diff --git a/.gitignore b/.gitignore
index f6636d015e..9658daad89 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,8 +7,10 @@
*.rpm.md5
*.log
/sqled
-/sqled.yml*
+/sqled.yml
+etc
/swag
bin/
ui/
+static/
.vscode/
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 6062038513..79c8f8385f 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
override GIT_VERSION = $(shell git rev-parse --abbrev-ref HEAD)${CUSTOM} $(shell git rev-parse HEAD)
override GIT_COMMIT = $(shell git rev-parse HEAD)
override PROJECT_NAME = sqle
-override LDFLAGS = -ldflags "-X 'main.version=\"${GIT_VERSION}\"'"
+override LDFLAGS = -ldflags "-X 'main.version=${GIT_VERSION}'"
override DOCKER = $(shell which docker)
override GOOS = linux
override OS_VERSION = el7
@@ -31,6 +31,8 @@ EDITION ?= ce
GO_BUILD_TAGS = dummyhead
ifeq ($(EDITION),ee)
GO_BUILD_TAGS :=$(GO_BUILD_TAGS),enterprise
+else ifeq ($(EDITION),trial)
+ GO_BUILD_TAGS :=$(GO_BUILD_TAGS),enterprise,trial
endif
RELEASE = qa
ifeq ($(RELEASE),rel)
@@ -63,8 +65,8 @@ vet: swagger
GOOS=$(GOOS) GOARCH=amd64 go vet $$(GOOS=${GOOS} GOARCH=${GOARCH} go list ./...)
## Unit Test
-test: swagger
- cd $(PROJECT_NAME) && GOOS=$(GOOS) GOARCH=amd64 go test -v ./...
+test:
+ cd $(PROJECT_NAME) && GOOS=$(GOOS) GOARCH=amd64 go test -v ./... -count 1
clean:
GOOS=$(GOOS) GOARCH=$(GOARCH) go clean
@@ -77,6 +79,8 @@ install_sqled: swagger
install_scannerd:
GOOS=$(GOOS) GOARCH=$(GOARCH) go build $(GO_BUILD_FLAGS) ${LDFLAGS} -tags $(GO_BUILD_TAGS) -o $(GOBIN)/scannerd ./$(PROJECT_NAME)/cmd/scannerd
+dlv_install:
+ GOOS=$(GOOS) GOARCH=$(GOARCH) go build -gcflags "all=-N -l" $(GO_BUILD_FLAGS) ${LDFLAGS} -tags $(GO_BUILD_TAGS) -o $(GOBIN)/sqled ./$(PROJECT_NAME)/cmd/sqled
swagger:
GOARCH=amd64 go build -o ${shell pwd}/bin/swag ${shell pwd}/build/swag/main.go
rm -rf ${shell pwd}/sqle/docs
@@ -141,9 +145,9 @@ docker_rpm: docker_install
override SQLE_DOCKER_IMAGE ?= actiontech/$(PROJECT_NAME)-$(EDITION):$(PROJECT_VERSION)
-docker_image: fill_ui_dir docker_rpm
+docker_image:
cp $(shell pwd)/$(RPM_NAME) $(shell pwd)/sqle.rpm
- $(DOCKER) build -t $(SQLE_DOCKER_IMAGE) -f ./docker-images/sqle/Dockerfile .
+ $(DOCKER) build -t $(SQLE_DOCKER_IMAGE) -f ./docker-images/sqle/Dockerfile .
docker_start:
cd ./docker-images/sqle && SQLE_IMAGE=$(SQLE_DOCKER_IMAGE) docker-compose up -d
@@ -151,6 +155,16 @@ docker_start:
docker_stop:
cd ./docker-images/sqle && docker-compose down
+docker_rpm_with_dms: docker_install
+ $(DOCKER) run -v $(dir $(CURDIR))dms:/universe/dms -v $(shell pwd):/universe/sqle --user root --rm $(RPM_BUILD_IMAGE) sh -c "(mkdir -p /root/rpmbuild/SOURCES >/dev/null 2>&1);cd /root/rpmbuild/SOURCES; \
+ (tar zcf ${PROJECT_NAME}.tar.gz /universe/sqle /universe/dms --transform 's/universe/${PROJECT_NAME}-$(GIT_COMMIT)/' > /tmp/build.log 2>&1) && \
+ (rpmbuild --define 'group_name $(RPM_USER_GROUP_NAME)' --define 'user_name $(RPM_USER_NAME)' \
+ --define 'commit $(GIT_COMMIT)' --define 'os_version $(OS_VERSION)' \
+ --target $(RPMBUILD_TARGET) -bb --with qa /universe/sqle/build/sqled_with_dms.spec >> /tmp/build.log 2>&1) && \
+ (cat ~/rpmbuild/RPMS/$(RPMBUILD_TARGET)/${PROJECT_NAME}-$(GIT_COMMIT)-qa.$(OS_VERSION).$(RPMBUILD_TARGET).rpm) || (cat /tmp/build.log && exit 1)" > $(RPM_NAME) && \
+ md5sum $(RPM_NAME) > $(RPM_NAME).md5
+
+
###################################### ui #####################################################
fill_ui_dir:
# fill ui dir, it is used by rpm build.
@@ -161,4 +175,4 @@ help:
$(warning ---------------------------------------------------------------------------------)
$(warning Supported Variables And Values:)
$(warning ---------------------------------------------------------------------------------)
- $(foreach v, $(.VARIABLES), $(if $(filter file,$(origin $(v))), $(info $(v)=$($(v)))))
\ No newline at end of file
+ $(foreach v, $(.VARIABLES), $(if $(filter file,$(origin $(v))), $(info $(v)=$($(v)))))
diff --git a/README.md b/README.md
index 564928d637..e28e99fe62 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,14 @@
-
+
+
+
+
+
一个支持多种不同类型数据库,覆盖事前控制、事后监督、标准发布场景,帮助您建立质量规范的SQL全生命周期质量管理平台。
+
每周发版,快速迭代中
+
简体中文 | [English](./README_en.md)
+
[](https://github.com/actiontech/sqle/releases)
[](https://github.com/actiontech/sqle/blob/main/LICENSE)
[](https://github.com/actiontech/sqle/stargazers)
@@ -9,52 +16,150 @@
[](https://github.com/actiontech/sqle/issues?q=is%3Aissue+is%3Aclosed)
[](https://hub.docker.com/r/actiontech/sqle-ce)
-SQLE 由上海爱可生信息技术股份有限公司(以下简称爱可生公司)出品和维护,是爱可生公司[云树®SQL质量管理软件SQLE](https://www.actionsky.com/sqle)(简称:CTREE SQLE)软件产品的开源版本。SQLE 是一个支持多场景,原生支持 MySQL 审核且数据库类型可扩展的 SQL 审核工具。
+
+
+
+
+
+
+# 🔍 SQLE是什么
+SQLE 是爱可生自主研发支持多元数据库的 SQL 质量管理平台。应用于开发、测试、上线发布、生产运行阶段的 SQL 质量治理。通过 “建立规范、事前控制、事后监督、标准发布” 的方式,为企业提供 SQL 全生命周期质量管控能力,规避业务 SQL 不规范引起的生产事故,提高业务稳定性,也可推动企业内部开发规范快速落地。
+
+# 📌 功能特性
+### 更丰富的数据源支持
+
+ 支持主流商业和开源数据库,包括 MySQL、PostgreSQL、Oracle、SQL Server、DB2、TiDB、OceanBase 等,持续增加新的数据源类型,以满足您不同的需求。
+
+### 更全面的审核规则
+
+ 审核规则源自我们经验丰富的 DBA 运维专家团队多年的技术积累。您可以借助我们的审核规则快速达到专家级的 SQL 诊断能力,并且我们的规则库目前已经拥有规则 700+,并在不断增加中。
+
+### 更智能的 SQL 采集
+
+ 提供多种智能扫描方式,例如慢日志、JAVA 应用等,以满足您的事前和事后 SQL 采集需求。一旦配置完成,我们的系统会自动持续采集各业务库中的 SQL,极大地减轻了您对 SQL 监督的压力,并及时发现问题 SQL。
+
+### 更高效的审批流转路径
+
+ 提供标准化的工作流,化解了在沟通和进度追踪上的难题,从而提升了上线效率。您可以通过与飞书、钉钉等多种消息通道的对接,及时了解更新进度,减少了沟通交流的成本。
+
+### 更便捷的 SQL 数据操作
+
+ 集成了在线数据库客户端 CloudBeaver,无需安装,通过可视化界面进行数据库管理和查询,提升了数据操作的易用性和效率。
+
+### 全生命周期的 SQL 管控
+
+ 提供 SQL 全流程的管控视角,帮助您统一管理SQL质量。您可以追踪问题SQL的解决进度,并提供快捷的优化功能,以提升 SQL 的效率。
+
+查看更多[社区版与企业版对比](https://actiontech.github.io/sqle-docs/docs/support/compare)。
+
+# 💡 使用场景
+
+
+ SQL 太复杂,执行性能低,如何优化?
+
+ 知识赋能,助您构建质量规范、提升 SQL 质量。提供审核规则及规则知识库,将专家经验赋能开发,快速提升问题 SQL 诊断能力,并支持私有云用户自主沉淀。
+
+- **从审核结果看 SQL 优化方向**
+
+ 平台提供丰富的审核规则,用以覆盖不同 SQL 审核场景,您可以根据触发的规则,有针对性地优化 SQL。
+
+- **从知识库了解问题解决经验**
-[官方网站](https://opensource.actionsky.com/sqle/) | [文档](https://actiontech.github.io/sqle-docs/docs/intro/) | [安装](https://actiontech.github.io/sqle-docs/docs/deploy-manual/intro) | [在线体验](https://actiontech.github.io/sqle-docs/docs/online-demo)
+ 每个规则包含对应的知识库,是运维专家的经验沉淀,您可以借鉴并强化自身的运维认知。
+
+- **对知识库做自主沉淀**
-## 产品展示
-
+ 除了平台提供的知识库信息,我们还支持私有云用户在知识库中进行自主沉淀,建立您的质量规范。
+
+
-[更多产品展示](https://actiontech.github.io/sqle-docs-cn/0.overview/2_product_show.html)
+
+ 应用数量多,SQL 采集难,如何摆脱重复劳动?
-## 产品特色
+提供智能扫描任务,可以自动持续采集不同来源的 SQL,帮助您摆脱重复劳动,极大地降低 SQL 采集难度。同时,根据不同业务要求定期巡检和生成审核报告,快速发现问题并提供优化建议。
-|特色|说明|
-|--|--|
-|SQL审核规范 |1. 审核规则自定义(700+) 2. 支持审核结果分级展示,支持生成下载审核报告 3. 支持规则模版,灵活组合规则 4. 审核白名单,跳过特例 SQL 5. 支持集成 IDE 自助审核 |
-| 多场景审核 | 支持事前事后审核,覆盖开发、测试、上线、生产等环节
-| 标准化上线流程 | 1. SQL 审核流程按需自定义,满足企业内部不同流程管理要求 2. 支持定时上线 3. 支持设置运维时间 4. 支持 Online DDL |
-| 多数据库类型支持 | 1. 统一接口,可通过插件进行多数据库审核扩展 2. 内置 MySQL 审核插件,官方支持常用数据库类型(包括:PostgreSQL、DB2、SQL Server、Oracle、TiDB、OceanBase) |
-| 统一的 SQL 客户端入口 | 提供审核管控的 SQL 客户端,杜绝执行不合规 SQL|
-| 丰富的集成能力 | 1. 标准 HTTP API 接口可与客户内部流程系统对接 2. 支持 LDAP,OAuth2.0 用户对接 3. 支持邮件、微信企业号、webhook 告警对接 |
+- **配置扫描任务,释放 SQL 采集负担**
-## 应用场景
-|场景|介绍|
-| --- | --- |
-| 上线前控制 | 1. SQLE 赋能开发,在代码开发阶段检查 SQL 质量 2. SQLE 集成专家经验,形成可复用的 SQL 规范标准规则,用户在平台提交工单后,平台将基于审核规则模板对提交的 SQL 语句进行初审,用以解决事前审核规范不标准难题|
-|上线后监督| 1. SQLE 提供智能扫描审核功能,实现生产环境下的 SQL 审核优化 2. SQLE 支持多种类型的扫描任务,基于任务需求执行周期性的扫描任务,并生成扫描结果报告,及时告警|
+ 平台支持十余种扫描任务类型,支持采集不同来源的 SQL,如:JAVA 应用程序、慢日志文件、TopSQL、MyBatis 文件等。
-## 在线体验
+- **定期持续巡检,提前发现问题 SQL**
+
+ 平台将根据配置的采集周期,为您自动、持续采集相应 SQL。
+
+ 平台将根据配置的审核规则模板,定期巡检和生成审核报告,有助于您及时发现问题 SQL,并提供优化方向。
+
+
-| 社区版 | 企业版 |
-| --- | --- |
-| [SQLE 社区版](http://demo.sqle.actionsky.com/) | [SQLE 企业版](http://demo.sqle.actionsky.com:8889/) |
-| 超级管理员: admin 密码: admin | 超级管理员: admin 密码: admin |
+
+ 公司规模大,流程周转长,如何有效追踪进度?
+
+提供标准化工作流,帮助提高工作透明度和上线效率。您可以根据实际组织架构配置自定义审批流程模板,化解沟通和进度追踪难题。同时,平台支持与多种消息通道对接,可以及时更新进度,减少沟通成本。
-### 测试 MySQL
-|配置项|值|
+- **生成您的自定义审批流程**
+
+ 平台支持您根据自身实际业务,配置SQL审批、上线流程,适配不同业务的上线节奏,提升业务响应效率。
+
+- **配置消息推送渠道,快捷订阅变更**
+
+ 平台支持对接多种主流IM应用,您可以将 SQL 审核集成到日常工作流中,协同办公,提升工作效率。
+
+
+
+
+ SQL 变更频,审批瓶颈大,如何分散审核压力?
+
+将审核环节灵活嵌入到研发流程,从研发环节入手,减轻 DBA 审核压力。平台支持多种事前审核场景,将 SQL 审核前置到代码阶段,从源头实现降本增效。
+
+- **使用 IDE 插件,前置规范检查**
+
+ 可以使用 IDE 审核插件,在代码编写过程中进行实时审核和规范检查,实现编码即审核的效果。
+
+- **对接 CI/CD 流程,保证应用代码上线无忧**
+
+ 可以配置 CI/CD 审核流程,自动抓取代码变更中的 SQL,减少人工错误和代码缺陷,提高开发团队的效率和代码质量。
+
+
+
+
+
+# 🧩 快速开始
+
+## 在线试用
+ 我们同时提供了 SQLE 社区版 和 SQLE 企业版 的线上 DEMO 环境,登录后您可以轻松体验 SQLE 的丰富功能。
+
+- [SQLE 社区版](http://demo.sqle.actionsky.com/)
+- [SQLE 企业版](http://demo.sqle.actionsky.com:8889/)
+
+**登录信息**
+|user|password|
|---|---|
-| 地址 | 20.20.20.3 |
-| 端口 | 3306 |
-| 用户 | root |
-| 密码 | test
+|admin|admin|
+
+**您可以连接MySQL实例,进行测试**
+
+|variable|value|
+|---|---|
+|地址| 20.20.20.3|
+|端口| 3306|
+|用户| root|
+|密码| test|
> 注意事项
> 1. 该服务仅用于在线功能体验,请勿在生产环境使用;
> 2. 该测试服务数据会定期清理。
-## SQL 审核插件
+
+## 本地安装
+SQLE 提供了多种安装部署的方式,用户可以结合自己的环境和现状选择。初次体验或者测试使用的话建议使用docker-compose 或 docker 快速部署。
+
+部署方式:
+
+1. [源码安装](https://actiontech.github.io/sqle-docs/docs/deploy-manual/source)
+2. [RPM 部署](https://actiontech.github.io/sqle-docs/docs/deploy-manual/rpm)
+3. [Docker 部署](https://actiontech.github.io/sqle-docs/docs/deploy-manual/Docker)
+4. [Docker Compose部署](https://actiontech.github.io/sqle-docs/docs/deploy-manual/DockerCompose)
+
+## 插件开发
目前支持其他种类数据库的审核插件:
* [PostgreSQL](https://github.com/actiontech/sqle-pg-plugin)
* [Oracle](https://github.com/actiontech/sqle-oracle-plugin)
@@ -63,22 +168,24 @@ SQLE 由上海爱可生信息技术股份有限公司(以下简称爱可生公
更多了解:《[功能说明及开发手册](https://actiontech.github.io/sqle-docs/docs/dev-manual/plugins/intro) 》
-## 官方技术支持
-|渠道 | 链接 |
-| -- | -- |
-| 代码库 | [github.com/actiontech/sqle](https://github.com/actiontech/sqle) |
-| UI 库 | [github.com/actiontech/sqle-ui](https://github.com/actiontech/sqle-ui) |
-| 文档库 | [github.com/actiontech/sqle-docs](https://github.com/actiontech/sqle-docs) |
-| 文档主页 | [actiontech.github.io/sqle-docs](https://actiontech.github.io/sqle-docs/) |
-| 社区网站 | [opensource.actionsky.com](https://opensource.actionsky.com) |
-| 微信技术交流群 | 添加管理员:ActionOpenSource |
-| 开源社区微信公众号 |  |
+# 🧑🏻💻社区支持
+我们感谢您的关注与贡献,社区将引导您了解如何使用和贡献。欢迎以下方式加入社区:
+* [官方网站](https://opensource.actionsky.com/sqle/)
+* [文档手册](https://actiontech.github.io/sqle-docs/)
+* 微信交流群:请添加管理员微信 ActionOpenSource
+* 微信公众号:爱可生开源社区
+
+ 
+
+* 其他媒体 [Gitee](https://gitee.com/mirrors/SQLE?_from=gitee_search) | [思否](https://segmentfault.com/blog/sqle) | [开源中国](https://www.oschina.net/p/sqle) | [墨天轮](https://www.modb.pro/wiki/2759) | [CSDN](https://blog.csdn.net/ActionTech) | [稀土掘金](https://juejin.cn/column/7241238544252829753) | [知乎](https://www.zhihu.com/people/Actionsky-86-50/columns)
+
+🤗 欢迎将体验中产生的 Bug、问题和需求提交到 [SQLE GitHub Issue](https://github.com/actiontech/sqle/issues)。
-## 联系我们
-如果想获得 SQLE 的商业支持, 您可以联系我们:
+# 📞 商业支持
+如果您想获得 SQLE 的商业支持, 您可以联系我们:
* 全国支持: 400-820-6580
* 华北地区: 86-13910506562, 汪先生
* 华南地区: 86-18503063188, 曹先生
* 华东地区: 86-18930110869, 梁先生
-* 西南地区: 86-13540040119, 洪先生
+* 西南地区: 86-13540040119, 洪先生
\ No newline at end of file
diff --git a/build/sqled.spec b/build/sqled.spec
index 10f394c9cd..bef3d87ee9 100644
--- a/build/sqled.spec
+++ b/build/sqled.spec
@@ -38,11 +38,14 @@ Acitontech Sqle
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/local/sqle/bin
mkdir -p %{_builddir}/%{buildsubdir}/sqle/plugins
+mkdir -p $RPM_BUILD_ROOT/usr/local/sqle/scripts
cp %{_builddir}/%{buildsubdir}/sqle/bin/sqled $RPM_BUILD_ROOT/usr/local/sqle/bin/sqled
cp %{_builddir}/%{buildsubdir}/sqle/bin/scannerd $RPM_BUILD_ROOT/usr/local/sqle/bin/scannerd
cp -R %{_builddir}/%{buildsubdir}/sqle/plugins $RPM_BUILD_ROOT/usr/local/sqle/plugins
-cp -R %{_builddir}/%{buildsubdir}/sqle/scripts $RPM_BUILD_ROOT/usr/local/sqle/scripts
-cp -R %{_builddir}/%{buildsubdir}/sqle/ui $RPM_BUILD_ROOT/usr/local/sqle/ui
+cp %{_builddir}/%{buildsubdir}/sqle/scripts/sqled.systemd $RPM_BUILD_ROOT/usr/local/sqle/scripts/sqled.systemd
+cp %{_builddir}/%{buildsubdir}/sqle/scripts/sqled.initd $RPM_BUILD_ROOT/usr/local/sqle/scripts/sqled.initd
+cp %{_builddir}/%{buildsubdir}/sqle/scripts/pt-online-schema-change.template $RPM_BUILD_ROOT/usr/local/sqle/scripts/pt-online-schema-change.template
+# cp -R %{_builddir}/%{buildsubdir}/sqle/ui $RPM_BUILD_ROOT/usr/local/sqle/ui
##########
@@ -102,25 +105,30 @@ mkdir -p $RPM_INSTALL_PREFIX/logs
mkdir -p $RPM_INSTALL_PREFIX/etc
cat > $RPM_INSTALL_PREFIX/etc/sqled.yml.template< $RPM_INSTALL_PREFIX/etc/gh-ost.ini</dev/null 2>&1
+if [ $? -eq 0 ]; then
+ if [ ! -d "/lib/systemd/system" ];then
+ mkdir -p /lib/systemd/system
+ chmod 0755 /lib/systemd/system
+ fi
+fi
+
+#create group & user
+(which nologin 1>/dev/null 2>&1) || (echo "require nologin" && exit 11)
+(which bash 1>/dev/null 2>&1) || (echo "require bash" && exit 12)
+(which pkill 1>/dev/null 2>&1) || (echo "require pkill" && exit 13)
+(getent group %{group_name} 1>/dev/null 2>&1) || groupadd -g 5700 %{group_name}
+(id %{user_name} 1>/dev/null 2>&1) || (useradd -M -g %{group_name} -s $(which nologin) -u 5700 %{user_name} && chage -M 99999 %{user_name})
+
+
+#check bash env
+bash -c "" 2>&1 | grep -e 'warning' -e 'error'
+if [ $? -eq 0 ]; then
+ exit 14
+fi
+
+##########
+
+%post
+
+#service
+grep systemd /proc/1/comm 1>/dev/null 2>&1
+if [ $? -eq 0 ]; then
+ sed -e "s|PIDFile=|PIDFile=$RPM_INSTALL_PREFIX\/sqled.pid|g" \
+ -e "s|User=|User=actiontech-universe|g" \
+ -e "s|ExecStart=|ExecStart=/bin/sh -c 'exec $RPM_INSTALL_PREFIX\/bin\/sqled --config $RPM_INSTALL_PREFIX\/etc\/config.yaml --pidfile=$RPM_INSTALL_PREFIX\/sqled.pid >>$RPM_INSTALL_PREFIX\/std.log 2>\&1'|g" \
+ -e "s|WorkingDirectory=|WorkingDirectory=$RPM_INSTALL_PREFIX|g" \
+ $RPM_INSTALL_PREFIX/scripts/sqled.systemd > /lib/systemd/system/sqled.service
+ sed -e "s|PIDFile=|PIDFile=$RPM_INSTALL_PREFIX\/dms.pid|g" -e "s|User=|User=actiontech-universe|g" -e "s|ExecStart=|ExecStart=$RPM_INSTALL_PREFIX\/bin\/dms -conf $RPM_INSTALL_PREFIX\/etc\/config.yaml|g" -e "s|WorkingDirectory=|WorkingDirectory=$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/scripts/dms.systemd > /lib/systemd/system/dms.service
+ systemctl daemon-reload
+ systemctl enable sqled.service
+ systemctl enable dms.service
+fi
+
+mkdir -p $RPM_INSTALL_PREFIX/logs
+# mkdir -p $RPM_INSTALL_PREFIX/etc
+
+
+if [ $1 -eq 1 ]; then
+cat >> $RPM_INSTALL_PREFIX/etc/config.yaml< $RPM_INSTALL_PREFIX/etc/gh-ost.ini</dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ systemctl stop sqled.service || true
+ else
+ service sqled stop || true
+ fi
+fi
+
+function kill_and_wait {
+ pidfile=$1
+ if [ -e $pidfile ]; then
+ kill $(cat $pidfile) &>/dev/null
+ fi
+ for i in {1..60}; do
+ if [ ! -e $pidfile ]; then
+ return 0
+ fi
+ kill -0 $(cat $pidfile) &>/dev/null
+ if [ $? -ne 0 ]; then
+ return 0
+ fi
+ sleep 1
+ done
+ return 1
+}
+
+if [ "$1" = "0" ]; then
+ kill_and_wait $RPM_INSTALL_PREFIX/sqled.pid
+ if [ $? -ne 0 ]; then
+ (>&2 echo "wait sqled pid shutdown timeout")
+ exit 1
+ fi
+ kill_and_wait $RPM_INSTALL_PREFIX/dms.pid
+ if [ $? -ne 0 ]; then
+ (>&2 echo "wait dms pid shutdown timeout")
+ exit 1
+ fi
+fi
+
+##########
+
+%postun
+
+if [ "$1" = "0" ]; then
+ grep systemd /proc/1/comm 1>/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ systemctl disable sqled.service || true
+ rm -f /lib/systemd/system/sqled.service || true
+ systemctl disable dms.service || true
+ rm -f /lib/systemd/system/dms.service || true
+ systemctl daemon-reload
+ systemctl reset-failed sqled.service || true
+ systemctl reset-failed dms.service || true
+ else
+ chkconfig --del sqled || true
+ rm -f /etc/init.d/sqled || true
+ chkconfig --del dms || true
+ rm -f /etc/init.d/dms || true
+ fi
+fi
+
+##########
+
+%files
+%defattr(-,root,root)
+/usr/local/%{name}/bin/sqled
+/usr/local/%{name}/bin/scannerd
+/usr/local/%{name}/bin/dms
+/usr/local/%{name}/plugins
+/usr/local/%{name}/scripts/*
+/usr/local/%{name}/static/*
+/usr/local/%{name}/etc/config.yaml
+
+
+%config /usr/local/%{name}/etc/config.yaml
diff --git a/docker-images/sqle/Dockerfile b/docker-images/sqle/Dockerfile
index 4e51c9028b..95348cd5b0 100644
--- a/docker-images/sqle/Dockerfile
+++ b/docker-images/sqle/Dockerfile
@@ -30,7 +30,8 @@ ENV MYSQL_HOST ""
ENV MYSQL_PORT 3306
ENV MYSQL_USER ""
ENV MYSQL_PASSWORD ""
-ENV MYSQL_SCHEMA ""
+ENV MYSQL_DMS_SCHEMA ""
+ENV MYSQL_SQLE_SCHEMA ""
ENV DEBUG false
ENV AUTO_MIGRATE_TABLE true
diff --git a/docker-images/sqle/docker-compose.yaml b/docker-images/sqle/docker-compose.yaml
index f0afc7fd4e..5648f1d470 100644
--- a/docker-images/sqle/docker-compose.yaml
+++ b/docker-images/sqle/docker-compose.yaml
@@ -14,12 +14,14 @@ services:
- sqle_net
ports:
- 10000:10000
+ - 10001:10001
environment:
- MYSQL_HOST=20.20.20.2
- MYSQL_PORT=3306
- MYSQL_USER=root
- MYSQL_PASSWORD=mysqlpass
- - MYSQL_SCHEMA=sqle
+ - MYSQL_SQLE_SCHEMA=sqle
+ - MYSQL_DMS_SCHEMA=dms
depends_on:
- mysql-for-sqle
command: bash -c "sleep 10 && /opt/start.sh"
@@ -41,6 +43,8 @@ services:
environment:
- MYSQL_ROOT_PASSWORD=mysqlpass
- MYSQL_DATABASE=sqle
+ volumes:
+ - ./init:/docker-entrypoint-initdb.d
command: ['mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci']
networks:
diff --git a/docker-images/sqle/init/db.sql b/docker-images/sqle/init/db.sql
new file mode 100644
index 0000000000..5a0c67ec83
--- /dev/null
+++ b/docker-images/sqle/init/db.sql
@@ -0,0 +1 @@
+CREATE DATABASE IF NOT EXISTS `dms`;
\ No newline at end of file
diff --git a/docker-images/sqle/start.sh b/docker-images/sqle/start.sh
index 7f3f7a472b..ad00e4821e 100644
--- a/docker-images/sqle/start.sh
+++ b/docker-images/sqle/start.sh
@@ -1,27 +1,74 @@
#!/bin/bash
SQLE_BASE="/opt/sqle"
-SQLE_CONF="${SQLE_BASE}/etc/sqled.yml"
+CONF="${SQLE_BASE}/etc/config.yml"
-if [ ! -f "${SQLE_CONF}" ];then
- cat > ${SQLE_CONF} < ${CONF} < /dev/null; do
+ sleep 1
+done
+# 启动sqle
+./bin/sqled --config ${CONF}
diff --git a/go.mod b/go.mod
index 63a584b087..7844ef063b 100644
--- a/go.mod
+++ b/go.mod
@@ -3,9 +3,9 @@ module github.com/actiontech/sqle
go 1.19
require (
- github.com/99designs/gqlgen v0.17.20
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/Masterminds/semver/v3 v3.1.1
+ github.com/actiontech/dms v0.0.0-20231129083427-a97a77db08e0
github.com/actiontech/java-sql-extractor v0.0.0-20231103015812-cdd5fc040f62
github.com/actiontech/mybatis-mapper-2-sql v0.5.0
github.com/agiledragon/gomonkey v2.0.2+incompatible
@@ -19,6 +19,7 @@ require (
github.com/alibabacloud-go/tea-utils/v2 v2.0.1
github.com/baidubce/bce-sdk-go v0.9.151
github.com/bwmarrin/snowflake v0.3.0
+ github.com/clbanning/mxj/v2 v2.5.6 // indirect
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548
github.com/cznic/parser v0.0.0-20181122101858-d773202d5b1f
github.com/cznic/sortutil v0.0.0-20181122101858-f5f958428db8
@@ -26,15 +27,19 @@ require (
github.com/cznic/y v0.0.0-20181122101901-b05e8c2e8d7b
github.com/denisenkom/go-mssqldb v0.9.0
github.com/facebookgo/grace v0.0.0-20180706040059-75cf19382434
- github.com/fatih/color v1.9.0
+ github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect
+ github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 // indirect
+ github.com/fatih/color v1.13.0
github.com/github/gh-ost v1.1.3-0.20210727153850-e484824bbd68
github.com/go-git/go-git/v5 v5.9.0
github.com/go-ini/ini v1.63.2
- github.com/go-ldap/ldap/v3 v3.4.1
- github.com/go-playground/locales v0.14.0
- github.com/go-playground/universal-translator v0.18.0
- github.com/go-playground/validator/v10 v10.9.0
- github.com/go-sql-driver/mysql v1.6.0
+ github.com/go-openapi/jsonreference v0.19.4 // indirect
+ github.com/go-openapi/spec v0.19.8 // indirect
+ github.com/go-openapi/swag v0.19.9 // indirect
+ github.com/go-playground/locales v0.14.1
+ github.com/go-playground/universal-translator v0.18.1
+ github.com/go-playground/validator/v10 v10.14.1
+ github.com/go-sql-driver/mysql v1.7.0
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/golang/protobuf v1.5.3
github.com/hashicorp/go-hclog v0.14.1
@@ -42,8 +47,10 @@ require (
github.com/jackc/pgx/v4 v4.13.0
github.com/jinzhu/gorm v1.9.15
github.com/jmoiron/sqlx v1.3.3
- github.com/labstack/echo/v4 v4.6.1
- github.com/larksuite/oapi-sdk-go/v3 v3.0.18
+ github.com/labstack/echo/v4 v4.10.2
+ github.com/larksuite/oapi-sdk-go/v3 v3.0.23
+ github.com/mattn/go-runewidth v0.0.9 // indirect
+ github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
github.com/openark/golib v0.0.0-20210531070646-355f37940af8
github.com/percona/go-mysql v0.0.0-20210427141028-73d29c6da78c
github.com/pingcap/parser v3.0.12+incompatible
@@ -53,24 +60,22 @@ require (
github.com/sijms/go-ora/v2 v2.2.15
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cobra v1.1.1
- github.com/stretchr/testify v1.7.1
+ github.com/stretchr/testify v1.8.4
github.com/swaggo/echo-swagger v1.0.0
github.com/swaggo/swag v1.6.7
github.com/ungerik/go-dry v0.0.0-20210209114055-a3e162a9e62e
github.com/urfave/cli/v2 v2.8.1
- github.com/vektah/gqlparser/v2 v2.5.1
golang.org/x/net v0.15.0
- google.golang.org/grpc v1.39.0
- gopkg.in/chanxuehong/wechat.v1 v1.0.0-20171118020122-aad7e298d1e7
- gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
+ google.golang.org/grpc v1.50.1
gopkg.in/natefinch/lumberjack.v2 v2.0.0
gopkg.in/yaml.v2 v2.4.0
vitess.io/vitess v0.12.0
)
+require github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.69
+
require (
dario.cat/mergo v1.0.0 // indirect
- github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c // indirect
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
@@ -78,7 +83,6 @@ require (
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/acomagu/bufpipe v1.0.4 // indirect
- github.com/agnivade/levenshtein v1.1.1 // indirect
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4 // indirect
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect
github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect
@@ -86,32 +90,30 @@ require (
github.com/alibabacloud-go/tea-xml v1.1.2 // indirect
github.com/aliyun/credentials-go v1.1.2 // indirect
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
- github.com/chanxuehong/util v0.0.0-20200304121633-ca8141845b13 // indirect
- github.com/clbanning/mxj/v2 v2.5.6 // indirect
+ github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
- github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
+ github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/cznic/golex v0.0.0-20181122101858-9c343928389c // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c // indirect
github.com/facebookgo/freeport v0.0.0-20150612182905-d4adf43b75b9 // indirect
- github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect
- github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 // indirect
+ github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 // indirect
- github.com/go-asn1-ber/asn1-ber v1.5.1 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/go-mysql-org/go-mysql v1.3.0 // indirect
github.com/go-ole/go-ole v1.2.4 // indirect
+ github.com/go-openapi/errors v0.20.3 // indirect
github.com/go-openapi/jsonpointer v0.19.3 // indirect
- github.com/go-openapi/jsonreference v0.19.4 // indirect
- github.com/go-openapi/spec v0.19.8 // indirect
- github.com/go-openapi/swag v0.19.9 // indirect
+ github.com/go-openapi/strfmt v0.21.7 // indirect
+ github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb // indirect
+ github.com/iancoleman/strcase v0.3.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.10.0 // indirect
@@ -122,19 +124,19 @@ require (
github.com/jackc/pgtype v1.8.1 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
- github.com/jinzhu/now v1.1.1 // indirect
- github.com/json-iterator/go v1.1.11 // indirect
+ github.com/json-iterator/go v1.1.12 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
- github.com/labstack/gommon v0.3.0 // indirect
- github.com/leodido/go-urn v1.2.1 // indirect
+ github.com/labstack/gommon v0.4.0 // indirect
+ github.com/leodido/go-urn v1.2.4 // indirect
github.com/mailru/easyjson v0.7.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
- github.com/mattn/go-isatty v0.0.16 // indirect
- github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
+ github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mitchellh/go-testing-interface v1.14.0 // indirect
+ github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
- github.com/modern-go/reflect2 v1.0.1 // indirect
+ github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/oklog/run v1.0.0 // indirect
+ github.com/oklog/ulid v1.3.1 // indirect
github.com/opentracing/opentracing-go v1.1.0 // indirect
github.com/pingcap/errors v0.11.5-0.20201126102027-b0a155152ca3 // indirect
github.com/pingcap/log v0.0.0-20210317133921-96f4fcab92a4 // indirect
@@ -152,11 +154,12 @@ require (
github.com/skeema/knownhosts v1.2.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14 // indirect
- github.com/tjfoc/gmsm v1.3.2 // indirect
+ github.com/tjfoc/gmsm v1.4.1 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
- github.com/valyala/fasttemplate v1.2.1 // indirect
+ github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
+ go.mongodb.org/mongo-driver v1.12.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.17.0 // indirect
@@ -165,17 +168,18 @@ require (
golang.org/x/mod v0.12.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
- golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
+ golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.13.0 // indirect
google.golang.org/genproto v0.0.0-20210701191553-46259e63a0a9 // indirect
google.golang.org/protobuf v1.28.0 // indirect
- gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
- gopkg.in/ini.v1 v1.62.0 // indirect
+ gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
replace (
+ cloud.google.com/go/compute/metadata => cloud.google.com/go/compute/metadata v0.1.0
+ github.com/labstack/echo/v4 => github.com/labstack/echo/v4 v4.6.1
github.com/pingcap/log => github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9
github.com/pingcap/parser => github.com/sjjian/parser v0.0.0-20231122073510-03e191068cf1
google.golang.org/grpc => google.golang.org/grpc v1.29.0
diff --git a/go.sum b/go.sum
index f03c2d3aca..1b5e8dd4e4 100644
--- a/go.sum
+++ b/go.sum
@@ -19,13 +19,8 @@ cloud.google.com/go/storage v1.10.0 h1:STgFzyU5/8miMl0//zKh2aQeTyeaUH3WN9bSUiJ09
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
-github.com/99designs/gqlgen v0.17.20 h1:O7WzccIhKB1dm+7g6dhQcULINftfiLSBg2l/mwbpJMw=
-github.com/99designs/gqlgen v0.17.20/go.mod h1:Mja2HI23kWT1VRH09hvWshFgOzKswpO20o4ScpJIES4=
-github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c h1:/IBSNwUN8+eKzUzbJPqhK839ygXJ82sde8x3ogr6R28=
-github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I=
-github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
@@ -53,15 +48,16 @@ github.com/VividCortex/ewma v1.1.1 h1:MnEK4VOv6n0RSY4vtRe3h11qjxL3+t0B8yOL8iMXdc
github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA=
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/actiontech/dms v0.0.0-20231129060158-ff9d70a10557 h1:eeJqVzkX5X5gMfaN67X2wCFbqoVfbDgIsoSYeJJfCzs=
+github.com/actiontech/dms v0.0.0-20231129060158-ff9d70a10557/go.mod h1:jG8WjxiSBcUccweOqRPONDx95j88FwZytoa1/PI8I44=
+github.com/actiontech/dms v0.0.0-20231129083427-a97a77db08e0 h1:BZlpGNWg6aJhFcWZc17VHlOLWHvuxJZIKFY5ePlY5ZQ=
+github.com/actiontech/dms v0.0.0-20231129083427-a97a77db08e0/go.mod h1:jG8WjxiSBcUccweOqRPONDx95j88FwZytoa1/PI8I44=
github.com/actiontech/java-sql-extractor v0.0.0-20231103015812-cdd5fc040f62 h1:JM7WnLzlvXOGE90KKd+aigi+qUDS+U5dLwQMNpTKZxE=
github.com/actiontech/java-sql-extractor v0.0.0-20231103015812-cdd5fc040f62/go.mod h1:adDZHhAf2LRMx2h0JzofPXn12x2XlyQjVE116KXquwo=
github.com/actiontech/mybatis-mapper-2-sql v0.5.0 h1:TGovwZpLT+DUE5W0ZeSNE//LQLpVuQx8ghx0r8rPVBY=
github.com/actiontech/mybatis-mapper-2-sql v0.5.0/go.mod h1:ZMmUEDfbjm8oWxSAZkejqeOzlXa1BWNCfhNIxCMu7lw=
github.com/agiledragon/gomonkey v2.0.2+incompatible h1:eXKi9/piiC3cjJD1658mEE2o3NjkJ5vDLgYjCQu0Xlw=
github.com/agiledragon/gomonkey v2.0.2+incompatible/go.mod h1:2NGfXu1a80LLr2cmWXGBDaHEjb1idR6+FVlX5T3D9hw=
-github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
-github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8=
-github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
@@ -102,8 +98,6 @@ github.com/alibabacloud-go/tea-xml v1.1.2 h1:oLxa7JUXm2EDFzMg+7oRsYc+kutgCVwm+bZ
github.com/alibabacloud-go/tea-xml v1.1.2/go.mod h1:Rq08vgCcCAjHyRi/M7xlHKUykZCEtyBy9+DPF6GgEu8=
github.com/aliyun/credentials-go v1.1.2 h1:qU1vwGIBb3UJ8BwunHDRFtAhS6jnQLnde/yk0+Ih2GY=
github.com/aliyun/credentials-go v1.1.2/go.mod h1:ozcZaMR5kLM7pwtCMEpVmQ242suV6qTJya2bDq4X1Tw=
-github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ=
-github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
@@ -111,13 +105,13 @@ github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8
github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g=
github.com/appleboy/gin-jwt/v2 v2.6.3/go.mod h1:MfPYA4ogzvOcVkRwAxT7quHOtQmVKDpTwxyUrC2DNw0=
github.com/appleboy/gofight/v2 v2.1.2/go.mod h1:frW+U1QZEdDgixycTj4CygQ48yLTUhplt43+Wczp3rw=
-github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q=
-github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
+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/aws/aws-sdk-go v1.26.1/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go v1.30.24/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/aws/aws-sdk-go v1.34.2 h1:9vCknCdTAmmV4ht7lPuda7aJXzllXwEQyCMZKJHjBrM=
@@ -139,8 +133,6 @@ github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
-github.com/chanxuehong/util v0.0.0-20200304121633-ca8141845b13 h1:c1vUDbnwvu5d2ucfzXvMzBWzeu5IxPvtESOFPl3CieA=
-github.com/chanxuehong/util v0.0.0-20200304121633-ca8141845b13/go.mod h1:XEYt99iTxMqkv+gW85JX/DdUINHUe43Sbe5AtqSaDAQ=
github.com/cheggaaa/pb/v3 v3.0.1/go.mod h1:SqqeMF/pMOIu3xgGoxtPYhMNQP258xE4x/XRTYua+KU=
github.com/cheggaaa/pb/v3 v3.0.4 h1:QZEPYOj2ix6d5oEg63fbHmpolrnNiwjUsk+h74Yt4bM=
github.com/cheggaaa/pb/v3 v3.0.4/go.mod h1:7rgWxLrAUcFMkvJuv09+DYi7mMUYi8nO9iOWcvGJPfw=
@@ -177,8 +169,8 @@ github.com/corona10/goimagehash v1.0.2/go.mod h1:/l9umBhvcHQXVtQO1V6Gp1yD20STawk
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
-github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU=
-github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
+github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
+github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
@@ -214,8 +206,6 @@ github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUn
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA=
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
-github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+UbP35JkH8yB7MYb4q/qhBarqZE6g=
-github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA=
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dustin/go-humanize v0.0.0-20180421182945-02af3965c54e/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
@@ -241,13 +231,16 @@ github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqL
github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk=
github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
-github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
+github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
+github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsouza/fake-gcs-server v1.15.0/go.mod h1:HNxAJ/+FY/XSsxuwz8iIYdp2GtMmPbJ8WQjjGMxd6Qk=
github.com/fsouza/fake-gcs-server v1.17.0/go.mod h1:D1rTE4YCyHFNa99oyJJ5HyclvN/0uQR+pM/VdlL83bw=
+github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
+github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 h1:Mn26/9ZMNWSw9C9ERFA1PUxfmGpolnw2v0bKOREu5ew=
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32/go.mod h1:GIjDIg/heH5DOkXY3YJ/wNhfHsQHoXGjl8G8amsYQ1I=
@@ -261,8 +254,6 @@ github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmC
github.com/github/gh-ost v1.1.3-0.20210727153850-e484824bbd68 h1:0ExfTwWAmfgQ2IAwMJp3Xagm1hkMgy9wdwvApGCY388=
github.com/github/gh-ost v1.1.3-0.20210727153850-e484824bbd68/go.mod h1:KapUFjHOhrrWRyXCV7iZXfL3FGhTfe8Z6UQupU1MxoU=
github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY=
-github.com/go-asn1-ber/asn1-ber v1.5.1 h1:pDbRAunXzIUXfx4CB2QJFv5IuPiuoW+sWvr/Us009o8=
-github.com/go-asn1-ber/asn1-ber v1.5.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
github.com/go-bindata/go-bindata/v3 v3.1.3/go.mod h1:1/zrpXsLD8YDIbhZRqXzm1Ghc7NhEvIN9+Z6R5/xH4I=
github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
@@ -280,8 +271,6 @@ github.com/go-ini/ini v1.63.2/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3I
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
-github.com/go-ldap/ldap/v3 v3.4.1 h1:fU/0xli6HY02ocbMuozHAYsaHLcnkLjvho2r5a34BUU=
-github.com/go-ldap/ldap/v3 v3.4.1/go.mod h1:iYS1MdmrmceOJ1QOTnRXrIs7i3kloqtmGQjRvjKpyMg=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
@@ -291,6 +280,8 @@ github.com/go-mysql-org/go-mysql v1.3.0/go.mod h1:3lFZKf7l95Qo70+3XB2WpiSf9wu2s3
github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI=
github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
+github.com/go-openapi/errors v0.20.3 h1:rz6kiC84sqNQoqrtulzaL/VERgkoCyB6WdEkc2ujzUc=
+github.com/go-openapi/errors v0.20.3/go.mod h1:Z3FlZ4I8jEGxjUK+bugx3on2mIAk4txuAOhlsB1FSgk=
github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M=
github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg=
github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w=
@@ -306,30 +297,32 @@ github.com/go-openapi/spec v0.19.4/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8
github.com/go-openapi/spec v0.19.7/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk=
github.com/go-openapi/spec v0.19.8 h1:qAdZLh1r6QF/hI/gTq+TJTvsQUodZsM7KLqkAJdiJNg=
github.com/go-openapi/spec v0.19.8/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk=
+github.com/go-openapi/strfmt v0.21.7 h1:rspiXgNWgeUzhjo1YU01do6qsahtJNByjLVbPLNHb8k=
+github.com/go-openapi/strfmt v0.21.7/go.mod h1:adeGTkxE44sPyLk0JV235VQAO/ZXUr8KAzYjclFs3ew=
github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg=
github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
github.com/go-openapi/swag v0.19.8/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY=
github.com/go-openapi/swag v0.19.9 h1:1IxuqvBUU3S2Bi4YC7tlP9SJF1gVpCvqN0T2Qof4azE=
github.com/go-openapi/swag v0.19.9/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY=
-github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
-github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
+github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
-github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU=
-github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
+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/overalls v0.0.0-20180201144345-22ec1a223b7c/go.mod h1:UqxAgEOt89sCiXlrc/ycnx00LVvUO/eS8tMUkWX4R7w=
github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
-github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho=
-github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
-github.com/go-playground/validator/v10 v10.9.0 h1:NgTtmN58D0m8+UuxtYmGztBJB7VnPgjj221I1QHci2A=
-github.com/go-playground/validator/v10 v10.9.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos=
+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-playground/validator/v10 v10.14.1 h1:9c50NUPC30zyuKprjL3vNZ0m5oG+jU0zvx4AqHGnv4k=
+github.com/go-playground/validator/v10 v10.14.1/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/go-sql-driver/mysql v0.0.0-20170715192408-3955978caca4/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
-github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
+github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
+github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/goccy/go-graphviz v0.0.5/go.mod h1:wXVsXxmyMQU6TN3zGRttjNn3h+iCAS7xQFC6TlNvLhk=
github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw=
@@ -343,6 +336,8 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
+github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
+github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
@@ -364,6 +359,12 @@ github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
+github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
+github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
+github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
+github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
+github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
+github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
@@ -379,6 +380,7 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.2/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/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
@@ -392,12 +394,11 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4
github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf/go.mod h1:RpwtwJQFrIEPstU94h88MWPXP2ektJZ8cZ0YntAmXiE=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
-github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
+github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
-github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 h1:l5lAOZEym3oK3SQ2HBHWsJUfbNBiTXJDeW2QDxw9AQ0=
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
@@ -409,8 +410,6 @@ github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY
github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
-github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
-github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-middleware v1.1.0 h1:THDBEeQ9xZ8JEaCLyLQqXMMdRqNr0QAUJTIkQAUtFjg=
@@ -442,8 +441,6 @@ github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
-github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
-github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
@@ -452,9 +449,12 @@ github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/J
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb h1:b5rjCoWHc7eqmAS4/qyk21ZsHyb6Mxv/jykxvNTkU4M=
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
+github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.69 h1:gPBExK6wtglcrZmQ4yhjuR/oPMvB+k1RmXDXQEHUzLM=
+github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.69/go.mod h1:AZT3IyeViMA1qIoo6lM2eDobcTXORpqIQzSqdodah7E=
github.com/hypnoglow/gormzap v0.3.0/go.mod h1:5Wom8B7Jl2oK0Im9hs6KQ+Kl92w4Y7gKCrj66rhyvw0=
-github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334 h1:VHgatEHNcBFEB7inlalqfNqw65aNkM1lGX2yt3NmbS8=
github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE=
+github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
+github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
@@ -514,8 +514,7 @@ github.com/jinzhu/gorm v1.9.15/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBef
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
-github.com/jinzhu/now v1.1.1 h1:g39TucaRWyV3dwDO++eEc6qf8TVIQ/Da48WmqjZ3i7E=
-github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
+github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
@@ -530,12 +529,11 @@ github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
-github.com/json-iterator/go v1.1.11 h1:uVUAXhF2To8cbw/3xN3pxj6kk7TYKs98NIrTqPlMWAQ=
-github.com/json-iterator/go v1.1.11/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/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
-github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/juju/ratelimit v1.0.1 h1:+7AIFJVQ0EQgq/K9+0Krm7m530Du7tIz0METWzN0RgY=
github.com/juju/ratelimit v1.0.1/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk=
@@ -543,10 +541,10 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V
github.com/kevinburke/go-bindata v3.18.0+incompatible/go.mod h1:/pEEZ72flUW2p0yi30bslSp9YqD9pysLxunQDdb2CPM=
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/kevinmbeaulieu/eq-go v1.0.0/go.mod h1:G3S8ajA56gKBZm4UB9AOyoOS37JO3roToPzKNM8dtdM=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
+github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/cpuid v1.2.0 h1:NMpwD2G9JSFOE1/TJjGSo5zG7Yb2bTe7eq1jH+irmeE=
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
@@ -556,7 +554,6 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxv
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
-github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pty v1.0.0/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
@@ -565,25 +562,23 @@ github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
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/labstack/echo/v4 v4.0.0/go.mod h1:tZv7nai5buKSg5h/8E6zz4LsD/Dqh9/91Mvs7Z5Zyno=
github.com/labstack/echo/v4 v4.6.1 h1:OMVsrnNFzYlGSdaiYGHbgWQnr+JM7NG+B9suCPie14M=
github.com/labstack/echo/v4 v4.6.1/go.mod h1:RnjgMWNDB9g/HucVWhQYNQP9PvbYf6adqftqryo7s9k=
-github.com/labstack/gommon v0.2.8/go.mod h1:/tj9csK2iPSBvn+3NLM9e52usepMtrd5ilFYA+wQNJ4=
-github.com/labstack/gommon v0.3.0 h1:JEeO0bvc78PKdyHxloTKiF8BD5iGrH8T6MSeGvSgob0=
github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
-github.com/larksuite/oapi-sdk-go/v3 v3.0.18 h1:I91VJQMC2dpwIDMfF7RO0kQ+bg6X4+2RMMLrg/z6m5E=
-github.com/larksuite/oapi-sdk-go/v3 v3.0.18/go.mod h1:FKi8vBgtkBt/xNRQUwdWvoDmsPh7/wP75Sn5IBIBQLk=
+github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8=
+github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
+github.com/larksuite/oapi-sdk-go/v3 v3.0.23 h1:mn4pD4JXgzYbpc9TT0grGHPcYppYEmisKMHeTwULu5Q=
+github.com/larksuite/oapi-sdk-go/v3 v3.0.23/go.mod h1:FKi8vBgtkBt/xNRQUwdWvoDmsPh7/wP75Sn5IBIBQLk=
github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
-github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
-github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
+github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
+github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8=
github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
-github.com/logrusorgru/aurora/v3 v3.0.0/go.mod h1:vsR12bk5grlLvLXAYrBsb5Oc/N+LxAlxggSjiwMnCUc=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
@@ -594,7 +589,6 @@ github.com/mailru/easyjson v0.7.1 h1:mdxE1MF9o53iCb2Ghj1VfWvh7ZOwHpnVG/xwXrV90U8
github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=
github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A=
github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
-github.com/matryer/moq v0.2.7/go.mod h1:kITsx543GOENm48TUAQyJ9+SAvFSr7iGQXPoth/VUBk=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
@@ -602,6 +596,8 @@ github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
+github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
+github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
@@ -614,12 +610,14 @@ github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcME
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
-github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
+github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
+github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
-github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+twI54=
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
+github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
+github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
@@ -643,15 +641,17 @@ github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS4
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
-github.com/mitchellh/mapstructure v1.3.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
-github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag=
+github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
+github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
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.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
github.com/modern-go/reflect2 v1.0.1/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/montanaflynn/stats v0.0.0-20151014174947-eeaced052adb/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
+github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
github.com/montanaflynn/stats v0.0.0-20180911141734-db72e6cae808/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
github.com/montanaflynn/stats v0.5.0/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
@@ -664,6 +664,7 @@ github.com/nicksnyder/go-i18n v1.10.0/go.mod h1:HrK7VCrbOvQoUAQ7Vpy7i87N7JZZZ7R2
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
+github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA=
@@ -754,7 +755,6 @@ github.com/pingcap/tipb v0.0.0-20200522051215-f31a15d98fce h1:LDyY6Xh/Z/SHVQ10er
github.com/pingcap/tipb v0.0.0-20200522051215-f31a15d98fce/go.mod h1:RtkHW8WbcNxj8lsbzjaILci01CtYnYbIkQhjyZWrWVI=
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/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
@@ -798,8 +798,6 @@ github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzG
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
-github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
-github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
@@ -848,9 +846,7 @@ github.com/sjjian/parser v0.0.0-20231122073510-03e191068cf1/go.mod h1:Qq2tnreUXw
github.com/skeema/knownhosts v1.2.0 h1:h9r9cf0+u7wSE+M183ZtMGgOJKiL96brpaz5ekfJCpM=
github.com/skeema/knownhosts v1.2.0/go.mod h1:g4fPeYpque7P0xefxtGzV81ihjC8sX2IqpAoNkjxbMo=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
-github.com/smartystreets/assertions v1.1.0 h1:MkTeG1DMwsrdH7QtLXy5W+fUxWq+vmb6cLmyJ7aRtF0=
github.com/smartystreets/assertions v1.1.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
-github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ=
@@ -873,14 +869,19 @@ github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5q
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
+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/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.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
-github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
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.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
+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/struCoder/pidusage v0.1.2/go.mod h1:pWBlW3YuSwRl6h7R5KbvA4N8oOqe9LjaKW5CwT1SPjI=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/swaggo/echo-swagger v1.0.0 h1:ppQFt6Am3/MHIUmTpZOwi4gggMZ/W9zmKP4Z9ahTe5c=
@@ -904,8 +905,9 @@ github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2/go.mod h1:2PfK
github.com/tidwall/gjson v1.3.5/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls=
github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
-github.com/tjfoc/gmsm v1.3.2 h1:7JVkAn5bvUJ7HtU08iW6UiD+UTmJTIToHCfeFzkcCxM=
github.com/tjfoc/gmsm v1.3.2/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w=
+github.com/tjfoc/gmsm v1.4.1 h1:aMe1GlZb+0bLjn+cKTPEvvn9oUEBlJitaZiiBwsbgho=
+github.com/tjfoc/gmsm v1.4.1/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
@@ -938,26 +940,27 @@ github.com/urfave/cli/v2 v2.8.1/go.mod h1:Z41J9TPoffeoqP0Iza0YbAhGvymRdZAd2uPmZ5
github.com/urfave/negroni v0.3.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
-github.com/valyala/fasttemplate v0.0.0-20170224212429-dcecefd839c4/go.mod h1:50wTf68f99/Zt14pr046Tgt3Lp2vLyFZKzbFXTOabXw=
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
-github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4=
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
-github.com/vektah/gqlparser/v2 v2.5.1 h1:ZGu+bquAY23jsxDRcYpWjttRZrUz07LbiY77gUOHcr4=
-github.com/vektah/gqlparser/v2 v2.5.1/go.mod h1:mPgqFBu/woKTVYWyNk8cO3kh4S/f4aRFZrvOnp3hmCs=
+github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
+github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
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/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
+github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4=
+github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
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/yookoala/realpath v1.0.0/go.mod h1:gJJMA9wuX7AcqLy1+ffPatSCySA1FQ2S8Ya9AIoYBpE=
+github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.30/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
-github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
@@ -967,6 +970,8 @@ go.etcd.io/etcd v0.0.0-20190320044326-77d4b742cdbf/go.mod h1:KSGwdbiFchh5KIC9My2
go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
go.etcd.io/etcd v0.5.0-alpha.5.0.20191023171146-3cf2f69b5738 h1:lWF4f9Nypl1ZqSb4gLeh/DGvBYVaUYHuiB93teOmwgc=
go.etcd.io/etcd v0.5.0-alpha.5.0.20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
+go.mongodb.org/mongo-driver v1.12.0 h1:aPx33jmn/rQuJXPQLZQ8NtfPQG8CaqgLThFtqRb0PiE=
+go.mongodb.org/mongo-driver v1.12.0/go.mod h1:AZkxhPnFJUoH7kZlFkVKucV20K387miPfm7oimrSmK0=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
@@ -1002,7 +1007,6 @@ golang.org/x/crypto v0.0.0-20180608092829-8ac0e0d97ce4/go.mod h1:6SG95UA2DQfeDnf
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
-golang.org/x/crypto v0.0.0-20190130090550-b01c7a725664/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
@@ -1017,8 +1021,8 @@ golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
-golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
@@ -1028,6 +1032,7 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
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.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I=
golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@@ -1059,7 +1064,6 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
-golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
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.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
@@ -1096,17 +1100,18 @@ golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
+golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210224082022-3d97a244fca7/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210913180222-943fd674d43e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
-golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
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.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@@ -1134,7 +1139,6 @@ golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -1168,9 +1172,9 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -1179,6 +1183,8 @@ 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.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
@@ -1187,6 +1193,8 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX
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.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
+golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo=
golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -1196,17 +1204,20 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/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.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
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.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
+golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
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-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
-golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs=
-golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
+golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@@ -1251,7 +1262,6 @@ golang.org/x/tools v0.0.0-20200325203130-f53864d0dba1/go.mod h1:Sl4aGygMT6LrqrWc
golang.org/x/tools v0.0.0-20200509030707-2212a7e161a5/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20201125231158-b5590deeca9b/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
-golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
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.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
@@ -1297,6 +1307,12 @@ google.golang.org/genproto v0.0.0-20210701191553-46259e63a0a9 h1:HBPuvo39L0DgfVn
google.golang.org/genproto v0.0.0-20210701191553-46259e63a0a9/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U=
google.golang.org/grpc v1.29.0 h1:2pJjwYOdkZ9HlN4sWRYBg9ttH5bCOlsueaM+b/oYjwo=
google.golang.org/grpc v1.29.0/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
+google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
+google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
+google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
+google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
+google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
+google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
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.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
@@ -1306,10 +1322,6 @@ gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4
gopkg.in/alecthomas/gometalinter.v2 v2.0.12/go.mod h1:NDRytsqEZyolNuAgTzJkZMkSQM7FIKyzVzGhjB/qfYo=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20180810215634-df19058c872c/go.mod h1:3HH7i1SgMqlzxCcBmUHW657sD4Kvv9sC3HpL3YukzwA=
-gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk=
-gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk=
-gopkg.in/chanxuehong/wechat.v1 v1.0.0-20171118020122-aad7e298d1e7 h1:VqKldcu82X3eGPRiJ0M3ewTxCYpvKBxExGQJhmycwpU=
-gopkg.in/chanxuehong/wechat.v1 v1.0.0-20171118020122-aad7e298d1e7/go.mod h1:k8z0IA51BPvL3wX1QPXAVtBY2JQ7mEQwSBu+EJ0+4fI=
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=
@@ -1324,13 +1336,12 @@ gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8
gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y=
gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=
gopkg.in/go-playground/validator.v9 v9.31.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=
-gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE=
-gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw=
gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s=
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
-gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU=
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
+gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
+gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
diff --git a/image.png b/image.png
new file mode 100644
index 0000000000..0f862b4949
Binary files /dev/null and b/image.png differ
diff --git a/scripts/init_start.sh b/scripts/init_start.sh
new file mode 100644
index 0000000000..c03e1ef308
--- /dev/null
+++ b/scripts/init_start.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+# 本脚本用于在rpm安装完成后,启动dms服务和sqled服务
+
+detectSystemServiceStatus() {
+ detectedRunningTimes=0
+ for i in {1..30}; do
+ sleep 1
+ if systemctl status "$1" &>/dev/null; then
+ ((detectedRunningTimes++))
+ if [[ $detectedRunningTimes == 3 ]]; then
+ return 0
+ fi
+ else
+ detectedRunningTimes=0
+ fi
+ done
+
+ return 1
+}
+
+systemctl daemon-reload
+systemctl start dms.service
+
+# 10秒dms还没有启动成功退出
+if detectSystemServiceStatus "dms.service"; then
+ echo "init and start dms success!"
+else
+ echo "duration 30 seconds; start dms failed"
+ exit 3
+fi
+
+systemctl start sqled.service
+
+# 10秒sqle还没有启动成功退出
+if detectSystemServiceStatus "sqled.service"; then
+ echo "init and start sqled success!"
+else
+ echo "duration 30 seconds; start sqled failed"
+fi
\ No newline at end of file
diff --git a/spelling_dict.txt b/spelling_dict.txt
index 1e18e11a62..e6e13d7864 100644
--- a/spelling_dict.txt
+++ b/spelling_dict.txt
@@ -21,6 +21,7 @@ bigint
binlog
blkid
btree
+brazil
chinese
cidr
cardinalities
@@ -88,6 +89,8 @@ gracenet
grpc
gtids
gzipped
+huawei
+huaweicloud
hashicorp
hclog
hostname
@@ -128,6 +131,7 @@ longtext
looper
maxvalue
mdriver
+mexico
mediumblob
mediumint
mediumtext
diff --git a/sqle/api/app.go b/sqle/api/app.go
index 4544435294..c995568c5c 100644
--- a/sqle/api/app.go
+++ b/sqle/api/app.go
@@ -5,7 +5,9 @@ import (
"fmt"
"net/http"
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper"
+ dmsV1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+
+ // "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper"
"github.com/actiontech/sqle/sqle/api/controller"
v1 "github.com/actiontech/sqle/sqle/api/controller/v1"
v2 "github.com/actiontech/sqle/sqle/api/controller/v2"
@@ -14,8 +16,6 @@ import (
_ "github.com/actiontech/sqle/sqle/docs"
"github.com/actiontech/sqle/sqle/errors"
"github.com/actiontech/sqle/sqle/log"
- "github.com/actiontech/sqle/sqle/model"
- "github.com/actiontech/sqle/sqle/utils"
"github.com/facebookgo/grace/gracenet"
"github.com/labstack/echo/v4"
@@ -73,11 +73,11 @@ func addCustomApis(e *echo.Group, apis []restApi) error {
// @in header
// @name Authorization
// @BasePath /
-func StartApi(net *gracenet.Net, exitChan chan struct{}, config config.SqleConfig) {
+func StartApi(net *gracenet.Net, exitChan chan struct{}, config *config.SqleOptions) {
defer close(exitChan)
e := echo.New()
- output := log.NewRotateFile(config.LogPath, "/api.log", config.LogMaxSizeMB /*MB*/, config.LogMaxBackupNumber)
+ output := log.NewRotateFile(config.Service.LogPath, "/api.log", config.Service.LogMaxSizeMB /*MB*/, config.Service.LogMaxBackupNumber)
defer output.Close()
e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{
@@ -99,343 +99,261 @@ func StartApi(net *gracenet.Net, exitChan chan struct{}, config config.SqleConfi
e.GET("/swagger/*", echoSwagger.WrapHandler)
- e.POST("/v1/login", v1.LoginV1)
- e.POST("/v2/login", v2.LoginV2)
-
- // the operation of obtaining the basic information of the platform should be for all users, not the users who log in to the platform
- e.GET("/v1/basic_info", v1.GetSQLEInfo)
- e.GET("/v1/static/logo", v1.GetLogo)
-
- // oauth2 interface does not require login authentication
- e.GET("/v1/configurations/oauth2/tips", v1.GetOauth2Tips)
- e.GET("/v1/oauth2/link", v1.Oauth2Link)
- e.GET("/v1/oauth2/callback", v1.Oauth2Callback)
- e.POST("/v1/oauth2/user/bind", v1.BindOauth2User)
-
v1Router := e.Group(apiV1)
- v1Router.Use(sqleMiddleware.JWTTokenAdapter(), sqleMiddleware.JWTWithConfig(utils.JWTSecretKey), sqleMiddleware.VerifyUserIsDisabled(), sqleMiddleware.LicenseAdapter(), sqleMiddleware.OperationLogRecord())
+ v1Router.Use(sqleMiddleware.JWTTokenAdapter(), sqleMiddleware.JWTWithConfig(dmsV1.JwtSigningKey), sqleMiddleware.VerifyUserIsDisabled(), sqleMiddleware.OperationLogRecord())
v2Router := e.Group(apiV2)
- v2Router.Use(sqleMiddleware.JWTTokenAdapter(), sqleMiddleware.JWTWithConfig(utils.JWTSecretKey), sqleMiddleware.VerifyUserIsDisabled(), sqleMiddleware.LicenseAdapter(), sqleMiddleware.OperationLogRecord())
+ v2Router.Use(sqleMiddleware.JWTTokenAdapter(), sqleMiddleware.JWTWithConfig(dmsV1.JwtSigningKey), sqleMiddleware.VerifyUserIsDisabled(), sqleMiddleware.OperationLogRecord())
// v1 admin api, just admin user can access.
{
- // user
- v1Router.GET("/users", v1.GetUsers, AdminUserAllowed())
- v1Router.POST("/users", v1.CreateUser, AdminUserAllowed())
- v1Router.GET("/users/:user_name/", v1.GetUser, AdminUserAllowed())
- v1Router.PATCH("/users/:user_name/", v1.UpdateUser, AdminUserAllowed())
- v1Router.DELETE("/users/:user_name/", v1.DeleteUser, AdminUserAllowed())
- v1Router.PATCH("/users/:user_name/password", v1.UpdateOtherUserPassword, AdminUserAllowed())
-
- // user_group
- v1Router.POST("/user_groups", v1.CreateUserGroup, AdminUserAllowed())
- v1Router.GET("/user_groups", v1.GetUserGroups, AdminUserAllowed())
- v1Router.DELETE("/user_groups/:user_group_name/", v1.DeleteUserGroup, AdminUserAllowed())
- v1Router.PATCH("/user_groups/:user_group_name/", v1.UpdateUserGroup, AdminUserAllowed())
-
- // role
- v1Router.GET("/roles", v1.GetRoles, AdminUserAllowed())
- v1Router.POST("/roles", v1.CreateRole, AdminUserAllowed())
- v1Router.PATCH("/roles/:role_name/", v1.UpdateRole, AdminUserAllowed())
- v1Router.DELETE("/roles/:role_name/", v1.DeleteRole, AdminUserAllowed())
-
// rule template
- v1Router.POST("/rule_templates", v1.CreateRuleTemplate, AdminUserAllowed())
- v1Router.POST("/rule_templates/:rule_template_name/clone", v1.CloneRuleTemplate, AdminUserAllowed())
- v1Router.PATCH("/rule_templates/:rule_template_name/", v1.UpdateRuleTemplate, AdminUserAllowed())
- v1Router.DELETE("/rule_templates/:rule_template_name/", v1.DeleteRuleTemplate, AdminUserAllowed())
- v1Router.GET("/rule_templates/:rule_template_name/export", v1.ExportRuleTemplateFile, AdminUserAllowed())
- v1Router.DELETE("/custom_rules/:rule_id", v1.DeleteCustomRule, AdminUserAllowed())
- v1Router.POST("/custom_rules", v1.CreateCustomRule, AdminUserAllowed())
- v1Router.PATCH("/custom_rules/:rule_id", v1.UpdateCustomRule, AdminUserAllowed())
- v1Router.PATCH("/rule_knowledge/db_types/:db_type/rules/:rule_name/", v1.UpdateRuleKnowledgeV1, AdminUserAllowed())
- v1Router.PATCH("/rule_knowledge/db_types/:db_type/custom_rules/:rule_name/", v1.UpdateCustomRuleKnowledgeV1, AdminUserAllowed())
-
+ v1Router.POST("/rule_templates", v1.CreateRuleTemplate, sqleMiddleware.AdminUserAllowed())
+ v1Router.POST("/rule_templates/:rule_template_name/clone", v1.CloneRuleTemplate, sqleMiddleware.AdminUserAllowed())
+ v1Router.PATCH("/rule_templates/:rule_template_name/", v1.UpdateRuleTemplate, sqleMiddleware.AdminUserAllowed())
+ v1Router.DELETE("/rule_templates/:rule_template_name/", v1.DeleteRuleTemplate, sqleMiddleware.AdminUserAllowed())
+ v1Router.GET("/rule_templates/:rule_template_name/export", v1.ExportRuleTemplateFile, sqleMiddleware.AdminUserAllowed())
+ v1Router.DELETE("/custom_rules/:rule_id", v1.DeleteCustomRule, sqleMiddleware.AdminUserAllowed())
+ v1Router.POST("/custom_rules", v1.CreateCustomRule, sqleMiddleware.AdminUserAllowed())
+ v1Router.PATCH("/custom_rules/:rule_id", v1.UpdateCustomRule, sqleMiddleware.AdminUserAllowed())
+ v1Router.PATCH("/rule_knowledge/db_types/:db_type/rules/:rule_name/", v1.UpdateRuleKnowledgeV1, sqleMiddleware.AdminUserAllowed())
+ v1Router.PATCH("/rule_knowledge/db_types/:db_type/custom_rules/:rule_name/", v1.UpdateCustomRuleKnowledgeV1, sqleMiddleware.AdminUserAllowed())
// configurations
- v1Router.GET("/configurations/ldap", v1.GetLDAPConfiguration, AdminUserAllowed())
- v1Router.PATCH("/configurations/ldap", v1.UpdateLDAPConfiguration, AdminUserAllowed())
- v1Router.GET("/configurations/smtp", v1.GetSMTPConfiguration, AdminUserAllowed())
- v1Router.POST("/configurations/smtp/test", v1.TestSMTPConfigurationV1, AdminUserAllowed())
- v1Router.PATCH("/configurations/smtp", v1.UpdateSMTPConfiguration, AdminUserAllowed())
- v1Router.GET("/configurations/wechat", v1.GetWeChatConfiguration, AdminUserAllowed())
- v1Router.PATCH("/configurations/wechat", v1.UpdateWeChatConfigurationV1, AdminUserAllowed())
- v1Router.POST("/configurations/wechat/test", v1.TestWeChatConfigurationV1, AdminUserAllowed())
- v1Router.GET("/configurations/ding_talk", v1.GetDingTalkConfigurationV1, AdminUserAllowed())
- v1Router.PATCH("/configurations/ding_talk", v1.UpdateDingTalkConfigurationV1, AdminUserAllowed())
- v1Router.POST("/configurations/ding_talk/test", v1.TestDingTalkConfigV1, AdminUserAllowed())
- v1Router.GET("/configurations/feishu", v1.GetFeishuConfigurationV1, AdminUserAllowed())
- v1Router.PATCH("/configurations/feishu", v1.UpdateFeishuConfigurationV1, AdminUserAllowed())
- v1Router.POST("/configurations/feishu/test", v1.TestFeishuConfigV1, AdminUserAllowed())
- v1Router.PATCH("/configurations/feishu_audit", v1.UpdateFeishuAuditConfigurationV1, AdminUserAllowed())
- v1Router.GET("/configurations/feishu_audit", v1.GetFeishuAuditConfigurationV1, AdminUserAllowed())
- v1Router.POST("/configurations/feishu_audit/test", v1.TestFeishuAuditConfigV1, AdminUserAllowed())
- v1Router.GET("/configurations/system_variables", v1.GetSystemVariables, AdminUserAllowed())
- v1Router.PATCH("/configurations/system_variables", v1.UpdateSystemVariables, AdminUserAllowed())
- v1Router.GET("/configurations/license", v1.GetLicense, AdminUserAllowed())
- v1Router.POST("/configurations/license", v1.SetLicense, AdminUserAllowed())
- v1Router.GET("/configurations/license/info", v1.GetSQLELicenseInfo, AdminUserAllowed())
- v1Router.POST("/configurations/license/check", v1.CheckLicense, AdminUserAllowed())
- v1Router.GET("/configurations/oauth2", v1.GetOauth2Configuration, AdminUserAllowed())
- v1Router.PATCH("/configurations/oauth2", v1.UpdateOauth2Configuration, AdminUserAllowed())
- v1Router.POST("/configurations/personalise/logo", v1.UploadLogo, AdminUserAllowed())
- v1Router.PATCH("/configurations/personalise", v1.UpdatePersonaliseConfig, AdminUserAllowed())
- v1Router.PATCH("/configurations/webhook", v1.UpdateWorkflowWebHookConfig, AdminUserAllowed())
- v1Router.GET("/configurations/webhook", v1.GetWorkflowWebHookConfig, AdminUserAllowed())
- v1Router.POST("/configurations/webhook/test", v1.TestWorkflowWebHookConfig, AdminUserAllowed())
+ v1Router.GET("/configurations/ding_talk", v1.GetDingTalkConfigurationV1, sqleMiddleware.AdminUserAllowed())
+ v1Router.PATCH("/configurations/ding_talk", v1.UpdateDingTalkConfigurationV1, sqleMiddleware.AdminUserAllowed())
+ v1Router.POST("/configurations/ding_talk/test", v1.TestDingTalkConfigV1, sqleMiddleware.AdminUserAllowed())
+ v1Router.GET("/configurations/system_variables", v1.GetSystemVariables, sqleMiddleware.AdminUserAllowed())
+ v1Router.PATCH("/configurations/system_variables", v1.UpdateSystemVariables, sqleMiddleware.AdminUserAllowed())
+ v1Router.GET("/configurations/license", v1.GetLicense, sqleMiddleware.AdminUserAllowed())
+ v1Router.POST("/configurations/license", v1.SetLicense, sqleMiddleware.AdminUserAllowed())
+ v1Router.GET("/configurations/license/info", v1.GetSQLELicenseInfo, sqleMiddleware.AdminUserAllowed())
+ v1Router.POST("/configurations/license/check", v1.CheckLicense, sqleMiddleware.AdminUserAllowed())
+ v1Router.PATCH("/configurations/feishu_audit", v1.UpdateFeishuAuditConfigurationV1, sqleMiddleware.AdminUserAllowed())
+ v1Router.GET("/configurations/feishu_audit", v1.GetFeishuAuditConfigurationV1, sqleMiddleware.AdminUserAllowed())
+ v1Router.POST("/configurations/feishu_audit/test", v1.TestFeishuAuditConfigV1, sqleMiddleware.AdminUserAllowed())
// statistic
- v1Router.GET("/statistic/instances/type_percent", v1.GetInstancesTypePercentV1, AdminUserAllowed())
- v1Router.GET("/statistic/instances/sql_average_execution_time", v1.GetSqlAverageExecutionTimeV1, AdminUserAllowed())
- v1Router.GET("/statistic/instances/sql_execution_fail_percent", v1.GetSqlExecutionFailPercentV1, AdminUserAllowed())
- v1Router.GET("/statistic/license/usage", v1.GetLicenseUsageV1, AdminUserAllowed())
- v1Router.GET("/statistic/workflows/rejected_percent_group_by_creator", v1.GetWorkflowRejectedPercentGroupByCreatorV1, AdminUserAllowed())
- //v1Router.GET("/statistic/workflows/rejected_percent_group_by_instance", v1.GetWorkflowRejectedPercentGroupByInstanceV1, AdminUserAllowed())
- v1Router.GET("/statistic/workflows/counts", v1.GetWorkflowCountsV1, AdminUserAllowed())
- v1Router.GET("/statistic/workflows/duration_of_waiting_for_audit", v1.GetWorkflowDurationOfWaitingForAuditV1, AdminUserAllowed())
- //v1Router.GET("/statistic/workflows/duration_of_waiting_for_execution", v1.GetWorkflowDurationOfWaitingForExecutionV1, AdminUserAllowed())
- //v1Router.GET("/statistic/workflows/pass_percent", v1.GetWorkflowPassPercentV1, AdminUserAllowed())
- v1Router.GET("/statistic/workflows/audit_pass_percent", v1.GetWorkflowAuditPassPercentV1, AdminUserAllowed())
- v1Router.GET("/statistic/workflows/each_day_counts", v1.GetWorkflowCreatedCountsEachDayV1, AdminUserAllowed())
- v1Router.GET("/statistic/workflows/status_count", v1.GetWorkflowStatusCountV1, AdminUserAllowed())
- v1Router.GET("/statistic/workflows/instance_type_percent", v1.GetWorkflowPercentCountedByInstanceTypeV1, AdminUserAllowed())
-
- // sync instance
- v1Router.POST("/sync_instances", v1.CreateSyncInstanceTask, AdminUserAllowed())
- v1Router.GET("/sync_instances", v1.GetSyncInstanceTaskList, AdminUserAllowed())
- v1Router.GET("/sync_instances/:task_id/", v1.GetSyncInstanceTask, AdminUserAllowed())
- v1Router.PATCH("/sync_instances/:task_id/", v1.UpdateSyncInstanceTask, AdminUserAllowed())
- v1Router.GET("/sync_instances/source_tips", v1.GetSyncTaskSourceTips, AdminUserAllowed())
- v1Router.DELETE("/sync_instances/:task_id/", v1.DeleteSyncInstanceTask, AdminUserAllowed())
- v1Router.POST("/sync_instances/:task_id/trigger", v1.TriggerSyncInstance, AdminUserAllowed())
+ v1Router.GET("/statistic/instances/type_percent", v1.GetInstancesTypePercentV1, sqleMiddleware.AdminUserAllowed())
+ v1Router.GET("/statistic/instances/sql_average_execution_time", v1.GetSqlAverageExecutionTimeV1, sqleMiddleware.AdminUserAllowed())
+ v1Router.GET("/statistic/license/usage", v1.GetLicenseUsageV1, sqleMiddleware.AdminUserAllowed())
+ v1Router.GET("/statistic/workflows/rejected_percent_group_by_creator", v1.GetWorkflowRejectedPercentGroupByCreatorV1, sqleMiddleware.AdminUserAllowed())
+ v1Router.GET("/statistic/workflows/counts", v1.GetWorkflowCountsV1, sqleMiddleware.AdminUserAllowed())
+ v1Router.GET("/statistic/workflows/duration_of_waiting_for_audit", v1.GetWorkflowDurationOfWaitingForAuditV1, sqleMiddleware.AdminUserAllowed())
+ v1Router.GET("/statistic/workflows/audit_pass_percent", v1.GetWorkflowAuditPassPercentV1, sqleMiddleware.AdminUserAllowed())
+ v1Router.GET("/statistic/workflows/each_day_counts", v1.GetWorkflowCreatedCountsEachDayV1, sqleMiddleware.AdminUserAllowed())
+ v1Router.GET("/statistic/workflows/status_count", v1.GetWorkflowStatusCountV1, sqleMiddleware.AdminUserAllowed())
+ v1Router.GET("/statistic/workflows/instance_type_percent", v1.GetWorkflowPercentCountedByInstanceTypeV1, sqleMiddleware.AdminUserAllowed())
// operation record
- v1Router.GET("/operation_records/operation_type_names", v1.GetOperationTypeNameList, AdminUserAllowed())
- v1Router.GET("/operation_records/operation_actions", v1.GetOperationActionList, AdminUserAllowed())
- v1Router.GET("/operation_records", v1.GetOperationRecordListV1, AdminUserAllowed())
- v1Router.GET("/operation_records/exports", v1.GetExportOperationRecordListV1, AdminUserAllowed())
-
- // other
- v1Router.GET("/management_permissions", v1.GetManagementPermissions, AdminUserAllowed())
+ v1Router.GET("/operation_records/operation_type_names", v1.GetOperationTypeNameList, sqleMiddleware.AdminUserAllowed())
+ v1Router.GET("/operation_records/operation_actions", v1.GetOperationActionList, sqleMiddleware.AdminUserAllowed())
+ v1Router.GET("/operation_records", v1.GetOperationRecordListV1, sqleMiddleware.AdminUserAllowed())
+ v1Router.GET("/operation_records/exports", v1.GetExportOperationRecordListV1, sqleMiddleware.AdminUserAllowed())
// 企业公告
- v1Router.PATCH("/company_notice", v1.UpdateCompanyNotice, AdminUserAllowed())
+ v1Router.PATCH("/company_notice", v1.UpdateCompanyNotice, sqleMiddleware.AdminUserAllowed())
+
+ // 内部调用
+ v1Router.POST("/data_resource/handle", v1.OperateDataResourceHandle, sqleMiddleware.AdminUserAllowed())
+ v1Router.POST(fmt.Sprintf("%s/connection", dmsV1.InternalDBServiceRouterGroup), v1.CheckInstanceIsConnectable, sqleMiddleware.AdminUserAllowed())
}
- // auth
- v1Router.POST("/logout", v1.LogoutV1)
-
- // statistic
- v1Router.GET("/projects/:project_name/statistics", v1.GetProjectStatisticsV1)
- v1Router.GET("/projects/:project_name/statistic/audited_sqls", v1.StatisticsAuditedSQLV1)
- v1Router.GET("/projects/:project_name/statistic/workflow_status", v1.StatisticWorkflowStatusV1)
- v1Router.GET("/projects/:project_name/statistic/risk_workflow", v1.StatisticRiskWorkflowV1)
- v1Router.GET("/projects/:project_name/statistic/audit_plans", v1.StatisticAuditPlanV1)
- v1Router.GET("/projects/:project_name/statistic/risk_audit_plans", v1.GetRiskAuditPlanV1)
- v1Router.GET("/projects/:project_name/statistic/role_user", v1.GetRoleUserCountV1)
- v1Router.GET("/projects/:project_name/statistic/project_score", v1.GetProjectScoreV1)
- v1Router.GET("/projects/:project_name/statistic/instance_health", v1.GetInstanceHealthV1)
-
- // audit whitelist
- v1Router.GET("/projects/:project_name/audit_whitelist", v1.GetSqlWhitelist)
- v1Router.POST("/projects/:project_name/audit_whitelist", v1.CreateAuditWhitelist)
- v1Router.PATCH("/projects/:project_name/audit_whitelist/:audit_whitelist_id/", v1.UpdateAuditWhitelistById)
- v1Router.DELETE("/projects/:project_name/audit_whitelist/:audit_whitelist_id/", v1.DeleteAuditWhitelistById)
-
- // project
- v1Router.PATCH("/projects/:project_name/", v1.UpdateProjectV1)
- v1Router.DELETE("/projects/:project_name/", v1.DeleteProjectV1)
- v1Router.POST("/projects", v1.CreateProjectV1)
- v1Router.POST("/projects/:project_name/archive", v1.ArchiveProjectV1)
- v1Router.POST("/projects/:project_name/unarchive", v1.UnarchiveProjectV1)
- v1Router.GET("/projects", v1.GetProjectListV1)
- v1Router.GET("/projects/:project_name/", v1.GetProjectDetailV1)
- v1Router.GET("/project_tips", v1.GetProjectTipsV1)
-
- // role
- v1Router.GET("/role_tips", v1.GetRoleTips)
-
- // user
- v1Router.GET("/user", v1.GetCurrentUser)
- v1Router.PATCH("/user", v1.UpdateCurrentUser)
- v1Router.GET("/user_tips", v1.GetUserTips)
- v1Router.PUT("/user/password", v1.UpdateCurrentUserPassword)
- v1Router.POST("/projects/:project_name/members", v1.AddMember)
- v1Router.PATCH("/projects/:project_name/members/:user_name/", v1.UpdateMember)
- v1Router.DELETE("/projects/:project_name/members/:user_name/", v1.DeleteMember)
- v1Router.GET("/projects/:project_name/members", v1.GetMembers)
- v1Router.GET("/projects/:project_name/members/:user_name/", v1.GetMember)
- v1Router.GET("/projects/:project_name/member_tips", v1.GetMemberTips)
-
- // user group
- v1Router.POST("/projects/:project_name/member_groups", v1.AddMemberGroup)
- v1Router.PATCH("/projects/:project_name/member_groups/:user_group_name/", v1.UpdateMemberGroup)
- v1Router.DELETE("/projects/:project_name/member_groups/:user_group_name/", v1.DeleteMemberGroup)
- v1Router.GET("/projects/:project_name/member_groups", v1.GetMemberGroups)
- v1Router.GET("/projects/:project_name/member_groups/:user_group_name/", v1.GetMemberGroup)
- v1Router.GET("/user_group_tips", v1.GetUserGroupTips)
-
- // operations
- v1Router.GET("/operations", v1.GetOperations)
-
- // instance
- v1Router.GET("/projects/:project_name/instances", v1.GetInstances)
- v2Router.GET("/projects/:project_name/instances", v2.GetInstances)
- v1Router.GET("/projects/:project_name/instances/:instance_name/", v1.GetInstance)
- v2Router.GET("/projects/:project_name/instances/:instance_name/", v2.GetInstance)
- v1Router.GET("/projects/:project_name/instances/:instance_name/connection", v1.CheckInstanceIsConnectableByName)
- v1Router.POST("/instance_connection", v1.CheckInstanceIsConnectable)
- v1Router.POST("/projects/:project_name/instances/connections", v1.BatchCheckInstanceConnections)
- v1Router.GET("/projects/:project_name/instances/:instance_name/schemas", v1.GetInstanceSchemas)
- v1Router.GET("/projects/:project_name/instance_tips", v1.GetInstanceTips)
- v1Router.GET("/projects/:project_name/instances/:instance_name/rules", v1.GetInstanceRules)
- v1Router.GET("/projects/:project_name/instances/:instance_name/schemas/:schema_name/tables", v1.ListTableBySchema)
- v1Router.GET("/projects/:project_name/instances/:instance_name/schemas/:schema_name/tables/:table_name/metadata", v1.GetTableMetadata)
- v1Router.POST("/projects/:project_name/instances", DeprecatedBy(apiV2))
- v2Router.POST("/projects/:project_name/instances", v2.CreateInstance)
- v1Router.GET("/instance_additional_metas", v1.GetInstanceAdditionalMetas)
- v1Router.DELETE("/projects/:project_name/instances/:instance_name/", v1.DeleteInstance)
- v1Router.PATCH("/projects/:project_name/instances/:instance_name/", v1.UpdateInstance)
- v1Router.GET("/static/instance_logo", v1.GetInstanceTypeLogo)
-
- // rule template
- v1Router.GET("/rule_templates", v1.GetRuleTemplates)
- v1Router.GET("/rule_template_tips", v1.GetRuleTemplateTips)
- v1Router.GET("/rule_templates/:rule_template_name/", v1.GetRuleTemplate)
- v1Router.POST("/projects/:project_name/rule_templates", v1.CreateProjectRuleTemplate)
- v1Router.PATCH("/projects/:project_name/rule_templates/:rule_template_name/", v1.UpdateProjectRuleTemplate)
- v1Router.GET("/projects/:project_name/rule_templates/:rule_template_name/", v1.GetProjectRuleTemplate)
- v1Router.DELETE("/projects/:project_name/rule_templates/:rule_template_name/", v1.DeleteProjectRuleTemplate)
- v1Router.GET("/projects/:project_name/rule_templates", v1.GetProjectRuleTemplates)
- v1Router.POST("/projects/:project_name/rule_templates/:rule_template_name/clone", v1.CloneProjectRuleTemplate)
- v1Router.GET("/projects/:project_name/rule_template_tips", v1.GetProjectRuleTemplateTips)
- v1Router.POST("/rule_templates/parse", v1.ParseProjectRuleTemplateFile)
- v1Router.GET("/projects/:project_name/rule_templates/:rule_template_name/export", v1.ExportProjectRuleTemplateFile)
- v1Router.GET("/rule_knowledge/db_types/:db_type/rules/:rule_name/", v1.GetRuleKnowledge)
- v1Router.GET("/rule_knowledge/db_types/:db_type/custom_rules/:rule_name/", v1.GetCustomRuleKnowledge)
-
- //rule
- v1Router.GET("/rules", v1.GetRules)
- v1Router.GET("/custom_rules", v1.GetCustomRules)
- v1Router.GET("/custom_rules/:rule_id", v1.GetCustomRule)
- v1Router.GET("/custom_rules/:db_type/rule_types", v1.GetRuleTypeByDBType)
-
- // workflow template
- v1Router.GET("/projects/:project_name/workflow_template", v1.GetWorkflowTemplate)
- v1Router.PATCH("/projects/:project_name/workflow_template", v1.UpdateWorkflowTemplate)
-
- // workflow
- v1Router.POST("/projects/:project_name/workflows", DeprecatedBy(apiV2))
- v2Router.POST("/projects/:project_name/workflows", v2.CreateWorkflowV2)
- v1Router.GET("/projects/:project_name/workflows/:workflow_name/", DeprecatedBy(apiV2))
- v2Router.GET("/projects/:project_name/workflows/:workflow_id/", v2.GetWorkflowV2)
- v1Router.GET("/workflows", v1.GetGlobalWorkflowsV1)
- v1Router.GET("/projects/:project_name/workflows", v1.GetWorkflowsV1)
- v1Router.POST("/projects/:project_name/workflows/:workflow_name/steps/:workflow_step_id/approve", DeprecatedBy(apiV2))
- v2Router.POST("/projects/:project_name/workflows/:workflow_id/steps/:workflow_step_id/approve", v2.ApproveWorkflowV2)
- v1Router.POST("/projects/:project_name/workflows/:workflow_name/steps/:workflow_step_id/reject", DeprecatedBy(apiV2))
- v2Router.POST("/projects/:project_name/workflows/:workflow_id/steps/:workflow_step_id/reject", v2.RejectWorkflowV2)
- v1Router.POST("/projects/:project_name/workflows/:workflow_name/cancel", DeprecatedBy(apiV2))
- v2Router.POST("/projects/:project_name/workflows/:workflow_id/cancel", v2.CancelWorkflowV2)
- v1Router.POST("/projects/:project_name/workflows/cancel", DeprecatedBy(apiV2))
- v2Router.POST("/projects/:project_name/workflows/cancel", v2.BatchCancelWorkflowsV2)
- v1Router.POST("/projects/:project_name/workflows/complete", DeprecatedBy(apiV2))
- v2Router.POST("/projects/:project_name/workflows/complete", v2.BatchCompleteWorkflowsV2)
- v1Router.POST("/projects/:project_name/workflows/:workflow_name/tasks/:task_id/execute", DeprecatedBy(apiV2))
- v2Router.POST("/projects/:project_name/workflows/:workflow_id/tasks/:task_id/execute", v2.ExecuteOneTaskOnWorkflowV2)
- v1Router.POST("/projects/:project_name/workflows/:workflow_id/tasks/:task_id/terminate", v1.TerminateSingleTaskByWorkflowV1)
- v1Router.GET("/projects/:project_name/workflows/:workflow_name/tasks", DeprecatedBy(apiV2))
- v2Router.GET("/projects/:project_name/workflows/:workflow_id/tasks", v2.GetSummaryOfWorkflowTasksV2)
- v1Router.POST("/projects/:project_name/workflows/:workflow_name/tasks/execute", DeprecatedBy(apiV2))
- v2Router.POST("/projects/:project_name/workflows/:workflow_id/tasks/execute", v2.ExecuteTasksOnWorkflowV2)
- v1Router.POST("/projects/:project_name/workflows/:workflow_id/tasks/terminate", v1.TerminateMultipleTaskByWorkflowV1)
- v1Router.PUT("/projects/:project_name/workflows/:workflow_name/tasks/:task_id/schedule", DeprecatedBy(apiV2))
- v2Router.PUT("/projects/:project_name/workflows/:workflow_id/tasks/:task_id/schedule", v2.UpdateWorkflowScheduleV2)
- v1Router.PATCH("/projects/:project_name/workflows/:workflow_name/", DeprecatedBy(apiV2))
- v2Router.PATCH("/projects/:project_name/workflows/:workflow_id/", v2.UpdateWorkflowV2)
- v1Router.GET("/projects/:project_name/workflows/exports", v1.ExportWorkflowV1)
-
- // task
- v1Router.POST("/projects/:project_name/tasks/audits", v1.CreateAndAuditTask)
- v1Router.GET("/tasks/audits/:task_id/", v1.GetTask)
- v1Router.GET("/tasks/audits/:task_id/sqls", v1.GetTaskSQLs)
- v2Router.GET("/tasks/audits/:task_id/sqls", v2.GetTaskSQLs)
- v1Router.GET("/tasks/audits/:task_id/sql_report", v1.DownloadTaskSQLReportFile)
- v1Router.GET("/tasks/audits/:task_id/sql_file", v1.DownloadTaskSQLFile)
- v1Router.GET("/tasks/audits/:task_id/sql_content", v1.GetAuditTaskSQLContent)
- v1Router.PATCH("/tasks/audits/:task_id/sqls/:number", v1.UpdateAuditTaskSQLs)
- v1Router.GET("/tasks/audits/:task_id/sqls/:number/analysis", v1.GetTaskAnalysisData)
- v2Router.GET("/tasks/audits/:task_id/sqls/:number/analysis", v2.GetTaskAnalysisData)
- v1Router.POST("/projects/:project_name/task_groups", v1.CreateAuditTasksGroupV1)
- v1Router.POST("/task_groups/audit", v1.AuditTaskGroupV1)
-
- // dashboard
- v1Router.GET("/dashboard", v1.Dashboard)
- v1Router.GET("/dashboard/project_tips", v1.DashboardProjectTipsV1)
-
- // configurations
- v1Router.GET("/configurations/drivers", v1.GetDrivers)
- v2Router.GET("/configurations/drivers", v2.GetDrivers)
- v1Router.GET("/configurations/sql_query", v1.GetSQLQueryConfiguration)
-
- // audit plan
- v1Router.GET("/audit_plan_metas", v1.GetAuditPlanMetas)
- v1Router.GET("/audit_plan_types", v1.GetAuditPlanTypes)
-
- // project - audit plan
- v1Router.POST("/projects/:project_name/audit_plans", v1.CreateAuditPlan)
- v1Router.GET("/projects/:project_name/audit_plans", v1.GetAuditPlans)
- v2Router.GET("/projects/:project_name/audit_plans", v2.GetAuditPlans)
- v1Router.DELETE("/projects/:project_name/audit_plans/:audit_plan_name/", v1.DeleteAuditPlan)
- v1Router.PATCH("/projects/:project_name/audit_plans/:audit_plan_name/", v1.UpdateAuditPlan)
- v1Router.GET("/projects/:project_name/audit_plans/:audit_plan_name/", v1.GetAuditPlan)
- v1Router.GET("/projects/:project_name/audit_plans/:audit_plan_name/reports", v1.GetAuditPlanReports)
- v1Router.GET("/projects/:project_name/audit_plans/:audit_plan_name/reports/:audit_plan_report_id/", v1.GetAuditPlanReport)
-
- v1Router.GET("/projects/:project_name/audit_plans/:audit_plan_name/sqls", v1.GetAuditPlanSQLs)
- v1Router.POST("/projects/:project_name/audit_plans/:audit_plan_name/sqls/full", v1.FullSyncAuditPlanSQLs, sqleMiddleware.ScannerVerifier())
- v2Router.POST("/projects/:project_name/audit_plans/:audit_plan_name/sqls/full", v2.FullSyncAuditPlanSQLs, sqleMiddleware.ScannerVerifier())
- v1Router.POST("/projects/:project_name/audit_plans/:audit_plan_name/sqls/partial", v1.PartialSyncAuditPlanSQLs, sqleMiddleware.ScannerVerifier())
- v2Router.POST("/projects/:project_name/audit_plans/:audit_plan_name/sqls/partial", v2.PartialSyncAuditPlanSQLs, sqleMiddleware.ScannerVerifier())
- v1Router.POST("/projects/:project_name/audit_plans/:audit_plan_name/trigger", v1.TriggerAuditPlan)
- v1Router.PATCH("/projects/:project_name/audit_plans/:audit_plan_name/notify_config", v1.UpdateAuditPlanNotifyConfig)
- v1Router.GET("/projects/:project_name/audit_plans/:audit_plan_name/notify_config", v1.GetAuditPlanNotifyConfig)
- v1Router.GET("/projects/:project_name/audit_plans/:audit_plan_name/notify_config/test", v1.TestAuditPlanNotifyConfig)
- v1Router.GET("/projects/:project_name/audit_plans/:audit_plan_name/reports/:audit_plan_report_id/sqls/:number/analysis", v1.GetAuditPlanAnalysisData)
- v2Router.GET("/projects/:project_name/audit_plans/:audit_plan_name/reports/:audit_plan_report_id/sqls/:number/analysis", v2.GetAuditPlanAnalysisData)
- v1Router.GET("/projects/:project_name/audit_plans/:audit_plan_name/reports/:audit_plan_report_id/sqls", v1.GetAuditPlanReportSQLsV1)
- v2Router.GET("/projects/:project_name/audit_plans/:audit_plan_name/reports/:audit_plan_report_id/sqls", v2.GetAuditPlanReportSQLs)
- v1Router.GET("/projects/:project_name/audit_plans/:audit_plan_name/reports/:audit_plan_report_id/export", v1.ExportAuditPlanReportV1)
-
- // sql manager
- v1Router.GET("/projects/:project_name/sql_manages", v1.GetSqlManageList)
- v2Router.GET("/projects/:project_name/sql_manages", v2.GetSqlManageList)
- v1Router.PATCH("/projects/:project_name/sql_manages/batch", v1.BatchUpdateSqlManage)
- v1Router.GET("/projects/:project_name/sql_manages/exports", v1.ExportSqlManagesV1)
- v1Router.GET("/projects/:project_name/sql_manages/rule_tips", v1.GetSqlManageRuleTips)
- v1Router.GET("/projects/:project_name/sql_manages/:sql_manage_id/sql_analysis", v1.GetSqlManageSqlAnalysisV1)
-
- // sql audit record
- v1Router.POST("/projects/:project_name/sql_audit_records", v1.CreateSQLAuditRecord)
- v1Router.GET("/projects/:project_name/sql_audit_records", v1.GetSQLAuditRecordsV1)
- v1Router.GET("/projects/:project_name/sql_audit_records/:sql_audit_record_id/", v1.GetSQLAuditRecordV1)
- v1Router.PATCH("/projects/:project_name/sql_audit_records/:sql_audit_record_id/", v1.UpdateSQLAuditRecordV1)
- v1Router.GET("/projects/:project_name/sql_audit_records/tag_tips", v1.GetSQLAuditRecordTagTipsV1)
-
- // 企业公告
- v1Router.GET("/company_notice", v1.GetCompanyNotice)
-
- // sql query
- if err := cloudbeaver_wrapper.StartApp(e); err != nil {
- log.Logger().Errorf("CloudBeaver wrapper configuration failed: %v", err)
- } else {
- log.Logger().Info("CloudBeaver wrapper is configured")
+ // project admin router
+ v1ProjectAdminRouter := v1Router.Group("/projects", sqleMiddleware.ProjectAdminUserAllowed())
+ {
+ // audit whitelist
+ v1ProjectAdminRouter.POST("/:project_name/audit_whitelist", v1.CreateAuditWhitelist)
+ v1ProjectAdminRouter.PATCH("/:project_name/audit_whitelist/:audit_whitelist_id/", v1.UpdateAuditWhitelistById)
+ v1ProjectAdminRouter.DELETE("/:project_name/audit_whitelist/:audit_whitelist_id/", v1.DeleteAuditWhitelistById)
+
+ // rule template
+ v1ProjectAdminRouter.POST("/:project_name/rule_templates", v1.CreateProjectRuleTemplate)
+ v1ProjectAdminRouter.PATCH("/:project_name/rule_templates/:rule_template_name/", v1.UpdateProjectRuleTemplate)
+ v1ProjectAdminRouter.DELETE("/:project_name/rule_templates/:rule_template_name/", v1.DeleteProjectRuleTemplate)
+ v1ProjectAdminRouter.POST("/:project_name/rule_templates/:rule_template_name/clone", v1.CloneProjectRuleTemplate)
+
+ // workflow template
+ v1ProjectAdminRouter.PATCH("/:project_name/workflow_template", v1.UpdateWorkflowTemplate)
+ }
+
+ // project member router
+ v1ProjectRouter := v1Router.Group("/projects", sqleMiddleware.ProjectMemberAllowed())
+ {
+ // statistic
+ v1ProjectRouter.GET("/:project_name/statistics", v1.GetProjectStatisticsV1)
+ v1ProjectRouter.GET("/:project_name/statistics", v1.GetProjectStatisticsV1)
+ v1ProjectRouter.GET("/:project_name/statistic/workflow_status", v1.StatisticWorkflowStatusV1)
+ v1ProjectRouter.GET("/:project_name/statistic/risk_workflow", v1.StatisticRiskWorkflowV1)
+ v1ProjectRouter.GET("/:project_name/statistic/audit_plans", v1.StatisticAuditPlanV1)
+ v1ProjectRouter.GET("/:project_name/statistic/risk_audit_plans", v1.GetRiskAuditPlanV1)
+ v1ProjectRouter.GET("/:project_name/statistic/role_user", v1.GetRoleUserCountV1)
+ v1ProjectRouter.GET("/:project_name/statistic/project_score", v1.GetProjectScoreV1)
+ v1ProjectRouter.GET("/:project_name/statistic/instance_health", v1.GetInstanceHealthV1)
+ v1ProjectRouter.GET("/:project_name/statistic/audited_sqls", v1.StatisticsAuditedSQLV1)
+
+ // audit whitelist
+ v1ProjectRouter.GET("/:project_name/audit_whitelist", v1.GetSqlWhitelist)
+
+ // instance
+ v1ProjectRouter.GET("/:project_name/instances/:instance_name/connection", v1.CheckInstanceIsConnectableByName)
+ v1ProjectRouter.POST("/:project_name/instances/connections", v1.BatchCheckInstanceConnections)
+ v1ProjectRouter.GET("/:project_name/instances/:instance_name/schemas", v1.GetInstanceSchemas)
+ v1ProjectRouter.GET("/:project_name/instance_tips", v1.GetInstanceTips)
+ v1ProjectRouter.GET("/:project_name/instances/:instance_name/rules", v1.GetInstanceRules)
+ v1ProjectRouter.GET("/:project_name/instances/:instance_name/schemas/:schema_name/tables", v1.ListTableBySchema)
+ v1ProjectRouter.GET("/:project_name/instances/:instance_name/schemas/:schema_name/tables/:table_name/metadata", v1.GetTableMetadata)
+
+ // rule template
+ v1ProjectRouter.GET("/:project_name/rule_templates/:rule_template_name/", v1.GetProjectRuleTemplate)
+ v1ProjectRouter.GET("/:project_name/rule_templates", v1.GetProjectRuleTemplates)
+ v1ProjectRouter.GET("/:project_name/rule_template_tips", v1.GetProjectRuleTemplateTips)
+ v1ProjectRouter.GET("/:project_name/rule_templates/:rule_template_name/export", v1.ExportProjectRuleTemplateFile)
+
+ // workflow template
+ v1ProjectRouter.GET("/:project_name/workflow_template", v1.GetWorkflowTemplate)
+
+ // workflow
+ v1ProjectRouter.POST("/:project_name/workflows", DeprecatedBy(apiV2))
+ v1ProjectRouter.GET("/:project_name/workflows/:workflow_name/", DeprecatedBy(apiV2))
+ v1ProjectRouter.GET("/:project_name/workflows", v1.GetWorkflowsV1)
+ v1ProjectRouter.POST("/:project_name/workflows/:workflow_name/steps/:workflow_step_id/approve", DeprecatedBy(apiV2))
+ v1ProjectRouter.POST("/:project_name/workflows/:workflow_name/steps/:workflow_step_id/reject", DeprecatedBy(apiV2))
+ v1ProjectRouter.POST("/:project_name/workflows/:workflow_name/cancel", DeprecatedBy(apiV2))
+ v1ProjectRouter.POST("/:project_name/workflows/cancel", DeprecatedBy(apiV2))
+ v1ProjectRouter.POST("/:project_name/workflows/complete", DeprecatedBy(apiV2))
+ v1ProjectRouter.POST("/:project_name/workflows/:workflow_name/tasks/:task_id/execute", DeprecatedBy(apiV2))
+ v1ProjectRouter.POST("/:project_name/workflows/:workflow_id/tasks/:task_id/terminate", v1.TerminateSingleTaskByWorkflowV1)
+ v1ProjectRouter.GET("/:project_name/workflows/:workflow_name/tasks", DeprecatedBy(apiV2))
+ v1ProjectRouter.POST("/:project_name/workflows/:workflow_name/tasks/execute", DeprecatedBy(apiV2))
+ v1ProjectRouter.POST("/:project_name/workflows/:workflow_id/tasks/terminate", v1.TerminateMultipleTaskByWorkflowV1)
+ v1ProjectRouter.PUT("/:project_name/workflows/:workflow_name/tasks/:task_id/schedule", DeprecatedBy(apiV2))
+ v1ProjectRouter.PATCH("/:project_name/workflows/:workflow_name/", DeprecatedBy(apiV2))
+ v1ProjectRouter.GET("/:project_name/workflows/exports", v1.ExportWorkflowV1)
+
+ // audit plan; 智能扫描任务
+ v1ProjectRouter.POST("/:project_name/audit_plans", v1.CreateAuditPlan)
+ v1ProjectRouter.GET("/:project_name/audit_plans", v1.GetAuditPlans)
+ v1ProjectRouter.DELETE("/:project_name/audit_plans/:audit_plan_name/", v1.DeleteAuditPlan)
+ v1ProjectRouter.PATCH("/:project_name/audit_plans/:audit_plan_name/", v1.UpdateAuditPlan)
+ v1ProjectRouter.GET("/:project_name/audit_plans/:audit_plan_name/", v1.GetAuditPlan)
+ v1ProjectRouter.GET("/:project_name/audit_plans/:audit_plan_name/reports", v1.GetAuditPlanReports)
+ v1ProjectRouter.GET("/:project_name/audit_plans/:audit_plan_name/reports/:audit_plan_report_id/", v1.GetAuditPlanReport)
+ v1ProjectRouter.GET("/:project_name/audit_plans/:audit_plan_name/sqls", v1.GetAuditPlanSQLs)
+ v1ProjectRouter.POST("/:project_name/audit_plans/:audit_plan_name/trigger", v1.TriggerAuditPlan)
+ v1ProjectRouter.PATCH("/:project_name/audit_plans/:audit_plan_name/notify_config", v1.UpdateAuditPlanNotifyConfig)
+ v1ProjectRouter.GET("/:project_name/audit_plans/:audit_plan_name/notify_config", v1.GetAuditPlanNotifyConfig)
+ v1ProjectRouter.GET("/:project_name/audit_plans/:audit_plan_name/notify_config/test", v1.TestAuditPlanNotifyConfig)
+ v1ProjectRouter.GET("/:project_name/audit_plans/:audit_plan_name/reports/:audit_plan_report_id/sqls/:number/analysis", v1.GetAuditPlanAnalysisData)
+ v1ProjectRouter.GET("/:project_name/audit_plans/:audit_plan_name/reports/:audit_plan_report_id/sqls", v1.GetAuditPlanReportSQLsV1)
+ v1ProjectRouter.GET("/:project_name/audit_plans/:audit_plan_name/reports/:audit_plan_report_id/export", v1.ExportAuditPlanReportV1)
+
+ // scanner token auth
+ v1ProjectRouter.POST("/:project_name/audit_plans/:audit_plan_name/sqls/full", v1.FullSyncAuditPlanSQLs, sqleMiddleware.ScannerVerifier())
+ v1ProjectRouter.POST("/:project_name/audit_plans/:audit_plan_name/sqls/partial", v1.PartialSyncAuditPlanSQLs, sqleMiddleware.ScannerVerifier())
+
+ // sql manager
+ v1ProjectRouter.GET("/:project_name/sql_manages", v1.GetSqlManageList)
+ v1ProjectRouter.PATCH("/:project_name/sql_manages/batch", v1.BatchUpdateSqlManage)
+ v1ProjectRouter.GET("/:project_name/sql_manages/exports", v1.ExportSqlManagesV1)
+ v1ProjectRouter.GET("/:project_name/sql_manages/rule_tips", v1.GetSqlManageRuleTips)
+ v1ProjectRouter.GET("/:project_name/sql_manages/:sql_manage_id/sql_analysis", v1.GetSqlManageSqlAnalysisV1)
+
+ // sql audit record
+ v1ProjectRouter.POST("/:project_name/sql_audit_records", v1.CreateSQLAuditRecord)
+ v1ProjectRouter.GET("/:project_name/sql_audit_records", v1.GetSQLAuditRecordsV1)
+ v1ProjectRouter.GET("/:project_name/sql_audit_records/:sql_audit_record_id/", v1.GetSQLAuditRecordV1)
+ v1ProjectRouter.PATCH("/:project_name/sql_audit_records/:sql_audit_record_id/", v1.UpdateSQLAuditRecordV1)
+ v1ProjectRouter.GET("/:project_name/sql_audit_records/tag_tips", v1.GetSQLAuditRecordTagTipsV1)
+
+ // task
+ v1ProjectRouter.POST("/:project_name/tasks/audits", v1.CreateAndAuditTask)
}
- // sql audit
- v1Router.POST("/sql_audit", v1.DirectAudit)
- v1Router.POST("/audit_files", v1.DirectAuditFiles)
- v2Router.POST("/audit_files", v2.DirectAuditFiles)
- v1Router.GET("/sql_analysis", v1.DirectGetSQLAnalysis)
+ // project member router
+ v2ProjectRouter := v2Router.Group("/projects", sqleMiddleware.ProjectMemberAllowed())
+ {
+ // workflow
+ v2ProjectRouter.POST("/:project_name/workflows", v2.CreateWorkflowV2)
+ v2ProjectRouter.GET("/:project_name/workflows/:workflow_id/", v2.GetWorkflowV2)
+ v2ProjectRouter.POST("/:project_name/workflows/:workflow_id/steps/:workflow_step_id/approve", v2.ApproveWorkflowV2)
+ v2ProjectRouter.POST("/:project_name/workflows/:workflow_id/steps/:workflow_step_id/reject", v2.RejectWorkflowV2)
+ v2ProjectRouter.POST("/:project_name/workflows/:workflow_id/cancel", v2.CancelWorkflowV2)
+ v2ProjectRouter.POST("/:project_name/workflows/cancel", v2.BatchCancelWorkflowsV2)
+ v2ProjectRouter.POST("/:project_name/workflows/complete", v2.BatchCompleteWorkflowsV2)
+ v2ProjectRouter.POST("/:project_name/workflows/:workflow_id/tasks/:task_id/execute", v2.ExecuteOneTaskOnWorkflowV2)
+ v2ProjectRouter.GET("/:project_name/workflows/:workflow_id/tasks", v2.GetSummaryOfWorkflowTasksV2)
+ v2ProjectRouter.POST("/:project_name/workflows/:workflow_id/tasks/execute", v2.ExecuteTasksOnWorkflowV2)
+ v2ProjectRouter.PUT("/:project_name/workflows/:workflow_id/tasks/:task_id/schedule", v2.UpdateWorkflowScheduleV2)
+ v2ProjectRouter.PATCH("/:project_name/workflows/:workflow_id/", v2.UpdateWorkflowV2)
+
+ // instance
+ v2ProjectRouter.GET("/:project_name/instances/:instance_name/", v2.GetInstance)
+ // audit plan; 智能扫描任务
+ v2ProjectRouter.GET("/:project_name/audit_plans", v2.GetAuditPlans)
+ v2ProjectRouter.GET("/:project_name/audit_plans/:audit_plan_name/reports/:audit_plan_report_id/sqls/:number/analysis", v2.GetAuditPlanAnalysisData)
+ v2ProjectRouter.GET("/:project_name/audit_plans/:audit_plan_name/reports/:audit_plan_report_id/sqls", v2.GetAuditPlanReportSQLs)
+ // sql managers
+ v2ProjectRouter.GET("/:project_name/sql_manages", v2.GetSqlManageList)
+
+ // scanner token auth
+ v2ProjectRouter.POST("/:project_name/audit_plans/:audit_plan_name/sqls/full", v2.FullSyncAuditPlanSQLs, sqleMiddleware.ScannerVerifier())
+ v2ProjectRouter.POST("/:project_name/audit_plans/:audit_plan_name/sqls/partial", v2.PartialSyncAuditPlanSQLs, sqleMiddleware.ScannerVerifier())
+
+ }
+
+ {
+ v1Router.GET("/user_tips", v1.GetUserTips)
+
+ // 全局 rule template
+ v1Router.GET("/rule_templates", v1.GetRuleTemplates)
+ v1Router.GET("/rule_template_tips", v1.GetRuleTemplateTips)
+ v1Router.GET("/rule_templates/:rule_template_name/", v1.GetRuleTemplate)
+
+ v1Router.POST("/rule_templates/parse", v1.ParseProjectRuleTemplateFile)
+
+ // 全局 workflow
+ v1Router.GET("/workflows", v1.GetGlobalWorkflowsV1)
+ v1Router.GET("/rule_knowledge/db_types/:db_type/rules/:rule_name/", v1.GetRuleKnowledge)
+ v1Router.GET("/rule_knowledge/db_types/:db_type/custom_rules/:rule_name/", v1.GetCustomRuleKnowledge)
+
+ //rule
+ v1Router.GET("/rules", v1.GetRules)
+ v1Router.GET("/custom_rules", v1.GetCustomRules)
+ v1Router.GET("/custom_rules/:rule_id", v1.GetCustomRule)
+ v1Router.GET("/custom_rules/:db_type/rule_types", v1.GetRuleTypeByDBType)
+
+ // task
+ v1Router.GET("/tasks/audits/:task_id/", v1.GetTask)
+ v1Router.GET("/tasks/audits/:task_id/sqls", v1.GetTaskSQLs)
+ v2Router.GET("/tasks/audits/:task_id/sqls", v2.GetTaskSQLs)
+ v1Router.GET("/tasks/audits/:task_id/sql_report", v1.DownloadTaskSQLReportFile)
+ v1Router.GET("/tasks/audits/:task_id/sql_file", v1.DownloadTaskSQLFile)
+ v1Router.GET("/tasks/audits/:task_id/sql_content", v1.GetAuditTaskSQLContent)
+ v1Router.PATCH("/tasks/audits/:task_id/sqls/:number", v1.UpdateAuditTaskSQLs)
+ v1Router.GET("/tasks/audits/:task_id/sqls/:number/analysis", v1.GetTaskAnalysisData)
+ v2Router.GET("/tasks/audits/:task_id/sqls/:number/analysis", v2.GetTaskAnalysisData)
+ v1Router.POST("/projects/:project_name/task_groups", v1.CreateAuditTasksGroupV1)
+ v1Router.POST("/task_groups/audit", v1.AuditTaskGroupV1)
+
+ // dashboard
+ v1Router.GET("/dashboard", v1.Dashboard)
+
+ // configurations
+ v1Router.GET("/configurations/drivers", v1.GetDrivers)
+ v2Router.GET("/configurations/drivers", v2.GetDrivers)
+
+ // audit plan
+ v1Router.GET("/audit_plan_metas", v1.GetAuditPlanMetas)
+ v1Router.GET("/audit_plan_types", v1.GetAuditPlanTypes)
+
+ // sql audit
+ v1Router.POST("/sql_audit", v1.DirectAudit)
+ v2Router.POST("/sql_audit", v2.DirectAudit)
+ v1Router.POST("/audit_files", v1.DirectAuditFiles)
+ v2Router.POST("/audit_files", v2.DirectAuditFiles)
+ v1Router.GET("/sql_analysis", v1.DirectGetSQLAnalysis)
+ // 企业公告
+ v1Router.GET("/company_notice", v1.GetCompanyNotice)
+ }
// enterprise customized apis
err := addCustomApis(v1Router, restApis)
@@ -451,7 +369,7 @@ func StartApi(net *gracenet.Net, exitChan chan struct{}, config config.SqleConfi
return c.File("ui/index.html")
})
- address := fmt.Sprintf(":%v", config.SqleServerPort)
+ address := fmt.Sprintf(":%v", config.APIServiceOpts.Port)
log.Logger().Infof("starting http server on %s", address)
// start http server
@@ -460,16 +378,17 @@ func StartApi(net *gracenet.Net, exitChan chan struct{}, config config.SqleConfi
log.Logger().Fatal(err)
return
}
- if config.EnableHttps {
+
+ if config.APIServiceOpts.EnableHttps {
// Usually, it is easier to create an tls server using echo#StartTLS;
// but I need create a graceful listener.
- if config.CertFilePath == "" || config.KeyFilePath == "" {
+ if config.APIServiceOpts.CertFilePath == "" || config.APIServiceOpts.KeyFilePath == "" {
log.Logger().Fatal("invalid tls configuration")
return
}
tlsConfig := new(tls.Config)
tlsConfig.Certificates = make([]tls.Certificate, 1)
- tlsConfig.Certificates[0], err = tls.LoadX509KeyPair(config.CertFilePath, config.KeyFilePath)
+ tlsConfig.Certificates[0], err = tls.LoadX509KeyPair(config.APIServiceOpts.CertFilePath, config.APIServiceOpts.KeyFilePath)
if err != nil {
log.Logger().Fatal("load x509 key pair failed, error:", err)
return
@@ -484,18 +403,6 @@ func StartApi(net *gracenet.Net, exitChan chan struct{}, config config.SqleConfi
}
}
-// AdminUserAllowed is a `echo` middleware, only allow admin user to access next.
-func AdminUserAllowed() echo.MiddlewareFunc {
- return func(next echo.HandlerFunc) echo.HandlerFunc {
- return func(c echo.Context) error {
- if controller.GetUserName(c) == model.DefaultAdminUser {
- return next(c)
- }
- return echo.NewHTTPError(http.StatusForbidden)
- }
- }
-}
-
// DeprecatedBy is a controller used to mark deprecated and used to replace the original controller.
func DeprecatedBy(version string) func(echo.Context) error {
return func(ctx echo.Context) error {
diff --git a/sqle/api/cloudbeaver_wrapper/app.go b/sqle/api/cloudbeaver_wrapper/app.go
deleted file mode 100644
index f793122e4b..0000000000
--- a/sqle/api/cloudbeaver_wrapper/app.go
+++ /dev/null
@@ -1,347 +0,0 @@
-package cloudbeaver_wrapper
-
-import (
- "bufio"
- "bytes"
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "io/ioutil"
- "net"
- "net/http"
- "net/url"
- "path"
- "strconv"
- "sync"
-
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/controller"
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/graph/model"
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/graph/resolver"
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/service"
- "github.com/actiontech/sqle/sqle/log"
- sqleModel "github.com/actiontech/sqle/sqle/model"
- "github.com/actiontech/sqle/sqle/utils"
-
- "github.com/99designs/gqlgen/graphql"
- "github.com/99designs/gqlgen/graphql/executor"
- "github.com/labstack/echo/v4"
- "github.com/labstack/echo/v4/middleware"
-)
-
-type gqlBehavior struct {
- useLocalHandler bool
- needModifyRemoteRes bool
- disable bool
- // 预处理主要用于在真正使用前处理前端传递的参数, 比如需要接收int, 但收到float, 则可以在此处调整参数类型
- preprocessing func(ctx echo.Context, params *graphql.RawParams) error
-}
-
-var gqlHandlerRouters = map[string] /* gql operation name */ gqlBehavior{
- "asyncSqlExecuteQuery": {
- useLocalHandler: true,
- needModifyRemoteRes: false,
- preprocessing: func(ctx echo.Context, params *graphql.RawParams) (err error) {
- // json中没有int类型, 这将导致执行json.Unmarshal()时int会被当作float64, 从而导致后面出现类型错误的异常
- if filter, ok := params.Variables["filter"].(map[string]interface{}); ok {
- if filter["limit"] != nil {
- params.Variables["filter"].(map[string]interface{})["limit"], err = strconv.Atoi(fmt.Sprintf("%v", params.Variables["filter"].(map[string]interface{})["limit"]))
- }
- }
- return err
- },
- },
- "getActiveUser": {
- useLocalHandler: true,
- needModifyRemoteRes: true,
- }, "authLogout": {
- disable: true,
- }, "authLogin": {
- disable: true,
- }, "configureServer": {
- disable: true,
- }, "createUser": {
- disable: true,
- }, "setUserCredentials": {
- disable: true,
- }, "enableUser": {
- disable: true,
- }, "grantUserRole": {
- disable: true,
- }, "setConnections": {
- disable: true,
- }, "saveUserMetaParameters": {
- disable: true,
- }, "deleteUser": {
- disable: true,
- }, "createRole": {
- disable: true,
- }, "updateRole": {
- disable: true,
- }, "deleteRole": {
- disable: true,
- }, "authChangeLocalPassword": {
- disable: true,
- },
-}
-
-func StartApp(e *echo.Echo) error {
- if !service.IsCloudBeaverConfigured() {
- return nil
- }
- cfg := service.GetSQLQueryConfig()
- protocol := "http"
- if cfg.EnableHttps {
- protocol = "https"
- }
- url2, err := url.Parse(fmt.Sprintf("%v://%v:%v", protocol, cfg.CloudBeaverHost, cfg.CloudBeaverPort))
- if err != nil {
- return err
- }
- targets := []*middleware.ProxyTarget{
- {
- URL: url2,
- },
- }
-
- err = service.InitGQLVersion()
- if err != nil {
- return err
- }
-
- q := e.Group(service.CbRootUri)
-
- q.Use(TriggerLogin())
- q.Use(GraphqlDistributor())
- q.Use(middleware.ProxyWithConfig(middleware.ProxyConfig{
- Skipper: middleware.DefaultSkipper,
- Balancer: middleware.NewRandomBalancer(targets),
- }))
-
- return nil
-}
-
-var (
- sqleTokenToCBSessionId = make(map[string]string)
- tokenMapMutex = &sync.Mutex{}
-)
-
-func getCBSessionIdBySqleToken(token string) string {
- tokenMapMutex.Lock()
- defer tokenMapMutex.Unlock()
- return sqleTokenToCBSessionId[token]
-}
-
-func setCBSessionIdBySqleToken(token, cbSessionId string) {
- tokenMapMutex.Lock()
- defer tokenMapMutex.Unlock()
- sqleTokenToCBSessionId[token] = cbSessionId
-}
-
-func UnbindCBSessionIdBySqleToken(token string) {
- tokenMapMutex.Lock()
- defer tokenMapMutex.Unlock()
- delete(sqleTokenToCBSessionId, token)
-}
-
-// 如果当前用户没有登录cloudbeaver,则登录
-func TriggerLogin() echo.MiddlewareFunc {
- return func(next echo.HandlerFunc) echo.HandlerFunc {
- return func(c echo.Context) error {
- var sqleToken string
- // 根据cookie中的sqle-token查找对应用户的cb-session-id
- for _, c := range c.Cookies() {
- if c.Name == "sqle-token" {
- sqleToken = c.Value
- break
- }
- }
- if sqleToken == "" {
- // 没有找到sqle-token,有可能是用户直接通过url访问cb页面,但没有登录sqle
- return c.Redirect(http.StatusFound, "/login?target=/sqlQuery")
- }
- l := log.NewEntry().WithField("action", "trigger cloudbeaver login")
- CBSessionId := getCBSessionIdBySqleToken(sqleToken)
- if CBSessionId != "" {
- c.Request().Header.Set("Cookie", "cb-session-id="+CBSessionId)
- // 判断是否访问cb数据接口,在访问前发送测试请求验证session id是否过期
- if c.Request().RequestURI == "/sql_query/api/gql" {
- activeUser, err := service.GetActiveUserQuery(c.Cookies())
- if err != nil {
- l.Errorf("get active user failed: %v", err)
- return err
- }
- if activeUser.User == nil {
- goto LoginCb
- }
- }
- c.Request().Header.Set("Cookie", "cb-session-id="+CBSessionId)
- return next(c)
- }
- LoginCb:
- // CBSessionId不存在认为当前用户没有登录cb,登录cb
- userName, err := utils.GetUserNameFromJWTToken(sqleToken)
- if err != nil {
- l.Errorf("get user name from token failed: %v", err)
- return errors.New("get user name to login failed")
- }
- s := sqleModel.GetStorage()
- user, _, err := s.GetUserByName(userName)
- if err != nil {
- l.Errorf("get user info err: %v", err)
- return err
- }
-
- cbUser := service.GenerateCloudBeaverUserName(userName)
- // 同步信息
- if err = service.SyncCurrentUser(cbUser); err != nil {
- l.Errorf("sync cloudbeaver user %v info failed: %v", cbUser, err)
- }
- err = service.SyncUserBindInstance(cbUser)
- if err != nil {
- l.Errorf("sync cloudbeaver user %v bind instance failed: %v", cbUser, err)
- }
- cookies, err := service.LoginToCBServer(cbUser, user.Password)
- if err != nil {
- l.Errorf("login to cloudbeaver failed: %v", err)
- return err
- }
-
- // 添加sqle和cb的用户映射
- for _, ck := range cookies {
- if ck.Name == "cb-session-id" {
- setCBSessionIdBySqleToken(sqleToken, ck.Value)
- CBSessionId = ck.Value
- }
- }
- c.Request().Header.Set("Cookie", "cb-session-id="+CBSessionId)
- return next(c)
- }
- }
-}
-
-func GraphqlDistributor() echo.MiddlewareFunc {
- return func(next echo.HandlerFunc) echo.HandlerFunc {
- return func(c echo.Context) error {
- if c.Request().RequestURI != path.Join(service.CbRootUri, service.CbGqlApi) {
- return next(c)
- }
- // copy request body
- reqBody := []byte{}
- if c.Request().Body != nil { // Read
- reqBody, _ = ioutil.ReadAll(c.Request().Body)
- }
- c.Request().Body = ioutil.NopCloser(bytes.NewBuffer(reqBody)) // Reset
-
- var params *graphql.RawParams
- err := json.Unmarshal(reqBody, ¶ms)
- if err != nil {
- fmt.Println(err)
- return err
- }
-
- bh, ok := gqlHandlerRouters[params.OperationName]
- if !ok {
- return next(c)
- }
-
- if bh.disable {
- errMsg := "this feature is prohibited"
- fmt.Printf("%v:%v", errMsg, params.OperationName)
- return c.JSON(http.StatusOK, model.ServerError{
- Message: &errMsg,
- })
- }
-
- if bh.preprocessing != nil {
- err = bh.preprocessing(c, params)
- if err != nil {
- fmt.Println(err)
- return err
- }
- }
-
- if bh.useLocalHandler {
- params.ReadTime = graphql.TraceTiming{
- Start: graphql.Now(),
- End: graphql.Now(),
- }
- ctx := graphql.StartOperationTrace(context.TODO())
- params.Headers = c.Request().Header.Clone()
-
- var n controller.Next
- var resWrite *responseProcessWriter
- if !bh.needModifyRemoteRes {
- n = func(c echo.Context) ([]byte, error) {
- return nil, next(c)
- }
- } else {
- n = func(c echo.Context) ([]byte, error) {
- resWrite = &responseProcessWriter{tmp: &bytes.Buffer{}, ResponseWriter: c.Response().Writer}
- c.Response().Writer = resWrite
- err := next(c)
- if err != nil {
- return nil, err
- }
- return resWrite.tmp.Bytes(), nil
- }
- }
-
- g := resolver.NewExecutableSchema(resolver.Config{
- Resolvers: &controller.ResolverImpl{
- Ctx: c,
- Next: n,
- },
- })
-
- exec := executor.New(g)
-
- rc, err := exec.CreateOperationContext(ctx, params)
- if err != nil {
- return err
- }
- responses, ctx := exec.DispatchOperation(ctx, rc)
-
- res := responses(ctx)
- if res.Errors.Error() != "" {
- return res.Errors
- }
- if !bh.needModifyRemoteRes {
- return nil
- } else {
- header := resWrite.ResponseWriter.Header()
- b, err := json.Marshal(res)
- if err != nil {
- return err
- }
- header.Set("Content-Length", fmt.Sprintf("%d", len(b)))
- _, err = resWrite.ResponseWriter.Write(b)
- return err
- }
- }
- return next(c)
- }
- }
-}
-
-type responseProcessWriter struct {
- tmp *bytes.Buffer
- headerCode int
- http.ResponseWriter
-}
-
-func (w *responseProcessWriter) WriteHeader(code int) {
- w.headerCode = code
-}
-
-func (w *responseProcessWriter) Write(b []byte) (int, error) {
- return w.tmp.Write(b)
-}
-
-func (w *responseProcessWriter) Flush() {
- w.ResponseWriter.(http.Flusher).Flush()
-}
-
-func (w *responseProcessWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
- return w.ResponseWriter.(http.Hijacker).Hijack()
-}
diff --git a/sqle/api/cloudbeaver_wrapper/controller/audit.go b/sqle/api/cloudbeaver_wrapper/controller/audit.go
deleted file mode 100644
index 7e997d57ad..0000000000
--- a/sqle/api/cloudbeaver_wrapper/controller/audit.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package controller
-
-import (
- "context"
- "fmt"
- "net/http"
-
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/graph/model"
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/service"
-)
-
-func (r *MutationResolverImpl) AsyncSQLExecuteQuery(ctx context.Context, projectID *string, connectionID string, contextID string, sql string, resultID *string, filter *model.SQLDataFilter, dataFormat *model.ResultDataFormat, readLogs *bool) (*model.AsyncTaskInfo, error) {
- success, result, err := service.AuditSQL(sql, connectionID)
- if err != nil {
- return nil, err
- }
- if !success {
- name := "SQL Audit Failed"
- msg := fmt.Sprintf("[SQLE] sql statements are not allowed to excute, caused by: \nthe highest error level in audit results is %v, which reaches the error level limit (%v) set in SQLE.", result.AuditLevel, result.LimitLevel)
- return nil, r.Ctx.JSON(http.StatusOK, struct {
- Data struct {
- TaskInfo model.AsyncTaskInfo `json:"taskInfo"`
- } `json:"data"`
- }{
- struct {
- TaskInfo model.AsyncTaskInfo `json:"taskInfo"`
- }{
- TaskInfo: model.AsyncTaskInfo{
- Name: &name,
- Running: false,
- Status: &sql,
- Error: &model.ServerError{
- Message: &msg,
- StackTrace: &result.Result,
- },
- },
- },
- })
- }
-
- _, err = r.Next(r.Ctx)
- if err != nil {
- return nil, err
- }
-
- return nil, err
-}
diff --git a/sqle/api/cloudbeaver_wrapper/controller/base.go b/sqle/api/cloudbeaver_wrapper/controller/base.go
deleted file mode 100644
index b86d702633..0000000000
--- a/sqle/api/cloudbeaver_wrapper/controller/base.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package controller
-
-import (
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/graph/resolver"
-
- "github.com/labstack/echo/v4"
-)
-
-type Next func(c echo.Context) ([]byte, error)
-
-type ResolverImpl struct {
- *resolver.Resolver
- Ctx echo.Context
- Next Next
-}
-
-func (r *ResolverImpl) Mutation() resolver.MutationResolver {
- return &MutationResolverImpl{
- Ctx: r.Ctx,
- Next: r.Next,
- }
-}
-
-// Query returns generated.QueryResolver implementation.
-func (r *ResolverImpl) Query() resolver.QueryResolver {
- return &QueryResolverImpl{
- Ctx: r.Ctx,
- Next: r.Next,
- }
-}
-
-type MutationResolverImpl struct {
- *resolver.MutationResolverImpl
- Ctx echo.Context
- Next Next
-}
-
-type QueryResolverImpl struct {
- *resolver.QueryResolverImpl
- Ctx echo.Context
- Next Next
-}
diff --git a/sqle/api/cloudbeaver_wrapper/controller/login.go b/sqle/api/cloudbeaver_wrapper/controller/login.go
deleted file mode 100644
index 8878864787..0000000000
--- a/sqle/api/cloudbeaver_wrapper/controller/login.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package controller
-
-import (
- "context"
- "encoding/json"
-
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/graph/model"
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/service"
-)
-
-// ActiveUser is the resolver for the activeUser field.
-func (r *QueryResolverImpl) ActiveUser(ctx context.Context) (*model.UserInfo, error) {
- data, err := r.Next(r.Ctx)
- if err != nil {
- return nil, err
- }
-
- resp := &struct {
- Data struct {
- User *model.UserInfo `json:"user"`
- } `json:"data"`
- }{}
-
- err = json.Unmarshal(data, resp)
- if err != nil {
- return nil, err
- }
-
- if resp.Data.User != nil && resp.Data.User.DisplayName != nil {
- *resp.Data.User.DisplayName = service.RestoreFromCloudBeaverUserName(*resp.Data.User.DisplayName)
- }
-
- return resp.Data.User, err
-}
diff --git a/sqle/api/cloudbeaver_wrapper/graph/client/client.go b/sqle/api/cloudbeaver_wrapper/graph/client/client.go
deleted file mode 100644
index 5eacc178dc..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/client/client.go
+++ /dev/null
@@ -1,332 +0,0 @@
-package client
-
-import (
- "bytes"
- "context"
- "encoding/json"
- "fmt"
- "io"
- "mime/multipart"
- "net/http"
-
- "github.com/pkg/errors"
-)
-
-// Client is a client for interacting with a GraphQL API.
-type Client struct {
- endpoint string
- httpClient *http.Client
- useMultipartForm bool
-
- cookies []*http.Cookie
-
- // closeReq will close the request body immediately allowing for reuse of client
- closeReq bool
-
- // Log is called with various debug information.
- // To log to standard out, use:
- // client.Log = func(s string) { log.Println(s) }
- Log func(s string)
-
- HttpResHandler func(res *http.Response)
-}
-
-// NewClient makes a new Client capable of making GraphQL requests.
-func NewClient(endpoint string, opts ...ClientOption) *Client {
- c := &Client{
- endpoint: endpoint,
- Log: func(string) {},
- }
- for _, optionFunc := range opts {
- optionFunc(c)
- }
- if c.httpClient == nil {
- c.httpClient = http.DefaultClient
- }
- return c
-}
-
-func (c *Client) logf(format string, args ...interface{}) {
- c.Log(fmt.Sprintf(format, args...))
-}
-
-// Run executes the query and unmarshals the response from the data field
-// into the response object.
-// Pass in a nil response object to skip response parsing.
-// If the request fails or the server returns an error, the first error
-// will be returned.
-func (c *Client) Run(ctx context.Context, req *Request, resp interface{}) error {
- select {
- case <-ctx.Done():
- return ctx.Err()
- default:
- }
- if len(req.files) > 0 && !c.useMultipartForm {
- return errors.New("cannot send files with PostFields option")
- }
- if c.useMultipartForm {
- return c.runWithPostFields(ctx, req, resp)
- }
- return c.runWithJSON(ctx, req, resp)
-}
-
-func (c *Client) runWithJSON(ctx context.Context, req *Request, resp interface{}) error {
- var requestBody bytes.Buffer
- requestBodyObj := struct {
- Query string `json:"query"`
- Variables map[string]interface{} `json:"variables"`
- OperationName string `json:"operationName"`
- }{
- Query: req.q,
- Variables: req.vars,
- }
- if req.operationName != "" {
- requestBodyObj.OperationName = req.operationName
- }
- if err := json.NewEncoder(&requestBody).Encode(requestBodyObj); err != nil {
- return errors.Wrap(err, "encode body")
- }
- c.logf(">> variables: %v", req.vars)
- c.logf(">> query: %s", req.q)
- gr := &graphResponse{
- Data: resp,
- }
- r, err := http.NewRequest(http.MethodPost, c.endpoint, &requestBody)
- if err != nil {
- return err
- }
- r.Close = c.closeReq
- r.Header.Set("Content-Type", "application/json; charset=utf-8")
- r.Header.Set("Accept", "application/json; charset=utf-8")
- for _, cookie := range c.cookies {
- r.AddCookie(cookie)
- }
- for key, values := range req.Header {
- for _, value := range values {
- r.Header.Add(key, value)
- }
- }
- c.logf(">> headers: %v", r.Header)
- r = r.WithContext(ctx)
- res, err := c.httpClient.Do(r)
- if err != nil {
- return err
- }
- if c.HttpResHandler != nil {
- c.HttpResHandler(res)
- }
-
- defer res.Body.Close()
- var buf bytes.Buffer
- if _, err := io.Copy(&buf, res.Body); err != nil {
- return errors.Wrap(err, "reading body")
- }
- c.logf("<< %s", buf.String())
- if err := json.NewDecoder(&buf).Decode(&gr); err != nil {
- if res.StatusCode != http.StatusOK {
- return fmt.Errorf("graphql: server returned a non-200 status code: %v", res.StatusCode)
- }
- return errors.Wrap(err, "decoding response")
- }
- if len(gr.Errors) > 0 {
- // return first error
- return gr.Errors[0]
- }
- return nil
-}
-
-func (c *Client) runWithPostFields(ctx context.Context, req *Request, resp interface{}) error {
- var requestBody bytes.Buffer
- writer := multipart.NewWriter(&requestBody)
- if err := writer.WriteField("query", req.q); err != nil {
- return errors.Wrap(err, "write query field")
- }
- var variablesBuf bytes.Buffer
- if len(req.vars) > 0 {
- variablesField, err := writer.CreateFormField("variables")
- if err != nil {
- return errors.Wrap(err, "create variables field")
- }
- if err := json.NewEncoder(io.MultiWriter(variablesField, &variablesBuf)).Encode(req.vars); err != nil {
- return errors.Wrap(err, "encode variables")
- }
- }
- for i := range req.files {
- part, err := writer.CreateFormFile(req.files[i].Field, req.files[i].Name)
- if err != nil {
- return errors.Wrap(err, "create form file")
- }
- if _, err := io.Copy(part, req.files[i].R); err != nil {
- return errors.Wrap(err, "preparing file")
- }
- }
- if err := writer.Close(); err != nil {
- return errors.Wrap(err, "close writer")
- }
- c.logf(">> variables: %s", variablesBuf.String())
- c.logf(">> files: %d", len(req.files))
- c.logf(">> query: %s", req.q)
- gr := &graphResponse{
- Data: resp,
- }
- r, err := http.NewRequest(http.MethodPost, c.endpoint, &requestBody)
- if err != nil {
- return err
- }
- r.Close = c.closeReq
- r.Header.Set("Content-Type", writer.FormDataContentType())
- r.Header.Set("Accept", "application/json; charset=utf-8")
- for _, cookie := range c.cookies {
- r.AddCookie(cookie)
- }
- for key, values := range req.Header {
- for _, value := range values {
- r.Header.Add(key, value)
- }
- }
- c.logf(">> headers: %v", r.Header)
- r = r.WithContext(ctx)
- res, err := c.httpClient.Do(r)
- if err != nil {
- return err
- }
- defer res.Body.Close()
- var buf bytes.Buffer
- if _, err := io.Copy(&buf, res.Body); err != nil {
- return errors.Wrap(err, "reading body")
- }
- c.logf("<< %s", buf.String())
- if err := json.NewDecoder(&buf).Decode(&gr); err != nil {
- if res.StatusCode != http.StatusOK {
- return fmt.Errorf("graphql: server returned a non-200 status code: %v", res.StatusCode)
- }
- return errors.Wrap(err, "decoding response")
- }
- if len(gr.Errors) > 0 {
- // return first error
- return gr.Errors[0]
- }
- return nil
-}
-
-// WithHTTPClient specifies the underlying http.Client to use when
-// making requests.
-// NewClient(endpoint, WithHTTPClient(specificHTTPClient))
-func WithHTTPClient(httpclient *http.Client) ClientOption {
- return func(client *Client) {
- client.httpClient = httpclient
- }
-}
-
-// UseMultipartForm uses multipart/form-data and activates support for
-// files.
-func UseMultipartForm() ClientOption {
- return func(client *Client) {
- client.useMultipartForm = true
- }
-}
-
-//ImmediatelyCloseReqBody will close the req body immediately after each request body is ready
-func ImmediatelyCloseReqBody() ClientOption {
- return func(client *Client) {
- client.closeReq = true
- }
-}
-
-func WithHttpResHandler(fn func(response *http.Response)) ClientOption {
- return func(client *Client) {
- client.HttpResHandler = fn
- }
-}
-
-func WithCookie(cookie []*http.Cookie) ClientOption {
- return func(client *Client) {
- client.cookies = cookie
- }
-}
-
-// ClientOption are functions that are passed into NewClient to
-// modify the behaviour of the Client.
-type ClientOption func(*Client)
-
-type graphError struct {
- Message string
-}
-
-func (e graphError) Error() string {
- return "graphql: " + e.Message
-}
-
-type graphResponse struct {
- Data interface{}
- Errors []graphError
-}
-
-// Request is a GraphQL request.
-type Request struct {
- q string
- vars map[string]interface{}
- operationName string
- files []File
-
- // Header represent any request headers that will be set
- // when the request is made.
- Header http.Header
-}
-
-// NewRequest makes a new Request with the specified string.
-func NewRequest(q string, variables map[string]interface{}) *Request {
- req := &Request{
- q: q,
- Header: make(map[string][]string),
- vars: variables,
- }
- return req
-}
-
-// SetOperationName set operation name
-// 发往SQLE的请求如果指定了OperationName, 请求会被SQLE拦截并通过对应逻辑处理, 不添加OperationName的请求会被SQLE直接转发
-func (req *Request) SetOperationName(operationName string) {
- req.operationName = operationName
-}
-
-// Var sets a variable.
-func (req *Request) Var(key string, value interface{}) {
- if req.vars == nil {
- req.vars = make(map[string]interface{})
- }
- req.vars[key] = value
-}
-
-// Vars gets the variables for this Request.
-func (req *Request) Vars() map[string]interface{} {
- return req.vars
-}
-
-// Files gets the files in this request.
-func (req *Request) Files() []File {
- return req.files
-}
-
-// Query gets the query string of this request.
-func (req *Request) Query() string {
- return req.q
-}
-
-// File sets a file to upload.
-// Files are only supported with a Client that was created with
-// the UseMultipartForm option.
-func (req *Request) File(fieldname, filename string, r io.Reader) {
- req.files = append(req.files, File{
- Field: fieldname,
- Name: filename,
- R: r,
- })
-}
-
-// File represents a file to upload.
-type File struct {
- Field string
- Name string
- R io.Reader
-}
diff --git a/sqle/api/cloudbeaver_wrapper/graph/gqlgen.yml b/sqle/api/cloudbeaver_wrapper/graph/gqlgen.yml
deleted file mode 100644
index a0b7e9c647..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/gqlgen.yml
+++ /dev/null
@@ -1,39 +0,0 @@
-# Where are all the schema files located? globs are supported eg src/**/*.graphqls
-schema:
- - ./schema/*.graphqls
-
-exec:
- filename: ./resolver/executor_gen.go
- package: resolver
-
-model:
- filename: ./model/models_gen.go
- package: model
-
-resolver:
- layout: follow-schema
- filename_template: "{name}_gen.go"
- dir: ./resolver
- package: resolver
-
-models:
- ID:
- model:
- - github.com/99designs/gqlgen/graphql.ID
- - github.com/99designs/gqlgen/graphql.Int
- - github.com/99designs/gqlgen/graphql.Int64
- - github.com/99designs/gqlgen/graphql.Int32
- Int:
- model:
- - github.com/99designs/gqlgen/graphql.Int
- - github.com/99designs/gqlgen/graphql.Int64
- - github.com/99designs/gqlgen/graphql.Int32
-
- Object:
- model:
- - github.com/99designs/gqlgen/graphql.Any
-
- DateTime:
- model:
- - github.com/99designs/gqlgen/graphql.Time
-
diff --git a/sqle/api/cloudbeaver_wrapper/graph/model/json.go b/sqle/api/cloudbeaver_wrapper/graph/model/json.go
deleted file mode 100644
index 9b5bacfe0e..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/model/json.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package model
-
-import (
- "encoding/json"
- "io"
-)
-
-type JSON map[string]interface{}
-
-// UnmarshalGQL implements the graphql.Unmarshaler interface
-func (b *JSON) UnmarshalGQL(v interface{}) error {
- *b = make(map[string]interface{})
- byteData, err := json.Marshal(v)
- if err != nil {
- panic("FAIL WHILE MARSHAL SCHEME")
- }
- tmp := make(map[string]interface{})
- err = json.Unmarshal(byteData, &tmp)
- if err != nil {
- panic("FAIL WHILE UNMARSHAL SCHEME")
- //return fmt.Errorf("%v", err)
- }
- *b = tmp
- return nil
-}
-
-// MarshalGQL implements the graphql.Marshaler interface
-func (b JSON) MarshalGQL(w io.Writer) {
- byteData, err := json.Marshal(b)
- if err != nil {
- panic("FAIL WHILE MARSHAL SCHEME")
- }
- _, _ = w.Write(byteData)
-}
diff --git a/sqle/api/cloudbeaver_wrapper/graph/model/models_gen.go b/sqle/api/cloudbeaver_wrapper/graph/model/models_gen.go
deleted file mode 100644
index 9dd0b67b45..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/model/models_gen.go
+++ /dev/null
@@ -1,993 +0,0 @@
-// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
-
-package model
-
-import (
- "fmt"
- "io"
- "strconv"
- "time"
-)
-
-type AdminAuthProviderConfiguration struct {
- ProviderID string `json:"providerId"`
- ID string `json:"id"`
- DisplayName string `json:"displayName"`
- Disabled bool `json:"disabled"`
- IconURL *string `json:"iconURL"`
- Description *string `json:"description"`
- Parameters interface{} `json:"parameters"`
- SignInLink *string `json:"signInLink"`
- SignOutLink *string `json:"signOutLink"`
- RedirectLink *string `json:"redirectLink"`
- MetadataLink *string `json:"metadataLink"`
-}
-
-type AdminConnectionGrantInfo struct {
- ConnectionID string `json:"connectionId"`
- DataSourceID string `json:"dataSourceId"`
- SubjectID string `json:"subjectId"`
- SubjectType AdminSubjectType `json:"subjectType"`
-}
-
-type AdminConnectionSearchInfo struct {
- DisplayName string `json:"displayName"`
- Host string `json:"host"`
- Port int `json:"port"`
- PossibleDrivers []string `json:"possibleDrivers"`
- DefaultDriver string `json:"defaultDriver"`
-}
-
-type AdminPermissionInfo struct {
- ID string `json:"id"`
- Label *string `json:"label"`
- Description *string `json:"description"`
- Provider string `json:"provider"`
- Category *string `json:"category"`
-}
-
-type AdminRoleInfo struct {
- RoleID string `json:"roleId"`
- RoleName *string `json:"roleName"`
- Description *string `json:"description"`
- GrantedUsers []string `json:"grantedUsers"`
- GrantedConnections []*AdminConnectionGrantInfo `json:"grantedConnections"`
- RolePermissions []string `json:"rolePermissions"`
-}
-
-type AdminUserInfo struct {
- UserID string `json:"userId"`
- MetaParameters interface{} `json:"metaParameters"`
- ConfigurationParameters interface{} `json:"configurationParameters"`
- GrantedRoles []string `json:"grantedRoles"`
- GrantedConnections []*AdminConnectionGrantInfo `json:"grantedConnections"`
- Origins []*ObjectOrigin `json:"origins"`
- LinkedAuthProviders []string `json:"linkedAuthProviders"`
- Enabled bool `json:"enabled"`
-}
-
-type AsyncTaskInfo struct {
- ID string `json:"id"`
- Name *string `json:"name"`
- Running bool `json:"running"`
- Status *string `json:"status"`
- Error *ServerError `json:"error"`
- Result *SQLExecuteInfo `json:"result"`
- TaskResult interface{} `json:"taskResult"`
-}
-
-type AuthCredentialInfo struct {
- ID string `json:"id"`
- DisplayName string `json:"displayName"`
- Description *string `json:"description"`
- Admin bool `json:"admin"`
- User bool `json:"user"`
- Identifying bool `json:"identifying"`
- PossibleValues []*string `json:"possibleValues"`
- Encryption *AuthCredentialEncryption `json:"encryption"`
-}
-
-type AuthInfo struct {
- RedirectLink *string `json:"redirectLink"`
- AuthID *string `json:"authId"`
- AuthStatus AuthStatus `json:"authStatus"`
- UserTokens []*UserAuthToken `json:"userTokens"`
-}
-
-type AuthProviderConfiguration struct {
- ID string `json:"id"`
- DisplayName string `json:"displayName"`
- Disabled bool `json:"disabled"`
- IconURL *string `json:"iconURL"`
- Description *string `json:"description"`
- SignInLink *string `json:"signInLink"`
- SignOutLink *string `json:"signOutLink"`
- MetadataLink *string `json:"metadataLink"`
-}
-
-type AuthProviderCredentialsProfile struct {
- ID *string `json:"id"`
- Label *string `json:"label"`
- Description *string `json:"description"`
- CredentialParameters []*AuthCredentialInfo `json:"credentialParameters"`
-}
-
-type AuthProviderInfo struct {
- ID string `json:"id"`
- Label string `json:"label"`
- Icon *string `json:"icon"`
- Description *string `json:"description"`
- DefaultProvider bool `json:"defaultProvider"`
- Configurable bool `json:"configurable"`
- Configurations []*AuthProviderConfiguration `json:"configurations"`
- CredentialProfiles []*AuthProviderCredentialsProfile `json:"credentialProfiles"`
- RequiredFeatures []string `json:"requiredFeatures"`
-}
-
-type ConnectionConfig struct {
- ConnectionID *string `json:"connectionId"`
- Name *string `json:"name"`
- Description *string `json:"description"`
- TemplateID *string `json:"templateId"`
- DriverID *string `json:"driverId"`
- Host *string `json:"host"`
- Port *string `json:"port"`
- ServerName *string `json:"serverName"`
- DatabaseName *string `json:"databaseName"`
- URL *string `json:"url"`
- Properties interface{} `json:"properties"`
- Template *bool `json:"template"`
- ReadOnly *bool `json:"readOnly"`
- SaveCredentials *bool `json:"saveCredentials"`
- AuthModelID *string `json:"authModelId"`
- Credentials interface{} `json:"credentials"`
- ProviderProperties interface{} `json:"providerProperties"`
- NetworkHandlersConfig []*NetworkHandlerConfigInput `json:"networkHandlersConfig"`
- DataSourceID *string `json:"dataSourceId"`
- UserName *string `json:"userName"`
- UserPassword *string `json:"userPassword"`
- Folder *string `json:"folder"`
-}
-
-type ConnectionFolderInfo struct {
- ID string `json:"id"`
- Description *string `json:"description"`
-}
-
-type ConnectionInfo struct {
- ID string `json:"id"`
- DriverID string `json:"driverId"`
- Name string `json:"name"`
- Description *string `json:"description"`
- Host *string `json:"host"`
- Port *string `json:"port"`
- ServerName *string `json:"serverName"`
- DatabaseName *string `json:"databaseName"`
- URL *string `json:"url"`
- Properties interface{} `json:"properties"`
- Template bool `json:"template"`
- Connected bool `json:"connected"`
- Provided bool `json:"provided"`
- ReadOnly bool `json:"readOnly"`
- UseURL bool `json:"useUrl"`
- SaveCredentials bool `json:"saveCredentials"`
- Folder *string `json:"folder"`
- NodePath *string `json:"nodePath"`
- ConnectTime *string `json:"connectTime"`
- ConnectionError *ServerError `json:"connectionError"`
- ServerVersion *string `json:"serverVersion"`
- ClientVersion *string `json:"clientVersion"`
- Origin *ObjectOrigin `json:"origin"`
- AuthNeeded bool `json:"authNeeded"`
- AuthModel *string `json:"authModel"`
- AuthProperties []*ObjectPropertyInfo `json:"authProperties"`
- ProviderProperties interface{} `json:"providerProperties"`
- NetworkHandlersConfig []*NetworkHandlerConfig `json:"networkHandlersConfig"`
- Features []string `json:"features"`
- NavigatorSettings *NavigatorSettings `json:"navigatorSettings"`
- SupportedDataFormats []ResultDataFormat `json:"supportedDataFormats"`
-}
-
-type DataTransferParameters struct {
- ProcessorID string `json:"processorId"`
- Settings interface{} `json:"settings"`
- ProcessorProperties interface{} `json:"processorProperties"`
- Filter *SQLDataFilter `json:"filter"`
-}
-
-type DataTransferProcessorInfo struct {
- ID string `json:"id"`
- Name *string `json:"name"`
- Description *string `json:"description"`
- FileExtension *string `json:"fileExtension"`
- AppFileExtension *string `json:"appFileExtension"`
- AppName *string `json:"appName"`
- Order int `json:"order"`
- Icon *string `json:"icon"`
- Properties []*ObjectPropertyInfo `json:"properties"`
- IsBinary *bool `json:"isBinary"`
- IsHTML *bool `json:"isHTML"`
-}
-
-type DataTypeLogicalOperation struct {
- ID string `json:"id"`
- Expression string `json:"expression"`
- ArgumentCount *int `json:"argumentCount"`
-}
-
-type DatabaseAuthModel struct {
- ID string `json:"id"`
- DisplayName string `json:"displayName"`
- Description *string `json:"description"`
- Icon *string `json:"icon"`
- RequiresLocalConfiguration *bool `json:"requiresLocalConfiguration"`
- Properties []*ObjectPropertyInfo `json:"properties"`
-}
-
-type DatabaseCatalog struct {
- Catalog *NavigatorNodeInfo `json:"catalog"`
- SchemaList []*NavigatorNodeInfo `json:"schemaList"`
-}
-
-type DatabaseDocument struct {
- ID *string `json:"id"`
- ContentType *string `json:"contentType"`
- Properties interface{} `json:"properties"`
- Data interface{} `json:"data"`
-}
-
-type DatabaseObjectInfo struct {
- Name *string `json:"name"`
- Description *string `json:"description"`
- Type *string `json:"type"`
- Properties []*ObjectPropertyInfo `json:"properties"`
- OrdinalPosition *int `json:"ordinalPosition"`
- FullyQualifiedName *string `json:"fullyQualifiedName"`
- OverloadedName *string `json:"overloadedName"`
- UniqueName *string `json:"uniqueName"`
- State *string `json:"state"`
- Features []string `json:"features"`
- Editors []string `json:"editors"`
-}
-
-type DatabaseStructContainers struct {
- CatalogList []*DatabaseCatalog `json:"catalogList"`
- SchemaList []*NavigatorNodeInfo `json:"schemaList"`
- SupportsCatalogChange bool `json:"supportsCatalogChange"`
- SupportsSchemaChange bool `json:"supportsSchemaChange"`
-}
-
-type DriverInfo struct {
- ID string `json:"id"`
- Name *string `json:"name"`
- Description *string `json:"description"`
- Icon *string `json:"icon"`
- IconBig *string `json:"iconBig"`
- ProviderID *string `json:"providerId"`
- DriverClassName *string `json:"driverClassName"`
- DefaultHost *string `json:"defaultHost"`
- DefaultPort *string `json:"defaultPort"`
- DefaultDatabase *string `json:"defaultDatabase"`
- DefaultServer *string `json:"defaultServer"`
- DefaultUser *string `json:"defaultUser"`
- SampleURL *string `json:"sampleURL"`
- DriverInfoURL *string `json:"driverInfoURL"`
- DriverPropertiesURL *string `json:"driverPropertiesURL"`
- Embedded *bool `json:"embedded"`
- Enabled bool `json:"enabled"`
- RequiresServerName *bool `json:"requiresServerName"`
- AllowsEmptyPassword *bool `json:"allowsEmptyPassword"`
- LicenseRequired *bool `json:"licenseRequired"`
- License *string `json:"license"`
- Custom *bool `json:"custom"`
- PromotedScore *int `json:"promotedScore"`
- DriverProperties []*ObjectPropertyInfo `json:"driverProperties"`
- DriverParameters interface{} `json:"driverParameters"`
- ProviderProperties []*ObjectPropertyInfo `json:"providerProperties"`
- AnonymousAccess *bool `json:"anonymousAccess"`
- DefaultAuthModel string `json:"defaultAuthModel"`
- ApplicableAuthModels []string `json:"applicableAuthModels"`
- ApplicableNetworkHandlers []*string `json:"applicableNetworkHandlers"`
-}
-
-type LogEntry struct {
- Time *time.Time `json:"time"`
- Type string `json:"type"`
- Message *string `json:"message"`
- StackTrace *string `json:"stackTrace"`
-}
-
-type NavigatorNodeInfo struct {
- ID string `json:"id"`
- Name *string `json:"name"`
- FullName *string `json:"fullName"`
- Icon *string `json:"icon"`
- Description *string `json:"description"`
- NodeType *string `json:"nodeType"`
- HasChildren *bool `json:"hasChildren"`
- Object *DatabaseObjectInfo `json:"object"`
- Features []string `json:"features"`
- NodeDetails []*ObjectPropertyInfo `json:"nodeDetails"`
- Folder *bool `json:"folder"`
- Inline *bool `json:"inline"`
- Navigable *bool `json:"navigable"`
-}
-
-type NavigatorSettings struct {
- ShowSystemObjects bool `json:"showSystemObjects"`
- ShowUtilityObjects bool `json:"showUtilityObjects"`
- ShowOnlyEntities bool `json:"showOnlyEntities"`
- MergeEntities bool `json:"mergeEntities"`
- HideFolders bool `json:"hideFolders"`
- HideSchemas bool `json:"hideSchemas"`
- HideVirtualModel bool `json:"hideVirtualModel"`
-}
-
-type NavigatorSettingsInput struct {
- ShowSystemObjects bool `json:"showSystemObjects"`
- ShowUtilityObjects bool `json:"showUtilityObjects"`
- ShowOnlyEntities bool `json:"showOnlyEntities"`
- MergeEntities bool `json:"mergeEntities"`
- HideFolders bool `json:"hideFolders"`
- HideSchemas bool `json:"hideSchemas"`
- HideVirtualModel bool `json:"hideVirtualModel"`
-}
-
-type NetworkEndpointInfo struct {
- Message *string `json:"message"`
- ClientVersion *string `json:"clientVersion"`
- ServerVersion *string `json:"serverVersion"`
-}
-
-type NetworkHandlerConfig struct {
- ID string `json:"id"`
- Enabled bool `json:"enabled"`
- AuthType NetworkHandlerAuthType `json:"authType"`
- UserName *string `json:"userName"`
- Password *string `json:"password"`
- Key *string `json:"key"`
- SavePassword bool `json:"savePassword"`
- Properties interface{} `json:"properties"`
-}
-
-type NetworkHandlerConfigInput struct {
- ID string `json:"id"`
- Enabled *bool `json:"enabled"`
- AuthType *NetworkHandlerAuthType `json:"authType"`
- UserName *string `json:"userName"`
- Password *string `json:"password"`
- Key *string `json:"key"`
- SavePassword *bool `json:"savePassword"`
- Properties interface{} `json:"properties"`
-}
-
-type NetworkHandlerDescriptor struct {
- ID string `json:"id"`
- CodeName string `json:"codeName"`
- Label string `json:"label"`
- Description *string `json:"description"`
- Secured bool `json:"secured"`
- Type *NetworkHandlerType `json:"type"`
- Properties []*ObjectPropertyInfo `json:"properties"`
-}
-
-type ObjectDescriptor struct {
- ID *int `json:"id"`
- DisplayName *string `json:"displayName"`
- FullName *string `json:"fullName"`
- UniqueName *string `json:"uniqueName"`
- Description *string `json:"description"`
- Value *string `json:"value"`
-}
-
-type ObjectDetails struct {
- ID *int `json:"id"`
- DisplayName *string `json:"displayName"`
- Description *string `json:"description"`
- Value interface{} `json:"value"`
-}
-
-type ObjectOrigin struct {
- Type string `json:"type"`
- SubType *string `json:"subType"`
- DisplayName string `json:"displayName"`
- Icon *string `json:"icon"`
- Configuration interface{} `json:"configuration"`
- Details []*ObjectPropertyInfo `json:"details"`
-}
-
-type ObjectPropertyFilter struct {
- Ids []string `json:"ids"`
- Features []string `json:"features"`
- Categories []string `json:"categories"`
- DataTypes []string `json:"dataTypes"`
-}
-
-type ObjectPropertyInfo struct {
- ID *string `json:"id"`
- DisplayName *string `json:"displayName"`
- Description *string `json:"description"`
- Category *string `json:"category"`
- DataType *string `json:"dataType"`
- Value interface{} `json:"value"`
- ValidValues []interface{} `json:"validValues"`
- DefaultValue interface{} `json:"defaultValue"`
- Length ObjectPropertyLength `json:"length"`
- Features []string `json:"features"`
- Order int `json:"order"`
-}
-
-type ProductInfo struct {
- ID string `json:"id"`
- Version string `json:"version"`
- Name string `json:"name"`
- Description *string `json:"description"`
- BuildTime string `json:"buildTime"`
- ReleaseTime string `json:"releaseTime"`
- LicenseInfo *string `json:"licenseInfo"`
- LatestVersionInfo *string `json:"latestVersionInfo"`
-}
-
-type RMProject struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Description *string `json:"description"`
- Shared bool `json:"shared"`
- CreateTime time.Time `json:"createTime"`
- Creator string `json:"creator"`
-}
-
-type RMResource struct {
- Name string `json:"name"`
- Folder bool `json:"folder"`
- Length int `json:"length"`
-}
-
-type SQLCompletionProposal struct {
- DisplayString string `json:"displayString"`
- Type string `json:"type"`
- Score *int `json:"score"`
- ReplacementString string `json:"replacementString"`
- ReplacementOffset int `json:"replacementOffset"`
- ReplacementLength int `json:"replacementLength"`
- CursorPosition *int `json:"cursorPosition"`
- Icon *string `json:"icon"`
- NodePath *string `json:"nodePath"`
-}
-
-type SQLContextInfo struct {
- ID string `json:"id"`
- ConnectionID string `json:"connectionId"`
- DefaultCatalog *string `json:"defaultCatalog"`
- DefaultSchema *string `json:"defaultSchema"`
-}
-
-type SQLDataFilter struct {
- Offset *float64 `json:"offset"`
- Limit *int `json:"limit"`
- Constraints []*SQLDataFilterConstraint `json:"constraints"`
- Where *string `json:"where"`
- OrderBy *string `json:"orderBy"`
-}
-
-type SQLDataFilterConstraint struct {
- AttributePosition int `json:"attributePosition"`
- OrderPosition *int `json:"orderPosition"`
- OrderAsc *bool `json:"orderAsc"`
- Criteria *string `json:"criteria"`
- Operator *string `json:"operator"`
- Value interface{} `json:"value"`
-}
-
-type SQLDialectInfo struct {
- Name string `json:"name"`
- DataTypes []*string `json:"dataTypes"`
- Functions []*string `json:"functions"`
- ReservedWords []*string `json:"reservedWords"`
- QuoteStrings [][]*string `json:"quoteStrings"`
- SingleLineComments []*string `json:"singleLineComments"`
- MultiLineComments [][]*string `json:"multiLineComments"`
- CatalogSeparator *string `json:"catalogSeparator"`
- StructSeparator *string `json:"structSeparator"`
- ScriptDelimiter *string `json:"scriptDelimiter"`
- SupportsExplainExecutionPlan bool `json:"supportsExplainExecutionPlan"`
-}
-
-type SQLExecuteInfo struct {
- StatusMessage *string `json:"statusMessage"`
- Duration int `json:"duration"`
- FilterText *string `json:"filterText"`
- Results []*SQLQueryResults `json:"results"`
-}
-
-type SQLExecutionPlan struct {
- Query string `json:"query"`
- Nodes []*SQLExecutionPlanNode `json:"nodes"`
-}
-
-type SQLExecutionPlanNode struct {
- ID string `json:"id"`
- ParentID *string `json:"parentId"`
- Kind string `json:"kind"`
- Name *string `json:"name"`
- Type string `json:"type"`
- Condition *string `json:"condition"`
- Description *string `json:"description"`
- Properties []*ObjectPropertyInfo `json:"properties"`
-}
-
-type SQLQueryGenerator struct {
- ID string `json:"id"`
- Label string `json:"label"`
- Description *string `json:"description"`
- Order int `json:"order"`
- MultiObject bool `json:"multiObject"`
-}
-
-type SQLQueryResults struct {
- Title *string `json:"title"`
- UpdateRowCount *float64 `json:"updateRowCount"`
- SourceQuery *string `json:"sourceQuery"`
- DataFormat *ResultDataFormat `json:"dataFormat"`
- ResultSet *SQLResultSet `json:"resultSet"`
-}
-
-type SQLResultColumn struct {
- Position int `json:"position"`
- Name *string `json:"name"`
- Label *string `json:"label"`
- Icon *string `json:"icon"`
- EntityName *string `json:"entityName"`
- DataKind *string `json:"dataKind"`
- TypeName *string `json:"typeName"`
- FullTypeName *string `json:"fullTypeName"`
- MaxLength *float64 `json:"maxLength"`
- Scale *int `json:"scale"`
- Precision *int `json:"precision"`
- Required bool `json:"required"`
- ReadOnly bool `json:"readOnly"`
- ReadOnlyStatus *string `json:"readOnlyStatus"`
- SupportedOperations []*DataTypeLogicalOperation `json:"supportedOperations"`
-}
-
-type SQLResultRow struct {
- Data []interface{} `json:"data"`
- UpdateValues interface{} `json:"updateValues"`
-}
-
-type SQLResultSet struct {
- ID string `json:"id"`
- Columns []*SQLResultColumn `json:"columns"`
- Rows [][]interface{} `json:"rows"`
- SingleEntity bool `json:"singleEntity"`
- HasMoreData bool `json:"hasMoreData"`
- HasRowIdentifier bool `json:"hasRowIdentifier"`
-}
-
-type SQLScriptInfo struct {
- Queries []*SQLScriptQuery `json:"queries"`
-}
-
-type SQLScriptQuery struct {
- Start int `json:"start"`
- End int `json:"end"`
-}
-
-type ServerConfig struct {
- Name string `json:"name"`
- Version string `json:"version"`
- WorkspaceID string `json:"workspaceId"`
- ServerURL string `json:"serverURL"`
- RootURI string `json:"rootURI"`
- HostName string `json:"hostName"`
- AnonymousAccessEnabled *bool `json:"anonymousAccessEnabled"`
- AuthenticationEnabled *bool `json:"authenticationEnabled"`
- SupportsCustomConnections *bool `json:"supportsCustomConnections"`
- SupportsConnectionBrowser *bool `json:"supportsConnectionBrowser"`
- SupportsWorkspaces *bool `json:"supportsWorkspaces"`
- ResourceManagerEnabled *bool `json:"resourceManagerEnabled"`
- PublicCredentialsSaveEnabled *bool `json:"publicCredentialsSaveEnabled"`
- AdminCredentialsSaveEnabled *bool `json:"adminCredentialsSaveEnabled"`
- LicenseRequired bool `json:"licenseRequired"`
- LicenseValid bool `json:"licenseValid"`
- SessionExpireTime *int `json:"sessionExpireTime"`
- LocalHostAddress *string `json:"localHostAddress"`
- ConfigurationMode *bool `json:"configurationMode"`
- DevelopmentMode *bool `json:"developmentMode"`
- RedirectOnFederatedAuth *bool `json:"redirectOnFederatedAuth"`
- EnabledFeatures []string `json:"enabledFeatures"`
- EnabledAuthProviders []string `json:"enabledAuthProviders"`
- SupportedLanguages []*ServerLanguage `json:"supportedLanguages"`
- Services []*WebServiceConfig `json:"services"`
- ProductConfiguration interface{} `json:"productConfiguration"`
- ProductInfo *ProductInfo `json:"productInfo"`
- DefaultNavigatorSettings *NavigatorSettings `json:"defaultNavigatorSettings"`
- DisabledDrivers []string `json:"disabledDrivers"`
- ResourceQuotas interface{} `json:"resourceQuotas"`
-}
-
-type ServerConfigInput struct {
- ServerName *string `json:"serverName"`
- ServerURL *string `json:"serverURL"`
- AdminName *string `json:"adminName"`
- AdminPassword *string `json:"adminPassword"`
- AnonymousAccessEnabled *bool `json:"anonymousAccessEnabled"`
- AuthenticationEnabled *bool `json:"authenticationEnabled"`
- CustomConnectionsEnabled *bool `json:"customConnectionsEnabled"`
- PublicCredentialsSaveEnabled *bool `json:"publicCredentialsSaveEnabled"`
- AdminCredentialsSaveEnabled *bool `json:"adminCredentialsSaveEnabled"`
- ResourceManagerEnabled *bool `json:"resourceManagerEnabled"`
- EnabledFeatures []string `json:"enabledFeatures"`
- EnabledAuthProviders []string `json:"enabledAuthProviders"`
- DisabledDrivers []string `json:"disabledDrivers"`
- SessionExpireTime *int `json:"sessionExpireTime"`
-}
-
-type ServerError struct {
- Message *string `json:"message"`
- ErrorCode *string `json:"errorCode"`
- ErrorType *string `json:"errorType"`
- StackTrace *string `json:"stackTrace"`
- CausedBy *ServerError `json:"causedBy"`
-}
-
-type ServerLanguage struct {
- IsoCode string `json:"isoCode"`
- DisplayName *string `json:"displayName"`
- NativeName *string `json:"nativeName"`
-}
-
-type ServerMessage struct {
- Time *string `json:"time"`
- Message *string `json:"message"`
-}
-
-type SessionInfo struct {
- CreateTime string `json:"createTime"`
- LastAccessTime string `json:"lastAccessTime"`
- Locale string `json:"locale"`
- CacheExpired bool `json:"cacheExpired"`
- ServerMessages []*ServerMessage `json:"serverMessages"`
- Connections []*ConnectionInfo `json:"connections"`
- ActionParameters interface{} `json:"actionParameters"`
-}
-
-type UserAuthToken struct {
- AuthProvider string `json:"authProvider"`
- AuthConfiguration *string `json:"authConfiguration"`
- LoginTime time.Time `json:"loginTime"`
- UserID string `json:"userId"`
- DisplayName string `json:"displayName"`
- Message *string `json:"message"`
- Origin *ObjectOrigin `json:"origin"`
-}
-
-type UserInfo struct {
- UserID string `json:"userId"`
- DisplayName *string `json:"displayName"`
- AuthRole *string `json:"authRole"`
- AuthTokens []*UserAuthToken `json:"authTokens"`
- LinkedAuthProviders []string `json:"linkedAuthProviders"`
- MetaParameters interface{} `json:"metaParameters"`
- ConfigurationParameters interface{} `json:"configurationParameters"`
-}
-
-type WebFeatureSet struct {
- ID string `json:"id"`
- Label string `json:"label"`
- Description *string `json:"description"`
- Icon *string `json:"icon"`
- Enabled bool `json:"enabled"`
-}
-
-type WebServiceConfig struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Description string `json:"description"`
- BundleVersion string `json:"bundleVersion"`
-}
-
-type AdminSubjectType string
-
-const (
- AdminSubjectTypeUser AdminSubjectType = "user"
- AdminSubjectTypeRole AdminSubjectType = "role"
-)
-
-var AllAdminSubjectType = []AdminSubjectType{
- AdminSubjectTypeUser,
- AdminSubjectTypeRole,
-}
-
-func (e AdminSubjectType) IsValid() bool {
- switch e {
- case AdminSubjectTypeUser, AdminSubjectTypeRole:
- return true
- }
- return false
-}
-
-func (e AdminSubjectType) String() string {
- return string(e)
-}
-
-func (e *AdminSubjectType) UnmarshalGQL(v interface{}) error {
- str, ok := v.(string)
- if !ok {
- return fmt.Errorf("enums must be strings")
- }
-
- *e = AdminSubjectType(str)
- if !e.IsValid() {
- return fmt.Errorf("%s is not a valid AdminSubjectType", str)
- }
- return nil
-}
-
-func (e AdminSubjectType) MarshalGQL(w io.Writer) {
- fmt.Fprint(w, strconv.Quote(e.String()))
-}
-
-type AuthCredentialEncryption string
-
-const (
- AuthCredentialEncryptionNone AuthCredentialEncryption = "none"
- AuthCredentialEncryptionPlain AuthCredentialEncryption = "plain"
- AuthCredentialEncryptionHash AuthCredentialEncryption = "hash"
-)
-
-var AllAuthCredentialEncryption = []AuthCredentialEncryption{
- AuthCredentialEncryptionNone,
- AuthCredentialEncryptionPlain,
- AuthCredentialEncryptionHash,
-}
-
-func (e AuthCredentialEncryption) IsValid() bool {
- switch e {
- case AuthCredentialEncryptionNone, AuthCredentialEncryptionPlain, AuthCredentialEncryptionHash:
- return true
- }
- return false
-}
-
-func (e AuthCredentialEncryption) String() string {
- return string(e)
-}
-
-func (e *AuthCredentialEncryption) UnmarshalGQL(v interface{}) error {
- str, ok := v.(string)
- if !ok {
- return fmt.Errorf("enums must be strings")
- }
-
- *e = AuthCredentialEncryption(str)
- if !e.IsValid() {
- return fmt.Errorf("%s is not a valid AuthCredentialEncryption", str)
- }
- return nil
-}
-
-func (e AuthCredentialEncryption) MarshalGQL(w io.Writer) {
- fmt.Fprint(w, strconv.Quote(e.String()))
-}
-
-type AuthStatus string
-
-const (
- AuthStatusSuccess AuthStatus = "SUCCESS"
- AuthStatusInProgress AuthStatus = "IN_PROGRESS"
- AuthStatusError AuthStatus = "ERROR"
-)
-
-var AllAuthStatus = []AuthStatus{
- AuthStatusSuccess,
- AuthStatusInProgress,
- AuthStatusError,
-}
-
-func (e AuthStatus) IsValid() bool {
- switch e {
- case AuthStatusSuccess, AuthStatusInProgress, AuthStatusError:
- return true
- }
- return false
-}
-
-func (e AuthStatus) String() string {
- return string(e)
-}
-
-func (e *AuthStatus) UnmarshalGQL(v interface{}) error {
- str, ok := v.(string)
- if !ok {
- return fmt.Errorf("enums must be strings")
- }
-
- *e = AuthStatus(str)
- if !e.IsValid() {
- return fmt.Errorf("%s is not a valid AuthStatus", str)
- }
- return nil
-}
-
-func (e AuthStatus) MarshalGQL(w io.Writer) {
- fmt.Fprint(w, strconv.Quote(e.String()))
-}
-
-type NetworkHandlerAuthType string
-
-const (
- NetworkHandlerAuthTypePassword NetworkHandlerAuthType = "PASSWORD"
- NetworkHandlerAuthTypePublicKey NetworkHandlerAuthType = "PUBLIC_KEY"
- NetworkHandlerAuthTypeAgent NetworkHandlerAuthType = "AGENT"
-)
-
-var AllNetworkHandlerAuthType = []NetworkHandlerAuthType{
- NetworkHandlerAuthTypePassword,
- NetworkHandlerAuthTypePublicKey,
- NetworkHandlerAuthTypeAgent,
-}
-
-func (e NetworkHandlerAuthType) IsValid() bool {
- switch e {
- case NetworkHandlerAuthTypePassword, NetworkHandlerAuthTypePublicKey, NetworkHandlerAuthTypeAgent:
- return true
- }
- return false
-}
-
-func (e NetworkHandlerAuthType) String() string {
- return string(e)
-}
-
-func (e *NetworkHandlerAuthType) UnmarshalGQL(v interface{}) error {
- str, ok := v.(string)
- if !ok {
- return fmt.Errorf("enums must be strings")
- }
-
- *e = NetworkHandlerAuthType(str)
- if !e.IsValid() {
- return fmt.Errorf("%s is not a valid NetworkHandlerAuthType", str)
- }
- return nil
-}
-
-func (e NetworkHandlerAuthType) MarshalGQL(w io.Writer) {
- fmt.Fprint(w, strconv.Quote(e.String()))
-}
-
-type NetworkHandlerType string
-
-const (
- NetworkHandlerTypeTunnel NetworkHandlerType = "TUNNEL"
- NetworkHandlerTypeProxy NetworkHandlerType = "PROXY"
- NetworkHandlerTypeConfig NetworkHandlerType = "CONFIG"
-)
-
-var AllNetworkHandlerType = []NetworkHandlerType{
- NetworkHandlerTypeTunnel,
- NetworkHandlerTypeProxy,
- NetworkHandlerTypeConfig,
-}
-
-func (e NetworkHandlerType) IsValid() bool {
- switch e {
- case NetworkHandlerTypeTunnel, NetworkHandlerTypeProxy, NetworkHandlerTypeConfig:
- return true
- }
- return false
-}
-
-func (e NetworkHandlerType) String() string {
- return string(e)
-}
-
-func (e *NetworkHandlerType) UnmarshalGQL(v interface{}) error {
- str, ok := v.(string)
- if !ok {
- return fmt.Errorf("enums must be strings")
- }
-
- *e = NetworkHandlerType(str)
- if !e.IsValid() {
- return fmt.Errorf("%s is not a valid NetworkHandlerType", str)
- }
- return nil
-}
-
-func (e NetworkHandlerType) MarshalGQL(w io.Writer) {
- fmt.Fprint(w, strconv.Quote(e.String()))
-}
-
-type ObjectPropertyLength string
-
-const (
- ObjectPropertyLengthTiny ObjectPropertyLength = "TINY"
- ObjectPropertyLengthShort ObjectPropertyLength = "SHORT"
- ObjectPropertyLengthMedium ObjectPropertyLength = "MEDIUM"
- ObjectPropertyLengthLong ObjectPropertyLength = "LONG"
- ObjectPropertyLengthMultiline ObjectPropertyLength = "MULTILINE"
-)
-
-var AllObjectPropertyLength = []ObjectPropertyLength{
- ObjectPropertyLengthTiny,
- ObjectPropertyLengthShort,
- ObjectPropertyLengthMedium,
- ObjectPropertyLengthLong,
- ObjectPropertyLengthMultiline,
-}
-
-func (e ObjectPropertyLength) IsValid() bool {
- switch e {
- case ObjectPropertyLengthTiny, ObjectPropertyLengthShort, ObjectPropertyLengthMedium, ObjectPropertyLengthLong, ObjectPropertyLengthMultiline:
- return true
- }
- return false
-}
-
-func (e ObjectPropertyLength) String() string {
- return string(e)
-}
-
-func (e *ObjectPropertyLength) UnmarshalGQL(v interface{}) error {
- str, ok := v.(string)
- if !ok {
- return fmt.Errorf("enums must be strings")
- }
-
- *e = ObjectPropertyLength(str)
- if !e.IsValid() {
- return fmt.Errorf("%s is not a valid ObjectPropertyLength", str)
- }
- return nil
-}
-
-func (e ObjectPropertyLength) MarshalGQL(w io.Writer) {
- fmt.Fprint(w, strconv.Quote(e.String()))
-}
-
-type ResultDataFormat string
-
-const (
- ResultDataFormatResultset ResultDataFormat = "resultset"
- ResultDataFormatDocument ResultDataFormat = "document"
- ResultDataFormatGraph ResultDataFormat = "graph"
- ResultDataFormatTimeseries ResultDataFormat = "timeseries"
-)
-
-var AllResultDataFormat = []ResultDataFormat{
- ResultDataFormatResultset,
- ResultDataFormatDocument,
- ResultDataFormatGraph,
- ResultDataFormatTimeseries,
-}
-
-func (e ResultDataFormat) IsValid() bool {
- switch e {
- case ResultDataFormatResultset, ResultDataFormatDocument, ResultDataFormatGraph, ResultDataFormatTimeseries:
- return true
- }
- return false
-}
-
-func (e ResultDataFormat) String() string {
- return string(e)
-}
-
-func (e *ResultDataFormat) UnmarshalGQL(v interface{}) error {
- str, ok := v.(string)
- if !ok {
- return fmt.Errorf("enums must be strings")
- }
-
- *e = ResultDataFormat(str)
- if !e.IsValid() {
- return fmt.Errorf("%s is not a valid ResultDataFormat", str)
- }
- return nil
-}
-
-func (e ResultDataFormat) MarshalGQL(w io.Writer) {
- fmt.Fprint(w, strconv.Quote(e.String()))
-}
diff --git a/sqle/api/cloudbeaver_wrapper/graph/resolver/executor_gen.go b/sqle/api/cloudbeaver_wrapper/graph/resolver/executor_gen.go
deleted file mode 100644
index 314febe019..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/resolver/executor_gen.go
+++ /dev/null
@@ -1,47771 +0,0 @@
-// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
-
-package resolver
-
-import (
- "bytes"
- "context"
- "errors"
- "fmt"
- "strconv"
- "sync"
- "sync/atomic"
- "time"
-
- "github.com/99designs/gqlgen/graphql"
- "github.com/99designs/gqlgen/graphql/introspection"
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/graph/model"
- gqlparser "github.com/vektah/gqlparser/v2"
- "github.com/vektah/gqlparser/v2/ast"
-)
-
-// region ************************** generated!.gotpl **************************
-
-// NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.
-func NewExecutableSchema(cfg Config) graphql.ExecutableSchema {
- return &executableSchema{
- resolvers: cfg.Resolvers,
- directives: cfg.Directives,
- complexity: cfg.Complexity,
- }
-}
-
-type Config struct {
- Resolvers ResolverRoot
- Directives DirectiveRoot
- Complexity ComplexityRoot
-}
-
-type ResolverRoot interface {
- Mutation() MutationResolver
- Query() QueryResolver
-}
-
-type DirectiveRoot struct {
-}
-
-type ComplexityRoot struct {
- AdminAuthProviderConfiguration struct {
- Description func(childComplexity int) int
- Disabled func(childComplexity int) int
- DisplayName func(childComplexity int) int
- ID func(childComplexity int) int
- IconURL func(childComplexity int) int
- MetadataLink func(childComplexity int) int
- Parameters func(childComplexity int) int
- ProviderID func(childComplexity int) int
- RedirectLink func(childComplexity int) int
- SignInLink func(childComplexity int) int
- SignOutLink func(childComplexity int) int
- }
-
- AdminConnectionGrantInfo struct {
- ConnectionID func(childComplexity int) int
- DataSourceID func(childComplexity int) int
- SubjectID func(childComplexity int) int
- SubjectType func(childComplexity int) int
- }
-
- AdminConnectionSearchInfo struct {
- DefaultDriver func(childComplexity int) int
- DisplayName func(childComplexity int) int
- Host func(childComplexity int) int
- Port func(childComplexity int) int
- PossibleDrivers func(childComplexity int) int
- }
-
- AdminPermissionInfo struct {
- Category func(childComplexity int) int
- Description func(childComplexity int) int
- ID func(childComplexity int) int
- Label func(childComplexity int) int
- Provider func(childComplexity int) int
- }
-
- AdminRoleInfo struct {
- Description func(childComplexity int) int
- GrantedConnections func(childComplexity int) int
- GrantedUsers func(childComplexity int) int
- RoleID func(childComplexity int) int
- RoleName func(childComplexity int) int
- RolePermissions func(childComplexity int) int
- }
-
- AdminUserInfo struct {
- ConfigurationParameters func(childComplexity int) int
- Enabled func(childComplexity int) int
- GrantedConnections func(childComplexity int) int
- GrantedRoles func(childComplexity int) int
- LinkedAuthProviders func(childComplexity int) int
- MetaParameters func(childComplexity int) int
- Origins func(childComplexity int) int
- UserID func(childComplexity int) int
- }
-
- AsyncTaskInfo struct {
- Error func(childComplexity int) int
- ID func(childComplexity int) int
- Name func(childComplexity int) int
- Result func(childComplexity int) int
- Running func(childComplexity int) int
- Status func(childComplexity int) int
- TaskResult func(childComplexity int) int
- }
-
- AuthCredentialInfo struct {
- Admin func(childComplexity int) int
- Description func(childComplexity int) int
- DisplayName func(childComplexity int) int
- Encryption func(childComplexity int) int
- ID func(childComplexity int) int
- Identifying func(childComplexity int) int
- PossibleValues func(childComplexity int) int
- User func(childComplexity int) int
- }
-
- AuthInfo struct {
- AuthID func(childComplexity int) int
- AuthStatus func(childComplexity int) int
- RedirectLink func(childComplexity int) int
- UserTokens func(childComplexity int) int
- }
-
- AuthProviderConfiguration struct {
- Description func(childComplexity int) int
- Disabled func(childComplexity int) int
- DisplayName func(childComplexity int) int
- ID func(childComplexity int) int
- IconURL func(childComplexity int) int
- MetadataLink func(childComplexity int) int
- SignInLink func(childComplexity int) int
- SignOutLink func(childComplexity int) int
- }
-
- AuthProviderCredentialsProfile struct {
- CredentialParameters func(childComplexity int) int
- Description func(childComplexity int) int
- ID func(childComplexity int) int
- Label func(childComplexity int) int
- }
-
- AuthProviderInfo struct {
- Configurable func(childComplexity int) int
- Configurations func(childComplexity int) int
- CredentialProfiles func(childComplexity int) int
- DefaultProvider func(childComplexity int) int
- Description func(childComplexity int) int
- ID func(childComplexity int) int
- Icon func(childComplexity int) int
- Label func(childComplexity int) int
- RequiredFeatures func(childComplexity int) int
- }
-
- ConnectionFolderInfo struct {
- Description func(childComplexity int) int
- ID func(childComplexity int) int
- }
-
- ConnectionInfo struct {
- AuthModel func(childComplexity int) int
- AuthNeeded func(childComplexity int) int
- AuthProperties func(childComplexity int) int
- ClientVersion func(childComplexity int) int
- ConnectTime func(childComplexity int) int
- Connected func(childComplexity int) int
- ConnectionError func(childComplexity int) int
- DatabaseName func(childComplexity int) int
- Description func(childComplexity int) int
- DriverID func(childComplexity int) int
- Features func(childComplexity int) int
- Folder func(childComplexity int) int
- Host func(childComplexity int) int
- ID func(childComplexity int) int
- Name func(childComplexity int) int
- NavigatorSettings func(childComplexity int) int
- NetworkHandlersConfig func(childComplexity int) int
- NodePath func(childComplexity int) int
- Origin func(childComplexity int) int
- Port func(childComplexity int) int
- Properties func(childComplexity int) int
- Provided func(childComplexity int) int
- ProviderProperties func(childComplexity int) int
- ReadOnly func(childComplexity int) int
- SaveCredentials func(childComplexity int) int
- ServerName func(childComplexity int) int
- ServerVersion func(childComplexity int) int
- SupportedDataFormats func(childComplexity int) int
- Template func(childComplexity int) int
- URL func(childComplexity int) int
- UseURL func(childComplexity int) int
- }
-
- DataTransferProcessorInfo struct {
- AppFileExtension func(childComplexity int) int
- AppName func(childComplexity int) int
- Description func(childComplexity int) int
- FileExtension func(childComplexity int) int
- ID func(childComplexity int) int
- Icon func(childComplexity int) int
- IsBinary func(childComplexity int) int
- IsHTML func(childComplexity int) int
- Name func(childComplexity int) int
- Order func(childComplexity int) int
- Properties func(childComplexity int) int
- }
-
- DataTypeLogicalOperation struct {
- ArgumentCount func(childComplexity int) int
- Expression func(childComplexity int) int
- ID func(childComplexity int) int
- }
-
- DatabaseAuthModel struct {
- Description func(childComplexity int) int
- DisplayName func(childComplexity int) int
- ID func(childComplexity int) int
- Icon func(childComplexity int) int
- Properties func(childComplexity int) int
- RequiresLocalConfiguration func(childComplexity int) int
- }
-
- DatabaseCatalog struct {
- Catalog func(childComplexity int) int
- SchemaList func(childComplexity int) int
- }
-
- DatabaseDocument struct {
- ContentType func(childComplexity int) int
- Data func(childComplexity int) int
- ID func(childComplexity int) int
- Properties func(childComplexity int) int
- }
-
- DatabaseObjectInfo struct {
- Description func(childComplexity int) int
- Editors func(childComplexity int) int
- Features func(childComplexity int) int
- FullyQualifiedName func(childComplexity int) int
- Name func(childComplexity int) int
- OrdinalPosition func(childComplexity int) int
- OverloadedName func(childComplexity int) int
- Properties func(childComplexity int, filter *model.ObjectPropertyFilter) int
- State func(childComplexity int) int
- Type func(childComplexity int) int
- UniqueName func(childComplexity int) int
- }
-
- DatabaseStructContainers struct {
- CatalogList func(childComplexity int) int
- SchemaList func(childComplexity int) int
- SupportsCatalogChange func(childComplexity int) int
- SupportsSchemaChange func(childComplexity int) int
- }
-
- DriverInfo struct {
- AllowsEmptyPassword func(childComplexity int) int
- AnonymousAccess func(childComplexity int) int
- ApplicableAuthModels func(childComplexity int) int
- ApplicableNetworkHandlers func(childComplexity int) int
- Custom func(childComplexity int) int
- DefaultAuthModel func(childComplexity int) int
- DefaultDatabase func(childComplexity int) int
- DefaultHost func(childComplexity int) int
- DefaultPort func(childComplexity int) int
- DefaultServer func(childComplexity int) int
- DefaultUser func(childComplexity int) int
- Description func(childComplexity int) int
- DriverClassName func(childComplexity int) int
- DriverInfoURL func(childComplexity int) int
- DriverParameters func(childComplexity int) int
- DriverProperties func(childComplexity int) int
- DriverPropertiesURL func(childComplexity int) int
- Embedded func(childComplexity int) int
- Enabled func(childComplexity int) int
- ID func(childComplexity int) int
- Icon func(childComplexity int) int
- IconBig func(childComplexity int) int
- License func(childComplexity int) int
- LicenseRequired func(childComplexity int) int
- Name func(childComplexity int) int
- PromotedScore func(childComplexity int) int
- ProviderID func(childComplexity int) int
- ProviderProperties func(childComplexity int) int
- RequiresServerName func(childComplexity int) int
- SampleURL func(childComplexity int) int
- }
-
- LogEntry struct {
- Message func(childComplexity int) int
- StackTrace func(childComplexity int) int
- Time func(childComplexity int) int
- Type func(childComplexity int) int
- }
-
- Mutation struct {
- AsyncReadDataFromContainer func(childComplexity int, connectionID string, contextID string, containerNodePath string, resultID *string, filter *model.SQLDataFilter, dataFormat *model.ResultDataFormat) int
- AsyncSQLExecuteQuery func(childComplexity int, projectID *string, connectionID string, contextID string, sql string, resultID *string, filter *model.SQLDataFilter, dataFormat *model.ResultDataFormat, readLogs *bool) int
- AsyncSQLExecuteResults func(childComplexity int, taskID string) int
- AsyncSQLExplainExecutionPlan func(childComplexity int, connectionID string, contextID string, query string, configuration interface{}) int
- AsyncSQLExplainExecutionPlanResult func(childComplexity int, taskID string) int
- AsyncTaskCancel func(childComplexity int, id string) int
- AsyncTaskInfo func(childComplexity int, id string, removeOnFinish bool) int
- AsyncTaskStatus func(childComplexity int, id string) int
- ChangeSessionLanguage func(childComplexity int, locale *string) int
- CloseConnection func(childComplexity int, id string) int
- CloseSession func(childComplexity int) int
- CopyConnectionFromNode func(childComplexity int, nodePath string, config *model.ConnectionConfig) int
- CreateConnection func(childComplexity int, config model.ConnectionConfig) int
- CreateConnectionFolder func(childComplexity int, parentFolderPath *string, folderName string) int
- CreateConnectionFromTemplate func(childComplexity int, templateID string, connectionName *string) int
- DeleteConnection func(childComplexity int, id string) int
- DeleteConnectionFolder func(childComplexity int, folderPath string) int
- InitConnection func(childComplexity int, id string, credentials interface{}, networkCredentials []*model.NetworkHandlerConfigInput, saveCredentials *bool) int
- NavDeleteNodes func(childComplexity int, nodePaths []string) int
- NavMoveNodesToFolder func(childComplexity int, nodePaths []string, folderPath string) int
- NavRenameNode func(childComplexity int, nodePath string, newName string) int
- OpenConnection func(childComplexity int, config model.ConnectionConfig) int
- OpenSession func(childComplexity int, defaultLocale *string) int
- ReadLobValue func(childComplexity int, connectionID string, contextID string, resultsID string, lobColumnIndex int, row []*model.SQLResultRow) int
- RefreshSessionConnections func(childComplexity int) int
- RmCreateResource func(childComplexity int, projectID string, resourcePath string, isFolder bool) int
- RmDeleteResource func(childComplexity int, projectID string, resourcePath string, recursive bool) int
- RmMoveResource func(childComplexity int, projectID string, oldResourcePath string, newResourcePath *string) int
- RmWriteResourceStringContent func(childComplexity int, projectID string, resourcePath string, data string) int
- SQLContextCreate func(childComplexity int, connectionID string, defaultCatalog *string, defaultSchema *string) int
- SQLContextDestroy func(childComplexity int, connectionID string, contextID string) int
- SQLContextSetDefaults func(childComplexity int, connectionID string, contextID string, defaultCatalog *string, defaultSchema *string) int
- SQLResultClose func(childComplexity int, connectionID string, contextID string, resultID string) int
- SetConnectionNavigatorSettings func(childComplexity int, id string, settings model.NavigatorSettingsInput) int
- SetUserConfigurationParameter func(childComplexity int, name string, value interface{}) int
- TestConnection func(childComplexity int, config model.ConnectionConfig) int
- TestNetworkHandler func(childComplexity int, config model.NetworkHandlerConfigInput) int
- TouchSession func(childComplexity int) int
- UpdateConnection func(childComplexity int, config model.ConnectionConfig) int
- UpdateResultsDataBatch func(childComplexity int, connectionID string, contextID string, resultsID string, updatedRows []*model.SQLResultRow, deletedRows []*model.SQLResultRow, addedRows []*model.SQLResultRow) int
- UpdateResultsDataBatchScript func(childComplexity int, connectionID string, contextID string, resultsID string, updatedRows []*model.SQLResultRow, deletedRows []*model.SQLResultRow, addedRows []*model.SQLResultRow) int
- }
-
- NavigatorNodeInfo struct {
- Description func(childComplexity int) int
- Features func(childComplexity int) int
- Folder func(childComplexity int) int
- FullName func(childComplexity int) int
- HasChildren func(childComplexity int) int
- ID func(childComplexity int) int
- Icon func(childComplexity int) int
- Inline func(childComplexity int) int
- Name func(childComplexity int) int
- Navigable func(childComplexity int) int
- NodeDetails func(childComplexity int) int
- NodeType func(childComplexity int) int
- Object func(childComplexity int) int
- }
-
- NavigatorSettings struct {
- HideFolders func(childComplexity int) int
- HideSchemas func(childComplexity int) int
- HideVirtualModel func(childComplexity int) int
- MergeEntities func(childComplexity int) int
- ShowOnlyEntities func(childComplexity int) int
- ShowSystemObjects func(childComplexity int) int
- ShowUtilityObjects func(childComplexity int) int
- }
-
- NetworkEndpointInfo struct {
- ClientVersion func(childComplexity int) int
- Message func(childComplexity int) int
- ServerVersion func(childComplexity int) int
- }
-
- NetworkHandlerConfig struct {
- AuthType func(childComplexity int) int
- Enabled func(childComplexity int) int
- ID func(childComplexity int) int
- Key func(childComplexity int) int
- Password func(childComplexity int) int
- Properties func(childComplexity int) int
- SavePassword func(childComplexity int) int
- UserName func(childComplexity int) int
- }
-
- NetworkHandlerDescriptor struct {
- CodeName func(childComplexity int) int
- Description func(childComplexity int) int
- ID func(childComplexity int) int
- Label func(childComplexity int) int
- Properties func(childComplexity int) int
- Secured func(childComplexity int) int
- Type func(childComplexity int) int
- }
-
- ObjectDescriptor struct {
- Description func(childComplexity int) int
- DisplayName func(childComplexity int) int
- FullName func(childComplexity int) int
- ID func(childComplexity int) int
- UniqueName func(childComplexity int) int
- Value func(childComplexity int) int
- }
-
- ObjectDetails struct {
- Description func(childComplexity int) int
- DisplayName func(childComplexity int) int
- ID func(childComplexity int) int
- Value func(childComplexity int) int
- }
-
- ObjectOrigin struct {
- Configuration func(childComplexity int) int
- Details func(childComplexity int) int
- DisplayName func(childComplexity int) int
- Icon func(childComplexity int) int
- SubType func(childComplexity int) int
- Type func(childComplexity int) int
- }
-
- ObjectPropertyInfo struct {
- Category func(childComplexity int) int
- DataType func(childComplexity int) int
- DefaultValue func(childComplexity int) int
- Description func(childComplexity int) int
- DisplayName func(childComplexity int) int
- Features func(childComplexity int) int
- ID func(childComplexity int) int
- Length func(childComplexity int) int
- Order func(childComplexity int) int
- ValidValues func(childComplexity int) int
- Value func(childComplexity int) int
- }
-
- ProductInfo struct {
- BuildTime func(childComplexity int) int
- Description func(childComplexity int) int
- ID func(childComplexity int) int
- LatestVersionInfo func(childComplexity int) int
- LicenseInfo func(childComplexity int) int
- Name func(childComplexity int) int
- ReleaseTime func(childComplexity int) int
- Version func(childComplexity int) int
- }
-
- Query struct {
- ActiveUser func(childComplexity int) int
- AllConnections func(childComplexity int, id *string) int
- AuthChangeLocalPassword func(childComplexity int, oldPassword string, newPassword string) int
- AuthLogin func(childComplexity int, provider string, configuration *string, credentials interface{}, linkUser *bool) int
- AuthLogout func(childComplexity int, provider *string, configuration *string) int
- AuthModels func(childComplexity int) int
- AuthProviders func(childComplexity int) int
- AuthUpdateStatus func(childComplexity int, authID string, linkUser *bool) int
- ConfigureServer func(childComplexity int, configuration model.ServerConfigInput) int
- ConnectionFolders func(childComplexity int, path *string) int
- ConnectionInfo func(childComplexity int, id string) int
- ConnectionState func(childComplexity int, id string) int
- CopyConnectionConfiguration func(childComplexity int, nodePath string, config *model.ConnectionConfig) int
- CreateConnectionConfiguration func(childComplexity int, config model.ConnectionConfig) int
- CreateRole func(childComplexity int, roleID string, roleName *string, description *string) int
- CreateUser func(childComplexity int, userID string) int
- DataTransferAvailableStreamProcessors func(childComplexity int) int
- DataTransferExportDataFromContainer func(childComplexity int, connectionID string, containerNodePath string, parameters model.DataTransferParameters) int
- DataTransferExportDataFromResults func(childComplexity int, connectionID string, contextID string, resultsID string, parameters model.DataTransferParameters) int
- DataTransferRemoveDataFile func(childComplexity int, dataFileID string) int
- DeleteAuthProviderConfiguration func(childComplexity int, id string) int
- DeleteConnectionConfiguration func(childComplexity int, id string) int
- DeleteRole func(childComplexity int, roleID string) int
- DeleteUser func(childComplexity int, userID string) int
- DeleteUserMetaParameter func(childComplexity int, id string) int
- DriverList func(childComplexity int, id *string) int
- EnableUser func(childComplexity int, userID string, enabled bool) int
- GetConnectionSubjectAccess func(childComplexity int, connectionID *string) int
- GetSubjectConnectionAccess func(childComplexity int, subjectID *string) int
- GrantUserRole func(childComplexity int, userID string, roleID string) int
- ListAuthProviderConfigurationParameters func(childComplexity int, providerID string) int
- ListAuthProviderConfigurations func(childComplexity int, providerID *string) int
- ListFeatureSets func(childComplexity int) int
- ListPermissions func(childComplexity int) int
- ListRoles func(childComplexity int, roleID *string) int
- ListUserProfileProperties func(childComplexity int) int
- ListUsers func(childComplexity int, userID *string) int
- MetadataGetNodeDdl func(childComplexity int, nodeID string, options interface{}) int
- NavGetStructContainers func(childComplexity int, connectionID string, contextID *string, catalog *string) int
- NavNodeChildren func(childComplexity int, parentPath string, offset *int, limit *int, onlyFolders *bool) int
- NavNodeInfo func(childComplexity int, nodePath string) int
- NavNodeParents func(childComplexity int, nodePath string) int
- NavRefreshNode func(childComplexity int, nodePath string) int
- NetworkHandlers func(childComplexity int) int
- ReadSessionLog func(childComplexity int, maxEntries *int, clearEntries *bool) int
- RevokeUserRole func(childComplexity int, userID string, roleID string) int
- RmListProjects func(childComplexity int) int
- RmListResources func(childComplexity int, projectID string, folder *string, nameMask *string, readProperties *bool, readHistory *bool) int
- RmReadResourceAsString func(childComplexity int, projectID string, resourcePath string) int
- SQLCompletionProposals func(childComplexity int, connectionID string, contextID string, query string, position int, maxResults *int, simpleMode *bool) int
- SQLDialectInfo func(childComplexity int, connectionID string) int
- SQLEntityQueryGenerators func(childComplexity int, nodePathList []string) int
- SQLFormatQuery func(childComplexity int, connectionID string, contextID string, query string) int
- SQLGenerateEntityQuery func(childComplexity int, generatorID string, options interface{}, nodePathList []string) int
- SQLListContexts func(childComplexity int, connectionID *string, contextID *string) int
- SQLParseQuery func(childComplexity int, connectionID string, script string, position int) int
- SQLParseScript func(childComplexity int, connectionID string, script string) int
- SQLSupportedOperations func(childComplexity int, connectionID string, contextID string, resultsID string, attributeIndex int) int
- SaveAuthProviderConfiguration func(childComplexity int, providerID string, id string, displayName *string, disabled *bool, iconURL *string, description *string, parameters interface{}) int
- SaveUserMetaParameter func(childComplexity int, id string, displayName string, description *string, required bool) int
- SearchConnections func(childComplexity int, hostNames []string) int
- ServerConfig func(childComplexity int) int
- SessionPermissions func(childComplexity int) int
- SessionState func(childComplexity int) int
- SetConnectionSubjectAccess func(childComplexity int, connectionID string, subjects []string) int
- SetDefaultNavigatorSettings func(childComplexity int, settings model.NavigatorSettingsInput) int
- SetSubjectConnectionAccess func(childComplexity int, subjectID string, connections []string) int
- SetSubjectPermissions func(childComplexity int, roleID string, permissions []string) int
- SetUserCredentials func(childComplexity int, userID string, providerID string, credentials interface{}) int
- SetUserMetaParameterValues func(childComplexity int, userID string, parameters interface{}) int
- TemplateConnections func(childComplexity int) int
- UpdateConnectionConfiguration func(childComplexity int, id string, config model.ConnectionConfig) int
- UpdateRole func(childComplexity int, roleID string, roleName *string, description *string) int
- UserConnections func(childComplexity int, id *string) int
- }
-
- RMProject struct {
- CreateTime func(childComplexity int) int
- Creator func(childComplexity int) int
- Description func(childComplexity int) int
- ID func(childComplexity int) int
- Name func(childComplexity int) int
- Shared func(childComplexity int) int
- }
-
- RMResource struct {
- Folder func(childComplexity int) int
- Length func(childComplexity int) int
- Name func(childComplexity int) int
- }
-
- SQLCompletionProposal struct {
- CursorPosition func(childComplexity int) int
- DisplayString func(childComplexity int) int
- Icon func(childComplexity int) int
- NodePath func(childComplexity int) int
- ReplacementLength func(childComplexity int) int
- ReplacementOffset func(childComplexity int) int
- ReplacementString func(childComplexity int) int
- Score func(childComplexity int) int
- Type func(childComplexity int) int
- }
-
- SQLContextInfo struct {
- ConnectionID func(childComplexity int) int
- DefaultCatalog func(childComplexity int) int
- DefaultSchema func(childComplexity int) int
- ID func(childComplexity int) int
- }
-
- SQLDialectInfo struct {
- CatalogSeparator func(childComplexity int) int
- DataTypes func(childComplexity int) int
- Functions func(childComplexity int) int
- MultiLineComments func(childComplexity int) int
- Name func(childComplexity int) int
- QuoteStrings func(childComplexity int) int
- ReservedWords func(childComplexity int) int
- ScriptDelimiter func(childComplexity int) int
- SingleLineComments func(childComplexity int) int
- StructSeparator func(childComplexity int) int
- SupportsExplainExecutionPlan func(childComplexity int) int
- }
-
- SQLExecuteInfo struct {
- Duration func(childComplexity int) int
- FilterText func(childComplexity int) int
- Results func(childComplexity int) int
- StatusMessage func(childComplexity int) int
- }
-
- SQLExecutionPlan struct {
- Nodes func(childComplexity int) int
- Query func(childComplexity int) int
- }
-
- SQLExecutionPlanNode struct {
- Condition func(childComplexity int) int
- Description func(childComplexity int) int
- ID func(childComplexity int) int
- Kind func(childComplexity int) int
- Name func(childComplexity int) int
- ParentID func(childComplexity int) int
- Properties func(childComplexity int) int
- Type func(childComplexity int) int
- }
-
- SQLQueryGenerator struct {
- Description func(childComplexity int) int
- ID func(childComplexity int) int
- Label func(childComplexity int) int
- MultiObject func(childComplexity int) int
- Order func(childComplexity int) int
- }
-
- SQLQueryResults struct {
- DataFormat func(childComplexity int) int
- ResultSet func(childComplexity int) int
- SourceQuery func(childComplexity int) int
- Title func(childComplexity int) int
- UpdateRowCount func(childComplexity int) int
- }
-
- SQLResultColumn struct {
- DataKind func(childComplexity int) int
- EntityName func(childComplexity int) int
- FullTypeName func(childComplexity int) int
- Icon func(childComplexity int) int
- Label func(childComplexity int) int
- MaxLength func(childComplexity int) int
- Name func(childComplexity int) int
- Position func(childComplexity int) int
- Precision func(childComplexity int) int
- ReadOnly func(childComplexity int) int
- ReadOnlyStatus func(childComplexity int) int
- Required func(childComplexity int) int
- Scale func(childComplexity int) int
- SupportedOperations func(childComplexity int) int
- TypeName func(childComplexity int) int
- }
-
- SQLResultSet struct {
- Columns func(childComplexity int) int
- HasMoreData func(childComplexity int) int
- HasRowIdentifier func(childComplexity int) int
- ID func(childComplexity int) int
- Rows func(childComplexity int) int
- SingleEntity func(childComplexity int) int
- }
-
- SQLScriptInfo struct {
- Queries func(childComplexity int) int
- }
-
- SQLScriptQuery struct {
- End func(childComplexity int) int
- Start func(childComplexity int) int
- }
-
- ServerConfig struct {
- AdminCredentialsSaveEnabled func(childComplexity int) int
- AnonymousAccessEnabled func(childComplexity int) int
- AuthenticationEnabled func(childComplexity int) int
- ConfigurationMode func(childComplexity int) int
- DefaultNavigatorSettings func(childComplexity int) int
- DevelopmentMode func(childComplexity int) int
- DisabledDrivers func(childComplexity int) int
- EnabledAuthProviders func(childComplexity int) int
- EnabledFeatures func(childComplexity int) int
- HostName func(childComplexity int) int
- LicenseRequired func(childComplexity int) int
- LicenseValid func(childComplexity int) int
- LocalHostAddress func(childComplexity int) int
- Name func(childComplexity int) int
- ProductConfiguration func(childComplexity int) int
- ProductInfo func(childComplexity int) int
- PublicCredentialsSaveEnabled func(childComplexity int) int
- RedirectOnFederatedAuth func(childComplexity int) int
- ResourceManagerEnabled func(childComplexity int) int
- ResourceQuotas func(childComplexity int) int
- RootURI func(childComplexity int) int
- ServerURL func(childComplexity int) int
- Services func(childComplexity int) int
- SessionExpireTime func(childComplexity int) int
- SupportedLanguages func(childComplexity int) int
- SupportsConnectionBrowser func(childComplexity int) int
- SupportsCustomConnections func(childComplexity int) int
- SupportsWorkspaces func(childComplexity int) int
- Version func(childComplexity int) int
- WorkspaceID func(childComplexity int) int
- }
-
- ServerError struct {
- CausedBy func(childComplexity int) int
- ErrorCode func(childComplexity int) int
- ErrorType func(childComplexity int) int
- Message func(childComplexity int) int
- StackTrace func(childComplexity int) int
- }
-
- ServerLanguage struct {
- DisplayName func(childComplexity int) int
- IsoCode func(childComplexity int) int
- NativeName func(childComplexity int) int
- }
-
- ServerMessage struct {
- Message func(childComplexity int) int
- Time func(childComplexity int) int
- }
-
- SessionInfo struct {
- ActionParameters func(childComplexity int) int
- CacheExpired func(childComplexity int) int
- Connections func(childComplexity int) int
- CreateTime func(childComplexity int) int
- LastAccessTime func(childComplexity int) int
- Locale func(childComplexity int) int
- ServerMessages func(childComplexity int) int
- }
-
- UserAuthToken struct {
- AuthConfiguration func(childComplexity int) int
- AuthProvider func(childComplexity int) int
- DisplayName func(childComplexity int) int
- LoginTime func(childComplexity int) int
- Message func(childComplexity int) int
- Origin func(childComplexity int) int
- UserID func(childComplexity int) int
- }
-
- UserInfo struct {
- AuthRole func(childComplexity int) int
- AuthTokens func(childComplexity int) int
- ConfigurationParameters func(childComplexity int) int
- DisplayName func(childComplexity int) int
- LinkedAuthProviders func(childComplexity int) int
- MetaParameters func(childComplexity int) int
- UserID func(childComplexity int) int
- }
-
- WebFeatureSet struct {
- Description func(childComplexity int) int
- Enabled func(childComplexity int) int
- ID func(childComplexity int) int
- Icon func(childComplexity int) int
- Label func(childComplexity int) int
- }
-
- WebServiceConfig struct {
- BundleVersion func(childComplexity int) int
- Description func(childComplexity int) int
- ID func(childComplexity int) int
- Name func(childComplexity int) int
- }
-}
-
-type MutationResolver interface {
- SetUserConfigurationParameter(ctx context.Context, name string, value interface{}) (bool, error)
- OpenSession(ctx context.Context, defaultLocale *string) (*model.SessionInfo, error)
- CloseSession(ctx context.Context) (*bool, error)
- TouchSession(ctx context.Context) (*bool, error)
- RefreshSessionConnections(ctx context.Context) (*bool, error)
- ChangeSessionLanguage(ctx context.Context, locale *string) (*bool, error)
- CreateConnection(ctx context.Context, config model.ConnectionConfig) (*model.ConnectionInfo, error)
- UpdateConnection(ctx context.Context, config model.ConnectionConfig) (*model.ConnectionInfo, error)
- DeleteConnection(ctx context.Context, id string) (bool, error)
- CreateConnectionFromTemplate(ctx context.Context, templateID string, connectionName *string) (*model.ConnectionInfo, error)
- CreateConnectionFolder(ctx context.Context, parentFolderPath *string, folderName string) (*model.ConnectionFolderInfo, error)
- DeleteConnectionFolder(ctx context.Context, folderPath string) (bool, error)
- CopyConnectionFromNode(ctx context.Context, nodePath string, config *model.ConnectionConfig) (*model.ConnectionInfo, error)
- TestConnection(ctx context.Context, config model.ConnectionConfig) (*model.ConnectionInfo, error)
- TestNetworkHandler(ctx context.Context, config model.NetworkHandlerConfigInput) (*model.NetworkEndpointInfo, error)
- InitConnection(ctx context.Context, id string, credentials interface{}, networkCredentials []*model.NetworkHandlerConfigInput, saveCredentials *bool) (*model.ConnectionInfo, error)
- CloseConnection(ctx context.Context, id string) (*model.ConnectionInfo, error)
- SetConnectionNavigatorSettings(ctx context.Context, id string, settings model.NavigatorSettingsInput) (*model.ConnectionInfo, error)
- AsyncTaskCancel(ctx context.Context, id string) (*bool, error)
- AsyncTaskInfo(ctx context.Context, id string, removeOnFinish bool) (*model.AsyncTaskInfo, error)
- OpenConnection(ctx context.Context, config model.ConnectionConfig) (*model.ConnectionInfo, error)
- AsyncTaskStatus(ctx context.Context, id string) (*model.AsyncTaskInfo, error)
- NavRenameNode(ctx context.Context, nodePath string, newName string) (*string, error)
- NavDeleteNodes(ctx context.Context, nodePaths []string) (*int, error)
- NavMoveNodesToFolder(ctx context.Context, nodePaths []string, folderPath string) (*bool, error)
- RmCreateResource(ctx context.Context, projectID string, resourcePath string, isFolder bool) (string, error)
- RmMoveResource(ctx context.Context, projectID string, oldResourcePath string, newResourcePath *string) (string, error)
- RmDeleteResource(ctx context.Context, projectID string, resourcePath string, recursive bool) (*bool, error)
- RmWriteResourceStringContent(ctx context.Context, projectID string, resourcePath string, data string) (string, error)
- SQLContextCreate(ctx context.Context, connectionID string, defaultCatalog *string, defaultSchema *string) (*model.SQLContextInfo, error)
- SQLContextSetDefaults(ctx context.Context, connectionID string, contextID string, defaultCatalog *string, defaultSchema *string) (bool, error)
- SQLContextDestroy(ctx context.Context, connectionID string, contextID string) (bool, error)
- AsyncSQLExecuteQuery(ctx context.Context, projectID *string, connectionID string, contextID string, sql string, resultID *string, filter *model.SQLDataFilter, dataFormat *model.ResultDataFormat, readLogs *bool) (*model.AsyncTaskInfo, error)
- AsyncReadDataFromContainer(ctx context.Context, connectionID string, contextID string, containerNodePath string, resultID *string, filter *model.SQLDataFilter, dataFormat *model.ResultDataFormat) (*model.AsyncTaskInfo, error)
- SQLResultClose(ctx context.Context, connectionID string, contextID string, resultID string) (bool, error)
- UpdateResultsDataBatch(ctx context.Context, connectionID string, contextID string, resultsID string, updatedRows []*model.SQLResultRow, deletedRows []*model.SQLResultRow, addedRows []*model.SQLResultRow) (*model.SQLExecuteInfo, error)
- UpdateResultsDataBatchScript(ctx context.Context, connectionID string, contextID string, resultsID string, updatedRows []*model.SQLResultRow, deletedRows []*model.SQLResultRow, addedRows []*model.SQLResultRow) (string, error)
- ReadLobValue(ctx context.Context, connectionID string, contextID string, resultsID string, lobColumnIndex int, row []*model.SQLResultRow) (string, error)
- AsyncSQLExecuteResults(ctx context.Context, taskID string) (*model.SQLExecuteInfo, error)
- AsyncSQLExplainExecutionPlan(ctx context.Context, connectionID string, contextID string, query string, configuration interface{}) (*model.AsyncTaskInfo, error)
- AsyncSQLExplainExecutionPlanResult(ctx context.Context, taskID string) (*model.SQLExecutionPlan, error)
-}
-type QueryResolver interface {
- ListUsers(ctx context.Context, userID *string) ([]*model.AdminUserInfo, error)
- ListRoles(ctx context.Context, roleID *string) ([]*model.AdminRoleInfo, error)
- ListPermissions(ctx context.Context) ([]*model.AdminPermissionInfo, error)
- CreateUser(ctx context.Context, userID string) (*model.AdminUserInfo, error)
- DeleteUser(ctx context.Context, userID string) (*bool, error)
- CreateRole(ctx context.Context, roleID string, roleName *string, description *string) (*model.AdminRoleInfo, error)
- UpdateRole(ctx context.Context, roleID string, roleName *string, description *string) (*model.AdminRoleInfo, error)
- DeleteRole(ctx context.Context, roleID string) (*bool, error)
- GrantUserRole(ctx context.Context, userID string, roleID string) (*bool, error)
- RevokeUserRole(ctx context.Context, userID string, roleID string) (*bool, error)
- SetSubjectPermissions(ctx context.Context, roleID string, permissions []string) ([]*model.AdminPermissionInfo, error)
- SetUserCredentials(ctx context.Context, userID string, providerID string, credentials interface{}) (*bool, error)
- EnableUser(ctx context.Context, userID string, enabled bool) (*bool, error)
- AllConnections(ctx context.Context, id *string) ([]*model.ConnectionInfo, error)
- SearchConnections(ctx context.Context, hostNames []string) ([]*model.AdminConnectionSearchInfo, error)
- CreateConnectionConfiguration(ctx context.Context, config model.ConnectionConfig) (*model.ConnectionInfo, error)
- CopyConnectionConfiguration(ctx context.Context, nodePath string, config *model.ConnectionConfig) (*model.ConnectionInfo, error)
- UpdateConnectionConfiguration(ctx context.Context, id string, config model.ConnectionConfig) (*model.ConnectionInfo, error)
- DeleteConnectionConfiguration(ctx context.Context, id string) (*bool, error)
- GetConnectionSubjectAccess(ctx context.Context, connectionID *string) ([]*model.AdminConnectionGrantInfo, error)
- SetConnectionSubjectAccess(ctx context.Context, connectionID string, subjects []string) (*bool, error)
- GetSubjectConnectionAccess(ctx context.Context, subjectID *string) ([]*model.AdminConnectionGrantInfo, error)
- SetSubjectConnectionAccess(ctx context.Context, subjectID string, connections []string) (*bool, error)
- ListFeatureSets(ctx context.Context) ([]*model.WebFeatureSet, error)
- ListAuthProviderConfigurationParameters(ctx context.Context, providerID string) ([]*model.ObjectPropertyInfo, error)
- ListAuthProviderConfigurations(ctx context.Context, providerID *string) ([]*model.AdminAuthProviderConfiguration, error)
- SaveAuthProviderConfiguration(ctx context.Context, providerID string, id string, displayName *string, disabled *bool, iconURL *string, description *string, parameters interface{}) (*model.AdminAuthProviderConfiguration, error)
- DeleteAuthProviderConfiguration(ctx context.Context, id string) (bool, error)
- SaveUserMetaParameter(ctx context.Context, id string, displayName string, description *string, required bool) (*model.ObjectPropertyInfo, error)
- DeleteUserMetaParameter(ctx context.Context, id string) (bool, error)
- SetUserMetaParameterValues(ctx context.Context, userID string, parameters interface{}) (bool, error)
- ConfigureServer(ctx context.Context, configuration model.ServerConfigInput) (bool, error)
- SetDefaultNavigatorSettings(ctx context.Context, settings model.NavigatorSettingsInput) (bool, error)
- AuthLogin(ctx context.Context, provider string, configuration *string, credentials interface{}, linkUser *bool) (*model.AuthInfo, error)
- AuthUpdateStatus(ctx context.Context, authID string, linkUser *bool) (*model.AuthInfo, error)
- AuthLogout(ctx context.Context, provider *string, configuration *string) (*bool, error)
- ActiveUser(ctx context.Context) (*model.UserInfo, error)
- AuthProviders(ctx context.Context) ([]*model.AuthProviderInfo, error)
- AuthChangeLocalPassword(ctx context.Context, oldPassword string, newPassword string) (bool, error)
- ListUserProfileProperties(ctx context.Context) ([]*model.ObjectPropertyInfo, error)
- ServerConfig(ctx context.Context) (*model.ServerConfig, error)
- SessionState(ctx context.Context) (*model.SessionInfo, error)
- SessionPermissions(ctx context.Context) ([]*string, error)
- DriverList(ctx context.Context, id *string) ([]*model.DriverInfo, error)
- AuthModels(ctx context.Context) ([]*model.DatabaseAuthModel, error)
- NetworkHandlers(ctx context.Context) ([]*model.NetworkHandlerDescriptor, error)
- UserConnections(ctx context.Context, id *string) ([]*model.ConnectionInfo, error)
- TemplateConnections(ctx context.Context) ([]*model.ConnectionInfo, error)
- ConnectionFolders(ctx context.Context, path *string) ([]*model.ConnectionFolderInfo, error)
- ConnectionState(ctx context.Context, id string) (*model.ConnectionInfo, error)
- ConnectionInfo(ctx context.Context, id string) (*model.ConnectionInfo, error)
- ReadSessionLog(ctx context.Context, maxEntries *int, clearEntries *bool) ([]*model.LogEntry, error)
- DataTransferAvailableStreamProcessors(ctx context.Context) ([]*model.DataTransferProcessorInfo, error)
- DataTransferExportDataFromContainer(ctx context.Context, connectionID string, containerNodePath string, parameters model.DataTransferParameters) (*model.AsyncTaskInfo, error)
- DataTransferExportDataFromResults(ctx context.Context, connectionID string, contextID string, resultsID string, parameters model.DataTransferParameters) (*model.AsyncTaskInfo, error)
- DataTransferRemoveDataFile(ctx context.Context, dataFileID string) (*bool, error)
- MetadataGetNodeDdl(ctx context.Context, nodeID string, options interface{}) (*string, error)
- NavNodeChildren(ctx context.Context, parentPath string, offset *int, limit *int, onlyFolders *bool) ([]*model.NavigatorNodeInfo, error)
- NavNodeParents(ctx context.Context, nodePath string) ([]*model.NavigatorNodeInfo, error)
- NavNodeInfo(ctx context.Context, nodePath string) (*model.NavigatorNodeInfo, error)
- NavRefreshNode(ctx context.Context, nodePath string) (*bool, error)
- NavGetStructContainers(ctx context.Context, connectionID string, contextID *string, catalog *string) (*model.DatabaseStructContainers, error)
- RmListProjects(ctx context.Context) ([]*model.RMProject, error)
- RmListResources(ctx context.Context, projectID string, folder *string, nameMask *string, readProperties *bool, readHistory *bool) ([]*model.RMResource, error)
- RmReadResourceAsString(ctx context.Context, projectID string, resourcePath string) (string, error)
- SQLDialectInfo(ctx context.Context, connectionID string) (*model.SQLDialectInfo, error)
- SQLListContexts(ctx context.Context, connectionID *string, contextID *string) ([]*model.SQLContextInfo, error)
- SQLCompletionProposals(ctx context.Context, connectionID string, contextID string, query string, position int, maxResults *int, simpleMode *bool) ([]*model.SQLCompletionProposal, error)
- SQLFormatQuery(ctx context.Context, connectionID string, contextID string, query string) (string, error)
- SQLSupportedOperations(ctx context.Context, connectionID string, contextID string, resultsID string, attributeIndex int) ([]*model.DataTypeLogicalOperation, error)
- SQLEntityQueryGenerators(ctx context.Context, nodePathList []string) ([]*model.SQLQueryGenerator, error)
- SQLGenerateEntityQuery(ctx context.Context, generatorID string, options interface{}, nodePathList []string) (string, error)
- SQLParseScript(ctx context.Context, connectionID string, script string) (*model.SQLScriptInfo, error)
- SQLParseQuery(ctx context.Context, connectionID string, script string, position int) (*model.SQLScriptQuery, error)
-}
-
-type executableSchema struct {
- resolvers ResolverRoot
- directives DirectiveRoot
- complexity ComplexityRoot
-}
-
-func (e *executableSchema) Schema() *ast.Schema {
- return parsedSchema
-}
-
-func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) {
- ec := executionContext{nil, e}
- _ = ec
- switch typeName + "." + field {
-
- case "AdminAuthProviderConfiguration.description":
- if e.complexity.AdminAuthProviderConfiguration.Description == nil {
- break
- }
-
- return e.complexity.AdminAuthProviderConfiguration.Description(childComplexity), true
-
- case "AdminAuthProviderConfiguration.disabled":
- if e.complexity.AdminAuthProviderConfiguration.Disabled == nil {
- break
- }
-
- return e.complexity.AdminAuthProviderConfiguration.Disabled(childComplexity), true
-
- case "AdminAuthProviderConfiguration.displayName":
- if e.complexity.AdminAuthProviderConfiguration.DisplayName == nil {
- break
- }
-
- return e.complexity.AdminAuthProviderConfiguration.DisplayName(childComplexity), true
-
- case "AdminAuthProviderConfiguration.id":
- if e.complexity.AdminAuthProviderConfiguration.ID == nil {
- break
- }
-
- return e.complexity.AdminAuthProviderConfiguration.ID(childComplexity), true
-
- case "AdminAuthProviderConfiguration.iconURL":
- if e.complexity.AdminAuthProviderConfiguration.IconURL == nil {
- break
- }
-
- return e.complexity.AdminAuthProviderConfiguration.IconURL(childComplexity), true
-
- case "AdminAuthProviderConfiguration.metadataLink":
- if e.complexity.AdminAuthProviderConfiguration.MetadataLink == nil {
- break
- }
-
- return e.complexity.AdminAuthProviderConfiguration.MetadataLink(childComplexity), true
-
- case "AdminAuthProviderConfiguration.parameters":
- if e.complexity.AdminAuthProviderConfiguration.Parameters == nil {
- break
- }
-
- return e.complexity.AdminAuthProviderConfiguration.Parameters(childComplexity), true
-
- case "AdminAuthProviderConfiguration.providerId":
- if e.complexity.AdminAuthProviderConfiguration.ProviderID == nil {
- break
- }
-
- return e.complexity.AdminAuthProviderConfiguration.ProviderID(childComplexity), true
-
- case "AdminAuthProviderConfiguration.redirectLink":
- if e.complexity.AdminAuthProviderConfiguration.RedirectLink == nil {
- break
- }
-
- return e.complexity.AdminAuthProviderConfiguration.RedirectLink(childComplexity), true
-
- case "AdminAuthProviderConfiguration.signInLink":
- if e.complexity.AdminAuthProviderConfiguration.SignInLink == nil {
- break
- }
-
- return e.complexity.AdminAuthProviderConfiguration.SignInLink(childComplexity), true
-
- case "AdminAuthProviderConfiguration.signOutLink":
- if e.complexity.AdminAuthProviderConfiguration.SignOutLink == nil {
- break
- }
-
- return e.complexity.AdminAuthProviderConfiguration.SignOutLink(childComplexity), true
-
- case "AdminConnectionGrantInfo.connectionId":
- if e.complexity.AdminConnectionGrantInfo.ConnectionID == nil {
- break
- }
-
- return e.complexity.AdminConnectionGrantInfo.ConnectionID(childComplexity), true
-
- case "AdminConnectionGrantInfo.dataSourceId":
- if e.complexity.AdminConnectionGrantInfo.DataSourceID == nil {
- break
- }
-
- return e.complexity.AdminConnectionGrantInfo.DataSourceID(childComplexity), true
-
- case "AdminConnectionGrantInfo.subjectId":
- if e.complexity.AdminConnectionGrantInfo.SubjectID == nil {
- break
- }
-
- return e.complexity.AdminConnectionGrantInfo.SubjectID(childComplexity), true
-
- case "AdminConnectionGrantInfo.subjectType":
- if e.complexity.AdminConnectionGrantInfo.SubjectType == nil {
- break
- }
-
- return e.complexity.AdminConnectionGrantInfo.SubjectType(childComplexity), true
-
- case "AdminConnectionSearchInfo.defaultDriver":
- if e.complexity.AdminConnectionSearchInfo.DefaultDriver == nil {
- break
- }
-
- return e.complexity.AdminConnectionSearchInfo.DefaultDriver(childComplexity), true
-
- case "AdminConnectionSearchInfo.displayName":
- if e.complexity.AdminConnectionSearchInfo.DisplayName == nil {
- break
- }
-
- return e.complexity.AdminConnectionSearchInfo.DisplayName(childComplexity), true
-
- case "AdminConnectionSearchInfo.host":
- if e.complexity.AdminConnectionSearchInfo.Host == nil {
- break
- }
-
- return e.complexity.AdminConnectionSearchInfo.Host(childComplexity), true
-
- case "AdminConnectionSearchInfo.port":
- if e.complexity.AdminConnectionSearchInfo.Port == nil {
- break
- }
-
- return e.complexity.AdminConnectionSearchInfo.Port(childComplexity), true
-
- case "AdminConnectionSearchInfo.possibleDrivers":
- if e.complexity.AdminConnectionSearchInfo.PossibleDrivers == nil {
- break
- }
-
- return e.complexity.AdminConnectionSearchInfo.PossibleDrivers(childComplexity), true
-
- case "AdminPermissionInfo.category":
- if e.complexity.AdminPermissionInfo.Category == nil {
- break
- }
-
- return e.complexity.AdminPermissionInfo.Category(childComplexity), true
-
- case "AdminPermissionInfo.description":
- if e.complexity.AdminPermissionInfo.Description == nil {
- break
- }
-
- return e.complexity.AdminPermissionInfo.Description(childComplexity), true
-
- case "AdminPermissionInfo.id":
- if e.complexity.AdminPermissionInfo.ID == nil {
- break
- }
-
- return e.complexity.AdminPermissionInfo.ID(childComplexity), true
-
- case "AdminPermissionInfo.label":
- if e.complexity.AdminPermissionInfo.Label == nil {
- break
- }
-
- return e.complexity.AdminPermissionInfo.Label(childComplexity), true
-
- case "AdminPermissionInfo.provider":
- if e.complexity.AdminPermissionInfo.Provider == nil {
- break
- }
-
- return e.complexity.AdminPermissionInfo.Provider(childComplexity), true
-
- case "AdminRoleInfo.description":
- if e.complexity.AdminRoleInfo.Description == nil {
- break
- }
-
- return e.complexity.AdminRoleInfo.Description(childComplexity), true
-
- case "AdminRoleInfo.grantedConnections":
- if e.complexity.AdminRoleInfo.GrantedConnections == nil {
- break
- }
-
- return e.complexity.AdminRoleInfo.GrantedConnections(childComplexity), true
-
- case "AdminRoleInfo.grantedUsers":
- if e.complexity.AdminRoleInfo.GrantedUsers == nil {
- break
- }
-
- return e.complexity.AdminRoleInfo.GrantedUsers(childComplexity), true
-
- case "AdminRoleInfo.roleId":
- if e.complexity.AdminRoleInfo.RoleID == nil {
- break
- }
-
- return e.complexity.AdminRoleInfo.RoleID(childComplexity), true
-
- case "AdminRoleInfo.roleName":
- if e.complexity.AdminRoleInfo.RoleName == nil {
- break
- }
-
- return e.complexity.AdminRoleInfo.RoleName(childComplexity), true
-
- case "AdminRoleInfo.rolePermissions":
- if e.complexity.AdminRoleInfo.RolePermissions == nil {
- break
- }
-
- return e.complexity.AdminRoleInfo.RolePermissions(childComplexity), true
-
- case "AdminUserInfo.configurationParameters":
- if e.complexity.AdminUserInfo.ConfigurationParameters == nil {
- break
- }
-
- return e.complexity.AdminUserInfo.ConfigurationParameters(childComplexity), true
-
- case "AdminUserInfo.enabled":
- if e.complexity.AdminUserInfo.Enabled == nil {
- break
- }
-
- return e.complexity.AdminUserInfo.Enabled(childComplexity), true
-
- case "AdminUserInfo.grantedConnections":
- if e.complexity.AdminUserInfo.GrantedConnections == nil {
- break
- }
-
- return e.complexity.AdminUserInfo.GrantedConnections(childComplexity), true
-
- case "AdminUserInfo.grantedRoles":
- if e.complexity.AdminUserInfo.GrantedRoles == nil {
- break
- }
-
- return e.complexity.AdminUserInfo.GrantedRoles(childComplexity), true
-
- case "AdminUserInfo.linkedAuthProviders":
- if e.complexity.AdminUserInfo.LinkedAuthProviders == nil {
- break
- }
-
- return e.complexity.AdminUserInfo.LinkedAuthProviders(childComplexity), true
-
- case "AdminUserInfo.metaParameters":
- if e.complexity.AdminUserInfo.MetaParameters == nil {
- break
- }
-
- return e.complexity.AdminUserInfo.MetaParameters(childComplexity), true
-
- case "AdminUserInfo.origins":
- if e.complexity.AdminUserInfo.Origins == nil {
- break
- }
-
- return e.complexity.AdminUserInfo.Origins(childComplexity), true
-
- case "AdminUserInfo.userId":
- if e.complexity.AdminUserInfo.UserID == nil {
- break
- }
-
- return e.complexity.AdminUserInfo.UserID(childComplexity), true
-
- case "AsyncTaskInfo.error":
- if e.complexity.AsyncTaskInfo.Error == nil {
- break
- }
-
- return e.complexity.AsyncTaskInfo.Error(childComplexity), true
-
- case "AsyncTaskInfo.id":
- if e.complexity.AsyncTaskInfo.ID == nil {
- break
- }
-
- return e.complexity.AsyncTaskInfo.ID(childComplexity), true
-
- case "AsyncTaskInfo.name":
- if e.complexity.AsyncTaskInfo.Name == nil {
- break
- }
-
- return e.complexity.AsyncTaskInfo.Name(childComplexity), true
-
- case "AsyncTaskInfo.result":
- if e.complexity.AsyncTaskInfo.Result == nil {
- break
- }
-
- return e.complexity.AsyncTaskInfo.Result(childComplexity), true
-
- case "AsyncTaskInfo.running":
- if e.complexity.AsyncTaskInfo.Running == nil {
- break
- }
-
- return e.complexity.AsyncTaskInfo.Running(childComplexity), true
-
- case "AsyncTaskInfo.status":
- if e.complexity.AsyncTaskInfo.Status == nil {
- break
- }
-
- return e.complexity.AsyncTaskInfo.Status(childComplexity), true
-
- case "AsyncTaskInfo.taskResult":
- if e.complexity.AsyncTaskInfo.TaskResult == nil {
- break
- }
-
- return e.complexity.AsyncTaskInfo.TaskResult(childComplexity), true
-
- case "AuthCredentialInfo.admin":
- if e.complexity.AuthCredentialInfo.Admin == nil {
- break
- }
-
- return e.complexity.AuthCredentialInfo.Admin(childComplexity), true
-
- case "AuthCredentialInfo.description":
- if e.complexity.AuthCredentialInfo.Description == nil {
- break
- }
-
- return e.complexity.AuthCredentialInfo.Description(childComplexity), true
-
- case "AuthCredentialInfo.displayName":
- if e.complexity.AuthCredentialInfo.DisplayName == nil {
- break
- }
-
- return e.complexity.AuthCredentialInfo.DisplayName(childComplexity), true
-
- case "AuthCredentialInfo.encryption":
- if e.complexity.AuthCredentialInfo.Encryption == nil {
- break
- }
-
- return e.complexity.AuthCredentialInfo.Encryption(childComplexity), true
-
- case "AuthCredentialInfo.id":
- if e.complexity.AuthCredentialInfo.ID == nil {
- break
- }
-
- return e.complexity.AuthCredentialInfo.ID(childComplexity), true
-
- case "AuthCredentialInfo.identifying":
- if e.complexity.AuthCredentialInfo.Identifying == nil {
- break
- }
-
- return e.complexity.AuthCredentialInfo.Identifying(childComplexity), true
-
- case "AuthCredentialInfo.possibleValues":
- if e.complexity.AuthCredentialInfo.PossibleValues == nil {
- break
- }
-
- return e.complexity.AuthCredentialInfo.PossibleValues(childComplexity), true
-
- case "AuthCredentialInfo.user":
- if e.complexity.AuthCredentialInfo.User == nil {
- break
- }
-
- return e.complexity.AuthCredentialInfo.User(childComplexity), true
-
- case "AuthInfo.authId":
- if e.complexity.AuthInfo.AuthID == nil {
- break
- }
-
- return e.complexity.AuthInfo.AuthID(childComplexity), true
-
- case "AuthInfo.authStatus":
- if e.complexity.AuthInfo.AuthStatus == nil {
- break
- }
-
- return e.complexity.AuthInfo.AuthStatus(childComplexity), true
-
- case "AuthInfo.redirectLink":
- if e.complexity.AuthInfo.RedirectLink == nil {
- break
- }
-
- return e.complexity.AuthInfo.RedirectLink(childComplexity), true
-
- case "AuthInfo.userTokens":
- if e.complexity.AuthInfo.UserTokens == nil {
- break
- }
-
- return e.complexity.AuthInfo.UserTokens(childComplexity), true
-
- case "AuthProviderConfiguration.description":
- if e.complexity.AuthProviderConfiguration.Description == nil {
- break
- }
-
- return e.complexity.AuthProviderConfiguration.Description(childComplexity), true
-
- case "AuthProviderConfiguration.disabled":
- if e.complexity.AuthProviderConfiguration.Disabled == nil {
- break
- }
-
- return e.complexity.AuthProviderConfiguration.Disabled(childComplexity), true
-
- case "AuthProviderConfiguration.displayName":
- if e.complexity.AuthProviderConfiguration.DisplayName == nil {
- break
- }
-
- return e.complexity.AuthProviderConfiguration.DisplayName(childComplexity), true
-
- case "AuthProviderConfiguration.id":
- if e.complexity.AuthProviderConfiguration.ID == nil {
- break
- }
-
- return e.complexity.AuthProviderConfiguration.ID(childComplexity), true
-
- case "AuthProviderConfiguration.iconURL":
- if e.complexity.AuthProviderConfiguration.IconURL == nil {
- break
- }
-
- return e.complexity.AuthProviderConfiguration.IconURL(childComplexity), true
-
- case "AuthProviderConfiguration.metadataLink":
- if e.complexity.AuthProviderConfiguration.MetadataLink == nil {
- break
- }
-
- return e.complexity.AuthProviderConfiguration.MetadataLink(childComplexity), true
-
- case "AuthProviderConfiguration.signInLink":
- if e.complexity.AuthProviderConfiguration.SignInLink == nil {
- break
- }
-
- return e.complexity.AuthProviderConfiguration.SignInLink(childComplexity), true
-
- case "AuthProviderConfiguration.signOutLink":
- if e.complexity.AuthProviderConfiguration.SignOutLink == nil {
- break
- }
-
- return e.complexity.AuthProviderConfiguration.SignOutLink(childComplexity), true
-
- case "AuthProviderCredentialsProfile.credentialParameters":
- if e.complexity.AuthProviderCredentialsProfile.CredentialParameters == nil {
- break
- }
-
- return e.complexity.AuthProviderCredentialsProfile.CredentialParameters(childComplexity), true
-
- case "AuthProviderCredentialsProfile.description":
- if e.complexity.AuthProviderCredentialsProfile.Description == nil {
- break
- }
-
- return e.complexity.AuthProviderCredentialsProfile.Description(childComplexity), true
-
- case "AuthProviderCredentialsProfile.id":
- if e.complexity.AuthProviderCredentialsProfile.ID == nil {
- break
- }
-
- return e.complexity.AuthProviderCredentialsProfile.ID(childComplexity), true
-
- case "AuthProviderCredentialsProfile.label":
- if e.complexity.AuthProviderCredentialsProfile.Label == nil {
- break
- }
-
- return e.complexity.AuthProviderCredentialsProfile.Label(childComplexity), true
-
- case "AuthProviderInfo.configurable":
- if e.complexity.AuthProviderInfo.Configurable == nil {
- break
- }
-
- return e.complexity.AuthProviderInfo.Configurable(childComplexity), true
-
- case "AuthProviderInfo.configurations":
- if e.complexity.AuthProviderInfo.Configurations == nil {
- break
- }
-
- return e.complexity.AuthProviderInfo.Configurations(childComplexity), true
-
- case "AuthProviderInfo.credentialProfiles":
- if e.complexity.AuthProviderInfo.CredentialProfiles == nil {
- break
- }
-
- return e.complexity.AuthProviderInfo.CredentialProfiles(childComplexity), true
-
- case "AuthProviderInfo.defaultProvider":
- if e.complexity.AuthProviderInfo.DefaultProvider == nil {
- break
- }
-
- return e.complexity.AuthProviderInfo.DefaultProvider(childComplexity), true
-
- case "AuthProviderInfo.description":
- if e.complexity.AuthProviderInfo.Description == nil {
- break
- }
-
- return e.complexity.AuthProviderInfo.Description(childComplexity), true
-
- case "AuthProviderInfo.id":
- if e.complexity.AuthProviderInfo.ID == nil {
- break
- }
-
- return e.complexity.AuthProviderInfo.ID(childComplexity), true
-
- case "AuthProviderInfo.icon":
- if e.complexity.AuthProviderInfo.Icon == nil {
- break
- }
-
- return e.complexity.AuthProviderInfo.Icon(childComplexity), true
-
- case "AuthProviderInfo.label":
- if e.complexity.AuthProviderInfo.Label == nil {
- break
- }
-
- return e.complexity.AuthProviderInfo.Label(childComplexity), true
-
- case "AuthProviderInfo.requiredFeatures":
- if e.complexity.AuthProviderInfo.RequiredFeatures == nil {
- break
- }
-
- return e.complexity.AuthProviderInfo.RequiredFeatures(childComplexity), true
-
- case "ConnectionFolderInfo.description":
- if e.complexity.ConnectionFolderInfo.Description == nil {
- break
- }
-
- return e.complexity.ConnectionFolderInfo.Description(childComplexity), true
-
- case "ConnectionFolderInfo.id":
- if e.complexity.ConnectionFolderInfo.ID == nil {
- break
- }
-
- return e.complexity.ConnectionFolderInfo.ID(childComplexity), true
-
- case "ConnectionInfo.authModel":
- if e.complexity.ConnectionInfo.AuthModel == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.AuthModel(childComplexity), true
-
- case "ConnectionInfo.authNeeded":
- if e.complexity.ConnectionInfo.AuthNeeded == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.AuthNeeded(childComplexity), true
-
- case "ConnectionInfo.authProperties":
- if e.complexity.ConnectionInfo.AuthProperties == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.AuthProperties(childComplexity), true
-
- case "ConnectionInfo.clientVersion":
- if e.complexity.ConnectionInfo.ClientVersion == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.ClientVersion(childComplexity), true
-
- case "ConnectionInfo.connectTime":
- if e.complexity.ConnectionInfo.ConnectTime == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.ConnectTime(childComplexity), true
-
- case "ConnectionInfo.connected":
- if e.complexity.ConnectionInfo.Connected == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.Connected(childComplexity), true
-
- case "ConnectionInfo.connectionError":
- if e.complexity.ConnectionInfo.ConnectionError == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.ConnectionError(childComplexity), true
-
- case "ConnectionInfo.databaseName":
- if e.complexity.ConnectionInfo.DatabaseName == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.DatabaseName(childComplexity), true
-
- case "ConnectionInfo.description":
- if e.complexity.ConnectionInfo.Description == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.Description(childComplexity), true
-
- case "ConnectionInfo.driverId":
- if e.complexity.ConnectionInfo.DriverID == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.DriverID(childComplexity), true
-
- case "ConnectionInfo.features":
- if e.complexity.ConnectionInfo.Features == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.Features(childComplexity), true
-
- case "ConnectionInfo.folder":
- if e.complexity.ConnectionInfo.Folder == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.Folder(childComplexity), true
-
- case "ConnectionInfo.host":
- if e.complexity.ConnectionInfo.Host == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.Host(childComplexity), true
-
- case "ConnectionInfo.id":
- if e.complexity.ConnectionInfo.ID == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.ID(childComplexity), true
-
- case "ConnectionInfo.name":
- if e.complexity.ConnectionInfo.Name == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.Name(childComplexity), true
-
- case "ConnectionInfo.navigatorSettings":
- if e.complexity.ConnectionInfo.NavigatorSettings == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.NavigatorSettings(childComplexity), true
-
- case "ConnectionInfo.networkHandlersConfig":
- if e.complexity.ConnectionInfo.NetworkHandlersConfig == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.NetworkHandlersConfig(childComplexity), true
-
- case "ConnectionInfo.nodePath":
- if e.complexity.ConnectionInfo.NodePath == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.NodePath(childComplexity), true
-
- case "ConnectionInfo.origin":
- if e.complexity.ConnectionInfo.Origin == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.Origin(childComplexity), true
-
- case "ConnectionInfo.port":
- if e.complexity.ConnectionInfo.Port == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.Port(childComplexity), true
-
- case "ConnectionInfo.properties":
- if e.complexity.ConnectionInfo.Properties == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.Properties(childComplexity), true
-
- case "ConnectionInfo.provided":
- if e.complexity.ConnectionInfo.Provided == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.Provided(childComplexity), true
-
- case "ConnectionInfo.providerProperties":
- if e.complexity.ConnectionInfo.ProviderProperties == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.ProviderProperties(childComplexity), true
-
- case "ConnectionInfo.readOnly":
- if e.complexity.ConnectionInfo.ReadOnly == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.ReadOnly(childComplexity), true
-
- case "ConnectionInfo.saveCredentials":
- if e.complexity.ConnectionInfo.SaveCredentials == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.SaveCredentials(childComplexity), true
-
- case "ConnectionInfo.serverName":
- if e.complexity.ConnectionInfo.ServerName == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.ServerName(childComplexity), true
-
- case "ConnectionInfo.serverVersion":
- if e.complexity.ConnectionInfo.ServerVersion == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.ServerVersion(childComplexity), true
-
- case "ConnectionInfo.supportedDataFormats":
- if e.complexity.ConnectionInfo.SupportedDataFormats == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.SupportedDataFormats(childComplexity), true
-
- case "ConnectionInfo.template":
- if e.complexity.ConnectionInfo.Template == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.Template(childComplexity), true
-
- case "ConnectionInfo.url":
- if e.complexity.ConnectionInfo.URL == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.URL(childComplexity), true
-
- case "ConnectionInfo.useUrl":
- if e.complexity.ConnectionInfo.UseURL == nil {
- break
- }
-
- return e.complexity.ConnectionInfo.UseURL(childComplexity), true
-
- case "DataTransferProcessorInfo.appFileExtension":
- if e.complexity.DataTransferProcessorInfo.AppFileExtension == nil {
- break
- }
-
- return e.complexity.DataTransferProcessorInfo.AppFileExtension(childComplexity), true
-
- case "DataTransferProcessorInfo.appName":
- if e.complexity.DataTransferProcessorInfo.AppName == nil {
- break
- }
-
- return e.complexity.DataTransferProcessorInfo.AppName(childComplexity), true
-
- case "DataTransferProcessorInfo.description":
- if e.complexity.DataTransferProcessorInfo.Description == nil {
- break
- }
-
- return e.complexity.DataTransferProcessorInfo.Description(childComplexity), true
-
- case "DataTransferProcessorInfo.fileExtension":
- if e.complexity.DataTransferProcessorInfo.FileExtension == nil {
- break
- }
-
- return e.complexity.DataTransferProcessorInfo.FileExtension(childComplexity), true
-
- case "DataTransferProcessorInfo.id":
- if e.complexity.DataTransferProcessorInfo.ID == nil {
- break
- }
-
- return e.complexity.DataTransferProcessorInfo.ID(childComplexity), true
-
- case "DataTransferProcessorInfo.icon":
- if e.complexity.DataTransferProcessorInfo.Icon == nil {
- break
- }
-
- return e.complexity.DataTransferProcessorInfo.Icon(childComplexity), true
-
- case "DataTransferProcessorInfo.isBinary":
- if e.complexity.DataTransferProcessorInfo.IsBinary == nil {
- break
- }
-
- return e.complexity.DataTransferProcessorInfo.IsBinary(childComplexity), true
-
- case "DataTransferProcessorInfo.isHTML":
- if e.complexity.DataTransferProcessorInfo.IsHTML == nil {
- break
- }
-
- return e.complexity.DataTransferProcessorInfo.IsHTML(childComplexity), true
-
- case "DataTransferProcessorInfo.name":
- if e.complexity.DataTransferProcessorInfo.Name == nil {
- break
- }
-
- return e.complexity.DataTransferProcessorInfo.Name(childComplexity), true
-
- case "DataTransferProcessorInfo.order":
- if e.complexity.DataTransferProcessorInfo.Order == nil {
- break
- }
-
- return e.complexity.DataTransferProcessorInfo.Order(childComplexity), true
-
- case "DataTransferProcessorInfo.properties":
- if e.complexity.DataTransferProcessorInfo.Properties == nil {
- break
- }
-
- return e.complexity.DataTransferProcessorInfo.Properties(childComplexity), true
-
- case "DataTypeLogicalOperation.argumentCount":
- if e.complexity.DataTypeLogicalOperation.ArgumentCount == nil {
- break
- }
-
- return e.complexity.DataTypeLogicalOperation.ArgumentCount(childComplexity), true
-
- case "DataTypeLogicalOperation.expression":
- if e.complexity.DataTypeLogicalOperation.Expression == nil {
- break
- }
-
- return e.complexity.DataTypeLogicalOperation.Expression(childComplexity), true
-
- case "DataTypeLogicalOperation.id":
- if e.complexity.DataTypeLogicalOperation.ID == nil {
- break
- }
-
- return e.complexity.DataTypeLogicalOperation.ID(childComplexity), true
-
- case "DatabaseAuthModel.description":
- if e.complexity.DatabaseAuthModel.Description == nil {
- break
- }
-
- return e.complexity.DatabaseAuthModel.Description(childComplexity), true
-
- case "DatabaseAuthModel.displayName":
- if e.complexity.DatabaseAuthModel.DisplayName == nil {
- break
- }
-
- return e.complexity.DatabaseAuthModel.DisplayName(childComplexity), true
-
- case "DatabaseAuthModel.id":
- if e.complexity.DatabaseAuthModel.ID == nil {
- break
- }
-
- return e.complexity.DatabaseAuthModel.ID(childComplexity), true
-
- case "DatabaseAuthModel.icon":
- if e.complexity.DatabaseAuthModel.Icon == nil {
- break
- }
-
- return e.complexity.DatabaseAuthModel.Icon(childComplexity), true
-
- case "DatabaseAuthModel.properties":
- if e.complexity.DatabaseAuthModel.Properties == nil {
- break
- }
-
- return e.complexity.DatabaseAuthModel.Properties(childComplexity), true
-
- case "DatabaseAuthModel.requiresLocalConfiguration":
- if e.complexity.DatabaseAuthModel.RequiresLocalConfiguration == nil {
- break
- }
-
- return e.complexity.DatabaseAuthModel.RequiresLocalConfiguration(childComplexity), true
-
- case "DatabaseCatalog.catalog":
- if e.complexity.DatabaseCatalog.Catalog == nil {
- break
- }
-
- return e.complexity.DatabaseCatalog.Catalog(childComplexity), true
-
- case "DatabaseCatalog.schemaList":
- if e.complexity.DatabaseCatalog.SchemaList == nil {
- break
- }
-
- return e.complexity.DatabaseCatalog.SchemaList(childComplexity), true
-
- case "DatabaseDocument.contentType":
- if e.complexity.DatabaseDocument.ContentType == nil {
- break
- }
-
- return e.complexity.DatabaseDocument.ContentType(childComplexity), true
-
- case "DatabaseDocument.data":
- if e.complexity.DatabaseDocument.Data == nil {
- break
- }
-
- return e.complexity.DatabaseDocument.Data(childComplexity), true
-
- case "DatabaseDocument.id":
- if e.complexity.DatabaseDocument.ID == nil {
- break
- }
-
- return e.complexity.DatabaseDocument.ID(childComplexity), true
-
- case "DatabaseDocument.properties":
- if e.complexity.DatabaseDocument.Properties == nil {
- break
- }
-
- return e.complexity.DatabaseDocument.Properties(childComplexity), true
-
- case "DatabaseObjectInfo.description":
- if e.complexity.DatabaseObjectInfo.Description == nil {
- break
- }
-
- return e.complexity.DatabaseObjectInfo.Description(childComplexity), true
-
- case "DatabaseObjectInfo.editors":
- if e.complexity.DatabaseObjectInfo.Editors == nil {
- break
- }
-
- return e.complexity.DatabaseObjectInfo.Editors(childComplexity), true
-
- case "DatabaseObjectInfo.features":
- if e.complexity.DatabaseObjectInfo.Features == nil {
- break
- }
-
- return e.complexity.DatabaseObjectInfo.Features(childComplexity), true
-
- case "DatabaseObjectInfo.fullyQualifiedName":
- if e.complexity.DatabaseObjectInfo.FullyQualifiedName == nil {
- break
- }
-
- return e.complexity.DatabaseObjectInfo.FullyQualifiedName(childComplexity), true
-
- case "DatabaseObjectInfo.name":
- if e.complexity.DatabaseObjectInfo.Name == nil {
- break
- }
-
- return e.complexity.DatabaseObjectInfo.Name(childComplexity), true
-
- case "DatabaseObjectInfo.ordinalPosition":
- if e.complexity.DatabaseObjectInfo.OrdinalPosition == nil {
- break
- }
-
- return e.complexity.DatabaseObjectInfo.OrdinalPosition(childComplexity), true
-
- case "DatabaseObjectInfo.overloadedName":
- if e.complexity.DatabaseObjectInfo.OverloadedName == nil {
- break
- }
-
- return e.complexity.DatabaseObjectInfo.OverloadedName(childComplexity), true
-
- case "DatabaseObjectInfo.properties":
- if e.complexity.DatabaseObjectInfo.Properties == nil {
- break
- }
-
- args, err := ec.field_DatabaseObjectInfo_properties_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.DatabaseObjectInfo.Properties(childComplexity, args["filter"].(*model.ObjectPropertyFilter)), true
-
- case "DatabaseObjectInfo.state":
- if e.complexity.DatabaseObjectInfo.State == nil {
- break
- }
-
- return e.complexity.DatabaseObjectInfo.State(childComplexity), true
-
- case "DatabaseObjectInfo.type":
- if e.complexity.DatabaseObjectInfo.Type == nil {
- break
- }
-
- return e.complexity.DatabaseObjectInfo.Type(childComplexity), true
-
- case "DatabaseObjectInfo.uniqueName":
- if e.complexity.DatabaseObjectInfo.UniqueName == nil {
- break
- }
-
- return e.complexity.DatabaseObjectInfo.UniqueName(childComplexity), true
-
- case "DatabaseStructContainers.catalogList":
- if e.complexity.DatabaseStructContainers.CatalogList == nil {
- break
- }
-
- return e.complexity.DatabaseStructContainers.CatalogList(childComplexity), true
-
- case "DatabaseStructContainers.schemaList":
- if e.complexity.DatabaseStructContainers.SchemaList == nil {
- break
- }
-
- return e.complexity.DatabaseStructContainers.SchemaList(childComplexity), true
-
- case "DatabaseStructContainers.supportsCatalogChange":
- if e.complexity.DatabaseStructContainers.SupportsCatalogChange == nil {
- break
- }
-
- return e.complexity.DatabaseStructContainers.SupportsCatalogChange(childComplexity), true
-
- case "DatabaseStructContainers.supportsSchemaChange":
- if e.complexity.DatabaseStructContainers.SupportsSchemaChange == nil {
- break
- }
-
- return e.complexity.DatabaseStructContainers.SupportsSchemaChange(childComplexity), true
-
- case "DriverInfo.allowsEmptyPassword":
- if e.complexity.DriverInfo.AllowsEmptyPassword == nil {
- break
- }
-
- return e.complexity.DriverInfo.AllowsEmptyPassword(childComplexity), true
-
- case "DriverInfo.anonymousAccess":
- if e.complexity.DriverInfo.AnonymousAccess == nil {
- break
- }
-
- return e.complexity.DriverInfo.AnonymousAccess(childComplexity), true
-
- case "DriverInfo.applicableAuthModels":
- if e.complexity.DriverInfo.ApplicableAuthModels == nil {
- break
- }
-
- return e.complexity.DriverInfo.ApplicableAuthModels(childComplexity), true
-
- case "DriverInfo.applicableNetworkHandlers":
- if e.complexity.DriverInfo.ApplicableNetworkHandlers == nil {
- break
- }
-
- return e.complexity.DriverInfo.ApplicableNetworkHandlers(childComplexity), true
-
- case "DriverInfo.custom":
- if e.complexity.DriverInfo.Custom == nil {
- break
- }
-
- return e.complexity.DriverInfo.Custom(childComplexity), true
-
- case "DriverInfo.defaultAuthModel":
- if e.complexity.DriverInfo.DefaultAuthModel == nil {
- break
- }
-
- return e.complexity.DriverInfo.DefaultAuthModel(childComplexity), true
-
- case "DriverInfo.defaultDatabase":
- if e.complexity.DriverInfo.DefaultDatabase == nil {
- break
- }
-
- return e.complexity.DriverInfo.DefaultDatabase(childComplexity), true
-
- case "DriverInfo.defaultHost":
- if e.complexity.DriverInfo.DefaultHost == nil {
- break
- }
-
- return e.complexity.DriverInfo.DefaultHost(childComplexity), true
-
- case "DriverInfo.defaultPort":
- if e.complexity.DriverInfo.DefaultPort == nil {
- break
- }
-
- return e.complexity.DriverInfo.DefaultPort(childComplexity), true
-
- case "DriverInfo.defaultServer":
- if e.complexity.DriverInfo.DefaultServer == nil {
- break
- }
-
- return e.complexity.DriverInfo.DefaultServer(childComplexity), true
-
- case "DriverInfo.defaultUser":
- if e.complexity.DriverInfo.DefaultUser == nil {
- break
- }
-
- return e.complexity.DriverInfo.DefaultUser(childComplexity), true
-
- case "DriverInfo.description":
- if e.complexity.DriverInfo.Description == nil {
- break
- }
-
- return e.complexity.DriverInfo.Description(childComplexity), true
-
- case "DriverInfo.driverClassName":
- if e.complexity.DriverInfo.DriverClassName == nil {
- break
- }
-
- return e.complexity.DriverInfo.DriverClassName(childComplexity), true
-
- case "DriverInfo.driverInfoURL":
- if e.complexity.DriverInfo.DriverInfoURL == nil {
- break
- }
-
- return e.complexity.DriverInfo.DriverInfoURL(childComplexity), true
-
- case "DriverInfo.driverParameters":
- if e.complexity.DriverInfo.DriverParameters == nil {
- break
- }
-
- return e.complexity.DriverInfo.DriverParameters(childComplexity), true
-
- case "DriverInfo.driverProperties":
- if e.complexity.DriverInfo.DriverProperties == nil {
- break
- }
-
- return e.complexity.DriverInfo.DriverProperties(childComplexity), true
-
- case "DriverInfo.driverPropertiesURL":
- if e.complexity.DriverInfo.DriverPropertiesURL == nil {
- break
- }
-
- return e.complexity.DriverInfo.DriverPropertiesURL(childComplexity), true
-
- case "DriverInfo.embedded":
- if e.complexity.DriverInfo.Embedded == nil {
- break
- }
-
- return e.complexity.DriverInfo.Embedded(childComplexity), true
-
- case "DriverInfo.enabled":
- if e.complexity.DriverInfo.Enabled == nil {
- break
- }
-
- return e.complexity.DriverInfo.Enabled(childComplexity), true
-
- case "DriverInfo.id":
- if e.complexity.DriverInfo.ID == nil {
- break
- }
-
- return e.complexity.DriverInfo.ID(childComplexity), true
-
- case "DriverInfo.icon":
- if e.complexity.DriverInfo.Icon == nil {
- break
- }
-
- return e.complexity.DriverInfo.Icon(childComplexity), true
-
- case "DriverInfo.iconBig":
- if e.complexity.DriverInfo.IconBig == nil {
- break
- }
-
- return e.complexity.DriverInfo.IconBig(childComplexity), true
-
- case "DriverInfo.license":
- if e.complexity.DriverInfo.License == nil {
- break
- }
-
- return e.complexity.DriverInfo.License(childComplexity), true
-
- case "DriverInfo.licenseRequired":
- if e.complexity.DriverInfo.LicenseRequired == nil {
- break
- }
-
- return e.complexity.DriverInfo.LicenseRequired(childComplexity), true
-
- case "DriverInfo.name":
- if e.complexity.DriverInfo.Name == nil {
- break
- }
-
- return e.complexity.DriverInfo.Name(childComplexity), true
-
- case "DriverInfo.promotedScore":
- if e.complexity.DriverInfo.PromotedScore == nil {
- break
- }
-
- return e.complexity.DriverInfo.PromotedScore(childComplexity), true
-
- case "DriverInfo.providerId":
- if e.complexity.DriverInfo.ProviderID == nil {
- break
- }
-
- return e.complexity.DriverInfo.ProviderID(childComplexity), true
-
- case "DriverInfo.providerProperties":
- if e.complexity.DriverInfo.ProviderProperties == nil {
- break
- }
-
- return e.complexity.DriverInfo.ProviderProperties(childComplexity), true
-
- case "DriverInfo.requiresServerName":
- if e.complexity.DriverInfo.RequiresServerName == nil {
- break
- }
-
- return e.complexity.DriverInfo.RequiresServerName(childComplexity), true
-
- case "DriverInfo.sampleURL":
- if e.complexity.DriverInfo.SampleURL == nil {
- break
- }
-
- return e.complexity.DriverInfo.SampleURL(childComplexity), true
-
- case "LogEntry.message":
- if e.complexity.LogEntry.Message == nil {
- break
- }
-
- return e.complexity.LogEntry.Message(childComplexity), true
-
- case "LogEntry.stackTrace":
- if e.complexity.LogEntry.StackTrace == nil {
- break
- }
-
- return e.complexity.LogEntry.StackTrace(childComplexity), true
-
- case "LogEntry.time":
- if e.complexity.LogEntry.Time == nil {
- break
- }
-
- return e.complexity.LogEntry.Time(childComplexity), true
-
- case "LogEntry.type":
- if e.complexity.LogEntry.Type == nil {
- break
- }
-
- return e.complexity.LogEntry.Type(childComplexity), true
-
- case "Mutation.asyncReadDataFromContainer":
- if e.complexity.Mutation.AsyncReadDataFromContainer == nil {
- break
- }
-
- args, err := ec.field_Mutation_asyncReadDataFromContainer_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.AsyncReadDataFromContainer(childComplexity, args["connectionId"].(string), args["contextId"].(string), args["containerNodePath"].(string), args["resultId"].(*string), args["filter"].(*model.SQLDataFilter), args["dataFormat"].(*model.ResultDataFormat)), true
-
- case "Mutation.asyncSqlExecuteQuery":
- if e.complexity.Mutation.AsyncSQLExecuteQuery == nil {
- break
- }
-
- args, err := ec.field_Mutation_asyncSqlExecuteQuery_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.AsyncSQLExecuteQuery(childComplexity, args["projectId"].(*string), args["connectionId"].(string), args["contextId"].(string), args["sql"].(string), args["resultId"].(*string), args["filter"].(*model.SQLDataFilter), args["dataFormat"].(*model.ResultDataFormat), args["readLogs"].(*bool)), true
-
- case "Mutation.asyncSqlExecuteResults":
- if e.complexity.Mutation.AsyncSQLExecuteResults == nil {
- break
- }
-
- args, err := ec.field_Mutation_asyncSqlExecuteResults_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.AsyncSQLExecuteResults(childComplexity, args["taskId"].(string)), true
-
- case "Mutation.asyncSqlExplainExecutionPlan":
- if e.complexity.Mutation.AsyncSQLExplainExecutionPlan == nil {
- break
- }
-
- args, err := ec.field_Mutation_asyncSqlExplainExecutionPlan_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.AsyncSQLExplainExecutionPlan(childComplexity, args["connectionId"].(string), args["contextId"].(string), args["query"].(string), args["configuration"].(interface{})), true
-
- case "Mutation.asyncSqlExplainExecutionPlanResult":
- if e.complexity.Mutation.AsyncSQLExplainExecutionPlanResult == nil {
- break
- }
-
- args, err := ec.field_Mutation_asyncSqlExplainExecutionPlanResult_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.AsyncSQLExplainExecutionPlanResult(childComplexity, args["taskId"].(string)), true
-
- case "Mutation.asyncTaskCancel":
- if e.complexity.Mutation.AsyncTaskCancel == nil {
- break
- }
-
- args, err := ec.field_Mutation_asyncTaskCancel_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.AsyncTaskCancel(childComplexity, args["id"].(string)), true
-
- case "Mutation.asyncTaskInfo":
- if e.complexity.Mutation.AsyncTaskInfo == nil {
- break
- }
-
- args, err := ec.field_Mutation_asyncTaskInfo_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.AsyncTaskInfo(childComplexity, args["id"].(string), args["removeOnFinish"].(bool)), true
-
- case "Mutation.asyncTaskStatus":
- if e.complexity.Mutation.AsyncTaskStatus == nil {
- break
- }
-
- args, err := ec.field_Mutation_asyncTaskStatus_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.AsyncTaskStatus(childComplexity, args["id"].(string)), true
-
- case "Mutation.changeSessionLanguage":
- if e.complexity.Mutation.ChangeSessionLanguage == nil {
- break
- }
-
- args, err := ec.field_Mutation_changeSessionLanguage_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.ChangeSessionLanguage(childComplexity, args["locale"].(*string)), true
-
- case "Mutation.closeConnection":
- if e.complexity.Mutation.CloseConnection == nil {
- break
- }
-
- args, err := ec.field_Mutation_closeConnection_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.CloseConnection(childComplexity, args["id"].(string)), true
-
- case "Mutation.closeSession":
- if e.complexity.Mutation.CloseSession == nil {
- break
- }
-
- return e.complexity.Mutation.CloseSession(childComplexity), true
-
- case "Mutation.copyConnectionFromNode":
- if e.complexity.Mutation.CopyConnectionFromNode == nil {
- break
- }
-
- args, err := ec.field_Mutation_copyConnectionFromNode_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.CopyConnectionFromNode(childComplexity, args["nodePath"].(string), args["config"].(*model.ConnectionConfig)), true
-
- case "Mutation.createConnection":
- if e.complexity.Mutation.CreateConnection == nil {
- break
- }
-
- args, err := ec.field_Mutation_createConnection_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.CreateConnection(childComplexity, args["config"].(model.ConnectionConfig)), true
-
- case "Mutation.createConnectionFolder":
- if e.complexity.Mutation.CreateConnectionFolder == nil {
- break
- }
-
- args, err := ec.field_Mutation_createConnectionFolder_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.CreateConnectionFolder(childComplexity, args["parentFolderPath"].(*string), args["folderName"].(string)), true
-
- case "Mutation.createConnectionFromTemplate":
- if e.complexity.Mutation.CreateConnectionFromTemplate == nil {
- break
- }
-
- args, err := ec.field_Mutation_createConnectionFromTemplate_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.CreateConnectionFromTemplate(childComplexity, args["templateId"].(string), args["connectionName"].(*string)), true
-
- case "Mutation.deleteConnection":
- if e.complexity.Mutation.DeleteConnection == nil {
- break
- }
-
- args, err := ec.field_Mutation_deleteConnection_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.DeleteConnection(childComplexity, args["id"].(string)), true
-
- case "Mutation.deleteConnectionFolder":
- if e.complexity.Mutation.DeleteConnectionFolder == nil {
- break
- }
-
- args, err := ec.field_Mutation_deleteConnectionFolder_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.DeleteConnectionFolder(childComplexity, args["folderPath"].(string)), true
-
- case "Mutation.initConnection":
- if e.complexity.Mutation.InitConnection == nil {
- break
- }
-
- args, err := ec.field_Mutation_initConnection_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.InitConnection(childComplexity, args["id"].(string), args["credentials"].(interface{}), args["networkCredentials"].([]*model.NetworkHandlerConfigInput), args["saveCredentials"].(*bool)), true
-
- case "Mutation.navDeleteNodes":
- if e.complexity.Mutation.NavDeleteNodes == nil {
- break
- }
-
- args, err := ec.field_Mutation_navDeleteNodes_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.NavDeleteNodes(childComplexity, args["nodePaths"].([]string)), true
-
- case "Mutation.navMoveNodesToFolder":
- if e.complexity.Mutation.NavMoveNodesToFolder == nil {
- break
- }
-
- args, err := ec.field_Mutation_navMoveNodesToFolder_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.NavMoveNodesToFolder(childComplexity, args["nodePaths"].([]string), args["folderPath"].(string)), true
-
- case "Mutation.navRenameNode":
- if e.complexity.Mutation.NavRenameNode == nil {
- break
- }
-
- args, err := ec.field_Mutation_navRenameNode_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.NavRenameNode(childComplexity, args["nodePath"].(string), args["newName"].(string)), true
-
- case "Mutation.openConnection":
- if e.complexity.Mutation.OpenConnection == nil {
- break
- }
-
- args, err := ec.field_Mutation_openConnection_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.OpenConnection(childComplexity, args["config"].(model.ConnectionConfig)), true
-
- case "Mutation.openSession":
- if e.complexity.Mutation.OpenSession == nil {
- break
- }
-
- args, err := ec.field_Mutation_openSession_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.OpenSession(childComplexity, args["defaultLocale"].(*string)), true
-
- case "Mutation.readLobValue":
- if e.complexity.Mutation.ReadLobValue == nil {
- break
- }
-
- args, err := ec.field_Mutation_readLobValue_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.ReadLobValue(childComplexity, args["connectionId"].(string), args["contextId"].(string), args["resultsId"].(string), args["lobColumnIndex"].(int), args["row"].([]*model.SQLResultRow)), true
-
- case "Mutation.refreshSessionConnections":
- if e.complexity.Mutation.RefreshSessionConnections == nil {
- break
- }
-
- return e.complexity.Mutation.RefreshSessionConnections(childComplexity), true
-
- case "Mutation.rmCreateResource":
- if e.complexity.Mutation.RmCreateResource == nil {
- break
- }
-
- args, err := ec.field_Mutation_rmCreateResource_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.RmCreateResource(childComplexity, args["projectId"].(string), args["resourcePath"].(string), args["isFolder"].(bool)), true
-
- case "Mutation.rmDeleteResource":
- if e.complexity.Mutation.RmDeleteResource == nil {
- break
- }
-
- args, err := ec.field_Mutation_rmDeleteResource_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.RmDeleteResource(childComplexity, args["projectId"].(string), args["resourcePath"].(string), args["recursive"].(bool)), true
-
- case "Mutation.rmMoveResource":
- if e.complexity.Mutation.RmMoveResource == nil {
- break
- }
-
- args, err := ec.field_Mutation_rmMoveResource_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.RmMoveResource(childComplexity, args["projectId"].(string), args["oldResourcePath"].(string), args["newResourcePath"].(*string)), true
-
- case "Mutation.rmWriteResourceStringContent":
- if e.complexity.Mutation.RmWriteResourceStringContent == nil {
- break
- }
-
- args, err := ec.field_Mutation_rmWriteResourceStringContent_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.RmWriteResourceStringContent(childComplexity, args["projectId"].(string), args["resourcePath"].(string), args["data"].(string)), true
-
- case "Mutation.sqlContextCreate":
- if e.complexity.Mutation.SQLContextCreate == nil {
- break
- }
-
- args, err := ec.field_Mutation_sqlContextCreate_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.SQLContextCreate(childComplexity, args["connectionId"].(string), args["defaultCatalog"].(*string), args["defaultSchema"].(*string)), true
-
- case "Mutation.sqlContextDestroy":
- if e.complexity.Mutation.SQLContextDestroy == nil {
- break
- }
-
- args, err := ec.field_Mutation_sqlContextDestroy_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.SQLContextDestroy(childComplexity, args["connectionId"].(string), args["contextId"].(string)), true
-
- case "Mutation.sqlContextSetDefaults":
- if e.complexity.Mutation.SQLContextSetDefaults == nil {
- break
- }
-
- args, err := ec.field_Mutation_sqlContextSetDefaults_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.SQLContextSetDefaults(childComplexity, args["connectionId"].(string), args["contextId"].(string), args["defaultCatalog"].(*string), args["defaultSchema"].(*string)), true
-
- case "Mutation.sqlResultClose":
- if e.complexity.Mutation.SQLResultClose == nil {
- break
- }
-
- args, err := ec.field_Mutation_sqlResultClose_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.SQLResultClose(childComplexity, args["connectionId"].(string), args["contextId"].(string), args["resultId"].(string)), true
-
- case "Mutation.setConnectionNavigatorSettings":
- if e.complexity.Mutation.SetConnectionNavigatorSettings == nil {
- break
- }
-
- args, err := ec.field_Mutation_setConnectionNavigatorSettings_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.SetConnectionNavigatorSettings(childComplexity, args["id"].(string), args["settings"].(model.NavigatorSettingsInput)), true
-
- case "Mutation.setUserConfigurationParameter":
- if e.complexity.Mutation.SetUserConfigurationParameter == nil {
- break
- }
-
- args, err := ec.field_Mutation_setUserConfigurationParameter_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.SetUserConfigurationParameter(childComplexity, args["name"].(string), args["value"].(interface{})), true
-
- case "Mutation.testConnection":
- if e.complexity.Mutation.TestConnection == nil {
- break
- }
-
- args, err := ec.field_Mutation_testConnection_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.TestConnection(childComplexity, args["config"].(model.ConnectionConfig)), true
-
- case "Mutation.testNetworkHandler":
- if e.complexity.Mutation.TestNetworkHandler == nil {
- break
- }
-
- args, err := ec.field_Mutation_testNetworkHandler_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.TestNetworkHandler(childComplexity, args["config"].(model.NetworkHandlerConfigInput)), true
-
- case "Mutation.touchSession":
- if e.complexity.Mutation.TouchSession == nil {
- break
- }
-
- return e.complexity.Mutation.TouchSession(childComplexity), true
-
- case "Mutation.updateConnection":
- if e.complexity.Mutation.UpdateConnection == nil {
- break
- }
-
- args, err := ec.field_Mutation_updateConnection_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.UpdateConnection(childComplexity, args["config"].(model.ConnectionConfig)), true
-
- case "Mutation.updateResultsDataBatch":
- if e.complexity.Mutation.UpdateResultsDataBatch == nil {
- break
- }
-
- args, err := ec.field_Mutation_updateResultsDataBatch_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.UpdateResultsDataBatch(childComplexity, args["connectionId"].(string), args["contextId"].(string), args["resultsId"].(string), args["updatedRows"].([]*model.SQLResultRow), args["deletedRows"].([]*model.SQLResultRow), args["addedRows"].([]*model.SQLResultRow)), true
-
- case "Mutation.updateResultsDataBatchScript":
- if e.complexity.Mutation.UpdateResultsDataBatchScript == nil {
- break
- }
-
- args, err := ec.field_Mutation_updateResultsDataBatchScript_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.UpdateResultsDataBatchScript(childComplexity, args["connectionId"].(string), args["contextId"].(string), args["resultsId"].(string), args["updatedRows"].([]*model.SQLResultRow), args["deletedRows"].([]*model.SQLResultRow), args["addedRows"].([]*model.SQLResultRow)), true
-
- case "NavigatorNodeInfo.description":
- if e.complexity.NavigatorNodeInfo.Description == nil {
- break
- }
-
- return e.complexity.NavigatorNodeInfo.Description(childComplexity), true
-
- case "NavigatorNodeInfo.features":
- if e.complexity.NavigatorNodeInfo.Features == nil {
- break
- }
-
- return e.complexity.NavigatorNodeInfo.Features(childComplexity), true
-
- case "NavigatorNodeInfo.folder":
- if e.complexity.NavigatorNodeInfo.Folder == nil {
- break
- }
-
- return e.complexity.NavigatorNodeInfo.Folder(childComplexity), true
-
- case "NavigatorNodeInfo.fullName":
- if e.complexity.NavigatorNodeInfo.FullName == nil {
- break
- }
-
- return e.complexity.NavigatorNodeInfo.FullName(childComplexity), true
-
- case "NavigatorNodeInfo.hasChildren":
- if e.complexity.NavigatorNodeInfo.HasChildren == nil {
- break
- }
-
- return e.complexity.NavigatorNodeInfo.HasChildren(childComplexity), true
-
- case "NavigatorNodeInfo.id":
- if e.complexity.NavigatorNodeInfo.ID == nil {
- break
- }
-
- return e.complexity.NavigatorNodeInfo.ID(childComplexity), true
-
- case "NavigatorNodeInfo.icon":
- if e.complexity.NavigatorNodeInfo.Icon == nil {
- break
- }
-
- return e.complexity.NavigatorNodeInfo.Icon(childComplexity), true
-
- case "NavigatorNodeInfo.inline":
- if e.complexity.NavigatorNodeInfo.Inline == nil {
- break
- }
-
- return e.complexity.NavigatorNodeInfo.Inline(childComplexity), true
-
- case "NavigatorNodeInfo.name":
- if e.complexity.NavigatorNodeInfo.Name == nil {
- break
- }
-
- return e.complexity.NavigatorNodeInfo.Name(childComplexity), true
-
- case "NavigatorNodeInfo.navigable":
- if e.complexity.NavigatorNodeInfo.Navigable == nil {
- break
- }
-
- return e.complexity.NavigatorNodeInfo.Navigable(childComplexity), true
-
- case "NavigatorNodeInfo.nodeDetails":
- if e.complexity.NavigatorNodeInfo.NodeDetails == nil {
- break
- }
-
- return e.complexity.NavigatorNodeInfo.NodeDetails(childComplexity), true
-
- case "NavigatorNodeInfo.nodeType":
- if e.complexity.NavigatorNodeInfo.NodeType == nil {
- break
- }
-
- return e.complexity.NavigatorNodeInfo.NodeType(childComplexity), true
-
- case "NavigatorNodeInfo.object":
- if e.complexity.NavigatorNodeInfo.Object == nil {
- break
- }
-
- return e.complexity.NavigatorNodeInfo.Object(childComplexity), true
-
- case "NavigatorSettings.hideFolders":
- if e.complexity.NavigatorSettings.HideFolders == nil {
- break
- }
-
- return e.complexity.NavigatorSettings.HideFolders(childComplexity), true
-
- case "NavigatorSettings.hideSchemas":
- if e.complexity.NavigatorSettings.HideSchemas == nil {
- break
- }
-
- return e.complexity.NavigatorSettings.HideSchemas(childComplexity), true
-
- case "NavigatorSettings.hideVirtualModel":
- if e.complexity.NavigatorSettings.HideVirtualModel == nil {
- break
- }
-
- return e.complexity.NavigatorSettings.HideVirtualModel(childComplexity), true
-
- case "NavigatorSettings.mergeEntities":
- if e.complexity.NavigatorSettings.MergeEntities == nil {
- break
- }
-
- return e.complexity.NavigatorSettings.MergeEntities(childComplexity), true
-
- case "NavigatorSettings.showOnlyEntities":
- if e.complexity.NavigatorSettings.ShowOnlyEntities == nil {
- break
- }
-
- return e.complexity.NavigatorSettings.ShowOnlyEntities(childComplexity), true
-
- case "NavigatorSettings.showSystemObjects":
- if e.complexity.NavigatorSettings.ShowSystemObjects == nil {
- break
- }
-
- return e.complexity.NavigatorSettings.ShowSystemObjects(childComplexity), true
-
- case "NavigatorSettings.showUtilityObjects":
- if e.complexity.NavigatorSettings.ShowUtilityObjects == nil {
- break
- }
-
- return e.complexity.NavigatorSettings.ShowUtilityObjects(childComplexity), true
-
- case "NetworkEndpointInfo.clientVersion":
- if e.complexity.NetworkEndpointInfo.ClientVersion == nil {
- break
- }
-
- return e.complexity.NetworkEndpointInfo.ClientVersion(childComplexity), true
-
- case "NetworkEndpointInfo.message":
- if e.complexity.NetworkEndpointInfo.Message == nil {
- break
- }
-
- return e.complexity.NetworkEndpointInfo.Message(childComplexity), true
-
- case "NetworkEndpointInfo.serverVersion":
- if e.complexity.NetworkEndpointInfo.ServerVersion == nil {
- break
- }
-
- return e.complexity.NetworkEndpointInfo.ServerVersion(childComplexity), true
-
- case "NetworkHandlerConfig.authType":
- if e.complexity.NetworkHandlerConfig.AuthType == nil {
- break
- }
-
- return e.complexity.NetworkHandlerConfig.AuthType(childComplexity), true
-
- case "NetworkHandlerConfig.enabled":
- if e.complexity.NetworkHandlerConfig.Enabled == nil {
- break
- }
-
- return e.complexity.NetworkHandlerConfig.Enabled(childComplexity), true
-
- case "NetworkHandlerConfig.id":
- if e.complexity.NetworkHandlerConfig.ID == nil {
- break
- }
-
- return e.complexity.NetworkHandlerConfig.ID(childComplexity), true
-
- case "NetworkHandlerConfig.key":
- if e.complexity.NetworkHandlerConfig.Key == nil {
- break
- }
-
- return e.complexity.NetworkHandlerConfig.Key(childComplexity), true
-
- case "NetworkHandlerConfig.password":
- if e.complexity.NetworkHandlerConfig.Password == nil {
- break
- }
-
- return e.complexity.NetworkHandlerConfig.Password(childComplexity), true
-
- case "NetworkHandlerConfig.properties":
- if e.complexity.NetworkHandlerConfig.Properties == nil {
- break
- }
-
- return e.complexity.NetworkHandlerConfig.Properties(childComplexity), true
-
- case "NetworkHandlerConfig.savePassword":
- if e.complexity.NetworkHandlerConfig.SavePassword == nil {
- break
- }
-
- return e.complexity.NetworkHandlerConfig.SavePassword(childComplexity), true
-
- case "NetworkHandlerConfig.userName":
- if e.complexity.NetworkHandlerConfig.UserName == nil {
- break
- }
-
- return e.complexity.NetworkHandlerConfig.UserName(childComplexity), true
-
- case "NetworkHandlerDescriptor.codeName":
- if e.complexity.NetworkHandlerDescriptor.CodeName == nil {
- break
- }
-
- return e.complexity.NetworkHandlerDescriptor.CodeName(childComplexity), true
-
- case "NetworkHandlerDescriptor.description":
- if e.complexity.NetworkHandlerDescriptor.Description == nil {
- break
- }
-
- return e.complexity.NetworkHandlerDescriptor.Description(childComplexity), true
-
- case "NetworkHandlerDescriptor.id":
- if e.complexity.NetworkHandlerDescriptor.ID == nil {
- break
- }
-
- return e.complexity.NetworkHandlerDescriptor.ID(childComplexity), true
-
- case "NetworkHandlerDescriptor.label":
- if e.complexity.NetworkHandlerDescriptor.Label == nil {
- break
- }
-
- return e.complexity.NetworkHandlerDescriptor.Label(childComplexity), true
-
- case "NetworkHandlerDescriptor.properties":
- if e.complexity.NetworkHandlerDescriptor.Properties == nil {
- break
- }
-
- return e.complexity.NetworkHandlerDescriptor.Properties(childComplexity), true
-
- case "NetworkHandlerDescriptor.secured":
- if e.complexity.NetworkHandlerDescriptor.Secured == nil {
- break
- }
-
- return e.complexity.NetworkHandlerDescriptor.Secured(childComplexity), true
-
- case "NetworkHandlerDescriptor.type":
- if e.complexity.NetworkHandlerDescriptor.Type == nil {
- break
- }
-
- return e.complexity.NetworkHandlerDescriptor.Type(childComplexity), true
-
- case "ObjectDescriptor.description":
- if e.complexity.ObjectDescriptor.Description == nil {
- break
- }
-
- return e.complexity.ObjectDescriptor.Description(childComplexity), true
-
- case "ObjectDescriptor.displayName":
- if e.complexity.ObjectDescriptor.DisplayName == nil {
- break
- }
-
- return e.complexity.ObjectDescriptor.DisplayName(childComplexity), true
-
- case "ObjectDescriptor.fullName":
- if e.complexity.ObjectDescriptor.FullName == nil {
- break
- }
-
- return e.complexity.ObjectDescriptor.FullName(childComplexity), true
-
- case "ObjectDescriptor.id":
- if e.complexity.ObjectDescriptor.ID == nil {
- break
- }
-
- return e.complexity.ObjectDescriptor.ID(childComplexity), true
-
- case "ObjectDescriptor.uniqueName":
- if e.complexity.ObjectDescriptor.UniqueName == nil {
- break
- }
-
- return e.complexity.ObjectDescriptor.UniqueName(childComplexity), true
-
- case "ObjectDescriptor.value":
- if e.complexity.ObjectDescriptor.Value == nil {
- break
- }
-
- return e.complexity.ObjectDescriptor.Value(childComplexity), true
-
- case "ObjectDetails.description":
- if e.complexity.ObjectDetails.Description == nil {
- break
- }
-
- return e.complexity.ObjectDetails.Description(childComplexity), true
-
- case "ObjectDetails.displayName":
- if e.complexity.ObjectDetails.DisplayName == nil {
- break
- }
-
- return e.complexity.ObjectDetails.DisplayName(childComplexity), true
-
- case "ObjectDetails.id":
- if e.complexity.ObjectDetails.ID == nil {
- break
- }
-
- return e.complexity.ObjectDetails.ID(childComplexity), true
-
- case "ObjectDetails.value":
- if e.complexity.ObjectDetails.Value == nil {
- break
- }
-
- return e.complexity.ObjectDetails.Value(childComplexity), true
-
- case "ObjectOrigin.configuration":
- if e.complexity.ObjectOrigin.Configuration == nil {
- break
- }
-
- return e.complexity.ObjectOrigin.Configuration(childComplexity), true
-
- case "ObjectOrigin.details":
- if e.complexity.ObjectOrigin.Details == nil {
- break
- }
-
- return e.complexity.ObjectOrigin.Details(childComplexity), true
-
- case "ObjectOrigin.displayName":
- if e.complexity.ObjectOrigin.DisplayName == nil {
- break
- }
-
- return e.complexity.ObjectOrigin.DisplayName(childComplexity), true
-
- case "ObjectOrigin.icon":
- if e.complexity.ObjectOrigin.Icon == nil {
- break
- }
-
- return e.complexity.ObjectOrigin.Icon(childComplexity), true
-
- case "ObjectOrigin.subType":
- if e.complexity.ObjectOrigin.SubType == nil {
- break
- }
-
- return e.complexity.ObjectOrigin.SubType(childComplexity), true
-
- case "ObjectOrigin.type":
- if e.complexity.ObjectOrigin.Type == nil {
- break
- }
-
- return e.complexity.ObjectOrigin.Type(childComplexity), true
-
- case "ObjectPropertyInfo.category":
- if e.complexity.ObjectPropertyInfo.Category == nil {
- break
- }
-
- return e.complexity.ObjectPropertyInfo.Category(childComplexity), true
-
- case "ObjectPropertyInfo.dataType":
- if e.complexity.ObjectPropertyInfo.DataType == nil {
- break
- }
-
- return e.complexity.ObjectPropertyInfo.DataType(childComplexity), true
-
- case "ObjectPropertyInfo.defaultValue":
- if e.complexity.ObjectPropertyInfo.DefaultValue == nil {
- break
- }
-
- return e.complexity.ObjectPropertyInfo.DefaultValue(childComplexity), true
-
- case "ObjectPropertyInfo.description":
- if e.complexity.ObjectPropertyInfo.Description == nil {
- break
- }
-
- return e.complexity.ObjectPropertyInfo.Description(childComplexity), true
-
- case "ObjectPropertyInfo.displayName":
- if e.complexity.ObjectPropertyInfo.DisplayName == nil {
- break
- }
-
- return e.complexity.ObjectPropertyInfo.DisplayName(childComplexity), true
-
- case "ObjectPropertyInfo.features":
- if e.complexity.ObjectPropertyInfo.Features == nil {
- break
- }
-
- return e.complexity.ObjectPropertyInfo.Features(childComplexity), true
-
- case "ObjectPropertyInfo.id":
- if e.complexity.ObjectPropertyInfo.ID == nil {
- break
- }
-
- return e.complexity.ObjectPropertyInfo.ID(childComplexity), true
-
- case "ObjectPropertyInfo.length":
- if e.complexity.ObjectPropertyInfo.Length == nil {
- break
- }
-
- return e.complexity.ObjectPropertyInfo.Length(childComplexity), true
-
- case "ObjectPropertyInfo.order":
- if e.complexity.ObjectPropertyInfo.Order == nil {
- break
- }
-
- return e.complexity.ObjectPropertyInfo.Order(childComplexity), true
-
- case "ObjectPropertyInfo.validValues":
- if e.complexity.ObjectPropertyInfo.ValidValues == nil {
- break
- }
-
- return e.complexity.ObjectPropertyInfo.ValidValues(childComplexity), true
-
- case "ObjectPropertyInfo.value":
- if e.complexity.ObjectPropertyInfo.Value == nil {
- break
- }
-
- return e.complexity.ObjectPropertyInfo.Value(childComplexity), true
-
- case "ProductInfo.buildTime":
- if e.complexity.ProductInfo.BuildTime == nil {
- break
- }
-
- return e.complexity.ProductInfo.BuildTime(childComplexity), true
-
- case "ProductInfo.description":
- if e.complexity.ProductInfo.Description == nil {
- break
- }
-
- return e.complexity.ProductInfo.Description(childComplexity), true
-
- case "ProductInfo.id":
- if e.complexity.ProductInfo.ID == nil {
- break
- }
-
- return e.complexity.ProductInfo.ID(childComplexity), true
-
- case "ProductInfo.latestVersionInfo":
- if e.complexity.ProductInfo.LatestVersionInfo == nil {
- break
- }
-
- return e.complexity.ProductInfo.LatestVersionInfo(childComplexity), true
-
- case "ProductInfo.licenseInfo":
- if e.complexity.ProductInfo.LicenseInfo == nil {
- break
- }
-
- return e.complexity.ProductInfo.LicenseInfo(childComplexity), true
-
- case "ProductInfo.name":
- if e.complexity.ProductInfo.Name == nil {
- break
- }
-
- return e.complexity.ProductInfo.Name(childComplexity), true
-
- case "ProductInfo.releaseTime":
- if e.complexity.ProductInfo.ReleaseTime == nil {
- break
- }
-
- return e.complexity.ProductInfo.ReleaseTime(childComplexity), true
-
- case "ProductInfo.version":
- if e.complexity.ProductInfo.Version == nil {
- break
- }
-
- return e.complexity.ProductInfo.Version(childComplexity), true
-
- case "Query.activeUser":
- if e.complexity.Query.ActiveUser == nil {
- break
- }
-
- return e.complexity.Query.ActiveUser(childComplexity), true
-
- case "Query.allConnections":
- if e.complexity.Query.AllConnections == nil {
- break
- }
-
- args, err := ec.field_Query_allConnections_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.AllConnections(childComplexity, args["id"].(*string)), true
-
- case "Query.authChangeLocalPassword":
- if e.complexity.Query.AuthChangeLocalPassword == nil {
- break
- }
-
- args, err := ec.field_Query_authChangeLocalPassword_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.AuthChangeLocalPassword(childComplexity, args["oldPassword"].(string), args["newPassword"].(string)), true
-
- case "Query.authLogin":
- if e.complexity.Query.AuthLogin == nil {
- break
- }
-
- args, err := ec.field_Query_authLogin_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.AuthLogin(childComplexity, args["provider"].(string), args["configuration"].(*string), args["credentials"].(interface{}), args["linkUser"].(*bool)), true
-
- case "Query.authLogout":
- if e.complexity.Query.AuthLogout == nil {
- break
- }
-
- args, err := ec.field_Query_authLogout_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.AuthLogout(childComplexity, args["provider"].(*string), args["configuration"].(*string)), true
-
- case "Query.authModels":
- if e.complexity.Query.AuthModels == nil {
- break
- }
-
- return e.complexity.Query.AuthModels(childComplexity), true
-
- case "Query.authProviders":
- if e.complexity.Query.AuthProviders == nil {
- break
- }
-
- return e.complexity.Query.AuthProviders(childComplexity), true
-
- case "Query.authUpdateStatus":
- if e.complexity.Query.AuthUpdateStatus == nil {
- break
- }
-
- args, err := ec.field_Query_authUpdateStatus_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.AuthUpdateStatus(childComplexity, args["authId"].(string), args["linkUser"].(*bool)), true
-
- case "Query.configureServer":
- if e.complexity.Query.ConfigureServer == nil {
- break
- }
-
- args, err := ec.field_Query_configureServer_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.ConfigureServer(childComplexity, args["configuration"].(model.ServerConfigInput)), true
-
- case "Query.connectionFolders":
- if e.complexity.Query.ConnectionFolders == nil {
- break
- }
-
- args, err := ec.field_Query_connectionFolders_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.ConnectionFolders(childComplexity, args["path"].(*string)), true
-
- case "Query.connectionInfo":
- if e.complexity.Query.ConnectionInfo == nil {
- break
- }
-
- args, err := ec.field_Query_connectionInfo_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.ConnectionInfo(childComplexity, args["id"].(string)), true
-
- case "Query.connectionState":
- if e.complexity.Query.ConnectionState == nil {
- break
- }
-
- args, err := ec.field_Query_connectionState_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.ConnectionState(childComplexity, args["id"].(string)), true
-
- case "Query.copyConnectionConfiguration":
- if e.complexity.Query.CopyConnectionConfiguration == nil {
- break
- }
-
- args, err := ec.field_Query_copyConnectionConfiguration_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.CopyConnectionConfiguration(childComplexity, args["nodePath"].(string), args["config"].(*model.ConnectionConfig)), true
-
- case "Query.createConnectionConfiguration":
- if e.complexity.Query.CreateConnectionConfiguration == nil {
- break
- }
-
- args, err := ec.field_Query_createConnectionConfiguration_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.CreateConnectionConfiguration(childComplexity, args["config"].(model.ConnectionConfig)), true
-
- case "Query.createRole":
- if e.complexity.Query.CreateRole == nil {
- break
- }
-
- args, err := ec.field_Query_createRole_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.CreateRole(childComplexity, args["roleId"].(string), args["roleName"].(*string), args["description"].(*string)), true
-
- case "Query.createUser":
- if e.complexity.Query.CreateUser == nil {
- break
- }
-
- args, err := ec.field_Query_createUser_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.CreateUser(childComplexity, args["userId"].(string)), true
-
- case "Query.dataTransferAvailableStreamProcessors":
- if e.complexity.Query.DataTransferAvailableStreamProcessors == nil {
- break
- }
-
- return e.complexity.Query.DataTransferAvailableStreamProcessors(childComplexity), true
-
- case "Query.dataTransferExportDataFromContainer":
- if e.complexity.Query.DataTransferExportDataFromContainer == nil {
- break
- }
-
- args, err := ec.field_Query_dataTransferExportDataFromContainer_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.DataTransferExportDataFromContainer(childComplexity, args["connectionId"].(string), args["containerNodePath"].(string), args["parameters"].(model.DataTransferParameters)), true
-
- case "Query.dataTransferExportDataFromResults":
- if e.complexity.Query.DataTransferExportDataFromResults == nil {
- break
- }
-
- args, err := ec.field_Query_dataTransferExportDataFromResults_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.DataTransferExportDataFromResults(childComplexity, args["connectionId"].(string), args["contextId"].(string), args["resultsId"].(string), args["parameters"].(model.DataTransferParameters)), true
-
- case "Query.dataTransferRemoveDataFile":
- if e.complexity.Query.DataTransferRemoveDataFile == nil {
- break
- }
-
- args, err := ec.field_Query_dataTransferRemoveDataFile_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.DataTransferRemoveDataFile(childComplexity, args["dataFileId"].(string)), true
-
- case "Query.deleteAuthProviderConfiguration":
- if e.complexity.Query.DeleteAuthProviderConfiguration == nil {
- break
- }
-
- args, err := ec.field_Query_deleteAuthProviderConfiguration_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.DeleteAuthProviderConfiguration(childComplexity, args["id"].(string)), true
-
- case "Query.deleteConnectionConfiguration":
- if e.complexity.Query.DeleteConnectionConfiguration == nil {
- break
- }
-
- args, err := ec.field_Query_deleteConnectionConfiguration_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.DeleteConnectionConfiguration(childComplexity, args["id"].(string)), true
-
- case "Query.deleteRole":
- if e.complexity.Query.DeleteRole == nil {
- break
- }
-
- args, err := ec.field_Query_deleteRole_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.DeleteRole(childComplexity, args["roleId"].(string)), true
-
- case "Query.deleteUser":
- if e.complexity.Query.DeleteUser == nil {
- break
- }
-
- args, err := ec.field_Query_deleteUser_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.DeleteUser(childComplexity, args["userId"].(string)), true
-
- case "Query.deleteUserMetaParameter":
- if e.complexity.Query.DeleteUserMetaParameter == nil {
- break
- }
-
- args, err := ec.field_Query_deleteUserMetaParameter_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.DeleteUserMetaParameter(childComplexity, args["id"].(string)), true
-
- case "Query.driverList":
- if e.complexity.Query.DriverList == nil {
- break
- }
-
- args, err := ec.field_Query_driverList_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.DriverList(childComplexity, args["id"].(*string)), true
-
- case "Query.enableUser":
- if e.complexity.Query.EnableUser == nil {
- break
- }
-
- args, err := ec.field_Query_enableUser_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.EnableUser(childComplexity, args["userId"].(string), args["enabled"].(bool)), true
-
- case "Query.getConnectionSubjectAccess":
- if e.complexity.Query.GetConnectionSubjectAccess == nil {
- break
- }
-
- args, err := ec.field_Query_getConnectionSubjectAccess_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.GetConnectionSubjectAccess(childComplexity, args["connectionId"].(*string)), true
-
- case "Query.getSubjectConnectionAccess":
- if e.complexity.Query.GetSubjectConnectionAccess == nil {
- break
- }
-
- args, err := ec.field_Query_getSubjectConnectionAccess_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.GetSubjectConnectionAccess(childComplexity, args["subjectId"].(*string)), true
-
- case "Query.grantUserRole":
- if e.complexity.Query.GrantUserRole == nil {
- break
- }
-
- args, err := ec.field_Query_grantUserRole_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.GrantUserRole(childComplexity, args["userId"].(string), args["roleId"].(string)), true
-
- case "Query.listAuthProviderConfigurationParameters":
- if e.complexity.Query.ListAuthProviderConfigurationParameters == nil {
- break
- }
-
- args, err := ec.field_Query_listAuthProviderConfigurationParameters_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.ListAuthProviderConfigurationParameters(childComplexity, args["providerId"].(string)), true
-
- case "Query.listAuthProviderConfigurations":
- if e.complexity.Query.ListAuthProviderConfigurations == nil {
- break
- }
-
- args, err := ec.field_Query_listAuthProviderConfigurations_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.ListAuthProviderConfigurations(childComplexity, args["providerId"].(*string)), true
-
- case "Query.listFeatureSets":
- if e.complexity.Query.ListFeatureSets == nil {
- break
- }
-
- return e.complexity.Query.ListFeatureSets(childComplexity), true
-
- case "Query.listPermissions":
- if e.complexity.Query.ListPermissions == nil {
- break
- }
-
- return e.complexity.Query.ListPermissions(childComplexity), true
-
- case "Query.listRoles":
- if e.complexity.Query.ListRoles == nil {
- break
- }
-
- args, err := ec.field_Query_listRoles_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.ListRoles(childComplexity, args["roleId"].(*string)), true
-
- case "Query.listUserProfileProperties":
- if e.complexity.Query.ListUserProfileProperties == nil {
- break
- }
-
- return e.complexity.Query.ListUserProfileProperties(childComplexity), true
-
- case "Query.listUsers":
- if e.complexity.Query.ListUsers == nil {
- break
- }
-
- args, err := ec.field_Query_listUsers_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.ListUsers(childComplexity, args["userId"].(*string)), true
-
- case "Query.metadataGetNodeDDL":
- if e.complexity.Query.MetadataGetNodeDdl == nil {
- break
- }
-
- args, err := ec.field_Query_metadataGetNodeDDL_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.MetadataGetNodeDdl(childComplexity, args["nodeId"].(string), args["options"].(interface{})), true
-
- case "Query.navGetStructContainers":
- if e.complexity.Query.NavGetStructContainers == nil {
- break
- }
-
- args, err := ec.field_Query_navGetStructContainers_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.NavGetStructContainers(childComplexity, args["connectionId"].(string), args["contextId"].(*string), args["catalog"].(*string)), true
-
- case "Query.navNodeChildren":
- if e.complexity.Query.NavNodeChildren == nil {
- break
- }
-
- args, err := ec.field_Query_navNodeChildren_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.NavNodeChildren(childComplexity, args["parentPath"].(string), args["offset"].(*int), args["limit"].(*int), args["onlyFolders"].(*bool)), true
-
- case "Query.navNodeInfo":
- if e.complexity.Query.NavNodeInfo == nil {
- break
- }
-
- args, err := ec.field_Query_navNodeInfo_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.NavNodeInfo(childComplexity, args["nodePath"].(string)), true
-
- case "Query.navNodeParents":
- if e.complexity.Query.NavNodeParents == nil {
- break
- }
-
- args, err := ec.field_Query_navNodeParents_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.NavNodeParents(childComplexity, args["nodePath"].(string)), true
-
- case "Query.navRefreshNode":
- if e.complexity.Query.NavRefreshNode == nil {
- break
- }
-
- args, err := ec.field_Query_navRefreshNode_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.NavRefreshNode(childComplexity, args["nodePath"].(string)), true
-
- case "Query.networkHandlers":
- if e.complexity.Query.NetworkHandlers == nil {
- break
- }
-
- return e.complexity.Query.NetworkHandlers(childComplexity), true
-
- case "Query.readSessionLog":
- if e.complexity.Query.ReadSessionLog == nil {
- break
- }
-
- args, err := ec.field_Query_readSessionLog_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.ReadSessionLog(childComplexity, args["maxEntries"].(*int), args["clearEntries"].(*bool)), true
-
- case "Query.revokeUserRole":
- if e.complexity.Query.RevokeUserRole == nil {
- break
- }
-
- args, err := ec.field_Query_revokeUserRole_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.RevokeUserRole(childComplexity, args["userId"].(string), args["roleId"].(string)), true
-
- case "Query.rmListProjects":
- if e.complexity.Query.RmListProjects == nil {
- break
- }
-
- return e.complexity.Query.RmListProjects(childComplexity), true
-
- case "Query.rmListResources":
- if e.complexity.Query.RmListResources == nil {
- break
- }
-
- args, err := ec.field_Query_rmListResources_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.RmListResources(childComplexity, args["projectId"].(string), args["folder"].(*string), args["nameMask"].(*string), args["readProperties"].(*bool), args["readHistory"].(*bool)), true
-
- case "Query.rmReadResourceAsString":
- if e.complexity.Query.RmReadResourceAsString == nil {
- break
- }
-
- args, err := ec.field_Query_rmReadResourceAsString_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.RmReadResourceAsString(childComplexity, args["projectId"].(string), args["resourcePath"].(string)), true
-
- case "Query.sqlCompletionProposals":
- if e.complexity.Query.SQLCompletionProposals == nil {
- break
- }
-
- args, err := ec.field_Query_sqlCompletionProposals_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.SQLCompletionProposals(childComplexity, args["connectionId"].(string), args["contextId"].(string), args["query"].(string), args["position"].(int), args["maxResults"].(*int), args["simpleMode"].(*bool)), true
-
- case "Query.sqlDialectInfo":
- if e.complexity.Query.SQLDialectInfo == nil {
- break
- }
-
- args, err := ec.field_Query_sqlDialectInfo_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.SQLDialectInfo(childComplexity, args["connectionId"].(string)), true
-
- case "Query.sqlEntityQueryGenerators":
- if e.complexity.Query.SQLEntityQueryGenerators == nil {
- break
- }
-
- args, err := ec.field_Query_sqlEntityQueryGenerators_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.SQLEntityQueryGenerators(childComplexity, args["nodePathList"].([]string)), true
-
- case "Query.sqlFormatQuery":
- if e.complexity.Query.SQLFormatQuery == nil {
- break
- }
-
- args, err := ec.field_Query_sqlFormatQuery_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.SQLFormatQuery(childComplexity, args["connectionId"].(string), args["contextId"].(string), args["query"].(string)), true
-
- case "Query.sqlGenerateEntityQuery":
- if e.complexity.Query.SQLGenerateEntityQuery == nil {
- break
- }
-
- args, err := ec.field_Query_sqlGenerateEntityQuery_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.SQLGenerateEntityQuery(childComplexity, args["generatorId"].(string), args["options"].(interface{}), args["nodePathList"].([]string)), true
-
- case "Query.sqlListContexts":
- if e.complexity.Query.SQLListContexts == nil {
- break
- }
-
- args, err := ec.field_Query_sqlListContexts_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.SQLListContexts(childComplexity, args["connectionId"].(*string), args["contextId"].(*string)), true
-
- case "Query.sqlParseQuery":
- if e.complexity.Query.SQLParseQuery == nil {
- break
- }
-
- args, err := ec.field_Query_sqlParseQuery_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.SQLParseQuery(childComplexity, args["connectionId"].(string), args["script"].(string), args["position"].(int)), true
-
- case "Query.sqlParseScript":
- if e.complexity.Query.SQLParseScript == nil {
- break
- }
-
- args, err := ec.field_Query_sqlParseScript_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.SQLParseScript(childComplexity, args["connectionId"].(string), args["script"].(string)), true
-
- case "Query.sqlSupportedOperations":
- if e.complexity.Query.SQLSupportedOperations == nil {
- break
- }
-
- args, err := ec.field_Query_sqlSupportedOperations_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.SQLSupportedOperations(childComplexity, args["connectionId"].(string), args["contextId"].(string), args["resultsId"].(string), args["attributeIndex"].(int)), true
-
- case "Query.saveAuthProviderConfiguration":
- if e.complexity.Query.SaveAuthProviderConfiguration == nil {
- break
- }
-
- args, err := ec.field_Query_saveAuthProviderConfiguration_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.SaveAuthProviderConfiguration(childComplexity, args["providerId"].(string), args["id"].(string), args["displayName"].(*string), args["disabled"].(*bool), args["iconURL"].(*string), args["description"].(*string), args["parameters"].(interface{})), true
-
- case "Query.saveUserMetaParameter":
- if e.complexity.Query.SaveUserMetaParameter == nil {
- break
- }
-
- args, err := ec.field_Query_saveUserMetaParameter_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.SaveUserMetaParameter(childComplexity, args["id"].(string), args["displayName"].(string), args["description"].(*string), args["required"].(bool)), true
-
- case "Query.searchConnections":
- if e.complexity.Query.SearchConnections == nil {
- break
- }
-
- args, err := ec.field_Query_searchConnections_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.SearchConnections(childComplexity, args["hostNames"].([]string)), true
-
- case "Query.serverConfig":
- if e.complexity.Query.ServerConfig == nil {
- break
- }
-
- return e.complexity.Query.ServerConfig(childComplexity), true
-
- case "Query.sessionPermissions":
- if e.complexity.Query.SessionPermissions == nil {
- break
- }
-
- return e.complexity.Query.SessionPermissions(childComplexity), true
-
- case "Query.sessionState":
- if e.complexity.Query.SessionState == nil {
- break
- }
-
- return e.complexity.Query.SessionState(childComplexity), true
-
- case "Query.setConnectionSubjectAccess":
- if e.complexity.Query.SetConnectionSubjectAccess == nil {
- break
- }
-
- args, err := ec.field_Query_setConnectionSubjectAccess_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.SetConnectionSubjectAccess(childComplexity, args["connectionId"].(string), args["subjects"].([]string)), true
-
- case "Query.setDefaultNavigatorSettings":
- if e.complexity.Query.SetDefaultNavigatorSettings == nil {
- break
- }
-
- args, err := ec.field_Query_setDefaultNavigatorSettings_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.SetDefaultNavigatorSettings(childComplexity, args["settings"].(model.NavigatorSettingsInput)), true
-
- case "Query.setSubjectConnectionAccess":
- if e.complexity.Query.SetSubjectConnectionAccess == nil {
- break
- }
-
- args, err := ec.field_Query_setSubjectConnectionAccess_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.SetSubjectConnectionAccess(childComplexity, args["subjectId"].(string), args["connections"].([]string)), true
-
- case "Query.setSubjectPermissions":
- if e.complexity.Query.SetSubjectPermissions == nil {
- break
- }
-
- args, err := ec.field_Query_setSubjectPermissions_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.SetSubjectPermissions(childComplexity, args["roleId"].(string), args["permissions"].([]string)), true
-
- case "Query.setUserCredentials":
- if e.complexity.Query.SetUserCredentials == nil {
- break
- }
-
- args, err := ec.field_Query_setUserCredentials_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.SetUserCredentials(childComplexity, args["userId"].(string), args["providerId"].(string), args["credentials"].(interface{})), true
-
- case "Query.setUserMetaParameterValues":
- if e.complexity.Query.SetUserMetaParameterValues == nil {
- break
- }
-
- args, err := ec.field_Query_setUserMetaParameterValues_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.SetUserMetaParameterValues(childComplexity, args["userId"].(string), args["parameters"].(interface{})), true
-
- case "Query.templateConnections":
- if e.complexity.Query.TemplateConnections == nil {
- break
- }
-
- return e.complexity.Query.TemplateConnections(childComplexity), true
-
- case "Query.updateConnectionConfiguration":
- if e.complexity.Query.UpdateConnectionConfiguration == nil {
- break
- }
-
- args, err := ec.field_Query_updateConnectionConfiguration_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.UpdateConnectionConfiguration(childComplexity, args["id"].(string), args["config"].(model.ConnectionConfig)), true
-
- case "Query.updateRole":
- if e.complexity.Query.UpdateRole == nil {
- break
- }
-
- args, err := ec.field_Query_updateRole_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.UpdateRole(childComplexity, args["roleId"].(string), args["roleName"].(*string), args["description"].(*string)), true
-
- case "Query.userConnections":
- if e.complexity.Query.UserConnections == nil {
- break
- }
-
- args, err := ec.field_Query_userConnections_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Query.UserConnections(childComplexity, args["id"].(*string)), true
-
- case "RMProject.createTime":
- if e.complexity.RMProject.CreateTime == nil {
- break
- }
-
- return e.complexity.RMProject.CreateTime(childComplexity), true
-
- case "RMProject.creator":
- if e.complexity.RMProject.Creator == nil {
- break
- }
-
- return e.complexity.RMProject.Creator(childComplexity), true
-
- case "RMProject.description":
- if e.complexity.RMProject.Description == nil {
- break
- }
-
- return e.complexity.RMProject.Description(childComplexity), true
-
- case "RMProject.id":
- if e.complexity.RMProject.ID == nil {
- break
- }
-
- return e.complexity.RMProject.ID(childComplexity), true
-
- case "RMProject.name":
- if e.complexity.RMProject.Name == nil {
- break
- }
-
- return e.complexity.RMProject.Name(childComplexity), true
-
- case "RMProject.shared":
- if e.complexity.RMProject.Shared == nil {
- break
- }
-
- return e.complexity.RMProject.Shared(childComplexity), true
-
- case "RMResource.folder":
- if e.complexity.RMResource.Folder == nil {
- break
- }
-
- return e.complexity.RMResource.Folder(childComplexity), true
-
- case "RMResource.length":
- if e.complexity.RMResource.Length == nil {
- break
- }
-
- return e.complexity.RMResource.Length(childComplexity), true
-
- case "RMResource.name":
- if e.complexity.RMResource.Name == nil {
- break
- }
-
- return e.complexity.RMResource.Name(childComplexity), true
-
- case "SQLCompletionProposal.cursorPosition":
- if e.complexity.SQLCompletionProposal.CursorPosition == nil {
- break
- }
-
- return e.complexity.SQLCompletionProposal.CursorPosition(childComplexity), true
-
- case "SQLCompletionProposal.displayString":
- if e.complexity.SQLCompletionProposal.DisplayString == nil {
- break
- }
-
- return e.complexity.SQLCompletionProposal.DisplayString(childComplexity), true
-
- case "SQLCompletionProposal.icon":
- if e.complexity.SQLCompletionProposal.Icon == nil {
- break
- }
-
- return e.complexity.SQLCompletionProposal.Icon(childComplexity), true
-
- case "SQLCompletionProposal.nodePath":
- if e.complexity.SQLCompletionProposal.NodePath == nil {
- break
- }
-
- return e.complexity.SQLCompletionProposal.NodePath(childComplexity), true
-
- case "SQLCompletionProposal.replacementLength":
- if e.complexity.SQLCompletionProposal.ReplacementLength == nil {
- break
- }
-
- return e.complexity.SQLCompletionProposal.ReplacementLength(childComplexity), true
-
- case "SQLCompletionProposal.replacementOffset":
- if e.complexity.SQLCompletionProposal.ReplacementOffset == nil {
- break
- }
-
- return e.complexity.SQLCompletionProposal.ReplacementOffset(childComplexity), true
-
- case "SQLCompletionProposal.replacementString":
- if e.complexity.SQLCompletionProposal.ReplacementString == nil {
- break
- }
-
- return e.complexity.SQLCompletionProposal.ReplacementString(childComplexity), true
-
- case "SQLCompletionProposal.score":
- if e.complexity.SQLCompletionProposal.Score == nil {
- break
- }
-
- return e.complexity.SQLCompletionProposal.Score(childComplexity), true
-
- case "SQLCompletionProposal.type":
- if e.complexity.SQLCompletionProposal.Type == nil {
- break
- }
-
- return e.complexity.SQLCompletionProposal.Type(childComplexity), true
-
- case "SQLContextInfo.connectionId":
- if e.complexity.SQLContextInfo.ConnectionID == nil {
- break
- }
-
- return e.complexity.SQLContextInfo.ConnectionID(childComplexity), true
-
- case "SQLContextInfo.defaultCatalog":
- if e.complexity.SQLContextInfo.DefaultCatalog == nil {
- break
- }
-
- return e.complexity.SQLContextInfo.DefaultCatalog(childComplexity), true
-
- case "SQLContextInfo.defaultSchema":
- if e.complexity.SQLContextInfo.DefaultSchema == nil {
- break
- }
-
- return e.complexity.SQLContextInfo.DefaultSchema(childComplexity), true
-
- case "SQLContextInfo.id":
- if e.complexity.SQLContextInfo.ID == nil {
- break
- }
-
- return e.complexity.SQLContextInfo.ID(childComplexity), true
-
- case "SQLDialectInfo.catalogSeparator":
- if e.complexity.SQLDialectInfo.CatalogSeparator == nil {
- break
- }
-
- return e.complexity.SQLDialectInfo.CatalogSeparator(childComplexity), true
-
- case "SQLDialectInfo.dataTypes":
- if e.complexity.SQLDialectInfo.DataTypes == nil {
- break
- }
-
- return e.complexity.SQLDialectInfo.DataTypes(childComplexity), true
-
- case "SQLDialectInfo.functions":
- if e.complexity.SQLDialectInfo.Functions == nil {
- break
- }
-
- return e.complexity.SQLDialectInfo.Functions(childComplexity), true
-
- case "SQLDialectInfo.multiLineComments":
- if e.complexity.SQLDialectInfo.MultiLineComments == nil {
- break
- }
-
- return e.complexity.SQLDialectInfo.MultiLineComments(childComplexity), true
-
- case "SQLDialectInfo.name":
- if e.complexity.SQLDialectInfo.Name == nil {
- break
- }
-
- return e.complexity.SQLDialectInfo.Name(childComplexity), true
-
- case "SQLDialectInfo.quoteStrings":
- if e.complexity.SQLDialectInfo.QuoteStrings == nil {
- break
- }
-
- return e.complexity.SQLDialectInfo.QuoteStrings(childComplexity), true
-
- case "SQLDialectInfo.reservedWords":
- if e.complexity.SQLDialectInfo.ReservedWords == nil {
- break
- }
-
- return e.complexity.SQLDialectInfo.ReservedWords(childComplexity), true
-
- case "SQLDialectInfo.scriptDelimiter":
- if e.complexity.SQLDialectInfo.ScriptDelimiter == nil {
- break
- }
-
- return e.complexity.SQLDialectInfo.ScriptDelimiter(childComplexity), true
-
- case "SQLDialectInfo.singleLineComments":
- if e.complexity.SQLDialectInfo.SingleLineComments == nil {
- break
- }
-
- return e.complexity.SQLDialectInfo.SingleLineComments(childComplexity), true
-
- case "SQLDialectInfo.structSeparator":
- if e.complexity.SQLDialectInfo.StructSeparator == nil {
- break
- }
-
- return e.complexity.SQLDialectInfo.StructSeparator(childComplexity), true
-
- case "SQLDialectInfo.supportsExplainExecutionPlan":
- if e.complexity.SQLDialectInfo.SupportsExplainExecutionPlan == nil {
- break
- }
-
- return e.complexity.SQLDialectInfo.SupportsExplainExecutionPlan(childComplexity), true
-
- case "SQLExecuteInfo.duration":
- if e.complexity.SQLExecuteInfo.Duration == nil {
- break
- }
-
- return e.complexity.SQLExecuteInfo.Duration(childComplexity), true
-
- case "SQLExecuteInfo.filterText":
- if e.complexity.SQLExecuteInfo.FilterText == nil {
- break
- }
-
- return e.complexity.SQLExecuteInfo.FilterText(childComplexity), true
-
- case "SQLExecuteInfo.results":
- if e.complexity.SQLExecuteInfo.Results == nil {
- break
- }
-
- return e.complexity.SQLExecuteInfo.Results(childComplexity), true
-
- case "SQLExecuteInfo.statusMessage":
- if e.complexity.SQLExecuteInfo.StatusMessage == nil {
- break
- }
-
- return e.complexity.SQLExecuteInfo.StatusMessage(childComplexity), true
-
- case "SQLExecutionPlan.nodes":
- if e.complexity.SQLExecutionPlan.Nodes == nil {
- break
- }
-
- return e.complexity.SQLExecutionPlan.Nodes(childComplexity), true
-
- case "SQLExecutionPlan.query":
- if e.complexity.SQLExecutionPlan.Query == nil {
- break
- }
-
- return e.complexity.SQLExecutionPlan.Query(childComplexity), true
-
- case "SQLExecutionPlanNode.condition":
- if e.complexity.SQLExecutionPlanNode.Condition == nil {
- break
- }
-
- return e.complexity.SQLExecutionPlanNode.Condition(childComplexity), true
-
- case "SQLExecutionPlanNode.description":
- if e.complexity.SQLExecutionPlanNode.Description == nil {
- break
- }
-
- return e.complexity.SQLExecutionPlanNode.Description(childComplexity), true
-
- case "SQLExecutionPlanNode.id":
- if e.complexity.SQLExecutionPlanNode.ID == nil {
- break
- }
-
- return e.complexity.SQLExecutionPlanNode.ID(childComplexity), true
-
- case "SQLExecutionPlanNode.kind":
- if e.complexity.SQLExecutionPlanNode.Kind == nil {
- break
- }
-
- return e.complexity.SQLExecutionPlanNode.Kind(childComplexity), true
-
- case "SQLExecutionPlanNode.name":
- if e.complexity.SQLExecutionPlanNode.Name == nil {
- break
- }
-
- return e.complexity.SQLExecutionPlanNode.Name(childComplexity), true
-
- case "SQLExecutionPlanNode.parentId":
- if e.complexity.SQLExecutionPlanNode.ParentID == nil {
- break
- }
-
- return e.complexity.SQLExecutionPlanNode.ParentID(childComplexity), true
-
- case "SQLExecutionPlanNode.properties":
- if e.complexity.SQLExecutionPlanNode.Properties == nil {
- break
- }
-
- return e.complexity.SQLExecutionPlanNode.Properties(childComplexity), true
-
- case "SQLExecutionPlanNode.type":
- if e.complexity.SQLExecutionPlanNode.Type == nil {
- break
- }
-
- return e.complexity.SQLExecutionPlanNode.Type(childComplexity), true
-
- case "SQLQueryGenerator.description":
- if e.complexity.SQLQueryGenerator.Description == nil {
- break
- }
-
- return e.complexity.SQLQueryGenerator.Description(childComplexity), true
-
- case "SQLQueryGenerator.id":
- if e.complexity.SQLQueryGenerator.ID == nil {
- break
- }
-
- return e.complexity.SQLQueryGenerator.ID(childComplexity), true
-
- case "SQLQueryGenerator.label":
- if e.complexity.SQLQueryGenerator.Label == nil {
- break
- }
-
- return e.complexity.SQLQueryGenerator.Label(childComplexity), true
-
- case "SQLQueryGenerator.multiObject":
- if e.complexity.SQLQueryGenerator.MultiObject == nil {
- break
- }
-
- return e.complexity.SQLQueryGenerator.MultiObject(childComplexity), true
-
- case "SQLQueryGenerator.order":
- if e.complexity.SQLQueryGenerator.Order == nil {
- break
- }
-
- return e.complexity.SQLQueryGenerator.Order(childComplexity), true
-
- case "SQLQueryResults.dataFormat":
- if e.complexity.SQLQueryResults.DataFormat == nil {
- break
- }
-
- return e.complexity.SQLQueryResults.DataFormat(childComplexity), true
-
- case "SQLQueryResults.resultSet":
- if e.complexity.SQLQueryResults.ResultSet == nil {
- break
- }
-
- return e.complexity.SQLQueryResults.ResultSet(childComplexity), true
-
- case "SQLQueryResults.sourceQuery":
- if e.complexity.SQLQueryResults.SourceQuery == nil {
- break
- }
-
- return e.complexity.SQLQueryResults.SourceQuery(childComplexity), true
-
- case "SQLQueryResults.title":
- if e.complexity.SQLQueryResults.Title == nil {
- break
- }
-
- return e.complexity.SQLQueryResults.Title(childComplexity), true
-
- case "SQLQueryResults.updateRowCount":
- if e.complexity.SQLQueryResults.UpdateRowCount == nil {
- break
- }
-
- return e.complexity.SQLQueryResults.UpdateRowCount(childComplexity), true
-
- case "SQLResultColumn.dataKind":
- if e.complexity.SQLResultColumn.DataKind == nil {
- break
- }
-
- return e.complexity.SQLResultColumn.DataKind(childComplexity), true
-
- case "SQLResultColumn.entityName":
- if e.complexity.SQLResultColumn.EntityName == nil {
- break
- }
-
- return e.complexity.SQLResultColumn.EntityName(childComplexity), true
-
- case "SQLResultColumn.fullTypeName":
- if e.complexity.SQLResultColumn.FullTypeName == nil {
- break
- }
-
- return e.complexity.SQLResultColumn.FullTypeName(childComplexity), true
-
- case "SQLResultColumn.icon":
- if e.complexity.SQLResultColumn.Icon == nil {
- break
- }
-
- return e.complexity.SQLResultColumn.Icon(childComplexity), true
-
- case "SQLResultColumn.label":
- if e.complexity.SQLResultColumn.Label == nil {
- break
- }
-
- return e.complexity.SQLResultColumn.Label(childComplexity), true
-
- case "SQLResultColumn.maxLength":
- if e.complexity.SQLResultColumn.MaxLength == nil {
- break
- }
-
- return e.complexity.SQLResultColumn.MaxLength(childComplexity), true
-
- case "SQLResultColumn.name":
- if e.complexity.SQLResultColumn.Name == nil {
- break
- }
-
- return e.complexity.SQLResultColumn.Name(childComplexity), true
-
- case "SQLResultColumn.position":
- if e.complexity.SQLResultColumn.Position == nil {
- break
- }
-
- return e.complexity.SQLResultColumn.Position(childComplexity), true
-
- case "SQLResultColumn.precision":
- if e.complexity.SQLResultColumn.Precision == nil {
- break
- }
-
- return e.complexity.SQLResultColumn.Precision(childComplexity), true
-
- case "SQLResultColumn.readOnly":
- if e.complexity.SQLResultColumn.ReadOnly == nil {
- break
- }
-
- return e.complexity.SQLResultColumn.ReadOnly(childComplexity), true
-
- case "SQLResultColumn.readOnlyStatus":
- if e.complexity.SQLResultColumn.ReadOnlyStatus == nil {
- break
- }
-
- return e.complexity.SQLResultColumn.ReadOnlyStatus(childComplexity), true
-
- case "SQLResultColumn.required":
- if e.complexity.SQLResultColumn.Required == nil {
- break
- }
-
- return e.complexity.SQLResultColumn.Required(childComplexity), true
-
- case "SQLResultColumn.scale":
- if e.complexity.SQLResultColumn.Scale == nil {
- break
- }
-
- return e.complexity.SQLResultColumn.Scale(childComplexity), true
-
- case "SQLResultColumn.supportedOperations":
- if e.complexity.SQLResultColumn.SupportedOperations == nil {
- break
- }
-
- return e.complexity.SQLResultColumn.SupportedOperations(childComplexity), true
-
- case "SQLResultColumn.typeName":
- if e.complexity.SQLResultColumn.TypeName == nil {
- break
- }
-
- return e.complexity.SQLResultColumn.TypeName(childComplexity), true
-
- case "SQLResultSet.columns":
- if e.complexity.SQLResultSet.Columns == nil {
- break
- }
-
- return e.complexity.SQLResultSet.Columns(childComplexity), true
-
- case "SQLResultSet.hasMoreData":
- if e.complexity.SQLResultSet.HasMoreData == nil {
- break
- }
-
- return e.complexity.SQLResultSet.HasMoreData(childComplexity), true
-
- case "SQLResultSet.hasRowIdentifier":
- if e.complexity.SQLResultSet.HasRowIdentifier == nil {
- break
- }
-
- return e.complexity.SQLResultSet.HasRowIdentifier(childComplexity), true
-
- case "SQLResultSet.id":
- if e.complexity.SQLResultSet.ID == nil {
- break
- }
-
- return e.complexity.SQLResultSet.ID(childComplexity), true
-
- case "SQLResultSet.rows":
- if e.complexity.SQLResultSet.Rows == nil {
- break
- }
-
- return e.complexity.SQLResultSet.Rows(childComplexity), true
-
- case "SQLResultSet.singleEntity":
- if e.complexity.SQLResultSet.SingleEntity == nil {
- break
- }
-
- return e.complexity.SQLResultSet.SingleEntity(childComplexity), true
-
- case "SQLScriptInfo.queries":
- if e.complexity.SQLScriptInfo.Queries == nil {
- break
- }
-
- return e.complexity.SQLScriptInfo.Queries(childComplexity), true
-
- case "SQLScriptQuery.end":
- if e.complexity.SQLScriptQuery.End == nil {
- break
- }
-
- return e.complexity.SQLScriptQuery.End(childComplexity), true
-
- case "SQLScriptQuery.start":
- if e.complexity.SQLScriptQuery.Start == nil {
- break
- }
-
- return e.complexity.SQLScriptQuery.Start(childComplexity), true
-
- case "ServerConfig.adminCredentialsSaveEnabled":
- if e.complexity.ServerConfig.AdminCredentialsSaveEnabled == nil {
- break
- }
-
- return e.complexity.ServerConfig.AdminCredentialsSaveEnabled(childComplexity), true
-
- case "ServerConfig.anonymousAccessEnabled":
- if e.complexity.ServerConfig.AnonymousAccessEnabled == nil {
- break
- }
-
- return e.complexity.ServerConfig.AnonymousAccessEnabled(childComplexity), true
-
- case "ServerConfig.authenticationEnabled":
- if e.complexity.ServerConfig.AuthenticationEnabled == nil {
- break
- }
-
- return e.complexity.ServerConfig.AuthenticationEnabled(childComplexity), true
-
- case "ServerConfig.configurationMode":
- if e.complexity.ServerConfig.ConfigurationMode == nil {
- break
- }
-
- return e.complexity.ServerConfig.ConfigurationMode(childComplexity), true
-
- case "ServerConfig.defaultNavigatorSettings":
- if e.complexity.ServerConfig.DefaultNavigatorSettings == nil {
- break
- }
-
- return e.complexity.ServerConfig.DefaultNavigatorSettings(childComplexity), true
-
- case "ServerConfig.developmentMode":
- if e.complexity.ServerConfig.DevelopmentMode == nil {
- break
- }
-
- return e.complexity.ServerConfig.DevelopmentMode(childComplexity), true
-
- case "ServerConfig.disabledDrivers":
- if e.complexity.ServerConfig.DisabledDrivers == nil {
- break
- }
-
- return e.complexity.ServerConfig.DisabledDrivers(childComplexity), true
-
- case "ServerConfig.enabledAuthProviders":
- if e.complexity.ServerConfig.EnabledAuthProviders == nil {
- break
- }
-
- return e.complexity.ServerConfig.EnabledAuthProviders(childComplexity), true
-
- case "ServerConfig.enabledFeatures":
- if e.complexity.ServerConfig.EnabledFeatures == nil {
- break
- }
-
- return e.complexity.ServerConfig.EnabledFeatures(childComplexity), true
-
- case "ServerConfig.hostName":
- if e.complexity.ServerConfig.HostName == nil {
- break
- }
-
- return e.complexity.ServerConfig.HostName(childComplexity), true
-
- case "ServerConfig.licenseRequired":
- if e.complexity.ServerConfig.LicenseRequired == nil {
- break
- }
-
- return e.complexity.ServerConfig.LicenseRequired(childComplexity), true
-
- case "ServerConfig.licenseValid":
- if e.complexity.ServerConfig.LicenseValid == nil {
- break
- }
-
- return e.complexity.ServerConfig.LicenseValid(childComplexity), true
-
- case "ServerConfig.localHostAddress":
- if e.complexity.ServerConfig.LocalHostAddress == nil {
- break
- }
-
- return e.complexity.ServerConfig.LocalHostAddress(childComplexity), true
-
- case "ServerConfig.name":
- if e.complexity.ServerConfig.Name == nil {
- break
- }
-
- return e.complexity.ServerConfig.Name(childComplexity), true
-
- case "ServerConfig.productConfiguration":
- if e.complexity.ServerConfig.ProductConfiguration == nil {
- break
- }
-
- return e.complexity.ServerConfig.ProductConfiguration(childComplexity), true
-
- case "ServerConfig.productInfo":
- if e.complexity.ServerConfig.ProductInfo == nil {
- break
- }
-
- return e.complexity.ServerConfig.ProductInfo(childComplexity), true
-
- case "ServerConfig.publicCredentialsSaveEnabled":
- if e.complexity.ServerConfig.PublicCredentialsSaveEnabled == nil {
- break
- }
-
- return e.complexity.ServerConfig.PublicCredentialsSaveEnabled(childComplexity), true
-
- case "ServerConfig.redirectOnFederatedAuth":
- if e.complexity.ServerConfig.RedirectOnFederatedAuth == nil {
- break
- }
-
- return e.complexity.ServerConfig.RedirectOnFederatedAuth(childComplexity), true
-
- case "ServerConfig.resourceManagerEnabled":
- if e.complexity.ServerConfig.ResourceManagerEnabled == nil {
- break
- }
-
- return e.complexity.ServerConfig.ResourceManagerEnabled(childComplexity), true
-
- case "ServerConfig.resourceQuotas":
- if e.complexity.ServerConfig.ResourceQuotas == nil {
- break
- }
-
- return e.complexity.ServerConfig.ResourceQuotas(childComplexity), true
-
- case "ServerConfig.rootURI":
- if e.complexity.ServerConfig.RootURI == nil {
- break
- }
-
- return e.complexity.ServerConfig.RootURI(childComplexity), true
-
- case "ServerConfig.serverURL":
- if e.complexity.ServerConfig.ServerURL == nil {
- break
- }
-
- return e.complexity.ServerConfig.ServerURL(childComplexity), true
-
- case "ServerConfig.services":
- if e.complexity.ServerConfig.Services == nil {
- break
- }
-
- return e.complexity.ServerConfig.Services(childComplexity), true
-
- case "ServerConfig.sessionExpireTime":
- if e.complexity.ServerConfig.SessionExpireTime == nil {
- break
- }
-
- return e.complexity.ServerConfig.SessionExpireTime(childComplexity), true
-
- case "ServerConfig.supportedLanguages":
- if e.complexity.ServerConfig.SupportedLanguages == nil {
- break
- }
-
- return e.complexity.ServerConfig.SupportedLanguages(childComplexity), true
-
- case "ServerConfig.supportsConnectionBrowser":
- if e.complexity.ServerConfig.SupportsConnectionBrowser == nil {
- break
- }
-
- return e.complexity.ServerConfig.SupportsConnectionBrowser(childComplexity), true
-
- case "ServerConfig.supportsCustomConnections":
- if e.complexity.ServerConfig.SupportsCustomConnections == nil {
- break
- }
-
- return e.complexity.ServerConfig.SupportsCustomConnections(childComplexity), true
-
- case "ServerConfig.supportsWorkspaces":
- if e.complexity.ServerConfig.SupportsWorkspaces == nil {
- break
- }
-
- return e.complexity.ServerConfig.SupportsWorkspaces(childComplexity), true
-
- case "ServerConfig.version":
- if e.complexity.ServerConfig.Version == nil {
- break
- }
-
- return e.complexity.ServerConfig.Version(childComplexity), true
-
- case "ServerConfig.workspaceId":
- if e.complexity.ServerConfig.WorkspaceID == nil {
- break
- }
-
- return e.complexity.ServerConfig.WorkspaceID(childComplexity), true
-
- case "ServerError.causedBy":
- if e.complexity.ServerError.CausedBy == nil {
- break
- }
-
- return e.complexity.ServerError.CausedBy(childComplexity), true
-
- case "ServerError.errorCode":
- if e.complexity.ServerError.ErrorCode == nil {
- break
- }
-
- return e.complexity.ServerError.ErrorCode(childComplexity), true
-
- case "ServerError.errorType":
- if e.complexity.ServerError.ErrorType == nil {
- break
- }
-
- return e.complexity.ServerError.ErrorType(childComplexity), true
-
- case "ServerError.message":
- if e.complexity.ServerError.Message == nil {
- break
- }
-
- return e.complexity.ServerError.Message(childComplexity), true
-
- case "ServerError.stackTrace":
- if e.complexity.ServerError.StackTrace == nil {
- break
- }
-
- return e.complexity.ServerError.StackTrace(childComplexity), true
-
- case "ServerLanguage.displayName":
- if e.complexity.ServerLanguage.DisplayName == nil {
- break
- }
-
- return e.complexity.ServerLanguage.DisplayName(childComplexity), true
-
- case "ServerLanguage.isoCode":
- if e.complexity.ServerLanguage.IsoCode == nil {
- break
- }
-
- return e.complexity.ServerLanguage.IsoCode(childComplexity), true
-
- case "ServerLanguage.nativeName":
- if e.complexity.ServerLanguage.NativeName == nil {
- break
- }
-
- return e.complexity.ServerLanguage.NativeName(childComplexity), true
-
- case "ServerMessage.message":
- if e.complexity.ServerMessage.Message == nil {
- break
- }
-
- return e.complexity.ServerMessage.Message(childComplexity), true
-
- case "ServerMessage.time":
- if e.complexity.ServerMessage.Time == nil {
- break
- }
-
- return e.complexity.ServerMessage.Time(childComplexity), true
-
- case "SessionInfo.actionParameters":
- if e.complexity.SessionInfo.ActionParameters == nil {
- break
- }
-
- return e.complexity.SessionInfo.ActionParameters(childComplexity), true
-
- case "SessionInfo.cacheExpired":
- if e.complexity.SessionInfo.CacheExpired == nil {
- break
- }
-
- return e.complexity.SessionInfo.CacheExpired(childComplexity), true
-
- case "SessionInfo.connections":
- if e.complexity.SessionInfo.Connections == nil {
- break
- }
-
- return e.complexity.SessionInfo.Connections(childComplexity), true
-
- case "SessionInfo.createTime":
- if e.complexity.SessionInfo.CreateTime == nil {
- break
- }
-
- return e.complexity.SessionInfo.CreateTime(childComplexity), true
-
- case "SessionInfo.lastAccessTime":
- if e.complexity.SessionInfo.LastAccessTime == nil {
- break
- }
-
- return e.complexity.SessionInfo.LastAccessTime(childComplexity), true
-
- case "SessionInfo.locale":
- if e.complexity.SessionInfo.Locale == nil {
- break
- }
-
- return e.complexity.SessionInfo.Locale(childComplexity), true
-
- case "SessionInfo.serverMessages":
- if e.complexity.SessionInfo.ServerMessages == nil {
- break
- }
-
- return e.complexity.SessionInfo.ServerMessages(childComplexity), true
-
- case "UserAuthToken.authConfiguration":
- if e.complexity.UserAuthToken.AuthConfiguration == nil {
- break
- }
-
- return e.complexity.UserAuthToken.AuthConfiguration(childComplexity), true
-
- case "UserAuthToken.authProvider":
- if e.complexity.UserAuthToken.AuthProvider == nil {
- break
- }
-
- return e.complexity.UserAuthToken.AuthProvider(childComplexity), true
-
- case "UserAuthToken.displayName":
- if e.complexity.UserAuthToken.DisplayName == nil {
- break
- }
-
- return e.complexity.UserAuthToken.DisplayName(childComplexity), true
-
- case "UserAuthToken.loginTime":
- if e.complexity.UserAuthToken.LoginTime == nil {
- break
- }
-
- return e.complexity.UserAuthToken.LoginTime(childComplexity), true
-
- case "UserAuthToken.message":
- if e.complexity.UserAuthToken.Message == nil {
- break
- }
-
- return e.complexity.UserAuthToken.Message(childComplexity), true
-
- case "UserAuthToken.origin":
- if e.complexity.UserAuthToken.Origin == nil {
- break
- }
-
- return e.complexity.UserAuthToken.Origin(childComplexity), true
-
- case "UserAuthToken.userId":
- if e.complexity.UserAuthToken.UserID == nil {
- break
- }
-
- return e.complexity.UserAuthToken.UserID(childComplexity), true
-
- case "UserInfo.authRole":
- if e.complexity.UserInfo.AuthRole == nil {
- break
- }
-
- return e.complexity.UserInfo.AuthRole(childComplexity), true
-
- case "UserInfo.authTokens":
- if e.complexity.UserInfo.AuthTokens == nil {
- break
- }
-
- return e.complexity.UserInfo.AuthTokens(childComplexity), true
-
- case "UserInfo.configurationParameters":
- if e.complexity.UserInfo.ConfigurationParameters == nil {
- break
- }
-
- return e.complexity.UserInfo.ConfigurationParameters(childComplexity), true
-
- case "UserInfo.displayName":
- if e.complexity.UserInfo.DisplayName == nil {
- break
- }
-
- return e.complexity.UserInfo.DisplayName(childComplexity), true
-
- case "UserInfo.linkedAuthProviders":
- if e.complexity.UserInfo.LinkedAuthProviders == nil {
- break
- }
-
- return e.complexity.UserInfo.LinkedAuthProviders(childComplexity), true
-
- case "UserInfo.metaParameters":
- if e.complexity.UserInfo.MetaParameters == nil {
- break
- }
-
- return e.complexity.UserInfo.MetaParameters(childComplexity), true
-
- case "UserInfo.userId":
- if e.complexity.UserInfo.UserID == nil {
- break
- }
-
- return e.complexity.UserInfo.UserID(childComplexity), true
-
- case "WebFeatureSet.description":
- if e.complexity.WebFeatureSet.Description == nil {
- break
- }
-
- return e.complexity.WebFeatureSet.Description(childComplexity), true
-
- case "WebFeatureSet.enabled":
- if e.complexity.WebFeatureSet.Enabled == nil {
- break
- }
-
- return e.complexity.WebFeatureSet.Enabled(childComplexity), true
-
- case "WebFeatureSet.id":
- if e.complexity.WebFeatureSet.ID == nil {
- break
- }
-
- return e.complexity.WebFeatureSet.ID(childComplexity), true
-
- case "WebFeatureSet.icon":
- if e.complexity.WebFeatureSet.Icon == nil {
- break
- }
-
- return e.complexity.WebFeatureSet.Icon(childComplexity), true
-
- case "WebFeatureSet.label":
- if e.complexity.WebFeatureSet.Label == nil {
- break
- }
-
- return e.complexity.WebFeatureSet.Label(childComplexity), true
-
- case "WebServiceConfig.bundleVersion":
- if e.complexity.WebServiceConfig.BundleVersion == nil {
- break
- }
-
- return e.complexity.WebServiceConfig.BundleVersion(childComplexity), true
-
- case "WebServiceConfig.description":
- if e.complexity.WebServiceConfig.Description == nil {
- break
- }
-
- return e.complexity.WebServiceConfig.Description(childComplexity), true
-
- case "WebServiceConfig.id":
- if e.complexity.WebServiceConfig.ID == nil {
- break
- }
-
- return e.complexity.WebServiceConfig.ID(childComplexity), true
-
- case "WebServiceConfig.name":
- if e.complexity.WebServiceConfig.Name == nil {
- break
- }
-
- return e.complexity.WebServiceConfig.Name(childComplexity), true
-
- }
- return 0, false
-}
-
-func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler {
- rc := graphql.GetOperationContext(ctx)
- ec := executionContext{rc, e}
- inputUnmarshalMap := graphql.BuildUnmarshalerMap(
- ec.unmarshalInputConnectionConfig,
- ec.unmarshalInputDataTransferParameters,
- ec.unmarshalInputNavigatorSettingsInput,
- ec.unmarshalInputNetworkHandlerConfigInput,
- ec.unmarshalInputObjectPropertyFilter,
- ec.unmarshalInputSQLDataFilter,
- ec.unmarshalInputSQLDataFilterConstraint,
- ec.unmarshalInputSQLResultRow,
- ec.unmarshalInputServerConfigInput,
- )
- first := true
-
- switch rc.Operation.Operation {
- case ast.Query:
- return func(ctx context.Context) *graphql.Response {
- if !first {
- return nil
- }
- first = false
- ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap)
- data := ec._Query(ctx, rc.Operation.SelectionSet)
- var buf bytes.Buffer
- data.MarshalGQL(&buf)
-
- return &graphql.Response{
- Data: buf.Bytes(),
- }
- }
- case ast.Mutation:
- return func(ctx context.Context) *graphql.Response {
- if !first {
- return nil
- }
- first = false
- ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap)
- data := ec._Mutation(ctx, rc.Operation.SelectionSet)
- var buf bytes.Buffer
- data.MarshalGQL(&buf)
-
- return &graphql.Response{
- Data: buf.Bytes(),
- }
- }
-
- default:
- return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation"))
- }
-}
-
-type executionContext struct {
- *graphql.OperationContext
- *executableSchema
-}
-
-func (ec *executionContext) introspectSchema() (*introspection.Schema, error) {
- if ec.DisableIntrospection {
- return nil, errors.New("introspection disabled")
- }
- return introspection.WrapSchema(parsedSchema), nil
-}
-
-func (ec *executionContext) introspectType(name string) (*introspection.Type, error) {
- if ec.DisableIntrospection {
- return nil, errors.New("introspection disabled")
- }
- return introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name]), nil
-}
-
-var sources = []*ast.Source{
- {Name: "../schema/schema.graphqls", Input: `# Any object (JSON)
-scalar Object
-# Date/Time
-scalar DateTime
-
-type Query
-
-type Mutation
-
-schema {
- query: Query
- mutation: Mutation
-}
-`, BuiltIn: false},
- {Name: "../schema/service.admin.graphqls", Input: `
-enum AdminSubjectType {
- user,
- role
-}
-
-type AdminConnectionGrantInfo {
- connectionId: ID! @deprecated(reason: "use dataSourceId instead")
- dataSourceId: ID!
- subjectId: ID!
- subjectType: AdminSubjectType!
-}
-
-type AdminConnectionSearchInfo {
- displayName: String!
- host: String!
- port: Int!
- possibleDrivers: [ID!]!
- defaultDriver: ID!
-}
-
-type AdminUserInfo {
- userId: ID!
-
- metaParameters: Object!
- configurationParameters: Object!
- grantedRoles: [ID!]!
- grantedConnections: [AdminConnectionGrantInfo!]!
-
- origins: [ObjectOrigin!]!
-
- linkedAuthProviders: [String!]!
- enabled: Boolean!
-}
-
-type AdminRoleInfo {
- roleId: ID!
- roleName: String
- description: String
-
- grantedUsers: [ID!]!
- grantedConnections: [AdminConnectionGrantInfo!]!
-
- rolePermissions: [ID!]!
-}
-
-type AdminPermissionInfo {
- id: ID!
- label: String
- description: String
-
- provider: String!
- category: String
-}
-
-type AdminAuthProviderConfiguration {
- providerId: ID!
- id: ID!
- displayName: String!
- disabled: Boolean!
-
- iconURL: String
- description: String
-
- parameters: Object!
-
- signInLink: String
- signOutLink: String
- redirectLink: String
- metadataLink: String
-}
-
-type WebFeatureSet {
- id: String!
- label: String!
- description: String
- icon: String
-
- enabled: Boolean!
-}
-
-input ServerConfigInput {
- serverName: String
- serverURL: String
-
- adminName: String
- adminPassword: String
-
- anonymousAccessEnabled: Boolean
- authenticationEnabled: Boolean
- customConnectionsEnabled: Boolean
- publicCredentialsSaveEnabled: Boolean
- adminCredentialsSaveEnabled: Boolean
- resourceManagerEnabled: Boolean
-
- enabledFeatures: [ID!]
- enabledAuthProviders: [ID!]
- disabledDrivers: [ID!]
-
- sessionExpireTime: Int
-}
-
-extend type Query {
-
- #### Users and roles
-
- listUsers(userId: ID): [AdminUserInfo!]!
- listRoles(roleId: ID): [AdminRoleInfo!]!
- listPermissions: [AdminPermissionInfo!]!
-
- createUser(userId: ID!): AdminUserInfo!
- deleteUser(userId: ID!): Boolean
-
- createRole(roleId: ID!, roleName: String, description: String): AdminRoleInfo!
- updateRole(roleId: ID!, roleName: String, description: String): AdminRoleInfo!
- deleteRole(roleId: ID!): Boolean
-
- grantUserRole(userId: ID!, roleId: ID!): Boolean
- revokeUserRole(userId: ID!, roleId: ID!): Boolean
-
- setSubjectPermissions(roleId: ID!, permissions: [ID!]!): [AdminPermissionInfo!]!
-
- setUserCredentials(userId: ID!, providerId: ID!, credentials: Object!): Boolean
-
- enableUser(userId: ID!, enabled: Boolean!): Boolean
-
- #### Connection management
-
- # All connection configurations
- allConnections( id: ID ): [ ConnectionInfo! ]!
-
- searchConnections( hostNames: [String!]! ): [AdminConnectionSearchInfo!]!
-
- createConnectionConfiguration( config: ConnectionConfig! ): ConnectionInfo!
- copyConnectionConfiguration( nodePath: String!, config: ConnectionConfig ): ConnectionInfo!
- updateConnectionConfiguration( id: ID!, config: ConnectionConfig! ): ConnectionInfo!
- deleteConnectionConfiguration( id: ID! ): Boolean
-
- # Permissions
-
- getConnectionSubjectAccess(connectionId: ID): [AdminConnectionGrantInfo!]!
- setConnectionSubjectAccess(connectionId: ID!, subjects: [ID!]!): Boolean
-
- getSubjectConnectionAccess(subjectId: ID): [AdminConnectionGrantInfo!]!
- setSubjectConnectionAccess(subjectId: ID!, connections: [ID!]!): Boolean
-
- #### Feature sets
-
- listFeatureSets: [WebFeatureSet!]!
-
- #### Auth providers and configurations
-
- listAuthProviderConfigurationParameters(providerId: ID!): [ObjectPropertyInfo!]!
- listAuthProviderConfigurations(providerId: ID): [AdminAuthProviderConfiguration!]!
-
- saveAuthProviderConfiguration(
- providerId: ID!,
- id: ID!,
- displayName: String,
- disabled: Boolean,
- iconURL: String
- description: String
- parameters: Object): AdminAuthProviderConfiguration!
- deleteAuthProviderConfiguration(id: ID!): Boolean!
-
- #### User profile
-
- saveUserMetaParameter(id: ID!, displayName: String!, description: String, required: Boolean!): ObjectPropertyInfo!
-
- deleteUserMetaParameter(id: ID!): Boolean!
-
- setUserMetaParameterValues(userId: ID!, parameters: Object!): Boolean!
-
- #### Global configuration
-
- configureServer(configuration: ServerConfigInput!): Boolean!
-
- # Changes default navigator settings
- setDefaultNavigatorSettings( settings: NavigatorSettingsInput!): Boolean!
-
-}
-`, BuiltIn: false},
- {Name: "../schema/service.auth.graphqls", Input: `enum AuthCredentialEncryption {
- none,
- plain,
- hash
-}
-
-enum AuthStatus {
- SUCCESS,
- IN_PROGRESS,
- ERROR
-}
-
-type AuthCredentialInfo {
- id: ID!
- displayName: String!
- description: String
-
- # This field must be shown in admin panel
- admin: Boolean!
- # This field must be shown in login form
- user: Boolean!
- # This field can be used as user identifier
-
- identifying: Boolean!
- possibleValues: [String]
- encryption: AuthCredentialEncryption
-}
-
-type AuthProviderConfiguration {
- id: ID!
- displayName: String!
- disabled: Boolean!
-
- iconURL: String
- description: String
-
- # URL to external authentication service.
- # If specified then it is external auhentication provider (SSO).
- # Otherwise authLogin function must be called.
- signInLink: String
- signOutLink: String
- metadataLink: String
-}
-
-type AuthProviderCredentialsProfile {
- id: String
- label: String
- description: String
- credentialParameters: [AuthCredentialInfo!]!
-}
-
-type AuthProviderInfo {
- id: ID!
- label: String!
- icon: ID
- description: String
-
- defaultProvider: Boolean!
-
- # Configurable providers must be configured first. See configurations field.
- configurable: Boolean!
-
- # Provider configurations (applicable only if configurable=true)
- configurations: [AuthProviderConfiguration!]
-
- credentialProfiles: [AuthProviderCredentialsProfile!]!
-
- requiredFeatures: [String!]!
-}
-
-type AuthInfo {
- redirectLink: String
-
- authId: String
-
- authStatus: AuthStatus!
-
- userTokens: [UserAuthToken!]
-}
-
-type UserAuthToken {
- # Auth provider used for authorization
- authProvider: ID!
-
- # Auth provider configuration ID
- authConfiguration: ID
-
- # Authorization time
- loginTime: DateTime!
-
- # User identity (aka user name) specific to auth provider
- userId: String!
-
- # User display name specific to auth provider
- displayName: String!
-
- # Optional login message
- message: String
-
- # Auth origin
- origin: ObjectOrigin!
-
-}
-
-type UserInfo {
- # User unique identifier
- userId: ID!
-
- # Human readable display name. It is taken from the first auth provider which was used for user login.
- displayName: String
- # User auth role ID. Optional.
- authRole: ID
-
- # All authentication tokens used during current session
- authTokens: [UserAuthToken!]!
-
- linkedAuthProviders: [String!]!
-
- # User profile properties map
- metaParameters: Object!
- # User configuration parameters
- configurationParameters: Object!
-
-}
-
-
-extend type Query {
-
- # Authorize user using specified auth provider. If linkUser=true then associates new
- authLogin(provider: ID!, configuration: ID, credentials: Object, linkUser: Boolean): AuthInfo!
-
- authUpdateStatus(authId: ID!, linkUser: Boolean): AuthInfo!
-
- # Logouts user. If provider not specified then all authorizations are revoked from session.
- authLogout(provider: ID, configuration: ID): Boolean
-
- # Active user information. null is no user was authorized within session
- activeUser: UserInfo
-
- authProviders: [AuthProviderInfo!]!
-
- authChangeLocalPassword(oldPassword: String!, newPassword: String!): Boolean!
-
- listUserProfileProperties: [ObjectPropertyInfo!]!
-
-}
-
-extend type Mutation {
-
- # Set user config parameter. If parameter value is null then removes the parameter
- setUserConfigurationParameter(name: String!, value: Object): Boolean!
-
-}
-`, BuiltIn: false},
- {Name: "../schema/service.core.graphqls", Input: `
-####################################################
-# General stuff
-####################################################
-
-# Property
-
-type ObjectPropertyInfo {
- # ID
- id: String
- # Human readable name
- displayName: String
- # Property description
- description: String
- # Property category (may be used if object has a lot of properties)
- category: String
- # Property data type (int, String, etc)
- dataType: String
-
- # Property value. Note: for some properties value reading may take a lot of time (e.g. RowCount for tables)
- value: Object
-
- # List of values this property can take. Makes sense only for enumerable properties
- validValues: [ Object ]
- # Default property value
- defaultValue: Object
-
- # Property value length
- length: ObjectPropertyLength!
-
- # Supported features (system, hidden, inherited, foreign, expensive, etc)
- features: [ String! ]!
- # Order position
- order: Int!
-}
-
-enum ObjectPropertyLength {
- # 1 character
- TINY,
- # 20 characters
- SHORT,
- # <= 64 characters
- MEDIUM,
- # Full line length. The default
- LONG,
- # Multi-line long text
- MULTILINE
-}
-
-# Async types
-
-type AsyncTaskInfo {
- id: String!
- name: String
- running: Boolean!
-
- status: String
- error: ServerError
-
- result: SQLExecuteInfo @deprecated # Deprecated. Use asyncSqlExecuteResults instead
- # Task result.
- # Can be some kind of identifier to obtain real result using another API function
- taskResult: Object
-}
-
-# Various server errors descriptor
-
-type ServerError {
- message: String
- errorCode: String
- errorType: String
- stackTrace: String
- causedBy: ServerError
-}
-
-type ServerMessage {
- time: String
- message: String
-}
-
-# Languages supported by server
-
-type ServerLanguage {
- isoCode: String!
- displayName: String
- nativeName: String
-}
-
-type WebServiceConfig {
- id: String!
- name: String!
- description: String!
- bundleVersion: String!
-}
-
-type ProductInfo {
- id: ID!
- version: String!
- name: String!
- description: String
- buildTime: String!
- releaseTime: String!
- licenseInfo: String
-
- latestVersionInfo: String
-}
-
-type ServerConfig {
- name: String!
- version: String!
- workspaceId: ID!
-
- serverURL: String!
-
- rootURI: String!
-
- hostName: String!
-
- anonymousAccessEnabled: Boolean
- authenticationEnabled: Boolean @deprecated
- supportsCustomConnections: Boolean
- supportsConnectionBrowser: Boolean
- supportsWorkspaces: Boolean
- resourceManagerEnabled: Boolean
-
- publicCredentialsSaveEnabled: Boolean
- adminCredentialsSaveEnabled: Boolean
-
- licenseRequired: Boolean!
- licenseValid: Boolean!
-
- sessionExpireTime: Int
- localHostAddress: String
-
- configurationMode: Boolean
- developmentMode: Boolean
- redirectOnFederatedAuth: Boolean
-
- enabledFeatures: [ID!]!
- enabledAuthProviders: [ID!]!
- supportedLanguages: [ ServerLanguage! ]!
- services: [ WebServiceConfig ]
- productConfiguration: Object!
- productInfo: ProductInfo!
- defaultNavigatorSettings: NavigatorSettings!
- disabledDrivers: [ID!]!
- resourceQuotas: Object!
-}
-
-type SessionInfo {
- createTime: String!
- lastAccessTime: String!
- locale: String!
-
- cacheExpired: Boolean!
-
- serverMessages: [ ServerMessage ]
- connections: [ ConnectionInfo! ]!
- actionParameters: Object
-}
-
-####################################################
-# Drivers and connections
-####################################################
-
-type DatabaseAuthModel {
- id: ID!
- displayName: String!
- description: String
- icon: String
- # checks if the auth model needs a configuration on a local file system
- requiresLocalConfiguration: Boolean
-
- properties: [ObjectPropertyInfo!]!
-}
-
-type DriverInfo {
- id: ID!
- name: String
- description: String
- icon: String
- iconBig: String
-
- # Driver provider ID
- providerId: ID
- # Driver Java class name
- driverClassName: String
- defaultHost: String
- defaultPort: String
- defaultDatabase: String
- defaultServer: String
- defaultUser: String
- sampleURL: String
- driverInfoURL: String
- driverPropertiesURL: String
- embedded: Boolean
- enabled: Boolean!
- requiresServerName: Boolean
-
- # this fields must be removed and be replaced by DriverAuthModel
- allowsEmptyPassword: Boolean @deprecated
-
- licenseRequired: Boolean
- license: String
- custom: Boolean
- # Driver score for ordering, biggest first
- promotedScore: Int
-
- # Never used?
- #connectionProperties: Object
- #defaultConnectionProperties: Object
-
- # Driver properties.
- # Note: it is expensive property and it may produce database server roundtrips.
- # Call it only when you really need it.
- # These properties are for advanced users in usually shouldn't be specified for new connections.
- driverProperties: [ObjectPropertyInfo!]!
- # Driver parameters (map name->value)
- driverParameters: Object!
-
- # Additional driver provider properties
- # These properties can be configured by user on main connection page
- # to provide important connection settings
- providerProperties: [ObjectPropertyInfo!]!
-
- # False for drivers which do not support authentication
- anonymousAccess: Boolean
-
- defaultAuthModel: ID!
- applicableAuthModels: [ID!]!
-
- applicableNetworkHandlers: [ID]!
-}
-
-enum ResultDataFormat {
- resultset,
- document,
- graph,
- timeseries
-}
-
-## Network handler config
-
-enum NetworkHandlerType {
- TUNNEL,
- PROXY,
- CONFIG
-}
-
-enum NetworkHandlerAuthType {
- PASSWORD,
- PUBLIC_KEY,
- AGENT
-}
-
-type NetworkHandlerDescriptor {
- id: ID!
- codeName: String!
- label: String!
- description: String
- secured: Boolean!
- type: NetworkHandlerType
- properties: [ObjectPropertyInfo!]!
-}
-
-type NetworkHandlerConfig {
- id: ID!
- enabled: Boolean!
- authType: NetworkHandlerAuthType!
- userName: String
- password: String
- key: String
- savePassword: Boolean!
- properties: Object!
-}
-
-# Connection instance
-type ConnectionInfo {
- id: ID!
- driverId: ID!
-
- name: String!
- description: String
-
- host: String
- port: String
- serverName: String
- databaseName: String
- url: String
-
- properties: Object
-
- template: Boolean!
- connected: Boolean!
- provided: Boolean!
- readOnly: Boolean!
- useUrl: Boolean!
- saveCredentials: Boolean!
-
- folder: ID
- nodePath: String
-
- connectTime: String
- connectionError: ServerError
- serverVersion: String
- clientVersion: String
-
- origin: ObjectOrigin!
-
- authNeeded: Boolean!
- authModel: ID
- authProperties: [ObjectPropertyInfo!]!
-
- providerProperties: Object!
- networkHandlersConfig: [NetworkHandlerConfig!]!
-
- # Supported features (provided etc)
- features: [ String! ]!
- navigatorSettings: NavigatorSettings!
- supportedDataFormats: [ ResultDataFormat! ]!
-}
-
-type ConnectionFolderInfo {
- id: ID!
- description: String
-}
-
-type NetworkEndpointInfo {
- message: String
- clientVersion: String
- serverVersion: String
-}
-
-type ObjectOrigin {
- type: ID!
- subType: ID
- displayName: String!
- icon: String
- configuration: Object
- details: [ObjectPropertyInfo!]
-}
-
-type NavigatorSettings {
- showSystemObjects: Boolean!
- showUtilityObjects: Boolean!
- showOnlyEntities: Boolean!
- mergeEntities: Boolean!
- hideFolders: Boolean!
- hideSchemas: Boolean!
- hideVirtualModel: Boolean!
-}
-
-type LogEntry {
- time: DateTime
- type: String!
- message: String
- stackTrace: String
-}
-
-####################################################
-# Input types
-####################################################
-
-input NavigatorSettingsInput {
- showSystemObjects: Boolean!
- showUtilityObjects: Boolean!
- showOnlyEntities: Boolean!
- mergeEntities: Boolean!
- hideFolders: Boolean!
- hideSchemas: Boolean!
- hideVirtualModel: Boolean!
-}
-
-input NetworkHandlerConfigInput {
- id: ID!
- enabled: Boolean
- authType: NetworkHandlerAuthType
- userName: String
- password: String
- key: String
- savePassword: Boolean
- properties: Object
-}
-
-# Configuration of particular connection. Used for new connection create. Includes auth info
-input ConnectionConfig {
- # used only for testing created connection
- connectionId: String
- name: String
- description: String
-
- # ID of template connection
- templateId: ID
- # ID of database driver
- driverId: ID
-
- # Custom connection parameters (all optional)
-
- host: String
- port: String
- serverName: String
- databaseName: String
- # Connection url jdbc:{driver}://{host}[:{port}]/[{database}]
- url: String
- # Properties
- properties: Object
-
- # Template connection
- template: Boolean
- # Read-onyl connection
- readOnly: Boolean
-
- # User credentials
-
- saveCredentials: Boolean
- authModelId: ID
- credentials: Object
-
- # Map of provider properties (name/value)
-
- providerProperties: Object
-
- # Network handlers. Map of id->property map (name/value).
-
- networkHandlersConfig: [NetworkHandlerConfigInput!]
-
- #### deprecated fields
-
- # ID of predefined datasource
- dataSourceId: ID #@deprecated
-
- # Direct user credentials
- userName: String #@deprecated
- userPassword: String #@deprecated
-
- # Folder
- folder: ID
-}
-
-####################################################
-# Main API
-####################################################
-
-extend type Query {
- # Returns server config
- serverConfig: ServerConfig!
-
- # Returns session state ( initialize if not )
- sessionState: SessionInfo!
-
- # Session permissions
- sessionPermissions: [ID]!
-
- # Get driver info
- driverList( id: ID ): [ DriverInfo! ]!
- authModels: [DatabaseAuthModel!]!
- networkHandlers: [NetworkHandlerDescriptor!]!
-
- # List of user connections.
- userConnections( id: ID ): [ ConnectionInfo! ]!
- # List of template connections.
- templateConnections: [ ConnectionInfo! ]!
-
- # List of connection folders
- connectionFolders( path: ID ): [ ConnectionFolderInfo! ]!
-
- # Return connection state
- connectionState( id: ID! ): ConnectionInfo! @deprecated
-
- # Return connection info
- connectionInfo( id: ID! ): ConnectionInfo!
-
- readSessionLog(maxEntries: Int, clearEntries: Boolean): [ LogEntry! ]!
-}
-
-extend type Mutation {
- # Initialize session
- openSession(defaultLocale: String): SessionInfo!
-
- # Destroy session
- closeSession: Boolean
-
- # Refreshes session on server and returns its state
- touchSession: Boolean
-
- # Refresh session connection list
- refreshSessionConnections: Boolean
-
- # Refreshes session on server and returns its state
- changeSessionLanguage(locale: String): Boolean
-
- # Create new custom connection. Custom connections exist only within the current session.
- createConnection( config: ConnectionConfig! ): ConnectionInfo!
-
- updateConnection( config: ConnectionConfig! ): ConnectionInfo!
-
- deleteConnection( id: ID! ): Boolean!
-
- createConnectionFromTemplate( templateId: ID!, connectionName: String ): ConnectionInfo!
-
- # Create new folder
- createConnectionFolder(parentFolderPath: ID, folderName: String! ): ConnectionFolderInfo!
-
- deleteConnectionFolder( folderPath: ID! ): Boolean!
-
- # Copies connection configuration from node
- copyConnectionFromNode( nodePath: String!, config: ConnectionConfig ): ConnectionInfo!
-
- # Test connection configuration. Returns remote server version
- testConnection( config: ConnectionConfig! ): ConnectionInfo!
-
- # Test connection configuration. Returns remote server version
- testNetworkHandler( config: NetworkHandlerConfigInput! ): NetworkEndpointInfo!
-
- # Initiate existing connection
- initConnection( id: ID!, credentials: Object, networkCredentials: [NetworkHandlerConfigInput!], saveCredentials: Boolean ): ConnectionInfo!
-
- # Disconnect from database
- closeConnection( id: ID! ): ConnectionInfo!
-
- # Changes navigator settings for connection
- setConnectionNavigatorSettings( id: ID!, settings: NavigatorSettingsInput!): ConnectionInfo!
-
- #### Generic async functions
-
- asyncTaskCancel(id: String!): Boolean
-
- asyncTaskInfo(id: String!, removeOnFinish: Boolean!): AsyncTaskInfo!
-
-
- #### Deprecated API
-
- # Create connection from template. Use createConnection instead
- openConnection( config: ConnectionConfig! ): ConnectionInfo! @deprecated
-
- # Use asyncTaskInfo instead
- asyncTaskStatus(id: String!): AsyncTaskInfo! @deprecated
-
-}
-
-`, BuiltIn: false},
- {Name: "../schema/service.data.transfer.graphqls", Input: `# Data transfer queries
-
-type DataTransferProcessorInfo {
- id: ID!
- name: String
- description: String
- fileExtension: String
- appFileExtension: String
- appName: String
- order: Int!
- icon: String
- properties: [ ObjectPropertyInfo ]
- isBinary: Boolean
- isHTML: Boolean
-}
-
-input DataTransferParameters {
- # Processor ID
- processorId: ID!
- # General settings:
- # - openNewConnection: opens new database connection for data transfer task
- settings: Object
- # Processor properties. See DataTransferProcessorInfo.properties
- processorProperties: Object!
- # Data filter settings
- filter: SQLDataFilter
-}
-
-extend type Query {
-
- # Available transfer processors
- dataTransferAvailableStreamProcessors: [ DataTransferProcessorInfo! ]!
-
- dataTransferExportDataFromContainer(
- connectionId: ID!,
- containerNodePath: ID!,
- parameters: DataTransferParameters!
- ): AsyncTaskInfo!
-
- dataTransferExportDataFromResults(
- connectionId: ID!,
- contextId: ID!,
- resultsId: ID!,
- parameters: DataTransferParameters!
- ): AsyncTaskInfo!
-
- dataTransferRemoveDataFile(dataFileId: String!): Boolean
-
-}
-`, BuiltIn: false},
- {Name: "../schema/service.metadata.graphqls", Input: `# Metadata queries
-
-extend type Query {
-
- # Get child nodes
- metadataGetNodeDDL(nodeId: ID!, options: Object): String
-
-}
-`, BuiltIn: false},
- {Name: "../schema/service.navigator.graphqls", Input: `# Nodes, objects and properties
-
-type ObjectDescriptor {
- id: Int
- displayName: String
- fullName: String
- uniqueName: String
- description: String
- value: String
-}
-
-input ObjectPropertyFilter {
- ids: [String!]
- features: [String!]
- categories: [String!]
- dataTypes: [String!]
-}
-
-type ObjectDetails {
- id: Int
- displayName: String
- description: String
- value: Object
-}
-
-type DatabaseObjectInfo {
- # Object name
- name: String
- # Description - optional
- description: String
- # Object type. Java class name in most cases
- type: String
-
- # Read object properties.
- # Optional parameter 'ids' filters properties by id. null means all properties.
- # Note: property value reading may take a lot of time so don't read all property values always
- # Examine property meta (features in particular) before reading them
- properties(filter: ObjectPropertyFilter): [ ObjectPropertyInfo ]
-
- # Optional properties
-
- ordinalPosition: Int
- fullyQualifiedName: String
- overloadedName: String
- uniqueName: String
- state: String
-
- # Features: script, scriptExtended, dataContainer, dataManipulator,
- # entity, schema, catalog
- features: [ String! ]
-
- # Supported editors: ddl, permissions, sourceDeclaration, sourceDefinition
- editors: [ String! ]
-}
-
-type NavigatorNodeInfo {
- # Node ID - generally a full path to the node from root of tree
- id: ID!
- # Node human readable name
- name: String
- #Node full name
- fullName: String
- # Node icon path
- icon: String
- # Node description
- description: String
- # Node type
- nodeType: String
- # Can this property have child nodes?
- hasChildren: Boolean
-
- # Associated object. Maybe null for non-database objects
- object: DatabaseObjectInfo
-
- # Supported features: item, container, leaf
- # canDelete, canRename
- features: [ String! ]
-
- # Object detailed info.
- # If is different than properties. It doesn't perform any expensive operation and doesn't require authentication.
- nodeDetails: [ ObjectPropertyInfo! ]
-
- folder: Boolean
- inline: Boolean
- navigable: Boolean
-}
-
-type DatabaseCatalog {
- catalog: NavigatorNodeInfo!
- schemaList: [ NavigatorNodeInfo! ]!
-}
-
-type DatabaseStructContainers {
- catalogList: [ DatabaseCatalog! ]!
- schemaList: [ NavigatorNodeInfo! ]!
- supportsCatalogChange: Boolean!
- supportsSchemaChange: Boolean!
-}
-
-####################################################
-# Main API
-####################################################
-
-extend type Query {
-
- # Get child nodes
- navNodeChildren(
- parentPath: ID!,
- offset: Int,
- limit: Int,
- onlyFolders: Boolean): [ NavigatorNodeInfo! ]!
-
- # Get child nodes
- navNodeParents(nodePath: ID!): [ NavigatorNodeInfo! ]!
-
- navNodeInfo( nodePath: ID! ): NavigatorNodeInfo!
-
- navRefreshNode( nodePath: ID! ): Boolean
-
- # contextId currently not using
- navGetStructContainers( connectionId: ID!, contextId: ID, catalog: ID ): DatabaseStructContainers!
-
-}
-
-extend type Mutation {
-
- # Rename node and returns new node name
- navRenameNode( nodePath: ID!, newName: String! ): String
-
- # Deletes nodes with specified IDs and returns number of deleted nodes
- navDeleteNodes( nodePaths: [ID!]! ): Int
-
- # Moves nodes with specified IDs to the connection folder
- navMoveNodesToFolder(nodePaths: [ID!]!, folderPath: ID!): Boolean
-
-}`, BuiltIn: false},
- {Name: "../schema/service.rm.graphqls", Input: `# Metadata queries
-
-type RMProject {
- id: String!
- name: String!
- description: String
- shared: Boolean!
-
- createTime: DateTime!
- creator: String!
-}
-
-type RMResource {
- name: String!
- folder: Boolean!
- length: Int!
-}
-
-extend type Query {
-
- # List accessible projects
- rmListProjects: [RMProject!]!
-
- # List accessible projects
- rmListResources(
- projectId: String!,
- folder: String,
- nameMask: String,
- readProperties: Boolean,
- readHistory: Boolean): [RMResource!]!
-
- # Reads resource contents as string in UTF-8
- rmReadResourceAsString(
- projectId: String!,
- resourcePath: String!): String!
-
-}
-
-extend type Mutation {
-
- rmCreateResource(
- projectId: String!,
- resourcePath: String!,
- isFolder: Boolean!): String!
-
- rmMoveResource(
- projectId: String!,
- oldResourcePath: String!,
- newResourcePath: String): String!
-
- rmDeleteResource(
- projectId: String!,
- resourcePath: String!,
- recursive: Boolean!): Boolean
-
- rmWriteResourceStringContent(
- projectId: String!,
- resourcePath: String!,
- data: String!): String!
-}`, BuiltIn: false},
- {Name: "../schema/service.sql.graphqls", Input: `####################################################
-# SQL helpers
-####################################################
-
-type SQLDialectInfo {
- name: String!
-
- dataTypes: [ String ]!
- functions: [ String ]!
- reservedWords: [ String ]!
- quoteStrings: [ [ String ] ]!
- singleLineComments: [ String ]!
- multiLineComments: [ [ String ] ]!
-
- catalogSeparator: String
- structSeparator: String
- scriptDelimiter: String
-
- supportsExplainExecutionPlan: Boolean!
-
-}
-
-type SQLCompletionProposal {
- displayString: String!
- type: String!
- score: Int
-
- replacementString: String!
- replacementOffset: Int!
- replacementLength: Int!
- cursorPosition: Int
-
- icon: String
- nodePath: String
-}
-
-####################################################
-# Data read / SQL execution
-####################################################
-
-# SQL context must be created for each SQL editor
-type SQLContextInfo {
-
- id: ID!
- connectionId: ID!
- defaultCatalog: String
- defaultSchema: String
-
-}
-
-input SQLDataFilterConstraint {
- attributePosition: Int!
- orderPosition: Int
- orderAsc: Boolean
-
- criteria: String
- operator: String
- value: Object
-}
-
-input SQLDataFilter {
- # Row offset. We use Float because offset may be bigger than 32 bit.
- offset: Float
- limit: Int
-
- constraints: [ SQLDataFilterConstraint ]
- where: String
- orderBy: String
-}
-
-type SQLResultColumn {
- position: Int!
- name: String
- label: String
- icon: String
- entityName: String
-
- dataKind: String
- typeName: String
- fullTypeName: String
- # Column value max length. We use Float because it may be bigger than 32 bit.
- maxLength: Float
- scale: Int
- precision: Int
-
- required: Boolean!
-
- readOnly: Boolean!
- readOnlyStatus: String
-
- # Operations supported for this attribute
- supportedOperations: [DataTypeLogicalOperation!]!
-}
-
-type DatabaseDocument {
- id: String
- contentType: String
- properties: Object
- data: Object
-}
-
-type SQLResultSet {
- id: ID!
- columns: [ SQLResultColumn ]
- rows: [ [ Object ] ]
-
- # True means that resultset was generated by single entity query
- # New rows can be added, old rows can be deleted
- singleEntity: Boolean!
- # server always returns hasMoreData = false
- hasMoreData: Boolean!
- # can't update data or load LOB file if hasRowIdentifier = false
- hasRowIdentifier: Boolean!
-}
-
-type SQLQueryResults {
- title: String
- updateRowCount: Float
- sourceQuery: String
-
- # Actual data format of this result
- dataFormat: ResultDataFormat
-
- resultSet: SQLResultSet
-}
-
-type SQLExecuteInfo {
-
- # Status message
- statusMessage: String
- # Execute time (ms)
- duration: Int!
- # Actual conditions applied to query
- filterText: String
- # Results
- results: [ SQLQueryResults! ]!
-}
-
-input SQLResultRow {
- data: [ Object ]!
- updateValues: Object
-}
-
-type DataTypeLogicalOperation {
- id: ID!
- expression: String!
- argumentCount: Int
-}
-
-####################################################
-# SQL Execution plan
-####################################################
-
-type SQLExecutionPlan {
- query: String!
- nodes: [SQLExecutionPlanNode!]!
-}
-
-type SQLExecutionPlanNode {
- id: ID!
- parentId: ID
-
- kind: String!
- name: String
- type: String!
- condition: String
- description: String
- properties: [ObjectPropertyInfo!]!
-}
-
-####################################################
-# SQL Generation
-####################################################
-
-type SQLQueryGenerator {
- id: String!
- label: String!
- description: String
- order: Int!
- multiObject: Boolean!
-}
-
-####################################################
-# SQL Query info
-####################################################
-type SQLScriptInfo {
- queries: [ SQLScriptQuery! ]!
-}
-
-type SQLScriptQuery {
- start: Int!
- end: Int!
-}
-####################################################
-# Query and Mutation
-####################################################
-
-extend type Query {
-
- sqlDialectInfo( connectionId: ID! ): SQLDialectInfo
-
- # Lists SQL contexts for a connection (optional) or returns the particular context info
- sqlListContexts( connectionId: ID, contextId: ID ): [ SQLContextInfo ]!
-
- sqlCompletionProposals(
- connectionId: ID!,
- contextId: ID!,
- query: String!,
- position: Int!,
- maxResults: Int,
- simpleMode: Boolean
- ): [ SQLCompletionProposal ]
-
- sqlFormatQuery(
- connectionId: ID!,
- contextId: ID!,
- query: String!
- ): String!
-
- sqlSupportedOperations(
- connectionId: ID!,
- contextId: ID!,
- resultsId: ID!,
- attributeIndex: Int!
- ): [DataTypeLogicalOperation!]!
-
- # List of all available entity query generators
- sqlEntityQueryGenerators(nodePathList: [String!]!
- ): [SQLQueryGenerator!]!
-
- # Options:
- # fullyQualifiedNames: Boolean
- # compactSQL: Boolean
- # showComments: Boolean
- # showPermissions: Boolean
- # showFullDdl: Boolean
- # excludeAutoGeneratedColumn: Boolean
- # useCustomDataFormat: Boolean
- sqlGenerateEntityQuery(
- generatorId: String!,
- options: Object!,
- nodePathList: [String!]!
- ): String!
-
- sqlParseScript(
- connectionId: ID!,
- script: String!
- ): SQLScriptInfo!
-
- sqlParseQuery(
- connectionId: ID!,
- script: String!,
- position: Int!
- ): SQLScriptQuery!
-}
-
-extend type Mutation {
- sqlContextCreate( connectionId: ID!, defaultCatalog: String, defaultSchema: String ): SQLContextInfo!
-
- sqlContextSetDefaults( connectionId: ID!, contextId: ID!, defaultCatalog: ID, defaultSchema: ID ): Boolean!
-
- sqlContextDestroy( connectionId: ID!, contextId: ID! ): Boolean!
-
- # Execute SQL and return results
- asyncSqlExecuteQuery(
- projectId: ID,
- connectionId: ID!,
- contextId: ID!,
- sql: String!,
- resultId: ID,
- filter: SQLDataFilter,
- dataFormat: ResultDataFormat, # requested data format. May be ignored by server
- readLogs: Boolean # added 23.2.1
- ): AsyncTaskInfo!
-
- # Read data from table
- asyncReadDataFromContainer(
- connectionId: ID!,
- contextId: ID!,
- containerNodePath: ID!,
- resultId: ID,
- filter: SQLDataFilter,
- dataFormat: ResultDataFormat
- ): AsyncTaskInfo!
-
- # Close results (free resources)
- sqlResultClose(connectionId: ID!, contextId: ID!, resultId: ID!): Boolean!
-
- # Update multiple cell values
- updateResultsDataBatch(
- connectionId: ID!,
- contextId: ID!,
- resultsId: ID!,
-
- updatedRows: [ SQLResultRow! ],
- deletedRows: [ SQLResultRow! ],
- addedRows: [ SQLResultRow! ],
- ): SQLExecuteInfo!
-
- # Return SQL script for cell values update
- updateResultsDataBatchScript(
- connectionId: ID!,
- contextId: ID!,
- resultsId: ID!,
-
- updatedRows: [ SQLResultRow! ],
- deletedRows: [ SQLResultRow! ],
- addedRows: [ SQLResultRow! ],
- ): String!
-
- #Return BLOB name
- readLobValue(
- connectionId: ID!,
- contextId: ID!,
- resultsId: ID!,
- lobColumnIndex: Int!,
- row: [ SQLResultRow! ]!
- ): String!
-
- # Returns SQLExecuteInfo
- asyncSqlExecuteResults(taskId: ID!): SQLExecuteInfo !
-
- # Read data from table
- asyncSqlExplainExecutionPlan(
- connectionId: ID!,
- contextId: ID!,
- query: String!,
- configuration: Object!
- ): AsyncTaskInfo!
-
- # Returns SQLExecutionPlan
- asyncSqlExplainExecutionPlanResult(taskId: ID!): SQLExecutionPlan !
-
-}
-`, BuiltIn: false},
-}
-var parsedSchema = gqlparser.MustLoadSchema(sources...)
-
-// endregion ************************** generated!.gotpl **************************
-
-// region ***************************** args.gotpl *****************************
-
-func (ec *executionContext) field_DatabaseObjectInfo_properties_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 *model.ObjectPropertyFilter
- if tmp, ok := rawArgs["filter"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("filter"))
- arg0, err = ec.unmarshalOObjectPropertyFilter2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyFilter(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["filter"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_asyncReadDataFromContainer_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["contextId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contextId"))
- arg1, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["contextId"] = arg1
- var arg2 string
- if tmp, ok := rawArgs["containerNodePath"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("containerNodePath"))
- arg2, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["containerNodePath"] = arg2
- var arg3 *string
- if tmp, ok := rawArgs["resultId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("resultId"))
- arg3, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["resultId"] = arg3
- var arg4 *model.SQLDataFilter
- if tmp, ok := rawArgs["filter"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("filter"))
- arg4, err = ec.unmarshalOSQLDataFilter2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLDataFilter(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["filter"] = arg4
- var arg5 *model.ResultDataFormat
- if tmp, ok := rawArgs["dataFormat"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dataFormat"))
- arg5, err = ec.unmarshalOResultDataFormat2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐResultDataFormat(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["dataFormat"] = arg5
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_asyncSqlExecuteQuery_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 *string
- if tmp, ok := rawArgs["projectId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("projectId"))
- arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["projectId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg1, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg1
- var arg2 string
- if tmp, ok := rawArgs["contextId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contextId"))
- arg2, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["contextId"] = arg2
- var arg3 string
- if tmp, ok := rawArgs["sql"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sql"))
- arg3, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["sql"] = arg3
- var arg4 *string
- if tmp, ok := rawArgs["resultId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("resultId"))
- arg4, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["resultId"] = arg4
- var arg5 *model.SQLDataFilter
- if tmp, ok := rawArgs["filter"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("filter"))
- arg5, err = ec.unmarshalOSQLDataFilter2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLDataFilter(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["filter"] = arg5
- var arg6 *model.ResultDataFormat
- if tmp, ok := rawArgs["dataFormat"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dataFormat"))
- arg6, err = ec.unmarshalOResultDataFormat2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐResultDataFormat(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["dataFormat"] = arg6
- var arg7 *bool
- if tmp, ok := rawArgs["readLogs"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("readLogs"))
- arg7, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["readLogs"] = arg7
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_asyncSqlExecuteResults_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["taskId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("taskId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["taskId"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_asyncSqlExplainExecutionPlanResult_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["taskId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("taskId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["taskId"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_asyncSqlExplainExecutionPlan_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["contextId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contextId"))
- arg1, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["contextId"] = arg1
- var arg2 string
- if tmp, ok := rawArgs["query"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("query"))
- arg2, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["query"] = arg2
- var arg3 interface{}
- if tmp, ok := rawArgs["configuration"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("configuration"))
- arg3, err = ec.unmarshalNObject2interface(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["configuration"] = arg3
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_asyncTaskCancel_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["id"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
- arg0, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["id"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_asyncTaskInfo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["id"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
- arg0, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["id"] = arg0
- var arg1 bool
- if tmp, ok := rawArgs["removeOnFinish"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("removeOnFinish"))
- arg1, err = ec.unmarshalNBoolean2bool(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["removeOnFinish"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_asyncTaskStatus_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["id"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
- arg0, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["id"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_changeSessionLanguage_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 *string
- if tmp, ok := rawArgs["locale"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("locale"))
- arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["locale"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_closeConnection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["id"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["id"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_copyConnectionFromNode_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["nodePath"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nodePath"))
- arg0, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["nodePath"] = arg0
- var arg1 *model.ConnectionConfig
- if tmp, ok := rawArgs["config"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("config"))
- arg1, err = ec.unmarshalOConnectionConfig2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionConfig(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["config"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_createConnectionFolder_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 *string
- if tmp, ok := rawArgs["parentFolderPath"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parentFolderPath"))
- arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["parentFolderPath"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["folderName"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("folderName"))
- arg1, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["folderName"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_createConnectionFromTemplate_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["templateId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("templateId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["templateId"] = arg0
- var arg1 *string
- if tmp, ok := rawArgs["connectionName"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionName"))
- arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionName"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_createConnection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 model.ConnectionConfig
- if tmp, ok := rawArgs["config"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("config"))
- arg0, err = ec.unmarshalNConnectionConfig2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionConfig(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["config"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_deleteConnectionFolder_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["folderPath"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("folderPath"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["folderPath"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_deleteConnection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["id"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["id"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_initConnection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["id"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["id"] = arg0
- var arg1 interface{}
- if tmp, ok := rawArgs["credentials"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("credentials"))
- arg1, err = ec.unmarshalOObject2interface(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["credentials"] = arg1
- var arg2 []*model.NetworkHandlerConfigInput
- if tmp, ok := rawArgs["networkCredentials"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("networkCredentials"))
- arg2, err = ec.unmarshalONetworkHandlerConfigInput2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerConfigInputᚄ(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["networkCredentials"] = arg2
- var arg3 *bool
- if tmp, ok := rawArgs["saveCredentials"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("saveCredentials"))
- arg3, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["saveCredentials"] = arg3
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_navDeleteNodes_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 []string
- if tmp, ok := rawArgs["nodePaths"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nodePaths"))
- arg0, err = ec.unmarshalNID2ᚕstringᚄ(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["nodePaths"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_navMoveNodesToFolder_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 []string
- if tmp, ok := rawArgs["nodePaths"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nodePaths"))
- arg0, err = ec.unmarshalNID2ᚕstringᚄ(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["nodePaths"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["folderPath"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("folderPath"))
- arg1, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["folderPath"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_navRenameNode_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["nodePath"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nodePath"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["nodePath"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["newName"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("newName"))
- arg1, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["newName"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_openConnection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 model.ConnectionConfig
- if tmp, ok := rawArgs["config"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("config"))
- arg0, err = ec.unmarshalNConnectionConfig2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionConfig(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["config"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_openSession_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 *string
- if tmp, ok := rawArgs["defaultLocale"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("defaultLocale"))
- arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["defaultLocale"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_readLobValue_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["contextId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contextId"))
- arg1, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["contextId"] = arg1
- var arg2 string
- if tmp, ok := rawArgs["resultsId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("resultsId"))
- arg2, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["resultsId"] = arg2
- var arg3 int
- if tmp, ok := rawArgs["lobColumnIndex"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lobColumnIndex"))
- arg3, err = ec.unmarshalNInt2int(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["lobColumnIndex"] = arg3
- var arg4 []*model.SQLResultRow
- if tmp, ok := rawArgs["row"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("row"))
- arg4, err = ec.unmarshalNSQLResultRow2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLResultRowᚄ(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["row"] = arg4
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_rmCreateResource_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["projectId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("projectId"))
- arg0, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["projectId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["resourcePath"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("resourcePath"))
- arg1, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["resourcePath"] = arg1
- var arg2 bool
- if tmp, ok := rawArgs["isFolder"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isFolder"))
- arg2, err = ec.unmarshalNBoolean2bool(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["isFolder"] = arg2
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_rmDeleteResource_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["projectId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("projectId"))
- arg0, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["projectId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["resourcePath"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("resourcePath"))
- arg1, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["resourcePath"] = arg1
- var arg2 bool
- if tmp, ok := rawArgs["recursive"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("recursive"))
- arg2, err = ec.unmarshalNBoolean2bool(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["recursive"] = arg2
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_rmMoveResource_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["projectId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("projectId"))
- arg0, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["projectId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["oldResourcePath"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("oldResourcePath"))
- arg1, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["oldResourcePath"] = arg1
- var arg2 *string
- if tmp, ok := rawArgs["newResourcePath"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("newResourcePath"))
- arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["newResourcePath"] = arg2
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_rmWriteResourceStringContent_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["projectId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("projectId"))
- arg0, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["projectId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["resourcePath"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("resourcePath"))
- arg1, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["resourcePath"] = arg1
- var arg2 string
- if tmp, ok := rawArgs["data"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("data"))
- arg2, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["data"] = arg2
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_setConnectionNavigatorSettings_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["id"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["id"] = arg0
- var arg1 model.NavigatorSettingsInput
- if tmp, ok := rawArgs["settings"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("settings"))
- arg1, err = ec.unmarshalNNavigatorSettingsInput2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNavigatorSettingsInput(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["settings"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_setUserConfigurationParameter_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["name"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name"))
- arg0, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["name"] = arg0
- var arg1 interface{}
- if tmp, ok := rawArgs["value"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("value"))
- arg1, err = ec.unmarshalOObject2interface(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["value"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_sqlContextCreate_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- var arg1 *string
- if tmp, ok := rawArgs["defaultCatalog"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("defaultCatalog"))
- arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["defaultCatalog"] = arg1
- var arg2 *string
- if tmp, ok := rawArgs["defaultSchema"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("defaultSchema"))
- arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["defaultSchema"] = arg2
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_sqlContextDestroy_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["contextId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contextId"))
- arg1, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["contextId"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_sqlContextSetDefaults_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["contextId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contextId"))
- arg1, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["contextId"] = arg1
- var arg2 *string
- if tmp, ok := rawArgs["defaultCatalog"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("defaultCatalog"))
- arg2, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["defaultCatalog"] = arg2
- var arg3 *string
- if tmp, ok := rawArgs["defaultSchema"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("defaultSchema"))
- arg3, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["defaultSchema"] = arg3
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_sqlResultClose_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["contextId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contextId"))
- arg1, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["contextId"] = arg1
- var arg2 string
- if tmp, ok := rawArgs["resultId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("resultId"))
- arg2, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["resultId"] = arg2
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_testConnection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 model.ConnectionConfig
- if tmp, ok := rawArgs["config"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("config"))
- arg0, err = ec.unmarshalNConnectionConfig2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionConfig(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["config"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_testNetworkHandler_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 model.NetworkHandlerConfigInput
- if tmp, ok := rawArgs["config"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("config"))
- arg0, err = ec.unmarshalNNetworkHandlerConfigInput2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerConfigInput(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["config"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_updateConnection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 model.ConnectionConfig
- if tmp, ok := rawArgs["config"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("config"))
- arg0, err = ec.unmarshalNConnectionConfig2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionConfig(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["config"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_updateResultsDataBatchScript_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["contextId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contextId"))
- arg1, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["contextId"] = arg1
- var arg2 string
- if tmp, ok := rawArgs["resultsId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("resultsId"))
- arg2, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["resultsId"] = arg2
- var arg3 []*model.SQLResultRow
- if tmp, ok := rawArgs["updatedRows"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedRows"))
- arg3, err = ec.unmarshalOSQLResultRow2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLResultRowᚄ(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["updatedRows"] = arg3
- var arg4 []*model.SQLResultRow
- if tmp, ok := rawArgs["deletedRows"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deletedRows"))
- arg4, err = ec.unmarshalOSQLResultRow2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLResultRowᚄ(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["deletedRows"] = arg4
- var arg5 []*model.SQLResultRow
- if tmp, ok := rawArgs["addedRows"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("addedRows"))
- arg5, err = ec.unmarshalOSQLResultRow2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLResultRowᚄ(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["addedRows"] = arg5
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_updateResultsDataBatch_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["contextId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contextId"))
- arg1, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["contextId"] = arg1
- var arg2 string
- if tmp, ok := rawArgs["resultsId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("resultsId"))
- arg2, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["resultsId"] = arg2
- var arg3 []*model.SQLResultRow
- if tmp, ok := rawArgs["updatedRows"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updatedRows"))
- arg3, err = ec.unmarshalOSQLResultRow2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLResultRowᚄ(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["updatedRows"] = arg3
- var arg4 []*model.SQLResultRow
- if tmp, ok := rawArgs["deletedRows"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deletedRows"))
- arg4, err = ec.unmarshalOSQLResultRow2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLResultRowᚄ(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["deletedRows"] = arg4
- var arg5 []*model.SQLResultRow
- if tmp, ok := rawArgs["addedRows"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("addedRows"))
- arg5, err = ec.unmarshalOSQLResultRow2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLResultRowᚄ(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["addedRows"] = arg5
- return args, nil
-}
-
-func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["name"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name"))
- arg0, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["name"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_allConnections_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 *string
- if tmp, ok := rawArgs["id"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
- arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["id"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_authChangeLocalPassword_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["oldPassword"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("oldPassword"))
- arg0, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["oldPassword"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["newPassword"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("newPassword"))
- arg1, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["newPassword"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Query_authLogin_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["provider"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("provider"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["provider"] = arg0
- var arg1 *string
- if tmp, ok := rawArgs["configuration"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("configuration"))
- arg1, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["configuration"] = arg1
- var arg2 interface{}
- if tmp, ok := rawArgs["credentials"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("credentials"))
- arg2, err = ec.unmarshalOObject2interface(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["credentials"] = arg2
- var arg3 *bool
- if tmp, ok := rawArgs["linkUser"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("linkUser"))
- arg3, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["linkUser"] = arg3
- return args, nil
-}
-
-func (ec *executionContext) field_Query_authLogout_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 *string
- if tmp, ok := rawArgs["provider"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("provider"))
- arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["provider"] = arg0
- var arg1 *string
- if tmp, ok := rawArgs["configuration"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("configuration"))
- arg1, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["configuration"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Query_authUpdateStatus_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["authId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("authId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["authId"] = arg0
- var arg1 *bool
- if tmp, ok := rawArgs["linkUser"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("linkUser"))
- arg1, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["linkUser"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Query_configureServer_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 model.ServerConfigInput
- if tmp, ok := rawArgs["configuration"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("configuration"))
- arg0, err = ec.unmarshalNServerConfigInput2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐServerConfigInput(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["configuration"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_connectionFolders_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 *string
- if tmp, ok := rawArgs["path"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("path"))
- arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["path"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_connectionInfo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["id"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["id"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_connectionState_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["id"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["id"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_copyConnectionConfiguration_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["nodePath"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nodePath"))
- arg0, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["nodePath"] = arg0
- var arg1 *model.ConnectionConfig
- if tmp, ok := rawArgs["config"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("config"))
- arg1, err = ec.unmarshalOConnectionConfig2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionConfig(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["config"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Query_createConnectionConfiguration_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 model.ConnectionConfig
- if tmp, ok := rawArgs["config"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("config"))
- arg0, err = ec.unmarshalNConnectionConfig2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionConfig(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["config"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_createRole_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["roleId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roleId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["roleId"] = arg0
- var arg1 *string
- if tmp, ok := rawArgs["roleName"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roleName"))
- arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["roleName"] = arg1
- var arg2 *string
- if tmp, ok := rawArgs["description"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description"))
- arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["description"] = arg2
- return args, nil
-}
-
-func (ec *executionContext) field_Query_createUser_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["userId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["userId"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_dataTransferExportDataFromContainer_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["containerNodePath"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("containerNodePath"))
- arg1, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["containerNodePath"] = arg1
- var arg2 model.DataTransferParameters
- if tmp, ok := rawArgs["parameters"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parameters"))
- arg2, err = ec.unmarshalNDataTransferParameters2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDataTransferParameters(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["parameters"] = arg2
- return args, nil
-}
-
-func (ec *executionContext) field_Query_dataTransferExportDataFromResults_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["contextId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contextId"))
- arg1, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["contextId"] = arg1
- var arg2 string
- if tmp, ok := rawArgs["resultsId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("resultsId"))
- arg2, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["resultsId"] = arg2
- var arg3 model.DataTransferParameters
- if tmp, ok := rawArgs["parameters"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parameters"))
- arg3, err = ec.unmarshalNDataTransferParameters2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDataTransferParameters(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["parameters"] = arg3
- return args, nil
-}
-
-func (ec *executionContext) field_Query_dataTransferRemoveDataFile_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["dataFileId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dataFileId"))
- arg0, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["dataFileId"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_deleteAuthProviderConfiguration_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["id"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["id"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_deleteConnectionConfiguration_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["id"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["id"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_deleteRole_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["roleId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roleId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["roleId"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_deleteUserMetaParameter_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["id"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["id"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_deleteUser_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["userId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["userId"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_driverList_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 *string
- if tmp, ok := rawArgs["id"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
- arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["id"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_enableUser_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["userId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["userId"] = arg0
- var arg1 bool
- if tmp, ok := rawArgs["enabled"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("enabled"))
- arg1, err = ec.unmarshalNBoolean2bool(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["enabled"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Query_getConnectionSubjectAccess_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 *string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_getSubjectConnectionAccess_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 *string
- if tmp, ok := rawArgs["subjectId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("subjectId"))
- arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["subjectId"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_grantUserRole_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["userId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["userId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["roleId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roleId"))
- arg1, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["roleId"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Query_listAuthProviderConfigurationParameters_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["providerId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("providerId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["providerId"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_listAuthProviderConfigurations_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 *string
- if tmp, ok := rawArgs["providerId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("providerId"))
- arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["providerId"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_listRoles_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 *string
- if tmp, ok := rawArgs["roleId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roleId"))
- arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["roleId"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_listUsers_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 *string
- if tmp, ok := rawArgs["userId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userId"))
- arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["userId"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_metadataGetNodeDDL_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["nodeId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nodeId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["nodeId"] = arg0
- var arg1 interface{}
- if tmp, ok := rawArgs["options"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("options"))
- arg1, err = ec.unmarshalOObject2interface(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["options"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Query_navGetStructContainers_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- var arg1 *string
- if tmp, ok := rawArgs["contextId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contextId"))
- arg1, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["contextId"] = arg1
- var arg2 *string
- if tmp, ok := rawArgs["catalog"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("catalog"))
- arg2, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["catalog"] = arg2
- return args, nil
-}
-
-func (ec *executionContext) field_Query_navNodeChildren_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["parentPath"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parentPath"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["parentPath"] = arg0
- var arg1 *int
- if tmp, ok := rawArgs["offset"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("offset"))
- arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["offset"] = arg1
- var arg2 *int
- if tmp, ok := rawArgs["limit"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("limit"))
- arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["limit"] = arg2
- var arg3 *bool
- if tmp, ok := rawArgs["onlyFolders"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("onlyFolders"))
- arg3, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["onlyFolders"] = arg3
- return args, nil
-}
-
-func (ec *executionContext) field_Query_navNodeInfo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["nodePath"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nodePath"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["nodePath"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_navNodeParents_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["nodePath"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nodePath"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["nodePath"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_navRefreshNode_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["nodePath"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nodePath"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["nodePath"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_readSessionLog_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 *int
- if tmp, ok := rawArgs["maxEntries"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxEntries"))
- arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["maxEntries"] = arg0
- var arg1 *bool
- if tmp, ok := rawArgs["clearEntries"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clearEntries"))
- arg1, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["clearEntries"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Query_revokeUserRole_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["userId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["userId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["roleId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roleId"))
- arg1, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["roleId"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Query_rmListResources_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["projectId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("projectId"))
- arg0, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["projectId"] = arg0
- var arg1 *string
- if tmp, ok := rawArgs["folder"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("folder"))
- arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["folder"] = arg1
- var arg2 *string
- if tmp, ok := rawArgs["nameMask"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameMask"))
- arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["nameMask"] = arg2
- var arg3 *bool
- if tmp, ok := rawArgs["readProperties"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("readProperties"))
- arg3, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["readProperties"] = arg3
- var arg4 *bool
- if tmp, ok := rawArgs["readHistory"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("readHistory"))
- arg4, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["readHistory"] = arg4
- return args, nil
-}
-
-func (ec *executionContext) field_Query_rmReadResourceAsString_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["projectId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("projectId"))
- arg0, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["projectId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["resourcePath"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("resourcePath"))
- arg1, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["resourcePath"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Query_saveAuthProviderConfiguration_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["providerId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("providerId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["providerId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["id"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
- arg1, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["id"] = arg1
- var arg2 *string
- if tmp, ok := rawArgs["displayName"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayName"))
- arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["displayName"] = arg2
- var arg3 *bool
- if tmp, ok := rawArgs["disabled"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("disabled"))
- arg3, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["disabled"] = arg3
- var arg4 *string
- if tmp, ok := rawArgs["iconURL"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("iconURL"))
- arg4, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["iconURL"] = arg4
- var arg5 *string
- if tmp, ok := rawArgs["description"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description"))
- arg5, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["description"] = arg5
- var arg6 interface{}
- if tmp, ok := rawArgs["parameters"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parameters"))
- arg6, err = ec.unmarshalOObject2interface(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["parameters"] = arg6
- return args, nil
-}
-
-func (ec *executionContext) field_Query_saveUserMetaParameter_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["id"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["id"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["displayName"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayName"))
- arg1, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["displayName"] = arg1
- var arg2 *string
- if tmp, ok := rawArgs["description"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description"))
- arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["description"] = arg2
- var arg3 bool
- if tmp, ok := rawArgs["required"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("required"))
- arg3, err = ec.unmarshalNBoolean2bool(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["required"] = arg3
- return args, nil
-}
-
-func (ec *executionContext) field_Query_searchConnections_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 []string
- if tmp, ok := rawArgs["hostNames"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hostNames"))
- arg0, err = ec.unmarshalNString2ᚕstringᚄ(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["hostNames"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_setConnectionSubjectAccess_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- var arg1 []string
- if tmp, ok := rawArgs["subjects"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("subjects"))
- arg1, err = ec.unmarshalNID2ᚕstringᚄ(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["subjects"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Query_setDefaultNavigatorSettings_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 model.NavigatorSettingsInput
- if tmp, ok := rawArgs["settings"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("settings"))
- arg0, err = ec.unmarshalNNavigatorSettingsInput2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNavigatorSettingsInput(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["settings"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_setSubjectConnectionAccess_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["subjectId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("subjectId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["subjectId"] = arg0
- var arg1 []string
- if tmp, ok := rawArgs["connections"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connections"))
- arg1, err = ec.unmarshalNID2ᚕstringᚄ(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connections"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Query_setSubjectPermissions_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["roleId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roleId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["roleId"] = arg0
- var arg1 []string
- if tmp, ok := rawArgs["permissions"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("permissions"))
- arg1, err = ec.unmarshalNID2ᚕstringᚄ(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["permissions"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Query_setUserCredentials_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["userId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["userId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["providerId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("providerId"))
- arg1, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["providerId"] = arg1
- var arg2 interface{}
- if tmp, ok := rawArgs["credentials"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("credentials"))
- arg2, err = ec.unmarshalNObject2interface(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["credentials"] = arg2
- return args, nil
-}
-
-func (ec *executionContext) field_Query_setUserMetaParameterValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["userId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["userId"] = arg0
- var arg1 interface{}
- if tmp, ok := rawArgs["parameters"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parameters"))
- arg1, err = ec.unmarshalNObject2interface(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["parameters"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Query_sqlCompletionProposals_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["contextId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contextId"))
- arg1, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["contextId"] = arg1
- var arg2 string
- if tmp, ok := rawArgs["query"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("query"))
- arg2, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["query"] = arg2
- var arg3 int
- if tmp, ok := rawArgs["position"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("position"))
- arg3, err = ec.unmarshalNInt2int(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["position"] = arg3
- var arg4 *int
- if tmp, ok := rawArgs["maxResults"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxResults"))
- arg4, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["maxResults"] = arg4
- var arg5 *bool
- if tmp, ok := rawArgs["simpleMode"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("simpleMode"))
- arg5, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["simpleMode"] = arg5
- return args, nil
-}
-
-func (ec *executionContext) field_Query_sqlDialectInfo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_sqlEntityQueryGenerators_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 []string
- if tmp, ok := rawArgs["nodePathList"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nodePathList"))
- arg0, err = ec.unmarshalNString2ᚕstringᚄ(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["nodePathList"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Query_sqlFormatQuery_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["contextId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contextId"))
- arg1, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["contextId"] = arg1
- var arg2 string
- if tmp, ok := rawArgs["query"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("query"))
- arg2, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["query"] = arg2
- return args, nil
-}
-
-func (ec *executionContext) field_Query_sqlGenerateEntityQuery_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["generatorId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("generatorId"))
- arg0, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["generatorId"] = arg0
- var arg1 interface{}
- if tmp, ok := rawArgs["options"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("options"))
- arg1, err = ec.unmarshalNObject2interface(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["options"] = arg1
- var arg2 []string
- if tmp, ok := rawArgs["nodePathList"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nodePathList"))
- arg2, err = ec.unmarshalNString2ᚕstringᚄ(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["nodePathList"] = arg2
- return args, nil
-}
-
-func (ec *executionContext) field_Query_sqlListContexts_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 *string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- var arg1 *string
- if tmp, ok := rawArgs["contextId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contextId"))
- arg1, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["contextId"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Query_sqlParseQuery_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["script"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("script"))
- arg1, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["script"] = arg1
- var arg2 int
- if tmp, ok := rawArgs["position"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("position"))
- arg2, err = ec.unmarshalNInt2int(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["position"] = arg2
- return args, nil
-}
-
-func (ec *executionContext) field_Query_sqlParseScript_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["script"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("script"))
- arg1, err = ec.unmarshalNString2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["script"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Query_sqlSupportedOperations_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["connectionId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["connectionId"] = arg0
- var arg1 string
- if tmp, ok := rawArgs["contextId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contextId"))
- arg1, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["contextId"] = arg1
- var arg2 string
- if tmp, ok := rawArgs["resultsId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("resultsId"))
- arg2, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["resultsId"] = arg2
- var arg3 int
- if tmp, ok := rawArgs["attributeIndex"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("attributeIndex"))
- arg3, err = ec.unmarshalNInt2int(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["attributeIndex"] = arg3
- return args, nil
-}
-
-func (ec *executionContext) field_Query_updateConnectionConfiguration_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["id"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["id"] = arg0
- var arg1 model.ConnectionConfig
- if tmp, ok := rawArgs["config"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("config"))
- arg1, err = ec.unmarshalNConnectionConfig2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionConfig(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["config"] = arg1
- return args, nil
-}
-
-func (ec *executionContext) field_Query_updateRole_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 string
- if tmp, ok := rawArgs["roleId"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roleId"))
- arg0, err = ec.unmarshalNID2string(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["roleId"] = arg0
- var arg1 *string
- if tmp, ok := rawArgs["roleName"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roleName"))
- arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["roleName"] = arg1
- var arg2 *string
- if tmp, ok := rawArgs["description"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description"))
- arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["description"] = arg2
- return args, nil
-}
-
-func (ec *executionContext) field_Query_userConnections_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 *string
- if tmp, ok := rawArgs["id"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
- arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["id"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 bool
- if tmp, ok := rawArgs["includeDeprecated"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated"))
- arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["includeDeprecated"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 bool
- if tmp, ok := rawArgs["includeDeprecated"]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated"))
- arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["includeDeprecated"] = arg0
- return args, nil
-}
-
-// endregion ***************************** args.gotpl *****************************
-
-// region ************************** directives.gotpl **************************
-
-// endregion ************************** directives.gotpl **************************
-
-// region **************************** field.gotpl *****************************
-
-func (ec *executionContext) _AdminAuthProviderConfiguration_providerId(ctx context.Context, field graphql.CollectedField, obj *model.AdminAuthProviderConfiguration) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminAuthProviderConfiguration_providerId(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ProviderID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminAuthProviderConfiguration_providerId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminAuthProviderConfiguration",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminAuthProviderConfiguration_id(ctx context.Context, field graphql.CollectedField, obj *model.AdminAuthProviderConfiguration) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminAuthProviderConfiguration_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminAuthProviderConfiguration_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminAuthProviderConfiguration",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminAuthProviderConfiguration_displayName(ctx context.Context, field graphql.CollectedField, obj *model.AdminAuthProviderConfiguration) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminAuthProviderConfiguration_displayName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DisplayName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminAuthProviderConfiguration_displayName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminAuthProviderConfiguration",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminAuthProviderConfiguration_disabled(ctx context.Context, field graphql.CollectedField, obj *model.AdminAuthProviderConfiguration) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminAuthProviderConfiguration_disabled(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Disabled, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminAuthProviderConfiguration_disabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminAuthProviderConfiguration",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminAuthProviderConfiguration_iconURL(ctx context.Context, field graphql.CollectedField, obj *model.AdminAuthProviderConfiguration) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminAuthProviderConfiguration_iconURL(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.IconURL, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminAuthProviderConfiguration_iconURL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminAuthProviderConfiguration",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminAuthProviderConfiguration_description(ctx context.Context, field graphql.CollectedField, obj *model.AdminAuthProviderConfiguration) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminAuthProviderConfiguration_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminAuthProviderConfiguration_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminAuthProviderConfiguration",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminAuthProviderConfiguration_parameters(ctx context.Context, field graphql.CollectedField, obj *model.AdminAuthProviderConfiguration) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminAuthProviderConfiguration_parameters(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Parameters, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(interface{})
- fc.Result = res
- return ec.marshalNObject2interface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminAuthProviderConfiguration_parameters(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminAuthProviderConfiguration",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminAuthProviderConfiguration_signInLink(ctx context.Context, field graphql.CollectedField, obj *model.AdminAuthProviderConfiguration) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminAuthProviderConfiguration_signInLink(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SignInLink, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminAuthProviderConfiguration_signInLink(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminAuthProviderConfiguration",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminAuthProviderConfiguration_signOutLink(ctx context.Context, field graphql.CollectedField, obj *model.AdminAuthProviderConfiguration) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminAuthProviderConfiguration_signOutLink(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SignOutLink, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminAuthProviderConfiguration_signOutLink(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminAuthProviderConfiguration",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminAuthProviderConfiguration_redirectLink(ctx context.Context, field graphql.CollectedField, obj *model.AdminAuthProviderConfiguration) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminAuthProviderConfiguration_redirectLink(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.RedirectLink, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminAuthProviderConfiguration_redirectLink(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminAuthProviderConfiguration",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminAuthProviderConfiguration_metadataLink(ctx context.Context, field graphql.CollectedField, obj *model.AdminAuthProviderConfiguration) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminAuthProviderConfiguration_metadataLink(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.MetadataLink, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminAuthProviderConfiguration_metadataLink(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminAuthProviderConfiguration",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminConnectionGrantInfo_connectionId(ctx context.Context, field graphql.CollectedField, obj *model.AdminConnectionGrantInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminConnectionGrantInfo_connectionId(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ConnectionID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminConnectionGrantInfo_connectionId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminConnectionGrantInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminConnectionGrantInfo_dataSourceId(ctx context.Context, field graphql.CollectedField, obj *model.AdminConnectionGrantInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminConnectionGrantInfo_dataSourceId(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DataSourceID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminConnectionGrantInfo_dataSourceId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminConnectionGrantInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminConnectionGrantInfo_subjectId(ctx context.Context, field graphql.CollectedField, obj *model.AdminConnectionGrantInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminConnectionGrantInfo_subjectId(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SubjectID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminConnectionGrantInfo_subjectId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminConnectionGrantInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminConnectionGrantInfo_subjectType(ctx context.Context, field graphql.CollectedField, obj *model.AdminConnectionGrantInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminConnectionGrantInfo_subjectType(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SubjectType, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(model.AdminSubjectType)
- fc.Result = res
- return ec.marshalNAdminSubjectType2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminSubjectType(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminConnectionGrantInfo_subjectType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminConnectionGrantInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type AdminSubjectType does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminConnectionSearchInfo_displayName(ctx context.Context, field graphql.CollectedField, obj *model.AdminConnectionSearchInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminConnectionSearchInfo_displayName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DisplayName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminConnectionSearchInfo_displayName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminConnectionSearchInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminConnectionSearchInfo_host(ctx context.Context, field graphql.CollectedField, obj *model.AdminConnectionSearchInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminConnectionSearchInfo_host(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Host, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminConnectionSearchInfo_host(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminConnectionSearchInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminConnectionSearchInfo_port(ctx context.Context, field graphql.CollectedField, obj *model.AdminConnectionSearchInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminConnectionSearchInfo_port(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Port, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(int)
- fc.Result = res
- return ec.marshalNInt2int(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminConnectionSearchInfo_port(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminConnectionSearchInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminConnectionSearchInfo_possibleDrivers(ctx context.Context, field graphql.CollectedField, obj *model.AdminConnectionSearchInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminConnectionSearchInfo_possibleDrivers(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.PossibleDrivers, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]string)
- fc.Result = res
- return ec.marshalNID2ᚕstringᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminConnectionSearchInfo_possibleDrivers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminConnectionSearchInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminConnectionSearchInfo_defaultDriver(ctx context.Context, field graphql.CollectedField, obj *model.AdminConnectionSearchInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminConnectionSearchInfo_defaultDriver(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DefaultDriver, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminConnectionSearchInfo_defaultDriver(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminConnectionSearchInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminPermissionInfo_id(ctx context.Context, field graphql.CollectedField, obj *model.AdminPermissionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminPermissionInfo_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminPermissionInfo_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminPermissionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminPermissionInfo_label(ctx context.Context, field graphql.CollectedField, obj *model.AdminPermissionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminPermissionInfo_label(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Label, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminPermissionInfo_label(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminPermissionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminPermissionInfo_description(ctx context.Context, field graphql.CollectedField, obj *model.AdminPermissionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminPermissionInfo_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminPermissionInfo_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminPermissionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminPermissionInfo_provider(ctx context.Context, field graphql.CollectedField, obj *model.AdminPermissionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminPermissionInfo_provider(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Provider, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminPermissionInfo_provider(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminPermissionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminPermissionInfo_category(ctx context.Context, field graphql.CollectedField, obj *model.AdminPermissionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminPermissionInfo_category(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Category, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminPermissionInfo_category(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminPermissionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminRoleInfo_roleId(ctx context.Context, field graphql.CollectedField, obj *model.AdminRoleInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminRoleInfo_roleId(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.RoleID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminRoleInfo_roleId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminRoleInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminRoleInfo_roleName(ctx context.Context, field graphql.CollectedField, obj *model.AdminRoleInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminRoleInfo_roleName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.RoleName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminRoleInfo_roleName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminRoleInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminRoleInfo_description(ctx context.Context, field graphql.CollectedField, obj *model.AdminRoleInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminRoleInfo_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminRoleInfo_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminRoleInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminRoleInfo_grantedUsers(ctx context.Context, field graphql.CollectedField, obj *model.AdminRoleInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminRoleInfo_grantedUsers(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.GrantedUsers, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]string)
- fc.Result = res
- return ec.marshalNID2ᚕstringᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminRoleInfo_grantedUsers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminRoleInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminRoleInfo_grantedConnections(ctx context.Context, field graphql.CollectedField, obj *model.AdminRoleInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminRoleInfo_grantedConnections(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.GrantedConnections, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.AdminConnectionGrantInfo)
- fc.Result = res
- return ec.marshalNAdminConnectionGrantInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminConnectionGrantInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminRoleInfo_grantedConnections(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminRoleInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "connectionId":
- return ec.fieldContext_AdminConnectionGrantInfo_connectionId(ctx, field)
- case "dataSourceId":
- return ec.fieldContext_AdminConnectionGrantInfo_dataSourceId(ctx, field)
- case "subjectId":
- return ec.fieldContext_AdminConnectionGrantInfo_subjectId(ctx, field)
- case "subjectType":
- return ec.fieldContext_AdminConnectionGrantInfo_subjectType(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AdminConnectionGrantInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminRoleInfo_rolePermissions(ctx context.Context, field graphql.CollectedField, obj *model.AdminRoleInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminRoleInfo_rolePermissions(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.RolePermissions, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]string)
- fc.Result = res
- return ec.marshalNID2ᚕstringᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminRoleInfo_rolePermissions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminRoleInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminUserInfo_userId(ctx context.Context, field graphql.CollectedField, obj *model.AdminUserInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminUserInfo_userId(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.UserID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminUserInfo_userId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminUserInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminUserInfo_metaParameters(ctx context.Context, field graphql.CollectedField, obj *model.AdminUserInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminUserInfo_metaParameters(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.MetaParameters, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(interface{})
- fc.Result = res
- return ec.marshalNObject2interface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminUserInfo_metaParameters(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminUserInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminUserInfo_configurationParameters(ctx context.Context, field graphql.CollectedField, obj *model.AdminUserInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminUserInfo_configurationParameters(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ConfigurationParameters, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(interface{})
- fc.Result = res
- return ec.marshalNObject2interface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminUserInfo_configurationParameters(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminUserInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminUserInfo_grantedRoles(ctx context.Context, field graphql.CollectedField, obj *model.AdminUserInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminUserInfo_grantedRoles(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.GrantedRoles, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]string)
- fc.Result = res
- return ec.marshalNID2ᚕstringᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminUserInfo_grantedRoles(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminUserInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminUserInfo_grantedConnections(ctx context.Context, field graphql.CollectedField, obj *model.AdminUserInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminUserInfo_grantedConnections(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.GrantedConnections, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.AdminConnectionGrantInfo)
- fc.Result = res
- return ec.marshalNAdminConnectionGrantInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminConnectionGrantInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminUserInfo_grantedConnections(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminUserInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "connectionId":
- return ec.fieldContext_AdminConnectionGrantInfo_connectionId(ctx, field)
- case "dataSourceId":
- return ec.fieldContext_AdminConnectionGrantInfo_dataSourceId(ctx, field)
- case "subjectId":
- return ec.fieldContext_AdminConnectionGrantInfo_subjectId(ctx, field)
- case "subjectType":
- return ec.fieldContext_AdminConnectionGrantInfo_subjectType(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AdminConnectionGrantInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminUserInfo_origins(ctx context.Context, field graphql.CollectedField, obj *model.AdminUserInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminUserInfo_origins(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Origins, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.ObjectOrigin)
- fc.Result = res
- return ec.marshalNObjectOrigin2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectOriginᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminUserInfo_origins(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminUserInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "type":
- return ec.fieldContext_ObjectOrigin_type(ctx, field)
- case "subType":
- return ec.fieldContext_ObjectOrigin_subType(ctx, field)
- case "displayName":
- return ec.fieldContext_ObjectOrigin_displayName(ctx, field)
- case "icon":
- return ec.fieldContext_ObjectOrigin_icon(ctx, field)
- case "configuration":
- return ec.fieldContext_ObjectOrigin_configuration(ctx, field)
- case "details":
- return ec.fieldContext_ObjectOrigin_details(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ObjectOrigin", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminUserInfo_linkedAuthProviders(ctx context.Context, field graphql.CollectedField, obj *model.AdminUserInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminUserInfo_linkedAuthProviders(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.LinkedAuthProviders, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]string)
- fc.Result = res
- return ec.marshalNString2ᚕstringᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminUserInfo_linkedAuthProviders(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminUserInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AdminUserInfo_enabled(ctx context.Context, field graphql.CollectedField, obj *model.AdminUserInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AdminUserInfo_enabled(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Enabled, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AdminUserInfo_enabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AdminUserInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AsyncTaskInfo_id(ctx context.Context, field graphql.CollectedField, obj *model.AsyncTaskInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AsyncTaskInfo_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AsyncTaskInfo_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AsyncTaskInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AsyncTaskInfo_name(ctx context.Context, field graphql.CollectedField, obj *model.AsyncTaskInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AsyncTaskInfo_name(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Name, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AsyncTaskInfo_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AsyncTaskInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AsyncTaskInfo_running(ctx context.Context, field graphql.CollectedField, obj *model.AsyncTaskInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AsyncTaskInfo_running(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Running, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AsyncTaskInfo_running(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AsyncTaskInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AsyncTaskInfo_status(ctx context.Context, field graphql.CollectedField, obj *model.AsyncTaskInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AsyncTaskInfo_status(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Status, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AsyncTaskInfo_status(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AsyncTaskInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AsyncTaskInfo_error(ctx context.Context, field graphql.CollectedField, obj *model.AsyncTaskInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AsyncTaskInfo_error(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Error, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*model.ServerError)
- fc.Result = res
- return ec.marshalOServerError2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐServerError(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AsyncTaskInfo_error(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AsyncTaskInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "message":
- return ec.fieldContext_ServerError_message(ctx, field)
- case "errorCode":
- return ec.fieldContext_ServerError_errorCode(ctx, field)
- case "errorType":
- return ec.fieldContext_ServerError_errorType(ctx, field)
- case "stackTrace":
- return ec.fieldContext_ServerError_stackTrace(ctx, field)
- case "causedBy":
- return ec.fieldContext_ServerError_causedBy(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ServerError", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AsyncTaskInfo_result(ctx context.Context, field graphql.CollectedField, obj *model.AsyncTaskInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AsyncTaskInfo_result(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Result, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*model.SQLExecuteInfo)
- fc.Result = res
- return ec.marshalOSQLExecuteInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLExecuteInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AsyncTaskInfo_result(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AsyncTaskInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "statusMessage":
- return ec.fieldContext_SQLExecuteInfo_statusMessage(ctx, field)
- case "duration":
- return ec.fieldContext_SQLExecuteInfo_duration(ctx, field)
- case "filterText":
- return ec.fieldContext_SQLExecuteInfo_filterText(ctx, field)
- case "results":
- return ec.fieldContext_SQLExecuteInfo_results(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type SQLExecuteInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AsyncTaskInfo_taskResult(ctx context.Context, field graphql.CollectedField, obj *model.AsyncTaskInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AsyncTaskInfo_taskResult(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.TaskResult, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(interface{})
- fc.Result = res
- return ec.marshalOObject2interface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AsyncTaskInfo_taskResult(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AsyncTaskInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthCredentialInfo_id(ctx context.Context, field graphql.CollectedField, obj *model.AuthCredentialInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthCredentialInfo_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthCredentialInfo_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthCredentialInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthCredentialInfo_displayName(ctx context.Context, field graphql.CollectedField, obj *model.AuthCredentialInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthCredentialInfo_displayName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DisplayName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthCredentialInfo_displayName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthCredentialInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthCredentialInfo_description(ctx context.Context, field graphql.CollectedField, obj *model.AuthCredentialInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthCredentialInfo_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthCredentialInfo_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthCredentialInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthCredentialInfo_admin(ctx context.Context, field graphql.CollectedField, obj *model.AuthCredentialInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthCredentialInfo_admin(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Admin, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthCredentialInfo_admin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthCredentialInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthCredentialInfo_user(ctx context.Context, field graphql.CollectedField, obj *model.AuthCredentialInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthCredentialInfo_user(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.User, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthCredentialInfo_user(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthCredentialInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthCredentialInfo_identifying(ctx context.Context, field graphql.CollectedField, obj *model.AuthCredentialInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthCredentialInfo_identifying(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Identifying, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthCredentialInfo_identifying(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthCredentialInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthCredentialInfo_possibleValues(ctx context.Context, field graphql.CollectedField, obj *model.AuthCredentialInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthCredentialInfo_possibleValues(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.PossibleValues, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([]*string)
- fc.Result = res
- return ec.marshalOString2ᚕᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthCredentialInfo_possibleValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthCredentialInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthCredentialInfo_encryption(ctx context.Context, field graphql.CollectedField, obj *model.AuthCredentialInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthCredentialInfo_encryption(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Encryption, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*model.AuthCredentialEncryption)
- fc.Result = res
- return ec.marshalOAuthCredentialEncryption2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthCredentialEncryption(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthCredentialInfo_encryption(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthCredentialInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type AuthCredentialEncryption does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthInfo_redirectLink(ctx context.Context, field graphql.CollectedField, obj *model.AuthInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthInfo_redirectLink(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.RedirectLink, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthInfo_redirectLink(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthInfo_authId(ctx context.Context, field graphql.CollectedField, obj *model.AuthInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthInfo_authId(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.AuthID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthInfo_authId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthInfo_authStatus(ctx context.Context, field graphql.CollectedField, obj *model.AuthInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthInfo_authStatus(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.AuthStatus, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(model.AuthStatus)
- fc.Result = res
- return ec.marshalNAuthStatus2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthStatus(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthInfo_authStatus(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type AuthStatus does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthInfo_userTokens(ctx context.Context, field graphql.CollectedField, obj *model.AuthInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthInfo_userTokens(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.UserTokens, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([]*model.UserAuthToken)
- fc.Result = res
- return ec.marshalOUserAuthToken2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐUserAuthTokenᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthInfo_userTokens(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "authProvider":
- return ec.fieldContext_UserAuthToken_authProvider(ctx, field)
- case "authConfiguration":
- return ec.fieldContext_UserAuthToken_authConfiguration(ctx, field)
- case "loginTime":
- return ec.fieldContext_UserAuthToken_loginTime(ctx, field)
- case "userId":
- return ec.fieldContext_UserAuthToken_userId(ctx, field)
- case "displayName":
- return ec.fieldContext_UserAuthToken_displayName(ctx, field)
- case "message":
- return ec.fieldContext_UserAuthToken_message(ctx, field)
- case "origin":
- return ec.fieldContext_UserAuthToken_origin(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type UserAuthToken", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderConfiguration_id(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderConfiguration) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderConfiguration_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderConfiguration_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderConfiguration",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderConfiguration_displayName(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderConfiguration) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderConfiguration_displayName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DisplayName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderConfiguration_displayName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderConfiguration",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderConfiguration_disabled(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderConfiguration) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderConfiguration_disabled(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Disabled, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderConfiguration_disabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderConfiguration",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderConfiguration_iconURL(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderConfiguration) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderConfiguration_iconURL(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.IconURL, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderConfiguration_iconURL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderConfiguration",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderConfiguration_description(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderConfiguration) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderConfiguration_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderConfiguration_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderConfiguration",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderConfiguration_signInLink(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderConfiguration) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderConfiguration_signInLink(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SignInLink, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderConfiguration_signInLink(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderConfiguration",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderConfiguration_signOutLink(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderConfiguration) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderConfiguration_signOutLink(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SignOutLink, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderConfiguration_signOutLink(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderConfiguration",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderConfiguration_metadataLink(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderConfiguration) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderConfiguration_metadataLink(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.MetadataLink, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderConfiguration_metadataLink(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderConfiguration",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderCredentialsProfile_id(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderCredentialsProfile) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderCredentialsProfile_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderCredentialsProfile_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderCredentialsProfile",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderCredentialsProfile_label(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderCredentialsProfile) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderCredentialsProfile_label(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Label, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderCredentialsProfile_label(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderCredentialsProfile",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderCredentialsProfile_description(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderCredentialsProfile) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderCredentialsProfile_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderCredentialsProfile_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderCredentialsProfile",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderCredentialsProfile_credentialParameters(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderCredentialsProfile) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderCredentialsProfile_credentialParameters(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.CredentialParameters, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.AuthCredentialInfo)
- fc.Result = res
- return ec.marshalNAuthCredentialInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthCredentialInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderCredentialsProfile_credentialParameters(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderCredentialsProfile",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_AuthCredentialInfo_id(ctx, field)
- case "displayName":
- return ec.fieldContext_AuthCredentialInfo_displayName(ctx, field)
- case "description":
- return ec.fieldContext_AuthCredentialInfo_description(ctx, field)
- case "admin":
- return ec.fieldContext_AuthCredentialInfo_admin(ctx, field)
- case "user":
- return ec.fieldContext_AuthCredentialInfo_user(ctx, field)
- case "identifying":
- return ec.fieldContext_AuthCredentialInfo_identifying(ctx, field)
- case "possibleValues":
- return ec.fieldContext_AuthCredentialInfo_possibleValues(ctx, field)
- case "encryption":
- return ec.fieldContext_AuthCredentialInfo_encryption(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AuthCredentialInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderInfo_id(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderInfo_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderInfo_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderInfo_label(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderInfo_label(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Label, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderInfo_label(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderInfo_icon(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderInfo_icon(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Icon, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOID2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderInfo_icon(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderInfo_description(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderInfo_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderInfo_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderInfo_defaultProvider(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderInfo_defaultProvider(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DefaultProvider, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderInfo_defaultProvider(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderInfo_configurable(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderInfo_configurable(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Configurable, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderInfo_configurable(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderInfo_configurations(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderInfo_configurations(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Configurations, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([]*model.AuthProviderConfiguration)
- fc.Result = res
- return ec.marshalOAuthProviderConfiguration2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthProviderConfigurationᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderInfo_configurations(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_AuthProviderConfiguration_id(ctx, field)
- case "displayName":
- return ec.fieldContext_AuthProviderConfiguration_displayName(ctx, field)
- case "disabled":
- return ec.fieldContext_AuthProviderConfiguration_disabled(ctx, field)
- case "iconURL":
- return ec.fieldContext_AuthProviderConfiguration_iconURL(ctx, field)
- case "description":
- return ec.fieldContext_AuthProviderConfiguration_description(ctx, field)
- case "signInLink":
- return ec.fieldContext_AuthProviderConfiguration_signInLink(ctx, field)
- case "signOutLink":
- return ec.fieldContext_AuthProviderConfiguration_signOutLink(ctx, field)
- case "metadataLink":
- return ec.fieldContext_AuthProviderConfiguration_metadataLink(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AuthProviderConfiguration", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderInfo_credentialProfiles(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderInfo_credentialProfiles(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.CredentialProfiles, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.AuthProviderCredentialsProfile)
- fc.Result = res
- return ec.marshalNAuthProviderCredentialsProfile2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthProviderCredentialsProfileᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderInfo_credentialProfiles(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_AuthProviderCredentialsProfile_id(ctx, field)
- case "label":
- return ec.fieldContext_AuthProviderCredentialsProfile_label(ctx, field)
- case "description":
- return ec.fieldContext_AuthProviderCredentialsProfile_description(ctx, field)
- case "credentialParameters":
- return ec.fieldContext_AuthProviderCredentialsProfile_credentialParameters(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AuthProviderCredentialsProfile", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _AuthProviderInfo_requiredFeatures(ctx context.Context, field graphql.CollectedField, obj *model.AuthProviderInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_AuthProviderInfo_requiredFeatures(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.RequiredFeatures, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]string)
- fc.Result = res
- return ec.marshalNString2ᚕstringᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_AuthProviderInfo_requiredFeatures(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "AuthProviderInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionFolderInfo_id(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionFolderInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionFolderInfo_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionFolderInfo_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionFolderInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionFolderInfo_description(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionFolderInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionFolderInfo_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionFolderInfo_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionFolderInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_id(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_driverId(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_driverId(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DriverID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_driverId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_name(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_name(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Name, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_description(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_host(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_host(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Host, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_host(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_port(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_port(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Port, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_port(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_serverName(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_serverName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ServerName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_serverName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_databaseName(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_databaseName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DatabaseName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_databaseName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_url(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_url(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.URL, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_url(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_properties(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_properties(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Properties, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(interface{})
- fc.Result = res
- return ec.marshalOObject2interface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_properties(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_template(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_template(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Template, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_template(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_connected(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_connected(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Connected, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_connected(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_provided(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_provided(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Provided, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_provided(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_readOnly(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_readOnly(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ReadOnly, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_readOnly(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_useUrl(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_useUrl(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.UseURL, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_useUrl(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_saveCredentials(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_saveCredentials(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SaveCredentials, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_saveCredentials(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_folder(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_folder(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Folder, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOID2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_folder(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_nodePath(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_nodePath(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.NodePath, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_nodePath(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_connectTime(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_connectTime(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ConnectTime, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_connectTime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_connectionError(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_connectionError(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ConnectionError, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*model.ServerError)
- fc.Result = res
- return ec.marshalOServerError2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐServerError(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_connectionError(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "message":
- return ec.fieldContext_ServerError_message(ctx, field)
- case "errorCode":
- return ec.fieldContext_ServerError_errorCode(ctx, field)
- case "errorType":
- return ec.fieldContext_ServerError_errorType(ctx, field)
- case "stackTrace":
- return ec.fieldContext_ServerError_stackTrace(ctx, field)
- case "causedBy":
- return ec.fieldContext_ServerError_causedBy(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ServerError", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_serverVersion(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_serverVersion(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ServerVersion, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_serverVersion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_clientVersion(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_clientVersion(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ClientVersion, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_clientVersion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_origin(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_origin(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Origin, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.ObjectOrigin)
- fc.Result = res
- return ec.marshalNObjectOrigin2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectOrigin(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_origin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "type":
- return ec.fieldContext_ObjectOrigin_type(ctx, field)
- case "subType":
- return ec.fieldContext_ObjectOrigin_subType(ctx, field)
- case "displayName":
- return ec.fieldContext_ObjectOrigin_displayName(ctx, field)
- case "icon":
- return ec.fieldContext_ObjectOrigin_icon(ctx, field)
- case "configuration":
- return ec.fieldContext_ObjectOrigin_configuration(ctx, field)
- case "details":
- return ec.fieldContext_ObjectOrigin_details(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ObjectOrigin", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_authNeeded(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_authNeeded(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.AuthNeeded, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_authNeeded(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_authModel(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_authModel(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.AuthModel, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOID2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_authModel(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_authProperties(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_authProperties(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.AuthProperties, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.ObjectPropertyInfo)
- fc.Result = res
- return ec.marshalNObjectPropertyInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_authProperties(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ObjectPropertyInfo_id(ctx, field)
- case "displayName":
- return ec.fieldContext_ObjectPropertyInfo_displayName(ctx, field)
- case "description":
- return ec.fieldContext_ObjectPropertyInfo_description(ctx, field)
- case "category":
- return ec.fieldContext_ObjectPropertyInfo_category(ctx, field)
- case "dataType":
- return ec.fieldContext_ObjectPropertyInfo_dataType(ctx, field)
- case "value":
- return ec.fieldContext_ObjectPropertyInfo_value(ctx, field)
- case "validValues":
- return ec.fieldContext_ObjectPropertyInfo_validValues(ctx, field)
- case "defaultValue":
- return ec.fieldContext_ObjectPropertyInfo_defaultValue(ctx, field)
- case "length":
- return ec.fieldContext_ObjectPropertyInfo_length(ctx, field)
- case "features":
- return ec.fieldContext_ObjectPropertyInfo_features(ctx, field)
- case "order":
- return ec.fieldContext_ObjectPropertyInfo_order(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ObjectPropertyInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_providerProperties(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_providerProperties(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ProviderProperties, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(interface{})
- fc.Result = res
- return ec.marshalNObject2interface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_providerProperties(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_networkHandlersConfig(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_networkHandlersConfig(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.NetworkHandlersConfig, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.NetworkHandlerConfig)
- fc.Result = res
- return ec.marshalNNetworkHandlerConfig2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerConfigᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_networkHandlersConfig(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_NetworkHandlerConfig_id(ctx, field)
- case "enabled":
- return ec.fieldContext_NetworkHandlerConfig_enabled(ctx, field)
- case "authType":
- return ec.fieldContext_NetworkHandlerConfig_authType(ctx, field)
- case "userName":
- return ec.fieldContext_NetworkHandlerConfig_userName(ctx, field)
- case "password":
- return ec.fieldContext_NetworkHandlerConfig_password(ctx, field)
- case "key":
- return ec.fieldContext_NetworkHandlerConfig_key(ctx, field)
- case "savePassword":
- return ec.fieldContext_NetworkHandlerConfig_savePassword(ctx, field)
- case "properties":
- return ec.fieldContext_NetworkHandlerConfig_properties(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type NetworkHandlerConfig", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_features(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_features(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Features, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]string)
- fc.Result = res
- return ec.marshalNString2ᚕstringᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_features(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_navigatorSettings(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_navigatorSettings(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.NavigatorSettings, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.NavigatorSettings)
- fc.Result = res
- return ec.marshalNNavigatorSettings2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNavigatorSettings(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_navigatorSettings(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "showSystemObjects":
- return ec.fieldContext_NavigatorSettings_showSystemObjects(ctx, field)
- case "showUtilityObjects":
- return ec.fieldContext_NavigatorSettings_showUtilityObjects(ctx, field)
- case "showOnlyEntities":
- return ec.fieldContext_NavigatorSettings_showOnlyEntities(ctx, field)
- case "mergeEntities":
- return ec.fieldContext_NavigatorSettings_mergeEntities(ctx, field)
- case "hideFolders":
- return ec.fieldContext_NavigatorSettings_hideFolders(ctx, field)
- case "hideSchemas":
- return ec.fieldContext_NavigatorSettings_hideSchemas(ctx, field)
- case "hideVirtualModel":
- return ec.fieldContext_NavigatorSettings_hideVirtualModel(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type NavigatorSettings", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ConnectionInfo_supportedDataFormats(ctx context.Context, field graphql.CollectedField, obj *model.ConnectionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ConnectionInfo_supportedDataFormats(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SupportedDataFormats, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]model.ResultDataFormat)
- fc.Result = res
- return ec.marshalNResultDataFormat2ᚕgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐResultDataFormatᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ConnectionInfo_supportedDataFormats(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ConnectionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ResultDataFormat does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DataTransferProcessorInfo_id(ctx context.Context, field graphql.CollectedField, obj *model.DataTransferProcessorInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DataTransferProcessorInfo_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DataTransferProcessorInfo_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DataTransferProcessorInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DataTransferProcessorInfo_name(ctx context.Context, field graphql.CollectedField, obj *model.DataTransferProcessorInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DataTransferProcessorInfo_name(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Name, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DataTransferProcessorInfo_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DataTransferProcessorInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DataTransferProcessorInfo_description(ctx context.Context, field graphql.CollectedField, obj *model.DataTransferProcessorInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DataTransferProcessorInfo_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DataTransferProcessorInfo_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DataTransferProcessorInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DataTransferProcessorInfo_fileExtension(ctx context.Context, field graphql.CollectedField, obj *model.DataTransferProcessorInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DataTransferProcessorInfo_fileExtension(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.FileExtension, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DataTransferProcessorInfo_fileExtension(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DataTransferProcessorInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DataTransferProcessorInfo_appFileExtension(ctx context.Context, field graphql.CollectedField, obj *model.DataTransferProcessorInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DataTransferProcessorInfo_appFileExtension(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.AppFileExtension, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DataTransferProcessorInfo_appFileExtension(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DataTransferProcessorInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DataTransferProcessorInfo_appName(ctx context.Context, field graphql.CollectedField, obj *model.DataTransferProcessorInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DataTransferProcessorInfo_appName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.AppName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DataTransferProcessorInfo_appName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DataTransferProcessorInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DataTransferProcessorInfo_order(ctx context.Context, field graphql.CollectedField, obj *model.DataTransferProcessorInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DataTransferProcessorInfo_order(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Order, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(int)
- fc.Result = res
- return ec.marshalNInt2int(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DataTransferProcessorInfo_order(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DataTransferProcessorInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DataTransferProcessorInfo_icon(ctx context.Context, field graphql.CollectedField, obj *model.DataTransferProcessorInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DataTransferProcessorInfo_icon(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Icon, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DataTransferProcessorInfo_icon(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DataTransferProcessorInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DataTransferProcessorInfo_properties(ctx context.Context, field graphql.CollectedField, obj *model.DataTransferProcessorInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DataTransferProcessorInfo_properties(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Properties, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([]*model.ObjectPropertyInfo)
- fc.Result = res
- return ec.marshalOObjectPropertyInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DataTransferProcessorInfo_properties(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DataTransferProcessorInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ObjectPropertyInfo_id(ctx, field)
- case "displayName":
- return ec.fieldContext_ObjectPropertyInfo_displayName(ctx, field)
- case "description":
- return ec.fieldContext_ObjectPropertyInfo_description(ctx, field)
- case "category":
- return ec.fieldContext_ObjectPropertyInfo_category(ctx, field)
- case "dataType":
- return ec.fieldContext_ObjectPropertyInfo_dataType(ctx, field)
- case "value":
- return ec.fieldContext_ObjectPropertyInfo_value(ctx, field)
- case "validValues":
- return ec.fieldContext_ObjectPropertyInfo_validValues(ctx, field)
- case "defaultValue":
- return ec.fieldContext_ObjectPropertyInfo_defaultValue(ctx, field)
- case "length":
- return ec.fieldContext_ObjectPropertyInfo_length(ctx, field)
- case "features":
- return ec.fieldContext_ObjectPropertyInfo_features(ctx, field)
- case "order":
- return ec.fieldContext_ObjectPropertyInfo_order(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ObjectPropertyInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DataTransferProcessorInfo_isBinary(ctx context.Context, field graphql.CollectedField, obj *model.DataTransferProcessorInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DataTransferProcessorInfo_isBinary(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.IsBinary, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DataTransferProcessorInfo_isBinary(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DataTransferProcessorInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DataTransferProcessorInfo_isHTML(ctx context.Context, field graphql.CollectedField, obj *model.DataTransferProcessorInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DataTransferProcessorInfo_isHTML(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.IsHTML, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DataTransferProcessorInfo_isHTML(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DataTransferProcessorInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DataTypeLogicalOperation_id(ctx context.Context, field graphql.CollectedField, obj *model.DataTypeLogicalOperation) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DataTypeLogicalOperation_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DataTypeLogicalOperation_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DataTypeLogicalOperation",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DataTypeLogicalOperation_expression(ctx context.Context, field graphql.CollectedField, obj *model.DataTypeLogicalOperation) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DataTypeLogicalOperation_expression(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Expression, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DataTypeLogicalOperation_expression(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DataTypeLogicalOperation",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DataTypeLogicalOperation_argumentCount(ctx context.Context, field graphql.CollectedField, obj *model.DataTypeLogicalOperation) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DataTypeLogicalOperation_argumentCount(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ArgumentCount, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*int)
- fc.Result = res
- return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DataTypeLogicalOperation_argumentCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DataTypeLogicalOperation",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseAuthModel_id(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseAuthModel) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseAuthModel_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseAuthModel_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseAuthModel",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseAuthModel_displayName(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseAuthModel) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseAuthModel_displayName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DisplayName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseAuthModel_displayName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseAuthModel",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseAuthModel_description(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseAuthModel) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseAuthModel_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseAuthModel_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseAuthModel",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseAuthModel_icon(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseAuthModel) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseAuthModel_icon(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Icon, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseAuthModel_icon(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseAuthModel",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseAuthModel_requiresLocalConfiguration(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseAuthModel) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseAuthModel_requiresLocalConfiguration(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.RequiresLocalConfiguration, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseAuthModel_requiresLocalConfiguration(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseAuthModel",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseAuthModel_properties(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseAuthModel) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseAuthModel_properties(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Properties, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.ObjectPropertyInfo)
- fc.Result = res
- return ec.marshalNObjectPropertyInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseAuthModel_properties(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseAuthModel",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ObjectPropertyInfo_id(ctx, field)
- case "displayName":
- return ec.fieldContext_ObjectPropertyInfo_displayName(ctx, field)
- case "description":
- return ec.fieldContext_ObjectPropertyInfo_description(ctx, field)
- case "category":
- return ec.fieldContext_ObjectPropertyInfo_category(ctx, field)
- case "dataType":
- return ec.fieldContext_ObjectPropertyInfo_dataType(ctx, field)
- case "value":
- return ec.fieldContext_ObjectPropertyInfo_value(ctx, field)
- case "validValues":
- return ec.fieldContext_ObjectPropertyInfo_validValues(ctx, field)
- case "defaultValue":
- return ec.fieldContext_ObjectPropertyInfo_defaultValue(ctx, field)
- case "length":
- return ec.fieldContext_ObjectPropertyInfo_length(ctx, field)
- case "features":
- return ec.fieldContext_ObjectPropertyInfo_features(ctx, field)
- case "order":
- return ec.fieldContext_ObjectPropertyInfo_order(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ObjectPropertyInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseCatalog_catalog(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseCatalog) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseCatalog_catalog(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Catalog, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.NavigatorNodeInfo)
- fc.Result = res
- return ec.marshalNNavigatorNodeInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNavigatorNodeInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseCatalog_catalog(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseCatalog",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_NavigatorNodeInfo_id(ctx, field)
- case "name":
- return ec.fieldContext_NavigatorNodeInfo_name(ctx, field)
- case "fullName":
- return ec.fieldContext_NavigatorNodeInfo_fullName(ctx, field)
- case "icon":
- return ec.fieldContext_NavigatorNodeInfo_icon(ctx, field)
- case "description":
- return ec.fieldContext_NavigatorNodeInfo_description(ctx, field)
- case "nodeType":
- return ec.fieldContext_NavigatorNodeInfo_nodeType(ctx, field)
- case "hasChildren":
- return ec.fieldContext_NavigatorNodeInfo_hasChildren(ctx, field)
- case "object":
- return ec.fieldContext_NavigatorNodeInfo_object(ctx, field)
- case "features":
- return ec.fieldContext_NavigatorNodeInfo_features(ctx, field)
- case "nodeDetails":
- return ec.fieldContext_NavigatorNodeInfo_nodeDetails(ctx, field)
- case "folder":
- return ec.fieldContext_NavigatorNodeInfo_folder(ctx, field)
- case "inline":
- return ec.fieldContext_NavigatorNodeInfo_inline(ctx, field)
- case "navigable":
- return ec.fieldContext_NavigatorNodeInfo_navigable(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type NavigatorNodeInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseCatalog_schemaList(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseCatalog) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseCatalog_schemaList(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SchemaList, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.NavigatorNodeInfo)
- fc.Result = res
- return ec.marshalNNavigatorNodeInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNavigatorNodeInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseCatalog_schemaList(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseCatalog",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_NavigatorNodeInfo_id(ctx, field)
- case "name":
- return ec.fieldContext_NavigatorNodeInfo_name(ctx, field)
- case "fullName":
- return ec.fieldContext_NavigatorNodeInfo_fullName(ctx, field)
- case "icon":
- return ec.fieldContext_NavigatorNodeInfo_icon(ctx, field)
- case "description":
- return ec.fieldContext_NavigatorNodeInfo_description(ctx, field)
- case "nodeType":
- return ec.fieldContext_NavigatorNodeInfo_nodeType(ctx, field)
- case "hasChildren":
- return ec.fieldContext_NavigatorNodeInfo_hasChildren(ctx, field)
- case "object":
- return ec.fieldContext_NavigatorNodeInfo_object(ctx, field)
- case "features":
- return ec.fieldContext_NavigatorNodeInfo_features(ctx, field)
- case "nodeDetails":
- return ec.fieldContext_NavigatorNodeInfo_nodeDetails(ctx, field)
- case "folder":
- return ec.fieldContext_NavigatorNodeInfo_folder(ctx, field)
- case "inline":
- return ec.fieldContext_NavigatorNodeInfo_inline(ctx, field)
- case "navigable":
- return ec.fieldContext_NavigatorNodeInfo_navigable(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type NavigatorNodeInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseDocument_id(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseDocument) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseDocument_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseDocument_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseDocument",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseDocument_contentType(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseDocument) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseDocument_contentType(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ContentType, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseDocument_contentType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseDocument",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseDocument_properties(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseDocument) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseDocument_properties(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Properties, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(interface{})
- fc.Result = res
- return ec.marshalOObject2interface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseDocument_properties(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseDocument",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseDocument_data(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseDocument) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseDocument_data(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Data, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(interface{})
- fc.Result = res
- return ec.marshalOObject2interface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseDocument_data(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseDocument",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseObjectInfo_name(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseObjectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseObjectInfo_name(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Name, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseObjectInfo_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseObjectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseObjectInfo_description(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseObjectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseObjectInfo_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseObjectInfo_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseObjectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseObjectInfo_type(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseObjectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseObjectInfo_type(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Type, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseObjectInfo_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseObjectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseObjectInfo_properties(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseObjectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseObjectInfo_properties(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Properties, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([]*model.ObjectPropertyInfo)
- fc.Result = res
- return ec.marshalOObjectPropertyInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseObjectInfo_properties(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseObjectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ObjectPropertyInfo_id(ctx, field)
- case "displayName":
- return ec.fieldContext_ObjectPropertyInfo_displayName(ctx, field)
- case "description":
- return ec.fieldContext_ObjectPropertyInfo_description(ctx, field)
- case "category":
- return ec.fieldContext_ObjectPropertyInfo_category(ctx, field)
- case "dataType":
- return ec.fieldContext_ObjectPropertyInfo_dataType(ctx, field)
- case "value":
- return ec.fieldContext_ObjectPropertyInfo_value(ctx, field)
- case "validValues":
- return ec.fieldContext_ObjectPropertyInfo_validValues(ctx, field)
- case "defaultValue":
- return ec.fieldContext_ObjectPropertyInfo_defaultValue(ctx, field)
- case "length":
- return ec.fieldContext_ObjectPropertyInfo_length(ctx, field)
- case "features":
- return ec.fieldContext_ObjectPropertyInfo_features(ctx, field)
- case "order":
- return ec.fieldContext_ObjectPropertyInfo_order(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ObjectPropertyInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_DatabaseObjectInfo_properties_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseObjectInfo_ordinalPosition(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseObjectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseObjectInfo_ordinalPosition(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.OrdinalPosition, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*int)
- fc.Result = res
- return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseObjectInfo_ordinalPosition(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseObjectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseObjectInfo_fullyQualifiedName(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseObjectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseObjectInfo_fullyQualifiedName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.FullyQualifiedName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseObjectInfo_fullyQualifiedName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseObjectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseObjectInfo_overloadedName(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseObjectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseObjectInfo_overloadedName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.OverloadedName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseObjectInfo_overloadedName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseObjectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseObjectInfo_uniqueName(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseObjectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseObjectInfo_uniqueName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.UniqueName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseObjectInfo_uniqueName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseObjectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseObjectInfo_state(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseObjectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseObjectInfo_state(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.State, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseObjectInfo_state(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseObjectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseObjectInfo_features(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseObjectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseObjectInfo_features(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Features, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([]string)
- fc.Result = res
- return ec.marshalOString2ᚕstringᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseObjectInfo_features(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseObjectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseObjectInfo_editors(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseObjectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseObjectInfo_editors(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Editors, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([]string)
- fc.Result = res
- return ec.marshalOString2ᚕstringᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseObjectInfo_editors(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseObjectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseStructContainers_catalogList(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseStructContainers) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseStructContainers_catalogList(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.CatalogList, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.DatabaseCatalog)
- fc.Result = res
- return ec.marshalNDatabaseCatalog2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDatabaseCatalogᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseStructContainers_catalogList(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseStructContainers",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "catalog":
- return ec.fieldContext_DatabaseCatalog_catalog(ctx, field)
- case "schemaList":
- return ec.fieldContext_DatabaseCatalog_schemaList(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type DatabaseCatalog", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseStructContainers_schemaList(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseStructContainers) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseStructContainers_schemaList(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SchemaList, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.NavigatorNodeInfo)
- fc.Result = res
- return ec.marshalNNavigatorNodeInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNavigatorNodeInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseStructContainers_schemaList(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseStructContainers",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_NavigatorNodeInfo_id(ctx, field)
- case "name":
- return ec.fieldContext_NavigatorNodeInfo_name(ctx, field)
- case "fullName":
- return ec.fieldContext_NavigatorNodeInfo_fullName(ctx, field)
- case "icon":
- return ec.fieldContext_NavigatorNodeInfo_icon(ctx, field)
- case "description":
- return ec.fieldContext_NavigatorNodeInfo_description(ctx, field)
- case "nodeType":
- return ec.fieldContext_NavigatorNodeInfo_nodeType(ctx, field)
- case "hasChildren":
- return ec.fieldContext_NavigatorNodeInfo_hasChildren(ctx, field)
- case "object":
- return ec.fieldContext_NavigatorNodeInfo_object(ctx, field)
- case "features":
- return ec.fieldContext_NavigatorNodeInfo_features(ctx, field)
- case "nodeDetails":
- return ec.fieldContext_NavigatorNodeInfo_nodeDetails(ctx, field)
- case "folder":
- return ec.fieldContext_NavigatorNodeInfo_folder(ctx, field)
- case "inline":
- return ec.fieldContext_NavigatorNodeInfo_inline(ctx, field)
- case "navigable":
- return ec.fieldContext_NavigatorNodeInfo_navigable(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type NavigatorNodeInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseStructContainers_supportsCatalogChange(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseStructContainers) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseStructContainers_supportsCatalogChange(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SupportsCatalogChange, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseStructContainers_supportsCatalogChange(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseStructContainers",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DatabaseStructContainers_supportsSchemaChange(ctx context.Context, field graphql.CollectedField, obj *model.DatabaseStructContainers) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DatabaseStructContainers_supportsSchemaChange(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SupportsSchemaChange, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DatabaseStructContainers_supportsSchemaChange(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DatabaseStructContainers",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_id(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_name(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_name(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Name, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_description(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_icon(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_icon(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Icon, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_icon(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_iconBig(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_iconBig(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.IconBig, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_iconBig(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_providerId(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_providerId(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ProviderID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOID2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_providerId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_driverClassName(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_driverClassName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DriverClassName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_driverClassName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_defaultHost(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_defaultHost(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DefaultHost, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_defaultHost(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_defaultPort(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_defaultPort(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DefaultPort, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_defaultPort(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_defaultDatabase(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_defaultDatabase(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DefaultDatabase, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_defaultDatabase(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_defaultServer(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_defaultServer(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DefaultServer, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_defaultServer(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_defaultUser(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_defaultUser(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DefaultUser, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_defaultUser(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_sampleURL(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_sampleURL(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SampleURL, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_sampleURL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_driverInfoURL(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_driverInfoURL(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DriverInfoURL, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_driverInfoURL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_driverPropertiesURL(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_driverPropertiesURL(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DriverPropertiesURL, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_driverPropertiesURL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_embedded(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_embedded(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Embedded, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_embedded(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_enabled(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_enabled(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Enabled, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_enabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_requiresServerName(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_requiresServerName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.RequiresServerName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_requiresServerName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_allowsEmptyPassword(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_allowsEmptyPassword(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.AllowsEmptyPassword, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_allowsEmptyPassword(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_licenseRequired(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_licenseRequired(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.LicenseRequired, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_licenseRequired(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_license(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_license(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.License, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_license(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_custom(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_custom(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Custom, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_custom(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_promotedScore(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_promotedScore(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.PromotedScore, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*int)
- fc.Result = res
- return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_promotedScore(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_driverProperties(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_driverProperties(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DriverProperties, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.ObjectPropertyInfo)
- fc.Result = res
- return ec.marshalNObjectPropertyInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_driverProperties(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ObjectPropertyInfo_id(ctx, field)
- case "displayName":
- return ec.fieldContext_ObjectPropertyInfo_displayName(ctx, field)
- case "description":
- return ec.fieldContext_ObjectPropertyInfo_description(ctx, field)
- case "category":
- return ec.fieldContext_ObjectPropertyInfo_category(ctx, field)
- case "dataType":
- return ec.fieldContext_ObjectPropertyInfo_dataType(ctx, field)
- case "value":
- return ec.fieldContext_ObjectPropertyInfo_value(ctx, field)
- case "validValues":
- return ec.fieldContext_ObjectPropertyInfo_validValues(ctx, field)
- case "defaultValue":
- return ec.fieldContext_ObjectPropertyInfo_defaultValue(ctx, field)
- case "length":
- return ec.fieldContext_ObjectPropertyInfo_length(ctx, field)
- case "features":
- return ec.fieldContext_ObjectPropertyInfo_features(ctx, field)
- case "order":
- return ec.fieldContext_ObjectPropertyInfo_order(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ObjectPropertyInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_driverParameters(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_driverParameters(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DriverParameters, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(interface{})
- fc.Result = res
- return ec.marshalNObject2interface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_driverParameters(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_providerProperties(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_providerProperties(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ProviderProperties, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.ObjectPropertyInfo)
- fc.Result = res
- return ec.marshalNObjectPropertyInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_providerProperties(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ObjectPropertyInfo_id(ctx, field)
- case "displayName":
- return ec.fieldContext_ObjectPropertyInfo_displayName(ctx, field)
- case "description":
- return ec.fieldContext_ObjectPropertyInfo_description(ctx, field)
- case "category":
- return ec.fieldContext_ObjectPropertyInfo_category(ctx, field)
- case "dataType":
- return ec.fieldContext_ObjectPropertyInfo_dataType(ctx, field)
- case "value":
- return ec.fieldContext_ObjectPropertyInfo_value(ctx, field)
- case "validValues":
- return ec.fieldContext_ObjectPropertyInfo_validValues(ctx, field)
- case "defaultValue":
- return ec.fieldContext_ObjectPropertyInfo_defaultValue(ctx, field)
- case "length":
- return ec.fieldContext_ObjectPropertyInfo_length(ctx, field)
- case "features":
- return ec.fieldContext_ObjectPropertyInfo_features(ctx, field)
- case "order":
- return ec.fieldContext_ObjectPropertyInfo_order(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ObjectPropertyInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_anonymousAccess(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_anonymousAccess(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.AnonymousAccess, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_anonymousAccess(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_defaultAuthModel(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_defaultAuthModel(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DefaultAuthModel, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_defaultAuthModel(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_applicableAuthModels(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_applicableAuthModels(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ApplicableAuthModels, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]string)
- fc.Result = res
- return ec.marshalNID2ᚕstringᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_applicableAuthModels(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _DriverInfo_applicableNetworkHandlers(ctx context.Context, field graphql.CollectedField, obj *model.DriverInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_DriverInfo_applicableNetworkHandlers(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ApplicableNetworkHandlers, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*string)
- fc.Result = res
- return ec.marshalNID2ᚕᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_DriverInfo_applicableNetworkHandlers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "DriverInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _LogEntry_time(ctx context.Context, field graphql.CollectedField, obj *model.LogEntry) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_LogEntry_time(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Time, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*time.Time)
- fc.Result = res
- return ec.marshalODateTime2ᚖtimeᚐTime(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_LogEntry_time(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "LogEntry",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type DateTime does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _LogEntry_type(ctx context.Context, field graphql.CollectedField, obj *model.LogEntry) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_LogEntry_type(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Type, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_LogEntry_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "LogEntry",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _LogEntry_message(ctx context.Context, field graphql.CollectedField, obj *model.LogEntry) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_LogEntry_message(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Message, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_LogEntry_message(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "LogEntry",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _LogEntry_stackTrace(ctx context.Context, field graphql.CollectedField, obj *model.LogEntry) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_LogEntry_stackTrace(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.StackTrace, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_LogEntry_stackTrace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "LogEntry",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_setUserConfigurationParameter(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_setUserConfigurationParameter(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().SetUserConfigurationParameter(rctx, fc.Args["name"].(string),
- func() interface{} {
- if fc.Args["value"] == nil {
- return nil
- }
- return fc.Args["value"].(interface{})
- }())
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_setUserConfigurationParameter(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_setUserConfigurationParameter_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_openSession(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_openSession(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().OpenSession(rctx, fc.Args["defaultLocale"].(*string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.SessionInfo)
- fc.Result = res
- return ec.marshalNSessionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSessionInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_openSession(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "createTime":
- return ec.fieldContext_SessionInfo_createTime(ctx, field)
- case "lastAccessTime":
- return ec.fieldContext_SessionInfo_lastAccessTime(ctx, field)
- case "locale":
- return ec.fieldContext_SessionInfo_locale(ctx, field)
- case "cacheExpired":
- return ec.fieldContext_SessionInfo_cacheExpired(ctx, field)
- case "serverMessages":
- return ec.fieldContext_SessionInfo_serverMessages(ctx, field)
- case "connections":
- return ec.fieldContext_SessionInfo_connections(ctx, field)
- case "actionParameters":
- return ec.fieldContext_SessionInfo_actionParameters(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type SessionInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_openSession_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_closeSession(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_closeSession(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().CloseSession(rctx)
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_closeSession(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_touchSession(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_touchSession(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().TouchSession(rctx)
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_touchSession(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_refreshSessionConnections(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_refreshSessionConnections(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().RefreshSessionConnections(rctx)
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_refreshSessionConnections(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_changeSessionLanguage(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_changeSessionLanguage(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().ChangeSessionLanguage(rctx, fc.Args["locale"].(*string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_changeSessionLanguage(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_changeSessionLanguage_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_createConnection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_createConnection(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().CreateConnection(rctx, fc.Args["config"].(model.ConnectionConfig))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.ConnectionInfo)
- fc.Result = res
- return ec.marshalNConnectionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_createConnection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ConnectionInfo_id(ctx, field)
- case "driverId":
- return ec.fieldContext_ConnectionInfo_driverId(ctx, field)
- case "name":
- return ec.fieldContext_ConnectionInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_ConnectionInfo_description(ctx, field)
- case "host":
- return ec.fieldContext_ConnectionInfo_host(ctx, field)
- case "port":
- return ec.fieldContext_ConnectionInfo_port(ctx, field)
- case "serverName":
- return ec.fieldContext_ConnectionInfo_serverName(ctx, field)
- case "databaseName":
- return ec.fieldContext_ConnectionInfo_databaseName(ctx, field)
- case "url":
- return ec.fieldContext_ConnectionInfo_url(ctx, field)
- case "properties":
- return ec.fieldContext_ConnectionInfo_properties(ctx, field)
- case "template":
- return ec.fieldContext_ConnectionInfo_template(ctx, field)
- case "connected":
- return ec.fieldContext_ConnectionInfo_connected(ctx, field)
- case "provided":
- return ec.fieldContext_ConnectionInfo_provided(ctx, field)
- case "readOnly":
- return ec.fieldContext_ConnectionInfo_readOnly(ctx, field)
- case "useUrl":
- return ec.fieldContext_ConnectionInfo_useUrl(ctx, field)
- case "saveCredentials":
- return ec.fieldContext_ConnectionInfo_saveCredentials(ctx, field)
- case "folder":
- return ec.fieldContext_ConnectionInfo_folder(ctx, field)
- case "nodePath":
- return ec.fieldContext_ConnectionInfo_nodePath(ctx, field)
- case "connectTime":
- return ec.fieldContext_ConnectionInfo_connectTime(ctx, field)
- case "connectionError":
- return ec.fieldContext_ConnectionInfo_connectionError(ctx, field)
- case "serverVersion":
- return ec.fieldContext_ConnectionInfo_serverVersion(ctx, field)
- case "clientVersion":
- return ec.fieldContext_ConnectionInfo_clientVersion(ctx, field)
- case "origin":
- return ec.fieldContext_ConnectionInfo_origin(ctx, field)
- case "authNeeded":
- return ec.fieldContext_ConnectionInfo_authNeeded(ctx, field)
- case "authModel":
- return ec.fieldContext_ConnectionInfo_authModel(ctx, field)
- case "authProperties":
- return ec.fieldContext_ConnectionInfo_authProperties(ctx, field)
- case "providerProperties":
- return ec.fieldContext_ConnectionInfo_providerProperties(ctx, field)
- case "networkHandlersConfig":
- return ec.fieldContext_ConnectionInfo_networkHandlersConfig(ctx, field)
- case "features":
- return ec.fieldContext_ConnectionInfo_features(ctx, field)
- case "navigatorSettings":
- return ec.fieldContext_ConnectionInfo_navigatorSettings(ctx, field)
- case "supportedDataFormats":
- return ec.fieldContext_ConnectionInfo_supportedDataFormats(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ConnectionInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_createConnection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_updateConnection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_updateConnection(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().UpdateConnection(rctx, fc.Args["config"].(model.ConnectionConfig))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.ConnectionInfo)
- fc.Result = res
- return ec.marshalNConnectionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_updateConnection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ConnectionInfo_id(ctx, field)
- case "driverId":
- return ec.fieldContext_ConnectionInfo_driverId(ctx, field)
- case "name":
- return ec.fieldContext_ConnectionInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_ConnectionInfo_description(ctx, field)
- case "host":
- return ec.fieldContext_ConnectionInfo_host(ctx, field)
- case "port":
- return ec.fieldContext_ConnectionInfo_port(ctx, field)
- case "serverName":
- return ec.fieldContext_ConnectionInfo_serverName(ctx, field)
- case "databaseName":
- return ec.fieldContext_ConnectionInfo_databaseName(ctx, field)
- case "url":
- return ec.fieldContext_ConnectionInfo_url(ctx, field)
- case "properties":
- return ec.fieldContext_ConnectionInfo_properties(ctx, field)
- case "template":
- return ec.fieldContext_ConnectionInfo_template(ctx, field)
- case "connected":
- return ec.fieldContext_ConnectionInfo_connected(ctx, field)
- case "provided":
- return ec.fieldContext_ConnectionInfo_provided(ctx, field)
- case "readOnly":
- return ec.fieldContext_ConnectionInfo_readOnly(ctx, field)
- case "useUrl":
- return ec.fieldContext_ConnectionInfo_useUrl(ctx, field)
- case "saveCredentials":
- return ec.fieldContext_ConnectionInfo_saveCredentials(ctx, field)
- case "folder":
- return ec.fieldContext_ConnectionInfo_folder(ctx, field)
- case "nodePath":
- return ec.fieldContext_ConnectionInfo_nodePath(ctx, field)
- case "connectTime":
- return ec.fieldContext_ConnectionInfo_connectTime(ctx, field)
- case "connectionError":
- return ec.fieldContext_ConnectionInfo_connectionError(ctx, field)
- case "serverVersion":
- return ec.fieldContext_ConnectionInfo_serverVersion(ctx, field)
- case "clientVersion":
- return ec.fieldContext_ConnectionInfo_clientVersion(ctx, field)
- case "origin":
- return ec.fieldContext_ConnectionInfo_origin(ctx, field)
- case "authNeeded":
- return ec.fieldContext_ConnectionInfo_authNeeded(ctx, field)
- case "authModel":
- return ec.fieldContext_ConnectionInfo_authModel(ctx, field)
- case "authProperties":
- return ec.fieldContext_ConnectionInfo_authProperties(ctx, field)
- case "providerProperties":
- return ec.fieldContext_ConnectionInfo_providerProperties(ctx, field)
- case "networkHandlersConfig":
- return ec.fieldContext_ConnectionInfo_networkHandlersConfig(ctx, field)
- case "features":
- return ec.fieldContext_ConnectionInfo_features(ctx, field)
- case "navigatorSettings":
- return ec.fieldContext_ConnectionInfo_navigatorSettings(ctx, field)
- case "supportedDataFormats":
- return ec.fieldContext_ConnectionInfo_supportedDataFormats(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ConnectionInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_updateConnection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_deleteConnection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_deleteConnection(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().DeleteConnection(rctx, fc.Args["id"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_deleteConnection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_deleteConnection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_createConnectionFromTemplate(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_createConnectionFromTemplate(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().CreateConnectionFromTemplate(rctx, fc.Args["templateId"].(string), fc.Args["connectionName"].(*string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.ConnectionInfo)
- fc.Result = res
- return ec.marshalNConnectionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_createConnectionFromTemplate(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ConnectionInfo_id(ctx, field)
- case "driverId":
- return ec.fieldContext_ConnectionInfo_driverId(ctx, field)
- case "name":
- return ec.fieldContext_ConnectionInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_ConnectionInfo_description(ctx, field)
- case "host":
- return ec.fieldContext_ConnectionInfo_host(ctx, field)
- case "port":
- return ec.fieldContext_ConnectionInfo_port(ctx, field)
- case "serverName":
- return ec.fieldContext_ConnectionInfo_serverName(ctx, field)
- case "databaseName":
- return ec.fieldContext_ConnectionInfo_databaseName(ctx, field)
- case "url":
- return ec.fieldContext_ConnectionInfo_url(ctx, field)
- case "properties":
- return ec.fieldContext_ConnectionInfo_properties(ctx, field)
- case "template":
- return ec.fieldContext_ConnectionInfo_template(ctx, field)
- case "connected":
- return ec.fieldContext_ConnectionInfo_connected(ctx, field)
- case "provided":
- return ec.fieldContext_ConnectionInfo_provided(ctx, field)
- case "readOnly":
- return ec.fieldContext_ConnectionInfo_readOnly(ctx, field)
- case "useUrl":
- return ec.fieldContext_ConnectionInfo_useUrl(ctx, field)
- case "saveCredentials":
- return ec.fieldContext_ConnectionInfo_saveCredentials(ctx, field)
- case "folder":
- return ec.fieldContext_ConnectionInfo_folder(ctx, field)
- case "nodePath":
- return ec.fieldContext_ConnectionInfo_nodePath(ctx, field)
- case "connectTime":
- return ec.fieldContext_ConnectionInfo_connectTime(ctx, field)
- case "connectionError":
- return ec.fieldContext_ConnectionInfo_connectionError(ctx, field)
- case "serverVersion":
- return ec.fieldContext_ConnectionInfo_serverVersion(ctx, field)
- case "clientVersion":
- return ec.fieldContext_ConnectionInfo_clientVersion(ctx, field)
- case "origin":
- return ec.fieldContext_ConnectionInfo_origin(ctx, field)
- case "authNeeded":
- return ec.fieldContext_ConnectionInfo_authNeeded(ctx, field)
- case "authModel":
- return ec.fieldContext_ConnectionInfo_authModel(ctx, field)
- case "authProperties":
- return ec.fieldContext_ConnectionInfo_authProperties(ctx, field)
- case "providerProperties":
- return ec.fieldContext_ConnectionInfo_providerProperties(ctx, field)
- case "networkHandlersConfig":
- return ec.fieldContext_ConnectionInfo_networkHandlersConfig(ctx, field)
- case "features":
- return ec.fieldContext_ConnectionInfo_features(ctx, field)
- case "navigatorSettings":
- return ec.fieldContext_ConnectionInfo_navigatorSettings(ctx, field)
- case "supportedDataFormats":
- return ec.fieldContext_ConnectionInfo_supportedDataFormats(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ConnectionInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_createConnectionFromTemplate_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_createConnectionFolder(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_createConnectionFolder(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().CreateConnectionFolder(rctx, fc.Args["parentFolderPath"].(*string), fc.Args["folderName"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.ConnectionFolderInfo)
- fc.Result = res
- return ec.marshalNConnectionFolderInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionFolderInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_createConnectionFolder(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ConnectionFolderInfo_id(ctx, field)
- case "description":
- return ec.fieldContext_ConnectionFolderInfo_description(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ConnectionFolderInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_createConnectionFolder_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_deleteConnectionFolder(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_deleteConnectionFolder(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().DeleteConnectionFolder(rctx, fc.Args["folderPath"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_deleteConnectionFolder(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_deleteConnectionFolder_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_copyConnectionFromNode(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_copyConnectionFromNode(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().CopyConnectionFromNode(rctx, fc.Args["nodePath"].(string), fc.Args["config"].(*model.ConnectionConfig))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.ConnectionInfo)
- fc.Result = res
- return ec.marshalNConnectionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_copyConnectionFromNode(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ConnectionInfo_id(ctx, field)
- case "driverId":
- return ec.fieldContext_ConnectionInfo_driverId(ctx, field)
- case "name":
- return ec.fieldContext_ConnectionInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_ConnectionInfo_description(ctx, field)
- case "host":
- return ec.fieldContext_ConnectionInfo_host(ctx, field)
- case "port":
- return ec.fieldContext_ConnectionInfo_port(ctx, field)
- case "serverName":
- return ec.fieldContext_ConnectionInfo_serverName(ctx, field)
- case "databaseName":
- return ec.fieldContext_ConnectionInfo_databaseName(ctx, field)
- case "url":
- return ec.fieldContext_ConnectionInfo_url(ctx, field)
- case "properties":
- return ec.fieldContext_ConnectionInfo_properties(ctx, field)
- case "template":
- return ec.fieldContext_ConnectionInfo_template(ctx, field)
- case "connected":
- return ec.fieldContext_ConnectionInfo_connected(ctx, field)
- case "provided":
- return ec.fieldContext_ConnectionInfo_provided(ctx, field)
- case "readOnly":
- return ec.fieldContext_ConnectionInfo_readOnly(ctx, field)
- case "useUrl":
- return ec.fieldContext_ConnectionInfo_useUrl(ctx, field)
- case "saveCredentials":
- return ec.fieldContext_ConnectionInfo_saveCredentials(ctx, field)
- case "folder":
- return ec.fieldContext_ConnectionInfo_folder(ctx, field)
- case "nodePath":
- return ec.fieldContext_ConnectionInfo_nodePath(ctx, field)
- case "connectTime":
- return ec.fieldContext_ConnectionInfo_connectTime(ctx, field)
- case "connectionError":
- return ec.fieldContext_ConnectionInfo_connectionError(ctx, field)
- case "serverVersion":
- return ec.fieldContext_ConnectionInfo_serverVersion(ctx, field)
- case "clientVersion":
- return ec.fieldContext_ConnectionInfo_clientVersion(ctx, field)
- case "origin":
- return ec.fieldContext_ConnectionInfo_origin(ctx, field)
- case "authNeeded":
- return ec.fieldContext_ConnectionInfo_authNeeded(ctx, field)
- case "authModel":
- return ec.fieldContext_ConnectionInfo_authModel(ctx, field)
- case "authProperties":
- return ec.fieldContext_ConnectionInfo_authProperties(ctx, field)
- case "providerProperties":
- return ec.fieldContext_ConnectionInfo_providerProperties(ctx, field)
- case "networkHandlersConfig":
- return ec.fieldContext_ConnectionInfo_networkHandlersConfig(ctx, field)
- case "features":
- return ec.fieldContext_ConnectionInfo_features(ctx, field)
- case "navigatorSettings":
- return ec.fieldContext_ConnectionInfo_navigatorSettings(ctx, field)
- case "supportedDataFormats":
- return ec.fieldContext_ConnectionInfo_supportedDataFormats(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ConnectionInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_copyConnectionFromNode_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_testConnection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_testConnection(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().TestConnection(rctx, fc.Args["config"].(model.ConnectionConfig))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.ConnectionInfo)
- fc.Result = res
- return ec.marshalNConnectionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_testConnection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ConnectionInfo_id(ctx, field)
- case "driverId":
- return ec.fieldContext_ConnectionInfo_driverId(ctx, field)
- case "name":
- return ec.fieldContext_ConnectionInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_ConnectionInfo_description(ctx, field)
- case "host":
- return ec.fieldContext_ConnectionInfo_host(ctx, field)
- case "port":
- return ec.fieldContext_ConnectionInfo_port(ctx, field)
- case "serverName":
- return ec.fieldContext_ConnectionInfo_serverName(ctx, field)
- case "databaseName":
- return ec.fieldContext_ConnectionInfo_databaseName(ctx, field)
- case "url":
- return ec.fieldContext_ConnectionInfo_url(ctx, field)
- case "properties":
- return ec.fieldContext_ConnectionInfo_properties(ctx, field)
- case "template":
- return ec.fieldContext_ConnectionInfo_template(ctx, field)
- case "connected":
- return ec.fieldContext_ConnectionInfo_connected(ctx, field)
- case "provided":
- return ec.fieldContext_ConnectionInfo_provided(ctx, field)
- case "readOnly":
- return ec.fieldContext_ConnectionInfo_readOnly(ctx, field)
- case "useUrl":
- return ec.fieldContext_ConnectionInfo_useUrl(ctx, field)
- case "saveCredentials":
- return ec.fieldContext_ConnectionInfo_saveCredentials(ctx, field)
- case "folder":
- return ec.fieldContext_ConnectionInfo_folder(ctx, field)
- case "nodePath":
- return ec.fieldContext_ConnectionInfo_nodePath(ctx, field)
- case "connectTime":
- return ec.fieldContext_ConnectionInfo_connectTime(ctx, field)
- case "connectionError":
- return ec.fieldContext_ConnectionInfo_connectionError(ctx, field)
- case "serverVersion":
- return ec.fieldContext_ConnectionInfo_serverVersion(ctx, field)
- case "clientVersion":
- return ec.fieldContext_ConnectionInfo_clientVersion(ctx, field)
- case "origin":
- return ec.fieldContext_ConnectionInfo_origin(ctx, field)
- case "authNeeded":
- return ec.fieldContext_ConnectionInfo_authNeeded(ctx, field)
- case "authModel":
- return ec.fieldContext_ConnectionInfo_authModel(ctx, field)
- case "authProperties":
- return ec.fieldContext_ConnectionInfo_authProperties(ctx, field)
- case "providerProperties":
- return ec.fieldContext_ConnectionInfo_providerProperties(ctx, field)
- case "networkHandlersConfig":
- return ec.fieldContext_ConnectionInfo_networkHandlersConfig(ctx, field)
- case "features":
- return ec.fieldContext_ConnectionInfo_features(ctx, field)
- case "navigatorSettings":
- return ec.fieldContext_ConnectionInfo_navigatorSettings(ctx, field)
- case "supportedDataFormats":
- return ec.fieldContext_ConnectionInfo_supportedDataFormats(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ConnectionInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_testConnection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_testNetworkHandler(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_testNetworkHandler(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().TestNetworkHandler(rctx, fc.Args["config"].(model.NetworkHandlerConfigInput))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.NetworkEndpointInfo)
- fc.Result = res
- return ec.marshalNNetworkEndpointInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkEndpointInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_testNetworkHandler(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "message":
- return ec.fieldContext_NetworkEndpointInfo_message(ctx, field)
- case "clientVersion":
- return ec.fieldContext_NetworkEndpointInfo_clientVersion(ctx, field)
- case "serverVersion":
- return ec.fieldContext_NetworkEndpointInfo_serverVersion(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type NetworkEndpointInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_testNetworkHandler_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_initConnection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_initConnection(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().InitConnection(rctx, fc.Args["id"].(string),
- func() interface{} {
- if fc.Args["credentials"] == nil {
- return nil
- }
- return fc.Args["credentials"].(interface{})
- }(), fc.Args["networkCredentials"].([]*model.NetworkHandlerConfigInput), fc.Args["saveCredentials"].(*bool))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.ConnectionInfo)
- fc.Result = res
- return ec.marshalNConnectionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_initConnection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ConnectionInfo_id(ctx, field)
- case "driverId":
- return ec.fieldContext_ConnectionInfo_driverId(ctx, field)
- case "name":
- return ec.fieldContext_ConnectionInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_ConnectionInfo_description(ctx, field)
- case "host":
- return ec.fieldContext_ConnectionInfo_host(ctx, field)
- case "port":
- return ec.fieldContext_ConnectionInfo_port(ctx, field)
- case "serverName":
- return ec.fieldContext_ConnectionInfo_serverName(ctx, field)
- case "databaseName":
- return ec.fieldContext_ConnectionInfo_databaseName(ctx, field)
- case "url":
- return ec.fieldContext_ConnectionInfo_url(ctx, field)
- case "properties":
- return ec.fieldContext_ConnectionInfo_properties(ctx, field)
- case "template":
- return ec.fieldContext_ConnectionInfo_template(ctx, field)
- case "connected":
- return ec.fieldContext_ConnectionInfo_connected(ctx, field)
- case "provided":
- return ec.fieldContext_ConnectionInfo_provided(ctx, field)
- case "readOnly":
- return ec.fieldContext_ConnectionInfo_readOnly(ctx, field)
- case "useUrl":
- return ec.fieldContext_ConnectionInfo_useUrl(ctx, field)
- case "saveCredentials":
- return ec.fieldContext_ConnectionInfo_saveCredentials(ctx, field)
- case "folder":
- return ec.fieldContext_ConnectionInfo_folder(ctx, field)
- case "nodePath":
- return ec.fieldContext_ConnectionInfo_nodePath(ctx, field)
- case "connectTime":
- return ec.fieldContext_ConnectionInfo_connectTime(ctx, field)
- case "connectionError":
- return ec.fieldContext_ConnectionInfo_connectionError(ctx, field)
- case "serverVersion":
- return ec.fieldContext_ConnectionInfo_serverVersion(ctx, field)
- case "clientVersion":
- return ec.fieldContext_ConnectionInfo_clientVersion(ctx, field)
- case "origin":
- return ec.fieldContext_ConnectionInfo_origin(ctx, field)
- case "authNeeded":
- return ec.fieldContext_ConnectionInfo_authNeeded(ctx, field)
- case "authModel":
- return ec.fieldContext_ConnectionInfo_authModel(ctx, field)
- case "authProperties":
- return ec.fieldContext_ConnectionInfo_authProperties(ctx, field)
- case "providerProperties":
- return ec.fieldContext_ConnectionInfo_providerProperties(ctx, field)
- case "networkHandlersConfig":
- return ec.fieldContext_ConnectionInfo_networkHandlersConfig(ctx, field)
- case "features":
- return ec.fieldContext_ConnectionInfo_features(ctx, field)
- case "navigatorSettings":
- return ec.fieldContext_ConnectionInfo_navigatorSettings(ctx, field)
- case "supportedDataFormats":
- return ec.fieldContext_ConnectionInfo_supportedDataFormats(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ConnectionInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_initConnection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_closeConnection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_closeConnection(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().CloseConnection(rctx, fc.Args["id"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.ConnectionInfo)
- fc.Result = res
- return ec.marshalNConnectionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_closeConnection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ConnectionInfo_id(ctx, field)
- case "driverId":
- return ec.fieldContext_ConnectionInfo_driverId(ctx, field)
- case "name":
- return ec.fieldContext_ConnectionInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_ConnectionInfo_description(ctx, field)
- case "host":
- return ec.fieldContext_ConnectionInfo_host(ctx, field)
- case "port":
- return ec.fieldContext_ConnectionInfo_port(ctx, field)
- case "serverName":
- return ec.fieldContext_ConnectionInfo_serverName(ctx, field)
- case "databaseName":
- return ec.fieldContext_ConnectionInfo_databaseName(ctx, field)
- case "url":
- return ec.fieldContext_ConnectionInfo_url(ctx, field)
- case "properties":
- return ec.fieldContext_ConnectionInfo_properties(ctx, field)
- case "template":
- return ec.fieldContext_ConnectionInfo_template(ctx, field)
- case "connected":
- return ec.fieldContext_ConnectionInfo_connected(ctx, field)
- case "provided":
- return ec.fieldContext_ConnectionInfo_provided(ctx, field)
- case "readOnly":
- return ec.fieldContext_ConnectionInfo_readOnly(ctx, field)
- case "useUrl":
- return ec.fieldContext_ConnectionInfo_useUrl(ctx, field)
- case "saveCredentials":
- return ec.fieldContext_ConnectionInfo_saveCredentials(ctx, field)
- case "folder":
- return ec.fieldContext_ConnectionInfo_folder(ctx, field)
- case "nodePath":
- return ec.fieldContext_ConnectionInfo_nodePath(ctx, field)
- case "connectTime":
- return ec.fieldContext_ConnectionInfo_connectTime(ctx, field)
- case "connectionError":
- return ec.fieldContext_ConnectionInfo_connectionError(ctx, field)
- case "serverVersion":
- return ec.fieldContext_ConnectionInfo_serverVersion(ctx, field)
- case "clientVersion":
- return ec.fieldContext_ConnectionInfo_clientVersion(ctx, field)
- case "origin":
- return ec.fieldContext_ConnectionInfo_origin(ctx, field)
- case "authNeeded":
- return ec.fieldContext_ConnectionInfo_authNeeded(ctx, field)
- case "authModel":
- return ec.fieldContext_ConnectionInfo_authModel(ctx, field)
- case "authProperties":
- return ec.fieldContext_ConnectionInfo_authProperties(ctx, field)
- case "providerProperties":
- return ec.fieldContext_ConnectionInfo_providerProperties(ctx, field)
- case "networkHandlersConfig":
- return ec.fieldContext_ConnectionInfo_networkHandlersConfig(ctx, field)
- case "features":
- return ec.fieldContext_ConnectionInfo_features(ctx, field)
- case "navigatorSettings":
- return ec.fieldContext_ConnectionInfo_navigatorSettings(ctx, field)
- case "supportedDataFormats":
- return ec.fieldContext_ConnectionInfo_supportedDataFormats(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ConnectionInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_closeConnection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_setConnectionNavigatorSettings(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_setConnectionNavigatorSettings(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().SetConnectionNavigatorSettings(rctx, fc.Args["id"].(string), fc.Args["settings"].(model.NavigatorSettingsInput))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.ConnectionInfo)
- fc.Result = res
- return ec.marshalNConnectionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_setConnectionNavigatorSettings(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ConnectionInfo_id(ctx, field)
- case "driverId":
- return ec.fieldContext_ConnectionInfo_driverId(ctx, field)
- case "name":
- return ec.fieldContext_ConnectionInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_ConnectionInfo_description(ctx, field)
- case "host":
- return ec.fieldContext_ConnectionInfo_host(ctx, field)
- case "port":
- return ec.fieldContext_ConnectionInfo_port(ctx, field)
- case "serverName":
- return ec.fieldContext_ConnectionInfo_serverName(ctx, field)
- case "databaseName":
- return ec.fieldContext_ConnectionInfo_databaseName(ctx, field)
- case "url":
- return ec.fieldContext_ConnectionInfo_url(ctx, field)
- case "properties":
- return ec.fieldContext_ConnectionInfo_properties(ctx, field)
- case "template":
- return ec.fieldContext_ConnectionInfo_template(ctx, field)
- case "connected":
- return ec.fieldContext_ConnectionInfo_connected(ctx, field)
- case "provided":
- return ec.fieldContext_ConnectionInfo_provided(ctx, field)
- case "readOnly":
- return ec.fieldContext_ConnectionInfo_readOnly(ctx, field)
- case "useUrl":
- return ec.fieldContext_ConnectionInfo_useUrl(ctx, field)
- case "saveCredentials":
- return ec.fieldContext_ConnectionInfo_saveCredentials(ctx, field)
- case "folder":
- return ec.fieldContext_ConnectionInfo_folder(ctx, field)
- case "nodePath":
- return ec.fieldContext_ConnectionInfo_nodePath(ctx, field)
- case "connectTime":
- return ec.fieldContext_ConnectionInfo_connectTime(ctx, field)
- case "connectionError":
- return ec.fieldContext_ConnectionInfo_connectionError(ctx, field)
- case "serverVersion":
- return ec.fieldContext_ConnectionInfo_serverVersion(ctx, field)
- case "clientVersion":
- return ec.fieldContext_ConnectionInfo_clientVersion(ctx, field)
- case "origin":
- return ec.fieldContext_ConnectionInfo_origin(ctx, field)
- case "authNeeded":
- return ec.fieldContext_ConnectionInfo_authNeeded(ctx, field)
- case "authModel":
- return ec.fieldContext_ConnectionInfo_authModel(ctx, field)
- case "authProperties":
- return ec.fieldContext_ConnectionInfo_authProperties(ctx, field)
- case "providerProperties":
- return ec.fieldContext_ConnectionInfo_providerProperties(ctx, field)
- case "networkHandlersConfig":
- return ec.fieldContext_ConnectionInfo_networkHandlersConfig(ctx, field)
- case "features":
- return ec.fieldContext_ConnectionInfo_features(ctx, field)
- case "navigatorSettings":
- return ec.fieldContext_ConnectionInfo_navigatorSettings(ctx, field)
- case "supportedDataFormats":
- return ec.fieldContext_ConnectionInfo_supportedDataFormats(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ConnectionInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_setConnectionNavigatorSettings_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_asyncTaskCancel(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_asyncTaskCancel(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().AsyncTaskCancel(rctx, fc.Args["id"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_asyncTaskCancel(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_asyncTaskCancel_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_asyncTaskInfo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_asyncTaskInfo(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().AsyncTaskInfo(rctx, fc.Args["id"].(string), fc.Args["removeOnFinish"].(bool))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.AsyncTaskInfo)
- fc.Result = res
- return ec.marshalNAsyncTaskInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAsyncTaskInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_asyncTaskInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_AsyncTaskInfo_id(ctx, field)
- case "name":
- return ec.fieldContext_AsyncTaskInfo_name(ctx, field)
- case "running":
- return ec.fieldContext_AsyncTaskInfo_running(ctx, field)
- case "status":
- return ec.fieldContext_AsyncTaskInfo_status(ctx, field)
- case "error":
- return ec.fieldContext_AsyncTaskInfo_error(ctx, field)
- case "result":
- return ec.fieldContext_AsyncTaskInfo_result(ctx, field)
- case "taskResult":
- return ec.fieldContext_AsyncTaskInfo_taskResult(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AsyncTaskInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_asyncTaskInfo_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_openConnection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_openConnection(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().OpenConnection(rctx, fc.Args["config"].(model.ConnectionConfig))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.ConnectionInfo)
- fc.Result = res
- return ec.marshalNConnectionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_openConnection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ConnectionInfo_id(ctx, field)
- case "driverId":
- return ec.fieldContext_ConnectionInfo_driverId(ctx, field)
- case "name":
- return ec.fieldContext_ConnectionInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_ConnectionInfo_description(ctx, field)
- case "host":
- return ec.fieldContext_ConnectionInfo_host(ctx, field)
- case "port":
- return ec.fieldContext_ConnectionInfo_port(ctx, field)
- case "serverName":
- return ec.fieldContext_ConnectionInfo_serverName(ctx, field)
- case "databaseName":
- return ec.fieldContext_ConnectionInfo_databaseName(ctx, field)
- case "url":
- return ec.fieldContext_ConnectionInfo_url(ctx, field)
- case "properties":
- return ec.fieldContext_ConnectionInfo_properties(ctx, field)
- case "template":
- return ec.fieldContext_ConnectionInfo_template(ctx, field)
- case "connected":
- return ec.fieldContext_ConnectionInfo_connected(ctx, field)
- case "provided":
- return ec.fieldContext_ConnectionInfo_provided(ctx, field)
- case "readOnly":
- return ec.fieldContext_ConnectionInfo_readOnly(ctx, field)
- case "useUrl":
- return ec.fieldContext_ConnectionInfo_useUrl(ctx, field)
- case "saveCredentials":
- return ec.fieldContext_ConnectionInfo_saveCredentials(ctx, field)
- case "folder":
- return ec.fieldContext_ConnectionInfo_folder(ctx, field)
- case "nodePath":
- return ec.fieldContext_ConnectionInfo_nodePath(ctx, field)
- case "connectTime":
- return ec.fieldContext_ConnectionInfo_connectTime(ctx, field)
- case "connectionError":
- return ec.fieldContext_ConnectionInfo_connectionError(ctx, field)
- case "serverVersion":
- return ec.fieldContext_ConnectionInfo_serverVersion(ctx, field)
- case "clientVersion":
- return ec.fieldContext_ConnectionInfo_clientVersion(ctx, field)
- case "origin":
- return ec.fieldContext_ConnectionInfo_origin(ctx, field)
- case "authNeeded":
- return ec.fieldContext_ConnectionInfo_authNeeded(ctx, field)
- case "authModel":
- return ec.fieldContext_ConnectionInfo_authModel(ctx, field)
- case "authProperties":
- return ec.fieldContext_ConnectionInfo_authProperties(ctx, field)
- case "providerProperties":
- return ec.fieldContext_ConnectionInfo_providerProperties(ctx, field)
- case "networkHandlersConfig":
- return ec.fieldContext_ConnectionInfo_networkHandlersConfig(ctx, field)
- case "features":
- return ec.fieldContext_ConnectionInfo_features(ctx, field)
- case "navigatorSettings":
- return ec.fieldContext_ConnectionInfo_navigatorSettings(ctx, field)
- case "supportedDataFormats":
- return ec.fieldContext_ConnectionInfo_supportedDataFormats(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ConnectionInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_openConnection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_asyncTaskStatus(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_asyncTaskStatus(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().AsyncTaskStatus(rctx, fc.Args["id"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.AsyncTaskInfo)
- fc.Result = res
- return ec.marshalNAsyncTaskInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAsyncTaskInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_asyncTaskStatus(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_AsyncTaskInfo_id(ctx, field)
- case "name":
- return ec.fieldContext_AsyncTaskInfo_name(ctx, field)
- case "running":
- return ec.fieldContext_AsyncTaskInfo_running(ctx, field)
- case "status":
- return ec.fieldContext_AsyncTaskInfo_status(ctx, field)
- case "error":
- return ec.fieldContext_AsyncTaskInfo_error(ctx, field)
- case "result":
- return ec.fieldContext_AsyncTaskInfo_result(ctx, field)
- case "taskResult":
- return ec.fieldContext_AsyncTaskInfo_taskResult(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AsyncTaskInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_asyncTaskStatus_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_navRenameNode(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_navRenameNode(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().NavRenameNode(rctx, fc.Args["nodePath"].(string), fc.Args["newName"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_navRenameNode(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_navRenameNode_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_navDeleteNodes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_navDeleteNodes(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().NavDeleteNodes(rctx, fc.Args["nodePaths"].([]string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*int)
- fc.Result = res
- return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_navDeleteNodes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_navDeleteNodes_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_navMoveNodesToFolder(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_navMoveNodesToFolder(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().NavMoveNodesToFolder(rctx, fc.Args["nodePaths"].([]string), fc.Args["folderPath"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_navMoveNodesToFolder(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_navMoveNodesToFolder_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_rmCreateResource(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_rmCreateResource(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().RmCreateResource(rctx, fc.Args["projectId"].(string), fc.Args["resourcePath"].(string), fc.Args["isFolder"].(bool))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_rmCreateResource(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_rmCreateResource_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_rmMoveResource(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_rmMoveResource(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().RmMoveResource(rctx, fc.Args["projectId"].(string), fc.Args["oldResourcePath"].(string), fc.Args["newResourcePath"].(*string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_rmMoveResource(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_rmMoveResource_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_rmDeleteResource(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_rmDeleteResource(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().RmDeleteResource(rctx, fc.Args["projectId"].(string), fc.Args["resourcePath"].(string), fc.Args["recursive"].(bool))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_rmDeleteResource(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_rmDeleteResource_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_rmWriteResourceStringContent(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_rmWriteResourceStringContent(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().RmWriteResourceStringContent(rctx, fc.Args["projectId"].(string), fc.Args["resourcePath"].(string), fc.Args["data"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_rmWriteResourceStringContent(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_rmWriteResourceStringContent_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_sqlContextCreate(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_sqlContextCreate(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().SQLContextCreate(rctx, fc.Args["connectionId"].(string), fc.Args["defaultCatalog"].(*string), fc.Args["defaultSchema"].(*string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.SQLContextInfo)
- fc.Result = res
- return ec.marshalNSQLContextInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLContextInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_sqlContextCreate(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_SQLContextInfo_id(ctx, field)
- case "connectionId":
- return ec.fieldContext_SQLContextInfo_connectionId(ctx, field)
- case "defaultCatalog":
- return ec.fieldContext_SQLContextInfo_defaultCatalog(ctx, field)
- case "defaultSchema":
- return ec.fieldContext_SQLContextInfo_defaultSchema(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type SQLContextInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_sqlContextCreate_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_sqlContextSetDefaults(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_sqlContextSetDefaults(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().SQLContextSetDefaults(rctx, fc.Args["connectionId"].(string), fc.Args["contextId"].(string), fc.Args["defaultCatalog"].(*string), fc.Args["defaultSchema"].(*string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_sqlContextSetDefaults(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_sqlContextSetDefaults_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_sqlContextDestroy(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_sqlContextDestroy(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().SQLContextDestroy(rctx, fc.Args["connectionId"].(string), fc.Args["contextId"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_sqlContextDestroy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_sqlContextDestroy_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_asyncSqlExecuteQuery(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_asyncSqlExecuteQuery(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().AsyncSQLExecuteQuery(rctx, fc.Args["projectId"].(*string), fc.Args["connectionId"].(string), fc.Args["contextId"].(string), fc.Args["sql"].(string), fc.Args["resultId"].(*string), fc.Args["filter"].(*model.SQLDataFilter), fc.Args["dataFormat"].(*model.ResultDataFormat), fc.Args["readLogs"].(*bool))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.AsyncTaskInfo)
- fc.Result = res
- return ec.marshalNAsyncTaskInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAsyncTaskInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_asyncSqlExecuteQuery(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_AsyncTaskInfo_id(ctx, field)
- case "name":
- return ec.fieldContext_AsyncTaskInfo_name(ctx, field)
- case "running":
- return ec.fieldContext_AsyncTaskInfo_running(ctx, field)
- case "status":
- return ec.fieldContext_AsyncTaskInfo_status(ctx, field)
- case "error":
- return ec.fieldContext_AsyncTaskInfo_error(ctx, field)
- case "result":
- return ec.fieldContext_AsyncTaskInfo_result(ctx, field)
- case "taskResult":
- return ec.fieldContext_AsyncTaskInfo_taskResult(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AsyncTaskInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_asyncSqlExecuteQuery_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_asyncReadDataFromContainer(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_asyncReadDataFromContainer(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().AsyncReadDataFromContainer(rctx, fc.Args["connectionId"].(string), fc.Args["contextId"].(string), fc.Args["containerNodePath"].(string), fc.Args["resultId"].(*string), fc.Args["filter"].(*model.SQLDataFilter), fc.Args["dataFormat"].(*model.ResultDataFormat))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.AsyncTaskInfo)
- fc.Result = res
- return ec.marshalNAsyncTaskInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAsyncTaskInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_asyncReadDataFromContainer(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_AsyncTaskInfo_id(ctx, field)
- case "name":
- return ec.fieldContext_AsyncTaskInfo_name(ctx, field)
- case "running":
- return ec.fieldContext_AsyncTaskInfo_running(ctx, field)
- case "status":
- return ec.fieldContext_AsyncTaskInfo_status(ctx, field)
- case "error":
- return ec.fieldContext_AsyncTaskInfo_error(ctx, field)
- case "result":
- return ec.fieldContext_AsyncTaskInfo_result(ctx, field)
- case "taskResult":
- return ec.fieldContext_AsyncTaskInfo_taskResult(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AsyncTaskInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_asyncReadDataFromContainer_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_sqlResultClose(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_sqlResultClose(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().SQLResultClose(rctx, fc.Args["connectionId"].(string), fc.Args["contextId"].(string), fc.Args["resultId"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_sqlResultClose(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_sqlResultClose_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_updateResultsDataBatch(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_updateResultsDataBatch(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().UpdateResultsDataBatch(rctx, fc.Args["connectionId"].(string), fc.Args["contextId"].(string), fc.Args["resultsId"].(string), fc.Args["updatedRows"].([]*model.SQLResultRow), fc.Args["deletedRows"].([]*model.SQLResultRow), fc.Args["addedRows"].([]*model.SQLResultRow))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.SQLExecuteInfo)
- fc.Result = res
- return ec.marshalNSQLExecuteInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLExecuteInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_updateResultsDataBatch(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "statusMessage":
- return ec.fieldContext_SQLExecuteInfo_statusMessage(ctx, field)
- case "duration":
- return ec.fieldContext_SQLExecuteInfo_duration(ctx, field)
- case "filterText":
- return ec.fieldContext_SQLExecuteInfo_filterText(ctx, field)
- case "results":
- return ec.fieldContext_SQLExecuteInfo_results(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type SQLExecuteInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_updateResultsDataBatch_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_updateResultsDataBatchScript(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_updateResultsDataBatchScript(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().UpdateResultsDataBatchScript(rctx, fc.Args["connectionId"].(string), fc.Args["contextId"].(string), fc.Args["resultsId"].(string), fc.Args["updatedRows"].([]*model.SQLResultRow), fc.Args["deletedRows"].([]*model.SQLResultRow), fc.Args["addedRows"].([]*model.SQLResultRow))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_updateResultsDataBatchScript(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_updateResultsDataBatchScript_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_readLobValue(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_readLobValue(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().ReadLobValue(rctx, fc.Args["connectionId"].(string), fc.Args["contextId"].(string), fc.Args["resultsId"].(string), fc.Args["lobColumnIndex"].(int), fc.Args["row"].([]*model.SQLResultRow))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_readLobValue(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_readLobValue_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_asyncSqlExecuteResults(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_asyncSqlExecuteResults(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().AsyncSQLExecuteResults(rctx, fc.Args["taskId"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.SQLExecuteInfo)
- fc.Result = res
- return ec.marshalNSQLExecuteInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLExecuteInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_asyncSqlExecuteResults(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "statusMessage":
- return ec.fieldContext_SQLExecuteInfo_statusMessage(ctx, field)
- case "duration":
- return ec.fieldContext_SQLExecuteInfo_duration(ctx, field)
- case "filterText":
- return ec.fieldContext_SQLExecuteInfo_filterText(ctx, field)
- case "results":
- return ec.fieldContext_SQLExecuteInfo_results(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type SQLExecuteInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_asyncSqlExecuteResults_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_asyncSqlExplainExecutionPlan(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_asyncSqlExplainExecutionPlan(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().AsyncSQLExplainExecutionPlan(rctx, fc.Args["connectionId"].(string), fc.Args["contextId"].(string), fc.Args["query"].(string),
- func() interface{} {
- if fc.Args["configuration"] == nil {
- return nil
- }
- return fc.Args["configuration"].(interface{})
- }())
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.AsyncTaskInfo)
- fc.Result = res
- return ec.marshalNAsyncTaskInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAsyncTaskInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_asyncSqlExplainExecutionPlan(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_AsyncTaskInfo_id(ctx, field)
- case "name":
- return ec.fieldContext_AsyncTaskInfo_name(ctx, field)
- case "running":
- return ec.fieldContext_AsyncTaskInfo_running(ctx, field)
- case "status":
- return ec.fieldContext_AsyncTaskInfo_status(ctx, field)
- case "error":
- return ec.fieldContext_AsyncTaskInfo_error(ctx, field)
- case "result":
- return ec.fieldContext_AsyncTaskInfo_result(ctx, field)
- case "taskResult":
- return ec.fieldContext_AsyncTaskInfo_taskResult(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AsyncTaskInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_asyncSqlExplainExecutionPlan_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Mutation_asyncSqlExplainExecutionPlanResult(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_asyncSqlExplainExecutionPlanResult(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().AsyncSQLExplainExecutionPlanResult(rctx, fc.Args["taskId"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.SQLExecutionPlan)
- fc.Result = res
- return ec.marshalNSQLExecutionPlan2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLExecutionPlan(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_asyncSqlExplainExecutionPlanResult(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "query":
- return ec.fieldContext_SQLExecutionPlan_query(ctx, field)
- case "nodes":
- return ec.fieldContext_SQLExecutionPlan_nodes(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type SQLExecutionPlan", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_asyncSqlExplainExecutionPlanResult_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NavigatorNodeInfo_id(ctx context.Context, field graphql.CollectedField, obj *model.NavigatorNodeInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NavigatorNodeInfo_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NavigatorNodeInfo_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NavigatorNodeInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NavigatorNodeInfo_name(ctx context.Context, field graphql.CollectedField, obj *model.NavigatorNodeInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NavigatorNodeInfo_name(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Name, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NavigatorNodeInfo_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NavigatorNodeInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NavigatorNodeInfo_fullName(ctx context.Context, field graphql.CollectedField, obj *model.NavigatorNodeInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NavigatorNodeInfo_fullName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.FullName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NavigatorNodeInfo_fullName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NavigatorNodeInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NavigatorNodeInfo_icon(ctx context.Context, field graphql.CollectedField, obj *model.NavigatorNodeInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NavigatorNodeInfo_icon(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Icon, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NavigatorNodeInfo_icon(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NavigatorNodeInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NavigatorNodeInfo_description(ctx context.Context, field graphql.CollectedField, obj *model.NavigatorNodeInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NavigatorNodeInfo_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NavigatorNodeInfo_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NavigatorNodeInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NavigatorNodeInfo_nodeType(ctx context.Context, field graphql.CollectedField, obj *model.NavigatorNodeInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NavigatorNodeInfo_nodeType(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.NodeType, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NavigatorNodeInfo_nodeType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NavigatorNodeInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NavigatorNodeInfo_hasChildren(ctx context.Context, field graphql.CollectedField, obj *model.NavigatorNodeInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NavigatorNodeInfo_hasChildren(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.HasChildren, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NavigatorNodeInfo_hasChildren(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NavigatorNodeInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NavigatorNodeInfo_object(ctx context.Context, field graphql.CollectedField, obj *model.NavigatorNodeInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NavigatorNodeInfo_object(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Object, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*model.DatabaseObjectInfo)
- fc.Result = res
- return ec.marshalODatabaseObjectInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDatabaseObjectInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NavigatorNodeInfo_object(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NavigatorNodeInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "name":
- return ec.fieldContext_DatabaseObjectInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_DatabaseObjectInfo_description(ctx, field)
- case "type":
- return ec.fieldContext_DatabaseObjectInfo_type(ctx, field)
- case "properties":
- return ec.fieldContext_DatabaseObjectInfo_properties(ctx, field)
- case "ordinalPosition":
- return ec.fieldContext_DatabaseObjectInfo_ordinalPosition(ctx, field)
- case "fullyQualifiedName":
- return ec.fieldContext_DatabaseObjectInfo_fullyQualifiedName(ctx, field)
- case "overloadedName":
- return ec.fieldContext_DatabaseObjectInfo_overloadedName(ctx, field)
- case "uniqueName":
- return ec.fieldContext_DatabaseObjectInfo_uniqueName(ctx, field)
- case "state":
- return ec.fieldContext_DatabaseObjectInfo_state(ctx, field)
- case "features":
- return ec.fieldContext_DatabaseObjectInfo_features(ctx, field)
- case "editors":
- return ec.fieldContext_DatabaseObjectInfo_editors(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type DatabaseObjectInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NavigatorNodeInfo_features(ctx context.Context, field graphql.CollectedField, obj *model.NavigatorNodeInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NavigatorNodeInfo_features(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Features, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([]string)
- fc.Result = res
- return ec.marshalOString2ᚕstringᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NavigatorNodeInfo_features(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NavigatorNodeInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NavigatorNodeInfo_nodeDetails(ctx context.Context, field graphql.CollectedField, obj *model.NavigatorNodeInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NavigatorNodeInfo_nodeDetails(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.NodeDetails, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([]*model.ObjectPropertyInfo)
- fc.Result = res
- return ec.marshalOObjectPropertyInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NavigatorNodeInfo_nodeDetails(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NavigatorNodeInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ObjectPropertyInfo_id(ctx, field)
- case "displayName":
- return ec.fieldContext_ObjectPropertyInfo_displayName(ctx, field)
- case "description":
- return ec.fieldContext_ObjectPropertyInfo_description(ctx, field)
- case "category":
- return ec.fieldContext_ObjectPropertyInfo_category(ctx, field)
- case "dataType":
- return ec.fieldContext_ObjectPropertyInfo_dataType(ctx, field)
- case "value":
- return ec.fieldContext_ObjectPropertyInfo_value(ctx, field)
- case "validValues":
- return ec.fieldContext_ObjectPropertyInfo_validValues(ctx, field)
- case "defaultValue":
- return ec.fieldContext_ObjectPropertyInfo_defaultValue(ctx, field)
- case "length":
- return ec.fieldContext_ObjectPropertyInfo_length(ctx, field)
- case "features":
- return ec.fieldContext_ObjectPropertyInfo_features(ctx, field)
- case "order":
- return ec.fieldContext_ObjectPropertyInfo_order(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ObjectPropertyInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NavigatorNodeInfo_folder(ctx context.Context, field graphql.CollectedField, obj *model.NavigatorNodeInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NavigatorNodeInfo_folder(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Folder, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NavigatorNodeInfo_folder(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NavigatorNodeInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NavigatorNodeInfo_inline(ctx context.Context, field graphql.CollectedField, obj *model.NavigatorNodeInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NavigatorNodeInfo_inline(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Inline, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NavigatorNodeInfo_inline(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NavigatorNodeInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NavigatorNodeInfo_navigable(ctx context.Context, field graphql.CollectedField, obj *model.NavigatorNodeInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NavigatorNodeInfo_navigable(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Navigable, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NavigatorNodeInfo_navigable(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NavigatorNodeInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NavigatorSettings_showSystemObjects(ctx context.Context, field graphql.CollectedField, obj *model.NavigatorSettings) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NavigatorSettings_showSystemObjects(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ShowSystemObjects, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NavigatorSettings_showSystemObjects(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NavigatorSettings",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NavigatorSettings_showUtilityObjects(ctx context.Context, field graphql.CollectedField, obj *model.NavigatorSettings) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NavigatorSettings_showUtilityObjects(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ShowUtilityObjects, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NavigatorSettings_showUtilityObjects(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NavigatorSettings",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NavigatorSettings_showOnlyEntities(ctx context.Context, field graphql.CollectedField, obj *model.NavigatorSettings) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NavigatorSettings_showOnlyEntities(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ShowOnlyEntities, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NavigatorSettings_showOnlyEntities(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NavigatorSettings",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NavigatorSettings_mergeEntities(ctx context.Context, field graphql.CollectedField, obj *model.NavigatorSettings) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NavigatorSettings_mergeEntities(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.MergeEntities, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NavigatorSettings_mergeEntities(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NavigatorSettings",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NavigatorSettings_hideFolders(ctx context.Context, field graphql.CollectedField, obj *model.NavigatorSettings) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NavigatorSettings_hideFolders(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.HideFolders, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NavigatorSettings_hideFolders(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NavigatorSettings",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NavigatorSettings_hideSchemas(ctx context.Context, field graphql.CollectedField, obj *model.NavigatorSettings) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NavigatorSettings_hideSchemas(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.HideSchemas, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NavigatorSettings_hideSchemas(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NavigatorSettings",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NavigatorSettings_hideVirtualModel(ctx context.Context, field graphql.CollectedField, obj *model.NavigatorSettings) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NavigatorSettings_hideVirtualModel(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.HideVirtualModel, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NavigatorSettings_hideVirtualModel(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NavigatorSettings",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NetworkEndpointInfo_message(ctx context.Context, field graphql.CollectedField, obj *model.NetworkEndpointInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NetworkEndpointInfo_message(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Message, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NetworkEndpointInfo_message(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NetworkEndpointInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NetworkEndpointInfo_clientVersion(ctx context.Context, field graphql.CollectedField, obj *model.NetworkEndpointInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NetworkEndpointInfo_clientVersion(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ClientVersion, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NetworkEndpointInfo_clientVersion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NetworkEndpointInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NetworkEndpointInfo_serverVersion(ctx context.Context, field graphql.CollectedField, obj *model.NetworkEndpointInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NetworkEndpointInfo_serverVersion(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ServerVersion, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NetworkEndpointInfo_serverVersion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NetworkEndpointInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NetworkHandlerConfig_id(ctx context.Context, field graphql.CollectedField, obj *model.NetworkHandlerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NetworkHandlerConfig_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NetworkHandlerConfig_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NetworkHandlerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NetworkHandlerConfig_enabled(ctx context.Context, field graphql.CollectedField, obj *model.NetworkHandlerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NetworkHandlerConfig_enabled(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Enabled, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NetworkHandlerConfig_enabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NetworkHandlerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NetworkHandlerConfig_authType(ctx context.Context, field graphql.CollectedField, obj *model.NetworkHandlerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NetworkHandlerConfig_authType(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.AuthType, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(model.NetworkHandlerAuthType)
- fc.Result = res
- return ec.marshalNNetworkHandlerAuthType2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerAuthType(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NetworkHandlerConfig_authType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NetworkHandlerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type NetworkHandlerAuthType does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NetworkHandlerConfig_userName(ctx context.Context, field graphql.CollectedField, obj *model.NetworkHandlerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NetworkHandlerConfig_userName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.UserName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NetworkHandlerConfig_userName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NetworkHandlerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NetworkHandlerConfig_password(ctx context.Context, field graphql.CollectedField, obj *model.NetworkHandlerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NetworkHandlerConfig_password(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Password, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NetworkHandlerConfig_password(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NetworkHandlerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NetworkHandlerConfig_key(ctx context.Context, field graphql.CollectedField, obj *model.NetworkHandlerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NetworkHandlerConfig_key(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Key, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NetworkHandlerConfig_key(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NetworkHandlerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NetworkHandlerConfig_savePassword(ctx context.Context, field graphql.CollectedField, obj *model.NetworkHandlerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NetworkHandlerConfig_savePassword(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SavePassword, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NetworkHandlerConfig_savePassword(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NetworkHandlerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NetworkHandlerConfig_properties(ctx context.Context, field graphql.CollectedField, obj *model.NetworkHandlerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NetworkHandlerConfig_properties(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Properties, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(interface{})
- fc.Result = res
- return ec.marshalNObject2interface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NetworkHandlerConfig_properties(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NetworkHandlerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NetworkHandlerDescriptor_id(ctx context.Context, field graphql.CollectedField, obj *model.NetworkHandlerDescriptor) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NetworkHandlerDescriptor_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NetworkHandlerDescriptor_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NetworkHandlerDescriptor",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NetworkHandlerDescriptor_codeName(ctx context.Context, field graphql.CollectedField, obj *model.NetworkHandlerDescriptor) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NetworkHandlerDescriptor_codeName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.CodeName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NetworkHandlerDescriptor_codeName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NetworkHandlerDescriptor",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NetworkHandlerDescriptor_label(ctx context.Context, field graphql.CollectedField, obj *model.NetworkHandlerDescriptor) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NetworkHandlerDescriptor_label(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Label, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NetworkHandlerDescriptor_label(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NetworkHandlerDescriptor",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NetworkHandlerDescriptor_description(ctx context.Context, field graphql.CollectedField, obj *model.NetworkHandlerDescriptor) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NetworkHandlerDescriptor_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NetworkHandlerDescriptor_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NetworkHandlerDescriptor",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NetworkHandlerDescriptor_secured(ctx context.Context, field graphql.CollectedField, obj *model.NetworkHandlerDescriptor) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NetworkHandlerDescriptor_secured(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Secured, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NetworkHandlerDescriptor_secured(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NetworkHandlerDescriptor",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NetworkHandlerDescriptor_type(ctx context.Context, field graphql.CollectedField, obj *model.NetworkHandlerDescriptor) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NetworkHandlerDescriptor_type(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Type, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*model.NetworkHandlerType)
- fc.Result = res
- return ec.marshalONetworkHandlerType2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerType(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NetworkHandlerDescriptor_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NetworkHandlerDescriptor",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type NetworkHandlerType does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _NetworkHandlerDescriptor_properties(ctx context.Context, field graphql.CollectedField, obj *model.NetworkHandlerDescriptor) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_NetworkHandlerDescriptor_properties(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Properties, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.ObjectPropertyInfo)
- fc.Result = res
- return ec.marshalNObjectPropertyInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_NetworkHandlerDescriptor_properties(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "NetworkHandlerDescriptor",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ObjectPropertyInfo_id(ctx, field)
- case "displayName":
- return ec.fieldContext_ObjectPropertyInfo_displayName(ctx, field)
- case "description":
- return ec.fieldContext_ObjectPropertyInfo_description(ctx, field)
- case "category":
- return ec.fieldContext_ObjectPropertyInfo_category(ctx, field)
- case "dataType":
- return ec.fieldContext_ObjectPropertyInfo_dataType(ctx, field)
- case "value":
- return ec.fieldContext_ObjectPropertyInfo_value(ctx, field)
- case "validValues":
- return ec.fieldContext_ObjectPropertyInfo_validValues(ctx, field)
- case "defaultValue":
- return ec.fieldContext_ObjectPropertyInfo_defaultValue(ctx, field)
- case "length":
- return ec.fieldContext_ObjectPropertyInfo_length(ctx, field)
- case "features":
- return ec.fieldContext_ObjectPropertyInfo_features(ctx, field)
- case "order":
- return ec.fieldContext_ObjectPropertyInfo_order(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ObjectPropertyInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectDescriptor_id(ctx context.Context, field graphql.CollectedField, obj *model.ObjectDescriptor) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectDescriptor_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*int)
- fc.Result = res
- return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectDescriptor_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectDescriptor",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectDescriptor_displayName(ctx context.Context, field graphql.CollectedField, obj *model.ObjectDescriptor) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectDescriptor_displayName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DisplayName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectDescriptor_displayName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectDescriptor",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectDescriptor_fullName(ctx context.Context, field graphql.CollectedField, obj *model.ObjectDescriptor) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectDescriptor_fullName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.FullName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectDescriptor_fullName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectDescriptor",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectDescriptor_uniqueName(ctx context.Context, field graphql.CollectedField, obj *model.ObjectDescriptor) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectDescriptor_uniqueName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.UniqueName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectDescriptor_uniqueName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectDescriptor",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectDescriptor_description(ctx context.Context, field graphql.CollectedField, obj *model.ObjectDescriptor) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectDescriptor_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectDescriptor_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectDescriptor",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectDescriptor_value(ctx context.Context, field graphql.CollectedField, obj *model.ObjectDescriptor) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectDescriptor_value(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Value, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectDescriptor_value(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectDescriptor",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectDetails_id(ctx context.Context, field graphql.CollectedField, obj *model.ObjectDetails) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectDetails_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*int)
- fc.Result = res
- return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectDetails_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectDetails",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectDetails_displayName(ctx context.Context, field graphql.CollectedField, obj *model.ObjectDetails) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectDetails_displayName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DisplayName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectDetails_displayName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectDetails",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectDetails_description(ctx context.Context, field graphql.CollectedField, obj *model.ObjectDetails) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectDetails_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectDetails_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectDetails",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectDetails_value(ctx context.Context, field graphql.CollectedField, obj *model.ObjectDetails) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectDetails_value(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Value, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(interface{})
- fc.Result = res
- return ec.marshalOObject2interface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectDetails_value(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectDetails",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectOrigin_type(ctx context.Context, field graphql.CollectedField, obj *model.ObjectOrigin) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectOrigin_type(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Type, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectOrigin_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectOrigin",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectOrigin_subType(ctx context.Context, field graphql.CollectedField, obj *model.ObjectOrigin) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectOrigin_subType(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SubType, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOID2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectOrigin_subType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectOrigin",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectOrigin_displayName(ctx context.Context, field graphql.CollectedField, obj *model.ObjectOrigin) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectOrigin_displayName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DisplayName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectOrigin_displayName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectOrigin",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectOrigin_icon(ctx context.Context, field graphql.CollectedField, obj *model.ObjectOrigin) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectOrigin_icon(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Icon, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectOrigin_icon(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectOrigin",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectOrigin_configuration(ctx context.Context, field graphql.CollectedField, obj *model.ObjectOrigin) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectOrigin_configuration(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Configuration, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(interface{})
- fc.Result = res
- return ec.marshalOObject2interface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectOrigin_configuration(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectOrigin",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectOrigin_details(ctx context.Context, field graphql.CollectedField, obj *model.ObjectOrigin) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectOrigin_details(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Details, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([]*model.ObjectPropertyInfo)
- fc.Result = res
- return ec.marshalOObjectPropertyInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectOrigin_details(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectOrigin",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ObjectPropertyInfo_id(ctx, field)
- case "displayName":
- return ec.fieldContext_ObjectPropertyInfo_displayName(ctx, field)
- case "description":
- return ec.fieldContext_ObjectPropertyInfo_description(ctx, field)
- case "category":
- return ec.fieldContext_ObjectPropertyInfo_category(ctx, field)
- case "dataType":
- return ec.fieldContext_ObjectPropertyInfo_dataType(ctx, field)
- case "value":
- return ec.fieldContext_ObjectPropertyInfo_value(ctx, field)
- case "validValues":
- return ec.fieldContext_ObjectPropertyInfo_validValues(ctx, field)
- case "defaultValue":
- return ec.fieldContext_ObjectPropertyInfo_defaultValue(ctx, field)
- case "length":
- return ec.fieldContext_ObjectPropertyInfo_length(ctx, field)
- case "features":
- return ec.fieldContext_ObjectPropertyInfo_features(ctx, field)
- case "order":
- return ec.fieldContext_ObjectPropertyInfo_order(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ObjectPropertyInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectPropertyInfo_id(ctx context.Context, field graphql.CollectedField, obj *model.ObjectPropertyInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectPropertyInfo_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectPropertyInfo_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectPropertyInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectPropertyInfo_displayName(ctx context.Context, field graphql.CollectedField, obj *model.ObjectPropertyInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectPropertyInfo_displayName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DisplayName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectPropertyInfo_displayName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectPropertyInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectPropertyInfo_description(ctx context.Context, field graphql.CollectedField, obj *model.ObjectPropertyInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectPropertyInfo_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectPropertyInfo_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectPropertyInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectPropertyInfo_category(ctx context.Context, field graphql.CollectedField, obj *model.ObjectPropertyInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectPropertyInfo_category(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Category, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectPropertyInfo_category(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectPropertyInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectPropertyInfo_dataType(ctx context.Context, field graphql.CollectedField, obj *model.ObjectPropertyInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectPropertyInfo_dataType(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DataType, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectPropertyInfo_dataType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectPropertyInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectPropertyInfo_value(ctx context.Context, field graphql.CollectedField, obj *model.ObjectPropertyInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectPropertyInfo_value(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Value, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(interface{})
- fc.Result = res
- return ec.marshalOObject2interface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectPropertyInfo_value(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectPropertyInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectPropertyInfo_validValues(ctx context.Context, field graphql.CollectedField, obj *model.ObjectPropertyInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectPropertyInfo_validValues(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ValidValues, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([]interface{})
- fc.Result = res
- return ec.marshalOObject2ᚕinterface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectPropertyInfo_validValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectPropertyInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectPropertyInfo_defaultValue(ctx context.Context, field graphql.CollectedField, obj *model.ObjectPropertyInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectPropertyInfo_defaultValue(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DefaultValue, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(interface{})
- fc.Result = res
- return ec.marshalOObject2interface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectPropertyInfo_defaultValue(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectPropertyInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectPropertyInfo_length(ctx context.Context, field graphql.CollectedField, obj *model.ObjectPropertyInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectPropertyInfo_length(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Length, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(model.ObjectPropertyLength)
- fc.Result = res
- return ec.marshalNObjectPropertyLength2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyLength(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectPropertyInfo_length(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectPropertyInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ObjectPropertyLength does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectPropertyInfo_features(ctx context.Context, field graphql.CollectedField, obj *model.ObjectPropertyInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectPropertyInfo_features(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Features, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]string)
- fc.Result = res
- return ec.marshalNString2ᚕstringᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectPropertyInfo_features(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectPropertyInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ObjectPropertyInfo_order(ctx context.Context, field graphql.CollectedField, obj *model.ObjectPropertyInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ObjectPropertyInfo_order(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Order, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(int)
- fc.Result = res
- return ec.marshalNInt2int(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ObjectPropertyInfo_order(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ObjectPropertyInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ProductInfo_id(ctx context.Context, field graphql.CollectedField, obj *model.ProductInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ProductInfo_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ProductInfo_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ProductInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ProductInfo_version(ctx context.Context, field graphql.CollectedField, obj *model.ProductInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ProductInfo_version(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Version, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ProductInfo_version(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ProductInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ProductInfo_name(ctx context.Context, field graphql.CollectedField, obj *model.ProductInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ProductInfo_name(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Name, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ProductInfo_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ProductInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ProductInfo_description(ctx context.Context, field graphql.CollectedField, obj *model.ProductInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ProductInfo_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ProductInfo_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ProductInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ProductInfo_buildTime(ctx context.Context, field graphql.CollectedField, obj *model.ProductInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ProductInfo_buildTime(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.BuildTime, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ProductInfo_buildTime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ProductInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ProductInfo_releaseTime(ctx context.Context, field graphql.CollectedField, obj *model.ProductInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ProductInfo_releaseTime(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ReleaseTime, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ProductInfo_releaseTime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ProductInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ProductInfo_licenseInfo(ctx context.Context, field graphql.CollectedField, obj *model.ProductInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ProductInfo_licenseInfo(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.LicenseInfo, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ProductInfo_licenseInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ProductInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ProductInfo_latestVersionInfo(ctx context.Context, field graphql.CollectedField, obj *model.ProductInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ProductInfo_latestVersionInfo(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.LatestVersionInfo, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ProductInfo_latestVersionInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ProductInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_listUsers(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_listUsers(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().ListUsers(rctx, fc.Args["userId"].(*string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.AdminUserInfo)
- fc.Result = res
- return ec.marshalNAdminUserInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminUserInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_listUsers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "userId":
- return ec.fieldContext_AdminUserInfo_userId(ctx, field)
- case "metaParameters":
- return ec.fieldContext_AdminUserInfo_metaParameters(ctx, field)
- case "configurationParameters":
- return ec.fieldContext_AdminUserInfo_configurationParameters(ctx, field)
- case "grantedRoles":
- return ec.fieldContext_AdminUserInfo_grantedRoles(ctx, field)
- case "grantedConnections":
- return ec.fieldContext_AdminUserInfo_grantedConnections(ctx, field)
- case "origins":
- return ec.fieldContext_AdminUserInfo_origins(ctx, field)
- case "linkedAuthProviders":
- return ec.fieldContext_AdminUserInfo_linkedAuthProviders(ctx, field)
- case "enabled":
- return ec.fieldContext_AdminUserInfo_enabled(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AdminUserInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_listUsers_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_listRoles(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_listRoles(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().ListRoles(rctx, fc.Args["roleId"].(*string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.AdminRoleInfo)
- fc.Result = res
- return ec.marshalNAdminRoleInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminRoleInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_listRoles(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "roleId":
- return ec.fieldContext_AdminRoleInfo_roleId(ctx, field)
- case "roleName":
- return ec.fieldContext_AdminRoleInfo_roleName(ctx, field)
- case "description":
- return ec.fieldContext_AdminRoleInfo_description(ctx, field)
- case "grantedUsers":
- return ec.fieldContext_AdminRoleInfo_grantedUsers(ctx, field)
- case "grantedConnections":
- return ec.fieldContext_AdminRoleInfo_grantedConnections(ctx, field)
- case "rolePermissions":
- return ec.fieldContext_AdminRoleInfo_rolePermissions(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AdminRoleInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_listRoles_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_listPermissions(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_listPermissions(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().ListPermissions(rctx)
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.AdminPermissionInfo)
- fc.Result = res
- return ec.marshalNAdminPermissionInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminPermissionInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_listPermissions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_AdminPermissionInfo_id(ctx, field)
- case "label":
- return ec.fieldContext_AdminPermissionInfo_label(ctx, field)
- case "description":
- return ec.fieldContext_AdminPermissionInfo_description(ctx, field)
- case "provider":
- return ec.fieldContext_AdminPermissionInfo_provider(ctx, field)
- case "category":
- return ec.fieldContext_AdminPermissionInfo_category(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AdminPermissionInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_createUser(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_createUser(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().CreateUser(rctx, fc.Args["userId"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.AdminUserInfo)
- fc.Result = res
- return ec.marshalNAdminUserInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminUserInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_createUser(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "userId":
- return ec.fieldContext_AdminUserInfo_userId(ctx, field)
- case "metaParameters":
- return ec.fieldContext_AdminUserInfo_metaParameters(ctx, field)
- case "configurationParameters":
- return ec.fieldContext_AdminUserInfo_configurationParameters(ctx, field)
- case "grantedRoles":
- return ec.fieldContext_AdminUserInfo_grantedRoles(ctx, field)
- case "grantedConnections":
- return ec.fieldContext_AdminUserInfo_grantedConnections(ctx, field)
- case "origins":
- return ec.fieldContext_AdminUserInfo_origins(ctx, field)
- case "linkedAuthProviders":
- return ec.fieldContext_AdminUserInfo_linkedAuthProviders(ctx, field)
- case "enabled":
- return ec.fieldContext_AdminUserInfo_enabled(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AdminUserInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_createUser_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_deleteUser(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_deleteUser(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().DeleteUser(rctx, fc.Args["userId"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_deleteUser(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_deleteUser_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_createRole(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_createRole(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().CreateRole(rctx, fc.Args["roleId"].(string), fc.Args["roleName"].(*string), fc.Args["description"].(*string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.AdminRoleInfo)
- fc.Result = res
- return ec.marshalNAdminRoleInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminRoleInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_createRole(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "roleId":
- return ec.fieldContext_AdminRoleInfo_roleId(ctx, field)
- case "roleName":
- return ec.fieldContext_AdminRoleInfo_roleName(ctx, field)
- case "description":
- return ec.fieldContext_AdminRoleInfo_description(ctx, field)
- case "grantedUsers":
- return ec.fieldContext_AdminRoleInfo_grantedUsers(ctx, field)
- case "grantedConnections":
- return ec.fieldContext_AdminRoleInfo_grantedConnections(ctx, field)
- case "rolePermissions":
- return ec.fieldContext_AdminRoleInfo_rolePermissions(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AdminRoleInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_createRole_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_updateRole(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_updateRole(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().UpdateRole(rctx, fc.Args["roleId"].(string), fc.Args["roleName"].(*string), fc.Args["description"].(*string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.AdminRoleInfo)
- fc.Result = res
- return ec.marshalNAdminRoleInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminRoleInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_updateRole(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "roleId":
- return ec.fieldContext_AdminRoleInfo_roleId(ctx, field)
- case "roleName":
- return ec.fieldContext_AdminRoleInfo_roleName(ctx, field)
- case "description":
- return ec.fieldContext_AdminRoleInfo_description(ctx, field)
- case "grantedUsers":
- return ec.fieldContext_AdminRoleInfo_grantedUsers(ctx, field)
- case "grantedConnections":
- return ec.fieldContext_AdminRoleInfo_grantedConnections(ctx, field)
- case "rolePermissions":
- return ec.fieldContext_AdminRoleInfo_rolePermissions(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AdminRoleInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_updateRole_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_deleteRole(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_deleteRole(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().DeleteRole(rctx, fc.Args["roleId"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_deleteRole(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_deleteRole_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_grantUserRole(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_grantUserRole(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().GrantUserRole(rctx, fc.Args["userId"].(string), fc.Args["roleId"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_grantUserRole(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_grantUserRole_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_revokeUserRole(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_revokeUserRole(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().RevokeUserRole(rctx, fc.Args["userId"].(string), fc.Args["roleId"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_revokeUserRole(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_revokeUserRole_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_setSubjectPermissions(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_setSubjectPermissions(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().SetSubjectPermissions(rctx, fc.Args["roleId"].(string), fc.Args["permissions"].([]string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.AdminPermissionInfo)
- fc.Result = res
- return ec.marshalNAdminPermissionInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminPermissionInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_setSubjectPermissions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_AdminPermissionInfo_id(ctx, field)
- case "label":
- return ec.fieldContext_AdminPermissionInfo_label(ctx, field)
- case "description":
- return ec.fieldContext_AdminPermissionInfo_description(ctx, field)
- case "provider":
- return ec.fieldContext_AdminPermissionInfo_provider(ctx, field)
- case "category":
- return ec.fieldContext_AdminPermissionInfo_category(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AdminPermissionInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_setSubjectPermissions_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_setUserCredentials(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_setUserCredentials(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().SetUserCredentials(rctx, fc.Args["userId"].(string), fc.Args["providerId"].(string),
- func() interface{} {
- if fc.Args["credentials"] == nil {
- return nil
- }
- return fc.Args["credentials"].(interface{})
- }())
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_setUserCredentials(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_setUserCredentials_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_enableUser(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_enableUser(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().EnableUser(rctx, fc.Args["userId"].(string), fc.Args["enabled"].(bool))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_enableUser(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_enableUser_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_allConnections(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_allConnections(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().AllConnections(rctx, fc.Args["id"].(*string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.ConnectionInfo)
- fc.Result = res
- return ec.marshalNConnectionInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_allConnections(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ConnectionInfo_id(ctx, field)
- case "driverId":
- return ec.fieldContext_ConnectionInfo_driverId(ctx, field)
- case "name":
- return ec.fieldContext_ConnectionInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_ConnectionInfo_description(ctx, field)
- case "host":
- return ec.fieldContext_ConnectionInfo_host(ctx, field)
- case "port":
- return ec.fieldContext_ConnectionInfo_port(ctx, field)
- case "serverName":
- return ec.fieldContext_ConnectionInfo_serverName(ctx, field)
- case "databaseName":
- return ec.fieldContext_ConnectionInfo_databaseName(ctx, field)
- case "url":
- return ec.fieldContext_ConnectionInfo_url(ctx, field)
- case "properties":
- return ec.fieldContext_ConnectionInfo_properties(ctx, field)
- case "template":
- return ec.fieldContext_ConnectionInfo_template(ctx, field)
- case "connected":
- return ec.fieldContext_ConnectionInfo_connected(ctx, field)
- case "provided":
- return ec.fieldContext_ConnectionInfo_provided(ctx, field)
- case "readOnly":
- return ec.fieldContext_ConnectionInfo_readOnly(ctx, field)
- case "useUrl":
- return ec.fieldContext_ConnectionInfo_useUrl(ctx, field)
- case "saveCredentials":
- return ec.fieldContext_ConnectionInfo_saveCredentials(ctx, field)
- case "folder":
- return ec.fieldContext_ConnectionInfo_folder(ctx, field)
- case "nodePath":
- return ec.fieldContext_ConnectionInfo_nodePath(ctx, field)
- case "connectTime":
- return ec.fieldContext_ConnectionInfo_connectTime(ctx, field)
- case "connectionError":
- return ec.fieldContext_ConnectionInfo_connectionError(ctx, field)
- case "serverVersion":
- return ec.fieldContext_ConnectionInfo_serverVersion(ctx, field)
- case "clientVersion":
- return ec.fieldContext_ConnectionInfo_clientVersion(ctx, field)
- case "origin":
- return ec.fieldContext_ConnectionInfo_origin(ctx, field)
- case "authNeeded":
- return ec.fieldContext_ConnectionInfo_authNeeded(ctx, field)
- case "authModel":
- return ec.fieldContext_ConnectionInfo_authModel(ctx, field)
- case "authProperties":
- return ec.fieldContext_ConnectionInfo_authProperties(ctx, field)
- case "providerProperties":
- return ec.fieldContext_ConnectionInfo_providerProperties(ctx, field)
- case "networkHandlersConfig":
- return ec.fieldContext_ConnectionInfo_networkHandlersConfig(ctx, field)
- case "features":
- return ec.fieldContext_ConnectionInfo_features(ctx, field)
- case "navigatorSettings":
- return ec.fieldContext_ConnectionInfo_navigatorSettings(ctx, field)
- case "supportedDataFormats":
- return ec.fieldContext_ConnectionInfo_supportedDataFormats(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ConnectionInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_allConnections_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_searchConnections(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_searchConnections(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().SearchConnections(rctx, fc.Args["hostNames"].([]string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.AdminConnectionSearchInfo)
- fc.Result = res
- return ec.marshalNAdminConnectionSearchInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminConnectionSearchInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_searchConnections(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "displayName":
- return ec.fieldContext_AdminConnectionSearchInfo_displayName(ctx, field)
- case "host":
- return ec.fieldContext_AdminConnectionSearchInfo_host(ctx, field)
- case "port":
- return ec.fieldContext_AdminConnectionSearchInfo_port(ctx, field)
- case "possibleDrivers":
- return ec.fieldContext_AdminConnectionSearchInfo_possibleDrivers(ctx, field)
- case "defaultDriver":
- return ec.fieldContext_AdminConnectionSearchInfo_defaultDriver(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AdminConnectionSearchInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_searchConnections_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_createConnectionConfiguration(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_createConnectionConfiguration(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().CreateConnectionConfiguration(rctx, fc.Args["config"].(model.ConnectionConfig))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.ConnectionInfo)
- fc.Result = res
- return ec.marshalNConnectionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_createConnectionConfiguration(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ConnectionInfo_id(ctx, field)
- case "driverId":
- return ec.fieldContext_ConnectionInfo_driverId(ctx, field)
- case "name":
- return ec.fieldContext_ConnectionInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_ConnectionInfo_description(ctx, field)
- case "host":
- return ec.fieldContext_ConnectionInfo_host(ctx, field)
- case "port":
- return ec.fieldContext_ConnectionInfo_port(ctx, field)
- case "serverName":
- return ec.fieldContext_ConnectionInfo_serverName(ctx, field)
- case "databaseName":
- return ec.fieldContext_ConnectionInfo_databaseName(ctx, field)
- case "url":
- return ec.fieldContext_ConnectionInfo_url(ctx, field)
- case "properties":
- return ec.fieldContext_ConnectionInfo_properties(ctx, field)
- case "template":
- return ec.fieldContext_ConnectionInfo_template(ctx, field)
- case "connected":
- return ec.fieldContext_ConnectionInfo_connected(ctx, field)
- case "provided":
- return ec.fieldContext_ConnectionInfo_provided(ctx, field)
- case "readOnly":
- return ec.fieldContext_ConnectionInfo_readOnly(ctx, field)
- case "useUrl":
- return ec.fieldContext_ConnectionInfo_useUrl(ctx, field)
- case "saveCredentials":
- return ec.fieldContext_ConnectionInfo_saveCredentials(ctx, field)
- case "folder":
- return ec.fieldContext_ConnectionInfo_folder(ctx, field)
- case "nodePath":
- return ec.fieldContext_ConnectionInfo_nodePath(ctx, field)
- case "connectTime":
- return ec.fieldContext_ConnectionInfo_connectTime(ctx, field)
- case "connectionError":
- return ec.fieldContext_ConnectionInfo_connectionError(ctx, field)
- case "serverVersion":
- return ec.fieldContext_ConnectionInfo_serverVersion(ctx, field)
- case "clientVersion":
- return ec.fieldContext_ConnectionInfo_clientVersion(ctx, field)
- case "origin":
- return ec.fieldContext_ConnectionInfo_origin(ctx, field)
- case "authNeeded":
- return ec.fieldContext_ConnectionInfo_authNeeded(ctx, field)
- case "authModel":
- return ec.fieldContext_ConnectionInfo_authModel(ctx, field)
- case "authProperties":
- return ec.fieldContext_ConnectionInfo_authProperties(ctx, field)
- case "providerProperties":
- return ec.fieldContext_ConnectionInfo_providerProperties(ctx, field)
- case "networkHandlersConfig":
- return ec.fieldContext_ConnectionInfo_networkHandlersConfig(ctx, field)
- case "features":
- return ec.fieldContext_ConnectionInfo_features(ctx, field)
- case "navigatorSettings":
- return ec.fieldContext_ConnectionInfo_navigatorSettings(ctx, field)
- case "supportedDataFormats":
- return ec.fieldContext_ConnectionInfo_supportedDataFormats(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ConnectionInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_createConnectionConfiguration_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_copyConnectionConfiguration(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_copyConnectionConfiguration(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().CopyConnectionConfiguration(rctx, fc.Args["nodePath"].(string), fc.Args["config"].(*model.ConnectionConfig))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.ConnectionInfo)
- fc.Result = res
- return ec.marshalNConnectionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_copyConnectionConfiguration(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ConnectionInfo_id(ctx, field)
- case "driverId":
- return ec.fieldContext_ConnectionInfo_driverId(ctx, field)
- case "name":
- return ec.fieldContext_ConnectionInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_ConnectionInfo_description(ctx, field)
- case "host":
- return ec.fieldContext_ConnectionInfo_host(ctx, field)
- case "port":
- return ec.fieldContext_ConnectionInfo_port(ctx, field)
- case "serverName":
- return ec.fieldContext_ConnectionInfo_serverName(ctx, field)
- case "databaseName":
- return ec.fieldContext_ConnectionInfo_databaseName(ctx, field)
- case "url":
- return ec.fieldContext_ConnectionInfo_url(ctx, field)
- case "properties":
- return ec.fieldContext_ConnectionInfo_properties(ctx, field)
- case "template":
- return ec.fieldContext_ConnectionInfo_template(ctx, field)
- case "connected":
- return ec.fieldContext_ConnectionInfo_connected(ctx, field)
- case "provided":
- return ec.fieldContext_ConnectionInfo_provided(ctx, field)
- case "readOnly":
- return ec.fieldContext_ConnectionInfo_readOnly(ctx, field)
- case "useUrl":
- return ec.fieldContext_ConnectionInfo_useUrl(ctx, field)
- case "saveCredentials":
- return ec.fieldContext_ConnectionInfo_saveCredentials(ctx, field)
- case "folder":
- return ec.fieldContext_ConnectionInfo_folder(ctx, field)
- case "nodePath":
- return ec.fieldContext_ConnectionInfo_nodePath(ctx, field)
- case "connectTime":
- return ec.fieldContext_ConnectionInfo_connectTime(ctx, field)
- case "connectionError":
- return ec.fieldContext_ConnectionInfo_connectionError(ctx, field)
- case "serverVersion":
- return ec.fieldContext_ConnectionInfo_serverVersion(ctx, field)
- case "clientVersion":
- return ec.fieldContext_ConnectionInfo_clientVersion(ctx, field)
- case "origin":
- return ec.fieldContext_ConnectionInfo_origin(ctx, field)
- case "authNeeded":
- return ec.fieldContext_ConnectionInfo_authNeeded(ctx, field)
- case "authModel":
- return ec.fieldContext_ConnectionInfo_authModel(ctx, field)
- case "authProperties":
- return ec.fieldContext_ConnectionInfo_authProperties(ctx, field)
- case "providerProperties":
- return ec.fieldContext_ConnectionInfo_providerProperties(ctx, field)
- case "networkHandlersConfig":
- return ec.fieldContext_ConnectionInfo_networkHandlersConfig(ctx, field)
- case "features":
- return ec.fieldContext_ConnectionInfo_features(ctx, field)
- case "navigatorSettings":
- return ec.fieldContext_ConnectionInfo_navigatorSettings(ctx, field)
- case "supportedDataFormats":
- return ec.fieldContext_ConnectionInfo_supportedDataFormats(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ConnectionInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_copyConnectionConfiguration_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_updateConnectionConfiguration(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_updateConnectionConfiguration(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().UpdateConnectionConfiguration(rctx, fc.Args["id"].(string), fc.Args["config"].(model.ConnectionConfig))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.ConnectionInfo)
- fc.Result = res
- return ec.marshalNConnectionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_updateConnectionConfiguration(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ConnectionInfo_id(ctx, field)
- case "driverId":
- return ec.fieldContext_ConnectionInfo_driverId(ctx, field)
- case "name":
- return ec.fieldContext_ConnectionInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_ConnectionInfo_description(ctx, field)
- case "host":
- return ec.fieldContext_ConnectionInfo_host(ctx, field)
- case "port":
- return ec.fieldContext_ConnectionInfo_port(ctx, field)
- case "serverName":
- return ec.fieldContext_ConnectionInfo_serverName(ctx, field)
- case "databaseName":
- return ec.fieldContext_ConnectionInfo_databaseName(ctx, field)
- case "url":
- return ec.fieldContext_ConnectionInfo_url(ctx, field)
- case "properties":
- return ec.fieldContext_ConnectionInfo_properties(ctx, field)
- case "template":
- return ec.fieldContext_ConnectionInfo_template(ctx, field)
- case "connected":
- return ec.fieldContext_ConnectionInfo_connected(ctx, field)
- case "provided":
- return ec.fieldContext_ConnectionInfo_provided(ctx, field)
- case "readOnly":
- return ec.fieldContext_ConnectionInfo_readOnly(ctx, field)
- case "useUrl":
- return ec.fieldContext_ConnectionInfo_useUrl(ctx, field)
- case "saveCredentials":
- return ec.fieldContext_ConnectionInfo_saveCredentials(ctx, field)
- case "folder":
- return ec.fieldContext_ConnectionInfo_folder(ctx, field)
- case "nodePath":
- return ec.fieldContext_ConnectionInfo_nodePath(ctx, field)
- case "connectTime":
- return ec.fieldContext_ConnectionInfo_connectTime(ctx, field)
- case "connectionError":
- return ec.fieldContext_ConnectionInfo_connectionError(ctx, field)
- case "serverVersion":
- return ec.fieldContext_ConnectionInfo_serverVersion(ctx, field)
- case "clientVersion":
- return ec.fieldContext_ConnectionInfo_clientVersion(ctx, field)
- case "origin":
- return ec.fieldContext_ConnectionInfo_origin(ctx, field)
- case "authNeeded":
- return ec.fieldContext_ConnectionInfo_authNeeded(ctx, field)
- case "authModel":
- return ec.fieldContext_ConnectionInfo_authModel(ctx, field)
- case "authProperties":
- return ec.fieldContext_ConnectionInfo_authProperties(ctx, field)
- case "providerProperties":
- return ec.fieldContext_ConnectionInfo_providerProperties(ctx, field)
- case "networkHandlersConfig":
- return ec.fieldContext_ConnectionInfo_networkHandlersConfig(ctx, field)
- case "features":
- return ec.fieldContext_ConnectionInfo_features(ctx, field)
- case "navigatorSettings":
- return ec.fieldContext_ConnectionInfo_navigatorSettings(ctx, field)
- case "supportedDataFormats":
- return ec.fieldContext_ConnectionInfo_supportedDataFormats(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ConnectionInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_updateConnectionConfiguration_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_deleteConnectionConfiguration(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_deleteConnectionConfiguration(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().DeleteConnectionConfiguration(rctx, fc.Args["id"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_deleteConnectionConfiguration(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_deleteConnectionConfiguration_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_getConnectionSubjectAccess(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_getConnectionSubjectAccess(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().GetConnectionSubjectAccess(rctx, fc.Args["connectionId"].(*string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.AdminConnectionGrantInfo)
- fc.Result = res
- return ec.marshalNAdminConnectionGrantInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminConnectionGrantInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_getConnectionSubjectAccess(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "connectionId":
- return ec.fieldContext_AdminConnectionGrantInfo_connectionId(ctx, field)
- case "dataSourceId":
- return ec.fieldContext_AdminConnectionGrantInfo_dataSourceId(ctx, field)
- case "subjectId":
- return ec.fieldContext_AdminConnectionGrantInfo_subjectId(ctx, field)
- case "subjectType":
- return ec.fieldContext_AdminConnectionGrantInfo_subjectType(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AdminConnectionGrantInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_getConnectionSubjectAccess_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_setConnectionSubjectAccess(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_setConnectionSubjectAccess(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().SetConnectionSubjectAccess(rctx, fc.Args["connectionId"].(string), fc.Args["subjects"].([]string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_setConnectionSubjectAccess(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_setConnectionSubjectAccess_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_getSubjectConnectionAccess(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_getSubjectConnectionAccess(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().GetSubjectConnectionAccess(rctx, fc.Args["subjectId"].(*string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.AdminConnectionGrantInfo)
- fc.Result = res
- return ec.marshalNAdminConnectionGrantInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminConnectionGrantInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_getSubjectConnectionAccess(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "connectionId":
- return ec.fieldContext_AdminConnectionGrantInfo_connectionId(ctx, field)
- case "dataSourceId":
- return ec.fieldContext_AdminConnectionGrantInfo_dataSourceId(ctx, field)
- case "subjectId":
- return ec.fieldContext_AdminConnectionGrantInfo_subjectId(ctx, field)
- case "subjectType":
- return ec.fieldContext_AdminConnectionGrantInfo_subjectType(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AdminConnectionGrantInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_getSubjectConnectionAccess_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_setSubjectConnectionAccess(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_setSubjectConnectionAccess(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().SetSubjectConnectionAccess(rctx, fc.Args["subjectId"].(string), fc.Args["connections"].([]string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_setSubjectConnectionAccess(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_setSubjectConnectionAccess_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_listFeatureSets(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_listFeatureSets(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().ListFeatureSets(rctx)
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.WebFeatureSet)
- fc.Result = res
- return ec.marshalNWebFeatureSet2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐWebFeatureSetᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_listFeatureSets(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_WebFeatureSet_id(ctx, field)
- case "label":
- return ec.fieldContext_WebFeatureSet_label(ctx, field)
- case "description":
- return ec.fieldContext_WebFeatureSet_description(ctx, field)
- case "icon":
- return ec.fieldContext_WebFeatureSet_icon(ctx, field)
- case "enabled":
- return ec.fieldContext_WebFeatureSet_enabled(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type WebFeatureSet", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_listAuthProviderConfigurationParameters(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_listAuthProviderConfigurationParameters(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().ListAuthProviderConfigurationParameters(rctx, fc.Args["providerId"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.ObjectPropertyInfo)
- fc.Result = res
- return ec.marshalNObjectPropertyInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_listAuthProviderConfigurationParameters(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ObjectPropertyInfo_id(ctx, field)
- case "displayName":
- return ec.fieldContext_ObjectPropertyInfo_displayName(ctx, field)
- case "description":
- return ec.fieldContext_ObjectPropertyInfo_description(ctx, field)
- case "category":
- return ec.fieldContext_ObjectPropertyInfo_category(ctx, field)
- case "dataType":
- return ec.fieldContext_ObjectPropertyInfo_dataType(ctx, field)
- case "value":
- return ec.fieldContext_ObjectPropertyInfo_value(ctx, field)
- case "validValues":
- return ec.fieldContext_ObjectPropertyInfo_validValues(ctx, field)
- case "defaultValue":
- return ec.fieldContext_ObjectPropertyInfo_defaultValue(ctx, field)
- case "length":
- return ec.fieldContext_ObjectPropertyInfo_length(ctx, field)
- case "features":
- return ec.fieldContext_ObjectPropertyInfo_features(ctx, field)
- case "order":
- return ec.fieldContext_ObjectPropertyInfo_order(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ObjectPropertyInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_listAuthProviderConfigurationParameters_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_listAuthProviderConfigurations(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_listAuthProviderConfigurations(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().ListAuthProviderConfigurations(rctx, fc.Args["providerId"].(*string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.AdminAuthProviderConfiguration)
- fc.Result = res
- return ec.marshalNAdminAuthProviderConfiguration2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminAuthProviderConfigurationᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_listAuthProviderConfigurations(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "providerId":
- return ec.fieldContext_AdminAuthProviderConfiguration_providerId(ctx, field)
- case "id":
- return ec.fieldContext_AdminAuthProviderConfiguration_id(ctx, field)
- case "displayName":
- return ec.fieldContext_AdminAuthProviderConfiguration_displayName(ctx, field)
- case "disabled":
- return ec.fieldContext_AdminAuthProviderConfiguration_disabled(ctx, field)
- case "iconURL":
- return ec.fieldContext_AdminAuthProviderConfiguration_iconURL(ctx, field)
- case "description":
- return ec.fieldContext_AdminAuthProviderConfiguration_description(ctx, field)
- case "parameters":
- return ec.fieldContext_AdminAuthProviderConfiguration_parameters(ctx, field)
- case "signInLink":
- return ec.fieldContext_AdminAuthProviderConfiguration_signInLink(ctx, field)
- case "signOutLink":
- return ec.fieldContext_AdminAuthProviderConfiguration_signOutLink(ctx, field)
- case "redirectLink":
- return ec.fieldContext_AdminAuthProviderConfiguration_redirectLink(ctx, field)
- case "metadataLink":
- return ec.fieldContext_AdminAuthProviderConfiguration_metadataLink(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AdminAuthProviderConfiguration", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_listAuthProviderConfigurations_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_saveAuthProviderConfiguration(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_saveAuthProviderConfiguration(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().SaveAuthProviderConfiguration(rctx, fc.Args["providerId"].(string), fc.Args["id"].(string), fc.Args["displayName"].(*string), fc.Args["disabled"].(*bool), fc.Args["iconURL"].(*string), fc.Args["description"].(*string),
- func() interface{} {
- if fc.Args["parameters"] == nil {
- return nil
- }
- return fc.Args["parameters"].(interface{})
- }())
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.AdminAuthProviderConfiguration)
- fc.Result = res
- return ec.marshalNAdminAuthProviderConfiguration2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminAuthProviderConfiguration(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_saveAuthProviderConfiguration(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "providerId":
- return ec.fieldContext_AdminAuthProviderConfiguration_providerId(ctx, field)
- case "id":
- return ec.fieldContext_AdminAuthProviderConfiguration_id(ctx, field)
- case "displayName":
- return ec.fieldContext_AdminAuthProviderConfiguration_displayName(ctx, field)
- case "disabled":
- return ec.fieldContext_AdminAuthProviderConfiguration_disabled(ctx, field)
- case "iconURL":
- return ec.fieldContext_AdminAuthProviderConfiguration_iconURL(ctx, field)
- case "description":
- return ec.fieldContext_AdminAuthProviderConfiguration_description(ctx, field)
- case "parameters":
- return ec.fieldContext_AdminAuthProviderConfiguration_parameters(ctx, field)
- case "signInLink":
- return ec.fieldContext_AdminAuthProviderConfiguration_signInLink(ctx, field)
- case "signOutLink":
- return ec.fieldContext_AdminAuthProviderConfiguration_signOutLink(ctx, field)
- case "redirectLink":
- return ec.fieldContext_AdminAuthProviderConfiguration_redirectLink(ctx, field)
- case "metadataLink":
- return ec.fieldContext_AdminAuthProviderConfiguration_metadataLink(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AdminAuthProviderConfiguration", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_saveAuthProviderConfiguration_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_deleteAuthProviderConfiguration(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_deleteAuthProviderConfiguration(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().DeleteAuthProviderConfiguration(rctx, fc.Args["id"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_deleteAuthProviderConfiguration(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_deleteAuthProviderConfiguration_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_saveUserMetaParameter(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_saveUserMetaParameter(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().SaveUserMetaParameter(rctx, fc.Args["id"].(string), fc.Args["displayName"].(string), fc.Args["description"].(*string), fc.Args["required"].(bool))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.ObjectPropertyInfo)
- fc.Result = res
- return ec.marshalNObjectPropertyInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_saveUserMetaParameter(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ObjectPropertyInfo_id(ctx, field)
- case "displayName":
- return ec.fieldContext_ObjectPropertyInfo_displayName(ctx, field)
- case "description":
- return ec.fieldContext_ObjectPropertyInfo_description(ctx, field)
- case "category":
- return ec.fieldContext_ObjectPropertyInfo_category(ctx, field)
- case "dataType":
- return ec.fieldContext_ObjectPropertyInfo_dataType(ctx, field)
- case "value":
- return ec.fieldContext_ObjectPropertyInfo_value(ctx, field)
- case "validValues":
- return ec.fieldContext_ObjectPropertyInfo_validValues(ctx, field)
- case "defaultValue":
- return ec.fieldContext_ObjectPropertyInfo_defaultValue(ctx, field)
- case "length":
- return ec.fieldContext_ObjectPropertyInfo_length(ctx, field)
- case "features":
- return ec.fieldContext_ObjectPropertyInfo_features(ctx, field)
- case "order":
- return ec.fieldContext_ObjectPropertyInfo_order(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ObjectPropertyInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_saveUserMetaParameter_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_deleteUserMetaParameter(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_deleteUserMetaParameter(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().DeleteUserMetaParameter(rctx, fc.Args["id"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_deleteUserMetaParameter(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_deleteUserMetaParameter_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_setUserMetaParameterValues(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_setUserMetaParameterValues(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().SetUserMetaParameterValues(rctx, fc.Args["userId"].(string),
- func() interface{} {
- if fc.Args["parameters"] == nil {
- return nil
- }
- return fc.Args["parameters"].(interface{})
- }())
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_setUserMetaParameterValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_setUserMetaParameterValues_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_configureServer(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_configureServer(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().ConfigureServer(rctx, fc.Args["configuration"].(model.ServerConfigInput))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_configureServer(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_configureServer_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_setDefaultNavigatorSettings(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_setDefaultNavigatorSettings(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().SetDefaultNavigatorSettings(rctx, fc.Args["settings"].(model.NavigatorSettingsInput))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_setDefaultNavigatorSettings(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_setDefaultNavigatorSettings_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_authLogin(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_authLogin(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().AuthLogin(rctx, fc.Args["provider"].(string), fc.Args["configuration"].(*string),
- func() interface{} {
- if fc.Args["credentials"] == nil {
- return nil
- }
- return fc.Args["credentials"].(interface{})
- }(), fc.Args["linkUser"].(*bool))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.AuthInfo)
- fc.Result = res
- return ec.marshalNAuthInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_authLogin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "redirectLink":
- return ec.fieldContext_AuthInfo_redirectLink(ctx, field)
- case "authId":
- return ec.fieldContext_AuthInfo_authId(ctx, field)
- case "authStatus":
- return ec.fieldContext_AuthInfo_authStatus(ctx, field)
- case "userTokens":
- return ec.fieldContext_AuthInfo_userTokens(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AuthInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_authLogin_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_authUpdateStatus(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_authUpdateStatus(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().AuthUpdateStatus(rctx, fc.Args["authId"].(string), fc.Args["linkUser"].(*bool))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.AuthInfo)
- fc.Result = res
- return ec.marshalNAuthInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_authUpdateStatus(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "redirectLink":
- return ec.fieldContext_AuthInfo_redirectLink(ctx, field)
- case "authId":
- return ec.fieldContext_AuthInfo_authId(ctx, field)
- case "authStatus":
- return ec.fieldContext_AuthInfo_authStatus(ctx, field)
- case "userTokens":
- return ec.fieldContext_AuthInfo_userTokens(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AuthInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_authUpdateStatus_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_authLogout(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_authLogout(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().AuthLogout(rctx, fc.Args["provider"].(*string), fc.Args["configuration"].(*string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_authLogout(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_authLogout_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_activeUser(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_activeUser(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().ActiveUser(rctx)
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*model.UserInfo)
- fc.Result = res
- return ec.marshalOUserInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐUserInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_activeUser(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "userId":
- return ec.fieldContext_UserInfo_userId(ctx, field)
- case "displayName":
- return ec.fieldContext_UserInfo_displayName(ctx, field)
- case "authRole":
- return ec.fieldContext_UserInfo_authRole(ctx, field)
- case "authTokens":
- return ec.fieldContext_UserInfo_authTokens(ctx, field)
- case "linkedAuthProviders":
- return ec.fieldContext_UserInfo_linkedAuthProviders(ctx, field)
- case "metaParameters":
- return ec.fieldContext_UserInfo_metaParameters(ctx, field)
- case "configurationParameters":
- return ec.fieldContext_UserInfo_configurationParameters(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type UserInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_authProviders(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_authProviders(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().AuthProviders(rctx)
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.AuthProviderInfo)
- fc.Result = res
- return ec.marshalNAuthProviderInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthProviderInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_authProviders(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_AuthProviderInfo_id(ctx, field)
- case "label":
- return ec.fieldContext_AuthProviderInfo_label(ctx, field)
- case "icon":
- return ec.fieldContext_AuthProviderInfo_icon(ctx, field)
- case "description":
- return ec.fieldContext_AuthProviderInfo_description(ctx, field)
- case "defaultProvider":
- return ec.fieldContext_AuthProviderInfo_defaultProvider(ctx, field)
- case "configurable":
- return ec.fieldContext_AuthProviderInfo_configurable(ctx, field)
- case "configurations":
- return ec.fieldContext_AuthProviderInfo_configurations(ctx, field)
- case "credentialProfiles":
- return ec.fieldContext_AuthProviderInfo_credentialProfiles(ctx, field)
- case "requiredFeatures":
- return ec.fieldContext_AuthProviderInfo_requiredFeatures(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AuthProviderInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_authChangeLocalPassword(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_authChangeLocalPassword(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().AuthChangeLocalPassword(rctx, fc.Args["oldPassword"].(string), fc.Args["newPassword"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_authChangeLocalPassword(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_authChangeLocalPassword_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_listUserProfileProperties(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_listUserProfileProperties(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().ListUserProfileProperties(rctx)
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.ObjectPropertyInfo)
- fc.Result = res
- return ec.marshalNObjectPropertyInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_listUserProfileProperties(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ObjectPropertyInfo_id(ctx, field)
- case "displayName":
- return ec.fieldContext_ObjectPropertyInfo_displayName(ctx, field)
- case "description":
- return ec.fieldContext_ObjectPropertyInfo_description(ctx, field)
- case "category":
- return ec.fieldContext_ObjectPropertyInfo_category(ctx, field)
- case "dataType":
- return ec.fieldContext_ObjectPropertyInfo_dataType(ctx, field)
- case "value":
- return ec.fieldContext_ObjectPropertyInfo_value(ctx, field)
- case "validValues":
- return ec.fieldContext_ObjectPropertyInfo_validValues(ctx, field)
- case "defaultValue":
- return ec.fieldContext_ObjectPropertyInfo_defaultValue(ctx, field)
- case "length":
- return ec.fieldContext_ObjectPropertyInfo_length(ctx, field)
- case "features":
- return ec.fieldContext_ObjectPropertyInfo_features(ctx, field)
- case "order":
- return ec.fieldContext_ObjectPropertyInfo_order(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ObjectPropertyInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_serverConfig(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_serverConfig(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().ServerConfig(rctx)
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.ServerConfig)
- fc.Result = res
- return ec.marshalNServerConfig2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐServerConfig(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_serverConfig(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "name":
- return ec.fieldContext_ServerConfig_name(ctx, field)
- case "version":
- return ec.fieldContext_ServerConfig_version(ctx, field)
- case "workspaceId":
- return ec.fieldContext_ServerConfig_workspaceId(ctx, field)
- case "serverURL":
- return ec.fieldContext_ServerConfig_serverURL(ctx, field)
- case "rootURI":
- return ec.fieldContext_ServerConfig_rootURI(ctx, field)
- case "hostName":
- return ec.fieldContext_ServerConfig_hostName(ctx, field)
- case "anonymousAccessEnabled":
- return ec.fieldContext_ServerConfig_anonymousAccessEnabled(ctx, field)
- case "authenticationEnabled":
- return ec.fieldContext_ServerConfig_authenticationEnabled(ctx, field)
- case "supportsCustomConnections":
- return ec.fieldContext_ServerConfig_supportsCustomConnections(ctx, field)
- case "supportsConnectionBrowser":
- return ec.fieldContext_ServerConfig_supportsConnectionBrowser(ctx, field)
- case "supportsWorkspaces":
- return ec.fieldContext_ServerConfig_supportsWorkspaces(ctx, field)
- case "resourceManagerEnabled":
- return ec.fieldContext_ServerConfig_resourceManagerEnabled(ctx, field)
- case "publicCredentialsSaveEnabled":
- return ec.fieldContext_ServerConfig_publicCredentialsSaveEnabled(ctx, field)
- case "adminCredentialsSaveEnabled":
- return ec.fieldContext_ServerConfig_adminCredentialsSaveEnabled(ctx, field)
- case "licenseRequired":
- return ec.fieldContext_ServerConfig_licenseRequired(ctx, field)
- case "licenseValid":
- return ec.fieldContext_ServerConfig_licenseValid(ctx, field)
- case "sessionExpireTime":
- return ec.fieldContext_ServerConfig_sessionExpireTime(ctx, field)
- case "localHostAddress":
- return ec.fieldContext_ServerConfig_localHostAddress(ctx, field)
- case "configurationMode":
- return ec.fieldContext_ServerConfig_configurationMode(ctx, field)
- case "developmentMode":
- return ec.fieldContext_ServerConfig_developmentMode(ctx, field)
- case "redirectOnFederatedAuth":
- return ec.fieldContext_ServerConfig_redirectOnFederatedAuth(ctx, field)
- case "enabledFeatures":
- return ec.fieldContext_ServerConfig_enabledFeatures(ctx, field)
- case "enabledAuthProviders":
- return ec.fieldContext_ServerConfig_enabledAuthProviders(ctx, field)
- case "supportedLanguages":
- return ec.fieldContext_ServerConfig_supportedLanguages(ctx, field)
- case "services":
- return ec.fieldContext_ServerConfig_services(ctx, field)
- case "productConfiguration":
- return ec.fieldContext_ServerConfig_productConfiguration(ctx, field)
- case "productInfo":
- return ec.fieldContext_ServerConfig_productInfo(ctx, field)
- case "defaultNavigatorSettings":
- return ec.fieldContext_ServerConfig_defaultNavigatorSettings(ctx, field)
- case "disabledDrivers":
- return ec.fieldContext_ServerConfig_disabledDrivers(ctx, field)
- case "resourceQuotas":
- return ec.fieldContext_ServerConfig_resourceQuotas(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ServerConfig", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_sessionState(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_sessionState(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().SessionState(rctx)
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.SessionInfo)
- fc.Result = res
- return ec.marshalNSessionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSessionInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_sessionState(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "createTime":
- return ec.fieldContext_SessionInfo_createTime(ctx, field)
- case "lastAccessTime":
- return ec.fieldContext_SessionInfo_lastAccessTime(ctx, field)
- case "locale":
- return ec.fieldContext_SessionInfo_locale(ctx, field)
- case "cacheExpired":
- return ec.fieldContext_SessionInfo_cacheExpired(ctx, field)
- case "serverMessages":
- return ec.fieldContext_SessionInfo_serverMessages(ctx, field)
- case "connections":
- return ec.fieldContext_SessionInfo_connections(ctx, field)
- case "actionParameters":
- return ec.fieldContext_SessionInfo_actionParameters(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type SessionInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_sessionPermissions(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_sessionPermissions(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().SessionPermissions(rctx)
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*string)
- fc.Result = res
- return ec.marshalNID2ᚕᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_sessionPermissions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_driverList(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_driverList(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().DriverList(rctx, fc.Args["id"].(*string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.DriverInfo)
- fc.Result = res
- return ec.marshalNDriverInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDriverInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_driverList(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_DriverInfo_id(ctx, field)
- case "name":
- return ec.fieldContext_DriverInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_DriverInfo_description(ctx, field)
- case "icon":
- return ec.fieldContext_DriverInfo_icon(ctx, field)
- case "iconBig":
- return ec.fieldContext_DriverInfo_iconBig(ctx, field)
- case "providerId":
- return ec.fieldContext_DriverInfo_providerId(ctx, field)
- case "driverClassName":
- return ec.fieldContext_DriverInfo_driverClassName(ctx, field)
- case "defaultHost":
- return ec.fieldContext_DriverInfo_defaultHost(ctx, field)
- case "defaultPort":
- return ec.fieldContext_DriverInfo_defaultPort(ctx, field)
- case "defaultDatabase":
- return ec.fieldContext_DriverInfo_defaultDatabase(ctx, field)
- case "defaultServer":
- return ec.fieldContext_DriverInfo_defaultServer(ctx, field)
- case "defaultUser":
- return ec.fieldContext_DriverInfo_defaultUser(ctx, field)
- case "sampleURL":
- return ec.fieldContext_DriverInfo_sampleURL(ctx, field)
- case "driverInfoURL":
- return ec.fieldContext_DriverInfo_driverInfoURL(ctx, field)
- case "driverPropertiesURL":
- return ec.fieldContext_DriverInfo_driverPropertiesURL(ctx, field)
- case "embedded":
- return ec.fieldContext_DriverInfo_embedded(ctx, field)
- case "enabled":
- return ec.fieldContext_DriverInfo_enabled(ctx, field)
- case "requiresServerName":
- return ec.fieldContext_DriverInfo_requiresServerName(ctx, field)
- case "allowsEmptyPassword":
- return ec.fieldContext_DriverInfo_allowsEmptyPassword(ctx, field)
- case "licenseRequired":
- return ec.fieldContext_DriverInfo_licenseRequired(ctx, field)
- case "license":
- return ec.fieldContext_DriverInfo_license(ctx, field)
- case "custom":
- return ec.fieldContext_DriverInfo_custom(ctx, field)
- case "promotedScore":
- return ec.fieldContext_DriverInfo_promotedScore(ctx, field)
- case "driverProperties":
- return ec.fieldContext_DriverInfo_driverProperties(ctx, field)
- case "driverParameters":
- return ec.fieldContext_DriverInfo_driverParameters(ctx, field)
- case "providerProperties":
- return ec.fieldContext_DriverInfo_providerProperties(ctx, field)
- case "anonymousAccess":
- return ec.fieldContext_DriverInfo_anonymousAccess(ctx, field)
- case "defaultAuthModel":
- return ec.fieldContext_DriverInfo_defaultAuthModel(ctx, field)
- case "applicableAuthModels":
- return ec.fieldContext_DriverInfo_applicableAuthModels(ctx, field)
- case "applicableNetworkHandlers":
- return ec.fieldContext_DriverInfo_applicableNetworkHandlers(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type DriverInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_driverList_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_authModels(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_authModels(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().AuthModels(rctx)
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.DatabaseAuthModel)
- fc.Result = res
- return ec.marshalNDatabaseAuthModel2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDatabaseAuthModelᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_authModels(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_DatabaseAuthModel_id(ctx, field)
- case "displayName":
- return ec.fieldContext_DatabaseAuthModel_displayName(ctx, field)
- case "description":
- return ec.fieldContext_DatabaseAuthModel_description(ctx, field)
- case "icon":
- return ec.fieldContext_DatabaseAuthModel_icon(ctx, field)
- case "requiresLocalConfiguration":
- return ec.fieldContext_DatabaseAuthModel_requiresLocalConfiguration(ctx, field)
- case "properties":
- return ec.fieldContext_DatabaseAuthModel_properties(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type DatabaseAuthModel", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_networkHandlers(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_networkHandlers(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().NetworkHandlers(rctx)
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.NetworkHandlerDescriptor)
- fc.Result = res
- return ec.marshalNNetworkHandlerDescriptor2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerDescriptorᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_networkHandlers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_NetworkHandlerDescriptor_id(ctx, field)
- case "codeName":
- return ec.fieldContext_NetworkHandlerDescriptor_codeName(ctx, field)
- case "label":
- return ec.fieldContext_NetworkHandlerDescriptor_label(ctx, field)
- case "description":
- return ec.fieldContext_NetworkHandlerDescriptor_description(ctx, field)
- case "secured":
- return ec.fieldContext_NetworkHandlerDescriptor_secured(ctx, field)
- case "type":
- return ec.fieldContext_NetworkHandlerDescriptor_type(ctx, field)
- case "properties":
- return ec.fieldContext_NetworkHandlerDescriptor_properties(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type NetworkHandlerDescriptor", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_userConnections(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_userConnections(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().UserConnections(rctx, fc.Args["id"].(*string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.ConnectionInfo)
- fc.Result = res
- return ec.marshalNConnectionInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_userConnections(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ConnectionInfo_id(ctx, field)
- case "driverId":
- return ec.fieldContext_ConnectionInfo_driverId(ctx, field)
- case "name":
- return ec.fieldContext_ConnectionInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_ConnectionInfo_description(ctx, field)
- case "host":
- return ec.fieldContext_ConnectionInfo_host(ctx, field)
- case "port":
- return ec.fieldContext_ConnectionInfo_port(ctx, field)
- case "serverName":
- return ec.fieldContext_ConnectionInfo_serverName(ctx, field)
- case "databaseName":
- return ec.fieldContext_ConnectionInfo_databaseName(ctx, field)
- case "url":
- return ec.fieldContext_ConnectionInfo_url(ctx, field)
- case "properties":
- return ec.fieldContext_ConnectionInfo_properties(ctx, field)
- case "template":
- return ec.fieldContext_ConnectionInfo_template(ctx, field)
- case "connected":
- return ec.fieldContext_ConnectionInfo_connected(ctx, field)
- case "provided":
- return ec.fieldContext_ConnectionInfo_provided(ctx, field)
- case "readOnly":
- return ec.fieldContext_ConnectionInfo_readOnly(ctx, field)
- case "useUrl":
- return ec.fieldContext_ConnectionInfo_useUrl(ctx, field)
- case "saveCredentials":
- return ec.fieldContext_ConnectionInfo_saveCredentials(ctx, field)
- case "folder":
- return ec.fieldContext_ConnectionInfo_folder(ctx, field)
- case "nodePath":
- return ec.fieldContext_ConnectionInfo_nodePath(ctx, field)
- case "connectTime":
- return ec.fieldContext_ConnectionInfo_connectTime(ctx, field)
- case "connectionError":
- return ec.fieldContext_ConnectionInfo_connectionError(ctx, field)
- case "serverVersion":
- return ec.fieldContext_ConnectionInfo_serverVersion(ctx, field)
- case "clientVersion":
- return ec.fieldContext_ConnectionInfo_clientVersion(ctx, field)
- case "origin":
- return ec.fieldContext_ConnectionInfo_origin(ctx, field)
- case "authNeeded":
- return ec.fieldContext_ConnectionInfo_authNeeded(ctx, field)
- case "authModel":
- return ec.fieldContext_ConnectionInfo_authModel(ctx, field)
- case "authProperties":
- return ec.fieldContext_ConnectionInfo_authProperties(ctx, field)
- case "providerProperties":
- return ec.fieldContext_ConnectionInfo_providerProperties(ctx, field)
- case "networkHandlersConfig":
- return ec.fieldContext_ConnectionInfo_networkHandlersConfig(ctx, field)
- case "features":
- return ec.fieldContext_ConnectionInfo_features(ctx, field)
- case "navigatorSettings":
- return ec.fieldContext_ConnectionInfo_navigatorSettings(ctx, field)
- case "supportedDataFormats":
- return ec.fieldContext_ConnectionInfo_supportedDataFormats(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ConnectionInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_userConnections_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_templateConnections(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_templateConnections(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().TemplateConnections(rctx)
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.ConnectionInfo)
- fc.Result = res
- return ec.marshalNConnectionInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_templateConnections(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ConnectionInfo_id(ctx, field)
- case "driverId":
- return ec.fieldContext_ConnectionInfo_driverId(ctx, field)
- case "name":
- return ec.fieldContext_ConnectionInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_ConnectionInfo_description(ctx, field)
- case "host":
- return ec.fieldContext_ConnectionInfo_host(ctx, field)
- case "port":
- return ec.fieldContext_ConnectionInfo_port(ctx, field)
- case "serverName":
- return ec.fieldContext_ConnectionInfo_serverName(ctx, field)
- case "databaseName":
- return ec.fieldContext_ConnectionInfo_databaseName(ctx, field)
- case "url":
- return ec.fieldContext_ConnectionInfo_url(ctx, field)
- case "properties":
- return ec.fieldContext_ConnectionInfo_properties(ctx, field)
- case "template":
- return ec.fieldContext_ConnectionInfo_template(ctx, field)
- case "connected":
- return ec.fieldContext_ConnectionInfo_connected(ctx, field)
- case "provided":
- return ec.fieldContext_ConnectionInfo_provided(ctx, field)
- case "readOnly":
- return ec.fieldContext_ConnectionInfo_readOnly(ctx, field)
- case "useUrl":
- return ec.fieldContext_ConnectionInfo_useUrl(ctx, field)
- case "saveCredentials":
- return ec.fieldContext_ConnectionInfo_saveCredentials(ctx, field)
- case "folder":
- return ec.fieldContext_ConnectionInfo_folder(ctx, field)
- case "nodePath":
- return ec.fieldContext_ConnectionInfo_nodePath(ctx, field)
- case "connectTime":
- return ec.fieldContext_ConnectionInfo_connectTime(ctx, field)
- case "connectionError":
- return ec.fieldContext_ConnectionInfo_connectionError(ctx, field)
- case "serverVersion":
- return ec.fieldContext_ConnectionInfo_serverVersion(ctx, field)
- case "clientVersion":
- return ec.fieldContext_ConnectionInfo_clientVersion(ctx, field)
- case "origin":
- return ec.fieldContext_ConnectionInfo_origin(ctx, field)
- case "authNeeded":
- return ec.fieldContext_ConnectionInfo_authNeeded(ctx, field)
- case "authModel":
- return ec.fieldContext_ConnectionInfo_authModel(ctx, field)
- case "authProperties":
- return ec.fieldContext_ConnectionInfo_authProperties(ctx, field)
- case "providerProperties":
- return ec.fieldContext_ConnectionInfo_providerProperties(ctx, field)
- case "networkHandlersConfig":
- return ec.fieldContext_ConnectionInfo_networkHandlersConfig(ctx, field)
- case "features":
- return ec.fieldContext_ConnectionInfo_features(ctx, field)
- case "navigatorSettings":
- return ec.fieldContext_ConnectionInfo_navigatorSettings(ctx, field)
- case "supportedDataFormats":
- return ec.fieldContext_ConnectionInfo_supportedDataFormats(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ConnectionInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_connectionFolders(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_connectionFolders(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().ConnectionFolders(rctx, fc.Args["path"].(*string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.ConnectionFolderInfo)
- fc.Result = res
- return ec.marshalNConnectionFolderInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionFolderInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_connectionFolders(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ConnectionFolderInfo_id(ctx, field)
- case "description":
- return ec.fieldContext_ConnectionFolderInfo_description(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ConnectionFolderInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_connectionFolders_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_connectionState(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_connectionState(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().ConnectionState(rctx, fc.Args["id"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.ConnectionInfo)
- fc.Result = res
- return ec.marshalNConnectionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_connectionState(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ConnectionInfo_id(ctx, field)
- case "driverId":
- return ec.fieldContext_ConnectionInfo_driverId(ctx, field)
- case "name":
- return ec.fieldContext_ConnectionInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_ConnectionInfo_description(ctx, field)
- case "host":
- return ec.fieldContext_ConnectionInfo_host(ctx, field)
- case "port":
- return ec.fieldContext_ConnectionInfo_port(ctx, field)
- case "serverName":
- return ec.fieldContext_ConnectionInfo_serverName(ctx, field)
- case "databaseName":
- return ec.fieldContext_ConnectionInfo_databaseName(ctx, field)
- case "url":
- return ec.fieldContext_ConnectionInfo_url(ctx, field)
- case "properties":
- return ec.fieldContext_ConnectionInfo_properties(ctx, field)
- case "template":
- return ec.fieldContext_ConnectionInfo_template(ctx, field)
- case "connected":
- return ec.fieldContext_ConnectionInfo_connected(ctx, field)
- case "provided":
- return ec.fieldContext_ConnectionInfo_provided(ctx, field)
- case "readOnly":
- return ec.fieldContext_ConnectionInfo_readOnly(ctx, field)
- case "useUrl":
- return ec.fieldContext_ConnectionInfo_useUrl(ctx, field)
- case "saveCredentials":
- return ec.fieldContext_ConnectionInfo_saveCredentials(ctx, field)
- case "folder":
- return ec.fieldContext_ConnectionInfo_folder(ctx, field)
- case "nodePath":
- return ec.fieldContext_ConnectionInfo_nodePath(ctx, field)
- case "connectTime":
- return ec.fieldContext_ConnectionInfo_connectTime(ctx, field)
- case "connectionError":
- return ec.fieldContext_ConnectionInfo_connectionError(ctx, field)
- case "serverVersion":
- return ec.fieldContext_ConnectionInfo_serverVersion(ctx, field)
- case "clientVersion":
- return ec.fieldContext_ConnectionInfo_clientVersion(ctx, field)
- case "origin":
- return ec.fieldContext_ConnectionInfo_origin(ctx, field)
- case "authNeeded":
- return ec.fieldContext_ConnectionInfo_authNeeded(ctx, field)
- case "authModel":
- return ec.fieldContext_ConnectionInfo_authModel(ctx, field)
- case "authProperties":
- return ec.fieldContext_ConnectionInfo_authProperties(ctx, field)
- case "providerProperties":
- return ec.fieldContext_ConnectionInfo_providerProperties(ctx, field)
- case "networkHandlersConfig":
- return ec.fieldContext_ConnectionInfo_networkHandlersConfig(ctx, field)
- case "features":
- return ec.fieldContext_ConnectionInfo_features(ctx, field)
- case "navigatorSettings":
- return ec.fieldContext_ConnectionInfo_navigatorSettings(ctx, field)
- case "supportedDataFormats":
- return ec.fieldContext_ConnectionInfo_supportedDataFormats(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ConnectionInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_connectionState_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_connectionInfo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_connectionInfo(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().ConnectionInfo(rctx, fc.Args["id"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.ConnectionInfo)
- fc.Result = res
- return ec.marshalNConnectionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_connectionInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ConnectionInfo_id(ctx, field)
- case "driverId":
- return ec.fieldContext_ConnectionInfo_driverId(ctx, field)
- case "name":
- return ec.fieldContext_ConnectionInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_ConnectionInfo_description(ctx, field)
- case "host":
- return ec.fieldContext_ConnectionInfo_host(ctx, field)
- case "port":
- return ec.fieldContext_ConnectionInfo_port(ctx, field)
- case "serverName":
- return ec.fieldContext_ConnectionInfo_serverName(ctx, field)
- case "databaseName":
- return ec.fieldContext_ConnectionInfo_databaseName(ctx, field)
- case "url":
- return ec.fieldContext_ConnectionInfo_url(ctx, field)
- case "properties":
- return ec.fieldContext_ConnectionInfo_properties(ctx, field)
- case "template":
- return ec.fieldContext_ConnectionInfo_template(ctx, field)
- case "connected":
- return ec.fieldContext_ConnectionInfo_connected(ctx, field)
- case "provided":
- return ec.fieldContext_ConnectionInfo_provided(ctx, field)
- case "readOnly":
- return ec.fieldContext_ConnectionInfo_readOnly(ctx, field)
- case "useUrl":
- return ec.fieldContext_ConnectionInfo_useUrl(ctx, field)
- case "saveCredentials":
- return ec.fieldContext_ConnectionInfo_saveCredentials(ctx, field)
- case "folder":
- return ec.fieldContext_ConnectionInfo_folder(ctx, field)
- case "nodePath":
- return ec.fieldContext_ConnectionInfo_nodePath(ctx, field)
- case "connectTime":
- return ec.fieldContext_ConnectionInfo_connectTime(ctx, field)
- case "connectionError":
- return ec.fieldContext_ConnectionInfo_connectionError(ctx, field)
- case "serverVersion":
- return ec.fieldContext_ConnectionInfo_serverVersion(ctx, field)
- case "clientVersion":
- return ec.fieldContext_ConnectionInfo_clientVersion(ctx, field)
- case "origin":
- return ec.fieldContext_ConnectionInfo_origin(ctx, field)
- case "authNeeded":
- return ec.fieldContext_ConnectionInfo_authNeeded(ctx, field)
- case "authModel":
- return ec.fieldContext_ConnectionInfo_authModel(ctx, field)
- case "authProperties":
- return ec.fieldContext_ConnectionInfo_authProperties(ctx, field)
- case "providerProperties":
- return ec.fieldContext_ConnectionInfo_providerProperties(ctx, field)
- case "networkHandlersConfig":
- return ec.fieldContext_ConnectionInfo_networkHandlersConfig(ctx, field)
- case "features":
- return ec.fieldContext_ConnectionInfo_features(ctx, field)
- case "navigatorSettings":
- return ec.fieldContext_ConnectionInfo_navigatorSettings(ctx, field)
- case "supportedDataFormats":
- return ec.fieldContext_ConnectionInfo_supportedDataFormats(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ConnectionInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_connectionInfo_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_readSessionLog(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_readSessionLog(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().ReadSessionLog(rctx, fc.Args["maxEntries"].(*int), fc.Args["clearEntries"].(*bool))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.LogEntry)
- fc.Result = res
- return ec.marshalNLogEntry2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐLogEntryᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_readSessionLog(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "time":
- return ec.fieldContext_LogEntry_time(ctx, field)
- case "type":
- return ec.fieldContext_LogEntry_type(ctx, field)
- case "message":
- return ec.fieldContext_LogEntry_message(ctx, field)
- case "stackTrace":
- return ec.fieldContext_LogEntry_stackTrace(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type LogEntry", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_readSessionLog_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_dataTransferAvailableStreamProcessors(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_dataTransferAvailableStreamProcessors(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().DataTransferAvailableStreamProcessors(rctx)
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.DataTransferProcessorInfo)
- fc.Result = res
- return ec.marshalNDataTransferProcessorInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDataTransferProcessorInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_dataTransferAvailableStreamProcessors(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_DataTransferProcessorInfo_id(ctx, field)
- case "name":
- return ec.fieldContext_DataTransferProcessorInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_DataTransferProcessorInfo_description(ctx, field)
- case "fileExtension":
- return ec.fieldContext_DataTransferProcessorInfo_fileExtension(ctx, field)
- case "appFileExtension":
- return ec.fieldContext_DataTransferProcessorInfo_appFileExtension(ctx, field)
- case "appName":
- return ec.fieldContext_DataTransferProcessorInfo_appName(ctx, field)
- case "order":
- return ec.fieldContext_DataTransferProcessorInfo_order(ctx, field)
- case "icon":
- return ec.fieldContext_DataTransferProcessorInfo_icon(ctx, field)
- case "properties":
- return ec.fieldContext_DataTransferProcessorInfo_properties(ctx, field)
- case "isBinary":
- return ec.fieldContext_DataTransferProcessorInfo_isBinary(ctx, field)
- case "isHTML":
- return ec.fieldContext_DataTransferProcessorInfo_isHTML(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type DataTransferProcessorInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_dataTransferExportDataFromContainer(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_dataTransferExportDataFromContainer(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().DataTransferExportDataFromContainer(rctx, fc.Args["connectionId"].(string), fc.Args["containerNodePath"].(string), fc.Args["parameters"].(model.DataTransferParameters))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.AsyncTaskInfo)
- fc.Result = res
- return ec.marshalNAsyncTaskInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAsyncTaskInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_dataTransferExportDataFromContainer(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_AsyncTaskInfo_id(ctx, field)
- case "name":
- return ec.fieldContext_AsyncTaskInfo_name(ctx, field)
- case "running":
- return ec.fieldContext_AsyncTaskInfo_running(ctx, field)
- case "status":
- return ec.fieldContext_AsyncTaskInfo_status(ctx, field)
- case "error":
- return ec.fieldContext_AsyncTaskInfo_error(ctx, field)
- case "result":
- return ec.fieldContext_AsyncTaskInfo_result(ctx, field)
- case "taskResult":
- return ec.fieldContext_AsyncTaskInfo_taskResult(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AsyncTaskInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_dataTransferExportDataFromContainer_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_dataTransferExportDataFromResults(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_dataTransferExportDataFromResults(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().DataTransferExportDataFromResults(rctx, fc.Args["connectionId"].(string), fc.Args["contextId"].(string), fc.Args["resultsId"].(string), fc.Args["parameters"].(model.DataTransferParameters))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.AsyncTaskInfo)
- fc.Result = res
- return ec.marshalNAsyncTaskInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAsyncTaskInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_dataTransferExportDataFromResults(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_AsyncTaskInfo_id(ctx, field)
- case "name":
- return ec.fieldContext_AsyncTaskInfo_name(ctx, field)
- case "running":
- return ec.fieldContext_AsyncTaskInfo_running(ctx, field)
- case "status":
- return ec.fieldContext_AsyncTaskInfo_status(ctx, field)
- case "error":
- return ec.fieldContext_AsyncTaskInfo_error(ctx, field)
- case "result":
- return ec.fieldContext_AsyncTaskInfo_result(ctx, field)
- case "taskResult":
- return ec.fieldContext_AsyncTaskInfo_taskResult(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type AsyncTaskInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_dataTransferExportDataFromResults_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_dataTransferRemoveDataFile(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_dataTransferRemoveDataFile(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().DataTransferRemoveDataFile(rctx, fc.Args["dataFileId"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_dataTransferRemoveDataFile(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_dataTransferRemoveDataFile_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_metadataGetNodeDDL(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_metadataGetNodeDDL(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().MetadataGetNodeDdl(rctx, fc.Args["nodeId"].(string),
- func() interface{} {
- if fc.Args["options"] == nil {
- return nil
- }
- return fc.Args["options"].(interface{})
- }())
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_metadataGetNodeDDL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_metadataGetNodeDDL_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_navNodeChildren(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_navNodeChildren(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().NavNodeChildren(rctx, fc.Args["parentPath"].(string), fc.Args["offset"].(*int), fc.Args["limit"].(*int), fc.Args["onlyFolders"].(*bool))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.NavigatorNodeInfo)
- fc.Result = res
- return ec.marshalNNavigatorNodeInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNavigatorNodeInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_navNodeChildren(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_NavigatorNodeInfo_id(ctx, field)
- case "name":
- return ec.fieldContext_NavigatorNodeInfo_name(ctx, field)
- case "fullName":
- return ec.fieldContext_NavigatorNodeInfo_fullName(ctx, field)
- case "icon":
- return ec.fieldContext_NavigatorNodeInfo_icon(ctx, field)
- case "description":
- return ec.fieldContext_NavigatorNodeInfo_description(ctx, field)
- case "nodeType":
- return ec.fieldContext_NavigatorNodeInfo_nodeType(ctx, field)
- case "hasChildren":
- return ec.fieldContext_NavigatorNodeInfo_hasChildren(ctx, field)
- case "object":
- return ec.fieldContext_NavigatorNodeInfo_object(ctx, field)
- case "features":
- return ec.fieldContext_NavigatorNodeInfo_features(ctx, field)
- case "nodeDetails":
- return ec.fieldContext_NavigatorNodeInfo_nodeDetails(ctx, field)
- case "folder":
- return ec.fieldContext_NavigatorNodeInfo_folder(ctx, field)
- case "inline":
- return ec.fieldContext_NavigatorNodeInfo_inline(ctx, field)
- case "navigable":
- return ec.fieldContext_NavigatorNodeInfo_navigable(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type NavigatorNodeInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_navNodeChildren_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_navNodeParents(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_navNodeParents(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().NavNodeParents(rctx, fc.Args["nodePath"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.NavigatorNodeInfo)
- fc.Result = res
- return ec.marshalNNavigatorNodeInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNavigatorNodeInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_navNodeParents(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_NavigatorNodeInfo_id(ctx, field)
- case "name":
- return ec.fieldContext_NavigatorNodeInfo_name(ctx, field)
- case "fullName":
- return ec.fieldContext_NavigatorNodeInfo_fullName(ctx, field)
- case "icon":
- return ec.fieldContext_NavigatorNodeInfo_icon(ctx, field)
- case "description":
- return ec.fieldContext_NavigatorNodeInfo_description(ctx, field)
- case "nodeType":
- return ec.fieldContext_NavigatorNodeInfo_nodeType(ctx, field)
- case "hasChildren":
- return ec.fieldContext_NavigatorNodeInfo_hasChildren(ctx, field)
- case "object":
- return ec.fieldContext_NavigatorNodeInfo_object(ctx, field)
- case "features":
- return ec.fieldContext_NavigatorNodeInfo_features(ctx, field)
- case "nodeDetails":
- return ec.fieldContext_NavigatorNodeInfo_nodeDetails(ctx, field)
- case "folder":
- return ec.fieldContext_NavigatorNodeInfo_folder(ctx, field)
- case "inline":
- return ec.fieldContext_NavigatorNodeInfo_inline(ctx, field)
- case "navigable":
- return ec.fieldContext_NavigatorNodeInfo_navigable(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type NavigatorNodeInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_navNodeParents_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_navNodeInfo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_navNodeInfo(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().NavNodeInfo(rctx, fc.Args["nodePath"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.NavigatorNodeInfo)
- fc.Result = res
- return ec.marshalNNavigatorNodeInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNavigatorNodeInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_navNodeInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_NavigatorNodeInfo_id(ctx, field)
- case "name":
- return ec.fieldContext_NavigatorNodeInfo_name(ctx, field)
- case "fullName":
- return ec.fieldContext_NavigatorNodeInfo_fullName(ctx, field)
- case "icon":
- return ec.fieldContext_NavigatorNodeInfo_icon(ctx, field)
- case "description":
- return ec.fieldContext_NavigatorNodeInfo_description(ctx, field)
- case "nodeType":
- return ec.fieldContext_NavigatorNodeInfo_nodeType(ctx, field)
- case "hasChildren":
- return ec.fieldContext_NavigatorNodeInfo_hasChildren(ctx, field)
- case "object":
- return ec.fieldContext_NavigatorNodeInfo_object(ctx, field)
- case "features":
- return ec.fieldContext_NavigatorNodeInfo_features(ctx, field)
- case "nodeDetails":
- return ec.fieldContext_NavigatorNodeInfo_nodeDetails(ctx, field)
- case "folder":
- return ec.fieldContext_NavigatorNodeInfo_folder(ctx, field)
- case "inline":
- return ec.fieldContext_NavigatorNodeInfo_inline(ctx, field)
- case "navigable":
- return ec.fieldContext_NavigatorNodeInfo_navigable(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type NavigatorNodeInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_navNodeInfo_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_navRefreshNode(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_navRefreshNode(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().NavRefreshNode(rctx, fc.Args["nodePath"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_navRefreshNode(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_navRefreshNode_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_navGetStructContainers(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_navGetStructContainers(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().NavGetStructContainers(rctx, fc.Args["connectionId"].(string), fc.Args["contextId"].(*string), fc.Args["catalog"].(*string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.DatabaseStructContainers)
- fc.Result = res
- return ec.marshalNDatabaseStructContainers2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDatabaseStructContainers(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_navGetStructContainers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "catalogList":
- return ec.fieldContext_DatabaseStructContainers_catalogList(ctx, field)
- case "schemaList":
- return ec.fieldContext_DatabaseStructContainers_schemaList(ctx, field)
- case "supportsCatalogChange":
- return ec.fieldContext_DatabaseStructContainers_supportsCatalogChange(ctx, field)
- case "supportsSchemaChange":
- return ec.fieldContext_DatabaseStructContainers_supportsSchemaChange(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type DatabaseStructContainers", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_navGetStructContainers_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_rmListProjects(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_rmListProjects(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().RmListProjects(rctx)
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.RMProject)
- fc.Result = res
- return ec.marshalNRMProject2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐRMProjectᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_rmListProjects(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_RMProject_id(ctx, field)
- case "name":
- return ec.fieldContext_RMProject_name(ctx, field)
- case "description":
- return ec.fieldContext_RMProject_description(ctx, field)
- case "shared":
- return ec.fieldContext_RMProject_shared(ctx, field)
- case "createTime":
- return ec.fieldContext_RMProject_createTime(ctx, field)
- case "creator":
- return ec.fieldContext_RMProject_creator(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type RMProject", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_rmListResources(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_rmListResources(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().RmListResources(rctx, fc.Args["projectId"].(string), fc.Args["folder"].(*string), fc.Args["nameMask"].(*string), fc.Args["readProperties"].(*bool), fc.Args["readHistory"].(*bool))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.RMResource)
- fc.Result = res
- return ec.marshalNRMResource2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐRMResourceᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_rmListResources(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "name":
- return ec.fieldContext_RMResource_name(ctx, field)
- case "folder":
- return ec.fieldContext_RMResource_folder(ctx, field)
- case "length":
- return ec.fieldContext_RMResource_length(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type RMResource", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_rmListResources_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_rmReadResourceAsString(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_rmReadResourceAsString(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().RmReadResourceAsString(rctx, fc.Args["projectId"].(string), fc.Args["resourcePath"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_rmReadResourceAsString(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_rmReadResourceAsString_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_sqlDialectInfo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_sqlDialectInfo(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().SQLDialectInfo(rctx, fc.Args["connectionId"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*model.SQLDialectInfo)
- fc.Result = res
- return ec.marshalOSQLDialectInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLDialectInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_sqlDialectInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "name":
- return ec.fieldContext_SQLDialectInfo_name(ctx, field)
- case "dataTypes":
- return ec.fieldContext_SQLDialectInfo_dataTypes(ctx, field)
- case "functions":
- return ec.fieldContext_SQLDialectInfo_functions(ctx, field)
- case "reservedWords":
- return ec.fieldContext_SQLDialectInfo_reservedWords(ctx, field)
- case "quoteStrings":
- return ec.fieldContext_SQLDialectInfo_quoteStrings(ctx, field)
- case "singleLineComments":
- return ec.fieldContext_SQLDialectInfo_singleLineComments(ctx, field)
- case "multiLineComments":
- return ec.fieldContext_SQLDialectInfo_multiLineComments(ctx, field)
- case "catalogSeparator":
- return ec.fieldContext_SQLDialectInfo_catalogSeparator(ctx, field)
- case "structSeparator":
- return ec.fieldContext_SQLDialectInfo_structSeparator(ctx, field)
- case "scriptDelimiter":
- return ec.fieldContext_SQLDialectInfo_scriptDelimiter(ctx, field)
- case "supportsExplainExecutionPlan":
- return ec.fieldContext_SQLDialectInfo_supportsExplainExecutionPlan(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type SQLDialectInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_sqlDialectInfo_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_sqlListContexts(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_sqlListContexts(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().SQLListContexts(rctx, fc.Args["connectionId"].(*string), fc.Args["contextId"].(*string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.SQLContextInfo)
- fc.Result = res
- return ec.marshalNSQLContextInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLContextInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_sqlListContexts(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_SQLContextInfo_id(ctx, field)
- case "connectionId":
- return ec.fieldContext_SQLContextInfo_connectionId(ctx, field)
- case "defaultCatalog":
- return ec.fieldContext_SQLContextInfo_defaultCatalog(ctx, field)
- case "defaultSchema":
- return ec.fieldContext_SQLContextInfo_defaultSchema(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type SQLContextInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_sqlListContexts_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_sqlCompletionProposals(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_sqlCompletionProposals(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().SQLCompletionProposals(rctx, fc.Args["connectionId"].(string), fc.Args["contextId"].(string), fc.Args["query"].(string), fc.Args["position"].(int), fc.Args["maxResults"].(*int), fc.Args["simpleMode"].(*bool))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([]*model.SQLCompletionProposal)
- fc.Result = res
- return ec.marshalOSQLCompletionProposal2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLCompletionProposal(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_sqlCompletionProposals(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "displayString":
- return ec.fieldContext_SQLCompletionProposal_displayString(ctx, field)
- case "type":
- return ec.fieldContext_SQLCompletionProposal_type(ctx, field)
- case "score":
- return ec.fieldContext_SQLCompletionProposal_score(ctx, field)
- case "replacementString":
- return ec.fieldContext_SQLCompletionProposal_replacementString(ctx, field)
- case "replacementOffset":
- return ec.fieldContext_SQLCompletionProposal_replacementOffset(ctx, field)
- case "replacementLength":
- return ec.fieldContext_SQLCompletionProposal_replacementLength(ctx, field)
- case "cursorPosition":
- return ec.fieldContext_SQLCompletionProposal_cursorPosition(ctx, field)
- case "icon":
- return ec.fieldContext_SQLCompletionProposal_icon(ctx, field)
- case "nodePath":
- return ec.fieldContext_SQLCompletionProposal_nodePath(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type SQLCompletionProposal", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_sqlCompletionProposals_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_sqlFormatQuery(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_sqlFormatQuery(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().SQLFormatQuery(rctx, fc.Args["connectionId"].(string), fc.Args["contextId"].(string), fc.Args["query"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_sqlFormatQuery(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_sqlFormatQuery_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_sqlSupportedOperations(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_sqlSupportedOperations(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().SQLSupportedOperations(rctx, fc.Args["connectionId"].(string), fc.Args["contextId"].(string), fc.Args["resultsId"].(string), fc.Args["attributeIndex"].(int))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.DataTypeLogicalOperation)
- fc.Result = res
- return ec.marshalNDataTypeLogicalOperation2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDataTypeLogicalOperationᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_sqlSupportedOperations(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_DataTypeLogicalOperation_id(ctx, field)
- case "expression":
- return ec.fieldContext_DataTypeLogicalOperation_expression(ctx, field)
- case "argumentCount":
- return ec.fieldContext_DataTypeLogicalOperation_argumentCount(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type DataTypeLogicalOperation", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_sqlSupportedOperations_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_sqlEntityQueryGenerators(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_sqlEntityQueryGenerators(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().SQLEntityQueryGenerators(rctx, fc.Args["nodePathList"].([]string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.SQLQueryGenerator)
- fc.Result = res
- return ec.marshalNSQLQueryGenerator2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLQueryGeneratorᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_sqlEntityQueryGenerators(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_SQLQueryGenerator_id(ctx, field)
- case "label":
- return ec.fieldContext_SQLQueryGenerator_label(ctx, field)
- case "description":
- return ec.fieldContext_SQLQueryGenerator_description(ctx, field)
- case "order":
- return ec.fieldContext_SQLQueryGenerator_order(ctx, field)
- case "multiObject":
- return ec.fieldContext_SQLQueryGenerator_multiObject(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type SQLQueryGenerator", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_sqlEntityQueryGenerators_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_sqlGenerateEntityQuery(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_sqlGenerateEntityQuery(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().SQLGenerateEntityQuery(rctx, fc.Args["generatorId"].(string),
- func() interface{} {
- if fc.Args["options"] == nil {
- return nil
- }
- return fc.Args["options"].(interface{})
- }(), fc.Args["nodePathList"].([]string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_sqlGenerateEntityQuery(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_sqlGenerateEntityQuery_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_sqlParseScript(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_sqlParseScript(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().SQLParseScript(rctx, fc.Args["connectionId"].(string), fc.Args["script"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.SQLScriptInfo)
- fc.Result = res
- return ec.marshalNSQLScriptInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLScriptInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_sqlParseScript(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "queries":
- return ec.fieldContext_SQLScriptInfo_queries(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type SQLScriptInfo", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_sqlParseScript_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query_sqlParseQuery(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query_sqlParseQuery(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().SQLParseQuery(rctx, fc.Args["connectionId"].(string), fc.Args["script"].(string), fc.Args["position"].(int))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.SQLScriptQuery)
- fc.Result = res
- return ec.marshalNSQLScriptQuery2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLScriptQuery(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query_sqlParseQuery(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "start":
- return ec.fieldContext_SQLScriptQuery_start(ctx, field)
- case "end":
- return ec.fieldContext_SQLScriptQuery_end(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type SQLScriptQuery", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query_sqlParseQuery_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query___type(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.introspectType(fc.Args["name"].(string))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*introspection.Type)
- fc.Result = res
- return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "kind":
- return ec.fieldContext___Type_kind(ctx, field)
- case "name":
- return ec.fieldContext___Type_name(ctx, field)
- case "description":
- return ec.fieldContext___Type_description(ctx, field)
- case "fields":
- return ec.fieldContext___Type_fields(ctx, field)
- case "interfaces":
- return ec.fieldContext___Type_interfaces(ctx, field)
- case "possibleTypes":
- return ec.fieldContext___Type_possibleTypes(ctx, field)
- case "enumValues":
- return ec.fieldContext___Type_enumValues(ctx, field)
- case "inputFields":
- return ec.fieldContext___Type_inputFields(ctx, field)
- case "ofType":
- return ec.fieldContext___Type_ofType(ctx, field)
- case "specifiedByURL":
- return ec.fieldContext___Type_specifiedByURL(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Query___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Query___schema(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.introspectSchema()
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*introspection.Schema)
- fc.Result = res
- return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Query___schema(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Query",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "description":
- return ec.fieldContext___Schema_description(ctx, field)
- case "types":
- return ec.fieldContext___Schema_types(ctx, field)
- case "queryType":
- return ec.fieldContext___Schema_queryType(ctx, field)
- case "mutationType":
- return ec.fieldContext___Schema_mutationType(ctx, field)
- case "subscriptionType":
- return ec.fieldContext___Schema_subscriptionType(ctx, field)
- case "directives":
- return ec.fieldContext___Schema_directives(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _RMProject_id(ctx context.Context, field graphql.CollectedField, obj *model.RMProject) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_RMProject_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_RMProject_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "RMProject",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _RMProject_name(ctx context.Context, field graphql.CollectedField, obj *model.RMProject) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_RMProject_name(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Name, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_RMProject_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "RMProject",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _RMProject_description(ctx context.Context, field graphql.CollectedField, obj *model.RMProject) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_RMProject_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_RMProject_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "RMProject",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _RMProject_shared(ctx context.Context, field graphql.CollectedField, obj *model.RMProject) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_RMProject_shared(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Shared, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_RMProject_shared(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "RMProject",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _RMProject_createTime(ctx context.Context, field graphql.CollectedField, obj *model.RMProject) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_RMProject_createTime(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.CreateTime, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(time.Time)
- fc.Result = res
- return ec.marshalNDateTime2timeᚐTime(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_RMProject_createTime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "RMProject",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type DateTime does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _RMProject_creator(ctx context.Context, field graphql.CollectedField, obj *model.RMProject) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_RMProject_creator(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Creator, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_RMProject_creator(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "RMProject",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _RMResource_name(ctx context.Context, field graphql.CollectedField, obj *model.RMResource) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_RMResource_name(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Name, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_RMResource_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "RMResource",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _RMResource_folder(ctx context.Context, field graphql.CollectedField, obj *model.RMResource) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_RMResource_folder(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Folder, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_RMResource_folder(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "RMResource",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _RMResource_length(ctx context.Context, field graphql.CollectedField, obj *model.RMResource) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_RMResource_length(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Length, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(int)
- fc.Result = res
- return ec.marshalNInt2int(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_RMResource_length(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "RMResource",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLCompletionProposal_displayString(ctx context.Context, field graphql.CollectedField, obj *model.SQLCompletionProposal) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLCompletionProposal_displayString(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DisplayString, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLCompletionProposal_displayString(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLCompletionProposal",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLCompletionProposal_type(ctx context.Context, field graphql.CollectedField, obj *model.SQLCompletionProposal) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLCompletionProposal_type(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Type, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLCompletionProposal_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLCompletionProposal",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLCompletionProposal_score(ctx context.Context, field graphql.CollectedField, obj *model.SQLCompletionProposal) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLCompletionProposal_score(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Score, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*int)
- fc.Result = res
- return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLCompletionProposal_score(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLCompletionProposal",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLCompletionProposal_replacementString(ctx context.Context, field graphql.CollectedField, obj *model.SQLCompletionProposal) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLCompletionProposal_replacementString(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ReplacementString, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLCompletionProposal_replacementString(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLCompletionProposal",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLCompletionProposal_replacementOffset(ctx context.Context, field graphql.CollectedField, obj *model.SQLCompletionProposal) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLCompletionProposal_replacementOffset(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ReplacementOffset, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(int)
- fc.Result = res
- return ec.marshalNInt2int(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLCompletionProposal_replacementOffset(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLCompletionProposal",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLCompletionProposal_replacementLength(ctx context.Context, field graphql.CollectedField, obj *model.SQLCompletionProposal) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLCompletionProposal_replacementLength(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ReplacementLength, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(int)
- fc.Result = res
- return ec.marshalNInt2int(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLCompletionProposal_replacementLength(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLCompletionProposal",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLCompletionProposal_cursorPosition(ctx context.Context, field graphql.CollectedField, obj *model.SQLCompletionProposal) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLCompletionProposal_cursorPosition(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.CursorPosition, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*int)
- fc.Result = res
- return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLCompletionProposal_cursorPosition(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLCompletionProposal",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLCompletionProposal_icon(ctx context.Context, field graphql.CollectedField, obj *model.SQLCompletionProposal) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLCompletionProposal_icon(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Icon, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLCompletionProposal_icon(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLCompletionProposal",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLCompletionProposal_nodePath(ctx context.Context, field graphql.CollectedField, obj *model.SQLCompletionProposal) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLCompletionProposal_nodePath(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.NodePath, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLCompletionProposal_nodePath(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLCompletionProposal",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLContextInfo_id(ctx context.Context, field graphql.CollectedField, obj *model.SQLContextInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLContextInfo_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLContextInfo_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLContextInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLContextInfo_connectionId(ctx context.Context, field graphql.CollectedField, obj *model.SQLContextInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLContextInfo_connectionId(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ConnectionID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLContextInfo_connectionId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLContextInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLContextInfo_defaultCatalog(ctx context.Context, field graphql.CollectedField, obj *model.SQLContextInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLContextInfo_defaultCatalog(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DefaultCatalog, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLContextInfo_defaultCatalog(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLContextInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLContextInfo_defaultSchema(ctx context.Context, field graphql.CollectedField, obj *model.SQLContextInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLContextInfo_defaultSchema(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DefaultSchema, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLContextInfo_defaultSchema(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLContextInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLDialectInfo_name(ctx context.Context, field graphql.CollectedField, obj *model.SQLDialectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLDialectInfo_name(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Name, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLDialectInfo_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLDialectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLDialectInfo_dataTypes(ctx context.Context, field graphql.CollectedField, obj *model.SQLDialectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLDialectInfo_dataTypes(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DataTypes, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*string)
- fc.Result = res
- return ec.marshalNString2ᚕᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLDialectInfo_dataTypes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLDialectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLDialectInfo_functions(ctx context.Context, field graphql.CollectedField, obj *model.SQLDialectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLDialectInfo_functions(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Functions, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*string)
- fc.Result = res
- return ec.marshalNString2ᚕᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLDialectInfo_functions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLDialectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLDialectInfo_reservedWords(ctx context.Context, field graphql.CollectedField, obj *model.SQLDialectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLDialectInfo_reservedWords(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ReservedWords, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*string)
- fc.Result = res
- return ec.marshalNString2ᚕᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLDialectInfo_reservedWords(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLDialectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLDialectInfo_quoteStrings(ctx context.Context, field graphql.CollectedField, obj *model.SQLDialectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLDialectInfo_quoteStrings(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.QuoteStrings, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([][]*string)
- fc.Result = res
- return ec.marshalNString2ᚕᚕᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLDialectInfo_quoteStrings(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLDialectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLDialectInfo_singleLineComments(ctx context.Context, field graphql.CollectedField, obj *model.SQLDialectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLDialectInfo_singleLineComments(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SingleLineComments, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*string)
- fc.Result = res
- return ec.marshalNString2ᚕᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLDialectInfo_singleLineComments(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLDialectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLDialectInfo_multiLineComments(ctx context.Context, field graphql.CollectedField, obj *model.SQLDialectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLDialectInfo_multiLineComments(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.MultiLineComments, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([][]*string)
- fc.Result = res
- return ec.marshalNString2ᚕᚕᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLDialectInfo_multiLineComments(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLDialectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLDialectInfo_catalogSeparator(ctx context.Context, field graphql.CollectedField, obj *model.SQLDialectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLDialectInfo_catalogSeparator(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.CatalogSeparator, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLDialectInfo_catalogSeparator(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLDialectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLDialectInfo_structSeparator(ctx context.Context, field graphql.CollectedField, obj *model.SQLDialectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLDialectInfo_structSeparator(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.StructSeparator, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLDialectInfo_structSeparator(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLDialectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLDialectInfo_scriptDelimiter(ctx context.Context, field graphql.CollectedField, obj *model.SQLDialectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLDialectInfo_scriptDelimiter(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ScriptDelimiter, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLDialectInfo_scriptDelimiter(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLDialectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLDialectInfo_supportsExplainExecutionPlan(ctx context.Context, field graphql.CollectedField, obj *model.SQLDialectInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLDialectInfo_supportsExplainExecutionPlan(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SupportsExplainExecutionPlan, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLDialectInfo_supportsExplainExecutionPlan(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLDialectInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLExecuteInfo_statusMessage(ctx context.Context, field graphql.CollectedField, obj *model.SQLExecuteInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLExecuteInfo_statusMessage(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.StatusMessage, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLExecuteInfo_statusMessage(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLExecuteInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLExecuteInfo_duration(ctx context.Context, field graphql.CollectedField, obj *model.SQLExecuteInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLExecuteInfo_duration(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Duration, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(int)
- fc.Result = res
- return ec.marshalNInt2int(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLExecuteInfo_duration(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLExecuteInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLExecuteInfo_filterText(ctx context.Context, field graphql.CollectedField, obj *model.SQLExecuteInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLExecuteInfo_filterText(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.FilterText, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLExecuteInfo_filterText(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLExecuteInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLExecuteInfo_results(ctx context.Context, field graphql.CollectedField, obj *model.SQLExecuteInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLExecuteInfo_results(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Results, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.SQLQueryResults)
- fc.Result = res
- return ec.marshalNSQLQueryResults2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLQueryResultsᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLExecuteInfo_results(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLExecuteInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "title":
- return ec.fieldContext_SQLQueryResults_title(ctx, field)
- case "updateRowCount":
- return ec.fieldContext_SQLQueryResults_updateRowCount(ctx, field)
- case "sourceQuery":
- return ec.fieldContext_SQLQueryResults_sourceQuery(ctx, field)
- case "dataFormat":
- return ec.fieldContext_SQLQueryResults_dataFormat(ctx, field)
- case "resultSet":
- return ec.fieldContext_SQLQueryResults_resultSet(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type SQLQueryResults", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLExecutionPlan_query(ctx context.Context, field graphql.CollectedField, obj *model.SQLExecutionPlan) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLExecutionPlan_query(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Query, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLExecutionPlan_query(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLExecutionPlan",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLExecutionPlan_nodes(ctx context.Context, field graphql.CollectedField, obj *model.SQLExecutionPlan) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLExecutionPlan_nodes(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Nodes, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.SQLExecutionPlanNode)
- fc.Result = res
- return ec.marshalNSQLExecutionPlanNode2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLExecutionPlanNodeᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLExecutionPlan_nodes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLExecutionPlan",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_SQLExecutionPlanNode_id(ctx, field)
- case "parentId":
- return ec.fieldContext_SQLExecutionPlanNode_parentId(ctx, field)
- case "kind":
- return ec.fieldContext_SQLExecutionPlanNode_kind(ctx, field)
- case "name":
- return ec.fieldContext_SQLExecutionPlanNode_name(ctx, field)
- case "type":
- return ec.fieldContext_SQLExecutionPlanNode_type(ctx, field)
- case "condition":
- return ec.fieldContext_SQLExecutionPlanNode_condition(ctx, field)
- case "description":
- return ec.fieldContext_SQLExecutionPlanNode_description(ctx, field)
- case "properties":
- return ec.fieldContext_SQLExecutionPlanNode_properties(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type SQLExecutionPlanNode", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLExecutionPlanNode_id(ctx context.Context, field graphql.CollectedField, obj *model.SQLExecutionPlanNode) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLExecutionPlanNode_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLExecutionPlanNode_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLExecutionPlanNode",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLExecutionPlanNode_parentId(ctx context.Context, field graphql.CollectedField, obj *model.SQLExecutionPlanNode) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLExecutionPlanNode_parentId(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ParentID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOID2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLExecutionPlanNode_parentId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLExecutionPlanNode",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLExecutionPlanNode_kind(ctx context.Context, field graphql.CollectedField, obj *model.SQLExecutionPlanNode) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLExecutionPlanNode_kind(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Kind, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLExecutionPlanNode_kind(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLExecutionPlanNode",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLExecutionPlanNode_name(ctx context.Context, field graphql.CollectedField, obj *model.SQLExecutionPlanNode) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLExecutionPlanNode_name(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Name, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLExecutionPlanNode_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLExecutionPlanNode",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLExecutionPlanNode_type(ctx context.Context, field graphql.CollectedField, obj *model.SQLExecutionPlanNode) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLExecutionPlanNode_type(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Type, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLExecutionPlanNode_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLExecutionPlanNode",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLExecutionPlanNode_condition(ctx context.Context, field graphql.CollectedField, obj *model.SQLExecutionPlanNode) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLExecutionPlanNode_condition(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Condition, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLExecutionPlanNode_condition(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLExecutionPlanNode",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLExecutionPlanNode_description(ctx context.Context, field graphql.CollectedField, obj *model.SQLExecutionPlanNode) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLExecutionPlanNode_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLExecutionPlanNode_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLExecutionPlanNode",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLExecutionPlanNode_properties(ctx context.Context, field graphql.CollectedField, obj *model.SQLExecutionPlanNode) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLExecutionPlanNode_properties(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Properties, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.ObjectPropertyInfo)
- fc.Result = res
- return ec.marshalNObjectPropertyInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLExecutionPlanNode_properties(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLExecutionPlanNode",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ObjectPropertyInfo_id(ctx, field)
- case "displayName":
- return ec.fieldContext_ObjectPropertyInfo_displayName(ctx, field)
- case "description":
- return ec.fieldContext_ObjectPropertyInfo_description(ctx, field)
- case "category":
- return ec.fieldContext_ObjectPropertyInfo_category(ctx, field)
- case "dataType":
- return ec.fieldContext_ObjectPropertyInfo_dataType(ctx, field)
- case "value":
- return ec.fieldContext_ObjectPropertyInfo_value(ctx, field)
- case "validValues":
- return ec.fieldContext_ObjectPropertyInfo_validValues(ctx, field)
- case "defaultValue":
- return ec.fieldContext_ObjectPropertyInfo_defaultValue(ctx, field)
- case "length":
- return ec.fieldContext_ObjectPropertyInfo_length(ctx, field)
- case "features":
- return ec.fieldContext_ObjectPropertyInfo_features(ctx, field)
- case "order":
- return ec.fieldContext_ObjectPropertyInfo_order(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ObjectPropertyInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLQueryGenerator_id(ctx context.Context, field graphql.CollectedField, obj *model.SQLQueryGenerator) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLQueryGenerator_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLQueryGenerator_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLQueryGenerator",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLQueryGenerator_label(ctx context.Context, field graphql.CollectedField, obj *model.SQLQueryGenerator) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLQueryGenerator_label(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Label, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLQueryGenerator_label(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLQueryGenerator",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLQueryGenerator_description(ctx context.Context, field graphql.CollectedField, obj *model.SQLQueryGenerator) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLQueryGenerator_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLQueryGenerator_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLQueryGenerator",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLQueryGenerator_order(ctx context.Context, field graphql.CollectedField, obj *model.SQLQueryGenerator) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLQueryGenerator_order(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Order, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(int)
- fc.Result = res
- return ec.marshalNInt2int(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLQueryGenerator_order(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLQueryGenerator",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLQueryGenerator_multiObject(ctx context.Context, field graphql.CollectedField, obj *model.SQLQueryGenerator) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLQueryGenerator_multiObject(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.MultiObject, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLQueryGenerator_multiObject(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLQueryGenerator",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLQueryResults_title(ctx context.Context, field graphql.CollectedField, obj *model.SQLQueryResults) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLQueryResults_title(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Title, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLQueryResults_title(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLQueryResults",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLQueryResults_updateRowCount(ctx context.Context, field graphql.CollectedField, obj *model.SQLQueryResults) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLQueryResults_updateRowCount(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.UpdateRowCount, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*float64)
- fc.Result = res
- return ec.marshalOFloat2ᚖfloat64(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLQueryResults_updateRowCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLQueryResults",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Float does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLQueryResults_sourceQuery(ctx context.Context, field graphql.CollectedField, obj *model.SQLQueryResults) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLQueryResults_sourceQuery(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SourceQuery, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLQueryResults_sourceQuery(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLQueryResults",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLQueryResults_dataFormat(ctx context.Context, field graphql.CollectedField, obj *model.SQLQueryResults) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLQueryResults_dataFormat(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DataFormat, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*model.ResultDataFormat)
- fc.Result = res
- return ec.marshalOResultDataFormat2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐResultDataFormat(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLQueryResults_dataFormat(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLQueryResults",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ResultDataFormat does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLQueryResults_resultSet(ctx context.Context, field graphql.CollectedField, obj *model.SQLQueryResults) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLQueryResults_resultSet(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ResultSet, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*model.SQLResultSet)
- fc.Result = res
- return ec.marshalOSQLResultSet2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLResultSet(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLQueryResults_resultSet(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLQueryResults",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_SQLResultSet_id(ctx, field)
- case "columns":
- return ec.fieldContext_SQLResultSet_columns(ctx, field)
- case "rows":
- return ec.fieldContext_SQLResultSet_rows(ctx, field)
- case "singleEntity":
- return ec.fieldContext_SQLResultSet_singleEntity(ctx, field)
- case "hasMoreData":
- return ec.fieldContext_SQLResultSet_hasMoreData(ctx, field)
- case "hasRowIdentifier":
- return ec.fieldContext_SQLResultSet_hasRowIdentifier(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type SQLResultSet", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultColumn_position(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultColumn) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultColumn_position(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Position, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(int)
- fc.Result = res
- return ec.marshalNInt2int(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultColumn_position(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultColumn",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultColumn_name(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultColumn) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultColumn_name(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Name, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultColumn_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultColumn",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultColumn_label(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultColumn) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultColumn_label(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Label, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultColumn_label(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultColumn",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultColumn_icon(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultColumn) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultColumn_icon(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Icon, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultColumn_icon(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultColumn",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultColumn_entityName(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultColumn) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultColumn_entityName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.EntityName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultColumn_entityName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultColumn",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultColumn_dataKind(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultColumn) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultColumn_dataKind(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DataKind, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultColumn_dataKind(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultColumn",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultColumn_typeName(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultColumn) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultColumn_typeName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.TypeName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultColumn_typeName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultColumn",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultColumn_fullTypeName(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultColumn) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultColumn_fullTypeName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.FullTypeName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultColumn_fullTypeName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultColumn",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultColumn_maxLength(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultColumn) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultColumn_maxLength(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.MaxLength, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*float64)
- fc.Result = res
- return ec.marshalOFloat2ᚖfloat64(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultColumn_maxLength(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultColumn",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Float does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultColumn_scale(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultColumn) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultColumn_scale(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Scale, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*int)
- fc.Result = res
- return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultColumn_scale(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultColumn",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultColumn_precision(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultColumn) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultColumn_precision(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Precision, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*int)
- fc.Result = res
- return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultColumn_precision(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultColumn",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultColumn_required(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultColumn) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultColumn_required(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Required, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultColumn_required(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultColumn",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultColumn_readOnly(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultColumn) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultColumn_readOnly(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ReadOnly, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultColumn_readOnly(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultColumn",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultColumn_readOnlyStatus(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultColumn) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultColumn_readOnlyStatus(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ReadOnlyStatus, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultColumn_readOnlyStatus(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultColumn",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultColumn_supportedOperations(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultColumn) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultColumn_supportedOperations(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SupportedOperations, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.DataTypeLogicalOperation)
- fc.Result = res
- return ec.marshalNDataTypeLogicalOperation2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDataTypeLogicalOperationᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultColumn_supportedOperations(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultColumn",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_DataTypeLogicalOperation_id(ctx, field)
- case "expression":
- return ec.fieldContext_DataTypeLogicalOperation_expression(ctx, field)
- case "argumentCount":
- return ec.fieldContext_DataTypeLogicalOperation_argumentCount(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type DataTypeLogicalOperation", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultSet_id(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultSet) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultSet_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultSet_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultSet",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultSet_columns(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultSet) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultSet_columns(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Columns, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([]*model.SQLResultColumn)
- fc.Result = res
- return ec.marshalOSQLResultColumn2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLResultColumn(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultSet_columns(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultSet",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "position":
- return ec.fieldContext_SQLResultColumn_position(ctx, field)
- case "name":
- return ec.fieldContext_SQLResultColumn_name(ctx, field)
- case "label":
- return ec.fieldContext_SQLResultColumn_label(ctx, field)
- case "icon":
- return ec.fieldContext_SQLResultColumn_icon(ctx, field)
- case "entityName":
- return ec.fieldContext_SQLResultColumn_entityName(ctx, field)
- case "dataKind":
- return ec.fieldContext_SQLResultColumn_dataKind(ctx, field)
- case "typeName":
- return ec.fieldContext_SQLResultColumn_typeName(ctx, field)
- case "fullTypeName":
- return ec.fieldContext_SQLResultColumn_fullTypeName(ctx, field)
- case "maxLength":
- return ec.fieldContext_SQLResultColumn_maxLength(ctx, field)
- case "scale":
- return ec.fieldContext_SQLResultColumn_scale(ctx, field)
- case "precision":
- return ec.fieldContext_SQLResultColumn_precision(ctx, field)
- case "required":
- return ec.fieldContext_SQLResultColumn_required(ctx, field)
- case "readOnly":
- return ec.fieldContext_SQLResultColumn_readOnly(ctx, field)
- case "readOnlyStatus":
- return ec.fieldContext_SQLResultColumn_readOnlyStatus(ctx, field)
- case "supportedOperations":
- return ec.fieldContext_SQLResultColumn_supportedOperations(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type SQLResultColumn", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultSet_rows(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultSet) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultSet_rows(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Rows, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([][]interface{})
- fc.Result = res
- return ec.marshalOObject2ᚕᚕinterface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultSet_rows(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultSet",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultSet_singleEntity(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultSet) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultSet_singleEntity(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SingleEntity, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultSet_singleEntity(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultSet",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultSet_hasMoreData(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultSet) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultSet_hasMoreData(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.HasMoreData, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultSet_hasMoreData(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultSet",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLResultSet_hasRowIdentifier(ctx context.Context, field graphql.CollectedField, obj *model.SQLResultSet) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLResultSet_hasRowIdentifier(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.HasRowIdentifier, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLResultSet_hasRowIdentifier(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLResultSet",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLScriptInfo_queries(ctx context.Context, field graphql.CollectedField, obj *model.SQLScriptInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLScriptInfo_queries(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Queries, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.SQLScriptQuery)
- fc.Result = res
- return ec.marshalNSQLScriptQuery2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLScriptQueryᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLScriptInfo_queries(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLScriptInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "start":
- return ec.fieldContext_SQLScriptQuery_start(ctx, field)
- case "end":
- return ec.fieldContext_SQLScriptQuery_end(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type SQLScriptQuery", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLScriptQuery_start(ctx context.Context, field graphql.CollectedField, obj *model.SQLScriptQuery) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLScriptQuery_start(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Start, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(int)
- fc.Result = res
- return ec.marshalNInt2int(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLScriptQuery_start(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLScriptQuery",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SQLScriptQuery_end(ctx context.Context, field graphql.CollectedField, obj *model.SQLScriptQuery) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SQLScriptQuery_end(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.End, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(int)
- fc.Result = res
- return ec.marshalNInt2int(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SQLScriptQuery_end(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SQLScriptQuery",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_name(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_name(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Name, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_version(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_version(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Version, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_version(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_workspaceId(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_workspaceId(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.WorkspaceID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_workspaceId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_serverURL(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_serverURL(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ServerURL, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_serverURL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_rootURI(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_rootURI(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.RootURI, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_rootURI(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_hostName(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_hostName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.HostName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_hostName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_anonymousAccessEnabled(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_anonymousAccessEnabled(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.AnonymousAccessEnabled, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_anonymousAccessEnabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_authenticationEnabled(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_authenticationEnabled(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.AuthenticationEnabled, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_authenticationEnabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_supportsCustomConnections(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_supportsCustomConnections(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SupportsCustomConnections, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_supportsCustomConnections(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_supportsConnectionBrowser(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_supportsConnectionBrowser(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SupportsConnectionBrowser, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_supportsConnectionBrowser(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_supportsWorkspaces(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_supportsWorkspaces(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SupportsWorkspaces, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_supportsWorkspaces(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_resourceManagerEnabled(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_resourceManagerEnabled(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ResourceManagerEnabled, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_resourceManagerEnabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_publicCredentialsSaveEnabled(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_publicCredentialsSaveEnabled(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.PublicCredentialsSaveEnabled, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_publicCredentialsSaveEnabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_adminCredentialsSaveEnabled(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_adminCredentialsSaveEnabled(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.AdminCredentialsSaveEnabled, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_adminCredentialsSaveEnabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_licenseRequired(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_licenseRequired(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.LicenseRequired, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_licenseRequired(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_licenseValid(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_licenseValid(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.LicenseValid, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_licenseValid(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_sessionExpireTime(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_sessionExpireTime(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SessionExpireTime, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*int)
- fc.Result = res
- return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_sessionExpireTime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_localHostAddress(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_localHostAddress(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.LocalHostAddress, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_localHostAddress(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_configurationMode(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_configurationMode(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ConfigurationMode, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_configurationMode(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_developmentMode(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_developmentMode(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DevelopmentMode, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_developmentMode(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_redirectOnFederatedAuth(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_redirectOnFederatedAuth(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.RedirectOnFederatedAuth, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*bool)
- fc.Result = res
- return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_redirectOnFederatedAuth(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_enabledFeatures(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_enabledFeatures(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.EnabledFeatures, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]string)
- fc.Result = res
- return ec.marshalNID2ᚕstringᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_enabledFeatures(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_enabledAuthProviders(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_enabledAuthProviders(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.EnabledAuthProviders, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]string)
- fc.Result = res
- return ec.marshalNID2ᚕstringᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_enabledAuthProviders(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_supportedLanguages(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_supportedLanguages(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SupportedLanguages, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.ServerLanguage)
- fc.Result = res
- return ec.marshalNServerLanguage2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐServerLanguageᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_supportedLanguages(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "isoCode":
- return ec.fieldContext_ServerLanguage_isoCode(ctx, field)
- case "displayName":
- return ec.fieldContext_ServerLanguage_displayName(ctx, field)
- case "nativeName":
- return ec.fieldContext_ServerLanguage_nativeName(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ServerLanguage", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_services(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_services(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Services, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([]*model.WebServiceConfig)
- fc.Result = res
- return ec.marshalOWebServiceConfig2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐWebServiceConfig(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_services(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_WebServiceConfig_id(ctx, field)
- case "name":
- return ec.fieldContext_WebServiceConfig_name(ctx, field)
- case "description":
- return ec.fieldContext_WebServiceConfig_description(ctx, field)
- case "bundleVersion":
- return ec.fieldContext_WebServiceConfig_bundleVersion(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type WebServiceConfig", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_productConfiguration(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_productConfiguration(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ProductConfiguration, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(interface{})
- fc.Result = res
- return ec.marshalNObject2interface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_productConfiguration(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_productInfo(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_productInfo(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ProductInfo, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.ProductInfo)
- fc.Result = res
- return ec.marshalNProductInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐProductInfo(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_productInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ProductInfo_id(ctx, field)
- case "version":
- return ec.fieldContext_ProductInfo_version(ctx, field)
- case "name":
- return ec.fieldContext_ProductInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_ProductInfo_description(ctx, field)
- case "buildTime":
- return ec.fieldContext_ProductInfo_buildTime(ctx, field)
- case "releaseTime":
- return ec.fieldContext_ProductInfo_releaseTime(ctx, field)
- case "licenseInfo":
- return ec.fieldContext_ProductInfo_licenseInfo(ctx, field)
- case "latestVersionInfo":
- return ec.fieldContext_ProductInfo_latestVersionInfo(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ProductInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_defaultNavigatorSettings(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_defaultNavigatorSettings(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DefaultNavigatorSettings, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.NavigatorSettings)
- fc.Result = res
- return ec.marshalNNavigatorSettings2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNavigatorSettings(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_defaultNavigatorSettings(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "showSystemObjects":
- return ec.fieldContext_NavigatorSettings_showSystemObjects(ctx, field)
- case "showUtilityObjects":
- return ec.fieldContext_NavigatorSettings_showUtilityObjects(ctx, field)
- case "showOnlyEntities":
- return ec.fieldContext_NavigatorSettings_showOnlyEntities(ctx, field)
- case "mergeEntities":
- return ec.fieldContext_NavigatorSettings_mergeEntities(ctx, field)
- case "hideFolders":
- return ec.fieldContext_NavigatorSettings_hideFolders(ctx, field)
- case "hideSchemas":
- return ec.fieldContext_NavigatorSettings_hideSchemas(ctx, field)
- case "hideVirtualModel":
- return ec.fieldContext_NavigatorSettings_hideVirtualModel(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type NavigatorSettings", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_disabledDrivers(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_disabledDrivers(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DisabledDrivers, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]string)
- fc.Result = res
- return ec.marshalNID2ᚕstringᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_disabledDrivers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerConfig_resourceQuotas(ctx context.Context, field graphql.CollectedField, obj *model.ServerConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerConfig_resourceQuotas(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ResourceQuotas, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(interface{})
- fc.Result = res
- return ec.marshalNObject2interface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerConfig_resourceQuotas(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerError_message(ctx context.Context, field graphql.CollectedField, obj *model.ServerError) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerError_message(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Message, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerError_message(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerError",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerError_errorCode(ctx context.Context, field graphql.CollectedField, obj *model.ServerError) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerError_errorCode(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ErrorCode, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerError_errorCode(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerError",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerError_errorType(ctx context.Context, field graphql.CollectedField, obj *model.ServerError) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerError_errorType(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ErrorType, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerError_errorType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerError",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerError_stackTrace(ctx context.Context, field graphql.CollectedField, obj *model.ServerError) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerError_stackTrace(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.StackTrace, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerError_stackTrace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerError",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerError_causedBy(ctx context.Context, field graphql.CollectedField, obj *model.ServerError) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerError_causedBy(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.CausedBy, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*model.ServerError)
- fc.Result = res
- return ec.marshalOServerError2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐServerError(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerError_causedBy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerError",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "message":
- return ec.fieldContext_ServerError_message(ctx, field)
- case "errorCode":
- return ec.fieldContext_ServerError_errorCode(ctx, field)
- case "errorType":
- return ec.fieldContext_ServerError_errorType(ctx, field)
- case "stackTrace":
- return ec.fieldContext_ServerError_stackTrace(ctx, field)
- case "causedBy":
- return ec.fieldContext_ServerError_causedBy(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ServerError", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerLanguage_isoCode(ctx context.Context, field graphql.CollectedField, obj *model.ServerLanguage) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerLanguage_isoCode(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.IsoCode, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerLanguage_isoCode(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerLanguage",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerLanguage_displayName(ctx context.Context, field graphql.CollectedField, obj *model.ServerLanguage) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerLanguage_displayName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DisplayName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerLanguage_displayName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerLanguage",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerLanguage_nativeName(ctx context.Context, field graphql.CollectedField, obj *model.ServerLanguage) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerLanguage_nativeName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.NativeName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerLanguage_nativeName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerLanguage",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerMessage_time(ctx context.Context, field graphql.CollectedField, obj *model.ServerMessage) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerMessage_time(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Time, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerMessage_time(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerMessage",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _ServerMessage_message(ctx context.Context, field graphql.CollectedField, obj *model.ServerMessage) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_ServerMessage_message(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Message, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_ServerMessage_message(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "ServerMessage",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SessionInfo_createTime(ctx context.Context, field graphql.CollectedField, obj *model.SessionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SessionInfo_createTime(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.CreateTime, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SessionInfo_createTime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SessionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SessionInfo_lastAccessTime(ctx context.Context, field graphql.CollectedField, obj *model.SessionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SessionInfo_lastAccessTime(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.LastAccessTime, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SessionInfo_lastAccessTime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SessionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SessionInfo_locale(ctx context.Context, field graphql.CollectedField, obj *model.SessionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SessionInfo_locale(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Locale, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SessionInfo_locale(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SessionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SessionInfo_cacheExpired(ctx context.Context, field graphql.CollectedField, obj *model.SessionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SessionInfo_cacheExpired(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.CacheExpired, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SessionInfo_cacheExpired(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SessionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SessionInfo_serverMessages(ctx context.Context, field graphql.CollectedField, obj *model.SessionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SessionInfo_serverMessages(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ServerMessages, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([]*model.ServerMessage)
- fc.Result = res
- return ec.marshalOServerMessage2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐServerMessage(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SessionInfo_serverMessages(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SessionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "time":
- return ec.fieldContext_ServerMessage_time(ctx, field)
- case "message":
- return ec.fieldContext_ServerMessage_message(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ServerMessage", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SessionInfo_connections(ctx context.Context, field graphql.CollectedField, obj *model.SessionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SessionInfo_connections(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Connections, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.ConnectionInfo)
- fc.Result = res
- return ec.marshalNConnectionInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfoᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SessionInfo_connections(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SessionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_ConnectionInfo_id(ctx, field)
- case "driverId":
- return ec.fieldContext_ConnectionInfo_driverId(ctx, field)
- case "name":
- return ec.fieldContext_ConnectionInfo_name(ctx, field)
- case "description":
- return ec.fieldContext_ConnectionInfo_description(ctx, field)
- case "host":
- return ec.fieldContext_ConnectionInfo_host(ctx, field)
- case "port":
- return ec.fieldContext_ConnectionInfo_port(ctx, field)
- case "serverName":
- return ec.fieldContext_ConnectionInfo_serverName(ctx, field)
- case "databaseName":
- return ec.fieldContext_ConnectionInfo_databaseName(ctx, field)
- case "url":
- return ec.fieldContext_ConnectionInfo_url(ctx, field)
- case "properties":
- return ec.fieldContext_ConnectionInfo_properties(ctx, field)
- case "template":
- return ec.fieldContext_ConnectionInfo_template(ctx, field)
- case "connected":
- return ec.fieldContext_ConnectionInfo_connected(ctx, field)
- case "provided":
- return ec.fieldContext_ConnectionInfo_provided(ctx, field)
- case "readOnly":
- return ec.fieldContext_ConnectionInfo_readOnly(ctx, field)
- case "useUrl":
- return ec.fieldContext_ConnectionInfo_useUrl(ctx, field)
- case "saveCredentials":
- return ec.fieldContext_ConnectionInfo_saveCredentials(ctx, field)
- case "folder":
- return ec.fieldContext_ConnectionInfo_folder(ctx, field)
- case "nodePath":
- return ec.fieldContext_ConnectionInfo_nodePath(ctx, field)
- case "connectTime":
- return ec.fieldContext_ConnectionInfo_connectTime(ctx, field)
- case "connectionError":
- return ec.fieldContext_ConnectionInfo_connectionError(ctx, field)
- case "serverVersion":
- return ec.fieldContext_ConnectionInfo_serverVersion(ctx, field)
- case "clientVersion":
- return ec.fieldContext_ConnectionInfo_clientVersion(ctx, field)
- case "origin":
- return ec.fieldContext_ConnectionInfo_origin(ctx, field)
- case "authNeeded":
- return ec.fieldContext_ConnectionInfo_authNeeded(ctx, field)
- case "authModel":
- return ec.fieldContext_ConnectionInfo_authModel(ctx, field)
- case "authProperties":
- return ec.fieldContext_ConnectionInfo_authProperties(ctx, field)
- case "providerProperties":
- return ec.fieldContext_ConnectionInfo_providerProperties(ctx, field)
- case "networkHandlersConfig":
- return ec.fieldContext_ConnectionInfo_networkHandlersConfig(ctx, field)
- case "features":
- return ec.fieldContext_ConnectionInfo_features(ctx, field)
- case "navigatorSettings":
- return ec.fieldContext_ConnectionInfo_navigatorSettings(ctx, field)
- case "supportedDataFormats":
- return ec.fieldContext_ConnectionInfo_supportedDataFormats(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ConnectionInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _SessionInfo_actionParameters(ctx context.Context, field graphql.CollectedField, obj *model.SessionInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_SessionInfo_actionParameters(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ActionParameters, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(interface{})
- fc.Result = res
- return ec.marshalOObject2interface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_SessionInfo_actionParameters(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "SessionInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _UserAuthToken_authProvider(ctx context.Context, field graphql.CollectedField, obj *model.UserAuthToken) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_UserAuthToken_authProvider(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.AuthProvider, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_UserAuthToken_authProvider(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "UserAuthToken",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _UserAuthToken_authConfiguration(ctx context.Context, field graphql.CollectedField, obj *model.UserAuthToken) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_UserAuthToken_authConfiguration(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.AuthConfiguration, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOID2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_UserAuthToken_authConfiguration(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "UserAuthToken",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _UserAuthToken_loginTime(ctx context.Context, field graphql.CollectedField, obj *model.UserAuthToken) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_UserAuthToken_loginTime(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.LoginTime, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(time.Time)
- fc.Result = res
- return ec.marshalNDateTime2timeᚐTime(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_UserAuthToken_loginTime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "UserAuthToken",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type DateTime does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _UserAuthToken_userId(ctx context.Context, field graphql.CollectedField, obj *model.UserAuthToken) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_UserAuthToken_userId(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.UserID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_UserAuthToken_userId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "UserAuthToken",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _UserAuthToken_displayName(ctx context.Context, field graphql.CollectedField, obj *model.UserAuthToken) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_UserAuthToken_displayName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DisplayName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_UserAuthToken_displayName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "UserAuthToken",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _UserAuthToken_message(ctx context.Context, field graphql.CollectedField, obj *model.UserAuthToken) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_UserAuthToken_message(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Message, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_UserAuthToken_message(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "UserAuthToken",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _UserAuthToken_origin(ctx context.Context, field graphql.CollectedField, obj *model.UserAuthToken) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_UserAuthToken_origin(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Origin, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*model.ObjectOrigin)
- fc.Result = res
- return ec.marshalNObjectOrigin2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectOrigin(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_UserAuthToken_origin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "UserAuthToken",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "type":
- return ec.fieldContext_ObjectOrigin_type(ctx, field)
- case "subType":
- return ec.fieldContext_ObjectOrigin_subType(ctx, field)
- case "displayName":
- return ec.fieldContext_ObjectOrigin_displayName(ctx, field)
- case "icon":
- return ec.fieldContext_ObjectOrigin_icon(ctx, field)
- case "configuration":
- return ec.fieldContext_ObjectOrigin_configuration(ctx, field)
- case "details":
- return ec.fieldContext_ObjectOrigin_details(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type ObjectOrigin", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _UserInfo_userId(ctx context.Context, field graphql.CollectedField, obj *model.UserInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_UserInfo_userId(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.UserID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNID2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_UserInfo_userId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "UserInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _UserInfo_displayName(ctx context.Context, field graphql.CollectedField, obj *model.UserInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_UserInfo_displayName(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DisplayName, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_UserInfo_displayName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "UserInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _UserInfo_authRole(ctx context.Context, field graphql.CollectedField, obj *model.UserInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_UserInfo_authRole(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.AuthRole, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOID2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_UserInfo_authRole(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "UserInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _UserInfo_authTokens(ctx context.Context, field graphql.CollectedField, obj *model.UserInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_UserInfo_authTokens(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.AuthTokens, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]*model.UserAuthToken)
- fc.Result = res
- return ec.marshalNUserAuthToken2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐUserAuthTokenᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_UserInfo_authTokens(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "UserInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "authProvider":
- return ec.fieldContext_UserAuthToken_authProvider(ctx, field)
- case "authConfiguration":
- return ec.fieldContext_UserAuthToken_authConfiguration(ctx, field)
- case "loginTime":
- return ec.fieldContext_UserAuthToken_loginTime(ctx, field)
- case "userId":
- return ec.fieldContext_UserAuthToken_userId(ctx, field)
- case "displayName":
- return ec.fieldContext_UserAuthToken_displayName(ctx, field)
- case "message":
- return ec.fieldContext_UserAuthToken_message(ctx, field)
- case "origin":
- return ec.fieldContext_UserAuthToken_origin(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type UserAuthToken", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _UserInfo_linkedAuthProviders(ctx context.Context, field graphql.CollectedField, obj *model.UserInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_UserInfo_linkedAuthProviders(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.LinkedAuthProviders, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]string)
- fc.Result = res
- return ec.marshalNString2ᚕstringᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_UserInfo_linkedAuthProviders(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "UserInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _UserInfo_metaParameters(ctx context.Context, field graphql.CollectedField, obj *model.UserInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_UserInfo_metaParameters(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.MetaParameters, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(interface{})
- fc.Result = res
- return ec.marshalNObject2interface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_UserInfo_metaParameters(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "UserInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _UserInfo_configurationParameters(ctx context.Context, field graphql.CollectedField, obj *model.UserInfo) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_UserInfo_configurationParameters(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ConfigurationParameters, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(interface{})
- fc.Result = res
- return ec.marshalNObject2interface(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_UserInfo_configurationParameters(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "UserInfo",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Object does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _WebFeatureSet_id(ctx context.Context, field graphql.CollectedField, obj *model.WebFeatureSet) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_WebFeatureSet_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_WebFeatureSet_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebFeatureSet",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _WebFeatureSet_label(ctx context.Context, field graphql.CollectedField, obj *model.WebFeatureSet) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_WebFeatureSet_label(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Label, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_WebFeatureSet_label(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebFeatureSet",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _WebFeatureSet_description(ctx context.Context, field graphql.CollectedField, obj *model.WebFeatureSet) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_WebFeatureSet_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_WebFeatureSet_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebFeatureSet",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _WebFeatureSet_icon(ctx context.Context, field graphql.CollectedField, obj *model.WebFeatureSet) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_WebFeatureSet_icon(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Icon, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_WebFeatureSet_icon(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebFeatureSet",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _WebFeatureSet_enabled(ctx context.Context, field graphql.CollectedField, obj *model.WebFeatureSet) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_WebFeatureSet_enabled(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Enabled, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_WebFeatureSet_enabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebFeatureSet",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _WebServiceConfig_id(ctx context.Context, field graphql.CollectedField, obj *model.WebServiceConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_WebServiceConfig_id(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_WebServiceConfig_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebServiceConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _WebServiceConfig_name(ctx context.Context, field graphql.CollectedField, obj *model.WebServiceConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_WebServiceConfig_name(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Name, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_WebServiceConfig_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebServiceConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _WebServiceConfig_description(ctx context.Context, field graphql.CollectedField, obj *model.WebServiceConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_WebServiceConfig_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_WebServiceConfig_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebServiceConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _WebServiceConfig_bundleVersion(ctx context.Context, field graphql.CollectedField, obj *model.WebServiceConfig) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_WebServiceConfig_bundleVersion(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.BundleVersion, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_WebServiceConfig_bundleVersion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebServiceConfig",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Directive_name(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Name, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Directive_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Directive",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Directive_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Directive_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Directive",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Directive_locations(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Locations, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]string)
- fc.Result = res
- return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Directive_locations(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Directive",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type __DirectiveLocation does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Directive_args(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Args, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]introspection.InputValue)
- fc.Result = res
- return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Directive_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Directive",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "name":
- return ec.fieldContext___InputValue_name(ctx, field)
- case "description":
- return ec.fieldContext___InputValue_description(ctx, field)
- case "type":
- return ec.fieldContext___InputValue_type(ctx, field)
- case "defaultValue":
- return ec.fieldContext___InputValue_defaultValue(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Directive_isRepeatable(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.IsRepeatable, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Directive",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___EnumValue_name(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Name, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___EnumValue_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__EnumValue",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___EnumValue_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___EnumValue_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__EnumValue",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___EnumValue_isDeprecated(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.IsDeprecated(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__EnumValue",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___EnumValue_deprecationReason(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DeprecationReason(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__EnumValue",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Field_name(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Name, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Field_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Field",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Field_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Field_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Field",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Field_args(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Args, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]introspection.InputValue)
- fc.Result = res
- return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Field_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Field",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "name":
- return ec.fieldContext___InputValue_name(ctx, field)
- case "description":
- return ec.fieldContext___InputValue_description(ctx, field)
- case "type":
- return ec.fieldContext___InputValue_type(ctx, field)
- case "defaultValue":
- return ec.fieldContext___InputValue_defaultValue(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Field_type(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Type, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*introspection.Type)
- fc.Result = res
- return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Field_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Field",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "kind":
- return ec.fieldContext___Type_kind(ctx, field)
- case "name":
- return ec.fieldContext___Type_name(ctx, field)
- case "description":
- return ec.fieldContext___Type_description(ctx, field)
- case "fields":
- return ec.fieldContext___Type_fields(ctx, field)
- case "interfaces":
- return ec.fieldContext___Type_interfaces(ctx, field)
- case "possibleTypes":
- return ec.fieldContext___Type_possibleTypes(ctx, field)
- case "enumValues":
- return ec.fieldContext___Type_enumValues(ctx, field)
- case "inputFields":
- return ec.fieldContext___Type_inputFields(ctx, field)
- case "ofType":
- return ec.fieldContext___Type_ofType(ctx, field)
- case "specifiedByURL":
- return ec.fieldContext___Type_specifiedByURL(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Field_isDeprecated(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.IsDeprecated(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(bool)
- fc.Result = res
- return ec.marshalNBoolean2bool(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Field_isDeprecated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Field",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Boolean does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Field_deprecationReason(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DeprecationReason(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Field_deprecationReason(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Field",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___InputValue_name(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Name, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalNString2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___InputValue_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__InputValue",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___InputValue_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___InputValue_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__InputValue",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___InputValue_type(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Type, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*introspection.Type)
- fc.Result = res
- return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___InputValue_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__InputValue",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "kind":
- return ec.fieldContext___Type_kind(ctx, field)
- case "name":
- return ec.fieldContext___Type_name(ctx, field)
- case "description":
- return ec.fieldContext___Type_description(ctx, field)
- case "fields":
- return ec.fieldContext___Type_fields(ctx, field)
- case "interfaces":
- return ec.fieldContext___Type_interfaces(ctx, field)
- case "possibleTypes":
- return ec.fieldContext___Type_possibleTypes(ctx, field)
- case "enumValues":
- return ec.fieldContext___Type_enumValues(ctx, field)
- case "inputFields":
- return ec.fieldContext___Type_inputFields(ctx, field)
- case "ofType":
- return ec.fieldContext___Type_ofType(ctx, field)
- case "specifiedByURL":
- return ec.fieldContext___Type_specifiedByURL(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___InputValue_defaultValue(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.DefaultValue, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__InputValue",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Schema_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Schema_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Schema",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Schema_types(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Types(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]introspection.Type)
- fc.Result = res
- return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Schema_types(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Schema",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "kind":
- return ec.fieldContext___Type_kind(ctx, field)
- case "name":
- return ec.fieldContext___Type_name(ctx, field)
- case "description":
- return ec.fieldContext___Type_description(ctx, field)
- case "fields":
- return ec.fieldContext___Type_fields(ctx, field)
- case "interfaces":
- return ec.fieldContext___Type_interfaces(ctx, field)
- case "possibleTypes":
- return ec.fieldContext___Type_possibleTypes(ctx, field)
- case "enumValues":
- return ec.fieldContext___Type_enumValues(ctx, field)
- case "inputFields":
- return ec.fieldContext___Type_inputFields(ctx, field)
- case "ofType":
- return ec.fieldContext___Type_ofType(ctx, field)
- case "specifiedByURL":
- return ec.fieldContext___Type_specifiedByURL(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Schema_queryType(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.QueryType(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*introspection.Type)
- fc.Result = res
- return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Schema_queryType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Schema",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "kind":
- return ec.fieldContext___Type_kind(ctx, field)
- case "name":
- return ec.fieldContext___Type_name(ctx, field)
- case "description":
- return ec.fieldContext___Type_description(ctx, field)
- case "fields":
- return ec.fieldContext___Type_fields(ctx, field)
- case "interfaces":
- return ec.fieldContext___Type_interfaces(ctx, field)
- case "possibleTypes":
- return ec.fieldContext___Type_possibleTypes(ctx, field)
- case "enumValues":
- return ec.fieldContext___Type_enumValues(ctx, field)
- case "inputFields":
- return ec.fieldContext___Type_inputFields(ctx, field)
- case "ofType":
- return ec.fieldContext___Type_ofType(ctx, field)
- case "specifiedByURL":
- return ec.fieldContext___Type_specifiedByURL(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Schema_mutationType(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.MutationType(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*introspection.Type)
- fc.Result = res
- return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Schema_mutationType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Schema",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "kind":
- return ec.fieldContext___Type_kind(ctx, field)
- case "name":
- return ec.fieldContext___Type_name(ctx, field)
- case "description":
- return ec.fieldContext___Type_description(ctx, field)
- case "fields":
- return ec.fieldContext___Type_fields(ctx, field)
- case "interfaces":
- return ec.fieldContext___Type_interfaces(ctx, field)
- case "possibleTypes":
- return ec.fieldContext___Type_possibleTypes(ctx, field)
- case "enumValues":
- return ec.fieldContext___Type_enumValues(ctx, field)
- case "inputFields":
- return ec.fieldContext___Type_inputFields(ctx, field)
- case "ofType":
- return ec.fieldContext___Type_ofType(ctx, field)
- case "specifiedByURL":
- return ec.fieldContext___Type_specifiedByURL(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Schema_subscriptionType(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SubscriptionType(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*introspection.Type)
- fc.Result = res
- return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Schema",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "kind":
- return ec.fieldContext___Type_kind(ctx, field)
- case "name":
- return ec.fieldContext___Type_name(ctx, field)
- case "description":
- return ec.fieldContext___Type_description(ctx, field)
- case "fields":
- return ec.fieldContext___Type_fields(ctx, field)
- case "interfaces":
- return ec.fieldContext___Type_interfaces(ctx, field)
- case "possibleTypes":
- return ec.fieldContext___Type_possibleTypes(ctx, field)
- case "enumValues":
- return ec.fieldContext___Type_enumValues(ctx, field)
- case "inputFields":
- return ec.fieldContext___Type_inputFields(ctx, field)
- case "ofType":
- return ec.fieldContext___Type_ofType(ctx, field)
- case "specifiedByURL":
- return ec.fieldContext___Type_specifiedByURL(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Schema_directives(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Directives(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.([]introspection.Directive)
- fc.Result = res
- return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Schema_directives(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Schema",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "name":
- return ec.fieldContext___Directive_name(ctx, field)
- case "description":
- return ec.fieldContext___Directive_description(ctx, field)
- case "locations":
- return ec.fieldContext___Directive_locations(ctx, field)
- case "args":
- return ec.fieldContext___Directive_args(ctx, field)
- case "isRepeatable":
- return ec.fieldContext___Directive_isRepeatable(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Type_kind(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Kind(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(string)
- fc.Result = res
- return ec.marshalN__TypeKind2string(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Type_kind(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Type",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type __TypeKind does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Type_name(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Name(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Type_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Type",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Type_description(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Description(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Type_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Type",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Type_fields(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([]introspection.Field)
- fc.Result = res
- return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Type",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "name":
- return ec.fieldContext___Field_name(ctx, field)
- case "description":
- return ec.fieldContext___Field_description(ctx, field)
- case "args":
- return ec.fieldContext___Field_args(ctx, field)
- case "type":
- return ec.fieldContext___Field_type(ctx, field)
- case "isDeprecated":
- return ec.fieldContext___Field_isDeprecated(ctx, field)
- case "deprecationReason":
- return ec.fieldContext___Field_deprecationReason(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type __Field", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field___Type_fields_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Type_interfaces(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Interfaces(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([]introspection.Type)
- fc.Result = res
- return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Type_interfaces(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Type",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "kind":
- return ec.fieldContext___Type_kind(ctx, field)
- case "name":
- return ec.fieldContext___Type_name(ctx, field)
- case "description":
- return ec.fieldContext___Type_description(ctx, field)
- case "fields":
- return ec.fieldContext___Type_fields(ctx, field)
- case "interfaces":
- return ec.fieldContext___Type_interfaces(ctx, field)
- case "possibleTypes":
- return ec.fieldContext___Type_possibleTypes(ctx, field)
- case "enumValues":
- return ec.fieldContext___Type_enumValues(ctx, field)
- case "inputFields":
- return ec.fieldContext___Type_inputFields(ctx, field)
- case "ofType":
- return ec.fieldContext___Type_ofType(ctx, field)
- case "specifiedByURL":
- return ec.fieldContext___Type_specifiedByURL(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Type_possibleTypes(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.PossibleTypes(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([]introspection.Type)
- fc.Result = res
- return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Type_possibleTypes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Type",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "kind":
- return ec.fieldContext___Type_kind(ctx, field)
- case "name":
- return ec.fieldContext___Type_name(ctx, field)
- case "description":
- return ec.fieldContext___Type_description(ctx, field)
- case "fields":
- return ec.fieldContext___Type_fields(ctx, field)
- case "interfaces":
- return ec.fieldContext___Type_interfaces(ctx, field)
- case "possibleTypes":
- return ec.fieldContext___Type_possibleTypes(ctx, field)
- case "enumValues":
- return ec.fieldContext___Type_enumValues(ctx, field)
- case "inputFields":
- return ec.fieldContext___Type_inputFields(ctx, field)
- case "ofType":
- return ec.fieldContext___Type_ofType(ctx, field)
- case "specifiedByURL":
- return ec.fieldContext___Type_specifiedByURL(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Type_enumValues(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([]introspection.EnumValue)
- fc.Result = res
- return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Type",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "name":
- return ec.fieldContext___EnumValue_name(ctx, field)
- case "description":
- return ec.fieldContext___EnumValue_description(ctx, field)
- case "isDeprecated":
- return ec.fieldContext___EnumValue_isDeprecated(ctx, field)
- case "deprecationReason":
- return ec.fieldContext___EnumValue_deprecationReason(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type __EnumValue", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field___Type_enumValues_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Type_inputFields(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.InputFields(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.([]introspection.InputValue)
- fc.Result = res
- return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Type_inputFields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Type",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "name":
- return ec.fieldContext___InputValue_name(ctx, field)
- case "description":
- return ec.fieldContext___InputValue_description(ctx, field)
- case "type":
- return ec.fieldContext___InputValue_type(ctx, field)
- case "defaultValue":
- return ec.fieldContext___InputValue_defaultValue(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Type_ofType(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.OfType(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*introspection.Type)
- fc.Result = res
- return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Type_ofType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Type",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "kind":
- return ec.fieldContext___Type_kind(ctx, field)
- case "name":
- return ec.fieldContext___Type_name(ctx, field)
- case "description":
- return ec.fieldContext___Type_description(ctx, field)
- case "fields":
- return ec.fieldContext___Type_fields(ctx, field)
- case "interfaces":
- return ec.fieldContext___Type_interfaces(ctx, field)
- case "possibleTypes":
- return ec.fieldContext___Type_possibleTypes(ctx, field)
- case "enumValues":
- return ec.fieldContext___Type_enumValues(ctx, field)
- case "inputFields":
- return ec.fieldContext___Type_inputFields(ctx, field)
- case "ofType":
- return ec.fieldContext___Type_ofType(ctx, field)
- case "specifiedByURL":
- return ec.fieldContext___Type_specifiedByURL(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext___Type_specifiedByURL(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.SpecifiedByURL(), nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "__Type",
- Field: field,
- IsMethod: true,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-// endregion **************************** field.gotpl *****************************
-
-// region **************************** input.gotpl *****************************
-
-func (ec *executionContext) unmarshalInputConnectionConfig(ctx context.Context, obj interface{}) (model.ConnectionConfig, error) {
- var it model.ConnectionConfig
- asMap := map[string]interface{}{}
- for k, v := range obj.(map[string]interface{}) {
- asMap[k] = v
- }
-
- fieldsInOrder := [...]string{"connectionId", "name", "description", "templateId", "driverId", "host", "port", "serverName", "databaseName", "url", "properties", "template", "readOnly", "saveCredentials", "authModelId", "credentials", "providerProperties", "networkHandlersConfig", "dataSourceId", "userName", "userPassword", "folder"}
- for _, k := range fieldsInOrder {
- v, ok := asMap[k]
- if !ok {
- continue
- }
- switch k {
- case "connectionId":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("connectionId"))
- it.ConnectionID, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "name":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name"))
- it.Name, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "description":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description"))
- it.Description, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "templateId":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("templateId"))
- it.TemplateID, err = ec.unmarshalOID2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "driverId":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("driverId"))
- it.DriverID, err = ec.unmarshalOID2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "host":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("host"))
- it.Host, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "port":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("port"))
- it.Port, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "serverName":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("serverName"))
- it.ServerName, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "databaseName":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("databaseName"))
- it.DatabaseName, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "url":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("url"))
- it.URL, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "properties":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("properties"))
- it.Properties, err = ec.unmarshalOObject2interface(ctx, v)
- if err != nil {
- return it, err
- }
- case "template":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("template"))
- it.Template, err = ec.unmarshalOBoolean2ᚖbool(ctx, v)
- if err != nil {
- return it, err
- }
- case "readOnly":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("readOnly"))
- it.ReadOnly, err = ec.unmarshalOBoolean2ᚖbool(ctx, v)
- if err != nil {
- return it, err
- }
- case "saveCredentials":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("saveCredentials"))
- it.SaveCredentials, err = ec.unmarshalOBoolean2ᚖbool(ctx, v)
- if err != nil {
- return it, err
- }
- case "authModelId":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("authModelId"))
- it.AuthModelID, err = ec.unmarshalOID2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "credentials":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("credentials"))
- it.Credentials, err = ec.unmarshalOObject2interface(ctx, v)
- if err != nil {
- return it, err
- }
- case "providerProperties":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("providerProperties"))
- it.ProviderProperties, err = ec.unmarshalOObject2interface(ctx, v)
- if err != nil {
- return it, err
- }
- case "networkHandlersConfig":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("networkHandlersConfig"))
- it.NetworkHandlersConfig, err = ec.unmarshalONetworkHandlerConfigInput2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerConfigInputᚄ(ctx, v)
- if err != nil {
- return it, err
- }
- case "dataSourceId":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dataSourceId"))
- it.DataSourceID, err = ec.unmarshalOID2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "userName":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userName"))
- it.UserName, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "userPassword":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userPassword"))
- it.UserPassword, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "folder":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("folder"))
- it.Folder, err = ec.unmarshalOID2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- }
- }
-
- return it, nil
-}
-
-func (ec *executionContext) unmarshalInputDataTransferParameters(ctx context.Context, obj interface{}) (model.DataTransferParameters, error) {
- var it model.DataTransferParameters
- asMap := map[string]interface{}{}
- for k, v := range obj.(map[string]interface{}) {
- asMap[k] = v
- }
-
- fieldsInOrder := [...]string{"processorId", "settings", "processorProperties", "filter"}
- for _, k := range fieldsInOrder {
- v, ok := asMap[k]
- if !ok {
- continue
- }
- switch k {
- case "processorId":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("processorId"))
- it.ProcessorID, err = ec.unmarshalNID2string(ctx, v)
- if err != nil {
- return it, err
- }
- case "settings":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("settings"))
- it.Settings, err = ec.unmarshalOObject2interface(ctx, v)
- if err != nil {
- return it, err
- }
- case "processorProperties":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("processorProperties"))
- it.ProcessorProperties, err = ec.unmarshalNObject2interface(ctx, v)
- if err != nil {
- return it, err
- }
- case "filter":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("filter"))
- it.Filter, err = ec.unmarshalOSQLDataFilter2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLDataFilter(ctx, v)
- if err != nil {
- return it, err
- }
- }
- }
-
- return it, nil
-}
-
-func (ec *executionContext) unmarshalInputNavigatorSettingsInput(ctx context.Context, obj interface{}) (model.NavigatorSettingsInput, error) {
- var it model.NavigatorSettingsInput
- asMap := map[string]interface{}{}
- for k, v := range obj.(map[string]interface{}) {
- asMap[k] = v
- }
-
- fieldsInOrder := [...]string{"showSystemObjects", "showUtilityObjects", "showOnlyEntities", "mergeEntities", "hideFolders", "hideSchemas", "hideVirtualModel"}
- for _, k := range fieldsInOrder {
- v, ok := asMap[k]
- if !ok {
- continue
- }
- switch k {
- case "showSystemObjects":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("showSystemObjects"))
- it.ShowSystemObjects, err = ec.unmarshalNBoolean2bool(ctx, v)
- if err != nil {
- return it, err
- }
- case "showUtilityObjects":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("showUtilityObjects"))
- it.ShowUtilityObjects, err = ec.unmarshalNBoolean2bool(ctx, v)
- if err != nil {
- return it, err
- }
- case "showOnlyEntities":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("showOnlyEntities"))
- it.ShowOnlyEntities, err = ec.unmarshalNBoolean2bool(ctx, v)
- if err != nil {
- return it, err
- }
- case "mergeEntities":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("mergeEntities"))
- it.MergeEntities, err = ec.unmarshalNBoolean2bool(ctx, v)
- if err != nil {
- return it, err
- }
- case "hideFolders":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hideFolders"))
- it.HideFolders, err = ec.unmarshalNBoolean2bool(ctx, v)
- if err != nil {
- return it, err
- }
- case "hideSchemas":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hideSchemas"))
- it.HideSchemas, err = ec.unmarshalNBoolean2bool(ctx, v)
- if err != nil {
- return it, err
- }
- case "hideVirtualModel":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hideVirtualModel"))
- it.HideVirtualModel, err = ec.unmarshalNBoolean2bool(ctx, v)
- if err != nil {
- return it, err
- }
- }
- }
-
- return it, nil
-}
-
-func (ec *executionContext) unmarshalInputNetworkHandlerConfigInput(ctx context.Context, obj interface{}) (model.NetworkHandlerConfigInput, error) {
- var it model.NetworkHandlerConfigInput
- asMap := map[string]interface{}{}
- for k, v := range obj.(map[string]interface{}) {
- asMap[k] = v
- }
-
- fieldsInOrder := [...]string{"id", "enabled", "authType", "userName", "password", "key", "savePassword", "properties"}
- for _, k := range fieldsInOrder {
- v, ok := asMap[k]
- if !ok {
- continue
- }
- switch k {
- case "id":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
- it.ID, err = ec.unmarshalNID2string(ctx, v)
- if err != nil {
- return it, err
- }
- case "enabled":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("enabled"))
- it.Enabled, err = ec.unmarshalOBoolean2ᚖbool(ctx, v)
- if err != nil {
- return it, err
- }
- case "authType":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("authType"))
- it.AuthType, err = ec.unmarshalONetworkHandlerAuthType2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerAuthType(ctx, v)
- if err != nil {
- return it, err
- }
- case "userName":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userName"))
- it.UserName, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "password":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("password"))
- it.Password, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "key":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("key"))
- it.Key, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "savePassword":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("savePassword"))
- it.SavePassword, err = ec.unmarshalOBoolean2ᚖbool(ctx, v)
- if err != nil {
- return it, err
- }
- case "properties":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("properties"))
- it.Properties, err = ec.unmarshalOObject2interface(ctx, v)
- if err != nil {
- return it, err
- }
- }
- }
-
- return it, nil
-}
-
-func (ec *executionContext) unmarshalInputObjectPropertyFilter(ctx context.Context, obj interface{}) (model.ObjectPropertyFilter, error) {
- var it model.ObjectPropertyFilter
- asMap := map[string]interface{}{}
- for k, v := range obj.(map[string]interface{}) {
- asMap[k] = v
- }
-
- fieldsInOrder := [...]string{"ids", "features", "categories", "dataTypes"}
- for _, k := range fieldsInOrder {
- v, ok := asMap[k]
- if !ok {
- continue
- }
- switch k {
- case "ids":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ids"))
- it.Ids, err = ec.unmarshalOString2ᚕstringᚄ(ctx, v)
- if err != nil {
- return it, err
- }
- case "features":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("features"))
- it.Features, err = ec.unmarshalOString2ᚕstringᚄ(ctx, v)
- if err != nil {
- return it, err
- }
- case "categories":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categories"))
- it.Categories, err = ec.unmarshalOString2ᚕstringᚄ(ctx, v)
- if err != nil {
- return it, err
- }
- case "dataTypes":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dataTypes"))
- it.DataTypes, err = ec.unmarshalOString2ᚕstringᚄ(ctx, v)
- if err != nil {
- return it, err
- }
- }
- }
-
- return it, nil
-}
-
-func (ec *executionContext) unmarshalInputSQLDataFilter(ctx context.Context, obj interface{}) (model.SQLDataFilter, error) {
- var it model.SQLDataFilter
- asMap := map[string]interface{}{}
- for k, v := range obj.(map[string]interface{}) {
- asMap[k] = v
- }
-
- fieldsInOrder := [...]string{"offset", "limit", "constraints", "where", "orderBy"}
- for _, k := range fieldsInOrder {
- v, ok := asMap[k]
- if !ok {
- continue
- }
- switch k {
- case "offset":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("offset"))
- it.Offset, err = ec.unmarshalOFloat2ᚖfloat64(ctx, v)
- if err != nil {
- return it, err
- }
- case "limit":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("limit"))
- it.Limit, err = ec.unmarshalOInt2ᚖint(ctx, v)
- if err != nil {
- return it, err
- }
- case "constraints":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("constraints"))
- it.Constraints, err = ec.unmarshalOSQLDataFilterConstraint2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLDataFilterConstraint(ctx, v)
- if err != nil {
- return it, err
- }
- case "where":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("where"))
- it.Where, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "orderBy":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("orderBy"))
- it.OrderBy, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- }
- }
-
- return it, nil
-}
-
-func (ec *executionContext) unmarshalInputSQLDataFilterConstraint(ctx context.Context, obj interface{}) (model.SQLDataFilterConstraint, error) {
- var it model.SQLDataFilterConstraint
- asMap := map[string]interface{}{}
- for k, v := range obj.(map[string]interface{}) {
- asMap[k] = v
- }
-
- fieldsInOrder := [...]string{"attributePosition", "orderPosition", "orderAsc", "criteria", "operator", "value"}
- for _, k := range fieldsInOrder {
- v, ok := asMap[k]
- if !ok {
- continue
- }
- switch k {
- case "attributePosition":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("attributePosition"))
- it.AttributePosition, err = ec.unmarshalNInt2int(ctx, v)
- if err != nil {
- return it, err
- }
- case "orderPosition":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("orderPosition"))
- it.OrderPosition, err = ec.unmarshalOInt2ᚖint(ctx, v)
- if err != nil {
- return it, err
- }
- case "orderAsc":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("orderAsc"))
- it.OrderAsc, err = ec.unmarshalOBoolean2ᚖbool(ctx, v)
- if err != nil {
- return it, err
- }
- case "criteria":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("criteria"))
- it.Criteria, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "operator":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("operator"))
- it.Operator, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "value":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("value"))
- it.Value, err = ec.unmarshalOObject2interface(ctx, v)
- if err != nil {
- return it, err
- }
- }
- }
-
- return it, nil
-}
-
-func (ec *executionContext) unmarshalInputSQLResultRow(ctx context.Context, obj interface{}) (model.SQLResultRow, error) {
- var it model.SQLResultRow
- asMap := map[string]interface{}{}
- for k, v := range obj.(map[string]interface{}) {
- asMap[k] = v
- }
-
- fieldsInOrder := [...]string{"data", "updateValues"}
- for _, k := range fieldsInOrder {
- v, ok := asMap[k]
- if !ok {
- continue
- }
- switch k {
- case "data":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("data"))
- it.Data, err = ec.unmarshalNObject2ᚕinterface(ctx, v)
- if err != nil {
- return it, err
- }
- case "updateValues":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updateValues"))
- it.UpdateValues, err = ec.unmarshalOObject2interface(ctx, v)
- if err != nil {
- return it, err
- }
- }
- }
-
- return it, nil
-}
-
-func (ec *executionContext) unmarshalInputServerConfigInput(ctx context.Context, obj interface{}) (model.ServerConfigInput, error) {
- var it model.ServerConfigInput
- asMap := map[string]interface{}{}
- for k, v := range obj.(map[string]interface{}) {
- asMap[k] = v
- }
-
- fieldsInOrder := [...]string{"serverName", "serverURL", "adminName", "adminPassword", "anonymousAccessEnabled", "authenticationEnabled", "customConnectionsEnabled", "publicCredentialsSaveEnabled", "adminCredentialsSaveEnabled", "resourceManagerEnabled", "enabledFeatures", "enabledAuthProviders", "disabledDrivers", "sessionExpireTime"}
- for _, k := range fieldsInOrder {
- v, ok := asMap[k]
- if !ok {
- continue
- }
- switch k {
- case "serverName":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("serverName"))
- it.ServerName, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "serverURL":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("serverURL"))
- it.ServerURL, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "adminName":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("adminName"))
- it.AdminName, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "adminPassword":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("adminPassword"))
- it.AdminPassword, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "anonymousAccessEnabled":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("anonymousAccessEnabled"))
- it.AnonymousAccessEnabled, err = ec.unmarshalOBoolean2ᚖbool(ctx, v)
- if err != nil {
- return it, err
- }
- case "authenticationEnabled":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("authenticationEnabled"))
- it.AuthenticationEnabled, err = ec.unmarshalOBoolean2ᚖbool(ctx, v)
- if err != nil {
- return it, err
- }
- case "customConnectionsEnabled":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("customConnectionsEnabled"))
- it.CustomConnectionsEnabled, err = ec.unmarshalOBoolean2ᚖbool(ctx, v)
- if err != nil {
- return it, err
- }
- case "publicCredentialsSaveEnabled":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("publicCredentialsSaveEnabled"))
- it.PublicCredentialsSaveEnabled, err = ec.unmarshalOBoolean2ᚖbool(ctx, v)
- if err != nil {
- return it, err
- }
- case "adminCredentialsSaveEnabled":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("adminCredentialsSaveEnabled"))
- it.AdminCredentialsSaveEnabled, err = ec.unmarshalOBoolean2ᚖbool(ctx, v)
- if err != nil {
- return it, err
- }
- case "resourceManagerEnabled":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("resourceManagerEnabled"))
- it.ResourceManagerEnabled, err = ec.unmarshalOBoolean2ᚖbool(ctx, v)
- if err != nil {
- return it, err
- }
- case "enabledFeatures":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("enabledFeatures"))
- it.EnabledFeatures, err = ec.unmarshalOID2ᚕstringᚄ(ctx, v)
- if err != nil {
- return it, err
- }
- case "enabledAuthProviders":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("enabledAuthProviders"))
- it.EnabledAuthProviders, err = ec.unmarshalOID2ᚕstringᚄ(ctx, v)
- if err != nil {
- return it, err
- }
- case "disabledDrivers":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("disabledDrivers"))
- it.DisabledDrivers, err = ec.unmarshalOID2ᚕstringᚄ(ctx, v)
- if err != nil {
- return it, err
- }
- case "sessionExpireTime":
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sessionExpireTime"))
- it.SessionExpireTime, err = ec.unmarshalOInt2ᚖint(ctx, v)
- if err != nil {
- return it, err
- }
- }
- }
-
- return it, nil
-}
-
-// endregion **************************** input.gotpl *****************************
-
-// region ************************** interface.gotpl ***************************
-
-// endregion ************************** interface.gotpl ***************************
-
-// region **************************** object.gotpl ****************************
-
-var adminAuthProviderConfigurationImplementors = []string{"AdminAuthProviderConfiguration"}
-
-func (ec *executionContext) _AdminAuthProviderConfiguration(ctx context.Context, sel ast.SelectionSet, obj *model.AdminAuthProviderConfiguration) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, adminAuthProviderConfigurationImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("AdminAuthProviderConfiguration")
- case "providerId":
-
- out.Values[i] = ec._AdminAuthProviderConfiguration_providerId(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "id":
-
- out.Values[i] = ec._AdminAuthProviderConfiguration_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "displayName":
-
- out.Values[i] = ec._AdminAuthProviderConfiguration_displayName(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "disabled":
-
- out.Values[i] = ec._AdminAuthProviderConfiguration_disabled(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "iconURL":
-
- out.Values[i] = ec._AdminAuthProviderConfiguration_iconURL(ctx, field, obj)
-
- case "description":
-
- out.Values[i] = ec._AdminAuthProviderConfiguration_description(ctx, field, obj)
-
- case "parameters":
-
- out.Values[i] = ec._AdminAuthProviderConfiguration_parameters(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "signInLink":
-
- out.Values[i] = ec._AdminAuthProviderConfiguration_signInLink(ctx, field, obj)
-
- case "signOutLink":
-
- out.Values[i] = ec._AdminAuthProviderConfiguration_signOutLink(ctx, field, obj)
-
- case "redirectLink":
-
- out.Values[i] = ec._AdminAuthProviderConfiguration_redirectLink(ctx, field, obj)
-
- case "metadataLink":
-
- out.Values[i] = ec._AdminAuthProviderConfiguration_metadataLink(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var adminConnectionGrantInfoImplementors = []string{"AdminConnectionGrantInfo"}
-
-func (ec *executionContext) _AdminConnectionGrantInfo(ctx context.Context, sel ast.SelectionSet, obj *model.AdminConnectionGrantInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, adminConnectionGrantInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("AdminConnectionGrantInfo")
- case "connectionId":
-
- out.Values[i] = ec._AdminConnectionGrantInfo_connectionId(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "dataSourceId":
-
- out.Values[i] = ec._AdminConnectionGrantInfo_dataSourceId(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "subjectId":
-
- out.Values[i] = ec._AdminConnectionGrantInfo_subjectId(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "subjectType":
-
- out.Values[i] = ec._AdminConnectionGrantInfo_subjectType(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var adminConnectionSearchInfoImplementors = []string{"AdminConnectionSearchInfo"}
-
-func (ec *executionContext) _AdminConnectionSearchInfo(ctx context.Context, sel ast.SelectionSet, obj *model.AdminConnectionSearchInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, adminConnectionSearchInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("AdminConnectionSearchInfo")
- case "displayName":
-
- out.Values[i] = ec._AdminConnectionSearchInfo_displayName(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "host":
-
- out.Values[i] = ec._AdminConnectionSearchInfo_host(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "port":
-
- out.Values[i] = ec._AdminConnectionSearchInfo_port(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "possibleDrivers":
-
- out.Values[i] = ec._AdminConnectionSearchInfo_possibleDrivers(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "defaultDriver":
-
- out.Values[i] = ec._AdminConnectionSearchInfo_defaultDriver(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var adminPermissionInfoImplementors = []string{"AdminPermissionInfo"}
-
-func (ec *executionContext) _AdminPermissionInfo(ctx context.Context, sel ast.SelectionSet, obj *model.AdminPermissionInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, adminPermissionInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("AdminPermissionInfo")
- case "id":
-
- out.Values[i] = ec._AdminPermissionInfo_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "label":
-
- out.Values[i] = ec._AdminPermissionInfo_label(ctx, field, obj)
-
- case "description":
-
- out.Values[i] = ec._AdminPermissionInfo_description(ctx, field, obj)
-
- case "provider":
-
- out.Values[i] = ec._AdminPermissionInfo_provider(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "category":
-
- out.Values[i] = ec._AdminPermissionInfo_category(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var adminRoleInfoImplementors = []string{"AdminRoleInfo"}
-
-func (ec *executionContext) _AdminRoleInfo(ctx context.Context, sel ast.SelectionSet, obj *model.AdminRoleInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, adminRoleInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("AdminRoleInfo")
- case "roleId":
-
- out.Values[i] = ec._AdminRoleInfo_roleId(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "roleName":
-
- out.Values[i] = ec._AdminRoleInfo_roleName(ctx, field, obj)
-
- case "description":
-
- out.Values[i] = ec._AdminRoleInfo_description(ctx, field, obj)
-
- case "grantedUsers":
-
- out.Values[i] = ec._AdminRoleInfo_grantedUsers(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "grantedConnections":
-
- out.Values[i] = ec._AdminRoleInfo_grantedConnections(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "rolePermissions":
-
- out.Values[i] = ec._AdminRoleInfo_rolePermissions(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var adminUserInfoImplementors = []string{"AdminUserInfo"}
-
-func (ec *executionContext) _AdminUserInfo(ctx context.Context, sel ast.SelectionSet, obj *model.AdminUserInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, adminUserInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("AdminUserInfo")
- case "userId":
-
- out.Values[i] = ec._AdminUserInfo_userId(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "metaParameters":
-
- out.Values[i] = ec._AdminUserInfo_metaParameters(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "configurationParameters":
-
- out.Values[i] = ec._AdminUserInfo_configurationParameters(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "grantedRoles":
-
- out.Values[i] = ec._AdminUserInfo_grantedRoles(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "grantedConnections":
-
- out.Values[i] = ec._AdminUserInfo_grantedConnections(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "origins":
-
- out.Values[i] = ec._AdminUserInfo_origins(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "linkedAuthProviders":
-
- out.Values[i] = ec._AdminUserInfo_linkedAuthProviders(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "enabled":
-
- out.Values[i] = ec._AdminUserInfo_enabled(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var asyncTaskInfoImplementors = []string{"AsyncTaskInfo"}
-
-func (ec *executionContext) _AsyncTaskInfo(ctx context.Context, sel ast.SelectionSet, obj *model.AsyncTaskInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, asyncTaskInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("AsyncTaskInfo")
- case "id":
-
- out.Values[i] = ec._AsyncTaskInfo_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "name":
-
- out.Values[i] = ec._AsyncTaskInfo_name(ctx, field, obj)
-
- case "running":
-
- out.Values[i] = ec._AsyncTaskInfo_running(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "status":
-
- out.Values[i] = ec._AsyncTaskInfo_status(ctx, field, obj)
-
- case "error":
-
- out.Values[i] = ec._AsyncTaskInfo_error(ctx, field, obj)
-
- case "result":
-
- out.Values[i] = ec._AsyncTaskInfo_result(ctx, field, obj)
-
- case "taskResult":
-
- out.Values[i] = ec._AsyncTaskInfo_taskResult(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var authCredentialInfoImplementors = []string{"AuthCredentialInfo"}
-
-func (ec *executionContext) _AuthCredentialInfo(ctx context.Context, sel ast.SelectionSet, obj *model.AuthCredentialInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, authCredentialInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("AuthCredentialInfo")
- case "id":
-
- out.Values[i] = ec._AuthCredentialInfo_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "displayName":
-
- out.Values[i] = ec._AuthCredentialInfo_displayName(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "description":
-
- out.Values[i] = ec._AuthCredentialInfo_description(ctx, field, obj)
-
- case "admin":
-
- out.Values[i] = ec._AuthCredentialInfo_admin(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "user":
-
- out.Values[i] = ec._AuthCredentialInfo_user(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "identifying":
-
- out.Values[i] = ec._AuthCredentialInfo_identifying(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "possibleValues":
-
- out.Values[i] = ec._AuthCredentialInfo_possibleValues(ctx, field, obj)
-
- case "encryption":
-
- out.Values[i] = ec._AuthCredentialInfo_encryption(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var authInfoImplementors = []string{"AuthInfo"}
-
-func (ec *executionContext) _AuthInfo(ctx context.Context, sel ast.SelectionSet, obj *model.AuthInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, authInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("AuthInfo")
- case "redirectLink":
-
- out.Values[i] = ec._AuthInfo_redirectLink(ctx, field, obj)
-
- case "authId":
-
- out.Values[i] = ec._AuthInfo_authId(ctx, field, obj)
-
- case "authStatus":
-
- out.Values[i] = ec._AuthInfo_authStatus(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "userTokens":
-
- out.Values[i] = ec._AuthInfo_userTokens(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var authProviderConfigurationImplementors = []string{"AuthProviderConfiguration"}
-
-func (ec *executionContext) _AuthProviderConfiguration(ctx context.Context, sel ast.SelectionSet, obj *model.AuthProviderConfiguration) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, authProviderConfigurationImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("AuthProviderConfiguration")
- case "id":
-
- out.Values[i] = ec._AuthProviderConfiguration_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "displayName":
-
- out.Values[i] = ec._AuthProviderConfiguration_displayName(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "disabled":
-
- out.Values[i] = ec._AuthProviderConfiguration_disabled(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "iconURL":
-
- out.Values[i] = ec._AuthProviderConfiguration_iconURL(ctx, field, obj)
-
- case "description":
-
- out.Values[i] = ec._AuthProviderConfiguration_description(ctx, field, obj)
-
- case "signInLink":
-
- out.Values[i] = ec._AuthProviderConfiguration_signInLink(ctx, field, obj)
-
- case "signOutLink":
-
- out.Values[i] = ec._AuthProviderConfiguration_signOutLink(ctx, field, obj)
-
- case "metadataLink":
-
- out.Values[i] = ec._AuthProviderConfiguration_metadataLink(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var authProviderCredentialsProfileImplementors = []string{"AuthProviderCredentialsProfile"}
-
-func (ec *executionContext) _AuthProviderCredentialsProfile(ctx context.Context, sel ast.SelectionSet, obj *model.AuthProviderCredentialsProfile) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, authProviderCredentialsProfileImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("AuthProviderCredentialsProfile")
- case "id":
-
- out.Values[i] = ec._AuthProviderCredentialsProfile_id(ctx, field, obj)
-
- case "label":
-
- out.Values[i] = ec._AuthProviderCredentialsProfile_label(ctx, field, obj)
-
- case "description":
-
- out.Values[i] = ec._AuthProviderCredentialsProfile_description(ctx, field, obj)
-
- case "credentialParameters":
-
- out.Values[i] = ec._AuthProviderCredentialsProfile_credentialParameters(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var authProviderInfoImplementors = []string{"AuthProviderInfo"}
-
-func (ec *executionContext) _AuthProviderInfo(ctx context.Context, sel ast.SelectionSet, obj *model.AuthProviderInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, authProviderInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("AuthProviderInfo")
- case "id":
-
- out.Values[i] = ec._AuthProviderInfo_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "label":
-
- out.Values[i] = ec._AuthProviderInfo_label(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "icon":
-
- out.Values[i] = ec._AuthProviderInfo_icon(ctx, field, obj)
-
- case "description":
-
- out.Values[i] = ec._AuthProviderInfo_description(ctx, field, obj)
-
- case "defaultProvider":
-
- out.Values[i] = ec._AuthProviderInfo_defaultProvider(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "configurable":
-
- out.Values[i] = ec._AuthProviderInfo_configurable(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "configurations":
-
- out.Values[i] = ec._AuthProviderInfo_configurations(ctx, field, obj)
-
- case "credentialProfiles":
-
- out.Values[i] = ec._AuthProviderInfo_credentialProfiles(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "requiredFeatures":
-
- out.Values[i] = ec._AuthProviderInfo_requiredFeatures(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var connectionFolderInfoImplementors = []string{"ConnectionFolderInfo"}
-
-func (ec *executionContext) _ConnectionFolderInfo(ctx context.Context, sel ast.SelectionSet, obj *model.ConnectionFolderInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, connectionFolderInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("ConnectionFolderInfo")
- case "id":
-
- out.Values[i] = ec._ConnectionFolderInfo_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "description":
-
- out.Values[i] = ec._ConnectionFolderInfo_description(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var connectionInfoImplementors = []string{"ConnectionInfo"}
-
-func (ec *executionContext) _ConnectionInfo(ctx context.Context, sel ast.SelectionSet, obj *model.ConnectionInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, connectionInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("ConnectionInfo")
- case "id":
-
- out.Values[i] = ec._ConnectionInfo_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "driverId":
-
- out.Values[i] = ec._ConnectionInfo_driverId(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "name":
-
- out.Values[i] = ec._ConnectionInfo_name(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "description":
-
- out.Values[i] = ec._ConnectionInfo_description(ctx, field, obj)
-
- case "host":
-
- out.Values[i] = ec._ConnectionInfo_host(ctx, field, obj)
-
- case "port":
-
- out.Values[i] = ec._ConnectionInfo_port(ctx, field, obj)
-
- case "serverName":
-
- out.Values[i] = ec._ConnectionInfo_serverName(ctx, field, obj)
-
- case "databaseName":
-
- out.Values[i] = ec._ConnectionInfo_databaseName(ctx, field, obj)
-
- case "url":
-
- out.Values[i] = ec._ConnectionInfo_url(ctx, field, obj)
-
- case "properties":
-
- out.Values[i] = ec._ConnectionInfo_properties(ctx, field, obj)
-
- case "template":
-
- out.Values[i] = ec._ConnectionInfo_template(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "connected":
-
- out.Values[i] = ec._ConnectionInfo_connected(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "provided":
-
- out.Values[i] = ec._ConnectionInfo_provided(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "readOnly":
-
- out.Values[i] = ec._ConnectionInfo_readOnly(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "useUrl":
-
- out.Values[i] = ec._ConnectionInfo_useUrl(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "saveCredentials":
-
- out.Values[i] = ec._ConnectionInfo_saveCredentials(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "folder":
-
- out.Values[i] = ec._ConnectionInfo_folder(ctx, field, obj)
-
- case "nodePath":
-
- out.Values[i] = ec._ConnectionInfo_nodePath(ctx, field, obj)
-
- case "connectTime":
-
- out.Values[i] = ec._ConnectionInfo_connectTime(ctx, field, obj)
-
- case "connectionError":
-
- out.Values[i] = ec._ConnectionInfo_connectionError(ctx, field, obj)
-
- case "serverVersion":
-
- out.Values[i] = ec._ConnectionInfo_serverVersion(ctx, field, obj)
-
- case "clientVersion":
-
- out.Values[i] = ec._ConnectionInfo_clientVersion(ctx, field, obj)
-
- case "origin":
-
- out.Values[i] = ec._ConnectionInfo_origin(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "authNeeded":
-
- out.Values[i] = ec._ConnectionInfo_authNeeded(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "authModel":
-
- out.Values[i] = ec._ConnectionInfo_authModel(ctx, field, obj)
-
- case "authProperties":
-
- out.Values[i] = ec._ConnectionInfo_authProperties(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "providerProperties":
-
- out.Values[i] = ec._ConnectionInfo_providerProperties(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "networkHandlersConfig":
-
- out.Values[i] = ec._ConnectionInfo_networkHandlersConfig(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "features":
-
- out.Values[i] = ec._ConnectionInfo_features(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "navigatorSettings":
-
- out.Values[i] = ec._ConnectionInfo_navigatorSettings(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "supportedDataFormats":
-
- out.Values[i] = ec._ConnectionInfo_supportedDataFormats(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var dataTransferProcessorInfoImplementors = []string{"DataTransferProcessorInfo"}
-
-func (ec *executionContext) _DataTransferProcessorInfo(ctx context.Context, sel ast.SelectionSet, obj *model.DataTransferProcessorInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, dataTransferProcessorInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("DataTransferProcessorInfo")
- case "id":
-
- out.Values[i] = ec._DataTransferProcessorInfo_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "name":
-
- out.Values[i] = ec._DataTransferProcessorInfo_name(ctx, field, obj)
-
- case "description":
-
- out.Values[i] = ec._DataTransferProcessorInfo_description(ctx, field, obj)
-
- case "fileExtension":
-
- out.Values[i] = ec._DataTransferProcessorInfo_fileExtension(ctx, field, obj)
-
- case "appFileExtension":
-
- out.Values[i] = ec._DataTransferProcessorInfo_appFileExtension(ctx, field, obj)
-
- case "appName":
-
- out.Values[i] = ec._DataTransferProcessorInfo_appName(ctx, field, obj)
-
- case "order":
-
- out.Values[i] = ec._DataTransferProcessorInfo_order(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "icon":
-
- out.Values[i] = ec._DataTransferProcessorInfo_icon(ctx, field, obj)
-
- case "properties":
-
- out.Values[i] = ec._DataTransferProcessorInfo_properties(ctx, field, obj)
-
- case "isBinary":
-
- out.Values[i] = ec._DataTransferProcessorInfo_isBinary(ctx, field, obj)
-
- case "isHTML":
-
- out.Values[i] = ec._DataTransferProcessorInfo_isHTML(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var dataTypeLogicalOperationImplementors = []string{"DataTypeLogicalOperation"}
-
-func (ec *executionContext) _DataTypeLogicalOperation(ctx context.Context, sel ast.SelectionSet, obj *model.DataTypeLogicalOperation) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, dataTypeLogicalOperationImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("DataTypeLogicalOperation")
- case "id":
-
- out.Values[i] = ec._DataTypeLogicalOperation_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "expression":
-
- out.Values[i] = ec._DataTypeLogicalOperation_expression(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "argumentCount":
-
- out.Values[i] = ec._DataTypeLogicalOperation_argumentCount(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var databaseAuthModelImplementors = []string{"DatabaseAuthModel"}
-
-func (ec *executionContext) _DatabaseAuthModel(ctx context.Context, sel ast.SelectionSet, obj *model.DatabaseAuthModel) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, databaseAuthModelImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("DatabaseAuthModel")
- case "id":
-
- out.Values[i] = ec._DatabaseAuthModel_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "displayName":
-
- out.Values[i] = ec._DatabaseAuthModel_displayName(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "description":
-
- out.Values[i] = ec._DatabaseAuthModel_description(ctx, field, obj)
-
- case "icon":
-
- out.Values[i] = ec._DatabaseAuthModel_icon(ctx, field, obj)
-
- case "requiresLocalConfiguration":
-
- out.Values[i] = ec._DatabaseAuthModel_requiresLocalConfiguration(ctx, field, obj)
-
- case "properties":
-
- out.Values[i] = ec._DatabaseAuthModel_properties(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var databaseCatalogImplementors = []string{"DatabaseCatalog"}
-
-func (ec *executionContext) _DatabaseCatalog(ctx context.Context, sel ast.SelectionSet, obj *model.DatabaseCatalog) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, databaseCatalogImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("DatabaseCatalog")
- case "catalog":
-
- out.Values[i] = ec._DatabaseCatalog_catalog(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "schemaList":
-
- out.Values[i] = ec._DatabaseCatalog_schemaList(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var databaseDocumentImplementors = []string{"DatabaseDocument"}
-
-func (ec *executionContext) _DatabaseDocument(ctx context.Context, sel ast.SelectionSet, obj *model.DatabaseDocument) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, databaseDocumentImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("DatabaseDocument")
- case "id":
-
- out.Values[i] = ec._DatabaseDocument_id(ctx, field, obj)
-
- case "contentType":
-
- out.Values[i] = ec._DatabaseDocument_contentType(ctx, field, obj)
-
- case "properties":
-
- out.Values[i] = ec._DatabaseDocument_properties(ctx, field, obj)
-
- case "data":
-
- out.Values[i] = ec._DatabaseDocument_data(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var databaseObjectInfoImplementors = []string{"DatabaseObjectInfo"}
-
-func (ec *executionContext) _DatabaseObjectInfo(ctx context.Context, sel ast.SelectionSet, obj *model.DatabaseObjectInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, databaseObjectInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("DatabaseObjectInfo")
- case "name":
-
- out.Values[i] = ec._DatabaseObjectInfo_name(ctx, field, obj)
-
- case "description":
-
- out.Values[i] = ec._DatabaseObjectInfo_description(ctx, field, obj)
-
- case "type":
-
- out.Values[i] = ec._DatabaseObjectInfo_type(ctx, field, obj)
-
- case "properties":
-
- out.Values[i] = ec._DatabaseObjectInfo_properties(ctx, field, obj)
-
- case "ordinalPosition":
-
- out.Values[i] = ec._DatabaseObjectInfo_ordinalPosition(ctx, field, obj)
-
- case "fullyQualifiedName":
-
- out.Values[i] = ec._DatabaseObjectInfo_fullyQualifiedName(ctx, field, obj)
-
- case "overloadedName":
-
- out.Values[i] = ec._DatabaseObjectInfo_overloadedName(ctx, field, obj)
-
- case "uniqueName":
-
- out.Values[i] = ec._DatabaseObjectInfo_uniqueName(ctx, field, obj)
-
- case "state":
-
- out.Values[i] = ec._DatabaseObjectInfo_state(ctx, field, obj)
-
- case "features":
-
- out.Values[i] = ec._DatabaseObjectInfo_features(ctx, field, obj)
-
- case "editors":
-
- out.Values[i] = ec._DatabaseObjectInfo_editors(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var databaseStructContainersImplementors = []string{"DatabaseStructContainers"}
-
-func (ec *executionContext) _DatabaseStructContainers(ctx context.Context, sel ast.SelectionSet, obj *model.DatabaseStructContainers) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, databaseStructContainersImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("DatabaseStructContainers")
- case "catalogList":
-
- out.Values[i] = ec._DatabaseStructContainers_catalogList(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "schemaList":
-
- out.Values[i] = ec._DatabaseStructContainers_schemaList(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "supportsCatalogChange":
-
- out.Values[i] = ec._DatabaseStructContainers_supportsCatalogChange(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "supportsSchemaChange":
-
- out.Values[i] = ec._DatabaseStructContainers_supportsSchemaChange(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var driverInfoImplementors = []string{"DriverInfo"}
-
-func (ec *executionContext) _DriverInfo(ctx context.Context, sel ast.SelectionSet, obj *model.DriverInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, driverInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("DriverInfo")
- case "id":
-
- out.Values[i] = ec._DriverInfo_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "name":
-
- out.Values[i] = ec._DriverInfo_name(ctx, field, obj)
-
- case "description":
-
- out.Values[i] = ec._DriverInfo_description(ctx, field, obj)
-
- case "icon":
-
- out.Values[i] = ec._DriverInfo_icon(ctx, field, obj)
-
- case "iconBig":
-
- out.Values[i] = ec._DriverInfo_iconBig(ctx, field, obj)
-
- case "providerId":
-
- out.Values[i] = ec._DriverInfo_providerId(ctx, field, obj)
-
- case "driverClassName":
-
- out.Values[i] = ec._DriverInfo_driverClassName(ctx, field, obj)
-
- case "defaultHost":
-
- out.Values[i] = ec._DriverInfo_defaultHost(ctx, field, obj)
-
- case "defaultPort":
-
- out.Values[i] = ec._DriverInfo_defaultPort(ctx, field, obj)
-
- case "defaultDatabase":
-
- out.Values[i] = ec._DriverInfo_defaultDatabase(ctx, field, obj)
-
- case "defaultServer":
-
- out.Values[i] = ec._DriverInfo_defaultServer(ctx, field, obj)
-
- case "defaultUser":
-
- out.Values[i] = ec._DriverInfo_defaultUser(ctx, field, obj)
-
- case "sampleURL":
-
- out.Values[i] = ec._DriverInfo_sampleURL(ctx, field, obj)
-
- case "driverInfoURL":
-
- out.Values[i] = ec._DriverInfo_driverInfoURL(ctx, field, obj)
-
- case "driverPropertiesURL":
-
- out.Values[i] = ec._DriverInfo_driverPropertiesURL(ctx, field, obj)
-
- case "embedded":
-
- out.Values[i] = ec._DriverInfo_embedded(ctx, field, obj)
-
- case "enabled":
-
- out.Values[i] = ec._DriverInfo_enabled(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "requiresServerName":
-
- out.Values[i] = ec._DriverInfo_requiresServerName(ctx, field, obj)
-
- case "allowsEmptyPassword":
-
- out.Values[i] = ec._DriverInfo_allowsEmptyPassword(ctx, field, obj)
-
- case "licenseRequired":
-
- out.Values[i] = ec._DriverInfo_licenseRequired(ctx, field, obj)
-
- case "license":
-
- out.Values[i] = ec._DriverInfo_license(ctx, field, obj)
-
- case "custom":
-
- out.Values[i] = ec._DriverInfo_custom(ctx, field, obj)
-
- case "promotedScore":
-
- out.Values[i] = ec._DriverInfo_promotedScore(ctx, field, obj)
-
- case "driverProperties":
-
- out.Values[i] = ec._DriverInfo_driverProperties(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "driverParameters":
-
- out.Values[i] = ec._DriverInfo_driverParameters(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "providerProperties":
-
- out.Values[i] = ec._DriverInfo_providerProperties(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "anonymousAccess":
-
- out.Values[i] = ec._DriverInfo_anonymousAccess(ctx, field, obj)
-
- case "defaultAuthModel":
-
- out.Values[i] = ec._DriverInfo_defaultAuthModel(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "applicableAuthModels":
-
- out.Values[i] = ec._DriverInfo_applicableAuthModels(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "applicableNetworkHandlers":
-
- out.Values[i] = ec._DriverInfo_applicableNetworkHandlers(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var logEntryImplementors = []string{"LogEntry"}
-
-func (ec *executionContext) _LogEntry(ctx context.Context, sel ast.SelectionSet, obj *model.LogEntry) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, logEntryImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("LogEntry")
- case "time":
-
- out.Values[i] = ec._LogEntry_time(ctx, field, obj)
-
- case "type":
-
- out.Values[i] = ec._LogEntry_type(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "message":
-
- out.Values[i] = ec._LogEntry_message(ctx, field, obj)
-
- case "stackTrace":
-
- out.Values[i] = ec._LogEntry_stackTrace(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var mutationImplementors = []string{"Mutation"}
-
-func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors)
- ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{
- Object: "Mutation",
- })
-
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{
- Object: field.Name,
- Field: field,
- })
-
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("Mutation")
- case "setUserConfigurationParameter":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_setUserConfigurationParameter(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "openSession":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_openSession(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "closeSession":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_closeSession(ctx, field)
- })
-
- case "touchSession":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_touchSession(ctx, field)
- })
-
- case "refreshSessionConnections":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_refreshSessionConnections(ctx, field)
- })
-
- case "changeSessionLanguage":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_changeSessionLanguage(ctx, field)
- })
-
- case "createConnection":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_createConnection(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "updateConnection":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_updateConnection(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "deleteConnection":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_deleteConnection(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "createConnectionFromTemplate":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_createConnectionFromTemplate(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "createConnectionFolder":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_createConnectionFolder(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "deleteConnectionFolder":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_deleteConnectionFolder(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "copyConnectionFromNode":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_copyConnectionFromNode(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "testConnection":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_testConnection(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "testNetworkHandler":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_testNetworkHandler(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "initConnection":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_initConnection(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "closeConnection":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_closeConnection(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "setConnectionNavigatorSettings":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_setConnectionNavigatorSettings(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "asyncTaskCancel":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_asyncTaskCancel(ctx, field)
- })
-
- case "asyncTaskInfo":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_asyncTaskInfo(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "openConnection":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_openConnection(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "asyncTaskStatus":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_asyncTaskStatus(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "navRenameNode":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_navRenameNode(ctx, field)
- })
-
- case "navDeleteNodes":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_navDeleteNodes(ctx, field)
- })
-
- case "navMoveNodesToFolder":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_navMoveNodesToFolder(ctx, field)
- })
-
- case "rmCreateResource":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_rmCreateResource(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "rmMoveResource":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_rmMoveResource(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "rmDeleteResource":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_rmDeleteResource(ctx, field)
- })
-
- case "rmWriteResourceStringContent":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_rmWriteResourceStringContent(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "sqlContextCreate":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_sqlContextCreate(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "sqlContextSetDefaults":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_sqlContextSetDefaults(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "sqlContextDestroy":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_sqlContextDestroy(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "asyncSqlExecuteQuery":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_asyncSqlExecuteQuery(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "asyncReadDataFromContainer":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_asyncReadDataFromContainer(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "sqlResultClose":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_sqlResultClose(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "updateResultsDataBatch":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_updateResultsDataBatch(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "updateResultsDataBatchScript":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_updateResultsDataBatchScript(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "readLobValue":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_readLobValue(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "asyncSqlExecuteResults":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_asyncSqlExecuteResults(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "asyncSqlExplainExecutionPlan":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_asyncSqlExplainExecutionPlan(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "asyncSqlExplainExecutionPlanResult":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_asyncSqlExplainExecutionPlanResult(ctx, field)
- })
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var navigatorNodeInfoImplementors = []string{"NavigatorNodeInfo"}
-
-func (ec *executionContext) _NavigatorNodeInfo(ctx context.Context, sel ast.SelectionSet, obj *model.NavigatorNodeInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, navigatorNodeInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("NavigatorNodeInfo")
- case "id":
-
- out.Values[i] = ec._NavigatorNodeInfo_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "name":
-
- out.Values[i] = ec._NavigatorNodeInfo_name(ctx, field, obj)
-
- case "fullName":
-
- out.Values[i] = ec._NavigatorNodeInfo_fullName(ctx, field, obj)
-
- case "icon":
-
- out.Values[i] = ec._NavigatorNodeInfo_icon(ctx, field, obj)
-
- case "description":
-
- out.Values[i] = ec._NavigatorNodeInfo_description(ctx, field, obj)
-
- case "nodeType":
-
- out.Values[i] = ec._NavigatorNodeInfo_nodeType(ctx, field, obj)
-
- case "hasChildren":
-
- out.Values[i] = ec._NavigatorNodeInfo_hasChildren(ctx, field, obj)
-
- case "object":
-
- out.Values[i] = ec._NavigatorNodeInfo_object(ctx, field, obj)
-
- case "features":
-
- out.Values[i] = ec._NavigatorNodeInfo_features(ctx, field, obj)
-
- case "nodeDetails":
-
- out.Values[i] = ec._NavigatorNodeInfo_nodeDetails(ctx, field, obj)
-
- case "folder":
-
- out.Values[i] = ec._NavigatorNodeInfo_folder(ctx, field, obj)
-
- case "inline":
-
- out.Values[i] = ec._NavigatorNodeInfo_inline(ctx, field, obj)
-
- case "navigable":
-
- out.Values[i] = ec._NavigatorNodeInfo_navigable(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var navigatorSettingsImplementors = []string{"NavigatorSettings"}
-
-func (ec *executionContext) _NavigatorSettings(ctx context.Context, sel ast.SelectionSet, obj *model.NavigatorSettings) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, navigatorSettingsImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("NavigatorSettings")
- case "showSystemObjects":
-
- out.Values[i] = ec._NavigatorSettings_showSystemObjects(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "showUtilityObjects":
-
- out.Values[i] = ec._NavigatorSettings_showUtilityObjects(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "showOnlyEntities":
-
- out.Values[i] = ec._NavigatorSettings_showOnlyEntities(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "mergeEntities":
-
- out.Values[i] = ec._NavigatorSettings_mergeEntities(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "hideFolders":
-
- out.Values[i] = ec._NavigatorSettings_hideFolders(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "hideSchemas":
-
- out.Values[i] = ec._NavigatorSettings_hideSchemas(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "hideVirtualModel":
-
- out.Values[i] = ec._NavigatorSettings_hideVirtualModel(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var networkEndpointInfoImplementors = []string{"NetworkEndpointInfo"}
-
-func (ec *executionContext) _NetworkEndpointInfo(ctx context.Context, sel ast.SelectionSet, obj *model.NetworkEndpointInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, networkEndpointInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("NetworkEndpointInfo")
- case "message":
-
- out.Values[i] = ec._NetworkEndpointInfo_message(ctx, field, obj)
-
- case "clientVersion":
-
- out.Values[i] = ec._NetworkEndpointInfo_clientVersion(ctx, field, obj)
-
- case "serverVersion":
-
- out.Values[i] = ec._NetworkEndpointInfo_serverVersion(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var networkHandlerConfigImplementors = []string{"NetworkHandlerConfig"}
-
-func (ec *executionContext) _NetworkHandlerConfig(ctx context.Context, sel ast.SelectionSet, obj *model.NetworkHandlerConfig) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, networkHandlerConfigImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("NetworkHandlerConfig")
- case "id":
-
- out.Values[i] = ec._NetworkHandlerConfig_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "enabled":
-
- out.Values[i] = ec._NetworkHandlerConfig_enabled(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "authType":
-
- out.Values[i] = ec._NetworkHandlerConfig_authType(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "userName":
-
- out.Values[i] = ec._NetworkHandlerConfig_userName(ctx, field, obj)
-
- case "password":
-
- out.Values[i] = ec._NetworkHandlerConfig_password(ctx, field, obj)
-
- case "key":
-
- out.Values[i] = ec._NetworkHandlerConfig_key(ctx, field, obj)
-
- case "savePassword":
-
- out.Values[i] = ec._NetworkHandlerConfig_savePassword(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "properties":
-
- out.Values[i] = ec._NetworkHandlerConfig_properties(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var networkHandlerDescriptorImplementors = []string{"NetworkHandlerDescriptor"}
-
-func (ec *executionContext) _NetworkHandlerDescriptor(ctx context.Context, sel ast.SelectionSet, obj *model.NetworkHandlerDescriptor) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, networkHandlerDescriptorImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("NetworkHandlerDescriptor")
- case "id":
-
- out.Values[i] = ec._NetworkHandlerDescriptor_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "codeName":
-
- out.Values[i] = ec._NetworkHandlerDescriptor_codeName(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "label":
-
- out.Values[i] = ec._NetworkHandlerDescriptor_label(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "description":
-
- out.Values[i] = ec._NetworkHandlerDescriptor_description(ctx, field, obj)
-
- case "secured":
-
- out.Values[i] = ec._NetworkHandlerDescriptor_secured(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "type":
-
- out.Values[i] = ec._NetworkHandlerDescriptor_type(ctx, field, obj)
-
- case "properties":
-
- out.Values[i] = ec._NetworkHandlerDescriptor_properties(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var objectDescriptorImplementors = []string{"ObjectDescriptor"}
-
-func (ec *executionContext) _ObjectDescriptor(ctx context.Context, sel ast.SelectionSet, obj *model.ObjectDescriptor) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, objectDescriptorImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("ObjectDescriptor")
- case "id":
-
- out.Values[i] = ec._ObjectDescriptor_id(ctx, field, obj)
-
- case "displayName":
-
- out.Values[i] = ec._ObjectDescriptor_displayName(ctx, field, obj)
-
- case "fullName":
-
- out.Values[i] = ec._ObjectDescriptor_fullName(ctx, field, obj)
-
- case "uniqueName":
-
- out.Values[i] = ec._ObjectDescriptor_uniqueName(ctx, field, obj)
-
- case "description":
-
- out.Values[i] = ec._ObjectDescriptor_description(ctx, field, obj)
-
- case "value":
-
- out.Values[i] = ec._ObjectDescriptor_value(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var objectDetailsImplementors = []string{"ObjectDetails"}
-
-func (ec *executionContext) _ObjectDetails(ctx context.Context, sel ast.SelectionSet, obj *model.ObjectDetails) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, objectDetailsImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("ObjectDetails")
- case "id":
-
- out.Values[i] = ec._ObjectDetails_id(ctx, field, obj)
-
- case "displayName":
-
- out.Values[i] = ec._ObjectDetails_displayName(ctx, field, obj)
-
- case "description":
-
- out.Values[i] = ec._ObjectDetails_description(ctx, field, obj)
-
- case "value":
-
- out.Values[i] = ec._ObjectDetails_value(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var objectOriginImplementors = []string{"ObjectOrigin"}
-
-func (ec *executionContext) _ObjectOrigin(ctx context.Context, sel ast.SelectionSet, obj *model.ObjectOrigin) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, objectOriginImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("ObjectOrigin")
- case "type":
-
- out.Values[i] = ec._ObjectOrigin_type(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "subType":
-
- out.Values[i] = ec._ObjectOrigin_subType(ctx, field, obj)
-
- case "displayName":
-
- out.Values[i] = ec._ObjectOrigin_displayName(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "icon":
-
- out.Values[i] = ec._ObjectOrigin_icon(ctx, field, obj)
-
- case "configuration":
-
- out.Values[i] = ec._ObjectOrigin_configuration(ctx, field, obj)
-
- case "details":
-
- out.Values[i] = ec._ObjectOrigin_details(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var objectPropertyInfoImplementors = []string{"ObjectPropertyInfo"}
-
-func (ec *executionContext) _ObjectPropertyInfo(ctx context.Context, sel ast.SelectionSet, obj *model.ObjectPropertyInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, objectPropertyInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("ObjectPropertyInfo")
- case "id":
-
- out.Values[i] = ec._ObjectPropertyInfo_id(ctx, field, obj)
-
- case "displayName":
-
- out.Values[i] = ec._ObjectPropertyInfo_displayName(ctx, field, obj)
-
- case "description":
-
- out.Values[i] = ec._ObjectPropertyInfo_description(ctx, field, obj)
-
- case "category":
-
- out.Values[i] = ec._ObjectPropertyInfo_category(ctx, field, obj)
-
- case "dataType":
-
- out.Values[i] = ec._ObjectPropertyInfo_dataType(ctx, field, obj)
-
- case "value":
-
- out.Values[i] = ec._ObjectPropertyInfo_value(ctx, field, obj)
-
- case "validValues":
-
- out.Values[i] = ec._ObjectPropertyInfo_validValues(ctx, field, obj)
-
- case "defaultValue":
-
- out.Values[i] = ec._ObjectPropertyInfo_defaultValue(ctx, field, obj)
-
- case "length":
-
- out.Values[i] = ec._ObjectPropertyInfo_length(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "features":
-
- out.Values[i] = ec._ObjectPropertyInfo_features(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "order":
-
- out.Values[i] = ec._ObjectPropertyInfo_order(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var productInfoImplementors = []string{"ProductInfo"}
-
-func (ec *executionContext) _ProductInfo(ctx context.Context, sel ast.SelectionSet, obj *model.ProductInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, productInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("ProductInfo")
- case "id":
-
- out.Values[i] = ec._ProductInfo_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "version":
-
- out.Values[i] = ec._ProductInfo_version(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "name":
-
- out.Values[i] = ec._ProductInfo_name(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "description":
-
- out.Values[i] = ec._ProductInfo_description(ctx, field, obj)
-
- case "buildTime":
-
- out.Values[i] = ec._ProductInfo_buildTime(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "releaseTime":
-
- out.Values[i] = ec._ProductInfo_releaseTime(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "licenseInfo":
-
- out.Values[i] = ec._ProductInfo_licenseInfo(ctx, field, obj)
-
- case "latestVersionInfo":
-
- out.Values[i] = ec._ProductInfo_latestVersionInfo(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var queryImplementors = []string{"Query"}
-
-func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors)
- ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{
- Object: "Query",
- })
-
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{
- Object: field.Name,
- Field: field,
- })
-
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("Query")
- case "listUsers":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_listUsers(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "listRoles":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_listRoles(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "listPermissions":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_listPermissions(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "createUser":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_createUser(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "deleteUser":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_deleteUser(ctx, field)
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "createRole":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_createRole(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "updateRole":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_updateRole(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "deleteRole":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_deleteRole(ctx, field)
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "grantUserRole":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_grantUserRole(ctx, field)
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "revokeUserRole":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_revokeUserRole(ctx, field)
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "setSubjectPermissions":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_setSubjectPermissions(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "setUserCredentials":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_setUserCredentials(ctx, field)
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "enableUser":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_enableUser(ctx, field)
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "allConnections":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_allConnections(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "searchConnections":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_searchConnections(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "createConnectionConfiguration":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_createConnectionConfiguration(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "copyConnectionConfiguration":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_copyConnectionConfiguration(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "updateConnectionConfiguration":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_updateConnectionConfiguration(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "deleteConnectionConfiguration":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_deleteConnectionConfiguration(ctx, field)
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "getConnectionSubjectAccess":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_getConnectionSubjectAccess(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "setConnectionSubjectAccess":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_setConnectionSubjectAccess(ctx, field)
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "getSubjectConnectionAccess":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_getSubjectConnectionAccess(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "setSubjectConnectionAccess":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_setSubjectConnectionAccess(ctx, field)
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "listFeatureSets":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_listFeatureSets(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "listAuthProviderConfigurationParameters":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_listAuthProviderConfigurationParameters(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "listAuthProviderConfigurations":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_listAuthProviderConfigurations(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "saveAuthProviderConfiguration":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_saveAuthProviderConfiguration(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "deleteAuthProviderConfiguration":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_deleteAuthProviderConfiguration(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "saveUserMetaParameter":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_saveUserMetaParameter(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "deleteUserMetaParameter":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_deleteUserMetaParameter(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "setUserMetaParameterValues":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_setUserMetaParameterValues(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "configureServer":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_configureServer(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "setDefaultNavigatorSettings":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_setDefaultNavigatorSettings(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "authLogin":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_authLogin(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "authUpdateStatus":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_authUpdateStatus(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "authLogout":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_authLogout(ctx, field)
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "activeUser":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_activeUser(ctx, field)
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "authProviders":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_authProviders(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "authChangeLocalPassword":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_authChangeLocalPassword(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "listUserProfileProperties":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_listUserProfileProperties(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "serverConfig":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_serverConfig(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "sessionState":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_sessionState(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "sessionPermissions":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_sessionPermissions(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "driverList":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_driverList(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "authModels":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_authModels(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "networkHandlers":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_networkHandlers(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "userConnections":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_userConnections(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "templateConnections":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_templateConnections(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "connectionFolders":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_connectionFolders(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "connectionState":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_connectionState(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "connectionInfo":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_connectionInfo(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "readSessionLog":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_readSessionLog(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "dataTransferAvailableStreamProcessors":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_dataTransferAvailableStreamProcessors(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "dataTransferExportDataFromContainer":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_dataTransferExportDataFromContainer(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "dataTransferExportDataFromResults":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_dataTransferExportDataFromResults(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "dataTransferRemoveDataFile":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_dataTransferRemoveDataFile(ctx, field)
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "metadataGetNodeDDL":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_metadataGetNodeDDL(ctx, field)
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "navNodeChildren":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_navNodeChildren(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "navNodeParents":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_navNodeParents(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "navNodeInfo":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_navNodeInfo(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "navRefreshNode":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_navRefreshNode(ctx, field)
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "navGetStructContainers":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_navGetStructContainers(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "rmListProjects":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_rmListProjects(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "rmListResources":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_rmListResources(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "rmReadResourceAsString":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_rmReadResourceAsString(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "sqlDialectInfo":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_sqlDialectInfo(ctx, field)
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "sqlListContexts":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_sqlListContexts(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "sqlCompletionProposals":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_sqlCompletionProposals(ctx, field)
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "sqlFormatQuery":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_sqlFormatQuery(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "sqlSupportedOperations":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_sqlSupportedOperations(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "sqlEntityQueryGenerators":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_sqlEntityQueryGenerators(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "sqlGenerateEntityQuery":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_sqlGenerateEntityQuery(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "sqlParseScript":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_sqlParseScript(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "sqlParseQuery":
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_sqlParseQuery(ctx, field)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- }
-
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
-
- out.Concurrently(i, func() graphql.Marshaler {
- return rrm(innerCtx)
- })
- case "__type":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Query___type(ctx, field)
- })
-
- case "__schema":
-
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Query___schema(ctx, field)
- })
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var rMProjectImplementors = []string{"RMProject"}
-
-func (ec *executionContext) _RMProject(ctx context.Context, sel ast.SelectionSet, obj *model.RMProject) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, rMProjectImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("RMProject")
- case "id":
-
- out.Values[i] = ec._RMProject_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "name":
-
- out.Values[i] = ec._RMProject_name(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "description":
-
- out.Values[i] = ec._RMProject_description(ctx, field, obj)
-
- case "shared":
-
- out.Values[i] = ec._RMProject_shared(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "createTime":
-
- out.Values[i] = ec._RMProject_createTime(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "creator":
-
- out.Values[i] = ec._RMProject_creator(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var rMResourceImplementors = []string{"RMResource"}
-
-func (ec *executionContext) _RMResource(ctx context.Context, sel ast.SelectionSet, obj *model.RMResource) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, rMResourceImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("RMResource")
- case "name":
-
- out.Values[i] = ec._RMResource_name(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "folder":
-
- out.Values[i] = ec._RMResource_folder(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "length":
-
- out.Values[i] = ec._RMResource_length(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var sQLCompletionProposalImplementors = []string{"SQLCompletionProposal"}
-
-func (ec *executionContext) _SQLCompletionProposal(ctx context.Context, sel ast.SelectionSet, obj *model.SQLCompletionProposal) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, sQLCompletionProposalImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("SQLCompletionProposal")
- case "displayString":
-
- out.Values[i] = ec._SQLCompletionProposal_displayString(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "type":
-
- out.Values[i] = ec._SQLCompletionProposal_type(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "score":
-
- out.Values[i] = ec._SQLCompletionProposal_score(ctx, field, obj)
-
- case "replacementString":
-
- out.Values[i] = ec._SQLCompletionProposal_replacementString(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "replacementOffset":
-
- out.Values[i] = ec._SQLCompletionProposal_replacementOffset(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "replacementLength":
-
- out.Values[i] = ec._SQLCompletionProposal_replacementLength(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "cursorPosition":
-
- out.Values[i] = ec._SQLCompletionProposal_cursorPosition(ctx, field, obj)
-
- case "icon":
-
- out.Values[i] = ec._SQLCompletionProposal_icon(ctx, field, obj)
-
- case "nodePath":
-
- out.Values[i] = ec._SQLCompletionProposal_nodePath(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var sQLContextInfoImplementors = []string{"SQLContextInfo"}
-
-func (ec *executionContext) _SQLContextInfo(ctx context.Context, sel ast.SelectionSet, obj *model.SQLContextInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, sQLContextInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("SQLContextInfo")
- case "id":
-
- out.Values[i] = ec._SQLContextInfo_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "connectionId":
-
- out.Values[i] = ec._SQLContextInfo_connectionId(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "defaultCatalog":
-
- out.Values[i] = ec._SQLContextInfo_defaultCatalog(ctx, field, obj)
-
- case "defaultSchema":
-
- out.Values[i] = ec._SQLContextInfo_defaultSchema(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var sQLDialectInfoImplementors = []string{"SQLDialectInfo"}
-
-func (ec *executionContext) _SQLDialectInfo(ctx context.Context, sel ast.SelectionSet, obj *model.SQLDialectInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, sQLDialectInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("SQLDialectInfo")
- case "name":
-
- out.Values[i] = ec._SQLDialectInfo_name(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "dataTypes":
-
- out.Values[i] = ec._SQLDialectInfo_dataTypes(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "functions":
-
- out.Values[i] = ec._SQLDialectInfo_functions(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "reservedWords":
-
- out.Values[i] = ec._SQLDialectInfo_reservedWords(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "quoteStrings":
-
- out.Values[i] = ec._SQLDialectInfo_quoteStrings(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "singleLineComments":
-
- out.Values[i] = ec._SQLDialectInfo_singleLineComments(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "multiLineComments":
-
- out.Values[i] = ec._SQLDialectInfo_multiLineComments(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "catalogSeparator":
-
- out.Values[i] = ec._SQLDialectInfo_catalogSeparator(ctx, field, obj)
-
- case "structSeparator":
-
- out.Values[i] = ec._SQLDialectInfo_structSeparator(ctx, field, obj)
-
- case "scriptDelimiter":
-
- out.Values[i] = ec._SQLDialectInfo_scriptDelimiter(ctx, field, obj)
-
- case "supportsExplainExecutionPlan":
-
- out.Values[i] = ec._SQLDialectInfo_supportsExplainExecutionPlan(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var sQLExecuteInfoImplementors = []string{"SQLExecuteInfo"}
-
-func (ec *executionContext) _SQLExecuteInfo(ctx context.Context, sel ast.SelectionSet, obj *model.SQLExecuteInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, sQLExecuteInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("SQLExecuteInfo")
- case "statusMessage":
-
- out.Values[i] = ec._SQLExecuteInfo_statusMessage(ctx, field, obj)
-
- case "duration":
-
- out.Values[i] = ec._SQLExecuteInfo_duration(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "filterText":
-
- out.Values[i] = ec._SQLExecuteInfo_filterText(ctx, field, obj)
-
- case "results":
-
- out.Values[i] = ec._SQLExecuteInfo_results(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var sQLExecutionPlanImplementors = []string{"SQLExecutionPlan"}
-
-func (ec *executionContext) _SQLExecutionPlan(ctx context.Context, sel ast.SelectionSet, obj *model.SQLExecutionPlan) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, sQLExecutionPlanImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("SQLExecutionPlan")
- case "query":
-
- out.Values[i] = ec._SQLExecutionPlan_query(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "nodes":
-
- out.Values[i] = ec._SQLExecutionPlan_nodes(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var sQLExecutionPlanNodeImplementors = []string{"SQLExecutionPlanNode"}
-
-func (ec *executionContext) _SQLExecutionPlanNode(ctx context.Context, sel ast.SelectionSet, obj *model.SQLExecutionPlanNode) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, sQLExecutionPlanNodeImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("SQLExecutionPlanNode")
- case "id":
-
- out.Values[i] = ec._SQLExecutionPlanNode_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "parentId":
-
- out.Values[i] = ec._SQLExecutionPlanNode_parentId(ctx, field, obj)
-
- case "kind":
-
- out.Values[i] = ec._SQLExecutionPlanNode_kind(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "name":
-
- out.Values[i] = ec._SQLExecutionPlanNode_name(ctx, field, obj)
-
- case "type":
-
- out.Values[i] = ec._SQLExecutionPlanNode_type(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "condition":
-
- out.Values[i] = ec._SQLExecutionPlanNode_condition(ctx, field, obj)
-
- case "description":
-
- out.Values[i] = ec._SQLExecutionPlanNode_description(ctx, field, obj)
-
- case "properties":
-
- out.Values[i] = ec._SQLExecutionPlanNode_properties(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var sQLQueryGeneratorImplementors = []string{"SQLQueryGenerator"}
-
-func (ec *executionContext) _SQLQueryGenerator(ctx context.Context, sel ast.SelectionSet, obj *model.SQLQueryGenerator) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, sQLQueryGeneratorImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("SQLQueryGenerator")
- case "id":
-
- out.Values[i] = ec._SQLQueryGenerator_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "label":
-
- out.Values[i] = ec._SQLQueryGenerator_label(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "description":
-
- out.Values[i] = ec._SQLQueryGenerator_description(ctx, field, obj)
-
- case "order":
-
- out.Values[i] = ec._SQLQueryGenerator_order(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "multiObject":
-
- out.Values[i] = ec._SQLQueryGenerator_multiObject(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var sQLQueryResultsImplementors = []string{"SQLQueryResults"}
-
-func (ec *executionContext) _SQLQueryResults(ctx context.Context, sel ast.SelectionSet, obj *model.SQLQueryResults) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, sQLQueryResultsImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("SQLQueryResults")
- case "title":
-
- out.Values[i] = ec._SQLQueryResults_title(ctx, field, obj)
-
- case "updateRowCount":
-
- out.Values[i] = ec._SQLQueryResults_updateRowCount(ctx, field, obj)
-
- case "sourceQuery":
-
- out.Values[i] = ec._SQLQueryResults_sourceQuery(ctx, field, obj)
-
- case "dataFormat":
-
- out.Values[i] = ec._SQLQueryResults_dataFormat(ctx, field, obj)
-
- case "resultSet":
-
- out.Values[i] = ec._SQLQueryResults_resultSet(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var sQLResultColumnImplementors = []string{"SQLResultColumn"}
-
-func (ec *executionContext) _SQLResultColumn(ctx context.Context, sel ast.SelectionSet, obj *model.SQLResultColumn) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, sQLResultColumnImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("SQLResultColumn")
- case "position":
-
- out.Values[i] = ec._SQLResultColumn_position(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "name":
-
- out.Values[i] = ec._SQLResultColumn_name(ctx, field, obj)
-
- case "label":
-
- out.Values[i] = ec._SQLResultColumn_label(ctx, field, obj)
-
- case "icon":
-
- out.Values[i] = ec._SQLResultColumn_icon(ctx, field, obj)
-
- case "entityName":
-
- out.Values[i] = ec._SQLResultColumn_entityName(ctx, field, obj)
-
- case "dataKind":
-
- out.Values[i] = ec._SQLResultColumn_dataKind(ctx, field, obj)
-
- case "typeName":
-
- out.Values[i] = ec._SQLResultColumn_typeName(ctx, field, obj)
-
- case "fullTypeName":
-
- out.Values[i] = ec._SQLResultColumn_fullTypeName(ctx, field, obj)
-
- case "maxLength":
-
- out.Values[i] = ec._SQLResultColumn_maxLength(ctx, field, obj)
-
- case "scale":
-
- out.Values[i] = ec._SQLResultColumn_scale(ctx, field, obj)
-
- case "precision":
-
- out.Values[i] = ec._SQLResultColumn_precision(ctx, field, obj)
-
- case "required":
-
- out.Values[i] = ec._SQLResultColumn_required(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "readOnly":
-
- out.Values[i] = ec._SQLResultColumn_readOnly(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "readOnlyStatus":
-
- out.Values[i] = ec._SQLResultColumn_readOnlyStatus(ctx, field, obj)
-
- case "supportedOperations":
-
- out.Values[i] = ec._SQLResultColumn_supportedOperations(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var sQLResultSetImplementors = []string{"SQLResultSet"}
-
-func (ec *executionContext) _SQLResultSet(ctx context.Context, sel ast.SelectionSet, obj *model.SQLResultSet) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, sQLResultSetImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("SQLResultSet")
- case "id":
-
- out.Values[i] = ec._SQLResultSet_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "columns":
-
- out.Values[i] = ec._SQLResultSet_columns(ctx, field, obj)
-
- case "rows":
-
- out.Values[i] = ec._SQLResultSet_rows(ctx, field, obj)
-
- case "singleEntity":
-
- out.Values[i] = ec._SQLResultSet_singleEntity(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "hasMoreData":
-
- out.Values[i] = ec._SQLResultSet_hasMoreData(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "hasRowIdentifier":
-
- out.Values[i] = ec._SQLResultSet_hasRowIdentifier(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var sQLScriptInfoImplementors = []string{"SQLScriptInfo"}
-
-func (ec *executionContext) _SQLScriptInfo(ctx context.Context, sel ast.SelectionSet, obj *model.SQLScriptInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, sQLScriptInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("SQLScriptInfo")
- case "queries":
-
- out.Values[i] = ec._SQLScriptInfo_queries(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var sQLScriptQueryImplementors = []string{"SQLScriptQuery"}
-
-func (ec *executionContext) _SQLScriptQuery(ctx context.Context, sel ast.SelectionSet, obj *model.SQLScriptQuery) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, sQLScriptQueryImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("SQLScriptQuery")
- case "start":
-
- out.Values[i] = ec._SQLScriptQuery_start(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "end":
-
- out.Values[i] = ec._SQLScriptQuery_end(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var serverConfigImplementors = []string{"ServerConfig"}
-
-func (ec *executionContext) _ServerConfig(ctx context.Context, sel ast.SelectionSet, obj *model.ServerConfig) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, serverConfigImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("ServerConfig")
- case "name":
-
- out.Values[i] = ec._ServerConfig_name(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "version":
-
- out.Values[i] = ec._ServerConfig_version(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "workspaceId":
-
- out.Values[i] = ec._ServerConfig_workspaceId(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "serverURL":
-
- out.Values[i] = ec._ServerConfig_serverURL(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "rootURI":
-
- out.Values[i] = ec._ServerConfig_rootURI(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "hostName":
-
- out.Values[i] = ec._ServerConfig_hostName(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "anonymousAccessEnabled":
-
- out.Values[i] = ec._ServerConfig_anonymousAccessEnabled(ctx, field, obj)
-
- case "authenticationEnabled":
-
- out.Values[i] = ec._ServerConfig_authenticationEnabled(ctx, field, obj)
-
- case "supportsCustomConnections":
-
- out.Values[i] = ec._ServerConfig_supportsCustomConnections(ctx, field, obj)
-
- case "supportsConnectionBrowser":
-
- out.Values[i] = ec._ServerConfig_supportsConnectionBrowser(ctx, field, obj)
-
- case "supportsWorkspaces":
-
- out.Values[i] = ec._ServerConfig_supportsWorkspaces(ctx, field, obj)
-
- case "resourceManagerEnabled":
-
- out.Values[i] = ec._ServerConfig_resourceManagerEnabled(ctx, field, obj)
-
- case "publicCredentialsSaveEnabled":
-
- out.Values[i] = ec._ServerConfig_publicCredentialsSaveEnabled(ctx, field, obj)
-
- case "adminCredentialsSaveEnabled":
-
- out.Values[i] = ec._ServerConfig_adminCredentialsSaveEnabled(ctx, field, obj)
-
- case "licenseRequired":
-
- out.Values[i] = ec._ServerConfig_licenseRequired(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "licenseValid":
-
- out.Values[i] = ec._ServerConfig_licenseValid(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "sessionExpireTime":
-
- out.Values[i] = ec._ServerConfig_sessionExpireTime(ctx, field, obj)
-
- case "localHostAddress":
-
- out.Values[i] = ec._ServerConfig_localHostAddress(ctx, field, obj)
-
- case "configurationMode":
-
- out.Values[i] = ec._ServerConfig_configurationMode(ctx, field, obj)
-
- case "developmentMode":
-
- out.Values[i] = ec._ServerConfig_developmentMode(ctx, field, obj)
-
- case "redirectOnFederatedAuth":
-
- out.Values[i] = ec._ServerConfig_redirectOnFederatedAuth(ctx, field, obj)
-
- case "enabledFeatures":
-
- out.Values[i] = ec._ServerConfig_enabledFeatures(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "enabledAuthProviders":
-
- out.Values[i] = ec._ServerConfig_enabledAuthProviders(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "supportedLanguages":
-
- out.Values[i] = ec._ServerConfig_supportedLanguages(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "services":
-
- out.Values[i] = ec._ServerConfig_services(ctx, field, obj)
-
- case "productConfiguration":
-
- out.Values[i] = ec._ServerConfig_productConfiguration(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "productInfo":
-
- out.Values[i] = ec._ServerConfig_productInfo(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "defaultNavigatorSettings":
-
- out.Values[i] = ec._ServerConfig_defaultNavigatorSettings(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "disabledDrivers":
-
- out.Values[i] = ec._ServerConfig_disabledDrivers(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "resourceQuotas":
-
- out.Values[i] = ec._ServerConfig_resourceQuotas(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var serverErrorImplementors = []string{"ServerError"}
-
-func (ec *executionContext) _ServerError(ctx context.Context, sel ast.SelectionSet, obj *model.ServerError) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, serverErrorImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("ServerError")
- case "message":
-
- out.Values[i] = ec._ServerError_message(ctx, field, obj)
-
- case "errorCode":
-
- out.Values[i] = ec._ServerError_errorCode(ctx, field, obj)
-
- case "errorType":
-
- out.Values[i] = ec._ServerError_errorType(ctx, field, obj)
-
- case "stackTrace":
-
- out.Values[i] = ec._ServerError_stackTrace(ctx, field, obj)
-
- case "causedBy":
-
- out.Values[i] = ec._ServerError_causedBy(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var serverLanguageImplementors = []string{"ServerLanguage"}
-
-func (ec *executionContext) _ServerLanguage(ctx context.Context, sel ast.SelectionSet, obj *model.ServerLanguage) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, serverLanguageImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("ServerLanguage")
- case "isoCode":
-
- out.Values[i] = ec._ServerLanguage_isoCode(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "displayName":
-
- out.Values[i] = ec._ServerLanguage_displayName(ctx, field, obj)
-
- case "nativeName":
-
- out.Values[i] = ec._ServerLanguage_nativeName(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var serverMessageImplementors = []string{"ServerMessage"}
-
-func (ec *executionContext) _ServerMessage(ctx context.Context, sel ast.SelectionSet, obj *model.ServerMessage) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, serverMessageImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("ServerMessage")
- case "time":
-
- out.Values[i] = ec._ServerMessage_time(ctx, field, obj)
-
- case "message":
-
- out.Values[i] = ec._ServerMessage_message(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var sessionInfoImplementors = []string{"SessionInfo"}
-
-func (ec *executionContext) _SessionInfo(ctx context.Context, sel ast.SelectionSet, obj *model.SessionInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, sessionInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("SessionInfo")
- case "createTime":
-
- out.Values[i] = ec._SessionInfo_createTime(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "lastAccessTime":
-
- out.Values[i] = ec._SessionInfo_lastAccessTime(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "locale":
-
- out.Values[i] = ec._SessionInfo_locale(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "cacheExpired":
-
- out.Values[i] = ec._SessionInfo_cacheExpired(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "serverMessages":
-
- out.Values[i] = ec._SessionInfo_serverMessages(ctx, field, obj)
-
- case "connections":
-
- out.Values[i] = ec._SessionInfo_connections(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "actionParameters":
-
- out.Values[i] = ec._SessionInfo_actionParameters(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var userAuthTokenImplementors = []string{"UserAuthToken"}
-
-func (ec *executionContext) _UserAuthToken(ctx context.Context, sel ast.SelectionSet, obj *model.UserAuthToken) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, userAuthTokenImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("UserAuthToken")
- case "authProvider":
-
- out.Values[i] = ec._UserAuthToken_authProvider(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "authConfiguration":
-
- out.Values[i] = ec._UserAuthToken_authConfiguration(ctx, field, obj)
-
- case "loginTime":
-
- out.Values[i] = ec._UserAuthToken_loginTime(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "userId":
-
- out.Values[i] = ec._UserAuthToken_userId(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "displayName":
-
- out.Values[i] = ec._UserAuthToken_displayName(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "message":
-
- out.Values[i] = ec._UserAuthToken_message(ctx, field, obj)
-
- case "origin":
-
- out.Values[i] = ec._UserAuthToken_origin(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var userInfoImplementors = []string{"UserInfo"}
-
-func (ec *executionContext) _UserInfo(ctx context.Context, sel ast.SelectionSet, obj *model.UserInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, userInfoImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("UserInfo")
- case "userId":
-
- out.Values[i] = ec._UserInfo_userId(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "displayName":
-
- out.Values[i] = ec._UserInfo_displayName(ctx, field, obj)
-
- case "authRole":
-
- out.Values[i] = ec._UserInfo_authRole(ctx, field, obj)
-
- case "authTokens":
-
- out.Values[i] = ec._UserInfo_authTokens(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "linkedAuthProviders":
-
- out.Values[i] = ec._UserInfo_linkedAuthProviders(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "metaParameters":
-
- out.Values[i] = ec._UserInfo_metaParameters(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "configurationParameters":
-
- out.Values[i] = ec._UserInfo_configurationParameters(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var webFeatureSetImplementors = []string{"WebFeatureSet"}
-
-func (ec *executionContext) _WebFeatureSet(ctx context.Context, sel ast.SelectionSet, obj *model.WebFeatureSet) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, webFeatureSetImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("WebFeatureSet")
- case "id":
-
- out.Values[i] = ec._WebFeatureSet_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "label":
-
- out.Values[i] = ec._WebFeatureSet_label(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "description":
-
- out.Values[i] = ec._WebFeatureSet_description(ctx, field, obj)
-
- case "icon":
-
- out.Values[i] = ec._WebFeatureSet_icon(ctx, field, obj)
-
- case "enabled":
-
- out.Values[i] = ec._WebFeatureSet_enabled(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var webServiceConfigImplementors = []string{"WebServiceConfig"}
-
-func (ec *executionContext) _WebServiceConfig(ctx context.Context, sel ast.SelectionSet, obj *model.WebServiceConfig) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, webServiceConfigImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("WebServiceConfig")
- case "id":
-
- out.Values[i] = ec._WebServiceConfig_id(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "name":
-
- out.Values[i] = ec._WebServiceConfig_name(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "description":
-
- out.Values[i] = ec._WebServiceConfig_description(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "bundleVersion":
-
- out.Values[i] = ec._WebServiceConfig_bundleVersion(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var __DirectiveImplementors = []string{"__Directive"}
-
-func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("__Directive")
- case "name":
-
- out.Values[i] = ec.___Directive_name(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "description":
-
- out.Values[i] = ec.___Directive_description(ctx, field, obj)
-
- case "locations":
-
- out.Values[i] = ec.___Directive_locations(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "args":
-
- out.Values[i] = ec.___Directive_args(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "isRepeatable":
-
- out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var __EnumValueImplementors = []string{"__EnumValue"}
-
-func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("__EnumValue")
- case "name":
-
- out.Values[i] = ec.___EnumValue_name(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "description":
-
- out.Values[i] = ec.___EnumValue_description(ctx, field, obj)
-
- case "isDeprecated":
-
- out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "deprecationReason":
-
- out.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var __FieldImplementors = []string{"__Field"}
-
-func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("__Field")
- case "name":
-
- out.Values[i] = ec.___Field_name(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "description":
-
- out.Values[i] = ec.___Field_description(ctx, field, obj)
-
- case "args":
-
- out.Values[i] = ec.___Field_args(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "type":
-
- out.Values[i] = ec.___Field_type(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "isDeprecated":
-
- out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "deprecationReason":
-
- out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var __InputValueImplementors = []string{"__InputValue"}
-
-func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("__InputValue")
- case "name":
-
- out.Values[i] = ec.___InputValue_name(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "description":
-
- out.Values[i] = ec.___InputValue_description(ctx, field, obj)
-
- case "type":
-
- out.Values[i] = ec.___InputValue_type(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "defaultValue":
-
- out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var __SchemaImplementors = []string{"__Schema"}
-
-func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("__Schema")
- case "description":
-
- out.Values[i] = ec.___Schema_description(ctx, field, obj)
-
- case "types":
-
- out.Values[i] = ec.___Schema_types(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "queryType":
-
- out.Values[i] = ec.___Schema_queryType(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "mutationType":
-
- out.Values[i] = ec.___Schema_mutationType(ctx, field, obj)
-
- case "subscriptionType":
-
- out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj)
-
- case "directives":
-
- out.Values[i] = ec.___Schema_directives(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var __TypeImplementors = []string{"__Type"}
-
-func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors)
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("__Type")
- case "kind":
-
- out.Values[i] = ec.___Type_kind(ctx, field, obj)
-
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "name":
-
- out.Values[i] = ec.___Type_name(ctx, field, obj)
-
- case "description":
-
- out.Values[i] = ec.___Type_description(ctx, field, obj)
-
- case "fields":
-
- out.Values[i] = ec.___Type_fields(ctx, field, obj)
-
- case "interfaces":
-
- out.Values[i] = ec.___Type_interfaces(ctx, field, obj)
-
- case "possibleTypes":
-
- out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj)
-
- case "enumValues":
-
- out.Values[i] = ec.___Type_enumValues(ctx, field, obj)
-
- case "inputFields":
-
- out.Values[i] = ec.___Type_inputFields(ctx, field, obj)
-
- case "ofType":
-
- out.Values[i] = ec.___Type_ofType(ctx, field, obj)
-
- case "specifiedByURL":
-
- out.Values[i] = ec.___Type_specifiedByURL(ctx, field, obj)
-
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-// endregion **************************** object.gotpl ****************************
-
-// region ***************************** type.gotpl *****************************
-
-func (ec *executionContext) marshalNAdminAuthProviderConfiguration2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminAuthProviderConfiguration(ctx context.Context, sel ast.SelectionSet, v model.AdminAuthProviderConfiguration) graphql.Marshaler {
- return ec._AdminAuthProviderConfiguration(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNAdminAuthProviderConfiguration2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminAuthProviderConfigurationᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.AdminAuthProviderConfiguration) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNAdminAuthProviderConfiguration2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminAuthProviderConfiguration(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNAdminAuthProviderConfiguration2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminAuthProviderConfiguration(ctx context.Context, sel ast.SelectionSet, v *model.AdminAuthProviderConfiguration) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._AdminAuthProviderConfiguration(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNAdminConnectionGrantInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminConnectionGrantInfoᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.AdminConnectionGrantInfo) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNAdminConnectionGrantInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminConnectionGrantInfo(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNAdminConnectionGrantInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminConnectionGrantInfo(ctx context.Context, sel ast.SelectionSet, v *model.AdminConnectionGrantInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._AdminConnectionGrantInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNAdminConnectionSearchInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminConnectionSearchInfoᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.AdminConnectionSearchInfo) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNAdminConnectionSearchInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminConnectionSearchInfo(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNAdminConnectionSearchInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminConnectionSearchInfo(ctx context.Context, sel ast.SelectionSet, v *model.AdminConnectionSearchInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._AdminConnectionSearchInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNAdminPermissionInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminPermissionInfoᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.AdminPermissionInfo) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNAdminPermissionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminPermissionInfo(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNAdminPermissionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminPermissionInfo(ctx context.Context, sel ast.SelectionSet, v *model.AdminPermissionInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._AdminPermissionInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNAdminRoleInfo2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminRoleInfo(ctx context.Context, sel ast.SelectionSet, v model.AdminRoleInfo) graphql.Marshaler {
- return ec._AdminRoleInfo(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNAdminRoleInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminRoleInfoᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.AdminRoleInfo) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNAdminRoleInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminRoleInfo(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNAdminRoleInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminRoleInfo(ctx context.Context, sel ast.SelectionSet, v *model.AdminRoleInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._AdminRoleInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalNAdminSubjectType2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminSubjectType(ctx context.Context, v interface{}) (model.AdminSubjectType, error) {
- var res model.AdminSubjectType
- err := res.UnmarshalGQL(v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalNAdminSubjectType2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminSubjectType(ctx context.Context, sel ast.SelectionSet, v model.AdminSubjectType) graphql.Marshaler {
- return v
-}
-
-func (ec *executionContext) marshalNAdminUserInfo2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminUserInfo(ctx context.Context, sel ast.SelectionSet, v model.AdminUserInfo) graphql.Marshaler {
- return ec._AdminUserInfo(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNAdminUserInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminUserInfoᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.AdminUserInfo) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNAdminUserInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminUserInfo(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNAdminUserInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAdminUserInfo(ctx context.Context, sel ast.SelectionSet, v *model.AdminUserInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._AdminUserInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNAsyncTaskInfo2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAsyncTaskInfo(ctx context.Context, sel ast.SelectionSet, v model.AsyncTaskInfo) graphql.Marshaler {
- return ec._AsyncTaskInfo(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNAsyncTaskInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAsyncTaskInfo(ctx context.Context, sel ast.SelectionSet, v *model.AsyncTaskInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._AsyncTaskInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNAuthCredentialInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthCredentialInfoᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.AuthCredentialInfo) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNAuthCredentialInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthCredentialInfo(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNAuthCredentialInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthCredentialInfo(ctx context.Context, sel ast.SelectionSet, v *model.AuthCredentialInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._AuthCredentialInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNAuthInfo2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthInfo(ctx context.Context, sel ast.SelectionSet, v model.AuthInfo) graphql.Marshaler {
- return ec._AuthInfo(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNAuthInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthInfo(ctx context.Context, sel ast.SelectionSet, v *model.AuthInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._AuthInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNAuthProviderConfiguration2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthProviderConfiguration(ctx context.Context, sel ast.SelectionSet, v *model.AuthProviderConfiguration) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._AuthProviderConfiguration(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNAuthProviderCredentialsProfile2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthProviderCredentialsProfileᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.AuthProviderCredentialsProfile) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNAuthProviderCredentialsProfile2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthProviderCredentialsProfile(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNAuthProviderCredentialsProfile2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthProviderCredentialsProfile(ctx context.Context, sel ast.SelectionSet, v *model.AuthProviderCredentialsProfile) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._AuthProviderCredentialsProfile(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNAuthProviderInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthProviderInfoᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.AuthProviderInfo) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNAuthProviderInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthProviderInfo(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNAuthProviderInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthProviderInfo(ctx context.Context, sel ast.SelectionSet, v *model.AuthProviderInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._AuthProviderInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalNAuthStatus2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthStatus(ctx context.Context, v interface{}) (model.AuthStatus, error) {
- var res model.AuthStatus
- err := res.UnmarshalGQL(v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalNAuthStatus2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthStatus(ctx context.Context, sel ast.SelectionSet, v model.AuthStatus) graphql.Marshaler {
- return v
-}
-
-func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) {
- res, err := graphql.UnmarshalBoolean(v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler {
- res := graphql.MarshalBoolean(v)
- if res == graphql.Null {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- }
- return res
-}
-
-func (ec *executionContext) unmarshalNConnectionConfig2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionConfig(ctx context.Context, v interface{}) (model.ConnectionConfig, error) {
- res, err := ec.unmarshalInputConnectionConfig(ctx, v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalNConnectionFolderInfo2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionFolderInfo(ctx context.Context, sel ast.SelectionSet, v model.ConnectionFolderInfo) graphql.Marshaler {
- return ec._ConnectionFolderInfo(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNConnectionFolderInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionFolderInfoᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.ConnectionFolderInfo) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNConnectionFolderInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionFolderInfo(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNConnectionFolderInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionFolderInfo(ctx context.Context, sel ast.SelectionSet, v *model.ConnectionFolderInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._ConnectionFolderInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNConnectionInfo2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfo(ctx context.Context, sel ast.SelectionSet, v model.ConnectionInfo) graphql.Marshaler {
- return ec._ConnectionInfo(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNConnectionInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfoᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.ConnectionInfo) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNConnectionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfo(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNConnectionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionInfo(ctx context.Context, sel ast.SelectionSet, v *model.ConnectionInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._ConnectionInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalNDataTransferParameters2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDataTransferParameters(ctx context.Context, v interface{}) (model.DataTransferParameters, error) {
- res, err := ec.unmarshalInputDataTransferParameters(ctx, v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalNDataTransferProcessorInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDataTransferProcessorInfoᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.DataTransferProcessorInfo) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNDataTransferProcessorInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDataTransferProcessorInfo(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNDataTransferProcessorInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDataTransferProcessorInfo(ctx context.Context, sel ast.SelectionSet, v *model.DataTransferProcessorInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._DataTransferProcessorInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNDataTypeLogicalOperation2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDataTypeLogicalOperationᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.DataTypeLogicalOperation) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNDataTypeLogicalOperation2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDataTypeLogicalOperation(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNDataTypeLogicalOperation2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDataTypeLogicalOperation(ctx context.Context, sel ast.SelectionSet, v *model.DataTypeLogicalOperation) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._DataTypeLogicalOperation(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNDatabaseAuthModel2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDatabaseAuthModelᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.DatabaseAuthModel) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNDatabaseAuthModel2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDatabaseAuthModel(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNDatabaseAuthModel2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDatabaseAuthModel(ctx context.Context, sel ast.SelectionSet, v *model.DatabaseAuthModel) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._DatabaseAuthModel(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNDatabaseCatalog2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDatabaseCatalogᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.DatabaseCatalog) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNDatabaseCatalog2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDatabaseCatalog(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNDatabaseCatalog2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDatabaseCatalog(ctx context.Context, sel ast.SelectionSet, v *model.DatabaseCatalog) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._DatabaseCatalog(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNDatabaseStructContainers2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDatabaseStructContainers(ctx context.Context, sel ast.SelectionSet, v model.DatabaseStructContainers) graphql.Marshaler {
- return ec._DatabaseStructContainers(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNDatabaseStructContainers2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDatabaseStructContainers(ctx context.Context, sel ast.SelectionSet, v *model.DatabaseStructContainers) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._DatabaseStructContainers(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalNDateTime2timeᚐTime(ctx context.Context, v interface{}) (time.Time, error) {
- res, err := graphql.UnmarshalTime(v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalNDateTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler {
- res := graphql.MarshalTime(v)
- if res == graphql.Null {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- }
- return res
-}
-
-func (ec *executionContext) marshalNDriverInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDriverInfoᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.DriverInfo) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNDriverInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDriverInfo(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNDriverInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDriverInfo(ctx context.Context, sel ast.SelectionSet, v *model.DriverInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._DriverInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface{}) (string, error) {
- res, err := graphql.UnmarshalID(v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler {
- res := graphql.MarshalID(v)
- if res == graphql.Null {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- }
- return res
-}
-
-func (ec *executionContext) unmarshalNID2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) {
- var vSlice []interface{}
- if v != nil {
- vSlice = graphql.CoerceList(v)
- }
- var err error
- res := make([]string, len(vSlice))
- for i := range vSlice {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
- res[i], err = ec.unmarshalNID2string(ctx, vSlice[i])
- if err != nil {
- return nil, err
- }
- }
- return res, nil
-}
-
-func (ec *executionContext) marshalNID2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- for i := range v {
- ret[i] = ec.marshalNID2string(ctx, sel, v[i])
- }
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) unmarshalNID2ᚕᚖstring(ctx context.Context, v interface{}) ([]*string, error) {
- var vSlice []interface{}
- if v != nil {
- vSlice = graphql.CoerceList(v)
- }
- var err error
- res := make([]*string, len(vSlice))
- for i := range vSlice {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
- res[i], err = ec.unmarshalOID2ᚖstring(ctx, vSlice[i])
- if err != nil {
- return nil, err
- }
- }
- return res, nil
-}
-
-func (ec *executionContext) marshalNID2ᚕᚖstring(ctx context.Context, sel ast.SelectionSet, v []*string) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- for i := range v {
- ret[i] = ec.marshalOID2ᚖstring(ctx, sel, v[i])
- }
-
- return ret
-}
-
-func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) {
- res, err := graphql.UnmarshalInt(v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler {
- res := graphql.MarshalInt(v)
- if res == graphql.Null {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- }
- return res
-}
-
-func (ec *executionContext) marshalNLogEntry2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐLogEntryᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.LogEntry) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNLogEntry2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐLogEntry(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNLogEntry2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐLogEntry(ctx context.Context, sel ast.SelectionSet, v *model.LogEntry) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._LogEntry(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNNavigatorNodeInfo2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNavigatorNodeInfo(ctx context.Context, sel ast.SelectionSet, v model.NavigatorNodeInfo) graphql.Marshaler {
- return ec._NavigatorNodeInfo(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNNavigatorNodeInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNavigatorNodeInfoᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.NavigatorNodeInfo) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNNavigatorNodeInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNavigatorNodeInfo(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNNavigatorNodeInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNavigatorNodeInfo(ctx context.Context, sel ast.SelectionSet, v *model.NavigatorNodeInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._NavigatorNodeInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNNavigatorSettings2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNavigatorSettings(ctx context.Context, sel ast.SelectionSet, v *model.NavigatorSettings) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._NavigatorSettings(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalNNavigatorSettingsInput2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNavigatorSettingsInput(ctx context.Context, v interface{}) (model.NavigatorSettingsInput, error) {
- res, err := ec.unmarshalInputNavigatorSettingsInput(ctx, v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalNNetworkEndpointInfo2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkEndpointInfo(ctx context.Context, sel ast.SelectionSet, v model.NetworkEndpointInfo) graphql.Marshaler {
- return ec._NetworkEndpointInfo(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNNetworkEndpointInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkEndpointInfo(ctx context.Context, sel ast.SelectionSet, v *model.NetworkEndpointInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._NetworkEndpointInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalNNetworkHandlerAuthType2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerAuthType(ctx context.Context, v interface{}) (model.NetworkHandlerAuthType, error) {
- var res model.NetworkHandlerAuthType
- err := res.UnmarshalGQL(v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalNNetworkHandlerAuthType2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerAuthType(ctx context.Context, sel ast.SelectionSet, v model.NetworkHandlerAuthType) graphql.Marshaler {
- return v
-}
-
-func (ec *executionContext) marshalNNetworkHandlerConfig2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerConfigᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.NetworkHandlerConfig) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNNetworkHandlerConfig2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerConfig(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNNetworkHandlerConfig2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerConfig(ctx context.Context, sel ast.SelectionSet, v *model.NetworkHandlerConfig) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._NetworkHandlerConfig(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalNNetworkHandlerConfigInput2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerConfigInput(ctx context.Context, v interface{}) (model.NetworkHandlerConfigInput, error) {
- res, err := ec.unmarshalInputNetworkHandlerConfigInput(ctx, v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) unmarshalNNetworkHandlerConfigInput2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerConfigInput(ctx context.Context, v interface{}) (*model.NetworkHandlerConfigInput, error) {
- res, err := ec.unmarshalInputNetworkHandlerConfigInput(ctx, v)
- return &res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalNNetworkHandlerDescriptor2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerDescriptorᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.NetworkHandlerDescriptor) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNNetworkHandlerDescriptor2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerDescriptor(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNNetworkHandlerDescriptor2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerDescriptor(ctx context.Context, sel ast.SelectionSet, v *model.NetworkHandlerDescriptor) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._NetworkHandlerDescriptor(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalNObject2interface(ctx context.Context, v interface{}) (interface{}, error) {
- res, err := graphql.UnmarshalAny(v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalNObject2interface(ctx context.Context, sel ast.SelectionSet, v interface{}) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- res := graphql.MarshalAny(v)
- if res == graphql.Null {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- }
- return res
-}
-
-func (ec *executionContext) unmarshalNObject2ᚕinterface(ctx context.Context, v interface{}) ([]interface{}, error) {
- var vSlice []interface{}
- if v != nil {
- vSlice = graphql.CoerceList(v)
- }
- var err error
- res := make([]interface{}, len(vSlice))
- for i := range vSlice {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
- res[i], err = ec.unmarshalOObject2interface(ctx, vSlice[i])
- if err != nil {
- return nil, err
- }
- }
- return res, nil
-}
-
-func (ec *executionContext) marshalNObject2ᚕinterface(ctx context.Context, sel ast.SelectionSet, v []interface{}) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- for i := range v {
- ret[i] = ec.marshalOObject2interface(ctx, sel, v[i])
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNObjectOrigin2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectOriginᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.ObjectOrigin) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNObjectOrigin2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectOrigin(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNObjectOrigin2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectOrigin(ctx context.Context, sel ast.SelectionSet, v *model.ObjectOrigin) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._ObjectOrigin(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNObjectPropertyInfo2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfo(ctx context.Context, sel ast.SelectionSet, v model.ObjectPropertyInfo) graphql.Marshaler {
- return ec._ObjectPropertyInfo(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNObjectPropertyInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfoᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.ObjectPropertyInfo) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNObjectPropertyInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfo(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNObjectPropertyInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfo(ctx context.Context, sel ast.SelectionSet, v *model.ObjectPropertyInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._ObjectPropertyInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalNObjectPropertyLength2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyLength(ctx context.Context, v interface{}) (model.ObjectPropertyLength, error) {
- var res model.ObjectPropertyLength
- err := res.UnmarshalGQL(v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalNObjectPropertyLength2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyLength(ctx context.Context, sel ast.SelectionSet, v model.ObjectPropertyLength) graphql.Marshaler {
- return v
-}
-
-func (ec *executionContext) marshalNProductInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐProductInfo(ctx context.Context, sel ast.SelectionSet, v *model.ProductInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._ProductInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNRMProject2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐRMProjectᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.RMProject) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNRMProject2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐRMProject(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNRMProject2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐRMProject(ctx context.Context, sel ast.SelectionSet, v *model.RMProject) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._RMProject(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNRMResource2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐRMResourceᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.RMResource) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNRMResource2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐRMResource(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNRMResource2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐRMResource(ctx context.Context, sel ast.SelectionSet, v *model.RMResource) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._RMResource(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalNResultDataFormat2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐResultDataFormat(ctx context.Context, v interface{}) (model.ResultDataFormat, error) {
- var res model.ResultDataFormat
- err := res.UnmarshalGQL(v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalNResultDataFormat2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐResultDataFormat(ctx context.Context, sel ast.SelectionSet, v model.ResultDataFormat) graphql.Marshaler {
- return v
-}
-
-func (ec *executionContext) unmarshalNResultDataFormat2ᚕgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐResultDataFormatᚄ(ctx context.Context, v interface{}) ([]model.ResultDataFormat, error) {
- var vSlice []interface{}
- if v != nil {
- vSlice = graphql.CoerceList(v)
- }
- var err error
- res := make([]model.ResultDataFormat, len(vSlice))
- for i := range vSlice {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
- res[i], err = ec.unmarshalNResultDataFormat2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐResultDataFormat(ctx, vSlice[i])
- if err != nil {
- return nil, err
- }
- }
- return res, nil
-}
-
-func (ec *executionContext) marshalNResultDataFormat2ᚕgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐResultDataFormatᚄ(ctx context.Context, sel ast.SelectionSet, v []model.ResultDataFormat) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNResultDataFormat2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐResultDataFormat(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNSQLContextInfo2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLContextInfo(ctx context.Context, sel ast.SelectionSet, v model.SQLContextInfo) graphql.Marshaler {
- return ec._SQLContextInfo(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNSQLContextInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLContextInfo(ctx context.Context, sel ast.SelectionSet, v []*model.SQLContextInfo) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalOSQLContextInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLContextInfo(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- return ret
-}
-
-func (ec *executionContext) marshalNSQLContextInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLContextInfo(ctx context.Context, sel ast.SelectionSet, v *model.SQLContextInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._SQLContextInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNSQLExecuteInfo2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLExecuteInfo(ctx context.Context, sel ast.SelectionSet, v model.SQLExecuteInfo) graphql.Marshaler {
- return ec._SQLExecuteInfo(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNSQLExecuteInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLExecuteInfo(ctx context.Context, sel ast.SelectionSet, v *model.SQLExecuteInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._SQLExecuteInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNSQLExecutionPlan2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLExecutionPlan(ctx context.Context, sel ast.SelectionSet, v model.SQLExecutionPlan) graphql.Marshaler {
- return ec._SQLExecutionPlan(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNSQLExecutionPlan2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLExecutionPlan(ctx context.Context, sel ast.SelectionSet, v *model.SQLExecutionPlan) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._SQLExecutionPlan(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNSQLExecutionPlanNode2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLExecutionPlanNodeᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.SQLExecutionPlanNode) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNSQLExecutionPlanNode2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLExecutionPlanNode(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNSQLExecutionPlanNode2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLExecutionPlanNode(ctx context.Context, sel ast.SelectionSet, v *model.SQLExecutionPlanNode) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._SQLExecutionPlanNode(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNSQLQueryGenerator2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLQueryGeneratorᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.SQLQueryGenerator) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNSQLQueryGenerator2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLQueryGenerator(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNSQLQueryGenerator2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLQueryGenerator(ctx context.Context, sel ast.SelectionSet, v *model.SQLQueryGenerator) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._SQLQueryGenerator(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNSQLQueryResults2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLQueryResultsᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.SQLQueryResults) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNSQLQueryResults2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLQueryResults(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNSQLQueryResults2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLQueryResults(ctx context.Context, sel ast.SelectionSet, v *model.SQLQueryResults) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._SQLQueryResults(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalNSQLResultRow2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLResultRowᚄ(ctx context.Context, v interface{}) ([]*model.SQLResultRow, error) {
- var vSlice []interface{}
- if v != nil {
- vSlice = graphql.CoerceList(v)
- }
- var err error
- res := make([]*model.SQLResultRow, len(vSlice))
- for i := range vSlice {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
- res[i], err = ec.unmarshalNSQLResultRow2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLResultRow(ctx, vSlice[i])
- if err != nil {
- return nil, err
- }
- }
- return res, nil
-}
-
-func (ec *executionContext) unmarshalNSQLResultRow2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLResultRow(ctx context.Context, v interface{}) (*model.SQLResultRow, error) {
- res, err := ec.unmarshalInputSQLResultRow(ctx, v)
- return &res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalNSQLScriptInfo2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLScriptInfo(ctx context.Context, sel ast.SelectionSet, v model.SQLScriptInfo) graphql.Marshaler {
- return ec._SQLScriptInfo(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNSQLScriptInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLScriptInfo(ctx context.Context, sel ast.SelectionSet, v *model.SQLScriptInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._SQLScriptInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNSQLScriptQuery2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLScriptQuery(ctx context.Context, sel ast.SelectionSet, v model.SQLScriptQuery) graphql.Marshaler {
- return ec._SQLScriptQuery(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNSQLScriptQuery2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLScriptQueryᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.SQLScriptQuery) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNSQLScriptQuery2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLScriptQuery(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNSQLScriptQuery2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLScriptQuery(ctx context.Context, sel ast.SelectionSet, v *model.SQLScriptQuery) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._SQLScriptQuery(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNServerConfig2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐServerConfig(ctx context.Context, sel ast.SelectionSet, v model.ServerConfig) graphql.Marshaler {
- return ec._ServerConfig(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNServerConfig2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐServerConfig(ctx context.Context, sel ast.SelectionSet, v *model.ServerConfig) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._ServerConfig(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalNServerConfigInput2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐServerConfigInput(ctx context.Context, v interface{}) (model.ServerConfigInput, error) {
- res, err := ec.unmarshalInputServerConfigInput(ctx, v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalNServerLanguage2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐServerLanguageᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.ServerLanguage) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNServerLanguage2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐServerLanguage(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNServerLanguage2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐServerLanguage(ctx context.Context, sel ast.SelectionSet, v *model.ServerLanguage) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._ServerLanguage(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNSessionInfo2githubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSessionInfo(ctx context.Context, sel ast.SelectionSet, v model.SessionInfo) graphql.Marshaler {
- return ec._SessionInfo(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNSessionInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSessionInfo(ctx context.Context, sel ast.SelectionSet, v *model.SessionInfo) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._SessionInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) {
- res, err := graphql.UnmarshalString(v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler {
- res := graphql.MarshalString(v)
- if res == graphql.Null {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- }
- return res
-}
-
-func (ec *executionContext) unmarshalNString2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) {
- var vSlice []interface{}
- if v != nil {
- vSlice = graphql.CoerceList(v)
- }
- var err error
- res := make([]string, len(vSlice))
- for i := range vSlice {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
- res[i], err = ec.unmarshalNString2string(ctx, vSlice[i])
- if err != nil {
- return nil, err
- }
- }
- return res, nil
-}
-
-func (ec *executionContext) marshalNString2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- for i := range v {
- ret[i] = ec.marshalNString2string(ctx, sel, v[i])
- }
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) unmarshalNString2ᚕᚕᚖstring(ctx context.Context, v interface{}) ([][]*string, error) {
- var vSlice []interface{}
- if v != nil {
- vSlice = graphql.CoerceList(v)
- }
- var err error
- res := make([][]*string, len(vSlice))
- for i := range vSlice {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
- res[i], err = ec.unmarshalOString2ᚕᚖstring(ctx, vSlice[i])
- if err != nil {
- return nil, err
- }
- }
- return res, nil
-}
-
-func (ec *executionContext) marshalNString2ᚕᚕᚖstring(ctx context.Context, sel ast.SelectionSet, v [][]*string) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- for i := range v {
- ret[i] = ec.marshalOString2ᚕᚖstring(ctx, sel, v[i])
- }
-
- return ret
-}
-
-func (ec *executionContext) unmarshalNString2ᚕᚖstring(ctx context.Context, v interface{}) ([]*string, error) {
- var vSlice []interface{}
- if v != nil {
- vSlice = graphql.CoerceList(v)
- }
- var err error
- res := make([]*string, len(vSlice))
- for i := range vSlice {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
- res[i], err = ec.unmarshalOString2ᚖstring(ctx, vSlice[i])
- if err != nil {
- return nil, err
- }
- }
- return res, nil
-}
-
-func (ec *executionContext) marshalNString2ᚕᚖstring(ctx context.Context, sel ast.SelectionSet, v []*string) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- for i := range v {
- ret[i] = ec.marshalOString2ᚖstring(ctx, sel, v[i])
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNUserAuthToken2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐUserAuthTokenᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.UserAuthToken) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNUserAuthToken2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐUserAuthToken(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNUserAuthToken2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐUserAuthToken(ctx context.Context, sel ast.SelectionSet, v *model.UserAuthToken) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._UserAuthToken(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNWebFeatureSet2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐWebFeatureSetᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.WebFeatureSet) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNWebFeatureSet2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐWebFeatureSet(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNWebFeatureSet2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐWebFeatureSet(ctx context.Context, sel ast.SelectionSet, v *model.WebFeatureSet) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._WebFeatureSet(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler {
- return ec.___Directive(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Directive) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) {
- res, err := graphql.UnmarshalString(v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler {
- res := graphql.MarshalString(v)
- if res == graphql.Null {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- }
- return res
-}
-
-func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) {
- var vSlice []interface{}
- if v != nil {
- vSlice = graphql.CoerceList(v)
- }
- var err error
- res := make([]string, len(vSlice))
- for i := range vSlice {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
- res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i])
- if err != nil {
- return nil, err
- }
- }
- return res, nil
-}
-
-func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalN__DirectiveLocation2string(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx context.Context, sel ast.SelectionSet, v introspection.EnumValue) graphql.Marshaler {
- return ec.___EnumValue(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx context.Context, sel ast.SelectionSet, v introspection.Field) graphql.Marshaler {
- return ec.___Field(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, sel ast.SelectionSet, v introspection.InputValue) graphql.Marshaler {
- return ec.___InputValue(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler {
- return ec.___Type(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec.___Type(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) {
- res, err := graphql.UnmarshalString(v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler {
- res := graphql.MarshalString(v)
- if res == graphql.Null {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- }
- return res
-}
-
-func (ec *executionContext) unmarshalOAuthCredentialEncryption2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthCredentialEncryption(ctx context.Context, v interface{}) (*model.AuthCredentialEncryption, error) {
- if v == nil {
- return nil, nil
- }
- var res = new(model.AuthCredentialEncryption)
- err := res.UnmarshalGQL(v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalOAuthCredentialEncryption2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthCredentialEncryption(ctx context.Context, sel ast.SelectionSet, v *model.AuthCredentialEncryption) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- return v
-}
-
-func (ec *executionContext) marshalOAuthProviderConfiguration2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthProviderConfigurationᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.AuthProviderConfiguration) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNAuthProviderConfiguration2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐAuthProviderConfiguration(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) {
- res, err := graphql.UnmarshalBoolean(v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler {
- res := graphql.MarshalBoolean(v)
- return res
-}
-
-func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v interface{}) (*bool, error) {
- if v == nil {
- return nil, nil
- }
- res, err := graphql.UnmarshalBoolean(v)
- return &res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- res := graphql.MarshalBoolean(*v)
- return res
-}
-
-func (ec *executionContext) unmarshalOConnectionConfig2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐConnectionConfig(ctx context.Context, v interface{}) (*model.ConnectionConfig, error) {
- if v == nil {
- return nil, nil
- }
- res, err := ec.unmarshalInputConnectionConfig(ctx, v)
- return &res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalODatabaseObjectInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐDatabaseObjectInfo(ctx context.Context, sel ast.SelectionSet, v *model.DatabaseObjectInfo) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- return ec._DatabaseObjectInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalODateTime2ᚖtimeᚐTime(ctx context.Context, v interface{}) (*time.Time, error) {
- if v == nil {
- return nil, nil
- }
- res, err := graphql.UnmarshalTime(v)
- return &res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalODateTime2ᚖtimeᚐTime(ctx context.Context, sel ast.SelectionSet, v *time.Time) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- res := graphql.MarshalTime(*v)
- return res
-}
-
-func (ec *executionContext) unmarshalOFloat2ᚖfloat64(ctx context.Context, v interface{}) (*float64, error) {
- if v == nil {
- return nil, nil
- }
- res, err := graphql.UnmarshalFloatContext(ctx, v)
- return &res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalOFloat2ᚖfloat64(ctx context.Context, sel ast.SelectionSet, v *float64) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- res := graphql.MarshalFloatContext(*v)
- return graphql.WrapContextMarshaler(ctx, res)
-}
-
-func (ec *executionContext) unmarshalOID2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) {
- if v == nil {
- return nil, nil
- }
- var vSlice []interface{}
- if v != nil {
- vSlice = graphql.CoerceList(v)
- }
- var err error
- res := make([]string, len(vSlice))
- for i := range vSlice {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
- res[i], err = ec.unmarshalNID2string(ctx, vSlice[i])
- if err != nil {
- return nil, err
- }
- }
- return res, nil
-}
-
-func (ec *executionContext) marshalOID2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- ret := make(graphql.Array, len(v))
- for i := range v {
- ret[i] = ec.marshalNID2string(ctx, sel, v[i])
- }
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) unmarshalOID2ᚖstring(ctx context.Context, v interface{}) (*string, error) {
- if v == nil {
- return nil, nil
- }
- res, err := graphql.UnmarshalID(v)
- return &res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalOID2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- res := graphql.MarshalID(*v)
- return res
-}
-
-func (ec *executionContext) unmarshalOInt2ᚖint(ctx context.Context, v interface{}) (*int, error) {
- if v == nil {
- return nil, nil
- }
- res, err := graphql.UnmarshalInt(v)
- return &res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.SelectionSet, v *int) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- res := graphql.MarshalInt(*v)
- return res
-}
-
-func (ec *executionContext) unmarshalONetworkHandlerAuthType2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerAuthType(ctx context.Context, v interface{}) (*model.NetworkHandlerAuthType, error) {
- if v == nil {
- return nil, nil
- }
- var res = new(model.NetworkHandlerAuthType)
- err := res.UnmarshalGQL(v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalONetworkHandlerAuthType2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerAuthType(ctx context.Context, sel ast.SelectionSet, v *model.NetworkHandlerAuthType) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- return v
-}
-
-func (ec *executionContext) unmarshalONetworkHandlerConfigInput2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerConfigInputᚄ(ctx context.Context, v interface{}) ([]*model.NetworkHandlerConfigInput, error) {
- if v == nil {
- return nil, nil
- }
- var vSlice []interface{}
- if v != nil {
- vSlice = graphql.CoerceList(v)
- }
- var err error
- res := make([]*model.NetworkHandlerConfigInput, len(vSlice))
- for i := range vSlice {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
- res[i], err = ec.unmarshalNNetworkHandlerConfigInput2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerConfigInput(ctx, vSlice[i])
- if err != nil {
- return nil, err
- }
- }
- return res, nil
-}
-
-func (ec *executionContext) unmarshalONetworkHandlerType2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerType(ctx context.Context, v interface{}) (*model.NetworkHandlerType, error) {
- if v == nil {
- return nil, nil
- }
- var res = new(model.NetworkHandlerType)
- err := res.UnmarshalGQL(v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalONetworkHandlerType2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐNetworkHandlerType(ctx context.Context, sel ast.SelectionSet, v *model.NetworkHandlerType) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- return v
-}
-
-func (ec *executionContext) unmarshalOObject2interface(ctx context.Context, v interface{}) (interface{}, error) {
- if v == nil {
- return nil, nil
- }
- res, err := graphql.UnmarshalAny(v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalOObject2interface(ctx context.Context, sel ast.SelectionSet, v interface{}) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- res := graphql.MarshalAny(v)
- return res
-}
-
-func (ec *executionContext) unmarshalOObject2ᚕinterface(ctx context.Context, v interface{}) ([]interface{}, error) {
- if v == nil {
- return nil, nil
- }
- var vSlice []interface{}
- if v != nil {
- vSlice = graphql.CoerceList(v)
- }
- var err error
- res := make([]interface{}, len(vSlice))
- for i := range vSlice {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
- res[i], err = ec.unmarshalOObject2interface(ctx, vSlice[i])
- if err != nil {
- return nil, err
- }
- }
- return res, nil
-}
-
-func (ec *executionContext) marshalOObject2ᚕinterface(ctx context.Context, sel ast.SelectionSet, v []interface{}) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- ret := make(graphql.Array, len(v))
- for i := range v {
- ret[i] = ec.marshalOObject2interface(ctx, sel, v[i])
- }
-
- return ret
-}
-
-func (ec *executionContext) unmarshalOObject2ᚕᚕinterface(ctx context.Context, v interface{}) ([][]interface{}, error) {
- if v == nil {
- return nil, nil
- }
- var vSlice []interface{}
- if v != nil {
- vSlice = graphql.CoerceList(v)
- }
- var err error
- res := make([][]interface{}, len(vSlice))
- for i := range vSlice {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
- res[i], err = ec.unmarshalOObject2ᚕinterface(ctx, vSlice[i])
- if err != nil {
- return nil, err
- }
- }
- return res, nil
-}
-
-func (ec *executionContext) marshalOObject2ᚕᚕinterface(ctx context.Context, sel ast.SelectionSet, v [][]interface{}) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- ret := make(graphql.Array, len(v))
- for i := range v {
- ret[i] = ec.marshalOObject2ᚕinterface(ctx, sel, v[i])
- }
-
- return ret
-}
-
-func (ec *executionContext) unmarshalOObjectPropertyFilter2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyFilter(ctx context.Context, v interface{}) (*model.ObjectPropertyFilter, error) {
- if v == nil {
- return nil, nil
- }
- res, err := ec.unmarshalInputObjectPropertyFilter(ctx, v)
- return &res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalOObjectPropertyInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfo(ctx context.Context, sel ast.SelectionSet, v []*model.ObjectPropertyInfo) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalOObjectPropertyInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfo(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- return ret
-}
-
-func (ec *executionContext) marshalOObjectPropertyInfo2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfoᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.ObjectPropertyInfo) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNObjectPropertyInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfo(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalOObjectPropertyInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐObjectPropertyInfo(ctx context.Context, sel ast.SelectionSet, v *model.ObjectPropertyInfo) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- return ec._ObjectPropertyInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalOResultDataFormat2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐResultDataFormat(ctx context.Context, v interface{}) (*model.ResultDataFormat, error) {
- if v == nil {
- return nil, nil
- }
- var res = new(model.ResultDataFormat)
- err := res.UnmarshalGQL(v)
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalOResultDataFormat2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐResultDataFormat(ctx context.Context, sel ast.SelectionSet, v *model.ResultDataFormat) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- return v
-}
-
-func (ec *executionContext) marshalOSQLCompletionProposal2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLCompletionProposal(ctx context.Context, sel ast.SelectionSet, v []*model.SQLCompletionProposal) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalOSQLCompletionProposal2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLCompletionProposal(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- return ret
-}
-
-func (ec *executionContext) marshalOSQLCompletionProposal2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLCompletionProposal(ctx context.Context, sel ast.SelectionSet, v *model.SQLCompletionProposal) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- return ec._SQLCompletionProposal(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalOSQLContextInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLContextInfo(ctx context.Context, sel ast.SelectionSet, v *model.SQLContextInfo) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- return ec._SQLContextInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalOSQLDataFilter2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLDataFilter(ctx context.Context, v interface{}) (*model.SQLDataFilter, error) {
- if v == nil {
- return nil, nil
- }
- res, err := ec.unmarshalInputSQLDataFilter(ctx, v)
- return &res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) unmarshalOSQLDataFilterConstraint2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLDataFilterConstraint(ctx context.Context, v interface{}) ([]*model.SQLDataFilterConstraint, error) {
- if v == nil {
- return nil, nil
- }
- var vSlice []interface{}
- if v != nil {
- vSlice = graphql.CoerceList(v)
- }
- var err error
- res := make([]*model.SQLDataFilterConstraint, len(vSlice))
- for i := range vSlice {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
- res[i], err = ec.unmarshalOSQLDataFilterConstraint2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLDataFilterConstraint(ctx, vSlice[i])
- if err != nil {
- return nil, err
- }
- }
- return res, nil
-}
-
-func (ec *executionContext) unmarshalOSQLDataFilterConstraint2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLDataFilterConstraint(ctx context.Context, v interface{}) (*model.SQLDataFilterConstraint, error) {
- if v == nil {
- return nil, nil
- }
- res, err := ec.unmarshalInputSQLDataFilterConstraint(ctx, v)
- return &res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalOSQLDialectInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLDialectInfo(ctx context.Context, sel ast.SelectionSet, v *model.SQLDialectInfo) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- return ec._SQLDialectInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalOSQLExecuteInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLExecuteInfo(ctx context.Context, sel ast.SelectionSet, v *model.SQLExecuteInfo) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- return ec._SQLExecuteInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalOSQLResultColumn2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLResultColumn(ctx context.Context, sel ast.SelectionSet, v []*model.SQLResultColumn) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalOSQLResultColumn2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLResultColumn(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- return ret
-}
-
-func (ec *executionContext) marshalOSQLResultColumn2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLResultColumn(ctx context.Context, sel ast.SelectionSet, v *model.SQLResultColumn) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- return ec._SQLResultColumn(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalOSQLResultRow2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLResultRowᚄ(ctx context.Context, v interface{}) ([]*model.SQLResultRow, error) {
- if v == nil {
- return nil, nil
- }
- var vSlice []interface{}
- if v != nil {
- vSlice = graphql.CoerceList(v)
- }
- var err error
- res := make([]*model.SQLResultRow, len(vSlice))
- for i := range vSlice {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
- res[i], err = ec.unmarshalNSQLResultRow2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLResultRow(ctx, vSlice[i])
- if err != nil {
- return nil, err
- }
- }
- return res, nil
-}
-
-func (ec *executionContext) marshalOSQLResultSet2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐSQLResultSet(ctx context.Context, sel ast.SelectionSet, v *model.SQLResultSet) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- return ec._SQLResultSet(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalOServerError2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐServerError(ctx context.Context, sel ast.SelectionSet, v *model.ServerError) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- return ec._ServerError(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalOServerMessage2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐServerMessage(ctx context.Context, sel ast.SelectionSet, v []*model.ServerMessage) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalOServerMessage2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐServerMessage(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- return ret
-}
-
-func (ec *executionContext) marshalOServerMessage2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐServerMessage(ctx context.Context, sel ast.SelectionSet, v *model.ServerMessage) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- return ec._ServerMessage(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalOString2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) {
- if v == nil {
- return nil, nil
- }
- var vSlice []interface{}
- if v != nil {
- vSlice = graphql.CoerceList(v)
- }
- var err error
- res := make([]string, len(vSlice))
- for i := range vSlice {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
- res[i], err = ec.unmarshalNString2string(ctx, vSlice[i])
- if err != nil {
- return nil, err
- }
- }
- return res, nil
-}
-
-func (ec *executionContext) marshalOString2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- ret := make(graphql.Array, len(v))
- for i := range v {
- ret[i] = ec.marshalNString2string(ctx, sel, v[i])
- }
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) unmarshalOString2ᚕᚖstring(ctx context.Context, v interface{}) ([]*string, error) {
- if v == nil {
- return nil, nil
- }
- var vSlice []interface{}
- if v != nil {
- vSlice = graphql.CoerceList(v)
- }
- var err error
- res := make([]*string, len(vSlice))
- for i := range vSlice {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
- res[i], err = ec.unmarshalOString2ᚖstring(ctx, vSlice[i])
- if err != nil {
- return nil, err
- }
- }
- return res, nil
-}
-
-func (ec *executionContext) marshalOString2ᚕᚖstring(ctx context.Context, sel ast.SelectionSet, v []*string) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- ret := make(graphql.Array, len(v))
- for i := range v {
- ret[i] = ec.marshalOString2ᚖstring(ctx, sel, v[i])
- }
-
- return ret
-}
-
-func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v interface{}) (*string, error) {
- if v == nil {
- return nil, nil
- }
- res, err := graphql.UnmarshalString(v)
- return &res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- res := graphql.MarshalString(*v)
- return res
-}
-
-func (ec *executionContext) marshalOUserAuthToken2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐUserAuthTokenᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.UserAuthToken) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNUserAuthToken2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐUserAuthToken(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalOUserInfo2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐUserInfo(ctx context.Context, sel ast.SelectionSet, v *model.UserInfo) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- return ec._UserInfo(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalOWebServiceConfig2ᚕᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐWebServiceConfig(ctx context.Context, sel ast.SelectionSet, v []*model.WebServiceConfig) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalOWebServiceConfig2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐWebServiceConfig(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- return ret
-}
-
-func (ec *executionContext) marshalOWebServiceConfig2ᚖgithubᚗcomᚋactiontechᚋsqleᚋsqleᚋapiᚋcloudbeaver_wrapperᚋgraphᚋmodelᚐWebServiceConfig(ctx context.Context, sel ast.SelectionSet, v *model.WebServiceConfig) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- return ec._WebServiceConfig(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Field) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, sel ast.SelectionSet, v *introspection.Schema) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- return ec.___Schema(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler {
- if v == nil {
- return graphql.Null
- }
- return ec.___Type(ctx, sel, v)
-}
-
-// endregion ***************************** type.gotpl *****************************
diff --git a/sqle/api/cloudbeaver_wrapper/graph/resolver/resolver.go b/sqle/api/cloudbeaver_wrapper/graph/resolver/resolver.go
deleted file mode 100644
index 14b7bf3412..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/resolver/resolver.go
+++ /dev/null
@@ -1,15 +0,0 @@
-package resolver
-
-// This file will not be regenerated automatically.
-//
-// It serves as dependency injection for your app, add any dependencies you require here.
-
-type Resolver struct{}
-
-type MutationResolverImpl struct {
- *mutationResolver
-}
-
-type QueryResolverImpl struct {
- *queryResolver
-}
diff --git a/sqle/api/cloudbeaver_wrapper/graph/resolver/schema_gen.go b/sqle/api/cloudbeaver_wrapper/graph/resolver/schema_gen.go
deleted file mode 100644
index c9ef8df5a0..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/resolver/schema_gen.go
+++ /dev/null
@@ -1,13 +0,0 @@
-package resolver
-
-// This file will be automatically regenerated based on the schema, any resolver implementations
-// will be copied through when generating and any unknown code will be moved to the end.
-
-// Mutation returns MutationResolver implementation.
-func (r *Resolver) Mutation() MutationResolver { return &mutationResolver{r} }
-
-// Query returns QueryResolver implementation.
-func (r *Resolver) Query() QueryResolver { return &queryResolver{r} }
-
-type mutationResolver struct{ *Resolver }
-type queryResolver struct{ *Resolver }
diff --git a/sqle/api/cloudbeaver_wrapper/graph/resolver/service.admin_gen.go b/sqle/api/cloudbeaver_wrapper/graph/resolver/service.admin_gen.go
deleted file mode 100644
index b258d72dda..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/resolver/service.admin_gen.go
+++ /dev/null
@@ -1,176 +0,0 @@
-package resolver
-
-// This file will be automatically regenerated based on the schema, any resolver implementations
-// will be copied through when generating and any unknown code will be moved to the end.
-
-import (
- "context"
- "fmt"
-
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/graph/model"
-)
-
-// ListUsers is the resolver for the listUsers field.
-func (r *queryResolver) ListUsers(ctx context.Context, userID *string) ([]*model.AdminUserInfo, error) {
- panic(fmt.Errorf("not implemented: ListUsers - listUsers"))
-}
-
-// ListRoles is the resolver for the listRoles field.
-func (r *queryResolver) ListRoles(ctx context.Context, roleID *string) ([]*model.AdminRoleInfo, error) {
- panic(fmt.Errorf("not implemented: ListRoles - listRoles"))
-}
-
-// ListPermissions is the resolver for the listPermissions field.
-func (r *queryResolver) ListPermissions(ctx context.Context) ([]*model.AdminPermissionInfo, error) {
- panic(fmt.Errorf("not implemented: ListPermissions - listPermissions"))
-}
-
-// CreateUser is the resolver for the createUser field.
-func (r *queryResolver) CreateUser(ctx context.Context, userID string) (*model.AdminUserInfo, error) {
- panic(fmt.Errorf("not implemented: CreateUser - createUser"))
-}
-
-// DeleteUser is the resolver for the deleteUser field.
-func (r *queryResolver) DeleteUser(ctx context.Context, userID string) (*bool, error) {
- panic(fmt.Errorf("not implemented: DeleteUser - deleteUser"))
-}
-
-// CreateRole is the resolver for the createRole field.
-func (r *queryResolver) CreateRole(ctx context.Context, roleID string, roleName *string, description *string) (*model.AdminRoleInfo, error) {
- panic(fmt.Errorf("not implemented: CreateRole - createRole"))
-}
-
-// UpdateRole is the resolver for the updateRole field.
-func (r *queryResolver) UpdateRole(ctx context.Context, roleID string, roleName *string, description *string) (*model.AdminRoleInfo, error) {
- panic(fmt.Errorf("not implemented: UpdateRole - updateRole"))
-}
-
-// DeleteRole is the resolver for the deleteRole field.
-func (r *queryResolver) DeleteRole(ctx context.Context, roleID string) (*bool, error) {
- panic(fmt.Errorf("not implemented: DeleteRole - deleteRole"))
-}
-
-// GrantUserRole is the resolver for the grantUserRole field.
-func (r *queryResolver) GrantUserRole(ctx context.Context, userID string, roleID string) (*bool, error) {
- panic(fmt.Errorf("not implemented: GrantUserRole - grantUserRole"))
-}
-
-// RevokeUserRole is the resolver for the revokeUserRole field.
-func (r *queryResolver) RevokeUserRole(ctx context.Context, userID string, roleID string) (*bool, error) {
- panic(fmt.Errorf("not implemented: RevokeUserRole - revokeUserRole"))
-}
-
-// SetSubjectPermissions is the resolver for the setSubjectPermissions field.
-func (r *queryResolver) SetSubjectPermissions(ctx context.Context, roleID string, permissions []string) ([]*model.AdminPermissionInfo, error) {
- panic(fmt.Errorf("not implemented: SetSubjectPermissions - setSubjectPermissions"))
-}
-
-// SetUserCredentials is the resolver for the setUserCredentials field.
-func (r *queryResolver) SetUserCredentials(ctx context.Context, userID string, providerID string, credentials interface{}) (*bool, error) {
- panic(fmt.Errorf("not implemented: SetUserCredentials - setUserCredentials"))
-}
-
-// EnableUser is the resolver for the enableUser field.
-func (r *queryResolver) EnableUser(ctx context.Context, userID string, enabled bool) (*bool, error) {
- panic(fmt.Errorf("not implemented: EnableUser - enableUser"))
-}
-
-// AllConnections is the resolver for the allConnections field.
-func (r *queryResolver) AllConnections(ctx context.Context, id *string) ([]*model.ConnectionInfo, error) {
- panic(fmt.Errorf("not implemented: AllConnections - allConnections"))
-}
-
-// SearchConnections is the resolver for the searchConnections field.
-func (r *queryResolver) SearchConnections(ctx context.Context, hostNames []string) ([]*model.AdminConnectionSearchInfo, error) {
- panic(fmt.Errorf("not implemented: SearchConnections - searchConnections"))
-}
-
-// CreateConnectionConfiguration is the resolver for the createConnectionConfiguration field.
-func (r *queryResolver) CreateConnectionConfiguration(ctx context.Context, config model.ConnectionConfig) (*model.ConnectionInfo, error) {
- panic(fmt.Errorf("not implemented: CreateConnectionConfiguration - createConnectionConfiguration"))
-}
-
-// CopyConnectionConfiguration is the resolver for the copyConnectionConfiguration field.
-func (r *queryResolver) CopyConnectionConfiguration(ctx context.Context, nodePath string, config *model.ConnectionConfig) (*model.ConnectionInfo, error) {
- panic(fmt.Errorf("not implemented: CopyConnectionConfiguration - copyConnectionConfiguration"))
-}
-
-// UpdateConnectionConfiguration is the resolver for the updateConnectionConfiguration field.
-func (r *queryResolver) UpdateConnectionConfiguration(ctx context.Context, id string, config model.ConnectionConfig) (*model.ConnectionInfo, error) {
- panic(fmt.Errorf("not implemented: UpdateConnectionConfiguration - updateConnectionConfiguration"))
-}
-
-// DeleteConnectionConfiguration is the resolver for the deleteConnectionConfiguration field.
-func (r *queryResolver) DeleteConnectionConfiguration(ctx context.Context, id string) (*bool, error) {
- panic(fmt.Errorf("not implemented: DeleteConnectionConfiguration - deleteConnectionConfiguration"))
-}
-
-// GetConnectionSubjectAccess is the resolver for the getConnectionSubjectAccess field.
-func (r *queryResolver) GetConnectionSubjectAccess(ctx context.Context, connectionID *string) ([]*model.AdminConnectionGrantInfo, error) {
- panic(fmt.Errorf("not implemented: GetConnectionSubjectAccess - getConnectionSubjectAccess"))
-}
-
-// SetConnectionSubjectAccess is the resolver for the setConnectionSubjectAccess field.
-func (r *queryResolver) SetConnectionSubjectAccess(ctx context.Context, connectionID string, subjects []string) (*bool, error) {
- panic(fmt.Errorf("not implemented: SetConnectionSubjectAccess - setConnectionSubjectAccess"))
-}
-
-// GetSubjectConnectionAccess is the resolver for the getSubjectConnectionAccess field.
-func (r *queryResolver) GetSubjectConnectionAccess(ctx context.Context, subjectID *string) ([]*model.AdminConnectionGrantInfo, error) {
- panic(fmt.Errorf("not implemented: GetSubjectConnectionAccess - getSubjectConnectionAccess"))
-}
-
-// SetSubjectConnectionAccess is the resolver for the setSubjectConnectionAccess field.
-func (r *queryResolver) SetSubjectConnectionAccess(ctx context.Context, subjectID string, connections []string) (*bool, error) {
- panic(fmt.Errorf("not implemented: SetSubjectConnectionAccess - setSubjectConnectionAccess"))
-}
-
-// ListFeatureSets is the resolver for the listFeatureSets field.
-func (r *queryResolver) ListFeatureSets(ctx context.Context) ([]*model.WebFeatureSet, error) {
- panic(fmt.Errorf("not implemented: ListFeatureSets - listFeatureSets"))
-}
-
-// ListAuthProviderConfigurationParameters is the resolver for the listAuthProviderConfigurationParameters field.
-func (r *queryResolver) ListAuthProviderConfigurationParameters(ctx context.Context, providerID string) ([]*model.ObjectPropertyInfo, error) {
- panic(fmt.Errorf("not implemented: ListAuthProviderConfigurationParameters - listAuthProviderConfigurationParameters"))
-}
-
-// ListAuthProviderConfigurations is the resolver for the listAuthProviderConfigurations field.
-func (r *queryResolver) ListAuthProviderConfigurations(ctx context.Context, providerID *string) ([]*model.AdminAuthProviderConfiguration, error) {
- panic(fmt.Errorf("not implemented: ListAuthProviderConfigurations - listAuthProviderConfigurations"))
-}
-
-// SaveAuthProviderConfiguration is the resolver for the saveAuthProviderConfiguration field.
-func (r *queryResolver) SaveAuthProviderConfiguration(ctx context.Context, providerID string, id string, displayName *string, disabled *bool, iconURL *string, description *string, parameters interface{}) (*model.AdminAuthProviderConfiguration, error) {
- panic(fmt.Errorf("not implemented: SaveAuthProviderConfiguration - saveAuthProviderConfiguration"))
-}
-
-// DeleteAuthProviderConfiguration is the resolver for the deleteAuthProviderConfiguration field.
-func (r *queryResolver) DeleteAuthProviderConfiguration(ctx context.Context, id string) (bool, error) {
- panic(fmt.Errorf("not implemented: DeleteAuthProviderConfiguration - deleteAuthProviderConfiguration"))
-}
-
-// SaveUserMetaParameter is the resolver for the saveUserMetaParameter field.
-func (r *queryResolver) SaveUserMetaParameter(ctx context.Context, id string, displayName string, description *string, required bool) (*model.ObjectPropertyInfo, error) {
- panic(fmt.Errorf("not implemented: SaveUserMetaParameter - saveUserMetaParameter"))
-}
-
-// DeleteUserMetaParameter is the resolver for the deleteUserMetaParameter field.
-func (r *queryResolver) DeleteUserMetaParameter(ctx context.Context, id string) (bool, error) {
- panic(fmt.Errorf("not implemented: DeleteUserMetaParameter - deleteUserMetaParameter"))
-}
-
-// SetUserMetaParameterValues is the resolver for the setUserMetaParameterValues field.
-func (r *queryResolver) SetUserMetaParameterValues(ctx context.Context, userID string, parameters interface{}) (bool, error) {
- panic(fmt.Errorf("not implemented: SetUserMetaParameterValues - setUserMetaParameterValues"))
-}
-
-// ConfigureServer is the resolver for the configureServer field.
-func (r *queryResolver) ConfigureServer(ctx context.Context, configuration model.ServerConfigInput) (bool, error) {
- panic(fmt.Errorf("not implemented: ConfigureServer - configureServer"))
-}
-
-// SetDefaultNavigatorSettings is the resolver for the setDefaultNavigatorSettings field.
-func (r *queryResolver) SetDefaultNavigatorSettings(ctx context.Context, settings model.NavigatorSettingsInput) (bool, error) {
- panic(fmt.Errorf("not implemented: SetDefaultNavigatorSettings - setDefaultNavigatorSettings"))
-}
diff --git a/sqle/api/cloudbeaver_wrapper/graph/resolver/service.auth_gen.go b/sqle/api/cloudbeaver_wrapper/graph/resolver/service.auth_gen.go
deleted file mode 100644
index 8e90beeb03..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/resolver/service.auth_gen.go
+++ /dev/null
@@ -1,51 +0,0 @@
-package resolver
-
-// This file will be automatically regenerated based on the schema, any resolver implementations
-// will be copied through when generating and any unknown code will be moved to the end.
-
-import (
- "context"
- "fmt"
-
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/graph/model"
-)
-
-// SetUserConfigurationParameter is the resolver for the setUserConfigurationParameter field.
-func (r *mutationResolver) SetUserConfigurationParameter(ctx context.Context, name string, value interface{}) (bool, error) {
- panic(fmt.Errorf("not implemented: SetUserConfigurationParameter - setUserConfigurationParameter"))
-}
-
-// AuthLogin is the resolver for the authLogin field.
-func (r *queryResolver) AuthLogin(ctx context.Context, provider string, configuration *string, credentials interface{}, linkUser *bool) (*model.AuthInfo, error) {
- panic(fmt.Errorf("not implemented: AuthLogin - authLogin"))
-}
-
-// AuthUpdateStatus is the resolver for the authUpdateStatus field.
-func (r *queryResolver) AuthUpdateStatus(ctx context.Context, authID string, linkUser *bool) (*model.AuthInfo, error) {
- panic(fmt.Errorf("not implemented: AuthUpdateStatus - authUpdateStatus"))
-}
-
-// AuthLogout is the resolver for the authLogout field.
-func (r *queryResolver) AuthLogout(ctx context.Context, provider *string, configuration *string) (*bool, error) {
- panic(fmt.Errorf("not implemented: AuthLogout - authLogout"))
-}
-
-// ActiveUser is the resolver for the activeUser field.
-func (r *queryResolver) ActiveUser(ctx context.Context) (*model.UserInfo, error) {
- panic(fmt.Errorf("not implemented: ActiveUser - activeUser"))
-}
-
-// AuthProviders is the resolver for the authProviders field.
-func (r *queryResolver) AuthProviders(ctx context.Context) ([]*model.AuthProviderInfo, error) {
- panic(fmt.Errorf("not implemented: AuthProviders - authProviders"))
-}
-
-// AuthChangeLocalPassword is the resolver for the authChangeLocalPassword field.
-func (r *queryResolver) AuthChangeLocalPassword(ctx context.Context, oldPassword string, newPassword string) (bool, error) {
- panic(fmt.Errorf("not implemented: AuthChangeLocalPassword - authChangeLocalPassword"))
-}
-
-// ListUserProfileProperties is the resolver for the listUserProfileProperties field.
-func (r *queryResolver) ListUserProfileProperties(ctx context.Context) ([]*model.ObjectPropertyInfo, error) {
- panic(fmt.Errorf("not implemented: ListUserProfileProperties - listUserProfileProperties"))
-}
diff --git a/sqle/api/cloudbeaver_wrapper/graph/resolver/service.core_gen.go b/sqle/api/cloudbeaver_wrapper/graph/resolver/service.core_gen.go
deleted file mode 100644
index 7ce45368fa..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/resolver/service.core_gen.go
+++ /dev/null
@@ -1,176 +0,0 @@
-package resolver
-
-// This file will be automatically regenerated based on the schema, any resolver implementations
-// will be copied through when generating and any unknown code will be moved to the end.
-
-import (
- "context"
- "fmt"
-
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/graph/model"
-)
-
-// OpenSession is the resolver for the openSession field.
-func (r *mutationResolver) OpenSession(ctx context.Context, defaultLocale *string) (*model.SessionInfo, error) {
- panic(fmt.Errorf("not implemented: OpenSession - openSession"))
-}
-
-// CloseSession is the resolver for the closeSession field.
-func (r *mutationResolver) CloseSession(ctx context.Context) (*bool, error) {
- panic(fmt.Errorf("not implemented: CloseSession - closeSession"))
-}
-
-// TouchSession is the resolver for the touchSession field.
-func (r *mutationResolver) TouchSession(ctx context.Context) (*bool, error) {
- panic(fmt.Errorf("not implemented: TouchSession - touchSession"))
-}
-
-// RefreshSessionConnections is the resolver for the refreshSessionConnections field.
-func (r *mutationResolver) RefreshSessionConnections(ctx context.Context) (*bool, error) {
- panic(fmt.Errorf("not implemented: RefreshSessionConnections - refreshSessionConnections"))
-}
-
-// ChangeSessionLanguage is the resolver for the changeSessionLanguage field.
-func (r *mutationResolver) ChangeSessionLanguage(ctx context.Context, locale *string) (*bool, error) {
- panic(fmt.Errorf("not implemented: ChangeSessionLanguage - changeSessionLanguage"))
-}
-
-// CreateConnection is the resolver for the createConnection field.
-func (r *mutationResolver) CreateConnection(ctx context.Context, config model.ConnectionConfig) (*model.ConnectionInfo, error) {
- panic(fmt.Errorf("not implemented: CreateConnection - createConnection"))
-}
-
-// UpdateConnection is the resolver for the updateConnection field.
-func (r *mutationResolver) UpdateConnection(ctx context.Context, config model.ConnectionConfig) (*model.ConnectionInfo, error) {
- panic(fmt.Errorf("not implemented: UpdateConnection - updateConnection"))
-}
-
-// DeleteConnection is the resolver for the deleteConnection field.
-func (r *mutationResolver) DeleteConnection(ctx context.Context, id string) (bool, error) {
- panic(fmt.Errorf("not implemented: DeleteConnection - deleteConnection"))
-}
-
-// CreateConnectionFromTemplate is the resolver for the createConnectionFromTemplate field.
-func (r *mutationResolver) CreateConnectionFromTemplate(ctx context.Context, templateID string, connectionName *string) (*model.ConnectionInfo, error) {
- panic(fmt.Errorf("not implemented: CreateConnectionFromTemplate - createConnectionFromTemplate"))
-}
-
-// CreateConnectionFolder is the resolver for the createConnectionFolder field.
-func (r *mutationResolver) CreateConnectionFolder(ctx context.Context, parentFolderPath *string, folderName string) (*model.ConnectionFolderInfo, error) {
- panic(fmt.Errorf("not implemented: CreateConnectionFolder - createConnectionFolder"))
-}
-
-// DeleteConnectionFolder is the resolver for the deleteConnectionFolder field.
-func (r *mutationResolver) DeleteConnectionFolder(ctx context.Context, folderPath string) (bool, error) {
- panic(fmt.Errorf("not implemented: DeleteConnectionFolder - deleteConnectionFolder"))
-}
-
-// CopyConnectionFromNode is the resolver for the copyConnectionFromNode field.
-func (r *mutationResolver) CopyConnectionFromNode(ctx context.Context, nodePath string, config *model.ConnectionConfig) (*model.ConnectionInfo, error) {
- panic(fmt.Errorf("not implemented: CopyConnectionFromNode - copyConnectionFromNode"))
-}
-
-// TestConnection is the resolver for the testConnection field.
-func (r *mutationResolver) TestConnection(ctx context.Context, config model.ConnectionConfig) (*model.ConnectionInfo, error) {
- panic(fmt.Errorf("not implemented: TestConnection - testConnection"))
-}
-
-// TestNetworkHandler is the resolver for the testNetworkHandler field.
-func (r *mutationResolver) TestNetworkHandler(ctx context.Context, config model.NetworkHandlerConfigInput) (*model.NetworkEndpointInfo, error) {
- panic(fmt.Errorf("not implemented: TestNetworkHandler - testNetworkHandler"))
-}
-
-// InitConnection is the resolver for the initConnection field.
-func (r *mutationResolver) InitConnection(ctx context.Context, id string, credentials interface{}, networkCredentials []*model.NetworkHandlerConfigInput, saveCredentials *bool) (*model.ConnectionInfo, error) {
- panic(fmt.Errorf("not implemented: InitConnection - initConnection"))
-}
-
-// CloseConnection is the resolver for the closeConnection field.
-func (r *mutationResolver) CloseConnection(ctx context.Context, id string) (*model.ConnectionInfo, error) {
- panic(fmt.Errorf("not implemented: CloseConnection - closeConnection"))
-}
-
-// SetConnectionNavigatorSettings is the resolver for the setConnectionNavigatorSettings field.
-func (r *mutationResolver) SetConnectionNavigatorSettings(ctx context.Context, id string, settings model.NavigatorSettingsInput) (*model.ConnectionInfo, error) {
- panic(fmt.Errorf("not implemented: SetConnectionNavigatorSettings - setConnectionNavigatorSettings"))
-}
-
-// AsyncTaskCancel is the resolver for the asyncTaskCancel field.
-func (r *mutationResolver) AsyncTaskCancel(ctx context.Context, id string) (*bool, error) {
- panic(fmt.Errorf("not implemented: AsyncTaskCancel - asyncTaskCancel"))
-}
-
-// AsyncTaskInfo is the resolver for the asyncTaskInfo field.
-func (r *mutationResolver) AsyncTaskInfo(ctx context.Context, id string, removeOnFinish bool) (*model.AsyncTaskInfo, error) {
- panic(fmt.Errorf("not implemented: AsyncTaskInfo - asyncTaskInfo"))
-}
-
-// OpenConnection is the resolver for the openConnection field.
-func (r *mutationResolver) OpenConnection(ctx context.Context, config model.ConnectionConfig) (*model.ConnectionInfo, error) {
- panic(fmt.Errorf("not implemented: OpenConnection - openConnection"))
-}
-
-// AsyncTaskStatus is the resolver for the asyncTaskStatus field.
-func (r *mutationResolver) AsyncTaskStatus(ctx context.Context, id string) (*model.AsyncTaskInfo, error) {
- panic(fmt.Errorf("not implemented: AsyncTaskStatus - asyncTaskStatus"))
-}
-
-// ServerConfig is the resolver for the serverConfig field.
-func (r *queryResolver) ServerConfig(ctx context.Context) (*model.ServerConfig, error) {
- panic(fmt.Errorf("not implemented: ServerConfig - serverConfig"))
-}
-
-// SessionState is the resolver for the sessionState field.
-func (r *queryResolver) SessionState(ctx context.Context) (*model.SessionInfo, error) {
- panic(fmt.Errorf("not implemented: SessionState - sessionState"))
-}
-
-// SessionPermissions is the resolver for the sessionPermissions field.
-func (r *queryResolver) SessionPermissions(ctx context.Context) ([]*string, error) {
- panic(fmt.Errorf("not implemented: SessionPermissions - sessionPermissions"))
-}
-
-// DriverList is the resolver for the driverList field.
-func (r *queryResolver) DriverList(ctx context.Context, id *string) ([]*model.DriverInfo, error) {
- panic(fmt.Errorf("not implemented: DriverList - driverList"))
-}
-
-// AuthModels is the resolver for the authModels field.
-func (r *queryResolver) AuthModels(ctx context.Context) ([]*model.DatabaseAuthModel, error) {
- panic(fmt.Errorf("not implemented: AuthModels - authModels"))
-}
-
-// NetworkHandlers is the resolver for the networkHandlers field.
-func (r *queryResolver) NetworkHandlers(ctx context.Context) ([]*model.NetworkHandlerDescriptor, error) {
- panic(fmt.Errorf("not implemented: NetworkHandlers - networkHandlers"))
-}
-
-// UserConnections is the resolver for the userConnections field.
-func (r *queryResolver) UserConnections(ctx context.Context, id *string) ([]*model.ConnectionInfo, error) {
- panic(fmt.Errorf("not implemented: UserConnections - userConnections"))
-}
-
-// TemplateConnections is the resolver for the templateConnections field.
-func (r *queryResolver) TemplateConnections(ctx context.Context) ([]*model.ConnectionInfo, error) {
- panic(fmt.Errorf("not implemented: TemplateConnections - templateConnections"))
-}
-
-// ConnectionFolders is the resolver for the connectionFolders field.
-func (r *queryResolver) ConnectionFolders(ctx context.Context, path *string) ([]*model.ConnectionFolderInfo, error) {
- panic(fmt.Errorf("not implemented: ConnectionFolders - connectionFolders"))
-}
-
-// ConnectionState is the resolver for the connectionState field.
-func (r *queryResolver) ConnectionState(ctx context.Context, id string) (*model.ConnectionInfo, error) {
- panic(fmt.Errorf("not implemented: ConnectionState - connectionState"))
-}
-
-// ConnectionInfo is the resolver for the connectionInfo field.
-func (r *queryResolver) ConnectionInfo(ctx context.Context, id string) (*model.ConnectionInfo, error) {
- panic(fmt.Errorf("not implemented: ConnectionInfo - connectionInfo"))
-}
-
-// ReadSessionLog is the resolver for the readSessionLog field.
-func (r *queryResolver) ReadSessionLog(ctx context.Context, maxEntries *int, clearEntries *bool) ([]*model.LogEntry, error) {
- panic(fmt.Errorf("not implemented: ReadSessionLog - readSessionLog"))
-}
diff --git a/sqle/api/cloudbeaver_wrapper/graph/resolver/service.data.transfer_gen.go b/sqle/api/cloudbeaver_wrapper/graph/resolver/service.data.transfer_gen.go
deleted file mode 100644
index eb1903f5eb..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/resolver/service.data.transfer_gen.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package resolver
-
-// This file will be automatically regenerated based on the schema, any resolver implementations
-// will be copied through when generating and any unknown code will be moved to the end.
-
-import (
- "context"
- "fmt"
-
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/graph/model"
-)
-
-// DataTransferAvailableStreamProcessors is the resolver for the dataTransferAvailableStreamProcessors field.
-func (r *queryResolver) DataTransferAvailableStreamProcessors(ctx context.Context) ([]*model.DataTransferProcessorInfo, error) {
- panic(fmt.Errorf("not implemented: DataTransferAvailableStreamProcessors - dataTransferAvailableStreamProcessors"))
-}
-
-// DataTransferExportDataFromContainer is the resolver for the dataTransferExportDataFromContainer field.
-func (r *queryResolver) DataTransferExportDataFromContainer(ctx context.Context, connectionID string, containerNodePath string, parameters model.DataTransferParameters) (*model.AsyncTaskInfo, error) {
- panic(fmt.Errorf("not implemented: DataTransferExportDataFromContainer - dataTransferExportDataFromContainer"))
-}
-
-// DataTransferExportDataFromResults is the resolver for the dataTransferExportDataFromResults field.
-func (r *queryResolver) DataTransferExportDataFromResults(ctx context.Context, connectionID string, contextID string, resultsID string, parameters model.DataTransferParameters) (*model.AsyncTaskInfo, error) {
- panic(fmt.Errorf("not implemented: DataTransferExportDataFromResults - dataTransferExportDataFromResults"))
-}
-
-// DataTransferRemoveDataFile is the resolver for the dataTransferRemoveDataFile field.
-func (r *queryResolver) DataTransferRemoveDataFile(ctx context.Context, dataFileID string) (*bool, error) {
- panic(fmt.Errorf("not implemented: DataTransferRemoveDataFile - dataTransferRemoveDataFile"))
-}
diff --git a/sqle/api/cloudbeaver_wrapper/graph/resolver/service.metadata_gen.go b/sqle/api/cloudbeaver_wrapper/graph/resolver/service.metadata_gen.go
deleted file mode 100644
index 501ac2fe15..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/resolver/service.metadata_gen.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package resolver
-
-// This file will be automatically regenerated based on the schema, any resolver implementations
-// will be copied through when generating and any unknown code will be moved to the end.
-
-import (
- "context"
- "fmt"
-)
-
-// MetadataGetNodeDdl is the resolver for the metadataGetNodeDDL field.
-func (r *queryResolver) MetadataGetNodeDdl(ctx context.Context, nodeID string, options interface{}) (*string, error) {
- panic(fmt.Errorf("not implemented: MetadataGetNodeDdl - metadataGetNodeDDL"))
-}
diff --git a/sqle/api/cloudbeaver_wrapper/graph/resolver/service.navigator_gen.go b/sqle/api/cloudbeaver_wrapper/graph/resolver/service.navigator_gen.go
deleted file mode 100644
index 55cd069112..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/resolver/service.navigator_gen.go
+++ /dev/null
@@ -1,51 +0,0 @@
-package resolver
-
-// This file will be automatically regenerated based on the schema, any resolver implementations
-// will be copied through when generating and any unknown code will be moved to the end.
-
-import (
- "context"
- "fmt"
-
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/graph/model"
-)
-
-// NavRenameNode is the resolver for the navRenameNode field.
-func (r *mutationResolver) NavRenameNode(ctx context.Context, nodePath string, newName string) (*string, error) {
- panic(fmt.Errorf("not implemented: NavRenameNode - navRenameNode"))
-}
-
-// NavDeleteNodes is the resolver for the navDeleteNodes field.
-func (r *mutationResolver) NavDeleteNodes(ctx context.Context, nodePaths []string) (*int, error) {
- panic(fmt.Errorf("not implemented: NavDeleteNodes - navDeleteNodes"))
-}
-
-// NavMoveNodesToFolder is the resolver for the navMoveNodesToFolder field.
-func (r *mutationResolver) NavMoveNodesToFolder(ctx context.Context, nodePaths []string, folderPath string) (*bool, error) {
- panic(fmt.Errorf("not implemented: NavMoveNodesToFolder - navMoveNodesToFolder"))
-}
-
-// NavNodeChildren is the resolver for the navNodeChildren field.
-func (r *queryResolver) NavNodeChildren(ctx context.Context, parentPath string, offset *int, limit *int, onlyFolders *bool) ([]*model.NavigatorNodeInfo, error) {
- panic(fmt.Errorf("not implemented: NavNodeChildren - navNodeChildren"))
-}
-
-// NavNodeParents is the resolver for the navNodeParents field.
-func (r *queryResolver) NavNodeParents(ctx context.Context, nodePath string) ([]*model.NavigatorNodeInfo, error) {
- panic(fmt.Errorf("not implemented: NavNodeParents - navNodeParents"))
-}
-
-// NavNodeInfo is the resolver for the navNodeInfo field.
-func (r *queryResolver) NavNodeInfo(ctx context.Context, nodePath string) (*model.NavigatorNodeInfo, error) {
- panic(fmt.Errorf("not implemented: NavNodeInfo - navNodeInfo"))
-}
-
-// NavRefreshNode is the resolver for the navRefreshNode field.
-func (r *queryResolver) NavRefreshNode(ctx context.Context, nodePath string) (*bool, error) {
- panic(fmt.Errorf("not implemented: NavRefreshNode - navRefreshNode"))
-}
-
-// NavGetStructContainers is the resolver for the navGetStructContainers field.
-func (r *queryResolver) NavGetStructContainers(ctx context.Context, connectionID string, contextID *string, catalog *string) (*model.DatabaseStructContainers, error) {
- panic(fmt.Errorf("not implemented: NavGetStructContainers - navGetStructContainers"))
-}
diff --git a/sqle/api/cloudbeaver_wrapper/graph/resolver/service.rm_gen.go b/sqle/api/cloudbeaver_wrapper/graph/resolver/service.rm_gen.go
deleted file mode 100644
index f1721e4836..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/resolver/service.rm_gen.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package resolver
-
-// This file will be automatically regenerated based on the schema, any resolver implementations
-// will be copied through when generating and any unknown code will be moved to the end.
-
-import (
- "context"
- "fmt"
-
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/graph/model"
-)
-
-// RmCreateResource is the resolver for the rmCreateResource field.
-func (r *mutationResolver) RmCreateResource(ctx context.Context, projectID string, resourcePath string, isFolder bool) (string, error) {
- panic(fmt.Errorf("not implemented: RmCreateResource - rmCreateResource"))
-}
-
-// RmMoveResource is the resolver for the rmMoveResource field.
-func (r *mutationResolver) RmMoveResource(ctx context.Context, projectID string, oldResourcePath string, newResourcePath *string) (string, error) {
- panic(fmt.Errorf("not implemented: RmMoveResource - rmMoveResource"))
-}
-
-// RmDeleteResource is the resolver for the rmDeleteResource field.
-func (r *mutationResolver) RmDeleteResource(ctx context.Context, projectID string, resourcePath string, recursive bool) (*bool, error) {
- panic(fmt.Errorf("not implemented: RmDeleteResource - rmDeleteResource"))
-}
-
-// RmWriteResourceStringContent is the resolver for the rmWriteResourceStringContent field.
-func (r *mutationResolver) RmWriteResourceStringContent(ctx context.Context, projectID string, resourcePath string, data string) (string, error) {
- panic(fmt.Errorf("not implemented: RmWriteResourceStringContent - rmWriteResourceStringContent"))
-}
-
-// RmListProjects is the resolver for the rmListProjects field.
-func (r *queryResolver) RmListProjects(ctx context.Context) ([]*model.RMProject, error) {
- panic(fmt.Errorf("not implemented: RmListProjects - rmListProjects"))
-}
-
-// RmListResources is the resolver for the rmListResources field.
-func (r *queryResolver) RmListResources(ctx context.Context, projectID string, folder *string, nameMask *string, readProperties *bool, readHistory *bool) ([]*model.RMResource, error) {
- panic(fmt.Errorf("not implemented: RmListResources - rmListResources"))
-}
-
-// RmReadResourceAsString is the resolver for the rmReadResourceAsString field.
-func (r *queryResolver) RmReadResourceAsString(ctx context.Context, projectID string, resourcePath string) (string, error) {
- panic(fmt.Errorf("not implemented: RmReadResourceAsString - rmReadResourceAsString"))
-}
diff --git a/sqle/api/cloudbeaver_wrapper/graph/resolver/service.sql_gen.go b/sqle/api/cloudbeaver_wrapper/graph/resolver/service.sql_gen.go
deleted file mode 100644
index 4529d12bb9..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/resolver/service.sql_gen.go
+++ /dev/null
@@ -1,116 +0,0 @@
-package resolver
-
-// This file will be automatically regenerated based on the schema, any resolver implementations
-// will be copied through when generating and any unknown code will be moved to the end.
-
-import (
- "context"
- "fmt"
-
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/graph/model"
-)
-
-// SQLContextCreate is the resolver for the sqlContextCreate field.
-func (r *mutationResolver) SQLContextCreate(ctx context.Context, connectionID string, defaultCatalog *string, defaultSchema *string) (*model.SQLContextInfo, error) {
- panic(fmt.Errorf("not implemented: SQLContextCreate - sqlContextCreate"))
-}
-
-// SQLContextSetDefaults is the resolver for the sqlContextSetDefaults field.
-func (r *mutationResolver) SQLContextSetDefaults(ctx context.Context, connectionID string, contextID string, defaultCatalog *string, defaultSchema *string) (bool, error) {
- panic(fmt.Errorf("not implemented: SQLContextSetDefaults - sqlContextSetDefaults"))
-}
-
-// SQLContextDestroy is the resolver for the sqlContextDestroy field.
-func (r *mutationResolver) SQLContextDestroy(ctx context.Context, connectionID string, contextID string) (bool, error) {
- panic(fmt.Errorf("not implemented: SQLContextDestroy - sqlContextDestroy"))
-}
-
-// AsyncSQLExecuteQuery is the resolver for the asyncSqlExecuteQuery field.
-func (r *mutationResolver) AsyncSQLExecuteQuery(ctx context.Context, projectID *string, connectionID string, contextID string, sql string, resultID *string, filter *model.SQLDataFilter, dataFormat *model.ResultDataFormat, readLogs *bool) (*model.AsyncTaskInfo, error) {
- panic(fmt.Errorf("not implemented: AsyncSQLExecuteQuery - asyncSqlExecuteQuery"))
-}
-
-// AsyncReadDataFromContainer is the resolver for the asyncReadDataFromContainer field.
-func (r *mutationResolver) AsyncReadDataFromContainer(ctx context.Context, connectionID string, contextID string, containerNodePath string, resultID *string, filter *model.SQLDataFilter, dataFormat *model.ResultDataFormat) (*model.AsyncTaskInfo, error) {
- panic(fmt.Errorf("not implemented: AsyncReadDataFromContainer - asyncReadDataFromContainer"))
-}
-
-// SQLResultClose is the resolver for the sqlResultClose field.
-func (r *mutationResolver) SQLResultClose(ctx context.Context, connectionID string, contextID string, resultID string) (bool, error) {
- panic(fmt.Errorf("not implemented: SQLResultClose - sqlResultClose"))
-}
-
-// UpdateResultsDataBatch is the resolver for the updateResultsDataBatch field.
-func (r *mutationResolver) UpdateResultsDataBatch(ctx context.Context, connectionID string, contextID string, resultsID string, updatedRows []*model.SQLResultRow, deletedRows []*model.SQLResultRow, addedRows []*model.SQLResultRow) (*model.SQLExecuteInfo, error) {
- panic(fmt.Errorf("not implemented: UpdateResultsDataBatch - updateResultsDataBatch"))
-}
-
-// UpdateResultsDataBatchScript is the resolver for the updateResultsDataBatchScript field.
-func (r *mutationResolver) UpdateResultsDataBatchScript(ctx context.Context, connectionID string, contextID string, resultsID string, updatedRows []*model.SQLResultRow, deletedRows []*model.SQLResultRow, addedRows []*model.SQLResultRow) (string, error) {
- panic(fmt.Errorf("not implemented: UpdateResultsDataBatchScript - updateResultsDataBatchScript"))
-}
-
-// ReadLobValue is the resolver for the readLobValue field.
-func (r *mutationResolver) ReadLobValue(ctx context.Context, connectionID string, contextID string, resultsID string, lobColumnIndex int, row []*model.SQLResultRow) (string, error) {
- panic(fmt.Errorf("not implemented: ReadLobValue - readLobValue"))
-}
-
-// AsyncSQLExecuteResults is the resolver for the asyncSqlExecuteResults field.
-func (r *mutationResolver) AsyncSQLExecuteResults(ctx context.Context, taskID string) (*model.SQLExecuteInfo, error) {
- panic(fmt.Errorf("not implemented: AsyncSQLExecuteResults - asyncSqlExecuteResults"))
-}
-
-// AsyncSQLExplainExecutionPlan is the resolver for the asyncSqlExplainExecutionPlan field.
-func (r *mutationResolver) AsyncSQLExplainExecutionPlan(ctx context.Context, connectionID string, contextID string, query string, configuration interface{}) (*model.AsyncTaskInfo, error) {
- panic(fmt.Errorf("not implemented: AsyncSQLExplainExecutionPlan - asyncSqlExplainExecutionPlan"))
-}
-
-// AsyncSQLExplainExecutionPlanResult is the resolver for the asyncSqlExplainExecutionPlanResult field.
-func (r *mutationResolver) AsyncSQLExplainExecutionPlanResult(ctx context.Context, taskID string) (*model.SQLExecutionPlan, error) {
- panic(fmt.Errorf("not implemented: AsyncSQLExplainExecutionPlanResult - asyncSqlExplainExecutionPlanResult"))
-}
-
-// SQLDialectInfo is the resolver for the sqlDialectInfo field.
-func (r *queryResolver) SQLDialectInfo(ctx context.Context, connectionID string) (*model.SQLDialectInfo, error) {
- panic(fmt.Errorf("not implemented: SQLDialectInfo - sqlDialectInfo"))
-}
-
-// SQLListContexts is the resolver for the sqlListContexts field.
-func (r *queryResolver) SQLListContexts(ctx context.Context, connectionID *string, contextID *string) ([]*model.SQLContextInfo, error) {
- panic(fmt.Errorf("not implemented: SQLListContexts - sqlListContexts"))
-}
-
-// SQLCompletionProposals is the resolver for the sqlCompletionProposals field.
-func (r *queryResolver) SQLCompletionProposals(ctx context.Context, connectionID string, contextID string, query string, position int, maxResults *int, simpleMode *bool) ([]*model.SQLCompletionProposal, error) {
- panic(fmt.Errorf("not implemented: SQLCompletionProposals - sqlCompletionProposals"))
-}
-
-// SQLFormatQuery is the resolver for the sqlFormatQuery field.
-func (r *queryResolver) SQLFormatQuery(ctx context.Context, connectionID string, contextID string, query string) (string, error) {
- panic(fmt.Errorf("not implemented: SQLFormatQuery - sqlFormatQuery"))
-}
-
-// SQLSupportedOperations is the resolver for the sqlSupportedOperations field.
-func (r *queryResolver) SQLSupportedOperations(ctx context.Context, connectionID string, contextID string, resultsID string, attributeIndex int) ([]*model.DataTypeLogicalOperation, error) {
- panic(fmt.Errorf("not implemented: SQLSupportedOperations - sqlSupportedOperations"))
-}
-
-// SQLEntityQueryGenerators is the resolver for the sqlEntityQueryGenerators field.
-func (r *queryResolver) SQLEntityQueryGenerators(ctx context.Context, nodePathList []string) ([]*model.SQLQueryGenerator, error) {
- panic(fmt.Errorf("not implemented: SQLEntityQueryGenerators - sqlEntityQueryGenerators"))
-}
-
-// SQLGenerateEntityQuery is the resolver for the sqlGenerateEntityQuery field.
-func (r *queryResolver) SQLGenerateEntityQuery(ctx context.Context, generatorID string, options interface{}, nodePathList []string) (string, error) {
- panic(fmt.Errorf("not implemented: SQLGenerateEntityQuery - sqlGenerateEntityQuery"))
-}
-
-// SQLParseScript is the resolver for the sqlParseScript field.
-func (r *queryResolver) SQLParseScript(ctx context.Context, connectionID string, script string) (*model.SQLScriptInfo, error) {
- panic(fmt.Errorf("not implemented: SQLParseScript - sqlParseScript"))
-}
-
-// SQLParseQuery is the resolver for the sqlParseQuery field.
-func (r *queryResolver) SQLParseQuery(ctx context.Context, connectionID string, script string, position int) (*model.SQLScriptQuery, error) {
- panic(fmt.Errorf("not implemented: SQLParseQuery - sqlParseQuery"))
-}
diff --git a/sqle/api/cloudbeaver_wrapper/graph/schema/schema.graphqls b/sqle/api/cloudbeaver_wrapper/graph/schema/schema.graphqls
deleted file mode 100644
index a3dee4ffa5..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/schema/schema.graphqls
+++ /dev/null
@@ -1,13 +0,0 @@
-# Any object (JSON)
-scalar Object
-# Date/Time
-scalar DateTime
-
-type Query
-
-type Mutation
-
-schema {
- query: Query
- mutation: Mutation
-}
diff --git a/sqle/api/cloudbeaver_wrapper/graph/schema/service.admin.graphqls b/sqle/api/cloudbeaver_wrapper/graph/schema/service.admin.graphqls
deleted file mode 100644
index db85a8cb99..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/schema/service.admin.graphqls
+++ /dev/null
@@ -1,181 +0,0 @@
-
-enum AdminSubjectType {
- user,
- role
-}
-
-type AdminConnectionGrantInfo {
- connectionId: ID! @deprecated(reason: "use dataSourceId instead")
- dataSourceId: ID!
- subjectId: ID!
- subjectType: AdminSubjectType!
-}
-
-type AdminConnectionSearchInfo {
- displayName: String!
- host: String!
- port: Int!
- possibleDrivers: [ID!]!
- defaultDriver: ID!
-}
-
-type AdminUserInfo {
- userId: ID!
-
- metaParameters: Object!
- configurationParameters: Object!
- grantedRoles: [ID!]!
- grantedConnections: [AdminConnectionGrantInfo!]!
-
- origins: [ObjectOrigin!]!
-
- linkedAuthProviders: [String!]!
- enabled: Boolean!
-}
-
-type AdminRoleInfo {
- roleId: ID!
- roleName: String
- description: String
-
- grantedUsers: [ID!]!
- grantedConnections: [AdminConnectionGrantInfo!]!
-
- rolePermissions: [ID!]!
-}
-
-type AdminPermissionInfo {
- id: ID!
- label: String
- description: String
-
- provider: String!
- category: String
-}
-
-type AdminAuthProviderConfiguration {
- providerId: ID!
- id: ID!
- displayName: String!
- disabled: Boolean!
-
- iconURL: String
- description: String
-
- parameters: Object!
-
- signInLink: String
- signOutLink: String
- redirectLink: String
- metadataLink: String
-}
-
-type WebFeatureSet {
- id: String!
- label: String!
- description: String
- icon: String
-
- enabled: Boolean!
-}
-
-input ServerConfigInput {
- serverName: String
- serverURL: String
-
- adminName: String
- adminPassword: String
-
- anonymousAccessEnabled: Boolean
- authenticationEnabled: Boolean
- customConnectionsEnabled: Boolean
- publicCredentialsSaveEnabled: Boolean
- adminCredentialsSaveEnabled: Boolean
- resourceManagerEnabled: Boolean
-
- enabledFeatures: [ID!]
- enabledAuthProviders: [ID!]
- disabledDrivers: [ID!]
-
- sessionExpireTime: Int
-}
-
-extend type Query {
-
- #### Users and roles
-
- listUsers(userId: ID): [AdminUserInfo!]!
- listRoles(roleId: ID): [AdminRoleInfo!]!
- listPermissions: [AdminPermissionInfo!]!
-
- createUser(userId: ID!): AdminUserInfo!
- deleteUser(userId: ID!): Boolean
-
- createRole(roleId: ID!, roleName: String, description: String): AdminRoleInfo!
- updateRole(roleId: ID!, roleName: String, description: String): AdminRoleInfo!
- deleteRole(roleId: ID!): Boolean
-
- grantUserRole(userId: ID!, roleId: ID!): Boolean
- revokeUserRole(userId: ID!, roleId: ID!): Boolean
-
- setSubjectPermissions(roleId: ID!, permissions: [ID!]!): [AdminPermissionInfo!]!
-
- setUserCredentials(userId: ID!, providerId: ID!, credentials: Object!): Boolean
-
- enableUser(userId: ID!, enabled: Boolean!): Boolean
-
- #### Connection management
-
- # All connection configurations
- allConnections( id: ID ): [ ConnectionInfo! ]!
-
- searchConnections( hostNames: [String!]! ): [AdminConnectionSearchInfo!]!
-
- createConnectionConfiguration( config: ConnectionConfig! ): ConnectionInfo!
- copyConnectionConfiguration( nodePath: String!, config: ConnectionConfig ): ConnectionInfo!
- updateConnectionConfiguration( id: ID!, config: ConnectionConfig! ): ConnectionInfo!
- deleteConnectionConfiguration( id: ID! ): Boolean
-
- # Permissions
-
- getConnectionSubjectAccess(connectionId: ID): [AdminConnectionGrantInfo!]!
- setConnectionSubjectAccess(connectionId: ID!, subjects: [ID!]!): Boolean
-
- getSubjectConnectionAccess(subjectId: ID): [AdminConnectionGrantInfo!]!
- setSubjectConnectionAccess(subjectId: ID!, connections: [ID!]!): Boolean
-
- #### Feature sets
-
- listFeatureSets: [WebFeatureSet!]!
-
- #### Auth providers and configurations
-
- listAuthProviderConfigurationParameters(providerId: ID!): [ObjectPropertyInfo!]!
- listAuthProviderConfigurations(providerId: ID): [AdminAuthProviderConfiguration!]!
-
- saveAuthProviderConfiguration(
- providerId: ID!,
- id: ID!,
- displayName: String,
- disabled: Boolean,
- iconURL: String
- description: String
- parameters: Object): AdminAuthProviderConfiguration!
- deleteAuthProviderConfiguration(id: ID!): Boolean!
-
- #### User profile
-
- saveUserMetaParameter(id: ID!, displayName: String!, description: String, required: Boolean!): ObjectPropertyInfo!
-
- deleteUserMetaParameter(id: ID!): Boolean!
-
- setUserMetaParameterValues(userId: ID!, parameters: Object!): Boolean!
-
- #### Global configuration
-
- configureServer(configuration: ServerConfigInput!): Boolean!
-
- # Changes default navigator settings
- setDefaultNavigatorSettings( settings: NavigatorSettingsInput!): Boolean!
-
-}
diff --git a/sqle/api/cloudbeaver_wrapper/graph/schema/service.auth.graphqls b/sqle/api/cloudbeaver_wrapper/graph/schema/service.auth.graphqls
deleted file mode 100644
index e251c227f6..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/schema/service.auth.graphqls
+++ /dev/null
@@ -1,153 +0,0 @@
-enum AuthCredentialEncryption {
- none,
- plain,
- hash
-}
-
-enum AuthStatus {
- SUCCESS,
- IN_PROGRESS,
- ERROR
-}
-
-type AuthCredentialInfo {
- id: ID!
- displayName: String!
- description: String
-
- # This field must be shown in admin panel
- admin: Boolean!
- # This field must be shown in login form
- user: Boolean!
- # This field can be used as user identifier
-
- identifying: Boolean!
- possibleValues: [String]
- encryption: AuthCredentialEncryption
-}
-
-type AuthProviderConfiguration {
- id: ID!
- displayName: String!
- disabled: Boolean!
-
- iconURL: String
- description: String
-
- # URL to external authentication service.
- # If specified then it is external auhentication provider (SSO).
- # Otherwise authLogin function must be called.
- signInLink: String
- signOutLink: String
- metadataLink: String
-}
-
-type AuthProviderCredentialsProfile {
- id: String
- label: String
- description: String
- credentialParameters: [AuthCredentialInfo!]!
-}
-
-type AuthProviderInfo {
- id: ID!
- label: String!
- icon: ID
- description: String
-
- defaultProvider: Boolean!
-
- # Configurable providers must be configured first. See configurations field.
- configurable: Boolean!
-
- # Provider configurations (applicable only if configurable=true)
- configurations: [AuthProviderConfiguration!]
-
- credentialProfiles: [AuthProviderCredentialsProfile!]!
-
- requiredFeatures: [String!]!
-}
-
-type AuthInfo {
- redirectLink: String
-
- authId: String
-
- authStatus: AuthStatus!
-
- userTokens: [UserAuthToken!]
-}
-
-type UserAuthToken {
- # Auth provider used for authorization
- authProvider: ID!
-
- # Auth provider configuration ID
- authConfiguration: ID
-
- # Authorization time
- loginTime: DateTime!
-
- # User identity (aka user name) specific to auth provider
- userId: String!
-
- # User display name specific to auth provider
- displayName: String!
-
- # Optional login message
- message: String
-
- # Auth origin
- origin: ObjectOrigin!
-
-}
-
-type UserInfo {
- # User unique identifier
- userId: ID!
-
- # Human readable display name. It is taken from the first auth provider which was used for user login.
- displayName: String
- # User auth role ID. Optional.
- authRole: ID
-
- # All authentication tokens used during current session
- authTokens: [UserAuthToken!]!
-
- linkedAuthProviders: [String!]!
-
- # User profile properties map
- metaParameters: Object!
- # User configuration parameters
- configurationParameters: Object!
-
-}
-
-
-extend type Query {
-
- # Authorize user using specified auth provider. If linkUser=true then associates new
- authLogin(provider: ID!, configuration: ID, credentials: Object, linkUser: Boolean): AuthInfo!
-
- authUpdateStatus(authId: ID!, linkUser: Boolean): AuthInfo!
-
- # Logouts user. If provider not specified then all authorizations are revoked from session.
- authLogout(provider: ID, configuration: ID): Boolean
-
- # Active user information. null is no user was authorized within session
- activeUser: UserInfo
-
- authProviders: [AuthProviderInfo!]!
-
- authChangeLocalPassword(oldPassword: String!, newPassword: String!): Boolean!
-
- listUserProfileProperties: [ObjectPropertyInfo!]!
-
-}
-
-extend type Mutation {
-
- # Set user config parameter. If parameter value is null then removes the parameter
- setUserConfigurationParameter(name: String!, value: Object): Boolean!
-
-}
diff --git a/sqle/api/cloudbeaver_wrapper/graph/schema/service.core.graphqls b/sqle/api/cloudbeaver_wrapper/graph/schema/service.core.graphqls
deleted file mode 100644
index 1894c49a2e..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/schema/service.core.graphqls
+++ /dev/null
@@ -1,540 +0,0 @@
-
-####################################################
-# General stuff
-####################################################
-
-# Property
-
-type ObjectPropertyInfo {
- # ID
- id: String
- # Human readable name
- displayName: String
- # Property description
- description: String
- # Property category (may be used if object has a lot of properties)
- category: String
- # Property data type (int, String, etc)
- dataType: String
-
- # Property value. Note: for some properties value reading may take a lot of time (e.g. RowCount for tables)
- value: Object
-
- # List of values this property can take. Makes sense only for enumerable properties
- validValues: [ Object ]
- # Default property value
- defaultValue: Object
-
- # Property value length
- length: ObjectPropertyLength!
-
- # Supported features (system, hidden, inherited, foreign, expensive, etc)
- features: [ String! ]!
- # Order position
- order: Int!
-}
-
-enum ObjectPropertyLength {
- # 1 character
- TINY,
- # 20 characters
- SHORT,
- # <= 64 characters
- MEDIUM,
- # Full line length. The default
- LONG,
- # Multi-line long text
- MULTILINE
-}
-
-# Async types
-
-type AsyncTaskInfo {
- id: String!
- name: String
- running: Boolean!
-
- status: String
- error: ServerError
-
- result: SQLExecuteInfo @deprecated # Deprecated. Use asyncSqlExecuteResults instead
- # Task result.
- # Can be some kind of identifier to obtain real result using another API function
- taskResult: Object
-}
-
-# Various server errors descriptor
-
-type ServerError {
- message: String
- errorCode: String
- errorType: String
- stackTrace: String
- causedBy: ServerError
-}
-
-type ServerMessage {
- time: String
- message: String
-}
-
-# Languages supported by server
-
-type ServerLanguage {
- isoCode: String!
- displayName: String
- nativeName: String
-}
-
-type WebServiceConfig {
- id: String!
- name: String!
- description: String!
- bundleVersion: String!
-}
-
-type ProductInfo {
- id: ID!
- version: String!
- name: String!
- description: String
- buildTime: String!
- releaseTime: String!
- licenseInfo: String
-
- latestVersionInfo: String
-}
-
-type ServerConfig {
- name: String!
- version: String!
- workspaceId: ID!
-
- serverURL: String!
-
- rootURI: String!
-
- hostName: String!
-
- anonymousAccessEnabled: Boolean
- authenticationEnabled: Boolean @deprecated
- supportsCustomConnections: Boolean
- supportsConnectionBrowser: Boolean
- supportsWorkspaces: Boolean
- resourceManagerEnabled: Boolean
-
- publicCredentialsSaveEnabled: Boolean
- adminCredentialsSaveEnabled: Boolean
-
- licenseRequired: Boolean!
- licenseValid: Boolean!
-
- sessionExpireTime: Int
- localHostAddress: String
-
- configurationMode: Boolean
- developmentMode: Boolean
- redirectOnFederatedAuth: Boolean
-
- enabledFeatures: [ID!]!
- enabledAuthProviders: [ID!]!
- supportedLanguages: [ ServerLanguage! ]!
- services: [ WebServiceConfig ]
- productConfiguration: Object!
- productInfo: ProductInfo!
- defaultNavigatorSettings: NavigatorSettings!
- disabledDrivers: [ID!]!
- resourceQuotas: Object!
-}
-
-type SessionInfo {
- createTime: String!
- lastAccessTime: String!
- locale: String!
-
- cacheExpired: Boolean!
-
- serverMessages: [ ServerMessage ]
- connections: [ ConnectionInfo! ]!
- actionParameters: Object
-}
-
-####################################################
-# Drivers and connections
-####################################################
-
-type DatabaseAuthModel {
- id: ID!
- displayName: String!
- description: String
- icon: String
- # checks if the auth model needs a configuration on a local file system
- requiresLocalConfiguration: Boolean
-
- properties: [ObjectPropertyInfo!]!
-}
-
-type DriverInfo {
- id: ID!
- name: String
- description: String
- icon: String
- iconBig: String
-
- # Driver provider ID
- providerId: ID
- # Driver Java class name
- driverClassName: String
- defaultHost: String
- defaultPort: String
- defaultDatabase: String
- defaultServer: String
- defaultUser: String
- sampleURL: String
- driverInfoURL: String
- driverPropertiesURL: String
- embedded: Boolean
- enabled: Boolean!
- requiresServerName: Boolean
-
- # this fields must be removed and be replaced by DriverAuthModel
- allowsEmptyPassword: Boolean @deprecated
-
- licenseRequired: Boolean
- license: String
- custom: Boolean
- # Driver score for ordering, biggest first
- promotedScore: Int
-
- # Never used?
- #connectionProperties: Object
- #defaultConnectionProperties: Object
-
- # Driver properties.
- # Note: it is expensive property and it may produce database server roundtrips.
- # Call it only when you really need it.
- # These properties are for advanced users in usually shouldn't be specified for new connections.
- driverProperties: [ObjectPropertyInfo!]!
- # Driver parameters (map name->value)
- driverParameters: Object!
-
- # Additional driver provider properties
- # These properties can be configured by user on main connection page
- # to provide important connection settings
- providerProperties: [ObjectPropertyInfo!]!
-
- # False for drivers which do not support authentication
- anonymousAccess: Boolean
-
- defaultAuthModel: ID!
- applicableAuthModels: [ID!]!
-
- applicableNetworkHandlers: [ID]!
-}
-
-enum ResultDataFormat {
- resultset,
- document,
- graph,
- timeseries
-}
-
-## Network handler config
-
-enum NetworkHandlerType {
- TUNNEL,
- PROXY,
- CONFIG
-}
-
-enum NetworkHandlerAuthType {
- PASSWORD,
- PUBLIC_KEY,
- AGENT
-}
-
-type NetworkHandlerDescriptor {
- id: ID!
- codeName: String!
- label: String!
- description: String
- secured: Boolean!
- type: NetworkHandlerType
- properties: [ObjectPropertyInfo!]!
-}
-
-type NetworkHandlerConfig {
- id: ID!
- enabled: Boolean!
- authType: NetworkHandlerAuthType!
- userName: String
- password: String
- key: String
- savePassword: Boolean!
- properties: Object!
-}
-
-# Connection instance
-type ConnectionInfo {
- id: ID!
- driverId: ID!
-
- name: String!
- description: String
-
- host: String
- port: String
- serverName: String
- databaseName: String
- url: String
-
- properties: Object
-
- template: Boolean!
- connected: Boolean!
- provided: Boolean!
- readOnly: Boolean!
- useUrl: Boolean!
- saveCredentials: Boolean!
-
- folder: ID
- nodePath: String
-
- connectTime: String
- connectionError: ServerError
- serverVersion: String
- clientVersion: String
-
- origin: ObjectOrigin!
-
- authNeeded: Boolean!
- authModel: ID
- authProperties: [ObjectPropertyInfo!]!
-
- providerProperties: Object!
- networkHandlersConfig: [NetworkHandlerConfig!]!
-
- # Supported features (provided etc)
- features: [ String! ]!
- navigatorSettings: NavigatorSettings!
- supportedDataFormats: [ ResultDataFormat! ]!
-}
-
-type ConnectionFolderInfo {
- id: ID!
- description: String
-}
-
-type NetworkEndpointInfo {
- message: String
- clientVersion: String
- serverVersion: String
-}
-
-type ObjectOrigin {
- type: ID!
- subType: ID
- displayName: String!
- icon: String
- configuration: Object
- details: [ObjectPropertyInfo!]
-}
-
-type NavigatorSettings {
- showSystemObjects: Boolean!
- showUtilityObjects: Boolean!
- showOnlyEntities: Boolean!
- mergeEntities: Boolean!
- hideFolders: Boolean!
- hideSchemas: Boolean!
- hideVirtualModel: Boolean!
-}
-
-type LogEntry {
- time: DateTime
- type: String!
- message: String
- stackTrace: String
-}
-
-####################################################
-# Input types
-####################################################
-
-input NavigatorSettingsInput {
- showSystemObjects: Boolean!
- showUtilityObjects: Boolean!
- showOnlyEntities: Boolean!
- mergeEntities: Boolean!
- hideFolders: Boolean!
- hideSchemas: Boolean!
- hideVirtualModel: Boolean!
-}
-
-input NetworkHandlerConfigInput {
- id: ID!
- enabled: Boolean
- authType: NetworkHandlerAuthType
- userName: String
- password: String
- key: String
- savePassword: Boolean
- properties: Object
-}
-
-# Configuration of particular connection. Used for new connection create. Includes auth info
-input ConnectionConfig {
- # used only for testing created connection
- connectionId: String
- name: String
- description: String
-
- # ID of template connection
- templateId: ID
- # ID of database driver
- driverId: ID
-
- # Custom connection parameters (all optional)
-
- host: String
- port: String
- serverName: String
- databaseName: String
- # Connection url jdbc:{driver}://{host}[:{port}]/[{database}]
- url: String
- # Properties
- properties: Object
-
- # Template connection
- template: Boolean
- # Read-onyl connection
- readOnly: Boolean
-
- # User credentials
-
- saveCredentials: Boolean
- authModelId: ID
- credentials: Object
-
- # Map of provider properties (name/value)
-
- providerProperties: Object
-
- # Network handlers. Map of id->property map (name/value).
-
- networkHandlersConfig: [NetworkHandlerConfigInput!]
-
- #### deprecated fields
-
- # ID of predefined datasource
- dataSourceId: ID #@deprecated
-
- # Direct user credentials
- userName: String #@deprecated
- userPassword: String #@deprecated
-
- # Folder
- folder: ID
-}
-
-####################################################
-# Main API
-####################################################
-
-extend type Query {
- # Returns server config
- serverConfig: ServerConfig!
-
- # Returns session state ( initialize if not )
- sessionState: SessionInfo!
-
- # Session permissions
- sessionPermissions: [ID]!
-
- # Get driver info
- driverList( id: ID ): [ DriverInfo! ]!
- authModels: [DatabaseAuthModel!]!
- networkHandlers: [NetworkHandlerDescriptor!]!
-
- # List of user connections.
- userConnections( id: ID ): [ ConnectionInfo! ]!
- # List of template connections.
- templateConnections: [ ConnectionInfo! ]!
-
- # List of connection folders
- connectionFolders( path: ID ): [ ConnectionFolderInfo! ]!
-
- # Return connection state
- connectionState( id: ID! ): ConnectionInfo! @deprecated
-
- # Return connection info
- connectionInfo( id: ID! ): ConnectionInfo!
-
- readSessionLog(maxEntries: Int, clearEntries: Boolean): [ LogEntry! ]!
-}
-
-extend type Mutation {
- # Initialize session
- openSession(defaultLocale: String): SessionInfo!
-
- # Destroy session
- closeSession: Boolean
-
- # Refreshes session on server and returns its state
- touchSession: Boolean
-
- # Refresh session connection list
- refreshSessionConnections: Boolean
-
- # Refreshes session on server and returns its state
- changeSessionLanguage(locale: String): Boolean
-
- # Create new custom connection. Custom connections exist only within the current session.
- createConnection( config: ConnectionConfig! ): ConnectionInfo!
-
- updateConnection( config: ConnectionConfig! ): ConnectionInfo!
-
- deleteConnection( id: ID! ): Boolean!
-
- createConnectionFromTemplate( templateId: ID!, connectionName: String ): ConnectionInfo!
-
- # Create new folder
- createConnectionFolder(parentFolderPath: ID, folderName: String! ): ConnectionFolderInfo!
-
- deleteConnectionFolder( folderPath: ID! ): Boolean!
-
- # Copies connection configuration from node
- copyConnectionFromNode( nodePath: String!, config: ConnectionConfig ): ConnectionInfo!
-
- # Test connection configuration. Returns remote server version
- testConnection( config: ConnectionConfig! ): ConnectionInfo!
-
- # Test connection configuration. Returns remote server version
- testNetworkHandler( config: NetworkHandlerConfigInput! ): NetworkEndpointInfo!
-
- # Initiate existing connection
- initConnection( id: ID!, credentials: Object, networkCredentials: [NetworkHandlerConfigInput!], saveCredentials: Boolean ): ConnectionInfo!
-
- # Disconnect from database
- closeConnection( id: ID! ): ConnectionInfo!
-
- # Changes navigator settings for connection
- setConnectionNavigatorSettings( id: ID!, settings: NavigatorSettingsInput!): ConnectionInfo!
-
- #### Generic async functions
-
- asyncTaskCancel(id: String!): Boolean
-
- asyncTaskInfo(id: String!, removeOnFinish: Boolean!): AsyncTaskInfo!
-
-
- #### Deprecated API
-
- # Create connection from template. Use createConnection instead
- openConnection( config: ConnectionConfig! ): ConnectionInfo! @deprecated
-
- # Use asyncTaskInfo instead
- asyncTaskStatus(id: String!): AsyncTaskInfo! @deprecated
-
-}
-
diff --git a/sqle/api/cloudbeaver_wrapper/graph/schema/service.data.transfer.graphqls b/sqle/api/cloudbeaver_wrapper/graph/schema/service.data.transfer.graphqls
deleted file mode 100644
index bdf22420d2..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/schema/service.data.transfer.graphqls
+++ /dev/null
@@ -1,49 +0,0 @@
-# Data transfer queries
-
-type DataTransferProcessorInfo {
- id: ID!
- name: String
- description: String
- fileExtension: String
- appFileExtension: String
- appName: String
- order: Int!
- icon: String
- properties: [ ObjectPropertyInfo ]
- isBinary: Boolean
- isHTML: Boolean
-}
-
-input DataTransferParameters {
- # Processor ID
- processorId: ID!
- # General settings:
- # - openNewConnection: opens new database connection for data transfer task
- settings: Object
- # Processor properties. See DataTransferProcessorInfo.properties
- processorProperties: Object!
- # Data filter settings
- filter: SQLDataFilter
-}
-
-extend type Query {
-
- # Available transfer processors
- dataTransferAvailableStreamProcessors: [ DataTransferProcessorInfo! ]!
-
- dataTransferExportDataFromContainer(
- connectionId: ID!,
- containerNodePath: ID!,
- parameters: DataTransferParameters!
- ): AsyncTaskInfo!
-
- dataTransferExportDataFromResults(
- connectionId: ID!,
- contextId: ID!,
- resultsId: ID!,
- parameters: DataTransferParameters!
- ): AsyncTaskInfo!
-
- dataTransferRemoveDataFile(dataFileId: String!): Boolean
-
-}
diff --git a/sqle/api/cloudbeaver_wrapper/graph/schema/service.metadata.graphqls b/sqle/api/cloudbeaver_wrapper/graph/schema/service.metadata.graphqls
deleted file mode 100644
index 0fde710b52..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/schema/service.metadata.graphqls
+++ /dev/null
@@ -1,8 +0,0 @@
-# Metadata queries
-
-extend type Query {
-
- # Get child nodes
- metadataGetNodeDDL(nodeId: ID!, options: Object): String
-
-}
diff --git a/sqle/api/cloudbeaver_wrapper/graph/schema/service.navigator.graphqls b/sqle/api/cloudbeaver_wrapper/graph/schema/service.navigator.graphqls
deleted file mode 100644
index 7ce82d2639..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/schema/service.navigator.graphqls
+++ /dev/null
@@ -1,136 +0,0 @@
-# Nodes, objects and properties
-
-type ObjectDescriptor {
- id: Int
- displayName: String
- fullName: String
- uniqueName: String
- description: String
- value: String
-}
-
-input ObjectPropertyFilter {
- ids: [String!]
- features: [String!]
- categories: [String!]
- dataTypes: [String!]
-}
-
-type ObjectDetails {
- id: Int
- displayName: String
- description: String
- value: Object
-}
-
-type DatabaseObjectInfo {
- # Object name
- name: String
- # Description - optional
- description: String
- # Object type. Java class name in most cases
- type: String
-
- # Read object properties.
- # Optional parameter 'ids' filters properties by id. null means all properties.
- # Note: property value reading may take a lot of time so don't read all property values always
- # Examine property meta (features in particular) before reading them
- properties(filter: ObjectPropertyFilter): [ ObjectPropertyInfo ]
-
- # Optional properties
-
- ordinalPosition: Int
- fullyQualifiedName: String
- overloadedName: String
- uniqueName: String
- state: String
-
- # Features: script, scriptExtended, dataContainer, dataManipulator,
- # entity, schema, catalog
- features: [ String! ]
-
- # Supported editors: ddl, permissions, sourceDeclaration, sourceDefinition
- editors: [ String! ]
-}
-
-type NavigatorNodeInfo {
- # Node ID - generally a full path to the node from root of tree
- id: ID!
- # Node human readable name
- name: String
- #Node full name
- fullName: String
- # Node icon path
- icon: String
- # Node description
- description: String
- # Node type
- nodeType: String
- # Can this property have child nodes?
- hasChildren: Boolean
-
- # Associated object. Maybe null for non-database objects
- object: DatabaseObjectInfo
-
- # Supported features: item, container, leaf
- # canDelete, canRename
- features: [ String! ]
-
- # Object detailed info.
- # If is different than properties. It doesn't perform any expensive operation and doesn't require authentication.
- nodeDetails: [ ObjectPropertyInfo! ]
-
- folder: Boolean
- inline: Boolean
- navigable: Boolean
-}
-
-type DatabaseCatalog {
- catalog: NavigatorNodeInfo!
- schemaList: [ NavigatorNodeInfo! ]!
-}
-
-type DatabaseStructContainers {
- catalogList: [ DatabaseCatalog! ]!
- schemaList: [ NavigatorNodeInfo! ]!
- supportsCatalogChange: Boolean!
- supportsSchemaChange: Boolean!
-}
-
-####################################################
-# Main API
-####################################################
-
-extend type Query {
-
- # Get child nodes
- navNodeChildren(
- parentPath: ID!,
- offset: Int,
- limit: Int,
- onlyFolders: Boolean): [ NavigatorNodeInfo! ]!
-
- # Get child nodes
- navNodeParents(nodePath: ID!): [ NavigatorNodeInfo! ]!
-
- navNodeInfo( nodePath: ID! ): NavigatorNodeInfo!
-
- navRefreshNode( nodePath: ID! ): Boolean
-
- # contextId currently not using
- navGetStructContainers( connectionId: ID!, contextId: ID, catalog: ID ): DatabaseStructContainers!
-
-}
-
-extend type Mutation {
-
- # Rename node and returns new node name
- navRenameNode( nodePath: ID!, newName: String! ): String
-
- # Deletes nodes with specified IDs and returns number of deleted nodes
- navDeleteNodes( nodePaths: [ID!]! ): Int
-
- # Moves nodes with specified IDs to the connection folder
- navMoveNodesToFolder(nodePaths: [ID!]!, folderPath: ID!): Boolean
-
-}
\ No newline at end of file
diff --git a/sqle/api/cloudbeaver_wrapper/graph/schema/service.rm.graphqls b/sqle/api/cloudbeaver_wrapper/graph/schema/service.rm.graphqls
deleted file mode 100644
index d74b840273..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/schema/service.rm.graphqls
+++ /dev/null
@@ -1,60 +0,0 @@
-# Metadata queries
-
-type RMProject {
- id: String!
- name: String!
- description: String
- shared: Boolean!
-
- createTime: DateTime!
- creator: String!
-}
-
-type RMResource {
- name: String!
- folder: Boolean!
- length: Int!
-}
-
-extend type Query {
-
- # List accessible projects
- rmListProjects: [RMProject!]!
-
- # List accessible projects
- rmListResources(
- projectId: String!,
- folder: String,
- nameMask: String,
- readProperties: Boolean,
- readHistory: Boolean): [RMResource!]!
-
- # Reads resource contents as string in UTF-8
- rmReadResourceAsString(
- projectId: String!,
- resourcePath: String!): String!
-
-}
-
-extend type Mutation {
-
- rmCreateResource(
- projectId: String!,
- resourcePath: String!,
- isFolder: Boolean!): String!
-
- rmMoveResource(
- projectId: String!,
- oldResourcePath: String!,
- newResourcePath: String): String!
-
- rmDeleteResource(
- projectId: String!,
- resourcePath: String!,
- recursive: Boolean!): Boolean
-
- rmWriteResourceStringContent(
- projectId: String!,
- resourcePath: String!,
- data: String!): String!
-}
\ No newline at end of file
diff --git a/sqle/api/cloudbeaver_wrapper/graph/schema/service.sql.graphqls b/sqle/api/cloudbeaver_wrapper/graph/schema/service.sql.graphqls
deleted file mode 100644
index 7dfb4ea543..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/schema/service.sql.graphqls
+++ /dev/null
@@ -1,334 +0,0 @@
-####################################################
-# SQL helpers
-####################################################
-
-type SQLDialectInfo {
- name: String!
-
- dataTypes: [ String ]!
- functions: [ String ]!
- reservedWords: [ String ]!
- quoteStrings: [ [ String ] ]!
- singleLineComments: [ String ]!
- multiLineComments: [ [ String ] ]!
-
- catalogSeparator: String
- structSeparator: String
- scriptDelimiter: String
-
- supportsExplainExecutionPlan: Boolean!
-
-}
-
-type SQLCompletionProposal {
- displayString: String!
- type: String!
- score: Int
-
- replacementString: String!
- replacementOffset: Int!
- replacementLength: Int!
- cursorPosition: Int
-
- icon: String
- nodePath: String
-}
-
-####################################################
-# Data read / SQL execution
-####################################################
-
-# SQL context must be created for each SQL editor
-type SQLContextInfo {
-
- id: ID!
- connectionId: ID!
- defaultCatalog: String
- defaultSchema: String
-
-}
-
-input SQLDataFilterConstraint {
- attributePosition: Int!
- orderPosition: Int
- orderAsc: Boolean
-
- criteria: String
- operator: String
- value: Object
-}
-
-input SQLDataFilter {
- # Row offset. We use Float because offset may be bigger than 32 bit.
- offset: Float
- limit: Int
-
- constraints: [ SQLDataFilterConstraint ]
- where: String
- orderBy: String
-}
-
-type SQLResultColumn {
- position: Int!
- name: String
- label: String
- icon: String
- entityName: String
-
- dataKind: String
- typeName: String
- fullTypeName: String
- # Column value max length. We use Float because it may be bigger than 32 bit.
- maxLength: Float
- scale: Int
- precision: Int
-
- required: Boolean!
-
- readOnly: Boolean!
- readOnlyStatus: String
-
- # Operations supported for this attribute
- supportedOperations: [DataTypeLogicalOperation!]!
-}
-
-type DatabaseDocument {
- id: String
- contentType: String
- properties: Object
- data: Object
-}
-
-type SQLResultSet {
- id: ID!
- columns: [ SQLResultColumn ]
- rows: [ [ Object ] ]
-
- # True means that resultset was generated by single entity query
- # New rows can be added, old rows can be deleted
- singleEntity: Boolean!
- # server always returns hasMoreData = false
- hasMoreData: Boolean!
- # can't update data or load LOB file if hasRowIdentifier = false
- hasRowIdentifier: Boolean!
-}
-
-type SQLQueryResults {
- title: String
- updateRowCount: Float
- sourceQuery: String
-
- # Actual data format of this result
- dataFormat: ResultDataFormat
-
- resultSet: SQLResultSet
-}
-
-type SQLExecuteInfo {
-
- # Status message
- statusMessage: String
- # Execute time (ms)
- duration: Int!
- # Actual conditions applied to query
- filterText: String
- # Results
- results: [ SQLQueryResults! ]!
-}
-
-input SQLResultRow {
- data: [ Object ]!
- updateValues: Object
-}
-
-type DataTypeLogicalOperation {
- id: ID!
- expression: String!
- argumentCount: Int
-}
-
-####################################################
-# SQL Execution plan
-####################################################
-
-type SQLExecutionPlan {
- query: String!
- nodes: [SQLExecutionPlanNode!]!
-}
-
-type SQLExecutionPlanNode {
- id: ID!
- parentId: ID
-
- kind: String!
- name: String
- type: String!
- condition: String
- description: String
- properties: [ObjectPropertyInfo!]!
-}
-
-####################################################
-# SQL Generation
-####################################################
-
-type SQLQueryGenerator {
- id: String!
- label: String!
- description: String
- order: Int!
- multiObject: Boolean!
-}
-
-####################################################
-# SQL Query info
-####################################################
-type SQLScriptInfo {
- queries: [ SQLScriptQuery! ]!
-}
-
-type SQLScriptQuery {
- start: Int!
- end: Int!
-}
-####################################################
-# Query and Mutation
-####################################################
-
-extend type Query {
-
- sqlDialectInfo( connectionId: ID! ): SQLDialectInfo
-
- # Lists SQL contexts for a connection (optional) or returns the particular context info
- sqlListContexts( connectionId: ID, contextId: ID ): [ SQLContextInfo ]!
-
- sqlCompletionProposals(
- connectionId: ID!,
- contextId: ID!,
- query: String!,
- position: Int!,
- maxResults: Int,
- simpleMode: Boolean
- ): [ SQLCompletionProposal ]
-
- sqlFormatQuery(
- connectionId: ID!,
- contextId: ID!,
- query: String!
- ): String!
-
- sqlSupportedOperations(
- connectionId: ID!,
- contextId: ID!,
- resultsId: ID!,
- attributeIndex: Int!
- ): [DataTypeLogicalOperation!]!
-
- # List of all available entity query generators
- sqlEntityQueryGenerators(nodePathList: [String!]!
- ): [SQLQueryGenerator!]!
-
- # Options:
- # fullyQualifiedNames: Boolean
- # compactSQL: Boolean
- # showComments: Boolean
- # showPermissions: Boolean
- # showFullDdl: Boolean
- # excludeAutoGeneratedColumn: Boolean
- # useCustomDataFormat: Boolean
- sqlGenerateEntityQuery(
- generatorId: String!,
- options: Object!,
- nodePathList: [String!]!
- ): String!
-
- sqlParseScript(
- connectionId: ID!,
- script: String!
- ): SQLScriptInfo!
-
- sqlParseQuery(
- connectionId: ID!,
- script: String!,
- position: Int!
- ): SQLScriptQuery!
-}
-
-extend type Mutation {
- sqlContextCreate( connectionId: ID!, defaultCatalog: String, defaultSchema: String ): SQLContextInfo!
-
- sqlContextSetDefaults( connectionId: ID!, contextId: ID!, defaultCatalog: ID, defaultSchema: ID ): Boolean!
-
- sqlContextDestroy( connectionId: ID!, contextId: ID! ): Boolean!
-
- # Execute SQL and return results
- asyncSqlExecuteQuery(
- projectId: ID,
- connectionId: ID!,
- contextId: ID!,
- sql: String!,
- resultId: ID,
- filter: SQLDataFilter,
- dataFormat: ResultDataFormat, # requested data format. May be ignored by server
- readLogs: Boolean # added 23.2.1
- ): AsyncTaskInfo!
-
- # Read data from table
- asyncReadDataFromContainer(
- connectionId: ID!,
- contextId: ID!,
- containerNodePath: ID!,
- resultId: ID,
- filter: SQLDataFilter,
- dataFormat: ResultDataFormat
- ): AsyncTaskInfo!
-
- # Close results (free resources)
- sqlResultClose(connectionId: ID!, contextId: ID!, resultId: ID!): Boolean!
-
- # Update multiple cell values
- updateResultsDataBatch(
- connectionId: ID!,
- contextId: ID!,
- resultsId: ID!,
-
- updatedRows: [ SQLResultRow! ],
- deletedRows: [ SQLResultRow! ],
- addedRows: [ SQLResultRow! ],
- ): SQLExecuteInfo!
-
- # Return SQL script for cell values update
- updateResultsDataBatchScript(
- connectionId: ID!,
- contextId: ID!,
- resultsId: ID!,
-
- updatedRows: [ SQLResultRow! ],
- deletedRows: [ SQLResultRow! ],
- addedRows: [ SQLResultRow! ],
- ): String!
-
- #Return BLOB name
- readLobValue(
- connectionId: ID!,
- contextId: ID!,
- resultsId: ID!,
- lobColumnIndex: Int!,
- row: [ SQLResultRow! ]!
- ): String!
-
- # Returns SQLExecuteInfo
- asyncSqlExecuteResults(taskId: ID!): SQLExecuteInfo !
-
- # Read data from table
- asyncSqlExplainExecutionPlan(
- connectionId: ID!,
- contextId: ID!,
- query: String!,
- configuration: Object!
- ): AsyncTaskInfo!
-
- # Returns SQLExecutionPlan
- asyncSqlExplainExecutionPlanResult(taskId: ID!): SQLExecutionPlan !
-
-}
diff --git a/sqle/api/cloudbeaver_wrapper/graph/tools.go b/sqle/api/cloudbeaver_wrapper/graph/tools.go
deleted file mode 100644
index d28155f881..0000000000
--- a/sqle/api/cloudbeaver_wrapper/graph/tools.go
+++ /dev/null
@@ -1,27 +0,0 @@
-//go:build tools
-// +build tools
-
-package main
-
-import (
- "fmt"
- "os"
-
- "github.com/99designs/gqlgen/api"
- "github.com/99designs/gqlgen/codegen/config"
- _ "github.com/99designs/gqlgen/graphql/introspection"
-)
-
-func main() {
- cfg, err := config.LoadConfigFromDefaultLocations()
- if err != nil {
- fmt.Fprintln(os.Stderr, "failed to load config", err.Error())
- os.Exit(2)
- }
-
- err = api.Generate(cfg)
- if err != nil {
- fmt.Fprintln(os.Stderr, err.Error())
- os.Exit(3)
- }
-}
diff --git a/sqle/api/cloudbeaver_wrapper/service/audit.go b/sqle/api/cloudbeaver_wrapper/service/audit.go
deleted file mode 100644
index a3f42d4c3d..0000000000
--- a/sqle/api/cloudbeaver_wrapper/service/audit.go
+++ /dev/null
@@ -1,83 +0,0 @@
-package service
-
-import (
- "fmt"
- "strings"
-
- driverV2 "github.com/actiontech/sqle/sqle/driver/v2"
- "github.com/actiontech/sqle/sqle/log"
- sqleModel "github.com/actiontech/sqle/sqle/model"
- "github.com/actiontech/sqle/sqle/server"
-)
-
-type AuditResult struct {
- Result string
- LimitLevel string
- AuditLevel string
-}
-
-func AuditSQL(sql string, connectionID string) (auditSuccess bool, result *AuditResult, err error) {
- if sql == "" || connectionID == "" {
- return true, nil, nil
- }
-
- // 获取SQLE实例
- s := sqleModel.GetStorage()
- cache, err := s.GetCloudBeaverInstanceCacheByCBInstIDs([]string{connectionID})
- if err != nil {
- return false, nil, err
- }
-
- // 找不到这个实例的缓存表示这个实例不在SQLE管理范围内
- if len(cache) == 0 {
- return true, nil, nil
- }
-
- // 找不到sqle实例可能是实例被删除后没更新的脏数据
- inst, exist, err := s.GetInstanceById(fmt.Sprintf("%v", cache[0].SQLEInstanceID))
- if err != nil || !exist {
- return false, nil, err
- }
-
- // 不用审核的实例跳过审核
- if !inst.SqlQueryConfig.AuditEnabled {
- return true, nil, nil
- }
-
- ruleTemplate, exist, err := s.GetRuleTemplatesByInstanceNameAndProjectId(inst.Name, inst.ProjectId)
- if err != nil {
- return false, nil, err
- }
- ruleTemplateName := ""
- var projectId uint
- if exist {
- ruleTemplateName = ruleTemplate.Name
- projectId = ruleTemplate.ProjectId
- }
-
- task, err := server.AuditSQLByDBType(log.NewEntry(), sql, inst.DbType, &projectId, ruleTemplateName)
- if err != nil {
- return false, nil, err
- }
-
- if driverV2.RuleLevel(task.AuditLevel).More(driverV2.RuleLevel(inst.SqlQueryConfig.AllowQueryWhenLessThanAuditLevel)) {
- return false, &AuditResult{
- Result: generateAuditResult(task),
- LimitLevel: inst.SqlQueryConfig.AllowQueryWhenLessThanAuditLevel,
- AuditLevel: task.AuditLevel,
- }, nil
- }
-
- return true, nil, nil
-}
-
-func generateAuditResult(task *sqleModel.Task) string {
- builder := strings.Builder{}
- for _, executeSQL := range task.ExecuteSQLs {
- builder.WriteString(strings.TrimSpace(executeSQL.Content))
- builder.WriteString("\n------------------------------------------------------------------------------------------------\n")
- builder.WriteString(executeSQL.GetAuditResults())
- builder.WriteString("\n------------------------------------------------------------------------------------------------\n\n")
- }
- return builder.String()
-}
diff --git a/sqle/api/cloudbeaver_wrapper/service/base.go b/sqle/api/cloudbeaver_wrapper/service/base.go
deleted file mode 100644
index e94f32ec31..0000000000
--- a/sqle/api/cloudbeaver_wrapper/service/base.go
+++ /dev/null
@@ -1,92 +0,0 @@
-package service
-
-import (
- "fmt"
- "sync"
-
- gqlClient "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/graph/client"
- "github.com/actiontech/sqle/sqle/config"
-
- "github.com/labstack/echo/v4"
-)
-
-type SQLQueryConfig struct {
- config.SQLQueryConfig
- SqlePort int
- SqleEnableHttps bool
-}
-
-var (
- cfg = &SQLQueryConfig{}
- cfgMu = &sync.RWMutex{}
-)
-
-const (
- CbRootUri = "/sql_query"
- CbGqlApi = "/api/gql"
- CBUserRole = "user"
-)
-
-// 这个客户端会用当前用户操作, 请求会发给SQLE, 由SQLE转发到CB
-func GetSQLEGQLClientWithCurrentUser(ctx echo.Context) (*gqlClient.Client, error) {
- return gqlClient.NewClient(GetSQLEGqlServerURI(), gqlClient.WithCookie(ctx.Cookies())), nil
-}
-
-// 这个客户端会用CB管理员操作, 请求会直接发到CB
-func GetGQLClientWithRootUser() (*gqlClient.Client, error) {
- cookies, err := LoginToCBServer(GetSQLQueryConfig().CloudBeaverAdminUser, GetSQLQueryConfig().CloudBeaverAdminPassword)
- if err != nil {
- return nil, err
- }
- return gqlClient.NewClient(GetGqlServerURI(), gqlClient.WithCookie(cookies)), nil
-}
-
-// 这个客户端会用指定用户操作, 请求会直接发到CB
-func GetGQLClient(username, password string) (*gqlClient.Client, error) {
- cookies, err := LoginToCBServer(username, password)
- if err != nil {
- return nil, err
- }
- return gqlClient.NewClient(GetGqlServerURI(), gqlClient.WithCookie(cookies)), nil
-}
-
-func IsCloudBeaverConfigured() bool {
- c := GetSQLQueryConfig()
- return c.SqlePort != 0 && c.CloudBeaverHost != "" && c.CloudBeaverPort != "" && c.CloudBeaverAdminUser != "" && c.CloudBeaverAdminPassword != ""
-}
-
-func GetGqlServerURI() string {
- protocol := "http"
- if cfg.EnableHttps {
- protocol = "https"
- }
-
- c := GetSQLQueryConfig()
-
- return fmt.Sprintf("%v://%v:%v%v%v", protocol, c.CloudBeaverHost, c.CloudBeaverPort, CbRootUri, CbGqlApi)
-}
-
-func GetSQLEGqlServerURI() string {
- protocol := "http"
- if cfg.EnableHttps {
- protocol = "https"
- }
-
- c := GetSQLQueryConfig()
-
- return fmt.Sprintf("%v://localhost:%v%v%v", protocol, c.SqlePort, CbRootUri, CbGqlApi)
-}
-
-func InitSQLQueryConfig(sqlePort int, sqleEnableHttps bool, c config.SQLQueryConfig) {
- cfgMu.Lock()
- cfg.SqlePort = sqlePort
- cfg.SQLQueryConfig = c
- cfg.SqleEnableHttps = sqleEnableHttps
- cfgMu.Unlock()
-}
-
-func GetSQLQueryConfig() *SQLQueryConfig {
- cfgMu.RLock()
- defer cfgMu.RUnlock()
- return cfg
-}
diff --git a/sqle/api/cloudbeaver_wrapper/service/gql.go b/sqle/api/cloudbeaver_wrapper/service/gql.go
deleted file mode 100644
index 211d24f360..0000000000
--- a/sqle/api/cloudbeaver_wrapper/service/gql.go
+++ /dev/null
@@ -1,345 +0,0 @@
-package service
-
-import (
- "context"
- "fmt"
- "strconv"
- "strings"
-
- gqlClient "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/graph/client"
-)
-
-var QueryGQL GetQueryGQL = CloudBeaverV2321{}
-
-var (
- Version2215 = CBVersion{
- version: []int{22, 1, 5},
- }
-
- Version2221 = CBVersion{
- version: []int{22, 2, 1},
- }
-
- Version2223 = CBVersion{
- version: []int{22, 2, 3},
- }
- Version2321 = CBVersion{
- version: []int{23, 2, 1},
- }
-)
-
-const getServerConfigQuery = `
-query serverConfig {
- serverConfig {
- version
- }
-}`
-
-func InitGQLVersion() error {
- client := gqlClient.NewClient(GetGqlServerURI())
- req := gqlClient.NewRequest(getServerConfigQuery, map[string]interface{}{})
- resp := struct {
- ServerConfig struct {
- Version string `json:"version"`
- } `json:"serverConfig"`
- }{}
- err := client.Run(context.Background(), req, &resp)
- if err != nil {
- return err
- }
-
- version, err := NewCBVersion(resp.ServerConfig.Version)
- if err != nil {
- return err
- }
- // QueryGQL 默认值是 CloudBeaverV2223{}
- if version.LessThan(Version2321) {
- QueryGQL = CloudBeaverV2223{}
- }
- if version.LessThan(Version2223) {
- QueryGQL = CloudBeaverV2221{}
- }
- if version.LessThan(Version2221) {
- QueryGQL = CloudBeaverV2215{}
- }
- if version.LessThan(Version2215) {
- return fmt.Errorf("CloudBeaver version less than 22.1.5 are not supported temporarily, your version is %v", resp.ServerConfig.Version)
- }
-
- return nil
-}
-
-// CloudBeaver 版本号格式一般为 X.X.X.X 格式,例如 '22.3.1.202212261505' , 其中前三位为版本号
-type CBVersion struct {
- version []int // version是版本号使用'.'进行分割后的数组
-}
-
-func NewCBVersion(versionStr string) (CBVersion, error) {
- versions := strings.Split(versionStr, ".")
- if len(versions) < 3 {
- return CBVersion{}, fmt.Errorf("CloudBeaver version number that cannot be resolved")
- }
- cb := CBVersion{
- version: []int{},
- }
- for _, version := range versions {
- v, err := strconv.Atoi(version)
- if err != nil {
- return CBVersion{}, fmt.Errorf("CloudBeaver version number that cannot be resolved")
- }
- cb.version = append(cb.version, v)
- }
- return cb, nil
-}
-
-// 只比较前三位, 因为只有前三位与版本有关
-func (v CBVersion) LessThan(version CBVersion) bool {
- if v.version[0] < version.version[0] {
- return true
- }
- if v.version[0] > version.version[0] {
- return false
- }
- if v.version[1] < version.version[1] {
- return true
- }
- if v.version[1] > version.version[1] {
- return false
- }
- return v.version[2] < version.version[2]
-
-}
-
-// 不同版本的CloudBeaver间存在不兼容查询语句
-// 说明: 接口传参时不要删除旧版查询语句的查询参数,多余的参数对新接口没有影响但是可以兼容旧版本
-type GetQueryGQL interface {
- CreateConnectionQuery() string
- UpdateConnectionQuery() string
- GetUserConnectionsQuery() string
- SetUserConnectionsQuery() string
- IsUserExistQuery(userId string) (string, map[string]interface{})
- UpdatePasswordQuery() string
- CreateUserQuery() string
- GrantUserRoleQuery() string
- LoginQuery() string
- GetActiveUserQuery() string
-}
-
-// TODO 暂时无法确定这套查询语句是兼容到22.1.5版本还是22.1.4版本, 因为虽然找到了22.1.4版本的镜像, 但没找到22.1.4版本的代码
-type CloudBeaverV2215 struct{}
-
-func (CloudBeaverV2215) CreateConnectionQuery() string {
- return `
-mutation createConnection(
- $projectId: ID!
- $config: ConnectionConfig!
-) {
- connection: createConnection(projectId: $projectId, config: $config) {
- ...DatabaseConnection
- }
-}
-fragment DatabaseConnection on ConnectionInfo {
- id
-}
-`
-}
-
-func (CloudBeaverV2215) UpdateConnectionQuery() string {
- return `
-mutation updateConnection(
- $projectId: ID!
- $config: ConnectionConfig!
-) {
- connection: updateConnection(projectId: $projectId, config: $config) {
- ...DatabaseConnection
- }
-}
-fragment DatabaseConnection on ConnectionInfo {
- id
-}
-`
-}
-
-func (CloudBeaverV2215) GetUserConnectionsQuery() string {
- return `
-query getUserConnections (
- $projectId: ID
- $connectionId: ID
-){
- connections: userConnections(projectId: $projectId, id: $connectionId) {
- ...DatabaseConnection
- }
-}
-fragment DatabaseConnection on ConnectionInfo {
- id
-}
-`
-}
-
-func (CloudBeaverV2215) SetUserConnectionsQuery() string {
- return `
-query setConnections($userId: ID!, $connections: [ID!]!) {
- grantedConnections: setSubjectConnectionAccess(
- subjectId: $userId
- connections: $connections
- )
-}
-`
-}
-
-func (CloudBeaverV2215) IsUserExistQuery(userId string) (string, map[string]interface{}) {
- return `
-query getUserList(
- $userId: ID
-){
- listUsers(userId: $userId) {
- ...adminUserInfo
- }
-}
-fragment adminUserInfo on AdminUserInfo {
- userId
-}`, map[string]interface{}{"userId": userId}
-}
-
-func (CloudBeaverV2215) UpdatePasswordQuery() string {
- return `
-query setUserCredentials(
- $userId: ID!
- $credentials: Object!
-) {
- setUserCredentials(
- userId: $userId
- providerId: "local"
- credentials: $credentials
- )
-}
-`
-}
-
-func (CloudBeaverV2215) CreateUserQuery() string {
- return `
-query createUser(
- $userId: ID!
-) {
- user: createUser(userId: $userId) {
- ...adminUserInfo
- }
-}
-fragment adminUserInfo on AdminUserInfo {
- userId
-}
-`
-}
-
-func (CloudBeaverV2215) GrantUserRoleQuery() string {
- return `
-query grantUserRole($userId: ID!, $roleId: ID!) {
- grantUserRole(userId: $userId, roleId: $roleId)
-}`
-}
-
-func (CloudBeaverV2215) LoginQuery() string {
- return `
-query authLogin(
- $credentials: Object
-) {
- authInfo: authLogin(
- provider: "local"
- configuration: null
- credentials: $credentials
- linkUser: false
- ){
- authId
- }
-}
-`
-}
-
-func (CloudBeaverV2215) GetActiveUserQuery() string {
- return `
- query getActiveUser {
- user: activeUser {
- userId
- }
- }
-`
-}
-
-type CloudBeaverV2221 struct {
- CloudBeaverV2215
-}
-
-func (CloudBeaverV2221) CreateUserQuery() string {
- return `
-query createUser(
- $userId: ID!
-) {
- user: createUser(userId: $userId, enabled: true) {
- ...adminUserInfo
- }
-}
-fragment adminUserInfo on AdminUserInfo {
- userId
-}
-`
-}
-
-type CloudBeaverV2223 struct {
- CloudBeaverV2221
-}
-
-func (CloudBeaverV2223) CreateUserQuery() string {
- return `
-query createUser(
- $userId: ID!
-) {
- user: createUser(userId: $userId, enabled: true, authRole: null) {
- ...adminUserInfo
- }
-}
-fragment adminUserInfo on AdminUserInfo {
- userId
-}
-`
-}
-
-func (CloudBeaverV2223) GrantUserRoleQuery() string {
- return `
-query grantUserTeam($userId: ID!, $teamId: ID!) {
- grantUserTeam(userId: $userId, teamId: $teamId)
-}`
-}
-
-type CloudBeaverV2321 struct {
- CloudBeaverV2221
-}
-
-func (CloudBeaverV2321) IsUserExistQuery(userId string) (string, map[string]interface{}) {
-
- return `
-query getUserList(
- $page: PageInput!
- $filter: AdminUserFilterInput!
-){
- listUsers(page: $page, filter: $filter) {
- ...adminUserInfo
- }
-}
-fragment adminUserInfo on AdminUserInfo {
- userId
-}
-`, map[string]interface{}{
- "page": map[string]interface{}{"offset": 0, "limit": 100},
- "filter": map[string]interface{}{"userIdMask": userId, "enabledState": true},
- }
-}
-
-func (CloudBeaverV2321) GetActiveUserQuery() string {
- return `
- query getActiveUser {
- user: activeUser {
- userId
- }
- }
-`
-}
diff --git a/sqle/api/cloudbeaver_wrapper/service/gql_test.go b/sqle/api/cloudbeaver_wrapper/service/gql_test.go
deleted file mode 100644
index fd34ef5bd5..0000000000
--- a/sqle/api/cloudbeaver_wrapper/service/gql_test.go
+++ /dev/null
@@ -1,95 +0,0 @@
-package service
-
-import (
- "fmt"
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-func TestCBVersion_LessThan(t *testing.T) {
- // 判断V1是否比V2小
- versions := []struct {
- V1 CBVersion
- V2 CBVersion
- result bool
- }{
- // 应当只比较前三位
- {
- V1: CBVersion{
- []int{2, 2, 2, 2},
- },
- V2: CBVersion{
- []int{2, 2, 2, 3},
- },
- result: false,
- },
- // 前两位相同
- {
- V1: CBVersion{
- []int{2, 2, 2},
- },
- V2: CBVersion{
- []int{2, 2, 2},
- },
- result: false,
- }, {
- V1: CBVersion{
- []int{2, 2, 3},
- },
- V2: CBVersion{
- []int{2, 2, 2},
- },
- result: false,
- }, {
- V1: CBVersion{
- []int{2, 2, 1},
- },
- V2: CBVersion{
- []int{2, 2, 2},
- },
- result: true,
- },
- // 第一位相同
- {
- V1: CBVersion{
- []int{2, 2, 2},
- },
- V2: CBVersion{
- []int{2, 1, 2},
- },
- result: false,
- }, {
- V1: CBVersion{
- []int{2, 1, 2},
- },
- V2: CBVersion{
- []int{2, 2, 2},
- },
- result: true,
- },
- // 第一位不同
- {
- V1: CBVersion{
- []int{2, 2, 2},
- },
- V2: CBVersion{
- []int{1, 2, 2},
- },
- result: false,
- }, {
- V1: CBVersion{
- []int{1, 2, 2},
- },
- V2: CBVersion{
- []int{2, 2, 2},
- },
- result: true,
- },
- }
-
- for _, version := range versions {
- assert.Equal(t, version.V1.LessThan(version.V2), version.result,
- fmt.Sprintf("V1: %v || V2: %v || result: %v", version.V1, version.V2, version.result))
- }
-}
diff --git a/sqle/api/cloudbeaver_wrapper/service/instance.go b/sqle/api/cloudbeaver_wrapper/service/instance.go
deleted file mode 100644
index c69f5021a0..0000000000
--- a/sqle/api/cloudbeaver_wrapper/service/instance.go
+++ /dev/null
@@ -1,375 +0,0 @@
-package service
-
-import (
- "context"
- "fmt"
-
- gqlClient "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/graph/client"
- driverV2 "github.com/actiontech/sqle/sqle/driver/v2"
- "github.com/actiontech/sqle/sqle/log"
- sqleModel "github.com/actiontech/sqle/sqle/model"
-)
-
-func SyncUserBindInstance(cbUserID string) error {
- // 获取当前SQLE用户
- s := sqleModel.GetStorage()
- sqleUserCache, exist, err := s.GetCloudBeaverUserCacheByCBUserID(cbUserID)
- if err != nil || !exist { // 如果用户不存在表示这可能是个与SQLE无关的用户
- return err
- }
- sqleUser, exist, err := s.GetUserByID(sqleUserCache.SQLEUserID)
- if err != nil || !exist {
- return err
- }
-
- // 获取用户当前拥有权限的SQLE实例
- var sqleInstSlice []*sqleModel.Instance
- if sqleUser.Name == sqleModel.DefaultAdminUser {
- sqleInstSlice, err = s.GetAllInstance()
- } else {
- sqleInstSlice, err = s.GetUserCanOpInstances(sqleUser, []uint{sqleModel.OP_SQL_QUERY_QUERY})
- }
- if err != nil {
- return err
- }
-
- sqleInstMap := map[uint] /*sqle inst id*/ *sqleModel.Instance{}
- instIds := make([]uint, len(sqleInstSlice))
- for i, instance := range sqleInstSlice {
- instIds[i] = instance.ID
- }
- insts, err := s.GetInstancesFromActiveProjectByIds(instIds)
- if err != nil {
- return err
- }
- for _, inst := range insts {
- sqleInstMap[inst.ID] = inst
- }
-
- // 同步实例信息
- if err := SyncInstance(sqleInstMap); err != nil {
- return err
- }
-
- // 同步cloudbeaver上用户对实例的权限信息
- if err := SyncVisibleInstance(sqleUserCache, sqleUser, sqleInstMap); err != nil {
- return err
- }
-
- return nil
-}
-
-func SyncInstance(sqleInstances map[uint] /*sqle inst id*/ *sqleModel.Instance) error {
- ids := []uint{}
- for _, instance := range sqleInstances {
- ids = append(ids, instance.ID)
- }
-
- // 从缓存中获取需要同步的CloudBeaver实例
- s := sqleModel.GetStorage()
- cbInstCacheSlice, err := s.GetCloudBeaverInstanceCacheBySQLEInstIDs(ids)
- if err != nil {
- return err
- }
- cbInstCacheMap := map[uint] /* sqle inst id*/ *sqleModel.CloudBeaverInstanceCache{}
- for _, cache := range cbInstCacheSlice {
- cbInstCacheMap[cache.SQLEInstanceID] = cache
- }
-
- // 找到需要同步的实例
- needAdd := []uint /*sqle inst id*/ {}
- needUpdate := []uint /*sqle inst id*/ {}
- for sqleInstID, sqleInst := range sqleInstances {
- cb, ok := cbInstCacheMap[sqleInstID]
- if !ok {
- needAdd = append(needAdd, sqleInstID)
- } else if cb.SQLEInstanceFingerprint != sqleInst.Fingerprint() {
- needUpdate = append(needUpdate, sqleInstID)
- }
- }
-
- if len(needAdd) == 0 && len(needUpdate) == 0 {
- return nil
- }
-
- // 获取管理员链接
- client, err := GetGQLClientWithRootUser()
- if err != nil {
- return err
- }
-
- l := log.NewEntry()
-
- // 同步实例信息
- for _, sqleInstID := range needAdd {
- project, _, err := s.GetProjectByID(sqleInstances[sqleInstID].ProjectId)
- if err != nil {
- l.Errorf("get instance %v project failed: %v", sqleInstID, err)
- project.Name = "unknown"
- }
- if err := AddCloudBeaverInstance(client, sqleInstances[sqleInstID], project); err != nil {
- l.Errorf("add instance %v to cloudbeaver failed: %v", sqleInstID, err)
- }
- }
- for _, sqleInstID := range needUpdate {
- project, _, err := s.GetProjectByID(sqleInstances[sqleInstID].ProjectId)
- if err != nil {
- l.Errorf("get instance %v project failed: %v", sqleInstID, err)
- project.Name = "unknown"
- }
- if err := UpdateCloudBeaverInstance(client, cbInstCacheMap[sqleInstID].CloudBeaverInstanceID, sqleInstances[sqleInstID], project); err != nil {
- l.Errorf("update instance %v to cloudbeaver failed: %v", sqleInstID, err)
- }
- }
-
- return nil
-
-}
-
-// AddCloudBeaverInstance 添加实例后会同步缓存
-func AddCloudBeaverInstance(client *gqlClient.Client, sqleInst *sqleModel.Instance, project *sqleModel.Project) error {
- params, err := GenerateCloudBeaverInstanceParams(sqleInst, project)
- if err != nil {
- fmt.Println("Instances of this type are not currently supported:", sqleInst.DbType)
- // 不支持的类型跳过就好,没必要终端流程
- //nolint:nilerr
- return nil
- }
- // 添加实例
- req := gqlClient.NewRequest(QueryGQL.CreateConnectionQuery(), params)
- resp := struct {
- Connection struct {
- ID string `json:"id"`
- } `json:"connection"`
- }{}
-
- err = client.Run(context.TODO(), req, &resp)
- if err != nil {
- return err
- }
-
- // 同步缓存
- s := sqleModel.GetStorage()
- return s.Save(&sqleModel.CloudBeaverInstanceCache{
- CloudBeaverInstanceID: resp.Connection.ID,
- SQLEInstanceID: sqleInst.ID,
- SQLEInstanceFingerprint: sqleInst.Fingerprint(),
- })
-}
-
-// UpdateCloudBeaverInstance 更新完毕后会同步缓存
-func UpdateCloudBeaverInstance(client *gqlClient.Client, cbInstID string, sqleInst *sqleModel.Instance, project *sqleModel.Project) error {
-
- params, err := GenerateCloudBeaverInstanceParams(sqleInst, project)
- if err != nil {
- fmt.Println("Instances of this type are not currently supported:", sqleInst.DbType)
- // 不支持的类型跳过就好,没必要终端流程
- //nolint:nilerr
- return nil
- }
- // 更新实例
- params["config"].(map[string]interface{})["connectionId"] = cbInstID
- req := gqlClient.NewRequest(QueryGQL.UpdateConnectionQuery(), params)
- resp := struct {
- Connection struct {
- ID string `json:"id"`
- } `json:"connection"`
- }{}
-
- err = client.Run(context.TODO(), req, &resp)
- if err != nil {
- return err
- }
-
- // 同步缓存
- s := sqleModel.GetStorage()
- return s.Save(&sqleModel.CloudBeaverInstanceCache{
- CloudBeaverInstanceID: resp.Connection.ID,
- SQLEInstanceID: sqleInst.ID,
- SQLEInstanceFingerprint: sqleInst.Fingerprint(),
- })
-}
-
-func SyncVisibleInstance(cbUserCache *sqleModel.CloudBeaverUserCache, sqleUser *sqleModel.User, sqleInstances map[uint] /*sqle inst id*/ *sqleModel.Instance) error {
-
- if cbUserCache.SQLEFingerprint != sqleUser.FingerPrint() {
- return fmt.Errorf("user information is not synchronized, unable to update instance information")
- }
-
- ids := []uint{}
- for _, instance := range sqleInstances {
- ids = append(ids, instance.ID)
- }
-
- // 从缓存中获取需要同步的CloudBeaver实例
- s := sqleModel.GetStorage()
- cbInstCacheSlice, err := s.GetCloudBeaverInstanceCacheBySQLEInstIDs(ids)
- if err != nil {
- return err
- }
- cbInstCacheMap := map[string] /* cb inst id*/ *sqleModel.CloudBeaverInstanceCache{}
- for _, cache := range cbInstCacheSlice {
- cbInstCacheMap[cache.CloudBeaverInstanceID] = cache
- }
-
- // 获取用户当前实例列表
- getConnResp := &struct {
- Connections []*struct {
- Id string `json:"id"`
- } `json:"connections"`
- }{}
-
- getConReq := gqlClient.NewRequest(QueryGQL.GetUserConnectionsQuery(), nil)
-
- client, err := GetGQLClient(cbUserCache.CloudBeaverUserID, sqleUser.Password)
- if err != nil {
- return err
- }
-
- err = client.Run(context.TODO(), getConReq, getConnResp)
- if err != nil {
- return err
- }
-
- // 判断是否需要同步权限
- if len(getConnResp.Connections) != len(cbInstCacheSlice) {
- return syncVisibleInstance(cbInstCacheSlice, cbUserCache.CloudBeaverUserID)
- }
- for _, connection := range getConnResp.Connections {
- if _, ok := cbInstCacheMap[connection.Id]; !ok {
- return syncVisibleInstance(cbInstCacheSlice, cbUserCache.CloudBeaverUserID)
- }
- }
- return nil
-
-}
-
-func syncVisibleInstance(cbInstCacheSlice []*sqleModel.CloudBeaverInstanceCache, cloudBeaverUserID string) error {
- cbInstIDs := []string{}
- for _, cache := range cbInstCacheSlice {
- cbInstIDs = append(cbInstIDs, cache.CloudBeaverInstanceID)
- }
- setConnReq := gqlClient.NewRequest(QueryGQL.SetUserConnectionsQuery(), map[string]interface{}{
- "userId": cloudBeaverUserID,
- "connections": cbInstIDs,
- })
- rootClient, err := GetGQLClientWithRootUser()
- if err != nil {
- return err
- }
- err = rootClient.Run(context.TODO(), setConnReq, nil)
- return err
-}
-
-func generateCommonCloudBeaverConfigParams(sqleInst *sqleModel.Instance, project *sqleModel.Project) map[string]interface{} {
- return map[string]interface{}{
- "configurationType": "MANUAL",
- "name": fmt.Sprintf("%v: %v", project.Name, sqleInst.Name),
- "template": false,
- "host": sqleInst.Host,
- "port": sqleInst.Port,
- "databaseName": nil,
- "description": nil,
- "authModelId": "native",
- "saveCredentials": true,
- "credentials": map[string]interface{}{
- "userName": sqleInst.User,
- "userPassword": sqleInst.Password,
- },
- }
-}
-
-func GenerateCloudBeaverInstanceParams(sqleInst *sqleModel.Instance, project *sqleModel.Project) (map[string]interface{}, error) {
- var err error
- config := generateCommonCloudBeaverConfigParams(sqleInst, project)
-
- switch sqleInst.DbType {
- case driverV2.DriverTypeMySQL, driverV2.DriverTypeTDSQLForInnoDB:
- err = fillMySQLParams(config)
- case driverV2.DriverTypeTiDB:
- err = fillTiDBParams(config)
- case driverV2.DriverTypePostgreSQL:
- err = fillPGSQLParams(config)
- case driverV2.DriverTypeSQLServer:
- err = fillMSSQLParams(config)
- case driverV2.DriverTypeOracle:
- err = fillOracleParams(sqleInst, config)
- case driverV2.DriverTypeDB2:
- err = fillDB2Params(sqleInst, config)
- case driverV2.DriverTypeOceanBase:
- err = fillOceanBaseParams(sqleInst, config)
- default:
- return nil, fmt.Errorf("temporarily unsupported instance types")
- }
-
- resp := map[string]interface{}{
- "projectId": "g_GlobalConfiguration",
- "config": config,
- }
- return resp, err
-}
-
-func fillMySQLParams(config map[string]interface{}) error {
- config["driverId"] = "mysql:mysql8"
- return nil
-}
-
-func fillTiDBParams(config map[string]interface{}) error {
- config["driverId"] = "mysql:tidb"
- return nil
-}
-
-func fillMSSQLParams(config map[string]interface{}) error {
- config["driverId"] = "sqlserver:microsoft"
- config["authModelId"] = "sqlserver_database"
- return nil
-}
-
-func fillPGSQLParams(config map[string]interface{}) error {
- config["driverId"] = "postgresql:postgres-jdbc"
- config["providerProperties"] = map[string]interface{}{
- "@dbeaver-show-non-default-db@": true,
- "@dbeaver-show-unavailable-db@": true,
- "@dbeaver-show-template-db@": true,
- }
- return nil
-}
-
-func fillOracleParams(inst *sqleModel.Instance, config map[string]interface{}) error {
- serviceName := inst.AdditionalParams.GetParam("service_name")
- if serviceName == nil {
- return fmt.Errorf("the service name of oracle cannot be empty")
- }
-
- config["driverId"] = "oracle:oracle_thin"
- config["authModelId"] = "oracle_native"
- config["databaseName"] = serviceName.Value
- config["providerProperties"] = map[string]interface{}{
- "@dbeaver-sid-service@": "SID",
- "oracle.logon-as": "Normal",
- }
- return nil
-}
-
-func fillDB2Params(inst *sqleModel.Instance, config map[string]interface{}) error {
- dbName := inst.AdditionalParams.GetParam("database_name")
- if dbName == nil {
- return fmt.Errorf("the database name of DB2 cannot be empty")
- }
-
- config["driverId"] = "db2:db2"
- config["databaseName"] = dbName.Value
- return nil
-}
-
-func fillOceanBaseParams(inst *sqleModel.Instance, config map[string]interface{}) error {
- tenant := inst.AdditionalParams.GetParam("tenant_name")
- if tenant == nil {
- return fmt.Errorf("the tenant name of oceanbase cannot be empty")
- }
-
- config["driverId"] = "oceanbase:alipay_oceanbase"
- config["authModelId"] = "oceanbase_native"
- config["credentials"].(map[string]interface{})["userName"] = fmt.Sprintf("%v@%v", inst.User, tenant)
- return nil
-}
diff --git a/sqle/api/cloudbeaver_wrapper/service/user.go b/sqle/api/cloudbeaver_wrapper/service/user.go
deleted file mode 100644
index 258cc94b32..0000000000
--- a/sqle/api/cloudbeaver_wrapper/service/user.go
+++ /dev/null
@@ -1,162 +0,0 @@
-package service
-
-import (
- "context"
- "fmt"
- "net/http"
- "strings"
-
- gqlClient "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/graph/client"
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/graph/model"
- sqleModel "github.com/actiontech/sqle/sqle/model"
- "github.com/actiontech/sqle/sqle/utils"
-)
-
-func SyncCurrentUser(cloudBeaverUser string) error {
- ctx := context.Background()
-
- // 获取SQLE缓存中的CloudBeaver用户信息和SQLE用户信息
- s := sqleModel.GetStorage()
- cache, cbExist, err := s.GetCloudBeaverUserCacheByCBUserID(cloudBeaverUser)
- if err != nil {
- return err
- }
-
- sqleUserName := RestoreFromCloudBeaverUserName(cloudBeaverUser)
- sqleUser, exist, err := s.GetUserByName(sqleUserName)
- if err != nil {
- return err
- }
- if !exist { // SQLE用户不存在有可能是用户使用自行添加的用户导致的, 此用户因为与SQLE无关, 所以忽略
- return nil
- }
-
- // 如果缓存存在且指纹校验通过, 则认为用户同步过且当前缓存为最新缓存
- // 反之则需要触发同步并更新缓存
- if cbExist && sqleUser.FingerPrint() == cache.SQLEFingerprint {
- return nil
- }
-
- if IsReserved(cloudBeaverUser) {
- return fmt.Errorf("this username cannot be used")
- }
-
- // 使用管理员身份登录
- client, err := GetGQLClientWithRootUser()
- if err != nil {
- return err
- }
-
- checkExistReq := gqlClient.NewRequest(QueryGQL.IsUserExistQuery(cloudBeaverUser))
-
- type UserList struct {
- ListUsers []struct {
- UserID string `json:"userID"`
- } `json:"listUsers"`
- }
- users := UserList{}
-
- err = client.Run(ctx, checkExistReq, &users)
- if err != nil {
- return fmt.Errorf("check cloudbeaver user exist failed: %v", err)
- }
-
- // 用户不存在则创建CloudBeaver用户
- if len(users.ListUsers) == 0 {
- // 创建用户
- createUserReq := gqlClient.NewRequest(QueryGQL.CreateUserQuery(), map[string]interface{}{
- "userId": cloudBeaverUser,
- })
- err = client.Run(ctx, createUserReq, &UserList{})
- if err != nil {
- return fmt.Errorf("create cloudbeaver user failed: %v", err)
- }
-
- // 授予角色(不授予角色的用户无法登录)
- grantUserRoleReq := gqlClient.NewRequest(QueryGQL.GrantUserRoleQuery(), map[string]interface{}{
- "userId": cloudBeaverUser,
- "roleId": CBUserRole,
- "teamId": CBUserRole,
- })
- err = client.Run(ctx, grantUserRoleReq, nil)
- if err != nil {
- return fmt.Errorf("create cloudbeaver user failed: %v", err)
- }
- }
-
- // 更新CloudBeaver用户密码
- updatePasswordReq := gqlClient.NewRequest(QueryGQL.UpdatePasswordQuery(), map[string]interface{}{
- "userId": cloudBeaverUser,
- "credentials": model.JSON{
- "password": strings.ToUpper(utils.Md5(sqleUser.Password)),
- },
- })
- err = client.Run(ctx, updatePasswordReq, nil)
- if err != nil {
- return fmt.Errorf("update cloudbeaver user failed: %v", err)
- }
-
- // 更新SQLE缓存
- return s.UpdateCloudBeaverUserCache(sqleUser.ID, cloudBeaverUser)
-}
-
-// IsReserved 会检查用户名是否为无法使用的名称, 比如admin和user是角色名, 按照CloudBeaver的要求角色名无法作为用户名
-func IsReserved(name string) bool {
- _, ok := map[string]struct{}{
- "admin": {},
- "user": {},
- }[name]
- return ok
-}
-
-const CBNamePrefix = "sqle-"
-
-func GenerateCloudBeaverUserName(name string) string {
- return CBNamePrefix + name
-}
-
-func RestoreFromCloudBeaverUserName(name string) string {
- return strings.TrimPrefix(name, CBNamePrefix)
-}
-
-// LoginToCBServer 的登录请求会直接被转发, 不会被中间件拦截处理
-func LoginToCBServer(user, pwd string) (cookie []*http.Cookie, err error) {
- client := gqlClient.NewClient(GetGqlServerURI(), gqlClient.WithHttpResHandler(
- func(response *http.Response) {
- if response != nil {
- cookie = response.Cookies()
- }
- }))
- req := gqlClient.NewRequest(QueryGQL.LoginQuery(), map[string]interface{}{
- "credentials": model.JSON{
- "user": user,
- "password": strings.ToUpper(utils.Md5(pwd)), // the password is an all-caps md5-32 string
- },
- })
-
- res := struct {
- AuthInfo struct {
- AuthId interface{} `json:"authId"`
- } `json:"authInfo"`
- }{}
- if err := client.Run(context.TODO(), req, &res); err != nil {
- return cookie, fmt.Errorf("cloudbeaver login failed: %v", err)
- }
-
- return cookie, nil
-}
-
-type ActiveUserQueryRes struct {
- User interface{} `json:"user"`
-}
-
-func GetActiveUserQuery(cookies []*http.Cookie) (*ActiveUserQueryRes, error) {
- client := gqlClient.NewClient(GetGqlServerURI(), gqlClient.WithCookie(cookies))
- req := gqlClient.NewRequest(QueryGQL.GetActiveUserQuery(), map[string]interface{}{})
-
- res := &ActiveUserQueryRes{}
- if err := client.Run(context.TODO(), req, res); err != nil {
- return nil, err
- }
- return res, nil
-}
diff --git a/sqle/api/controller/base.go b/sqle/api/controller/base.go
index e76a6d1f60..2946e2e7d5 100644
--- a/sqle/api/controller/base.go
+++ b/sqle/api/controller/base.go
@@ -1,17 +1,29 @@
package controller
import (
+ "context"
"fmt"
"io/ioutil"
"net/http"
+ "strconv"
"github.com/actiontech/sqle/sqle/errors"
"github.com/actiontech/sqle/sqle/model"
+ dmsJWT "github.com/actiontech/dms/pkg/dms-common/api/jwt"
"github.com/golang-jwt/jwt"
"github.com/labstack/echo/v4"
)
+var dmsServerAddress string
+
+func GetDMSServerAddress() string {
+ return dmsServerAddress
+}
+func InitDMSServerAddress(addr string) {
+ dmsServerAddress = addr
+}
+
type BaseRes struct {
Code int `json:"code" example:"0"`
Message string `json:"message" example:"ok"`
@@ -59,7 +71,19 @@ func GetUserName(c echo.Context) string {
return claims["name"].(string)
}
-func GetCurrentUser(c echo.Context) (*model.User, error) {
+func GetUserID(c echo.Context) string {
+ uidStr, err := dmsJWT.GetUserUidStrFromContextWithOldJwt(c)
+ if err != nil {
+ return ""
+ }
+ uid, err := strconv.Atoi(uidStr)
+ if err != nil {
+ return ""
+ }
+ return fmt.Sprintf("%d", uid)
+}
+
+func GetCurrentUser(c echo.Context, getUser func(context.Context, string, string) (*model.User, error)) (*model.User, error) {
key := "current_user"
currentUser := c.Get(key)
if currentUser != nil {
@@ -67,15 +91,11 @@ func GetCurrentUser(c echo.Context) (*model.User, error) {
return user, nil
}
}
- s := model.GetStorage()
- user, exist, err := s.GetUserByName(GetUserName(c))
+ uidStr := GetUserID(c)
+ user, err := getUser(c.Request().Context(), uidStr, GetDMSServerAddress())
if err != nil {
return nil, err
}
- if !exist {
- return nil, errors.New(errors.DataNotExist,
- fmt.Errorf("current user is not exist"))
- }
c.Set(key, user)
return user, nil
}
diff --git a/sqle/api/controller/v1/audit_plan.go b/sqle/api/controller/v1/audit_plan.go
index f78e040c4b..23221ab470 100644
--- a/sqle/api/controller/v1/audit_plan.go
+++ b/sqle/api/controller/v1/audit_plan.go
@@ -13,8 +13,11 @@ import (
"strings"
"time"
+ v1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+ dmsCommonJwt "github.com/actiontech/dms/pkg/dms-common/api/jwt"
"github.com/actiontech/sqle/sqle/api/controller"
"github.com/actiontech/sqle/sqle/common"
+ dms "github.com/actiontech/sqle/sqle/dms"
"github.com/actiontech/sqle/sqle/driver"
driverV2 "github.com/actiontech/sqle/sqle/driver/v2"
"github.com/actiontech/sqle/sqle/errors"
@@ -25,7 +28,6 @@ import (
"github.com/actiontech/sqle/sqle/server"
"github.com/actiontech/sqle/sqle/server/auditplan"
"github.com/actiontech/sqle/sqle/utils"
-
"github.com/labstack/echo/v4"
dry "github.com/ungerik/go-dry"
)
@@ -219,36 +221,13 @@ func CreateAuditPlan(c echo.Context) error {
return controller.JSONBaseErrorReq(c, errAuditPlanInstanceConflict)
}
- // check project
- projectName := c.Param("project_name")
- project, exist, err := s.GetProjectByName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrProjectNotExist(projectName))
- }
- if project.IsArchived() {
- return controller.JSONBaseErrorReq(c, ErrProjectArchived)
- }
-
- // check user
- currentUserName := controller.GetUserName(c)
-
- err = CheckIsProjectMember(currentUserName, projectName)
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- user, exist, err := s.GetUserByName(currentUserName)
- if !exist {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist, fmt.Errorf("user is not exist")))
- } else if err != nil {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataConflict, err))
- }
-
// check audit plan name
- _, exist, err = s.GetAuditPlanFromProjectByName(projectName, req.Name)
+ _, exist, err := s.GetAuditPlanFromProjectByName(projectUid, req.Name)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -259,7 +238,7 @@ func CreateAuditPlan(c echo.Context) error {
// check instance
var instanceType string
if req.InstanceName != "" {
- inst, exist, err := s.GetInstanceByNameAndProjectName(req.InstanceName, projectName)
+ inst, exist, err := dms.GetInstanceInProjectByName(c.Request().Context(), projectUid, req.InstanceName)
if !exist {
return controller.JSONBaseErrorReq(c, ErrInstanceNotExist)
} else if err != nil {
@@ -282,23 +261,25 @@ func CreateAuditPlan(c echo.Context) error {
}
}
instanceType = inst.DbType
-
// check operation
- can, err := s.CheckUserCanCreateAuditPlan(user, projectName, req.InstanceName)
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !can {
+ canCreateAuditPlan, err := CheckUserCanCreateAuditPlan(c.Request().Context(), projectUid, user, []*model.Instance{inst})
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ if !canCreateAuditPlan {
return controller.JSONBaseErrorReq(c, errors.NewUserNotPermissionError(model.GetOperationCodeDesc(uint(model.OP_AUDIT_PLAN_SAVE))))
}
-
} else {
instanceType = req.InstanceType
}
// check rule template name
if req.RuleTemplateName != "" {
- exist, err = s.IsRuleTemplateExist(req.RuleTemplateName, []uint{project.ID, model.ProjectIdForGlobalRuleTemplate})
+ exist, err = s.IsRuleTemplateExist(req.RuleTemplateName, []string{projectUid, model.ProjectIdForGlobalRuleTemplate})
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -306,7 +287,7 @@ func CreateAuditPlan(c echo.Context) error {
return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist, fmt.Errorf("rule template does not exist")))
}
}
- ruleTemplateName, err := autoSelectRuleTemplate(req.RuleTemplateName, req.InstanceName, req.InstanceType, project.ID)
+ ruleTemplateName, err := autoSelectRuleTemplate(c.Request().Context(), req.RuleTemplateName, req.InstanceName, req.InstanceType, projectUid)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -321,11 +302,10 @@ func CreateAuditPlan(c echo.Context) error {
}
// generate token
+ userId := controller.GetUserID(c)
// 为了控制JWT Token的长度,保证其长度不超过数据表定义的长度上限(255字符)
// 因此使用MD5算法将变长的 currentUserName 和 Name 转换为固定长度
- j := utils.NewJWT(utils.JWTSecretKey)
- t, err := j.CreateToken(currentUserName, time.Now().Add(tokenExpire).Unix(),
- utils.WithAuditPlanName(utils.Md5(req.Name)))
+ t, err := dmsCommonJwt.GenJwtToken(dmsCommonJwt.WithUserId(userId), dmsCommonJwt.WithExpiredTime(tokenExpire), dmsCommonJwt.WithAuditPlanName(utils.Md5(req.Name)))
if err != nil {
return controller.JSONBaseErrorReq(c, errors.New(errors.DataConflict, err))
}
@@ -335,13 +315,13 @@ func CreateAuditPlan(c echo.Context) error {
CronExpression: req.Cron,
Type: req.Type,
Params: ps,
- CreateUserID: user.ID,
+ CreateUserID: userId,
Token: t,
DBType: instanceType,
RuleTemplateName: ruleTemplateName,
InstanceName: req.InstanceName,
InstanceDatabase: req.InstanceDatabase,
- ProjectId: project.ID,
+ ProjectId: model.ProjectUID(projectUid),
}
err = s.Save(ap)
if err != nil {
@@ -353,7 +333,7 @@ func CreateAuditPlan(c echo.Context) error {
// customRuleTemplateName如果为空, 将返回instanceName绑定的规则模板, 如果customRuleTemplateName,和instanceName都为空, 将返回dbType对应默认模板, dbType不能为空, 函数不做参数校验
// 规则模板选择规则: 指定规则模板 -- > 数据源绑定的规则模板 -- > 数据库类型默认模板
-func autoSelectRuleTemplate(customRuleTemplateName string, instanceName string, dbType string, projectId uint) (ruleTemplateName string, err error) {
+func autoSelectRuleTemplate(ctx context.Context, customRuleTemplateName string, instanceName string, dbType string, projectId string) (ruleTemplateName string, err error) {
s := model.GetStorage()
if customRuleTemplateName != "" {
@@ -361,13 +341,14 @@ func autoSelectRuleTemplate(customRuleTemplateName string, instanceName string,
}
if instanceName != "" {
- ruleTemplate, exist, err := s.GetRuleTemplatesByInstanceNameAndProjectId(instanceName, projectId)
+ instance, exist, err := dms.GetInstanceInProjectByName(ctx, projectId, instanceName)
if err != nil {
return "", err
}
if exist {
- return ruleTemplate.Name, nil
+ return instance.RuleTemplateName, nil
}
+
}
return s.GetDefaultRuleTemplateName(dbType), nil
@@ -385,18 +366,14 @@ func autoSelectRuleTemplate(customRuleTemplateName string, instanceName string,
// @router /v1/projects/{project_name}/audit_plans/{audit_plan_name}/ [delete]
func DeleteAuditPlan(c echo.Context) error {
s := model.GetStorage()
- projectName := c.Param("project_name")
- apName := c.Param("audit_plan_name")
-
- archived, err := s.IsProjectArchived(projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if archived {
- return controller.JSONBaseErrorReq(c, ErrProjectArchived)
- }
- ap, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectName, apName, 0)
+ apName := c.Param("audit_plan_name")
+
+ ap, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectUid, apName, "")
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -433,19 +410,16 @@ func UpdateAuditPlan(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
- projectName := c.Param("project_name")
- apName := c.Param("audit_plan_name")
-
- storage := model.GetStorage()
- archived, err := storage.IsProjectArchived(projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if archived {
- return controller.JSONBaseErrorReq(c, ErrProjectArchived)
- }
- ap, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectName, apName, 0)
+ apName := c.Param("audit_plan_name")
+
+ storage := model.GetStorage()
+
+ ap, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectUid, apName, "")
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -465,7 +439,7 @@ func UpdateAuditPlan(c echo.Context) error {
}
if req.RuleTemplateName != nil {
- exist, err = storage.IsRuleTemplateExist(*req.RuleTemplateName, []uint{ap.ProjectId, model.ProjectIdForGlobalRuleTemplate})
+ exist, err = storage.IsRuleTemplateExist(*req.RuleTemplateName, []string{projectUid, model.ProjectIdForGlobalRuleTemplate})
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -537,9 +511,7 @@ func GetAuditPlans(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
- projectName := c.Param("project_name")
- userName := controller.GetUserName(c)
- err := CheckIsProjectMember(userName, projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -549,22 +521,11 @@ func GetAuditPlans(c echo.Context) error {
offset = req.PageSize * (req.PageIndex - 1)
}
- currentUser, err := controller.GetCurrentUser(c)
- if err != nil {
- return err
- }
- instances, err := s.GetUserCanOpInstancesFromProject(currentUser, projectName, []uint{model.OP_AUDIT_PLAN_VIEW_OTHERS})
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- names := []string{}
- for _, instance := range instances {
- names = append(names, instance.Name)
- }
+ userId := controller.GetUserID(c)
- isManager, err := s.IsProjectManager(currentUser.Name, projectName)
+ up, err := dms.NewUserPermission(userId, projectUid)
if err != nil {
- return controller.JSONBaseErrorReq(c, err)
+ return err
}
data := map[string]interface{}{
@@ -572,15 +533,20 @@ func GetAuditPlans(c echo.Context) error {
"fuzzy_search_audit_plan_name": req.FuzzySearchAuditPlanName,
"filter_audit_plan_type": req.FilterAuditPlanType,
"filter_audit_plan_instance_name": req.FilterAuditPlanInstanceName,
- "current_user_name": currentUser.Name,
- "current_user_is_admin": model.DefaultAdminUser == currentUser.Name || isManager,
- "filter_project_name": projectName,
+ "filter_project_id": projectUid,
"limit": req.PageSize,
+ "current_user_id": userId,
+ "current_user_is_admin": up.IsAdmin(),
"offset": offset,
}
- if len(names) > 0 {
- data["accessible_instances_name"] = fmt.Sprintf("'%s'", strings.Join(names, "', '"))
+ if !up.IsAdmin() {
+ instanceNames, err := dms.GetInstanceNamesInProjectByIds(c.Request().Context(), projectUid, up.GetInstancesByOP(v1.OpPermissionTypeViewOtherAuditPlan))
+ if err != nil {
+ return err
+ }
+ data["accessible_instances_name"] = fmt.Sprintf("\"%s\"", strings.Join(instanceNames, "\",\""))
}
+
auditPlans, count, err := s.GetAuditPlansByReq(data)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
@@ -626,10 +592,13 @@ type GetAuditPlanResV1 struct {
// @Success 200 {object} v1.GetAuditPlanResV1
// @router /v1/projects/{project_name}/audit_plans/{audit_plan_name}/ [get]
func GetAuditPlan(c echo.Context) error {
- projectName := c.Param("project_name")
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
apName := c.Param("audit_plan_name")
- ap, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectName, apName, model.OP_AUDIT_PLAN_VIEW_OTHERS)
+ ap, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectUid, apName, v1.OpPermissionTypeViewOtherAuditPlan)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -696,10 +665,13 @@ func GetAuditPlanReports(c echo.Context) error {
return err
}
- projectName := c.Param("project_name")
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
apName := c.Param("audit_plan_name")
- _, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectName, apName, model.OP_AUDIT_PLAN_VIEW_OTHERS)
+ _, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectUid, apName, v1.OpPermissionTypeViewOtherAuditPlan)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -713,7 +685,7 @@ func GetAuditPlanReports(c echo.Context) error {
}
data := map[string]interface{}{
- "project_name": projectName,
+ "project_id": projectUid,
"audit_plan_name": apName,
"limit": req.PageSize,
"offset": offset,
@@ -756,10 +728,13 @@ type GetAuditPlanReportResV1 struct {
// @Success 200 {object} v1.GetAuditPlanReportResV1
// @router /v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/ [get]
func GetAuditPlanReport(c echo.Context) error {
- projectName := c.Param("project_name")
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
apName := c.Param("audit_plan_name")
- ap, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectName, apName, model.OP_AUDIT_PLAN_VIEW_OTHERS)
+ ap, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectUid, apName, v1.OpPermissionTypeViewOtherAuditPlan)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -914,14 +889,22 @@ func FullSyncAuditPlanSQLs(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
- projectName := c.Param("project_name")
apName := c.Param("audit_plan_name")
s := model.GetStorage()
- ap, err := CheckProjectAndAuditPlan(s, projectName, apName)
+
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), c.Param("project_name"), true)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+
+ ap, exist, err := s.GetAuditPlanFromProjectByName(projectUid, apName)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
+ if !exist {
+ return controller.JSONBaseErrorReq(c, errAuditPlanNotExist)
+ }
l := log.NewEntry()
reqSQLs := req.SQLs
@@ -963,15 +946,22 @@ func PartialSyncAuditPlanSQLs(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
- projectName := c.Param("project_name")
apName := c.Param("audit_plan_name")
s := model.GetStorage()
- ap, err := CheckProjectAndAuditPlan(s, projectName, apName)
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
+ ap, exist, err := dms.GetAuditPlanWithInstanceFromProjectByName(projectUid, apName, s.GetAuditPlanFromProjectByName)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ if !exist {
+ return controller.JSONBaseErrorReq(c, errAuditPlanNotExist)
+ }
+
l := log.NewEntry()
reqSQLs := req.SQLs
blackList, err := s.GetBlackListAuditPlanSQLs()
@@ -990,26 +980,6 @@ func PartialSyncAuditPlanSQLs(c echo.Context) error {
return controller.JSONBaseErrorReq(c, auditplan.UploadSQLs(l, ap, sqls, true))
}
-func CheckProjectAndAuditPlan(s *model.Storage, projectName string, apName string) (*model.AuditPlan, error) {
- archived, err := s.IsProjectArchived(projectName)
- if err != nil {
- return nil, err
- }
- if archived {
- return nil, ErrProjectArchived
- }
-
- ap, exist, err := s.GetAuditPlanFromProjectByName(projectName, apName)
- if err != nil {
- return nil, err
- }
- if !exist {
- return nil, errors.NewAuditPlanNotExistErr()
- }
-
- return ap, nil
-}
-
func convertToModelAuditPlanSQL(c echo.Context, auditPlan *model.AuditPlan, reqSQLs []*AuditPlanSQLReqV1) ([]*auditplan.SQL, error) {
var p driver.Plugin
var err error
@@ -1103,19 +1073,13 @@ type TriggerAuditPlanResV1 struct {
// @Success 200 {object} v1.TriggerAuditPlanResV1
// @router /v1/projects/{project_name}/audit_plans/{audit_plan_name}/trigger [post]
func TriggerAuditPlan(c echo.Context) error {
- projectName := c.Param("project_name")
- apName := c.Param("audit_plan_name")
-
- s := model.GetStorage()
- archived, err := s.IsProjectArchived(projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if archived {
- return controller.JSONBaseErrorReq(c, ErrProjectArchived)
- }
+ apName := c.Param("audit_plan_name")
- ap, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectName, apName, 0)
+ ap, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectUid, apName, "")
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -1139,44 +1103,6 @@ func TriggerAuditPlan(c echo.Context) error {
})
}
-// deprecated. will be removed when sqle-ee is not referenced.
-func CheckCurrentUserCanAccessAuditPlan(c echo.Context, apName string, opCode int) error {
- storage := model.GetStorage()
-
- ap, exist, err := storage.GetAuditPlanByName(apName)
- if err != nil {
- return err
- }
- if !exist {
- return errAuditPlanNotExist
- }
-
- if controller.GetUserName(c) == model.DefaultAdminUser {
- return nil
- }
-
- user, err := controller.GetCurrentUser(c)
- if err != nil {
- return err
- }
-
- if ap.CreateUserID == user.ID {
- return nil
- }
- if opCode > 0 {
- instances, err := storage.GetUserCanOpInstances(user, []uint{uint(opCode)})
- if err != nil {
- return controller.JSONBaseErrorReq(c, errors.NewUserNotPermissionError(model.GetOperationCodeDesc(uint(opCode))))
- }
- for _, instance := range instances {
- if ap.InstanceName == instance.Name {
- return nil
- }
- }
- }
- return nil
-}
-
type UpdateAuditPlanNotifyConfigReqV1 struct {
NotifyInterval *int `json:"notify_interval" default:"10"`
NotifyLevel *string `json:"notify_level" default:"warn" enums:"normal,notice,warn,error" valid:"oneof=normal notice warn error"`
@@ -1202,19 +1128,15 @@ func UpdateAuditPlanNotifyConfig(c echo.Context) error {
return err
}
- projectName := c.Param("project_name")
- apName := c.Param("audit_plan_name")
-
- storage := model.GetStorage()
- archived, err := storage.IsProjectArchived(projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if archived {
- return controller.JSONBaseErrorReq(c, ErrProjectArchived)
- }
+ apName := c.Param("audit_plan_name")
- ap, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectName, apName, 0)
+ storage := model.GetStorage()
+
+ ap, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectUid, apName, "")
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -1270,10 +1192,13 @@ type GetAuditPlanNotifyConfigResDataV1 struct {
// @Success 200 {object} v1.GetAuditPlanNotifyConfigResV1
// @router /v1/projects/{project_name}/audit_plans/{audit_plan_name}/notify_config [get]
func GetAuditPlanNotifyConfig(c echo.Context) error {
- projectName := c.Param("project_name")
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
apName := c.Param("audit_plan_name")
- ap, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectName, apName, model.OP_AUDIT_PLAN_VIEW_OTHERS)
+ ap, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectUid, apName, v1.OpPermissionTypeViewOtherAuditPlan)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -1314,10 +1239,13 @@ type TestAuditPlanNotifyConfigResDataV1 struct {
// @Success 200 {object} v1.TestAuditPlanNotifyConfigResV1
// @router /v1/projects/{project_name}/audit_plans/{audit_plan_name}/notify_config/test [get]
func TestAuditPlanNotifyConfig(c echo.Context) error {
- projectName := c.Param("project_name")
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
apName := c.Param("audit_plan_name")
- ap, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectName, apName, 0)
+ ap, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectUid, apName, "")
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -1325,12 +1253,11 @@ func TestAuditPlanNotifyConfig(c echo.Context) error {
return controller.JSONBaseErrorReq(c, errAuditPlanNotExist)
}
- s := model.GetStorage()
- user, exist, err := s.GetUserByID(ap.CreateUserID)
+ // s := model.GetStorage()
+ _, err = controller.GetCurrentUser(c, dms.GetUser)
if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
+ // return controller.JSONBaseErrorReq(c, err)
+ // dms-todo: 需要判断用户是否存在,dms提供
return c.JSON(http.StatusOK, TestAuditPlanNotifyConfigResV1{
BaseRes: controller.NewBaseReq(nil),
Data: TestAuditPlanNotifyConfigResDataV1{
@@ -1339,8 +1266,14 @@ func TestAuditPlanNotifyConfig(c echo.Context) error {
},
})
}
- ap.CreateUser = user
+ // user, exist, err := s.GetUserByID(ap.CreateUserID)
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
+
+ // dms-todo: notification
+ // ap.CreateUser = user
err = notification.GetAuditPlanNotifier().Send(¬ification.TestNotify{}, ap)
if err != nil {
return c.JSON(http.StatusOK, TestAuditPlanNotifyConfigResV1{
@@ -1434,10 +1367,13 @@ func GetAuditPlanSQLs(c echo.Context) error {
return err
}
- projectName := c.Param("project_name")
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
apName := c.Param("audit_plan_name")
- ap, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectName, apName, model.OP_AUDIT_PLAN_VIEW_OTHERS)
+ ap, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectUid, apName, v1.OpPermissionTypeViewOtherAuditPlan)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -1515,10 +1451,13 @@ func GetAuditPlanReportSQLsV1(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
- projectName := c.Param("project_name")
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
apName := c.Param("audit_plan_name")
- ap, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectName, apName, model.OP_AUDIT_PLAN_VIEW_OTHERS)
+ ap, exist, err := GetAuditPlanIfCurrentUserCanAccess(c, projectUid, apName, v1.OpPermissionTypeViewOtherAuditPlan)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -1606,7 +1545,7 @@ func ExportAuditPlanReportV1(c echo.Context) error {
{"审核结果评分", strconv.FormatInt(int64(reportInfo.Score), 10)},
{"审核通过率", fmt.Sprintf("%v%%", reportInfo.PassRate*100)},
{"所属项目", projectName},
- {"扫描任务创建人", utils.AddDelTag(reportInfo.AuditPlan.CreateUser.DeletedAt, reportInfo.AuditPlan.CreateUser.Name)},
+ {"扫描任务创建人", dms.GetUserNameWithDelTag(reportInfo.AuditPlan.CreateUserID)},
{"扫描任务类型", reportInfo.AuditPlan.Type},
{"数据库类型", reportInfo.AuditPlan.DBType},
{"审核的数据库", reportInfo.AuditPlan.InstanceDatabase},
diff --git a/sqle/api/controller/v1/auth.go b/sqle/api/controller/v1/auth.go
deleted file mode 100644
index 6740b286fa..0000000000
--- a/sqle/api/controller/v1/auth.go
+++ /dev/null
@@ -1,333 +0,0 @@
-package v1
-
-import (
- "crypto/tls"
- _errors "errors"
- "fmt"
- "net/http"
- "time"
-
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper"
- "github.com/actiontech/sqle/sqle/api/controller"
- "github.com/actiontech/sqle/sqle/errors"
- "github.com/actiontech/sqle/sqle/model"
- "github.com/actiontech/sqle/sqle/utils"
-
- "github.com/go-ldap/ldap/v3"
- "github.com/labstack/echo/v4"
-)
-
-type UserLoginReqV1 struct {
- UserName string `json:"username" form:"username" example:"test" valid:"required"`
- Password string `json:"password" form:"password" example:"123456" valid:"required"`
-}
-
-type GetUserLoginResV1 struct {
- controller.BaseRes
- Data UserLoginResV1 `json:"data"`
-}
-
-type UserLoginResV1 struct {
- Token string `json:"token" example:"this is a jwt token string"`
-}
-
-// @Summary 用户登录
-// @Description user login
-// @Tags user
-// @Id loginV1
-// @Param user body v1.UserLoginReqV1 true "user login request"
-// @Success 200 {object} v1.GetUserLoginResV1
-// @router /v1/login [post]
-func LoginV1(c echo.Context) error {
- req := new(UserLoginReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
-
- t, err := Login(c, req.UserName, req.Password)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- return c.JSON(http.StatusOK, &GetUserLoginResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: UserLoginResV1{
- Token: t, // this token won't be used any more
- },
- })
-}
-
-func Login(c echo.Context, userName, password string) (token string, err error) {
- loginChecker, err := GetLoginCheckerByUserName(userName)
- if err != nil {
- return "", errors.New(errors.LoginAuthFail, err)
- }
- err = loginChecker.login(password)
- if err != nil {
- return "", errors.New(errors.LoginAuthFail, err)
- }
-
- token, err = generateToken(userName)
- if err != nil {
- return "", errors.New(http.StatusInternalServerError, err)
- }
-
- SetCookie(c, token)
-
- return
-}
-
-func SetCookie(c echo.Context, token string) {
- c.SetCookie(&http.Cookie{
- Name: "sqle-token",
- Value: token,
- Expires: time.Now().Add(tokenLifeTime),
- Path: "/",
- })
-}
-
-const tokenLifeTime = time.Hour * 24
-
-func generateToken(userName string) (string, error) {
- j := utils.NewJWT(utils.JWTSecretKey)
- return j.CreateToken(userName, time.Now().Add(tokenLifeTime).Unix())
-}
-
-// GetLoginCheckerByUserName get login checker by user name and init login checker
-func GetLoginCheckerByUserName(userName string) (LoginChecker, error) {
- // get user metadata and config
- s := model.GetStorage()
- user, userExist, err := s.GetUserByName(userName)
- if err != nil {
- return nil, err
- }
- ldapC, ldapExist, err := s.GetLDAPConfiguration()
- if err != nil {
- return nil, err
- }
-
- checkerType := loginCheckerTypeUnknown
- exist := false
- { // get login checker type
- var u *model.User = nil
- var l *model.LDAPConfiguration = nil
- if userExist {
- u = user
- }
- if ldapExist {
- l = ldapC
- }
- checkerType, exist = getLoginCheckerType(u, l)
- }
-
- // match login method
- switch checkerType {
- case loginCheckerTypeLDAP:
- if !exist {
- return newLdapLoginV3WhenUserNotExist(ldapC, userName), nil
- }
- return newLdapLoginV3WhenUserExist(ldapC, user), nil
- case loginCheckerTypeSQLE:
- return newSqleLogin(user), nil
- default:
- return nil, fmt.Errorf("the user does not exist or the password is wrong")
- }
-}
-
-type checkerType int
-
-const (
- loginCheckerTypeUnknown checkerType = iota
- loginCheckerTypeSQLE
- loginCheckerTypeLDAP
-)
-
-// determine whether the login conditions are met according to the order of login priority
-func getLoginCheckerType(user *model.User, ldapC *model.LDAPConfiguration) (checkerType checkerType, userExist bool) {
-
- // ldap login condition
- if ldapC != nil && ldapC.Enable {
- if user != nil && user.UserAuthenticationType == model.UserAuthenticationTypeLDAP {
- return loginCheckerTypeLDAP, true
- }
- if user == nil {
- return loginCheckerTypeLDAP, false
- }
- }
-
- // sqle login condition, oauth 2 and other login types of users can also log in through the account and password
- if user != nil && (user.UserAuthenticationType != model.UserAuthenticationTypeLDAP) {
- return loginCheckerTypeSQLE, true
- }
-
- // no alternative login method
- return loginCheckerTypeUnknown, user != nil
-}
-
-type LoginChecker interface {
- login(password string) (err error)
-}
-
-type baseLoginChecker struct {
- user *model.User
-}
-
-// ldapLoginV3 version 3 ldap login verification logic.
-type ldapLoginV3 struct {
- baseLoginChecker
- config *model.LDAPConfiguration
- email string
- userExist bool
-}
-
-func newLdapLoginV3WhenUserExist(configuration *model.LDAPConfiguration, user *model.User) *ldapLoginV3 {
- return &ldapLoginV3{
- config: configuration,
- userExist: true,
- baseLoginChecker: baseLoginChecker{
- user: user,
- },
- }
-}
-
-func newLdapLoginV3WhenUserNotExist(configuration *model.LDAPConfiguration, userName string) *ldapLoginV3 {
- return &ldapLoginV3{
- config: configuration,
- userExist: false,
- baseLoginChecker: baseLoginChecker{
- user: &model.User{
- Name: userName,
- },
- },
- }
-}
-
-func (l *ldapLoginV3) login(password string) (err error) {
- err = l.loginToLdap(password)
- if err != nil {
- return err
- }
- return l.autoRegisterUser(password)
-}
-
-var errLdapLoginFailed = _errors.New("ldap login failed, username and password do not match")
-
-const ldapServerErrorFormat = "search user on ldap server failed: %v"
-
-func (l *ldapLoginV3) loginToLdap(password string) (err error) {
- ldapC, _, err := model.GetStorage().GetLDAPConfiguration()
- if err != nil {
- return err
- }
-
- var conn *ldap.Conn
- if l.config.EnableSSL {
- url := fmt.Sprintf("ldaps://%s:%s", ldapC.Host, ldapC.Port)
- conn, err = ldap.DialURL(url, ldap.DialWithTLSConfig(&tls.Config{InsecureSkipVerify: true}))
- } else {
- url := fmt.Sprintf("ldap://%s:%s", ldapC.Host, ldapC.Port)
- conn, err = ldap.DialURL(url)
- }
- if err != nil {
- return fmt.Errorf("get ldap server connect failed: %v", err)
- }
- defer conn.Close()
-
- if err = conn.Bind(ldapC.ConnectDn, ldapC.ConnectPassword); err != nil {
- return fmt.Errorf("bind ldap manager user failed: %v", err)
- }
- searchRequest := ldap.NewSearchRequest(
- ldapC.BaseDn,
- ldap.ScopeWholeSubtree,
- ldap.NeverDerefAliases,
- 0,
- 0,
- false,
- fmt.Sprintf("(%s=%s)", ldapC.UserNameRdnKey, l.user.Name),
- []string{},
- nil,
- )
- result, err := conn.Search(searchRequest)
- if err != nil {
- return fmt.Errorf(ldapServerErrorFormat, err)
- }
- if len(result.Entries) == 0 {
- return errLdapLoginFailed
- }
- if len(result.Entries) != 1 {
- return fmt.Errorf(ldapServerErrorFormat, "the queried user is not unique, please check whether the relevant configuration is correct")
- }
- userDn := result.Entries[0].DN
- if err = conn.Bind(userDn, password); err != nil {
- return errLdapLoginFailed
- }
- l.email = result.Entries[0].GetAttributeValue(ldapC.UserEmailRdnKey)
- return nil
-}
-
-func (l *ldapLoginV3) autoRegisterUser(pwd string) (err error) {
- if l.userExist {
- return l.updateUser(pwd)
- }
- return l.registerUser(pwd)
-}
-
-func (l *ldapLoginV3) registerUser(pwd string) (err error) {
- user := &model.User{
- Name: l.user.Name,
- Password: pwd,
- Email: l.email,
- UserAuthenticationType: model.UserAuthenticationTypeLDAP,
- }
- return model.GetStorage().Save(user)
-}
-
-func (l *ldapLoginV3) updateUser(pwd string) (err error) {
- if l.user.Password == pwd {
- return nil
- }
- return model.GetStorage().UpdatePassword(l.user, pwd)
-}
-
-// sqleLogin sqle login verification logic
-type sqleLogin struct {
- baseLoginChecker
-}
-
-func newSqleLogin(user *model.User) *sqleLogin {
- return &sqleLogin{
- baseLoginChecker: baseLoginChecker{
- user: user,
- },
- }
-}
-
-func (s *sqleLogin) login(password string) (err error) {
- if password != s.user.Password {
- return fmt.Errorf("password is wrong or user does not exist")
- }
- return nil
-}
-
-// LogoutV1
-// @Summary 用户登出
-// @Description user logout
-// @Tags user
-// @Id logoutV1
-// @Success 200 {object} controller.BaseRes
-// @router /v1/logout [post]
-func LogoutV1(c echo.Context) error {
- return c.JSON(http.StatusOK, controller.NewBaseReq(logout(c)))
-}
-
-func logout(c echo.Context) error {
- cookie, err := c.Cookie("sqle-token")
- if err != nil {
- return err
- }
- cookie.MaxAge = -1 // MaxAge<0 means delete cookie now
- cookie.Path = "/"
- c.SetCookie(cookie)
- cloudbeaver_wrapper.UnbindCBSessionIdBySqleToken(cookie.Value)
- return nil
-}
diff --git a/sqle/api/controller/v1/configuration.go b/sqle/api/controller/v1/configuration.go
index 7b4f177988..84d8b2ef72 100644
--- a/sqle/api/controller/v1/configuration.go
+++ b/sqle/api/controller/v1/configuration.go
@@ -4,258 +4,18 @@ import (
"fmt"
"net/http"
"strconv"
- "strings"
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/service"
"github.com/actiontech/sqle/sqle/api/controller"
"github.com/actiontech/sqle/sqle/driver"
- "github.com/actiontech/sqle/sqle/errors"
+
"github.com/actiontech/sqle/sqle/model"
- "github.com/actiontech/sqle/sqle/notification"
+
"github.com/actiontech/sqle/sqle/pkg/im"
"github.com/actiontech/sqle/sqle/pkg/im/dingding"
- "github.com/actiontech/sqle/sqle/pkg/im/feishu"
"github.com/labstack/echo/v4"
- larkContact "github.com/larksuite/oapi-sdk-go/v3/service/contact/v3"
)
-type UpdateSMTPConfigurationReqV1 struct {
- EnableSMTPNotify *bool `json:"enable_smtp_notify" from:"enable_smtp_notify" description:"是否启用邮件通知"`
- Host *string `json:"smtp_host" form:"smtp_host" example:"smtp.email.qq.com"`
- Port *string `json:"smtp_port" form:"smtp_port" example:"465" valid:"omitempty,port"`
- Username *string `json:"smtp_username" form:"smtp_username" example:"test@qq.com" valid:"omitempty,email"`
- Password *string `json:"smtp_password" form:"smtp_password" example:"123"`
- IsSkipVerify *bool `json:"is_skip_verify" form:"is_skip_verify" description:"是否跳过安全认证"`
-}
-
-// @Summary 添加 SMTP 配置
-// @Description update SMTP configuration
-// @Accept json
-// @Id updateSMTPConfigurationV1
-// @Tags configuration
-// @Security ApiKeyAuth
-// @Param instance body v1.UpdateSMTPConfigurationReqV1 true "update SMTP configuration req"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/configurations/smtp [patch]
-func UpdateSMTPConfiguration(c echo.Context) error {
- req := new(UpdateSMTPConfigurationReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
- s := model.GetStorage()
- smtpC, _, err := s.GetSMTPConfiguration()
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- { // disable
- if req.EnableSMTPNotify != nil && !(*req.EnableSMTPNotify) {
- // It is never possible to trigger an error here
- _ = smtpC.EnableSMTPNotify.Scan(false)
- return controller.JSONBaseErrorReq(c, s.Save(smtpC))
- }
- }
-
- if req.Host != nil {
- smtpC.Host = *req.Host
- }
- if req.Port != nil {
- smtpC.Port = *req.Port
- }
- if req.Username != nil {
- smtpC.Username = *req.Username
- }
- if req.Password != nil {
- smtpC.Password = *req.Password
- }
- if req.EnableSMTPNotify != nil {
- // It is never possible to trigger an error here
- _ = smtpC.EnableSMTPNotify.Scan(*req.EnableSMTPNotify)
- }
- if req.IsSkipVerify != nil {
- smtpC.IsSkipVerify = *req.IsSkipVerify
- }
-
- if err := s.Save(smtpC); err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- return controller.JSONBaseErrorReq(c, nil)
-}
-
-type GetSMTPConfigurationResV1 struct {
- controller.BaseRes
- Data SMTPConfigurationResV1 `json:"data"`
-}
-
-type SMTPConfigurationResV1 struct {
- EnableSMTPNotify bool `json:"enable_smtp_notify"`
- Host string `json:"smtp_host"`
- Port string `json:"smtp_port"`
- Username string `json:"smtp_username"`
- IsSkipVerify bool `json:"is_skip_verify"`
-}
-
-// @Summary 获取 SMTP 配置
-// @Description get SMTP configuration
-// @Id getSMTPConfigurationV1
-// @Tags configuration
-// @Security ApiKeyAuth
-// @Success 200 {object} v1.GetSMTPConfigurationResV1
-// @router /v1/configurations/smtp [get]
-func GetSMTPConfiguration(c echo.Context) error {
- s := model.GetStorage()
- smtpC, _, err := s.GetSMTPConfiguration()
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- return c.JSON(http.StatusOK, &GetSMTPConfigurationResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: SMTPConfigurationResV1{
- EnableSMTPNotify: smtpC.EnableSMTPNotify.Bool,
- Host: smtpC.Host,
- Port: smtpC.Port,
- Username: smtpC.Username,
- IsSkipVerify: smtpC.IsSkipVerify,
- },
- })
-}
-
-type TestSMTPConfigurationReqV1 struct {
- RecipientAddr string `json:"recipient_addr" from:"recipient_addr" description:"消息接收者邮箱地址" valid:"required,email"`
-}
-
-type TestSMTPConfigurationResV1 struct {
- controller.BaseRes
- Data TestSMTPConfigurationResDataV1 `json:"data"`
-}
-
-type TestSMTPConfigurationResDataV1 struct {
- IsSMTPSendNormal bool `json:"is_smtp_send_normal"`
- SendErrorMessage string `json:"send_error_message,omitempty"`
-}
-
-// TestSMTPConfigurationV1 used to test SMTP notifications
-// @Summary 测试 邮箱 配置
-// @Description test SMTP configuration
-// @Accept json
-// @Id testSMTPConfigurationV1
-// @Tags configuration
-// @Security ApiKeyAuth
-// @Param req body v1.TestSMTPConfigurationReqV1 true "test SMTP configuration req"
-// @Success 200 {object} v1.TestSMTPConfigurationResV1
-// @router /v1/configurations/smtp/test [post]
-func TestSMTPConfigurationV1(c echo.Context) error {
- req := new(TestSMTPConfigurationReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
-
- s := model.GetStorage()
- smtpC, exist, err := s.GetSMTPConfiguration()
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return c.JSON(http.StatusOK, &TestSMTPConfigurationResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: newSmtpConnectableResV1(false, "SMTP is not configured"),
- })
- }
-
- if !smtpC.EnableSMTPNotify.Bool {
- return c.JSON(http.StatusOK, &TestSMTPConfigurationResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: newSmtpConnectableResV1(false, "SMTP notice is not enabled"),
- })
- }
-
- addr := req.RecipientAddr
- notifier := ¬ification.EmailNotifier{}
- err = notifier.Notify(¬ification.TestNotify{}, []*model.User{
- {
- Email: addr,
- },
- })
- if err != nil {
- return c.JSON(http.StatusOK, &TestSMTPConfigurationResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: newSmtpConnectableResV1(false, err.Error()),
- })
- }
-
- return c.JSON(http.StatusOK, &TestSMTPConfigurationResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: newSmtpConnectableResV1(true, "ok"),
- })
-}
-
-func newSmtpConnectableResV1(isSendNormal bool, errMsg string) TestSMTPConfigurationResDataV1 {
- return TestSMTPConfigurationResDataV1{
- IsSMTPSendNormal: isSendNormal,
- SendErrorMessage: errMsg,
- }
-}
-
-type TestWeChatConfigurationReqV1 struct {
- RecipientID string `json:"recipient_id" from:"recipient_id" description:"消息接收者企业微信ID"`
-}
-
-type TestWeChatConfigurationResV1 struct {
- controller.BaseRes
- Data TestWeChatConfigurationResDataV1 `json:"data"`
-}
-
-type TestWeChatConfigurationResDataV1 struct {
- IsWeChatSendNormal bool `json:"is_wechat_send_normal"`
- SendErrorMessage string `json:"send_error_message,omitempty"`
-}
-
-// TestWeChatConfigurationV1 used to test WeChat notifications
-// @Summary 测试 企业微信 配置
-// @Description test WeChat configuration
-// @Accept json
-// @Id testWeChatConfigurationV1
-// @Tags configuration
-// @Security ApiKeyAuth
-// @Param instance body v1.TestWeChatConfigurationReqV1 true "test WeChat configuration req"
-// @Success 200 {object} v1.TestWeChatConfigurationResV1
-// @router /v1/configurations/wechat/test [post]
-func TestWeChatConfigurationV1(c echo.Context) error {
- return testWeChatConfigurationV1(c)
-}
-
-func testWeChatConfigurationV1(c echo.Context) error {
- req := new(TestWeChatConfigurationReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
- testID := req.RecipientID
- notifier := ¬ification.WeChatNotifier{}
- err := notifier.Notify(¬ification.TestNotify{}, []*model.User{
- {
- Name: testID,
- WeChatID: testID,
- },
- })
- if err != nil {
- return c.JSON(http.StatusOK, &TestWeChatConfigurationResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: TestWeChatConfigurationResDataV1{
- IsWeChatSendNormal: false,
- SendErrorMessage: err.Error(),
- },
- })
- }
- return c.JSON(http.StatusOK, &TestWeChatConfigurationResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: TestWeChatConfigurationResDataV1{
- IsWeChatSendNormal: true,
- SendErrorMessage: "ok",
- },
- })
-}
-
type GetDingTalkConfigurationResV1 struct {
controller.BaseRes
Data DingTalkConfigurationV1 `json:"data"`
@@ -406,555 +166,106 @@ func TestDingTalkConfigV1(c echo.Context) error {
})
}
-type GetFeishuConfigurationResV1 struct {
- controller.BaseRes
- Data FeishuConfigurationV1 `json:"data"`
-}
-
-type FeishuConfigurationV1 struct {
- AppID string `json:"app_id"`
- IsFeishuNotificationEnabled bool `json:"is_feishu_notification_enabled"`
-}
-
-// GetFeishuConfigurationV1
-// @Summary 获取飞书配置
-// @Description get feishu configuration
-// @Id getFeishuConfigurationV1
-// @Tags configuration
-// @Security ApiKeyAuth
-// @Success 200 {object} v1.GetFeishuConfigurationResV1
-// @router /v1/configurations/feishu [get]
-func GetFeishuConfigurationV1(c echo.Context) error {
- s := model.GetStorage()
- feishuCfg, exist, err := s.GetImConfigByType(model.ImTypeFeishu)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return c.JSON(http.StatusOK, &GetFeishuConfigurationResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: FeishuConfigurationV1{},
- })
- }
-
- return c.JSON(http.StatusOK, &GetFeishuConfigurationResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: FeishuConfigurationV1{
- AppID: feishuCfg.AppKey,
- IsFeishuNotificationEnabled: feishuCfg.IsEnable,
- },
- })
-}
-
-type UpdateFeishuConfigurationReqV1 struct {
- AppID *string `json:"app_id" form:"app_id" validate:"required" description:"飞书应用ID"`
- AppSecret *string `json:"app_secret" form:"app_secret" validate:"required" description:"飞书应用Secret"`
- IsFeishuNotificationEnabled *bool `json:"is_feishu_notification_enabled" from:"is_feishu_notification_enabled" validate:"required" description:"是否启用飞书推送"`
+type UpdateSystemVariablesReqV1 struct {
+ WorkflowExpiredHours *int `json:"workflow_expired_hours" form:"workflow_expired_hours" example:"720"`
+ Url *string `json:"url" form:"url" example:"http://10.186.61.32:8080" validate:"url"`
+ OperationRecordExpiredHours *int `json:"operation_record_expired_hours" form:"operation_record_expired_hours" example:"2160"`
}
-// UpdateFeishuConfigurationV1
-// @Summary 添加或更新飞书配置
-// @Description update feishu configuration
+// @Summary 修改系统变量
+// @Description update system variables
// @Accept json
-// @Id updateFeishuConfigurationV1
+// @Id updateSystemVariablesV1
// @Tags configuration
// @Security ApiKeyAuth
-// @Param param body v1.UpdateFeishuConfigurationReqV1 true "update feishu configuration req"
+// @Param instance body v1.UpdateSystemVariablesReqV1 true "update system variables request"
// @Success 200 {object} controller.BaseRes
-// @router /v1/configurations/feishu [patch]
-func UpdateFeishuConfigurationV1(c echo.Context) error {
- req := new(UpdateFeishuConfigurationReqV1)
+// @router /v1/configurations/system_variables [patch]
+func UpdateSystemVariables(c echo.Context) error {
+ req := new(UpdateSystemVariablesReqV1)
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
+
s := model.GetStorage()
- feishuCfg, _, err := s.GetImConfigByType(model.ImTypeFeishu)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- { // disable
- if req.IsFeishuNotificationEnabled != nil && !(*req.IsFeishuNotificationEnabled) {
- feishuCfg.IsEnable = false
- return controller.JSONBaseErrorReq(c, s.Save(feishuCfg))
- }
+ var systemVariables []model.SystemVariable
+ if req.WorkflowExpiredHours != nil {
+ systemVariables = append(systemVariables, model.SystemVariable{
+ Key: model.SystemVariableWorkflowExpiredHours,
+ Value: fmt.Sprintf("%v", *req.WorkflowExpiredHours),
+ })
}
- if req.AppID != nil {
- feishuCfg.AppKey = *req.AppID
- }
- if req.AppSecret != nil {
- feishuCfg.AppSecret = *req.AppSecret
+ if req.OperationRecordExpiredHours != nil {
+ systemVariables = append(systemVariables, model.SystemVariable{
+ Key: model.SystemVariableOperationRecordExpiredHours,
+ Value: strconv.Itoa(*req.OperationRecordExpiredHours),
+ })
}
- if req.IsFeishuNotificationEnabled != nil {
- feishuCfg.IsEnable = *req.IsFeishuNotificationEnabled
+
+ if req.Url != nil {
+ systemVariables = append(systemVariables, model.SystemVariable{
+ Key: model.SystemVariableSqleUrl,
+ Value: *req.Url,
+ })
}
- feishuCfg.Type = model.ImTypeFeishu
- if err := s.Save(feishuCfg); err != nil {
+ if err := s.PathSaveSystemVariables(systemVariables); err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- return controller.JSONBaseErrorReq(c, nil)
-}
-
-type TestFeishuConfigurationReqV1 struct {
- AccountType string `json:"account_type" form:"account_type" enums:"email,phone" valid:"required"`
- Account string `json:"account" form:"account" valid:"required" description:"绑定了飞书的手机号或邮箱"`
-}
-type TestFeishuConfigResDataV1 struct {
- IsMessageSentNormally bool `json:"is_message_sent_normally"`
- ErrorMessage string `json:"error_message,omitempty"`
+ return controller.JSONBaseErrorReq(c, nil)
}
-type TestFeishuConfigResV1 struct {
+type GetSystemVariablesResV1 struct {
controller.BaseRes
- Data TestFeishuConfigResDataV1 `json:"data"`
+ Data SystemVariablesResV1 `json:"data"`
}
-const (
- FeishuAccountTypeEmail = "email"
- FeishuAccountTypePhone = "phone"
-)
+type SystemVariablesResV1 struct {
+ WorkflowExpiredHours int `json:"workflow_expired_hours"`
+ Url string `json:"url"`
+ OperationRecordExpiredHours int `json:"operation_record_expired_hours"`
+}
-// TestFeishuConfigV1
-// @Summary 测试飞书配置
-// @Description test feishu configuration
-// @Accept json
-// @Id testFeishuConfigV1
+// @Summary 获取系统变量
+// @Description get system variables
+// @Id getSystemVariablesV1
// @Tags configuration
// @Security ApiKeyAuth
-// @Param req body v1.TestFeishuConfigurationReqV1 true "test feishu configuration req"
-// @Success 200 {object} v1.TestFeishuConfigResV1
-// @router /v1/configurations/feishu/test [post]
-func TestFeishuConfigV1(c echo.Context) error {
- req := new(TestFeishuConfigurationReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- var email, phone []string
- switch req.AccountType {
- case FeishuAccountTypeEmail:
- err := controller.Validate(struct {
- Email string `valid:"email"`
- }{req.Account})
- if err != nil {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataInvalid, err))
- }
- email = append(email, req.Account)
- case FeishuAccountTypePhone:
- phone = append(phone, req.Account)
- default:
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataInvalid, fmt.Errorf("unknown account type: %v", req.AccountType)))
- }
-
+// @Success 200 {object} v1.GetSystemVariablesResV1
+// @router /v1/configurations/system_variables [get]
+func GetSystemVariables(c echo.Context) error {
s := model.GetStorage()
- feishuCfg, exist, err := s.GetImConfigByType(model.ImTypeFeishu)
+ systemVariables, err := s.GetAllSystemVariables()
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return c.JSON(http.StatusOK, &TestFeishuConfigResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: TestFeishuConfigResDataV1{
- IsMessageSentNormally: false,
- ErrorMessage: "feishu configuration doesn't exist",
- },
- })
- }
- client := feishu.NewFeishuClient(feishuCfg.AppKey, feishuCfg.AppSecret)
- feishuUsers, err := client.GetUsersByEmailOrMobileWithLimitation(email, phone, larkContact.UserIdTypeGetUserUserId)
+ expiredHours, err := strconv.Atoi(systemVariables[model.SystemVariableWorkflowExpiredHours].Value)
if err != nil {
- return c.JSON(http.StatusOK, &TestFeishuConfigResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: TestFeishuConfigResDataV1{
- IsMessageSentNormally: false,
- ErrorMessage: fmt.Sprintf("get user_ids failed: %v", err),
- },
- })
- }
-
- if len(feishuUsers) == 0 {
- return c.JSON(http.StatusOK, &TestFeishuConfigResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: TestFeishuConfigResDataV1{
- IsMessageSentNormally: false,
- ErrorMessage: "can not find matched feishu user",
- },
- })
+ return controller.JSONBaseErrorReq(c, err)
}
- n := ¬ification.TestNotify{}
- content, err := notification.BuildFeishuMessageBody(n)
+ operationRecordExpiredHours, err := strconv.Atoi(systemVariables[model.SystemVariableOperationRecordExpiredHours].Value)
if err != nil {
- return c.JSON(http.StatusOK, &TestFeishuConfigResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: TestFeishuConfigResDataV1{
- IsMessageSentNormally: false,
- ErrorMessage: fmt.Sprintf("convert content failed: %v", err),
- },
- })
- }
- for uid := range feishuUsers {
- if err = client.SendMessage(feishu.FeishuReceiverIdTypeUserId, uid, feishu.FeishuSendMessageMsgTypePost, content); err != nil {
- return c.JSON(http.StatusOK, &TestFeishuConfigResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: TestFeishuConfigResDataV1{
- IsMessageSentNormally: false,
- ErrorMessage: err.Error(),
- },
- })
- }
+ return controller.JSONBaseErrorReq(c, err)
}
- return c.JSON(http.StatusOK, &TestFeishuConfigResV1{
+ return c.JSON(http.StatusOK, &GetSystemVariablesResV1{
BaseRes: controller.NewBaseReq(nil),
- Data: TestFeishuConfigResDataV1{
- IsMessageSentNormally: true,
+ Data: SystemVariablesResV1{
+ WorkflowExpiredHours: expiredHours,
+ Url: systemVariables[model.SystemVariableSqleUrl].Value,
+ OperationRecordExpiredHours: operationRecordExpiredHours,
},
})
-
}
-type UpdateWeChatConfigurationReqV1 struct {
- EnableWeChatNotify *bool `json:"enable_wechat_notify" from:"enable_wechat_notify" description:"是否启用微信通知"`
- CorpID *string `json:"corp_id" from:"corp_id" description:"企业微信ID"`
- CorpSecret *string `json:"corp_secret" from:"corp_secret" description:"企业微信ID对应密码"`
- AgentID *int `json:"agent_id" from:"agent_id" description:"企业微信应用ID"`
- SafeEnabled *bool `json:"safe_enabled" from:"safe_enabled" description:"是否对传输信息加密"`
- ProxyIP *string `json:"proxy_ip" from:"proxy_ip" description:"企业微信代理服务器IP"`
-}
-
-// UpdateWeChatConfigurationV1 used to configure WeChat notifications
-// @Summary 添加 企业微信 配置
-// @Description update WeChat configuration
-// @Accept json
-// @Id updateWeChatConfigurationV1
-// @Tags configuration
-// @Security ApiKeyAuth
-// @Param instance body v1.UpdateWeChatConfigurationReqV1 true "update WeChat configuration req"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/configurations/wechat [patch]
-func UpdateWeChatConfigurationV1(c echo.Context) error {
- return updateWeChatConfigurationV1(c)
-}
-
-func updateWeChatConfigurationV1(c echo.Context) error {
- req := new(UpdateWeChatConfigurationReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
- s := model.GetStorage()
- wechatC, _, err := s.GetWeChatConfiguration()
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- { // disable
- if req.EnableWeChatNotify != nil && !(*req.EnableWeChatNotify) {
- wechatC.EnableWeChatNotify = false
- return controller.JSONBaseErrorReq(c, s.Save(wechatC))
- }
- }
-
- if req.CorpID != nil {
- wechatC.CorpID = *req.CorpID
- }
- if req.CorpSecret != nil {
- wechatC.CorpSecret = *req.CorpSecret
- }
- if req.AgentID != nil {
- wechatC.AgentID = *req.AgentID
- }
- if req.ProxyIP != nil {
- wechatC.ProxyIP = *req.ProxyIP
- }
- if req.EnableWeChatNotify != nil {
- wechatC.EnableWeChatNotify = *req.EnableWeChatNotify
- }
- if req.SafeEnabled != nil {
- wechatC.SafeEnabled = *req.SafeEnabled
- }
-
- if err := s.Save(wechatC); err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- return controller.JSONBaseErrorReq(c, nil)
-}
-
-type GetWeChatConfigurationResV1 struct {
- controller.BaseRes
- Data WeChatConfigurationResV1 `json:"data"`
-}
-
-type WeChatConfigurationResV1 struct {
- EnableWeChatNotify bool `json:"enable_wechat_notify"`
- CorpID string `json:"corp_id"`
- AgentID int `json:"agent_id"`
- SafeEnabled bool `json:"safe_enabled"`
- ProxyIP string `json:"proxy_ip"`
-}
-
-// GetWeChatConfiguration used to get wechat configure
-// @Summary 获取 企业微信 配置
-// @Description get WeChat configuration
-// @Id getWeChatConfigurationV1
-// @Tags configuration
-// @Security ApiKeyAuth
-// @Success 200 {object} v1.GetWeChatConfigurationResV1
-// @router /v1/configurations/wechat [get]
-func GetWeChatConfiguration(c echo.Context) error {
- return getWeChatConfiguration(c)
-}
-
-func getWeChatConfiguration(c echo.Context) error {
- s := model.GetStorage()
- wechatC, _, err := s.GetWeChatConfiguration()
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- return c.JSON(http.StatusOK, &GetWeChatConfigurationResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: WeChatConfigurationResV1{
- EnableWeChatNotify: wechatC.EnableWeChatNotify,
- CorpID: wechatC.CorpID,
- AgentID: wechatC.AgentID,
- SafeEnabled: wechatC.SafeEnabled,
- ProxyIP: wechatC.ProxyIP,
- },
- })
-}
-
-type GetLDAPConfigurationResV1 struct {
- controller.BaseRes
- Data LDAPConfigurationResV1 `json:"data"`
-}
-
-type LDAPConfigurationReqV1 struct {
- EnableLdap *bool `json:"enable_ldap"`
- EnableSSL *bool `json:"enable_ssl"`
- LdapServerHost *string `json:"ldap_server_host"`
- LdapServerPort *string `json:"ldap_server_port"`
- LdapConnectDn *string `json:"ldap_connect_dn"`
- LdapConnectPwd *string `json:"ldap_connect_pwd"`
- LdapSearchBaseDn *string `json:"ldap_search_base_dn"`
- LdapUserNameRdnKey *string `json:"ldap_user_name_rdn_key"`
- LdapUserEmailRdnKey *string `json:"ldap_user_email_rdn_key"`
-}
-
-type LDAPConfigurationResV1 struct {
- EnableLdap bool `json:"enable_ldap"`
- EnableSSL bool `json:"enable_ssl"`
- LdapServerHost string `json:"ldap_server_host"`
- LdapServerPort string `json:"ldap_server_port"`
- LdapConnectDn string `json:"ldap_connect_dn"`
- LdapSearchBaseDn string `json:"ldap_search_base_dn"`
- LdapUserNameRdnKey string `json:"ldap_user_name_rdn_key"`
- LdapUserEmailRdnKey string `json:"ldap_user_email_rdn_key"`
-}
-
-// @Summary 获取 LDAP 配置
-// @Description get LDAP configuration
-// @Id getLDAPConfigurationV1
-// @Tags configuration
-// @Security ApiKeyAuth
-// @Success 200 {object} v1.GetLDAPConfigurationResV1
-// @router /v1/configurations/ldap [get]
-func GetLDAPConfiguration(c echo.Context) error {
- s := model.GetStorage()
- ldapC, _, err := s.GetLDAPConfiguration()
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- return c.JSON(http.StatusOK, &GetLDAPConfigurationResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: LDAPConfigurationResV1{
- EnableLdap: ldapC.Enable,
- EnableSSL: ldapC.EnableSSL,
- LdapServerHost: ldapC.Host,
- LdapServerPort: ldapC.Port,
- LdapConnectDn: ldapC.ConnectDn,
- LdapSearchBaseDn: ldapC.BaseDn,
- LdapUserNameRdnKey: ldapC.UserNameRdnKey,
- LdapUserEmailRdnKey: ldapC.UserEmailRdnKey,
- },
- })
-}
-
-// @Summary 添加 LDAP 配置
-// @Description update LDAP configuration
-// @Accept json
-// @Id updateLDAPConfigurationV1
-// @Tags configuration
-// @Security ApiKeyAuth
-// @Param instance body v1.LDAPConfigurationReqV1 true "update LDAP configuration req"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/configurations/ldap [patch]
-func UpdateLDAPConfiguration(c echo.Context) error {
- req := new(LDAPConfigurationReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
- s := model.GetStorage()
- ldapC, _, err := s.GetLDAPConfiguration()
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- { // disable
- if req.EnableLdap != nil && !(*req.EnableLdap) {
- ldapC.Enable = false
- return controller.JSONBaseErrorReq(c, s.Save(ldapC))
- }
- }
-
- { // patch ldap config
-
- if req.EnableLdap != nil {
- ldapC.Enable = *req.EnableLdap
- }
-
- if req.EnableSSL != nil {
- ldapC.EnableSSL = *req.EnableSSL
- }
-
- if req.LdapServerHost != nil {
- ldapC.Host = *req.LdapServerHost
- }
-
- if req.LdapServerPort != nil {
- ldapC.Port = *req.LdapServerPort
- }
-
- if req.LdapConnectDn != nil {
- ldapC.ConnectDn = *req.LdapConnectDn
- }
-
- if req.LdapConnectPwd != nil {
- ldapC.ConnectPassword = *req.LdapConnectPwd
- }
-
- if req.LdapSearchBaseDn != nil {
- ldapC.BaseDn = *req.LdapSearchBaseDn
- }
-
- if req.LdapUserNameRdnKey != nil {
- ldapC.UserNameRdnKey = *req.LdapUserNameRdnKey
- }
-
- if req.LdapUserEmailRdnKey != nil {
- ldapC.UserEmailRdnKey = *req.LdapUserEmailRdnKey
- }
-
- }
- if err := s.Save(ldapC); err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- return controller.JSONBaseErrorReq(c, nil)
-}
-
-type UpdateSystemVariablesReqV1 struct {
- WorkflowExpiredHours *int `json:"workflow_expired_hours" form:"workflow_expired_hours" example:"720"`
- Url *string `json:"url" form:"url" example:"http://10.186.61.32:8080" validate:"url"`
- OperationRecordExpiredHours *int `json:"operation_record_expired_hours" form:"operation_record_expired_hours" example:"2160"`
-}
-
-// @Summary 修改系统变量
-// @Description update system variables
-// @Accept json
-// @Id updateSystemVariablesV1
-// @Tags configuration
-// @Security ApiKeyAuth
-// @Param instance body v1.UpdateSystemVariablesReqV1 true "update system variables request"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/configurations/system_variables [patch]
-func UpdateSystemVariables(c echo.Context) error {
- req := new(UpdateSystemVariablesReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
-
- s := model.GetStorage()
-
- var systemVariables []model.SystemVariable
- if req.WorkflowExpiredHours != nil {
- systemVariables = append(systemVariables, model.SystemVariable{
- Key: model.SystemVariableWorkflowExpiredHours,
- Value: fmt.Sprintf("%v", *req.WorkflowExpiredHours),
- })
- }
-
- if req.OperationRecordExpiredHours != nil {
- systemVariables = append(systemVariables, model.SystemVariable{
- Key: model.SystemVariableOperationRecordExpiredHours,
- Value: strconv.Itoa(*req.OperationRecordExpiredHours),
- })
- }
-
- if req.Url != nil {
- systemVariables = append(systemVariables, model.SystemVariable{
- Key: model.SystemVariableSqleUrl,
- Value: *req.Url,
- })
- }
-
- if err := s.PathSaveSystemVariables(systemVariables); err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- return controller.JSONBaseErrorReq(c, nil)
-}
-
-type GetSystemVariablesResV1 struct {
- controller.BaseRes
- Data SystemVariablesResV1 `json:"data"`
-}
-
-type SystemVariablesResV1 struct {
- WorkflowExpiredHours int `json:"workflow_expired_hours"`
- Url string `json:"url"`
- OperationRecordExpiredHours int `json:"operation_record_expired_hours"`
-}
-
-// @Summary 获取系统变量
-// @Description get system variables
-// @Id getSystemVariablesV1
-// @Tags configuration
-// @Security ApiKeyAuth
-// @Success 200 {object} v1.GetSystemVariablesResV1
-// @router /v1/configurations/system_variables [get]
-func GetSystemVariables(c echo.Context) error {
- s := model.GetStorage()
- systemVariables, err := s.GetAllSystemVariables()
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- expiredHours, err := strconv.Atoi(systemVariables[model.SystemVariableWorkflowExpiredHours].Value)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- operationRecordExpiredHours, err := strconv.Atoi(systemVariables[model.SystemVariableOperationRecordExpiredHours].Value)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- return c.JSON(http.StatusOK, &GetSystemVariablesResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: SystemVariablesResV1{
- WorkflowExpiredHours: expiredHours,
- Url: systemVariables[model.SystemVariableSqleUrl].Value,
- OperationRecordExpiredHours: operationRecordExpiredHours,
- },
- })
-}
-
-type GetDriversResV1 struct {
- controller.BaseRes
- Data DriversResV1 `json:"data"`
+type GetDriversResV1 struct {
+ controller.BaseRes
+ Data DriversResV1 `json:"data"`
}
type DriversResV1 struct {
@@ -976,396 +287,16 @@ func GetDrivers(c echo.Context) error {
})
}
-type GetSQLEInfoResV1 struct {
- controller.BaseRes
- Data GetSQLEInfoResDataV1 `json:"data"`
-}
-
-type GetSQLEInfoResDataV1 struct {
- Version string `json:"version"`
- LogoUrl string `json:"logo_url"`
- Title string `json:"title"`
-}
-
-// GetSQLEInfo get sqle basic info
-// @Summary 获取 sqle 基本信息
-// @Description get sqle basic info
-// @Id getSQLEInfoV1
-// @Tags global
-// @Success 200 {object} v1.GetSQLEInfoResV1
-// @router /v1/basic_info [get]
-func GetSQLEInfo(c echo.Context) error {
- return getSQLEInfo(c)
-}
-
-type GetOauth2ConfigurationResV1 struct {
- controller.BaseRes
- Data GetOauth2ConfigurationResDataV1 `json:"data"`
-}
-
-type GetOauth2ConfigurationResDataV1 struct {
- EnableOauth2 bool `json:"enable_oauth2"`
- ClientID string `json:"client_id"`
- ClientHost string `json:"client_host"`
- ServerAuthUrl string `json:"server_auth_url"`
- ServerTokenUrl string `json:"server_token_url"`
- ServerUserIdUrl string `json:"server_user_id_url"`
- Scopes []string `json:"scopes"`
- AccessTokenTag string `json:"access_token_tag"`
- UserIdTag string `json:"user_id_tag"`
- LoginTip string `json:"login_tip"`
-}
-
-// @Summary 获取 Oauth2 配置
-// @Description get Oauth2 configuration
-// @Id getOauth2ConfigurationV1
-// @Tags configuration
-// @Security ApiKeyAuth
-// @Success 200 {object} v1.GetOauth2ConfigurationResV1
-// @router /v1/configurations/oauth2 [get]
-func GetOauth2Configuration(c echo.Context) error {
- s := model.GetStorage()
- oauth2C, _, err := s.GetOauth2Configuration()
- return c.JSON(http.StatusOK, &GetOauth2ConfigurationResV1{
- BaseRes: controller.NewBaseReq(err),
- Data: GetOauth2ConfigurationResDataV1{
- EnableOauth2: oauth2C.EnableOauth2,
- ClientID: oauth2C.ClientID,
- ClientHost: oauth2C.ClientHost,
- ServerAuthUrl: oauth2C.ServerAuthUrl,
- ServerTokenUrl: oauth2C.ServerTokenUrl,
- ServerUserIdUrl: oauth2C.ServerUserIdUrl,
- Scopes: oauth2C.GetScopes(),
- AccessTokenTag: oauth2C.AccessTokenTag,
- UserIdTag: oauth2C.UserIdTag,
- LoginTip: oauth2C.LoginTip,
- },
- })
-}
-
-type Oauth2ConfigurationReqV1 struct {
- EnableOauth2 *bool `json:"enable_oauth2"`
- ClientID *string `json:"client_id"`
- ClientKey *string `json:"client_key"`
- ClientHost *string `json:"client_host"`
- ServerAuthUrl *string `json:"server_auth_url"`
- ServerTokenUrl *string `json:"server_token_url"`
- ServerUserIdUrl *string `json:"server_user_id_url"`
- Scopes *[]string `json:"scopes"`
- AccessTokenTag *string `json:"access_token_tag"`
- UserIdTag *string `json:"user_id_tag"`
- LoginTip *string `json:"login_tip"`
-}
-
-// @Summary 修改 Oauth2 配置
-// @Description update Oauth2 configuration
-// @Accept json
-// @Id updateOauth2ConfigurationV1
-// @Tags configuration
-// @Security ApiKeyAuth
-// @Param conf body v1.Oauth2ConfigurationReqV1 true "update Oauth2 configuration req"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/configurations/oauth2 [patch]
-func UpdateOauth2Configuration(c echo.Context) error {
- req := new(Oauth2ConfigurationReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
- s := model.GetStorage()
- oauth2C, _, err := s.GetOauth2Configuration()
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- { // disable
- if req.EnableOauth2 != nil && !(*req.EnableOauth2) {
- oauth2C.EnableOauth2 = false
- return controller.JSONBaseErrorReq(c, s.Save(oauth2C))
- }
- }
-
- { // patch oauth2 config
- if req.EnableOauth2 != nil {
- oauth2C.EnableOauth2 = *req.EnableOauth2
- }
- if req.ClientID != nil {
- oauth2C.ClientID = *req.ClientID
- }
- if req.ClientKey != nil {
- oauth2C.ClientKey = *req.ClientKey
- }
- if req.ClientHost != nil {
- oauth2C.ClientHost = *req.ClientHost
- }
- if req.ServerAuthUrl != nil {
- oauth2C.ServerAuthUrl = *req.ServerAuthUrl
- }
- if req.ServerTokenUrl != nil {
- oauth2C.ServerTokenUrl = *req.ServerTokenUrl
- }
- if req.ServerUserIdUrl != nil {
- oauth2C.ServerUserIdUrl = *req.ServerUserIdUrl
- }
- if req.Scopes != nil {
- oauth2C.SetScopes(*req.Scopes)
- }
- if req.AccessTokenTag != nil {
- oauth2C.AccessTokenTag = *req.AccessTokenTag
- }
- if req.UserIdTag != nil {
- oauth2C.UserIdTag = *req.UserIdTag
- }
- if req.LoginTip != nil {
- oauth2C.LoginTip = *req.LoginTip
- }
-
- }
-
- return controller.JSONBaseErrorReq(c, s.Save(oauth2C))
-}
-
-type GetOauth2TipsResV1 struct {
- controller.BaseRes
- Data GetOauth2TipsResDataV1 `json:"data"`
-}
-
-type GetOauth2TipsResDataV1 struct {
- EnableOauth2 bool `json:"enable_oauth2"`
- LoginTip string `json:"login_tip"`
-}
-
-// @Summary 获取 Oauth2 基本信息
-// @Description get Oauth2 tips
-// @Id getOauth2Tips
-// @Tags configuration
-// @Success 200 {object} v1.GetOauth2TipsResV1
-// @router /v1/configurations/oauth2/tips [get]
-func GetOauth2Tips(c echo.Context) error {
- s := model.GetStorage()
- oauth2C, _, err := s.GetOauth2Configuration()
- return c.JSON(http.StatusOK, &GetOauth2TipsResV1{
- BaseRes: controller.NewBaseReq(err),
- Data: GetOauth2TipsResDataV1{
- EnableOauth2: oauth2C.EnableOauth2,
- LoginTip: oauth2C.LoginTip,
- },
- })
-}
-
-type GetSQLQueryConfigurationResV1 struct {
- controller.BaseRes
- Data GetSQLQueryConfigurationResDataV1 `json:"data"`
-}
-
-type GetSQLQueryConfigurationResDataV1 struct {
- EnableSQLQuery bool `json:"enable_sql_query"`
- SQLQueryRootURI string `json:"sql_query_root_uri"`
-}
-
-// @Summary 获取SQL查询配置信息
-// @Description get sqle query configuration
-// @Id getSQLQueryConfiguration
-// @Tags configuration
-// @Security ApiKeyAuth
-// @Success 200 {object} v1.GetSQLQueryConfigurationResV1
-// @router /v1/configurations/sql_query [get]
-func GetSQLQueryConfiguration(c echo.Context) error {
- return c.JSON(http.StatusOK, GetSQLQueryConfigurationResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: GetSQLQueryConfigurationResDataV1{
- EnableSQLQuery: service.IsCloudBeaverConfigured(),
- SQLQueryRootURI: service.CbRootUri,
- },
- })
-}
-
-type UploadLogoResV1 struct {
- controller.BaseRes
- Data UploadLogoResDataV1 `json:"data"`
-}
-
-type UploadLogoResDataV1 struct {
- LogoUrl string `json:"logo_url"`
-}
-
-// UploadLogo
-// @Summary 上传Logo
-// @Description upload logo
-// @Id uploadLogo
-// @Tags configuration
-// @Accept mpfd
-// @Security ApiKeyAuth
-// @Param logo formData file true "logo file"
-// @Success 200 {object} v1.UploadLogoResV1
-// @router /v1/configurations/personalise/logo [post]
-func UploadLogo(c echo.Context) error {
- return uploadLogo(c)
-}
-
-type GetLogoReqV1 struct {
- Timestamp string `query:"timestamp"`
-}
-
-// GetLogo
-// @Summary 获取logo
-// @Description get logo
-// @Id getLogo
-// @Tags configuration
-// @Param timestamp query string false "timestamp"
-// @Success 200 {file} file "get logo"
-// @router /v1/static/logo [get]
-func GetLogo(c echo.Context) error {
- return getLogo(c)
-}
-
-type PersonaliseReqV1 struct {
- Title *string `json:"title"`
-}
-
-// UpdatePersonaliseConfig
-// @Summary 更新个性化设置
-// @Description update personalise config
-// @Id personalise
-// @Tags configuration
-// @Security ApiKeyAuth
-// @Param conf body v1.PersonaliseReqV1 true "personalise req"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/configurations/personalise [patch]
-func UpdatePersonaliseConfig(c echo.Context) error {
- return updatePersonaliseConfig(c)
-}
-
-type WebHookConfigV1 struct {
- Enable *bool `json:"enable" description:"是否启用"`
- MaxRetryTimes *int `json:"max_retry_times" description:"最大重试次数"`
- RetryIntervalSeconds *int `json:"retry_interval_seconds" description:"请求重试间隔"`
- Token *string `json:"token" description:"token 令牌"`
- URL *string `json:"url" description:"回调API URL"`
-}
-
-// UpdateWorkflowWebHookConfig
-// @Summary 更新工单 WebHook 配置
-// @Description update webhook config
-// @Id updateGlobalWebHookConfig
-// @Tags configuration
-// @Security ApiKeyAuth
-// @Param request body v1.WebHookConfigV1 true "update webhook config"
-// @Success 200 {object} controller.BaseRes
-// @Router /v1/configurations/webhook [patch]
-func UpdateWorkflowWebHookConfig(c echo.Context) error {
- req := new(WebHookConfigV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
- s := model.GetStorage()
- cfg, _, err := s.GetWorkflowWebHookConfig()
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- {
- if req.Enable != nil && !(*req.Enable) {
- cfg.Enable = false
- return controller.JSONBaseErrorReq(c, s.Save(cfg))
- }
- }
-
- if req.Enable != nil {
- cfg.Enable = *req.Enable
- }
- if req.MaxRetryTimes != nil {
- if *req.MaxRetryTimes < 0 || *req.MaxRetryTimes > 5 {
- err = errors.NewDataInvalidErr(
- "ouf of range[0-5] for max_retry_times[%v]", *req.MaxRetryTimes)
- return controller.JSONBaseErrorReq(c, err)
- }
- cfg.MaxRetryTimes = *req.MaxRetryTimes
- }
- if req.RetryIntervalSeconds != nil {
- if *req.RetryIntervalSeconds < 1 || *req.RetryIntervalSeconds > 5 {
- err = errors.NewDataInvalidErr(
- "out of range[1-5] for retry_interval_seconds[%v]", *req.RetryIntervalSeconds)
- return controller.JSONBaseErrorReq(c, err)
- }
- cfg.RetryIntervalSeconds = *req.RetryIntervalSeconds
- }
- if req.Token != nil {
- cfg.Token = *req.Token
- }
- if req.URL != nil {
- if !strings.HasPrefix(*req.URL, "http://") {
- err = errors.NewDataInvalidErr("url must start with 'http://'")
- return controller.JSONBaseErrorReq(c, err)
- }
- cfg.URL = *req.URL
- }
- return controller.JSONBaseErrorReq(c, s.Save(cfg))
-}
-
-type GetWorkflowWebHookConfigResV1 struct {
- controller.BaseRes
- Data WebHookConfigV1 `json:"data"`
-}
-
-// GetWorkflowWebHookConfig
-// @Summary 获取全局工单 WebHook 配置
-// @Description get workflow webhook config
-// @Id getGlobalWorkflowWebHookConfig
-// @Tags configuration
-// @Security ApiKeyAuth
-// @Success 200 {object} v1.GetWorkflowWebHookConfigResV1
-// @Router /v1/configurations/webhook [get]
-func GetWorkflowWebHookConfig(c echo.Context) error {
- s := model.GetStorage()
- cfg, _, err := s.GetWorkflowWebHookConfig()
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- return c.JSON(http.StatusOK, &GetWorkflowWebHookConfigResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: WebHookConfigV1{
- Enable: &cfg.Enable,
- MaxRetryTimes: &cfg.MaxRetryTimes,
- RetryIntervalSeconds: &cfg.RetryIntervalSeconds,
- Token: &cfg.Token,
- URL: &cfg.URL,
- },
- })
-}
-
-type TestWorkflowWebHookConfigResDataV1 struct {
- SendErrorMessage string `json:"send_error_message,omitempty"`
-}
-
-type TestWorkflowWebHookConfigResV1 struct {
- controller.BaseRes
- Data TestWorkflowWebHookConfigResDataV1 `json:"data"`
-}
-
-// TestWorkflowWebHookConfig
-// @Summary 测试全局工单 WebHook 配置
-// @Description test workflow webhook config
-// @Id testGlobalWorkflowWebHookConfig
-// @Tags configuration
-// @Security ApiKeyAuth
-// @Success 200 {object} v1.TestWorkflowWebHookConfigResV1
-// @Router /v1/configurations/webhook/test [post]
-func TestWorkflowWebHookConfig(c echo.Context) error {
- data := &TestWorkflowWebHookConfigResDataV1{}
- err := notification.TestWorkflowConfig()
- if err != nil {
- data.SendErrorMessage = err.Error()
- }
- return c.JSON(http.StatusOK, &TestWorkflowWebHookConfigResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: *data,
- })
-}
-
type GetFeishuAuditConfigurationResV1 struct {
controller.BaseRes
Data FeishuConfigurationV1 `json:"data"`
}
+type FeishuConfigurationV1 struct {
+ AppID string `json:"app_id"`
+ IsFeishuNotificationEnabled bool `json:"is_feishu_notification_enabled"`
+}
+
// GetFeishuAuditConfigurationV1
// @Summary 获取飞书审核配置
// @Description get feishu audit configuration
@@ -1378,6 +309,12 @@ func GetFeishuAuditConfigurationV1(c echo.Context) error {
return getFeishuAuditConfigurationV1(c)
}
+type UpdateFeishuConfigurationReqV1 struct {
+ AppID *string `json:"app_id" form:"app_id" validate:"required" description:"飞书应用ID"`
+ AppSecret *string `json:"app_secret" form:"app_secret" validate:"required" description:"飞书应用Secret"`
+ IsFeishuNotificationEnabled *bool `json:"is_feishu_notification_enabled" from:"is_feishu_notification_enabled" validate:"required" description:"是否启用飞书推送"`
+}
+
// UpdateFeishuAuditConfigurationV1
// @Summary 添加或更新飞书配置
// @Description update feishu audit configuration
@@ -1392,6 +329,26 @@ func UpdateFeishuAuditConfigurationV1(c echo.Context) error {
return updateFeishuAuditConfigurationV1(c)
}
+type TestFeishuConfigurationReqV1 struct {
+ AccountType string `json:"account_type" form:"account_type" enums:"email,phone" valid:"required"`
+ Account string `json:"account" form:"account" valid:"required" description:"绑定了飞书的手机号或邮箱"`
+}
+
+type TestFeishuConfigResDataV1 struct {
+ IsMessageSentNormally bool `json:"is_message_sent_normally"`
+ ErrorMessage string `json:"error_message,omitempty"`
+}
+
+type TestFeishuConfigResV1 struct {
+ controller.BaseRes
+ Data TestFeishuConfigResDataV1 `json:"data"`
+}
+
+const (
+ FeishuAccountTypeEmail = "email"
+ FeishuAccountTypePhone = "phone"
+)
+
// TestFeishuAuditConfigV1
// @Summary 测试飞书审批配置
// @Description test feishu audit configuration
diff --git a/sqle/api/controller/v1/configuration_ce.go b/sqle/api/controller/v1/configuration_ce.go
index d8d598b967..aa14b95f45 100644
--- a/sqle/api/controller/v1/configuration_ce.go
+++ b/sqle/api/controller/v1/configuration_ce.go
@@ -5,53 +5,17 @@ package v1
import (
e "errors"
- "net/http"
"github.com/actiontech/sqle/sqle/errors"
"github.com/actiontech/sqle/sqle/api/controller"
- "github.com/actiontech/sqle/sqle/config"
"github.com/labstack/echo/v4"
)
var (
- errCommunityEditionNotSupportCostumeLogo = errors.New(errors.EnterpriseEditionFeatures, e.New("costume logo is enterprise version feature"))
- errCommunityEditionNotSupportUpdatePersonaliseConfig = errors.New(errors.EnterpriseEditionFeatures, e.New("update personalise config is enterprise version feature"))
- errCommunityEditionNotSupportFeishuAudit = errors.New(errors.EnterpriseEditionFeatures, e.New("feishu audit is enterprise version feature"))
+ errCommunityEditionNotSupportFeishuAudit = errors.New(errors.EnterpriseEditionFeatures, e.New("feishu audit is enterprise version feature"))
)
-const (
- Title = "SQLE"
-)
-
-func uploadLogo(c echo.Context) error {
- return controller.JSONBaseErrorReq(c, errCommunityEditionNotSupportCostumeLogo)
-}
-
-func getLogo(c echo.Context) error {
- return controller.JSONBaseErrorReq(c, errCommunityEditionNotSupportCostumeLogo)
-}
-
-func updatePersonaliseConfig(c echo.Context) error {
- return controller.JSONBaseErrorReq(c, errCommunityEditionNotSupportUpdatePersonaliseConfig)
-}
-
-func getSQLEInfo(c echo.Context) error {
- logoUrl, err := GetDefaultLogoUrl()
- if err != nil {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist, e.New("no logo file")))
- }
-
- return c.JSON(http.StatusOK, &GetSQLEInfoResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: GetSQLEInfoResDataV1{
- Version: config.Version,
- LogoUrl: logoUrl,
- Title: Title,
- },
- })
-}
-
func updateFeishuAuditConfigurationV1(c echo.Context) error {
return controller.JSONBaseErrorReq(c, errCommunityEditionNotSupportFeishuAudit)
}
diff --git a/sqle/api/controller/v1/configuration_comm.go b/sqle/api/controller/v1/configuration_comm.go
deleted file mode 100644
index 07491267e1..0000000000
--- a/sqle/api/controller/v1/configuration_comm.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package v1
-
-import (
- e "errors"
- "fmt"
- "io/fs"
- "io/ioutil"
- "strings"
-)
-
-const (
- // LogoUrlBase sqle static 服务接口的url前缀
- LogoUrlBase = "/static/media"
-
- // LogoDir sqle logo 的本地目录
- LogoDir = "./ui/static/media"
-)
-
-// GetDefaultLogoUrl 获取默认logo的静态资源url
-func GetDefaultLogoUrl() (string, error) {
- fileInfo, err := getLogoFileInfo()
- if err != nil {
- return "", e.New("failed to get logo file info")
- }
-
- modifyTime := fileInfo.ModTime().Unix()
- return fmt.Sprintf("%s/%s?timestamp=%d", LogoUrlBase, fileInfo.Name(), modifyTime), nil
-}
-
-func getLogoFileInfo() (fs.FileInfo, error) {
- fileInfos, err := ioutil.ReadDir(LogoDir)
- if err != nil {
- return nil, e.New("read logo dir failed")
- }
-
- var hasLogoFile bool
- var logoFileInfo fs.FileInfo
- for _, fileInfo := range fileInfos {
- if strings.HasPrefix(fileInfo.Name(), "logo.") {
- hasLogoFile = true
- logoFileInfo = fileInfo
- break
- }
- }
- if !hasLogoFile {
- return nil, e.New("no logo file")
- }
-
- return logoFileInfo, nil
-}
diff --git a/sqle/api/controller/v1/dashboard.go b/sqle/api/controller/v1/dashboard.go
index 947963e01d..22c9c9933b 100644
--- a/sqle/api/controller/v1/dashboard.go
+++ b/sqle/api/controller/v1/dashboard.go
@@ -2,9 +2,9 @@ package v1
import (
"net/http"
- "sort"
"github.com/actiontech/sqle/sqle/api/controller"
+ dms "github.com/actiontech/sqle/sqle/dms"
"github.com/actiontech/sqle/sqle/model"
"github.com/labstack/echo/v4"
)
@@ -28,7 +28,7 @@ type WorkflowStatisticsResV1 struct {
}
type GetDashboardReqV1 struct {
- FilterProjectName string `json:"filter_project_name" query:"filter_project_name" form:"filter_project_name"`
+ FilterProjectName string `json:"filter_project_id" query:"filter_project_id" form:"filter_project_id"`
}
// @Summary 获取 dashboard 信息
@@ -45,38 +45,42 @@ func Dashboard(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return controller.JSONBaseErrorReq(c, err)
}
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), req.FilterProjectName)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
- user, err := controller.GetCurrentUser(c)
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
s := model.GetStorage()
createdNumber, err := s.GetWorkflowCountByReq(map[string]interface{}{
- "filter_project_name": req.FilterProjectName,
- "filter_create_user_name": user.Name,
- "filter_status": model.WorkflowStatusWaitForAudit,
- "check_user_can_access": false,
+ "filter_project_id": projectUid,
+ "filter_create_user_id": user.GetIDStr(),
+ "filter_status": model.WorkflowStatusWaitForAudit,
+ "check_user_can_access": false,
})
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
rejectedNumber, err := s.GetWorkflowCountByReq(map[string]interface{}{
- "filter_project_name": req.FilterProjectName,
- "filter_create_user_name": user.Name,
- "filter_status": model.WorkflowStatusReject,
- "check_user_can_access": false,
+ "filter_project_id": projectUid,
+ "filter_create_user_id": user.GetIDStr(),
+ "filter_status": model.WorkflowStatusReject,
+ "check_user_can_access": false,
})
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
myNeedReviewNumber, err := s.GetWorkflowCountByReq(map[string]interface{}{
- "filter_project_name": req.FilterProjectName,
+ "filter_project_id": projectUid,
"filter_status": model.WorkflowStatusWaitForAudit,
"filter_current_step_type": model.WorkflowStepTypeSQLReview,
- "filter_create_user_name": user.Name,
+ "filter_create_user_id": user.GetIDStr(),
"check_user_can_access": false,
})
if err != nil {
@@ -84,10 +88,10 @@ func Dashboard(c echo.Context) error {
}
myNeedExecuteNumber, err := s.GetWorkflowCountByReq(map[string]interface{}{
- "filter_project_name": req.FilterProjectName,
+ "filter_project_id": projectUid,
"filter_status": model.WorkflowStatusWaitForExecution,
"filter_current_step_type": model.WorkflowStepTypeSQLExecute,
- "filter_create_user_name": user.Name,
+ "filter_create_user_id": user.GetIDStr(),
"check_user_can_access": false,
})
if err != nil {
@@ -95,22 +99,22 @@ func Dashboard(c echo.Context) error {
}
reviewNumber, err := s.GetWorkflowCountByReq(map[string]interface{}{
- "filter_project_name": req.FilterProjectName,
- "filter_status": model.WorkflowStatusWaitForAudit,
- "filter_current_step_type": model.WorkflowStepTypeSQLReview,
- "filter_current_step_assignee_user_name": user.Name,
- "check_user_can_access": false,
+ "filter_project_id": projectUid,
+ "filter_status": model.WorkflowStatusWaitForAudit,
+ "filter_current_step_type": model.WorkflowStepTypeSQLReview,
+ "filter_current_step_assignee_user_id": user.GetIDStr(),
+ "check_user_can_access": false,
})
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
executeNumber, err := s.GetWorkflowCountByReq(map[string]interface{}{
- "filter_project_name": req.FilterProjectName,
- "filter_status": model.WorkflowStatusWaitForExecution,
- "filter_current_step_type": model.WorkflowStepTypeSQLExecute,
- "filter_current_step_assignee_user_name": user.Name,
- "check_user_can_access": false,
+ "filter_project_id": projectUid,
+ "filter_status": model.WorkflowStatusWaitForExecution,
+ "filter_current_step_type": model.WorkflowStepTypeSQLExecute,
+ "filter_current_step_assignee_user_id": user.GetIDStr(),
+ "check_user_can_access": false,
})
if err != nil {
return controller.JSONBaseErrorReq(c, err)
@@ -130,108 +134,3 @@ func Dashboard(c echo.Context) error {
},
})
}
-
-type DashboardProjectTipV1 struct {
- Name string `json:"project_name"`
- UnfinishedWorkflowCount int `json:"unfinished_workflow_count"` // 只统计与当前用户相关的未完成工单
-}
-
-type GetDashboardProjectTipsResV1 struct {
- controller.BaseRes
- Data []*DashboardProjectTipV1 `json:"data"`
-}
-
-// DashboardProjectTipsV1
-// @Summary 获取dashboard项目提示列表
-// @Description get dashboard project tips
-// @Tags dashboard
-// @Id getDashboardProjectTipsV1
-// @Security ApiKeyAuth
-// @Produce json
-// @Success 200 {object} v1.GetDashboardProjectTipsResV1
-// @router /v1/dashboard/project_tips [get]
-func DashboardProjectTipsV1(c echo.Context) error {
- user, err := controller.GetCurrentUser(c)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- s := model.GetStorage()
- allProjectsByCurrentUser, err := s.GetProjectTips(controller.GetUserName(c))
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- createdByMeWorkflowCounts, err := s.GetWorkflowCountForDashboardProjectTipsByReq(map[string]interface{}{
- "filter_create_user_name": user.Name,
- "filter_status": []string{model.WorkflowStatusReject, model.WorkflowStatusWaitForAudit, model.WorkflowStatusWaitForExecution},
- "check_user_can_access": false,
- })
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- needMeHandleWorkflowCounts, err := s.GetWorkflowCountForDashboardProjectTipsByReq(map[string]interface{}{
- "filter_status": []string{model.WorkflowStatusWaitForAudit, model.WorkflowStatusWaitForExecution},
- "filter_current_step_assignee_user_name": user.Name,
- "check_user_can_access": false,
- })
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- projectToWorkflowCount := make(map[string]int)
- summingUpWorkflowCount := func(projectName string, records []*model.ProjectWorkflowCount) {
- for _, record := range records {
- if record.ProjectName != projectName {
- continue
- }
- if workflowCount, ok := projectToWorkflowCount[record.ProjectName]; ok {
- projectToWorkflowCount[record.ProjectName] = workflowCount + record.WorkflowCount
- } else {
- projectToWorkflowCount[record.ProjectName] = record.WorkflowCount
- }
- }
- }
-
- for _, p := range allProjectsByCurrentUser {
- projectToWorkflowCount[p.Name] = 0
- summingUpWorkflowCount(p.Name, createdByMeWorkflowCounts)
- summingUpWorkflowCount(p.Name, needMeHandleWorkflowCounts)
- }
-
- // sort by unfinished workflow count, project name
- i := 0
- projectTips := make(dashboardProjectTipSort, len(projectToWorkflowCount))
- for pName, count := range projectToWorkflowCount {
- projectTips[i] = &DashboardProjectTipV1{
- Name: pName,
- UnfinishedWorkflowCount: count,
- }
- i++
- }
- sort.Sort(projectTips)
-
- data := make([]*DashboardProjectTipV1, len(projectTips))
- for j, projectTip := range projectTips {
- data[j] = projectTip
- }
-
- return c.JSON(http.StatusOK, &GetDashboardProjectTipsResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: data,
- })
-}
-
-type dashboardProjectTipSort []*DashboardProjectTipV1
-
-func (m dashboardProjectTipSort) Len() int {
- return len(m)
-}
-
-func (m dashboardProjectTipSort) Less(i, j int) bool {
- return m[i].UnfinishedWorkflowCount < m[j].UnfinishedWorkflowCount
-}
-
-func (m dashboardProjectTipSort) Swap(i, j int) {
- m[i], m[j] = m[j], m[i]
-}
diff --git a/sqle/api/controller/v1/default_logo.go b/sqle/api/controller/v1/default_logo.go
deleted file mode 100644
index 97f75fd6cc..0000000000
--- a/sqle/api/controller/v1/default_logo.go
+++ /dev/null
@@ -1,4 +0,0 @@
-package v1
-
-// 默认实例logo的二进制数据
-var defaultInstanceLogo = []byte{137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 225, 0, 0, 0, 225, 8, 6, 0, 0, 0, 62, 179, 210, 122, 0, 0, 20, 81, 73, 68, 65, 84, 120, 94, 237, 157, 45, 111, 28, 73, 23, 70, 67, 243, 7, 2, 66, 44, 5, 174, 20, 24, 102, 156, 48, 67, 147, 16, 179, 144, 160, 240, 192, 128, 252, 129, 4, 133, 45, 13, 92, 184, 112, 193, 254, 1, 75, 38, 65, 11, 195, 162, 149, 2, 86, 154, 87, 103, 164, 199, 239, 157, 235, 234, 219, 93, 61, 118, 106, 236, 121, 142, 84, 242, 184, 63, 170, 171, 90, 117, 186, 62, 186, 187, 250, 209, 198, 24, 51, 148, 71, 121, 129, 49, 230, 215, 98, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 194, 3, 228, 191, 255, 254, 219, 252, 251, 239, 191, 155, 127, 254, 249, 103, 115, 121, 121, 185, 249, 251, 239, 191, 55, 127, 253, 245, 215, 230, 143, 63, 254, 216, 124, 253, 250, 117, 243, 251, 239, 191, 111, 190, 124, 249, 178, 13, 159, 63, 127, 190, 254, 205, 114, 214, 179, 29, 219, 179, 31, 251, 19, 15, 241, 17, 175, 57, 60, 44, 225, 32, 126, 252, 248, 177, 185, 186, 186, 218, 10, 243, 233, 211, 167, 205, 187, 119, 239, 54, 103, 103, 103, 155, 223, 126, 251, 109, 243, 232, 209, 163, 59, 11, 196, 207, 113, 56, 30, 199, 229, 248, 164, 131, 244, 152, 49, 88, 194, 95, 0, 181, 16, 181, 18, 181, 213, 197, 197, 197, 230, 241, 227, 199, 55, 228, 56, 132, 64, 186, 72, 31, 233, 36, 189, 164, 219, 220, 61, 150, 240, 142, 160, 16, 127, 252, 248, 113, 115, 122, 122, 122, 163, 176, 223, 167, 64, 250, 201, 7, 249, 49, 119, 131, 37, 220, 131, 220, 199, 162, 31, 70, 51, 47, 23, 228, 181, 225, 217, 179, 103, 91, 9, 104, 62, 82, 67, 17, 247, 251, 247, 239, 55, 31, 62, 124, 216, 138, 65, 160, 73, 169, 223, 44, 103, 61, 219, 177, 61, 251, 177, 63, 241, 228, 184, 215, 6, 226, 38, 159, 145, 124, 30, 76, 31, 150, 112, 79, 190, 127, 255, 190, 21, 224, 201, 147, 39, 55, 10, 236, 92, 96, 31, 100, 97, 127, 6, 84, 168, 109, 190, 125, 251, 182, 109, 6, 254, 252, 249, 51, 31, 106, 47, 136, 143, 120, 137, 159, 227, 112, 60, 142, 203, 241, 215, 166, 157, 253, 201, 191, 217, 15, 75, 216, 65, 188, 226, 83, 248, 122, 106, 189, 231, 207, 159, 111, 183, 167, 240, 51, 98, 121, 104, 253, 45, 210, 67, 186, 72, 31, 233, 36, 189, 57, 15, 83, 129, 237, 163, 140, 174, 25, 251, 176, 132, 11, 137, 5, 139, 26, 32, 23, 196, 86, 120, 251, 246, 237, 118, 244, 241, 190, 214, 22, 164, 155, 244, 147, 143, 156, 183, 86, 224, 188, 8, 139, 184, 28, 75, 56, 3, 133, 73, 5, 138, 251, 109, 115, 253, 43, 106, 133, 135, 58, 136, 65, 190, 230, 106, 127, 206, 15, 231, 9, 44, 226, 50, 44, 225, 12, 42, 72, 12, 70, 228, 2, 23, 11, 30, 55, 202, 111, 187, 31, 119, 168, 144, 79, 242, 91, 93, 144, 52, 120, 99, 17, 231, 177, 132, 11, 160, 175, 148, 11, 153, 2, 125, 168, 200, 67, 47, 116, 57, 127, 228, 63, 159, 19, 5, 206, 155, 153, 199, 18, 206, 192, 85, 63, 23, 46, 2, 253, 164, 99, 169, 249, 230, 64, 204, 169, 126, 163, 207, 209, 60, 150, 112, 6, 238, 195, 229, 130, 197, 50, 145, 107, 134, 99, 35, 230, 159, 231, 88, 171, 115, 101, 218, 88, 194, 25, 114, 161, 226, 134, 56, 28, 187, 124, 25, 157, 15, 206, 79, 62, 103, 166, 198, 103, 168, 128, 33, 250, 92, 160, 14, 237, 254, 222, 161, 193, 249, 201, 231, 236, 190, 222, 162, 249, 85, 88, 194, 2, 134, 218, 99, 97, 226, 1, 103, 225, 154, 112, 151, 120, 62, 242, 3, 234, 186, 101, 97, 218, 88, 194, 130, 44, 33, 65, 35, 126, 150, 112, 23, 157, 143, 214, 72, 178, 37, 172, 177, 132, 5, 45, 9, 185, 55, 230, 38, 105, 27, 206, 75, 235, 222, 161, 37, 172, 177, 132, 5, 45, 9, 9, 60, 87, 233, 130, 181, 11, 231, 99, 234, 121, 83, 159, 171, 26, 75, 88, 48, 37, 161, 2, 79, 141, 152, 205, 246, 60, 228, 115, 99, 9, 151, 99, 9, 11, 230, 36, 36, 208, 252, 250, 243, 207, 63, 175, 247, 137, 207, 154, 62, 52, 114, 222, 200, 119, 171, 249, 153, 131, 37, 172, 177, 132, 5, 115, 18, 198, 81, 192, 147, 147, 147, 237, 180, 16, 15, 125, 174, 22, 242, 71, 62, 163, 124, 121, 52, 52, 7, 75, 88, 99, 9, 11, 178, 132, 76, 146, 196, 171, 61, 185, 144, 229, 192, 27, 237, 60, 83, 217, 186, 63, 150, 107, 147, 67, 98, 42, 109, 228, 131, 252, 144, 175, 156, 215, 28, 56, 63, 121, 178, 42, 75, 88, 99, 9, 11, 178, 132, 188, 77, 14, 20, 202, 169, 103, 37, 115, 120, 241, 226, 197, 246, 41, 18, 222, 42, 104, 73, 121, 136, 144, 78, 210, 75, 186, 73, 127, 206, 83, 43, 112, 62, 148, 191, 252, 166, 190, 37, 172, 177, 132, 5, 83, 18, 10, 166, 138, 152, 123, 191, 46, 7, 226, 120, 243, 230, 205, 246, 57, 75, 250, 84, 28, 99, 212, 45, 15, 205, 109, 74, 58, 72, 15, 233, 202, 2, 205, 5, 242, 207, 121, 136, 228, 56, 44, 97, 141, 37, 44, 168, 36, 140, 205, 54, 106, 0, 250, 73, 83, 67, 244, 75, 2, 125, 202, 56, 31, 40, 35, 142, 200, 17, 39, 240, 229, 56, 244, 201, 120, 51, 33, 55, 27, 249, 159, 229, 172, 103, 59, 196, 208, 196, 193, 196, 67, 124, 113, 126, 83, 142, 151, 211, 176, 52, 144, 79, 242, 59, 53, 165, 133, 37, 236, 195, 18, 22, 84, 18, 78, 65, 225, 167, 128, 190, 124, 249, 242, 70, 225, 189, 207, 129, 252, 144, 175, 92, 235, 65, 190, 32, 88, 194, 62, 44, 97, 193, 26, 9, 35, 212, 74, 212, 66, 61, 125, 171, 67, 9, 234, 203, 146, 254, 222, 17, 95, 75, 216, 135, 37, 44, 216, 87, 194, 76, 156, 209, 140, 249, 65, 207, 207, 207, 111, 20, 254, 17, 129, 230, 41, 233, 185, 173, 153, 224, 44, 97, 31, 150, 176, 224, 182, 37, 156, 130, 190, 92, 156, 15, 148, 190, 27, 82, 48, 80, 130, 32, 212, 74, 12, 251, 63, 125, 250, 244, 134, 64, 173, 192, 118, 108, 207, 126, 236, 79, 60, 196, 71, 188, 196, 207, 200, 39, 199, 187, 171, 183, 222, 45, 97, 31, 150, 176, 224, 174, 37, 204, 125, 169, 37, 32, 142, 38, 242, 165, 153, 200, 223, 24, 214, 136, 181, 38, 29, 21, 150, 176, 15, 75, 88, 112, 215, 18, 62, 84, 44, 97, 31, 150, 176, 192, 18, 174, 195, 18, 246, 97, 9, 11, 44, 225, 58, 44, 97, 31, 150, 176, 192, 18, 174, 195, 18, 246, 97, 9, 11, 44, 225, 58, 44, 97, 31, 150, 176, 192, 18, 174, 195, 18, 246, 97, 9, 11, 44, 225, 58, 44, 97, 31, 150, 176, 192, 18, 174, 195, 18, 246, 97, 9, 11, 44, 225, 58, 44, 97, 31, 150, 176, 192, 18, 174, 195, 18, 246, 97, 9, 11, 178, 132, 132, 53, 143, 133, 29, 19, 173, 175, 88, 89, 194, 26, 75, 88, 208, 146, 48, 126, 18, 218, 220, 164, 245, 41, 113, 75, 88, 99, 9, 11, 90, 18, 18, 60, 223, 104, 155, 169, 249, 71, 45, 97, 141, 37, 44, 152, 146, 144, 192, 52, 17, 183, 253, 246, 193, 125, 133, 243, 80, 205, 181, 99, 9, 107, 44, 97, 65, 37, 33, 129, 249, 54, 153, 226, 239, 152, 33, 255, 158, 119, 116, 63, 44, 97, 193, 156, 132, 10, 76, 124, 196, 203, 178, 199, 82, 51, 146, 79, 242, 187, 116, 98, 43, 75, 88, 99, 9, 11, 178, 132, 188, 177, 126, 122, 122, 186, 253, 61, 117, 245, 167, 89, 198, 27, 242, 15, 13, 196, 35, 95, 83, 205, 78, 157, 15, 206, 79, 158, 1, 192, 18, 214, 88, 194, 130, 150, 132, 208, 250, 36, 116, 14, 220, 43, 163, 192, 174, 153, 40, 233, 80, 208, 68, 85, 228, 35, 223, 251, 107, 5, 125, 74, 220, 18, 246, 97, 9, 11, 178, 132, 241, 102, 61, 235, 150, 206, 194, 77, 96, 206, 23, 230, 121, 161, 15, 197, 252, 46, 115, 147, 41, 77, 77, 73, 191, 134, 37, 241, 144, 30, 210, 69, 250, 72, 231, 146, 15, 189, 40, 112, 30, 162, 104, 89, 88, 75, 88, 99, 9, 11, 166, 36, 140, 133, 154, 109, 90, 247, 198, 150, 4, 38, 98, 98, 18, 38, 77, 192, 68, 115, 143, 248, 238, 234, 129, 0, 226, 37, 254, 56, 161, 20, 199, 95, 59, 29, 35, 249, 142, 130, 233, 188, 88, 194, 62, 44, 97, 193, 148, 132, 83, 48, 139, 89, 79, 237, 56, 23, 152, 37, 155, 73, 119, 47, 46, 46, 182, 241, 210, 44, 164, 201, 71, 225, 71, 160, 28, 88, 206, 122, 182, 99, 123, 246, 99, 255, 125, 102, 219, 206, 129, 120, 201, 103, 133, 37, 236, 195, 18, 22, 244, 74, 40, 52, 136, 129, 20, 107, 107, 153, 67, 9, 164, 159, 124, 144, 159, 37, 205, 90, 176, 132, 125, 88, 194, 130, 181, 18, 102, 24, 224, 160, 246, 160, 182, 122, 253, 250, 245, 141, 66, 122, 40, 129, 116, 145, 62, 210, 73, 122, 215, 14, 40, 229, 252, 89, 194, 26, 75, 88, 112, 91, 18, 182, 160, 128, 107, 54, 110, 10, 61, 205, 188, 214, 240, 254, 109, 7, 221, 102, 225, 120, 234, 139, 146, 142, 181, 194, 181, 176, 132, 125, 88, 194, 130, 219, 150, 112, 105, 115, 142, 145, 74, 190, 120, 196, 241, 17, 132, 90, 137, 81, 75, 132, 225, 249, 76, 62, 204, 66, 136, 253, 65, 45, 99, 61, 219, 177, 61, 251, 197, 47, 58, 205, 141, 200, 138, 165, 233, 156, 194, 18, 246, 97, 9, 11, 110, 91, 194, 99, 193, 18, 246, 97, 9, 11, 44, 225, 58, 44, 97, 31, 150, 176, 192, 18, 174, 195, 18, 246, 97, 9, 11, 44, 225, 58, 44, 97, 31, 150, 176, 192, 18, 174, 195, 18, 246, 97, 9, 11, 44, 225, 58, 44, 97, 31, 150, 176, 192, 18, 174, 195, 18, 246, 97, 9, 11, 142, 65, 66, 238, 9, 198, 143, 140, 238, 123, 143, 16, 44, 97, 31, 150, 176, 224, 161, 75, 200, 91, 21, 122, 101, 74, 2, 234, 75, 192, 251, 96, 9, 251, 176, 132, 5, 15, 89, 194, 40, 28, 143, 172, 233, 175, 126, 239, 83, 35, 90, 194, 62, 44, 97, 65, 150, 144, 41, 28, 30, 10, 18, 13, 233, 162, 144, 250, 238, 253, 62, 181, 97, 158, 250, 195, 18, 214, 88, 194, 130, 44, 33, 65, 243, 199, 236, 83, 83, 28, 2, 106, 126, 170, 230, 227, 255, 248, 187, 87, 66, 157, 15, 206, 79, 62, 103, 150, 176, 198, 18, 22, 68, 9, 185, 186, 51, 229, 3, 211, 84, 220, 230, 27, 7, 163, 80, 95, 80, 226, 197, 102, 233, 26, 9, 129, 253, 90, 211, 98, 88, 194, 26, 75, 88, 16, 37, 164, 112, 33, 34, 253, 29, 126, 51, 31, 203, 125, 65, 82, 229, 218, 91, 162, 197, 145, 81, 137, 56, 71, 142, 139, 243, 33, 1, 221, 28, 237, 195, 18, 22, 68, 9, 79, 78, 78, 174, 107, 67, 45, 227, 213, 161, 67, 71, 35, 159, 83, 181, 91, 188, 61, 177, 246, 22, 5, 231, 33, 215, 126, 150, 112, 57, 150, 112, 2, 10, 35, 87, 119, 10, 17, 181, 159, 36, 228, 111, 44, 96, 76, 255, 192, 187, 123, 177, 240, 170, 73, 55, 85, 176, 179, 24, 173, 90, 74, 131, 37, 113, 155, 24, 111, 222, 94, 180, 142, 157, 69, 139, 235, 226, 250, 169, 60, 232, 216, 121, 228, 148, 124, 199, 243, 193, 11, 195, 92, 164, 8, 113, 132, 212, 18, 214, 88, 194, 6, 18, 64, 18, 82, 168, 40, 108, 72, 24, 155, 90, 244, 15, 245, 155, 109, 120, 185, 86, 5, 78, 133, 91, 133, 89, 5, 55, 47, 143, 191, 243, 241, 179, 80, 121, 31, 66, 68, 235, 243, 126, 26, 1, 141, 203, 20, 180, 156, 109, 148, 134, 214, 241, 148, 126, 206, 9, 249, 204, 125, 191, 44, 30, 231, 139, 96, 9, 231, 177, 132, 13, 84, 192, 115, 77, 72, 65, 99, 50, 92, 45, 139, 130, 198, 2, 249, 234, 213, 171, 237, 219, 237, 177, 240, 169, 16, 79, 137, 18, 69, 108, 109, 147, 37, 138, 210, 136, 184, 62, 199, 155, 127, 235, 255, 24, 175, 164, 214, 114, 165, 153, 124, 240, 198, 254, 249, 249, 249, 117, 30, 169, 245, 116, 65, 138, 83, 114, 112, 126, 152, 225, 141, 223, 186, 72, 89, 194, 26, 75, 152, 136, 53, 149, 36, 212, 149, 93, 51, 112, 51, 85, 4, 19, 228, 178, 60, 214, 140, 136, 169, 160, 101, 72, 202, 52, 132, 52, 221, 52, 197, 68, 44, 224, 192, 177, 226, 128, 136, 254, 215, 182, 45, 25, 167, 36, 204, 3, 43, 49, 63, 90, 174, 101, 250, 29, 211, 195, 95, 164, 65, 38, 242, 24, 243, 18, 47, 60, 228, 59, 202, 199, 156, 53, 228, 15, 88, 206, 249, 210, 246, 150, 176, 198, 18, 38, 40, 132, 42, 200, 89, 66, 61, 49, 163, 66, 203, 122, 201, 168, 66, 170, 193, 27, 53, 215, 114, 179, 141, 62, 36, 243, 129, 210, 164, 163, 160, 95, 93, 93, 93, 55, 23, 99, 26, 84, 27, 233, 127, 73, 8, 81, 202, 72, 75, 66, 200, 162, 9, 182, 229, 248, 92, 32, 72, 15, 233, 34, 159, 49, 189, 45, 233, 226, 54, 228, 95, 35, 197, 202, 7, 53, 96, 20, 212, 18, 214, 88, 194, 132, 10, 252, 156, 132, 218, 6, 248, 77, 115, 77, 31, 139, 33, 228, 145, 212, 88, 160, 249, 155, 31, 237, 34, 156, 157, 157, 109, 107, 20, 230, 249, 252, 252, 249, 243, 245, 100, 77, 220, 0, 71, 22, 10, 51, 181, 141, 38, 129, 82, 205, 74, 225, 143, 203, 9, 164, 157, 253, 16, 157, 120, 24, 193, 36, 94, 226, 231, 56, 249, 216, 74, 179, 210, 24, 155, 155, 57, 31, 236, 79, 124, 28, 23, 242, 69, 33, 246, 149, 9, 164, 37, 94, 84, 204, 46, 150, 176, 65, 150, 80, 133, 144, 79, 129, 65, 172, 153, 8, 177, 112, 177, 15, 5, 52, 22, 116, 132, 83, 205, 16, 155, 172, 42, 236, 8, 30, 107, 26, 9, 154, 239, 183, 229, 16, 183, 171, 182, 213, 58, 254, 106, 31, 29, 147, 223, 26, 84, 137, 205, 205, 124, 145, 160, 159, 75, 190, 16, 92, 181, 170, 164, 211, 249, 210, 69, 137, 243, 20, 107, 75, 213, 246, 146, 214, 236, 98, 9, 27, 168, 128, 73, 66, 10, 43, 133, 138, 43, 124, 92, 31, 107, 195, 184, 175, 164, 164, 102, 162, 38, 162, 79, 56, 85, 251, 16, 47, 242, 73, 74, 45, 139, 255, 75, 16, 213, 48, 81, 98, 109, 175, 229, 185, 214, 82, 250, 217, 87, 178, 74, 252, 152, 134, 184, 61, 235, 73, 47, 233, 166, 38, 38, 31, 49, 95, 170, 125, 37, 33, 203, 99, 51, 152, 116, 16, 167, 36, 71, 66, 214, 41, 30, 179, 139, 37, 44, 144, 132, 106, 154, 81, 184, 132, 154, 96, 173, 66, 21, 155, 103, 106, 134, 17, 248, 173, 62, 24, 77, 67, 102, 187, 110, 73, 35, 113, 178, 24, 113, 89, 172, 173, 84, 232, 115, 237, 181, 36, 176, 15, 163, 158, 164, 135, 116, 181, 250, 168, 57, 175, 173, 11, 144, 242, 7, 212, 132, 49, 45, 138, 83, 210, 154, 93, 44, 97, 65, 124, 98, 70, 5, 246, 46, 160, 112, 114, 44, 250, 112, 234, 191, 81, 11, 209, 127, 67, 16, 134, 252, 41, 216, 113, 176, 163, 10, 108, 199, 246, 236, 199, 254, 196, 67, 124, 196, 75, 252, 250, 250, 211, 26, 41, 90, 23, 157, 76, 190, 24, 120, 96, 166, 198, 18, 22, 252, 42, 9, 247, 97, 137, 20, 191, 26, 75, 216, 135, 37, 44, 184, 15, 18, 102, 14, 65, 74, 75, 216, 135, 37, 44, 184, 143, 18, 30, 2, 150, 176, 15, 75, 88, 96, 9, 215, 97, 9, 251, 176, 132, 5, 150, 112, 29, 150, 176, 15, 75, 88, 96, 9, 215, 97, 9, 251, 176, 132, 5, 150, 112, 29, 150, 176, 15, 75, 88, 96, 9, 215, 97, 9, 251, 176, 132, 5, 150, 112, 29, 150, 176, 15, 75, 88, 96, 9, 215, 97, 9, 251, 176, 132, 5, 150, 112, 29, 150, 176, 15, 75, 88, 192, 83, 255, 177, 48, 17, 214, 60, 111, 121, 76, 112, 126, 242, 57, 211, 27, 247, 166, 141, 37, 156, 33, 23, 40, 30, 132, 54, 55, 209, 227, 114, 156, 159, 124, 206, 76, 141, 207, 208, 12, 76, 251, 144, 11, 21, 111, 189, 139, 67, 120, 86, 115, 36, 49, 255, 173, 115, 197, 50, 83, 99, 9, 103, 224, 29, 185, 92, 176, 8, 188, 30, 148, 95, 232, 61, 86, 56, 15, 156, 143, 124, 142, 8, 62, 71, 243, 88, 194, 5, 92, 94, 94, 222, 40, 92, 10, 76, 109, 24, 121, 232, 53, 99, 206, 31, 249, 207, 231, 68, 129, 243, 102, 230, 177, 132, 51, 168, 208, 49, 205, 67, 46, 100, 10, 188, 229, 206, 68, 79, 199, 114, 213, 39, 159, 228, 119, 106, 86, 0, 2, 231, 11, 178, 180, 230, 38, 150, 112, 6, 77, 77, 1, 12, 181, 87, 5, 143, 240, 238, 221, 187, 235, 207, 167, 61, 52, 200, 23, 249, 203, 121, 142, 129, 243, 163, 91, 18, 241, 220, 153, 105, 44, 225, 66, 98, 97, 98, 62, 150, 92, 248, 90, 129, 126, 146, 38, 253, 189, 143, 144, 110, 210, 63, 213, 223, 203, 129, 243, 34, 44, 223, 114, 44, 97, 7, 177, 96, 81, 64, 231, 106, 133, 24, 152, 243, 133, 237, 233, 67, 209, 87, 58, 180, 251, 141, 164, 135, 9, 153, 72, 31, 233, 36, 189, 57, 15, 83, 129, 237, 227, 133, 198, 2, 246, 97, 9, 247, 132, 194, 71, 13, 144, 159, 18, 89, 18, 216, 135, 89, 175, 217, 159, 194, 79, 63, 138, 25, 222, 90, 179, 104, 239, 11, 241, 17, 47, 241, 115, 28, 142, 199, 113, 57, 254, 218, 180, 179, 255, 125, 173, 229, 15, 9, 75, 184, 7, 249, 138, 79, 225, 238, 169, 29, 231, 2, 253, 43, 102, 245, 102, 14, 80, 100, 33, 110, 166, 157, 231, 134, 56, 2, 112, 15, 78, 129, 255, 89, 206, 122, 182, 99, 123, 246, 99, 255, 185, 126, 108, 79, 32, 110, 13, 186, 136, 124, 30, 76, 31, 150, 240, 142, 96, 16, 3, 49, 226, 212, 248, 247, 49, 144, 126, 242, 241, 80, 7, 155, 14, 1, 75, 248, 11, 160, 191, 69, 33, 102, 222, 79, 106, 168, 60, 177, 239, 161, 4, 210, 69, 250, 72, 39, 233, 61, 180, 126, 235, 67, 197, 18, 14, 34, 126, 17, 137, 199, 224, 104, 230, 209, 124, 204, 31, 83, 185, 237, 64, 252, 28, 135, 227, 233, 163, 51, 154, 33, 219, 140, 193, 18, 30, 32, 244, 177, 52, 43, 55, 35, 169, 241, 235, 74, 12, 168, 112, 163, 156, 218, 138, 128, 72, 250, 205, 114, 214, 199, 175, 57, 177, 63, 241, 76, 77, 217, 111, 198, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 23, 208, 251, 113, 77, 182, 207, 251, 228, 255, 123, 200, 251, 230, 255, 167, 150, 221, 53, 107, 142, 185, 102, 159, 135, 142, 37, 12, 236, 83, 64, 230, 246, 157, 91, 223, 67, 142, 43, 255, 127, 215, 252, 252, 249, 115, 27, 204, 237, 96, 9, 19, 231, 231, 231, 155, 103, 207, 158, 109, 191, 237, 174, 240, 252, 249, 243, 205, 197, 197, 197, 246, 19, 212, 208, 170, 233, 224, 228, 228, 100, 187, 253, 147, 39, 79, 182, 159, 174, 206, 240, 157, 248, 28, 119, 14, 143, 31, 63, 222, 126, 222, 90, 240, 155, 101, 138, 151, 79, 96, 103, 248, 20, 182, 182, 137, 225, 244, 244, 116, 243, 225, 195, 135, 205, 247, 239, 223, 183, 219, 181, 210, 204, 103, 184, 137, 87, 241, 107, 219, 136, 246, 35, 79, 228, 241, 209, 163, 71, 219, 208, 202, 39, 159, 234, 86, 124, 173, 64, 254, 45, 240, 46, 150, 48, 241, 242, 229, 203, 235, 66, 214, 10, 31, 63, 126, 220, 110, 151, 11, 52, 178, 196, 237, 222, 190, 125, 187, 179, 30, 16, 60, 199, 215, 10, 81, 66, 36, 137, 235, 248, 70, 125, 6, 9, 115, 28, 57, 196, 56, 35, 228, 39, 110, 215, 146, 28, 242, 118, 49, 32, 186, 248, 250, 245, 235, 141, 245, 57, 88, 194, 93, 44, 97, 66, 18, 190, 127, 255, 126, 243, 237, 219, 183, 205, 213, 213, 213, 230, 242, 242, 114, 243, 230, 205, 155, 235, 66, 212, 42, 208, 89, 22, 174, 248, 25, 246, 35, 62, 2, 113, 83, 123, 177, 237, 151, 47, 95, 118, 142, 21, 5, 255, 244, 233, 211, 78, 188, 164, 35, 19, 37, 36, 29, 138, 43, 10, 209, 186, 40, 192, 235, 215, 175, 119, 226, 207, 53, 27, 80, 59, 106, 61, 231, 229, 199, 143, 31, 219, 64, 186, 181, 92, 53, 168, 142, 73, 173, 167, 116, 196, 64, 254, 204, 46, 150, 48, 33, 9, 41, 252, 25, 10, 214, 212, 58, 201, 66, 97, 87, 193, 164, 160, 86, 72, 66, 154, 112, 83, 72, 18, 93, 4, 72, 67, 38, 74, 72, 193, 143, 80, 115, 178, 252, 233, 211, 167, 59, 203, 5, 235, 72, 135, 226, 151, 172, 241, 66, 64, 250, 180, 93, 134, 38, 47, 235, 144, 15, 162, 132, 102, 25, 150, 48, 81, 73, 72, 179, 139, 117, 244, 237, 50, 106, 106, 210, 111, 148, 16, 115, 87, 253, 37, 18, 106, 155, 24, 111, 150, 59, 74, 72, 109, 19, 161, 121, 169, 117, 185, 9, 173, 26, 142, 90, 91, 162, 73, 158, 184, 173, 68, 38, 143, 90, 167, 245, 156, 11, 214, 169, 153, 110, 9, 251, 177, 132, 137, 74, 66, 245, 139, 114, 147, 144, 2, 201, 96, 4, 235, 16, 66, 181, 67, 171, 105, 23, 153, 147, 48, 54, 3, 65, 191, 115, 191, 109, 137, 132, 28, 43, 75, 40, 177, 201, 79, 236, 211, 18, 95, 68, 18, 158, 157, 157, 109, 255, 143, 241, 32, 29, 34, 186, 38, 92, 143, 37, 76, 172, 145, 80, 178, 32, 34, 168, 118, 160, 255, 84, 49, 39, 161, 4, 82, 13, 52, 37, 247, 82, 9, 51, 146, 139, 188, 34, 150, 226, 200, 53, 184, 106, 73, 66, 174, 133, 51, 150, 176, 31, 75, 152, 88, 35, 161, 106, 20, 250, 111, 128, 36, 252, 255, 226, 197, 139, 157, 237, 50, 115, 18, 106, 224, 67, 77, 61, 164, 230, 255, 220, 28, 174, 36, 84, 95, 85, 181, 88, 132, 219, 46, 172, 99, 48, 7, 184, 21, 195, 255, 170, 213, 68, 140, 95, 199, 158, 186, 77, 51, 39, 97, 107, 159, 99, 199, 18, 38, 214, 72, 40, 89, 180, 15, 53, 137, 10, 109, 85, 232, 230, 36, 212, 32, 143, 36, 153, 42, 224, 83, 163, 163, 186, 24, 16, 114, 19, 22, 232, 11, 178, 78, 163, 189, 85, 13, 30, 71, 66, 117, 81, 104, 161, 52, 34, 180, 89, 134, 37, 76, 172, 145, 80, 35, 139, 146, 133, 38, 155, 10, 108, 174, 153, 34, 115, 18, 170, 102, 146, 36, 81, 238, 120, 175, 109, 238, 62, 161, 4, 140, 23, 132, 220, 223, 4, 73, 75, 179, 183, 133, 36, 37, 80, 139, 42, 190, 88, 43, 198, 219, 34, 156, 75, 226, 82, 80, 179, 218, 236, 98, 9, 19, 107, 36, 148, 76, 241, 254, 161, 106, 153, 41, 193, 160, 146, 16, 201, 84, 152, 99, 97, 215, 178, 216, 111, 139, 18, 18, 167, 130, 150, 145, 150, 124, 111, 51, 247, 55, 97, 74, 242, 72, 188, 105, 79, 115, 59, 247, 17, 171, 155, 245, 173, 126, 169, 177, 132, 55, 232, 149, 48, 10, 16, 81, 83, 50, 62, 77, 146, 169, 36, 148, 16, 164, 39, 162, 123, 149, 177, 223, 22, 211, 16, 101, 163, 182, 211, 125, 198, 92, 187, 169, 214, 139, 77, 203, 234, 126, 99, 36, 14, 212, 240, 24, 91, 20, 81, 18, 34, 62, 121, 200, 193, 220, 196, 18, 38, 122, 37, 84, 141, 242, 234, 213, 171, 176, 229, 255, 11, 121, 150, 40, 82, 73, 168, 253, 179, 196, 173, 126, 91, 53, 48, 19, 155, 157, 81, 80, 197, 147, 143, 77, 237, 214, 90, 158, 137, 247, 31, 53, 32, 5, 83, 253, 86, 51, 141, 37, 76, 244, 74, 216, 170, 81, 96, 73, 211, 174, 146, 112, 74, 18, 21, 242, 40, 247, 148, 132, 106, 198, 106, 157, 30, 64, 7, 61, 136, 157, 155, 169, 58, 110, 150, 191, 69, 108, 122, 170, 150, 179, 132, 253, 88, 194, 68, 175, 132, 42, 180, 52, 63, 17, 146, 81, 68, 130, 110, 13, 180, 10, 186, 168, 36, 84, 141, 132, 12, 138, 151, 191, 186, 77, 65, 144, 100, 83, 18, 10, 173, 139, 111, 129, 104, 153, 210, 171, 160, 219, 22, 177, 102, 103, 192, 137, 123, 138, 173, 1, 158, 24, 15, 88, 194, 126, 44, 97, 162, 87, 66, 221, 64, 175, 130, 70, 77, 51, 83, 18, 206, 141, 118, 42, 168, 223, 214, 43, 97, 172, 165, 171, 32, 242, 163, 105, 32, 17, 53, 50, 172, 230, 177, 37, 236, 199, 18, 38, 42, 9, 115, 127, 44, 22, 126, 106, 138, 92, 171, 72, 208, 220, 84, 21, 83, 18, 34, 18, 203, 121, 232, 58, 199, 73, 96, 121, 220, 111, 74, 194, 220, 28, 85, 77, 22, 155, 180, 177, 246, 38, 180, 106, 112, 61, 51, 171, 38, 106, 172, 9, 245, 204, 172, 242, 104, 9, 251, 177, 132, 9, 73, 152, 223, 219, 139, 247, 254, 244, 216, 152, 106, 148, 169, 2, 167, 154, 115, 234, 254, 216, 148, 132, 26, 125, 164, 105, 216, 34, 23, 252, 106, 84, 51, 190, 98, 165, 215, 141, 212, 164, 205, 121, 20, 218, 62, 63, 36, 144, 111, 192, 199, 102, 173, 70, 107, 45, 97, 63, 150, 48, 33, 9, 17, 0, 217, 8, 212, 14, 186, 239, 71, 208, 144, 188, 10, 220, 148, 44, 81, 128, 22, 83, 18, 170, 230, 105, 213, 198, 144, 31, 69, 139, 18, 34, 166, 210, 173, 120, 226, 182, 160, 26, 58, 14, 212, 68, 216, 54, 30, 63, 142, 176, 146, 87, 106, 84, 242, 166, 115, 69, 208, 224, 147, 206, 9, 181, 181, 210, 161, 160, 218, 182, 122, 138, 232, 24, 105, 151, 142, 35, 102, 174, 143, 23, 251, 119, 170, 81, 166, 100, 161, 86, 210, 126, 173, 105, 35, 180, 78, 18, 170, 112, 170, 112, 79, 245, 37, 179, 220, 115, 125, 72, 70, 66, 117, 252, 248, 16, 64, 43, 77, 32, 121, 163, 184, 213, 77, 248, 120, 17, 169, 182, 83, 152, 26, 45, 62, 86, 44, 97, 2, 161, 144, 43, 6, 141, 80, 230, 167, 67, 216, 150, 126, 226, 212, 77, 104, 164, 98, 61, 161, 53, 96, 66, 220, 172, 203, 163, 142, 218, 103, 74, 18, 150, 107, 27, 210, 68, 161, 230, 119, 78, 55, 181, 98, 22, 89, 251, 178, 126, 170, 70, 34, 61, 108, 147, 111, 83, 144, 7, 150, 115, 145, 96, 244, 180, 149, 47, 237, 155, 211, 18, 195, 212, 113, 143, 21, 75, 24, 248, 149, 133, 99, 237, 177, 214, 238, 103, 14, 23, 75, 184, 39, 75, 164, 96, 155, 185, 237, 242, 250, 252, 127, 102, 110, 253, 20, 218, 111, 105, 154, 242, 54, 173, 101, 75, 217, 103, 223, 135, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 140, 37, 52, 102, 48, 150, 208, 152, 193, 88, 66, 99, 6, 99, 9, 141, 25, 204, 255, 0, 212, 20, 62, 205, 71, 79, 97, 57, 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130}
diff --git a/sqle/api/controller/v1/dms_handle.go b/sqle/api/controller/v1/dms_handle.go
new file mode 100644
index 0000000000..aff13c90b0
--- /dev/null
+++ b/sqle/api/controller/v1/dms_handle.go
@@ -0,0 +1,64 @@
+package v1
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+ "strconv"
+
+ baseV1 "github.com/actiontech/dms/pkg/dms-common/api/base/v1"
+ dmsV1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+ "github.com/actiontech/dms/pkg/dms-common/dmsobject"
+ "github.com/actiontech/sqle/sqle/api/controller"
+ "github.com/actiontech/sqle/sqle/common"
+ "github.com/labstack/echo/v4"
+)
+
+func init() {
+ dmsobject.InitOperateHandlers([]dmsobject.OperationHandler{
+ AfterDeleteProject{},
+ BeforeDeleteProject{},
+ BeforeArchiveProject{},
+ AfterCreateProject{},
+ BeforeDeleteDbService{},
+ })
+}
+
+// 内部接口
+func OperateDataResourceHandle(c echo.Context) error {
+ req := new(dmsV1.OperateDataResourceHandleReq)
+ if err := controller.BindAndValidateReq(c, req); err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ h := dmsobject.GetOperateHandle(fmt.Sprintf("%s_%s_%s", req.OperationTiming, req.OperationType, req.DataResourceType))
+
+ if err := h.Handle(c.Request().Context(), "", req.DataResourceUid); err != nil {
+ return c.JSON(http.StatusOK, dmsV1.OperateDataResourceHandleReply{GenericResp: baseV1.GenericResp{Code: http.StatusBadRequest, Message: err.Error()}})
+ }
+
+ return c.JSON(http.StatusOK, dmsV1.OperateDataResourceHandleReply{GenericResp: baseV1.GenericResp{Message: "OK"}})
+}
+
+type AfterDeleteProject struct {
+}
+
+type BeforeArchiveProject struct {
+}
+
+type BeforeDeleteProject struct {
+}
+
+type AfterCreateProject struct {
+}
+
+type BeforeDeleteDbService struct {
+}
+
+func (h BeforeDeleteDbService) Handle(ctx context.Context, currentUserId string, instanceIdStr string) error {
+ instanceId, err := strconv.ParseInt(instanceIdStr, 10, 64)
+ if err != nil {
+ return err
+ }
+
+ return common.CheckDeleteInstance(instanceId)
+}
diff --git a/sqle/api/controller/v1/dms_handle_ce.go b/sqle/api/controller/v1/dms_handle_ce.go
new file mode 100644
index 0000000000..788552a6a9
--- /dev/null
+++ b/sqle/api/controller/v1/dms_handle_ce.go
@@ -0,0 +1,21 @@
+//go:build !enterprise
+// +build !enterprise
+
+package v1
+
+import (
+ "context"
+)
+
+func (h BeforeArchiveProject) Handle(ctx context.Context, currentUserId string, dataResourceId string) error {
+ return nil
+}
+func (h AfterDeleteProject) Handle(ctx context.Context, currentUserId string, dataResourceId string) error {
+ return nil
+}
+func (h BeforeDeleteProject) Handle(ctx context.Context, currentUserId string, dataResourceId string) error {
+ return nil
+}
+func (h AfterCreateProject) Handle(ctx context.Context, currentUserId string, dataResourceId string) error {
+ return nil
+}
diff --git a/sqle/api/controller/v1/instance.go b/sqle/api/controller/v1/instance.go
index e040fa2600..c48e472830 100644
--- a/sqle/api/controller/v1/instance.go
+++ b/sqle/api/controller/v1/instance.go
@@ -5,14 +5,16 @@ import (
"fmt"
"net/http"
+ baseV1 "github.com/actiontech/dms/pkg/dms-common/api/base/v1"
+ v1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
"github.com/actiontech/sqle/sqle/api/controller"
"github.com/actiontech/sqle/sqle/common"
+ "github.com/actiontech/sqle/sqle/dms"
"github.com/actiontech/sqle/sqle/driver"
driverV2 "github.com/actiontech/sqle/sqle/driver/v2"
"github.com/actiontech/sqle/sqle/errors"
"github.com/actiontech/sqle/sqle/log"
"github.com/actiontech/sqle/sqle/model"
- "github.com/actiontech/sqle/sqle/pkg/params"
"github.com/actiontech/sqle/sqle/utils"
"github.com/labstack/echo/v4"
@@ -23,16 +25,6 @@ var ErrInstanceNoAccess = errors.New(errors.DataNotExist, fmt.Errorf("instance i
var errInstanceBind = errors.New(errors.DataExist, fmt.Errorf("an instance can only bind one rule template"))
var ErrWrongTimePeriod = errors.New(errors.DataInvalid, fmt.Errorf("wrong time period"))
-type GetInstanceAdditionalMetasResV1 struct {
- controller.BaseRes
- Metas []*InstanceAdditionalMetaV1 `json:"data"`
-}
-
-type InstanceAdditionalMetaV1 struct {
- DBType string `json:"db_type"`
- Params []*InstanceAdditionalParamResV1 `json:"params"`
-}
-
type InstanceAdditionalParamResV1 struct {
Name string `json:"name" example:"param name" form:"name"`
Description string `json:"description" example:"参数项中文名" form:"description"`
@@ -40,123 +32,11 @@ type InstanceAdditionalParamResV1 struct {
Value string `json:"value" example:"0" form:"value"`
}
-// GetInstanceAdditionalMetas get instance additional metas
-// @Summary 获取实例的额外属性列表
-// @Description get instance additional metas
-// @Id getInstanceAdditionalMetas
-// @Tags instance
-// @Security ApiKeyAuth
-// @Success 200 {object} v1.GetInstanceAdditionalMetasResV1
-// @router /v1/instance_additional_metas [get]
-func GetInstanceAdditionalMetas(c echo.Context) error {
- additionalParams := driver.GetPluginManager().AllAdditionalParams()
- res := &GetInstanceAdditionalMetasResV1{
- BaseRes: controller.NewBaseReq(nil),
- Metas: []*InstanceAdditionalMetaV1{},
- }
- for name, params := range additionalParams {
- meta := &InstanceAdditionalMetaV1{
- DBType: name,
- Params: convertParamsToInstanceAdditionalParamRes(params),
- }
-
- res.Metas = append(res.Metas, meta)
- }
- return c.JSON(http.StatusOK, res)
-}
-
-func convertParamsToInstanceAdditionalParamRes(params params.Params) []*InstanceAdditionalParamResV1 {
- res := make([]*InstanceAdditionalParamResV1, len(params))
- for i, param := range params {
- res[i] = &InstanceAdditionalParamResV1{
- Name: param.Key,
- Description: param.Desc,
- Type: string(param.Type),
- Value: param.Value,
- }
- }
- return res
-}
-
-type CreateInstanceReqV1 struct {
- Name string `json:"instance_name" form:"instance_name" example:"test" valid:"required,name"`
- DBType string `json:"db_type" form:"db_type" example:"mysql"`
- User string `json:"db_user" form:"db_user" example:"root" valid:"required"`
- Host string `json:"db_host" form:"db_host" example:"10.10.10.10" valid:"required,ip_addr|uri|hostname|hostname_rfc1123"`
- Port string `json:"db_port" form:"db_port" example:"3306" valid:"required,port"`
- Password string `json:"db_password" form:"db_password" example:"123456" valid:"required"`
- Desc string `json:"desc" example:"this is a test instance"`
- SQLQueryConfig *SQLQueryConfigReqV1 `json:"sql_query_config" form:"sql_query_config"`
- MaintenanceTimes []*MaintenanceTimeReqV1 `json:"maintenance_times" form:"maintenance_times"`
- RuleTemplateName string `json:"rule_template_name" form:"rule_template_name"`
- AdditionalParams []*InstanceAdditionalParamReqV1 `json:"additional_params" form:"additional_params"`
-}
-
-type SQLQueryConfigReqV1 struct {
- MaxPreQueryRows int `json:"max_pre_query_rows" from:"max_pre_query_rows" example:"100"`
- QueryTimeoutSecond int `json:"query_timeout_second" from:"query_timeout_second" example:"10"`
- AuditEnabled bool `json:"audit_enabled" from:"audit_enabled" example:"false"`
- AllowQueryWhenLessThanAuditLevel string `json:"allow_query_when_less_than_audit_level" from:"allow_query_when_less_than_audit_level" enums:"normal,notice,warn,error" valid:"omitempty,oneof=normal notice warn error " example:"error"`
-}
-
type InstanceAdditionalParamReqV1 struct {
Name string `json:"name"`
Value string `json:"value"`
}
-type MaintenanceTimeReqV1 struct {
- MaintenanceStartTime *TimeReqV1 `json:"maintenance_start_time"`
- MaintenanceStopTime *TimeReqV1 `json:"maintenance_stop_time"`
-}
-
-type TimeReqV1 struct {
- Hour int `json:"hour"`
- Minute int `json:"minute"`
-}
-
-func ConvertMaintenanceTimeReqV1ToPeriod(mt []*MaintenanceTimeReqV1) model.Periods {
- periods := make(model.Periods, len(mt))
- for i, time := range mt {
- periods[i] = &model.Period{
- StartHour: time.MaintenanceStartTime.Hour,
- StartMinute: time.MaintenanceStartTime.Minute,
- EndHour: time.MaintenanceStopTime.Hour,
- EndMinute: time.MaintenanceStopTime.Minute,
- }
- }
- return periods
-}
-
-// CreateInstance create instance
-// @Deprecated
-// @Summary 添加实例
-// @Description create a instance
-// @Id createInstanceV1
-// @Tags instance
-// @Security ApiKeyAuth
-// @Accept json
-// @Param project_name path string true "project name"
-// @Param instance body v1.CreateInstanceReqV1 true "add instance"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/projects/{project_name}/instances [post]
-func CreateInstance(c echo.Context) error {
- return nil
-}
-
-type InstanceResV1 struct {
- Name string `json:"instance_name"`
- DBType string `json:"db_type" example:"mysql"`
- Host string `json:"db_host" example:"10.10.10.10"`
- Port string `json:"db_port" example:"3306"`
- User string `json:"db_user" example:"root"`
- Desc string `json:"desc" example:"this is a instance"`
- MaintenanceTimes []*MaintenanceTimeResV1 `json:"maintenance_times" from:"maintenance_times"`
- RuleTemplateName string `json:"rule_template_name,omitempty"`
- AdditionalParams []*InstanceAdditionalParamResV1 `json:"additional_params"`
- SQLQueryConfig *SQLQueryConfigResV1 `json:"sql_query_config"`
- Source string `json:"source" example:"SQLE"`
-}
-
type SQLQueryConfigResV1 struct {
MaxPreQueryRows int `json:"max_pre_query_rows"`
QueryTimeoutSecond int `json:"query_timeout_second"`
@@ -191,396 +71,6 @@ func ConvertPeriodToMaintenanceTimeResV1(mt model.Periods) []*MaintenanceTimeRes
return periods
}
-type GetInstanceResV1 struct {
- controller.BaseRes
- Data InstanceResV1 `json:"data"`
-}
-
-func convertInstanceToRes(instance *model.Instance) InstanceResV1 {
- instanceResV1 := InstanceResV1{
- Name: instance.Name,
- Host: instance.Host,
- Port: instance.Port,
- User: instance.User,
- Desc: instance.Desc,
- DBType: instance.DbType,
- MaintenanceTimes: ConvertPeriodToMaintenanceTimeResV1(instance.MaintenancePeriod),
- AdditionalParams: []*InstanceAdditionalParamResV1{},
- SQLQueryConfig: &SQLQueryConfigResV1{
- MaxPreQueryRows: instance.SqlQueryConfig.MaxPreQueryRows,
- QueryTimeoutSecond: instance.SqlQueryConfig.QueryTimeoutSecond,
- AuditEnabled: instance.SqlQueryConfig.AuditEnabled,
- AllowQueryWhenLessThanAuditLevel: instance.SqlQueryConfig.AllowQueryWhenLessThanAuditLevel,
- },
- Source: instance.Source,
- }
-
- if len(instance.RuleTemplates) > 0 {
- instanceResV1.RuleTemplateName = instance.RuleTemplates[0].Name
- }
-
- for _, param := range instance.AdditionalParams {
- instanceResV1.AdditionalParams = append(instanceResV1.AdditionalParams, &InstanceAdditionalParamResV1{
- Name: param.Key,
- Description: param.Desc,
- Type: string(param.Type),
- Value: fmt.Sprintf("%v", param.Value),
- })
- }
- return instanceResV1
-}
-
-// GetInstance get instance
-// @Summary 获取实例信息
-// @Description get instance db
-// @Id getInstanceV1
-// @Tags instance
-// @Security ApiKeyAuth
-// @Param project_name path string true "project name"
-// @Param instance_name path string true "instance name"
-// @Success 200 {object} v1.GetInstanceResV1
-// @router /v1/projects/{project_name}/instances/{instance_name}/ [get]
-func GetInstance(c echo.Context) error {
- s := model.GetStorage()
- instanceName := c.Param("instance_name")
- projectName := c.Param("project_name")
- username := controller.GetUserName(c)
- err := CheckIsProjectMember(username, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- instance, exist, err := s.GetInstanceDetailByNameAndProjectName(instanceName, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrInstanceNoAccess)
- }
-
- return c.JSON(http.StatusOK, &GetInstanceResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: convertInstanceToRes(instance),
- })
-}
-
-// DeleteInstance delete instance
-// @Summary 删除实例
-// @Description delete instance db
-// @Id deleteInstanceV1
-// @Tags instance
-// @Security ApiKeyAuth
-// @Param project_name path string true "project name"
-// @Param instance_name path string true "instance name"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/projects/{project_name}/instances/{instance_name}/ [delete]
-func DeleteInstance(c echo.Context) error {
- instanceName := c.Param("instance_name")
- projectName := c.Param("project_name")
- userName := controller.GetUserName(c)
-
- err := CheckIsProjectManager(userName, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- s := model.GetStorage()
- archived, err := s.IsProjectArchived(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if archived {
- return controller.JSONBaseErrorReq(c, ErrProjectArchived)
- }
-
- instance, exist, err := s.GetInstanceByNameAndProjectName(instanceName, projectName)
- if err != nil {
- return err
- }
- if !exist {
- return fmt.Errorf("instance %s not exist", instanceName)
- }
-
- if err = common.CheckDeleteInstance(instance.ID); err != nil {
- return controller.JSONBaseErrorReq(c, fmt.Errorf("%v can't be deleted. Cause: %v", instance.Name, err))
- }
-
- if err := s.DeleteInstance(instance); err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- return c.JSON(http.StatusOK, controller.NewBaseReq(nil))
-}
-
-type UpdateInstanceReqV1 struct {
- DBType *string `json:"db_type" form:"db_type" example:"mysql"`
- User *string `json:"db_user" form:"db_user" example:"root"`
- Host *string `json:"db_host" form:"db_host" example:"10.10.10.10" valid:"omitempty,ip_addr|uri|hostname|hostname_rfc1123"`
- Port *string `json:"db_port" form:"db_port" example:"3306" valid:"omitempty,port"`
- Password *string `json:"db_password" form:"db_password" example:"123456"`
- Desc *string `json:"desc" example:"this is a test instance"`
- MaintenanceTimes []*MaintenanceTimeReqV1 `json:"maintenance_times" from:"maintenance_times"`
- RuleTemplateName *string `json:"rule_template_name" form:"rule_template_name"`
- SQLQueryConfig *SQLQueryConfigReqV1 `json:"sql_query_config" from:"sql_query_config"`
- AdditionalParams []*InstanceAdditionalParamReqV1 `json:"additional_params" from:"additional_params"`
-}
-
-// UpdateInstance update instance
-// @Summary 更新实例
-// @Description update instance
-// @Id updateInstanceV1
-// @Tags instance
-// @Security ApiKeyAuth
-// @Param project_name path string true "project name"
-// @Param instance_name path string true "instance name"
-// @param instance body v1.UpdateInstanceReqV1 true "update instance request"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/projects/{project_name}/instances/{instance_name}/ [patch]
-func UpdateInstance(c echo.Context) error {
- req := new(UpdateInstanceReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
-
- maintenancePeriod := ConvertMaintenanceTimeReqV1ToPeriod(req.MaintenanceTimes)
- if !maintenancePeriod.SelfCheck() {
- return controller.JSONBaseErrorReq(c, ErrWrongTimePeriod)
- }
-
- instanceName := c.Param("instance_name")
- projectName := c.Param("project_name")
- userName := controller.GetUserName(c)
-
- err := CheckIsProjectManager(userName, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- s := model.GetStorage()
- archived, err := s.IsProjectArchived(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if archived {
- return controller.JSONBaseErrorReq(c, ErrProjectArchived)
- }
-
- instance, exist, err := s.GetInstanceByNameAndProjectName(instanceName, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrInstanceNotExist)
- }
-
- if instance.Source != model.InstanceSourceSQLE {
- if req.Desc != nil ||
- req.Host != nil ||
- req.Port != nil ||
- req.User != nil ||
- req.Password != nil {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataInvalid, fmt.Errorf("description, host, port, user, password of external instance can not be changed")))
- }
- }
-
- updateMap := map[string]interface{}{}
- if req.Desc != nil {
- updateMap["desc"] = *req.Desc
- }
- if req.Host != nil {
- updateMap["db_host"] = *req.Host
- }
- if req.Port != nil {
- updateMap["db_port"] = *req.Port
- }
- if req.User != nil {
- updateMap["db_user"] = *req.User
- }
-
- if req.MaintenanceTimes != nil {
- updateMap["maintenance_period"] = maintenancePeriod
- }
-
- if req.Password != nil {
- password, err := utils.AesEncrypt(*req.Password)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- updateMap["db_password"] = password
- }
-
- if req.RuleTemplateName != nil {
- var ruleTemplates []*model.RuleTemplate
- if *req.RuleTemplateName != "" {
- ruleTemplate, exist, err := s.GetGlobalAndProjectRuleTemplateByNameAndProjectId(*req.RuleTemplateName, instance.ProjectId)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrRuleTemplateNotExist)
- }
- err = CheckInstanceAndRuleTemplateDbType([]*model.RuleTemplate{ruleTemplate}, instance)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- ruleTemplates = append(ruleTemplates, ruleTemplate)
- }
-
- err = s.UpdateInstanceRuleTemplates(instance, ruleTemplates...)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- }
-
- if req.AdditionalParams != nil {
- additionalParams := driver.GetPluginManager().AllAdditionalParams()[instance.DbType]
- for _, additionalParam := range req.AdditionalParams {
- err = additionalParams.SetParamValue(additionalParam.Name, additionalParam.Value)
- if err != nil {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataInvalid, err))
- }
- }
- updateMap["additional_params"] = additionalParams
- }
-
- if req.SQLQueryConfig != nil {
- if req.SQLQueryConfig.AuditEnabled && req.SQLQueryConfig.AllowQueryWhenLessThanAuditLevel == "" {
- req.SQLQueryConfig.AllowQueryWhenLessThanAuditLevel = string(driverV2.RuleLevelError)
- }
-
- maxPreQueryRows := req.SQLQueryConfig.MaxPreQueryRows
- queryTimeout := req.SQLQueryConfig.QueryTimeoutSecond
-
- // default value
- if queryTimeout == 0 {
- queryTimeout = 10
- }
- // default value
- if maxPreQueryRows == 0 {
- maxPreQueryRows = 100
- }
-
- updateMap["sql_query_config"] = model.SqlQueryConfig{
- MaxPreQueryRows: maxPreQueryRows,
- QueryTimeoutSecond: queryTimeout,
- AuditEnabled: req.SQLQueryConfig.AuditEnabled,
- AllowQueryWhenLessThanAuditLevel: req.SQLQueryConfig.AllowQueryWhenLessThanAuditLevel,
- }
- }
-
- err = s.UpdateInstanceById(instance.ID, updateMap)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- return c.JSON(http.StatusOK, controller.NewBaseReq(nil))
-}
-
-type GetInstancesReqV1 struct {
- FilterInstanceName string `json:"filter_instance_name" query:"filter_instance_name"`
- FilterDBType string `json:"filter_db_type" query:"filter_db_type"`
- FilterDBHost string `json:"filter_db_host" query:"filter_db_host"`
- FilterDBPort string `json:"filter_db_port" query:"filter_db_port"`
- FilterDBUser string `json:"filter_db_user" query:"filter_db_user"`
- FilterRuleTemplateName string `json:"filter_rule_template_name" query:"filter_rule_template_name"`
- PageIndex uint32 `json:"page_index" query:"page_index" valid:"required"`
- PageSize uint32 `json:"page_size" query:"page_size" valid:"required"`
-}
-
-type GetInstancesResV1 struct {
- controller.BaseRes
- Data []InstanceResV1 `json:"data"`
- TotalNums uint64 `json:"total_nums"`
-}
-
-// GetInstances get instances
-// @Summary 获取实例信息列表
-// @Description get instance info list
-// @Id getInstanceListV1
-// @Tags instance
-// @Security ApiKeyAuth
-// @Param project_name path string true "project name"
-// @Param filter_instance_name query string false "filter instance name"
-// @Param filter_db_type query string false "filter db type"
-// @Param filter_db_host query string false "filter db host"
-// @Param filter_db_port query string false "filter db port"
-// @Param filter_db_user query string false "filter db user"
-// @Param filter_rule_template_name query string false "filter rule template name"
-// @Param page_index query uint32 true "page index"
-// @Param page_size query uint32 true "size of per page"
-// @Success 200 {object} v1.GetInstancesResV1
-// @router /v1/projects/{project_name}/instances [get]
-func GetInstances(c echo.Context) error {
- req := new(GetInstancesReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
- s := model.GetStorage()
-
- user, err := controller.GetCurrentUser(c)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- projectName := c.Param("project_name")
- err = CheckIsProjectMember(user.Name, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- var offset uint32
- if req.PageIndex >= 1 {
- offset = req.PageSize * (req.PageIndex - 1)
- }
- data := map[string]interface{}{
- "filter_instance_name": req.FilterInstanceName,
- "filter_project_name": projectName,
- "filter_db_host": req.FilterDBHost,
- "filter_db_port": req.FilterDBPort,
- "filter_db_user": req.FilterDBUser,
- "filter_rule_template_name": req.FilterRuleTemplateName,
- "filter_db_type": req.FilterDBType,
- "limit": req.PageSize,
- "offset": offset,
- }
-
- instances, count, err := s.GetInstancesByReq(data, user)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- instancesRes := []InstanceResV1{}
- for _, instance := range instances {
- ruleTemplateName := ""
- if len(instance.RuleTemplateNames) >= 1 {
- ruleTemplateName = instance.RuleTemplateNames[0]
- }
-
- instanceReq := InstanceResV1{
- Name: instance.Name,
- DBType: instance.DbType,
- Host: instance.Host,
- Port: instance.Port,
- User: instance.User,
- Desc: instance.Desc,
- MaintenanceTimes: ConvertPeriodToMaintenanceTimeResV1(instance.MaintenancePeriod),
- RuleTemplateName: ruleTemplateName,
- SQLQueryConfig: &SQLQueryConfigResV1{
- MaxPreQueryRows: instance.SqlQueryConfig.MaxPreQueryRows,
- QueryTimeoutSecond: instance.SqlQueryConfig.QueryTimeoutSecond,
- AuditEnabled: instance.SqlQueryConfig.AuditEnabled,
- AllowQueryWhenLessThanAuditLevel: instance.SqlQueryConfig.AllowQueryWhenLessThanAuditLevel,
- },
- Source: instance.Source,
- }
- instancesRes = append(instancesRes, instanceReq)
- }
- return c.JSON(http.StatusOK, &GetInstancesResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: instancesRes,
- TotalNums: count,
- })
-}
-
type GetInstanceConnectableResV1 struct {
controller.BaseRes
Data InstanceConnectableResV1 `json:"data"`
@@ -614,33 +104,29 @@ func newInstanceConnectableResV1(err error) InstanceConnectableResV1 {
// @Success 200 {object} v1.GetInstanceConnectableResV1
// @router /v1/projects/{project_name}/instances/{instance_name}/connection [get]
func CheckInstanceIsConnectableByName(c echo.Context) error {
- s := model.GetStorage()
-
instanceName := c.Param("instance_name")
- projectName := c.Param("project_name")
- userName := controller.GetUserName(c)
-
- err := CheckIsProjectMember(userName, projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- instance, exist, err := s.GetInstanceByNameAndProjectName(instanceName, projectName)
+ instance, exist, err := dms.GetInstanceInProjectByName(c.Request().Context(), projectUid, instanceName)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
if !exist {
return controller.JSONBaseErrorReq(c, ErrInstanceNoAccess)
}
- can, err := checkCurrentUserCanAccessInstance(c, instance)
+
+ can, err := CheckCurrentUserCanAccessInstances(c.Request().Context(), projectUid, controller.GetUserID(c), []*model.Instance{instance})
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
if !can {
return controller.JSONBaseErrorReq(c, ErrInstanceNoAccess)
}
- l := log.NewEntry()
+ l := log.NewEntry()
err = common.CheckInstanceIsConnectable(instance)
if err != nil {
l.Warnf("instance %s is not connectable, err: %s", instanceName, err)
@@ -686,10 +172,7 @@ func BatchCheckInstanceConnections(c echo.Context) error {
return controller.JSONBaseErrorReq(c, err)
}
- projectName := c.Param("project_name")
- userName := controller.GetUserName(c)
-
- err := CheckIsProjectMember(userName, projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -701,8 +184,7 @@ func BatchCheckInstanceConnections(c echo.Context) error {
distinctInstNames := utils.RemoveDuplicate(instanceNames)
- s := model.GetStorage()
- instances, err := s.GetInstancesByNamesAndProjectName(distinctInstNames, projectName)
+ instances, err := dms.GetInstancesInProjectByNames(c.Request().Context(), projectUid, distinctInstNames)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -711,7 +193,7 @@ func BatchCheckInstanceConnections(c echo.Context) error {
return controller.JSONBaseErrorReq(c, ErrInstanceNoAccess)
}
- can, err := checkCurrentUserCanAccessInstances(c, instances)
+ can, err := CheckCurrentUserCanAccessInstances(c.Request().Context(), projectUid, controller.GetUserID(c), instances)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -747,18 +229,8 @@ type GetInstanceConnectableReqV1 struct {
AdditionalParams []*InstanceAdditionalParamReqV1 `json:"additional_params" from:"additional_params"`
}
-// CheckInstanceIsConnectable test instance db connection
-// @Summary 实例连通性测试(实例提交前)
-// @Description test instance db connection 注:可直接提交创建实例接口的body,该接口的json 内容是创建实例的 json 的子集
-// @Accept json
-// @Id checkInstanceIsConnectableV1
-// @Tags instance
-// @Security ApiKeyAuth
-// @Param instance body v1.GetInstanceConnectableReqV1 true "instance info"
-// @Success 200 {object} v1.GetInstanceConnectableResV1
-// @router /v1/instance_connection [post]
func CheckInstanceIsConnectable(c echo.Context) error {
- req := new(GetInstanceConnectableReqV1)
+ req := new(v1.CheckDbConnectable)
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
@@ -788,12 +260,9 @@ func CheckInstanceIsConnectable(c echo.Context) error {
err := common.CheckInstanceIsConnectable(instance)
if err != nil {
l.Warnf("check instance is connectable failed: %v", err)
+ return c.JSON(http.StatusOK, baseV1.GenericResp{Code: http.StatusBadRequest, Message: err.Error()})
}
-
- return c.JSON(http.StatusOK, GetInstanceConnectableResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: newInstanceConnectableResV1(err),
- })
+ return c.JSON(http.StatusOK, baseV1.GenericResp{Message: "OK"})
}
type GetInstanceSchemaResV1 struct {
@@ -816,25 +285,21 @@ type InstanceSchemaResV1 struct {
// @Success 200 {object} v1.GetInstanceSchemaResV1
// @router /v1/projects/{project_name}/instances/{instance_name}/schemas [get]
func GetInstanceSchemas(c echo.Context) error {
- s := model.GetStorage()
-
instanceName := c.Param("instance_name")
- projectName := c.Param("project_name")
- userName := controller.GetUserName(c)
-
- err := CheckIsProjectMember(userName, projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- instance, exist, err := s.GetInstanceByNameAndProjectName(instanceName, projectName)
+ instance, exist, err := dms.GetInstanceInProjectByName(c.Request().Context(), projectUid, instanceName)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
if !exist {
return controller.JSONBaseErrorReq(c, ErrInstanceNoAccess)
}
- can, err := checkCurrentUserCanAccessInstance(c, instance)
+
+ can, err := CheckCurrentUserCanAccessInstances(c.Request().Context(), projectUid, controller.GetUserID(c), []*model.Instance{instance})
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -872,6 +337,7 @@ type InstanceTipReqV1 struct {
}
type InstanceTipResV1 struct {
+ ID string `json:"instance_id"`
Name string `json:"instance_name"`
Type string `json:"instance_type"`
WorkflowTemplateId uint32 `json:"workflow_template_id"`
@@ -901,35 +367,46 @@ func GetInstanceTips(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
- projectName := c.Param("project_name")
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
- s := model.GetStorage()
- user, err := controller.GetCurrentUser(c)
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- var instances []*model.Instance
+ var operationType v1.OpPermissionType
switch req.FunctionalModule {
case create_audit_plan:
- instances, err = s.GetInstanceTipsByUserAndOperation(user, req.FilterDBType, projectName, model.OP_AUDIT_PLAN_SAVE)
+ operationType = v1.OpPermissionTypeSaveAuditPlan
case create_workflow:
- instances, err = s.GetInstanceTipsByUserAndOperation(user, req.FilterDBType, projectName, model.OP_WORKFLOW_SAVE)
+ operationType = v1.OpPermissionTypeCreateWorkflow
default:
- instances, err = s.GetInstanceTipsByUser(user, req.FilterDBType, projectName)
}
+
+ instances, err := GetCanOperationInstances(c.Request().Context(), user, req.FilterDBType, projectUid, operationType)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
-
+ s := model.GetStorage()
+ template, exist, err := s.GetWorkflowTemplateByProjectId(model.ProjectUID(projectUid))
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ if !exist {
+ return controller.JSONBaseErrorReq(c, fmt.Errorf("current project doesn't has workflow template"))
+ }
instanceTipsResV1 := make([]InstanceTipResV1, 0, len(instances))
for _, inst := range instances {
instanceTipRes := InstanceTipResV1{
+ ID: inst.GetIDStr(),
Name: inst.Name,
Type: inst.DbType,
Host: inst.Host,
Port: inst.Port,
- WorkflowTemplateId: uint32(inst.WorkflowTemplateId),
+ WorkflowTemplateId: uint32(template.ID),
}
instanceTipsResV1 = append(instanceTipsResV1, instanceTipRes)
}
@@ -954,23 +431,20 @@ func GetInstanceRules(c echo.Context) error {
s := model.GetStorage()
instanceName := c.Param("instance_name")
- projectName := c.Param("project_name")
- userName := controller.GetUserName(c)
-
- err := CheckIsProjectMember(userName, projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- instance, exist, err := s.GetInstanceByNameAndProjectName(instanceName, projectName)
+ instance, exist, err := dms.GetInstanceInProjectByName(c.Request().Context(), projectUid, instanceName)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
-
if !exist {
return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist, fmt.Errorf("instance is not exist")))
}
- can, err := checkCurrentUserCanAccessInstance(c, instance)
+
+ can, err := CheckCurrentUserCanAccessInstances(c.Request().Context(), projectUid, controller.GetUserID(c), []*model.Instance{instance})
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -978,7 +452,7 @@ func GetInstanceRules(c echo.Context) error {
return controller.JSONBaseErrorReq(c, ErrInstanceNoAccess)
}
- rules, _, err := s.GetAllRulesByInstanceId(fmt.Sprintf("%d", instance.ID))
+ rules, _, err := s.GetAllRulesByInstance(instance)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -1079,31 +553,3 @@ type GetTableMetadataResV1 struct {
func GetTableMetadata(c echo.Context) error {
return getTableMetadata(c)
}
-
-type GetInstanceTypeLogoReqV1 struct {
- InstanceType string `json:"instance_type" query:"instance_type"`
-}
-
-// GetInstanceTypeLogo
-// @Summary 获取实例类型logo
-// @Description get instance type logo
-// @Id getInstanceTypeLogo
-// @Tags instance
-// @Param instance_type query string true "instance type"
-// @Security ApiKeyAuth
-// @Success 200 {file} file "get instance type logo"
-// @router /v1/static/instance_logo [get]
-func GetInstanceTypeLogo(c echo.Context) error {
- req := new(GetInstanceTypeLogoReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- instanceTypeLogoMap := driver.GetPluginManager().AllLogo()
-
- if logo, ok := instanceTypeLogoMap[req.InstanceType]; ok {
- return c.Blob(http.StatusOK, "image/png", logo)
- }
-
- return c.Blob(http.StatusOK, "image/png", defaultInstanceLogo)
-}
diff --git a/sqle/api/controller/v1/management_permission.go b/sqle/api/controller/v1/management_permission.go
deleted file mode 100644
index f0144fefc1..0000000000
--- a/sqle/api/controller/v1/management_permission.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package v1
-
-import (
- "net/http"
-
- "github.com/actiontech/sqle/sqle/api/controller"
- "github.com/actiontech/sqle/sqle/model"
-
- "github.com/labstack/echo/v4"
-)
-
-type GetManagementPermissionsResV1 struct {
- controller.BaseRes
- Data []*ManagementPermissionResV1 `json:"data"`
-}
-
-type ManagementPermissionResV1 struct {
- Code uint `json:"code"`
- Desc string `json:"desc"`
-}
-
-func generateManagementPermissionResV1(code uint) ManagementPermissionResV1 {
- return ManagementPermissionResV1{
- Code: code,
- Desc: model.GetManagementPermissionDesc(code),
- }
-}
-
-func generateManagementPermissionResV1s(code []uint) []*ManagementPermissionResV1 {
- m := []*ManagementPermissionResV1{}
- for _, u := range code {
- p := generateManagementPermissionResV1(u)
- m = append(m, &p)
- }
- return m
-}
-
-// GetManagementPermissions
-// @Summary 获取平台管理权限列表
-// @Description get platform management permissions
-// @Id GetManagementPermissionsV1
-// @Tags management_permission
-// @Security ApiKeyAuth
-// @Success 200 {object} v1.GetManagementPermissionsResV1
-// @Router /v1/management_permissions [get]
-func GetManagementPermissions(c echo.Context) error {
- p := model.GetManagementPermission()
- data := []*ManagementPermissionResV1{}
- for u, s := range p {
- data = append(data, &ManagementPermissionResV1{
- Code: u,
- Desc: s,
- })
- }
-
- return c.JSON(http.StatusOK, GetManagementPermissionsResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: data,
- })
-}
diff --git a/sqle/api/controller/v1/oauth2.go b/sqle/api/controller/v1/oauth2.go
deleted file mode 100644
index 8525290ed7..0000000000
--- a/sqle/api/controller/v1/oauth2.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package v1
-
-import (
- "github.com/actiontech/sqle/sqle/api/controller"
- "github.com/labstack/echo/v4"
-)
-
-// @Summary oauth2通过此链接跳转到第三方登录网址
-// @Description oauth2 link
-// @Id Oauth2Link
-// @Tags oauth2
-// @router /v1/oauth2/link [get]
-func Oauth2Link(c echo.Context) error {
- return oauth2Link(c)
-}
-
-// Oauth2Callback is a hidden interface for third-party platform callbacks for oauth2 verification
-func Oauth2Callback(c echo.Context) error {
- return oauth2Callback(c)
-}
-
-type BindOauth2UserReqV1 struct {
- UserName string `json:"user_name" from:"user_name" valid:"required"`
- Pwd string `json:"pwd" from:"pwd" valid:"required"`
- Oauth2Token string `json:"oauth2_token" from:"oauth2_token" valid:"required"`
-}
-
-type BindOauth2UserResV1 struct {
- controller.BaseRes
- Data BindOauth2UserResDataV1 `json:"data"`
-}
-
-type BindOauth2UserResDataV1 struct {
- Token string `json:"token"`
-}
-
-// @Summary 绑定 Oauth2 和 sqle用户
-// @Description bind Oauth2 user to sqle
-// @Id bindOauth2User
-// @Tags oauth2
-// @Param conf body v1.BindOauth2UserReqV1 true "bind oauth2 user req"
-// @Success 200 {object} v1.BindOauth2UserResV1
-// @router /v1/oauth2/user/bind [post]
-func BindOauth2User(c echo.Context) error {
- return bindOauth2User(c)
-}
diff --git a/sqle/api/controller/v1/oauth2_ce.go b/sqle/api/controller/v1/oauth2_ce.go
deleted file mode 100644
index 0b1ade4e11..0000000000
--- a/sqle/api/controller/v1/oauth2_ce.go
+++ /dev/null
@@ -1,27 +0,0 @@
-//go:build !enterprise
-// +build !enterprise
-
-package v1
-
-import (
- "fmt"
-
- "github.com/actiontech/sqle/sqle/api/controller"
- "github.com/actiontech/sqle/sqle/errors"
-
- "github.com/labstack/echo/v4"
-)
-
-var errNotSupportOauth2 = errors.New(errors.EnterpriseEditionFeatures, fmt.Errorf("oauth2 related functions are enterprise version functions"))
-
-func oauth2Link(c echo.Context) error {
- return controller.JSONBaseErrorReq(c, errNotSupportOauth2)
-}
-
-func oauth2Callback(c echo.Context) error {
- return controller.JSONBaseErrorReq(c, errNotSupportOauth2)
-}
-
-func bindOauth2User(c echo.Context) error {
- return controller.JSONBaseErrorReq(c, errNotSupportOauth2)
-}
diff --git a/sqle/api/controller/v1/project.go b/sqle/api/controller/v1/project.go
deleted file mode 100644
index 2a7f617103..0000000000
--- a/sqle/api/controller/v1/project.go
+++ /dev/null
@@ -1,322 +0,0 @@
-package v1
-
-import (
- "fmt"
- "net/http"
- "time"
-
- "github.com/actiontech/sqle/sqle/api/controller"
- "github.com/actiontech/sqle/sqle/errors"
- "github.com/actiontech/sqle/sqle/model"
-
- "github.com/labstack/echo/v4"
-)
-
-var (
- ErrProjectNotExist = func(projectName string) error {
- return errors.New(errors.DataNotExist, fmt.Errorf("project [%v] is not exist", projectName))
- }
- ErrProjectArchived = errors.New(errors.ErrAccessDeniedError, fmt.Errorf("project is archived"))
-)
-
-type GetProjectReqV1 struct {
- PageIndex uint32 `json:"page_index" query:"page_index" valid:"required"`
- PageSize uint32 `json:"page_size" query:"page_size" valid:"required"`
-}
-
-type GetProjectResV1 struct {
- controller.BaseRes
- Data []*ProjectListItem `json:"data"`
- TotalNums uint64 `json:"total_nums"`
-}
-
-type ProjectListItem struct {
- Name string `json:"name"`
- Desc string `json:"desc"`
- CreateUserName string `json:"create_user_name"`
- CreateTime *time.Time `json:"create_time"`
- Archived bool `json:"archived"`
-}
-
-// GetProjectListV1
-// @Summary 获取项目列表
-// @Description get project list
-// @Tags project
-// @Id getProjectListV1
-// @Security ApiKeyAuth
-// @Param page_index query uint32 true "page index"
-// @Param page_size query uint32 true "size of per page" default(50)
-// @Success 200 {object} v1.GetProjectResV1
-// @router /v1/projects [get]
-func GetProjectListV1(c echo.Context) error {
- req := new(GetProjectReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
-
- limit, offset := controller.GetLimitAndOffset(req.PageIndex, req.PageSize)
-
- user := controller.GetUserName(c)
-
- mp := map[string]interface{}{
- "limit": limit,
- "offset": offset,
- "filter_user_name": user,
- }
-
- s := model.GetStorage()
- projects, total, err := s.GetProjectsByReq(mp)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- resp := []*ProjectListItem{}
- for _, project := range projects {
- resp = append(resp, &ProjectListItem{
- Name: project.Name,
- Desc: project.Desc,
- CreateUserName: project.CreateUserName,
- CreateTime: &project.CreateTime,
- Archived: project.Status == model.ProjectStatusArchived,
- })
- }
-
- return c.JSON(http.StatusOK, &GetProjectResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: resp,
- TotalNums: total,
- })
-}
-
-type GetProjectDetailResV1 struct {
- controller.BaseRes
- Data ProjectDetailItem `json:"data"`
-}
-
-type ProjectDetailItem struct {
- Name string `json:"name"`
- Desc string `json:"desc"`
- CreateUserName string `json:"create_user_name"`
- CreateTime *time.Time `json:"create_time"`
- Archived bool `json:"archived"`
-}
-
-// GetProjectDetailV1
-// @Summary 获取项目详情
-// @Description get project detail
-// @Tags project
-// @Id getProjectDetailV1
-// @Security ApiKeyAuth
-// @Param project_name path string true "project name"
-// @Success 200 {object} v1.GetProjectDetailResV1
-// @router /v1/projects/{project_name}/ [get]
-func GetProjectDetailV1(c echo.Context) error {
- projectName := c.Param("project_name")
- userName := controller.GetUserName(c)
- s := model.GetStorage()
- err := CheckIsProjectMember(userName, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- project, exist, err := s.GetProjectByName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrProjectNotExist(projectName))
- }
-
- return c.JSON(http.StatusOK, GetProjectDetailResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: ProjectDetailItem{
- Name: project.Name,
- Desc: project.Desc,
- CreateUserName: project.CreateUser.Name,
- CreateTime: &project.CreatedAt,
- Archived: project.Status == model.ProjectStatusArchived,
- },
- })
-}
-
-type CreateProjectReqV1 struct {
- Name string `json:"name" valid:"required"`
- Desc string `json:"desc"`
-}
-
-// CreateProjectV1
-// @Summary 创建项目
-// @Description create project
-// @Accept json
-// @Produce json
-// @Tags project
-// @Id createProjectV1
-// @Security ApiKeyAuth
-// @Param project body v1.CreateProjectReqV1 true "create project request"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/projects [post]
-func CreateProjectV1(c echo.Context) error {
- return createProjectV1(c)
-}
-
-type UpdateProjectReqV1 struct {
- Desc *string `json:"desc"`
-}
-
-// UpdateProjectV1
-// @Summary 更新项目
-// @Description update project
-// @Accept json
-// @Produce json
-// @Tags project
-// @Id updateProjectV1
-// @Security ApiKeyAuth
-// @Param project_name path string true "project name"
-// @Param project body v1.UpdateProjectReqV1 true "create project request"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/projects/{project_name}/ [patch]
-func UpdateProjectV1(c echo.Context) error {
- req := new(UpdateProjectReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
-
- user, err := controller.GetCurrentUser(c)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- projectName := c.Param("project_name")
- err = CheckIsProjectManager(user.Name, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- s := model.GetStorage()
- archived, err := s.IsProjectArchived(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if archived {
- return controller.JSONBaseErrorReq(c, ErrProjectArchived)
- }
-
- sure, err := s.CheckUserCanUpdateProject(projectName, user.ID)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !sure {
- return controller.JSONBaseErrorReq(c, fmt.Errorf("you can not modify this project"))
- }
-
- attr := map[string]interface{}{}
- if req.Desc != nil {
- attr["desc"] = *req.Desc
- }
-
- return controller.JSONBaseErrorReq(c, s.UpdateProjectInfoByID(projectName, attr))
-}
-
-// DeleteProjectV1
-// @Summary 删除项目
-// @Description delete project
-// @Id deleteProjectV1
-// @Tags project
-// @Security ApiKeyAuth
-// @Param project_name path string true "project name"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/projects/{project_name}/ [delete]
-func DeleteProjectV1(c echo.Context) error {
- return deleteProjectV1(c)
-}
-
-type GetProjectTipsReqV1 struct {
- FunctionalModule string `json:"functional_module" query:"functional_module"`
-}
-
-type GetProjectTipsResV1 struct {
- controller.BaseRes
- Data []ProjectTipResV1 `json:"data"`
-}
-
-type ProjectTipResV1 struct {
- Name string `json:"project_name"`
-}
-
-// GetProjectTipsV1
-// @Summary 获取项目提示列表
-// @Description get project tip list
-// @Tags project
-// @Id getProjectTipsV1
-// @Security ApiKeyAuth
-// @Param functional_module query string false "functional module" Enums(operation_record)
-// @Success 200 {object} v1.GetProjectTipsResV1
-// @router /v1/project_tips [get]
-func GetProjectTipsV1(c echo.Context) error {
- req := new(GetProjectTipsReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- s := model.GetStorage()
-
- data := []ProjectTipResV1{}
-
- switch req.FunctionalModule {
- case "operation_record":
- projectNameList, err := s.GetOperationRecordProjectNameList()
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- for _, projectName := range projectNameList {
- data = append(data, ProjectTipResV1{
- Name: projectName,
- })
- }
- default:
- projects, err := s.GetProjectTips(controller.GetUserName(c))
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- for _, project := range projects {
- data = append(data, ProjectTipResV1{
- Name: project.Name,
- })
- }
- }
-
- return c.JSON(http.StatusOK, GetProjectTipsResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: data,
- })
-}
-
-// ArchiveProjectV1
-// @Summary 归档项目
-// @Description archive project
-// @Accept json
-// @Produce json
-// @Tags project
-// @Id archiveProjectV1
-// @Security ApiKeyAuth
-// @Param project_name path string true "project name"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/projects/{project_name}/archive [post]
-func ArchiveProjectV1(c echo.Context) error {
- return archiveProjectV1(c)
-}
-
-// UnarchiveProjectV1
-// @Summary 取消归档项目
-// @Description archive project
-// @Accept json
-// @Produce json
-// @Tags project
-// @Id unarchiveProjectV1
-// @Security ApiKeyAuth
-// @Param project_name path string true "project name"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/projects/{project_name}/unarchive [post]
-func UnarchiveProjectV1(c echo.Context) error {
- return unarchiveProjectV1(c)
-}
diff --git a/sqle/api/controller/v1/project_ce.go b/sqle/api/controller/v1/project_ce.go
deleted file mode 100644
index de6ddb216d..0000000000
--- a/sqle/api/controller/v1/project_ce.go
+++ /dev/null
@@ -1,34 +0,0 @@
-//go:build !enterprise
-// +build !enterprise
-
-package v1
-
-import (
- e "errors"
-
- "github.com/actiontech/sqle/sqle/api/controller"
- "github.com/actiontech/sqle/sqle/errors"
-
- "github.com/labstack/echo/v4"
-)
-
-var errCommunityEditionDoesNotSupportCreateProject = errors.New(errors.EnterpriseEditionFeatures, e.New("community edition does not support create project"))
-var errCommunityEditionDoesNotSupportDeleteProject = errors.New(errors.EnterpriseEditionFeatures, e.New("community edition does not support delete project"))
-var errCommunityEditionDoesNotSupportArchiveProject = errors.New(errors.EnterpriseEditionFeatures, e.New("community edition does not support suspend project"))
-var errCommunityEditionDoesNotSupportUnarchiveProject = errors.New(errors.EnterpriseEditionFeatures, e.New("community edition does not support unarchive project"))
-
-func createProjectV1(c echo.Context) error {
- return controller.JSONBaseErrorReq(c, errCommunityEditionDoesNotSupportCreateProject)
-}
-
-func deleteProjectV1(c echo.Context) error {
- return controller.JSONBaseErrorReq(c, errCommunityEditionDoesNotSupportDeleteProject)
-}
-
-func archiveProjectV1(c echo.Context) error {
- return controller.JSONBaseErrorReq(c, errCommunityEditionDoesNotSupportArchiveProject)
-}
-
-func unarchiveProjectV1(c echo.Context) error {
- return controller.JSONBaseErrorReq(c, errCommunityEditionDoesNotSupportUnarchiveProject)
-}
diff --git a/sqle/api/controller/v1/project_permission.go b/sqle/api/controller/v1/project_permission.go
index eac50c1e22..815b7fb06a 100644
--- a/sqle/api/controller/v1/project_permission.go
+++ b/sqle/api/controller/v1/project_permission.go
@@ -1,70 +1,33 @@
package v1
import (
+ "context"
"fmt"
+ "strconv"
+ dmsV1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+ v1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+ "github.com/actiontech/dms/pkg/dms-common/dmsobject"
"github.com/actiontech/sqle/sqle/api/controller"
+ "github.com/actiontech/sqle/sqle/dms"
"github.com/actiontech/sqle/sqle/errors"
"github.com/actiontech/sqle/sqle/model"
+
"github.com/labstack/echo/v4"
)
-/*
-
-project permission.
-
-*/
-
-func CheckIsProjectMember(userName, projectName string) error {
- if userName == model.DefaultAdminUser {
- return nil
- }
- s := model.GetStorage()
- isMember, err := s.IsUserInProject(userName, projectName)
+func CheckCurrentUserCanOperateWorkflow(c echo.Context, projectUid string, workflow *model.Workflow, ops []dmsV1.OpPermissionType) error {
+ userId := controller.GetUserID(c)
+ up, err := dms.NewUserPermission(userId, projectUid)
if err != nil {
return err
}
- if !isMember {
- return errors.New(errors.UserNotPermission, fmt.Errorf("the project does not exist or user %v is not in project %v", userName, projectName))
- }
- return nil
-}
-
-func CheckIsProjectManager(userName, projectName string) error {
- if userName == model.DefaultAdminUser {
+ if up.IsAdmin() {
return nil
}
- s := model.GetStorage()
- isManager, err := s.IsProjectManager(userName, projectName)
- if err != nil {
- return err
- }
- if !isManager {
- return errors.New(errors.UserNotPermission, fmt.Errorf("the project does not exist or the user does not have permission to operate"))
- }
- return nil
-}
-
-func CheckCurrentUserCanOperateTasks(c echo.Context, project *model.Project, workflow *model.Workflow, ops []uint, taskIdList []uint) error {
- if controller.GetUserName(c) == model.DefaultAdminUser {
- return nil
- }
- user, err := controller.GetCurrentUser(c)
- if err != nil {
- return err
- }
s := model.GetStorage()
-
- isManager, err := s.IsProjectManager(user.Name, project.Name)
- if err != nil {
- return err
- }
- if isManager {
- return nil
- }
-
- access, err := s.UserCanAccessWorkflow(user, workflow)
+ access, err := s.UserCanAccessWorkflow(userId, workflow)
if err != nil {
return err
}
@@ -73,92 +36,79 @@ func CheckCurrentUserCanOperateTasks(c echo.Context, project *model.Project, wor
}
if len(ops) > 0 {
- instances, err := s.GetInstanceByTaskIDList(taskIdList)
- if err != nil {
- return err
- }
-
- ok, err := s.CheckUserHasOpToInstances(user, instances, ops)
- if err != nil {
- return err
- }
- if ok {
- return nil
+ for _, item := range workflow.Record.InstanceRecords {
+ if !up.CanOpInstanceNoAdmin(item.Instance.GetIDStr(), ops...) {
+ return ErrWorkflowNoAccess
+ }
}
+ return nil
}
-
return ErrWorkflowNoAccess
}
-/*
-
-workflow permission.
-
-*/
-
-func CheckCurrentUserCanOperateWorkflow(c echo.Context, project *model.Project, workflow *model.Workflow, ops []uint) error {
- if controller.GetUserName(c) == model.DefaultAdminUser {
- return nil
- }
- user, err := controller.GetCurrentUser(c)
- if err != nil {
- return err
- }
-
- s := model.GetStorage()
-
- isManager, err := s.IsProjectManager(user.Name, project.Name)
+func CheckCurrentUserCanOperateTasks(c echo.Context, projectUid string, workflow *model.Workflow, ops []dmsV1.OpPermissionType, taskIdList []uint) error {
+ userId := controller.GetUserID(c)
+ up, err := dms.NewUserPermission(userId, projectUid)
if err != nil {
return err
}
- if isManager {
+ if up.IsAdmin() {
return nil
}
- access, err := s.UserCanAccessWorkflow(user, workflow)
+ s := model.GetStorage()
+
+ access, err := s.UserCanAccessWorkflow(userId, workflow)
if err != nil {
return err
}
if access {
return nil
}
+
if len(ops) > 0 {
- instances, err := s.GetInstancesByWorkflowID(workflow.ID)
+ workflowInstances, err := s.GetWorkInstanceRecordByTaskIds(taskIdList)
if err != nil {
return err
}
- ok, err := s.CheckUserHasOpToInstances(user, instances, ops)
+
+ instanceIds := make([]uint64, 0, len(workflowInstances))
+ for _, item := range workflowInstances {
+ instanceIds = append(instanceIds, item.InstanceId)
+ }
+
+ instances, err := dms.GetInstancesInProjectByIds(c.Request().Context(), projectUid, instanceIds)
if err != nil {
return err
}
- if ok {
- return nil
+ for _, instance := range instances {
+ if up.CanOpInstanceNoAdmin(instance.GetIDStr(), ops...) {
+ return nil
+ }
}
}
+
return ErrWorkflowNoAccess
}
-func checkCurrentUserCanAccessTask(c echo.Context, task *model.Task, ops []uint) error {
- user, err := controller.GetCurrentUser(c)
- if err != nil {
- return err
- }
-
- if controller.GetUserName(c) == model.DefaultAdminUser {
+func checkCurrentUserCanAccessTask(c echo.Context, task *model.Task, ops []dmsV1.OpPermissionType) error {
+ userId := controller.GetUserID(c)
+ // todo issues-2005
+ if task.Instance == nil || task.Instance.ProjectId == "" {
return nil
}
- if user.ID == task.CreateUserId {
- return nil
- }
- s := model.GetStorage()
- isManager, err := s.IsProjectManagerByID(user.ID, task.Instance.ProjectId)
+ up, err := dms.NewUserPermission(userId, task.Instance.ProjectId)
if err != nil {
return err
}
- if isManager {
+ if up.IsAdmin() {
+ return nil
+ }
+ if userId == fmt.Sprintf("%d", task.CreateUserId) {
return nil
}
+ s := model.GetStorage()
workflow, exist, err := s.GetWorkflowByTaskId(task.ID)
if err != nil {
return err
@@ -166,191 +116,186 @@ func checkCurrentUserCanAccessTask(c echo.Context, task *model.Task, ops []uint)
if !exist {
return errors.NewTaskNoExistOrNoAccessErr()
}
- access, err := s.UserCanAccessWorkflow(user, workflow)
+ access, err := s.UserCanAccessWorkflow(userId, workflow)
if err != nil {
return err
}
if access {
return nil
}
- if len(ops) > 0 {
- ok, err := s.CheckUserHasOpToInstances(user, []*model.Instance{task.Instance}, ops)
- if err != nil {
- return err
- }
- if ok {
- return nil
- }
+
+ if up.CanOpInstanceNoAdmin(task.Instance.GetIDStr(), ops...) {
+ return nil
}
return errors.NewTaskNoExistOrNoAccessErr()
}
-func CheckCurrentUserCanViewWorkflow(c echo.Context, workflowName, projectName string) error {
- userName := controller.GetUserName(c)
- s := model.GetStorage()
- isManager, err := s.IsProjectManager(userName, projectName)
- if err != nil {
- return err
- }
- if userName == model.DefaultAdminUser || isManager {
- return nil
+func GetAuditPlanIfCurrentUserCanAccess(c echo.Context, projectId, auditPlanName string, opType v1.OpPermissionType) (*model.AuditPlan, bool, error) {
+ storage := model.GetStorage()
+
+ ap, exist, err := dms.GetAuditPlanWithInstanceFromProjectByName(projectId, auditPlanName, storage.GetAuditPlanFromProjectByName)
+ if err != nil || !exist {
+ return nil, exist, err
}
- user, err := controller.GetCurrentUser(c)
+
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
if err != nil {
- return err
+ return nil, false, err
}
- workflow, _, err := s.GetWorkflowByProjectAndWorkflowName(projectName, workflowName)
- if err != nil {
- return err
+
+ if ap.CreateUserID == user.GetIDStr() {
+ return ap, true, nil
}
- access, err := s.UserCanAccessWorkflow(user, workflow)
+ _, isAdmin, err := dmsobject.GetUserOpPermission(c.Request().Context(), projectId, user.GetIDStr(), controller.GetDMSServerAddress())
if err != nil {
- return err
+ return nil, false, err
}
- if access {
- return nil
+ if isAdmin {
+ return ap, true, nil
}
- instances, err := s.GetInstancesByWorkflowID(workflow.ID)
- if err != nil {
- return err
+
+ if opType != "" {
+ instances, err := GetCanOperationInstances(c.Request().Context(), user, "", projectId, opType)
+ if err != nil {
+ return nil, false, errors.NewUserNotPermissionError(string(opType))
+ }
+ for _, instance := range instances {
+ if ap.InstanceName == instance.Name {
+ return ap, true, nil
+ }
+ }
}
- ok, err := s.CheckUserHasOpToAnyInstance(user, instances, []uint{model.OP_WORKFLOW_VIEW_OTHERS})
+ return ap, false, errors.NewUserNotPermissionError(v1.GetOperationTypeDesc(opType))
+}
+
+func CheckCurrentUserCanAccessInstances(ctx context.Context, projectUID string, userId string, instances []*model.Instance) (bool, error) {
+ up, err := dms.NewUserPermission(userId, projectUID)
if err != nil {
- return err
+ return false, fmt.Errorf("get user op permission from dms error: %v", err)
}
- if ok {
- return nil
+ if up.IsAdmin() {
+ return true, nil
}
- return ErrWorkflowNoAccess
-}
-
-func CheckCurrentUserCanCreateWorkflow(user *model.User, tasks []*model.Task, projectName string) error {
- if model.IsDefaultAdminUser(user.Name) {
- return nil
+ for _, instance := range instances {
+ if !up.CanOpInstanceNoAdmin(instance.GetIDStr(), dms.GetAllOpPermissions()...) {
+ return false, nil
+ }
}
+ return true, nil
+}
- s := model.GetStorage()
-
- isManager, err := s.IsProjectManager(user.Name, projectName)
+func CheckCurrentUserCanCreateWorkflow(ctx context.Context, projectUID string, user *model.User, tasks []*model.Task) (bool, error) {
+ up, err := dms.NewUserPermission(user.GetIDStr(), projectUID)
if err != nil {
- return err
+ return false, err
}
-
- if isManager {
- return nil
+ if up.IsAdmin() {
+ return true, nil
}
instances := make([]*model.Instance, len(tasks))
for i, task := range tasks {
instances[i] = task.Instance
}
-
- ok, err := s.CheckUserHasOpToInstances(user, instances, []uint{model.OP_WORKFLOW_SAVE})
- if err != nil {
- return err
- }
- if !ok {
- return errors.NewAccessDeniedErr("user has no access to create workflow for instance")
+ for _, instance := range instances {
+ if !up.CanOpInstanceNoAdmin(instance.GetIDStr(), dmsV1.OpPermissionTypeCreateWorkflow) {
+ return false, nil
+ }
}
-
- return nil
+ return true, nil
}
-/*
-
-instance permission.
-
-*/
-
-// 1. admin user have all access to all instance
-// 2. non-admin user have access to instance which is bound to one of his roles
-func checkCurrentUserCanAccessInstance(c echo.Context, instance *model.Instance) (bool, error) {
- if controller.GetUserName(c) == model.DefaultAdminUser {
- return true, nil
- }
- user, err := controller.GetCurrentUser(c)
- if err != nil {
- return false, err
- }
- s := model.GetStorage()
- access, err := s.UserCanAccessInstance(user, instance)
+func CheckUserCanCreateAuditPlan(ctx context.Context, projectUID string, user *model.User, instances []*model.Instance) (bool, error) {
+ up, err := dms.NewUserPermission(user.GetIDStr(), projectUID)
if err != nil {
return false, err
}
- if !access {
- return false, nil
- }
- return true, nil
-}
-
-func checkCurrentUserCanAccessInstances(c echo.Context, instances []*model.Instance) (bool, error) {
- if len(instances) == 0 {
- return false, nil
+ if up.IsAdmin() {
+ return true, nil
}
-
for _, instance := range instances {
- can, err := checkCurrentUserCanAccessInstance(c, instance)
- if err != nil {
- return false, err
- }
- if !can {
+ if !up.CanOpInstanceNoAdmin(instance.GetIDStr(), dmsV1.OpPermissionTypeSaveAuditPlan) {
return false, nil
}
}
-
return true, nil
}
-/*
-
-audit plan permission.
-
-*/
-
-func GetAuditPlanIfCurrentUserCanAccess(c echo.Context, projectName, auditPlanName string, opCode int) (*model.AuditPlan, bool, error) {
- storage := model.GetStorage()
-
- userName := controller.GetUserName(c)
- err := CheckIsProjectMember(userName, projectName)
+// 根据用户权限获取能访问/操作的实例列表
+func GetCanOperationInstances(ctx context.Context, user *model.User, dbType, projectUid string, operationType v1.OpPermissionType) ([]*model.Instance, error) {
+ // 获取当前项目下指定数据库类型的全部实例
+ instances, err := dms.GetInstancesInProjectByType(ctx, projectUid, dbType)
if err != nil {
- return nil, false, err
+ return nil, err
}
- ap, exist, err := storage.GetAuditPlanFromProjectByName(projectName, auditPlanName)
- if err != nil || !exist {
- return nil, exist, err
+ userOpPermissions, isAdmin, err := dmsobject.GetUserOpPermission(ctx, projectUid, user.GetIDStr(), controller.GetDMSServerAddress())
+ if err != nil {
+ return nil, err
}
- if controller.GetUserName(c) == model.DefaultAdminUser {
- return ap, true, nil
+ if isAdmin || operationType == "" {
+ return instances, nil
}
-
- user, err := controller.GetCurrentUser(c)
- if err != nil {
- return nil, false, err
+ canOperationInstance := make([]*model.Instance, 0)
+ for _, instance := range instances {
+ if CanOperationInstance(userOpPermissions, []v1.OpPermissionType{operationType}, instance) {
+ canOperationInstance = append(canOperationInstance, instance)
+ }
}
+ return canOperationInstance, nil
+}
- if ap.CreateUserID == user.ID {
- return ap, true, nil
+func GetCanOpInstanceUsers(memberWithPermissions []*dmsV1.ListMembersForInternalItem, instance *model.Instance, opPermissioins []dmsV1.OpPermissionType) (opUsers []*model.User, err error) {
+ opMapUsers := make(map[uint]struct{}, 0)
+ for _, memberWithPermission := range memberWithPermissions {
+ for _, memberOpPermission := range memberWithPermission.MemberOpPermissionList {
+ if CanOperationInstance([]dmsV1.OpPermissionItem{memberOpPermission}, opPermissioins, instance) {
+ opUser := new(model.User)
+ userId, err := strconv.Atoi(memberWithPermission.User.Uid)
+ if err != nil {
+ return nil, err
+ }
+ opUser.ID = uint(userId)
+ opUser.Name = memberWithPermission.User.Name
+ if _, ok := opMapUsers[opUser.ID]; !ok {
+ opMapUsers[opUser.ID] = struct{}{}
+ opUsers = append(opUsers, opUser)
+ }
+ }
+ }
}
+ return opUsers, nil
+}
- err = CheckIsProjectManager(userName, projectName)
- if err == nil {
- return ap, true, nil
- }
+func CanOperationInstance(userOpPermissions []dmsV1.OpPermissionItem, needOpPermissionTypes []dmsV1.OpPermissionType, instance *model.Instance) bool {
+ for _, userOpPermission := range userOpPermissions {
+ // 对象权限(当前空间内所有对象)
+ if userOpPermission.RangeType == dmsV1.OpRangeTypeProject {
+ return true
+ }
- if opCode > 0 {
- instances, err := storage.GetUserCanOpInstancesFromProject(user, projectName, []uint{uint(opCode)})
- if err != nil {
- return nil, false, errors.NewUserNotPermissionError(model.GetOperationCodeDesc(uint(opCode)))
+ // 动作权限(创建、审核、上线工单等)
+ hasPrivilege := false
+ for _, needOpPermissionType := range needOpPermissionTypes {
+ if needOpPermissionType == userOpPermission.OpPermissionType {
+ hasPrivilege = true
+ break
+ }
}
- for _, instance := range instances {
- if ap.InstanceName == instance.Name {
- return ap, true, nil
+ if !hasPrivilege {
+ continue
+ }
+ // 对象权限(指定数据源)
+ if userOpPermission.RangeType == dmsV1.OpRangeTypeDBService {
+ for _, id := range userOpPermission.RangeUids {
+ if id == instance.GetIDStr() {
+ return true
+ }
}
}
}
- return nil, false, errors.NewUserNotPermissionError(model.GetOperationCodeDesc(uint(opCode)))
+ return false
}
diff --git a/sqle/api/controller/v1/role.go b/sqle/api/controller/v1/role.go
deleted file mode 100644
index e78e8e9d5a..0000000000
--- a/sqle/api/controller/v1/role.go
+++ /dev/null
@@ -1,311 +0,0 @@
-package v1
-
-import (
- "fmt"
- "net/http"
-
- "github.com/actiontech/sqle/sqle/api/controller"
- "github.com/actiontech/sqle/sqle/errors"
- "github.com/actiontech/sqle/sqle/model"
-
- "github.com/labstack/echo/v4"
-)
-
-// @Summary 删除角色
-// @Description delete role
-// @Id deleteRoleV1
-// @Tags role
-// @Security ApiKeyAuth
-// @Accept json
-// @Produce json
-// @Param role_name path string true "role name"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/roles/{role_name}/ [delete]
-func DeleteRole(c echo.Context) error {
- roleName := c.Param("role_name")
- s := model.GetStorage()
- role, exist, err := s.GetRoleByName(roleName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- if !exist {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist, fmt.Errorf("role is not exist")))
- }
-
- return controller.JSONBaseErrorReq(c,
- s.DeleteRoleAndAssociations(role))
-}
-
-type RoleTipResV1 struct {
- Name string `json:"role_name"`
- Operations []*Operation `json:"operations,omitempty"`
-}
-
-type GetRoleTipsResV1 struct {
- controller.BaseRes
- Data []RoleTipResV1 `json:"data"`
-}
-
-// @Summary 获取角色提示列表
-// @Description get role tip list
-// @Tags role
-// @Id getRoleTipListV1
-// @Security ApiKeyAuth
-// @Success 200 {object} v1.GetRoleTipsResV1
-// @router /v1/role_tips [get]
-func GetRoleTips(c echo.Context) error {
- s := model.GetStorage()
- roles, err := s.GetAllRoleTip()
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- roleTipsRes := make([]RoleTipResV1, 0, len(roles))
-
- for i, role := range roles {
- ops := make([]*Operation, len(roles[i].OperationsCodes))
- opCodes := roles[i].OperationsCodes.ForceConvertIntSlice()
- for i := range opCodes {
- ops[i] = &Operation{
- Code: opCodes[i],
- Desc: model.GetOperationCodeDesc(opCodes[i]),
- }
- }
- roleTipRes := RoleTipResV1{
- Name: role.Name,
- Operations: ops,
- }
- roleTipsRes = append(roleTipsRes, roleTipRes)
- }
- return c.JSON(http.StatusOK, &GetRoleTipsResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: roleTipsRes,
- })
-}
-
-type CreateRoleReqV1 struct {
- Name string `json:"role_name" form:"role_name" valid:"required,name"`
- Desc string `json:"role_desc" form:"role_desc"`
- OperationCodes []uint `json:"operation_code_list" form:"operation_code_list"`
-}
-
-// @Summary 创建角色
-// @Description create role
-// @Id createRoleV1
-// @Tags role
-// @Security ApiKeyAuth
-// @Accept json
-// @Produce json
-// @Param instance body v1.CreateRoleReqV1 true "create role"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/roles [post]
-func CreateRole(c echo.Context) (err error) {
-
- req := new(CreateRoleReqV1)
- {
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
- }
-
- s := model.GetStorage()
-
- // check if role name already exists
- {
- _, exist, err := s.GetRoleByName(req.Name)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if exist {
- return controller.JSONNewDataExistErr(c, "role<%s> is exist", req.Name)
- }
- }
-
- // check operation codes
- {
- if len(req.OperationCodes) > 0 {
- if err := model.CheckIfOperationCodeValid(req.OperationCodes); err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- }
- }
-
- newRole := &model.Role{
- Name: req.Name,
- Desc: req.Desc,
- }
-
- return controller.JSONBaseErrorReq(c,
- s.SaveRoleAndAssociations(newRole, req.OperationCodes),
- )
-}
-
-type GetRolesReqV1 struct {
- FilterRoleName string `json:"filter_role_name" query:"filter_role_name"`
- PageIndex uint32 `json:"page_index" query:"page_index" valid:"required"`
- PageSize uint32 `json:"page_size" query:"page_size" valid:"required"`
-}
-
-type GetRolesResV1 struct {
- controller.BaseRes
- Data []*RoleResV1 `json:"data"`
- TotalNums uint64 `json:"total_nums"`
-}
-
-type Operation struct {
- Code uint `json:"op_code"`
- Desc string `json:"op_desc"`
-}
-
-type RoleResV1 struct {
- Name string `json:"role_name"`
- Desc string `json:"role_desc"`
- Operations []*Operation `json:"operation_list,omitempty"`
- IsDisabled bool `json:"is_disabled,omitempty"`
-}
-
-// @Summary 获取角色列表
-// @Description get role list
-// @Id getRoleListV1
-// @Tags role
-// @Security ApiKeyAuth
-// @Accept json
-// @Produce json
-// @Param filter_role_name query string false "filter role name"
-// @Param page_index query uint32 true "page index"
-// @Param page_size query uint32 true "size of per page"
-// @Success 200 {object} v1.GetRolesResV1
-// @router /v1/roles [get]
-func GetRoles(c echo.Context) error {
- req := new(GetRolesReqV1)
- {
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
- }
-
- s := model.GetStorage()
-
- var queryCondition map[string]interface{}
- {
- limit, offset := controller.GetLimitAndOffset(req.PageIndex, req.PageSize)
- queryCondition = map[string]interface{}{
- "filter_role_name": req.FilterRoleName,
- "limit": limit,
- "offset": offset,
- }
- }
-
- roles, count, err := s.GetRolesByReq(queryCondition)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- roleRes := make([]*RoleResV1, len(roles))
- for i := range roles {
- ops := make([]*Operation, len(roles[i].OperationsCodes))
- opCodes := roles[i].OperationsCodes.ForceConvertIntSlice()
- for i := range opCodes {
- ops[i] = &Operation{
- Code: opCodes[i],
- Desc: model.GetOperationCodeDesc(opCodes[i]),
- }
- }
- roleRes[i] = &RoleResV1{
- Name: roles[i].Name,
- Desc: roles[i].Desc,
- IsDisabled: roles[i].IsDisabled(),
- Operations: ops,
- }
-
- }
-
- return c.JSON(http.StatusOK, &GetRolesResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: roleRes,
- TotalNums: count,
- })
-}
-
-type UpdateRoleReqV1 struct {
- Desc *string `json:"role_desc" form:"role_desc"`
- OperationCodes *[]uint `json:"operation_code_list,omitempty" form:"operation_code_list"`
- IsDisabled *bool `json:"is_disabled,omitempty"`
-}
-
-// @Summary 更新角色信息
-// @Description update role
-// @Id updateRoleV1
-// @Tags role
-// @Security ApiKeyAuth
-// @Accept json
-// @Produce json
-// @Param role_name path string true "role name"
-// @Param instance body v1.UpdateRoleReqV1 true "update role request"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/roles/{role_name}/ [patch]
-func UpdateRole(c echo.Context) (err error) {
-
- req := new(UpdateRoleReqV1)
- {
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
- }
-
- s := model.GetStorage()
- roleName := c.Param("role_name")
-
- // check if role name exists
- var role *model.Role
- {
- var isExist bool
- role, isExist, err = s.GetRoleByName(roleName)
- if err != nil {
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- }
- if !isExist {
- return controller.JSONNewDataNotExistErr(c,
- `role is not exist`)
- }
- }
-
- // update stat
- {
- if req.IsDisabled != nil {
- if *req.IsDisabled {
- role.Stat = model.Disabled
- } else {
- role.Stat = model.Enabled
- }
-
- }
- }
-
- // update desc
- if req.Desc != nil {
- role.Desc = *req.Desc
- }
-
- // check operation codes
- var opCodes []uint
- {
- if req.OperationCodes != nil {
- if len(*req.OperationCodes) > 0 {
- if err := model.CheckIfOperationCodeValid(*req.OperationCodes); err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- opCodes = *req.OperationCodes
- } else {
- opCodes = make([]uint, 0)
- }
- }
- }
-
- return controller.JSONBaseErrorReq(c,
- s.SaveRoleAndAssociations(role, opCodes),
- )
-
-}
diff --git a/sqle/api/controller/v1/rule.go b/sqle/api/controller/v1/rule.go
index 5b34dadcc3..a59f9c45ac 100644
--- a/sqle/api/controller/v1/rule.go
+++ b/sqle/api/controller/v1/rule.go
@@ -2,16 +2,16 @@ package v1
import (
"bytes"
+ "context"
"encoding/json"
"fmt"
"mime"
"net/http"
- "strconv"
"strings"
"github.com/actiontech/sqle/sqle/api/controller"
+ "github.com/actiontech/sqle/sqle/dms"
"github.com/actiontech/sqle/sqle/errors"
- "github.com/actiontech/sqle/sqle/log"
"github.com/actiontech/sqle/sqle/model"
"github.com/labstack/echo/v4"
@@ -157,7 +157,7 @@ func CreateRuleTemplate(c echo.Context) error {
return err
}
s := model.GetStorage()
- exist, err := s.IsRuleTemplateExistFromAnyProject(req.Name)
+ exist, err := s.IsRuleTemplateExistFromAnyProject(model.ProjectIdForGlobalRuleTemplate, req.Name)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -166,9 +166,10 @@ func CreateRuleTemplate(c echo.Context) error {
}
ruleTemplate := &model.RuleTemplate{
- Name: req.Name,
- Desc: req.Desc,
- DBType: req.DBType,
+ ProjectId: model.ProjectIdForGlobalRuleTemplate,
+ Name: req.Name,
+ Desc: req.Desc,
+ DBType: req.DBType,
}
templateRules := []model.RuleTemplateRule{}
templateCustomRules := []model.RuleTemplateCustomRule{}
@@ -255,40 +256,42 @@ func UpdateRuleTemplate(c echo.Context) error {
return c.JSON(http.StatusOK, controller.NewBaseReq(nil))
}
+type GetRuleTemplateReqV1 struct {
+ FuzzyKeywordRule string `json:"fuzzy_keyword_rule" query:"fuzzy_keyword_rule"`
+}
+
type GetRuleTemplateResV1 struct {
controller.BaseRes
Data *RuleTemplateDetailResV1 `json:"data"`
}
type RuleTemplateDetailResV1 struct {
- Name string `json:"rule_template_name"`
- Desc string `json:"desc"`
- DBType string `json:"db_type"`
- Instances []*GlobalRuleTemplateInstance `json:"instance_list,omitempty"`
- RuleList []RuleResV1 `json:"rule_list,omitempty"`
+ Name string `json:"rule_template_name"`
+ Desc string `json:"desc"`
+ DBType string `json:"db_type"`
+ RuleList []RuleResV1 `json:"rule_list,omitempty"`
}
-func convertRuleTemplateToRes(template *model.RuleTemplate, instNameToProjectName map[uint]model.ProjectAndInstance) *RuleTemplateDetailResV1 {
- instances := make([]*GlobalRuleTemplateInstance, 0, len(template.Instances))
- for _, instance := range template.Instances {
- instances = append(instances, &GlobalRuleTemplateInstance{
- ProjectName: instNameToProjectName[instance.ID].ProjectName,
- InstanceName: instance.Name,
- })
- }
+func convertRuleTemplateToRes(template *model.RuleTemplate) *RuleTemplateDetailResV1 {
+
ruleList := make([]RuleResV1, 0, len(template.RuleList))
for _, r := range template.RuleList {
+ if r.Rule == nil {
+ continue
+ }
ruleList = append(ruleList, convertRuleToRes(r.GetRule()))
}
for _, r := range template.CustomRuleList {
+ if r.CustomRule == nil {
+ continue
+ }
ruleList = append(ruleList, convertCustomRuleToRuleResV1(r.GetRule()))
}
return &RuleTemplateDetailResV1{
- Name: template.Name,
- Desc: template.Desc,
- DBType: template.DBType,
- Instances: instances,
- RuleList: ruleList,
+ Name: template.Name,
+ Desc: template.Desc,
+ DBType: template.DBType,
+ RuleList: ruleList,
}
}
@@ -298,12 +301,17 @@ func convertRuleTemplateToRes(template *model.RuleTemplate, instNameToProjectNam
// @Tags rule_template
// @Security ApiKeyAuth
// @Param rule_template_name path string true "rule template name"
+// @Param fuzzy_keyword_rule query string false "fuzzy rule,keyword for desc and annotation"
// @Success 200 {object} v1.GetRuleTemplateResV1
// @router /v1/rule_templates/{rule_template_name}/ [get]
func GetRuleTemplate(c echo.Context) error {
s := model.GetStorage()
templateName := c.Param("rule_template_name")
- template, exist, err := s.GetRuleTemplateDetailByNameAndProjectIds([]uint{model.ProjectIdForGlobalRuleTemplate}, templateName)
+ req := new(GetRuleTemplateReqV1)
+ if err := controller.BindAndValidateReq(c, req); err != nil {
+ return err
+ }
+ template, exist, err := s.GetRuleTemplateDetailByNameAndProjectIds([]string{model.ProjectIdForGlobalRuleTemplate}, templateName, req.FuzzyKeywordRule)
if err != nil {
return c.JSON(200, controller.NewBaseReq(err))
}
@@ -312,18 +320,9 @@ func GetRuleTemplate(c echo.Context) error {
fmt.Errorf("rule template is not exist"))))
}
- instanceIds := make([]uint, len(template.Instances))
- for i, inst := range template.Instances {
- instanceIds[i] = inst.ID
- }
- instanceNameToProjectName, err := s.GetProjectNamesByInstanceIds(instanceIds)
- if err != nil {
- return c.JSON(200, controller.NewBaseReq(err))
- }
-
return c.JSON(http.StatusOK, &GetRuleTemplateResV1{
BaseRes: controller.NewBaseReq(nil),
- Data: convertRuleTemplateToRes(template, instanceNameToProjectName),
+ Data: convertRuleTemplateToRes(template),
})
}
@@ -362,7 +361,7 @@ func DeleteRuleTemplate(c echo.Context) error {
// check instance
{
- instanceNames, err := s.GetInstancesNamesByRuleTemplate(templateName)
+ instanceNames, err := dms.GetInstancesNameByRuleTemplateName(c.Request().Context(), templateName)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -392,15 +391,9 @@ type GetRuleTemplatesResV1 struct {
}
type RuleTemplateResV1 struct {
- Name string `json:"rule_template_name"`
- Desc string `json:"desc"`
- DBType string `json:"db_type"`
- Instances []*GlobalRuleTemplateInstance `json:"instance_list"`
-}
-
-type GlobalRuleTemplateInstance struct {
- ProjectName string `json:"project_name"`
- InstanceName string `json:"instance_name"`
+ Name string `json:"rule_template_name"`
+ Desc string `json:"desc"`
+ DBType string `json:"db_type"`
}
// @Summary 全局规则模板列表
@@ -425,37 +418,14 @@ func GetRuleTemplates(c echo.Context) error {
return controller.JSONBaseErrorReq(c, err)
}
- // get project name and instance name
- var instanceIds []uint
- templateNameToInstanceIds := make(map[string][]uint)
- for _, template := range ruleTemplates {
- for _, instIdStr := range template.InstanceIds {
- if instIdStr == "" {
- continue
- }
- instId, err := strconv.Atoi(instIdStr)
- if err != nil {
- log.Logger().Errorf("unexpected instance id. id=%v", instIdStr)
- continue
- }
- instanceIds = append(instanceIds, uint(instId))
- templateNameToInstanceIds[template.Name] = append(templateNameToInstanceIds[template.Name], uint(instId))
- }
- }
-
- instanceIdToProjectName, err := s.GetProjectNamesByInstanceIds(instanceIds)
- if err != nil {
- return c.JSON(200, controller.NewBaseReq(err))
- }
-
return c.JSON(http.StatusOK, &GetRuleTemplatesResV1{
BaseRes: controller.NewBaseReq(nil),
- Data: convertRuleTemplatesToRes(templateNameToInstanceIds, instanceIdToProjectName, ruleTemplates),
+ Data: convertRuleTemplatesToRes(ruleTemplates),
TotalNums: count,
})
}
-func getRuleTemplatesByReq(s *model.Storage, limit, offset uint32, projectId uint) (ruleTemplates []*model.RuleTemplateDetail, count uint64, err error) {
+func getRuleTemplatesByReq(s *model.Storage, limit, offset uint32, projectId string) (ruleTemplates []*model.RuleTemplateDetail, count uint64, err error) {
data := map[string]interface{}{
"limit": limit,
"offset": offset,
@@ -468,24 +438,14 @@ func getRuleTemplatesByReq(s *model.Storage, limit, offset uint32, projectId uin
return
}
-func convertRuleTemplatesToRes(templateNameToInstanceIds map[string][]uint,
- instanceIdToProjectName map[uint] /*instance id*/ model.ProjectAndInstance,
- ruleTemplates []*model.RuleTemplateDetail) []RuleTemplateResV1 {
+func convertRuleTemplatesToRes(ruleTemplates []*model.RuleTemplateDetail) []RuleTemplateResV1 {
ruleTemplatesReq := make([]RuleTemplateResV1, 0, len(ruleTemplates))
for _, ruleTemplate := range ruleTemplates {
- instances := make([]*GlobalRuleTemplateInstance, len(templateNameToInstanceIds[ruleTemplate.Name]))
- for i, instId := range templateNameToInstanceIds[ruleTemplate.Name] {
- instances[i] = &GlobalRuleTemplateInstance{
- ProjectName: instanceIdToProjectName[instId].ProjectName,
- InstanceName: instanceIdToProjectName[instId].InstanceName,
- }
- }
ruleTemplateReq := RuleTemplateResV1{
- Name: ruleTemplate.Name,
- Desc: ruleTemplate.Desc,
- DBType: ruleTemplate.DBType,
- Instances: instances,
+ Name: ruleTemplate.Name,
+ Desc: ruleTemplate.Desc,
+ DBType: ruleTemplate.DBType,
}
ruleTemplatesReq = append(ruleTemplatesReq, ruleTemplateReq)
}
@@ -496,6 +456,7 @@ type GetRulesReqV1 struct {
FilterDBType string `json:"filter_db_type" query:"filter_db_type"`
FilterGlobalRuleTemplateName string `json:"filter_global_rule_template_name" query:"filter_global_rule_template_name"`
FilterRuleNames string `json:"filter_rule_names" query:"filter_rule_names"`
+ FuzzyKeywordRule string `json:"fuzzy_keyword_rule" query:"fuzzy_keyword_rule"`
}
type GetRulesResV1 struct {
@@ -580,6 +541,7 @@ func convertRulesToRes(rules interface{}) []RuleResV1 {
// @Tags rule_template
// @Security ApiKeyAuth
// @Param filter_db_type query string false "filter db type"
+// @Param fuzzy_keyword_rule query string false "fuzzy rule,keyword for desc and annotation"
// @Param filter_global_rule_template_name query string false "filter global rule template name"
// @Param filter_rule_names query string false "filter rule name list"
// @Success 200 {object} v1.GetRulesResV1
@@ -597,6 +559,7 @@ func GetRules(c echo.Context) error {
"filter_global_rule_template_name": req.FilterGlobalRuleTemplateName,
"filter_db_type": req.FilterDBType,
"filter_rule_names": req.FilterRuleNames,
+ "fuzzy_keyword_rule": req.FuzzyKeywordRule,
})
if err != nil {
return controller.JSONBaseErrorReq(c, err)
@@ -605,6 +568,7 @@ func GetRules(c echo.Context) error {
"filter_global_rule_template_name": req.FilterGlobalRuleTemplateName,
"filter_db_type": req.FilterDBType,
"filter_rule_names": req.FilterRuleNames,
+ "fuzzy_keyword_rule": req.FuzzyKeywordRule,
})
if err != nil {
return controller.JSONBaseErrorReq(c, err)
@@ -624,6 +588,7 @@ type RuleTemplateTipReqV1 struct {
}
type RuleTemplateTipResV1 struct {
+ ID string `json:"rule_template_id"`
Name string `json:"rule_template_name"`
DBType string `json:"db_type"`
}
@@ -650,7 +615,7 @@ func GetRuleTemplateTips(c echo.Context) error {
return getRuleTemplateTips(c, model.ProjectIdForGlobalRuleTemplate, req.FilterDBType)
}
-func getRuleTemplateTips(c echo.Context, projectId uint, filterDBType string) error {
+func getRuleTemplateTips(c echo.Context, projectId string, filterDBType string) error {
s := model.GetStorage()
ruleTemplates, err := s.GetRuleTemplateTips(projectId, filterDBType)
if err != nil {
@@ -660,6 +625,7 @@ func getRuleTemplateTips(c echo.Context, projectId uint, filterDBType string) er
ruleTemplateTipsRes := make([]RuleTemplateTipResV1, 0, len(ruleTemplates))
for _, roleTemplate := range ruleTemplates {
ruleTemplateTipRes := RuleTemplateTipResV1{
+ ID: roleTemplate.GetIDStr(),
Name: roleTemplate.Name,
DBType: roleTemplate.DBType,
}
@@ -692,7 +658,7 @@ func CloneRuleTemplate(c echo.Context) error {
return err
}
s := model.GetStorage()
- exist, err := s.IsRuleTemplateExistFromAnyProject(req.Name)
+ exist, err := s.IsRuleTemplateExistFromAnyProject(model.ProjectIdForGlobalRuleTemplate, req.Name)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -701,7 +667,7 @@ func CloneRuleTemplate(c echo.Context) error {
}
sourceTplName := c.Param("rule_template_name")
- sourceTpl, exist, err := s.GetRuleTemplateDetailByNameAndProjectIds([]uint{model.ProjectIdForGlobalRuleTemplate}, sourceTplName)
+ sourceTpl, exist, err := s.GetRuleTemplateDetailByNameAndProjectIds([]string{model.ProjectIdForGlobalRuleTemplate}, sourceTplName, "")
if err != nil {
return c.JSON(200, controller.NewBaseReq(err))
}
@@ -711,9 +677,10 @@ func CloneRuleTemplate(c echo.Context) error {
}
ruleTemplate := &model.RuleTemplate{
- Name: req.Name,
- Desc: req.Desc,
- DBType: sourceTpl.DBType,
+ ProjectId: model.ProjectIdForGlobalRuleTemplate,
+ Name: req.Name,
+ Desc: req.Desc,
+ DBType: sourceTpl.DBType,
}
err = s.Save(ruleTemplate)
if err != nil {
@@ -748,11 +715,10 @@ func CheckRuleTemplateCanBeBindEachInstance(s *model.Storage, tplName string, in
}
type CreateProjectRuleTemplateReqV1 struct {
- Name string `json:"rule_template_name" valid:"required,name"`
- Desc string `json:"desc"`
- DBType string `json:"db_type" valid:"required"`
- Instances []string `json:"instance_name_list"`
- RuleList []RuleReqV1 `json:"rule_list" form:"rule_list" valid:"required,dive,required"`
+ Name string `json:"rule_template_name" valid:"required,name"`
+ Desc string `json:"desc"`
+ DBType string `json:"db_type" valid:"required"`
+ RuleList []RuleReqV1 `json:"rule_list" form:"rule_list" valid:"required,dive,required"`
}
// CreateProjectRuleTemplate
@@ -771,24 +737,13 @@ func CreateProjectRuleTemplate(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
- projectName := c.Param("project_name")
-
- userName := controller.GetUserName(c)
- err := CheckIsProjectManager(userName, projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
s := model.GetStorage()
- project, exist, err := s.GetProjectByName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrProjectNotExist(projectName))
- }
-
- _, exist, err = s.GetGlobalAndProjectRuleTemplateByNameAndProjectId(req.Name, project.ID)
+ _, exist, err := s.GetGlobalAndProjectRuleTemplateByNameAndProjectId(req.Name, projectUid)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -797,7 +752,7 @@ func CreateProjectRuleTemplate(c echo.Context) error {
}
ruleTemplate := &model.RuleTemplate{
- ProjectId: project.ID,
+ ProjectId: model.ProjectUID(projectUid),
Name: req.Name,
Desc: req.Desc,
DBType: req.DBType,
@@ -811,23 +766,23 @@ func CreateProjectRuleTemplate(c echo.Context) error {
}
}
- var instances []*model.Instance
- if len(req.Instances) > 0 {
- instances, err = s.GetAndCheckInstanceExist(req.Instances, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- }
+ // var instances []*model.Instance
+ // if len(req.Instances) > 0 {
+ // instances, err = s.GetAndCheckInstanceExist(req.Instances, projectName)
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
+ // }
- err = CheckRuleTemplateCanBeBindEachInstance(s, req.Name, instances)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
+ // err = CheckRuleTemplateCanBeBindEachInstance(s, req.Name, instances)
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
- err = CheckInstanceAndRuleTemplateDbType([]*model.RuleTemplate{ruleTemplate}, instances...)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
+ // err = CheckInstanceAndRuleTemplateDbType([]*model.RuleTemplate{ruleTemplate}, instances...)
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
err = s.Save(ruleTemplate)
if err != nil {
@@ -843,17 +798,17 @@ func CreateProjectRuleTemplate(c echo.Context) error {
return controller.JSONBaseErrorReq(c, err)
}
- err = s.UpdateRuleTemplateInstances(ruleTemplate, instances...)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
+ // TODO SQLE会移除instance参数
+ // err = s.UpdateRuleTemplateInstances(ruleTemplate, instances...)
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
return c.JSON(http.StatusOK, controller.NewBaseReq(nil))
}
type UpdateProjectRuleTemplateReqV1 struct {
- Desc *string `json:"desc"`
- Instances []string `json:"instance_name_list" example:"mysql-xxx"`
- RuleList []RuleReqV1 `json:"rule_list" form:"rule_list" valid:"dive,required"`
+ Desc *string `json:"desc"`
+ RuleList []RuleReqV1 `json:"rule_list" form:"rule_list" valid:"dive,required"`
}
// UpdateProjectRuleTemplate
@@ -873,23 +828,12 @@ func UpdateProjectRuleTemplate(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
- projectName := c.Param("project_name")
-
- userName := controller.GetUserName(c)
- err := CheckIsProjectManager(userName, projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
-
s := model.GetStorage()
- project, exist, err := s.GetProjectByName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrProjectNotExist(projectName))
- }
- template, exist, err := s.GetGlobalAndProjectRuleTemplateByNameAndProjectId(templateName, project.ID)
+ template, exist, err := s.GetGlobalAndProjectRuleTemplateByNameAndProjectId(templateName, projectUid)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -910,24 +854,6 @@ func UpdateProjectRuleTemplate(c echo.Context) error {
}
}
- var instances []*model.Instance
- if len(req.Instances) > 0 {
- instances, err = s.GetAndCheckInstanceExist(req.Instances, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- }
-
- err = CheckRuleTemplateCanBeBindEachInstance(s, templateName, instances)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- err = CheckInstanceAndRuleTemplateDbType([]*model.RuleTemplate{template}, instances...)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
if req.Desc != nil {
template.Desc = *req.Desc
err = s.Save(&template)
@@ -946,12 +872,6 @@ func UpdateProjectRuleTemplate(c echo.Context) error {
}
}
- if req.Instances != nil {
- err = s.UpdateRuleTemplateInstances(template, instances...)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- }
return c.JSON(http.StatusOK, controller.NewBaseReq(nil))
}
@@ -961,11 +881,10 @@ type GetProjectRuleTemplateResV1 struct {
}
type RuleProjectTemplateDetailResV1 struct {
- Name string `json:"rule_template_name"`
- Desc string `json:"desc"`
- DBType string `json:"db_type"`
- Instances []*ProjectRuleTemplateInstance `json:"instance_list,omitempty"`
- RuleList []RuleResV1 `json:"rule_list,omitempty"`
+ Name string `json:"rule_template_name"`
+ Desc string `json:"desc"`
+ DBType string `json:"db_type"`
+ RuleList []RuleResV1 `json:"rule_list,omitempty"`
}
type ProjectRuleTemplateInstance struct {
@@ -980,32 +899,26 @@ type ProjectRuleTemplateInstance struct {
// @Security ApiKeyAuth
// @Param project_name path string true "project name"
// @Param rule_template_name path string true "rule template name"
+// @Param fuzzy_keyword_rule query string false "fuzzy rule,keyword for desc and annotation"
// @Success 200 {object} v1.GetProjectRuleTemplateResV1
// @router /v1/projects/{project_name}/rule_templates/{rule_template_name}/ [get]
func GetProjectRuleTemplate(c echo.Context) error {
- projectName := c.Param("project_name")
-
- userName := controller.GetUserName(c)
- err := CheckIsProjectMember(userName, projectName)
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
-
s := model.GetStorage()
- project, exist, err := s.GetProjectByName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrProjectNotExist(projectName))
- }
templateName := c.Param("rule_template_name")
- template, exist, err := s.GetRuleTemplateDetailByNameAndProjectIds([]uint{project.ID}, templateName)
+ req := new(GetRuleTemplateReqV1)
+ if err := controller.BindAndValidateReq(c, req); err != nil {
+ return err
+ }
+ template, exist, err := s.GetRuleTemplateDetailByNameAndProjectIds([]string{projectUid}, templateName, req.FuzzyKeywordRule)
if err != nil {
- return c.JSON(200, controller.NewBaseReq(err))
+ return c.JSON(http.StatusOK, controller.NewBaseReq(err))
}
if !exist {
- return c.JSON(200, controller.NewBaseReq(errors.New(errors.DataNotExist,
+ return c.JSON(http.StatusOK, controller.NewBaseReq(errors.New(errors.DataNotExist,
fmt.Errorf("rule template is not exist"))))
}
@@ -1016,25 +929,24 @@ func GetProjectRuleTemplate(c echo.Context) error {
}
func convertProjectRuleTemplateToRes(template *model.RuleTemplate) *RuleProjectTemplateDetailResV1 {
- instances := make([]*ProjectRuleTemplateInstance, 0, len(template.Instances))
- for _, instance := range template.Instances {
- instances = append(instances, &ProjectRuleTemplateInstance{
- Name: instance.Name,
- })
- }
ruleList := make([]RuleResV1, 0, len(template.RuleList))
for _, r := range template.RuleList {
+ if r.Rule == nil {
+ continue
+ }
ruleList = append(ruleList, convertRuleToRes(r.GetRule()))
}
for _, r := range template.CustomRuleList {
+ if r.CustomRule == nil {
+ continue
+ }
ruleList = append(ruleList, convertCustomRuleToRuleResV1(r.GetRule()))
}
return &RuleProjectTemplateDetailResV1{
- Name: template.Name,
- Desc: template.Desc,
- DBType: template.DBType,
- Instances: instances,
- RuleList: ruleList,
+ Name: template.Name,
+ Desc: template.Desc,
+ DBType: template.DBType,
+ RuleList: ruleList,
}
}
@@ -1049,25 +961,15 @@ func convertProjectRuleTemplateToRes(template *model.RuleTemplate) *RuleProjectT
// @Success 200 {object} controller.BaseRes
// @router /v1/projects/{project_name}/rule_templates/{rule_template_name}/ [delete]
func DeleteProjectRuleTemplate(c echo.Context) error {
- projectName := c.Param("project_name")
-
- userName := controller.GetUserName(c)
- err := CheckIsProjectManager(userName, projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
s := model.GetStorage()
- project, exist, err := s.GetProjectByName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrProjectNotExist(projectName))
- }
templateName := c.Param("rule_template_name")
- template, exist, err := s.GetGlobalAndProjectRuleTemplateByNameAndProjectId(templateName, project.ID)
+ template, exist, err := s.GetGlobalAndProjectRuleTemplateByNameAndProjectId(templateName, projectUid)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -1081,7 +983,7 @@ func DeleteProjectRuleTemplate(c echo.Context) error {
// check audit plans
{
- auditPlanNames, err := s.GetAuditPlanNamesByRuleTemplateAndProject(templateName, project.ID)
+ auditPlanNames, err := s.GetAuditPlanNamesByRuleTemplateAndProject(templateName, projectUid)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -1095,7 +997,7 @@ func DeleteProjectRuleTemplate(c echo.Context) error {
// check instance
{
- instanceNames, err := s.GetInstancesNamesByRuleTemplateAndProject(templateName, project.ID)
+ instanceNames, err := dms.GetInstancesNameInProjectByRuleTemplateName(c.Request().Context(), projectUid, templateName)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -1120,10 +1022,9 @@ type GetProjectRuleTemplatesResV1 struct {
}
type ProjectRuleTemplateResV1 struct {
- Name string `json:"rule_template_name"`
- Desc string `json:"desc"`
- DBType string `json:"db_type"`
- Instances []*ProjectRuleTemplateInstance `json:"instance_list"`
+ Name string `json:"rule_template_name"`
+ Desc string `json:"desc"`
+ DBType string `json:"db_type"`
}
// GetProjectRuleTemplates
@@ -1142,25 +1043,13 @@ func GetProjectRuleTemplates(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
- projectName := c.Param("project_name")
-
- userName := controller.GetUserName(c)
- err := CheckIsProjectMember(userName, projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
-
s := model.GetStorage()
- project, exist, err := s.GetProjectByName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrProjectNotExist(projectName))
- }
-
limit, offset := controller.GetLimitAndOffset(req.PageIndex, req.PageSize)
- ruleTemplates, count, err := getRuleTemplatesByReq(s, limit, offset, project.ID)
+ ruleTemplates, count, err := getRuleTemplatesByReq(s, limit, offset, projectUid)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -1175,24 +1064,23 @@ func GetProjectRuleTemplates(c echo.Context) error {
func convertProjectRuleTemplatesToRes(ruleTemplates []*model.RuleTemplateDetail) []ProjectRuleTemplateResV1 {
ruleTemplatesRes := make([]ProjectRuleTemplateResV1, len(ruleTemplates))
for i, t := range ruleTemplates {
- instances := make([]*ProjectRuleTemplateInstance, len(t.InstanceNames))
- for j, instName := range t.InstanceNames {
- instances[j] = &ProjectRuleTemplateInstance{Name: instName}
- }
+ // instances := make([]*ProjectRuleTemplateInstance, len(t.InstanceNames))
+ // for j, instName := range t.InstanceNames {
+ // instances[j] = &ProjectRuleTemplateInstance{Name: instName}
+ // }
ruleTemplatesRes[i] = ProjectRuleTemplateResV1{
- Name: t.Name,
- Desc: t.Desc,
- DBType: t.DBType,
- Instances: instances,
+ Name: t.Name,
+ Desc: t.Desc,
+ DBType: t.DBType,
+ // Instances: instances,
}
}
return ruleTemplatesRes
}
type CloneProjectRuleTemplateReqV1 struct {
- Name string `json:"new_rule_template_name" valid:"required"`
- Desc string `json:"desc"`
- Instances []string `json:"instance_name_list"`
+ Name string `json:"new_rule_template_name" valid:"required"`
+ Desc string `json:"desc"`
}
// CloneProjectRuleTemplate
@@ -1212,23 +1100,13 @@ func CloneProjectRuleTemplate(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
- projectName := c.Param("project_name")
-
- userName := controller.GetUserName(c)
- err := CheckIsProjectManager(userName, projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
s := model.GetStorage()
- project, exist, err := s.GetProjectByName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrProjectNotExist(projectName))
- }
- exist, err = s.IsRuleTemplateExistFromAnyProject(req.Name)
+ exist, err := s.IsRuleTemplateExistFromAnyProject(model.ProjectUID(projectUid), req.Name)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -1237,7 +1115,7 @@ func CloneProjectRuleTemplate(c echo.Context) error {
}
sourceTplName := c.Param("rule_template_name")
- sourceTpl, exist, err := s.GetRuleTemplateDetailByNameAndProjectIds([]uint{project.ID}, sourceTplName)
+ sourceTpl, exist, err := s.GetRuleTemplateDetailByNameAndProjectIds([]string{projectUid}, sourceTplName, "")
if err != nil {
return c.JSON(200, controller.NewBaseReq(err))
}
@@ -1246,26 +1124,26 @@ func CloneProjectRuleTemplate(c echo.Context) error {
fmt.Errorf("source rule template %s is not exist", sourceTplName))))
}
- var instances []*model.Instance
- if len(req.Instances) > 0 {
- instances, err = s.GetAndCheckInstanceExist(req.Instances, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- }
+ // var instances []*model.Instance
+ // if len(req.Instances) > 0 {
+ // instances, err = s.GetAndCheckInstanceExist(req.Instances, projectName)
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
+ // }
- err = CheckRuleTemplateCanBeBindEachInstance(s, req.Name, instances)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
+ // err = CheckRuleTemplateCanBeBindEachInstance(s, req.Name, instances)
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
- err = CheckInstanceAndRuleTemplateDbType([]*model.RuleTemplate{sourceTpl}, instances...)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
+ // err = CheckInstanceAndRuleTemplateDbType([]*model.RuleTemplate{sourceTpl}, instances...)
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
ruleTemplate := &model.RuleTemplate{
- ProjectId: project.ID,
+ ProjectId: model.ProjectUID(projectUid),
Name: req.Name,
Desc: req.Desc,
DBType: sourceTpl.DBType,
@@ -1283,10 +1161,6 @@ func CloneProjectRuleTemplate(c echo.Context) error {
return controller.JSONBaseErrorReq(c, err)
}
- err = s.UpdateRuleTemplateInstances(ruleTemplate, instances...)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
return c.JSON(http.StatusOK, controller.NewBaseReq(nil))
}
@@ -1305,24 +1179,12 @@ func GetProjectRuleTemplateTips(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
- projectName := c.Param("project_name")
-
- userName := controller.GetUserName(c)
- err := CheckIsProjectMember(userName, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- s := model.GetStorage()
- project, exist, err := s.GetProjectByName(projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrProjectNotExist(projectName))
- }
- return getRuleTemplateTips(c, project.ID, req.FilterDBType)
+ return getRuleTemplateTips(c, projectUid, req.FilterDBType)
}
type ParseProjectRuleTemplateFileResV1 struct {
@@ -1395,32 +1257,20 @@ func ExportRuleTemplateFile(c echo.Context) error {
// @router /v1/projects/{project_name}/rule_templates/{rule_template_name}/export [get]
func ExportProjectRuleTemplateFile(c echo.Context) error {
// 权限检查
- projectName := c.Param("project_name")
-
- userName := controller.GetUserName(c)
- err := CheckIsProjectMember(userName, projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
// 获取模板内容
templateName := c.Param("rule_template_name")
- s := model.GetStorage()
- project, exist, err := s.GetProjectByName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrProjectNotExist(projectName))
- }
-
- return exportRuleTemplateFile(c, project.ID, templateName)
+ return exportRuleTemplateFile(c, projectUid, templateName)
}
-func exportRuleTemplateFile(c echo.Context, projectID uint, ruleTemplateName string) error {
+func exportRuleTemplateFile(c echo.Context, projectID string, ruleTemplateName string) error {
// 获取规则模板详情
s := model.GetStorage()
- template, exist, err := s.GetRuleTemplateDetailByNameAndProjectIds([]uint{projectID}, ruleTemplateName)
+ template, exist, err := s.GetRuleTemplateDetailByNameAndProjectIds([]string{projectID}, ruleTemplateName, "")
if err != nil {
return c.JSON(200, controller.NewBaseReq(err))
}
diff --git a/sqle/api/controller/v1/sql_audit.go b/sqle/api/controller/v1/sql_audit.go
index f51bc39ec8..de6fceb0c1 100644
--- a/sqle/api/controller/v1/sql_audit.go
+++ b/sqle/api/controller/v1/sql_audit.go
@@ -2,6 +2,7 @@ package v1
import (
"bytes"
+ "context"
e "errors"
"fmt"
"net/http"
@@ -9,6 +10,7 @@ import (
parser "github.com/actiontech/mybatis-mapper-2-sql"
"github.com/actiontech/sqle/sqle/api/controller"
+ dms "github.com/actiontech/sqle/sqle/dms"
"github.com/actiontech/sqle/sqle/errors"
"github.com/actiontech/sqle/sqle/log"
"github.com/actiontech/sqle/sqle/model"
@@ -70,11 +72,16 @@ func DirectAudit(c echo.Context) error {
}
if req.ProjectName != nil {
- user := controller.GetUserName(c)
- s := model.GetStorage()
- if yes, err := s.IsProjectMember(user, *req.ProjectName); err != nil {
- return controller.JSONBaseErrorReq(c, fmt.Errorf("check privilege failed: %v", err))
- } else if !yes {
+ userUid := controller.GetUserID(c)
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), *req.ProjectName)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ up, err := dms.NewUserPermission(userUid, projectUid)
+ if err != nil {
+ return echo.NewHTTPError(http.StatusForbidden)
+ }
+ if up.IsProjectMember() {
return controller.JSONBaseErrorReq(c, errors.New(errors.ErrAccessDeniedError, e.New("you are not the project member")))
}
}
@@ -86,14 +93,16 @@ func DirectAudit(c echo.Context) error {
return controller.JSONBaseErrorReq(c, err)
}
}
-
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), *req.ProjectName)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
l := log.NewEntry().WithField("/v1/sql_audit", "direct audit failed")
- s := model.GetStorage()
var instance *model.Instance
var exist bool
if req.ProjectName != nil && req.InstanceName != nil {
- instance, exist, err = s.GetInstanceByNameAndProjectName(*req.InstanceName, *req.ProjectName)
+ instance, exist, err = dms.GetInstanceInProjectByName(c.Request().Context(), projectUid, *req.InstanceName)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -111,7 +120,7 @@ func DirectAudit(c echo.Context) error {
if instance != nil && schemaName != "" {
task, err = server.DirectAuditByInstance(l, sql, schemaName, instance)
} else {
- task, err = server.AuditSQLByDBType(l, sql, req.InstanceType, nil, "")
+ task, err = server.AuditSQLByDBType(l, sql, req.InstanceType)
}
if err != nil {
l.Errorf("audit sqls failed: %v", err)
@@ -167,12 +176,16 @@ func DirectAuditFiles(c echo.Context) error {
if err != nil {
return err
}
-
- user := controller.GetUserName(c)
- s := model.GetStorage()
- if yes, err := s.IsProjectMember(user, req.ProjectName); err != nil {
- return controller.JSONBaseErrorReq(c, fmt.Errorf("check privilege failed: %v", err))
- } else if !yes {
+ userUid := controller.GetUserID(c)
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), req.ProjectName)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ up, err := dms.NewUserPermission(userUid, projectUid)
+ if err != nil {
+ return echo.NewHTTPError(http.StatusForbidden)
+ }
+ if up.IsProjectMember() {
return controller.JSONBaseErrorReq(c, errors.New(errors.ErrAccessDeniedError, e.New("you are not the project member")))
}
@@ -196,7 +209,7 @@ func DirectAuditFiles(c echo.Context) error {
var instance *model.Instance
var exist bool
if req.InstanceName != nil {
- instance, exist, err = s.GetInstanceByNameAndProjectName(*req.InstanceName, req.ProjectName)
+ instance, exist, err = dms.GetInstanceInProjectByName(c.Request().Context(), projectUid, *req.InstanceName)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -214,7 +227,7 @@ func DirectAuditFiles(c echo.Context) error {
if instance != nil && schemaName != "" {
task, err = server.DirectAuditByInstance(l, sqls, schemaName, instance)
} else {
- task, err = server.AuditSQLByDBType(l, sqls, req.InstanceType, nil, "")
+ task, err = server.AuditSQLByDBType(l, sqls, req.InstanceType)
}
if err != nil {
l.Errorf("audit sqls failed: %v", err)
diff --git a/sqle/api/controller/v1/sql_audit_record.go b/sqle/api/controller/v1/sql_audit_record.go
index 5ff1e01b9b..929d86b5f4 100644
--- a/sqle/api/controller/v1/sql_audit_record.go
+++ b/sqle/api/controller/v1/sql_audit_record.go
@@ -20,6 +20,7 @@ import (
xmlAst "github.com/actiontech/mybatis-mapper-2-sql/ast"
"github.com/actiontech/sqle/sqle/api/controller"
"github.com/actiontech/sqle/sqle/common"
+ "github.com/actiontech/sqle/sqle/dms"
"github.com/actiontech/sqle/sqle/driver"
"github.com/actiontech/sqle/sqle/errors"
"github.com/actiontech/sqle/sqle/log"
@@ -88,29 +89,17 @@ func CreateSQLAuditRecord(c echo.Context) error {
if req.DbType == "" && req.InstanceName == "" {
return controller.JSONBaseErrorReq(c, errors.New(errors.DataInvalid, e.New("db_type and instance_name can't both be empty")))
}
- projectName := c.Param("project_name")
-
- s := model.GetStorage()
- project, exist, err := s.GetProjectByName(projectName)
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrProjectNotExist(projectName))
- }
- if project.IsArchived() {
- return controller.JSONBaseErrorReq(c, ErrProjectArchived)
- }
- user, err := controller.GetCurrentUser(c)
+ s := model.GetStorage()
+ sqls := getSQLFromFileResp{}
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if err := CheckIsProjectMember(user.Name, project.Name); err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- var sqls getSQLFromFileResp
if req.Sqls != "" {
sqls = getSQLFromFileResp{model.TaskSQLSourceFromFormData, []SQLsFromFile{{SQLs: req.Sqls}}}
} else {
@@ -122,24 +111,26 @@ func CreateSQLAuditRecord(c echo.Context) error {
var task *model.Task
if req.InstanceName != "" {
- task, err = buildOnlineTaskForAudit(c, s, user.ID, req.InstanceName, req.InstanceSchema, projectName, sqls)
+ task, err = buildOnlineTaskForAudit(c, s, uint64(user.ID), req.InstanceName, req.InstanceSchema, projectUid, sqls)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
} else {
- task, err = buildOfflineTaskForAudit(user.ID, req.DbType, sqls)
+ task, err = buildOfflineTaskForAudit(uint64(user.ID), req.DbType, sqls)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
}
+ // if task instance is not nil, gorm will update instance when save task.
+ task.Instance = nil
recordId, err := utils.GenUid()
if err != nil {
return controller.JSONBaseErrorReq(c, fmt.Errorf("generate audit record id failed: %v", err))
}
record := model.SQLAuditRecord{
- ProjectId: project.ID,
- CreatorId: user.ID,
+ ProjectId: projectUid,
+ CreatorId: user.GetIDStr(),
AuditRecordId: recordId,
TaskId: task.ID,
Task: task,
@@ -213,7 +204,7 @@ func buildOnlineTaskForAudit(c echo.Context, s *model.Storage, userId uint, inst
if !exist {
return nil, ErrInstanceNoAccess
}
- can, err := checkCurrentUserCanAccessInstance(c, instance)
+ can, err := CheckCurrentUserCanAccessInstances(c.Request().Context(), projectUid, controller.GetUserID(c), []*model.Instance{instance})
if err != nil {
return nil, err
}
@@ -250,7 +241,7 @@ func buildOnlineTaskForAudit(c echo.Context, s *model.Storage, userId uint, inst
return task, nil
}
-func buildOfflineTaskForAudit(userId uint, dbType string, sqls getSQLFromFileResp) (*model.Task, error) {
+func buildOfflineTaskForAudit(userId uint64, dbType string, sqls getSQLFromFileResp) (*model.Task, error) {
task := &model.Task{
CreateUserId: userId,
ExecuteSQLs: []*model.ExecuteSQL{},
@@ -509,36 +500,49 @@ func UpdateSQLAuditRecordV1(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- projectName := c.Param("project_name")
- auditRecordId := c.Param("sql_audit_record_id")
-
- s := model.GetStorage()
- project, exist, err := s.GetProjectByName(projectName)
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrProjectNotExist(projectName))
- }
- user, err := controller.GetCurrentUser(c)
+ auditRecordId := c.Param("sql_audit_record_id")
+
+ s := model.GetStorage()
+
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- record, exist, err := s.GetSQLAuditRecordById(project.ID, auditRecordId)
+ record, exist, err := s.GetSQLAuditRecordById(projectUid, auditRecordId)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
if !exist {
return controller.JSONBaseErrorReq(c, errors.New(errors.ErrAccessDeniedError, fmt.Errorf("sql audit record id %v not exist", auditRecordId)))
}
+ instance, exist, err := dms.GetInstanceInProjectById(c.Request().Context(), projectUid, record.Task.InstanceId)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ if exist {
+ record.Task.Instance = instance
+ }
if req.Tags != nil {
- if yes, err := s.IsSQLAuditRecordBelongToCurrentUser(user.ID, project.ID, auditRecordId); err != nil {
- return controller.JSONBaseErrorReq(c, fmt.Errorf("check privilege failed: %v", err))
- } else if !yes {
- return controller.JSONBaseErrorReq(c, errors.New(errors.ErrAccessDeniedError, errors.NewAccessDeniedErr("you can't update SQL audit record that created by others")))
+ up, err := dms.NewUserPermission(user.GetIDStr(), projectUid)
+ if err != nil {
+ return echo.NewHTTPError(http.StatusForbidden)
+ }
+ if err != nil {
+ return errors.New(errors.ConnectStorageError, fmt.Errorf("check project manager failed: %v", err))
+ }
+ if !up.IsProjectAdmin() {
+ if yes, err := s.IsSQLAuditRecordBelongToCurrentUser(user.GetIDStr(), projectUid, auditRecordId); err != nil {
+ return controller.JSONBaseErrorReq(c, fmt.Errorf("check privilege failed: %v", err))
+ } else if !yes {
+ return controller.JSONBaseErrorReq(c, errors.New(errors.ErrAccessDeniedError, errors.NewAccessDeniedErr("you can't update SQL audit record that created by others")))
+ }
}
data := model.SQLAuditRecordUpdateData{Tags: req.Tags}
@@ -560,7 +564,7 @@ func UpdateSQLAuditRecordV1(c echo.Context) error {
type GetSQLAuditRecordsReqV1 struct {
FuzzySearchTags string `json:"fuzzy_search_tags" query:"fuzzy_search_tags"` // todo issue1811
FilterSQLAuditStatus string `json:"filter_sql_audit_status" query:"filter_sql_audit_status" enums:"auditing,successfully,"`
- FilterInstanceName string `json:"filter_instance_name" query:"filter_instance_name"`
+ FilterInstanceId uint64 `json:"filter_instance_id" query:"filter_instance_id"`
FilterCreateTimeFrom string `json:"filter_create_time_from" query:"filter_create_time_from"`
FilterCreateTimeTo string `json:"filter_create_time_to" query:"filter_create_time_to"`
FilterSqlAuditRecordIDs string `json:"filter_sql_audit_record_ids" query:"filter_sql_audit_record_ids" example:"1711247438821462016,1711246967037759488"`
@@ -602,7 +606,7 @@ const (
// @Security ApiKeyAuth
// @Param fuzzy_search_tags query string false "fuzzy search tags"
// @Param filter_sql_audit_status query string false "filter sql audit status" Enums(auditing,successfully)
-// @Param filter_instance_name query string false "filter instance name"
+// @Param filter_instance_id query uint64 false "filter instance id"
// @Param filter_create_time_from query string false "filter create time from"
// @Param filter_create_time_to query string false "filter create time to"
// @Param filter_sql_audit_record_ids query string false "filter sql audit record ids"
@@ -616,24 +620,22 @@ func GetSQLAuditRecordsV1(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- projectName := c.Param("project_name")
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), c.Param("project_name"), false)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
s := model.GetStorage()
- _, exist, err := s.GetProjectByName(projectName)
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrProjectNotExist(projectName))
- }
-
- user, err := controller.GetCurrentUser(c)
+ up, err := dms.NewUserPermission(user.GetIDStr(), projectUid)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- isManager, err := s.IsProjectManager(user.Name, projectName)
if err != nil {
- return err
+ return controller.JSONBaseErrorReq(c, fmt.Errorf("check project manager failed: %v", err))
}
var offset uint32
@@ -642,13 +644,13 @@ func GetSQLAuditRecordsV1(c echo.Context) error {
}
data := map[string]interface{}{
- "filter_project_name": projectName,
+ "filter_project_id": projectUid,
"filter_creator_id": user.ID,
"fuzzy_search_tags": req.FuzzySearchTags,
- "filter_instance_name": req.FilterInstanceName,
+ "filter_instance_id": req.FilterInstanceId,
"filter_create_time_from": req.FilterCreateTimeFrom,
"filter_create_time_to": req.FilterCreateTimeTo,
- "check_user_can_access": !isManager,
+ "check_user_can_access": !up.IsProjectAdmin(),
"filter_audit_record_ids": req.FilterSqlAuditRecordIDs,
"limit": req.PageSize,
"offset": offset,
@@ -664,6 +666,20 @@ func GetSQLAuditRecordsV1(c echo.Context) error {
return controller.JSONBaseErrorReq(c, err)
}
+ // batch get instance info
+ instanceIds := make([]uint64, 0)
+ for _, record := range records {
+ instanceIds = append(instanceIds, record.InstanceId)
+ }
+ instances, err := dms.GetInstancesByIds(c.Request().Context(), instanceIds)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ idInstMap := make(map[uint64] /*instance id*/ *model.Instance /*instance */, 0)
+ for _, instance := range instances {
+ idInstMap[instance.ID] = instance
+ }
+
resData := make([]SQLAuditRecord, len(records))
for i := range records {
record := records[i]
@@ -677,19 +693,15 @@ func GetSQLAuditRecordsV1(c echo.Context) error {
log.NewEntry().Errorf("parse tags failed,tags:%v , err: %v", record.Tags, err)
}
}
+
resData[i] = SQLAuditRecord{
- Creator: record.CreatorName,
+ Creator: dms.GetUserNameWithDelTag(record.CreatorId),
SQLAuditRecordId: record.AuditRecordId,
SQLAuditStatus: status,
Tags: tags,
CreatedAt: record.RecordCreatedAt,
- Instance: &SQLAuditRecordInstance{
- Host: record.InstanceHost.String,
- Port: record.InstancePort.String,
- },
Task: &AuditTaskResV1{
Id: record.TaskId,
- InstanceName: record.InstanceName.String,
InstanceDbType: record.DbType,
InstanceSchema: record.InstanceSchema,
AuditLevel: record.AuditLevel.String,
@@ -699,6 +711,13 @@ func GetSQLAuditRecordsV1(c echo.Context) error {
SQLSource: record.SQLSource,
},
}
+ if inst, ok := idInstMap[record.InstanceId]; ok {
+ resData[i].Instance = &SQLAuditRecordInstance{
+ Host: inst.Host,
+ Port: inst.Port,
+ }
+ resData[i].Task.InstanceName = idInstMap[record.InstanceId].Name
+ }
}
return c.JSON(http.StatusOK, &GetSQLAuditRecordsResV1{
BaseRes: controller.NewBaseReq(nil),
@@ -723,54 +742,78 @@ type GetSQLAuditRecordResV1 struct {
// @Success 200 {object} v1.GetSQLAuditRecordResV1
// @router /v1/projects/{project_name}/sql_audit_records/{sql_audit_record_id}/ [get]
func GetSQLAuditRecordV1(c echo.Context) error {
- projectName := c.Param("project_name")
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), c.Param("project_name"), false)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
auditRecordId := c.Param("sql_audit_record_id")
- s := model.GetStorage()
- project, exist, err := s.GetProjectByName(projectName)
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrProjectNotExist(projectName))
- }
- user, err := controller.GetCurrentUser(c)
+ up, err := dms.NewUserPermission(user.GetIDStr(), projectUid)
if err != nil {
- return controller.JSONBaseErrorReq(c, err)
+ return echo.NewHTTPError(http.StatusForbidden)
+ }
+ if err != nil {
+ return errors.New(errors.ConnectStorageError, fmt.Errorf("check project manager failed: %v", err))
}
- if yes, err := s.IsSQLAuditRecordBelongToCurrentUser(user.ID, project.ID, auditRecordId); err != nil {
- return controller.JSONBaseErrorReq(c, fmt.Errorf("check privilege failed: %v", err))
- } else if !yes {
- return controller.JSONBaseErrorReq(c, errors.New(errors.ErrAccessDeniedError, errors.NewAccessDeniedErr("you can't see the SQL audit record because it isn't created by you")))
+ s := model.GetStorage()
+
+ if !up.IsProjectAdmin() {
+ if yes, err := s.IsSQLAuditRecordBelongToCurrentUser(user.GetIDStr(), projectUid, auditRecordId); err != nil {
+ return controller.JSONBaseErrorReq(c, fmt.Errorf("check privilege failed: %v", err))
+ } else if !yes {
+ return controller.JSONBaseErrorReq(c, errors.New(errors.ErrAccessDeniedError, errors.NewAccessDeniedErr("you can't see the SQL audit record because it isn't created by you")))
+ }
}
- record, exist, err := s.GetSQLAuditRecordById(project.ID, auditRecordId)
+ record, exist, err := s.GetSQLAuditRecordById(projectUid, auditRecordId)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
if !exist {
return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist, e.New("can not find record")))
}
+ // build ret info
+ status := SQLAuditRecordStatusAuditing
+ if record.Task.Status == model.TaskStatusAudited {
+ status = SQLAuditRecordStatusSuccessfully
+ }
+ var tags []string
+ if err := json.Unmarshal([]byte(record.Tags), &tags); err != nil {
+ log.NewEntry().Errorf("parse tags failed,tags:%v , err: %v", record.Tags, err)
+ }
+ task := &AuditTaskResV1{
+ Id: record.Task.ID,
+ InstanceDbType: record.Task.DBType,
+ InstanceSchema: record.Task.Schema,
+ AuditLevel: record.Task.AuditLevel,
+ Score: record.Task.Score,
+ PassRate: record.Task.PassRate,
+ Status: record.Task.Status,
+ SQLSource: record.Task.SQLSource,
+ ExecStartTime: record.Task.ExecStartAt,
+ ExecEndTime: record.Task.ExecEndAt,
+ }
+ instance, exist, err := dms.GetInstancesById(c.Request().Context(), record.Task.InstanceId)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ if exist {
+ task.InstanceName = instance.Name
+ }
return c.JSON(http.StatusOK, &GetSQLAuditRecordResV1{
BaseRes: controller.NewBaseReq(nil),
Data: SQLAuditRecord{
+ SQLAuditStatus: status,
+ Tags: tags,
SQLAuditRecordId: auditRecordId,
- Task: &AuditTaskResV1{
- Id: record.Task.ID,
- InstanceName: record.Task.InstanceName(),
- InstanceDbType: record.Task.DBType,
- InstanceSchema: record.Task.Schema,
- AuditLevel: record.Task.AuditLevel,
- Score: record.Task.Score,
- PassRate: record.Task.PassRate,
- Status: record.Task.Status,
- SQLSource: record.Task.SQLSource,
- ExecStartTime: record.Task.ExecStartAt,
- ExecEndTime: record.Task.ExecEndAt,
- },
+ Task: task,
},
})
}
diff --git a/sqle/api/controller/v1/sql_manage.go b/sqle/api/controller/v1/sql_manage.go
index fab200feca..8347c721b4 100644
--- a/sqle/api/controller/v1/sql_manage.go
+++ b/sqle/api/controller/v1/sql_manage.go
@@ -96,7 +96,7 @@ func GetSqlManageList(c echo.Context) error {
type BatchUpdateSqlManageReq struct {
SqlManageIdList []*uint64 `json:"sql_manage_id_list"`
Status *string `json:"status" enums:"solved,ignored,manual_audited"`
- Assignees []*string `json:"assignees"`
+ Assignees []string `json:"assignees"`
Remark *string `json:"remark"`
}
diff --git a/sqle/api/controller/v1/sql_whitelist.go b/sqle/api/controller/v1/sql_whitelist.go
index 7c224264d4..6f529e26f1 100644
--- a/sqle/api/controller/v1/sql_whitelist.go
+++ b/sqle/api/controller/v1/sql_whitelist.go
@@ -1,11 +1,13 @@
package v1
import (
+ "context"
"fmt"
"net/http"
"github.com/actiontech/sqle/sqle/api/controller"
+ "github.com/actiontech/sqle/sqle/dms"
"github.com/actiontech/sqle/sqle/errors"
"github.com/actiontech/sqle/sqle/model"
@@ -33,28 +35,14 @@ func CreateAuditWhitelist(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
- projectName := c.Param("project_name")
-
- userName := controller.GetUserName(c)
- err := CheckIsProjectManager(userName, projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"),true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
-
s := model.GetStorage()
- project, exist, err := s.GetProjectByName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrProjectNotExist(projectName))
- }
- if project.IsArchived() {
- return controller.JSONBaseErrorReq(c, ErrProjectArchived)
- }
sqlWhitelist := &model.SqlWhitelist{
- ProjectId: project.ID,
+ ProjectId: model.ProjectUID(projectUid),
Value: req.Value,
Desc: req.Desc,
MatchType: req.MatchType,
@@ -90,24 +78,15 @@ func UpdateAuditWhitelistById(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
- projectName := c.Param("project_name")
- userName := controller.GetUserName(c)
- err := CheckIsProjectManager(userName, projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
s := model.GetStorage()
- archived, err := s.IsProjectArchived(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if archived {
- return controller.JSONBaseErrorReq(c, ErrProjectArchived)
- }
whitelistId := c.Param("audit_whitelist_id")
- sqlWhitelist, exist, err := s.GetSqlWhitelistByIdAndProjectName(whitelistId, projectName)
+ sqlWhitelist, exist, err := s.GetSqlWhitelistByIdAndProjectUID(whitelistId, model.ProjectUID(projectUid))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -151,22 +130,14 @@ func UpdateAuditWhitelistById(c echo.Context) error {
func DeleteAuditWhitelistById(c echo.Context) error {
s := model.GetStorage()
whitelistId := c.Param("audit_whitelist_id")
- projectName := c.Param("project_name")
- archived, err := s.IsProjectArchived(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if archived {
- return controller.JSONBaseErrorReq(c, ErrProjectArchived)
- }
+ // projectName := c.Param("project_name")
- userName := controller.GetUserName(c)
- err = CheckIsProjectManager(userName, projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- sqlWhitelist, exist, err := s.GetSqlWhitelistByIdAndProjectName(whitelistId, projectName)
+ sqlWhitelist, exist, err := s.GetSqlWhitelistByIdAndProjectUID(whitelistId, model.ProjectUID(projectUid))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -214,15 +185,13 @@ func GetSqlWhitelist(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
- projectName := c.Param("project_name")
- userName := controller.GetUserName(c)
- err := CheckIsProjectMember(userName, projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
s := model.GetStorage()
- sqlWhitelist, count, err := s.GetSqlWhitelistByProjectName(req.PageIndex, req.PageSize, projectName)
+ sqlWhitelist, count, err := s.GetSqlWhitelistByProjectUID(req.PageIndex, req.PageSize, model.ProjectUID(projectUid))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
diff --git a/sqle/api/controller/v1/statistic.go b/sqle/api/controller/v1/statistic.go
index 4b56b584cc..1eb734f4b0 100644
--- a/sqle/api/controller/v1/statistic.go
+++ b/sqle/api/controller/v1/statistic.go
@@ -1,9 +1,11 @@
package v1
import (
+ "context"
"net/http"
"github.com/actiontech/sqle/sqle/api/controller"
+ "github.com/actiontech/sqle/sqle/dms"
"github.com/actiontech/sqle/sqle/model"
"github.com/actiontech/sqle/sqle/server/auditplan"
@@ -348,7 +350,21 @@ type GetLicenseUsageResV1 struct {
// @Success 200 {object} v1.GetLicenseUsageResV1
// @router /v1/statistic/license/usage [get]
func GetLicenseUsageV1(c echo.Context) error {
- return getLicenseUsageV1(c)
+ // dms-todo: 移除 license
+ return c.JSON(http.StatusOK, &GetLicenseUsageResV1{
+ BaseRes: controller.NewBaseReq(nil),
+ Data: &LicenseUsageV1{
+ UsersUsage: LicenseUsageItem{
+ ResourceType: "user",
+ ResourceTypeDesc: "用户",
+ Used: 0,
+ Limit: 0,
+ IsLimited: false,
+ },
+ InstancesUsage: []LicenseUsageItem{},
+ },
+ })
+ // return getLicenseUsageV1(c)
}
type GetSqlExecutionFailPercentReqV1 struct {
@@ -402,44 +418,45 @@ type GetProjectStatisticsResDataV1 struct {
// @Success 200 {object} v1.GetProjectStatisticsResV1
// @router /v1/projects/{project_name}/statistics [get]
func GetProjectStatisticsV1(c echo.Context) error {
- projectName := c.Param("project_name")
- err := CheckIsProjectMember(controller.GetUserName(c), projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
+ // TODO 暂时不处理,解决页面报错
+ // projectName := c.Param("project_name")
+ // err := CheckIsProjectMember(controller.GetUserName(c), projectName)
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
resp := GetProjectStatisticsResDataV1{}
- s := model.GetStorage()
-
- resp.MemberTotal, err = s.GetUserTotalInProjectByProjectName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- resp.WhitelistTotal, err = s.GetSqlWhitelistTotalByProjectName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- resp.RuleTemplateTotal, err = s.GetRuleTemplateTotalByProjectName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- resp.InstanceTotal, err = s.GetInstanceTotalByProjectName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- resp.AuditPlanTotal, err = s.GetAuditPlanTotalByProjectName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- resp.WorkflowTotal, err = s.GetWorkflowTotalByProjectName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
+ // s := model.GetStorage()
+
+ // resp.MemberTotal, err = s.GetUserTotalInProjectByProjectName(projectName)
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
+
+ // resp.WhitelistTotal, err = s.GetSqlWhitelistTotalByProjectName(projectName)
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
+
+ // resp.RuleTemplateTotal, err = s.GetRuleTemplateTotalByProjectName(projectName)
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
+
+ // resp.InstanceTotal, err = s.GetInstanceTotalByProjectName(projectName)
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
+
+ // resp.AuditPlanTotal, err = s.GetAuditPlanTotalByProjectName(projectName)
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
+
+ // resp.WorkflowTotal, err = s.GetWorkflowTotalByProjectName(projectName)
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
return c.JSON(http.StatusOK, GetProjectStatisticsResV1{
BaseRes: controller.NewBaseReq(nil),
@@ -468,18 +485,16 @@ type StatisticsAuditedSQLResV1 struct {
// @Success 200 {object} v1.StatisticsAuditedSQLResV1
// @router /v1/projects/{project_name}/statistic/audited_sqls [get]
func StatisticsAuditedSQLV1(c echo.Context) error {
- projectName := c.Param("project_name")
- err := CheckIsProjectMember(controller.GetUserName(c), projectName)
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
-
s := model.GetStorage()
- workflowSqlCount, err := s.GetSqlCountAndTriggerRuleCountFromWorkflowByProject(projectName)
+ workflowSqlCount, err := s.GetSqlCountAndTriggerRuleCountFromWorkflowByProject(projectUid)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- auditPlanSqlCount, err := s.GetAuditPlanSQLCountAndTriggerRuleCountByProject(projectName)
+ auditPlanSqlCount, err := s.GetAuditPlanSQLCountAndTriggerRuleCountByProject(projectUid)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -506,12 +521,12 @@ type dbErr struct {
err error
}
-func (d *dbErr) getWorkFlowStatusCountByProject(status string, projectName string) (count int) {
+func (d *dbErr) getWorkFlowStatusCountByProject(status string, projectUid string) (count int) {
if d.err != nil {
return 0
}
- count, d.err = d.s.GetWorkflowCountByStatusAndProject(status, projectName)
+ count, d.err = d.s.GetWorkflowCountByStatusAndProject(status, projectUid)
return count
}
@@ -526,20 +541,19 @@ func (d *dbErr) getWorkFlowStatusCountByProject(status string, projectName strin
// @Success 200 {object} v1.GetWorkflowStatusCountResV1
// @router /v1/projects/{project_name}/statistic/workflow_status [get]
func StatisticWorkflowStatusV1(c echo.Context) error {
- projectName := c.Param("project_name")
- err := CheckIsProjectMember(controller.GetUserName(c), projectName)
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
d := &dbErr{s: model.GetStorage()}
- waitingForAuditCount := d.getWorkFlowStatusCountByProject(model.WorkflowStatusWaitForAudit, projectName)
- waitingForExecutionCount := d.getWorkFlowStatusCountByProject(model.WorkflowStatusWaitForExecution, projectName)
- executingCount := d.getWorkFlowStatusCountByProject(model.WorkflowStatusExecuting, projectName)
- executionSuccessCount := d.getWorkFlowStatusCountByProject(model.WorkflowStatusFinish, projectName)
- executingFailedCount := d.getWorkFlowStatusCountByProject(model.WorkflowStatusExecFailed, projectName)
- rejectedCount := d.getWorkFlowStatusCountByProject(model.WorkflowStatusReject, projectName)
- closedCount := d.getWorkFlowStatusCountByProject(model.WorkflowStatusCancel, projectName)
+ waitingForAuditCount := d.getWorkFlowStatusCountByProject(model.WorkflowStatusWaitForAudit, projectUid)
+ waitingForExecutionCount := d.getWorkFlowStatusCountByProject(model.WorkflowStatusWaitForExecution, projectUid)
+ executingCount := d.getWorkFlowStatusCountByProject(model.WorkflowStatusExecuting, projectUid)
+ executionSuccessCount := d.getWorkFlowStatusCountByProject(model.WorkflowStatusFinish, projectUid)
+ executingFailedCount := d.getWorkFlowStatusCountByProject(model.WorkflowStatusExecFailed, projectUid)
+ rejectedCount := d.getWorkFlowStatusCountByProject(model.WorkflowStatusReject, projectUid)
+ closedCount := d.getWorkFlowStatusCountByProject(model.WorkflowStatusCancel, projectUid)
return c.JSON(http.StatusOK, &GetWorkflowStatusCountResV1{
BaseRes: controller.NewBaseReq(nil),
@@ -578,25 +592,33 @@ type StatisticRiskWorkflowResV1 struct {
// @Success 200 {object} v1.StatisticRiskWorkflowResV1
// @router /v1/projects/{project_name}/statistic/risk_workflow [get]
func StatisticRiskWorkflowV1(c echo.Context) error {
- projectName := c.Param("project_name")
- err := CheckIsProjectMember(controller.GetUserName(c), projectName)
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
-
s := model.GetStorage()
- projectWorkflowStatusDetails, err := s.GetProjectWorkflowStatusDetail(projectName, []string{model.WorkflowStatusReject, model.WorkflowStatusExecFailed})
+ projectWorkflowStatusDetails, err := s.GetProjectWorkflowStatusDetail(projectUid, []string{model.WorkflowStatusReject, model.WorkflowStatusExecFailed})
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
riskWorkflows := make([]*RiskWorkflow, len(projectWorkflowStatusDetails))
for i, info := range projectWorkflowStatusDetails {
+ user, err := func() (*model.User, error) {
+ ctx, cancel := context.WithTimeout(c.Request().Context(), 5*time.Second)
+ defer cancel()
+
+ return dms.GetUser(ctx, info.CreateUserId, controller.GetDMSServerAddress())
+ }()
+
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
riskWorkflows[i] = &RiskWorkflow{
Name: info.Subject,
WorkflowID: info.WorkflowId,
Status: info.Status,
- CreateUser: info.LoginName,
+ CreateUser: user.Name,
UpdateTime: info.UpdatedAt,
}
}
@@ -633,14 +655,13 @@ type StatisticAuditPlanResV1 struct {
// @Success 200 {object} v1.StatisticAuditPlanResV1
// @router /v1/projects/{project_name}/statistic/audit_plans [get]
func StatisticAuditPlanV1(c echo.Context) error {
- projectName := c.Param("project_name")
- err := CheckIsProjectMember(controller.GetUserName(c), projectName)
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
s := model.GetStorage()
- dBTypeAuditPlanCounts, err := s.GetDBTypeAuditPlanCountByProject(projectName)
+ dBTypeAuditPlanCounts, err := s.GetDBTypeAuditPlanCountByProject(projectUid)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -700,14 +721,13 @@ type GetRiskAuditPlanResV1 struct {
// @Success 200 {object} v1.GetRiskAuditPlanResV1
// @router /v1/projects/{project_name}/statistic/risk_audit_plans [get]
func GetRiskAuditPlanV1(c echo.Context) error {
- projectName := c.Param("project_name")
- err := CheckIsProjectMember(controller.GetUserName(c), projectName)
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
s := model.GetStorage()
- riskAuditPlanInfos, err := s.GetRiskAuditPlan(projectName)
+ riskAuditPlanInfos, err := s.GetRiskAuditPlan(projectUid)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -749,51 +769,47 @@ type GetRoleUserCountResV1 struct {
// @Success 200 {object} v1.GetRoleUserCountResV1
// @router /v1/projects/{project_name}/statistic/role_user [get]
func GetRoleUserCountV1(c echo.Context) error {
- projectName := c.Param("project_name")
- err := CheckIsProjectMember(controller.GetUserName(c), projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- s := model.GetStorage()
- userRoles, err := s.GetUserRoleByProjectName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- userRoleFromUserGroup, err := s.GetUserRoleFromUserGroupByProjectName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- // 若成员和成员组重复绑定相同角色,需要去重
- userRoleMap := make(map[string]map[string]struct{}) // key 1: role_name, key 2: username
- for i := range userRoles {
- userRole := userRoles[i]
- subMap, exist := userRoleMap[userRole.RoleName]
- if !exist {
- subMap = make(map[string]struct{})
- userRoleMap[userRole.RoleName] = subMap
- }
- subMap[userRole.UserName] = struct{}{}
- }
- for i := range userRoleFromUserGroup {
- userRole := userRoleFromUserGroup[i]
- subMap, exist := userRoleMap[userRole.RoleName]
- if !exist {
- subMap = make(map[string]struct{})
- userRoleMap[userRole.RoleName] = subMap
- }
- subMap[userRole.UserName] = struct{}{}
- }
-
- roleUserCountSlice := []*RoleUserCount{}
- for k, v := range userRoleMap {
- roleUserCountSlice = append(roleUserCountSlice, &RoleUserCount{Role: k, Count: uint(len(v))})
- }
+ // projectName := c.Param("project_name")
+
+ // s := model.GetStorage()
+ // userRoles, err := s.GetUserRoleByProjectName(projectName)
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
+ // userRoleFromUserGroup, err := s.GetUserRoleFromUserGroupByProjectName(projectName)
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
+
+ // // 若成员和成员组重复绑定相同角色,需要去重
+ // userRoleMap := make(map[string]map[string]struct{}) // key 1: role_name, key 2: username
+ // for i := range userRoles {
+ // userRole := userRoles[i]
+ // subMap, exist := userRoleMap[userRole.RoleName]
+ // if !exist {
+ // subMap = make(map[string]struct{})
+ // userRoleMap[userRole.RoleName] = subMap
+ // }
+ // subMap[userRole.UserName] = struct{}{}
+ // }
+ // for i := range userRoleFromUserGroup {
+ // userRole := userRoleFromUserGroup[i]
+ // subMap, exist := userRoleMap[userRole.RoleName]
+ // if !exist {
+ // subMap = make(map[string]struct{})
+ // userRoleMap[userRole.RoleName] = subMap
+ // }
+ // subMap[userRole.UserName] = struct{}{}
+ // }
+
+ // roleUserCountSlice := []*RoleUserCount{}
+ // for k, v := range userRoleMap {
+ // roleUserCountSlice = append(roleUserCountSlice, &RoleUserCount{Role: k, Count: uint(len(v))})
+ // }
return c.JSON(http.StatusOK, GetRoleUserCountResV1{
BaseRes: controller.NewBaseReq(nil),
- Data: roleUserCountSlice,
+ Data: nil,
})
}
@@ -816,19 +832,17 @@ type GetProjectScoreResV1 struct {
// @Success 200 {object} v1.GetProjectScoreResV1
// @router /v1/projects/{project_name}/statistic/project_score [get]
func GetProjectScoreV1(c echo.Context) error {
- projectName := c.Param("project_name")
- err := CheckIsProjectMember(controller.GetUserName(c), projectName)
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
-
s := model.GetStorage()
execFailedStatus := []string{model.WorkflowStatusExecFailed, model.WorkflowStatusFinish, model.WorkflowStatusExecuting}
- workflowsStatuses, err := s.GetProjectWorkflowStatusDetail(projectName, execFailedStatus)
+ workflowsStatuses, err := s.GetProjectWorkflowStatusDetail(projectUid, execFailedStatus)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- auditReports, err := s.GetAuditPlanReportByProjectName(projectName)
+ auditReports, err := s.GetAuditPlanReportByProjectName(projectUid)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -946,18 +960,26 @@ func generateMaps(instanceWorkFlowFailedStatus []*model.InstanceWorkFlowStatusCo
// @Success 200 {object} v1.GetInstanceHealthResV1
// @router /v1/projects/{project_name}/statistic/instance_health [get]
func GetInstanceHealthV1(c echo.Context) error {
- projectName := c.Param("project_name")
- err := CheckIsProjectMember(controller.GetUserName(c), projectName)
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
s := model.GetStorage()
- instanceWorkFlowFailedStatus, err := s.GetInstanceWorkFlowStatusCountByProject(projectName, []string{model.WorkflowStatusReject, model.WorkflowStatusExecFailed})
+ instances, err := dms.GetInstancesInProject(c.Request().Context(), projectUid)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ instanceWorkFlowFailedStatus, err := s.GetInstanceWorkFlowStatusCountByProject(instances, []string{model.WorkflowStatusReject, model.WorkflowStatusExecFailed})
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+
+ instanceNames, err := dms.GetInstanceNamesInProject(c.Request().Context(), projectUid)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- latestAuditPlanReportScores, err := s.GetLatestAuditPlanReportScoreFromInstanceByProject(projectName)
+ latestAuditPlanReportScores, err := s.GetLatestAuditPlanReportScoreFromInstanceByProject(projectUid, instanceNames)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
diff --git a/sqle/api/controller/v1/statistic_ce.go b/sqle/api/controller/v1/statistic_ce.go
index 736a85784c..37e082287c 100644
--- a/sqle/api/controller/v1/statistic_ce.go
+++ b/sqle/api/controller/v1/statistic_ce.go
@@ -17,10 +17,6 @@ func getInstancesTypePercentV1(c echo.Context) error {
return controller.JSONBaseErrorReq(c, errCommunityEditionDoesNotSupportStatistic)
}
-func getLicenseUsageV1(c echo.Context) error {
- return controller.JSONBaseErrorReq(c, errCommunityEditionDoesNotSupportStatistic)
-}
-
func getWorkflowRejectedPercentGroupByCreatorV1(c echo.Context) error {
return controller.JSONBaseErrorReq(c, errCommunityEditionDoesNotSupportStatistic)
}
diff --git a/sqle/api/controller/v1/sync_instance.go b/sqle/api/controller/v1/sync_instance.go
deleted file mode 100644
index 7f3f7c2e07..0000000000
--- a/sqle/api/controller/v1/sync_instance.go
+++ /dev/null
@@ -1,165 +0,0 @@
-package v1
-
-import (
- "time"
-
- "github.com/actiontech/sqle/sqle/api/controller"
- "github.com/labstack/echo/v4"
-)
-
-type CreateSyncInstanceTaskReqV1 struct {
- Source string `json:"source" form:"source" validate:"required" example:"actiontech-dmp"`
- Version string `json:"version" form:"version" validate:"required" example:"5.23.01.0"`
- URL string `json:"url" form:"url" validate:"required" example:"http://10.186.62.56:10000"`
- DbType string `json:"db_type" form:"db_type" validate:"required" example:"mysql"`
- GlobalRuleTemplate string `json:"global_rule_template" form:"global_rule_template" validate:"required" example:"default_mysql"`
- SyncInstanceInterval string `json:"sync_instance_interval" form:"sync_instance_interval" validate:"required" example:"0 0 * * *"`
-}
-
-// CreateSyncInstanceTask create sync instance task
-// @Summary 创建同步实例任务
-// @Description create sync instance task
-// @Id createSyncInstanceTaskV1
-// @Tags sync_instance
-// @Security ApiKeyAuth
-// @Accept json
-// @Param sync_task body v1.CreateSyncInstanceTaskReqV1 true "create sync instance task request"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/sync_instances [post]
-func CreateSyncInstanceTask(c echo.Context) error {
- return createSyncInstanceTask(c)
-}
-
-type UpdateSyncInstanceTaskReqV1 struct {
- Version *string `json:"version" form:"version" example:"5.23.01.0"`
- URL *string `json:"url" form:"url" example:"http://10.186.62.56:10000"`
- GlobalRuleTemplate *string `json:"global_rule_template" form:"global_rule_template" example:"default_mysql"`
- SyncInstanceInterval *string `json:"sync_instance_interval" form:"sync_instance_interval" example:"0 0 * * *"`
-}
-
-// UpdateSyncInstanceTask update sync instance task
-// @Summary 更新同步实例任务
-// @Description update sync instance task
-// @Id updateSyncInstanceTaskV1
-// @Tags sync_instance
-// @Security ApiKeyAuth
-// @Param task_id path string true "sync task id"
-// @param sync_task body v1.UpdateSyncInstanceTaskReqV1 true "update sync instance request"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/sync_instances/{task_id}/ [patch]
-func UpdateSyncInstanceTask(c echo.Context) error {
- return updateSyncInstanceTask(c)
-}
-
-// DeleteSyncInstanceTask delete sync instance task
-// @Summary 删除同步实例任务
-// @Description delete sync instance task
-// @Id deleteSyncInstanceTaskV1
-// @Tags sync_instance
-// @Security ApiKeyAuth
-// @param task_id path string true "sync task id"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/sync_instances/{task_id}/ [delete]
-func DeleteSyncInstanceTask(c echo.Context) error {
- return deleteSyncInstanceTask(c)
-}
-
-type SyncInstanceResV1 struct {
- IsSyncInstanceSuccess bool `json:"is_sync_instance_success" example:"true"`
- SyncErrorMessage string `json:"sync_error_message"`
-}
-
-type TriggerSyncInstanceResV1 struct {
- controller.BaseRes
- Data SyncInstanceResV1 `json:"data"`
-}
-
-// TriggerSyncInstance trigger sync instance
-// @Summary 触发同步实例
-// @Description trigger sync instance
-// @Id triggerSyncInstanceV1
-// @Tags sync_instance
-// @Security ApiKeyAuth
-// @param task_id path string true "sync task id"
-// @Success 200 {object} v1.TriggerSyncInstanceResV1
-// @router /v1/sync_instances/{task_id}/trigger [post]
-func TriggerSyncInstance(c echo.Context) error {
- return triggerSyncInstance(c)
-}
-
-type GetSyncInstanceTaskListResV1 struct {
- controller.BaseRes
- Data []InstanceTaskResV1 `json:"data"`
-}
-
-type InstanceTaskResV1 struct {
- ID int `json:"id" example:"1"`
- Source string `json:"source" example:"actiontech-dmp"`
- Version string `json:"version" example:"1.23.1"`
- URL string `json:"url" example:"http://10.186.62.56:10000"`
- DbType string `json:"db_type" example:"mysql"`
- LastSyncStatus string `json:"last_sync_status" enums:"succeeded,failed" example:"succeeded"`
- LastSyncSuccessTime *time.Time `json:"last_sync_success_time" example:"2021-08-12 12:00:00"`
-}
-
-// GetSyncInstanceTaskList get sync instance task list
-// @Summary 获取同步实例任务列表
-// @Description get sync instance task list
-// @Id GetSyncInstanceTaskList
-// @Tags sync_instance
-// @Security ApiKeyAuth
-// @Success 200 {object} v1.GetSyncInstanceTaskListResV1
-// @router /v1/sync_instances [get]
-func GetSyncInstanceTaskList(c echo.Context) error {
- return getSyncInstanceTaskList(c)
-}
-
-type SyncTaskTipsResV1 struct {
- Source string `json:"source" example:"actiontech-dmp"`
- DbTypes []string `json:"db_types"`
-}
-
-type GetSyncTaskSourceTipsResV1 struct {
- controller.BaseRes
- Data []SyncTaskTipsResV1 `json:"data"`
-}
-
-// GetSyncTaskSourceTips get sync instance tips
-// @Summary 获取同步任务提示
-// @Description get sync task tips
-// @Id GetSyncTaskSourceTips
-// @Tags sync_instance
-// @Security ApiKeyAuth
-// @Success 200 {object} v1.GetSyncTaskSourceTipsResV1
-// @router /v1/sync_instances/source_tips [get]
-func GetSyncTaskSourceTips(c echo.Context) error {
- return getSyncTaskSourceTips(c)
-}
-
-type InstanceTaskDetailResV1 struct {
- ID int `json:"id" example:"1"`
- Source string `json:"source" example:"actiontech-dmp"`
- Version string `json:"version" example:"1.23.1"`
- URL string `json:"url" example:"http://10.186.62.56:10000"`
- DbType string `json:"db_type" example:"mysql"`
- RuleTemplate string `json:"rule_template" example:"default_mysql"`
- SyncInstanceInterval string `json:"sync_instance_interval" example:"0 0 * * *"`
-}
-
-type GetSyncInstanceTaskResV1 struct {
- controller.BaseRes
- Data InstanceTaskDetailResV1 `json:"data"`
-}
-
-// GetSyncInstanceTask get sync task detail
-// @Summary 获取同步任务详情
-// @Description get sync task detail
-// @Id GetSyncInstanceTask
-// @Tags sync_instance
-// @Security ApiKeyAuth
-// @param task_id path string true "sync task id"
-// @Success 200 {object} v1.GetSyncInstanceTaskResV1
-// @router /v1/sync_instances/{task_id}/ [get]
-func GetSyncInstanceTask(c echo.Context) error {
- return getSyncInstanceTask(c)
-}
diff --git a/sqle/api/controller/v1/sync_instance_ce.go b/sqle/api/controller/v1/sync_instance_ce.go
deleted file mode 100644
index 2a38ba7b7c..0000000000
--- a/sqle/api/controller/v1/sync_instance_ce.go
+++ /dev/null
@@ -1,41 +0,0 @@
-//go:build !enterprise
-// +build !enterprise
-
-package v1
-
-import (
- e "errors"
- "github.com/actiontech/sqle/sqle/api/controller"
- "github.com/actiontech/sqle/sqle/errors"
- "github.com/labstack/echo/v4"
-)
-
-var errCommunityEditionDoesNotSupportSyncInstance = errors.New(errors.EnterpriseEditionFeatures, e.New("community edition does not support sync instance"))
-
-func createSyncInstanceTask(c echo.Context) error {
- return controller.JSONBaseErrorReq(c, errCommunityEditionDoesNotSupportSyncInstance)
-}
-
-func updateSyncInstanceTask(c echo.Context) error {
- return controller.JSONBaseErrorReq(c, errCommunityEditionDoesNotSupportSyncInstance)
-}
-
-func deleteSyncInstanceTask(c echo.Context) error {
- return controller.JSONBaseErrorReq(c, errCommunityEditionDoesNotSupportSyncInstance)
-}
-
-func triggerSyncInstance(c echo.Context) error {
- return controller.JSONBaseErrorReq(c, errCommunityEditionDoesNotSupportSyncInstance)
-}
-
-func getSyncInstanceTaskList(c echo.Context) error {
- return controller.JSONBaseErrorReq(c, errCommunityEditionDoesNotSupportSyncInstance)
-}
-
-func getSyncTaskSourceTips(c echo.Context) error {
- return controller.JSONBaseErrorReq(c, errCommunityEditionDoesNotSupportSyncInstance)
-}
-
-func getSyncInstanceTask(c echo.Context) error {
- return controller.JSONBaseErrorReq(c, errCommunityEditionDoesNotSupportSyncInstance)
-}
diff --git a/sqle/api/controller/v1/task.go b/sqle/api/controller/v1/task.go
index ff3eeace26..124e78ace2 100644
--- a/sqle/api/controller/v1/task.go
+++ b/sqle/api/controller/v1/task.go
@@ -10,9 +10,11 @@ import (
"strconv"
"time"
+ dmsV1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
mybatis_parser "github.com/actiontech/mybatis-mapper-2-sql"
"github.com/actiontech/sqle/sqle/api/controller"
"github.com/actiontech/sqle/sqle/common"
+ "github.com/actiontech/sqle/sqle/dms"
driverV2 "github.com/actiontech/sqle/sqle/driver/v2"
"github.com/actiontech/sqle/sqle/errors"
"github.com/actiontech/sqle/sqle/log"
@@ -174,19 +176,19 @@ func CreateAndAuditTask(c echo.Context) error {
}
}
- projectName := c.Param("project_name")
-
- user, err := controller.GetCurrentUser(c)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- err = CheckIsProjectMember(user.Name, projectName)
+ s := model.GetStorage()
+
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- s := model.GetStorage()
- task, err := buildOnlineTaskForAudit(c, s, user.ID, req.InstanceName, req.InstanceSchema, projectName, sqls)
+
+ task, err := buildOnlineTaskForAudit(c, s, uint64(user.ID), req.InstanceName, req.InstanceSchema, projectUid, sqls)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -220,15 +222,12 @@ func CreateAndAuditTask(c echo.Context) error {
// @Success 200 {object} v1.GetAuditTaskResV1
// @router /v1/tasks/audits/{task_id}/ [get]
func GetTask(c echo.Context) error {
- s := model.GetStorage()
taskId := c.Param("task_id")
- task, exist, err := s.GetTaskById(taskId)
+ task, err := getTaskById(c.Request().Context(), taskId)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, errors.NewTaskNoExistOrNoAccessErr())
- }
+
err = CheckCurrentUserCanViewTask(c, task)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
@@ -239,6 +238,28 @@ func GetTask(c echo.Context) error {
Data: convertTaskToRes(task),
})
}
+func GetTaskById(ctx context.Context, taskId string) (*model.Task, error) {
+ return getTaskById(ctx, taskId)
+}
+
+func getTaskById(ctx context.Context, taskId string) (*model.Task, error) {
+ s := model.GetStorage()
+ task, exist, err := s.GetTaskById(taskId)
+ if err != nil {
+ return nil, err
+ }
+ if !exist {
+ return nil, errors.NewTaskNoExistOrNoAccessErr()
+ }
+
+ instance, exist, err := dms.GetInstancesById(ctx, task.InstanceId)
+ if err != nil {
+ return nil, err
+ }
+ task.Instance = instance
+
+ return task, nil
+}
type GetAuditTaskSQLsReqV1 struct {
FilterExecStatus string `json:"filter_exec_status" query:"filter_exec_status"`
@@ -288,14 +309,12 @@ func GetTaskSQLs(c echo.Context) error {
}
s := model.GetStorage()
taskId := c.Param("task_id")
- task, exist, err := s.GetTaskById(taskId)
+ task, err := getTaskById(c.Request().Context(), taskId)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, errors.NewTaskNoExistOrNoAccessErr())
- }
- err = CheckCurrentUserCanViewTask(c, task)
+
+ err = CheckCurrentUserCanViewTaskDMS(c, task)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -362,13 +381,11 @@ func DownloadTaskSQLReportFile(c echo.Context) error {
}
s := model.GetStorage()
taskId := c.Param("task_id")
- task, exist, err := s.GetTaskById(taskId)
+ task, err := getTaskById(c.Request().Context(), taskId)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, errors.NewTaskNoExistOrNoAccessErr())
- }
+
err = CheckCurrentUserCanViewTask(c, task)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
@@ -428,13 +445,11 @@ func DownloadTaskSQLReportFile(c echo.Context) error {
func DownloadTaskSQLFile(c echo.Context) error {
taskId := c.Param("task_id")
s := model.GetStorage()
- task, exist, err := s.GetTaskById(taskId)
+ task, err := getTaskById(c.Request().Context(), taskId)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, errors.NewTaskNoExistOrNoAccessErr())
- }
+
err = CheckCurrentUserCanViewTask(c, task)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
@@ -471,13 +486,12 @@ type AuditTaskSQLContentResV1 struct {
func GetAuditTaskSQLContent(c echo.Context) error {
taskId := c.Param("task_id")
s := model.GetStorage()
- task, exist, err := s.GetTaskById(taskId)
+
+ task, err := getTaskById(c.Request().Context(), taskId)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, errors.NewTaskNoExistOrNoAccessErr())
- }
+
err = CheckCurrentUserCanViewTask(c, task)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
@@ -519,13 +533,11 @@ func UpdateAuditTaskSQLs(c echo.Context) error {
number := c.Param("number")
s := model.GetStorage()
- task, exist, err := s.GetTaskById(taskId)
+ task, err := getTaskById(c.Request().Context(), taskId)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, errors.NewTaskNoExistOrNoAccessErr())
- }
+
err = CheckCurrentUserCanViewTask(c, task)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
@@ -544,7 +556,16 @@ func UpdateAuditTaskSQLs(c echo.Context) error {
}
func CheckCurrentUserCanViewTask(c echo.Context, task *model.Task) (err error) {
- return checkCurrentUserCanAccessTask(c, task, []uint{model.OP_WORKFLOW_VIEW_OTHERS})
+ return checkCurrentUserCanAccessTask(c, task, []dmsV1.OpPermissionType{dmsV1.OpPermissionTypeViewOthersWorkflow})
+}
+
+// TODO 使用DMS的权限校验
+func CheckCurrentUserCanViewTaskDMS(c echo.Context, task *model.Task) error {
+ _, err := controller.GetCurrentUser(c, dms.GetUser)
+ if err != nil {
+ return err
+ }
+ return nil
}
type SQLExplain struct {
@@ -620,26 +641,38 @@ func CreateAuditTasksGroupV1(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
-
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
// 数据源个数最大为10
if len(req.Instances) > MaximumDataSourceNum {
return controller.JSONBaseErrorReq(c, ErrTooManyDataSource)
}
- projectName := c.Param("project_name")
- userName := controller.GetUserName(c)
+ instNames := make([]string, len(req.Instances))
+ for i, instance := range req.Instances {
+ instNames[i] = instance.InstanceName
+ }
+
+ distinctInstNames := utils.RemoveDuplicate(instNames)
- err := CheckIsProjectMember(userName, projectName)
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
s := model.GetStorage()
- distinctInstNameList := getDistinctInstNameList(req.Instances)
+
+ instances, err := dms.GetInstancesInProjectByNames(c.Request().Context(), projectUid, distinctInstNames)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+
nameInstanceMap := make(map[string]*model.Instance, len(req.Instances))
- for _, instName := range distinctInstNameList {
+ for _, inst := range instances {
// https://github.com/actiontech/sqle/issues/1673
- inst, exist, err := s.GetInstanceByNameAndProjectName(instName, projectName)
+ inst, exist, err := dms.GetInstanceInProjectByName(c.Request().Context(), projectUid, inst.Name)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -647,7 +680,7 @@ func CreateAuditTasksGroupV1(c echo.Context) error {
return controller.JSONBaseErrorReq(c, ErrInstanceNoAccess)
}
- can, err := checkCurrentUserCanAccessInstance(c, inst)
+ can, err := CheckCurrentUserCanAccessInstances(c.Request().Context(), projectUid, user.GetIDStr(), instances)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -659,12 +692,7 @@ func CreateAuditTasksGroupV1(c echo.Context) error {
return controller.JSONBaseErrorReq(c, err)
}
- nameInstanceMap[instName] = inst
- }
-
- user, err := controller.GetCurrentUser(c)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
+ nameInstanceMap[inst.Name] = inst
}
tasks := make([]*model.Task, len(req.Instances))
@@ -672,7 +700,7 @@ func CreateAuditTasksGroupV1(c echo.Context) error {
tasks[i] = &model.Task{
Schema: reqInstance.InstanceSchema,
InstanceId: nameInstanceMap[reqInstance.InstanceName].ID,
- CreateUserId: user.ID,
+ CreateUserId: uint64(user.ID),
DBType: nameInstanceMap[reqInstance.InstanceName].DbType,
}
tasks[i].CreatedAt = time.Now()
@@ -691,15 +719,6 @@ func CreateAuditTasksGroupV1(c echo.Context) error {
})
}
-func getDistinctInstNameList(instList []*InstanceForCreatingTask) []string {
- instNames := make([]string, len(instList))
- for i, inst := range instList {
- instNames[i] = inst.InstanceName
- }
-
- return utils.RemoveDuplicate(instNames)
-}
-
type AuditTaskGroupReqV1 struct {
TaskGroupId uint `json:"task_group_id" form:"task_group_id" valid:"required"`
Sql string `json:"sql" form:"sql" example:"alter table tb1 drop columns c1"`
@@ -768,12 +787,19 @@ func AuditTaskGroupV1(c echo.Context) error {
tasks := taskGroup.Tasks
{
- instances := make([]*model.Instance, 0)
+ instanceIds := make([]uint64, 0, len(tasks))
for _, task := range tasks {
- instances = append(instances, task.Instance)
+ instanceIds = append(instanceIds, task.InstanceId)
+ }
+
+ instances, err := dms.GetInstancesByIds(c.Request().Context(), instanceIds)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
}
- can, err := checkCurrentUserCanAccessInstances(c, instances)
+ // 因为这个接口数据源属于同一个项目,取第一个DB所属项目
+ projectId := instances[0].ProjectId
+ can, err := CheckCurrentUserCanAccessInstances(c.Request().Context(), projectId, controller.GetUserID(c), instances)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
diff --git a/sqle/api/controller/v1/user.go b/sqle/api/controller/v1/user.go
index fbd7f34bdc..78690b478d 100644
--- a/sqle/api/controller/v1/user.go
+++ b/sqle/api/controller/v1/user.go
@@ -1,564 +1,21 @@
package v1
import (
- _errors "errors"
- "fmt"
"net/http"
"github.com/actiontech/sqle/sqle/api/controller"
- "github.com/actiontech/sqle/sqle/errors"
- "github.com/actiontech/sqle/sqle/model"
- "github.com/actiontech/sqle/sqle/utils"
+ "github.com/actiontech/sqle/sqle/dms"
"github.com/labstack/echo/v4"
)
-type CreateUserReqV1 struct {
- Name string `json:"user_name" form:"user_name" example:"test" valid:"required,name"`
- Password string `json:"user_password" form:"user_name" example:"123456" valid:"required"`
- Email string `json:"email" form:"email" example:"test@email.com" valid:"omitempty,email"`
- Phone string `json:"phone" form:"phone" example:"18962136666" valid:"omitempty"`
- WeChatID string `json:"wechat_id" example:"UserID"`
- UserGroups []string `json:"user_group_name_list" form:"user_group_name_list"`
- ManagementPermissionCodes []uint `json:"management_permission_code_list" form:"management_permission_code_list"`
-}
-
-// @Summary 创建用户
-// @Description create user
-// @Id createUserV1
-// @Tags user
-// @Security ApiKeyAuth
-// @Accept json
-// @Produce json
-// @Param instance body v1.CreateUserReqV1 true "create user"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/users [post]
-func CreateUser(c echo.Context) error {
- req := new(CreateUserReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
-
- s := model.GetStorage()
- _, exist, err := s.GetUserByName(req.Name)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if exist {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataExist, fmt.Errorf("user is exist")))
- }
-
- var userGroups []*model.UserGroup
- {
- if req.UserGroups != nil || len(req.UserGroups) > 0 {
- userGroups, err = s.GetAndCheckUserGroupExist(req.UserGroups)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- }
- }
-
- user := &model.User{
- Name: req.Name,
- Password: req.Password,
- Email: req.Email,
- Phone: req.Phone,
- WeChatID: req.WeChatID,
- }
-
- return controller.JSONBaseErrorReq(c,
- s.SaveUserAndAssociations(user, userGroups, &req.ManagementPermissionCodes))
-}
-
-type UpdateUserReqV1 struct {
- Email *string `json:"email" valid:"omitempty,len=0|email" form:"email"`
- Phone *string `json:"phone" valid:"omitempty" form:"phone"`
- WeChatID *string `json:"wechat_id" example:"UserID"`
- IsDisabled *bool `json:"is_disabled,omitempty" form:"is_disabled"`
- UserGroups *[]string `json:"user_group_name_list" form:"user_group_name_list"`
- ManagementPermissionCodes *[]uint `json:"management_permission_code_list,omitempty" form:"management_permission_code_list"`
-}
-
-// @Summary 更新用户信息
-// @Description update user
-// @Id updateUserV1
-// @Tags user
-// @Security ApiKeyAuth
-// @Accept json
-// @Produce json
-// @Param user_name path string true "user name"
-// @Param instance body v1.UpdateUserReqV1 true "update user"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/users/{user_name}/ [patch]
-func UpdateUser(c echo.Context) error {
- req := new(UpdateUserReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
- userName := c.Param("user_name")
- s := model.GetStorage()
- user, exist, err := s.GetUserByName(userName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist, fmt.Errorf("user is not exist")))
- }
-
- // Email
- if req.Email != nil {
- user.Email = *req.Email
- }
-
- // Phone
- if req.Phone != nil {
- user.Phone = *req.Phone
- }
-
- // WeChatID
- if req.WeChatID != nil {
- user.WeChatID = *req.WeChatID
- }
-
- // IsDisabled
- if req.IsDisabled != nil {
- if err := controller.CanThisUserBeDisabled(
- controller.GetUserName(c), userName); err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if *req.IsDisabled {
- user.SetStat(model.Disabled)
- } else {
- user.SetStat(model.Enabled)
- }
- }
-
- // user_groups
- var userGroups []*model.UserGroup
- {
- if req.UserGroups != nil {
- if len(*req.UserGroups) > 0 {
- userGroups, err = s.GetAndCheckUserGroupExist(*req.UserGroups)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- } else {
- userGroups = make([]*model.UserGroup, 0)
- }
- }
-
- }
-
- return controller.JSONBaseErrorReq(c, s.SaveUserAndAssociations(user, userGroups, req.ManagementPermissionCodes))
-}
-
-// @Summary 删除用户
-// @Description delete user
-// @Id deleteUserV1
-// @Tags user
-// @Security ApiKeyAuth
-// @Param user_name path string true "user name"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/users/{user_name}/ [delete]
-func DeleteUser(c echo.Context) error {
- userName := c.Param("user_name")
- if userName == model.DefaultAdminUser {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataConflict,
- fmt.Errorf("admin user cannot be deleted")))
- }
- s := model.GetStorage()
- user, exist, err := s.GetUserByName(userName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist, fmt.Errorf("user is not exist")))
- }
- exist, err = s.UserHasRunningWorkflow(user.ID)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if exist {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataExist,
- fmt.Errorf("%s can't be deleted,cause wait_for_audit or wait_for_execution workflow exist", userName)))
- }
- hasBind, err := s.UserHasBindWorkflowTemplate(user)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if hasBind {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataExist,
- fmt.Errorf("%s can't be deleted,cause the user binds the workflow template", userName)))
- }
-
- isLastMgr, err := s.IsLastProjectManagerOfAnyProjectByUserID(user.ID)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if isLastMgr {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataExist, fmt.Errorf("%s can't be deleted,cause the user is project last manager", userName)))
- }
-
- err = s.RemoveMemberFromAllProjectByUserID(user.ID)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- err = s.Delete(user)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- return controller.JSONBaseErrorReq(c, nil)
-}
-
-type UpdateOtherUserPasswordReqV1 struct {
- Password string `json:"password" valid:"required"`
-}
-
-// @Summary admin修改其他用户密码
-// @Description admin modifies the passwords of other users
-// @Id UpdateOtherUserPasswordV1
-// @Tags user
-// @Security ApiKeyAuth
-// @Accept json
-// @Produce json
-// @Param user_name path string true "user name"
-// @Param instance body v1.UpdateOtherUserPasswordReqV1 true "change user's password"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/users/{user_name}/password [patch]
-func UpdateOtherUserPassword(c echo.Context) error {
- req := new(UpdateOtherUserPasswordReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
- userName := c.Param("user_name")
- if userName == model.DefaultAdminUser {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataConflict,
- fmt.Errorf("admin user's password cannot be changed in this page")))
- }
-
- s := model.GetStorage()
- user, exist, err := s.GetUserByName(userName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist, fmt.Errorf("user is not exist")))
- }
- if user.UserAuthenticationType == model.UserAuthenticationTypeLDAP {
- return controller.JSONBaseErrorReq(c, errLdapUserCanNotChangePassword)
- }
- err = s.UpdatePassword(user, req.Password)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- return controller.JSONBaseErrorReq(c, nil)
-}
-
-type GetUserDetailResV1 struct {
- controller.BaseRes
- Data UserDetailResV1 `json:"data"`
-}
-
-type UserDetailResV1 struct {
- Name string `json:"user_name"`
- Email string `json:"email"`
- Phone string `json:"phone"`
- IsAdmin bool `json:"is_admin"`
- WeChatID string `json:"wechat_id"`
- LoginType string `json:"login_type"`
- IsDisabled bool `json:"is_disabled,omitempty"`
- UserGroups []string `json:"user_group_name_list,omitempty"`
- ManagementPermissionList []*ManagementPermissionResV1 `json:"management_permission_list,omitempty"`
- BindProjects []*UserBindProjectResV1 `json:"bind_projects,omitempty"`
-}
-
-type UserBindProjectResV1 struct {
- ProjectName string `json:"project_name"`
- IsManager bool `json:"is_manager"`
-}
-
-func convertUserToRes(user *model.User, managementPermissionCodes []uint, projects []*model.Project, projectManagerCache map[uint] /*project id*/ bool /*is manager*/) UserDetailResV1 {
- if user.UserAuthenticationType == "" {
- user.UserAuthenticationType = model.UserAuthenticationTypeSQLE
- }
- userResp := UserDetailResV1{
- Name: user.Name,
- Phone: user.Phone,
- Email: user.Email,
- WeChatID: user.WeChatID,
- LoginType: string(user.UserAuthenticationType),
- IsAdmin: user.Name == model.DefaultAdminUser,
- IsDisabled: user.IsDisabled(),
- }
-
- userGroupNames := make([]string, len(user.UserGroups))
- for i := range user.UserGroups {
- userGroupNames[i] = user.UserGroups[i].Name
- }
- userResp.UserGroups = userGroupNames
-
- bindProjects := []*UserBindProjectResV1{}
- for _, project := range projects {
- bindProjects = append(bindProjects, &UserBindProjectResV1{
- ProjectName: project.Name,
- IsManager: projectManagerCache[project.ID],
- })
- }
- userResp.BindProjects = bindProjects
-
- userResp.ManagementPermissionList = generateManagementPermissionResV1s(managementPermissionCodes)
-
- return userResp
-}
-
-// @Summary 获取用户信息
-// @Description get user info
-// @Id getUserV1
-// @Tags user
-// @Security ApiKeyAuth
-// @Param user_name path string true "user name"
-// @Success 200 {object} v1.GetUserDetailResV1
-// @router /v1/users/{user_name}/ [get]
-func GetUser(c echo.Context) error {
- userName := c.Param("user_name")
- return getUserDetail(c, userName)
-}
-
-func getUserDetail(c echo.Context, userName string) error {
- s := model.GetStorage()
- user, exist, err := s.GetUserDetailByName(userName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist, fmt.Errorf("user is not exist")))
- }
-
- codes, err := s.GetManagementPermissionByUserID(user.ID)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- projects, err := s.GetProjectTips(user.Name)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- managed, err := s.GetManagedProjects(user.ID)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- managerCache := map[uint]bool{}
- for _, project := range projects {
- isManager := false
- for _, p := range managed {
- if p.ID == project.ID {
- isManager = true
- break
- }
- }
- managerCache[project.ID] = isManager
- }
-
- return c.JSON(http.StatusOK, &GetUserDetailResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: convertUserToRes(user, codes, projects, managerCache),
- })
-}
-
-// @Summary 获取当前用户信息
-// @Description get current user info
-// @Id getCurrentUserV1
-// @Tags user
-// @Security ApiKeyAuth
-// @Success 200 {object} v1.GetUserDetailResV1
-// @router /v1/user [get]
-func GetCurrentUser(c echo.Context) error {
- userName := controller.GetUserName(c)
- return getUserDetail(c, userName)
-}
-
-type UpdateCurrentUserReqV1 struct {
- Email *string `json:"email"`
- WeChatID *string `json:"wechat_id" example:"UserID"`
- Phone *string `json:"phone" form:"phone"`
-}
-
-// @Summary 更新个人信息
-// @Description update current user
-// @Id updateCurrentUserV1
-// @Tags user
-// @Security ApiKeyAuth
-// @Accept json
-// @Produce json
-// @Param instance body v1.UpdateCurrentUserReqV1 true "update user"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/user [patch]
-func UpdateCurrentUser(c echo.Context) error {
- req := new(UpdateCurrentUserReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
- user, err := controller.GetCurrentUser(c)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- s := model.GetStorage()
- if req.Email != nil {
- user.Email = *req.Email
- }
- if req.WeChatID != nil {
- user.WeChatID = *req.WeChatID
- }
- if req.Phone != nil {
- user.Phone = *req.Phone
- }
- err = s.Save(user)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- return controller.JSONBaseErrorReq(c, nil)
-}
-
-type UpdateCurrentUserPasswordReqV1 struct {
- Password string `json:"password" valid:"required"`
- NewPassword string `json:"new_password" valid:"required"`
-}
-
-var errLdapUserCanNotChangePassword = errors.New(errors.DataConflict, _errors.New("the password of the ldap user cannot be changed or reset, because this password is meaningless"))
-
-// @Summary 用户修改密码
-// @Description update current user's password
-// @Id UpdateCurrentUserPasswordV1
-// @Tags user
-// @Security ApiKeyAuth
-// @Accept json
-// @Produce json
-// @Param instance body v1.UpdateCurrentUserPasswordReqV1 true "update user's password"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/user/password [put]
-func UpdateCurrentUserPassword(c echo.Context) error {
- req := new(UpdateCurrentUserPasswordReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
- user, err := controller.GetCurrentUser(c)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if user.UserAuthenticationType == model.UserAuthenticationTypeLDAP {
- return controller.JSONBaseErrorReq(c, errLdapUserCanNotChangePassword)
- }
- if user.Password != req.Password {
- return controller.JSONBaseErrorReq(c,
- errors.New(errors.LoginAuthFail, fmt.Errorf("password is wrong")))
- }
-
- s := model.GetStorage()
- err = s.UpdatePassword(user, req.NewPassword)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- return controller.JSONBaseErrorReq(c, logout(c))
-}
-
-type GetUsersReqV1 struct {
- FilterUserName string `json:"filter_user_name" query:"filter_user_name"`
- PageIndex uint32 `json:"page_index" query:"page_index" valid:"required"`
- PageSize uint32 `json:"page_size" query:"page_size" valid:"required"`
-}
-
-type GetUsersResV1 struct {
- controller.BaseRes
- Data []UserResV1 `json:"data"`
- TotalNums uint64 `json:"total_nums"`
-}
-
-type UserResV1 struct {
- Name string `json:"user_name"`
- Phone string `json:"phone"`
- Email string `json:"email"`
- WeChatID string `json:"wechat_id"`
- LoginType string `json:"login_type"`
- IsDisabled bool `json:"is_disabled,omitempty"`
- UserGroups []string `json:"user_group_name_list,omitempty"`
- ManagementPermissionList []*ManagementPermissionResV1 `json:"management_permission_list,omitempty"`
-}
-
-// @Summary 获取用户信息列表
-// @Description get user info list
-// @Tags user
-// @Id getUserListV1
-// @Security ApiKeyAuth
-// @Param filter_user_name query string false "filter user name"
-// @Param page_index query uint32 true "page index"
-// @Param page_size query uint32 true "size of per page"
-// @Success 200 {object} v1.GetUsersResV1
-// @router /v1/users [get]
-func GetUsers(c echo.Context) error {
- req := new(GetUsersReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
- s := model.GetStorage()
-
- var offset uint32
- if req.PageIndex >= 1 {
- offset = req.PageSize * (req.PageIndex - 1)
- }
- data := map[string]interface{}{
- "filter_user_name": req.FilterUserName,
- "limit": req.PageSize,
- "offset": offset,
- }
-
- users, count, err := s.GetUsersByReq(data)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- userIDs := []uint{}
- for _, user := range users {
- userIDs = append(userIDs, uint(user.Id))
- }
- permission, err := s.GetManagementPermissionByUserIDs(userIDs)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- usersRes := []UserResV1{}
- for _, user := range users {
- if user.LoginType == "" {
- user.LoginType = string(model.UserAuthenticationTypeSQLE)
- }
- userReq := UserResV1{
- Name: user.Name,
- Email: user.Email,
- Phone: user.Phone.String,
- WeChatID: user.WeChatID.String,
- LoginType: user.LoginType,
- IsDisabled: user.IsDisabled(),
- UserGroups: user.UserGroupNames,
- ManagementPermissionList: generateManagementPermissionResV1s(permission[uint(user.Id)]),
- }
- usersRes = append(usersRes, userReq)
- }
- return c.JSON(http.StatusOK, &GetUsersResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: usersRes,
- TotalNums: count,
- })
-}
-
type UserTipsReqV1 struct {
- FilterProject string `json:"filter_project" query:"filter_project"`
+ FilterProject string `json:"filter_project" query:"filter_project" valid:"required"`
}
type UserTipResV1 struct {
- Name string `json:"user_name"`
+ UserID string `json:"user_id"`
+ Name string `json:"user_name"`
}
type GetUserTipsResV1 struct {
@@ -571,7 +28,7 @@ type GetUserTipsResV1 struct {
// @Tags user
// @Id getUserTipListV1
// @Security ApiKeyAuth
-// @Param filter_project query string false "project name"
+// @Param filter_project query string true "project name"
// @Success 200 {object} v1.GetUserTipsResV1
// @router /v1/user_tips [get]
func GetUserTips(c echo.Context) error {
@@ -579,474 +36,24 @@ func GetUserTips(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
- s := model.GetStorage()
- users, err := s.GetUserTipsByProject(req.FilterProject)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- userTipsRes := make([]UserTipResV1, 0, len(users))
-
- for _, user := range users {
- userTipRes := UserTipResV1{
- Name: user.Name,
- }
- userTipsRes = append(userTipsRes, userTipRes)
- }
- return c.JSON(http.StatusOK, &GetUserTipsResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: userTipsRes,
- })
-}
-
-type CreateMemberReqV1 struct {
- UserName string `json:"user_name" valid:"required"`
- IsManager bool `json:"is_manager"`
- Roles []BindRoleReqV1 `json:"roles" valid:"required"`
-}
-
-type BindRoleReqV1 struct {
- InstanceName string `json:"instance_name" valid:"required"`
- RoleNames []string `json:"role_names" valid:"required"`
-}
-
-// AddMember
-// @Summary 添加成员
-// @Description add member
-// @Id addMemberV1
-// @Tags user
-// @Security ApiKeyAuth
-// @Accept json
-// @Produce json
-// @Param project_name path string true "project name"
-// @Param data body v1.CreateMemberReqV1 true "add member"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/projects/{project_name}/members [post]
-func AddMember(c echo.Context) error {
- req := new(CreateMemberReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
-
- projectName := c.Param("project_name")
- userName := controller.GetUserName(c)
-
- err := CheckIsProjectManager(userName, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- s := model.GetStorage()
- archived, err := s.IsProjectArchived(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if archived {
- return controller.JSONBaseErrorReq(c, ErrProjectArchived)
- }
- // 检查用户是否已添加过
- isMember, err := s.CheckUserIsMember(req.UserName, projectName)
- if err != nil {
- return err
- }
- if isMember {
- return errors.New(errors.DataExist, fmt.Errorf("user %v is in project %v", req.UserName, projectName))
- }
-
- role := []model.BindRole{}
- instNames := []string{}
- roleNames := []string{}
- for _, r := range req.Roles {
- role = append(role, model.BindRole{
- RoleNames: r.RoleNames,
- InstanceName: r.InstanceName,
- })
- instNames = append(instNames, r.InstanceName)
- roleNames = append(roleNames, r.RoleNames...)
- }
-
- // 检查实例是否存在
- exist, err := s.CheckInstancesExist(projectName, utils.RemoveDuplicate(instNames))
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist, fmt.Errorf("prohibit binding non-existent instances")))
- }
-
- // 检查角色是否存在
- exist, err = s.CheckRolesExist(utils.RemoveDuplicate(roleNames))
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist, fmt.Errorf("prohibit binding non-existent roles")))
- }
-
- return controller.JSONBaseErrorReq(c, s.AddMember(req.UserName, projectName, req.IsManager, role))
-}
-
-type UpdateMemberReqV1 struct {
- IsManager *bool `json:"is_manager"`
- Roles *[]BindRoleReqV1 `json:"roles"`
-}
-
-// UpdateMember
-// @Summary 修改成员
-// @Description update member
-// @Id updateMemberV1
-// @Tags user
-// @Security ApiKeyAuth
-// @Accept json
-// @Produce json
-// @Param project_name path string true "project name"
-// @Param user_name path string true "user name"
-// @Param data body v1.UpdateMemberReqV1 true "update member"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/projects/{project_name}/members/{user_name}/ [patch]
-func UpdateMember(c echo.Context) error {
- req := new(UpdateMemberReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
-
- projectName := c.Param("project_name")
- userName := c.Param("user_name")
- currentUser := controller.GetUserName(c)
-
- s := model.GetStorage()
- archived, err := s.IsProjectArchived(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if archived {
- return controller.JSONBaseErrorReq(c, ErrProjectArchived)
- }
-
- err = CheckIsProjectManager(currentUser, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- isMember, err := s.CheckUserIsMember(userName, projectName)
- if err != nil {
- return err
- }
- if !isMember {
- return errors.New(errors.DataNotExist, fmt.Errorf("user %v is not in project %v", userName, projectName))
- }
-
- // 更新成员
- if req.IsManager != nil {
- if *req.IsManager {
- isManager, err := s.IsProjectManager(userName, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !isManager {
- err = s.AddProjectManager(userName, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- }
- } else {
- isLastManager, err := s.IsLastProjectManager(userName, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if isLastManager {
- return controller.JSONBaseErrorReq(c, errors.New(errors.UserNotPermission, fmt.Errorf("you cannot delete the last administrator")))
- }
- err = s.RemoveProjectManager(userName, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- }
-
- }
-
- // 更新角色
- role := []model.BindRole{}
- if req.Roles != nil {
- for _, r := range *req.Roles {
- role = append(role, model.BindRole{
- RoleNames: r.RoleNames,
- InstanceName: r.InstanceName,
- })
- }
- err = s.UpdateUserRoles(userName, projectName, role)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- }
-
- return controller.JSONBaseErrorReq(c, nil)
-}
-
-// DeleteMember
-// @Summary 删除成员
-// @Description delete member
-// @Id deleteMemberV1
-// @Tags user
-// @Security ApiKeyAuth
-// @Param project_name path string true "project name"
-// @Param user_name path string true "user name"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/projects/{project_name}/members/{user_name}/ [delete]
-func DeleteMember(c echo.Context) error {
- projectName := c.Param("project_name")
- userName := c.Param("user_name")
- currentUser := controller.GetUserName(c)
-
- s := model.GetStorage()
- archived, err := s.IsProjectArchived(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if archived {
- return controller.JSONBaseErrorReq(c, ErrProjectArchived)
- }
-
- err = CheckIsProjectManager(currentUser, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- err = checkMemberCanDelete(userName, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- return controller.JSONBaseErrorReq(c, s.RemoveMember(userName, projectName))
-
-}
-
-func checkMemberCanDelete(userName, projectName string) error {
-
- err := CheckIsProjectMember(userName, projectName)
- if err != nil {
- return err
- }
-
- s := model.GetStorage()
- user, exist, err := s.GetUserByName(userName)
- if err != nil {
- return err
- }
- if !exist {
- return errors.New(errors.DataNotExist, fmt.Errorf("user not exist"))
- }
-
- project, exist, err := s.GetProjectByName(projectName)
- if err != nil {
- return err
- }
- if !exist {
- return ErrProjectNotExist(projectName)
- }
-
- if len(project.Managers) == 1 && project.Managers[0].ID == user.ID {
- return errors.New(errors.DataInvalid, fmt.Errorf("cannot delete the last administrator"))
- }
-
- return nil
-
-}
-
-type GetMemberReqV1 struct {
- FilterInstanceName string `json:"filter_instance_name" query:"filter_instance_name"`
- FilterUserName string `json:"filter_user_name" query:"filter_user_name"`
- PageIndex uint32 `json:"page_index" query:"page_index" valid:"required"`
- PageSize uint32 `json:"page_size" query:"page_size" valid:"required"`
-}
-
-type GetMembersRespV1 struct {
- controller.BaseRes
- Data []GetMemberRespDataV1 `json:"data"`
- TotalNums uint64 `json:"total_nums"`
-}
-
-type GetMemberRespDataV1 struct {
- UserName string `json:"user_name"`
- IsManager bool `json:"is_manager"`
- Roles []BindRoleReqV1 `json:"roles"`
-}
-
-// GetMembers
-// @Summary 获取成员列表
-// @Description get members
-// @Id getMembersV1
-// @Tags user
-// @Security ApiKeyAuth
-// @Param filter_user_name query string false "filter user name"
-// @Param filter_instance_name query string false "filter instance name"
-// @Param page_index query uint32 true "page index"
-// @Param page_size query uint32 true "size of per page"
-// @Param project_name path string true "project name"
-// @Success 200 {object} v1.GetMembersRespV1
-// @router /v1/projects/{project_name}/members [get]
-func GetMembers(c echo.Context) error {
- req := new(GetMemberReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
-
- projectName := c.Param("project_name")
- currentUser := controller.GetUserName(c)
-
- err := CheckIsProjectMember(currentUser, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- limit, offset := controller.GetLimitAndOffset(req.PageIndex, req.PageSize)
-
- // 获取成员信息
- mp := map[string]interface{}{
- "limit": limit,
- "offset": offset,
- "filter_project_name": projectName,
- "filter_user_name": req.FilterUserName,
- "filter_instance_name": req.FilterInstanceName,
- }
-
- s := model.GetStorage()
- members, total, err := s.GetMembersByReq(mp)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- // 获取角色信息
- memberNames := []string{}
- for _, member := range members {
- memberNames = append(memberNames, member.UserName)
- }
-
- bindRole, err := s.GetBindRolesByMemberNames(memberNames, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- // 生成响应
- data := []GetMemberRespDataV1{}
- for _, member := range members {
- data = append(data, GetMemberRespDataV1{
- UserName: member.UserName,
- IsManager: member.IsManager,
- Roles: convertBindRoleToBindRoleReqV1(bindRole[member.UserName]),
- })
- }
-
- return c.JSON(http.StatusOK, GetMembersRespV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: data,
- TotalNums: total,
- })
-}
-
-func convertBindRoleToBindRoleReqV1(role []model.BindRole) []BindRoleReqV1 {
- req := []BindRoleReqV1{}
- for _, r := range role {
- req = append(req, BindRoleReqV1{
- InstanceName: r.InstanceName,
- RoleNames: r.RoleNames,
- })
- }
- return req
-}
-
-type GetMemberRespV1 struct {
- controller.BaseRes
- Data GetMemberRespDataV1 `json:"data"`
-}
-
-// GetMember
-// @Summary 获取成员信息
-// @Description get member
-// @Id getMemberV1
-// @Tags user
-// @Security ApiKeyAuth
-// @Param project_name path string true "project name"
-// @Param user_name path string true "user name"
-// @Success 200 {object} v1.GetMemberRespV1
-// @router /v1/projects/{project_name}/members/{user_name}/ [get]
-func GetMember(c echo.Context) error {
- projectName := c.Param("project_name")
- userName := c.Param("user_name")
- currentUser := controller.GetUserName(c)
-
- err := CheckIsProjectMember(currentUser, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- mp := map[string]interface{}{
- "limit": 1,
- "offset": 1,
- "filter_user_name": userName,
- "filter_project_name": projectName,
- }
-
- s := model.GetStorage()
- members, _, err := s.GetMembersByReq(mp)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if len(members) != 1 {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist, fmt.Errorf("the number of members is not unique")))
- }
-
- bindRole, err := s.GetBindRolesByMemberNames([]string{members[0].UserName}, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- return c.JSON(http.StatusOK, GetMemberRespV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: GetMemberRespDataV1{
- UserName: members[0].UserName,
- IsManager: members[0].IsManager,
- Roles: convertBindRoleToBindRoleReqV1(bindRole[members[0].UserName]),
- },
- })
-}
-
-type MemberTipResV1 struct {
- Name string `json:"user_name"`
-}
-
-type GetMemberTipsResV1 struct {
- controller.BaseRes
- Data []MemberTipResV1 `json:"data"`
-}
-
-// @Summary 获取成员提示列表
-// @Description get member tip list
-// @Tags user
-// @Id getMemberTipListV1
-// @Security ApiKeyAuth
-// @Param project_name path string true "project name"
-// @Success 200 {object} v1.GetMemberTipsResV1
-// @router /v1/projects/{project_name}/member_tips [get]
-func GetMemberTips(c echo.Context) error {
- projectName := c.Param("project_name")
- err := CheckIsProjectMember(controller.GetUserName(c), projectName)
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), req.FilterProject)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
-
- s := model.GetStorage()
- users, err := s.GetMemberTips(projectName)
+ users, err := dms.ListProjectUserTips(c.Request().Context(), projectUid)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- userTipsRes := make([]MemberTipResV1, 0, len(users))
+ userTipsRes := make([]UserTipResV1, 0, len(users))
for _, user := range users {
- userTipRes := MemberTipResV1{
- Name: user.Name,
+ userTipRes := UserTipResV1{
+ Name: user.Name,
+ UserID: user.GetIDStr(),
}
userTipsRes = append(userTipsRes, userTipRes)
}
- return c.JSON(http.StatusOK, &GetMemberTipsResV1{
+ return c.JSON(http.StatusOK, &GetUserTipsResV1{
BaseRes: controller.NewBaseReq(nil),
Data: userTipsRes,
})
diff --git a/sqle/api/controller/v1/user_group.go b/sqle/api/controller/v1/user_group.go
deleted file mode 100644
index 7e9a017fd1..0000000000
--- a/sqle/api/controller/v1/user_group.go
+++ /dev/null
@@ -1,648 +0,0 @@
-package v1
-
-import (
- "fmt"
- "net/http"
-
- "github.com/actiontech/sqle/sqle/api/controller"
- "github.com/actiontech/sqle/sqle/errors"
- "github.com/actiontech/sqle/sqle/model"
- "github.com/actiontech/sqle/sqle/utils"
-
- "github.com/labstack/echo/v4"
-)
-
-type CreateUserGroupReqV1 struct {
- Name string `json:"user_group_name" form:"user_group_name" example:"test" valid:"required,name"`
- Desc string `json:"user_group_desc" form:"user_group_desc" example:"this is a group"`
- Users []string `json:"user_name_list" form:"user_name_list"`
-}
-
-// @Summary 创建用户组
-// @Description create user group
-// @Id CreateUserGroupV1
-// @Tags user_group
-// @Security ApiKeyAuth
-// @Accept json
-// @Produce json
-// @Param instance body v1.CreateUserGroupReqV1 true "create user group"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/user_groups [post]
-func CreateUserGroup(c echo.Context) (err error) {
-
- req := new(CreateUserGroupReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
-
- s := model.GetStorage()
- // check if user group already exist
- {
- _, isExist, err := s.GetUserGroupByName(req.Name)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if isExist {
- return controller.JSONNewDataExistErr(c, "user group already exist")
- }
- }
-
- // check users
- var users []*model.User
- {
- userNames := req.Users
- users, err = s.GetAndCheckUserExist(userNames)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- }
-
- // user group
- ug := &model.UserGroup{
- Name: req.Name,
- Desc: req.Desc,
- }
-
- if err := s.SaveUserGroupAndAssociations(ug, users); err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- return controller.JSONBaseErrorReq(c, nil)
-}
-
-type GetUserGroupsReqV1 struct {
- FilterUserGroupName string `json:"filter_user_group_name" query:"filter_user_group_name"`
- PageIndex uint32 `json:"page_index" query:"page_index" valid:"required"`
- PageSize uint32 `json:"page_size" query:"page_size" valid:"required"`
-}
-
-type GetUserGroupsResV1 struct {
- controller.BaseRes
- Data []*UserGroupListItemResV1 `json:"data"`
- TotalNums uint64 `json:"total_nums"`
-}
-
-type UserGroupListItemResV1 struct {
- Name string `json:"user_group_name"`
- Desc string `json:"user_group_desc"`
- IsDisabled bool `json:"is_disabled,omitempty"`
- Users []string `json:"user_name_list,omitempty"`
-}
-
-// @Summary 获取用户组列表
-// @Description get user group info list
-// @Id GetUserGroupsV1
-// @Tags user_group
-// @Id getUserGroupListV1
-// @Security ApiKeyAuth
-// @Param filter_user_group_name query string false "filter user group name"
-// @Param page_index query uint32 true "page index"
-// @Param page_size query uint32 true "size of per page"
-// @Produce json
-// @Success 200 {object} v1.GetUserGroupsResV1
-// @router /v1/user_groups [get]
-func GetUserGroups(c echo.Context) (err error) {
- req := new(GetUserGroupsReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
- s := model.GetStorage()
-
- var offset uint32
- if req.PageIndex >= 1 {
- offset = req.PageSize * (req.PageIndex - 1)
- }
-
- data := map[string]interface{}{
- "filter_user_group_name": req.FilterUserGroupName,
- "limit": req.PageSize,
- "offset": offset,
- }
-
- userGroups, count, err := s.GetUserGroupsByReq(data)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- resData := make([]*UserGroupListItemResV1, len(userGroups))
- for i := range userGroups {
- userGroupItem := &UserGroupListItemResV1{
- Name: userGroups[i].Name,
- Desc: userGroups[i].Desc,
- IsDisabled: userGroups[i].IsDisabled(),
- Users: userGroups[i].UserNames,
- }
- resData[i] = userGroupItem
- }
-
- return c.JSON(http.StatusOK, &GetUserGroupsResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: resData,
- TotalNums: count,
- })
-}
-
-// @Summary 删除用户组
-// @Description delete user group
-// @Id deleteUserGroupV1
-// @Tags user_group
-// @Security ApiKeyAuth
-// @Param user_group_name path string true "user_group_name"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/user_groups/{user_group_name}/ [delete]
-func DeleteUserGroup(c echo.Context) (err error) {
-
- userGroupName := c.Param("user_group_name")
-
- s := model.GetStorage()
-
- // check if user group exist
- var ug *model.UserGroup
- {
- var exist bool
- ug, exist, err = s.GetUserGroupByName(userGroupName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(
- c, errors.NewDataNotExistErr("user group<%v> not exist", userGroupName))
- }
- }
-
- err = s.RemoveMemberGroupFromAllProjectByUserGroupID(ug.ID)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- err = s.Delete(ug)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- return controller.JSONBaseErrorReq(c, nil)
-}
-
-type PatchUserGroupReqV1 struct {
- Desc *string `json:"user_group_desc,omitempty" form:"user_group_desc" example:"this is a group"`
- Users *[]string `json:"user_name_list,omitempty" form:"user_name_list"`
- IsDisabled *bool `json:"is_disabled,omitempty" form:"is_disabled"`
-}
-
-// @Summary 更新用户组
-// @Description update user group
-// @Id updateUserGroupV1
-// @Tags user_group
-// @Security ApiKeyAuth
-// @Param user_group_name path string true "user_group_name"
-// @Param instance body v1.PatchUserGroupReqV1 true "update user group"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/user_groups/{user_group_name}/ [patch]
-func UpdateUserGroup(c echo.Context) (err error) {
-
- userGroupName := c.Param("user_group_name")
-
- req := new(PatchUserGroupReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
-
- s := model.GetStorage()
-
- // check if user group already exist
- var ug *model.UserGroup
- {
- var isExist bool
- ug, isExist, err = s.GetUserGroupByName(userGroupName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !isExist {
- return controller.JSONNewDataNotExistErr(c, "user_group<%v> not exist", userGroupName)
- }
- }
-
- // update stat
- if req.IsDisabled != nil {
- if *req.IsDisabled {
- ug.SetStat(model.Disabled)
- } else {
- ug.SetStat(model.Enabled)
- }
- }
-
- // update desc
- if req.Desc != nil {
- ug.Desc = *req.Desc
- }
-
- // users
- var users []*model.User
- {
- if req.Users != nil {
- if len(*req.Users) > 0 {
- users, err = s.GetAndCheckUserExist(*req.Users)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- } else {
- users = make([]*model.User, 0)
- }
- }
- }
-
- if err := s.SaveUserGroupAndAssociations(ug, users); err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- return controller.JSONBaseErrorReq(c, nil)
-}
-
-type UserGroupTipsReqV1 struct {
- FilterProject string `json:"filter_project" query:"filter_project"`
-}
-
-type UserGroupTipListItem struct {
- Name string `json:"user_group_name"`
- UserNames []string `json:"user_names"`
-}
-
-type GetUserGroupTipsResV1 struct {
- controller.BaseRes
- Data []*UserGroupTipListItem `json:"data"`
-}
-
-// @Summary 获取用户组提示列表
-// @Description get user group tip list
-// @Tags user_group
-// @Id getUserGroupTipListV1
-// @Param filter_project query string false "project name"
-// @Security ApiKeyAuth
-// @Success 200 {object} v1.GetUserGroupTipsResV1
-// @router /v1/user_group_tips [get]
-func GetUserGroupTips(c echo.Context) error {
- req := new(UserGroupTipsReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
-
- s := model.GetStorage()
-
- data := map[string]interface{}{
- "project_name": req.FilterProject,
- }
- userGroups, err := s.GetUserGroupTipByProject(data)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- userGroupTipsRes := make([]*UserGroupTipListItem, len(userGroups))
- for i := range userGroups {
- userGroupTipsRes[i] = &UserGroupTipListItem{
- Name: userGroups[i].Name,
- UserNames: userGroups[i].UserNames,
- }
- }
-
- return c.JSON(http.StatusOK, &GetUserGroupTipsResV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: userGroupTipsRes,
- })
-}
-
-type CreateMemberGroupReqV1 struct {
- UserGroupName string `json:"user_group_name" valid:"required"`
- Roles []BindRoleReqV1 `json:"roles" valid:"required"`
-}
-
-// AddMemberGroup
-// @Summary 添加成员组
-// @Description add member group
-// @Id addMemberGroupV1
-// @Tags user_group
-// @Security ApiKeyAuth
-// @Accept json
-// @Produce json
-// @Param project_name path string true "project name"
-// @Param data body v1.CreateMemberGroupReqV1 true "add member group"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/projects/{project_name}/member_groups [post]
-func AddMemberGroup(c echo.Context) error {
- req := new(CreateMemberGroupReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
-
- projectName := c.Param("project_name")
- userName := controller.GetUserName(c)
-
- s := model.GetStorage()
- archived, err := s.IsProjectArchived(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if archived {
- return controller.JSONBaseErrorReq(c, ErrProjectArchived)
- }
-
- err = CheckIsProjectManager(userName, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- // 检查用户组是否已添加过
- isMember, err := s.CheckUserGroupIsMember(req.UserGroupName, projectName)
- if err != nil {
- return err
- }
- if isMember {
- return errors.New(errors.DataExist, fmt.Errorf("user group %v is in project %v", req.UserGroupName, projectName))
- }
-
- role := []model.BindRole{}
- instNames := []string{}
- roleNames := []string{}
- for _, r := range req.Roles {
- role = append(role, model.BindRole{
- RoleNames: r.RoleNames,
- InstanceName: r.InstanceName,
- })
- instNames = append(instNames, r.InstanceName)
- roleNames = append(roleNames, r.RoleNames...)
- }
-
- // 检查实例是否存在
- exist, err := s.CheckInstancesExist(projectName, utils.RemoveDuplicate(instNames))
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist, fmt.Errorf("prohibit binding non-existent instances")))
- }
-
- // 检查角色是否存在
- exist, err = s.CheckRolesExist(utils.RemoveDuplicate(roleNames))
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist, fmt.Errorf("prohibit binding non-existent roles")))
- }
-
- return controller.JSONBaseErrorReq(c, s.AddMemberGroup(req.UserGroupName, projectName, role))
-}
-
-type UpdateMemberGroupReqV1 struct {
- Roles *[]BindRoleReqV1 `json:"roles"`
-}
-
-// UpdateMemberGroup
-// @Summary 修改成员组
-// @Description update member group
-// @Id updateMemberGroupV1
-// @Tags user_group
-// @Security ApiKeyAuth
-// @Accept json
-// @Produce json
-// @Param project_name path string true "project name"
-// @Param user_group_name path string true "user group name"
-// @Param data body v1.UpdateMemberGroupReqV1 true "update member_group"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/projects/{project_name}/member_groups/{user_group_name}/ [patch]
-func UpdateMemberGroup(c echo.Context) error {
- req := new(UpdateMemberGroupReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
-
- projectName := c.Param("project_name")
- groupName := c.Param("user_group_name")
- currentUser := controller.GetUserName(c)
-
- s := model.GetStorage()
- archived, err := s.IsProjectArchived(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if archived {
- return controller.JSONBaseErrorReq(c, ErrProjectArchived)
- }
-
- err = CheckIsProjectManager(currentUser, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- isMember, err := s.CheckUserGroupIsMember(groupName, projectName)
- if err != nil {
- return err
- }
- if !isMember {
- return errors.New(errors.DataNotExist, fmt.Errorf("user group %v is not in project %v", groupName, projectName))
- }
-
- // 更新角色
- role := []model.BindRole{}
- if req.Roles != nil {
- for _, r := range *req.Roles {
- role = append(role, model.BindRole{
- RoleNames: r.RoleNames,
- InstanceName: r.InstanceName,
- })
- }
- err = s.UpdateUserGroupRoles(groupName, projectName, role)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- }
-
- return controller.JSONBaseErrorReq(c, nil)
-}
-
-// DeleteMemberGroup
-// @Summary 删除成员组
-// @Description delete member group
-// @Id deleteMemberGroupV1
-// @Tags user_group
-// @Security ApiKeyAuth
-// @Param project_name path string true "project name"
-// @Param user_group_name path string true "user group name"
-// @Success 200 {object} controller.BaseRes
-// @router /v1/projects/{project_name}/member_groups/{user_group_name}/ [delete]
-func DeleteMemberGroup(c echo.Context) error {
- projectName := c.Param("project_name")
- groupName := c.Param("user_group_name")
- currentUser := controller.GetUserName(c)
-
- s := model.GetStorage()
- archived, err := s.IsProjectArchived(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if archived {
- return controller.JSONBaseErrorReq(c, ErrProjectArchived)
- }
-
- err = CheckIsProjectManager(currentUser, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- return controller.JSONBaseErrorReq(c, s.RemoveMemberGroup(groupName, projectName))
-
-}
-
-type GetMemberGroupReqV1 struct {
- FilterInstanceName string `json:"filter_instance_name" query:"filter_instance_name"`
- FilterUserGroupName string `json:"filter_user_group_name" query:"filter_user_group_name"`
- PageIndex uint32 `json:"page_index" query:"page_index" valid:"required"`
- PageSize uint32 `json:"page_size" query:"page_size" valid:"required"`
-}
-
-type GetMemberGroupsRespV1 struct {
- controller.BaseRes
- Data []GetMemberGroupRespDataV1 `json:"data"`
- TotalNums uint64 `json:"total_nums"`
-}
-
-type MemberGroupUserItem struct {
- Name string `json:"name"`
-}
-
-type GetMemberGroupRespDataV1 struct {
- UserGroupName string `json:"user_group_name"`
- Roles []BindRoleReqV1 `json:"roles"`
- Users []MemberGroupUserItem `json:"users"`
-}
-
-// GetMemberGroups
-// @Summary 获取成员组列表
-// @Description get member groups
-// @Id getMemberGroupsV1
-// @Tags user_group
-// @Security ApiKeyAuth
-// @Param filter_user_group_name query string false "filter user group name"
-// @Param filter_instance_name query string false "filter instance name"
-// @Param page_index query uint32 true "page index"
-// @Param page_size query uint32 true "size of per page"
-// @Param project_name path string true "project name"
-// @Success 200 {object} v1.GetMemberGroupsRespV1
-// @router /v1/projects/{project_name}/member_groups [get]
-func GetMemberGroups(c echo.Context) error {
- req := new(GetMemberGroupReqV1)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
-
- projectName := c.Param("project_name")
- currentUser := controller.GetUserName(c)
-
- err := CheckIsProjectMember(currentUser, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- // 获取成员组列表
- limit, offset := controller.GetLimitAndOffset(req.PageIndex, req.PageSize)
- filter := model.GetMemberGroupFilter{
- Limit: &limit,
- Offset: &offset,
- FilterProjectName: &projectName,
- }
- if req.FilterInstanceName != "" {
- filter.FilterInstanceName = &req.FilterInstanceName
- }
- if req.FilterUserGroupName != "" {
- filter.FilterUserGroupName = &req.FilterUserGroupName
- }
-
- s := model.GetStorage()
- groups, err := s.GetMemberGroups(filter)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- total, err := s.GetMemberGroupCount(filter)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- // 获取角色信息
- groupNames := []string{}
- for _, group := range groups {
- groupNames = append(groupNames, group.Name)
- }
-
- bindRole, err := s.GetBindRolesByMemberGroupNames(groupNames, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- // 生成响应
- data := []GetMemberGroupRespDataV1{}
- for _, group := range groups {
- data = append(data, GetMemberGroupRespDataV1{
- UserGroupName: group.Name,
- Roles: convertBindRoleToBindRoleReqV1(bindRole[group.Name]),
- Users: convertMemberGroupUsers(group.Users),
- })
- }
-
- return c.JSON(http.StatusOK, GetMemberGroupsRespV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: data,
- TotalNums: total,
- })
-}
-
-func convertMemberGroupUsers(users []*model.User) []MemberGroupUserItem {
- usersRes := make([]MemberGroupUserItem, len(users))
- for i, user := range users {
- usersRes[i] = MemberGroupUserItem{Name: user.Name}
- }
- return usersRes
-}
-
-type GetMemberGroupRespV1 struct {
- controller.BaseRes
- Data GetMemberGroupRespDataV1 `json:"data"`
-}
-
-// GetMemberGroup
-// @Summary 获取成员组信息
-// @Description get member group
-// @Id getMemberGroupV1
-// @Tags user_group
-// @Security ApiKeyAuth
-// @Param project_name path string true "project name"
-// @Param user_group_name path string true "user group name"
-// @Success 200 {object} v1.GetMemberGroupRespV1
-// @router /v1/projects/{project_name}/member_groups/{user_group_name}/ [get]
-func GetMemberGroup(c echo.Context) error {
- projectName := c.Param("project_name")
- groupName := c.Param("user_group_name")
- currentUser := controller.GetUserName(c)
-
- err := CheckIsProjectMember(currentUser, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- s := model.GetStorage()
- userGroup, err := s.GetMemberGroupByGroupName(projectName, groupName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- bindRole, err := s.GetBindRolesByMemberGroupNames([]string{userGroup.Name}, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- return c.JSON(http.StatusOK, GetMemberGroupRespV1{
- BaseRes: controller.NewBaseReq(nil),
- Data: GetMemberGroupRespDataV1{
- UserGroupName: userGroup.Name,
- Roles: convertBindRoleToBindRoleReqV1(bindRole[userGroup.Name]),
- },
- })
-}
diff --git a/sqle/api/controller/v1/workflow.go b/sqle/api/controller/v1/workflow.go
index 54f284dcf1..4e49e73439 100644
--- a/sqle/api/controller/v1/workflow.go
+++ b/sqle/api/controller/v1/workflow.go
@@ -1,18 +1,24 @@
package v1
import (
+ "context"
"database/sql"
e "errors"
"fmt"
"net/http"
"strconv"
+ "strings"
"time"
+ dmsV1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
"github.com/actiontech/sqle/sqle/api/controller"
+ "github.com/actiontech/sqle/sqle/dms"
driverV2 "github.com/actiontech/sqle/sqle/driver/v2"
"github.com/actiontech/sqle/sqle/errors"
"github.com/actiontech/sqle/sqle/model"
+ "github.com/actiontech/sqle/sqle/server"
"github.com/actiontech/sqle/sqle/utils"
+
"github.com/labstack/echo/v4"
)
@@ -41,7 +47,7 @@ type WorkflowTemplateDetailResV1 struct {
Desc string `json:"desc,omitempty"`
AllowSubmitWhenLessAuditLevel string `json:"allow_submit_when_less_audit_level" enums:"normal,notice,warn,error"`
Steps []*WorkFlowStepTemplateResV1 `json:"workflow_step_template_list"`
- Instances []string `json:"instance_name_list,omitempty"`
+ UpdateTime time.Time `json:"update_time"`
}
type WorkFlowStepTemplateResV1 struct {
@@ -50,7 +56,7 @@ type WorkFlowStepTemplateResV1 struct {
Desc string `json:"desc,omitempty"`
ApprovedByAuthorized bool `json:"approved_by_authorized"`
ExecuteByAuthorized bool `json:"execute_by_authorized"`
- Users []string `json:"assignee_user_name_list"`
+ Users []string `json:"assignee_user_id_list"`
}
// @Summary 获取审批流程模板详情
@@ -64,55 +70,54 @@ type WorkFlowStepTemplateResV1 struct {
func GetWorkflowTemplate(c echo.Context) error {
s := model.GetStorage()
- projectName := c.Param("project_name")
-
- err := CheckIsProjectMember(controller.GetUserName(c), projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
+ var td *model.WorkflowTemplate
- project, exist, err := s.GetProjectByName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrProjectNotExist(projectName))
- }
-
- template, exist, err := s.GetWorkflowTemplateById(project.WorkflowTemplateId)
+ template, exist, err := s.GetWorkflowTemplateByProjectId(model.ProjectUID(projectUid))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
if !exist {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist,
- fmt.Errorf("workflow template is not exist")))
- }
-
- res, err := getWorkflowTemplateDetailByTemplate(template)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
+ td = model.DefaultWorkflowTemplate(projectUid)
+ err = s.SaveWorkflowTemplate(td)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ } else {
+ td, err = getWorkflowTemplateDetailByTemplate(template)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
}
return c.JSON(http.StatusOK, &GetWorkflowTemplateResV1{
BaseRes: controller.NewBaseReq(nil),
- Data: res,
+ Data: convertWorkflowTemplateToRes(td),
})
}
-func getWorkflowTemplateDetailByTemplate(template *model.WorkflowTemplate) (*WorkflowTemplateDetailResV1, error) {
+func getWorkflowTemplateDetailByTemplate(template *model.WorkflowTemplate) (*model.WorkflowTemplate, error) {
s := model.GetStorage()
steps, err := s.GetWorkflowStepsDetailByTemplateId(template.ID)
if err != nil {
return nil, err
}
template.Steps = steps
+ return template, nil
+}
+
+func convertWorkflowTemplateToRes(template *model.WorkflowTemplate) *WorkflowTemplateDetailResV1 {
res := &WorkflowTemplateDetailResV1{
Name: template.Name,
Desc: template.Desc,
AllowSubmitWhenLessAuditLevel: template.AllowSubmitWhenLessAuditLevel,
+ UpdateTime: template.UpdatedAt,
}
- stepsRes := make([]*WorkFlowStepTemplateResV1, 0, len(steps))
- for _, step := range steps {
+ stepsRes := make([]*WorkFlowStepTemplateResV1, 0, len(template.Steps))
+ for _, step := range template.Steps {
stepRes := &WorkFlowStepTemplateResV1{
Number: int(step.Number),
ApprovedByAuthorized: step.ApprovedByAuthorized.Bool,
@@ -120,23 +125,20 @@ func getWorkflowTemplateDetailByTemplate(template *model.WorkflowTemplate) (*Wor
Typ: step.Typ,
Desc: step.Desc,
}
- users := []string{}
- if step.Users != nil {
- for _, user := range step.Users {
- users = append(users, user.Name)
- }
+ stepRes.Users = make([]string, 0)
+ if step.Users != "" {
+ stepRes.Users = strings.Split(step.Users, ",")
}
- stepRes.Users = users
stepsRes = append(stepsRes, stepRes)
}
res.Steps = stepsRes
- instanceNames, err := s.GetInstanceNamesByWorkflowTemplateId(template.ID)
- if err != nil {
- return nil, err
- }
- res.Instances = instanceNames
- return res, nil
+ // instanceNames, err := s.GetInstanceNamesByWorkflowTemplateId(template.ID)
+ // if err != nil {
+ // return nil, err
+ // }
+ // res.Instances = instanceNames
+ return res
}
type WorkFlowStepTemplateReqV1 struct {
@@ -144,7 +146,7 @@ type WorkFlowStepTemplateReqV1 struct {
Desc string `json:"desc" form:"desc"`
ApprovedByAuthorized bool `json:"approved_by_authorized"`
ExecuteByAuthorized bool `json:"execute_by_authorized"`
- Users []string `json:"assignee_user_name_list" form:"assignee_user_name_list"`
+ Users []string `json:"assignee_user_id_list" form:"assignee_user_id_list"`
}
func validWorkflowTemplateReq(steps []*WorkFlowStepTemplateReqV1) error {
@@ -177,7 +179,6 @@ type UpdateWorkflowTemplateReqV1 struct {
Desc *string `json:"desc" form:"desc"`
AllowSubmitWhenLessAuditLevel *string `json:"allow_submit_when_less_audit_level" enums:"normal,notice,warn,error"`
Steps []*WorkFlowStepTemplateReqV1 `json:"workflow_step_template_list" form:"workflow_step_template_list"`
- Instances []string `json:"instance_name_list" form:"instance_name_list"`
}
// @Summary 更新Sql审批流程模板
@@ -197,27 +198,14 @@ func UpdateWorkflowTemplate(c echo.Context) error {
return err
}
- projectName := c.Param("project_name")
-
- s := model.GetStorage()
- project, exist, err := s.GetProjectByName(projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrProjectNotExist(projectName))
- }
- if project.IsArchived() {
- return controller.JSONBaseErrorReq(c, ErrProjectArchived)
- }
- userName := controller.GetUserName(c)
- err = CheckIsProjectManager(userName, project.Name)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
+ s := model.GetStorage()
- workflowTemplate, exist, err := s.GetWorkflowTemplateById(project.WorkflowTemplateId)
+ workflowTemplate, exist, err := s.GetWorkflowTemplateByProjectId(model.ProjectUID(projectUid))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -226,32 +214,13 @@ func UpdateWorkflowTemplate(c echo.Context) error {
fmt.Errorf("workflow template is not exist")))
}
- var instances []*model.Instance
- if req.Instances != nil && len(req.Instances) > 0 {
- instances, err = s.GetAndCheckInstanceExist(req.Instances, project.Name)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- }
-
if req.Steps != nil {
err = validWorkflowTemplateReq(req.Steps)
if err != nil {
return controller.JSONBaseErrorReq(c, errors.New(errors.DataInvalid, err))
}
- userNames := []string{}
- for _, step := range req.Steps {
- userNames = append(userNames, step.Users...)
- }
- users, err := s.GetAndCheckUserExist(userNames)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- userMap := map[string]*model.User{}
- for _, user := range users {
- userMap[user.Name] = user
- }
+ // dms-todo: 校验step.Users用户是否存在
steps := make([]*model.WorkflowStepTemplate, 0, len(req.Steps))
for i, step := range req.Steps {
@@ -268,11 +237,7 @@ func UpdateWorkflowTemplate(c echo.Context) error {
Typ: step.Type,
Desc: step.Desc,
}
- stepUsers := make([]*model.User, 0, len(step.Users))
- for _, userName := range step.Users {
- stepUsers = append(stepUsers, userMap[userName])
- }
- s.Users = stepUsers
+ s.Users = strings.Join(step.Users, ",")
steps = append(steps, s)
}
err = s.UpdateWorkflowTemplateSteps(workflowTemplate.ID, steps)
@@ -294,13 +259,6 @@ func UpdateWorkflowTemplate(c echo.Context) error {
return controller.JSONBaseErrorReq(c, err)
}
- if req.Instances != nil {
- err = s.UpdateWorkflowTemplateInstances(workflowTemplate, instances...)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- }
-
return c.JSON(http.StatusOK, controller.NewBaseReq(nil))
}
@@ -445,13 +403,10 @@ func ExecuteOneTaskOnWorkflowV1(c echo.Context) error {
}
func IsTaskCanExecute(s *model.Storage, taskId string) (bool, error) {
- task, exist, err := s.GetTaskById(taskId)
+ task, err := getTaskById(context.Background(), taskId)
if err != nil {
return false, fmt.Errorf("get task by id failed. taskId=%v err=%v", taskId, err)
}
- if !exist {
- return false, fmt.Errorf("task not exist. taskId=%v", taskId)
- }
if task.Instance == nil {
return false, fmt.Errorf("task instance is nil. taskId=%v", taskId)
@@ -474,12 +429,64 @@ func IsTaskCanExecute(s *model.Storage, taskId string) (bool, error) {
return true, nil
}
-func PrepareForTaskExecution(c echo.Context, projectName string, workflow *model.Workflow, user *model.User, TaskId int) error {
+func GetNeedExecTaskIds(workflow *model.Workflow, user *model.User) (taskIds map[uint] /*task id*/ string /*user id*/, err error) {
+ instances := make([]*model.Instance, 0, len(workflow.Record.InstanceRecords))
+ for _, item := range workflow.Record.InstanceRecords {
+ instances = append(instances, item.Instance)
+ }
+
+ // 有不在运维时间内的instances报错
+ var cannotExecuteInstanceNames []string
+ for _, inst := range instances {
+ if len(inst.MaintenancePeriod) != 0 && !inst.MaintenancePeriod.IsWithinScope(time.Now()) {
+ cannotExecuteInstanceNames = append(cannotExecuteInstanceNames, inst.Name)
+ }
+ }
+ if len(cannotExecuteInstanceNames) > 0 {
+ return nil, errors.New(errors.TaskActionInvalid,
+ fmt.Errorf("please go online during instance operation and maintenance time. these instances are not in maintenance time[%v]", strings.Join(cannotExecuteInstanceNames, ",")))
+ }
+
+ // 定时的instances和已上线的跳过
+ needExecTaskIds := make(map[uint]string)
+ for _, instRecord := range workflow.Record.InstanceRecords {
+ if instRecord.ScheduledAt != nil || instRecord.IsSQLExecuted {
+ continue
+ }
+ needExecTaskIds[instRecord.TaskId] = user.GetIDStr()
+ }
+ return needExecTaskIds, nil
+}
+
+func PrepareForWorkflowExecution(c echo.Context, projectUid string, workflow *model.Workflow, user *model.User) error {
+ err := CheckCurrentUserCanOperateWorkflow(c, projectUid, workflow, []dmsV1.OpPermissionType{})
+ if err != nil {
+ return err
+ }
+
+ currentStep := workflow.CurrentStep()
+ if currentStep == nil {
+ return errors.New(errors.DataInvalid, fmt.Errorf("workflow current step not found"))
+ }
+
+ if workflow.Record.Status != model.WorkflowStatusWaitForExecution {
+ return errors.New(errors.DataInvalid,
+ fmt.Errorf("workflow need to be approved first"))
+ }
+
+ err = server.CheckUserCanOperateStep(user, workflow, int(currentStep.ID))
+ if err != nil {
+ return errors.New(errors.DataInvalid, err)
+ }
+ return nil
+}
+
+func PrepareForTaskExecution(c echo.Context, projectID string, workflow *model.Workflow, user *model.User, TaskId int) error {
if workflow.Record.Status != model.WorkflowStatusWaitForExecution {
return errors.New(errors.DataInvalid, e.New("workflow need to be approved first"))
}
- err := CheckCurrentUserCanOperateTasks(c, &model.Project{Name: projectName}, workflow, []uint{model.OP_WORKFLOW_EXECUTE}, []uint{uint(TaskId)})
+ err := CheckCurrentUserCanOperateTasks(c, projectID, workflow, []dmsV1.OpPermissionType{dmsV1.OpPermissionTypeExecuteWorkflow}, []uint{uint(TaskId)})
if err != nil {
return err
}
@@ -489,8 +496,8 @@ func PrepareForTaskExecution(c echo.Context, projectName string, workflow *model
continue
}
- for _, u := range record.ExecutionAssignees {
- if u.ID == user.ID {
+ for _, u := range strings.Split(record.ExecutionAssignees, ",") {
+ if u == user.GetIDStr() {
return nil
}
}
@@ -614,19 +621,19 @@ func CheckWorkflowCanCommit(template *model.WorkflowTemplate, tasks []*model.Tas
}
type GetWorkflowsReqV1 struct {
- FilterSubject string `json:"filter_subject" query:"filter_subject"`
- FilterWorkflowID string `json:"filter_workflow_id" query:"filter_workflow_id"`
- FuzzySearchWorkflowDesc string `json:"fuzzy_search_workflow_desc" query:"fuzzy_search_workflow_desc"`
- FilterCreateTimeFrom string `json:"filter_create_time_from" query:"filter_create_time_from"`
- FilterCreateTimeTo string `json:"filter_create_time_to" query:"filter_create_time_to"`
- FilterCreateUserName string `json:"filter_create_user_name" query:"filter_create_user_name"`
- FilterStatus string `json:"filter_status" query:"filter_status" valid:"omitempty,oneof=wait_for_audit wait_for_execution rejected canceled executing exec_failed finished"`
- FilterCurrentStepAssigneeUserName string `json:"filter_current_step_assignee_user_name" query:"filter_current_step_assignee_user_name"`
- FilterTaskInstanceName string `json:"filter_task_instance_name" query:"filter_task_instance_name"`
- FilterTaskExecuteStartTimeFrom string `json:"filter_task_execute_start_time_from" query:"filter_task_execute_start_time_from"`
- FilterTaskExecuteStartTimeTo string `json:"filter_task_execute_start_time_to" query:"filter_task_execute_start_time_to"`
- PageIndex uint32 `json:"page_index" query:"page_index" valid:"required"`
- PageSize uint32 `json:"page_size" query:"page_size" valid:"required"`
+ FilterSubject string `json:"filter_subject" query:"filter_subject"`
+ FilterWorkflowID string `json:"filter_workflow_id" query:"filter_workflow_id"`
+ FilterCreateTimeFrom string `json:"filter_create_time_from" query:"filter_create_time_from"`
+ FilterCreateTimeTo string `json:"filter_create_time_to" query:"filter_create_time_to"`
+ FilterCreateUserId string `json:"filter_create_user_id" query:"filter_create_user_id"`
+ FilterStatus string `json:"filter_status" query:"filter_status" valid:"omitempty,oneof=wait_for_audit wait_for_execution rejected canceled executing exec_failed finished"`
+ FilterCurrentStepAssigneeUserId string `json:"filter_current_step_assignee_user_id" query:"filter_current_step_assignee_user_id"`
+ FilterTaskInstanceName string `json:"filter_task_instance_name" query:"filter_task_instance_name"`
+ FilterTaskExecuteStartTimeFrom string `json:"filter_task_execute_start_time_from" query:"filter_task_execute_start_time_from"`
+ FilterTaskExecuteStartTimeTo string `json:"filter_task_execute_start_time_to" query:"filter_task_execute_start_time_to"`
+ PageIndex uint32 `json:"page_index" query:"page_index" valid:"required"`
+ PageSize uint32 `json:"page_size" query:"page_size" valid:"required"`
+ FuzzyKeyword string `json:"fuzzy_keyword" query:"fuzzy_keyword"`
}
type GetWorkflowsResV1 struct {
@@ -658,10 +665,10 @@ type WorkflowDetailResV1 struct {
// @Param filter_create_time_to query string false "filter create time to"
// @Param filter_task_execute_start_time_from query string false "filter_task_execute_start_time_from"
// @Param filter_task_execute_start_time_to query string false "filter_task_execute_start_time_to"
-// @Param filter_create_user_name query string false "filter create user name"
+// @Param filter_create_user_id query string false "filter create user id"
// @Param filter_status query string false "filter workflow status" Enums(wait_for_audit,wait_for_execution,rejected,executing,canceled,exec_failed,finished)
-// @Param filter_current_step_assignee_user_name query string false "filter current step assignee user name"
-// @Param filter_task_instance_name query string false "filter instance name"
+// @Param filter_current_step_assignee_user_id query string false "filter current step assignee user id"
+// @Param filter_task_instance_name query string false "filter instance id"
// @Param page_index query uint32 true "page index"
// @Param page_size query uint32 true "size of per page"
// @Success 200 {object} v1.GetWorkflowsResV1
@@ -672,7 +679,7 @@ func GetGlobalWorkflowsV1(c echo.Context) error {
return controller.JSONBaseErrorReq(c, err)
}
- user, err := controller.GetCurrentUser(c)
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -683,38 +690,43 @@ func GetGlobalWorkflowsV1(c echo.Context) error {
}
data := map[string]interface{}{
- "filter_subject": req.FilterSubject,
- "filter_create_time_from": req.FilterCreateTimeFrom,
- "filter_create_time_to": req.FilterCreateTimeTo,
- "filter_create_user_name": req.FilterCreateUserName,
- "filter_task_execute_start_time_from": req.FilterTaskExecuteStartTimeFrom,
- "filter_task_execute_start_time_to": req.FilterTaskExecuteStartTimeTo,
- "filter_status": req.FilterStatus,
- "filter_current_step_assignee_user_name": req.FilterCurrentStepAssigneeUserName,
- "filter_task_instance_name": req.FilterTaskInstanceName,
- "current_user_id": user.ID,
- "check_user_can_access": user.Name != model.DefaultAdminUser,
- "limit": req.PageSize,
- "offset": offset,
+ "filter_subject": req.FilterSubject,
+ "filter_create_time_from": req.FilterCreateTimeFrom,
+ "filter_create_time_to": req.FilterCreateTimeTo,
+ "filter_create_user_id": req.FilterCreateUserId,
+ "filter_task_execute_start_time_from": req.FilterTaskExecuteStartTimeFrom,
+ "filter_task_execute_start_time_to": req.FilterTaskExecuteStartTimeTo,
+ "filter_status": req.FilterStatus,
+ "filter_current_step_assignee_user_id": req.FilterCurrentStepAssigneeUserId,
+ "filter_task_instance_name": req.FilterTaskInstanceName,
+ "current_user_id": user.GetIDStr(),
+ "check_user_can_access": user.Name != model.DefaultAdminUser, // dms-todo: 判断是否是超级管理员
+ "limit": req.PageSize,
+ "offset": offset,
}
s := model.GetStorage()
- workflows, count, err := s.GetWorkflowsByReq(data, user)
+ workflows, count, err := s.GetWorkflowsByReq(data)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
+ /*
+ TODO 全局工单暂时不使用
+ 1. viewable_instance_ids,check_user_can_access 调用 AddFilterInstanceAndUserAdmin 添加筛选项
+ 2. 用户相关代码需要从DMS获取
+ */
workflowsResV1 := make([]*WorkflowDetailResV1, 0, len(workflows))
for _, workflow := range workflows {
workflowRes := &WorkflowDetailResV1{
- ProjectName: workflow.ProjectName,
+ ProjectName: workflow.ProjectId, // dms-todo: 临时使用id代替name
Name: workflow.Subject,
WorkflowId: workflow.WorkflowId,
Desc: workflow.Desc,
CreateUser: utils.AddDelTag(workflow.CreateUserDeletedAt, workflow.CreateUser.String),
CreateTime: workflow.CreateTime,
CurrentStepType: workflow.CurrentStepType.String,
- CurrentStepAssigneeUser: workflow.CurrentStepAssigneeUser,
+ CurrentStepAssigneeUser: strings.Split(workflow.CurrentStepAssigneeUserIds.String, ","),
Status: workflow.Status,
}
workflowsResV1 = append(workflowsResV1, workflowRes)
@@ -740,13 +752,14 @@ func GetGlobalWorkflowsV1(c echo.Context) error {
// @Param filter_create_time_to query string false "filter create time to"
// @Param filter_task_execute_start_time_from query string false "filter_task_execute_start_time_from"
// @Param filter_task_execute_start_time_to query string false "filter_task_execute_start_time_to"
-// @Param filter_create_user_name query string false "filter create user name"
+// @Param filter_create_user_id query string false "filter create user id"
// @Param filter_status query string false "filter workflow status" Enums(wait_for_audit,wait_for_execution,rejected,executing,canceled,exec_failed,finished)
-// @Param filter_current_step_assignee_user_name query string false "filter current step assignee user name"
+// @Param filter_current_step_assignee_user_id query string false "filter current step assignee user id"
// @Param filter_task_instance_name query string false "filter instance name"
// @Param page_index query uint32 true "page index"
// @Param page_size query uint32 true "size of per page"
// @Param project_name path string true "project name"
+// @Param fuzzy_keyword query string false "fuzzy matching subject/workflow_id"
// @Success 200 {object} v1.GetWorkflowsResV1
// @router /v1/projects/{project_name}/workflows [get]
func GetWorkflowsV1(c echo.Context) error {
@@ -754,68 +767,74 @@ func GetWorkflowsV1(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return controller.JSONBaseErrorReq(c, err)
}
-
- projectName := c.Param("project_name")
-
- s := model.GetStorage()
-
- project, exist, err := s.GetProjectByName(projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrProjectNotExist(projectName))
- }
- user, err := controller.GetCurrentUser(c)
+ s := model.GetStorage()
+
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
-
- if err := CheckIsProjectMember(user.Name, project.Name); err != nil {
+ up, err := dms.NewUserPermission(user.GetIDStr(), projectUid)
+ if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
-
var offset uint32
if req.PageIndex > 0 {
offset = (req.PageIndex - 1) * req.PageSize
}
-
data := map[string]interface{}{
- "filter_workflow_id": req.FilterWorkflowID,
- "fuzzy_search_workflow_desc": req.FuzzySearchWorkflowDesc,
- "filter_subject": req.FilterSubject,
- "filter_create_time_from": req.FilterCreateTimeFrom,
- "filter_create_time_to": req.FilterCreateTimeTo,
- "filter_create_user_name": req.FilterCreateUserName,
- "filter_task_execute_start_time_from": req.FilterTaskExecuteStartTimeFrom,
- "filter_task_execute_start_time_to": req.FilterTaskExecuteStartTimeTo,
- "filter_status": req.FilterStatus,
- "filter_current_step_assignee_user_name": req.FilterCurrentStepAssigneeUserName,
- "filter_task_instance_name": req.FilterTaskInstanceName,
- "filter_project_name": project.Name,
- "current_user_id": user.ID,
- "check_user_can_access": CheckIsProjectManager(user.Name, project.Name) != nil,
- "limit": req.PageSize,
- "offset": offset,
- }
-
- workflows, count, err := s.GetWorkflowsByReq(data, user)
+ "filter_workflow_id": req.FilterWorkflowID,
+ "filter_subject": req.FilterSubject,
+ "filter_create_time_from": req.FilterCreateTimeFrom,
+ "filter_create_time_to": req.FilterCreateTimeTo,
+ "filter_create_user_id": req.FilterCreateUserId,
+ "filter_task_execute_start_time_from": req.FilterTaskExecuteStartTimeFrom,
+ "filter_task_execute_start_time_to": req.FilterTaskExecuteStartTimeTo,
+ "filter_status": req.FilterStatus,
+ "filter_current_step_assignee_user_id": req.FilterCurrentStepAssigneeUserId,
+ "filter_task_instance_name": req.FilterTaskInstanceName,
+ "filter_project_id": projectUid,
+ "current_user_id": user.ID,
+ "check_user_can_access": !up.IsAdmin(),
+ "limit": req.PageSize,
+ "offset": offset,
+ }
+ if req.FuzzyKeyword != "" {
+ data["fuzzy_keyword"] = fmt.Sprintf("%%%s%%", req.FuzzyKeyword)
+ }
+
+ if !up.IsAdmin() {
+ data["viewable_instance_ids"] = strings.Join(up.GetInstancesByOP(dmsV1.OpPermissionTypeViewOthersWorkflow), ",")
+ }
+
+ workflows, count, err := s.GetWorkflowsByReq(data)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
workflowsResV1 := make([]*WorkflowDetailResV1, 0, len(workflows))
for _, workflow := range workflows {
+ // TODO DMS提供根据ID批量查询用户接口,demo阶段使用GetUser实现
+ CurrentStepAssigneeUserNames := make([]string, 0)
+ for _, currentStepAssigneeUser := range strings.Split(workflow.CurrentStepAssigneeUserIds.String, ",") {
+ if currentStepAssigneeUser == "" {
+ continue
+ }
+ CurrentStepAssigneeUserNames = append(CurrentStepAssigneeUserNames, dms.GetUserNameWithDelTag(currentStepAssigneeUser))
+ }
workflowRes := &WorkflowDetailResV1{
- ProjectName: workflow.ProjectName,
+ ProjectName: workflow.ProjectId, // dms-todo: 暂时使用id代替name
Name: workflow.Subject,
WorkflowId: workflow.WorkflowId,
Desc: workflow.Desc,
- CreateUser: utils.AddDelTag(workflow.CreateUserDeletedAt, workflow.CreateUser.String),
+ CreateUser: dms.GetUserNameWithDelTag(workflow.CreateUser.String),
CreateTime: workflow.CreateTime,
CurrentStepType: workflow.CurrentStepType.String,
- CurrentStepAssigneeUser: workflow.CurrentStepAssigneeUser,
+ CurrentStepAssigneeUser: CurrentStepAssigneeUserNames,
Status: workflow.Status,
}
workflowsResV1 = append(workflowsResV1, workflowRes)
@@ -930,16 +949,16 @@ func GetWorkflowV1(c echo.Context) error {
}
type ExportWorkflowReqV1 struct {
- FilterSubject string `json:"filter_subject" query:"filter_subject"`
- FuzzySearchWorkflowDesc string `json:"fuzzy_search_workflow_desc" query:"fuzzy_search_workflow_desc"`
- FilterCreateTimeFrom string `json:"filter_create_time_from" query:"filter_create_time_from"`
- FilterCreateTimeTo string `json:"filter_create_time_to" query:"filter_create_time_to"`
- FilterCreateUserName string `json:"filter_create_user_name" query:"filter_create_user_name"`
- FilterStatus string `json:"filter_status" query:"filter_status" valid:"omitempty,oneof=wait_for_audit wait_for_execution rejected canceled executing exec_failed finished"`
- FilterCurrentStepAssigneeUserName string `json:"filter_current_step_assignee_user_name" query:"filter_current_step_assignee_user_name"`
- FilterTaskInstanceName string `json:"filter_task_instance_name" query:"filter_task_instance_name"`
- FilterTaskExecuteStartTimeFrom string `json:"filter_task_execute_start_time_from" query:"filter_task_execute_start_time_from"`
- FilterTaskExecuteStartTimeTo string `json:"filter_task_execute_start_time_to" query:"filter_task_execute_start_time_to"`
+ FilterSubject string `json:"filter_subject" query:"filter_subject"`
+ FilterCreateTimeFrom string `json:"filter_create_time_from" query:"filter_create_time_from"`
+ FilterCreateTimeTo string `json:"filter_create_time_to" query:"filter_create_time_to"`
+ FilterCreateUserID string `json:"filter_create_user_id" query:"filter_create_user_id"`
+ FilterStatus string `json:"filter_status" query:"filter_status" valid:"omitempty,oneof=wait_for_audit wait_for_execution rejected canceled executing exec_failed finished"`
+ FilterCurrentStepAssigneeUserId string `json:"filter_current_step_assignee_user_id" query:"filter_current_step_assignee_user_id"`
+ FilterTaskInstanceName string `json:"filter_task_instance_name" query:"filter_task_instance_name"`
+ FilterTaskExecuteStartTimeFrom string `json:"filter_task_execute_start_time_from" query:"filter_task_execute_start_time_from"`
+ FilterTaskExecuteStartTimeTo string `json:"filter_task_execute_start_time_to" query:"filter_task_execute_start_time_to"`
+ FuzzyKeyword string `json:"fuzzy_keyword" query:"fuzzy_keyword"`
}
// ExportWorkflowV1
@@ -954,11 +973,12 @@ type ExportWorkflowReqV1 struct {
// @Param filter_create_time_to query string false "filter create time to"
// @Param filter_task_execute_start_time_from query string false "filter_task_execute_start_time_from"
// @Param filter_task_execute_start_time_to query string false "filter_task_execute_start_time_to"
-// @Param filter_create_user_name query string false "filter create user name"
+// @Param filter_create_user_id query string false "filter create user id"
// @Param filter_status query string false "filter workflow status" Enums(wait_for_audit,wait_for_execution,rejected,executing,canceled,exec_failed,finished)
-// @Param filter_current_step_assignee_user_name query string false "filter current step assignee user name"
+// @Param filter_current_step_assignee_user_id query string false "filter current step assignee user id"
// @Param filter_task_instance_name query string false "filter instance name"
// @Param project_name path string true "project name"
+// @Param fuzzy_keyword query string false "fuzzy matching subject/workflow_id/desc"
// @Success 200 {file} file "export workflow"
// @Router /v1/projects/{project_name}/workflows/exports [get]
func ExportWorkflowV1(c echo.Context) error {
@@ -977,28 +997,31 @@ func ExportWorkflowV1(c echo.Context) error {
// @Router /v1/projects/{project_name}/workflows/{workflow_id}/tasks/terminate [post]
func TerminateMultipleTaskByWorkflowV1(c echo.Context) error {
- projectName := c.Param("project_name")
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+
workflowID := c.Param("workflow_id")
+ // user, err := controller.GetCurrentUser(c,dms.GetUser)
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
s := model.GetStorage()
var workflow *model.Workflow
- var err error
{
- var exist bool
- workflow, exist, err = s.GetWorkflowDetailByWorkflowID(projectName, workflowID)
+ workflow, err = dms.GetWorkflowDetailByWorkflowId(projectUid, workflowID, s.GetWorkflowDetailWithoutInstancesByWorkflowID)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrWorkflowNoAccess)
- }
}
terminatingTaskIDs := getTerminatingTaskIDs(workflow)
// check workflow permission
{
- err := checkBeforeTasksTermination(c, projectName, workflow, terminatingTaskIDs)
+ err := checkBeforeTasksTermination(c, projectUid, workflow, terminatingTaskIDs)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -1022,30 +1045,35 @@ func TerminateMultipleTaskByWorkflowV1(c echo.Context) error {
// @Success 200 {object} controller.BaseRes
// @Router /v1/projects/{project_name}/workflows/{workflow_id}/tasks/{task_id}/terminate [post]
func TerminateSingleTaskByWorkflowV1(c echo.Context) error {
- projectName := c.Param("project_name")
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+
workflowID := c.Param("workflow_id")
taskIDStr := c.Param("task_id")
taskID, err := strconv.Atoi(taskIDStr)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
+
+ // user, err := controller.GetCurrentUser(c,dms.GetUser)
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
s := model.GetStorage()
var workflow *model.Workflow
{
- var exist bool
- workflow, exist, err = s.GetWorkflowDetailByWorkflowID(projectName, workflowID)
+ workflow, err = dms.GetWorkflowDetailByWorkflowId(projectUid, workflowID, s.GetWorkflowDetailWithoutInstancesByWorkflowID)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, ErrWorkflowNoAccess)
- }
}
// check workflow permission
{
- err := checkBeforeTasksTermination(c, projectName, workflow, []uint{uint(taskID)})
+ err := checkBeforeTasksTermination(c, projectUid, workflow, []uint{uint(taskID)})
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -1069,7 +1097,7 @@ func TerminateSingleTaskByWorkflowV1(c echo.Context) error {
return c.JSON(http.StatusOK, controller.NewBaseReq(err))
}
-func checkBeforeTasksTermination(c echo.Context, projectName string, workflow *model.Workflow, needTerminatedTaskIdList []uint) error {
+func checkBeforeTasksTermination(c echo.Context, projectId string, workflow *model.Workflow, needTerminatedTaskIdList []uint) error {
needTerminatedTaskIdMap := make(map[uint]struct{}, len(needTerminatedTaskIdList))
for _, taskID := range needTerminatedTaskIdList {
needTerminatedTaskIdMap[taskID] = struct{}{}
@@ -1096,7 +1124,7 @@ func checkBeforeTasksTermination(c echo.Context, projectName string, workflow *m
}
err := CheckCurrentUserCanOperateTasks(c,
- &model.Project{Name: projectName}, workflow, []uint{model.OP_WORKFLOW_EXECUTE}, needTerminatedTaskIdList)
+ projectId, workflow, []dmsV1.OpPermissionType{dmsV1.OpPermissionTypeViewOthersWorkflow}, needTerminatedTaskIdList)
if err != nil {
return err
}
@@ -1105,13 +1133,11 @@ func checkBeforeTasksTermination(c echo.Context, projectName string, workflow *m
}
func isTaskCanBeTerminate(s *model.Storage, taskID string) (bool, error) {
- task, exist, err := s.GetTaskById(taskID)
+ task, err := getTaskById(context.Background(), taskID)
if err != nil {
return false, fmt.Errorf("get task by id failed. taskID=%v err=%v", taskID, err)
}
- if !exist {
- return false, fmt.Errorf("task not exist. taskID=%v", taskID)
- }
+
if task.Instance == nil {
return false, fmt.Errorf("task instance is nil. taskID=%v", taskID)
}
diff --git a/sqle/api/controller/v2/audit_plan.go b/sqle/api/controller/v2/audit_plan.go
index 82ee8a96f7..93e966954d 100644
--- a/sqle/api/controller/v2/audit_plan.go
+++ b/sqle/api/controller/v2/audit_plan.go
@@ -14,8 +14,10 @@ import (
"github.com/actiontech/sqle/sqle/server"
"github.com/labstack/echo/v4"
+ dmsV1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
"github.com/actiontech/sqle/sqle/api/controller"
v1 "github.com/actiontech/sqle/sqle/api/controller/v1"
+ "github.com/actiontech/sqle/sqle/dms"
"github.com/actiontech/sqle/sqle/errors"
"github.com/actiontech/sqle/sqle/model"
"github.com/actiontech/sqle/sqle/server/auditplan"
@@ -70,9 +72,7 @@ func GetAuditPlans(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
- projectName := c.Param("project_name")
- userName := controller.GetUserName(c)
- err := v1.CheckIsProjectMember(userName, projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -82,22 +82,11 @@ func GetAuditPlans(c echo.Context) error {
offset = req.PageSize * (req.PageIndex - 1)
}
- currentUser, err := controller.GetCurrentUser(c)
- if err != nil {
- return err
- }
- instances, err := s.GetUserCanOpInstancesFromProject(currentUser, projectName, []uint{model.OP_AUDIT_PLAN_VIEW_OTHERS})
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- names := []string{}
- for _, instance := range instances {
- names = append(names, instance.Name)
- }
+ userId := controller.GetUserID(c)
- isManager, err := s.IsProjectManager(currentUser.Name, projectName)
+ up, err := dms.NewUserPermission(userId, projectUid)
if err != nil {
- return controller.JSONBaseErrorReq(c, err)
+ return err
}
data := map[string]interface{}{
@@ -105,21 +94,26 @@ func GetAuditPlans(c echo.Context) error {
"fuzzy_search_audit_plan_name": req.FuzzySearchAuditPlanName,
"filter_audit_plan_type": req.FilterAuditPlanType,
"filter_audit_plan_instance_name": req.FilterAuditPlanInstanceName,
- "current_user_name": currentUser.Name,
- "current_user_is_admin": model.DefaultAdminUser == currentUser.Name || isManager,
- "filter_project_name": projectName,
+ "current_user_id": userId,
+ "current_user_is_admin": up.IsAdmin(),
+ "filter_project_id": projectUid,
"limit": req.PageSize,
"offset": offset,
}
- if len(names) > 0 {
- data["accessible_instances_name"] = fmt.Sprintf("'%s'", strings.Join(names, "', '"))
+ if !up.IsAdmin() {
+ instanceNames, err := dms.GetInstanceNamesInProjectByIds(c.Request().Context(), projectUid, up.GetInstancesByOP(dmsV1.OpPermissionTypeViewOtherAuditPlan))
+ if err != nil {
+ return err
+ }
+ data["accessible_instances_name"] = fmt.Sprintf("\"%s\"", strings.Join(instanceNames, "\",\""))
}
+
auditPlans, count, err := s.GetAuditPlansByReq(data)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- templateNamesInProject, err := s.GetRuleTemplateNamesByProjectName(projectName)
+ templateNamesInProject, err := s.GetRuleTemplateNamesByProjectId(projectUid)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -194,10 +188,13 @@ func GetAuditPlanReportSQLs(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
- projectName := c.Param("project_name")
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
apName := c.Param("audit_plan_name")
- ap, exist, err := v1.GetAuditPlanIfCurrentUserCanAccess(c, projectName, apName, model.OP_AUDIT_PLAN_VIEW_OTHERS)
+ ap, exist, err := v1.GetAuditPlanIfCurrentUserCanAccess(c, projectUid, apName, dmsV1.OpPermissionTypeViewOtherAuditPlan)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -393,15 +390,22 @@ func PartialSyncAuditPlanSQLs(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
- projectName := c.Param("project_name")
apName := c.Param("audit_plan_name")
s := model.GetStorage()
- ap, err := v1.CheckProjectAndAuditPlan(s, projectName, apName)
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
+ ap, exist, err := dms.GetAuditPlanWithInstanceFromProjectByName(projectUid, apName, s.GetAuditPlanFromProjectByName)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ if !exist {
+ return controller.JSONBaseErrorReq(c, errors.NewAuditPlanNotExistErr())
+ }
+
l := log.NewEntry()
reqSQLs := req.SQLs
blackList, err := s.GetBlackListAuditPlanSQLs()
@@ -439,15 +443,23 @@ func FullSyncAuditPlanSQLs(c echo.Context) error {
if err := controller.BindAndValidateReq(c, req); err != nil {
return err
}
- projectName := c.Param("project_name")
apName := c.Param("audit_plan_name")
s := model.GetStorage()
- ap, err := v1.CheckProjectAndAuditPlan(s, projectName, apName)
+
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
+ ap, exist, err := s.GetAuditPlanFromProjectByName(projectUid, apName)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ if !exist {
+ return controller.JSONBaseErrorReq(c, errors.NewAuditPlanNotExistErr())
+ }
+
l := log.NewEntry()
reqSQLs := req.SQLs
blackList, err := s.GetBlackListAuditPlanSQLs()
diff --git a/sqle/api/controller/v2/auth.go b/sqle/api/controller/v2/auth.go
deleted file mode 100644
index 24a348ac95..0000000000
--- a/sqle/api/controller/v2/auth.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package v2
-
-import (
- "net/http"
-
- "github.com/actiontech/sqle/sqle/api/controller"
- v1 "github.com/actiontech/sqle/sqle/api/controller/v1"
- "github.com/labstack/echo/v4"
-)
-
-type UserLoginReqV2 struct {
- UserName string `json:"username" form:"username" example:"test" valid:"required"`
- Password string `json:"password" form:"password" example:"123456" valid:"required"`
-}
-
-// @Summary 用户登录
-// @Description user login
-// @Tags user
-// @Id loginV2
-// @Param user body v1.UserLoginReqV1 true "user login request"
-// @Success 200 {object} controller.BaseRes
-// @router /v2/login [post]
-func LoginV2(c echo.Context) error {
- req := new(UserLoginReqV2)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
-
- _, err := v1.Login(c, req.UserName, req.Password)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- return c.JSON(http.StatusOK, controller.NewBaseReq(nil))
-}
diff --git a/sqle/api/controller/v2/instance.go b/sqle/api/controller/v2/instance.go
index eb8fa350ef..2341537a6a 100644
--- a/sqle/api/controller/v2/instance.go
+++ b/sqle/api/controller/v2/instance.go
@@ -4,14 +4,11 @@ import (
"fmt"
"net/http"
- "github.com/actiontech/sqle/sqle/driver"
- "github.com/actiontech/sqle/sqle/errors"
-
"github.com/actiontech/sqle/sqle/api/controller"
v1 "github.com/actiontech/sqle/sqle/api/controller/v1"
- driverV2 "github.com/actiontech/sqle/sqle/driver/v2"
+ "github.com/actiontech/sqle/sqle/dms"
"github.com/actiontech/sqle/sqle/model"
- "github.com/actiontech/sqle/sqle/utils"
+
"github.com/labstack/echo/v4"
)
@@ -45,253 +42,6 @@ type InstanceResV2 struct {
Source string `json:"source" example:"SQLE"`
}
-type GetInstancesResV2 struct {
- controller.BaseRes
- Data []InstanceResV2 `json:"data"`
- TotalNums uint64 `json:"total_nums"`
-}
-
-// GetInstances get instances
-// @Summary 获取实例信息列表
-// @Description get instance info list
-// @Id getInstanceListV2
-// @Tags instance
-// @Security ApiKeyAuth
-// @Param project_name path string true "project name"
-// @Param filter_instance_name query string false "filter instance name"
-// @Param filter_db_type query string false "filter db type"
-// @Param filter_db_host query string false "filter db host"
-// @Param filter_db_port query string false "filter db port"
-// @Param filter_db_user query string false "filter db user"
-// @Param filter_rule_template_name query string false "filter rule template name"
-// @Param page_index query uint32 true "page index"
-// @Param page_size query uint32 true "size of per page"
-// @Success 200 {object} GetInstancesResV2
-// @router /v2/projects/{project_name}/instances [get]
-func GetInstances(c echo.Context) error {
- req := new(GetInstancesReqV2)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
- s := model.GetStorage()
-
- user, err := controller.GetCurrentUser(c)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- projectName := c.Param("project_name")
- err = v1.CheckIsProjectMember(user.Name, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- var offset uint32
- if req.PageIndex >= 1 {
- offset = req.PageSize * (req.PageIndex - 1)
- }
- data := map[string]interface{}{
- "filter_instance_name": req.FilterInstanceName,
- "filter_project_name": projectName,
- "filter_db_host": req.FilterDBHost,
- "filter_db_port": req.FilterDBPort,
- "filter_db_user": req.FilterDBUser,
- "filter_rule_template_name": req.FilterRuleTemplateName,
- "filter_db_type": req.FilterDBType,
- "limit": req.PageSize,
- "offset": offset,
- }
-
- instances, count, err := s.GetInstancesByReq(data, user)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- templateNamesInProject, err := s.GetRuleTemplateNamesByProjectName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- instancesRes := []InstanceResV2{}
- for _, instance := range instances {
- var ruleTemplate *RuleTemplateV2
- if len(instance.RuleTemplateNames) >= 1 {
- ruleTemplate = &RuleTemplateV2{
- Name: instance.RuleTemplateNames[0],
- }
-
- if !utils.StringsContains(templateNamesInProject, ruleTemplate.Name) {
- ruleTemplate.IsGlobalRuleTemplate = true
- }
- }
-
- instanceReq := InstanceResV2{
- Name: instance.Name,
- DBType: instance.DbType,
- Host: instance.Host,
- Port: instance.Port,
- User: instance.User,
- Desc: instance.Desc,
- MaintenanceTimes: v1.ConvertPeriodToMaintenanceTimeResV1(instance.MaintenancePeriod),
- RuleTemplate: ruleTemplate,
- SQLQueryConfig: &v1.SQLQueryConfigResV1{
- MaxPreQueryRows: instance.SqlQueryConfig.MaxPreQueryRows,
- QueryTimeoutSecond: instance.SqlQueryConfig.QueryTimeoutSecond,
- AuditEnabled: instance.SqlQueryConfig.AuditEnabled,
- AllowQueryWhenLessThanAuditLevel: instance.SqlQueryConfig.AllowQueryWhenLessThanAuditLevel,
- },
- Source: instance.Source,
- }
- instancesRes = append(instancesRes, instanceReq)
- }
- return c.JSON(http.StatusOK, &GetInstancesResV2{
- BaseRes: controller.NewBaseReq(nil),
- Data: instancesRes,
- TotalNums: count,
- })
-}
-
-type CreateInstanceReqV2 struct {
- Name string `json:"instance_name" form:"instance_name" example:"test" valid:"required,name"`
- DBType string `json:"db_type" form:"db_type" example:"mysql"`
- User string `json:"db_user" form:"db_user" example:"root" valid:"required"`
- Host string `json:"db_host" form:"db_host" example:"10.10.10.10" valid:"required,ip_addr|uri|hostname|hostname_rfc1123"`
- Port string `json:"db_port" form:"db_port" example:"3306" valid:"required,port"`
- Password string `json:"db_password" form:"db_password" example:"123456" valid:"required"`
- Desc string `json:"desc" example:"this is a test instance"`
- SQLQueryConfig *v1.SQLQueryConfigReqV1 `json:"sql_query_config" form:"sql_query_config"`
- MaintenanceTimes []*v1.MaintenanceTimeReqV1 `json:"maintenance_times" form:"maintenance_times"`
- RuleTemplateName string `json:"rule_template_name" form:"rule_template_name" valid:"required"`
- AdditionalParams []*v1.InstanceAdditionalParamReqV1 `json:"additional_params" form:"additional_params"`
-}
-
-// CreateInstance create instance
-// @Summary 添加实例
-// @Description create a instance
-// @Id createInstanceV2
-// @Tags instance
-// @Security ApiKeyAuth
-// @Accept json
-// @Param project_name path string true "project name"
-// @Param instance body v2.CreateInstanceReqV2 true "add instance"
-// @Success 200 {object} controller.BaseRes
-// @router /v2/projects/{project_name}/instances [post]
-func CreateInstance(c echo.Context) error {
- s := model.GetStorage()
- req := new(CreateInstanceReqV2)
- if err := controller.BindAndValidateReq(c, req); err != nil {
- return err
- }
-
- projectName := c.Param("project_name")
-
- userName := controller.GetUserName(c)
- err := v1.CheckIsProjectManager(userName, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- project, exist, err := s.GetProjectByName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, v1.ErrProjectNotExist(projectName))
- }
- if project.IsArchived() {
- return controller.JSONBaseErrorReq(c, v1.ErrProjectArchived)
- }
-
- _, exist, err = s.GetInstanceByNameAndProjectName(req.Name, projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if exist {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataExist, fmt.Errorf("instance is exist")))
- }
-
- if req.DBType == "" {
- req.DBType = driverV2.DriverTypeMySQL
- }
-
- maintenancePeriod := v1.ConvertMaintenanceTimeReqV1ToPeriod(req.MaintenanceTimes)
- if !maintenancePeriod.SelfCheck() {
- return controller.JSONBaseErrorReq(c, v1.ErrWrongTimePeriod)
- }
-
- additionalParams := driver.GetPluginManager().AllAdditionalParams()[req.DBType]
- for _, additionalParam := range req.AdditionalParams {
- err = additionalParams.SetParamValue(additionalParam.Name, additionalParam.Value)
- if err != nil {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataInvalid, err))
- }
- }
-
- sqlQueryConfig := model.SqlQueryConfig{}
- if req.SQLQueryConfig != nil {
- sqlQueryConfig = model.SqlQueryConfig{
- MaxPreQueryRows: req.SQLQueryConfig.MaxPreQueryRows,
- QueryTimeoutSecond: req.SQLQueryConfig.QueryTimeoutSecond,
- AuditEnabled: req.SQLQueryConfig.AuditEnabled,
- AllowQueryWhenLessThanAuditLevel: req.SQLQueryConfig.AllowQueryWhenLessThanAuditLevel,
- }
- }
- // default value
- if sqlQueryConfig.QueryTimeoutSecond == 0 {
- sqlQueryConfig.QueryTimeoutSecond = 10
- }
- // default value
- if sqlQueryConfig.MaxPreQueryRows == 0 {
- sqlQueryConfig.MaxPreQueryRows = 100
- }
-
- if sqlQueryConfig.AuditEnabled && sqlQueryConfig.AllowQueryWhenLessThanAuditLevel == "" {
- sqlQueryConfig.AllowQueryWhenLessThanAuditLevel = string(driverV2.RuleLevelError)
- }
-
- instance := &model.Instance{
- DbType: req.DBType,
- Name: req.Name,
- User: req.User,
- Host: req.Host,
- Port: req.Port,
- Password: req.Password,
- Desc: req.Desc,
- AdditionalParams: additionalParams,
- MaintenancePeriod: maintenancePeriod,
- SqlQueryConfig: sqlQueryConfig,
- WorkflowTemplateId: project.WorkflowTemplateId,
- ProjectId: project.ID,
- Source: model.InstanceSourceSQLE,
- }
-
- var templates []*model.RuleTemplate
- template, exist, err := s.GetGlobalAndProjectRuleTemplateByNameAndProjectId(req.RuleTemplateName, project.ID)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, v1.ErrRuleTemplateNotExist)
- }
- templates = append(templates, template)
-
- err = v1.CheckInstanceAndRuleTemplateDbType(templates, instance)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- err = s.Save(instance)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- err = s.UpdateInstanceRuleTemplates(instance, templates...)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- return c.JSON(http.StatusOK, controller.NewBaseReq(nil))
-}
-
type GetInstanceResV2 struct {
controller.BaseRes
Data InstanceResV2 `json:"data"`
@@ -308,23 +58,23 @@ type GetInstanceResV2 struct {
// @Success 200 {object} v2.GetInstanceResV2
// @router /v2/projects/{project_name}/instances/{instance_name}/ [get]
func GetInstance(c echo.Context) error {
- s := model.GetStorage()
instanceName := c.Param("instance_name")
- projectName := c.Param("project_name")
- username := controller.GetUserName(c)
- err := v1.CheckIsProjectMember(username, projectName)
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- instance, exist, err := s.GetInstanceDetailByNameAndProjectName(instanceName, projectName)
+ instance, exist, err := dms.GetInstanceInProjectByName(c.Request().Context(), projectUid, instanceName)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
if !exist {
return controller.JSONBaseErrorReq(c, v1.ErrInstanceNoAccess)
}
-
+ ruletemplate, err := model.GetStorage().GetRuleTemplateById(instance.RuleTemplateId)
+ if err == nil {
+ instance.RuleTemplates = []model.RuleTemplate{*ruletemplate}
+ }
return c.JSON(http.StatusOK, &GetInstanceResV2{
BaseRes: controller.NewBaseReq(nil),
Data: convertInstanceToRes(instance),
@@ -350,12 +100,11 @@ func convertInstanceToRes(instance *model.Instance) InstanceResV2 {
Source: instance.Source,
}
- if len(instance.RuleTemplates) > 0 {
+ if len(instance.RuleTemplates) != 0 {
+ ruleTemplate := instance.RuleTemplates[0]
instanceResV2.RuleTemplate = &RuleTemplateV2{
- Name: instance.RuleTemplates[0].Name,
- }
- if instance.RuleTemplates[0].ProjectId == model.ProjectIdForGlobalRuleTemplate {
- instanceResV2.RuleTemplate.IsGlobalRuleTemplate = true
+ Name: ruleTemplate.Name,
+ IsGlobalRuleTemplate: ruleTemplate.ProjectId == model.ProjectIdForGlobalRuleTemplate,
}
}
for _, param := range instance.AdditionalParams {
diff --git a/sqle/api/controller/v2/sql_audit.go b/sqle/api/controller/v2/sql_audit.go
index d43df89c14..7b629d6ab9 100644
--- a/sqle/api/controller/v2/sql_audit.go
+++ b/sqle/api/controller/v2/sql_audit.go
@@ -2,12 +2,12 @@ package v2
import (
e "errors"
- "fmt"
"net/http"
parser "github.com/actiontech/mybatis-mapper-2-sql"
"github.com/actiontech/sqle/sqle/api/controller"
v1 "github.com/actiontech/sqle/sqle/api/controller/v1"
+ "github.com/actiontech/sqle/sqle/dms"
"github.com/actiontech/sqle/sqle/errors"
"github.com/actiontech/sqle/sqle/log"
"github.com/actiontech/sqle/sqle/model"
@@ -68,7 +68,7 @@ func DirectAudit(c echo.Context) error {
l := log.NewEntry().WithField(c.Path(), "direct audit failed")
- task, err := server.AuditSQLByDBType(l, sql, req.InstanceType, nil, "")
+ task, err := server.AuditSQLByDBType(l, sql, req.InstanceType)
if err != nil {
l.Errorf("audit sqls failed: %v", err)
return controller.JSONBaseErrorReq(c, v1.ErrDirectAudit)
@@ -136,11 +136,16 @@ func DirectAuditFiles(c echo.Context) error {
return err
}
- user := controller.GetUserName(c)
- s := model.GetStorage()
- if yes, err := s.IsProjectMember(user, req.ProjectName); err != nil {
- return controller.JSONBaseErrorReq(c, fmt.Errorf("check privilege failed: %v", err))
- } else if !yes {
+ userId := controller.GetUserID(c)
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), req.ProjectName)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ up, err := dms.NewUserPermission(userId, projectUid)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ if !up.IsProjectMember() {
return controller.JSONBaseErrorReq(c, errors.New(errors.ErrAccessDeniedError, e.New("you are not the project member")))
}
@@ -164,7 +169,7 @@ func DirectAuditFiles(c echo.Context) error {
var instance *model.Instance
var exist bool
if req.InstanceName != nil {
- instance, exist, err = s.GetInstanceByNameAndProjectName(*req.InstanceName, req.ProjectName)
+ instance, exist, err = dms.GetInstanceInProjectByName(c.Request().Context(), projectUid, *req.InstanceName)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -182,7 +187,7 @@ func DirectAuditFiles(c echo.Context) error {
if instance != nil && schemaName != "" {
task, err = server.DirectAuditByInstance(l, sqls, schemaName, instance)
} else {
- task, err = server.AuditSQLByDBType(l, sqls, req.InstanceType, nil, "")
+ task, err = server.AuditSQLByDBType(l, sqls, req.InstanceType)
}
if err != nil {
l.Errorf("audit sqls failed: %v", err)
diff --git a/sqle/api/controller/v2/task.go b/sqle/api/controller/v2/task.go
index 7ade890e52..2b02eb41de 100644
--- a/sqle/api/controller/v2/task.go
+++ b/sqle/api/controller/v2/task.go
@@ -5,7 +5,6 @@ import (
"github.com/actiontech/sqle/sqle/api/controller"
v1 "github.com/actiontech/sqle/sqle/api/controller/v1"
- "github.com/actiontech/sqle/sqle/errors"
"github.com/actiontech/sqle/sqle/model"
"github.com/labstack/echo/v4"
@@ -67,13 +66,11 @@ func GetTaskSQLs(c echo.Context) error {
}
s := model.GetStorage()
taskId := c.Param("task_id")
- task, exist, err := s.GetTaskById(taskId)
+ task, err := v1.GetTaskById(c.Request().Context(), taskId)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, errors.NewTaskNoExistOrNoAccessErr())
- }
+
err = v1.CheckCurrentUserCanViewTask(c, task)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
diff --git a/sqle/api/controller/v2/workflow.go b/sqle/api/controller/v2/workflow.go
index c7aacd9da9..3e7cab29a3 100644
--- a/sqle/api/controller/v2/workflow.go
+++ b/sqle/api/controller/v2/workflow.go
@@ -1,23 +1,24 @@
package v2
import (
+ "context"
_err "errors"
"fmt"
"net/http"
- "strconv"
+ "strings"
"time"
- "github.com/actiontech/sqle/sqle/server"
-
+ dmsV1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+ "github.com/actiontech/dms/pkg/dms-common/dmsobject"
+ v1 "github.com/actiontech/sqle/sqle/api/controller/v1"
+ "github.com/actiontech/sqle/sqle/dms"
"github.com/actiontech/sqle/sqle/errors"
+ "github.com/actiontech/sqle/sqle/model"
"github.com/actiontech/sqle/sqle/notification"
"github.com/actiontech/sqle/sqle/pkg/im"
+ "github.com/actiontech/sqle/sqle/server"
"github.com/actiontech/sqle/sqle/utils"
- "github.com/actiontech/sqle/sqle/model"
-
- v1 "github.com/actiontech/sqle/sqle/api/controller/v1"
-
"github.com/actiontech/sqle/sqle/api/controller"
"github.com/labstack/echo/v4"
)
@@ -47,55 +48,35 @@ type WorkflowStepResV2 struct {
// @Success 200 {object} controller.BaseRes
// @router /v2/projects/{project_name}/workflows/{workflow_id}/steps/{workflow_step_id}/approve [post]
func ApproveWorkflowV2(c echo.Context) error {
- projectName := c.Param("project_name")
- workflowId := c.Param("workflow_id")
-
- s := model.GetStorage()
- project, exist, err := s.GetProjectByName(projectName)
+ projectUid, err := dms.GetPorjectUIDByName(c.Request().Context(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, v1.ErrProjectNotExist(projectName))
- }
- userName := controller.GetUserName(c)
- if err := v1.CheckIsProjectMember(userName, project.Name); err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
+ workflowId := c.Param("workflow_id")
- workflow, exist, err := s.GetWorkflowByProjectNameAndWorkflowId(projectName, workflowId)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, v1.ErrWorkflowNoAccess)
- }
+ s := model.GetStorage()
- err = v1.CheckCurrentUserCanOperateWorkflow(c, project, workflow, []uint{})
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- stepIdStr := c.Param("workflow_step_id")
- stepId, err := v1.FormatStringToInt(stepIdStr)
+ workflow, err := dms.GetWorkflowDetailByWorkflowId(projectUid, workflowId, s.GetWorkflowDetailWithoutInstancesByWorkflowID)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- user, err := controller.GetCurrentUser(c)
+ err = v1.CheckCurrentUserCanOperateWorkflow(c, projectUid, workflow, []dmsV1.OpPermissionType{})
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- workflowIdStr := strconv.Itoa(int(workflow.ID))
- workflow, exist, err = s.GetWorkflowDetailById(workflowIdStr)
+ stepIdStr := c.Param("workflow_step_id")
+ stepId, err := v1.FormatStringToInt(stepIdStr)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, v1.ErrWorkflowNoAccess)
- }
nextStep := workflow.NextStep()
@@ -108,10 +89,10 @@ func ApproveWorkflowV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, err)
}
- go im.UpdateApprove(workflow.ID, user, model.ApproveStatusAgree, "")
+ go im.UpdateApprove(workflow.WorkflowId, user, model.ApproveStatusAgree, "")
if nextStep != nil {
- go im.CreateApprove(strconv.Itoa(int(workflow.ID)))
+ go im.CreateApprove(string(workflow.ProjectId), workflow.WorkflowId)
}
return c.JSON(http.StatusOK, controller.NewBaseReq(nil))
@@ -140,26 +121,19 @@ func RejectWorkflowV2(c echo.Context) error {
s := model.GetStorage()
- projectName := c.Param("project_name")
- project, exist, err := s.GetProjectByName(projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, v1.ErrProjectNotExist(projectName))
- }
workflowID := c.Param("workflow_id")
- workflow, exist, err := s.GetWorkflowByProjectNameAndWorkflowId(project.Name, workflowID)
+ workflow, err := dms.GetWorkflowDetailByWorkflowId(projectUid, workflowID, s.GetWorkflowDetailWithoutInstancesByWorkflowID)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, v1.ErrWorkflowNoAccess)
- }
// RejectWorkflow no need extra operation code for now.
- err = v1.CheckCurrentUserCanOperateWorkflow(c, project, workflow, []uint{})
+ err = v1.CheckCurrentUserCanOperateWorkflow(c, projectUid, workflow, []dmsV1.OpPermissionType{})
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -170,20 +144,11 @@ func RejectWorkflowV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, err)
}
- user, err := controller.GetCurrentUser(c)
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- workflowIdStr := strconv.Itoa(int(workflow.ID))
- workflow, exist, err = s.GetWorkflowDetailById(workflowIdStr)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, v1.ErrWorkflowNoAccess)
- }
-
err = server.CheckUserCanOperateStep(user, workflow, stepId)
if err != nil {
return controller.JSONBaseErrorReq(c, errors.New(errors.DataInvalid, err))
@@ -202,7 +167,7 @@ func RejectWorkflowV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, err)
}
- go im.UpdateApprove(workflow.ID, user, model.ApproveStatusRefuse, req.Reason)
+ go im.UpdateApprove(workflow.WorkflowId, user, model.ApproveStatusRefuse, req.Reason)
return c.JSON(http.StatusOK, controller.NewBaseReq(nil))
}
@@ -219,17 +184,13 @@ func RejectWorkflowV2(c echo.Context) error {
func CancelWorkflowV2(c echo.Context) error {
s := model.GetStorage()
- projectName := c.Param("project_name")
- project, exist, err := s.GetProjectByName(projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, v1.ErrProjectNotExist(projectName))
- }
workflowID := c.Param("workflow_id")
- workflow, exist, err := s.GetWorkflowByProjectNameAndWorkflowId(project.Name, workflowID)
+ workflow, exist, err := s.GetWorkflowByProjectAndWorkflowId(projectUid, workflowID)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -237,27 +198,22 @@ func CancelWorkflowV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, v1.ErrWorkflowNoAccess)
}
- err = v1.CheckCurrentUserCanOperateWorkflow(c, project, workflow, []uint{})
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
- workflow, err = checkCancelWorkflow(project.Name, workflow.WorkflowId)
+ err = v1.CheckCurrentUserCanOperateWorkflow(c, projectUid, workflow, []dmsV1.OpPermissionType{})
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- user, err := controller.GetCurrentUser(c)
+ workflow, err = checkCancelWorkflow(projectUid, workflow.WorkflowId)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- isManager, err := s.IsProjectManager(user.Name, projectName)
+ up, err := dms.NewUserPermission(controller.GetUserID(c), projectUid)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !(user.ID == workflow.CreateUserId || user.Name == model.DefaultAdminUser || isManager) {
+ if !(controller.GetUserID(c) == workflow.CreateUserId || up.IsAdmin()) {
return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist,
fmt.Errorf("you are not allow to operate the workflow")))
}
@@ -270,19 +226,21 @@ func CancelWorkflowV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, err)
}
- go im.BatchCancelApprove([]uint{workflow.ID}, user)
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ go im.BatchCancelApprove([]string{workflow.WorkflowId}, user)
return controller.JSONBaseErrorReq(c, nil)
}
-func checkCancelWorkflow(projectName, workflowID string) (*model.Workflow, error) {
- workflow, exist, err := model.GetStorage().GetWorkflowDetailByWorkflowID(projectName, workflowID)
+func checkCancelWorkflow(projectId, workflowID string) (*model.Workflow, error) {
+ workflow, err := dms.GetWorkflowDetailByWorkflowId(projectId, workflowID, model.GetStorage().GetWorkflowDetailWithoutInstancesByWorkflowID)
if err != nil {
return nil, err
}
- if !exist {
- return nil, v1.ErrWorkflowNoAccess
- }
+
if !(workflow.Record.Status == model.WorkflowStatusWaitForAudit ||
workflow.Record.Status == model.WorkflowStatusWaitForExecution ||
workflow.Record.Status == model.WorkflowStatusReject) {
@@ -312,25 +270,20 @@ func BatchCancelWorkflowsV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, err)
}
- projectName := c.Param("project_name")
- user, err := controller.GetCurrentUser(c)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if err := v1.CheckIsProjectManager(user.Name, projectName); err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
-
workflows := make([]*model.Workflow, len(req.WorkflowIDList))
- workflowIds := make([]uint, 0, len(req.WorkflowIDList))
+ workflowIds := make([]string, 0, len(req.WorkflowIDList))
for i, workflowID := range req.WorkflowIDList {
- workflow, err := checkCancelWorkflow(projectName, workflowID)
+ workflow, err := checkCancelWorkflow(projectUid, workflowID)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
workflows[i] = workflow
- workflowIds = append(workflowIds, workflow.ID)
+ workflowIds = append(workflowIds, workflow.WorkflowId)
workflow.Record.Status = model.WorkflowStatusCancel
workflow.Record.CurrentWorkflowStepId = 0
}
@@ -338,7 +291,10 @@ func BatchCancelWorkflowsV2(c echo.Context) error {
if err := model.GetStorage().BatchUpdateWorkflowStatus(workflows); err != nil {
return controller.JSONBaseErrorReq(c, err)
}
-
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
go im.BatchCancelApprove(workflowIds, user)
return controller.JSONBaseErrorReq(c, nil)
@@ -364,31 +320,33 @@ func BatchCompleteWorkflowsV2(c echo.Context) error {
return err
}
- projectName := c.Param("project_name")
- user, err := controller.GetCurrentUser(c)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- s := model.GetStorage()
- isManager, err := s.IsProjectManager(user.Name, projectName)
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ up, err := dms.NewUserPermission(user.GetIDStr(), projectUid)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
workflows := make([]*model.Workflow, len(req.WorkflowIDList))
for i, workflowID := range req.WorkflowIDList {
- workflow, err := checkCanCompleteWorkflow(projectName, workflowID)
+ workflow, err := checkCanCompleteWorkflow(projectUid, workflowID)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
// 执行上线的人可以决定真的上线这个工单还是直接标记完成
lastStep := workflow.Record.Steps[len(workflow.Record.Steps)-1]
- canFinishWorkflow := isManager
+ canFinishWorkflow := up.IsAdmin()
if !canFinishWorkflow {
- for _, assignee := range lastStep.Assignees {
- if assignee.Name == user.Name {
+ for _, assignee := range strings.Split(lastStep.Assignees, ",") {
+ if assignee == user.GetIDStr() {
canFinishWorkflow = true
break
}
@@ -400,7 +358,7 @@ func BatchCompleteWorkflowsV2(c echo.Context) error {
}
lastStep.State = model.WorkflowStepStateApprove
- lastStep.OperationUserId = user.ID
+ lastStep.OperationUserId = user.GetIDStr()
workflows[i] = workflow
workflow.Record.Status = model.WorkflowStatusFinish
workflow.Record.CurrentWorkflowStepId = 0
@@ -408,7 +366,7 @@ func BatchCompleteWorkflowsV2(c echo.Context) error {
needExecInstanceRecords := []*model.WorkflowInstanceRecord{}
for _, inst := range workflow.Record.InstanceRecords {
if !inst.IsSQLExecuted {
- inst.ExecutionUserId = user.ID
+ inst.ExecutionUserId = user.GetIDStr()
inst.IsSQLExecuted = true
needExecInstanceRecords = append(needExecInstanceRecords, inst)
}
@@ -421,14 +379,12 @@ func BatchCompleteWorkflowsV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, nil)
}
-func checkCanCompleteWorkflow(projectName, workflowID string) (*model.Workflow, error) {
- workflow, exist, err := model.GetStorage().GetWorkflowDetailByWorkflowID(projectName, workflowID)
+func checkCanCompleteWorkflow(projectId, workflowID string) (*model.Workflow, error) {
+ workflow, err := dms.GetWorkflowDetailByWorkflowId(projectId, workflowID, model.GetStorage().GetWorkflowDetailWithoutInstancesByWorkflowID)
if err != nil {
return nil, err
}
- if !exist {
- return nil, v1.ErrWorkflowNoAccess
- }
+
if !(workflow.Record.Status == model.WorkflowStatusWaitForExecution) {
return nil, errors.New(errors.DataInvalid,
fmt.Errorf("workflow status is %s, not allow operate it", workflow.Record.Status))
@@ -448,19 +404,17 @@ func checkCanCompleteWorkflow(projectName, workflowID string) (*model.Workflow,
// @Success 200 {object} controller.BaseRes
// @router /v2/projects/{project_name}/workflows/{workflow_id}/tasks/{task_id}/execute [post]
func ExecuteOneTaskOnWorkflowV2(c echo.Context) error {
- projectName := c.Param("project_name")
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
workflowID := c.Param("workflow_id")
s := model.GetStorage()
- workflow, exist, err := s.GetWorkflowByProjectNameAndWorkflowId(projectName, workflowID)
+ workflow, err := dms.GetWorkflowDetailByWorkflowId(projectUid, workflowID, s.GetWorkflowDetailWithoutInstancesByWorkflowID)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, v1.ErrWorkflowNoAccess)
- }
-
- workflowId := fmt.Sprintf("%v", workflow.ID)
taskIdStr := c.Param("task_id")
taskId, err := v1.FormatStringToInt(taskIdStr)
@@ -468,18 +422,11 @@ func ExecuteOneTaskOnWorkflowV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, err)
}
- workflow, exist, err = s.GetWorkflowDetailById(workflowId)
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, v1.ErrWorkflowNoAccess)
- }
- user, err := controller.GetCurrentUser(c)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- err = v1.PrepareForTaskExecution(c, projectName, workflow, user, taskId)
+ err = v1.PrepareForTaskExecution(c, projectUid, workflow, user, taskId)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -489,10 +436,10 @@ func ExecuteOneTaskOnWorkflowV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, err)
}
if !isCan {
- return controller.JSONBaseErrorReq(c, fmt.Errorf("task has no need to be executed. taskId=%v workflowId=%v", taskId, workflowId))
+ return controller.JSONBaseErrorReq(c, fmt.Errorf("task has no need to be executed. taskId=%v workflowId=%v", taskId, workflow.WorkflowId))
}
- err = server.ExecuteWorkflow(workflow, map[uint]uint{uint(taskId): user.ID})
+ err = server.ExecuteWorkflow(workflow, map[uint]string{uint(taskId): user.GetIDStr()})
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -529,15 +476,15 @@ type GetWorkflowTasksItemV2 struct {
// @Success 200 {object} v2.GetWorkflowTasksResV2
// @router /v2/projects/{project_name}/workflows/{workflow_id}/tasks [get]
func GetSummaryOfWorkflowTasksV2(c echo.Context) error {
- projectName := c.Param("project_name")
- workflowId := c.Param("workflow_id")
-
- if err := CheckCurrentUserCanViewWorkflow(c, workflowId, projectName); err != nil {
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
+ if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
+ workflowId := c.Param("workflow_id")
+
s := model.GetStorage()
- workflow, exist, err := s.GetWorkflowByProjectNameAndWorkflowId(projectName, workflowId)
+ workflow, exist, err := s.GetWorkflowByProjectAndWorkflowId(projectUid, workflowId)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -545,9 +492,14 @@ func GetSummaryOfWorkflowTasksV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, v1.ErrWorkflowNoAccess)
}
+ err = v1.CheckCurrentUserCanOperateWorkflow(c, projectUid, workflow, []dmsV1.OpPermissionType{dmsV1.OpPermissionTypeViewOthersWorkflow})
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+
queryData := map[string]interface{}{
- "workflow_id": workflowId,
- "project_name": projectName,
+ "workflow_id": workflowId,
+ "project_id": projectUid,
}
var taskDetails []*model.WorkflowTasksSummaryDetail
@@ -566,6 +518,17 @@ func GetSummaryOfWorkflowTasksV2(c echo.Context) error {
}
}
+ for i, detail := range taskDetails {
+ instance, exist, err := dms.GetInstanceInProjectById(c.Request().Context(), projectUid, detail.InstanceId)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ if exist {
+ taskDetails[i].InstanceName = instance.Name
+ taskDetails[i].InstanceMaintenancePeriod = instance.MaintenancePeriod
+ }
+ }
+
return c.JSON(http.StatusOK, &GetWorkflowTasksResV2{
BaseRes: controller.NewBaseReq(nil),
Data: convertWorkflowToTasksSummaryRes(taskDetails),
@@ -576,6 +539,14 @@ func convertWorkflowToTasksSummaryRes(taskDetails []*model.WorkflowTasksSummaryD
res := make([]*GetWorkflowTasksItemV2, len(taskDetails))
for i, taskDetail := range taskDetails {
+ userNames := make([]string, 0)
+ for _, userId := range strings.Split(taskDetail.CurrentStepAssigneeUserIds.String, ",") {
+ if userId == "" {
+ continue
+ }
+ userNames = append(userNames, dms.GetUserNameWithDelTag(userId))
+ }
+
res[i] = &GetWorkflowTasksItemV2{
TaskId: taskDetail.TaskId,
InstanceName: utils.AddDelTag(taskDetail.InstanceDeletedAt, taskDetail.InstanceName),
@@ -583,11 +554,11 @@ func convertWorkflowToTasksSummaryRes(taskDetails []*model.WorkflowTasksSummaryD
ExecStartTime: taskDetail.TaskExecStartAt,
ExecEndTime: taskDetail.TaskExecEndAt,
ScheduleTime: taskDetail.InstanceScheduledAt,
- CurrentStepAssigneeUser: taskDetail.CurrentStepAssigneeUsers,
+ CurrentStepAssigneeUser: userNames,
TaskPassRate: taskDetail.TaskPassRate,
TaskScore: taskDetail.TaskScore,
InstanceMaintenanceTimes: v1.ConvertPeriodToMaintenanceTimeResV1(taskDetail.InstanceMaintenancePeriod),
- ExecutionUserName: utils.AddDelTag(taskDetail.ExecutionUserDeletedAt, taskDetail.ExecutionUserName),
+ ExecutionUserName: dms.GetUserNameWithDelTag(taskDetail.ExecutionUserId),
}
}
@@ -627,43 +598,25 @@ func CreateWorkflowV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, err)
}
- projectName := c.Param("project_name")
-
- s := model.GetStorage()
- project, exist, err := s.GetProjectByName(projectName)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, v1.ErrProjectNotExist(projectName))
- }
- if project.IsArchived() {
- return controller.JSONBaseErrorReq(c, v1.ErrProjectArchived)
- }
-
- user, err := controller.GetCurrentUser(c)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if err := v1.CheckIsProjectMember(user.Name, project.Name); err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
+ s := model.GetStorage()
- workflowId, err := utils.GenUid()
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- _, exist, err = s.GetWorkflowByProjectAndWorkflowName(project.Name, req.Subject)
+ // dms-todo: 与 dms 生成uid保持一致
+ workflowId, err := utils.GenUid()
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if exist {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataExist, fmt.Errorf("workflow[%v] is exist", req.Subject)))
- }
- _, exist, err = s.GetWorkflowByProjectNameAndWorkflowId(project.Name, workflowId)
+ _, exist, err := s.GetWorkflowByProjectAndWorkflowId(projectUid, workflowId)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -683,18 +636,39 @@ func CreateWorkflowV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, errors.NewTaskNoExistOrNoAccessErr())
}
- insIdtMap := make(map[uint] /* project instance id */ struct{}, len(project.Instances))
- for _, instance := range project.Instances {
- insIdtMap[instance.ID] = struct{}{}
+ instanceIds := make([]uint64, 0, len(tasks))
+ for _, task := range tasks {
+ instanceIds = append(instanceIds, task.InstanceId)
+ }
+
+ instances, err := dms.GetInstancesInProjectByIds(c.Request().Context(), projectUid, instanceIds)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+
+ instanceMap := map[uint64]*model.Instance{}
+ for _, instance := range instances {
+ instanceMap[instance.ID] = instance
+ }
+
+ workflowTemplate, exist, err := s.GetWorkflowTemplateByProjectId(model.ProjectUID(projectUid))
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ if !exist {
+ return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist, fmt.Errorf("the task instance is not bound workflow template")))
}
- workflowTemplateId := tasks[0].Instance.WorkflowTemplateId
for _, task := range tasks {
+ if instance, ok := instanceMap[task.InstanceId]; ok {
+ task.Instance = instance
+ }
+
if task.Instance == nil {
return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist, fmt.Errorf("instance is not exist. taskId=%v", task.ID)))
}
- if _, ok := insIdtMap[task.InstanceId]; !ok {
+ if task.Instance.ProjectId != projectUid {
return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist, fmt.Errorf("instance is not in project. taskId=%v", task.ID)))
}
@@ -706,7 +680,7 @@ func CreateWorkflowV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, errors.New(errors.DataInvalid, fmt.Errorf("workflow's execute sql is null. taskId=%v", task.ID)))
}
- if task.CreateUserId != user.ID {
+ if task.CreateUserId != uint64(user.ID) {
return controller.JSONBaseErrorReq(c, errors.New(errors.DataConflict,
fmt.Errorf("the task is not created by yourself. taskId=%v", task.ID)))
}
@@ -714,20 +688,19 @@ func CreateWorkflowV2(c echo.Context) error {
if task.SQLSource == model.TaskSQLSourceFromMyBatisXMLFile {
return controller.JSONBaseErrorReq(c, v1.ErrForbidMyBatisXMLTask(task.ID))
}
-
- // all instances must use the same workflow template
- if task.Instance.WorkflowTemplateId != workflowTemplateId {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataConflict,
- fmt.Errorf("all instances must use the same workflow template")))
- }
}
// check user role operations
{
- err = v1.CheckCurrentUserCanCreateWorkflow(user, tasks, projectName)
+
+ canOperationInstance, err := v1.CheckCurrentUserCanCreateWorkflow(c.Request().Context(), projectUid, user, tasks)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
+ if !canOperationInstance {
+ return controller.JSONBaseErrorReq(c, fmt.Errorf("can't operation instance"))
+ }
+
}
count, err := s.GetWorkflowRecordCountByTaskIds(taskIds)
@@ -738,25 +711,40 @@ func CreateWorkflowV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, errTaskHasBeenUsed)
}
- template, exist, err := s.GetWorkflowTemplateById(workflowTemplateId)
+ err = v1.CheckWorkflowCanCommit(workflowTemplate, tasks)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist,
- fmt.Errorf("the task instance is not bound workflow template")))
- }
- err = v1.CheckWorkflowCanCommit(template, tasks)
+ stepTemplates, err := s.GetWorkflowStepsByTemplateId(workflowTemplate.ID)
if err != nil {
- return controller.JSONBaseErrorReq(c, err)
+ return err
}
- stepTemplates, err := s.GetWorkflowStepsByTemplateId(template.ID)
+ memberWithPermissions, _, err := dmsobject.ListMembersInProject(c.Request().Context(), controller.GetDMSServerAddress(), dmsV1.ListMembersForInternalReq{
+ ProjectUid: projectUid,
+ PageSize: 999,
+ PageIndex: 1,
+ })
if err != nil {
return err
}
- err = s.CreateWorkflowV2(req.Subject, workflowId, req.Desc, user, tasks, stepTemplates, project.ID)
+
+ err = s.CreateWorkflowV2(req.Subject, workflowId, req.Desc, user, tasks, stepTemplates, model.ProjectUID(projectUid), func(tasks []*model.Task) (auditWorkflowUsers, canExecUser [][]*model.User) {
+ auditWorkflowUsers = make([][]*model.User, len(tasks))
+ executorWorkflowUsers := make([][]*model.User, len(tasks))
+ for i, task := range tasks {
+ auditWorkflowUsers[i], err = v1.GetCanOpInstanceUsers(memberWithPermissions, task.Instance, []dmsV1.OpPermissionType{dmsV1.OpPermissionTypeAuditWorkflow})
+ if err != nil {
+ return
+ }
+ executorWorkflowUsers[i], err = v1.GetCanOpInstanceUsers(memberWithPermissions, task.Instance, []dmsV1.OpPermissionType{dmsV1.OpPermissionTypeExecuteWorkflow})
+ if err != nil {
+ return
+ }
+ }
+ return auditWorkflowUsers, executorWorkflowUsers
+ })
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -769,10 +757,9 @@ func CreateWorkflowV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist, fmt.Errorf("should exist at least one workflow after create workflow")))
}
- workFlowId := strconv.Itoa(int(workflow.ID))
- go notification.NotifyWorkflow(workFlowId, notification.WorkflowNotifyTypeCreate)
+ go notification.NotifyWorkflow(string(workflow.ProjectId), workflow.WorkflowId, notification.WorkflowNotifyTypeCreate)
- go im.CreateApprove(workFlowId)
+ go im.CreateApprove(string(workflow.ProjectId), workflow.WorkflowId)
return c.JSON(http.StatusOK, &CreateWorkflowResV2{
BaseRes: controller.NewBaseReq(nil),
@@ -805,19 +792,20 @@ func UpdateWorkflowV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, err)
}
- projectName := c.Param("project_name")
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+
workflowId := c.Param("workflow_id")
s := model.GetStorage()
- workflow, exist, err := s.GetWorkflowByProjectNameAndWorkflowId(projectName, workflowId)
+ workflow, err := dms.GetWorkflowDetailByWorkflowId(projectUid, workflowId, s.GetWorkflowDetailWithoutInstancesByWorkflowID)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, errors.NewDataNotExistErr("workflow not exist"))
- }
- err = v1.CheckCurrentUserCanOperateWorkflow(c, &model.Project{Name: projectName}, workflow, []uint{})
+ err = v1.CheckCurrentUserCanOperateWorkflow(c, projectUid, workflow, []dmsV1.OpPermissionType{})
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -830,7 +818,22 @@ func UpdateWorkflowV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, errors.NewTaskNoExistOrNoAccessErr())
}
- user, err := controller.GetCurrentUser(c)
+ instanceIds := make([]uint64, 0, len(tasks))
+ for _, task := range tasks {
+ instanceIds = append(instanceIds, task.InstanceId)
+ }
+
+ instances, err := dms.GetInstancesInProjectByIds(c.Request().Context(), projectUid, instanceIds)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+
+ instanceMap := map[uint64]*model.Instance{}
+ for _, instance := range instances {
+ instanceMap[instance.ID] = instance
+ }
+
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -839,6 +842,10 @@ func UpdateWorkflowV2(c echo.Context) error {
for i, task := range tasks {
taskIds[i] = task.ID
+ if instance, ok := instanceMap[task.InstanceId]; ok {
+ task.Instance = instance
+ }
+
count, err := s.GetTaskSQLCountByTaskID(task.ID)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
@@ -856,7 +863,7 @@ func UpdateWorkflowV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, v1.ErrInstanceNotExist)
}
- if user.ID != task.CreateUserId {
+ if uint64(user.ID) != task.CreateUserId {
return controller.JSONBaseErrorReq(c, errors.New(errors.DataConflict,
fmt.Errorf("the task is not created by yourself. taskId=%v", task.ID)))
}
@@ -874,26 +881,17 @@ func UpdateWorkflowV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, errTaskHasBeenUsed)
}
- workflowIdStr := fmt.Sprintf("%v", workflow.ID)
- workflow, exist, err = s.GetWorkflowDetailById(workflowIdStr)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, v1.ErrWorkflowNoAccess)
- }
-
if workflow.Record.Status != model.WorkflowStatusReject {
return controller.JSONBaseErrorReq(c, errors.New(errors.DataInvalid,
fmt.Errorf("workflow status is %s, not allow operate it", workflow.Record.Status)))
}
- if user.ID != workflow.CreateUserId {
+ if user.GetIDStr() != workflow.CreateUserId {
return controller.JSONBaseErrorReq(c, errors.New(errors.DataNotExist,
fmt.Errorf("you are not allow to operate the workflow")))
}
- template, exist, err := s.GetWorkflowTemplateById(tasks[0].Instance.WorkflowTemplateId)
+ template, exist, err := s.GetWorkflowTemplateByProjectId(workflow.ProjectId)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -911,10 +909,9 @@ func UpdateWorkflowV2(c echo.Context) error {
if err != nil {
return c.JSON(http.StatusOK, controller.NewBaseReq(err))
}
- go notification.NotifyWorkflow(workflowIdStr, notification.WorkflowNotifyTypeCreate)
+ go notification.NotifyWorkflow(string(workflow.ProjectId), workflow.WorkflowId, notification.WorkflowNotifyTypeCreate)
- workFlowId := strconv.Itoa(int(workflow.ID))
- go im.CreateApprove(workFlowId)
+ go im.CreateApprove(string(workflow.ProjectId), workflow.WorkflowId)
return c.JSON(http.StatusOK, controller.NewBaseReq(nil))
}
@@ -938,26 +935,24 @@ type UpdateWorkflowScheduleReqV2 struct {
// @Success 200 {object} controller.BaseRes
// @router /v2/projects/{project_name}/workflows/{workflow_id}/tasks/{task_id}/schedule [put]
func UpdateWorkflowScheduleV2(c echo.Context) error {
- projectName := c.Param("project_name")
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+
workflowId := c.Param("workflow_id")
s := model.GetStorage()
-
- workflow, exist, err := s.GetWorkflowByProjectNameAndWorkflowId(projectName, workflowId)
+ workflow, err := dms.GetWorkflowDetailByWorkflowId(projectUid, workflowId, s.GetWorkflowDetailWithoutInstancesByWorkflowID)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, v1.ErrWorkflowNoAccess)
- }
- err = v1.CheckCurrentUserCanOperateWorkflow(c, &model.Project{Name: projectName}, workflow, []uint{})
+ err = v1.CheckCurrentUserCanOperateWorkflow(c, projectUid, workflow, []dmsV1.OpPermissionType{})
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- workflowId = strconv.Itoa(int(workflow.ID))
-
taskId := c.Param("task_id")
taskIdUint, err := v1.FormatStringToUint64(taskId)
if err != nil {
@@ -968,17 +963,11 @@ func UpdateWorkflowScheduleV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, err)
}
- user, err := controller.GetCurrentUser(c)
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- workflow, exist, err = s.GetWorkflowDetailById(workflowId)
- if err != nil {
- return controller.JSONBaseErrorReq(c, err)
- }
- if !exist {
- return controller.JSONBaseErrorReq(c, v1.ErrWorkflowNoAccess)
- }
+
currentStep := workflow.CurrentStep()
if currentStep == nil {
return controller.JSONBaseErrorReq(c, errors.New(errors.DataInvalid, _err.New("workflow current step not found")))
@@ -1013,7 +1002,7 @@ func UpdateWorkflowScheduleV2(c echo.Context) error {
"task has been executed")))
}
- instance, exist, err := s.GetInstanceById(fmt.Sprintf("%v", curTaskRecord.InstanceId))
+ instance, exist, err := dms.GetInstanceInProjectById(c.Request().Context(), projectUid, curTaskRecord.InstanceId)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -1025,7 +1014,7 @@ func UpdateWorkflowScheduleV2(c echo.Context) error {
return controller.JSONBaseErrorReq(c, v1.ErrWorkflowExecuteTimeIncorrect)
}
- err = s.UpdateInstanceRecordSchedule(curTaskRecord, user.ID, req.ScheduleTime)
+ err = s.UpdateInstanceRecordSchedule(curTaskRecord, user.GetIDStr(), req.ScheduleTime)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
@@ -1044,31 +1033,32 @@ func UpdateWorkflowScheduleV2(c echo.Context) error {
// @Success 200 {object} controller.BaseRes
// @router /v2/projects/{project_name}/workflows/{workflow_id}/tasks/execute [post]
func ExecuteTasksOnWorkflowV2(c echo.Context) error {
- projectName := c.Param("project_name")
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"), true)
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
workflowId := c.Param("workflow_id")
s := model.GetStorage()
- workflow, exist, err := s.GetWorkflowByProjectNameAndWorkflowId(projectName, workflowId)
+ workflow, err := dms.GetWorkflowDetailByWorkflowId(projectUid, workflowId, s.GetWorkflowDetailWithoutInstancesByWorkflowID)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, v1.ErrWorkflowNoAccess)
- }
- user, err := controller.GetCurrentUser(c)
+ user, err := controller.GetCurrentUser(c, dms.GetUser)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
+ if err := v1.PrepareForWorkflowExecution(c, projectUid, workflow, user); err != nil {
+ return err
+ }
- workflowId = fmt.Sprintf("%v", workflow.ID)
-
- err = server.ExecuteTasksProcess(workflowId, projectName, user)
+ err = server.ExecuteTasksProcess(workflow.WorkflowId, projectUid, user)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- im.UpdateApprove(workflow.ID, user, model.ApproveStatusAgree, "")
+ im.UpdateApprove(workflow.WorkflowId, user, model.ApproveStatusAgree, "")
return c.JSON(http.StatusOK, controller.NewBaseReq(nil))
}
@@ -1111,40 +1101,54 @@ type WorkflowResV2 struct {
// @Success 200 {object} GetWorkflowResV2
// @router /v2/projects/{project_name}/workflows/{workflow_id}/ [get]
func GetWorkflowV2(c echo.Context) error {
- projectName := c.Param("project_name")
- workflowID := c.Param("workflow_id")
-
- s := model.GetStorage()
-
- err := CheckCurrentUserCanViewWorkflow(c, workflowID, projectName)
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
+ workflowID := c.Param("workflow_id")
- workflow, exist, err := s.GetWorkflowByProjectNameAndWorkflowId(projectName, workflowID)
+ s := model.GetStorage()
+ workflow, err := dms.GetWorkflowDetailByWorkflowId(projectUid, workflowID, s.GetWorkflowDetailWithoutInstancesByWorkflowID)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, v1.ErrWorkflowNoAccess)
- }
-
- workflowIdStr := strconv.Itoa(int(workflow.ID))
- workflow, exist, err = s.GetWorkflowDetailById(workflowIdStr)
+ err = v1.CheckCurrentUserCanOperateWorkflow(c, projectUid, workflow, []dmsV1.OpPermissionType{dmsV1.OpPermissionTypeViewOthersWorkflow})
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !exist {
- return controller.JSONBaseErrorReq(c, v1.ErrWorkflowNoAccess)
+
+ // TODO 优化为一次批量用户查询,history 记录也许一并处理
+ for i := range workflow.Record.Steps {
+ step := workflow.Record.Steps[i]
+ AssigneesUserNames := make([]string, 0)
+ for _, id := range strings.Split(step.Assignees, ",") {
+ if id == "" {
+ continue
+ }
+ // user, err := dms.GetUser(c.Request().Context(), id, controller.GetDMSServerAddress())
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
+ AssigneesUserNames = append(AssigneesUserNames, dms.GetUserNameWithDelTag(id))
+ }
+ step.Assignees = strings.Join(AssigneesUserNames, ",")
+ if workflow.CurrentStep() != nil && step.ID == workflow.CurrentStep().ID {
+ workflow.Record.CurrentStep = step
+ }
+ workflow.Record.Steps[i] = step
}
- history, err := s.GetWorkflowHistoryById(workflowIdStr)
+ history, err := s.GetWorkflowHistoryById(workflow.ID)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
workflow.RecordHistory = history
-
+ // createUser, err := dms.GetUser(c.Request().Context(), workflow.CreateUserId, controller.GetDMSServerAddress())
+ // if err != nil {
+ // return controller.JSONBaseErrorReq(c, err)
+ // }
+ // workflow.CreateUser = createUser.Name
return c.JSON(http.StatusOK, &GetWorkflowResV2{
BaseRes: controller.NewBaseReq(nil),
Data: convertWorkflowToRes(workflow),
@@ -1157,7 +1161,7 @@ func convertWorkflowToRes(workflow *model.Workflow) *WorkflowResV2 {
WorkflowID: workflow.WorkflowId,
Desc: workflow.Desc,
Mode: workflow.Mode,
- CreateUser: workflow.CreateUser.Name,
+ CreateUser: dms.GetUserNameWithDelTag(workflow.CreateUserId),
CreateTime: &workflow.CreatedAt,
}
@@ -1190,7 +1194,7 @@ func convertWorkflowRecordToRes(workflow *model.Workflow, record *model.Workflow
firstVirtualStep := &WorkflowStepResV2{
Type: stepType,
OperationTime: &record.CreatedAt,
- OperationUser: workflow.CreateUserName(),
+ OperationUser: dms.GetUserNameWithDelTag(workflow.CreateUserId),
}
steps = append(steps, firstVirtualStep)
@@ -1231,54 +1235,8 @@ func convertWorkflowStepToRes(step *model.WorkflowStep) *WorkflowStepResV2 {
State: step.State,
Reason: step.Reason,
Users: []string{},
+ OperationUser: dms.GetUserNameWithDelTag(step.OperationUserId),
}
- if step.OperationUser != nil {
- stepRes.OperationUser = step.OperationUser.Name
- }
- if step.Assignees != nil {
- for _, user := range step.Assignees {
- stepRes.Users = append(stepRes.Users, user.Name)
- }
- }
+ stepRes.Users = append(stepRes.Users, strings.Split(step.Assignees, ",")...)
return stepRes
}
-
-func CheckCurrentUserCanViewWorkflow(c echo.Context, workflowID, projectName string) error {
- userName := controller.GetUserName(c)
- s := model.GetStorage()
- isManager, err := s.IsProjectManager(userName, projectName)
- if err != nil {
- return err
- }
- if userName == model.DefaultAdminUser || isManager {
- return nil
- }
- user, err := controller.GetCurrentUser(c)
- if err != nil {
- return err
- }
- workflow, _, err := s.GetWorkflowByProjectNameAndWorkflowId(projectName, workflowID)
- if err != nil {
- return err
- }
-
- access, err := s.UserCanAccessWorkflow(user, workflow)
- if err != nil {
- return err
- }
- if access {
- return nil
- }
- instances, err := s.GetInstancesByWorkflowID(workflow.ID)
- if err != nil {
- return err
- }
- ok, err := s.CheckUserHasOpToAnyInstance(user, instances, []uint{model.OP_WORKFLOW_VIEW_OTHERS})
- if err != nil {
- return err
- }
- if ok {
- return nil
- }
- return v1.ErrWorkflowNoAccess
-}
diff --git a/sqle/api/middleware/jwt.go b/sqle/api/middleware/jwt.go
index 9171d8d625..b0d2be792d 100644
--- a/sqle/api/middleware/jwt.go
+++ b/sqle/api/middleware/jwt.go
@@ -1,14 +1,16 @@
package middleware
import (
+ "context"
"errors"
"fmt"
"net/http"
"strings"
+ dmsCommonJwt "github.com/actiontech/dms/pkg/dms-common/api/jwt"
+ "github.com/actiontech/sqle/sqle/dms"
"github.com/actiontech/sqle/sqle/model"
"github.com/actiontech/sqle/sqle/utils"
-
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
@@ -25,11 +27,10 @@ func JWTTokenAdapter() echo.MiddlewareFunc {
}
// sqle-token为空时,可能是cookie过期被清理了,希望返回的错误是http.StatusUnauthorized
// 但sqle-token为空时jwt返回的错误是http.StatusBadRequest
- _, err := c.Cookie("sqle-token")
+ _, err := c.Cookie("dms-token")
if err == http.ErrNoCookie && auth == "" {
- return echo.NewHTTPError(http.StatusUnauthorized, "can not find sqle-token")
+ return echo.NewHTTPError(http.StatusUnauthorized, "can not find dms-token")
}
-
return next(c)
}
}
@@ -38,7 +39,7 @@ func JWTTokenAdapter() echo.MiddlewareFunc {
func JWTWithConfig(key interface{}) echo.MiddlewareFunc {
c := middleware.DefaultJWTConfig
c.SigningKey = key
- c.TokenLookup = "cookie:sqle-token,header:Authorization" // tell the middleware where to get token: from cookie and header
+ c.TokenLookup = "cookie:dms-token,header:Authorization" // tell the middleware where to get token: from cookie and header
return middleware.JWTWithConfig(c)
}
@@ -58,11 +59,15 @@ func ScannerVerifier() echo.MiddlewareFunc {
token = parts[1]
}
- apnInToken, err := utils.ParseAuditPlanName(token)
+ apnInToken, err := dmsCommonJwt.ParseAuditPlanName(token)
+ if err != nil {
+ return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
+ }
+
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
}
- projectName := c.Param("project_name")
apnInParam := c.Param("audit_plan_name")
// 由于对生成的JWT Token的负载使用MD5算法进行预处理,因此在验证的时候也需要对param中的apn使用MD5处理
// 为了兼容老版本的JWT Token需要增加不经MD5处理的apnInParam和apnInToken的判断
@@ -70,7 +75,7 @@ func ScannerVerifier() echo.MiddlewareFunc {
return echo.NewHTTPError(http.StatusInternalServerError, errAuditPlanMisMatch.Error())
}
- apn, apnExist, err := model.GetStorage().GetAuditPlanFromProjectByName(projectName, apnInParam)
+ apn, apnExist, err := model.GetStorage().GetAuditPlanFromProjectByName(projectUid, apnInParam)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
}
diff --git a/sqle/api/middleware/jwt_test.go b/sqle/api/middleware/jwt_test.go
index 6d4fdbb439..8b97f89a4c 100644
--- a/sqle/api/middleware/jwt_test.go
+++ b/sqle/api/middleware/jwt_test.go
@@ -2,13 +2,18 @@ package middleware
import (
"database/sql/driver"
+ "encoding/json"
"fmt"
+ "log"
"net/http"
"net/http/httptest"
"testing"
"time"
sqlmock "github.com/DATA-DOG/go-sqlmock"
+ dmsCommon "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+ dmsCommonJwt "github.com/actiontech/dms/pkg/dms-common/api/jwt"
+ "github.com/actiontech/sqle/sqle/api/controller"
"github.com/actiontech/sqle/sqle/model"
"github.com/actiontech/sqle/sqle/utils"
"github.com/jinzhu/gorm"
@@ -17,12 +22,42 @@ import (
"github.com/stretchr/testify/assert"
)
+func mockServer() *httptest.Server {
+ f := func(w http.ResponseWriter, r *http.Request) {
+ response := dmsCommon.ListProjectReply{
+ Data: []*dmsCommon.ListProject{{
+ ProjectUid: "700300",
+ Name: "default",
+ Archived: false,
+ }},
+ Total: 1,
+ }
+ res, err := json.Marshal(response)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ log.Printf("response err %v", err)
+ return
+ }
+ w.WriteHeader(http.StatusOK)
+ w.Header().Set("Content-Type", "application/json")
+
+ _, err = w.Write(res)
+ if err != nil {
+ log.Printf("response err %v ", err)
+ }
+ }
+ return httptest.NewServer(http.HandlerFunc(f))
+}
+
func TestScannerVerifier(t *testing.T) {
+ server := mockServer()
+ defer server.Close()
+ controller.InitDMSServerAddress(server.URL)
+
e := echo.New()
- jwt := utils.NewJWT(utils.JWTSecretKey)
apName := "test_audit_plan"
- projectName := "test_project"
+ projectUID := "700300"
testUser := "test_user"
h := func(c echo.Context) error {
@@ -37,12 +72,12 @@ func TestScannerVerifier(t *testing.T) {
res := httptest.NewRecorder()
ctx := e.NewContext(req, res)
ctx.SetParamNames("audit_plan_name", "project_name")
- ctx.SetParamValues(apName, projectName)
+ ctx.SetParamValues(apName, projectUID)
return ctx, res
}
{ // test audit plan name don't match the token
- token, err := jwt.CreateToken(testUser, time.Now().Add(1*time.Hour).Unix(), utils.WithAuditPlanName(apName))
+ token, err := dmsCommonJwt.GenJwtToken(dmsCommonJwt.WithUserName(testUser), dmsCommonJwt.WithExpiredTime(1*time.Hour), dmsCommonJwt.WithAuditPlanName(apName))
assert.NoError(t, err)
ctx, _ := newContextFunc(token, fmt.Sprintf("%s_modified", apName))
err = mw(h)(ctx)
@@ -50,7 +85,7 @@ func TestScannerVerifier(t *testing.T) {
}
{ // test unknown token
- token, err := jwt.CreateToken(testUser, time.Now().Add(1*time.Hour).Unix())
+ token, err := dmsCommonJwt.GenJwtToken(dmsCommonJwt.WithUserName(testUser), dmsCommonJwt.WithExpiredTime(1*time.Hour))
assert.NoError(t, err)
ctx, _ := newContextFunc(token, apName)
err = mw(h)(ctx)
@@ -58,14 +93,14 @@ func TestScannerVerifier(t *testing.T) {
}
{ // test audit plan token incorrect
- token, err := jwt.CreateToken(testUser, time.Now().Add(1*time.Hour).Unix(), utils.WithAuditPlanName(apName))
+ token, err := dmsCommonJwt.GenJwtToken(dmsCommonJwt.WithUserName(testUser), dmsCommonJwt.WithExpiredTime(1*time.Hour), dmsCommonJwt.WithAuditPlanName(apName))
assert.NoError(t, err)
mockDB, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
assert.NoError(t, err)
model.InitMockStorage(mockDB)
- mock.ExpectQuery("SELECT `audit_plans`.* FROM `audit_plans` LEFT JOIN projects ON projects.id = audit_plans.project_id WHERE `audit_plans`.`deleted_at` IS NULL AND ((projects.name = ? AND audit_plans.name = ?))").
- WithArgs(projectName, apName).
+ mock.ExpectQuery("SELECT * FROM `audit_plans` WHERE `audit_plans`.`deleted_at` IS NULL AND ((project_id = ? AND name = ?))").
+ WithArgs(projectUID, apName).
WillReturnRows(sqlmock.NewRows([]string{"name", "token"}).AddRow(driver.Value(testUser), "test-token"))
mock.ExpectClose()
@@ -79,14 +114,14 @@ func TestScannerVerifier(t *testing.T) {
}
{ // test audit plan not found
- token, err := jwt.CreateToken(testUser, time.Now().Add(1*time.Hour).Unix(), utils.WithAuditPlanName(apName))
+ token, err := dmsCommonJwt.GenJwtToken(dmsCommonJwt.WithUserName(testUser), dmsCommonJwt.WithExpiredTime(1*time.Hour), dmsCommonJwt.WithAuditPlanName(apName))
assert.NoError(t, err)
mockDB, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
assert.NoError(t, err)
model.InitMockStorage(mockDB)
- mock.ExpectQuery("SELECT `audit_plans`.* FROM `audit_plans` LEFT JOIN projects ON projects.id = audit_plans.project_id WHERE `audit_plans`.`deleted_at` IS NULL AND ((projects.name = ? AND audit_plans.name = ?))").
- WithArgs(projectName, apName).
+ mock.ExpectQuery("SELECT * FROM `audit_plans` WHERE `audit_plans`.`deleted_at` IS NULL AND ((project_id = ? AND name = ?))").
+ WithArgs(projectUID, apName).
WillReturnError(gorm.ErrRecordNotFound)
assert.NoError(t, err)
model.InitMockStorage(mockDB)
@@ -102,14 +137,14 @@ func TestScannerVerifier(t *testing.T) {
}
{ // test check success
- token, err := jwt.CreateToken(testUser, time.Now().Add(1*time.Hour).Unix(), utils.WithAuditPlanName(apName))
+ token, err := dmsCommonJwt.GenJwtToken(dmsCommonJwt.WithUserName(testUser), dmsCommonJwt.WithExpiredTime(1*time.Hour), dmsCommonJwt.WithAuditPlanName(apName))
assert.NoError(t, err)
mockDB, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
assert.NoError(t, err)
model.InitMockStorage(mockDB)
- mock.ExpectQuery("SELECT `audit_plans`.* FROM `audit_plans` LEFT JOIN projects ON projects.id = audit_plans.project_id WHERE `audit_plans`.`deleted_at` IS NULL AND ((projects.name = ? AND audit_plans.name = ?))").
- WithArgs(projectName, apName).
+ mock.ExpectQuery("SELECT * FROM `audit_plans` WHERE `audit_plans`.`deleted_at` IS NULL AND ((project_id = ? AND name = ?))").
+ WithArgs(projectUID, apName).
WillReturnRows(sqlmock.NewRows([]string{"name", "token"}).AddRow(testUser, token))
mock.ExpectClose()
@@ -124,14 +159,14 @@ func TestScannerVerifier(t *testing.T) {
}
{ // test default auth scheme success
- token, err := jwt.CreateToken(testUser, time.Now().Add(1*time.Hour).Unix(), utils.WithAuditPlanName(apName))
+ token, err := dmsCommonJwt.GenJwtToken(dmsCommonJwt.WithUserName(testUser), dmsCommonJwt.WithExpiredTime(1*time.Hour), dmsCommonJwt.WithAuditPlanName(apName))
assert.NoError(t, err)
mockDB, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
assert.NoError(t, err)
model.InitMockStorage(mockDB)
- mock.ExpectQuery("SELECT `audit_plans`.* FROM `audit_plans` LEFT JOIN projects ON projects.id = audit_plans.project_id WHERE `audit_plans`.`deleted_at` IS NULL AND ((projects.name = ? AND audit_plans.name = ?))").
- WithArgs(projectName, apName).
+ mock.ExpectQuery("SELECT * FROM `audit_plans` WHERE `audit_plans`.`deleted_at` IS NULL AND ((project_id = ? AND name = ?))").
+ WithArgs(projectUID, apName).
WillReturnRows(sqlmock.NewRows([]string{"name", "token"}).AddRow(testUser, token))
mock.ExpectClose()
@@ -148,11 +183,14 @@ func TestScannerVerifier(t *testing.T) {
}
func TestScannerVerifierIssue1758(t *testing.T) {
+ server := mockServer()
+ defer server.Close()
+ controller.InitDMSServerAddress(server.URL)
e := echo.New()
jwt := utils.NewJWT(utils.JWTSecretKey)
apName120 := "test_name_length_120_000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
- projectName := "default"
+ projectUid := "700300"
userName := "admin"
assert.Equal(t, 120, len(apName120))
h := func(c echo.Context) error {
@@ -166,18 +204,18 @@ func TestScannerVerifierIssue1758(t *testing.T) {
res := httptest.NewRecorder()
ctx := e.NewContext(req, res)
ctx.SetParamNames("audit_plan_name", "project_name")
- ctx.SetParamValues(apName, projectName)
+ ctx.SetParamValues(apName, projectUid)
return ctx, res
}
{ // test check success
- token, err := jwt.CreateToken(utils.Md5(userName), time.Now().Add(1*time.Hour).Unix(), utils.WithAuditPlanName(utils.Md5(apName120)))
+ token, err := dmsCommonJwt.GenJwtToken(dmsCommonJwt.WithUserName(utils.Md5(userName)), dmsCommonJwt.WithExpiredTime(1*time.Hour), dmsCommonJwt.WithAuditPlanName(utils.Md5(apName120)))
assert.NoError(t, err)
mockDB, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
assert.NoError(t, err)
model.InitMockStorage(mockDB)
- mock.ExpectQuery("SELECT `audit_plans`.* FROM `audit_plans` LEFT JOIN projects ON projects.id = audit_plans.project_id WHERE `audit_plans`.`deleted_at` IS NULL AND ((projects.name = ? AND audit_plans.name = ?))").
- WithArgs(projectName, apName120).
+ mock.ExpectQuery("SELECT * FROM `audit_plans` WHERE `audit_plans`.`deleted_at` IS NULL AND ((project_id = ? AND name = ?))").
+ WithArgs(projectUid, apName120).
WillReturnRows(sqlmock.NewRows([]string{"name", "token"}).AddRow(userName, token))
mock.ExpectClose()
@@ -210,8 +248,8 @@ func TestScannerVerifierIssue1758(t *testing.T) {
mockDB, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
assert.NoError(t, err)
model.InitMockStorage(mockDB)
- mock.ExpectQuery("SELECT `audit_plans`.* FROM `audit_plans` LEFT JOIN projects ON projects.id = audit_plans.project_id WHERE `audit_plans`.`deleted_at` IS NULL AND ((projects.name = ? AND audit_plans.name = ?))").
- WithArgs(projectName, apName120).
+ mock.ExpectQuery("SELECT * FROM `audit_plans` WHERE `audit_plans`.`deleted_at` IS NULL AND ((project_id = ? AND name = ?))").
+ WithArgs(projectUid, apName120).
WillReturnRows(sqlmock.NewRows([]string{"name", "token"}).AddRow(userName, token))
mock.ExpectClose()
diff --git a/sqle/api/middleware/license.go b/sqle/api/middleware/license.go
deleted file mode 100644
index d8cd0152dc..0000000000
--- a/sqle/api/middleware/license.go
+++ /dev/null
@@ -1,8 +0,0 @@
-package middleware
-
-import "github.com/labstack/echo/v4"
-
-func LicenseAdapter() echo.MiddlewareFunc {
- //nolint:typecheck
- return licenseAdapter()
-}
diff --git a/sqle/api/middleware/license_qa.go b/sqle/api/middleware/license_qa.go
deleted file mode 100644
index 155b471f0b..0000000000
--- a/sqle/api/middleware/license_qa.go
+++ /dev/null
@@ -1,16 +0,0 @@
-//go:build !release
-// +build !release
-
-package middleware
-
-import (
- "github.com/labstack/echo/v4"
-)
-
-func licenseAdapter() echo.MiddlewareFunc {
- return func(next echo.HandlerFunc) echo.HandlerFunc {
- return func(c echo.Context) error {
- return next(c)
- }
- }
-}
diff --git a/sqle/api/middleware/permission.go b/sqle/api/middleware/permission.go
new file mode 100644
index 0000000000..e866e83377
--- /dev/null
+++ b/sqle/api/middleware/permission.go
@@ -0,0 +1,77 @@
+package middleware
+
+import (
+ "context"
+ "net/http"
+
+ dmsJWT "github.com/actiontech/dms/pkg/dms-common/api/jwt"
+ "github.com/actiontech/sqle/sqle/api/controller"
+ "github.com/actiontech/sqle/sqle/dms"
+ "github.com/labstack/echo/v4"
+)
+
+// AdminUserAllowed is a `echo` middleware, only allow admin user to access next.
+func AdminUserAllowed() echo.MiddlewareFunc {
+ return func(next echo.HandlerFunc) echo.HandlerFunc {
+ return func(c echo.Context) error {
+ uid, err := dmsJWT.GetUserUidStrFromContextWithOldJwt(c)
+ if err != nil {
+ return echo.NewHTTPError(http.StatusForbidden)
+ }
+ up, err := dms.NewUserPermission(uid, "700300" /*TODO 支持不传空间 */)
+ if err != nil {
+ return echo.NewHTTPError(http.StatusForbidden)
+ }
+ if up.IsAdmin() {
+ return next(c)
+ }
+ return echo.NewHTTPError(http.StatusForbidden)
+ }
+ }
+}
+
+func ProjectAdminUserAllowed() echo.MiddlewareFunc {
+ return func(next echo.HandlerFunc) echo.HandlerFunc {
+ return func(c echo.Context) error {
+ uid, err := dmsJWT.GetUserUidStrFromContextWithOldJwt(c)
+ if err != nil {
+ return echo.NewHTTPError(http.StatusForbidden)
+ }
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ up, err := dms.NewUserPermission(uid, projectUid)
+ if err != nil {
+ return echo.NewHTTPError(http.StatusForbidden)
+ }
+ if up.IsAdmin() || up.IsProjectAdmin() {
+ return next(c)
+ }
+ return echo.NewHTTPError(http.StatusForbidden)
+ }
+ }
+}
+
+func ProjectMemberAllowed() echo.MiddlewareFunc {
+ return func(next echo.HandlerFunc) echo.HandlerFunc {
+ return func(c echo.Context) error {
+ uid, err := dmsJWT.GetUserUidStrFromContextWithOldJwt(c)
+ if err != nil {
+ return echo.NewHTTPError(http.StatusForbidden)
+ }
+ projectUid, err := dms.GetPorjectUIDByName(context.TODO(), c.Param("project_name"))
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
+ }
+ up, err := dms.NewUserPermission(uid, projectUid)
+ if err != nil {
+ return echo.NewHTTPError(http.StatusForbidden)
+ }
+ if up.IsAdmin() || up.IsProjectAdmin() || up.IsProjectMember() {
+ return next(c)
+ }
+ return echo.NewHTTPError(http.StatusForbidden)
+ }
+ }
+}
diff --git a/sqle/api/middleware/verify_user.go b/sqle/api/middleware/verify_user.go
index b346b0c71f..73e3865768 100644
--- a/sqle/api/middleware/verify_user.go
+++ b/sqle/api/middleware/verify_user.go
@@ -1,26 +1,27 @@
package middleware
import (
+ v1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+ dmsJWT "github.com/actiontech/dms/pkg/dms-common/api/jwt"
+ dmsObject "github.com/actiontech/dms/pkg/dms-common/dmsobject"
"github.com/actiontech/sqle/sqle/api/controller"
"github.com/actiontech/sqle/sqle/errors"
- "github.com/actiontech/sqle/sqle/model"
-
"github.com/labstack/echo/v4"
)
func VerifyUserIsDisabled() echo.MiddlewareFunc {
return func(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
- userName := controller.GetUserName(c)
- user, isExist, err := model.GetStorage().GetUserByName(userName)
+ uid, err := dmsJWT.GetUserUidStrFromContextWithOldJwt(c)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
- if !isExist {
- return controller.JSONBaseErrorReq(c, errors.NewDataInvalidErr("user is not exist"))
+ user, err := dmsObject.GetUser(c.Request().Context(), uid, controller.GetDMSServerAddress())
+ if err != nil {
+ return controller.JSONBaseErrorReq(c, err)
}
- if user.IsDisabled() {
- return controller.JSONBaseErrorReq(c, errors.NewUserDisabledErr("current user is disabled"))
+ if user.Stat != v1.StatOK {
+ return controller.JSONBaseErrorReq(c, errors.NewUserDisabledErr("current user status is %s", user.Stat))
}
return next(c)
}
diff --git a/sqle/cmd/sqled/gen_secret_pass.go b/sqle/cmd/sqled/gen_secret_pass.go
index 6074981b0b..f147543b66 100644
--- a/sqle/cmd/sqled/gen_secret_pass.go
+++ b/sqle/cmd/sqled/gen_secret_pass.go
@@ -5,16 +5,15 @@ import (
"io/ioutil"
"os"
+ dmsCommonAes "github.com/actiontech/dms/pkg/dms-common/pkg/aes"
"github.com/actiontech/sqle/sqle/config"
- "github.com/actiontech/sqle/sqle/utils"
-
"github.com/spf13/cobra"
yaml "gopkg.in/yaml.v2"
)
func genSecretPasswordCmd() *cobra.Command {
run := func() error {
- var cfg = &config.Config{}
+ var cfg = &config.SqleOptions{}
if configPath != "" {
b, err := ioutil.ReadFile(configPath)
if err != nil {
@@ -25,23 +24,23 @@ func genSecretPasswordCmd() *cobra.Command {
return fmt.Errorf("unmarshal config file error %v", err)
}
- secretKey := cfg.Server.SqleCnf.SecretKey
+ secretKey := cfg.SecretKey
if secretKey != "" {
- if err := utils.SetSecretKey([]byte(secretKey)); err != nil {
+ if err = dmsCommonAes.ResetAesSecretKey(secretKey); err != nil {
return fmt.Errorf("set secret key error, %v, check your secret key in config file", err)
}
}
- password := cfg.Server.DBCnf.MysqlCnf.Password
+ password := cfg.Service.Database.Password
if password == "" {
return fmt.Errorf("mysql_password is empty")
}
- secretPassword, err := utils.AesEncrypt(password)
+ secretPassword, err := dmsCommonAes.AesEncrypt(password)
if err != nil {
return fmt.Errorf("gen secret password error, %d", err)
}
- cfg.Server.DBCnf.MysqlCnf.SecretPassword = secretPassword
- cfg.Server.DBCnf.MysqlCnf.Password = ""
+ cfg.Service.Database.SecretPassword = secretPassword
+ cfg.Service.Database.Password = ""
} else {
return fmt.Errorf("--config is required")
}
diff --git a/sqle/cmd/sqled/sqled.go b/sqle/cmd/sqled/sqled.go
index 838b509546..af106d0795 100644
--- a/sqle/cmd/sqled/sqled.go
+++ b/sqle/cmd/sqled/sqled.go
@@ -5,11 +5,11 @@ import (
"io/ioutil"
"os"
+ dmsCommonConf "github.com/actiontech/dms/pkg/dms-common/conf"
sqled "github.com/actiontech/sqle/sqle"
"github.com/actiontech/sqle/sqle/config"
"github.com/actiontech/sqle/sqle/log"
"github.com/actiontech/sqle/sqle/utils"
-
"github.com/spf13/cobra"
yaml "gopkg.in/yaml.v2"
)
@@ -17,7 +17,7 @@ import (
var version string
var port int
-//var user string
+// var user string
var mysqlUser string
var mysqlPass string
var mysqlHost string
@@ -77,7 +77,7 @@ func main() {
}
func run(cmd *cobra.Command, _ []string) error {
- var cfg = &config.Config{}
+ var cfg = &config.Options{}
// read config from file first, then read from cmd args.
if configPath != "" {
@@ -89,28 +89,29 @@ func run(cmd *cobra.Command, _ []string) error {
if err != nil {
return fmt.Errorf("unmarshal config file error %v", err)
}
-
} else {
mysqlPass, err := utils.DecodeString(mysqlPass)
if err != nil {
return fmt.Errorf("decode mysql password to string error : %v", err)
}
- cfg = &config.Config{
- Server: config.Server{
- SqleCnf: config.SqleConfig{
- SqleServerPort: port,
+ cfg = &config.Options{
+ SqleOptions: config.SqleOptions{
+ BaseOptions: dmsCommonConf.BaseOptions{
+ APIServiceOpts: &dmsCommonConf.APIServerOpts{
+ Port: port,
+ EnableHttps: httpsEnable,
+ CertFilePath: certFilePath,
+ KeyFilePath: keyFilePath,
+ },
+ },
+ Service: config.SeviceOpts{
AutoMigrateTable: autoMigrateTable,
DebugLog: debug,
LogPath: logPath,
LogMaxSizeMB: logMaxSizeMB,
LogMaxBackupNumber: logMaxBackupNumber,
- EnableHttps: httpsEnable,
- CertFilePath: certFilePath,
- KeyFilePath: keyFilePath,
PluginPath: pluginPath,
- },
- DBCnf: config.DatabaseConfig{
- MysqlCnf: config.MysqlConfig{
+ Database: config.Database{
Host: mysqlHost,
Port: mysqlPort,
User: mysqlUser,
@@ -132,5 +133,5 @@ func run(cmd *cobra.Command, _ []string) error {
os.Remove(pidFile)
}()
}
- return sqled.Run(cfg)
+ return sqled.Run(&cfg.SqleOptions)
}
diff --git a/sqle/common/instance.go b/sqle/common/instance.go
index bfc50989b6..d198f35c60 100644
--- a/sqle/common/instance.go
+++ b/sqle/common/instance.go
@@ -23,7 +23,7 @@ func CheckInstanceIsConnectable(instance *model.Instance) error {
return nil
}
-func CheckDeleteInstance(instanceId uint) error {
+func CheckDeleteInstance(instanceId int64) error {
s := model.GetStorage()
isUnFinished, err := s.IsWorkflowUnFinishedByInstanceId(instanceId)
diff --git a/sqle/config/config.go b/sqle/config/config.go
index 38085d26b8..03159e3bf6 100644
--- a/sqle/config/config.go
+++ b/sqle/config/config.go
@@ -1,37 +1,29 @@
package config
-type Config struct {
- Server Server `yaml:"server"`
-}
+import dmsCommonConf "github.com/actiontech/dms/pkg/dms-common/conf"
-type Server struct {
- SqleCnf SqleConfig `yaml:"sqle_config"`
- DBCnf DatabaseConfig `yaml:"db_config"`
- SQLQueryConfig SQLQueryConfig `yaml:"sql_query_config"`
- PluginConfig []PluginConfig `yaml:"plugin_config"`
+type Options struct {
+ SqleOptions SqleOptions `yaml:"sqle"`
}
-
-type SqleConfig struct {
- ServerId string `yaml:"server_id"`
- EnableClusterMode bool `yaml:"enable_cluster_mode"`
- SqleServerPort int `yaml:"server_port"`
- EnableHttps bool `yaml:"enable_https"`
- CertFilePath string `yaml:"cert_file_path"`
- KeyFilePath string `yaml:"key_file_path"`
- AutoMigrateTable bool `yaml:"auto_migrate_table"`
- DebugLog bool `yaml:"debug_log"`
- LogPath string `yaml:"log_path"`
- LogMaxSizeMB int `yaml:"log_max_size_mb"`
- LogMaxBackupNumber int `yaml:"log_max_backup_number"`
- PluginPath string `yaml:"plugin_path"`
- SecretKey string `yaml:"secret_key"`
+type SqleOptions struct {
+ dmsCommonConf.BaseOptions `yaml:",inline"`
+ DMSServerAddress string `yaml:"dms_server_address"`
+ Service SeviceOpts `yaml:"service"`
}
-type DatabaseConfig struct {
- MysqlCnf MysqlConfig `yaml:"mysql_cnf"`
+type SeviceOpts struct {
+ EnableClusterMode bool `yaml:"enable_cluster_mode"`
+ AutoMigrateTable bool `yaml:"auto_migrate_table"`
+ DebugLog bool `yaml:"debug_log"`
+ LogPath string `yaml:"log_path"`
+ LogMaxSizeMB int `yaml:"log_max_size_mb"`
+ LogMaxBackupNumber int `yaml:"log_max_backup_number"`
+ PluginPath string `yaml:"plugin_path"`
+ Database Database `yaml:"database"`
+ PluginConfig []PluginConfig `yaml:"plugin_config"`
}
-type MysqlConfig struct {
+type Database struct {
Host string `yaml:"mysql_host"`
Port string `yaml:"mysql_port"`
User string `yaml:"mysql_user"`
@@ -40,14 +32,6 @@ type MysqlConfig struct {
Schema string `yaml:"mysql_schema"`
}
-type SQLQueryConfig struct {
- EnableHttps bool `yaml:"enable_https"`
- CloudBeaverHost string `yaml:"cloud_beaver_host"`
- CloudBeaverPort string `yaml:"cloud_beaver_port"`
- CloudBeaverAdminUser string `yaml:"cloud_beaver_admin_user"`
- CloudBeaverAdminPassword string `yaml:"cloud_beaver_admin_password"`
-}
-
type PluginConfig struct {
PluginName string `yaml:"plugin_name"`
CMD string `yaml:"cmd"`
diff --git a/sqle/dms/common.go b/sqle/dms/common.go
new file mode 100644
index 0000000000..8d57d969c6
--- /dev/null
+++ b/sqle/dms/common.go
@@ -0,0 +1,215 @@
+package dms
+
+import (
+ "context"
+ "fmt"
+ "strconv"
+ "strings"
+ "time"
+
+ dmsV1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+ "github.com/actiontech/dms/pkg/dms-common/dmsobject"
+ dmsRegister "github.com/actiontech/dms/pkg/dms-common/register"
+ "github.com/actiontech/sqle/sqle/api/controller"
+ "github.com/actiontech/sqle/sqle/config"
+ "github.com/actiontech/sqle/sqle/log"
+ "github.com/actiontech/sqle/sqle/model"
+)
+
+func GetAllUsers(ctx context.Context, dmsAddr string) ([]*model.User, error) {
+ ret := make([]*model.User, 0)
+ for pageIndex, pageSize := 1, 10; ; pageIndex++ {
+ users, _, err := dmsobject.ListUsers(ctx, controller.GetDMSServerAddress(), dmsV1.ListUserReq{PageSize: uint32(pageSize), PageIndex: uint32(pageIndex), FilterDeletedUser: true})
+ if err != nil {
+ return nil, err
+ }
+ for _, user := range users {
+ ret = append(ret, convertListUserToModel(user))
+ }
+ if len(users) < pageSize {
+ break
+ }
+ }
+ return ret, nil
+}
+
+func GetMapUsers(ctx context.Context, userUid []string, dmsAddr string) (map[string] /*user_id*/ *model.User, error) {
+ users, err := GetUsers(ctx, userUid, dmsAddr)
+ if err != nil {
+ return nil, err
+ }
+ ret := make(map[string]*model.User)
+ for _, user := range users {
+ ret[user.GetIDStr()] = user
+ }
+ if len(users) == 0 {
+ return nil, fmt.Errorf("cant't find any users")
+ }
+ return ret, nil
+}
+
+func GetUsers(ctx context.Context, userUid []string, dmsAddr string) ([]*model.User, error) {
+ users, _, err := dmsobject.ListUsers(ctx, controller.GetDMSServerAddress(), dmsV1.ListUserReq{PageSize: 999, PageIndex: 1, FilterDeletedUser: true, FilterByUids: strings.Join(userUid, ",")})
+ if err != nil {
+ return nil, err
+ }
+ ret := make([]*model.User, 0)
+ for _, user := range users {
+ ret = append(ret, convertListUserToModel(user))
+ }
+ return ret, nil
+}
+
+func convertListUserToModel(user *dmsV1.ListUser) *model.User {
+ id, _ := strconv.Atoi(user.UserUid)
+ model_ := model.Model{ID: uint(id)}
+ if user.IsDeleted {
+ // 仅记录为已删除
+ model_.DeletedAt = &time.Time{}
+ }
+ ret := &model.User{
+ Model: model_,
+ Name: user.Name,
+ Email: user.Email,
+ Phone: user.Phone,
+ WeChatID: user.WxID,
+ }
+ if user.Stat != dmsV1.StatOK {
+ ret.Stat = 1
+ }
+ return ret
+}
+
+func GetUser(ctx context.Context, userUid string, dmsAddr string) (*model.User, error) {
+ dmsUser, err := dmsobject.GetUser(ctx, userUid, dmsAddr)
+ if err != nil {
+ return nil, err
+ }
+ return convertUserToModel(dmsUser), nil
+
+}
+
+func convertUserToModel(user *dmsV1.GetUser) *model.User {
+ id, _ := strconv.Atoi(user.UserUid)
+ model_ := model.Model{ID: uint(id)}
+ ret := &model.User{
+ Model: model_,
+ Name: user.Name,
+ Email: user.Email,
+ Phone: user.Phone,
+ WeChatID: user.WxID,
+ }
+ if user.Stat != dmsV1.StatOK {
+ ret.Stat = 1
+ }
+ return ret
+}
+
+// dms-todo: 1. 缓存 user 信息;2. 后续考虑所有需要name的接口返回 user id + name 组合的形式
+func GetUserNameWithDelTag(userId string) string {
+ if userId == "" {
+ return ""
+ }
+ users, _, err := dmsobject.ListUsers(context.TODO(), controller.GetDMSServerAddress(), dmsV1.ListUserReq{PageSize: 1, PageIndex: 1, FilterDeletedUser: true, FilterByUids: userId})
+ if err != nil {
+ log.NewEntry().WithField("user_id", userId).Errorln("fail to get user from dms")
+ return ""
+ }
+ if len(users) == 0 {
+ return ""
+ }
+ user := users[0]
+
+ if user.IsDeleted {
+ return fmt.Sprintf("%s[x]", user.Name)
+ }
+ return user.Name
+}
+
+// dms-todo: 临时方案
+func GetPorjectUIDByName(ctx context.Context, projectName string, needActive ...bool) (projectUID string, err error) {
+ project, err := GetPorjectByName(ctx, projectName)
+ if err != nil {
+ return "", err
+ }
+
+ if len(needActive) == 1 && needActive[0] && project.Archived {
+ return "", fmt.Errorf("project is archived")
+ }
+ return project.ProjectUid, nil
+}
+
+func GetPorjectByName(ctx context.Context, projectName string) (project *dmsV1.ListProject, err error) {
+ ret, total, err := dmsobject.ListProjects(ctx, controller.GetDMSServerAddress(), dmsV1.ListProjectReq{
+ PageSize: 1,
+ PageIndex: 1,
+ FilterByName: projectName,
+ })
+ if err != nil {
+ return nil, err
+ }
+ if total == 0 || len(ret) == 0 {
+ return nil, fmt.Errorf("project %s not found", projectName)
+ }
+
+ return ret[0], nil
+}
+
+func GetProjects() ([]string, error) {
+ projectIds := make([]string, 0)
+ projects, _, err := dmsobject.ListProjects(context.Background(), controller.GetDMSServerAddress(), dmsV1.ListProjectReq{
+ PageSize: 9999,
+ PageIndex: 1,
+ })
+ if err != nil {
+ return nil, err
+ }
+ for _, namespce := range projects {
+ projectIds = append(projectIds, namespce.ProjectUid)
+ }
+ return projectIds, nil
+}
+
+func RegisterAsDMSTarget(sqleConfig *config.SqleOptions) error {
+ controller.InitDMSServerAddress(sqleConfig.DMSServerAddress)
+ InitDMSServerAddress(sqleConfig.DMSServerAddress)
+ ctx := context.Background()
+
+ // 向DMS注册反向代理
+ if err := dmsRegister.RegisterDMSProxyTarget(ctx, controller.GetDMSServerAddress(), "sqle", fmt.Sprintf("http://%v:%v", sqleConfig.APIServiceOpts.Addr, sqleConfig.APIServiceOpts.Port) /* TODO https的处理*/, config.Version, []string{"/sqle/v"}); nil != err {
+ return fmt.Errorf("failed to register dms proxy target: %v", err)
+ }
+ // 注册校验接口
+ if err := dmsRegister.RegisterDMSPlugin(ctx, controller.GetDMSServerAddress(), &dmsV1.Plugin{
+ Name: "sqle",
+ OperateDataResourceHandleUrl: fmt.Sprintf("http://%s:%d/%s/%s", sqleConfig.APIServiceOpts.Addr, sqleConfig.APIServiceOpts.Port, "v1", "data_resource/handle"),
+ }); err != nil {
+ return fmt.Errorf("failed to register dms plugin for operation data source handle")
+ }
+
+ return nil
+}
+
+func ListProjectUserTips(ctx context.Context, projectUid string) (users []*model.User, err error) {
+ dmsUsers, _, err := dmsobject.ListMembersInProject(ctx, controller.GetDMSServerAddress(), dmsV1.ListMembersForInternalReq{
+ PageSize: 999,
+ PageIndex: 1,
+ ProjectUid: projectUid,
+ })
+ if err != nil {
+ return nil, fmt.Errorf("get user from dms error: %v", err)
+ }
+
+ for _, dmsUser := range dmsUsers {
+ id, err := strconv.Atoi(dmsUser.User.Uid)
+ if err != nil {
+ return nil, err
+ }
+ model_ := model.Model{ID: uint(id)}
+ users = append(users, &model.User{
+ Model: model_,
+ Name: dmsUser.User.Name,
+ })
+ }
+ return users, nil
+}
diff --git a/sqle/dms/instance.go b/sqle/dms/instance.go
new file mode 100644
index 0000000000..60c39cee63
--- /dev/null
+++ b/sqle/dms/instance.go
@@ -0,0 +1,469 @@
+package dms
+
+import (
+ "context"
+ "fmt"
+ "strconv"
+ "time"
+
+ dmsV1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+ "github.com/actiontech/dms/pkg/dms-common/dmsobject"
+ dmsCommonAes "github.com/actiontech/dms/pkg/dms-common/pkg/aes"
+ "github.com/actiontech/sqle/sqle/errors"
+ "github.com/actiontech/sqle/sqle/model"
+ "github.com/actiontech/sqle/sqle/pkg/params"
+)
+
+func getInstances(ctx context.Context, req dmsV1.ListDBServiceReq) ([]*model.Instance, error) {
+ var ret = make([]*model.Instance, 0)
+
+ var limit, pageIndex uint32 = 20, 1
+
+ for ; ; pageIndex++ {
+ req.PageIndex = pageIndex
+ req.PageSize = limit
+
+ dbServices, _, err := func() ([]*dmsV1.ListDBService, int64, error) {
+ newCtx, cancel := context.WithTimeout(ctx, 10*time.Second)
+ defer cancel()
+
+ return dmsobject.ListDbServices(newCtx, GetDMSServerAddress(), req)
+ }()
+
+ if err != nil {
+ return nil, fmt.Errorf("get instances from dms error: %v", err)
+ }
+
+ for _, item := range dbServices {
+ if item.SQLEConfig == nil || item.SQLEConfig.RuleTemplateID == "" {
+ continue
+ }
+
+ instance, err := convertInstance(item)
+ if err != nil {
+ return nil, fmt.Errorf("convert instance error: %v", err)
+ }
+
+ ret = append(ret, instance)
+ }
+
+ if len(dbServices) < int(limit) {
+ break
+ }
+ }
+
+ return ret, nil
+}
+
+func getInstance(ctx context.Context, req dmsV1.ListDBServiceReq) (*model.Instance, bool, error) {
+ newCtx, cancel := context.WithTimeout(ctx, 10*time.Second)
+ defer cancel()
+
+ dbServices, total, err := dmsobject.ListDbServices(newCtx, GetDMSServerAddress(), req)
+
+ if err != nil {
+ return nil, false, fmt.Errorf("get instances from dms error: %v", err)
+ }
+
+ if total == 0 {
+ return nil, false, nil
+ }
+
+ instance, err := convertInstance(dbServices[0])
+ if err != nil {
+ return nil, false, fmt.Errorf("convert instance error: %v", err)
+ }
+
+ return instance, true, nil
+}
+
+func convertInstance(instance *dmsV1.ListDBService) (*model.Instance, error) {
+ instanceId, err := strconv.ParseInt(instance.DBServiceUid, 0, 64)
+ if err != nil {
+ return nil, err
+ }
+
+ ruleTemplateId, err := strconv.ParseInt(instance.SQLEConfig.RuleTemplateID, 0, 64)
+ if err != nil {
+ return nil, err
+ }
+
+ var maintenancePeriod = make(model.Periods, 0)
+ for _, item := range instance.MaintenanceTimes {
+ maintenancePeriod = append(maintenancePeriod, &model.Period{
+ StartHour: item.MaintenanceStartTime.Hour,
+ StartMinute: item.MaintenanceStartTime.Minute,
+ EndHour: item.MaintenanceStopTime.Hour,
+ EndMinute: item.MaintenanceStopTime.Minute,
+ })
+ }
+
+ decryptPassword, err := dmsCommonAes.AesDecrypt(instance.Password)
+ if err != nil {
+ return nil, err
+ }
+
+ additionalParams := make(params.Params, 0, len(instance.AdditionalParams))
+ for _, item := range instance.AdditionalParams {
+ additionalParams = append(additionalParams, ¶ms.Param{
+ Key: item.Name,
+ Value: item.Value,
+ Desc: item.Description,
+ Type: params.ParamType(item.Type),
+ })
+ }
+
+ sqlQueryConfig := model.SqlQueryConfig{}
+ if instance.SQLEConfig != nil {
+ sqlQueryConfig = model.SqlQueryConfig{
+ MaxPreQueryRows: instance.SQLEConfig.SQLQueryConfig.MaxPreQueryRows,
+ QueryTimeoutSecond: instance.SQLEConfig.SQLQueryConfig.QueryTimeoutSecond,
+ AuditEnabled: instance.SQLEConfig.SQLQueryConfig.AuditEnabled,
+ AllowQueryWhenLessThanAuditLevel: string(instance.SQLEConfig.SQLQueryConfig.AllowQueryWhenLessThanAuditLevel),
+ }
+ }
+
+ return &model.Instance{
+ ID: uint64(instanceId),
+ Name: instance.Name,
+ DbType: instance.DBType,
+ RuleTemplateId: uint64(ruleTemplateId),
+ RuleTemplateName: instance.SQLEConfig.RuleTemplateName,
+ ProjectId: instance.ProjectUID,
+ MaintenancePeriod: maintenancePeriod,
+ Host: instance.Host,
+ Port: instance.Port,
+ User: instance.User,
+ Password: decryptPassword,
+ Desc: instance.Desc,
+ AdditionalParams: additionalParams,
+ SqlQueryConfig: sqlQueryConfig,
+ }, nil
+}
+
+func GetInstancesInProject(ctx context.Context, projectUid string) ([]*model.Instance, error) {
+ return getInstances(ctx, dmsV1.ListDBServiceReq{
+ ProjectUid: projectUid,
+ })
+}
+
+func GetInstancesInProjectByType(ctx context.Context, projectUid, dbType string) ([]*model.Instance, error) {
+ return getInstances(ctx, dmsV1.ListDBServiceReq{
+ ProjectUid: projectUid,
+ FilterByDBType: dbType,
+ })
+}
+
+func GetInstancesNameInProjectByRuleTemplateName(ctx context.Context, projectUid, ruleTemplateName string) ([]string, error) {
+ instances, err := getInstances(ctx, dmsV1.ListDBServiceReq{
+ ProjectUid: projectUid,
+ })
+
+ if err != nil {
+ return nil, err
+ }
+
+ ret := make([]string, 0)
+ for _, instance := range instances {
+ if instance.RuleTemplateName == ruleTemplateName {
+ ret = append(ret, instance.Name)
+ }
+ }
+
+ return ret, nil
+}
+
+func GetInstancesNameByRuleTemplateName(ctx context.Context, ruleTemplateName string) ([]string, error) {
+ instances, err := getInstances(ctx, dmsV1.ListDBServiceReq{})
+
+ if err != nil {
+ return nil, err
+ }
+
+ ret := make([]string, 0)
+ for _, instance := range instances {
+ if instance.RuleTemplateName == ruleTemplateName {
+ ret = append(ret, instance.Name)
+ }
+ }
+
+ return ret, nil
+}
+
+func GetInstanceInProjectByName(ctx context.Context, projectUid, name string) (*model.Instance, bool, error) {
+ if len(projectUid) == 0 || len(name) == 0 {
+ return nil, false, nil
+ }
+
+ return getInstance(ctx, dmsV1.ListDBServiceReq{
+ PageSize: 1,
+ FilterByName: name,
+ ProjectUid: projectUid,
+ })
+}
+
+func GetInstancesInProjectByNames(ctx context.Context, projectUid string, names []string) (instances []*model.Instance, err error) {
+ for _, name := range names {
+ instance, isExist, err := getInstance(ctx, dmsV1.ListDBServiceReq{
+ PageSize: 1,
+ FilterByName: name,
+ ProjectUid: projectUid,
+ })
+
+ if err != nil {
+ return nil, err
+ }
+
+ if isExist {
+ instances = append(instances, instance)
+ }
+ }
+
+ return instances, err
+}
+
+func GetInstanceNamesInProjectByIds(ctx context.Context, projectUid string, instanceIds []string) ([]string, error) {
+ ret := make([]string, 0)
+ for _, instanceId := range instanceIds {
+ instance, exist, err := getInstance(ctx, dmsV1.ListDBServiceReq{
+ PageSize: 1,
+ FilterByUID: instanceId,
+ ProjectUid: projectUid,
+ })
+
+ if err != nil {
+ return nil, err
+ }
+
+ if exist {
+ ret = append(ret, instance.Name)
+ }
+ }
+
+ return ret, nil
+}
+
+func GetInstanceNamesInProject(ctx context.Context, projectUid string) ([]string, error) {
+ ret := make([]string, 0)
+
+ instances, err := getInstances(ctx, dmsV1.ListDBServiceReq{
+ PageSize: 1,
+ ProjectUid: projectUid,
+ })
+
+ if err != nil {
+ return nil, err
+ }
+
+ for _, instance := range instances {
+ ret = append(ret, instance.Name)
+ }
+
+ return ret, nil
+}
+
+func GetInstancesById(ctx context.Context, instanceId uint64) (*model.Instance, bool, error) {
+ if instanceId == 0 {
+ return nil, false, nil
+ }
+
+ return getInstance(ctx, dmsV1.ListDBServiceReq{
+ PageSize: 1,
+ FilterByUID: strconv.FormatUint(instanceId, 10),
+ })
+}
+
+func GetInstancesByIds(ctx context.Context, instanceIds []uint64) ([]*model.Instance, error) {
+ ret := make([]*model.Instance, 0)
+ for _, instanceId := range instanceIds {
+ instance, exist, err := getInstance(ctx, dmsV1.ListDBServiceReq{
+ PageSize: 1,
+ FilterByUID: strconv.FormatUint(instanceId, 10),
+ })
+
+ if err != nil {
+ return nil, err
+ }
+
+ if exist {
+ ret = append(ret, instance)
+ }
+ }
+
+ return ret, nil
+}
+
+func GetInstanceIdNameMapByIds(ctx context.Context, instanceIds []uint64) (map[uint64]string, error) {
+ // todo: remove duplicate instance id
+ ret := make(map[uint64]string)
+ for _, instanceId := range instanceIds {
+ instance, exist, err := getInstance(ctx, dmsV1.ListDBServiceReq{
+ PageSize: 1,
+ FilterByUID: strconv.FormatUint(instanceId, 10),
+ })
+
+ if err != nil {
+ return nil, err
+ }
+
+ if exist {
+ ret[instance.ID] = instance.Name
+ }
+ }
+
+ return ret, nil
+}
+
+func GetInstanceInProjectById(ctx context.Context, projectUid string, instanceId uint64) (*model.Instance, bool, error) {
+ if len(projectUid) == 0 || instanceId == 0 {
+ return nil, false, nil
+ }
+
+ return getInstance(ctx, dmsV1.ListDBServiceReq{
+ PageSize: 1,
+ FilterByUID: strconv.FormatUint(instanceId, 10),
+ ProjectUid: projectUid,
+ })
+}
+
+func GetInstancesInProjectByIds(ctx context.Context, projectUid string, instanceIds []uint64) ([]*model.Instance, error) {
+ ret := make([]*model.Instance, 0)
+ for _, instanceId := range instanceIds {
+ instance, exist, err := getInstance(ctx, dmsV1.ListDBServiceReq{
+ PageSize: 1,
+ FilterByUID: strconv.FormatUint(instanceId, 10),
+ ProjectUid: projectUid,
+ })
+
+ if err != nil {
+ return nil, err
+ }
+
+ if exist {
+ ret = append(ret, instance)
+ }
+ }
+
+ return ret, nil
+}
+
+type InstanceTypeCount struct {
+ DBType string `json:"db_type"`
+ Count int64 `json:"count"`
+}
+
+func GetInstanceCountGroupType(ctx context.Context) ([]InstanceTypeCount, error) {
+ instances, err := getInstances(ctx, dmsV1.ListDBServiceReq{})
+
+ if err != nil {
+ return nil, err
+ }
+
+ var typeCountMap = map[string]int64{}
+
+ for _, instance := range instances {
+ typeCountMap[instance.DbType]++
+ }
+
+ ret := make([]InstanceTypeCount, 0, len(typeCountMap))
+ for dbType, count := range typeCountMap {
+ ret = append(ret, InstanceTypeCount{
+ DBType: dbType,
+ Count: count,
+ })
+ }
+
+ return ret, nil
+}
+
+func GetWorkflowDetailByWorkflowId(projectId, workflowId string, fn func(projectId, workflowId string) (*model.Workflow, bool, error)) (*model.Workflow, error) {
+ workflow, exist, err := fn(projectId, workflowId)
+ if err != nil {
+ return nil, err
+ }
+ if !exist {
+ return nil, errors.New(errors.DataNotExist, fmt.Errorf("workflow is not exist or you can't access it"))
+ }
+
+ instanceIds := make([]uint64, 0, len(workflow.Record.InstanceRecords))
+ for _, item := range workflow.Record.InstanceRecords {
+ instanceIds = append(instanceIds, item.InstanceId)
+ }
+
+ if len(instanceIds) == 0 {
+ return workflow, nil
+ }
+
+ instances, err := GetInstancesInProjectByIds(context.Background(), string(workflow.ProjectId), instanceIds)
+ if err != nil {
+ return nil, err
+ }
+ instanceMap := map[uint64]*model.Instance{}
+ for _, instance := range instances {
+ instanceMap[instance.ID] = instance
+ }
+ for i, item := range workflow.Record.InstanceRecords {
+ if instance, ok := instanceMap[item.InstanceId]; ok {
+ workflow.Record.InstanceRecords[i].Instance = instance
+ }
+ }
+
+ return workflow, nil
+}
+
+func GetAuditPlanWithInstanceFromProjectByName(projectId, name string, fn func(projectId, name string) (*model.AuditPlan, bool, error)) (*model.AuditPlan, bool, error) {
+ auditPlan, exist, err := fn(projectId, name)
+ if err != nil {
+ return nil, false, err
+ }
+ if !exist {
+ return nil, false, nil
+ }
+
+ instance, exists, err := GetInstanceInProjectByName(context.Background(), projectId, auditPlan.InstanceName)
+ if err != nil {
+ return nil, false, err
+ }
+ if exists {
+ auditPlan.Instance = instance
+ }
+ return auditPlan, true, nil
+}
+
+func GetActiveAuditPlansWithInstance(fn func() ([]*model.AuditPlan, error)) ([]*model.AuditPlan, error) {
+ auditPlans, err := fn()
+ if err != nil {
+ return nil, err
+ }
+
+ for i, item := range auditPlans {
+ // todo dms不支持跨项目查询实例,所以单个查询
+ instance, exists, err := GetInstanceInProjectByName(context.Background(), string(item.ProjectId), item.Name)
+ if err != nil {
+ continue
+ }
+ if exists {
+ auditPlans[i].Instance = instance
+ }
+ }
+ return auditPlans, nil
+}
+
+func GetAuditPlanWithInstanceById(id uint, fn func(id uint) (*model.AuditPlan, bool, error)) (*model.AuditPlan, bool, error) {
+ auditPlan, exist, err := fn(id)
+ if err != nil {
+ return nil, false, err
+ }
+ if !exist {
+ return nil, false, nil
+ }
+
+ instance, exists, err := GetInstanceInProjectByName(context.Background(), string(auditPlan.ProjectId), auditPlan.InstanceName)
+ if err != nil {
+ return nil, false, err
+ }
+ if exists {
+ auditPlan.Instance = instance
+ }
+ return auditPlan, true, nil
+}
diff --git a/sqle/dms/permission.go b/sqle/dms/permission.go
new file mode 100644
index 0000000000..2ce344b124
--- /dev/null
+++ b/sqle/dms/permission.go
@@ -0,0 +1,123 @@
+package dms
+
+import (
+ "context"
+ "fmt"
+
+ v1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+ "github.com/actiontech/dms/pkg/dms-common/dmsobject"
+ "github.com/actiontech/sqle/sqle/api/controller"
+ "github.com/actiontech/sqle/sqle/log"
+ "github.com/ungerik/go-dry"
+)
+
+type UserPermission struct {
+ userId string
+ projectId string
+ isAdmin bool
+ opPermissionItem []v1.OpPermissionItem
+}
+
+func NewUserPermission(userId, projectId string) (*UserPermission, error) {
+ opPermissions, isAdmin, err := dmsobject.GetUserOpPermission(context.TODO(), projectId, userId, controller.GetDMSServerAddress())
+ if err != nil {
+ return nil, fmt.Errorf("get user op permission from dms error: %v", err)
+ }
+ return &UserPermission{
+ userId: userId,
+ projectId: projectId,
+ isAdmin: isAdmin,
+ opPermissionItem: opPermissions,
+ }, nil
+}
+
+func (p *UserPermission) IsAdmin() bool {
+ return p.isAdmin
+}
+
+func (p *UserPermission) IsProjectAdmin() bool {
+ for _, userOpPermission := range p.opPermissionItem {
+ if userOpPermission.RangeType == v1.OpRangeTypeProject {
+ return true
+ }
+ }
+ return false
+}
+
+// dms-todo: 1. 判断用户是 project 成员的方式成本高,看是否可以优化. 2. 捕捉错误.
+func (p *UserPermission) IsProjectMember() bool {
+ members, _, err := dmsobject.ListMembersInProject(context.TODO(), controller.GetDMSServerAddress(), v1.ListMembersForInternalReq{PageSize: 999, PageIndex: 1, ProjectUid: p.projectId})
+ if err != nil {
+ log.NewEntry().WithField("project_id", p.projectId).Errorln("fail to list member in project from dms")
+ return false
+ }
+ for _, member := range members {
+ if member.User.Uid == p.userId {
+ return true
+ }
+ }
+ return false
+}
+
+func (p *UserPermission) isPermissionMatch(opType v1.OpPermissionType, opTypes ...v1.OpPermissionType) bool {
+ for i := range opTypes {
+ if opTypes[i] == opType {
+ return true
+ }
+ }
+ return false
+}
+
+func (p *UserPermission) CanOpInstanceNoAdmin(instanceId string, OpTypes ...v1.OpPermissionType) bool {
+ for _, userOpPermission := range p.opPermissionItem {
+ // 判断是否是数据源权限
+ if userOpPermission.RangeType != v1.OpRangeTypeDBService {
+ continue
+ }
+ // 判断权限类型是否一致
+ if !p.isPermissionMatch(userOpPermission.OpPermissionType, OpTypes...) {
+ continue
+ }
+ // 判断权限对应的资源内有指定的数据源
+ if dry.StringInSlice(instanceId, userOpPermission.RangeUids) {
+ return true
+ }
+ }
+ return false
+}
+
+func (p *UserPermission) GetInstancesByOP(OpTypes ...v1.OpPermissionType) []string {
+ instances := []string{}
+ instanceMap := map[string]struct{}{}
+
+ for _, userOpPermission := range p.opPermissionItem {
+ // 判断是否是数据源权限
+ if userOpPermission.RangeType != v1.OpRangeTypeDBService {
+ continue
+ }
+ // 判断权限类型是否一致
+ if !p.isPermissionMatch(userOpPermission.OpPermissionType, OpTypes...) {
+ continue
+ }
+ for _, id := range userOpPermission.RangeUids {
+ if _, ok := instanceMap[id]; ok {
+ continue
+ }
+ instances = append(instances, id)
+ instanceMap[id] = struct{}{}
+ }
+ }
+ return instances
+}
+
+func GetAllOpPermissions() []v1.OpPermissionType {
+ return []v1.OpPermissionType{
+ v1.OpPermissionTypeAuditWorkflow,
+ v1.OpPermissionTypeCreateWorkflow,
+ v1.OpPermissionTypeExecuteWorkflow,
+ v1.OpPermissionTypeViewOthersWorkflow,
+ v1.OpPermissionTypeSaveAuditPlan,
+ v1.OpPermissionTypeViewOtherAuditPlan,
+ v1.OpPermissionTypeSQLQuery,
+ }
+}
diff --git a/sqle/dms/server.go b/sqle/dms/server.go
new file mode 100644
index 0000000000..13dbde5d8e
--- /dev/null
+++ b/sqle/dms/server.go
@@ -0,0 +1,11 @@
+package dms
+
+var dmsServerAddress string
+
+func GetDMSServerAddress() string {
+ return dmsServerAddress
+}
+
+func InitDMSServerAddress(addr string) {
+ dmsServerAddress = addr
+}
diff --git a/sqle/docs/docs.go b/sqle/docs/docs.go
index 0409bc122a..d23da309c1 100644
--- a/sqle/docs/docs.go
+++ b/sqle/docs/docs.go
@@ -113,24 +113,6 @@ var doc = `{
}
}
},
- "/v1/basic_info": {
- "get": {
- "description": "get sqle basic info",
- "tags": [
- "global"
- ],
- "summary": "获取 sqle 基本信息",
- "operationId": "getSQLEInfoV1",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetSQLEInfoResV1"
- }
- }
- }
- }
- },
"/v1/company_notice": {
"get": {
"security": [
@@ -299,101 +281,6 @@ var doc = `{
}
}
},
- "/v1/configurations/feishu": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get feishu configuration",
- "tags": [
- "configuration"
- ],
- "summary": "获取飞书配置",
- "operationId": "getFeishuConfigurationV1",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetFeishuConfigurationResV1"
- }
- }
- }
- },
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "update feishu configuration",
- "consumes": [
- "application/json"
- ],
- "tags": [
- "configuration"
- ],
- "summary": "添加或更新飞书配置",
- "operationId": "updateFeishuConfigurationV1",
- "parameters": [
- {
- "description": "update feishu configuration req",
- "name": "param",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateFeishuConfigurationReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/configurations/feishu/test": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "test feishu configuration",
- "consumes": [
- "application/json"
- ],
- "tags": [
- "configuration"
- ],
- "summary": "测试飞书配置",
- "operationId": "testFeishuConfigV1",
- "parameters": [
- {
- "description": "test feishu configuration req",
- "name": "req",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.TestFeishuConfigurationReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.TestFeishuConfigResV1"
- }
- }
- }
- }
- },
"/v1/configurations/feishu_audit": {
"get": {
"security": [
@@ -489,64 +376,6 @@ var doc = `{
}
}
},
- "/v1/configurations/ldap": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get LDAP configuration",
- "tags": [
- "configuration"
- ],
- "summary": "获取 LDAP 配置",
- "operationId": "getLDAPConfigurationV1",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetLDAPConfigurationResV1"
- }
- }
- }
- },
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "update LDAP configuration",
- "consumes": [
- "application/json"
- ],
- "tags": [
- "configuration"
- ],
- "summary": "添加 LDAP 配置",
- "operationId": "updateLDAPConfigurationV1",
- "parameters": [
- {
- "description": "update LDAP configuration req",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.LDAPConfigurationReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
"/v1/configurations/license": {
"get": {
"security": [
@@ -661,24 +490,24 @@ var doc = `{
}
}
},
- "/v1/configurations/oauth2": {
+ "/v1/configurations/system_variables": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get Oauth2 configuration",
+ "description": "get system variables",
"tags": [
"configuration"
],
- "summary": "获取 Oauth2 配置",
- "operationId": "getOauth2ConfigurationV1",
+ "summary": "获取系统变量",
+ "operationId": "getSystemVariablesV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetOauth2ConfigurationResV1"
+ "$ref": "#/definitions/v1.GetSystemVariablesResV1"
}
}
}
@@ -689,23 +518,23 @@ var doc = `{
"ApiKeyAuth": []
}
],
- "description": "update Oauth2 configuration",
+ "description": "update system variables",
"consumes": [
"application/json"
],
"tags": [
"configuration"
],
- "summary": "修改 Oauth2 配置",
- "operationId": "updateOauth2ConfigurationV1",
+ "summary": "修改系统变量",
+ "operationId": "updateSystemVariablesV1",
"parameters": [
{
- "description": "update Oauth2 configuration req",
- "name": "conf",
+ "description": "update system variables request",
+ "name": "instance",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.Oauth2ConfigurationReqV1"
+ "$ref": "#/definitions/v1.UpdateSystemVariablesReqV1"
}
}
],
@@ -719,45 +548,62 @@ var doc = `{
}
}
},
- "/v1/configurations/oauth2/tips": {
+ "/v1/custom_rules": {
"get": {
- "description": "get Oauth2 tips",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get all custom rule template",
"tags": [
- "configuration"
+ "rule_template"
+ ],
+ "summary": "自定义规则列表",
+ "operationId": "getCustomRulesV1",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "filter db type",
+ "name": "filter_db_type",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter desc",
+ "name": "filter_desc",
+ "in": "query"
+ }
],
- "summary": "获取 Oauth2 基本信息",
- "operationId": "getOauth2Tips",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetOauth2TipsResV1"
+ "$ref": "#/definitions/v1.GetCustomRulesResV1"
}
}
}
- }
- },
- "/v1/configurations/personalise": {
- "patch": {
+ },
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update personalise config",
+ "description": "create custom rule",
"tags": [
- "configuration"
+ "rule_template"
],
- "summary": "更新个性化设置",
- "operationId": "personalise",
+ "summary": "添加自定义规则",
+ "operationId": "createCustomRuleV1",
"parameters": [
{
- "description": "personalise req",
- "name": "conf",
+ "description": "add custom rule",
+ "name": "instance",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.PersonaliseReqV1"
+ "$ref": "#/definitions/v1.CreateCustomRuleReqV1"
}
}
],
@@ -771,28 +617,25 @@ var doc = `{
}
}
},
- "/v1/configurations/personalise/logo": {
- "post": {
+ "/v1/custom_rules/{db_type}/rule_types": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "upload logo",
- "consumes": [
- "multipart/form-data"
- ],
+ "description": "get rule type by db type",
"tags": [
- "configuration"
+ "rule_template"
],
- "summary": "上传Logo",
- "operationId": "uploadLogo",
+ "summary": "获取规则分类",
+ "operationId": "getRuleTypeByDBTypeV1",
"parameters": [
{
- "type": "file",
- "description": "logo file",
- "name": "logo",
- "in": "formData",
+ "type": "string",
+ "description": "db type",
+ "name": "db_type",
+ "in": "query",
"required": true
}
],
@@ -800,58 +643,62 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.UploadLogoResV1"
+ "$ref": "#/definitions/v1.GetRuleTypeByDBTypeResV1"
}
}
}
}
},
- "/v1/configurations/smtp": {
+ "/v1/custom_rules/{rule_id}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get SMTP configuration",
+ "description": "get custom rule by rule_id",
"tags": [
- "configuration"
+ "rule_template"
+ ],
+ "summary": "获取自定义规则",
+ "operationId": "getCustomRuleV1",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "rule id",
+ "name": "rule_id",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "获取 SMTP 配置",
- "operationId": "getSMTPConfigurationV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSMTPConfigurationResV1"
+ "$ref": "#/definitions/v1.GetCustomRuleResV1"
}
}
}
},
- "patch": {
+ "delete": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update SMTP configuration",
- "consumes": [
- "application/json"
- ],
+ "description": "delete custom rule",
"tags": [
- "configuration"
+ "rule_template"
],
- "summary": "添加 SMTP 配置",
- "operationId": "updateSMTPConfigurationV1",
+ "summary": "删除自定义规则",
+ "operationId": "deleteCustomRuleV1",
"parameters": [
{
- "description": "update SMTP configuration req",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateSMTPConfigurationReqV1"
- }
+ "type": "string",
+ "description": "rule id",
+ "name": "rule_id",
+ "in": "path",
+ "required": true
}
],
"responses": {
@@ -862,32 +709,34 @@ var doc = `{
}
}
}
- }
- },
- "/v1/configurations/smtp/test": {
- "post": {
+ },
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "test SMTP configuration",
- "consumes": [
- "application/json"
- ],
+ "description": "update custom rule",
"tags": [
- "configuration"
+ "rule_template"
],
- "summary": "测试 邮箱 配置",
- "operationId": "testSMTPConfigurationV1",
+ "summary": "更新自定义规则",
+ "operationId": "updateCustomRuleV1",
"parameters": [
{
- "description": "test SMTP configuration req",
- "name": "req",
+ "type": "string",
+ "description": "rule id",
+ "name": "rule_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "update custom rule",
+ "name": "instance",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.TestSMTPConfigurationReqV1"
+ "$ref": "#/definitions/v1.UpdateCustomRuleReqV1"
}
}
],
@@ -895,216 +744,350 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.TestSMTPConfigurationResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/configurations/sql_query": {
+ "/v1/dashboard": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get sqle query configuration",
+ "description": "get dashboard info",
+ "produces": [
+ "application/json"
+ ],
"tags": [
- "configuration"
+ "dashboard"
+ ],
+ "summary": "获取 dashboard 信息",
+ "operationId": "getDashboardV1",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "filter project name",
+ "name": "filter_project_name",
+ "in": "query"
+ }
],
- "summary": "获取SQL查询配置信息",
- "operationId": "getSQLQueryConfiguration",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSQLQueryConfigurationResV1"
+ "$ref": "#/definitions/v1.GetDashboardResV1"
}
}
}
}
},
- "/v1/configurations/system_variables": {
+ "/v1/operation_records": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get system variables",
+ "description": "Get operation record list",
"tags": [
- "configuration"
+ "OperationRecord"
+ ],
+ "summary": "获取操作记录列表",
+ "operationId": "getOperationRecordListV1",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "filter_operate_time_from",
+ "name": "filter_operate_time_from",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_operate_time_to",
+ "name": "filter_operate_time_to",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_operate_project_name",
+ "name": "filter_operate_project_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "fuzzy_search_operate_user_name",
+ "name": "fuzzy_search_operate_user_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_operate_type_name",
+ "name": "filter_operate_type_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_operate_action",
+ "name": "filter_operate_action",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page_index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "page_size",
+ "name": "page_size",
+ "in": "query",
+ "required": true
+ }
],
- "summary": "获取系统变量",
- "operationId": "getSystemVariablesV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSystemVariablesResV1"
+ "$ref": "#/definitions/v1.GetOperationRecordListResV1"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v1/operation_records/exports": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update system variables",
- "consumes": [
- "application/json"
- ],
+ "description": "Export operation record list",
"tags": [
- "configuration"
+ "OperationRecord"
],
- "summary": "修改系统变量",
- "operationId": "updateSystemVariablesV1",
+ "summary": "导出操作记录列表",
+ "operationId": "getExportOperationRecordListV1",
"parameters": [
{
- "description": "update system variables request",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateSystemVariablesReqV1"
- }
+ "type": "string",
+ "description": "filter_operate_time_from",
+ "name": "filter_operate_time_from",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_operate_time_to",
+ "name": "filter_operate_time_to",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_operate_project_name",
+ "name": "filter_operate_project_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "fuzzy_search_operate_user_name",
+ "name": "fuzzy_search_operate_user_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_operate_type_name",
+ "name": "filter_operate_type_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_operate_action",
+ "name": "filter_operate_action",
+ "in": "query"
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "get export operation record list",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "type": "file"
}
}
}
}
},
- "/v1/configurations/webhook": {
+ "/v1/operation_records/operation_actions": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get workflow webhook config",
+ "description": "Get operation action list",
"tags": [
- "configuration"
+ "OperationRecord"
],
- "summary": "获取全局工单 WebHook 配置",
- "operationId": "getGlobalWorkflowWebHookConfig",
+ "summary": "获取操作内容列表",
+ "operationId": "getOperationActionList",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowWebHookConfigResV1"
+ "$ref": "#/definitions/v1.GetOperationActionListResV1"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v1/operation_records/operation_type_names": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update webhook config",
+ "description": "Get operation type name list",
"tags": [
- "configuration"
- ],
- "summary": "更新工单 WebHook 配置",
- "operationId": "updateGlobalWebHookConfig",
- "parameters": [
- {
- "description": "update webhook config",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.WebHookConfigV1"
- }
- }
+ "OperationRecord"
],
+ "summary": "获取操作类型名列表",
+ "operationId": "GetOperationTypeNameList",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetOperationTypeNamesListResV1"
}
}
}
}
},
- "/v1/configurations/webhook/test": {
- "post": {
+ "/v1/operations": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "test workflow webhook config",
+ "description": "get permission operations",
"tags": [
- "configuration"
+ "operation"
],
- "summary": "测试全局工单 WebHook 配置",
- "operationId": "testGlobalWorkflowWebHookConfig",
+ "summary": "获取权限动作列表",
+ "operationId": "GetOperationsV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.TestWorkflowWebHookConfigResV1"
+ "$ref": "#/definitions/v1.GetOperationsResV1"
}
}
}
}
},
- "/v1/configurations/wechat": {
+ "/v1/projects/{project_name}/audit_plans": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get WeChat configuration",
+ "description": "get audit plan info list",
"tags": [
- "configuration"
+ "audit_plan"
+ ],
+ "summary": "获取扫描任务信息列表",
+ "operationId": "getAuditPlansV1",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "filter audit plan db type",
+ "name": "filter_audit_plan_db_type",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "fuzzy search audit plan name",
+ "name": "fuzzy_search_audit_plan_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter audit plan type",
+ "name": "filter_audit_plan_type",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter audit plan instance name",
+ "name": "filter_audit_plan_instance_name",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "size of per page",
+ "name": "page_size",
+ "in": "query",
+ "required": true
+ }
],
- "summary": "获取 企业微信 配置",
- "operationId": "getWeChatConfigurationV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWeChatConfigurationResV1"
+ "$ref": "#/definitions/v1.GetAuditPlansResV1"
}
}
}
},
- "patch": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update WeChat configuration",
+ "description": "create audit plan",
"consumes": [
"application/json"
],
"tags": [
- "configuration"
+ "audit_plan"
],
- "summary": "添加 企业微信 配置",
- "operationId": "updateWeChatConfigurationV1",
+ "summary": "添加扫描任务",
+ "operationId": "createAuditPlanV1",
"parameters": [
{
- "description": "update WeChat configuration req",
- "name": "instance",
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "create audit plan",
+ "name": "audit_plan",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.UpdateWeChatConfigurationReqV1"
+ "$ref": "#/definitions/v1.CreateAuditPlanReqV1"
}
}
],
@@ -1118,99 +1101,115 @@ var doc = `{
}
}
},
- "/v1/configurations/wechat/test": {
- "post": {
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "test WeChat configuration",
- "consumes": [
- "application/json"
- ],
+ "description": "get audit plan",
"tags": [
- "configuration"
+ "audit_plan"
],
- "summary": "测试 企业微信 配置",
- "operationId": "testWeChatConfigurationV1",
+ "summary": "获取指定扫描任务",
+ "operationId": "getAuditPlanV1",
"parameters": [
{
- "description": "test WeChat configuration req",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.TestWeChatConfigurationReqV1"
- }
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.TestWeChatConfigurationResV1"
+ "$ref": "#/definitions/v1.GetAuditPlanResV1"
}
}
}
- }
- },
- "/v1/custom_rules": {
- "get": {
+ },
+ "delete": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get all custom rule template",
+ "description": "delete audit plan",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "自定义规则列表",
- "operationId": "getCustomRulesV1",
+ "summary": "删除扫描任务",
+ "operationId": "deleteAuditPlanV1",
"parameters": [
{
"type": "string",
- "description": "filter db type",
- "name": "filter_db_type",
- "in": "query"
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
},
{
"type": "string",
- "description": "filter desc",
- "name": "filter_desc",
- "in": "query"
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetCustomRulesResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
},
- "post": {
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "create custom rule",
+ "description": "update audit plan",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "添加自定义规则",
- "operationId": "createCustomRuleV1",
+ "summary": "更新扫描任务",
+ "operationId": "updateAuditPlanV1",
"parameters": [
{
- "description": "add custom rule",
- "name": "instance",
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "update audit plan",
+ "name": "audit_plan",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.CreateCustomRuleReqV1"
+ "$ref": "#/definitions/v1.UpdateAuditPlanReqV1"
}
}
],
@@ -1224,25 +1223,32 @@ var doc = `{
}
}
},
- "/v1/custom_rules/{db_type}/rule_types": {
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/notify_config": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get rule type by db type",
+ "description": "get audit plan notify config",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "获取规则分类",
- "operationId": "getRuleTypeByDBTypeV1",
+ "summary": "获取扫描任务消息推送设置",
+ "operationId": "getAuditPlanNotifyConfigV1",
"parameters": [
{
"type": "string",
- "description": "db type",
- "name": "db_type",
- "in": "query",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
"required": true
}
],
@@ -1250,60 +1256,83 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRuleTypeByDBTypeResV1"
+ "$ref": "#/definitions/v1.GetAuditPlanNotifyConfigResV1"
}
}
}
- }
- },
- "/v1/custom_rules/{rule_id}": {
- "get": {
+ },
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get custom rule by rule_id",
+ "description": "update audit plan notify config",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "获取自定义规则",
- "operationId": "getCustomRuleV1",
+ "summary": "更新扫描任务通知设置",
+ "operationId": "updateAuditPlanNotifyConfigV1",
"parameters": [
{
"type": "string",
- "description": "rule id",
- "name": "rule_id",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
"in": "path",
"required": true
+ },
+ {
+ "description": "update audit plan notify config",
+ "name": "config",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.UpdateAuditPlanNotifyConfigReqV1"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetCustomRuleResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
- },
- "delete": {
+ }
+ },
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/notify_config/test": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "delete custom rule",
+ "description": "Test audit task message push",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "删除自定义规则",
- "operationId": "deleteCustomRuleV1",
+ "summary": "测试扫描任务消息推送",
+ "operationId": "testAuditPlanNotifyConfigV1",
"parameters": [
{
"type": "string",
- "description": "rule id",
- "name": "rule_id",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
"in": "path",
"required": true
}
@@ -1312,267 +1341,359 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.TestAuditPlanNotifyConfigResV1"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update custom rule",
+ "description": "get audit plan report list",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "更新自定义规则",
- "operationId": "updateCustomRuleV1",
+ "summary": "获取指定扫描任务的报告列表",
+ "operationId": "getAuditPlanReportsV1",
"parameters": [
{
"type": "string",
- "description": "rule id",
- "name": "rule_id",
+ "description": "project name",
+ "name": "project_name",
"in": "path",
"required": true
},
{
- "description": "update custom rule",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateCustomRuleReqV1"
- }
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "page index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "size of per page",
+ "name": "page_size",
+ "in": "query",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetAuditPlanReportsResV1"
}
}
}
}
},
- "/v1/dashboard": {
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get dashboard info",
- "produces": [
- "application/json"
- ],
+ "description": "get audit plan report",
"tags": [
- "dashboard"
+ "audit_plan"
],
- "summary": "获取 dashboard 信息",
- "operationId": "getDashboardV1",
+ "summary": "获取指定扫描任务的SQL扫描记录统计信息",
+ "operationId": "getAuditPlanReportV1",
"parameters": [
{
"type": "string",
- "description": "filter project name",
- "name": "filter_project_name",
- "in": "query"
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetDashboardResV1"
- }
- }
- }
- }
- },
- "/v1/dashboard/project_tips": {
- "get": {
- "security": [
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
{
- "ApiKeyAuth": []
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan report id",
+ "name": "audit_plan_report_id",
+ "in": "path",
+ "required": true
}
],
- "description": "get dashboard project tips",
- "produces": [
- "application/json"
- ],
- "tags": [
- "dashboard"
- ],
- "summary": "获取dashboard项目提示列表",
- "operationId": "getDashboardProjectTipsV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetDashboardProjectTipsResV1"
+ "$ref": "#/definitions/v1.GetAuditPlanReportResV1"
}
}
}
}
},
- "/v1/instance_additional_metas": {
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/export": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get instance additional metas",
+ "description": "export audit plan report as csv",
"tags": [
- "instance"
+ "audit_plan"
+ ],
+ "summary": "以csv的形式导出扫描报告",
+ "operationId": "exportAuditPlanReportV1",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan report id",
+ "name": "audit_plan_report_id",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "获取实例的额外属性列表",
- "operationId": "getInstanceAdditionalMetas",
"responses": {
"200": {
- "description": "OK",
+ "description": "get export audit plan report",
"schema": {
- "$ref": "#/definitions/v1.GetInstanceAdditionalMetasResV1"
+ "type": "file"
}
}
}
}
},
- "/v1/instance_connection": {
- "post": {
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "test instance db connection 注:可直接提交创建实例接口的body,该接口的json 内容是创建实例的 json 的子集",
- "consumes": [
- "application/json"
- ],
+ "description": "get audit plan report SQLs",
"tags": [
- "instance"
+ "audit_plan"
],
- "summary": "实例连通性测试(实例提交前)",
- "operationId": "checkInstanceIsConnectableV1",
+ "summary": "获取指定扫描任务的SQL扫描详情",
+ "operationId": "getAuditPlanReportsSQLsV1",
"parameters": [
{
- "description": "instance info",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.GetInstanceConnectableReqV1"
- }
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan report id",
+ "name": "audit_plan_report_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "page index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "size of per page",
+ "name": "page_size",
+ "in": "query",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetInstanceConnectableResV1"
+ "$ref": "#/definitions/v1.GetAuditPlanReportSQLsResV1"
}
}
}
}
},
- "/v1/login": {
- "post": {
- "description": "user login",
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls/{number}/analysis": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get SQL explain and related table metadata for analysis",
"tags": [
- "user"
+ "audit_plan"
],
- "summary": "用户登录",
- "operationId": "loginV1",
+ "summary": "获取task相关的SQL执行计划和表元数据",
+ "operationId": "getTaskAnalysisData",
"parameters": [
{
- "description": "user login request",
- "name": "user",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UserLoginReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetUserLoginResV1"
- }
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan report id",
+ "name": "audit_plan_report_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "sql number",
+ "name": "number",
+ "in": "path",
+ "required": true
}
- }
- }
- },
- "/v1/logout": {
- "post": {
- "description": "user logout",
- "tags": [
- "user"
],
- "summary": "用户登出",
- "operationId": "logoutV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetAuditPlanAnalysisDataResV1"
}
}
}
}
},
- "/v1/management_permissions": {
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/sqls": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get platform management permissions",
+ "description": "get audit plan SQLs",
"tags": [
- "management_permission"
+ "audit_plan"
+ ],
+ "summary": "获取指定扫描任务的SQLs信息(不包括扫描结果)",
+ "operationId": "getAuditPlanSQLsV1",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "page index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "size of per page",
+ "name": "page_size",
+ "in": "query",
+ "required": true
+ }
],
- "summary": "获取平台管理权限列表",
- "operationId": "GetManagementPermissionsV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetManagementPermissionsResV1"
+ "$ref": "#/definitions/v1.GetAuditPlanSQLsResV1"
}
}
}
}
},
- "/v1/oauth2/link": {
- "get": {
- "description": "oauth2 link",
- "tags": [
- "oauth2"
- ],
- "summary": "oauth2通过此链接跳转到第三方登录网址",
- "operationId": "Oauth2Link"
- }
- },
- "/v1/oauth2/user/bind": {
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/sqls/full": {
"post": {
- "description": "bind Oauth2 user to sqle",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "full sync audit plan SQLs",
"tags": [
- "oauth2"
+ "audit_plan"
],
- "summary": "绑定 Oauth2 和 sqle用户",
- "operationId": "bindOauth2User",
+ "summary": "全量同步SQL到扫描任务",
+ "operationId": "fullSyncAuditPlanSQLsV1",
+ "deprecated": true,
"parameters": [
{
- "description": "bind oauth2 user req",
- "name": "conf",
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "full sync audit plan SQLs request",
+ "name": "sqls",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.BindOauth2UserReqV1"
+ "$ref": "#/definitions/v1.FullSyncAuditPlanSQLsReqV1"
}
}
],
@@ -1580,276 +1701,131 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.BindOauth2UserResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/operation_records": {
- "get": {
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/sqls/partial": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Get operation record list",
+ "description": "partial sync audit plan SQLs",
"tags": [
- "OperationRecord"
+ "audit_plan"
],
- "summary": "获取操作记录列表",
- "operationId": "getOperationRecordListV1",
+ "summary": "增量同步SQL到扫描任务",
+ "operationId": "partialSyncAuditPlanSQLsV1",
+ "deprecated": true,
"parameters": [
{
"type": "string",
- "description": "filter_operate_time_from",
- "name": "filter_operate_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_operate_time_to",
- "name": "filter_operate_time_to",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_operate_project_name",
- "name": "filter_operate_project_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "fuzzy_search_operate_user_name",
- "name": "fuzzy_search_operate_user_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_operate_type_name",
- "name": "filter_operate_type_name",
- "in": "query"
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
},
{
"type": "string",
- "description": "filter_operate_action",
- "name": "filter_operate_action",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page_index",
- "name": "page_index",
- "in": "query",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
"required": true
},
{
- "type": "integer",
- "description": "page_size",
- "name": "page_size",
- "in": "query",
- "required": true
+ "description": "partial sync audit plan SQLs request",
+ "name": "sqls",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.PartialSyncAuditPlanSQLsReqV1"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetOperationRecordListResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/operation_records/exports": {
- "get": {
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/trigger": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Export operation record list",
+ "description": "trigger audit plan",
"tags": [
- "OperationRecord"
+ "audit_plan"
],
- "summary": "导出操作记录列表",
- "operationId": "getExportOperationRecordListV1",
+ "summary": "触发扫描任务",
+ "operationId": "triggerAuditPlanV1",
"parameters": [
{
"type": "string",
- "description": "filter_operate_time_from",
- "name": "filter_operate_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_operate_time_to",
- "name": "filter_operate_time_to",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_operate_project_name",
- "name": "filter_operate_project_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "fuzzy_search_operate_user_name",
- "name": "fuzzy_search_operate_user_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_operate_type_name",
- "name": "filter_operate_type_name",
- "in": "query"
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
},
{
"type": "string",
- "description": "filter_operate_action",
- "name": "filter_operate_action",
- "in": "query"
- }
- ],
- "responses": {
- "200": {
- "description": "get export operation record list",
- "schema": {
- "type": "file"
- }
- }
- }
- }
- },
- "/v1/operation_records/operation_actions": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Get operation action list",
- "tags": [
- "OperationRecord"
- ],
- "summary": "获取操作内容列表",
- "operationId": "getOperationActionList",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetOperationActionListResV1"
- }
- }
- }
- }
- },
- "/v1/operation_records/operation_type_names": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Get operation type name list",
- "tags": [
- "OperationRecord"
- ],
- "summary": "获取操作类型名列表",
- "operationId": "GetOperationTypeNameList",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetOperationTypeNamesListResV1"
- }
- }
- }
- }
- },
- "/v1/operations": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
}
],
- "description": "get permission operations",
- "tags": [
- "operation"
- ],
- "summary": "获取权限动作列表",
- "operationId": "GetOperationsV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetOperationsResV1"
+ "$ref": "#/definitions/v1.TriggerAuditPlanResV1"
}
}
}
}
},
- "/v1/project_tips": {
+ "/v1/projects/{project_name}/audit_whitelist": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get project tip list",
+ "description": "get all whitelist",
"tags": [
- "project"
+ "audit_whitelist"
],
- "summary": "获取项目提示列表",
- "operationId": "getProjectTipsV1",
+ "summary": "获取Sql审核白名单",
+ "operationId": "getAuditWhitelistV1",
"parameters": [
{
- "enum": [
- "operation_record"
- ],
"type": "string",
- "description": "functional module",
- "name": "functional_module",
- "in": "query"
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetProjectTipsResV1"
- }
- }
- }
- }
- },
- "/v1/projects": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get project list",
- "tags": [
- "project"
- ],
- "summary": "获取项目列表",
- "operationId": "getProjectListV1",
- "parameters": [
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
{
- "type": "integer",
+ "type": "string",
"description": "page index",
"name": "page_index",
"in": "query",
"required": true
},
{
- "type": "integer",
- "default": 50,
- "description": "size of per page",
+ "type": "string",
+ "description": "page size",
"name": "page_size",
"in": "query",
"required": true
@@ -1859,7 +1835,7 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetProjectResV1"
+ "$ref": "#/definitions/v1.GetAuditWhitelistResV1"
}
}
}
@@ -1870,26 +1846,30 @@ var doc = `{
"ApiKeyAuth": []
}
],
- "description": "create project",
+ "description": "create a sql whitelist",
"consumes": [
"application/json"
],
- "produces": [
- "application/json"
- ],
"tags": [
- "project"
+ "audit_whitelist"
],
- "summary": "创建项目",
- "operationId": "createProjectV1",
+ "summary": "添加SQL白名单",
+ "operationId": "createAuditWhitelistV1",
"parameters": [
{
- "description": "create project request",
- "name": "project",
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "add sql whitelist req",
+ "name": "instance",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.CreateProjectReqV1"
+ "$ref": "#/definitions/v1.CreateAuditWhitelistReqV1"
}
}
],
@@ -1903,19 +1883,19 @@ var doc = `{
}
}
},
- "/v1/projects/{project_name}/": {
- "get": {
+ "/v1/projects/{project_name}/audit_whitelist/{audit_whitelist_id}/": {
+ "delete": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get project detail",
+ "description": "remove sql white",
"tags": [
- "project"
+ "audit_whitelist"
],
- "summary": "获取项目详情",
- "operationId": "getProjectDetailV1",
+ "summary": "删除SQL白名单信息",
+ "operationId": "deleteAuditWhitelistByIdV1",
"parameters": [
{
"type": "string",
@@ -1923,43 +1903,20 @@ var doc = `{
"name": "project_name",
"in": "path",
"required": true
+ },
+ {
+ "type": "string",
+ "description": "audit whitelist id",
+ "name": "audit_whitelist_id",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetProjectDetailResV1"
- }
- }
- }
- },
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "delete project",
- "tags": [
- "project"
- ],
- "summary": "删除项目",
- "operationId": "deleteProjectV1",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
@@ -1970,18 +1927,15 @@ var doc = `{
"ApiKeyAuth": []
}
],
- "description": "update project",
+ "description": "update sql whitelist by id",
"consumes": [
"application/json"
],
- "produces": [
- "application/json"
- ],
"tags": [
- "project"
+ "audit_whitelist"
],
- "summary": "更新项目",
- "operationId": "updateProjectV1",
+ "summary": "更新SQL白名单",
+ "operationId": "UpdateAuditWhitelistByIdV1",
"parameters": [
{
"type": "string",
@@ -1991,52 +1945,21 @@ var doc = `{
"required": true
},
{
- "description": "create project request",
- "name": "project",
+ "type": "string",
+ "description": "sql audit whitelist id",
+ "name": "audit_whitelist_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "update sql whitelist req",
+ "name": "instance",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.UpdateProjectReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.UpdateAuditWhitelistReqV1"
}
}
- }
- }
- },
- "/v1/projects/{project_name}/archive": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "archive project",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "project"
- ],
- "summary": "归档项目",
- "operationId": "archiveProjectV1",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- }
],
"responses": {
"200": {
@@ -2048,19 +1971,19 @@ var doc = `{
}
}
},
- "/v1/projects/{project_name}/audit_plans": {
+ "/v1/projects/{project_name}/instance_tips": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get audit plan info list",
+ "description": "get instance tip list",
"tags": [
- "audit_plan"
+ "instance"
],
- "summary": "获取扫描任务信息列表",
- "operationId": "getAuditPlansV1",
+ "summary": "获取实例提示列表",
+ "operationId": "getInstanceTipListV1",
"parameters": [
{
"type": "string",
@@ -2071,67 +1994,51 @@ var doc = `{
},
{
"type": "string",
- "description": "filter audit plan db type",
- "name": "filter_audit_plan_db_type",
- "in": "query"
- },
- {
- "type": "string",
- "description": "fuzzy search audit plan name",
- "name": "fuzzy_search_audit_plan_name",
+ "description": "filter db type",
+ "name": "filter_db_type",
"in": "query"
},
{
"type": "string",
- "description": "filter audit plan type",
- "name": "filter_audit_plan_type",
+ "description": "filter workflow template id",
+ "name": "filter_workflow_template_id",
"in": "query"
},
{
+ "enum": [
+ "create_audit_plan",
+ "create_workflow",
+ "sql_manage"
+ ],
"type": "string",
- "description": "filter audit plan instance name",
- "name": "filter_audit_plan_instance_name",
+ "description": "functional module",
+ "name": "functional_module",
"in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetAuditPlansResV1"
+ "$ref": "#/definitions/v1.GetInstanceTipsResV1"
}
}
}
- },
+ }
+ },
+ "/v1/projects/{project_name}/instances/connections": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "create audit plan",
- "consumes": [
- "application/json"
- ],
+ "description": "batch test instance db connections",
"tags": [
- "audit_plan"
+ "instance"
],
- "summary": "添加扫描任务",
- "operationId": "createAuditPlanV1",
+ "summary": "批量测试实例连通性(实例提交后)",
+ "operationId": "batchCheckInstanceIsConnectableByName",
"parameters": [
{
"type": "string",
@@ -2141,12 +2048,12 @@ var doc = `{
"required": true
},
{
- "description": "create audit plan",
- "name": "audit_plan",
+ "description": "instances",
+ "name": "instances",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.CreateAuditPlanReqV1"
+ "$ref": "#/definitions/v1.BatchCheckInstanceConnectionsReqV1"
}
}
],
@@ -2154,25 +2061,25 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.BatchGetInstanceConnectionsResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/": {
+ "/v1/projects/{project_name}/instances/{instance_name}/connection": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get audit plan",
+ "description": "test instance db connection",
"tags": [
- "audit_plan"
+ "instance"
],
- "summary": "获取指定扫描任务",
- "operationId": "getAuditPlanV1",
+ "summary": "实例连通性测试(实例提交后)",
+ "operationId": "checkInstanceIsConnectableByNameV1",
"parameters": [
{
"type": "string",
@@ -2183,8 +2090,8 @@ var doc = `{
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
+ "description": "instance name",
+ "name": "instance_name",
"in": "path",
"required": true
}
@@ -2193,23 +2100,25 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetAuditPlanResV1"
+ "$ref": "#/definitions/v1.GetInstanceConnectableResV1"
}
}
}
- },
- "delete": {
+ }
+ },
+ "/v1/projects/{project_name}/instances/{instance_name}/rules": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "delete audit plan",
+ "description": "get instance all rule",
"tags": [
- "audit_plan"
+ "instance"
],
- "summary": "删除扫描任务",
- "operationId": "deleteAuditPlanV1",
+ "summary": "获取实例应用的规则列表",
+ "operationId": "getInstanceRuleListV1",
"parameters": [
{
"type": "string",
@@ -2220,8 +2129,8 @@ var doc = `{
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
+ "description": "instance name",
+ "name": "instance_name",
"in": "path",
"required": true
}
@@ -2230,23 +2139,25 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetRulesResV1"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v1/projects/{project_name}/instances/{instance_name}/schemas": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update audit plan",
+ "description": "instance schema list",
"tags": [
- "audit_plan"
+ "instance"
],
- "summary": "更新扫描任务",
- "operationId": "updateAuditPlanV1",
+ "summary": "实例 Schema 列表",
+ "operationId": "getInstanceSchemasV1",
"parameters": [
{
"type": "string",
@@ -2257,44 +2168,35 @@ var doc = `{
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
+ "description": "instance name",
+ "name": "instance_name",
"in": "path",
"required": true
- },
- {
- "description": "update audit plan",
- "name": "audit_plan",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateAuditPlanReqV1"
- }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetInstanceSchemaResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/notify_config": {
+ "/v1/projects/{project_name}/instances/{instance_name}/schemas/{schema_name}/tables": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get audit plan notify config",
+ "description": "list table by schema",
"tags": [
- "audit_plan"
+ "instance"
],
- "summary": "获取扫描任务消息推送设置",
- "operationId": "getAuditPlanNotifyConfigV1",
+ "summary": "获取数据库下的所有表",
+ "operationId": "listTableBySchema",
"parameters": [
{
"type": "string",
@@ -2305,8 +2207,15 @@ var doc = `{
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
+ "description": "instance name",
+ "name": "instance_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "schema name",
+ "name": "schema_name",
"in": "path",
"required": true
}
@@ -2315,23 +2224,25 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetAuditPlanNotifyConfigResV1"
+ "$ref": "#/definitions/v1.ListTableBySchemaResV1"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v1/projects/{project_name}/instances/{instance_name}/schemas/{schema_name}/tables/{table_name}/metadata": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update audit plan notify config",
+ "description": "get table metadata",
"tags": [
- "audit_plan"
+ "instance"
],
- "summary": "更新扫描任务通知设置",
- "operationId": "updateAuditPlanNotifyConfigV1",
+ "summary": "获取表元数据",
+ "operationId": "getTableMetadata",
"parameters": [
{
"type": "string",
@@ -2342,44 +2253,49 @@ var doc = `{
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
+ "description": "instance name",
+ "name": "instance_name",
"in": "path",
"required": true
},
{
- "description": "update audit plan notify config",
- "name": "config",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateAuditPlanNotifyConfigReqV1"
- }
+ "type": "string",
+ "description": "schema name",
+ "name": "schema_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "table name",
+ "name": "table_name",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetTableMetadataResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/notify_config/test": {
+ "/v1/projects/{project_name}/rule_template_tips": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Test audit task message push",
+ "description": "get rule template tips in project",
"tags": [
- "audit_plan"
+ "rule_template"
],
- "summary": "测试扫描任务消息推送",
- "operationId": "testAuditPlanNotifyConfigV1",
+ "summary": "获取项目规则模板提示",
+ "operationId": "getProjectRuleTemplateTipsV1",
"parameters": [
{
"type": "string",
@@ -2390,35 +2306,34 @@ var doc = `{
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
- "in": "path",
- "required": true
+ "description": "filter db type",
+ "name": "filter_db_type",
+ "in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.TestAuditPlanNotifyConfigResV1"
+ "$ref": "#/definitions/v1.GetRuleTemplateTipsResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports": {
+ "/v1/projects/{project_name}/rule_templates": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get audit plan report list",
+ "description": "get all rule template in a project",
"tags": [
- "audit_plan"
+ "rule_template"
],
- "summary": "获取指定扫描任务的报告列表",
- "operationId": "getAuditPlanReportsV1",
+ "summary": "项目规则模板列表",
+ "operationId": "getProjectRuleTemplateListV1",
"parameters": [
{
"type": "string",
@@ -2427,13 +2342,6 @@ var doc = `{
"in": "path",
"required": true
},
- {
- "type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
- "in": "path",
- "required": true
- },
{
"type": "integer",
"description": "page index",
@@ -2453,25 +2361,26 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetAuditPlanReportsResV1"
+ "$ref": "#/definitions/v1.GetProjectRuleTemplatesResV1"
}
}
}
- }
- },
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/": {
- "get": {
+ },
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get audit plan report",
+ "description": "create a rule template in project",
+ "consumes": [
+ "application/json"
+ ],
"tags": [
- "audit_plan"
+ "rule_template"
],
- "summary": "获取指定扫描任务的SQL扫描记录统计信息",
- "operationId": "getAuditPlanReportV1",
+ "summary": "添加项目规则模板",
+ "operationId": "createProjectRuleTemplateV1",
"parameters": [
{
"type": "string",
@@ -2481,43 +2390,38 @@ var doc = `{
"required": true
},
{
- "type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "audit plan report id",
- "name": "audit_plan_report_id",
- "in": "path",
- "required": true
+ "description": "add rule template request",
+ "name": "req",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.CreateProjectRuleTemplateReqV1"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetAuditPlanReportResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/export": {
+ "/v1/projects/{project_name}/rule_templates/{rule_template_name}/": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "export audit plan report as csv",
+ "description": "get rule template detail in project",
"tags": [
- "audit_plan"
+ "rule_template"
],
- "summary": "以csv的形式导出扫描报告",
- "operationId": "exportAuditPlanReportV1",
+ "summary": "获取项目规则模板信息",
+ "operationId": "getProjectRuleTemplateV1",
"parameters": [
{
"type": "string",
@@ -2528,42 +2432,39 @@ var doc = `{
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
+ "description": "rule template name",
+ "name": "rule_template_name",
"in": "path",
"required": true
},
{
"type": "string",
- "description": "audit plan report id",
- "name": "audit_plan_report_id",
- "in": "path",
- "required": true
+ "description": "fuzzy rule,keyword for desc and annotation",
+ "name": "fuzzy_keyword_rule",
+ "in": "query"
}
],
"responses": {
"200": {
- "description": "get export audit plan report",
+ "description": "OK",
"schema": {
- "type": "file"
+ "$ref": "#/definitions/v1.GetProjectRuleTemplateResV1"
}
}
}
- }
- },
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls": {
- "get": {
+ },
+ "delete": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get audit plan report SQLs",
+ "description": "delete rule template in project",
"tags": [
- "audit_plan"
+ "rule_template"
],
- "summary": "获取指定扫描任务的SQL扫描详情",
- "operationId": "getAuditPlanReportsSQLsV1",
+ "summary": "删除项目规则模板",
+ "operationId": "deleteProjectRuleTemplateV1",
"parameters": [
{
"type": "string",
@@ -2574,56 +2475,33 @@ var doc = `{
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "audit plan report id",
- "name": "audit_plan_report_id",
+ "description": "rule template name",
+ "name": "rule_template_name",
"in": "path",
"required": true
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetAuditPlanReportSQLsResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
- }
- },
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls/{number}/analysis": {
- "get": {
+ },
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get SQL explain and related table metadata for analysis",
+ "description": "update rule template in project",
"tags": [
- "audit_plan"
+ "rule_template"
],
- "summary": "获取task相关的SQL执行计划和表元数据",
- "operationId": "getTaskAnalysisData",
+ "summary": "更新项目规则模板",
+ "operationId": "updateProjectRuleTemplateV1",
"parameters": [
{
"type": "string",
@@ -2634,49 +2512,47 @@ var doc = `{
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "audit plan report id",
- "name": "audit_plan_report_id",
+ "description": "rule template name",
+ "name": "rule_template_name",
"in": "path",
"required": true
},
{
- "type": "string",
- "description": "sql number",
- "name": "number",
- "in": "path",
- "required": true
+ "description": "update rule template request",
+ "name": "req",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.UpdateProjectRuleTemplateReqV1"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetAuditPlanAnalysisDataResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/sqls": {
- "get": {
+ "/v1/projects/{project_name}/rule_templates/{rule_template_name}/clone": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get audit plan SQLs",
+ "description": "clone a rule template in project",
+ "consumes": [
+ "application/json"
+ ],
"tags": [
- "audit_plan"
+ "rule_template"
],
- "summary": "获取指定扫描任务的SQLs信息(不包括扫描结果)",
- "operationId": "getAuditPlanSQLsV1",
+ "summary": "克隆项目规则模板",
+ "operationId": "cloneProjectRuleTemplateV1",
"parameters": [
{
"type": "string",
@@ -2687,50 +2563,44 @@ var doc = `{
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
+ "description": "rule template name",
+ "name": "rule_template_name",
"in": "path",
"required": true
},
{
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
+ "description": "clone rule template request",
+ "name": "req",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.CloneProjectRuleTemplateReqV1"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetAuditPlanSQLsResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/sqls/full": {
- "post": {
+ "/v1/projects/{project_name}/rule_templates/{rule_template_name}/export": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "full sync audit plan SQLs",
+ "description": "export rule template in a project",
"tags": [
- "audit_plan"
+ "rule_template"
],
- "summary": "全量同步SQL到扫描任务",
- "operationId": "fullSyncAuditPlanSQLsV1",
- "deprecated": true,
+ "summary": "导出项目规则模板",
+ "operationId": "exportProjectRuleTemplateV1",
"parameters": [
{
"type": "string",
@@ -2741,105 +2611,94 @@ var doc = `{
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
+ "description": "rule template name",
+ "name": "rule_template_name",
"in": "path",
"required": true
- },
- {
- "description": "full sync audit plan SQLs request",
- "name": "sqls",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.FullSyncAuditPlanSQLsReqV1"
- }
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "sqle rule template file",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "type": "file"
}
}
}
}
},
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/sqls/partial": {
- "post": {
+ "/v1/projects/{project_name}/sql_audit_records": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "partial sync audit plan SQLs",
+ "description": "get sql audit records",
"tags": [
- "audit_plan"
+ "sql_audit_record"
],
- "summary": "增量同步SQL到扫描任务",
- "operationId": "partialSyncAuditPlanSQLsV1",
- "deprecated": true,
+ "summary": "获取SQL审核记录列表",
+ "operationId": "getSQLAuditRecordsV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "fuzzy search tags",
+ "name": "fuzzy_search_tags",
+ "in": "query"
},
{
+ "enum": [
+ "auditing",
+ "successfully"
+ ],
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
- "in": "path",
- "required": true
+ "description": "filter sql audit status",
+ "name": "filter_sql_audit_status",
+ "in": "query"
},
{
- "description": "partial sync audit plan SQLs request",
- "name": "sqls",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.PartialSyncAuditPlanSQLsReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/trigger": {
- "post": {
- "security": [
+ "type": "integer",
+ "description": "filter instance id",
+ "name": "filter_instance_id",
+ "in": "query"
+ },
{
- "ApiKeyAuth": []
- }
- ],
- "description": "trigger audit plan",
- "tags": [
- "audit_plan"
- ],
- "summary": "触发扫描任务",
- "operationId": "triggerAuditPlanV1",
- "parameters": [
+ "type": "string",
+ "description": "filter create time from",
+ "name": "filter_create_time_from",
+ "in": "query"
+ },
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
+ "description": "filter create time to",
+ "name": "filter_create_time_to",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter sql audit record ids",
+ "name": "filter_sql_audit_record_ids",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "size of per page",
+ "name": "page_size",
+ "in": "query",
"required": true
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
+ "description": "project name",
+ "name": "project_name",
"in": "path",
"required": true
}
@@ -2848,25 +2707,29 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.TriggerAuditPlanResV1"
+ "$ref": "#/definitions/v1.GetSQLAuditRecordsResV1"
}
}
}
- }
- },
- "/v1/projects/{project_name}/audit_whitelist": {
- "get": {
+ },
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get all whitelist",
+ "description": "SQL audit\n1. formData[sql]: sql content;\n2. file[input_sql_file]: it is a sql file;\n3. file[input_mybatis_xml_file]: it is mybatis xml file, sql will be parsed from it.\n4. file[input_zip_file]: it is ZIP file that sql will be parsed from xml or sql file inside it.\n5. formData[git_http_url]:the url which scheme is http(s) and end with .git.\n6. formData[git_user_name]:The name of the user who owns the repository read access.\n7. formData[git_user_password]:The password corresponding to git_user_name.",
+ "consumes": [
+ "multipart/form-data"
+ ],
+ "produces": [
+ "application/json"
+ ],
"tags": [
- "audit_whitelist"
+ "sql_audit_record"
],
- "summary": "获取Sql审核白名单",
- "operationId": "getAuditWhitelistV1",
+ "summary": "SQL审核",
+ "operationId": "CreateSQLAuditRecordV1",
"parameters": [
{
"type": "string",
@@ -2877,43 +2740,88 @@ var doc = `{
},
{
"type": "string",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
+ "description": "instance name",
+ "name": "instance_name",
+ "in": "formData"
},
{
"type": "string",
- "description": "page size",
- "name": "page_size",
- "in": "query",
- "required": true
+ "description": "schema of instance",
+ "name": "instance_schema",
+ "in": "formData"
+ },
+ {
+ "type": "string",
+ "description": "db type of instance",
+ "name": "db_type",
+ "in": "formData"
+ },
+ {
+ "type": "string",
+ "description": "sqls for audit",
+ "name": "sqls",
+ "in": "formData"
+ },
+ {
+ "type": "file",
+ "description": "input SQL file",
+ "name": "input_sql_file",
+ "in": "formData"
+ },
+ {
+ "type": "file",
+ "description": "input mybatis XML file",
+ "name": "input_mybatis_xml_file",
+ "in": "formData"
+ },
+ {
+ "type": "file",
+ "description": "input ZIP file",
+ "name": "input_zip_file",
+ "in": "formData"
+ },
+ {
+ "type": "string",
+ "description": "git repository url",
+ "name": "git_http_url",
+ "in": "formData"
+ },
+ {
+ "type": "string",
+ "description": "the name of user to clone the repository",
+ "name": "git_user_name",
+ "in": "formData"
+ },
+ {
+ "type": "string",
+ "description": "the password corresponding to git_user_name",
+ "name": "git_user_password",
+ "in": "formData"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetAuditWhitelistResV1"
+ "$ref": "#/definitions/v1.CreateSQLAuditRecordResV1"
}
}
}
- },
- "post": {
+ }
+ },
+ "/v1/projects/{project_name}/sql_audit_records/tag_tips": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "create a sql whitelist",
- "consumes": [
- "application/json"
- ],
+ "description": "get sql audit record tag tips",
"tags": [
- "audit_whitelist"
+ "sql_audit_record"
],
- "summary": "添加SQL白名单",
- "operationId": "createAuditWhitelistV1",
+ "summary": "获取SQL审核记录标签列表",
+ "operationId": "GetSQLAuditRecordTagTipsV1",
"parameters": [
{
"type": "string",
@@ -2921,40 +2829,31 @@ var doc = `{
"name": "project_name",
"in": "path",
"required": true
- },
- {
- "description": "add sql whitelist req",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.CreateAuditWhitelistReqV1"
- }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetSQLAuditRecordTagTipsResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/audit_whitelist/{audit_whitelist_id}/": {
- "delete": {
+ "/v1/projects/{project_name}/sql_audit_records/{sql_audit_record_id}/": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "remove sql white",
+ "description": "get sql audit record info",
"tags": [
- "audit_whitelist"
+ "sql_audit_record"
],
- "summary": "删除SQL白名单信息",
- "operationId": "deleteAuditWhitelistByIdV1",
+ "summary": "获取SQL审核记录信息",
+ "operationId": "getSQLAuditRecordV1",
"parameters": [
{
"type": "string",
@@ -2965,8 +2864,8 @@ var doc = `{
},
{
"type": "string",
- "description": "audit whitelist id",
- "name": "audit_whitelist_id",
+ "description": "sql audit record id",
+ "name": "sql_audit_record_id",
"in": "path",
"required": true
}
@@ -2975,7 +2874,7 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetSQLAuditRecordResV1"
}
}
}
@@ -2986,15 +2885,15 @@ var doc = `{
"ApiKeyAuth": []
}
],
- "description": "update sql whitelist by id",
+ "description": "update SQL audit record",
"consumes": [
"application/json"
],
"tags": [
- "audit_whitelist"
+ "sql_audit_record"
],
- "summary": "更新SQL白名单",
- "operationId": "UpdateAuditWhitelistByIdV1",
+ "summary": "更新SQL审核记录",
+ "operationId": "updateSQLAuditRecordV1",
"parameters": [
{
"type": "string",
@@ -3005,18 +2904,18 @@ var doc = `{
},
{
"type": "string",
- "description": "sql audit whitelist id",
- "name": "audit_whitelist_id",
+ "description": "sql audit record id",
+ "name": "sql_audit_record_id",
"in": "path",
"required": true
},
{
- "description": "update sql whitelist req",
- "name": "instance",
+ "description": "update SQL audit record",
+ "name": "param",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.UpdateAuditWhitelistReqV1"
+ "$ref": "#/definitions/v1.UpdateSQLAuditRecordReqV1"
}
}
],
@@ -3030,19 +2929,20 @@ var doc = `{
}
}
},
- "/v1/projects/{project_name}/instance_tips": {
+ "/v1/projects/{project_name}/sql_manages": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get instance tip list",
+ "description": "get sql manage list",
"tags": [
- "instance"
+ "SqlManage"
],
- "summary": "获取实例提示列表",
- "operationId": "getInstanceTipListV1",
+ "summary": "获取管控sql列表",
+ "operationId": "GetSqlManageList",
+ "deprecated": true,
"parameters": [
{
"type": "string",
@@ -3053,93 +2953,111 @@ var doc = `{
},
{
"type": "string",
- "description": "filter db type",
- "name": "filter_db_type",
+ "description": "fuzzy search sql fingerprint",
+ "name": "fuzzy_search_sql_fingerprint",
"in": "query"
},
{
"type": "string",
- "description": "filter workflow template id",
- "name": "filter_workflow_template_id",
+ "description": "assignee",
+ "name": "filter_assignee",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "instance name",
+ "name": "filter_instance_name",
"in": "query"
},
{
"enum": [
- "create_audit_plan",
- "create_workflow",
- "sql_manage"
+ "audit_plan",
+ "sql_audit_record"
],
"type": "string",
- "description": "functional module",
- "name": "functional_module",
+ "description": "source",
+ "name": "filter_source",
"in": "query"
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetInstanceTipsResV1"
- }
- }
- }
- }
- },
- "/v1/projects/{project_name}/instances": {
- "get": {
- "security": [
+ },
{
- "ApiKeyAuth": []
- }
- ],
- "description": "get instance info list",
- "tags": [
- "instance"
- ],
- "summary": "获取实例信息列表",
- "operationId": "getInstanceListV1",
- "parameters": [
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ],
+ "type": "string",
+ "description": "audit level",
+ "name": "filter_audit_level",
+ "in": "query"
+ },
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "last audit start time from",
+ "name": "filter_last_audit_start_time_from",
+ "in": "query"
},
{
"type": "string",
- "description": "filter instance name",
- "name": "filter_instance_name",
+ "description": "last audit start time to",
+ "name": "filter_last_audit_start_time_to",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "unhandled",
+ "solved",
+ "ignored",
+ "manual_audited"
+ ],
+ "type": "string",
+ "description": "status",
+ "name": "filter_status",
"in": "query"
},
{
"type": "string",
- "description": "filter db type",
+ "description": "rule name",
+ "name": "filter_rule_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "db type",
"name": "filter_db_type",
"in": "query"
},
{
"type": "string",
- "description": "filter db host",
- "name": "filter_db_host",
+ "description": "fuzzy search endpoint",
+ "name": "fuzzy_search_endpoint",
"in": "query"
},
{
"type": "string",
- "description": "filter db port",
- "name": "filter_db_port",
+ "description": "fuzzy search schema name",
+ "name": "fuzzy_search_schema_name",
"in": "query"
},
{
+ "enum": [
+ "first_appear_timestamp",
+ "last_receive_timestamp",
+ "fp_count"
+ ],
"type": "string",
- "description": "filter db user",
- "name": "filter_db_user",
+ "description": "sort field",
+ "name": "sort_field",
"in": "query"
},
{
+ "enum": [
+ "asc",
+ "desc"
+ ],
"type": "string",
- "description": "filter rule template name",
- "name": "filter_rule_template_name",
+ "description": "sort order",
+ "name": "sort_order",
"in": "query"
},
{
@@ -3161,27 +3079,25 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetInstancesResV1"
+ "$ref": "#/definitions/v1.GetSqlManageListResp"
}
}
}
- },
- "post": {
+ }
+ },
+ "/v1/projects/{project_name}/sql_manages/batch": {
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "create a instance",
- "consumes": [
- "application/json"
- ],
+ "description": "batch update sql manage",
"tags": [
- "instance"
+ "SqlManage"
],
- "summary": "添加实例",
- "operationId": "createInstanceV1",
- "deprecated": true,
+ "summary": "批量更新SQL管控",
+ "operationId": "BatchUpdateSqlManage",
"parameters": [
{
"type": "string",
@@ -3191,12 +3107,12 @@ var doc = `{
"required": true
},
{
- "description": "add instance",
- "name": "instance",
+ "description": "batch update sql manage request",
+ "name": "BatchUpdateSqlManageReq",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.CreateInstanceReqV1"
+ "$ref": "#/definitions/v1.BatchUpdateSqlManageReq"
}
}
],
@@ -3210,19 +3126,19 @@ var doc = `{
}
}
},
- "/v1/projects/{project_name}/instances/connections": {
- "post": {
+ "/v1/projects/{project_name}/sql_manages/exports": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "batch test instance db connections",
+ "description": "export sql manage",
"tags": [
- "instance"
+ "SqlManage"
],
- "summary": "批量测试实例连通性(实例提交后)",
- "operationId": "batchCheckInstanceIsConnectableByName",
+ "summary": "导出SQL管控",
+ "operationId": "exportSqlManageV1",
"parameters": [
{
"type": "string",
@@ -3232,160 +3148,138 @@ var doc = `{
"required": true
},
{
- "description": "instances",
- "name": "instances",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.BatchCheckInstanceConnectionsReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.BatchGetInstanceConnectionsResV1"
- }
- }
- }
- }
- },
- "/v1/projects/{project_name}/instances/{instance_name}/": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get instance db",
- "tags": [
- "instance"
- ],
- "summary": "获取实例信息",
- "operationId": "getInstanceV1",
- "parameters": [
+ "type": "string",
+ "description": "fuzzy search sql fingerprint",
+ "name": "fuzzy_search_sql_fingerprint",
+ "in": "query"
+ },
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "assignee",
+ "name": "filter_assignee",
+ "in": "query"
},
{
"type": "string",
"description": "instance name",
- "name": "instance_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetInstanceResV1"
- }
- }
- }
- },
- "delete": {
- "security": [
+ "name": "filter_instance_name",
+ "in": "query"
+ },
{
- "ApiKeyAuth": []
- }
- ],
- "description": "delete instance db",
- "tags": [
- "instance"
- ],
- "summary": "删除实例",
- "operationId": "deleteInstanceV1",
- "parameters": [
+ "enum": [
+ "audit_plan",
+ "sql_audit_record"
+ ],
+ "type": "string",
+ "description": "source",
+ "name": "filter_source",
+ "in": "query"
+ },
{
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ],
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "audit level",
+ "name": "filter_audit_level",
+ "in": "query"
},
{
"type": "string",
- "description": "instance name",
- "name": "instance_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- },
- "patch": {
- "security": [
+ "description": "last audit start time from",
+ "name": "filter_last_audit_start_time_from",
+ "in": "query"
+ },
{
- "ApiKeyAuth": []
- }
- ],
- "description": "update instance",
- "tags": [
- "instance"
- ],
- "summary": "更新实例",
- "operationId": "updateInstanceV1",
- "parameters": [
+ "type": "string",
+ "description": "last audit start time to",
+ "name": "filter_last_audit_start_time_to",
+ "in": "query"
+ },
{
+ "enum": [
+ "unhandled",
+ "solved",
+ "ignored",
+ "manual_audited"
+ ],
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "status",
+ "name": "filter_status",
+ "in": "query"
},
{
"type": "string",
- "description": "instance name",
- "name": "instance_name",
- "in": "path",
- "required": true
+ "description": "db type",
+ "name": "filter_db_type",
+ "in": "query"
},
{
- "description": "update instance request",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateInstanceReqV1"
- }
+ "type": "string",
+ "description": "rule name",
+ "name": "filter_rule_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "fuzzy search endpoint",
+ "name": "fuzzy_search_endpoint",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "fuzzy search schema name",
+ "name": "fuzzy_search_schema_name",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "first_appear_timestamp",
+ "last_receive_timestamp",
+ "fp_count"
+ ],
+ "type": "string",
+ "description": "sort field",
+ "name": "sort_field",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "asc",
+ "desc"
+ ],
+ "type": "string",
+ "description": "sort order",
+ "name": "sort_order",
+ "in": "query"
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "export sql manage",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "type": "file"
}
}
}
}
},
- "/v1/projects/{project_name}/instances/{instance_name}/connection": {
+ "/v1/projects/{project_name}/sql_manages/rule_tips": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "test instance db connection",
+ "description": "get sql manage rule tips",
"tags": [
- "instance"
+ "SqlManage"
],
- "summary": "实例连通性测试(实例提交后)",
- "operationId": "checkInstanceIsConnectableByNameV1",
+ "summary": "获取管控规则tips",
+ "operationId": "GetSqlManageRuleTips",
"parameters": [
{
"type": "string",
@@ -3393,38 +3287,31 @@ var doc = `{
"name": "project_name",
"in": "path",
"required": true
- },
- {
- "type": "string",
- "description": "instance name",
- "name": "instance_name",
- "in": "path",
- "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetInstanceConnectableResV1"
+ "$ref": "#/definitions/v1.GetSqlManageRuleTipsResp"
}
}
}
}
},
- "/v1/projects/{project_name}/instances/{instance_name}/rules": {
+ "/v1/projects/{project_name}/sql_manages/{sql_manage_id}/sql_analysis": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get instance all rule",
+ "description": "get sql manage analysis",
"tags": [
- "instance"
+ "SqlManage"
],
- "summary": "获取实例应用的规则列表",
- "operationId": "getInstanceRuleListV1",
+ "summary": "获取SQL管控SQL分析",
+ "operationId": "GetSqlManageSqlAnalysisV1",
"parameters": [
{
"type": "string",
@@ -3435,8 +3322,8 @@ var doc = `{
},
{
"type": "string",
- "description": "instance name",
- "name": "instance_name",
+ "description": "sql manage id",
+ "name": "sql_manage_id",
"in": "path",
"required": true
}
@@ -3445,25 +3332,25 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRulesResV1"
+ "$ref": "#/definitions/v1.GetSqlManageSqlAnalysisResp"
}
}
}
}
},
- "/v1/projects/{project_name}/instances/{instance_name}/schemas": {
+ "/v1/projects/{project_name}/statistic/audit_plans": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "instance schema list",
+ "description": "statistic audit plan",
"tags": [
- "instance"
+ "statistic"
],
- "summary": "实例 Schema 列表",
- "operationId": "getInstanceSchemasV1",
+ "summary": "获取各类型数据源上的扫描任务数量",
+ "operationId": "statisticAuditPlanV1",
"parameters": [
{
"type": "string",
@@ -3471,38 +3358,31 @@ var doc = `{
"name": "project_name",
"in": "path",
"required": true
- },
- {
- "type": "string",
- "description": "instance name",
- "name": "instance_name",
- "in": "path",
- "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetInstanceSchemaResV1"
+ "$ref": "#/definitions/v1.StatisticAuditPlanResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/instances/{instance_name}/schemas/{schema_name}/tables": {
+ "/v1/projects/{project_name}/statistic/audited_sqls": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "list table by schema",
+ "description": "statistics audited sql",
"tags": [
- "instance"
+ "statistic"
],
- "summary": "获取数据库下的所有表",
- "operationId": "listTableBySchema",
+ "summary": "获取审核SQL总数,以及触发审核规则的SQL数量",
+ "operationId": "statisticsAuditedSQLV1",
"parameters": [
{
"type": "string",
@@ -3510,45 +3390,31 @@ var doc = `{
"name": "project_name",
"in": "path",
"required": true
- },
- {
- "type": "string",
- "description": "instance name",
- "name": "instance_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "schema name",
- "name": "schema_name",
- "in": "path",
- "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.ListTableBySchemaResV1"
+ "$ref": "#/definitions/v1.StatisticsAuditedSQLResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/instances/{instance_name}/schemas/{schema_name}/tables/{table_name}/metadata": {
+ "/v1/projects/{project_name}/statistic/instance_health": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get table metadata",
+ "description": "get instance health",
"tags": [
- "instance"
+ "statistic"
],
- "summary": "获取表元数据",
- "operationId": "getTableMetadata",
+ "summary": "获取各类型数据源的健康情况",
+ "operationId": "GetInstanceHealthV1",
"parameters": [
{
"type": "string",
@@ -3556,79 +3422,32 @@ var doc = `{
"name": "project_name",
"in": "path",
"required": true
- },
- {
- "type": "string",
- "description": "instance name",
- "name": "instance_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "schema name",
- "name": "schema_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "table name",
- "name": "table_name",
- "in": "path",
- "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetTableMetadataResV1"
+ "$ref": "#/definitions/v1.GetInstanceHealthResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/member_groups": {
+ "/v1/projects/{project_name}/statistic/project_score": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get member groups",
+ "description": "get project score",
"tags": [
- "user_group"
+ "statistic"
],
- "summary": "获取成员组列表",
- "operationId": "getMemberGroupsV1",
+ "summary": "获取项目分数",
+ "operationId": "GetProjectScoreV1",
"parameters": [
- {
- "type": "string",
- "description": "filter user group name",
- "name": "filter_user_group_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter instance name",
- "name": "filter_instance_name",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
- },
{
"type": "string",
"description": "project name",
@@ -3641,29 +3460,25 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetMemberGroupsRespV1"
+ "$ref": "#/definitions/v1.GetProjectScoreResV1"
}
}
}
- },
- "post": {
+ }
+ },
+ "/v1/projects/{project_name}/statistic/risk_audit_plans": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "add member group",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "get risk audit plan",
"tags": [
- "user_group"
+ "statistic"
],
- "summary": "添加成员组",
- "operationId": "addMemberGroupV1",
+ "summary": "获取扫描任务报告评分低于60的扫描任务",
+ "operationId": "getRiskAuditPlanV1",
"parameters": [
{
"type": "string",
@@ -3671,77 +3486,31 @@ var doc = `{
"name": "project_name",
"in": "path",
"required": true
- },
- {
- "description": "add member group",
- "name": "data",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.CreateMemberGroupReqV1"
- }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetRiskAuditPlanResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/member_groups/{user_group_name}/": {
+ "/v1/projects/{project_name}/statistic/risk_workflow": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get member group",
+ "description": "statistic risk workflow",
"tags": [
- "user_group"
+ "statistic"
],
- "summary": "获取成员组信息",
- "operationId": "getMemberGroupV1",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "user group name",
- "name": "user_group_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetMemberGroupRespV1"
- }
- }
- }
- },
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "delete member group",
- "tags": [
- "user_group"
- ],
- "summary": "删除成员组",
- "operationId": "deleteMemberGroupV1",
+ "summary": "获取存在风险的工单",
+ "operationId": "statisticRiskWorkflowV1",
"parameters": [
{
"type": "string",
@@ -3749,42 +3518,31 @@ var doc = `{
"name": "project_name",
"in": "path",
"required": true
- },
- {
- "type": "string",
- "description": "user group name",
- "name": "user_group_name",
- "in": "path",
- "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.StatisticRiskWorkflowResV1"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v1/projects/{project_name}/statistic/role_user": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update member group",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "get role user count",
"tags": [
- "user_group"
+ "statistic"
],
- "summary": "修改成员组",
- "operationId": "updateMemberGroupV1",
+ "summary": "获取各角色类型对应的成员数量",
+ "operationId": "getRoleUserCountV1",
"parameters": [
{
"type": "string",
@@ -3792,47 +3550,31 @@ var doc = `{
"name": "project_name",
"in": "path",
"required": true
- },
- {
- "type": "string",
- "description": "user group name",
- "name": "user_group_name",
- "in": "path",
- "required": true
- },
- {
- "description": "update member_group",
- "name": "data",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateMemberGroupReqV1"
- }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetRoleUserCountResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/member_tips": {
+ "/v1/projects/{project_name}/statistic/workflow_status": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get member tip list",
+ "description": "statistic workflow status",
"tags": [
- "user"
+ "statistic"
],
- "summary": "获取成员提示列表",
- "operationId": "getMemberTipListV1",
+ "summary": "获取项目下工单各个状态的数量",
+ "operationId": "statisticWorkflowStatusV1",
"parameters": [
{
"type": "string",
@@ -3846,52 +3588,26 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetMemberTipsResV1"
+ "$ref": "#/definitions/v1.GetWorkflowStatusCountResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/members": {
+ "/v1/projects/{project_name}/statistics": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get members",
+ "description": "get project statistics",
"tags": [
- "user"
+ "statistic"
],
- "summary": "获取成员列表",
- "operationId": "getMembersV1",
+ "summary": "获取项目统计信息",
+ "operationId": "getProjectStatisticsV1",
"parameters": [
- {
- "type": "string",
- "description": "filter user name",
- "name": "filter_user_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter instance name",
- "name": "filter_instance_name",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
- },
{
"type": "string",
"description": "project name",
@@ -3904,18 +3620,20 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetMembersRespV1"
+ "$ref": "#/definitions/v1.GetProjectStatisticsResV1"
}
}
}
- },
+ }
+ },
+ "/v1/projects/{project_name}/task_groups": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "add member",
+ "description": "create tasks group.",
"consumes": [
"application/json"
],
@@ -3923,10 +3641,10 @@ var doc = `{
"application/json"
],
"tags": [
- "user"
+ "task"
],
- "summary": "添加成员",
- "operationId": "addMemberV1",
+ "summary": "创建审核任务组",
+ "operationId": "createAuditTasksV1",
"parameters": [
{
"type": "string",
@@ -3936,12 +3654,12 @@ var doc = `{
"required": true
},
{
- "description": "add member",
- "name": "data",
+ "description": "parameters for creating audit tasks group",
+ "name": "req",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.CreateMemberReqV1"
+ "$ref": "#/definitions/v1.CreateAuditTasksGroupReqV1"
}
}
],
@@ -3949,25 +3667,31 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.CreateAuditTasksGroupResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/members/{user_name}/": {
- "get": {
+ "/v1/projects/{project_name}/tasks/audits": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get member",
+ "description": "create and audit a task, you can upload sql content in three ways, any one can be used, but only one is effective.\n1. formData[sql]: sql content;\n2. file[input_sql_file]: it is a sql file;\n3. file[input_mybatis_xml_file]: it is mybatis xml file, sql will be parsed from it.",
+ "consumes": [
+ "multipart/form-data"
+ ],
+ "produces": [
+ "application/json"
+ ],
"tags": [
- "user"
+ "task"
],
- "summary": "获取成员信息",
- "operationId": "getMemberV1",
+ "summary": "创建Sql扫描任务并提交审核",
+ "operationId": "createAndAuditTaskV1",
"parameters": [
{
"type": "string",
@@ -3978,33 +3702,65 @@ var doc = `{
},
{
"type": "string",
- "description": "user name",
- "name": "user_name",
- "in": "path",
+ "description": "instance name",
+ "name": "instance_name",
+ "in": "formData",
"required": true
+ },
+ {
+ "type": "string",
+ "description": "schema of instance",
+ "name": "instance_schema",
+ "in": "formData"
+ },
+ {
+ "type": "string",
+ "description": "sqls for audit",
+ "name": "sql",
+ "in": "formData"
+ },
+ {
+ "type": "file",
+ "description": "input SQL file",
+ "name": "input_sql_file",
+ "in": "formData"
+ },
+ {
+ "type": "file",
+ "description": "input mybatis XML file",
+ "name": "input_mybatis_xml_file",
+ "in": "formData"
+ },
+ {
+ "type": "file",
+ "description": "input ZIP file",
+ "name": "input_zip_file",
+ "in": "formData"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetMemberRespV1"
+ "$ref": "#/definitions/v1.GetAuditTaskResV1"
}
}
}
- },
- "delete": {
+ }
+ },
+ "/v1/projects/{project_name}/workflow_template": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "delete member",
+ "description": "get workflow template detail",
"tags": [
- "user"
+ "workflow"
],
- "summary": "删除成员",
- "operationId": "deleteMemberV1",
+ "summary": "获取审批流程模板详情",
+ "operationId": "getWorkflowTemplateV1",
"parameters": [
{
"type": "string",
@@ -4012,20 +3768,13 @@ var doc = `{
"name": "project_name",
"in": "path",
"required": true
- },
- {
- "type": "string",
- "description": "user name",
- "name": "user_name",
- "in": "path",
- "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetWorkflowTemplateResV1"
}
}
}
@@ -4036,7 +3785,7 @@ var doc = `{
"ApiKeyAuth": []
}
],
- "description": "update member",
+ "description": "update the workflow template",
"consumes": [
"application/json"
],
@@ -4044,10 +3793,10 @@ var doc = `{
"application/json"
],
"tags": [
- "user"
+ "workflow"
],
- "summary": "修改成员",
- "operationId": "updateMemberV1",
+ "summary": "更新Sql审批流程模板",
+ "operationId": "updateWorkflowTemplateV1",
"parameters": [
{
"type": "string",
@@ -4057,19 +3806,12 @@ var doc = `{
"required": true
},
{
- "type": "string",
- "description": "user name",
- "name": "user_name",
- "in": "path",
- "required": true
- },
- {
- "description": "update member",
- "name": "data",
+ "description": "create workflow template",
+ "name": "instance",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.UpdateMemberReqV1"
+ "$ref": "#/definitions/v1.UpdateWorkflowTemplateReqV1"
}
}
],
@@ -4083,64 +3825,94 @@ var doc = `{
}
}
},
- "/v1/projects/{project_name}/rule_template_tips": {
+ "/v1/projects/{project_name}/workflows": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get rule template tips in project",
+ "description": "get workflow list",
"tags": [
- "rule_template"
+ "workflow"
],
- "summary": "获取项目规则模板提示",
- "operationId": "getProjectRuleTemplateTipsV1",
+ "summary": "获取工单列表",
+ "operationId": "getWorkflowsV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "filter subject",
+ "name": "filter_subject",
+ "in": "query"
},
{
"type": "string",
- "description": "filter db type",
- "name": "filter_db_type",
+ "description": "filter by workflow_id",
+ "name": "filter_workflow_id",
"in": "query"
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetRuleTemplateTipsResV1"
- }
- }
- }
- }
- },
- "/v1/projects/{project_name}/rule_templates": {
- "get": {
- "security": [
+ },
{
- "ApiKeyAuth": []
- }
- ],
- "description": "get all rule template in a project",
- "tags": [
- "rule_template"
- ],
- "summary": "项目规则模板列表",
- "operationId": "getProjectRuleTemplateListV1",
- "parameters": [
+ "type": "string",
+ "description": "fuzzy search by workflow description",
+ "name": "fuzzy_search_workflow_desc",
+ "in": "query"
+ },
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "filter create time from",
+ "name": "filter_create_time_from",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter create time to",
+ "name": "filter_create_time_to",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_task_execute_start_time_from",
+ "name": "filter_task_execute_start_time_from",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_task_execute_start_time_to",
+ "name": "filter_task_execute_start_time_to",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter create user id",
+ "name": "filter_create_user_id",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "wait_for_audit",
+ "wait_for_execution",
+ "rejected",
+ "executing",
+ "canceled",
+ "exec_failed",
+ "finished"
+ ],
+ "type": "string",
+ "description": "filter workflow status",
+ "name": "filter_status",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter current step assignee user id",
+ "name": "filter_current_step_assignee_user_id",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter instance name",
+ "name": "filter_task_instance_name",
+ "in": "query"
},
{
"type": "integer",
@@ -4155,13 +3927,26 @@ var doc = `{
"name": "page_size",
"in": "query",
"required": true
+ },
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "fuzzy matching subject/workflow_id",
+ "name": "fuzzy_keyword",
+ "in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetProjectRuleTemplatesResV1"
+ "$ref": "#/definitions/v1.GetWorkflowsResV1"
}
}
}
@@ -4172,31 +3957,35 @@ var doc = `{
"ApiKeyAuth": []
}
],
- "description": "create a rule template in project",
+ "description": "create workflow",
"consumes": [
"application/json"
],
+ "produces": [
+ "application/json"
+ ],
"tags": [
- "rule_template"
+ "workflow"
],
- "summary": "添加项目规则模板",
- "operationId": "createProjectRuleTemplateV1",
+ "summary": "创建工单",
+ "operationId": "createWorkflowV1",
+ "deprecated": true,
"parameters": [
+ {
+ "description": "create workflow request",
+ "name": "instance",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.CreateWorkflowReqV1"
+ }
+ },
{
"type": "string",
"description": "project name",
"name": "project_name",
"in": "path",
"required": true
- },
- {
- "description": "add rule template request",
- "name": "req",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.CreateProjectRuleTemplateReqV1"
- }
}
],
"responses": {
@@ -4209,19 +3998,20 @@ var doc = `{
}
}
},
- "/v1/projects/{project_name}/rule_templates/{rule_template_name}/": {
- "get": {
+ "/v1/projects/{project_name}/workflows/cancel": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get rule template detail in project",
+ "description": "batch cancel workflows",
"tags": [
- "rule_template"
+ "workflow"
],
- "summary": "获取项目规则模板信息",
- "operationId": "getProjectRuleTemplateV1",
+ "summary": "批量取消工单",
+ "operationId": "batchCancelWorkflowsV1",
+ "deprecated": true,
"parameters": [
{
"type": "string",
@@ -4231,34 +4021,39 @@ var doc = `{
"required": true
},
{
- "type": "string",
- "description": "rule template name",
- "name": "rule_template_name",
- "in": "path",
- "required": true
+ "description": "batch cancel workflows request",
+ "name": "BatchCancelWorkflowsReqV1",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.BatchCancelWorkflowsReqV1"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetProjectRuleTemplateResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
- },
- "delete": {
+ }
+ },
+ "/v1/projects/{project_name}/workflows/complete": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "delete rule template in project",
+ "description": "this api will directly change the work order status to finished without real online operation",
"tags": [
- "rule_template"
+ "workflow"
],
- "summary": "删除项目规则模板",
- "operationId": "deleteProjectRuleTemplateV1",
+ "summary": "批量完成工单",
+ "operationId": "batchCompleteWorkflowsV1",
+ "deprecated": true,
"parameters": [
{
"type": "string",
@@ -4268,11 +4063,13 @@ var doc = `{
"required": true
},
{
- "type": "string",
- "description": "rule template name",
- "name": "rule_template_name",
- "in": "path",
- "required": true
+ "description": "batch complete workflows request",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.BatchCompleteWorkflowsReqV1"
+ }
}
],
"responses": {
@@ -4283,93 +4080,142 @@ var doc = `{
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v1/projects/{project_name}/workflows/exports": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update rule template in project",
+ "description": "export workflow",
"tags": [
- "rule_template"
+ "workflow"
],
- "summary": "更新项目规则模板",
- "operationId": "updateProjectRuleTemplateV1",
+ "summary": "导出工单",
+ "operationId": "exportWorkflowV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "filter subject",
+ "name": "filter_subject",
+ "in": "query"
},
{
"type": "string",
- "description": "rule template name",
- "name": "rule_template_name",
+ "description": "fuzzy search by workflow description",
+ "name": "fuzzy_search_workflow_desc",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter create time from",
+ "name": "filter_create_time_from",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter create time to",
+ "name": "filter_create_time_to",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_task_execute_start_time_from",
+ "name": "filter_task_execute_start_time_from",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_task_execute_start_time_to",
+ "name": "filter_task_execute_start_time_to",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter create user id",
+ "name": "filter_create_user_id",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "wait_for_audit",
+ "wait_for_execution",
+ "rejected",
+ "executing",
+ "canceled",
+ "exec_failed",
+ "finished"
+ ],
+ "type": "string",
+ "description": "filter workflow status",
+ "name": "filter_status",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter current step assignee user id",
+ "name": "filter_current_step_assignee_user_id",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter instance name",
+ "name": "filter_task_instance_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
"in": "path",
"required": true
},
{
- "description": "update rule template request",
- "name": "req",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateProjectRuleTemplateReqV1"
- }
+ "type": "string",
+ "description": "fuzzy matching subject/workflow_id/desc",
+ "name": "fuzzy_keyword",
+ "in": "query"
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "export workflow",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "type": "file"
}
}
}
}
},
- "/v1/projects/{project_name}/rule_templates/{rule_template_name}/clone": {
+ "/v1/projects/{project_name}/workflows/{workflow_id}/tasks/terminate": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "clone a rule template in project",
- "consumes": [
- "application/json"
- ],
+ "description": "terminate multiple task by project and workflow",
"tags": [
- "rule_template"
+ "workflow"
],
- "summary": "克隆项目规则模板",
- "operationId": "cloneProjectRuleTemplateV1",
+ "summary": "终止工单下多个上线任务",
+ "operationId": "terminateMultipleTaskByWorkflowV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "workflow id",
+ "name": "workflow_id",
"in": "path",
"required": true
},
{
"type": "string",
- "description": "rule template name",
- "name": "rule_template_name",
+ "description": "project name",
+ "name": "project_name",
"in": "path",
"required": true
- },
- {
- "description": "clone rule template request",
- "name": "req",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.CloneProjectRuleTemplateReqV1"
- }
}
],
"responses": {
@@ -4382,20 +4228,27 @@ var doc = `{
}
}
},
- "/v1/projects/{project_name}/rule_templates/{rule_template_name}/export": {
- "get": {
+ "/v1/projects/{project_name}/workflows/{workflow_id}/tasks/{task_id}/terminate": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "export rule template in a project",
+ "description": "execute one task on workflow",
"tags": [
- "rule_template"
+ "workflow"
],
- "summary": "导出项目规则模板",
- "operationId": "exportProjectRuleTemplateV1",
+ "summary": "终止单个上线任务",
+ "operationId": "terminateSingleTaskByWorkflowV1",
"parameters": [
+ {
+ "type": "string",
+ "description": "workflow id",
+ "name": "workflow_id",
+ "in": "path",
+ "required": true
+ },
{
"type": "string",
"description": "project name",
@@ -4405,88 +4258,42 @@ var doc = `{
},
{
"type": "string",
- "description": "rule template name",
- "name": "rule_template_name",
+ "description": "task id",
+ "name": "task_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
- "description": "sqle rule template file",
+ "description": "OK",
"schema": {
- "type": "file"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/sql_audit_records": {
+ "/v1/projects/{project_name}/workflows/{workflow_name}/": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get sql audit records",
+ "description": "get workflow detail",
"tags": [
- "sql_audit_record"
+ "workflow"
],
- "summary": "获取SQL审核记录列表",
- "operationId": "getSQLAuditRecordsV1",
+ "summary": "获取工单详情",
+ "operationId": "getWorkflowV1",
+ "deprecated": true,
"parameters": [
{
"type": "string",
- "description": "fuzzy search tags",
- "name": "fuzzy_search_tags",
- "in": "query"
- },
- {
- "enum": [
- "auditing",
- "successfully"
- ],
- "type": "string",
- "description": "filter sql audit status",
- "name": "filter_sql_audit_status",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter instance name",
- "name": "filter_instance_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create time from",
- "name": "filter_create_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create time to",
- "name": "filter_create_time_to",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter sql audit record ids",
- "name": "filter_sql_audit_record_ids",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
+ "description": "workflow name",
+ "name": "workflow_name",
+ "in": "path",
"required": true
},
{
@@ -4501,121 +4308,79 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSQLAuditRecordsResV1"
+ "$ref": "#/definitions/v1.GetWorkflowResV1"
}
}
}
},
- "post": {
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "SQL audit\n1. formData[sql]: sql content;\n2. file[input_sql_file]: it is a sql file;\n3. file[input_mybatis_xml_file]: it is mybatis xml file, sql will be parsed from it.\n4. file[input_zip_file]: it is ZIP file that sql will be parsed from xml or sql file inside it.\n5. formData[git_http_url]:the url which scheme is http(s) and end with .git.\n6. formData[git_user_name]:The name of the user who owns the repository read access.\n7. formData[git_user_password]:The password corresponding to git_user_name.",
+ "description": "update workflow when it is rejected to creator.",
"consumes": [
- "multipart/form-data"
+ "application/json"
],
"produces": [
"application/json"
],
"tags": [
- "sql_audit_record"
+ "workflow"
],
- "summary": "SQL审核",
- "operationId": "CreateSQLAuditRecordV1",
+ "summary": "更新工单(驳回后才可更新)",
+ "operationId": "updateWorkflowV1",
+ "deprecated": true,
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "workflow name",
+ "name": "workflow_name",
"in": "path",
"required": true
},
{
"type": "string",
- "description": "instance name",
- "name": "instance_name",
- "in": "formData"
- },
- {
- "type": "string",
- "description": "schema of instance",
- "name": "instance_schema",
- "in": "formData"
- },
- {
- "type": "string",
- "description": "db type of instance",
- "name": "db_type",
- "in": "formData"
- },
- {
- "type": "string",
- "description": "sqls for audit",
- "name": "sqls",
- "in": "formData"
- },
- {
- "type": "file",
- "description": "input SQL file",
- "name": "input_sql_file",
- "in": "formData"
- },
- {
- "type": "file",
- "description": "input mybatis XML file",
- "name": "input_mybatis_xml_file",
- "in": "formData"
- },
- {
- "type": "file",
- "description": "input ZIP file",
- "name": "input_zip_file",
- "in": "formData"
- },
- {
- "type": "string",
- "description": "git repository url",
- "name": "git_http_url",
- "in": "formData"
- },
- {
- "type": "string",
- "description": "the name of user to clone the repository",
- "name": "git_user_name",
- "in": "formData"
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
},
{
- "type": "string",
- "description": "the password corresponding to git_user_name",
- "name": "git_user_password",
- "in": "formData"
+ "description": "update workflow request",
+ "name": "instance",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.UpdateWorkflowReqV1"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.CreateSQLAuditRecordResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/sql_audit_records/tag_tips": {
- "get": {
+ "/v1/projects/{project_name}/workflows/{workflow_name}/cancel": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get sql audit record tag tips",
+ "description": "cancel workflow",
"tags": [
- "sql_audit_record"
+ "workflow"
],
- "summary": "获取SQL审核记录标签列表",
- "operationId": "GetSQLAuditRecordTagTipsV1",
+ "summary": "审批关闭(中止)",
+ "operationId": "cancelWorkflowV1",
+ "deprecated": true,
"parameters": [
{
"type": "string",
@@ -4623,43 +4388,58 @@ var doc = `{
"name": "project_name",
"in": "path",
"required": true
+ },
+ {
+ "type": "string",
+ "description": "workflow name",
+ "name": "workflow_name",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSQLAuditRecordTagTipsResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/sql_audit_records/{sql_audit_record_id}/": {
- "get": {
+ "/v1/projects/{project_name}/workflows/{workflow_name}/steps/{workflow_step_id}/approve": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get sql audit record info",
+ "description": "approve workflow",
"tags": [
- "sql_audit_record"
+ "workflow"
],
- "summary": "获取SQL审核记录信息",
- "operationId": "getSQLAuditRecordV1",
+ "summary": "审批通过",
+ "operationId": "approveWorkflowV1",
+ "deprecated": true,
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "workflow name",
+ "name": "workflow_name",
"in": "path",
"required": true
},
{
"type": "string",
- "description": "sql audit record id",
- "name": "sql_audit_record_id",
+ "description": "workflow step id",
+ "name": "workflow_step_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
"in": "path",
"required": true
}
@@ -4668,27 +4448,34 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSQLAuditRecordResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
- },
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
+ }
+ },
+ "/v1/projects/{project_name}/workflows/{workflow_name}/steps/{workflow_step_id}/reject": {
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
}
],
- "description": "update SQL audit record",
- "consumes": [
- "application/json"
- ],
+ "description": "reject workflow",
"tags": [
- "sql_audit_record"
+ "workflow"
],
- "summary": "更新SQL审核记录",
- "operationId": "updateSQLAuditRecordV1",
+ "summary": "审批驳回",
+ "operationId": "rejectWorkflowV1",
+ "deprecated": true,
"parameters": [
+ {
+ "type": "string",
+ "description": "workflow name",
+ "name": "workflow_name",
+ "in": "path",
+ "required": true
+ },
{
"type": "string",
"description": "project name",
@@ -4698,18 +4485,18 @@ var doc = `{
},
{
"type": "string",
- "description": "sql audit record id",
- "name": "sql_audit_record_id",
+ "description": "workflow step id",
+ "name": "workflow_step_id",
"in": "path",
"required": true
},
{
- "description": "update SQL audit record",
- "name": "param",
+ "description": "workflow approve request",
+ "name": "workflow_approve",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.UpdateSQLAuditRecordReqV1"
+ "$ref": "#/definitions/v1.RejectWorkflowReqV1"
}
}
],
@@ -4723,149 +4510,33 @@ var doc = `{
}
}
},
- "/v1/projects/{project_name}/sql_manages": {
+ "/v1/projects/{project_name}/workflows/{workflow_name}/tasks": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get sql manage list",
+ "description": "get summary of workflow instance tasks",
"tags": [
- "SqlManage"
+ "workflow"
],
- "summary": "获取管控sql列表",
- "operationId": "GetSqlManageList",
+ "summary": "获取工单数据源任务概览",
+ "operationId": "getSummaryOfInstanceTasksV1",
"deprecated": true,
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "workflow name",
+ "name": "workflow_name",
"in": "path",
"required": true
},
{
"type": "string",
- "description": "fuzzy search sql fingerprint",
- "name": "fuzzy_search_sql_fingerprint",
- "in": "query"
- },
- {
- "type": "string",
- "description": "assignee",
- "name": "filter_assignee",
- "in": "query"
- },
- {
- "type": "string",
- "description": "instance name",
- "name": "filter_instance_name",
- "in": "query"
- },
- {
- "enum": [
- "audit_plan",
- "sql_audit_record"
- ],
- "type": "string",
- "description": "source",
- "name": "filter_source",
- "in": "query"
- },
- {
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ],
- "type": "string",
- "description": "audit level",
- "name": "filter_audit_level",
- "in": "query"
- },
- {
- "type": "string",
- "description": "last audit start time from",
- "name": "filter_last_audit_start_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "last audit start time to",
- "name": "filter_last_audit_start_time_to",
- "in": "query"
- },
- {
- "enum": [
- "unhandled",
- "solved",
- "ignored",
- "manual_audited"
- ],
- "type": "string",
- "description": "status",
- "name": "filter_status",
- "in": "query"
- },
- {
- "type": "string",
- "description": "rule name",
- "name": "filter_rule_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "db type",
- "name": "filter_db_type",
- "in": "query"
- },
- {
- "type": "string",
- "description": "fuzzy search endpoint",
- "name": "fuzzy_search_endpoint",
- "in": "query"
- },
- {
- "type": "string",
- "description": "fuzzy search schema name",
- "name": "fuzzy_search_schema_name",
- "in": "query"
- },
- {
- "enum": [
- "first_appear_timestamp",
- "last_receive_timestamp",
- "fp_count"
- ],
- "type": "string",
- "description": "sort field",
- "name": "sort_field",
- "in": "query"
- },
- {
- "enum": [
- "asc",
- "desc"
- ],
- "type": "string",
- "description": "sort order",
- "name": "sort_order",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
"required": true
}
],
@@ -4873,41 +4544,40 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSqlManageListResp"
+ "$ref": "#/definitions/v1.GetWorkflowTasksResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/sql_manages/batch": {
- "patch": {
+ "/v1/projects/{project_name}/workflows/{workflow_name}/tasks/execute": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "batch update sql manage",
+ "description": "execute tasks on workflow",
"tags": [
- "SqlManage"
+ "workflow"
],
- "summary": "批量更新SQL管控",
- "operationId": "BatchUpdateSqlManage",
+ "summary": "多数据源批量上线",
+ "operationId": "executeTasksOnWorkflowV1",
+ "deprecated": true,
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "workflow name",
+ "name": "workflow_name",
"in": "path",
"required": true
},
{
- "description": "batch update sql manage request",
- "name": "BatchUpdateSqlManageReq",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.BatchUpdateSqlManageReq"
- }
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
}
],
"responses": {
@@ -4920,165 +4590,140 @@ var doc = `{
}
}
},
- "/v1/projects/{project_name}/sql_manages/exports": {
- "get": {
+ "/v1/projects/{project_name}/workflows/{workflow_name}/tasks/{task_id}/execute": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "export sql manage",
+ "description": "execute one task on workflow",
"tags": [
- "SqlManage"
+ "workflow"
],
- "summary": "导出SQL管控",
- "operationId": "exportSqlManageV1",
+ "summary": "工单提交单个数据源上线",
+ "operationId": "executeOneTaskOnWorkflowV1",
+ "deprecated": true,
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "workflow name",
+ "name": "workflow_name",
"in": "path",
"required": true
},
{
"type": "string",
- "description": "fuzzy search sql fingerprint",
- "name": "fuzzy_search_sql_fingerprint",
- "in": "query"
- },
- {
- "type": "string",
- "description": "assignee",
- "name": "filter_assignee",
- "in": "query"
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
},
{
"type": "string",
- "description": "instance name",
- "name": "filter_instance_name",
- "in": "query"
- },
+ "description": "task id",
+ "name": "task_id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/controller.BaseRes"
+ }
+ }
+ }
+ }
+ },
+ "/v1/projects/{project_name}/workflows/{workflow_name}/tasks/{task_id}/schedule": {
+ "put": {
+ "security": [
{
- "enum": [
- "audit_plan",
- "sql_audit_record"
- ],
- "type": "string",
- "description": "source",
- "name": "filter_source",
- "in": "query"
- },
- {
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ],
- "type": "string",
- "description": "audit level",
- "name": "filter_audit_level",
- "in": "query"
- },
- {
- "type": "string",
- "description": "last audit start time from",
- "name": "filter_last_audit_start_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "last audit start time to",
- "name": "filter_last_audit_start_time_to",
- "in": "query"
- },
- {
- "enum": [
- "unhandled",
- "solved",
- "ignored",
- "manual_audited"
- ],
- "type": "string",
- "description": "status",
- "name": "filter_status",
- "in": "query"
- },
- {
- "type": "string",
- "description": "db type",
- "name": "filter_db_type",
- "in": "query"
- },
- {
- "type": "string",
- "description": "rule name",
- "name": "filter_rule_name",
- "in": "query"
- },
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "update workflow schedule.",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "workflow"
+ ],
+ "summary": "设置工单数据源定时上线时间(设置为空则代表取消定时时间,需要SQL审核流程都通过后才可以设置)",
+ "operationId": "updateWorkflowScheduleV1",
+ "deprecated": true,
+ "parameters": [
{
"type": "string",
- "description": "fuzzy search endpoint",
- "name": "fuzzy_search_endpoint",
- "in": "query"
+ "description": "workflow name",
+ "name": "workflow_name",
+ "in": "path",
+ "required": true
},
{
"type": "string",
- "description": "fuzzy search schema name",
- "name": "fuzzy_search_schema_name",
- "in": "query"
+ "description": "task id",
+ "name": "task_id",
+ "in": "path",
+ "required": true
},
{
- "enum": [
- "first_appear_timestamp",
- "last_receive_timestamp",
- "fp_count"
- ],
"type": "string",
- "description": "sort field",
- "name": "sort_field",
- "in": "query"
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
},
{
- "enum": [
- "asc",
- "desc"
- ],
- "type": "string",
- "description": "sort order",
- "name": "sort_order",
- "in": "query"
+ "description": "update workflow schedule request",
+ "name": "instance",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.UpdateWorkflowScheduleReqV1"
+ }
}
],
"responses": {
"200": {
- "description": "export sql manage",
+ "description": "OK",
"schema": {
- "type": "file"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/sql_manages/rule_tips": {
+ "/v1/rule_knowledge/db_types/{db_type}/custom_rules/{rule_name}/": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get sql manage rule tips",
+ "description": "get custom rule knowledge",
"tags": [
- "SqlManage"
+ "rule_template"
],
- "summary": "获取管控规则tips",
- "operationId": "GetSqlManageRuleTips",
+ "summary": "查看自定义规则知识库",
+ "operationId": "getCustomRuleKnowledgeV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "rule name",
+ "name": "rule_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "db type of rule",
+ "name": "db_type",
"in": "path",
"required": true
}
@@ -5087,69 +4732,83 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSqlManageRuleTipsResp"
+ "$ref": "#/definitions/v1.GetRuleKnowledgeResV1"
}
}
}
- }
- },
- "/v1/projects/{project_name}/sql_manages/{sql_manage_id}/sql_analysis": {
- "get": {
+ },
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get sql manage analysis",
+ "description": "update custom rule knowledge",
"tags": [
- "SqlManage"
+ "rule_template"
],
- "summary": "获取SQL管控SQL分析",
- "operationId": "GetSqlManageSqlAnalysisV1",
+ "summary": "更新自定义规则知识库",
+ "operationId": "updateCustomRuleKnowledge",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "rule name",
+ "name": "rule_name",
"in": "path",
"required": true
},
{
"type": "string",
- "description": "sql manage id",
- "name": "sql_manage_id",
+ "description": "db type of rule",
+ "name": "db_type",
"in": "path",
"required": true
+ },
+ {
+ "description": "update rule knowledge",
+ "name": "req",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.UpdateRuleKnowledgeReq"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSqlManageSqlAnalysisResp"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/statistic/audit_plans": {
+ "/v1/rule_knowledge/db_types/{db_type}/rules/{rule_name}/": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "statistic audit plan",
+ "description": "get rule knowledge",
"tags": [
- "statistic"
+ "rule_template"
],
- "summary": "获取各类型数据源上的扫描任务数量",
- "operationId": "statisticAuditPlanV1",
+ "summary": "查看规则知识库",
+ "operationId": "getRuleKnowledgeV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "rule name",
+ "name": "rule_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "db type of rule",
+ "name": "db_type",
"in": "path",
"required": true
}
@@ -5158,95 +4817,115 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.StatisticAuditPlanResV1"
+ "$ref": "#/definitions/v1.GetRuleKnowledgeResV1"
}
}
}
- }
- },
- "/v1/projects/{project_name}/statistic/audited_sqls": {
- "get": {
+ },
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "statistics audited sql",
+ "description": "update rule knowledge",
"tags": [
- "statistic"
+ "rule_template"
],
- "summary": "获取审核SQL总数,以及触发审核规则的SQL数量",
- "operationId": "statisticsAuditedSQLV1",
+ "summary": "更新规则知识库",
+ "operationId": "updateRuleKnowledge",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "rule name",
+ "name": "rule_name",
"in": "path",
"required": true
+ },
+ {
+ "type": "string",
+ "description": "db type of rule",
+ "name": "db_type",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "update rule knowledge",
+ "name": "req",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.UpdateRuleKnowledgeReq"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.StatisticsAuditedSQLResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/statistic/instance_health": {
+ "/v1/rule_template_tips": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get instance health",
+ "description": "get global rule template tips",
"tags": [
- "statistic"
+ "rule_template"
],
- "summary": "获取各类型数据源的健康情况",
- "operationId": "GetInstanceHealthV1",
+ "summary": "获取全局规则模板提示",
+ "operationId": "getRuleTemplateTipsV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "filter db type",
+ "name": "filter_db_type",
+ "in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetInstanceHealthResV1"
+ "$ref": "#/definitions/v1.GetRuleTemplateTipsResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/statistic/project_score": {
+ "/v1/rule_templates": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get project score",
+ "description": "get all global rule template",
"tags": [
- "statistic"
+ "rule_template"
],
- "summary": "获取项目分数",
- "operationId": "GetProjectScoreV1",
+ "summary": "全局规则模板列表",
+ "operationId": "getRuleTemplateListV1",
"parameters": [
{
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
+ "type": "integer",
+ "description": "page index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "size of per page",
+ "name": "page_size",
+ "in": "query",
"required": true
}
],
@@ -5254,63 +4933,69 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetProjectScoreResV1"
+ "$ref": "#/definitions/v1.GetRuleTemplatesResV1"
}
}
}
- }
- },
- "/v1/projects/{project_name}/statistic/risk_audit_plans": {
- "get": {
+ },
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get risk audit plan",
+ "description": "create a global rule template",
+ "consumes": [
+ "application/json"
+ ],
"tags": [
- "statistic"
+ "rule_template"
],
- "summary": "获取扫描任务报告评分低于60的扫描任务",
- "operationId": "getRiskAuditPlanV1",
+ "summary": "添加全局规则模板",
+ "operationId": "createRuleTemplateV1",
"parameters": [
{
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "add rule template request",
+ "name": "req",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.CreateRuleTemplateReqV1"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRiskAuditPlanResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/statistic/risk_workflow": {
- "get": {
+ "/v1/rule_templates/parse": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "statistic risk workflow",
+ "description": "parse rule template",
+ "consumes": [
+ "multipart/form-data"
+ ],
"tags": [
- "statistic"
+ "rule_template"
],
- "summary": "获取存在风险的工单",
- "operationId": "statisticRiskWorkflowV1",
+ "summary": "解析规则模板文件",
+ "operationId": "importProjectRuleTemplateV1",
"parameters": [
{
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
+ "type": "file",
+ "description": "SQLE rule template file",
+ "name": "rule_template_file",
+ "in": "formData",
"required": true
}
],
@@ -5318,62 +5003,66 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.StatisticRiskWorkflowResV1"
+ "$ref": "#/definitions/v1.ParseProjectRuleTemplateFileResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/statistic/role_user": {
+ "/v1/rule_templates/{rule_template_name}/": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get role user count",
+ "description": "get global rule template",
"tags": [
- "statistic"
+ "rule_template"
],
- "summary": "获取各角色类型对应的成员数量",
- "operationId": "getRoleUserCountV1",
+ "summary": "获取全局规则模板信息",
+ "operationId": "getRuleTemplateV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "rule template name",
+ "name": "rule_template_name",
"in": "path",
"required": true
+ },
+ {
+ "type": "string",
+ "description": "fuzzy rule,keyword for desc and annotation",
+ "name": "fuzzy_keyword_rule",
+ "in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRoleUserCountResV1"
+ "$ref": "#/definitions/v1.GetRuleTemplateResV1"
}
}
}
- }
- },
- "/v1/projects/{project_name}/statistic/workflow_status": {
- "get": {
+ },
+ "delete": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "statistic workflow status",
+ "description": "delete global rule template",
"tags": [
- "statistic"
+ "rule_template"
],
- "summary": "获取项目下工单各个状态的数量",
- "operationId": "statisticWorkflowStatusV1",
+ "summary": "删除全局规则模板",
+ "operationId": "deleteRuleTemplateV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "rule template name",
+ "name": "rule_template_name",
"in": "path",
"required": true
}
@@ -5382,78 +5071,82 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowStatusCountResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
- }
- },
- "/v1/projects/{project_name}/statistics": {
- "get": {
+ },
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get project statistics",
+ "description": "update global rule template",
"tags": [
- "statistic"
+ "rule_template"
],
- "summary": "获取项目统计信息",
- "operationId": "getProjectStatisticsV1",
+ "summary": "更新全局规则模板",
+ "operationId": "updateRuleTemplateV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "rule template name",
+ "name": "rule_template_name",
"in": "path",
"required": true
+ },
+ {
+ "description": "update rule template request",
+ "name": "req",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.UpdateRuleTemplateReqV1"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetProjectStatisticsResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/task_groups": {
+ "/v1/rule_templates/{rule_template_name}/clone": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "create tasks group.",
+ "description": "clone a rule template",
"consumes": [
"application/json"
],
- "produces": [
- "application/json"
- ],
"tags": [
- "task"
+ "rule_template"
],
- "summary": "创建审核任务组",
- "operationId": "createAuditTasksV1",
+ "summary": "克隆全局规则模板",
+ "operationId": "CloneRuleTemplateV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "rule template name",
+ "name": "rule_template_name",
"in": "path",
"required": true
},
{
- "description": "parameters for creating audit tasks group",
+ "description": "clone rule template request",
"name": "req",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.CreateAuditTasksGroupReqV1"
+ "$ref": "#/definitions/v1.CloneRuleTemplateReqV1"
}
}
],
@@ -5461,189 +5154,166 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.CreateAuditTasksGroupResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/tasks/audits": {
- "post": {
+ "/v1/rule_templates/{rule_template_name}/export": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "create and audit a task, you can upload sql content in three ways, any one can be used, but only one is effective.\n1. formData[sql]: sql content;\n2. file[input_sql_file]: it is a sql file;\n3. file[input_mybatis_xml_file]: it is mybatis xml file, sql will be parsed from it.",
- "consumes": [
- "multipart/form-data"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "export rule template",
"tags": [
- "task"
+ "rule_template"
],
- "summary": "创建Sql扫描任务并提交审核",
- "operationId": "createAndAuditTaskV1",
+ "summary": "导出全局规则模板",
+ "operationId": "exportRuleTemplateV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "rule template name",
+ "name": "rule_template_name",
"in": "path",
"required": true
- },
- {
- "type": "string",
- "description": "instance name",
- "name": "instance_name",
- "in": "formData",
- "required": true
- },
- {
- "type": "string",
- "description": "schema of instance",
- "name": "instance_schema",
- "in": "formData"
- },
- {
- "type": "string",
- "description": "sqls for audit",
- "name": "sql",
- "in": "formData"
- },
- {
- "type": "file",
- "description": "input SQL file",
- "name": "input_sql_file",
- "in": "formData"
- },
- {
- "type": "file",
- "description": "input mybatis XML file",
- "name": "input_mybatis_xml_file",
- "in": "formData"
- },
- {
- "type": "file",
- "description": "input ZIP file",
- "name": "input_zip_file",
- "in": "formData"
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "sqle rule template file",
"schema": {
- "$ref": "#/definitions/v1.GetAuditTaskResV1"
+ "type": "file"
}
}
}
}
},
- "/v1/projects/{project_name}/unarchive": {
- "post": {
+ "/v1/rules": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "archive project",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "get all rule template",
"tags": [
- "project"
+ "rule_template"
],
- "summary": "取消归档项目",
- "operationId": "unarchiveProjectV1",
+ "summary": "规则列表",
+ "operationId": "getRuleListV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
+ "description": "filter db type",
+ "name": "filter_db_type",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "fuzzy rule,keyword for desc and annotation",
+ "name": "fuzzy_keyword_rule",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter global rule template name",
+ "name": "filter_global_rule_template_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter rule name list",
+ "name": "filter_rule_names",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetRulesResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflow_template": {
+ "/v1/sql_analysis": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get workflow template detail",
+ "description": "Direct get sql analysis result",
"tags": [
- "workflow"
+ "sql_analysis"
],
- "summary": "获取审批流程模板详情",
- "operationId": "getWorkflowTemplateV1",
+ "summary": "直接获取SQL分析结果",
+ "operationId": "directGetSQLAnalysisV1",
"parameters": [
{
"type": "string",
"description": "project name",
"name": "project_name",
- "in": "path",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "instance name",
+ "name": "instance_name",
+ "in": "query",
"required": true
+ },
+ {
+ "type": "string",
+ "description": "schema name",
+ "name": "schema_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "sql",
+ "name": "sql",
+ "in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowTemplateResV1"
+ "$ref": "#/definitions/v1.DirectGetSQLAnalysisResV1"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v1/sql_audit": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update the workflow template",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "Direct audit sql",
"tags": [
- "workflow"
+ "sql_audit"
],
- "summary": "更新Sql审批流程模板",
- "operationId": "updateWorkflowTemplateV1",
+ "summary": "直接审核SQL",
+ "operationId": "directAuditV1",
+ "deprecated": true,
"parameters": [
{
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "description": "create workflow template",
- "name": "instance",
+ "description": "sqls that should be audited",
+ "name": "req",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.UpdateWorkflowTemplateReqV1"
+ "$ref": "#/definitions/v1.DirectAuditReqV1"
}
}
],
@@ -5651,166 +5321,63 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.DirectAuditResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows": {
+ "/v1/statistic/instances/sql_average_execution_time": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get workflow list",
+ "description": "get average execution time of sql",
"tags": [
- "workflow"
+ "statistic"
],
- "summary": "获取工单列表",
- "operationId": "getWorkflowsV1",
+ "summary": "获取sql上线平均耗时,按平均耗时降序排列",
+ "operationId": "getSqlAverageExecutionTimeV1",
"parameters": [
- {
- "type": "string",
- "description": "filter subject",
- "name": "filter_subject",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter by workflow_id",
- "name": "filter_workflow_id",
- "in": "query"
- },
- {
- "type": "string",
- "description": "fuzzy search by workflow description",
- "name": "fuzzy_search_workflow_desc",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create time from",
- "name": "filter_create_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create time to",
- "name": "filter_create_time_to",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_task_execute_start_time_from",
- "name": "filter_task_execute_start_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_task_execute_start_time_to",
- "name": "filter_task_execute_start_time_to",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create user name",
- "name": "filter_create_user_name",
- "in": "query"
- },
- {
- "enum": [
- "wait_for_audit",
- "wait_for_execution",
- "rejected",
- "executing",
- "canceled",
- "exec_failed",
- "finished"
- ],
- "type": "string",
- "description": "filter workflow status",
- "name": "filter_status",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter current step assignee user name",
- "name": "filter_current_step_assignee_user_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter instance name",
- "name": "filter_task_instance_name",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
{
"type": "integer",
- "description": "size of per page",
- "name": "page_size",
+ "description": "the limit of result item number",
+ "name": "limit",
"in": "query",
"required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowsResV1"
+ "$ref": "#/definitions/v1.GetSqlAverageExecutionTimeResV1"
}
}
}
- },
- "post": {
+ }
+ },
+ "/v1/statistic/instances/sql_execution_fail_percent": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "create workflow",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "get sql execution fail percent",
"tags": [
- "workflow"
+ "statistic"
],
- "summary": "创建工单",
- "operationId": "createWorkflowV1",
- "deprecated": true,
+ "summary": "获取SQL上线失败率,按失败率降序排列",
+ "operationId": "getSqlExecutionFailPercentV1",
"parameters": [
{
- "description": "create workflow request",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.CreateWorkflowReqV1"
- }
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
+ "type": "integer",
+ "description": "the limit of result item number",
+ "name": "limit",
+ "in": "query",
"required": true
}
],
@@ -5818,309 +5385,177 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetSqlExecutionFailPercentResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/cancel": {
- "post": {
+ "/v1/statistic/instances/type_percent": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "batch cancel workflows",
+ "description": "get database instances' types percent",
"tags": [
- "workflow"
- ],
- "summary": "批量取消工单",
- "operationId": "batchCancelWorkflowsV1",
- "deprecated": true,
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "description": "batch cancel workflows request",
- "name": "BatchCancelWorkflowsReqV1",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.BatchCancelWorkflowsReqV1"
- }
- }
+ "statistic"
],
+ "summary": "获取数据源类型百分比",
+ "operationId": "getInstancesTypePercentV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetInstancesTypePercentResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/complete": {
- "post": {
+ "/v1/statistic/license/usage": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "this api will directly change the work order status to finished without real online operation",
+ "description": "get usage of license",
"tags": [
- "workflow"
+ "statistic"
],
- "summary": "批量完成工单",
- "operationId": "batchCompleteWorkflowsV1",
- "deprecated": true,
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "description": "batch complete workflows request",
- "name": "data",
- "in": "body",
- "required": true,
+ "summary": "获取License使用情况",
+ "operationId": "getLicenseUsageV1",
+ "responses": {
+ "200": {
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/v1.BatchCompleteWorkflowsReqV1"
+ "$ref": "#/definitions/v1.GetLicenseUsageResV1"
}
}
+ }
+ }
+ },
+ "/v1/statistic/workflows/audit_pass_percent": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get workflow audit pass percent",
+ "tags": [
+ "statistic"
],
+ "summary": "获取工单审核通过率",
+ "operationId": "getWorkflowAuditPassPercentV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetWorkflowAuditPassPercentResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/exports": {
+ "/v1/statistic/workflows/counts": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "export workflow",
+ "description": "get workflow counts",
"tags": [
- "workflow"
- ],
- "summary": "导出工单",
- "operationId": "exportWorkflowV1",
- "parameters": [
- {
- "type": "string",
- "description": "filter subject",
- "name": "filter_subject",
- "in": "query"
- },
- {
- "type": "string",
- "description": "fuzzy search by workflow description",
- "name": "fuzzy_search_workflow_desc",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create time from",
- "name": "filter_create_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create time to",
- "name": "filter_create_time_to",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_task_execute_start_time_from",
- "name": "filter_task_execute_start_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_task_execute_start_time_to",
- "name": "filter_task_execute_start_time_to",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create user name",
- "name": "filter_create_user_name",
- "in": "query"
- },
- {
- "enum": [
- "wait_for_audit",
- "wait_for_execution",
- "rejected",
- "executing",
- "canceled",
- "exec_failed",
- "finished"
- ],
- "type": "string",
- "description": "filter workflow status",
- "name": "filter_status",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter current step assignee user name",
- "name": "filter_current_step_assignee_user_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter instance name",
- "name": "filter_task_instance_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- }
+ "statistic"
],
+ "summary": "获取工单数量统计数据",
+ "operationId": "getWorkflowCountV1",
"responses": {
"200": {
- "description": "export workflow",
+ "description": "OK",
"schema": {
- "type": "file"
+ "$ref": "#/definitions/v1.GetWorkflowCountsResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/{workflow_id}/tasks/terminate": {
- "post": {
+ "/v1/statistic/workflows/duration_of_waiting_for_audit": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "terminate multiple task by project and workflow",
+ "description": "get duration from workflow being created to audited",
"tags": [
- "workflow"
- ],
- "summary": "终止工单下多个上线任务",
- "operationId": "terminateMultipleTaskByWorkflowV1",
- "parameters": [
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- }
+ "statistic"
],
+ "summary": "获取工单从创建到审核结束的平均时长",
+ "operationId": "getWorkflowDurationOfWaitingForAuditV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetWorkflowDurationOfWaitingForAuditResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/{workflow_id}/tasks/{task_id}/terminate": {
- "post": {
+ "/v1/statistic/workflows/duration_of_waiting_for_execution": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "execute one task on workflow",
+ "description": "get duration from workflow being created to executed",
"tags": [
- "workflow"
- ],
- "summary": "终止单个上线任务",
- "operationId": "terminateSingleTaskByWorkflowV1",
- "parameters": [
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- }
+ "statistic"
],
+ "summary": "获取工单各从审核完毕到执行上线的平均时长",
+ "operationId": "getWorkflowDurationOfWaitingForExecutionV1",
+ "deprecated": true,
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetWorkflowDurationOfWaitingForExecutionResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/{workflow_name}/": {
+ "/v1/statistic/workflows/each_day_counts": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get workflow detail",
+ "description": "get counts of created workflow each day",
"tags": [
- "workflow"
+ "statistic"
],
- "summary": "获取工单详情",
- "operationId": "getWorkflowV1",
- "deprecated": true,
+ "summary": "获取每天工单创建数量",
+ "operationId": "getWorkflowCreatedCountEachDayV1",
"parameters": [
{
"type": "string",
- "description": "workflow name",
- "name": "workflow_name",
- "in": "path",
+ "description": "filter date from.(format:yyyy-mm-dd)",
+ "name": "filter_date_from",
+ "in": "query",
"required": true
},
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
+ "description": "filter date to.(format:yyyy-mm-dd)",
+ "name": "filter_date_to",
+ "in": "query",
"required": true
}
],
@@ -6128,92 +5563,78 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowResV1"
+ "$ref": "#/definitions/v1.GetWorkflowCreatedCountsEachDayResV1"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v1/statistic/workflows/instance_type_percent": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update workflow when it is rejected to creator.",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "get workflows percent counted by instance type",
"tags": [
- "workflow"
+ "statistic"
],
- "summary": "更新工单(驳回后才可更新)",
- "operationId": "updateWorkflowV1",
- "deprecated": true,
- "parameters": [
- {
- "type": "string",
- "description": "workflow name",
- "name": "workflow_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "description": "update workflow request",
- "name": "instance",
- "in": "body",
- "required": true,
+ "summary": "获取按数据源类型统计的工单百分比",
+ "operationId": "getWorkflowPercentCountedByInstanceTypeV1",
+ "responses": {
+ "200": {
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/v1.UpdateWorkflowReqV1"
+ "$ref": "#/definitions/v1.GetWorkflowPercentCountedByInstanceTypeResV1"
}
}
+ }
+ }
+ },
+ "/v1/statistic/workflows/pass_percent": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
],
+ "description": "get workflow pass percent",
+ "tags": [
+ "statistic"
+ ],
+ "summary": "获取工单通过率",
+ "operationId": "getWorkflowPassPercentV1",
+ "deprecated": true,
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetWorkflowPassPercentResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/{workflow_name}/cancel": {
- "post": {
+ "/v1/statistic/workflows/rejected_percent_group_by_creator": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "cancel workflow",
+ "description": "get workflows rejected percent group by creator. The result will be sorted by rejected percent in descending order",
"tags": [
- "workflow"
+ "statistic"
],
- "summary": "审批关闭(中止)",
- "operationId": "cancelWorkflowV1",
- "deprecated": true,
+ "summary": "获取各个用户提交的工单驳回率,按驳回率降序排列",
+ "operationId": "getWorkflowRejectedPercentGroupByCreatorV1",
"parameters": [
{
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "workflow name",
- "name": "workflow_name",
- "in": "path",
+ "type": "integer",
+ "description": "the limit of result item number",
+ "name": "limit",
+ "in": "query",
"required": true
}
],
@@ -6221,141 +5642,148 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetWorkflowRejectedPercentGroupByCreatorResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/{workflow_name}/steps/{workflow_step_id}/approve": {
- "post": {
+ "/v1/statistic/workflows/rejected_percent_group_by_instance": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "approve workflow",
+ "description": "get workflow rejected percent group by instance. The result will be sorted by rejected percent in descending order",
"tags": [
- "workflow"
+ "statistic"
],
- "summary": "审批通过",
- "operationId": "approveWorkflowV1",
+ "summary": "获取各个数据源相关的工单驳回率,按驳回率降序排列",
+ "operationId": "getWorkflowRejectedPercentGroupByInstanceV1",
"deprecated": true,
"parameters": [
{
- "type": "string",
- "description": "workflow name",
- "name": "workflow_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "workflow step id",
- "name": "workflow_step_id",
- "in": "path",
+ "type": "integer",
+ "description": "the limit of result item number",
+ "name": "limit",
+ "in": "query",
"required": true
- },
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/v1.GetWorkflowRejectedPercentGroupByInstanceResV1"
+ }
+ }
+ }
+ }
+ },
+ "/v1/statistic/workflows/status_count": {
+ "get": {
+ "security": [
{
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "ApiKeyAuth": []
}
],
+ "description": "get count of workflow status",
+ "tags": [
+ "statistic"
+ ],
+ "summary": "获取各种状态工单的数量",
+ "operationId": "getWorkflowStatusCountV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetWorkflowStatusCountResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/{workflow_name}/steps/{workflow_step_id}/reject": {
+ "/v1/task_groups/audit": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "reject workflow",
+ "description": "audit task group.\n1. formData[sql]: sql content;\n2. file[input_sql_file]: it is a sql file;\n3. file[input_mybatis_xml_file]: it is mybatis xml file, sql will be parsed from it.\n4. file[input_zip_file]: it is zip file, sql will be parsed from it.",
+ "consumes": [
+ "multipart/form-data"
+ ],
+ "produces": [
+ "application/json"
+ ],
"tags": [
- "workflow"
+ "task"
],
- "summary": "审批驳回",
- "operationId": "rejectWorkflowV1",
- "deprecated": true,
+ "summary": "审核任务组",
+ "operationId": "auditTaskGroupIdV1",
"parameters": [
{
- "type": "string",
- "description": "workflow name",
- "name": "workflow_name",
- "in": "path",
+ "type": "integer",
+ "description": "group id of tasks",
+ "name": "task_group_id",
+ "in": "formData",
"required": true
},
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "sqls for audit",
+ "name": "sql",
+ "in": "formData"
},
{
- "type": "string",
- "description": "workflow step id",
- "name": "workflow_step_id",
- "in": "path",
- "required": true
+ "type": "file",
+ "description": "input SQL file",
+ "name": "input_sql_file",
+ "in": "formData"
},
{
- "description": "workflow approve request",
- "name": "workflow_approve",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.RejectWorkflowReqV1"
- }
+ "type": "file",
+ "description": "input mybatis XML file",
+ "name": "input_mybatis_xml_file",
+ "in": "formData"
+ },
+ {
+ "type": "file",
+ "description": "input ZIP file",
+ "name": "input_zip_file",
+ "in": "formData"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.AuditTaskGroupResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/{workflow_name}/tasks": {
+ "/v1/tasks/audits/{task_id}/": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get summary of workflow instance tasks",
+ "description": "get task",
"tags": [
- "workflow"
+ "task"
],
- "summary": "获取工单数据源任务概览",
- "operationId": "getSummaryOfInstanceTasksV1",
- "deprecated": true,
+ "summary": "获取Sql扫描任务信息",
+ "operationId": "getAuditTaskV1",
"parameters": [
{
"type": "string",
- "description": "workflow name",
- "name": "workflow_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "task id",
+ "name": "task_id",
"in": "path",
"required": true
}
@@ -6364,38 +5792,30 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowTasksResV1"
+ "$ref": "#/definitions/v1.GetAuditTaskResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/{workflow_name}/tasks/execute": {
- "post": {
+ "/v1/tasks/audits/{task_id}/sql_content": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "execute tasks on workflow",
+ "description": "get SQL content for the audit task",
"tags": [
- "workflow"
+ "task"
],
- "summary": "多数据源批量上线",
- "operationId": "executeTasksOnWorkflowV1",
- "deprecated": true,
+ "summary": "获取指定扫描任务的SQL内容",
+ "operationId": "getAuditTaskSQLContentV1",
"parameters": [
{
"type": "string",
- "description": "workflow name",
- "name": "workflow_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "task id",
+ "name": "task_id",
"in": "path",
"required": true
}
@@ -6404,41 +5824,26 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetAuditTaskSQLContentResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/{workflow_name}/tasks/{task_id}/execute": {
- "post": {
+ "/v1/tasks/audits/{task_id}/sql_file": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "execute one task on workflow",
+ "description": "download SQL file for the audit task",
"tags": [
- "workflow"
+ "task"
],
- "summary": "工单提交单个数据源上线",
- "operationId": "executeOneTaskOnWorkflowV1",
- "deprecated": true,
+ "summary": "下载指定扫描任务的SQL文件",
+ "operationId": "downloadAuditTaskSQLFileV1",
"parameters": [
- {
- "type": "string",
- "description": "workflow name",
- "name": "workflow_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
{
"type": "string",
"description": "task id",
@@ -6449,42 +5854,28 @@ var doc = `{
],
"responses": {
"200": {
- "description": "OK",
+ "description": "sql file",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "type": "file"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/{workflow_name}/tasks/{task_id}/schedule": {
- "put": {
+ "/v1/tasks/audits/{task_id}/sql_report": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update workflow schedule.",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "download report file of all SQLs information belong to the specified audit task",
"tags": [
- "workflow"
+ "task"
],
- "summary": "设置工单数据源定时上线时间(设置为空则代表取消定时时间,需要SQL审核流程都通过后才可以设置)",
- "operationId": "updateWorkflowScheduleV1",
- "deprecated": true,
+ "summary": "下载指定扫描任务的SQLs信息报告",
+ "operationId": "downloadAuditTaskSQLReportV1",
"parameters": [
- {
- "type": "string",
- "description": "workflow name",
- "name": "workflow_name",
- "in": "path",
- "required": true
- },
{
"type": "string",
"description": "task id",
@@ -6493,91 +5884,95 @@ var doc = `{
"required": true
},
{
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "description": "update workflow schedule request",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateWorkflowScheduleReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/role_tips": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
+ "type": "boolean",
+ "description": "select unique (fingerprint and audit result) for task sql",
+ "name": "no_duplicate",
+ "in": "query"
}
],
- "description": "get role tip list",
- "tags": [
- "role"
- ],
- "summary": "获取角色提示列表",
- "operationId": "getRoleTipListV1",
"responses": {
"200": {
- "description": "OK",
+ "description": "sql report csv file",
"schema": {
- "$ref": "#/definitions/v1.GetRoleTipsResV1"
+ "type": "file"
}
}
}
}
},
- "/v1/roles": {
+ "/v1/tasks/audits/{task_id}/sqls": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get role list",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "get information of all SQLs belong to the specified audit task",
"tags": [
- "role"
+ "task"
],
- "summary": "获取角色列表",
- "operationId": "getRoleListV1",
+ "summary": "获取指定扫描任务的SQLs信息",
+ "operationId": "getAuditTaskSQLsV1",
"parameters": [
{
"type": "string",
- "description": "filter role name",
- "name": "filter_role_name",
+ "description": "task id",
+ "name": "task_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "enum": [
+ "initialized",
+ "doing",
+ "succeeded",
+ "failed",
+ "manually_executed"
+ ],
+ "type": "string",
+ "description": "filter: exec status of task sql",
+ "name": "filter_exec_status",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "initialized",
+ "doing",
+ "finished"
+ ],
+ "type": "string",
+ "description": "filter: audit status of task sql",
+ "name": "filter_audit_status",
"in": "query"
},
{
- "type": "integer",
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ],
+ "type": "string",
+ "description": "filter: audit level of task sql",
+ "name": "filter_audit_level",
+ "in": "query"
+ },
+ {
+ "type": "boolean",
+ "description": "select unique (fingerprint and audit result) for task sql",
+ "name": "no_duplicate",
+ "in": "query"
+ },
+ {
+ "type": "string",
"description": "page index",
"name": "page_index",
"in": "query",
"required": true
},
{
- "type": "integer",
- "description": "size of per page",
+ "type": "string",
+ "description": "page size",
"name": "page_size",
"in": "query",
"required": true
@@ -6587,37 +5982,50 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRolesResV1"
+ "$ref": "#/definitions/v1.GetAuditTaskSQLsResV1"
}
}
}
- },
- "post": {
+ }
+ },
+ "/v1/tasks/audits/{task_id}/sqls/{number}": {
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "create role",
+ "description": "modify the relevant information of a certain SQL in the audit task",
"consumes": [
"application/json"
],
- "produces": [
- "application/json"
- ],
"tags": [
- "role"
+ "task"
],
- "summary": "创建角色",
- "operationId": "createRoleV1",
+ "summary": "修改扫描任务中某条SQL的相关信息",
+ "operationId": "updateAuditTaskSQLsV1",
"parameters": [
{
- "description": "create role",
- "name": "instance",
+ "type": "string",
+ "description": "task id",
+ "name": "task_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "sql number",
+ "name": "number",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "modify the relevant information of a certain SQL in the audit task",
+ "name": "audit_plan",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.CreateRoleReqV1"
+ "$ref": "#/definitions/v1.UpdateAuditTaskSQLsReqV1"
}
}
],
@@ -6631,30 +6039,31 @@ var doc = `{
}
}
},
- "/v1/roles/{role_name}/": {
- "delete": {
+ "/v1/tasks/audits/{task_id}/sqls/{number}/analysis": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "delete role",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "get SQL explain and related table metadata for analysis",
"tags": [
- "role"
+ "task"
],
- "summary": "删除角色",
- "operationId": "deleteRoleV1",
+ "summary": "获取task相关的SQL执行计划和表元数据",
+ "operationId": "getTaskAnalysisData",
"parameters": [
{
"type": "string",
- "description": "role name",
- "name": "role_name",
+ "description": "task id",
+ "name": "task_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "sql number",
+ "name": "number",
"in": "path",
"required": true
}
@@ -6663,129 +6072,167 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetTaskAnalysisDataResV1"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v1/user_tips": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update role",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "get user tip list",
"tags": [
- "role"
+ "user"
],
- "summary": "更新角色信息",
- "operationId": "updateRoleV1",
+ "summary": "获取用户提示列表",
+ "operationId": "getUserTipListV1",
"parameters": [
{
"type": "string",
- "description": "role name",
- "name": "role_name",
- "in": "path",
+ "description": "project name",
+ "name": "filter_project",
+ "in": "query",
"required": true
- },
- {
- "description": "update role request",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateRoleReqV1"
- }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetUserTipsResV1"
}
}
}
}
},
- "/v1/rule_knowledge/db_types/{db_type}/custom_rules/{rule_name}/": {
+ "/v1/workflows": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get custom rule knowledge",
+ "description": "get global workflow list",
"tags": [
- "rule_template"
+ "workflow"
],
- "summary": "查看自定义规则知识库",
- "operationId": "getCustomRuleKnowledgeV1",
+ "summary": "获取全局工单列表",
+ "operationId": "getGlobalWorkflowsV1",
"parameters": [
{
"type": "string",
- "description": "rule name",
- "name": "rule_name",
- "in": "path",
- "required": true
+ "description": "filter subject",
+ "name": "filter_subject",
+ "in": "query"
},
{
"type": "string",
- "description": "db type of rule",
- "name": "db_type",
- "in": "path",
- "required": true
- }
- ],
+ "description": "filter create time from",
+ "name": "filter_create_time_from",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter create time to",
+ "name": "filter_create_time_to",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_task_execute_start_time_from",
+ "name": "filter_task_execute_start_time_from",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_task_execute_start_time_to",
+ "name": "filter_task_execute_start_time_to",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter create user id",
+ "name": "filter_create_user_id",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "wait_for_audit",
+ "wait_for_execution",
+ "rejected",
+ "executing",
+ "canceled",
+ "exec_failed",
+ "finished"
+ ],
+ "type": "string",
+ "description": "filter workflow status",
+ "name": "filter_status",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter current step assignee user id",
+ "name": "filter_current_step_assignee_user_id",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter instance id",
+ "name": "filter_task_instance_name",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "size of per page",
+ "name": "page_size",
+ "in": "query",
+ "required": true
+ }
+ ],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRuleKnowledgeResV1"
+ "$ref": "#/definitions/v1.GetWorkflowsResV1"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v2/audit_files": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update custom rule knowledge",
+ "description": "Direct audit sql from SQL files and MyBatis files",
"tags": [
- "rule_template"
+ "sql_audit"
],
- "summary": "更新自定义规则知识库",
- "operationId": "updateCustomRuleKnowledge",
+ "summary": "直接从文件内容提取SQL并审核,SQL文件暂时只支持一次解析一个文件",
+ "operationId": "directAuditFilesV2",
"parameters": [
{
- "type": "string",
- "description": "rule name",
- "name": "rule_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "db type of rule",
- "name": "db_type",
- "in": "path",
- "required": true
- },
- {
- "description": "update rule knowledge",
+ "description": "files that should be audited",
"name": "req",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.UpdateRuleKnowledgeReq"
+ "$ref": "#/definitions/v2.DirectAuditFileReqV2"
}
}
],
@@ -6793,142 +6240,140 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v2.DirectAuditResV2"
}
}
}
}
},
- "/v1/rule_knowledge/db_types/{db_type}/rules/{rule_name}/": {
+ "/v2/configurations/drivers": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get rule knowledge",
+ "description": "get drivers",
"tags": [
- "rule_template"
- ],
- "summary": "查看规则知识库",
- "operationId": "getRuleKnowledgeV1",
- "parameters": [
- {
- "type": "string",
- "description": "rule name",
- "name": "rule_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "db type of rule",
- "name": "db_type",
- "in": "path",
- "required": true
- }
+ "configuration"
],
+ "summary": "获取当前 server 支持的审核类型",
+ "operationId": "getDriversV2",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRuleKnowledgeResV1"
+ "$ref": "#/definitions/v2.GetDriversRes"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v2/projects/{project_name}/audit_plans": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update rule knowledge",
+ "description": "get audit plan info list",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "更新规则知识库",
- "operationId": "updateRuleKnowledge",
+ "summary": "获取扫描任务信息列表",
+ "operationId": "getAuditPlansV2",
"parameters": [
{
"type": "string",
- "description": "rule name",
- "name": "rule_name",
+ "description": "project name",
+ "name": "project_name",
"in": "path",
"required": true
},
{
"type": "string",
- "description": "db type of rule",
- "name": "db_type",
- "in": "path",
- "required": true
+ "description": "filter audit plan db type",
+ "name": "filter_audit_plan_db_type",
+ "in": "query"
},
{
- "description": "update rule knowledge",
- "name": "req",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateRuleKnowledgeReq"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/rule_template_tips": {
- "get": {
- "security": [
+ "type": "string",
+ "description": "fuzzy search audit plan name",
+ "name": "fuzzy_search_audit_plan_name",
+ "in": "query"
+ },
{
- "ApiKeyAuth": []
- }
- ],
- "description": "get global rule template tips",
- "tags": [
- "rule_template"
- ],
- "summary": "获取全局规则模板提示",
- "operationId": "getRuleTemplateTipsV1",
- "parameters": [
+ "type": "string",
+ "description": "filter audit plan type",
+ "name": "filter_audit_plan_type",
+ "in": "query"
+ },
{
"type": "string",
- "description": "filter db type",
- "name": "filter_db_type",
+ "description": "filter audit plan instance name",
+ "name": "filter_audit_plan_instance_name",
"in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "size of per page",
+ "name": "page_size",
+ "in": "query",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRuleTemplateTipsResV1"
+ "$ref": "#/definitions/v2.GetAuditPlansResV2"
}
}
}
}
},
- "/v1/rule_templates": {
+ "/v2/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get all global rule template",
+ "description": "get audit plan report SQLs",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "全局规则模板列表",
- "operationId": "getRuleTemplateListV1",
+ "summary": "获取指定扫描任务的SQL扫描详情",
+ "operationId": "getAuditPlanReportsSQLs",
"parameters": [
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan report id",
+ "name": "audit_plan_report_id",
+ "in": "path",
+ "required": true
+ },
{
"type": "integer",
"description": "page index",
@@ -6948,100 +6393,51 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRuleTemplatesResV1"
+ "$ref": "#/definitions/v2.GetAuditPlanReportSQLsResV2"
}
}
}
- },
- "post": {
+ }
+ },
+ "/v2/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls/{number}/analysis": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "create a global rule template",
- "consumes": [
- "application/json"
- ],
+ "description": "get SQL explain and related table metadata for analysis",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "添加全局规则模板",
- "operationId": "createRuleTemplateV1",
+ "summary": "获取task相关的SQL执行计划和表元数据",
+ "operationId": "getAuditPlantAnalysisDataV2",
"parameters": [
{
- "description": "add rule template request",
- "name": "req",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.CreateRuleTemplateReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/rule_templates/parse": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "parse rule template",
- "consumes": [
- "multipart/form-data"
- ],
- "tags": [
- "rule_template"
- ],
- "summary": "解析规则模板文件",
- "operationId": "importProjectRuleTemplateV1",
- "parameters": [
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
{
- "type": "file",
- "description": "SQLE rule template file",
- "name": "rule_template_file",
- "in": "formData",
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
"required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.ParseProjectRuleTemplateFileResV1"
- }
- }
- }
- }
- },
- "/v1/rule_templates/{rule_template_name}/": {
- "get": {
- "security": [
+ },
{
- "ApiKeyAuth": []
- }
- ],
- "description": "get global rule template",
- "tags": [
- "rule_template"
- ],
- "summary": "获取全局规则模板信息",
- "operationId": "getRuleTemplateV1",
- "parameters": [
+ "type": "string",
+ "description": "audit plan report id",
+ "name": "audit_plan_report_id",
+ "in": "path",
+ "required": true
+ },
{
"type": "string",
- "description": "rule template name",
- "name": "rule_template_name",
+ "description": "sql number",
+ "name": "number",
"in": "path",
"required": true
}
@@ -7050,68 +6446,47 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRuleTemplateResV1"
+ "$ref": "#/definitions/v2.GetAuditPlanAnalysisDataResV2"
}
}
}
- },
- "delete": {
+ }
+ },
+ "/v2/projects/{project_name}/audit_plans/{audit_plan_name}/sqls/full": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "delete global rule template",
+ "description": "full sync audit plan SQLs",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "删除全局规则模板",
- "operationId": "deleteRuleTemplateV1",
+ "summary": "全量同步SQL到扫描任务",
+ "operationId": "fullSyncAuditPlanSQLsV2",
"parameters": [
{
"type": "string",
- "description": "rule template name",
- "name": "rule_template_name",
+ "description": "project name",
+ "name": "project_name",
"in": "path",
"required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- },
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "update global rule template",
- "tags": [
- "rule_template"
- ],
- "summary": "更新全局规则模板",
- "operationId": "updateRuleTemplateV1",
- "parameters": [
+ },
{
"type": "string",
- "description": "rule template name",
- "name": "rule_template_name",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
"in": "path",
"required": true
},
{
- "description": "update rule template request",
- "name": "req",
+ "description": "full sync audit plan SQLs request",
+ "name": "sqls",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.UpdateRuleTemplateReqV1"
+ "$ref": "#/definitions/v2.FullSyncAuditPlanSQLsReqV2"
}
}
],
@@ -7125,37 +6500,41 @@ var doc = `{
}
}
},
- "/v1/rule_templates/{rule_template_name}/clone": {
+ "/v2/projects/{project_name}/audit_plans/{audit_plan_name}/sqls/partial": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "clone a rule template",
- "consumes": [
- "application/json"
- ],
+ "description": "partial sync audit plan SQLs",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "克隆全局规则模板",
- "operationId": "CloneRuleTemplateV1",
+ "summary": "增量同步SQL到扫描任务",
+ "operationId": "partialSyncAuditPlanSQLsV2",
"parameters": [
{
"type": "string",
- "description": "rule template name",
- "name": "rule_template_name",
+ "description": "project name",
+ "name": "project_name",
"in": "path",
"required": true
},
{
- "description": "clone rule template request",
- "name": "req",
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "partial sync audit plan SQLs request",
+ "name": "sqls",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.CloneRuleTemplateReqV1"
+ "$ref": "#/definitions/v2.PartialSyncAuditPlanSQLsReqV2"
}
}
],
@@ -7169,276 +6548,355 @@ var doc = `{
}
}
},
- "/v1/rule_templates/{rule_template_name}/export": {
+ "/v2/projects/{project_name}/instances/{instance_name}/": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "export rule template",
+ "description": "get instance db",
"tags": [
- "rule_template"
+ "instance"
],
- "summary": "导出全局规则模板",
- "operationId": "exportRuleTemplateV1",
+ "summary": "获取实例信息",
+ "operationId": "getInstanceV2",
"parameters": [
{
"type": "string",
- "description": "rule template name",
- "name": "rule_template_name",
+ "description": "project name",
+ "name": "project_name",
"in": "path",
"required": true
- }
- ],
- "responses": {
- "200": {
- "description": "sqle rule template file",
- "schema": {
- "type": "file"
- }
- }
- }
- }
- },
- "/v1/rules": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get all rule template",
- "tags": [
- "rule_template"
- ],
- "summary": "规则列表",
- "operationId": "getRuleListV1",
- "parameters": [
- {
- "type": "string",
- "description": "filter db type",
- "name": "filter_db_type",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter global rule template name",
- "name": "filter_global_rule_template_name",
- "in": "query"
},
{
"type": "string",
- "description": "filter rule name list",
- "name": "filter_rule_names",
- "in": "query"
+ "description": "instance name",
+ "name": "instance_name",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRulesResV1"
+ "$ref": "#/definitions/v2.GetInstanceResV2"
}
}
}
}
},
- "/v1/sql_analysis": {
+ "/v2/projects/{project_name}/sql_manages": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Direct get sql analysis result",
+ "description": "get sql manage list",
"tags": [
- "sql_analysis"
+ "SqlManage"
],
- "summary": "直接获取SQL分析结果",
- "operationId": "directGetSQLAnalysisV1",
+ "summary": "获取管控sql列表",
+ "operationId": "GetSqlManageListV2",
"parameters": [
{
"type": "string",
"description": "project name",
"name": "project_name",
- "in": "query",
+ "in": "path",
"required": true
},
{
"type": "string",
- "description": "instance name",
- "name": "instance_name",
- "in": "query",
- "required": true
+ "description": "fuzzy search sql fingerprint",
+ "name": "fuzzy_search_sql_fingerprint",
+ "in": "query"
},
{
"type": "string",
- "description": "schema name",
- "name": "schema_name",
+ "description": "assignee",
+ "name": "filter_assignee",
"in": "query"
},
{
"type": "string",
- "description": "sql",
- "name": "sql",
+ "description": "instance name",
+ "name": "filter_instance_name",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "audit_plan",
+ "sql_audit_record"
+ ],
+ "type": "string",
+ "description": "source",
+ "name": "filter_source",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ],
+ "type": "string",
+ "description": "audit level",
+ "name": "filter_audit_level",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "last audit start time from",
+ "name": "filter_last_audit_start_time_from",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "last audit start time to",
+ "name": "filter_last_audit_start_time_to",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "unhandled",
+ "solved",
+ "ignored",
+ "manual_audited"
+ ],
+ "type": "string",
+ "description": "status",
+ "name": "filter_status",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "rule name",
+ "name": "filter_rule_name",
"in": "query"
+ },
+ {
+ "type": "string",
+ "description": "db type",
+ "name": "filter_db_type",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "fuzzy search endpoint",
+ "name": "fuzzy_search_endpoint",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "fuzzy search schema name",
+ "name": "fuzzy_search_schema_name",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "first_appear_timestamp",
+ "last_receive_timestamp",
+ "fp_count"
+ ],
+ "type": "string",
+ "description": "sort field",
+ "name": "sort_field",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "asc",
+ "desc"
+ ],
+ "type": "string",
+ "description": "sort order",
+ "name": "sort_order",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "size of per page",
+ "name": "page_size",
+ "in": "query",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.DirectGetSQLAnalysisResV1"
+ "$ref": "#/definitions/v2.GetSqlManageListResp"
}
}
}
}
},
- "/v1/sql_audit": {
+ "/v2/projects/{project_name}/workflows": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Direct audit sql",
+ "description": "create workflow",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
"tags": [
- "sql_audit"
+ "workflow"
],
- "summary": "直接审核SQL",
- "operationId": "directAuditV1",
- "deprecated": true,
+ "summary": "创建工单",
+ "operationId": "createWorkflowV2",
"parameters": [
{
- "description": "sqls that should be audited",
- "name": "req",
+ "description": "create workflow request",
+ "name": "instance",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.DirectAuditReqV1"
+ "$ref": "#/definitions/v2.CreateWorkflowReqV2"
}
+ },
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.DirectAuditResV1"
+ "$ref": "#/definitions/v2.CreateWorkflowResV2"
}
}
}
}
},
- "/v1/static/instance_logo": {
- "get": {
+ "/v2/projects/{project_name}/workflows/cancel": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get instance type logo",
+ "description": "batch cancel workflows",
"tags": [
- "instance"
+ "workflow"
],
- "summary": "获取实例类型logo",
- "operationId": "getInstanceTypeLogo",
+ "summary": "批量取消工单",
+ "operationId": "batchCancelWorkflowsV2",
"parameters": [
{
"type": "string",
- "description": "instance type",
- "name": "instance_type",
- "in": "query",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
"required": true
- }
- ],
- "responses": {
- "200": {
- "description": "get instance type logo",
+ },
+ {
+ "description": "batch cancel workflows request",
+ "name": "BatchCancelWorkflowsReqV2",
+ "in": "body",
+ "required": true,
"schema": {
- "type": "file"
+ "$ref": "#/definitions/v2.BatchCancelWorkflowsReqV2"
}
}
- }
- }
- },
- "/v1/static/logo": {
- "get": {
- "description": "get logo",
- "tags": [
- "configuration"
- ],
- "summary": "获取logo",
- "operationId": "getLogo",
- "parameters": [
- {
- "type": "string",
- "description": "timestamp",
- "name": "timestamp",
- "in": "query"
- }
],
"responses": {
"200": {
- "description": "get logo",
+ "description": "OK",
"schema": {
- "type": "file"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/statistic/instances/sql_average_execution_time": {
- "get": {
+ "/v2/projects/{project_name}/workflows/complete": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get average execution time of sql",
+ "description": "this api will directly change the work order status to finished without real online operation",
"tags": [
- "statistic"
+ "workflow"
],
- "summary": "获取sql上线平均耗时,按平均耗时降序排列",
- "operationId": "getSqlAverageExecutionTimeV1",
+ "summary": "批量完成工单",
+ "operationId": "batchCompleteWorkflowsV2",
"parameters": [
{
- "type": "integer",
- "description": "the limit of result item number",
- "name": "limit",
- "in": "query",
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
"required": true
+ },
+ {
+ "description": "batch complete workflows request",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v2.BatchCompleteWorkflowsReqV2"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSqlAverageExecutionTimeResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/statistic/instances/sql_execution_fail_percent": {
+ "/v2/projects/{project_name}/workflows/{workflow_id}/": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get sql execution fail percent",
+ "description": "get workflow detail",
"tags": [
- "statistic"
+ "workflow"
],
- "summary": "获取SQL上线失败率,按失败率降序排列",
- "operationId": "getSqlExecutionFailPercentV1",
+ "summary": "获取工单详情",
+ "operationId": "getWorkflowV2",
"parameters": [
{
- "type": "integer",
- "description": "the limit of result item number",
- "name": "limit",
- "in": "query",
+ "type": "string",
+ "description": "workflow id",
+ "name": "workflow_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
"required": true
}
],
@@ -7446,177 +6904,315 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSqlExecutionFailPercentResV1"
+ "$ref": "#/definitions/v2.GetWorkflowResV2"
}
}
}
- }
- },
- "/v1/statistic/instances/type_percent": {
- "get": {
+ },
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get database instances' types percent",
- "tags": [
- "statistic"
+ "description": "update workflow when it is rejected to creator.",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "workflow"
+ ],
+ "summary": "更新工单(驳回后才可更新)",
+ "operationId": "updateWorkflowV2",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "workflow id",
+ "name": "workflow_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "update workflow request",
+ "name": "instance",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v2.UpdateWorkflowReqV2"
+ }
+ }
],
- "summary": "获取数据源类型百分比",
- "operationId": "getInstancesTypePercentV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetInstancesTypePercentResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/statistic/license/usage": {
- "get": {
+ "/v2/projects/{project_name}/workflows/{workflow_id}/cancel": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get usage of license",
+ "description": "cancel workflow",
"tags": [
- "statistic"
+ "workflow"
+ ],
+ "summary": "审批关闭(中止)",
+ "operationId": "cancelWorkflowV2",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "workflow id",
+ "name": "workflow_id",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "获取License使用情况",
- "operationId": "getLicenseUsageV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetLicenseUsageResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/statistic/workflows/audit_pass_percent": {
- "get": {
+ "/v2/projects/{project_name}/workflows/{workflow_id}/steps/{workflow_step_id}/approve": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get workflow audit pass percent",
+ "description": "approve workflow",
"tags": [
- "statistic"
+ "workflow"
+ ],
+ "summary": "审批通过",
+ "operationId": "approveWorkflowV2",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "workflow id",
+ "name": "workflow_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "workflow step id",
+ "name": "workflow_step_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "获取工单审核通过率",
- "operationId": "getWorkflowAuditPassPercentV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowAuditPassPercentResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/statistic/workflows/counts": {
- "get": {
+ "/v2/projects/{project_name}/workflows/{workflow_id}/steps/{workflow_step_id}/reject": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get workflow counts",
+ "description": "reject workflow",
"tags": [
- "statistic"
+ "workflow"
+ ],
+ "summary": "审批驳回",
+ "operationId": "rejectWorkflowV2",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "workflow id",
+ "name": "workflow_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "workflow step id",
+ "name": "workflow_step_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "workflow approve request",
+ "name": "workflow_approve",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v2.RejectWorkflowReqV2"
+ }
+ }
],
- "summary": "获取工单数量统计数据",
- "operationId": "getWorkflowCountV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowCountsResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/statistic/workflows/duration_of_waiting_for_audit": {
+ "/v2/projects/{project_name}/workflows/{workflow_id}/tasks": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get duration from workflow being created to audited",
+ "description": "get summary of workflow instance tasks",
"tags": [
- "statistic"
+ "workflow"
+ ],
+ "summary": "获取工单数据源任务概览",
+ "operationId": "getSummaryOfInstanceTasksV2",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "workflow id",
+ "name": "workflow_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "获取工单从创建到审核结束的平均时长",
- "operationId": "getWorkflowDurationOfWaitingForAuditV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowDurationOfWaitingForAuditResV1"
+ "$ref": "#/definitions/v2.GetWorkflowTasksResV2"
}
}
}
}
},
- "/v1/statistic/workflows/duration_of_waiting_for_execution": {
- "get": {
+ "/v2/projects/{project_name}/workflows/{workflow_id}/tasks/execute": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get duration from workflow being created to executed",
+ "description": "execute tasks on workflow",
"tags": [
- "statistic"
+ "workflow"
+ ],
+ "summary": "多数据源批量上线",
+ "operationId": "executeTasksOnWorkflowV2",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "workflow id",
+ "name": "workflow_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "获取工单各从审核完毕到执行上线的平均时长",
- "operationId": "getWorkflowDurationOfWaitingForExecutionV1",
- "deprecated": true,
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowDurationOfWaitingForExecutionResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/statistic/workflows/each_day_counts": {
- "get": {
+ "/v2/projects/{project_name}/workflows/{workflow_id}/tasks/{task_id}/execute": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get counts of created workflow each day",
+ "description": "execute one task on workflow",
"tags": [
- "statistic"
+ "workflow"
],
- "summary": "获取每天工单创建数量",
- "operationId": "getWorkflowCreatedCountEachDayV1",
+ "summary": "工单提交单个数据源上线",
+ "operationId": "executeOneTaskOnWorkflowV2",
"parameters": [
{
"type": "string",
- "description": "filter date from.(format:yyyy-mm-dd)",
- "name": "filter_date_from",
- "in": "query",
+ "description": "workflow id",
+ "name": "workflow_id",
+ "in": "path",
"required": true
},
{
"type": "string",
- "description": "filter date to.(format:yyyy-mm-dd)",
- "name": "filter_date_to",
- "in": "query",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "task id",
+ "name": "task_id",
+ "in": "path",
"required": true
}
],
@@ -7624,192 +7220,95 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowCreatedCountsEachDayResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/statistic/workflows/instance_type_percent": {
- "get": {
+ "/v2/projects/{project_name}/workflows/{workflow_id}/tasks/{task_id}/schedule": {
+ "put": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get workflows percent counted by instance type",
- "tags": [
- "statistic"
+ "description": "update workflow schedule.",
+ "consumes": [
+ "application/json"
],
- "summary": "获取按数据源类型统计的工单百分比",
- "operationId": "getWorkflowPercentCountedByInstanceTypeV1",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetWorkflowPercentCountedByInstanceTypeResV1"
- }
- }
- }
- }
- },
- "/v1/statistic/workflows/pass_percent": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get workflow pass percent",
- "tags": [
- "statistic"
- ],
- "summary": "获取工单通过率",
- "operationId": "getWorkflowPassPercentV1",
- "deprecated": true,
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetWorkflowPassPercentResV1"
- }
- }
- }
- }
- },
- "/v1/statistic/workflows/rejected_percent_group_by_creator": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
+ "produces": [
+ "application/json"
],
- "description": "get workflows rejected percent group by creator. The result will be sorted by rejected percent in descending order",
"tags": [
- "statistic"
+ "workflow"
],
- "summary": "获取各个用户提交的工单驳回率,按驳回率降序排列",
- "operationId": "getWorkflowRejectedPercentGroupByCreatorV1",
+ "summary": "设置工单数据源定时上线时间(设置为空则代表取消定时时间,需要SQL审核流程都通过后才可以设置)",
+ "operationId": "updateWorkflowScheduleV2",
"parameters": [
{
- "type": "integer",
- "description": "the limit of result item number",
- "name": "limit",
- "in": "query",
+ "type": "string",
+ "description": "workflow id",
+ "name": "workflow_id",
+ "in": "path",
"required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetWorkflowRejectedPercentGroupByCreatorResV1"
- }
- }
- }
- }
- },
- "/v1/statistic/workflows/rejected_percent_group_by_instance": {
- "get": {
- "security": [
+ },
{
- "ApiKeyAuth": []
- }
- ],
- "description": "get workflow rejected percent group by instance. The result will be sorted by rejected percent in descending order",
- "tags": [
- "statistic"
- ],
- "summary": "获取各个数据源相关的工单驳回率,按驳回率降序排列",
- "operationId": "getWorkflowRejectedPercentGroupByInstanceV1",
- "deprecated": true,
- "parameters": [
+ "type": "string",
+ "description": "task id",
+ "name": "task_id",
+ "in": "path",
+ "required": true
+ },
{
- "type": "integer",
- "description": "the limit of result item number",
- "name": "limit",
- "in": "query",
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
"required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
+ },
+ {
+ "description": "update workflow schedule request",
+ "name": "instance",
+ "in": "body",
+ "required": true,
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowRejectedPercentGroupByInstanceResV1"
+ "$ref": "#/definitions/v2.UpdateWorkflowScheduleReqV2"
}
}
- }
- }
- },
- "/v1/statistic/workflows/status_count": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get count of workflow status",
- "tags": [
- "statistic"
],
- "summary": "获取各种状态工单的数量",
- "operationId": "getWorkflowStatusCountV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowStatusCountResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/sync_instances": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get sync instance task list",
- "tags": [
- "sync_instance"
- ],
- "summary": "获取同步实例任务列表",
- "operationId": "GetSyncInstanceTaskList",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetSyncInstanceTaskListResV1"
- }
- }
- }
- },
+ "/v2/sql_audit": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "create sync instance task",
- "consumes": [
- "application/json"
- ],
+ "description": "Direct audit sql",
"tags": [
- "sync_instance"
+ "sql_audit"
],
- "summary": "创建同步实例任务",
- "operationId": "createSyncInstanceTaskV1",
+ "summary": "直接审核SQL",
+ "operationId": "directAuditV2",
+ "deprecated": true,
"parameters": [
{
- "description": "create sync instance task request",
- "name": "sync_task",
+ "description": "sqls that should be audited",
+ "name": "req",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.CreateSyncInstanceTaskReqV1"
+ "$ref": "#/definitions/v2.DirectAuditReqV2"
}
}
],
@@ -7817,4745 +7316,496 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v2.DirectAuditResV2"
}
}
}
}
},
- "/v1/sync_instances/source_tips": {
+ "/v2/tasks/audits/{task_id}/sqls": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get sync task tips",
+ "description": "get information of all SQLs belong to the specified audit task",
"tags": [
- "sync_instance"
+ "task"
+ ],
+ "summary": "获取指定扫描任务的SQLs信息",
+ "operationId": "getAuditTaskSQLsV2",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "task id",
+ "name": "task_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "enum": [
+ "initialized",
+ "doing",
+ "succeeded",
+ "failed",
+ "manually_executed",
+ "terminating",
+ "terminate_succeeded",
+ "terminate_failed"
+ ],
+ "type": "string",
+ "description": "filter: exec status of task sql",
+ "name": "filter_exec_status",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "initialized",
+ "doing",
+ "finished"
+ ],
+ "type": "string",
+ "description": "filter: audit status of task sql",
+ "name": "filter_audit_status",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ],
+ "type": "string",
+ "description": "filter: audit level of task sql",
+ "name": "filter_audit_level",
+ "in": "query"
+ },
+ {
+ "type": "boolean",
+ "description": "select unique (fingerprint and audit result) for task sql",
+ "name": "no_duplicate",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "page index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "page size",
+ "name": "page_size",
+ "in": "query",
+ "required": true
+ }
],
- "summary": "获取同步任务提示",
- "operationId": "GetSyncTaskSourceTips",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSyncTaskSourceTipsResV1"
+ "$ref": "#/definitions/v2.GetAuditTaskSQLsResV2"
}
}
}
}
},
- "/v1/sync_instances/{task_id}/": {
+ "/v2/tasks/audits/{task_id}/sqls/{number}/analysis": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get sync task detail",
+ "description": "get SQL explain and related table metadata for analysis",
"tags": [
- "sync_instance"
+ "task"
],
- "summary": "获取同步任务详情",
- "operationId": "GetSyncInstanceTask",
+ "summary": "获取task相关的SQL执行计划和表元数据",
+ "operationId": "getTaskAnalysisDataV2",
"parameters": [
{
"type": "string",
- "description": "sync task id",
+ "description": "task id",
"name": "task_id",
"in": "path",
"required": true
+ },
+ {
+ "type": "integer",
+ "description": "sql number",
+ "name": "number",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSyncInstanceTaskResV1"
+ "$ref": "#/definitions/v2.GetTaskAnalysisDataResV2"
}
}
}
- },
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "delete sync instance task",
- "tags": [
- "sync_instance"
- ],
- "summary": "删除同步实例任务",
- "operationId": "deleteSyncInstanceTaskV1",
- "parameters": [
- {
- "type": "string",
- "description": "sync task id",
- "name": "task_id",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- },
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "update sync instance task",
- "tags": [
- "sync_instance"
- ],
- "summary": "更新同步实例任务",
- "operationId": "updateSyncInstanceTaskV1",
- "parameters": [
- {
- "type": "string",
- "description": "sync task id",
- "name": "task_id",
- "in": "path",
- "required": true
- },
- {
- "description": "update sync instance request",
- "name": "sync_task",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateSyncInstanceTaskReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/sync_instances/{task_id}/trigger": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "trigger sync instance",
- "tags": [
- "sync_instance"
- ],
- "summary": "触发同步实例",
- "operationId": "triggerSyncInstanceV1",
- "parameters": [
- {
- "type": "string",
- "description": "sync task id",
- "name": "task_id",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.TriggerSyncInstanceResV1"
- }
- }
- }
- }
- },
- "/v1/task_groups/audit": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "audit task group.\n1. formData[sql]: sql content;\n2. file[input_sql_file]: it is a sql file;\n3. file[input_mybatis_xml_file]: it is mybatis xml file, sql will be parsed from it.\n4. file[input_zip_file]: it is zip file, sql will be parsed from it.",
- "consumes": [
- "multipart/form-data"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "task"
- ],
- "summary": "审核任务组",
- "operationId": "auditTaskGroupIdV1",
- "parameters": [
- {
- "type": "integer",
- "description": "group id of tasks",
- "name": "task_group_id",
- "in": "formData",
- "required": true
- },
- {
- "type": "string",
- "description": "sqls for audit",
- "name": "sql",
- "in": "formData"
- },
- {
- "type": "file",
- "description": "input SQL file",
- "name": "input_sql_file",
- "in": "formData"
- },
- {
- "type": "file",
- "description": "input mybatis XML file",
- "name": "input_mybatis_xml_file",
- "in": "formData"
- },
- {
- "type": "file",
- "description": "input ZIP file",
- "name": "input_zip_file",
- "in": "formData"
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.AuditTaskGroupResV1"
- }
- }
- }
- }
- },
- "/v1/tasks/audits/{task_id}/": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get task",
- "tags": [
- "task"
- ],
- "summary": "获取Sql扫描任务信息",
- "operationId": "getAuditTaskV1",
- "parameters": [
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetAuditTaskResV1"
- }
- }
- }
- }
- },
- "/v1/tasks/audits/{task_id}/sql_content": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get SQL content for the audit task",
- "tags": [
- "task"
- ],
- "summary": "获取指定扫描任务的SQL内容",
- "operationId": "getAuditTaskSQLContentV1",
- "parameters": [
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetAuditTaskSQLContentResV1"
- }
- }
- }
- }
- },
- "/v1/tasks/audits/{task_id}/sql_file": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "download SQL file for the audit task",
- "tags": [
- "task"
- ],
- "summary": "下载指定扫描任务的SQL文件",
- "operationId": "downloadAuditTaskSQLFileV1",
- "parameters": [
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "sql file",
- "schema": {
- "type": "file"
- }
- }
- }
- }
- },
- "/v1/tasks/audits/{task_id}/sql_report": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "download report file of all SQLs information belong to the specified audit task",
- "tags": [
- "task"
- ],
- "summary": "下载指定扫描任务的SQLs信息报告",
- "operationId": "downloadAuditTaskSQLReportV1",
- "parameters": [
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- },
- {
- "type": "boolean",
- "description": "select unique (fingerprint and audit result) for task sql",
- "name": "no_duplicate",
- "in": "query"
- }
- ],
- "responses": {
- "200": {
- "description": "sql report csv file",
- "schema": {
- "type": "file"
- }
- }
- }
- }
- },
- "/v1/tasks/audits/{task_id}/sqls": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get information of all SQLs belong to the specified audit task",
- "tags": [
- "task"
- ],
- "summary": "获取指定扫描任务的SQLs信息",
- "operationId": "getAuditTaskSQLsV1",
- "parameters": [
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- },
- {
- "enum": [
- "initialized",
- "doing",
- "succeeded",
- "failed",
- "manually_executed"
- ],
- "type": "string",
- "description": "filter: exec status of task sql",
- "name": "filter_exec_status",
- "in": "query"
- },
- {
- "enum": [
- "initialized",
- "doing",
- "finished"
- ],
- "type": "string",
- "description": "filter: audit status of task sql",
- "name": "filter_audit_status",
- "in": "query"
- },
- {
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ],
- "type": "string",
- "description": "filter: audit level of task sql",
- "name": "filter_audit_level",
- "in": "query"
- },
- {
- "type": "boolean",
- "description": "select unique (fingerprint and audit result) for task sql",
- "name": "no_duplicate",
- "in": "query"
- },
- {
- "type": "string",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "string",
- "description": "page size",
- "name": "page_size",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetAuditTaskSQLsResV1"
- }
- }
- }
- }
- },
- "/v1/tasks/audits/{task_id}/sqls/{number}": {
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "modify the relevant information of a certain SQL in the audit task",
- "consumes": [
- "application/json"
- ],
- "tags": [
- "task"
- ],
- "summary": "修改扫描任务中某条SQL的相关信息",
- "operationId": "updateAuditTaskSQLsV1",
- "parameters": [
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "sql number",
- "name": "number",
- "in": "path",
- "required": true
- },
- {
- "description": "modify the relevant information of a certain SQL in the audit task",
- "name": "audit_plan",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateAuditTaskSQLsReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/tasks/audits/{task_id}/sqls/{number}/analysis": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get SQL explain and related table metadata for analysis",
- "tags": [
- "task"
- ],
- "summary": "获取task相关的SQL执行计划和表元数据",
- "operationId": "getTaskAnalysisData",
- "parameters": [
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- },
- {
- "type": "integer",
- "description": "sql number",
- "name": "number",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetTaskAnalysisDataResV1"
- }
- }
- }
- }
- },
- "/v1/user": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get current user info",
- "tags": [
- "user"
- ],
- "summary": "获取当前用户信息",
- "operationId": "getCurrentUserV1",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetUserDetailResV1"
- }
- }
- }
- },
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "update current user",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "user"
- ],
- "summary": "更新个人信息",
- "operationId": "updateCurrentUserV1",
- "parameters": [
- {
- "description": "update user",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateCurrentUserReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/user/password": {
- "put": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "update current user's password",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "user"
- ],
- "summary": "用户修改密码",
- "operationId": "UpdateCurrentUserPasswordV1",
- "parameters": [
- {
- "description": "update user's password",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateCurrentUserPasswordReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/user_group_tips": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get user group tip list",
- "tags": [
- "user_group"
- ],
- "summary": "获取用户组提示列表",
- "operationId": "getUserGroupTipListV1",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "filter_project",
- "in": "query"
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetUserGroupTipsResV1"
- }
- }
- }
- }
- },
- "/v1/user_groups": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get user group info list",
- "produces": [
- "application/json"
- ],
- "tags": [
- "user_group"
- ],
- "summary": "获取用户组列表",
- "operationId": "getUserGroupListV1",
- "parameters": [
- {
- "type": "string",
- "description": "filter user group name",
- "name": "filter_user_group_name",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetUserGroupsResV1"
- }
- }
- }
- },
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "create user group",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "user_group"
- ],
- "summary": "创建用户组",
- "operationId": "CreateUserGroupV1",
- "parameters": [
- {
- "description": "create user group",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.CreateUserGroupReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/user_groups/{user_group_name}/": {
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "delete user group",
- "tags": [
- "user_group"
- ],
- "summary": "删除用户组",
- "operationId": "deleteUserGroupV1",
- "parameters": [
- {
- "type": "string",
- "description": "user_group_name",
- "name": "user_group_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- },
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "update user group",
- "tags": [
- "user_group"
- ],
- "summary": "更新用户组",
- "operationId": "updateUserGroupV1",
- "parameters": [
- {
- "type": "string",
- "description": "user_group_name",
- "name": "user_group_name",
- "in": "path",
- "required": true
- },
- {
- "description": "update user group",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.PatchUserGroupReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/user_tips": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get user tip list",
- "tags": [
- "user"
- ],
- "summary": "获取用户提示列表",
- "operationId": "getUserTipListV1",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "filter_project",
- "in": "query"
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetUserTipsResV1"
- }
- }
- }
- }
- },
- "/v1/users": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get user info list",
- "tags": [
- "user"
- ],
- "summary": "获取用户信息列表",
- "operationId": "getUserListV1",
- "parameters": [
- {
- "type": "string",
- "description": "filter user name",
- "name": "filter_user_name",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetUsersResV1"
- }
- }
- }
- },
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "create user",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "user"
- ],
- "summary": "创建用户",
- "operationId": "createUserV1",
- "parameters": [
- {
- "description": "create user",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.CreateUserReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/users/{user_name}/": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get user info",
- "tags": [
- "user"
- ],
- "summary": "获取用户信息",
- "operationId": "getUserV1",
- "parameters": [
- {
- "type": "string",
- "description": "user name",
- "name": "user_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetUserDetailResV1"
- }
- }
- }
- },
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "delete user",
- "tags": [
- "user"
- ],
- "summary": "删除用户",
- "operationId": "deleteUserV1",
- "parameters": [
- {
- "type": "string",
- "description": "user name",
- "name": "user_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- },
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "update user",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "user"
- ],
- "summary": "更新用户信息",
- "operationId": "updateUserV1",
- "parameters": [
- {
- "type": "string",
- "description": "user name",
- "name": "user_name",
- "in": "path",
- "required": true
- },
- {
- "description": "update user",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateUserReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/users/{user_name}/password": {
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "admin modifies the passwords of other users",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "user"
- ],
- "summary": "admin修改其他用户密码",
- "operationId": "UpdateOtherUserPasswordV1",
- "parameters": [
- {
- "type": "string",
- "description": "user name",
- "name": "user_name",
- "in": "path",
- "required": true
- },
- {
- "description": "change user's password",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateOtherUserPasswordReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/workflows": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get global workflow list",
- "tags": [
- "workflow"
- ],
- "summary": "获取全局工单列表",
- "operationId": "getGlobalWorkflowsV1",
- "parameters": [
- {
- "type": "string",
- "description": "filter subject",
- "name": "filter_subject",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create time from",
- "name": "filter_create_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create time to",
- "name": "filter_create_time_to",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_task_execute_start_time_from",
- "name": "filter_task_execute_start_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_task_execute_start_time_to",
- "name": "filter_task_execute_start_time_to",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create user name",
- "name": "filter_create_user_name",
- "in": "query"
- },
- {
- "enum": [
- "wait_for_audit",
- "wait_for_execution",
- "rejected",
- "executing",
- "canceled",
- "exec_failed",
- "finished"
- ],
- "type": "string",
- "description": "filter workflow status",
- "name": "filter_status",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter current step assignee user name",
- "name": "filter_current_step_assignee_user_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter instance name",
- "name": "filter_task_instance_name",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetWorkflowsResV1"
- }
- }
- }
- }
- },
- "/v2/audit_files": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Direct audit sql from SQL files and MyBatis files",
- "tags": [
- "sql_audit"
- ],
- "summary": "直接从文件内容提取SQL并审核,SQL文件暂时只支持一次解析一个文件",
- "operationId": "directAuditFilesV2",
- "parameters": [
- {
- "description": "files that should be audited",
- "name": "req",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.DirectAuditFileReqV2"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.DirectAuditResV2"
- }
- }
- }
- }
- },
- "/v2/configurations/drivers": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get drivers",
- "tags": [
- "configuration"
- ],
- "summary": "获取当前 server 支持的审核类型",
- "operationId": "getDriversV2",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetDriversRes"
- }
- }
- }
- }
- },
- "/v2/login": {
- "post": {
- "description": "user login",
- "tags": [
- "user"
- ],
- "summary": "用户登录",
- "operationId": "loginV2",
- "parameters": [
- {
- "description": "user login request",
- "name": "user",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UserLoginReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/audit_plans": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get audit plan info list",
- "tags": [
- "audit_plan"
- ],
- "summary": "获取扫描任务信息列表",
- "operationId": "getAuditPlansV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "filter audit plan db type",
- "name": "filter_audit_plan_db_type",
- "in": "query"
- },
- {
- "type": "string",
- "description": "fuzzy search audit plan name",
- "name": "fuzzy_search_audit_plan_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter audit plan type",
- "name": "filter_audit_plan_type",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter audit plan instance name",
- "name": "filter_audit_plan_instance_name",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetAuditPlansResV2"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get audit plan report SQLs",
- "tags": [
- "audit_plan"
- ],
- "summary": "获取指定扫描任务的SQL扫描详情",
- "operationId": "getAuditPlanReportsSQLs",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "audit plan report id",
- "name": "audit_plan_report_id",
- "in": "path",
- "required": true
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetAuditPlanReportSQLsResV2"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls/{number}/analysis": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get SQL explain and related table metadata for analysis",
- "tags": [
- "audit_plan"
- ],
- "summary": "获取task相关的SQL执行计划和表元数据",
- "operationId": "getAuditPlantAnalysisDataV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "audit plan report id",
- "name": "audit_plan_report_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "sql number",
- "name": "number",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetAuditPlanAnalysisDataResV2"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/audit_plans/{audit_plan_name}/sqls/full": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "full sync audit plan SQLs",
- "tags": [
- "audit_plan"
- ],
- "summary": "全量同步SQL到扫描任务",
- "operationId": "fullSyncAuditPlanSQLsV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
- "in": "path",
- "required": true
- },
- {
- "description": "full sync audit plan SQLs request",
- "name": "sqls",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.FullSyncAuditPlanSQLsReqV2"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/audit_plans/{audit_plan_name}/sqls/partial": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "partial sync audit plan SQLs",
- "tags": [
- "audit_plan"
- ],
- "summary": "增量同步SQL到扫描任务",
- "operationId": "partialSyncAuditPlanSQLsV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
- "in": "path",
- "required": true
- },
- {
- "description": "partial sync audit plan SQLs request",
- "name": "sqls",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.PartialSyncAuditPlanSQLsReqV2"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/instances": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get instance info list",
- "tags": [
- "instance"
- ],
- "summary": "获取实例信息列表",
- "operationId": "getInstanceListV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "filter instance name",
- "name": "filter_instance_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter db type",
- "name": "filter_db_type",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter db host",
- "name": "filter_db_host",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter db port",
- "name": "filter_db_port",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter db user",
- "name": "filter_db_user",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter rule template name",
- "name": "filter_rule_template_name",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetInstancesResV2"
- }
- }
- }
- },
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "create a instance",
- "consumes": [
- "application/json"
- ],
- "tags": [
- "instance"
- ],
- "summary": "添加实例",
- "operationId": "createInstanceV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "description": "add instance",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.CreateInstanceReqV2"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/instances/{instance_name}/": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get instance db",
- "tags": [
- "instance"
- ],
- "summary": "获取实例信息",
- "operationId": "getInstanceV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "instance name",
- "name": "instance_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetInstanceResV2"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/sql_manages": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get sql manage list",
- "tags": [
- "SqlManage"
- ],
- "summary": "获取管控sql列表",
- "operationId": "GetSqlManageListV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "fuzzy search sql fingerprint",
- "name": "fuzzy_search_sql_fingerprint",
- "in": "query"
- },
- {
- "type": "string",
- "description": "assignee",
- "name": "filter_assignee",
- "in": "query"
- },
- {
- "type": "string",
- "description": "instance name",
- "name": "filter_instance_name",
- "in": "query"
- },
- {
- "enum": [
- "audit_plan",
- "sql_audit_record"
- ],
- "type": "string",
- "description": "source",
- "name": "filter_source",
- "in": "query"
- },
- {
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ],
- "type": "string",
- "description": "audit level",
- "name": "filter_audit_level",
- "in": "query"
- },
- {
- "type": "string",
- "description": "last audit start time from",
- "name": "filter_last_audit_start_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "last audit start time to",
- "name": "filter_last_audit_start_time_to",
- "in": "query"
- },
- {
- "enum": [
- "unhandled",
- "solved",
- "ignored",
- "manual_audited"
- ],
- "type": "string",
- "description": "status",
- "name": "filter_status",
- "in": "query"
- },
- {
- "type": "string",
- "description": "rule name",
- "name": "filter_rule_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "db type",
- "name": "filter_db_type",
- "in": "query"
- },
- {
- "type": "string",
- "description": "fuzzy search endpoint",
- "name": "fuzzy_search_endpoint",
- "in": "query"
- },
- {
- "type": "string",
- "description": "fuzzy search schema name",
- "name": "fuzzy_search_schema_name",
- "in": "query"
- },
- {
- "enum": [
- "first_appear_timestamp",
- "last_receive_timestamp",
- "fp_count"
- ],
- "type": "string",
- "description": "sort field",
- "name": "sort_field",
- "in": "query"
- },
- {
- "enum": [
- "asc",
- "desc"
- ],
- "type": "string",
- "description": "sort order",
- "name": "sort_order",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetSqlManageListResp"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "create workflow",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "workflow"
- ],
- "summary": "创建工单",
- "operationId": "createWorkflowV2",
- "parameters": [
- {
- "description": "create workflow request",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.CreateWorkflowReqV2"
- }
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.CreateWorkflowResV2"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows/cancel": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "batch cancel workflows",
- "tags": [
- "workflow"
- ],
- "summary": "批量取消工单",
- "operationId": "batchCancelWorkflowsV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "description": "batch cancel workflows request",
- "name": "BatchCancelWorkflowsReqV2",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.BatchCancelWorkflowsReqV2"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows/complete": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "this api will directly change the work order status to finished without real online operation",
- "tags": [
- "workflow"
- ],
- "summary": "批量完成工单",
- "operationId": "batchCompleteWorkflowsV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "description": "batch complete workflows request",
- "name": "data",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.BatchCompleteWorkflowsReqV2"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows/{workflow_id}/": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get workflow detail",
- "tags": [
- "workflow"
- ],
- "summary": "获取工单详情",
- "operationId": "getWorkflowV2",
- "parameters": [
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetWorkflowResV2"
- }
- }
- }
- },
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "update workflow when it is rejected to creator.",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "workflow"
- ],
- "summary": "更新工单(驳回后才可更新)",
- "operationId": "updateWorkflowV2",
- "parameters": [
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "description": "update workflow request",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.UpdateWorkflowReqV2"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows/{workflow_id}/cancel": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "cancel workflow",
- "tags": [
- "workflow"
- ],
- "summary": "审批关闭(中止)",
- "operationId": "cancelWorkflowV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows/{workflow_id}/steps/{workflow_step_id}/approve": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "approve workflow",
- "tags": [
- "workflow"
- ],
- "summary": "审批通过",
- "operationId": "approveWorkflowV2",
- "parameters": [
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "workflow step id",
- "name": "workflow_step_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows/{workflow_id}/steps/{workflow_step_id}/reject": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "reject workflow",
- "tags": [
- "workflow"
- ],
- "summary": "审批驳回",
- "operationId": "rejectWorkflowV2",
- "parameters": [
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "workflow step id",
- "name": "workflow_step_id",
- "in": "path",
- "required": true
- },
- {
- "description": "workflow approve request",
- "name": "workflow_approve",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.RejectWorkflowReqV2"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows/{workflow_id}/tasks": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get summary of workflow instance tasks",
- "tags": [
- "workflow"
- ],
- "summary": "获取工单数据源任务概览",
- "operationId": "getSummaryOfInstanceTasksV2",
- "parameters": [
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetWorkflowTasksResV2"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows/{workflow_id}/tasks/execute": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "execute tasks on workflow",
- "tags": [
- "workflow"
- ],
- "summary": "多数据源批量上线",
- "operationId": "executeTasksOnWorkflowV2",
- "parameters": [
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows/{workflow_id}/tasks/{task_id}/execute": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "execute one task on workflow",
- "tags": [
- "workflow"
- ],
- "summary": "工单提交单个数据源上线",
- "operationId": "executeOneTaskOnWorkflowV2",
- "parameters": [
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows/{workflow_id}/tasks/{task_id}/schedule": {
- "put": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "update workflow schedule.",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "workflow"
- ],
- "summary": "设置工单数据源定时上线时间(设置为空则代表取消定时时间,需要SQL审核流程都通过后才可以设置)",
- "operationId": "updateWorkflowScheduleV2",
- "parameters": [
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "description": "update workflow schedule request",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.UpdateWorkflowScheduleReqV2"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/sql_audit": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Direct audit sql",
- "tags": [
- "sql_audit"
- ],
- "summary": "直接审核SQL",
- "operationId": "directAuditV2",
- "deprecated": true,
- "parameters": [
- {
- "description": "sqls that should be audited",
- "name": "req",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.DirectAuditReqV2"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.DirectAuditResV2"
- }
- }
- }
- }
- },
- "/v2/tasks/audits/{task_id}/sqls": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get information of all SQLs belong to the specified audit task",
- "tags": [
- "task"
- ],
- "summary": "获取指定扫描任务的SQLs信息",
- "operationId": "getAuditTaskSQLsV2",
- "parameters": [
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- },
- {
- "enum": [
- "initialized",
- "doing",
- "succeeded",
- "failed",
- "manually_executed",
- "terminating",
- "terminate_succeeded",
- "terminate_failed"
- ],
- "type": "string",
- "description": "filter: exec status of task sql",
- "name": "filter_exec_status",
- "in": "query"
- },
- {
- "enum": [
- "initialized",
- "doing",
- "finished"
- ],
- "type": "string",
- "description": "filter: audit status of task sql",
- "name": "filter_audit_status",
- "in": "query"
- },
- {
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ],
- "type": "string",
- "description": "filter: audit level of task sql",
- "name": "filter_audit_level",
- "in": "query"
- },
- {
- "type": "boolean",
- "description": "select unique (fingerprint and audit result) for task sql",
- "name": "no_duplicate",
- "in": "query"
- },
- {
- "type": "string",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "string",
- "description": "page size",
- "name": "page_size",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetAuditTaskSQLsResV2"
- }
- }
- }
- }
- },
- "/v2/tasks/audits/{task_id}/sqls/{number}/analysis": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get SQL explain and related table metadata for analysis",
- "tags": [
- "task"
- ],
- "summary": "获取task相关的SQL执行计划和表元数据",
- "operationId": "getTaskAnalysisDataV2",
- "parameters": [
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- },
- {
- "type": "integer",
- "description": "sql number",
- "name": "number",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetTaskAnalysisDataResV2"
- }
- }
- }
- }
- }
- },
- "definitions": {
- "controller.BaseRes": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.AffectRows": {
- "type": "object",
- "properties": {
- "count": {
- "type": "integer"
- },
- "err_message": {
- "type": "string"
- }
- }
- },
- "v1.AuditPlanCount": {
- "type": "object",
- "properties": {
- "audit_plan_count": {
- "type": "integer"
- },
- "audit_plan_desc": {
- "type": "string"
- },
- "audit_plan_type": {
- "type": "string"
- }
- }
- },
- "v1.AuditPlanMetaV1": {
- "type": "object",
- "properties": {
- "audit_plan_params": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanParamResV1"
- }
- },
- "audit_plan_type": {
- "type": "string"
- },
- "audit_plan_type_desc": {
- "type": "string"
- },
- "instance_type": {
- "type": "string"
- }
- }
- },
- "v1.AuditPlanParamReqV1": {
- "type": "object",
- "properties": {
- "key": {
- "type": "string"
- },
- "value": {
- "type": "string"
- }
- }
- },
- "v1.AuditPlanParamResV1": {
- "type": "object",
- "properties": {
- "desc": {
- "type": "string"
- },
- "key": {
- "type": "string"
- },
- "type": {
- "type": "string",
- "enum": [
- "string",
- "int",
- "bool"
- ]
- },
- "value": {
- "type": "string"
- }
- }
- },
- "v1.AuditPlanReportResV1": {
- "type": "object",
- "properties": {
- "audit_level": {
- "type": "string",
- "enum": [
- "normal",
- "notice",
- "warn",
- "error",
- ""
- ]
- },
- "audit_plan_report_id": {
- "type": "string",
- "example": "1"
- },
- "audit_plan_report_timestamp": {
- "type": "string",
- "example": "RFC3339"
- },
- "pass_rate": {
- "type": "number"
- },
- "score": {
- "type": "integer"
- }
- }
- },
- "v1.AuditPlanReportSQLResV1": {
- "type": "object",
- "properties": {
- "audit_plan_report_sql": {
- "type": "string",
- "example": "select * from t1 where id = 1"
- },
- "audit_plan_report_sql_audit_result": {
- "type": "string",
- "example": "same format as task audit result"
- },
- "number": {
- "type": "integer",
- "example": 1
- }
- }
- },
- "v1.AuditPlanResV1": {
- "type": "object",
- "properties": {
- "audit_plan_cron": {
- "type": "string",
- "example": "0 */2 * * *"
- },
- "audit_plan_db_type": {
- "type": "string",
- "example": "mysql"
- },
- "audit_plan_instance_database": {
- "type": "string",
- "example": "app1"
- },
- "audit_plan_instance_name": {
- "type": "string",
- "example": "test_mysql"
- },
- "audit_plan_meta": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditPlanMetaV1"
- },
- "audit_plan_name": {
- "type": "string",
- "example": "audit_for_java_app1"
- },
- "audit_plan_token": {
- "type": "string",
- "example": "it's a JWT Token for scanner"
- },
- "rule_template_name": {
- "type": "string",
- "example": "default_MySQL"
- }
- }
- },
- "v1.AuditPlanSQLHeadV1": {
- "type": "object",
- "properties": {
- "desc": {
- "type": "string"
- },
- "name": {
- "type": "string"
- },
- "type": {
- "type": "string",
- "enum": [
- "sql"
- ]
- }
- }
- },
- "v1.AuditPlanSQLReqV1": {
- "type": "object",
- "properties": {
- "audit_plan_sql_counter": {
- "type": "string",
- "example": "6"
- },
- "audit_plan_sql_fingerprint": {
- "type": "string",
- "example": "select * from t1 where id = ?"
- },
- "audit_plan_sql_last_receive_text": {
- "type": "string",
- "example": "select * from t1 where id = 1"
- },
- "audit_plan_sql_last_receive_timestamp": {
- "type": "string",
- "example": "RFC3339"
- },
- "audit_plan_sql_schema": {
- "type": "string",
- "example": "db1"
- },
- "db_user": {
- "type": "string",
- "example": "database_user001"
- },
- "endpoint": {
- "type": "string",
- "example": "10.186.1.2"
- },
- "first_query_at": {
- "type": "string",
- "example": "2023-09-12T02:48:01.317880Z"
- },
- "query_time_avg": {
- "type": "number",
- "example": 3.22
- },
- "query_time_max": {
- "type": "number",
- "example": 5.22
- }
- }
- },
- "v1.AuditPlanSQLResV1": {
- "type": "object",
- "properties": {
- "head": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanSQLHeadV1"
- }
- },
- "rows": {
- "type": "array",
- "items": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- }
- }
- }
- },
- "v1.AuditPlanTypesV1": {
- "type": "object",
- "properties": {
- "desc": {
- "type": "string"
- },
- "instance_type": {
- "type": "string",
- "enum": [
- "MySQL",
- "Oracle",
- "TiDB",
- "OceanBase For MySQL",
- ""
- ]
- },
- "type": {
- "type": "string"
- }
- }
- },
- "v1.AuditResDataV1": {
- "type": "object",
- "properties": {
- "audit_level": {
- "type": "string",
- "enum": [
- "normal",
- "notice",
- "warn",
- "error",
- ""
- ]
- },
- "pass_rate": {
- "type": "number"
- },
- "score": {
- "type": "integer"
- },
- "sql_results": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditSQLResV1"
- }
- }
- }
- },
- "v1.AuditResult": {
- "type": "object",
- "properties": {
- "level": {
- "type": "string",
- "example": "warn"
- },
- "message": {
- "type": "string",
- "example": "避免使用不必要的内置函数md5()"
- },
- "rule_name": {
- "type": "string"
- }
- }
- },
- "v1.AuditSQLResV1": {
- "type": "object",
- "properties": {
- "audit_level": {
- "type": "string"
- },
- "audit_result": {
- "type": "string"
- },
- "exec_sql": {
- "type": "string"
- },
- "number": {
- "type": "integer"
- }
- }
- },
- "v1.AuditTaskGroupRes": {
- "type": "object",
- "properties": {
- "task_group_id": {
- "type": "integer"
- },
- "tasks": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditTaskResV1"
- }
- }
- }
- },
- "v1.AuditTaskGroupResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditTaskGroupRes"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.AuditTaskResV1": {
- "type": "object",
- "properties": {
- "audit_level": {
- "type": "string",
- "enum": [
- "normal",
- "notice",
- "warn",
- "error",
- ""
- ]
- },
- "exec_end_time": {
- "type": "string"
- },
- "exec_start_time": {
- "type": "string"
- },
- "instance_db_type": {
- "type": "string"
- },
- "instance_name": {
- "type": "string"
- },
- "instance_schema": {
- "type": "string",
- "example": "db1"
- },
- "pass_rate": {
- "type": "number"
- },
- "score": {
- "type": "integer"
- },
- "sql_source": {
- "type": "string",
- "enum": [
- "form_data",
- "sql_file",
- "mybatis_xml_file",
- "audit_plan"
- ]
- },
- "status": {
- "type": "string",
- "enum": [
- "initialized",
- "audited",
- "executing",
- "exec_success",
- "exec_failed",
- "manually_executed"
- ]
- },
- "task_id": {
- "type": "integer"
- }
- }
- },
- "v1.AuditTaskSQLContentResV1": {
- "type": "object",
- "properties": {
- "sql": {
- "type": "string",
- "example": "alter table tb1 drop columns c1"
- }
- }
- },
- "v1.AuditTaskSQLResV1": {
- "type": "object",
- "properties": {
- "audit_level": {
- "type": "string"
- },
- "audit_result": {
- "type": "string"
- },
- "audit_status": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "exec_result": {
- "type": "string"
- },
- "exec_sql": {
- "type": "string"
- },
- "exec_status": {
- "type": "string"
- },
- "number": {
- "type": "integer"
- },
- "rollback_sql": {
- "type": "string"
- }
- }
- },
- "v1.AuditTasksGroupResV1": {
- "type": "object",
- "properties": {
- "task_group_id": {
- "type": "integer"
- }
- }
- },
- "v1.AuditWhitelistResV1": {
- "type": "object",
- "properties": {
- "audit_whitelist_id": {
- "type": "integer"
- },
- "desc": {
- "type": "string"
- },
- "match_type": {
- "type": "string"
- },
- "value": {
- "type": "string"
- }
- }
- },
- "v1.AuditedSQLCount": {
- "type": "object",
- "properties": {
- "risk_sql_count": {
- "type": "integer"
- },
- "total_sql_count": {
- "type": "integer"
- }
- }
- },
- "v1.BatchCancelWorkflowsReqV1": {
- "type": "object",
- "properties": {
- "workflow_names": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
- },
- "v1.BatchCheckInstanceConnectionsReqV1": {
- "type": "object",
- "properties": {
- "instances": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.InstanceForCheckConnection"
- }
- }
- }
- },
- "v1.BatchCompleteWorkflowsReqV1": {
- "type": "object",
- "properties": {
- "workflow_names": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
- },
- "v1.BatchGetInstanceConnectionsResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.InstanceConnectionResV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.BatchUpdateSqlManageReq": {
- "type": "object",
- "properties": {
- "assignees": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "remark": {
- "type": "string"
- },
- "sql_manage_id_list": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- },
- "status": {
- "type": "string",
- "enum": [
- "solved",
- "ignored",
- "manual_audited"
- ]
- }
- }
- },
- "v1.BindOauth2UserReqV1": {
- "type": "object",
- "properties": {
- "oauth2_token": {
- "type": "string"
- },
- "pwd": {
- "type": "string"
- },
- "user_name": {
- "type": "string"
- }
- }
- },
- "v1.BindOauth2UserResDataV1": {
- "type": "object",
- "properties": {
- "token": {
- "type": "string"
- }
- }
- },
- "v1.BindOauth2UserResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.BindOauth2UserResDataV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.BindRoleReqV1": {
- "type": "object",
- "properties": {
- "instance_name": {
- "type": "string"
- },
- "role_names": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
- },
- "v1.CheckLicenseResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "content": {
- "type": "string"
- },
- "license": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.LicenseItem"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.CloneProjectRuleTemplateReqV1": {
- "type": "object",
- "properties": {
- "desc": {
- "type": "string"
- },
- "instance_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "new_rule_template_name": {
- "type": "string"
- }
- }
- },
- "v1.CloneRuleTemplateReqV1": {
- "type": "object",
- "properties": {
- "desc": {
- "type": "string"
- },
- "new_rule_template_name": {
- "type": "string"
- }
- }
- },
- "v1.CompanyNotice": {
- "type": "object",
- "properties": {
- "notice_str": {
- "type": "string"
- }
- }
- },
- "v1.CreateAuditPlanReqV1": {
- "type": "object",
- "properties": {
- "audit_plan_cron": {
- "type": "string",
- "example": "0 */2 * * *"
- },
- "audit_plan_instance_database": {
- "type": "string",
- "example": "app1"
- },
- "audit_plan_instance_name": {
- "type": "string",
- "example": "test_mysql"
- },
- "audit_plan_instance_type": {
- "type": "string",
- "example": "mysql"
- },
- "audit_plan_name": {
- "type": "string",
- "example": "audit_plan_for_java_repo_1"
- },
- "audit_plan_params": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanParamReqV1"
- }
- },
- "audit_plan_type": {
- "type": "string",
- "example": "slow log"
- },
- "rule_template_name": {
- "type": "string",
- "example": "default_MySQL"
- }
- }
- },
- "v1.CreateAuditTasksGroupReqV1": {
- "type": "object",
- "properties": {
- "instances": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.InstanceForCreatingTask"
- }
- }
- }
- },
- "v1.CreateAuditTasksGroupResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditTasksGroupResV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.CreateAuditWhitelistReqV1": {
- "type": "object",
- "properties": {
- "desc": {
- "type": "string",
- "example": "used for rapid release"
- },
- "match_type": {
- "type": "string",
- "enum": [
- "exact_match",
- "fp_match"
- ],
- "example": "exact_match"
- },
- "value": {
- "type": "string",
- "example": "create table"
- }
- }
- },
- "v1.CreateCustomRuleReqV1": {
- "type": "object",
- "properties": {
- "annotation": {
- "type": "string",
- "example": "this is test rule"
- },
- "db_type": {
- "type": "string",
- "example": "MySQL"
- },
- "desc": {
- "type": "string",
- "example": "this is test rule"
- },
- "level": {
- "type": "string",
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ],
- "example": "notice"
- },
- "rule_script": {
- "type": "string"
- },
- "type": {
- "type": "string",
- "example": "DDL规则"
- }
- }
- },
- "v1.CreateInstanceReqV1": {
- "type": "object",
- "properties": {
- "additional_params": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.InstanceAdditionalParamReqV1"
- }
- },
- "db_host": {
- "type": "string",
- "example": "10.10.10.10"
- },
- "db_password": {
- "type": "string",
- "example": "123456"
- },
- "db_port": {
- "type": "string",
- "example": "3306"
- },
- "db_type": {
- "type": "string",
- "example": "mysql"
- },
- "db_user": {
- "type": "string",
- "example": "root"
- },
- "desc": {
- "type": "string",
- "example": "this is a test instance"
- },
- "instance_name": {
- "type": "string",
- "example": "test"
- },
- "maintenance_times": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.MaintenanceTimeReqV1"
- }
- },
- "rule_template_name": {
- "type": "string"
- },
- "sql_query_config": {
- "type": "object",
- "$ref": "#/definitions/v1.SQLQueryConfigReqV1"
- }
- }
- },
- "v1.CreateMemberGroupReqV1": {
- "type": "object",
- "properties": {
- "roles": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.BindRoleReqV1"
- }
- },
- "user_group_name": {
- "type": "string"
- }
- }
- },
- "v1.CreateMemberReqV1": {
- "type": "object",
- "properties": {
- "is_manager": {
- "type": "boolean"
- },
- "roles": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.BindRoleReqV1"
- }
- },
- "user_name": {
- "type": "string"
- }
- }
- },
- "v1.CreateProjectReqV1": {
- "type": "object",
- "properties": {
- "desc": {
- "type": "string"
- },
- "name": {
- "type": "string"
- }
- }
- },
- "v1.CreateProjectRuleTemplateReqV1": {
- "type": "object",
- "properties": {
- "db_type": {
- "type": "string"
- },
- "desc": {
- "type": "string"
- },
- "instance_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "rule_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.RuleReqV1"
- }
- },
- "rule_template_name": {
- "type": "string"
- }
- }
- },
- "v1.CreateRoleReqV1": {
- "type": "object",
- "properties": {
- "operation_code_list": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- },
- "role_desc": {
- "type": "string"
- },
- "role_name": {
- "type": "string"
- }
- }
- },
- "v1.CreateRuleTemplateReqV1": {
- "type": "object",
- "properties": {
- "db_type": {
- "type": "string"
- },
- "desc": {
- "type": "string"
- },
- "rule_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.RuleReqV1"
- }
- },
- "rule_template_name": {
- "type": "string"
- }
- }
- },
- "v1.CreateSQLAuditRecordResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.SQLAuditRecordResData"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.CreateSyncInstanceTaskReqV1": {
- "type": "object",
- "required": [
- "db_type",
- "global_rule_template",
- "source",
- "sync_instance_interval",
- "url",
- "version"
- ],
- "properties": {
- "db_type": {
- "type": "string",
- "example": "mysql"
- },
- "global_rule_template": {
- "type": "string",
- "example": "default_mysql"
- },
- "source": {
- "type": "string",
- "example": "actiontech-dmp"
- },
- "sync_instance_interval": {
- "type": "string",
- "example": "0 0 * * *"
- },
- "url": {
- "type": "string",
- "example": "http://10.186.62.56:10000"
- },
- "version": {
- "type": "string",
- "example": "5.23.01.0"
- }
- }
- },
- "v1.CreateUserGroupReqV1": {
- "type": "object",
- "properties": {
- "user_group_desc": {
- "type": "string",
- "example": "this is a group"
- },
- "user_group_name": {
- "type": "string",
- "example": "test"
- },
- "user_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
- },
- "v1.CreateUserReqV1": {
- "type": "object",
- "properties": {
- "email": {
- "type": "string",
- "example": "test@email.com"
- },
- "management_permission_code_list": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- },
- "phone": {
- "type": "string",
- "example": "18962136666"
- },
- "user_group_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "user_name": {
- "type": "string",
- "example": "test"
- },
- "user_password": {
- "type": "string",
- "example": "123456"
- },
- "wechat_id": {
- "type": "string",
- "example": "UserID"
- }
- }
- },
- "v1.CreateWorkflowReqV1": {
- "type": "object",
- "properties": {
- "desc": {
- "type": "string"
- },
- "task_ids": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- },
- "workflow_subject": {
- "type": "string"
- }
- }
- },
- "v1.CustomRuleResV1": {
- "type": "object",
- "properties": {
- "annotation": {
- "type": "string",
- "example": "this is test rule"
- },
- "db_type": {
- "type": "string",
- "example": "MySQL"
- },
- "desc": {
- "type": "string",
- "example": "this is test rule"
- },
- "level": {
- "type": "string",
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ],
- "example": "notice"
- },
- "rule_id": {
- "type": "string"
- },
- "rule_script": {
- "type": "string"
- },
- "type": {
- "type": "string",
- "example": "DDL规则"
- }
- }
- },
- "v1.DBTypeAuditPlan": {
- "type": "object",
- "properties": {
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanCount"
- }
- },
- "db_type": {
- "type": "string"
- }
- }
- },
- "v1.DBTypeHealth": {
- "type": "object",
- "properties": {
- "db_type": {
- "type": "string"
- },
- "health_instance_names": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "unhealth_instance_names": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
- },
- "v1.DashboardProjectTipV1": {
- "type": "object",
- "properties": {
- "project_name": {
- "type": "string"
- },
- "unfinished_workflow_count": {
- "description": "只统计与当前用户相关的未完成工单",
- "type": "integer"
- }
- }
- },
- "v1.DashboardResV1": {
- "type": "object",
- "properties": {
- "workflow_statistics": {
- "type": "object",
- "$ref": "#/definitions/v1.WorkflowStatisticsResV1"
- }
- }
- },
- "v1.DingTalkConfigurationV1": {
- "type": "object",
- "properties": {
- "app_key": {
- "type": "string"
- },
- "is_enable_ding_talk_notify": {
- "type": "boolean"
- }
- }
- },
- "v1.DirectAuditFileReqV1": {
- "type": "object",
- "properties": {
- "file_contents": {
- "description": "调用方不应该关心SQL是否被完美的拆分成独立的条目, 拆分SQL由SQLE实现\n每个数组元素是一个文件内容",
- "type": "array",
- "items": {
- "type": "string"
- },
- "example": [
- "select * from t1; select * from t2;"
- ]
- },
- "instance_name": {
- "type": "string",
- "example": "instance1"
- },
- "instance_type": {
- "type": "string",
- "example": "MySQL"
- },
- "project_name": {
- "type": "string",
- "example": "project1"
- },
- "schema_name": {
- "type": "string",
- "example": "schema1"
- },
- "sql_type": {
- "type": "string",
- "enum": [
- "sql",
- "mybatis",
- ""
- ],
- "example": "sql"
- }
- }
- },
- "v1.DirectAuditReqV1": {
- "type": "object",
- "properties": {
- "instance_name": {
- "type": "string",
- "example": "instance1"
- },
- "instance_type": {
- "type": "string",
- "example": "MySQL"
- },
- "project_name": {
- "type": "string",
- "example": "project1"
- },
- "schema_name": {
- "type": "string",
- "example": "schema1"
- },
- "sql_content": {
- "description": "调用方不应该关心SQL是否被完美的拆分成独立的条目, 拆分SQL由SQLE实现",
- "type": "string",
- "example": "select * from t1; select * from t2;"
- },
- "sql_type": {
- "type": "string",
- "enum": [
- "sql",
- "mybatis",
- ""
- ],
- "example": "sql"
- }
- }
- },
- "v1.DirectAuditResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditResDataV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.DirectGetSQLAnalysisResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.SqlAnalysisResDataV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.DriversResV1": {
- "type": "object",
- "properties": {
- "driver_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
- },
- "v1.ExplainClassicResult": {
- "type": "object",
- "properties": {
- "head": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.TableMetaItemHeadResV1"
- }
- },
- "rows": {
- "type": "array",
- "items": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- }
- }
- }
- },
- "v1.FeishuConfigurationV1": {
- "type": "object",
- "properties": {
- "app_id": {
- "type": "string"
- },
- "is_feishu_notification_enabled": {
- "type": "boolean"
- }
- }
- },
- "v1.FullSyncAuditPlanSQLsReqV1": {
- "type": "object",
- "properties": {
- "audit_plan_sql_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanSQLReqV1"
- }
- }
- }
- },
- "v1.GetAuditPlanAnalysisDataResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.GetSQLAnalysisDataResItemV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetAuditPlanMetasResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanMetaV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetAuditPlanNotifyConfigResDataV1": {
- "type": "object",
- "properties": {
- "enable_email_notify": {
- "type": "boolean"
- },
- "enable_web_hook_notify": {
- "type": "boolean"
- },
- "notify_interval": {
- "type": "integer"
- },
- "notify_level": {
- "type": "string"
- },
- "web_hook_template": {
- "type": "string"
- },
- "web_hook_url": {
- "type": "string"
- }
- }
- },
- "v1.GetAuditPlanNotifyConfigResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.GetAuditPlanNotifyConfigResDataV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetAuditPlanReportResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditPlanReportResV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetAuditPlanReportSQLsResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanReportSQLResV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
- }
- }
- },
- "v1.GetAuditPlanReportsResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanReportResV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
- }
- }
- },
- "v1.GetAuditPlanResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditPlanResV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetAuditPlanSQLsResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditPlanSQLResV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
- }
- }
- },
- "v1.GetAuditPlanTypesResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanTypesV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetAuditPlansResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanResV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
- }
- }
- },
- "v1.GetAuditTaskResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditTaskResV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetAuditTaskSQLContentResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditTaskSQLContentResV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetAuditTaskSQLsResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditTaskSQLResV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
- }
- }
- },
- "v1.GetAuditWhitelistResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditWhitelistResV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
- }
- }
- },
- "v1.GetCompanyNoticeResp": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.CompanyNotice"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetCustomRuleResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.CustomRuleResV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetCustomRulesResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.CustomRuleResV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetDashboardProjectTipsResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.DashboardProjectTipV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetDashboardResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.DashboardResV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetDingTalkConfigurationResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.DingTalkConfigurationV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetDriversResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.DriversResV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetFeishuAuditConfigurationResV1": {
+ }
+ }
+ },
+ "definitions": {
+ "controller.BaseRes": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"example": 0
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.FeishuConfigurationV1"
- },
"message": {
"type": "string",
"example": "ok"
}
}
},
- "v1.GetFeishuConfigurationResV1": {
+ "v1.AffectRows": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.FeishuConfigurationV1"
+ "count": {
+ "type": "integer"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "err_message": {
+ "type": "string"
}
}
},
- "v1.GetInstanceAdditionalMetasResV1": {
+ "v1.AuditPlanCount": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "audit_plan_count": {
+ "type": "integer"
},
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.InstanceAdditionalMetaV1"
- }
+ "audit_plan_desc": {
+ "type": "string"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "audit_plan_type": {
+ "type": "string"
}
}
},
- "v1.GetInstanceConnectableReqV1": {
+ "v1.AuditPlanMetaV1": {
"type": "object",
"properties": {
- "additional_params": {
+ "audit_plan_params": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.InstanceAdditionalParamReqV1"
+ "$ref": "#/definitions/v1.AuditPlanParamResV1"
}
},
- "db_type": {
- "type": "string",
- "example": "mysql"
- },
- "host": {
- "type": "string",
- "example": "10.10.10.10"
- },
- "password": {
- "type": "string",
- "example": "123456"
+ "audit_plan_type": {
+ "type": "string"
},
- "port": {
- "type": "string",
- "example": "3306"
+ "audit_plan_type_desc": {
+ "type": "string"
},
- "user": {
- "type": "string",
- "example": "root"
+ "instance_type": {
+ "type": "string"
}
}
},
- "v1.GetInstanceConnectableResV1": {
+ "v1.AuditPlanParamReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.InstanceConnectableResV1"
+ "key": {
+ "type": "string"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "value": {
+ "type": "string"
}
}
},
- "v1.GetInstanceHealthResV1": {
+ "v1.AuditPlanParamResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "desc": {
+ "type": "string"
},
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.DBTypeHealth"
- }
+ "key": {
+ "type": "string"
},
- "message": {
+ "type": {
"type": "string",
- "example": "ok"
+ "enum": [
+ "string",
+ "int",
+ "bool"
+ ]
+ },
+ "value": {
+ "type": "string"
}
}
},
- "v1.GetInstanceResV1": {
+ "v1.AuditPlanReportResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "audit_level": {
+ "type": "string",
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error",
+ ""
+ ]
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.InstanceResV1"
+ "audit_plan_report_id": {
+ "type": "string",
+ "example": "1"
},
- "message": {
+ "audit_plan_report_timestamp": {
"type": "string",
- "example": "ok"
+ "example": "RFC3339"
+ },
+ "pass_rate": {
+ "type": "number"
+ },
+ "score": {
+ "type": "integer"
}
}
},
- "v1.GetInstanceSchemaResV1": {
+ "v1.AuditPlanReportSQLResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.InstanceSchemaResV1"
+ "audit_plan_report_sql": {
+ "type": "string",
+ "example": "select * from t1 where id = 1"
},
- "message": {
+ "audit_plan_report_sql_audit_result": {
"type": "string",
- "example": "ok"
+ "example": "same format as task audit result"
+ },
+ "number": {
+ "type": "integer",
+ "example": 1
}
}
},
- "v1.GetInstanceTipsResV1": {
+ "v1.AuditPlanResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "audit_plan_cron": {
+ "type": "string",
+ "example": "0 */2 * * *"
},
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.InstanceTipResV1"
- }
+ "audit_plan_db_type": {
+ "type": "string",
+ "example": "mysql"
},
- "message": {
+ "audit_plan_instance_database": {
"type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetInstancesResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "example": "app1"
},
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.InstanceResV1"
- }
+ "audit_plan_instance_name": {
+ "type": "string",
+ "example": "test_mysql"
},
- "message": {
+ "audit_plan_meta": {
+ "type": "object",
+ "$ref": "#/definitions/v1.AuditPlanMetaV1"
+ },
+ "audit_plan_name": {
"type": "string",
- "example": "ok"
+ "example": "audit_for_java_app1"
},
- "total_nums": {
- "type": "integer"
+ "audit_plan_token": {
+ "type": "string",
+ "example": "it's a JWT Token for scanner"
+ },
+ "rule_template_name": {
+ "type": "string",
+ "example": "default_MySQL"
}
}
},
- "v1.GetInstancesTypePercentResV1": {
+ "v1.AuditPlanSQLHeadV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "desc": {
+ "type": "string"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.InstancesTypePercentV1"
+ "name": {
+ "type": "string"
},
- "message": {
+ "type": {
"type": "string",
- "example": "ok"
+ "enum": [
+ "sql"
+ ]
}
}
},
- "v1.GetLDAPConfigurationResV1": {
+ "v1.AuditPlanSQLReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "audit_plan_sql_counter": {
+ "type": "string",
+ "example": "6"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.LDAPConfigurationResV1"
+ "audit_plan_sql_fingerprint": {
+ "type": "string",
+ "example": "select * from t1 where id = ?"
+ },
+ "audit_plan_sql_last_receive_text": {
+ "type": "string",
+ "example": "select * from t1 where id = 1"
+ },
+ "audit_plan_sql_last_receive_timestamp": {
+ "type": "string",
+ "example": "RFC3339"
+ },
+ "audit_plan_sql_schema": {
+ "type": "string",
+ "example": "db1"
+ },
+ "db_user": {
+ "type": "string",
+ "example": "database_user001"
+ },
+ "endpoint": {
+ "type": "string",
+ "example": "10.186.1.2"
},
- "message": {
+ "first_query_at": {
"type": "string",
- "example": "ok"
+ "example": "2023-09-12T02:48:01.317880Z"
+ },
+ "query_time_avg": {
+ "type": "number",
+ "example": 3.22
+ },
+ "query_time_max": {
+ "type": "number",
+ "example": 5.22
}
}
},
- "v1.GetLicenseResV1": {
+ "v1.AuditPlanSQLResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "content": {
- "type": "string"
- },
- "license": {
+ "head": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.LicenseItem"
+ "$ref": "#/definitions/v1.AuditPlanSQLHeadV1"
}
},
- "message": {
- "type": "string",
- "example": "ok"
+ "rows": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
}
}
},
- "v1.GetLicenseUsageResV1": {
+ "v1.AuditPlanTypesV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.LicenseUsageV1"
+ "desc": {
+ "type": "string"
},
- "message": {
+ "instance_type": {
"type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetManagementPermissionsResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.ManagementPermissionResV1"
- }
+ "enum": [
+ "MySQL",
+ "Oracle",
+ "TiDB",
+ "OceanBase For MySQL",
+ ""
+ ]
},
- "message": {
- "type": "string",
- "example": "ok"
+ "type": {
+ "type": "string"
}
}
},
- "v1.GetMemberGroupRespDataV1": {
+ "v1.AuditResDataV1": {
"type": "object",
"properties": {
- "roles": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.BindRoleReqV1"
- }
+ "audit_level": {
+ "type": "string",
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error",
+ ""
+ ]
},
- "user_group_name": {
- "type": "string"
+ "pass_rate": {
+ "type": "number"
+ },
+ "score": {
+ "type": "integer"
},
- "users": {
+ "sql_results": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.MemberGroupUserItem"
+ "$ref": "#/definitions/v1.AuditSQLResV1"
}
}
}
},
- "v1.GetMemberGroupRespV1": {
+ "v1.AuditResult": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.GetMemberGroupRespDataV1"
+ "level": {
+ "type": "string",
+ "example": "warn"
},
"message": {
"type": "string",
- "example": "ok"
+ "example": "避免使用不必要的内置函数md5()"
+ },
+ "rule_name": {
+ "type": "string"
}
}
},
- "v1.GetMemberGroupsRespV1": {
+ "v1.AuditSQLResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "audit_level": {
+ "type": "string"
},
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.GetMemberGroupRespDataV1"
- }
+ "audit_result": {
+ "type": "string"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "exec_sql": {
+ "type": "string"
},
- "total_nums": {
+ "number": {
"type": "integer"
}
}
},
- "v1.GetMemberRespDataV1": {
+ "v1.AuditTaskGroupRes": {
"type": "object",
"properties": {
- "is_manager": {
- "type": "boolean"
+ "task_group_id": {
+ "type": "integer"
},
- "roles": {
+ "tasks": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.BindRoleReqV1"
+ "$ref": "#/definitions/v1.AuditTaskResV1"
}
- },
- "user_name": {
- "type": "string"
}
}
},
- "v1.GetMemberRespV1": {
+ "v1.AuditTaskGroupResV1": {
"type": "object",
"properties": {
"code": {
@@ -12564,7 +7814,7 @@ var doc = `{
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.GetMemberRespDataV1"
+ "$ref": "#/definitions/v1.AuditTaskGroupRes"
},
"message": {
"type": "string",
@@ -12572,191 +7822,177 @@ var doc = `{
}
}
},
- "v1.GetMemberTipsResV1": {
+ "v1.AuditTaskResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "audit_level": {
+ "type": "string",
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error",
+ ""
+ ]
},
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.MemberTipResV1"
- }
+ "exec_end_time": {
+ "type": "string"
},
- "message": {
+ "exec_start_time": {
+ "type": "string"
+ },
+ "instance_db_type": {
+ "type": "string"
+ },
+ "instance_name": {
+ "type": "string"
+ },
+ "instance_schema": {
"type": "string",
- "example": "ok"
+ "example": "db1"
+ },
+ "pass_rate": {
+ "type": "number"
+ },
+ "score": {
+ "type": "integer"
+ },
+ "sql_source": {
+ "type": "string",
+ "enum": [
+ "form_data",
+ "sql_file",
+ "mybatis_xml_file",
+ "audit_plan"
+ ]
+ },
+ "status": {
+ "type": "string",
+ "enum": [
+ "initialized",
+ "audited",
+ "executing",
+ "exec_success",
+ "exec_failed",
+ "manually_executed"
+ ]
+ },
+ "task_id": {
+ "type": "integer"
}
}
},
- "v1.GetMembersRespV1": {
+ "v1.AuditTaskSQLContentResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.GetMemberRespDataV1"
- }
- },
- "message": {
+ "sql": {
"type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
+ "example": "alter table tb1 drop columns c1"
}
}
},
- "v1.GetOauth2ConfigurationResDataV1": {
+ "v1.AuditTaskSQLResV1": {
"type": "object",
"properties": {
- "access_token_tag": {
+ "audit_level": {
"type": "string"
},
- "client_host": {
+ "audit_result": {
"type": "string"
},
- "client_id": {
+ "audit_status": {
"type": "string"
},
- "enable_oauth2": {
- "type": "boolean"
- },
- "login_tip": {
+ "description": {
"type": "string"
},
- "scopes": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "server_auth_url": {
+ "exec_result": {
"type": "string"
},
- "server_token_url": {
+ "exec_sql": {
"type": "string"
},
- "server_user_id_url": {
+ "exec_status": {
"type": "string"
},
- "user_id_tag": {
+ "number": {
+ "type": "integer"
+ },
+ "rollback_sql": {
"type": "string"
}
}
},
- "v1.GetOauth2ConfigurationResV1": {
+ "v1.AuditTasksGroupResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.GetOauth2ConfigurationResDataV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
+ "task_group_id": {
+ "type": "integer"
}
}
},
- "v1.GetOauth2TipsResDataV1": {
+ "v1.AuditWhitelistResV1": {
"type": "object",
"properties": {
- "enable_oauth2": {
- "type": "boolean"
+ "audit_whitelist_id": {
+ "type": "integer"
+ },
+ "desc": {
+ "type": "string"
+ },
+ "match_type": {
+ "type": "string"
},
- "login_tip": {
+ "value": {
"type": "string"
}
}
},
- "v1.GetOauth2TipsResV1": {
+ "v1.AuditedSQLCount": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.GetOauth2TipsResDataV1"
+ "risk_sql_count": {
+ "type": "integer"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "total_sql_count": {
+ "type": "integer"
}
}
},
- "v1.GetOperationActionListResV1": {
+ "v1.BatchCancelWorkflowsReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
+ "workflow_names": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.OperationActionList"
+ "type": "string"
}
- },
- "message": {
- "type": "string",
- "example": "ok"
}
}
},
- "v1.GetOperationRecordListResV1": {
+ "v1.BatchCheckInstanceConnectionsReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
+ "instances": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.OperationRecordList"
+ "$ref": "#/definitions/v1.InstanceForCheckConnection"
}
- },
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
}
}
},
- "v1.GetOperationTypeNamesListResV1": {
+ "v1.BatchCompleteWorkflowsReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
+ "workflow_names": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.OperationTypeNameList"
+ "type": "string"
}
- },
- "message": {
- "type": "string",
- "example": "ok"
}
}
},
- "v1.GetOperationsResV1": {
+ "v1.BatchGetInstanceConnectionsResV1": {
"type": "object",
"properties": {
"code": {
@@ -12766,7 +8002,7 @@ var doc = `{
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.OperationResV1"
+ "$ref": "#/definitions/v1.InstanceConnectionResV1"
}
},
"message": {
@@ -12775,85 +8011,137 @@ var doc = `{
}
}
},
- "v1.GetProjectDetailResV1": {
+ "v1.BatchUpdateSqlManageReq": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "assignees": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.ProjectDetailItem"
+ "remark": {
+ "type": "string"
},
- "message": {
+ "sql_manage_id_list": {
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ },
+ "status": {
"type": "string",
- "example": "ok"
+ "enum": [
+ "solved",
+ "ignored",
+ "manual_audited"
+ ]
}
}
},
- "v1.GetProjectResV1": {
+ "v1.CheckLicenseResV1": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"example": 0
},
- "data": {
+ "content": {
+ "type": "string"
+ },
+ "license": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.ProjectListItem"
+ "$ref": "#/definitions/v1.LicenseItem"
}
},
"message": {
"type": "string",
"example": "ok"
- },
- "total_nums": {
- "type": "integer"
}
}
},
- "v1.GetProjectRuleTemplateResV1": {
+ "v1.CloneProjectRuleTemplateReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "desc": {
+ "type": "string"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.RuleProjectTemplateDetailResV1"
+ "new_rule_template_name": {
+ "type": "string"
+ }
+ }
+ },
+ "v1.CloneRuleTemplateReqV1": {
+ "type": "object",
+ "properties": {
+ "desc": {
+ "type": "string"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "new_rule_template_name": {
+ "type": "string"
}
}
},
- "v1.GetProjectRuleTemplatesResV1": {
+ "v1.CompanyNotice": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "notice_str": {
+ "type": "string"
+ }
+ }
+ },
+ "v1.CreateAuditPlanReqV1": {
+ "type": "object",
+ "properties": {
+ "audit_plan_cron": {
+ "type": "string",
+ "example": "0 */2 * * *"
},
- "data": {
+ "audit_plan_instance_database": {
+ "type": "string",
+ "example": "app1"
+ },
+ "audit_plan_instance_name": {
+ "type": "string",
+ "example": "test_mysql"
+ },
+ "audit_plan_instance_type": {
+ "type": "string",
+ "example": "mysql"
+ },
+ "audit_plan_name": {
+ "type": "string",
+ "example": "audit_plan_for_java_repo_1"
+ },
+ "audit_plan_params": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.ProjectRuleTemplateResV1"
+ "$ref": "#/definitions/v1.AuditPlanParamReqV1"
}
},
- "message": {
+ "audit_plan_type": {
"type": "string",
- "example": "ok"
+ "example": "slow log"
},
- "total_nums": {
- "type": "integer"
+ "rule_template_name": {
+ "type": "string",
+ "example": "default_MySQL"
}
}
},
- "v1.GetProjectScoreResV1": {
+ "v1.CreateAuditTasksGroupReqV1": {
+ "type": "object",
+ "properties": {
+ "instances": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.InstanceForCreatingTask"
+ }
+ }
+ }
+ },
+ "v1.CreateAuditTasksGroupResV1": {
"type": "object",
"properties": {
"code": {
@@ -12862,7 +8150,7 @@ var doc = `{
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.ProjectScore"
+ "$ref": "#/definitions/v1.AuditTasksGroupResV1"
},
"message": {
"type": "string",
@@ -12870,104 +8158,102 @@ var doc = `{
}
}
},
- "v1.GetProjectStatisticsResDataV1": {
+ "v1.CreateAuditWhitelistReqV1": {
"type": "object",
"properties": {
- "audit_plan_total": {
- "type": "integer"
- },
- "instance_total": {
- "type": "integer"
- },
- "member_total": {
- "type": "integer"
- },
- "rule_template_total": {
- "type": "integer"
+ "desc": {
+ "type": "string",
+ "example": "used for rapid release"
},
- "whitelist_total": {
- "type": "integer"
+ "match_type": {
+ "type": "string",
+ "enum": [
+ "exact_match",
+ "fp_match"
+ ],
+ "example": "exact_match"
},
- "workflow_total": {
- "type": "integer"
+ "value": {
+ "type": "string",
+ "example": "create table"
}
}
},
- "v1.GetProjectStatisticsResV1": {
+ "v1.CreateCustomRuleReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "annotation": {
+ "type": "string",
+ "example": "this is test rule"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.GetProjectStatisticsResDataV1"
+ "db_type": {
+ "type": "string",
+ "example": "MySQL"
},
- "message": {
+ "desc": {
"type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetProjectTipsResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "example": "this is test rule"
+ },
+ "level": {
+ "type": "string",
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ],
+ "example": "notice"
},
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.ProjectTipResV1"
- }
+ "rule_script": {
+ "type": "string"
},
- "message": {
+ "type": {
"type": "string",
- "example": "ok"
+ "example": "DDL规则"
}
}
},
- "v1.GetRiskAuditPlanResV1": {
+ "v1.CreateProjectRuleTemplateReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "db_type": {
+ "type": "string"
},
- "data": {
+ "desc": {
+ "type": "string"
+ },
+ "rule_list": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.RiskAuditPlan"
+ "$ref": "#/definitions/v1.RuleReqV1"
}
},
- "message": {
- "type": "string",
- "example": "ok"
+ "rule_template_name": {
+ "type": "string"
}
}
},
- "v1.GetRoleTipsResV1": {
+ "v1.CreateRuleTemplateReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "db_type": {
+ "type": "string"
},
- "data": {
+ "desc": {
+ "type": "string"
+ },
+ "rule_list": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.RoleTipResV1"
+ "$ref": "#/definitions/v1.RuleReqV1"
}
},
- "message": {
- "type": "string",
- "example": "ok"
+ "rule_template_name": {
+ "type": "string"
}
}
},
- "v1.GetRoleUserCountResV1": {
+ "v1.CreateSQLAuditRecordResV1": {
"type": "object",
"properties": {
"code": {
@@ -12975,10 +8261,8 @@ var doc = `{
"example": 0
},
"data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.RoleUserCount"
- }
+ "type": "object",
+ "$ref": "#/definitions/v1.SQLAuditRecordResData"
},
"message": {
"type": "string",
@@ -12986,174 +8270,190 @@ var doc = `{
}
}
},
- "v1.GetRolesResV1": {
+ "v1.CreateWorkflowReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "desc": {
+ "type": "string"
},
- "data": {
+ "task_ids": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.RoleResV1"
+ "type": "integer"
}
},
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
+ "workflow_subject": {
+ "type": "string"
}
}
},
- "v1.GetRuleKnowledgeResV1": {
+ "v1.CustomRuleResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "annotation": {
+ "type": "string",
+ "example": "this is test rule"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.RuleKnowledgeResV1"
+ "db_type": {
+ "type": "string",
+ "example": "MySQL"
},
- "message": {
+ "desc": {
"type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetRuleTemplateResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "example": "this is test rule"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.RuleTemplateDetailResV1"
+ "level": {
+ "type": "string",
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ],
+ "example": "notice"
},
- "message": {
+ "rule_id": {
+ "type": "string"
+ },
+ "rule_script": {
+ "type": "string"
+ },
+ "type": {
"type": "string",
- "example": "ok"
+ "example": "DDL规则"
}
}
},
- "v1.GetRuleTemplateTipsResV1": {
+ "v1.DBTypeAuditPlan": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.RuleTemplateTipResV1"
+ "$ref": "#/definitions/v1.AuditPlanCount"
}
},
- "message": {
- "type": "string",
- "example": "ok"
+ "db_type": {
+ "type": "string"
}
}
},
- "v1.GetRuleTemplatesResV1": {
+ "v1.DBTypeHealth": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "db_type": {
+ "type": "string"
},
- "data": {
+ "health_instance_names": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.RuleTemplateResV1"
+ "type": "string"
}
},
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
+ "unhealth_instance_names": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
}
}
},
- "v1.GetRuleTypeByDBTypeResV1": {
+ "v1.DashboardResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.RuleTypeV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
+ "workflow_statistics": {
+ "type": "object",
+ "$ref": "#/definitions/v1.WorkflowStatisticsResV1"
}
}
},
- "v1.GetRulesResV1": {
+ "v1.DingTalkConfigurationV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.RuleResV1"
- }
+ "app_key": {
+ "type": "string"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "is_enable_ding_talk_notify": {
+ "type": "boolean"
}
}
},
- "v1.GetSMTPConfigurationResV1": {
+ "v1.DirectAuditFileReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "file_contents": {
+ "description": "调用方不应该关心SQL是否被完美的拆分成独立的条目, 拆分SQL由SQLE实现\n每个数组元素是一个文件内容",
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "example": [
+ "select * from t1; select * from t2;"
+ ]
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.SMTPConfigurationResV1"
+ "instance_name": {
+ "type": "string",
+ "example": "instance1"
},
- "message": {
+ "instance_type": {
"type": "string",
- "example": "ok"
+ "example": "MySQL"
+ },
+ "project_name": {
+ "type": "string",
+ "example": "project1"
+ },
+ "schema_name": {
+ "type": "string",
+ "example": "schema1"
+ },
+ "sql_type": {
+ "type": "string",
+ "enum": [
+ "sql",
+ "mybatis",
+ ""
+ ],
+ "example": "sql"
}
}
},
- "v1.GetSQLAnalysisDataResItemV1": {
+ "v1.DirectAuditReqV1": {
"type": "object",
"properties": {
- "sql_explain": {
- "type": "object",
- "$ref": "#/definitions/v1.SQLExplain"
+ "instance_name": {
+ "type": "string",
+ "example": "instance1"
+ },
+ "instance_type": {
+ "type": "string",
+ "example": "MySQL"
+ },
+ "project_name": {
+ "type": "string",
+ "example": "project1"
+ },
+ "schema_name": {
+ "type": "string",
+ "example": "schema1"
+ },
+ "sql_content": {
+ "description": "调用方不应该关心SQL是否被完美的拆分成独立的条目, 拆分SQL由SQLE实现",
+ "type": "string",
+ "example": "select * from t1; select * from t2;"
},
- "table_metas": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.TableMeta"
- }
+ "sql_type": {
+ "type": "string",
+ "enum": [
+ "sql",
+ "mybatis",
+ ""
+ ],
+ "example": "sql"
}
}
},
- "v1.GetSQLAuditRecordResV1": {
+ "v1.DirectAuditResV1": {
"type": "object",
"properties": {
"code": {
@@ -13162,7 +8462,7 @@ var doc = `{
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.SQLAuditRecord"
+ "$ref": "#/definitions/v1.AuditResDataV1"
},
"message": {
"type": "string",
@@ -13170,7 +8470,7 @@ var doc = `{
}
}
},
- "v1.GetSQLAuditRecordTagTipsResV1": {
+ "v1.DirectGetSQLAnalysisResV1": {
"type": "object",
"properties": {
"code": {
@@ -13180,7 +8480,7 @@ var doc = `{
"data": {
"type": "array",
"items": {
- "type": "string"
+ "$ref": "#/definitions/v1.SqlAnalysisResDataV1"
}
},
"message": {
@@ -13189,88 +8489,60 @@ var doc = `{
}
}
},
- "v1.GetSQLAuditRecordsResV1": {
+ "v1.DriversResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
+ "driver_name_list": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.SQLAuditRecord"
+ "type": "string"
}
- },
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
}
}
},
- "v1.GetSQLEInfoResDataV1": {
+ "v1.ExplainClassicResult": {
"type": "object",
"properties": {
- "logo_url": {
- "type": "string"
- },
- "title": {
- "type": "string"
+ "head": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.TableMetaItemHeadResV1"
+ }
},
- "version": {
- "type": "string"
+ "rows": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
}
}
},
- "v1.GetSQLEInfoResV1": {
+ "v1.FeishuConfigurationV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.GetSQLEInfoResDataV1"
+ "app_id": {
+ "type": "string"
},
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetSQLQueryConfigurationResDataV1": {
- "type": "object",
- "properties": {
- "enable_sql_query": {
+ "is_feishu_notification_enabled": {
"type": "boolean"
- },
- "sql_query_root_uri": {
- "type": "string"
}
}
},
- "v1.GetSQLQueryConfigurationResV1": {
+ "v1.FullSyncAuditPlanSQLsReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.GetSQLQueryConfigurationResDataV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
+ "audit_plan_sql_list": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.AuditPlanSQLReqV1"
+ }
}
}
},
- "v1.GetSqlAverageExecutionTimeResV1": {
+ "v1.GetAuditPlanAnalysisDataResV1": {
"type": "object",
"properties": {
"code": {
@@ -13278,10 +8550,8 @@ var doc = `{
"example": 0
},
"data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.SqlAverageExecutionTime"
- }
+ "type": "object",
+ "$ref": "#/definitions/v1.GetSQLAnalysisDataResItemV1"
},
"message": {
"type": "string",
@@ -13289,7 +8559,7 @@ var doc = `{
}
}
},
- "v1.GetSqlExecutionFailPercentResV1": {
+ "v1.GetAuditPlanMetasResV1": {
"type": "object",
"properties": {
"code": {
@@ -13299,7 +8569,7 @@ var doc = `{
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.SqlExecutionFailPercent"
+ "$ref": "#/definitions/v1.AuditPlanMetaV1"
}
},
"message": {
@@ -13308,35 +8578,30 @@ var doc = `{
}
}
},
- "v1.GetSqlManageListResp": {
+ "v1.GetAuditPlanNotifyConfigResDataV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.SqlManage"
- }
+ "enable_email_notify": {
+ "type": "boolean"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "enable_web_hook_notify": {
+ "type": "boolean"
},
- "sql_manage_bad_num": {
+ "notify_interval": {
"type": "integer"
},
- "sql_manage_optimized_num": {
- "type": "integer"
+ "notify_level": {
+ "type": "string"
},
- "sql_manage_total_num": {
- "type": "integer"
+ "web_hook_template": {
+ "type": "string"
+ },
+ "web_hook_url": {
+ "type": "string"
}
}
},
- "v1.GetSqlManageRuleTipsResp": {
+ "v1.GetAuditPlanNotifyConfigResV1": {
"type": "object",
"properties": {
"code": {
@@ -13344,10 +8609,8 @@ var doc = `{
"example": 0
},
"data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.RuleTips"
- }
+ "type": "object",
+ "$ref": "#/definitions/v1.GetAuditPlanNotifyConfigResDataV1"
},
"message": {
"type": "string",
@@ -13355,7 +8618,7 @@ var doc = `{
}
}
},
- "v1.GetSqlManageSqlAnalysisResp": {
+ "v1.GetAuditPlanReportResV1": {
"type": "object",
"properties": {
"code": {
@@ -13364,7 +8627,7 @@ var doc = `{
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.SqlAnalysis"
+ "$ref": "#/definitions/v1.AuditPlanReportResV1"
},
"message": {
"type": "string",
@@ -13372,7 +8635,7 @@ var doc = `{
}
}
},
- "v1.GetSyncInstanceTaskListResV1": {
+ "v1.GetAuditPlanReportSQLsResV1": {
"type": "object",
"properties": {
"code": {
@@ -13382,33 +8645,19 @@ var doc = `{
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.InstanceTaskResV1"
+ "$ref": "#/definitions/v1.AuditPlanReportSQLResV1"
}
},
"message": {
"type": "string",
"example": "ok"
- }
- }
- },
- "v1.GetSyncInstanceTaskResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.InstanceTaskDetailResV1"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "total_nums": {
+ "type": "integer"
}
}
},
- "v1.GetSyncTaskSourceTipsResV1": {
+ "v1.GetAuditPlanReportsResV1": {
"type": "object",
"properties": {
"code": {
@@ -13418,33 +8667,19 @@ var doc = `{
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.SyncTaskTipsResV1"
+ "$ref": "#/definitions/v1.AuditPlanReportResV1"
}
},
"message": {
"type": "string",
"example": "ok"
- }
- }
- },
- "v1.GetSystemVariablesResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.SystemVariablesResV1"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "total_nums": {
+ "type": "integer"
}
}
},
- "v1.GetTableMetadataResV1": {
+ "v1.GetAuditPlanResV1": {
"type": "object",
"properties": {
"code": {
@@ -13453,7 +8688,7 @@ var doc = `{
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.InstanceTableMeta"
+ "$ref": "#/definitions/v1.AuditPlanResV1"
},
"message": {
"type": "string",
@@ -13461,22 +8696,7 @@ var doc = `{
}
}
},
- "v1.GetTaskAnalysisDataResItemV1": {
- "type": "object",
- "properties": {
- "sql_explain": {
- "type": "object",
- "$ref": "#/definitions/v1.SQLExplain"
- },
- "table_metas": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.TableMeta"
- }
- }
- }
- },
- "v1.GetTaskAnalysisDataResV1": {
+ "v1.GetAuditPlanSQLsResV1": {
"type": "object",
"properties": {
"code": {
@@ -13485,32 +8705,18 @@ var doc = `{
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.GetTaskAnalysisDataResItemV1"
+ "$ref": "#/definitions/v1.AuditPlanSQLResV1"
},
"message": {
"type": "string",
"example": "ok"
- }
- }
- },
- "v1.GetUserDetailResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.UserDetailResV1"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "total_nums": {
+ "type": "integer"
}
}
},
- "v1.GetUserGroupTipsResV1": {
+ "v1.GetAuditPlanTypesResV1": {
"type": "object",
"properties": {
"code": {
@@ -13520,7 +8726,7 @@ var doc = `{
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.UserGroupTipListItem"
+ "$ref": "#/definitions/v1.AuditPlanTypesV1"
}
},
"message": {
@@ -13529,7 +8735,7 @@ var doc = `{
}
}
},
- "v1.GetUserGroupsResV1": {
+ "v1.GetAuditPlansResV1": {
"type": "object",
"properties": {
"code": {
@@ -13539,7 +8745,7 @@ var doc = `{
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.UserGroupListItemResV1"
+ "$ref": "#/definitions/v1.AuditPlanResV1"
}
},
"message": {
@@ -13551,7 +8757,7 @@ var doc = `{
}
}
},
- "v1.GetUserLoginResV1": {
+ "v1.GetAuditTaskResV1": {
"type": "object",
"properties": {
"code": {
@@ -13560,7 +8766,7 @@ var doc = `{
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.UserLoginResV1"
+ "$ref": "#/definitions/v1.AuditTaskResV1"
},
"message": {
"type": "string",
@@ -13568,7 +8774,7 @@ var doc = `{
}
}
},
- "v1.GetUserTipsResV1": {
+ "v1.GetAuditTaskSQLContentResV1": {
"type": "object",
"properties": {
"code": {
@@ -13576,10 +8782,8 @@ var doc = `{
"example": 0
},
"data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.UserTipResV1"
- }
+ "type": "object",
+ "$ref": "#/definitions/v1.AuditTaskSQLContentResV1"
},
"message": {
"type": "string",
@@ -13587,7 +8791,7 @@ var doc = `{
}
}
},
- "v1.GetUsersResV1": {
+ "v1.GetAuditTaskSQLsResV1": {
"type": "object",
"properties": {
"code": {
@@ -13597,7 +8801,7 @@ var doc = `{
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.UserResV1"
+ "$ref": "#/definitions/v1.AuditTaskSQLResV1"
}
},
"message": {
@@ -13609,7 +8813,7 @@ var doc = `{
}
}
},
- "v1.GetWeChatConfigurationResV1": {
+ "v1.GetAuditWhitelistResV1": {
"type": "object",
"properties": {
"code": {
@@ -13617,16 +8821,21 @@ var doc = `{
"example": 0
},
"data": {
- "type": "object",
- "$ref": "#/definitions/v1.WeChatConfigurationResV1"
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.AuditWhitelistResV1"
+ }
},
"message": {
"type": "string",
"example": "ok"
+ },
+ "total_nums": {
+ "type": "integer"
}
}
},
- "v1.GetWorkflowAuditPassPercentResV1": {
+ "v1.GetCompanyNoticeResp": {
"type": "object",
"properties": {
"code": {
@@ -13635,7 +8844,7 @@ var doc = `{
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.WorkflowAuditPassPercentV1"
+ "$ref": "#/definitions/v1.CompanyNotice"
},
"message": {
"type": "string",
@@ -13643,7 +8852,7 @@ var doc = `{
}
}
},
- "v1.GetWorkflowCountsResV1": {
+ "v1.GetCustomRuleResV1": {
"type": "object",
"properties": {
"code": {
@@ -13652,7 +8861,7 @@ var doc = `{
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.WorkflowCountsV1"
+ "$ref": "#/definitions/v1.CustomRuleResV1"
},
"message": {
"type": "string",
@@ -13660,7 +8869,7 @@ var doc = `{
}
}
},
- "v1.GetWorkflowCreatedCountsEachDayResV1": {
+ "v1.GetCustomRulesResV1": {
"type": "object",
"properties": {
"code": {
@@ -13668,8 +8877,10 @@ var doc = `{
"example": 0
},
"data": {
- "type": "object",
- "$ref": "#/definitions/v1.WorkflowCreatedCountsEachDayV1"
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.CustomRuleResV1"
+ }
},
"message": {
"type": "string",
@@ -13677,7 +8888,7 @@ var doc = `{
}
}
},
- "v1.GetWorkflowDurationOfWaitingForAuditResV1": {
+ "v1.GetDashboardResV1": {
"type": "object",
"properties": {
"code": {
@@ -13686,7 +8897,7 @@ var doc = `{
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.WorkflowStageDuration"
+ "$ref": "#/definitions/v1.DashboardResV1"
},
"message": {
"type": "string",
@@ -13694,7 +8905,7 @@ var doc = `{
}
}
},
- "v1.GetWorkflowDurationOfWaitingForExecutionResV1": {
+ "v1.GetDingTalkConfigurationResV1": {
"type": "object",
"properties": {
"code": {
@@ -13703,7 +8914,7 @@ var doc = `{
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.WorkflowStageDuration"
+ "$ref": "#/definitions/v1.DingTalkConfigurationV1"
},
"message": {
"type": "string",
@@ -13711,7 +8922,7 @@ var doc = `{
}
}
},
- "v1.GetWorkflowPassPercentResV1": {
+ "v1.GetDriversResV1": {
"type": "object",
"properties": {
"code": {
@@ -13720,7 +8931,7 @@ var doc = `{
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.WorkflowPassPercentV1"
+ "$ref": "#/definitions/v1.DriversResV1"
},
"message": {
"type": "string",
@@ -13728,7 +8939,7 @@ var doc = `{
}
}
},
- "v1.GetWorkflowPercentCountedByInstanceTypeResV1": {
+ "v1.GetFeishuAuditConfigurationResV1": {
"type": "object",
"properties": {
"code": {
@@ -13737,7 +8948,7 @@ var doc = `{
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.WorkflowPercentCountedByInstanceTypeV1"
+ "$ref": "#/definitions/v1.FeishuConfigurationV1"
},
"message": {
"type": "string",
@@ -13745,7 +8956,7 @@ var doc = `{
}
}
},
- "v1.GetWorkflowRejectedPercentGroupByCreatorResV1": {
+ "v1.GetInstanceConnectableResV1": {
"type": "object",
"properties": {
"code": {
@@ -13753,10 +8964,8 @@ var doc = `{
"example": 0
},
"data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.WorkflowRejectedPercentGroupByCreator"
- }
+ "type": "object",
+ "$ref": "#/definitions/v1.InstanceConnectableResV1"
},
"message": {
"type": "string",
@@ -13764,7 +8973,7 @@ var doc = `{
}
}
},
- "v1.GetWorkflowRejectedPercentGroupByInstanceResV1": {
+ "v1.GetInstanceHealthResV1": {
"type": "object",
"properties": {
"code": {
@@ -13774,7 +8983,7 @@ var doc = `{
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.WorkflowRejectedPercentGroupByInstance"
+ "$ref": "#/definitions/v1.DBTypeHealth"
}
},
"message": {
@@ -13783,7 +8992,7 @@ var doc = `{
}
}
},
- "v1.GetWorkflowResV1": {
+ "v1.GetInstanceSchemaResV1": {
"type": "object",
"properties": {
"code": {
@@ -13792,7 +9001,7 @@ var doc = `{
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.WorkflowResV1"
+ "$ref": "#/definitions/v1.InstanceSchemaResV1"
},
"message": {
"type": "string",
@@ -13800,7 +9009,7 @@ var doc = `{
}
}
},
- "v1.GetWorkflowStatusCountResV1": {
+ "v1.GetInstanceTipsResV1": {
"type": "object",
"properties": {
"code": {
@@ -13808,8 +9017,10 @@ var doc = `{
"example": 0
},
"data": {
- "type": "object",
- "$ref": "#/definitions/v1.WorkflowStatusCountV1"
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.InstanceTipResV1"
+ }
},
"message": {
"type": "string",
@@ -13817,70 +9028,37 @@ var doc = `{
}
}
},
- "v1.GetWorkflowTasksItemV1": {
+ "v1.GetInstancesTypePercentResV1": {
"type": "object",
"properties": {
- "current_step_assignee_user_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "exec_end_time": {
- "type": "string"
- },
- "exec_start_time": {
- "type": "string"
- },
- "execution_user_name": {
- "type": "string"
- },
- "instance_maintenance_times": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.MaintenanceTimeResV1"
- }
- },
- "instance_name": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "schedule_time": {
- "type": "string"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.InstancesTypePercentV1"
},
- "status": {
+ "message": {
"type": "string",
- "enum": [
- "wait_for_audit",
- "wait_for_execution",
- "exec_scheduled",
- "exec_failed",
- "exec_succeeded",
- "executing",
- "manually_executed"
- ]
- },
- "task_id": {
- "type": "integer"
- },
- "task_pass_rate": {
- "type": "number"
- },
- "task_score": {
- "type": "integer"
+ "example": "ok"
}
}
},
- "v1.GetWorkflowTasksResV1": {
+ "v1.GetLicenseResV1": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"example": 0
},
- "data": {
+ "content": {
+ "type": "string"
+ },
+ "license": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.GetWorkflowTasksItemV1"
+ "$ref": "#/definitions/v1.LicenseItem"
}
},
"message": {
@@ -13889,7 +9067,7 @@ var doc = `{
}
}
},
- "v1.GetWorkflowTemplateResV1": {
+ "v1.GetLicenseUsageResV1": {
"type": "object",
"properties": {
"code": {
@@ -13898,7 +9076,7 @@ var doc = `{
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.WorkflowTemplateDetailResV1"
+ "$ref": "#/definitions/v1.LicenseUsageV1"
},
"message": {
"type": "string",
@@ -13906,7 +9084,7 @@ var doc = `{
}
}
},
- "v1.GetWorkflowWebHookConfigResV1": {
+ "v1.GetOperationActionListResV1": {
"type": "object",
"properties": {
"code": {
@@ -13914,8 +9092,10 @@ var doc = `{
"example": 0
},
"data": {
- "type": "object",
- "$ref": "#/definitions/v1.WebHookConfigV1"
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.OperationActionList"
+ }
},
"message": {
"type": "string",
@@ -13923,7 +9103,7 @@ var doc = `{
}
}
},
- "v1.GetWorkflowsResV1": {
+ "v1.GetOperationRecordListResV1": {
"type": "object",
"properties": {
"code": {
@@ -13933,7 +9113,7 @@ var doc = `{
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.WorkflowDetailResV1"
+ "$ref": "#/definitions/v1.OperationRecordList"
}
},
"message": {
@@ -13945,420 +9125,273 @@ var doc = `{
}
}
},
- "v1.GlobalRuleTemplateInstance": {
- "type": "object",
- "properties": {
- "instance_name": {
- "type": "string"
- },
- "project_name": {
- "type": "string"
- }
- }
- },
- "v1.InstanceAdditionalMetaV1": {
- "type": "object",
- "properties": {
- "db_type": {
- "type": "string"
- },
- "params": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.InstanceAdditionalParamResV1"
- }
- }
- }
- },
- "v1.InstanceAdditionalParamReqV1": {
- "type": "object",
- "properties": {
- "name": {
- "type": "string"
- },
- "value": {
- "type": "string"
- }
- }
- },
- "v1.InstanceAdditionalParamResV1": {
- "type": "object",
- "properties": {
- "description": {
- "type": "string",
- "example": "参数项中文名"
- },
- "name": {
- "type": "string",
- "example": "param name"
- },
- "type": {
- "type": "string",
- "example": "int"
- },
- "value": {
- "type": "string",
- "example": "0"
- }
- }
- },
- "v1.InstanceConnectableResV1": {
- "type": "object",
- "properties": {
- "connect_error_message": {
- "type": "string"
- },
- "is_instance_connectable": {
- "type": "boolean"
- }
- }
- },
- "v1.InstanceConnectionResV1": {
- "type": "object",
- "properties": {
- "connect_error_message": {
- "type": "string"
- },
- "instance_name": {
- "type": "string"
- },
- "is_instance_connectable": {
- "type": "boolean"
- }
- }
- },
- "v1.InstanceForCheckConnection": {
- "type": "object",
- "properties": {
- "name": {
- "type": "string"
- }
- }
- },
- "v1.InstanceForCreatingTask": {
- "type": "object",
- "properties": {
- "instance_name": {
- "type": "string"
- },
- "instance_schema": {
- "type": "string"
- }
- }
- },
- "v1.InstanceResV1": {
+ "v1.GetOperationTypeNamesListResV1": {
"type": "object",
"properties": {
- "additional_params": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.InstanceAdditionalParamResV1"
- }
- },
- "db_host": {
- "type": "string",
- "example": "10.10.10.10"
- },
- "db_port": {
- "type": "string",
- "example": "3306"
- },
- "db_type": {
- "type": "string",
- "example": "mysql"
- },
- "db_user": {
- "type": "string",
- "example": "root"
- },
- "desc": {
- "type": "string",
- "example": "this is a instance"
- },
- "instance_name": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "maintenance_times": {
+ "data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.MaintenanceTimeResV1"
+ "$ref": "#/definitions/v1.OperationTypeNameList"
}
},
- "rule_template_name": {
- "type": "string"
- },
- "source": {
+ "message": {
"type": "string",
- "example": "SQLE"
- },
- "sql_query_config": {
- "type": "object",
- "$ref": "#/definitions/v1.SQLQueryConfigResV1"
+ "example": "ok"
}
}
},
- "v1.InstanceSchemaResV1": {
+ "v1.GetOperationsResV1": {
"type": "object",
"properties": {
- "schema_name_list": {
+ "code": {
+ "type": "integer",
+ "example": 0
+ },
+ "data": {
"type": "array",
"items": {
- "type": "string"
+ "$ref": "#/definitions/v1.OperationResV1"
}
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.InstanceTableMeta": {
+ "v1.GetProjectRuleTemplateResV1": {
"type": "object",
"properties": {
- "columns": {
- "type": "object",
- "$ref": "#/definitions/v1.TableColumns"
- },
- "create_table_sql": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "indexes": {
+ "data": {
"type": "object",
- "$ref": "#/definitions/v1.TableIndexes"
- },
- "name": {
- "type": "string"
+ "$ref": "#/definitions/v1.RuleProjectTemplateDetailResV1"
},
- "schema": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.InstanceTaskDetailResV1": {
+ "v1.GetProjectRuleTemplatesResV1": {
"type": "object",
"properties": {
- "db_type": {
- "type": "string",
- "example": "mysql"
- },
- "id": {
+ "code": {
"type": "integer",
- "example": 1
- },
- "rule_template": {
- "type": "string",
- "example": "default_mysql"
- },
- "source": {
- "type": "string",
- "example": "actiontech-dmp"
+ "example": 0
},
- "sync_instance_interval": {
- "type": "string",
- "example": "0 0 * * *"
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.ProjectRuleTemplateResV1"
+ }
},
- "url": {
+ "message": {
"type": "string",
- "example": "http://10.186.62.56:10000"
+ "example": "ok"
},
- "version": {
- "type": "string",
- "example": "1.23.1"
+ "total_nums": {
+ "type": "integer"
}
}
},
- "v1.InstanceTaskResV1": {
+ "v1.GetProjectScoreResV1": {
"type": "object",
"properties": {
- "db_type": {
- "type": "string",
- "example": "mysql"
- },
- "id": {
+ "code": {
"type": "integer",
- "example": 1
- },
- "last_sync_status": {
- "type": "string",
- "enum": [
- "succeeded",
- "failed"
- ],
- "example": "succeeded"
- },
- "last_sync_success_time": {
- "type": "string",
- "example": "2021-08-12 12:00:00"
- },
- "source": {
- "type": "string",
- "example": "actiontech-dmp"
+ "example": 0
},
- "url": {
- "type": "string",
- "example": "http://10.186.62.56:10000"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.ProjectScore"
},
- "version": {
+ "message": {
"type": "string",
- "example": "1.23.1"
+ "example": "ok"
}
}
},
- "v1.InstanceTipResV1": {
+ "v1.GetProjectStatisticsResDataV1": {
"type": "object",
"properties": {
- "host": {
- "type": "string"
+ "audit_plan_total": {
+ "type": "integer"
},
- "instance_name": {
- "type": "string"
+ "instance_total": {
+ "type": "integer"
},
- "instance_type": {
- "type": "string"
+ "member_total": {
+ "type": "integer"
},
- "port": {
- "type": "string"
+ "rule_template_total": {
+ "type": "integer"
},
- "workflow_template_id": {
+ "whitelist_total": {
+ "type": "integer"
+ },
+ "workflow_total": {
"type": "integer"
}
}
},
- "v1.InstanceTypePercent": {
+ "v1.GetProjectStatisticsResV1": {
"type": "object",
"properties": {
- "count": {
- "type": "integer"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "percent": {
- "type": "number"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.GetProjectStatisticsResDataV1"
},
- "type": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.InstancesTypePercentV1": {
+ "v1.GetRiskAuditPlanResV1": {
"type": "object",
"properties": {
- "instance_total_num": {
- "type": "integer"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "instance_type_percents": {
+ "data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.InstanceTypePercent"
+ "$ref": "#/definitions/v1.RiskAuditPlan"
}
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.LDAPConfigurationReqV1": {
+ "v1.GetRoleUserCountResV1": {
"type": "object",
"properties": {
- "enable_ldap": {
- "type": "boolean"
- },
- "enable_ssl": {
- "type": "boolean"
- },
- "ldap_connect_dn": {
- "type": "string"
- },
- "ldap_connect_pwd": {
- "type": "string"
- },
- "ldap_search_base_dn": {
- "type": "string"
- },
- "ldap_server_host": {
- "type": "string"
- },
- "ldap_server_port": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "ldap_user_email_rdn_key": {
- "type": "string"
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.RoleUserCount"
+ }
},
- "ldap_user_name_rdn_key": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.LDAPConfigurationResV1": {
+ "v1.GetRuleKnowledgeResV1": {
"type": "object",
"properties": {
- "enable_ldap": {
- "type": "boolean"
- },
- "enable_ssl": {
- "type": "boolean"
- },
- "ldap_connect_dn": {
- "type": "string"
- },
- "ldap_search_base_dn": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "ldap_server_host": {
- "type": "string"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.RuleKnowledgeResV1"
},
- "ldap_server_port": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
+ }
+ }
+ },
+ "v1.GetRuleTemplateResV1": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "ldap_user_email_rdn_key": {
- "type": "string"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.RuleTemplateDetailResV1"
},
- "ldap_user_name_rdn_key": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.LicenseItem": {
+ "v1.GetRuleTemplateTipsResV1": {
"type": "object",
"properties": {
- "description": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "limit": {
- "type": "string"
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.RuleTemplateTipResV1"
+ }
},
- "name": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.LicenseUsageItem": {
+ "v1.GetRuleTemplatesResV1": {
"type": "object",
"properties": {
- "is_limited": {
- "type": "boolean"
- },
- "limit": {
- "type": "integer"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "resource_type": {
- "type": "string"
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.RuleTemplateResV1"
+ }
},
- "resource_type_desc": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
},
- "used": {
+ "total_nums": {
"type": "integer"
}
}
},
- "v1.LicenseUsageV1": {
+ "v1.GetRuleTypeByDBTypeResV1": {
"type": "object",
"properties": {
- "instances_usage": {
+ "code": {
+ "type": "integer",
+ "example": 0
+ },
+ "data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.LicenseUsageItem"
+ "$ref": "#/definitions/v1.RuleTypeV1"
}
},
- "users_usage": {
- "type": "object",
- "$ref": "#/definitions/v1.LicenseUsageItem"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.ListTableBySchemaResV1": {
+ "v1.GetRulesResV1": {
"type": "object",
"properties": {
"code": {
@@ -14368,7 +9401,7 @@ var doc = `{
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.Table"
+ "$ref": "#/definitions/v1.RuleResV1"
}
},
"message": {
@@ -14377,213 +9410,183 @@ var doc = `{
}
}
},
- "v1.MaintenanceTimeReqV1": {
+ "v1.GetSQLAnalysisDataResItemV1": {
"type": "object",
"properties": {
- "maintenance_start_time": {
+ "sql_explain": {
"type": "object",
- "$ref": "#/definitions/v1.TimeReqV1"
+ "$ref": "#/definitions/v1.SQLExplain"
},
- "maintenance_stop_time": {
- "type": "object",
- "$ref": "#/definitions/v1.TimeReqV1"
+ "table_metas": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.TableMeta"
+ }
}
}
},
- "v1.MaintenanceTimeResV1": {
+ "v1.GetSQLAuditRecordResV1": {
"type": "object",
"properties": {
- "maintenance_start_time": {
- "type": "object",
- "$ref": "#/definitions/v1.TimeResV1"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "maintenance_stop_time": {
+ "data": {
"type": "object",
- "$ref": "#/definitions/v1.TimeResV1"
+ "$ref": "#/definitions/v1.SQLAuditRecord"
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.ManagementPermissionResV1": {
+ "v1.GetSQLAuditRecordTagTipsResV1": {
"type": "object",
"properties": {
"code": {
- "type": "integer"
+ "type": "integer",
+ "example": 0
},
- "desc": {
- "type": "string"
- }
- }
- },
- "v1.MemberGroupUserItem": {
- "type": "object",
- "properties": {
- "name": {
- "type": "string"
- }
- }
- },
- "v1.MemberTipResV1": {
- "type": "object",
- "properties": {
- "user_name": {
- "type": "string"
+ "data": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.Oauth2ConfigurationReqV1": {
+ "v1.GetSQLAuditRecordsResV1": {
"type": "object",
"properties": {
- "access_token_tag": {
- "type": "string"
- },
- "client_host": {
- "type": "string"
- },
- "client_id": {
- "type": "string"
- },
- "client_key": {
- "type": "string"
- },
- "enable_oauth2": {
- "type": "boolean"
- },
- "login_tip": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "scopes": {
+ "data": {
"type": "array",
"items": {
- "type": "string"
+ "$ref": "#/definitions/v1.SQLAuditRecord"
}
},
- "server_auth_url": {
- "type": "string"
- },
- "server_token_url": {
- "type": "string"
- },
- "server_user_id_url": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
},
- "user_id_tag": {
- "type": "string"
+ "total_nums": {
+ "type": "integer"
}
}
},
- "v1.Operation": {
+ "v1.GetSqlAverageExecutionTimeResV1": {
"type": "object",
"properties": {
- "op_code": {
- "type": "integer"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "op_desc": {
- "type": "string"
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.SqlAverageExecutionTime"
+ }
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.OperationActionList": {
+ "v1.GetSqlExecutionFailPercentResV1": {
"type": "object",
"properties": {
- "desc": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "operation_action": {
- "type": "string"
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.SqlExecutionFailPercent"
+ }
},
- "operation_type": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.OperationRecordList": {
+ "v1.GetSqlManageListResp": {
"type": "object",
"properties": {
- "id": {
- "type": "integer"
- },
- "operation_action": {
- "type": "string"
- },
- "operation_content": {
- "type": "string"
- },
- "operation_time": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "operation_type_name": {
- "type": "string"
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.SqlManage"
+ }
},
- "operation_user": {
- "type": "object",
- "$ref": "#/definitions/v1.OperationUser"
+ "message": {
+ "type": "string",
+ "example": "ok"
},
- "project_name": {
- "type": "string"
+ "sql_manage_bad_num": {
+ "type": "integer"
},
- "status": {
- "type": "string",
- "enum": [
- "succeeded",
- "failed"
- ]
- }
- }
- },
- "v1.OperationResV1": {
- "type": "object",
- "properties": {
- "op_code": {
+ "sql_manage_optimized_num": {
"type": "integer"
},
- "op_desc": {
- "type": "string"
+ "sql_manage_total_num": {
+ "type": "integer"
}
}
},
- "v1.OperationTypeNameList": {
+ "v1.GetSqlManageRuleTipsResp": {
"type": "object",
"properties": {
- "desc": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "operation_type_name": {
- "type": "string"
- }
- }
- },
- "v1.OperationUser": {
- "type": "object",
- "properties": {
- "ip": {
- "type": "string"
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.RuleTips"
+ }
},
- "user_name": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.ParseProjectRuleTemplateFileResDataV1": {
+ "v1.GetSqlManageSqlAnalysisResp": {
"type": "object",
"properties": {
- "db_type": {
- "type": "string"
- },
- "desc": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "name": {
- "type": "string"
+ "data": {
+ "description": "V1版本不能引用V2版本的结构体,所以只能复制一份",
+ "type": "object",
+ "$ref": "#/definitions/v1.SqlAnalysis"
},
- "rule_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.RuleResV1"
- }
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.ParseProjectRuleTemplateFileResV1": {
+ "v1.GetSystemVariablesResV1": {
"type": "object",
"properties": {
"code": {
@@ -14592,7 +9595,7 @@ var doc = `{
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.ParseProjectRuleTemplateFileResDataV1"
+ "$ref": "#/definitions/v1.SystemVariablesResV1"
},
"message": {
"type": "string",
@@ -14600,795 +9603,708 @@ var doc = `{
}
}
},
- "v1.PartialSyncAuditPlanSQLsReqV1": {
+ "v1.GetTableMetadataResV1": {
"type": "object",
"properties": {
- "audit_plan_sql_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanSQLReqV1"
- }
+ "code": {
+ "type": "integer",
+ "example": 0
+ },
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.InstanceTableMeta"
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.PatchUserGroupReqV1": {
+ "v1.GetTaskAnalysisDataResItemV1": {
"type": "object",
"properties": {
- "is_disabled": {
- "type": "boolean"
- },
- "user_group_desc": {
- "type": "string",
- "example": "this is a group"
+ "sql_explain": {
+ "type": "object",
+ "$ref": "#/definitions/v1.SQLExplain"
},
- "user_name_list": {
+ "table_metas": {
"type": "array",
"items": {
- "type": "string"
+ "$ref": "#/definitions/v1.TableMeta"
}
}
}
},
- "v1.PerformanceStatistics": {
+ "v1.GetTaskAnalysisDataResV1": {
"type": "object",
"properties": {
- "affect_rows": {
+ "code": {
+ "type": "integer",
+ "example": 0
+ },
+ "data": {
"type": "object",
- "$ref": "#/definitions/v1.AffectRows"
- }
- }
- },
- "v1.PersonaliseReqV1": {
- "type": "object",
- "properties": {
- "title": {
- "type": "string"
+ "$ref": "#/definitions/v1.GetTaskAnalysisDataResItemV1"
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.ProjectDetailItem": {
+ "v1.GetUserTipsResV1": {
"type": "object",
"properties": {
- "archived": {
- "type": "boolean"
- },
- "create_time": {
- "type": "string"
- },
- "create_user_name": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "desc": {
- "type": "string"
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.UserTipResV1"
+ }
},
- "name": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.ProjectListItem": {
+ "v1.GetWorkflowAuditPassPercentResV1": {
"type": "object",
"properties": {
- "archived": {
- "type": "boolean"
- },
- "create_time": {
- "type": "string"
- },
- "create_user_name": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "desc": {
- "type": "string"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.WorkflowAuditPassPercentV1"
},
- "name": {
- "type": "string"
- }
- }
- },
- "v1.ProjectRuleTemplateInstance": {
- "type": "object",
- "properties": {
- "name": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.ProjectRuleTemplateResV1": {
+ "v1.GetWorkflowCountsResV1": {
"type": "object",
"properties": {
- "db_type": {
- "type": "string"
- },
- "desc": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "instance_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.ProjectRuleTemplateInstance"
- }
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.WorkflowCountsV1"
},
- "rule_template_name": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.ProjectScore": {
+ "v1.GetWorkflowCreatedCountsEachDayResV1": {
"type": "object",
"properties": {
- "score": {
- "type": "integer"
+ "code": {
+ "type": "integer",
+ "example": 0
+ },
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.WorkflowCreatedCountsEachDayV1"
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.ProjectTipResV1": {
+ "v1.GetWorkflowDurationOfWaitingForAuditResV1": {
"type": "object",
"properties": {
- "project_name": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
+ },
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.WorkflowStageDuration"
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.RejectWorkflowReqV1": {
+ "v1.GetWorkflowDurationOfWaitingForExecutionResV1": {
"type": "object",
"properties": {
- "reason": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
+ },
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.WorkflowStageDuration"
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.RiskAuditPlan": {
+ "v1.GetWorkflowPassPercentResV1": {
"type": "object",
"properties": {
- "audit_plan_name": {
- "type": "string"
- },
- "audit_plan_report_id": {
- "type": "integer"
- },
- "audit_plan_report_timestamp": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "risk_sql_count": {
- "type": "integer"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.WorkflowPassPercentV1"
},
- "trigger_audit_plan_time": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.RiskWorkflow": {
+ "v1.GetWorkflowPercentCountedByInstanceTypeResV1": {
"type": "object",
"properties": {
- "create_user_name": {
- "type": "string"
- },
- "update_time": {
- "type": "string"
- },
- "workflow_id": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "workflow_name": {
- "type": "string"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.WorkflowPercentCountedByInstanceTypeV1"
},
- "workflow_status": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.RoleResV1": {
+ "v1.GetWorkflowRejectedPercentGroupByCreatorResV1": {
"type": "object",
"properties": {
- "is_disabled": {
- "type": "boolean"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "operation_list": {
+ "data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.Operation"
+ "$ref": "#/definitions/v1.WorkflowRejectedPercentGroupByCreator"
}
},
- "role_desc": {
- "type": "string"
- },
- "role_name": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.RoleTipResV1": {
+ "v1.GetWorkflowRejectedPercentGroupByInstanceResV1": {
"type": "object",
"properties": {
- "operations": {
+ "code": {
+ "type": "integer",
+ "example": 0
+ },
+ "data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.Operation"
+ "$ref": "#/definitions/v1.WorkflowRejectedPercentGroupByInstance"
}
},
- "role_name": {
- "type": "string"
- }
- }
- },
- "v1.RoleUserCount": {
- "type": "object",
- "properties": {
- "count": {
- "type": "integer"
- },
- "role": {
- "type": "string"
- }
- }
- },
- "v1.RuleInfo": {
- "type": "object",
- "properties": {
- "annotation": {
- "type": "string",
- "example": "this is test rule"
- },
- "desc": {
+ "message": {
"type": "string",
- "example": "this is test rule"
+ "example": "ok"
}
}
},
- "v1.RuleKnowledgeResV1": {
+ "v1.GetWorkflowResV1": {
"type": "object",
"properties": {
- "knowledge_content": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "rule": {
+ "data": {
"type": "object",
- "$ref": "#/definitions/v1.RuleInfo"
+ "$ref": "#/definitions/v1.WorkflowResV1"
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.RuleParamReqV1": {
+ "v1.GetWorkflowStatusCountResV1": {
"type": "object",
"properties": {
- "key": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "value": {
- "type": "string"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.WorkflowStatusCountV1"
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.RuleParamResV1": {
+ "v1.GetWorkflowTasksItemV1": {
"type": "object",
"properties": {
- "desc": {
+ "current_step_assignee_user_name_list": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "exec_end_time": {
"type": "string"
},
- "key": {
+ "exec_start_time": {
"type": "string"
},
- "type": {
+ "execution_user_name": {
+ "type": "string"
+ },
+ "instance_maintenance_times": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.MaintenanceTimeResV1"
+ }
+ },
+ "instance_name": {
+ "type": "string"
+ },
+ "schedule_time": {
+ "type": "string"
+ },
+ "status": {
"type": "string",
"enum": [
- "string",
- "int",
- "bool"
+ "wait_for_audit",
+ "wait_for_execution",
+ "exec_scheduled",
+ "exec_failed",
+ "exec_succeeded",
+ "executing",
+ "manually_executed"
]
},
- "value": {
- "type": "string"
+ "task_id": {
+ "type": "integer"
+ },
+ "task_pass_rate": {
+ "type": "number"
+ },
+ "task_score": {
+ "type": "integer"
}
}
},
- "v1.RuleProjectTemplateDetailResV1": {
+ "v1.GetWorkflowTasksResV1": {
"type": "object",
"properties": {
- "db_type": {
- "type": "string"
- },
- "desc": {
- "type": "string"
- },
- "instance_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.ProjectRuleTemplateInstance"
- }
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "rule_list": {
+ "data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.RuleResV1"
+ "$ref": "#/definitions/v1.GetWorkflowTasksItemV1"
}
},
- "rule_template_name": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.RuleReqV1": {
+ "v1.GetWorkflowTemplateResV1": {
"type": "object",
"properties": {
- "is_custom_rule": {
- "type": "boolean"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "level": {
- "type": "string",
- "example": "error"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.WorkflowTemplateDetailResV1"
},
- "name": {
+ "message": {
"type": "string",
- "example": "ddl_check_index_count"
+ "example": "ok"
+ }
+ }
+ },
+ "v1.GetWorkflowsResV1": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "params": {
+ "data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.RuleParamReqV1"
+ "$ref": "#/definitions/v1.WorkflowDetailResV1"
}
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
+ },
+ "total_nums": {
+ "type": "integer"
}
}
},
- "v1.RuleResV1": {
+ "v1.InstanceAdditionalParamResV1": {
"type": "object",
"properties": {
- "annotation": {
+ "description": {
"type": "string",
- "example": "避免多次 table rebuild 带来的消耗、以及对线上业务的影响"
+ "example": "参数项中文名"
},
- "db_type": {
+ "name": {
"type": "string",
- "example": "mysql"
- },
- "desc": {
- "type": "string"
- },
- "is_custom_rule": {
- "type": "boolean"
+ "example": "param name"
},
- "level": {
+ "type": {
"type": "string",
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ],
- "example": "error"
- },
- "params": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.RuleParamResV1"
- }
- },
- "rule_name": {
- "type": "string"
+ "example": "int"
},
- "type": {
+ "value": {
"type": "string",
- "example": "全局配置"
+ "example": "0"
}
}
},
- "v1.RuleRespV1": {
+ "v1.InstanceConnectableResV1": {
"type": "object",
"properties": {
- "desc": {
+ "connect_error_message": {
"type": "string"
},
- "rule_name": {
- "type": "string"
+ "is_instance_connectable": {
+ "type": "boolean"
}
}
},
- "v1.RuleTemplateDetailResV1": {
+ "v1.InstanceConnectionResV1": {
"type": "object",
"properties": {
- "db_type": {
+ "connect_error_message": {
"type": "string"
},
- "desc": {
+ "instance_name": {
"type": "string"
},
- "instance_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.GlobalRuleTemplateInstance"
- }
- },
- "rule_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.RuleResV1"
- }
- },
- "rule_template_name": {
- "type": "string"
+ "is_instance_connectable": {
+ "type": "boolean"
}
}
},
- "v1.RuleTemplateResV1": {
+ "v1.InstanceForCheckConnection": {
"type": "object",
"properties": {
- "db_type": {
- "type": "string"
- },
- "desc": {
- "type": "string"
- },
- "instance_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.GlobalRuleTemplateInstance"
- }
- },
- "rule_template_name": {
+ "name": {
"type": "string"
}
}
},
- "v1.RuleTemplateTipResV1": {
+ "v1.InstanceForCreatingTask": {
"type": "object",
"properties": {
- "db_type": {
+ "instance_name": {
"type": "string"
},
- "rule_template_name": {
+ "instance_schema": {
"type": "string"
}
}
},
- "v1.RuleTips": {
+ "v1.InstanceSchemaResV1": {
"type": "object",
"properties": {
- "db_type": {
- "type": "string"
- },
- "rule": {
+ "schema_name_list": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.RuleRespV1"
+ "type": "string"
}
}
}
},
- "v1.RuleTypeV1": {
- "type": "object",
- "properties": {
- "is_custom_rule_type": {
- "type": "boolean"
- },
- "rule_count": {
- "type": "integer"
- },
- "rule_type": {
- "type": "string"
- }
- }
- },
- "v1.SMTPConfigurationResV1": {
+ "v1.InstanceTableMeta": {
"type": "object",
"properties": {
- "enable_smtp_notify": {
- "type": "boolean"
- },
- "is_skip_verify": {
- "type": "boolean"
+ "columns": {
+ "type": "object",
+ "$ref": "#/definitions/v1.TableColumns"
},
- "smtp_host": {
+ "create_table_sql": {
"type": "string"
},
- "smtp_port": {
+ "indexes": {
+ "type": "object",
+ "$ref": "#/definitions/v1.TableIndexes"
+ },
+ "name": {
"type": "string"
},
- "smtp_username": {
+ "schema": {
"type": "string"
}
}
},
- "v1.SQLAuditRecord": {
+ "v1.InstanceTipResV1": {
"type": "object",
"properties": {
- "created_at": {
+ "host": {
"type": "string"
},
- "creator": {
+ "instance_id": {
"type": "string"
},
- "instance": {
- "type": "object",
- "$ref": "#/definitions/v1.SQLAuditRecordInstance"
- },
- "sql_audit_record_id": {
+ "instance_name": {
"type": "string"
},
- "sql_audit_status": {
+ "instance_type": {
"type": "string"
},
- "tags": {
- "type": "array",
- "items": {
- "type": "string"
- }
+ "port": {
+ "type": "string"
},
- "task": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditTaskResV1"
+ "workflow_template_id": {
+ "type": "integer"
}
}
},
- "v1.SQLAuditRecordInstance": {
+ "v1.InstanceTypePercent": {
"type": "object",
"properties": {
- "db_host": {
- "type": "string",
- "example": "10.10.10.10"
+ "count": {
+ "type": "integer"
},
- "db_port": {
- "type": "string",
- "example": "3306"
+ "percent": {
+ "type": "number"
+ },
+ "type": {
+ "type": "string"
}
}
},
- "v1.SQLAuditRecordResData": {
+ "v1.InstancesTypePercentV1": {
"type": "object",
"properties": {
- "sql_audit_record_id": {
- "type": "string"
+ "instance_total_num": {
+ "type": "integer"
},
- "task": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditTaskResV1"
+ "instance_type_percents": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.InstanceTypePercent"
+ }
}
}
},
- "v1.SQLExplain": {
+ "v1.LicenseItem": {
"type": "object",
"properties": {
- "classic_result": {
- "description": "explain result in table format",
- "type": "object",
- "$ref": "#/definitions/v1.ExplainClassicResult"
- },
- "message": {
+ "description": {
"type": "string"
},
- "sql": {
+ "limit": {
"type": "string"
- }
- }
- },
- "v1.SQLQueryConfigReqV1": {
- "type": "object",
- "properties": {
- "allow_query_when_less_than_audit_level": {
- "type": "string",
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ],
- "example": "error"
- },
- "audit_enabled": {
- "type": "boolean",
- "example": false
- },
- "max_pre_query_rows": {
- "type": "integer",
- "example": 100
},
- "query_timeout_second": {
- "type": "integer",
- "example": 10
+ "name": {
+ "type": "string"
}
}
},
- "v1.SQLQueryConfigResV1": {
+ "v1.LicenseUsageItem": {
"type": "object",
"properties": {
- "allow_query_when_less_than_audit_level": {
- "type": "string",
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ]
- },
- "audit_enabled": {
+ "is_limited": {
"type": "boolean"
},
- "max_pre_query_rows": {
+ "limit": {
"type": "integer"
},
- "query_timeout_second": {
+ "resource_type": {
+ "type": "string"
+ },
+ "resource_type_desc": {
+ "type": "string"
+ },
+ "used": {
"type": "integer"
}
}
},
- "v1.Source": {
+ "v1.LicenseUsageV1": {
"type": "object",
"properties": {
- "audit_plan_name": {
- "type": "string"
- },
- "sql_audit_record_ids": {
+ "instances_usage": {
"type": "array",
"items": {
- "type": "string"
+ "$ref": "#/definitions/v1.LicenseUsageItem"
}
},
- "type": {
- "type": "string",
- "enum": [
- "audit_plan",
- "sql_audit_record"
- ]
- }
- }
- },
- "v1.SqlAnalysis": {
- "type": "object",
- "properties": {
- "performance_statistics": {
- "type": "object",
- "$ref": "#/definitions/v1.PerformanceStatistics"
- },
- "sql_explain": {
- "type": "object",
- "$ref": "#/definitions/v1.SQLExplain"
- },
- "table_metas": {
+ "users_usage": {
"type": "object",
- "$ref": "#/definitions/v1.TableMetas"
+ "$ref": "#/definitions/v1.LicenseUsageItem"
}
}
},
- "v1.SqlAnalysisResDataV1": {
+ "v1.ListTableBySchemaResV1": {
"type": "object",
"properties": {
- "sql_explain": {
- "type": "object",
- "$ref": "#/definitions/v1.SQLExplain"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "table_metas": {
+ "data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.TableMeta"
+ "$ref": "#/definitions/v1.Table"
}
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.SqlAverageExecutionTime": {
+ "v1.MaintenanceTimeResV1": {
"type": "object",
"properties": {
- "average_execution_seconds": {
- "type": "integer"
- },
- "instance_name": {
- "type": "string"
- },
- "max_execution_seconds": {
- "type": "integer"
+ "maintenance_start_time": {
+ "type": "object",
+ "$ref": "#/definitions/v1.TimeResV1"
},
- "min_execution_seconds": {
- "type": "integer"
+ "maintenance_stop_time": {
+ "type": "object",
+ "$ref": "#/definitions/v1.TimeResV1"
}
}
},
- "v1.SqlExecutionFailPercent": {
+ "v1.OperationActionList": {
"type": "object",
"properties": {
- "instance_name": {
+ "desc": {
"type": "string"
},
- "percent": {
- "type": "number"
+ "operation_action": {
+ "type": "string"
+ },
+ "operation_type": {
+ "type": "string"
}
}
},
- "v1.SqlManage": {
+ "v1.OperationRecordList": {
"type": "object",
"properties": {
- "appear_num": {
+ "id": {
"type": "integer"
},
- "assignees": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "audit_result": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditResult"
- }
- },
- "endpoint": {
+ "operation_action": {
"type": "string"
},
- "first_appear_time": {
+ "operation_content": {
"type": "string"
},
- "id": {
- "type": "integer"
- },
- "instance_name": {
+ "operation_time": {
"type": "string"
},
- "last_appear_time": {
+ "operation_type_name": {
"type": "string"
},
- "remark": {
- "type": "string"
+ "operation_user": {
+ "type": "object",
+ "$ref": "#/definitions/v1.OperationUser"
},
- "schema_name": {
+ "project_name": {
"type": "string"
},
- "source": {
- "type": "object",
- "$ref": "#/definitions/v1.Source"
+ "status": {
+ "type": "string",
+ "enum": [
+ "succeeded",
+ "failed"
+ ]
+ }
+ }
+ },
+ "v1.OperationResV1": {
+ "type": "object",
+ "properties": {
+ "op_code": {
+ "type": "integer"
},
- "sql": {
+ "op_desc": {
+ "type": "string"
+ }
+ }
+ },
+ "v1.OperationTypeNameList": {
+ "type": "object",
+ "properties": {
+ "desc": {
"type": "string"
},
- "sql_fingerprint": {
+ "operation_type_name": {
"type": "string"
- },
- "status": {
- "type": "string",
- "enum": [
- "unhandled",
- "solved",
- "ignored",
- "manual_audited"
- ]
}
}
},
- "v1.StatisticAuditPlanResV1": {
+ "v1.OperationUser": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.DBTypeAuditPlan"
- }
+ "ip": {
+ "type": "string"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "user_name": {
+ "type": "string"
}
}
},
- "v1.StatisticRiskWorkflowResV1": {
+ "v1.ParseProjectRuleTemplateFileResDataV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "db_type": {
+ "type": "string"
},
- "data": {
+ "desc": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "rule_list": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.RiskWorkflow"
+ "$ref": "#/definitions/v1.RuleResV1"
}
- },
- "message": {
- "type": "string",
- "example": "ok"
}
}
},
- "v1.StatisticsAuditedSQLResV1": {
+ "v1.ParseProjectRuleTemplateFileResV1": {
"type": "object",
"properties": {
"code": {
@@ -15397,424 +10313,421 @@ var doc = `{
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.AuditedSQLCount"
+ "$ref": "#/definitions/v1.ParseProjectRuleTemplateFileResDataV1"
},
"message": {
"type": "string",
"example": "ok"
- },
- "risk_rate": {
- "type": "integer"
- }
- }
- },
- "v1.SyncInstanceResV1": {
- "type": "object",
- "properties": {
- "is_sync_instance_success": {
- "type": "boolean",
- "example": true
- },
- "sync_error_message": {
- "type": "string"
}
}
},
- "v1.SyncTaskTipsResV1": {
+ "v1.PartialSyncAuditPlanSQLsReqV1": {
"type": "object",
"properties": {
- "db_types": {
+ "audit_plan_sql_list": {
"type": "array",
"items": {
- "type": "string"
+ "$ref": "#/definitions/v1.AuditPlanSQLReqV1"
}
- },
- "source": {
- "type": "string",
- "example": "actiontech-dmp"
}
}
},
- "v1.SystemVariablesResV1": {
+ "v1.PerformanceStatistics": {
"type": "object",
"properties": {
- "operation_record_expired_hours": {
- "type": "integer"
- },
- "url": {
- "type": "string"
- },
- "workflow_expired_hours": {
- "type": "integer"
+ "affect_rows": {
+ "type": "object",
+ "$ref": "#/definitions/v1.AffectRows"
}
}
},
- "v1.Table": {
+ "v1.ProjectRuleTemplateResV1": {
"type": "object",
"properties": {
- "name": {
+ "db_type": {
+ "type": "string"
+ },
+ "desc": {
+ "type": "string"
+ },
+ "rule_template_name": {
"type": "string"
}
}
},
- "v1.TableColumns": {
+ "v1.ProjectScore": {
"type": "object",
"properties": {
- "head": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.TableMetaItemHeadResV1"
- }
- },
- "rows": {
- "type": "array",
- "items": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- }
+ "score": {
+ "type": "integer"
}
}
},
- "v1.TableIndexes": {
+ "v1.RejectWorkflowReqV1": {
"type": "object",
"properties": {
- "head": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.TableMetaItemHeadResV1"
- }
- },
- "rows": {
- "type": "array",
- "items": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- }
+ "reason": {
+ "type": "string"
}
}
},
- "v1.TableMeta": {
+ "v1.RiskAuditPlan": {
"type": "object",
"properties": {
- "columns": {
- "type": "object",
- "$ref": "#/definitions/v1.TableColumns"
- },
- "create_table_sql": {
+ "audit_plan_name": {
"type": "string"
},
- "indexes": {
- "type": "object",
- "$ref": "#/definitions/v1.TableIndexes"
+ "audit_plan_report_id": {
+ "type": "integer"
},
- "message": {
+ "audit_plan_report_timestamp": {
"type": "string"
},
- "name": {
- "type": "string"
+ "risk_sql_count": {
+ "type": "integer"
},
- "schema": {
+ "trigger_audit_plan_time": {
"type": "string"
}
}
},
- "v1.TableMetaItemHeadResV1": {
+ "v1.RiskWorkflow": {
"type": "object",
"properties": {
- "desc": {
+ "create_user_name": {
"type": "string"
},
- "field_name": {
+ "update_time": {
+ "type": "string"
+ },
+ "workflow_id": {
+ "type": "string"
+ },
+ "workflow_name": {
+ "type": "string"
+ },
+ "workflow_status": {
"type": "string"
}
}
},
- "v1.TableMetas": {
+ "v1.RoleUserCount": {
"type": "object",
"properties": {
- "err_message": {
- "type": "string"
+ "count": {
+ "type": "integer"
},
- "table_meta_items": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.TableMeta"
- }
+ "role": {
+ "type": "string"
}
}
},
- "v1.TestAuditPlanNotifyConfigResDataV1": {
+ "v1.RuleInfo": {
"type": "object",
"properties": {
- "is_notify_send_normal": {
- "type": "boolean"
+ "annotation": {
+ "type": "string",
+ "example": "this is test rule"
},
- "send_error_message": {
- "type": "string"
+ "desc": {
+ "type": "string",
+ "example": "this is test rule"
}
}
},
- "v1.TestAuditPlanNotifyConfigResV1": {
+ "v1.RuleKnowledgeResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "knowledge_content": {
+ "type": "string"
},
- "data": {
+ "rule": {
"type": "object",
- "$ref": "#/definitions/v1.TestAuditPlanNotifyConfigResDataV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
+ "$ref": "#/definitions/v1.RuleInfo"
}
}
},
- "v1.TestDingTalkConfigResDataV1": {
+ "v1.RuleParamReqV1": {
"type": "object",
"properties": {
- "is_ding_talk_send_normal": {
- "type": "boolean"
+ "key": {
+ "type": "string"
},
- "send_error_message": {
+ "value": {
"type": "string"
}
}
},
- "v1.TestDingTalkConfigResV1": {
+ "v1.RuleParamResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "desc": {
+ "type": "string"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.TestDingTalkConfigResDataV1"
+ "key": {
+ "type": "string"
},
- "message": {
+ "type": {
"type": "string",
- "example": "ok"
+ "enum": [
+ "string",
+ "int",
+ "bool"
+ ]
+ },
+ "value": {
+ "type": "string"
}
}
},
- "v1.TestFeishuConfigResDataV1": {
+ "v1.RuleProjectTemplateDetailResV1": {
"type": "object",
"properties": {
- "error_message": {
+ "db_type": {
"type": "string"
},
- "is_message_sent_normally": {
- "type": "boolean"
+ "desc": {
+ "type": "string"
+ },
+ "rule_list": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.RuleResV1"
+ }
+ },
+ "rule_template_name": {
+ "type": "string"
}
}
},
- "v1.TestFeishuConfigResV1": {
+ "v1.RuleReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "is_custom_rule": {
+ "type": "boolean"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.TestFeishuConfigResDataV1"
+ "level": {
+ "type": "string",
+ "example": "error"
},
- "message": {
+ "name": {
"type": "string",
- "example": "ok"
+ "example": "ddl_check_index_count"
+ },
+ "params": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.RuleParamReqV1"
+ }
}
}
},
- "v1.TestFeishuConfigurationReqV1": {
+ "v1.RuleResV1": {
"type": "object",
"properties": {
- "account": {
+ "annotation": {
+ "type": "string",
+ "example": "避免多次 table rebuild 带来的消耗、以及对线上业务的影响"
+ },
+ "db_type": {
+ "type": "string",
+ "example": "mysql"
+ },
+ "desc": {
"type": "string"
},
- "account_type": {
+ "is_custom_rule": {
+ "type": "boolean"
+ },
+ "level": {
"type": "string",
"enum": [
- "email",
- "phone"
- ]
- }
- }
- },
- "v1.TestSMTPConfigurationReqV1": {
- "type": "object",
- "properties": {
- "recipient_addr": {
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ],
+ "example": "error"
+ },
+ "params": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.RuleParamResV1"
+ }
+ },
+ "rule_name": {
"type": "string"
+ },
+ "type": {
+ "type": "string",
+ "example": "全局配置"
}
}
},
- "v1.TestSMTPConfigurationResDataV1": {
+ "v1.RuleRespV1": {
"type": "object",
"properties": {
- "is_smtp_send_normal": {
- "type": "boolean"
+ "desc": {
+ "type": "string"
},
- "send_error_message": {
+ "rule_name": {
"type": "string"
}
}
},
- "v1.TestSMTPConfigurationResV1": {
+ "v1.RuleTemplateDetailResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "db_type": {
+ "type": "string"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.TestSMTPConfigurationResDataV1"
+ "desc": {
+ "type": "string"
},
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.TestWeChatConfigurationReqV1": {
- "type": "object",
- "properties": {
- "recipient_id": {
+ "rule_list": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.RuleResV1"
+ }
+ },
+ "rule_template_name": {
"type": "string"
}
}
},
- "v1.TestWeChatConfigurationResDataV1": {
+ "v1.RuleTemplateResV1": {
"type": "object",
"properties": {
- "is_wechat_send_normal": {
- "type": "boolean"
+ "db_type": {
+ "type": "string"
},
- "send_error_message": {
+ "desc": {
+ "type": "string"
+ },
+ "rule_template_name": {
"type": "string"
}
}
},
- "v1.TestWeChatConfigurationResV1": {
+ "v1.RuleTemplateTipResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "db_type": {
+ "type": "string"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.TestWeChatConfigurationResDataV1"
+ "rule_template_id": {
+ "type": "string"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "rule_template_name": {
+ "type": "string"
}
}
},
- "v1.TestWorkflowWebHookConfigResDataV1": {
+ "v1.RuleTips": {
"type": "object",
"properties": {
- "send_error_message": {
+ "db_type": {
"type": "string"
+ },
+ "rule": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.RuleRespV1"
+ }
}
}
},
- "v1.TestWorkflowWebHookConfigResV1": {
+ "v1.RuleTypeV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "is_custom_rule_type": {
+ "type": "boolean"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.TestWorkflowWebHookConfigResDataV1"
+ "rule_count": {
+ "type": "integer"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "rule_type": {
+ "type": "string"
}
}
},
- "v1.TimeReqV1": {
+ "v1.SQLAuditRecord": {
"type": "object",
"properties": {
- "hour": {
- "type": "integer"
+ "created_at": {
+ "type": "string"
},
- "minute": {
- "type": "integer"
+ "creator": {
+ "type": "string"
+ },
+ "instance": {
+ "type": "object",
+ "$ref": "#/definitions/v1.SQLAuditRecordInstance"
+ },
+ "sql_audit_record_id": {
+ "type": "string"
+ },
+ "sql_audit_status": {
+ "type": "string"
+ },
+ "tags": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "task": {
+ "type": "object",
+ "$ref": "#/definitions/v1.AuditTaskResV1"
}
}
},
- "v1.TimeResV1": {
+ "v1.SQLAuditRecordInstance": {
"type": "object",
"properties": {
- "hour": {
- "type": "integer"
+ "db_host": {
+ "type": "string",
+ "example": "10.10.10.10"
},
- "minute": {
- "type": "integer"
+ "db_port": {
+ "type": "string",
+ "example": "3306"
}
}
},
- "v1.TriggerAuditPlanResV1": {
+ "v1.SQLAuditRecordResData": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "sql_audit_record_id": {
+ "type": "string"
},
- "data": {
+ "task": {
"type": "object",
- "$ref": "#/definitions/v1.AuditPlanReportResV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
+ "$ref": "#/definitions/v1.AuditTaskResV1"
}
}
},
- "v1.TriggerSyncInstanceResV1": {
+ "v1.SQLExplain": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
+ "classic_result": {
+ "description": "explain result in table format",
"type": "object",
- "$ref": "#/definitions/v1.SyncInstanceResV1"
+ "$ref": "#/definitions/v1.ExplainClassicResult"
},
"message": {
- "type": "string",
- "example": "ok"
+ "type": "string"
+ },
+ "sql": {
+ "type": "string"
}
}
},
- "v1.UpdateAuditPlanNotifyConfigReqV1": {
+ "v1.SQLQueryConfigResV1": {
"type": "object",
"properties": {
- "enable_email_notify": {
- "type": "boolean"
- },
- "enable_web_hook_notify": {
- "type": "boolean"
- },
- "notify_interval": {
- "type": "integer",
- "default": 10
- },
- "notify_level": {
+ "allow_query_when_less_than_audit_level": {
"type": "string",
- "default": "warn",
"enum": [
"normal",
"notice",
@@ -15822,715 +10735,731 @@ var doc = `{
"error"
]
},
- "web_hook_template": {
- "type": "string"
+ "audit_enabled": {
+ "type": "boolean"
},
- "web_hook_url": {
- "type": "string"
+ "max_pre_query_rows": {
+ "type": "integer"
+ },
+ "query_timeout_second": {
+ "type": "integer"
}
}
},
- "v1.UpdateAuditPlanReqV1": {
+ "v1.Source": {
"type": "object",
"properties": {
- "audit_plan_cron": {
- "type": "string",
- "example": "0 */2 * * *"
- },
- "audit_plan_instance_database": {
- "type": "string",
- "example": "app1"
- },
- "audit_plan_instance_name": {
- "type": "string",
- "example": "test_mysql"
+ "audit_plan_name": {
+ "type": "string"
},
- "audit_plan_params": {
+ "sql_audit_record_ids": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.AuditPlanParamReqV1"
+ "type": "string"
}
},
- "rule_template_name": {
+ "type": {
"type": "string",
- "example": "default_MySQL"
+ "enum": [
+ "audit_plan",
+ "sql_audit_record"
+ ]
}
}
},
- "v1.UpdateAuditTaskSQLsReqV1": {
+ "v1.SqlAnalysis": {
"type": "object",
"properties": {
- "description": {
- "type": "string"
+ "performance_statistics": {
+ "type": "object",
+ "$ref": "#/definitions/v1.PerformanceStatistics"
+ },
+ "sql_explain": {
+ "type": "object",
+ "$ref": "#/definitions/v1.SQLExplain"
+ },
+ "table_metas": {
+ "type": "object",
+ "$ref": "#/definitions/v1.TableMetas"
}
}
},
- "v1.UpdateAuditWhitelistReqV1": {
+ "v1.SqlAnalysisResDataV1": {
"type": "object",
"properties": {
- "desc": {
- "type": "string",
- "example": "used for rapid release"
- },
- "match_type": {
- "type": "string",
- "enum": [
- "exact_match",
- "fp_match"
- ],
- "example": "exact_match"
+ "sql_explain": {
+ "type": "object",
+ "$ref": "#/definitions/v1.SQLExplain"
},
- "value": {
- "type": "string",
- "example": "create table"
+ "table_metas": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.TableMeta"
+ }
}
}
},
- "v1.UpdateCompanyNoticeReq": {
+ "v1.SqlAverageExecutionTime": {
"type": "object",
"properties": {
- "notice_str": {
+ "average_execution_seconds": {
+ "type": "integer"
+ },
+ "instance_name": {
"type": "string"
+ },
+ "max_execution_seconds": {
+ "type": "integer"
+ },
+ "min_execution_seconds": {
+ "type": "integer"
}
}
},
- "v1.UpdateCurrentUserPasswordReqV1": {
+ "v1.SqlExecutionFailPercent": {
"type": "object",
"properties": {
- "new_password": {
+ "instance_name": {
"type": "string"
},
- "password": {
- "type": "string"
+ "percent": {
+ "type": "number"
}
}
},
- "v1.UpdateCurrentUserReqV1": {
+ "v1.SqlManage": {
"type": "object",
"properties": {
- "email": {
+ "appear_num": {
+ "type": "integer"
+ },
+ "assignees": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "audit_result": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.AuditResult"
+ }
+ },
+ "endpoint": {
"type": "string"
},
- "phone": {
+ "first_appear_time": {
"type": "string"
},
- "wechat_id": {
- "type": "string",
- "example": "UserID"
- }
- }
- },
- "v1.UpdateCustomRuleReqV1": {
- "type": "object",
- "properties": {
- "annotation": {
- "type": "string",
- "example": "this is test rule"
+ "id": {
+ "type": "integer"
},
- "desc": {
- "type": "string",
- "example": "this is test rule"
+ "instance_name": {
+ "type": "string"
},
- "level": {
- "type": "string",
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ],
- "example": "notice"
+ "last_appear_time": {
+ "type": "string"
},
- "rule_script": {
+ "remark": {
"type": "string"
},
- "type": {
- "type": "string",
- "example": "DDL规则"
- }
- }
- },
- "v1.UpdateDingTalkConfigurationReqV1": {
- "type": "object",
- "required": [
- "app_key",
- "app_secret",
- "is_enable_ding_talk_notify"
- ],
- "properties": {
- "app_key": {
+ "schema_name": {
"type": "string"
},
- "app_secret": {
+ "source": {
+ "type": "object",
+ "$ref": "#/definitions/v1.Source"
+ },
+ "sql": {
"type": "string"
},
- "is_enable_ding_talk_notify": {
- "type": "boolean"
+ "sql_fingerprint": {
+ "type": "string"
+ },
+ "status": {
+ "type": "string",
+ "enum": [
+ "unhandled",
+ "solved",
+ "ignored",
+ "manual_audited"
+ ]
}
}
},
- "v1.UpdateFeishuConfigurationReqV1": {
+ "v1.StatisticAuditPlanResV1": {
"type": "object",
- "required": [
- "app_id",
- "app_secret",
- "is_feishu_notification_enabled"
- ],
"properties": {
- "app_id": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "app_secret": {
- "type": "string"
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.DBTypeAuditPlan"
+ }
},
- "is_feishu_notification_enabled": {
- "type": "boolean"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.UpdateInstanceReqV1": {
+ "v1.StatisticRiskWorkflowResV1": {
"type": "object",
"properties": {
- "additional_params": {
+ "code": {
+ "type": "integer",
+ "example": 0
+ },
+ "data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.InstanceAdditionalParamReqV1"
+ "$ref": "#/definitions/v1.RiskWorkflow"
}
},
- "db_host": {
- "type": "string",
- "example": "10.10.10.10"
- },
- "db_password": {
- "type": "string",
- "example": "123456"
- },
- "db_port": {
- "type": "string",
- "example": "3306"
- },
- "db_type": {
+ "message": {
"type": "string",
- "example": "mysql"
+ "example": "ok"
+ }
+ }
+ },
+ "v1.StatisticsAuditedSQLResV1": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "db_user": {
- "type": "string",
- "example": "root"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.AuditedSQLCount"
},
- "desc": {
+ "message": {
"type": "string",
- "example": "this is a test instance"
+ "example": "ok"
},
- "maintenance_times": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.MaintenanceTimeReqV1"
- }
+ "risk_rate": {
+ "type": "integer"
+ }
+ }
+ },
+ "v1.SystemVariablesResV1": {
+ "type": "object",
+ "properties": {
+ "operation_record_expired_hours": {
+ "type": "integer"
},
- "rule_template_name": {
+ "url": {
"type": "string"
},
- "sql_query_config": {
- "type": "object",
- "$ref": "#/definitions/v1.SQLQueryConfigReqV1"
+ "workflow_expired_hours": {
+ "type": "integer"
+ }
+ }
+ },
+ "v1.Table": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
}
}
},
- "v1.UpdateMemberGroupReqV1": {
+ "v1.TableColumns": {
"type": "object",
"properties": {
- "roles": {
+ "head": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.TableMetaItemHeadResV1"
+ }
+ },
+ "rows": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.BindRoleReqV1"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
},
- "v1.UpdateMemberReqV1": {
+ "v1.TableIndexes": {
"type": "object",
"properties": {
- "is_manager": {
- "type": "boolean"
+ "head": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.TableMetaItemHeadResV1"
+ }
},
- "roles": {
+ "rows": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.BindRoleReqV1"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
},
- "v1.UpdateOtherUserPasswordReqV1": {
+ "v1.TableMeta": {
"type": "object",
"properties": {
- "password": {
+ "columns": {
+ "type": "object",
+ "$ref": "#/definitions/v1.TableColumns"
+ },
+ "create_table_sql": {
+ "type": "string"
+ },
+ "indexes": {
+ "type": "object",
+ "$ref": "#/definitions/v1.TableIndexes"
+ },
+ "message": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "schema": {
"type": "string"
}
}
},
- "v1.UpdateProjectReqV1": {
+ "v1.TableMetaItemHeadResV1": {
"type": "object",
"properties": {
"desc": {
"type": "string"
+ },
+ "field_name": {
+ "type": "string"
}
}
},
- "v1.UpdateProjectRuleTemplateReqV1": {
+ "v1.TableMetas": {
"type": "object",
"properties": {
- "desc": {
+ "err_message": {
"type": "string"
},
- "instance_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "example": [
- "mysql-xxx"
- ]
- },
- "rule_list": {
+ "table_meta_items": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.RuleReqV1"
+ "$ref": "#/definitions/v1.TableMeta"
}
}
}
},
- "v1.UpdateRoleReqV1": {
+ "v1.TestAuditPlanNotifyConfigResDataV1": {
"type": "object",
"properties": {
- "is_disabled": {
+ "is_notify_send_normal": {
"type": "boolean"
},
- "operation_code_list": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- },
- "role_desc": {
+ "send_error_message": {
"type": "string"
}
}
},
- "v1.UpdateRuleKnowledgeReq": {
+ "v1.TestAuditPlanNotifyConfigResV1": {
"type": "object",
"properties": {
- "knowledge_content": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
+ },
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.TestAuditPlanNotifyConfigResDataV1"
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.UpdateRuleTemplateReqV1": {
+ "v1.TestDingTalkConfigResDataV1": {
"type": "object",
"properties": {
- "desc": {
- "type": "string"
+ "is_ding_talk_send_normal": {
+ "type": "boolean"
},
- "rule_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.RuleReqV1"
- }
+ "send_error_message": {
+ "type": "string"
}
}
},
- "v1.UpdateSMTPConfigurationReqV1": {
+ "v1.TestDingTalkConfigResV1": {
"type": "object",
"properties": {
- "enable_smtp_notify": {
- "type": "boolean"
- },
- "is_skip_verify": {
- "type": "boolean"
- },
- "smtp_host": {
- "type": "string",
- "example": "smtp.email.qq.com"
- },
- "smtp_password": {
- "type": "string",
- "example": "123"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "smtp_port": {
- "type": "string",
- "example": "465"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.TestDingTalkConfigResDataV1"
},
- "smtp_username": {
+ "message": {
"type": "string",
- "example": "test@qq.com"
+ "example": "ok"
}
}
},
- "v1.UpdateSQLAuditRecordReqV1": {
+ "v1.TestFeishuConfigResDataV1": {
"type": "object",
"properties": {
- "tags": {
- "type": "array",
- "items": {
- "type": "string"
- }
+ "error_message": {
+ "type": "string"
+ },
+ "is_message_sent_normally": {
+ "type": "boolean"
}
}
},
- "v1.UpdateSyncInstanceTaskReqV1": {
+ "v1.TestFeishuConfigResV1": {
"type": "object",
"properties": {
- "global_rule_template": {
- "type": "string",
- "example": "default_mysql"
- },
- "sync_instance_interval": {
- "type": "string",
- "example": "0 0 * * *"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "url": {
- "type": "string",
- "example": "http://10.186.62.56:10000"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.TestFeishuConfigResDataV1"
},
- "version": {
+ "message": {
"type": "string",
- "example": "5.23.01.0"
+ "example": "ok"
}
}
},
- "v1.UpdateSystemVariablesReqV1": {
+ "v1.TestFeishuConfigurationReqV1": {
"type": "object",
"properties": {
- "operation_record_expired_hours": {
- "type": "integer",
- "example": 2160
+ "account": {
+ "type": "string"
},
- "url": {
+ "account_type": {
"type": "string",
- "example": "http://10.186.61.32:8080"
- },
- "workflow_expired_hours": {
- "type": "integer",
- "example": 720
+ "enum": [
+ "email",
+ "phone"
+ ]
}
}
},
- "v1.UpdateUserReqV1": {
+ "v1.TimeResV1": {
"type": "object",
"properties": {
- "email": {
- "type": "string"
- },
- "is_disabled": {
- "type": "boolean"
- },
- "management_permission_code_list": {
- "type": "array",
- "items": {
- "type": "integer"
- }
+ "hour": {
+ "type": "integer"
},
- "phone": {
- "type": "string"
+ "minute": {
+ "type": "integer"
+ }
+ }
+ },
+ "v1.TriggerAuditPlanResV1": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "user_group_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- }
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.AuditPlanReportResV1"
},
- "wechat_id": {
+ "message": {
"type": "string",
- "example": "UserID"
+ "example": "ok"
}
}
},
- "v1.UpdateWeChatConfigurationReqV1": {
+ "v1.UpdateAuditPlanNotifyConfigReqV1": {
"type": "object",
"properties": {
- "agent_id": {
- "type": "integer"
+ "enable_email_notify": {
+ "type": "boolean"
},
- "corp_id": {
- "type": "string"
+ "enable_web_hook_notify": {
+ "type": "boolean"
},
- "corp_secret": {
- "type": "string"
+ "notify_interval": {
+ "type": "integer",
+ "default": 10
},
- "enable_wechat_notify": {
- "type": "boolean"
+ "notify_level": {
+ "type": "string",
+ "default": "warn",
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ]
},
- "proxy_ip": {
+ "web_hook_template": {
"type": "string"
},
- "safe_enabled": {
- "type": "boolean"
+ "web_hook_url": {
+ "type": "string"
}
}
},
- "v1.UpdateWorkflowReqV1": {
+ "v1.UpdateAuditPlanReqV1": {
"type": "object",
"properties": {
- "task_ids": {
+ "audit_plan_cron": {
+ "type": "string",
+ "example": "0 */2 * * *"
+ },
+ "audit_plan_instance_database": {
+ "type": "string",
+ "example": "app1"
+ },
+ "audit_plan_instance_name": {
+ "type": "string",
+ "example": "test_mysql"
+ },
+ "audit_plan_params": {
"type": "array",
"items": {
- "type": "integer"
+ "$ref": "#/definitions/v1.AuditPlanParamReqV1"
}
+ },
+ "rule_template_name": {
+ "type": "string",
+ "example": "default_MySQL"
}
}
},
- "v1.UpdateWorkflowScheduleReqV1": {
+ "v1.UpdateAuditTaskSQLsReqV1": {
"type": "object",
"properties": {
- "schedule_time": {
+ "description": {
"type": "string"
}
}
},
- "v1.UpdateWorkflowTemplateReqV1": {
+ "v1.UpdateAuditWhitelistReqV1": {
"type": "object",
"properties": {
- "allow_submit_when_less_audit_level": {
- "type": "string",
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ]
- },
"desc": {
- "type": "string"
+ "type": "string",
+ "example": "used for rapid release"
},
- "instance_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- }
+ "match_type": {
+ "type": "string",
+ "enum": [
+ "exact_match",
+ "fp_match"
+ ],
+ "example": "exact_match"
},
- "workflow_step_template_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.WorkFlowStepTemplateReqV1"
- }
+ "value": {
+ "type": "string",
+ "example": "create table"
}
}
},
- "v1.UploadLogoResDataV1": {
+ "v1.UpdateCompanyNoticeReq": {
"type": "object",
"properties": {
- "logo_url": {
+ "notice_str": {
"type": "string"
}
}
},
- "v1.UploadLogoResV1": {
+ "v1.UpdateCustomRuleReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "annotation": {
+ "type": "string",
+ "example": "this is test rule"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.UploadLogoResDataV1"
+ "desc": {
+ "type": "string",
+ "example": "this is test rule"
},
- "message": {
+ "level": {
"type": "string",
- "example": "ok"
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ],
+ "example": "notice"
+ },
+ "rule_script": {
+ "type": "string"
+ },
+ "type": {
+ "type": "string",
+ "example": "DDL规则"
}
}
},
- "v1.UserBindProjectResV1": {
+ "v1.UpdateDingTalkConfigurationReqV1": {
"type": "object",
+ "required": [
+ "app_key",
+ "app_secret",
+ "is_enable_ding_talk_notify"
+ ],
"properties": {
- "is_manager": {
- "type": "boolean"
+ "app_key": {
+ "type": "string"
},
- "project_name": {
+ "app_secret": {
"type": "string"
+ },
+ "is_enable_ding_talk_notify": {
+ "type": "boolean"
}
}
},
- "v1.UserDetailResV1": {
+ "v1.UpdateFeishuConfigurationReqV1": {
"type": "object",
+ "required": [
+ "app_id",
+ "app_secret",
+ "is_feishu_notification_enabled"
+ ],
"properties": {
- "bind_projects": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.UserBindProjectResV1"
- }
- },
- "email": {
+ "app_id": {
"type": "string"
},
- "is_admin": {
- "type": "boolean"
- },
- "is_disabled": {
- "type": "boolean"
- },
- "login_type": {
+ "app_secret": {
"type": "string"
},
- "management_permission_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.ManagementPermissionResV1"
- }
- },
- "phone": {
+ "is_feishu_notification_enabled": {
+ "type": "boolean"
+ }
+ }
+ },
+ "v1.UpdateProjectRuleTemplateReqV1": {
+ "type": "object",
+ "properties": {
+ "desc": {
"type": "string"
},
- "user_group_name_list": {
+ "rule_list": {
"type": "array",
"items": {
- "type": "string"
+ "$ref": "#/definitions/v1.RuleReqV1"
}
- },
- "user_name": {
- "type": "string"
- },
- "wechat_id": {
- "type": "string"
}
}
},
- "v1.UserGroupListItemResV1": {
+ "v1.UpdateRuleKnowledgeReq": {
"type": "object",
"properties": {
- "is_disabled": {
- "type": "boolean"
- },
- "user_group_desc": {
- "type": "string"
- },
- "user_group_name": {
+ "knowledge_content": {
"type": "string"
- },
- "user_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- }
}
}
},
- "v1.UserGroupTipListItem": {
+ "v1.UpdateRuleTemplateReqV1": {
"type": "object",
"properties": {
- "user_group_name": {
+ "desc": {
"type": "string"
},
- "user_names": {
+ "rule_list": {
"type": "array",
"items": {
- "type": "string"
+ "$ref": "#/definitions/v1.RuleReqV1"
}
}
}
},
- "v1.UserLoginReqV1": {
+ "v1.UpdateSQLAuditRecordReqV1": {
"type": "object",
"properties": {
- "password": {
- "type": "string",
- "example": "123456"
- },
- "username": {
- "type": "string",
- "example": "test"
+ "tags": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
}
}
},
- "v1.UserLoginResV1": {
+ "v1.UpdateSystemVariablesReqV1": {
"type": "object",
"properties": {
- "token": {
+ "operation_record_expired_hours": {
+ "type": "integer",
+ "example": 2160
+ },
+ "url": {
"type": "string",
- "example": "this is a jwt token string"
+ "example": "http://10.186.61.32:8080"
+ },
+ "workflow_expired_hours": {
+ "type": "integer",
+ "example": 720
}
}
},
- "v1.UserResV1": {
+ "v1.UpdateWorkflowReqV1": {
"type": "object",
"properties": {
- "email": {
- "type": "string"
- },
- "is_disabled": {
- "type": "boolean"
- },
- "login_type": {
- "type": "string"
- },
- "management_permission_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.ManagementPermissionResV1"
- }
- },
- "phone": {
- "type": "string"
- },
- "user_group_name_list": {
+ "task_ids": {
"type": "array",
"items": {
- "type": "string"
+ "type": "integer"
}
- },
- "user_name": {
- "type": "string"
- },
- "wechat_id": {
- "type": "string"
}
}
},
- "v1.UserTipResV1": {
+ "v1.UpdateWorkflowScheduleReqV1": {
"type": "object",
"properties": {
- "user_name": {
+ "schedule_time": {
"type": "string"
}
}
},
- "v1.WeChatConfigurationResV1": {
+ "v1.UpdateWorkflowTemplateReqV1": {
"type": "object",
"properties": {
- "agent_id": {
- "type": "integer"
- },
- "corp_id": {
- "type": "string"
- },
- "enable_wechat_notify": {
- "type": "boolean"
+ "allow_submit_when_less_audit_level": {
+ "type": "string",
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ]
},
- "proxy_ip": {
+ "desc": {
"type": "string"
},
- "safe_enabled": {
- "type": "boolean"
+ "workflow_step_template_list": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.WorkFlowStepTemplateReqV1"
+ }
}
}
},
- "v1.WebHookConfigV1": {
+ "v1.UserTipResV1": {
"type": "object",
"properties": {
- "enable": {
- "type": "boolean"
- },
- "max_retry_times": {
- "type": "integer"
- },
- "retry_interval_seconds": {
- "type": "integer"
- },
- "token": {
+ "user_id": {
"type": "string"
},
- "url": {
+ "user_name": {
"type": "string"
}
}
@@ -16541,7 +11470,7 @@ var doc = `{
"approved_by_authorized": {
"type": "boolean"
},
- "assignee_user_name_list": {
+ "assignee_user_id_list": {
"type": "array",
"items": {
"type": "string"
@@ -16568,7 +11497,7 @@ var doc = `{
"approved_by_authorized": {
"type": "boolean"
},
- "assignee_user_name_list": {
+ "assignee_user_id_list": {
"type": "array",
"items": {
"type": "string"
@@ -16937,11 +11866,8 @@ var doc = `{
"desc": {
"type": "string"
},
- "instance_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- }
+ "update_time": {
+ "type": "string"
},
"workflow_step_template_list": {
"type": "array",
@@ -17166,6 +12092,9 @@ var doc = `{
},
"rollback_sql": {
"type": "string"
+ },
+ "sql_source_file": {
+ "type": "string"
}
}
},
@@ -17191,58 +12120,6 @@ var doc = `{
}
}
},
- "v2.CreateInstanceReqV2": {
- "type": "object",
- "properties": {
- "additional_params": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.InstanceAdditionalParamReqV1"
- }
- },
- "db_host": {
- "type": "string",
- "example": "10.10.10.10"
- },
- "db_password": {
- "type": "string",
- "example": "123456"
- },
- "db_port": {
- "type": "string",
- "example": "3306"
- },
- "db_type": {
- "type": "string",
- "example": "mysql"
- },
- "db_user": {
- "type": "string",
- "example": "root"
- },
- "desc": {
- "type": "string",
- "example": "this is a test instance"
- },
- "instance_name": {
- "type": "string",
- "example": "test"
- },
- "maintenance_times": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.MaintenanceTimeReqV1"
- }
- },
- "rule_template_name": {
- "type": "string"
- },
- "sql_query_config": {
- "type": "object",
- "$ref": "#/definitions/v1.SQLQueryConfigReqV1"
- }
- }
- },
"v2.CreateWorkflowReqV2": {
"type": "object",
"properties": {
@@ -17509,28 +12386,6 @@ var doc = `{
}
}
},
- "v2.GetInstancesResV2": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v2.InstanceResV2"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
- }
- }
- },
"v2.GetSqlManageListResp": {
"type": "object",
"properties": {
diff --git a/sqle/docs/swagger.json b/sqle/docs/swagger.json
index f0be473df1..8faa815a76 100644
--- a/sqle/docs/swagger.json
+++ b/sqle/docs/swagger.json
@@ -97,24 +97,6 @@
}
}
},
- "/v1/basic_info": {
- "get": {
- "description": "get sqle basic info",
- "tags": [
- "global"
- ],
- "summary": "获取 sqle 基本信息",
- "operationId": "getSQLEInfoV1",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetSQLEInfoResV1"
- }
- }
- }
- }
- },
"/v1/company_notice": {
"get": {
"security": [
@@ -283,101 +265,6 @@
}
}
},
- "/v1/configurations/feishu": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get feishu configuration",
- "tags": [
- "configuration"
- ],
- "summary": "获取飞书配置",
- "operationId": "getFeishuConfigurationV1",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetFeishuConfigurationResV1"
- }
- }
- }
- },
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "update feishu configuration",
- "consumes": [
- "application/json"
- ],
- "tags": [
- "configuration"
- ],
- "summary": "添加或更新飞书配置",
- "operationId": "updateFeishuConfigurationV1",
- "parameters": [
- {
- "description": "update feishu configuration req",
- "name": "param",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateFeishuConfigurationReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/configurations/feishu/test": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "test feishu configuration",
- "consumes": [
- "application/json"
- ],
- "tags": [
- "configuration"
- ],
- "summary": "测试飞书配置",
- "operationId": "testFeishuConfigV1",
- "parameters": [
- {
- "description": "test feishu configuration req",
- "name": "req",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.TestFeishuConfigurationReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.TestFeishuConfigResV1"
- }
- }
- }
- }
- },
"/v1/configurations/feishu_audit": {
"get": {
"security": [
@@ -473,64 +360,6 @@
}
}
},
- "/v1/configurations/ldap": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get LDAP configuration",
- "tags": [
- "configuration"
- ],
- "summary": "获取 LDAP 配置",
- "operationId": "getLDAPConfigurationV1",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetLDAPConfigurationResV1"
- }
- }
- }
- },
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "update LDAP configuration",
- "consumes": [
- "application/json"
- ],
- "tags": [
- "configuration"
- ],
- "summary": "添加 LDAP 配置",
- "operationId": "updateLDAPConfigurationV1",
- "parameters": [
- {
- "description": "update LDAP configuration req",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.LDAPConfigurationReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
"/v1/configurations/license": {
"get": {
"security": [
@@ -645,24 +474,24 @@
}
}
},
- "/v1/configurations/oauth2": {
+ "/v1/configurations/system_variables": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get Oauth2 configuration",
+ "description": "get system variables",
"tags": [
"configuration"
],
- "summary": "获取 Oauth2 配置",
- "operationId": "getOauth2ConfigurationV1",
+ "summary": "获取系统变量",
+ "operationId": "getSystemVariablesV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetOauth2ConfigurationResV1"
+ "$ref": "#/definitions/v1.GetSystemVariablesResV1"
}
}
}
@@ -673,23 +502,23 @@
"ApiKeyAuth": []
}
],
- "description": "update Oauth2 configuration",
+ "description": "update system variables",
"consumes": [
"application/json"
],
"tags": [
"configuration"
],
- "summary": "修改 Oauth2 配置",
- "operationId": "updateOauth2ConfigurationV1",
+ "summary": "修改系统变量",
+ "operationId": "updateSystemVariablesV1",
"parameters": [
{
- "description": "update Oauth2 configuration req",
- "name": "conf",
+ "description": "update system variables request",
+ "name": "instance",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.Oauth2ConfigurationReqV1"
+ "$ref": "#/definitions/v1.UpdateSystemVariablesReqV1"
}
}
],
@@ -703,45 +532,62 @@
}
}
},
- "/v1/configurations/oauth2/tips": {
+ "/v1/custom_rules": {
"get": {
- "description": "get Oauth2 tips",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get all custom rule template",
"tags": [
- "configuration"
+ "rule_template"
+ ],
+ "summary": "自定义规则列表",
+ "operationId": "getCustomRulesV1",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "filter db type",
+ "name": "filter_db_type",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter desc",
+ "name": "filter_desc",
+ "in": "query"
+ }
],
- "summary": "获取 Oauth2 基本信息",
- "operationId": "getOauth2Tips",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetOauth2TipsResV1"
+ "$ref": "#/definitions/v1.GetCustomRulesResV1"
}
}
}
- }
- },
- "/v1/configurations/personalise": {
- "patch": {
+ },
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update personalise config",
+ "description": "create custom rule",
"tags": [
- "configuration"
+ "rule_template"
],
- "summary": "更新个性化设置",
- "operationId": "personalise",
+ "summary": "添加自定义规则",
+ "operationId": "createCustomRuleV1",
"parameters": [
{
- "description": "personalise req",
- "name": "conf",
+ "description": "add custom rule",
+ "name": "instance",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.PersonaliseReqV1"
+ "$ref": "#/definitions/v1.CreateCustomRuleReqV1"
}
}
],
@@ -755,28 +601,25 @@
}
}
},
- "/v1/configurations/personalise/logo": {
- "post": {
+ "/v1/custom_rules/{db_type}/rule_types": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "upload logo",
- "consumes": [
- "multipart/form-data"
- ],
+ "description": "get rule type by db type",
"tags": [
- "configuration"
+ "rule_template"
],
- "summary": "上传Logo",
- "operationId": "uploadLogo",
+ "summary": "获取规则分类",
+ "operationId": "getRuleTypeByDBTypeV1",
"parameters": [
{
- "type": "file",
- "description": "logo file",
- "name": "logo",
- "in": "formData",
+ "type": "string",
+ "description": "db type",
+ "name": "db_type",
+ "in": "query",
"required": true
}
],
@@ -784,58 +627,62 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.UploadLogoResV1"
+ "$ref": "#/definitions/v1.GetRuleTypeByDBTypeResV1"
}
}
}
}
},
- "/v1/configurations/smtp": {
+ "/v1/custom_rules/{rule_id}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get SMTP configuration",
+ "description": "get custom rule by rule_id",
"tags": [
- "configuration"
+ "rule_template"
+ ],
+ "summary": "获取自定义规则",
+ "operationId": "getCustomRuleV1",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "rule id",
+ "name": "rule_id",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "获取 SMTP 配置",
- "operationId": "getSMTPConfigurationV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSMTPConfigurationResV1"
+ "$ref": "#/definitions/v1.GetCustomRuleResV1"
}
}
}
},
- "patch": {
+ "delete": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update SMTP configuration",
- "consumes": [
- "application/json"
- ],
+ "description": "delete custom rule",
"tags": [
- "configuration"
+ "rule_template"
],
- "summary": "添加 SMTP 配置",
- "operationId": "updateSMTPConfigurationV1",
+ "summary": "删除自定义规则",
+ "operationId": "deleteCustomRuleV1",
"parameters": [
{
- "description": "update SMTP configuration req",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateSMTPConfigurationReqV1"
- }
+ "type": "string",
+ "description": "rule id",
+ "name": "rule_id",
+ "in": "path",
+ "required": true
}
],
"responses": {
@@ -846,32 +693,34 @@
}
}
}
- }
- },
- "/v1/configurations/smtp/test": {
- "post": {
+ },
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "test SMTP configuration",
- "consumes": [
- "application/json"
- ],
+ "description": "update custom rule",
"tags": [
- "configuration"
+ "rule_template"
],
- "summary": "测试 邮箱 配置",
- "operationId": "testSMTPConfigurationV1",
+ "summary": "更新自定义规则",
+ "operationId": "updateCustomRuleV1",
"parameters": [
{
- "description": "test SMTP configuration req",
- "name": "req",
+ "type": "string",
+ "description": "rule id",
+ "name": "rule_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "update custom rule",
+ "name": "instance",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.TestSMTPConfigurationReqV1"
+ "$ref": "#/definitions/v1.UpdateCustomRuleReqV1"
}
}
],
@@ -879,216 +728,350 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.TestSMTPConfigurationResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/configurations/sql_query": {
+ "/v1/dashboard": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get sqle query configuration",
+ "description": "get dashboard info",
+ "produces": [
+ "application/json"
+ ],
"tags": [
- "configuration"
+ "dashboard"
+ ],
+ "summary": "获取 dashboard 信息",
+ "operationId": "getDashboardV1",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "filter project name",
+ "name": "filter_project_name",
+ "in": "query"
+ }
],
- "summary": "获取SQL查询配置信息",
- "operationId": "getSQLQueryConfiguration",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSQLQueryConfigurationResV1"
+ "$ref": "#/definitions/v1.GetDashboardResV1"
}
}
}
}
},
- "/v1/configurations/system_variables": {
+ "/v1/operation_records": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get system variables",
+ "description": "Get operation record list",
"tags": [
- "configuration"
+ "OperationRecord"
+ ],
+ "summary": "获取操作记录列表",
+ "operationId": "getOperationRecordListV1",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "filter_operate_time_from",
+ "name": "filter_operate_time_from",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_operate_time_to",
+ "name": "filter_operate_time_to",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_operate_project_name",
+ "name": "filter_operate_project_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "fuzzy_search_operate_user_name",
+ "name": "fuzzy_search_operate_user_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_operate_type_name",
+ "name": "filter_operate_type_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_operate_action",
+ "name": "filter_operate_action",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page_index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "page_size",
+ "name": "page_size",
+ "in": "query",
+ "required": true
+ }
],
- "summary": "获取系统变量",
- "operationId": "getSystemVariablesV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSystemVariablesResV1"
+ "$ref": "#/definitions/v1.GetOperationRecordListResV1"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v1/operation_records/exports": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update system variables",
- "consumes": [
- "application/json"
- ],
+ "description": "Export operation record list",
"tags": [
- "configuration"
+ "OperationRecord"
],
- "summary": "修改系统变量",
- "operationId": "updateSystemVariablesV1",
+ "summary": "导出操作记录列表",
+ "operationId": "getExportOperationRecordListV1",
"parameters": [
{
- "description": "update system variables request",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateSystemVariablesReqV1"
- }
+ "type": "string",
+ "description": "filter_operate_time_from",
+ "name": "filter_operate_time_from",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_operate_time_to",
+ "name": "filter_operate_time_to",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_operate_project_name",
+ "name": "filter_operate_project_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "fuzzy_search_operate_user_name",
+ "name": "fuzzy_search_operate_user_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_operate_type_name",
+ "name": "filter_operate_type_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_operate_action",
+ "name": "filter_operate_action",
+ "in": "query"
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "get export operation record list",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "type": "file"
}
}
}
}
},
- "/v1/configurations/webhook": {
+ "/v1/operation_records/operation_actions": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get workflow webhook config",
+ "description": "Get operation action list",
"tags": [
- "configuration"
+ "OperationRecord"
],
- "summary": "获取全局工单 WebHook 配置",
- "operationId": "getGlobalWorkflowWebHookConfig",
+ "summary": "获取操作内容列表",
+ "operationId": "getOperationActionList",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowWebHookConfigResV1"
+ "$ref": "#/definitions/v1.GetOperationActionListResV1"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v1/operation_records/operation_type_names": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update webhook config",
+ "description": "Get operation type name list",
"tags": [
- "configuration"
- ],
- "summary": "更新工单 WebHook 配置",
- "operationId": "updateGlobalWebHookConfig",
- "parameters": [
- {
- "description": "update webhook config",
- "name": "request",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.WebHookConfigV1"
- }
- }
+ "OperationRecord"
],
+ "summary": "获取操作类型名列表",
+ "operationId": "GetOperationTypeNameList",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetOperationTypeNamesListResV1"
}
}
}
}
},
- "/v1/configurations/webhook/test": {
- "post": {
+ "/v1/operations": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "test workflow webhook config",
+ "description": "get permission operations",
"tags": [
- "configuration"
+ "operation"
],
- "summary": "测试全局工单 WebHook 配置",
- "operationId": "testGlobalWorkflowWebHookConfig",
+ "summary": "获取权限动作列表",
+ "operationId": "GetOperationsV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.TestWorkflowWebHookConfigResV1"
+ "$ref": "#/definitions/v1.GetOperationsResV1"
}
}
}
}
},
- "/v1/configurations/wechat": {
+ "/v1/projects/{project_name}/audit_plans": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get WeChat configuration",
+ "description": "get audit plan info list",
"tags": [
- "configuration"
+ "audit_plan"
+ ],
+ "summary": "获取扫描任务信息列表",
+ "operationId": "getAuditPlansV1",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "filter audit plan db type",
+ "name": "filter_audit_plan_db_type",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "fuzzy search audit plan name",
+ "name": "fuzzy_search_audit_plan_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter audit plan type",
+ "name": "filter_audit_plan_type",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter audit plan instance name",
+ "name": "filter_audit_plan_instance_name",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "size of per page",
+ "name": "page_size",
+ "in": "query",
+ "required": true
+ }
],
- "summary": "获取 企业微信 配置",
- "operationId": "getWeChatConfigurationV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWeChatConfigurationResV1"
+ "$ref": "#/definitions/v1.GetAuditPlansResV1"
}
}
}
},
- "patch": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update WeChat configuration",
+ "description": "create audit plan",
"consumes": [
"application/json"
],
"tags": [
- "configuration"
+ "audit_plan"
],
- "summary": "添加 企业微信 配置",
- "operationId": "updateWeChatConfigurationV1",
+ "summary": "添加扫描任务",
+ "operationId": "createAuditPlanV1",
"parameters": [
{
- "description": "update WeChat configuration req",
- "name": "instance",
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "create audit plan",
+ "name": "audit_plan",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.UpdateWeChatConfigurationReqV1"
+ "$ref": "#/definitions/v1.CreateAuditPlanReqV1"
}
}
],
@@ -1102,99 +1085,115 @@
}
}
},
- "/v1/configurations/wechat/test": {
- "post": {
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "test WeChat configuration",
- "consumes": [
- "application/json"
- ],
+ "description": "get audit plan",
"tags": [
- "configuration"
+ "audit_plan"
],
- "summary": "测试 企业微信 配置",
- "operationId": "testWeChatConfigurationV1",
+ "summary": "获取指定扫描任务",
+ "operationId": "getAuditPlanV1",
"parameters": [
{
- "description": "test WeChat configuration req",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.TestWeChatConfigurationReqV1"
- }
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.TestWeChatConfigurationResV1"
+ "$ref": "#/definitions/v1.GetAuditPlanResV1"
}
}
}
- }
- },
- "/v1/custom_rules": {
- "get": {
+ },
+ "delete": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get all custom rule template",
+ "description": "delete audit plan",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "自定义规则列表",
- "operationId": "getCustomRulesV1",
+ "summary": "删除扫描任务",
+ "operationId": "deleteAuditPlanV1",
"parameters": [
{
"type": "string",
- "description": "filter db type",
- "name": "filter_db_type",
- "in": "query"
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
},
{
"type": "string",
- "description": "filter desc",
- "name": "filter_desc",
- "in": "query"
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetCustomRulesResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
},
- "post": {
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "create custom rule",
+ "description": "update audit plan",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "添加自定义规则",
- "operationId": "createCustomRuleV1",
+ "summary": "更新扫描任务",
+ "operationId": "updateAuditPlanV1",
"parameters": [
{
- "description": "add custom rule",
- "name": "instance",
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "update audit plan",
+ "name": "audit_plan",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.CreateCustomRuleReqV1"
+ "$ref": "#/definitions/v1.UpdateAuditPlanReqV1"
}
}
],
@@ -1208,25 +1207,32 @@
}
}
},
- "/v1/custom_rules/{db_type}/rule_types": {
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/notify_config": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get rule type by db type",
+ "description": "get audit plan notify config",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "获取规则分类",
- "operationId": "getRuleTypeByDBTypeV1",
+ "summary": "获取扫描任务消息推送设置",
+ "operationId": "getAuditPlanNotifyConfigV1",
"parameters": [
{
"type": "string",
- "description": "db type",
- "name": "db_type",
- "in": "query",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
"required": true
}
],
@@ -1234,60 +1240,83 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRuleTypeByDBTypeResV1"
+ "$ref": "#/definitions/v1.GetAuditPlanNotifyConfigResV1"
}
}
}
- }
- },
- "/v1/custom_rules/{rule_id}": {
- "get": {
+ },
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get custom rule by rule_id",
+ "description": "update audit plan notify config",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "获取自定义规则",
- "operationId": "getCustomRuleV1",
+ "summary": "更新扫描任务通知设置",
+ "operationId": "updateAuditPlanNotifyConfigV1",
"parameters": [
{
"type": "string",
- "description": "rule id",
- "name": "rule_id",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
"in": "path",
"required": true
+ },
+ {
+ "description": "update audit plan notify config",
+ "name": "config",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.UpdateAuditPlanNotifyConfigReqV1"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetCustomRuleResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
- },
- "delete": {
+ }
+ },
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/notify_config/test": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "delete custom rule",
+ "description": "Test audit task message push",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "删除自定义规则",
- "operationId": "deleteCustomRuleV1",
+ "summary": "测试扫描任务消息推送",
+ "operationId": "testAuditPlanNotifyConfigV1",
"parameters": [
{
"type": "string",
- "description": "rule id",
- "name": "rule_id",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
"in": "path",
"required": true
}
@@ -1296,267 +1325,359 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.TestAuditPlanNotifyConfigResV1"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update custom rule",
+ "description": "get audit plan report list",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "更新自定义规则",
- "operationId": "updateCustomRuleV1",
+ "summary": "获取指定扫描任务的报告列表",
+ "operationId": "getAuditPlanReportsV1",
"parameters": [
{
"type": "string",
- "description": "rule id",
- "name": "rule_id",
+ "description": "project name",
+ "name": "project_name",
"in": "path",
"required": true
},
{
- "description": "update custom rule",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateCustomRuleReqV1"
- }
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "page index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "size of per page",
+ "name": "page_size",
+ "in": "query",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetAuditPlanReportsResV1"
}
}
}
}
},
- "/v1/dashboard": {
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get dashboard info",
- "produces": [
- "application/json"
- ],
+ "description": "get audit plan report",
"tags": [
- "dashboard"
+ "audit_plan"
],
- "summary": "获取 dashboard 信息",
- "operationId": "getDashboardV1",
+ "summary": "获取指定扫描任务的SQL扫描记录统计信息",
+ "operationId": "getAuditPlanReportV1",
"parameters": [
{
"type": "string",
- "description": "filter project name",
- "name": "filter_project_name",
- "in": "query"
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetDashboardResV1"
- }
- }
- }
- }
- },
- "/v1/dashboard/project_tips": {
- "get": {
- "security": [
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
{
- "ApiKeyAuth": []
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan report id",
+ "name": "audit_plan_report_id",
+ "in": "path",
+ "required": true
}
],
- "description": "get dashboard project tips",
- "produces": [
- "application/json"
- ],
- "tags": [
- "dashboard"
- ],
- "summary": "获取dashboard项目提示列表",
- "operationId": "getDashboardProjectTipsV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetDashboardProjectTipsResV1"
+ "$ref": "#/definitions/v1.GetAuditPlanReportResV1"
}
}
}
}
},
- "/v1/instance_additional_metas": {
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/export": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get instance additional metas",
+ "description": "export audit plan report as csv",
"tags": [
- "instance"
+ "audit_plan"
+ ],
+ "summary": "以csv的形式导出扫描报告",
+ "operationId": "exportAuditPlanReportV1",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan report id",
+ "name": "audit_plan_report_id",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "获取实例的额外属性列表",
- "operationId": "getInstanceAdditionalMetas",
"responses": {
"200": {
- "description": "OK",
+ "description": "get export audit plan report",
"schema": {
- "$ref": "#/definitions/v1.GetInstanceAdditionalMetasResV1"
+ "type": "file"
}
}
}
}
},
- "/v1/instance_connection": {
- "post": {
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "test instance db connection 注:可直接提交创建实例接口的body,该接口的json 内容是创建实例的 json 的子集",
- "consumes": [
- "application/json"
- ],
+ "description": "get audit plan report SQLs",
"tags": [
- "instance"
+ "audit_plan"
],
- "summary": "实例连通性测试(实例提交前)",
- "operationId": "checkInstanceIsConnectableV1",
+ "summary": "获取指定扫描任务的SQL扫描详情",
+ "operationId": "getAuditPlanReportsSQLsV1",
"parameters": [
{
- "description": "instance info",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.GetInstanceConnectableReqV1"
- }
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan report id",
+ "name": "audit_plan_report_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "page index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "size of per page",
+ "name": "page_size",
+ "in": "query",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetInstanceConnectableResV1"
+ "$ref": "#/definitions/v1.GetAuditPlanReportSQLsResV1"
}
}
}
}
},
- "/v1/login": {
- "post": {
- "description": "user login",
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls/{number}/analysis": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get SQL explain and related table metadata for analysis",
"tags": [
- "user"
+ "audit_plan"
],
- "summary": "用户登录",
- "operationId": "loginV1",
+ "summary": "获取task相关的SQL执行计划和表元数据",
+ "operationId": "getTaskAnalysisData",
"parameters": [
{
- "description": "user login request",
- "name": "user",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UserLoginReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetUserLoginResV1"
- }
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan report id",
+ "name": "audit_plan_report_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "sql number",
+ "name": "number",
+ "in": "path",
+ "required": true
}
- }
- }
- },
- "/v1/logout": {
- "post": {
- "description": "user logout",
- "tags": [
- "user"
],
- "summary": "用户登出",
- "operationId": "logoutV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetAuditPlanAnalysisDataResV1"
}
}
}
}
},
- "/v1/management_permissions": {
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/sqls": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get platform management permissions",
+ "description": "get audit plan SQLs",
"tags": [
- "management_permission"
+ "audit_plan"
+ ],
+ "summary": "获取指定扫描任务的SQLs信息(不包括扫描结果)",
+ "operationId": "getAuditPlanSQLsV1",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "page index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "size of per page",
+ "name": "page_size",
+ "in": "query",
+ "required": true
+ }
],
- "summary": "获取平台管理权限列表",
- "operationId": "GetManagementPermissionsV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetManagementPermissionsResV1"
+ "$ref": "#/definitions/v1.GetAuditPlanSQLsResV1"
}
}
}
}
},
- "/v1/oauth2/link": {
- "get": {
- "description": "oauth2 link",
- "tags": [
- "oauth2"
- ],
- "summary": "oauth2通过此链接跳转到第三方登录网址",
- "operationId": "Oauth2Link"
- }
- },
- "/v1/oauth2/user/bind": {
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/sqls/full": {
"post": {
- "description": "bind Oauth2 user to sqle",
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "full sync audit plan SQLs",
"tags": [
- "oauth2"
+ "audit_plan"
],
- "summary": "绑定 Oauth2 和 sqle用户",
- "operationId": "bindOauth2User",
+ "summary": "全量同步SQL到扫描任务",
+ "operationId": "fullSyncAuditPlanSQLsV1",
+ "deprecated": true,
"parameters": [
{
- "description": "bind oauth2 user req",
- "name": "conf",
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "full sync audit plan SQLs request",
+ "name": "sqls",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.BindOauth2UserReqV1"
+ "$ref": "#/definitions/v1.FullSyncAuditPlanSQLsReqV1"
}
}
],
@@ -1564,276 +1685,131 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.BindOauth2UserResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/operation_records": {
- "get": {
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/sqls/partial": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Get operation record list",
+ "description": "partial sync audit plan SQLs",
"tags": [
- "OperationRecord"
+ "audit_plan"
],
- "summary": "获取操作记录列表",
- "operationId": "getOperationRecordListV1",
+ "summary": "增量同步SQL到扫描任务",
+ "operationId": "partialSyncAuditPlanSQLsV1",
+ "deprecated": true,
"parameters": [
{
"type": "string",
- "description": "filter_operate_time_from",
- "name": "filter_operate_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_operate_time_to",
- "name": "filter_operate_time_to",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_operate_project_name",
- "name": "filter_operate_project_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "fuzzy_search_operate_user_name",
- "name": "fuzzy_search_operate_user_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_operate_type_name",
- "name": "filter_operate_type_name",
- "in": "query"
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
},
{
"type": "string",
- "description": "filter_operate_action",
- "name": "filter_operate_action",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page_index",
- "name": "page_index",
- "in": "query",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
"required": true
},
{
- "type": "integer",
- "description": "page_size",
- "name": "page_size",
- "in": "query",
- "required": true
+ "description": "partial sync audit plan SQLs request",
+ "name": "sqls",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.PartialSyncAuditPlanSQLsReqV1"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetOperationRecordListResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/operation_records/exports": {
- "get": {
+ "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/trigger": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Export operation record list",
+ "description": "trigger audit plan",
"tags": [
- "OperationRecord"
+ "audit_plan"
],
- "summary": "导出操作记录列表",
- "operationId": "getExportOperationRecordListV1",
+ "summary": "触发扫描任务",
+ "operationId": "triggerAuditPlanV1",
"parameters": [
{
"type": "string",
- "description": "filter_operate_time_from",
- "name": "filter_operate_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_operate_time_to",
- "name": "filter_operate_time_to",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_operate_project_name",
- "name": "filter_operate_project_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "fuzzy_search_operate_user_name",
- "name": "fuzzy_search_operate_user_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_operate_type_name",
- "name": "filter_operate_type_name",
- "in": "query"
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
},
{
"type": "string",
- "description": "filter_operate_action",
- "name": "filter_operate_action",
- "in": "query"
- }
- ],
- "responses": {
- "200": {
- "description": "get export operation record list",
- "schema": {
- "type": "file"
- }
- }
- }
- }
- },
- "/v1/operation_records/operation_actions": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Get operation action list",
- "tags": [
- "OperationRecord"
- ],
- "summary": "获取操作内容列表",
- "operationId": "getOperationActionList",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetOperationActionListResV1"
- }
- }
- }
- }
- },
- "/v1/operation_records/operation_type_names": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Get operation type name list",
- "tags": [
- "OperationRecord"
- ],
- "summary": "获取操作类型名列表",
- "operationId": "GetOperationTypeNameList",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetOperationTypeNamesListResV1"
- }
- }
- }
- }
- },
- "/v1/operations": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
}
],
- "description": "get permission operations",
- "tags": [
- "operation"
- ],
- "summary": "获取权限动作列表",
- "operationId": "GetOperationsV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetOperationsResV1"
+ "$ref": "#/definitions/v1.TriggerAuditPlanResV1"
}
}
}
}
},
- "/v1/project_tips": {
+ "/v1/projects/{project_name}/audit_whitelist": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get project tip list",
+ "description": "get all whitelist",
"tags": [
- "project"
+ "audit_whitelist"
],
- "summary": "获取项目提示列表",
- "operationId": "getProjectTipsV1",
+ "summary": "获取Sql审核白名单",
+ "operationId": "getAuditWhitelistV1",
"parameters": [
{
- "enum": [
- "operation_record"
- ],
"type": "string",
- "description": "functional module",
- "name": "functional_module",
- "in": "query"
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetProjectTipsResV1"
- }
- }
- }
- }
- },
- "/v1/projects": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get project list",
- "tags": [
- "project"
- ],
- "summary": "获取项目列表",
- "operationId": "getProjectListV1",
- "parameters": [
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
{
- "type": "integer",
+ "type": "string",
"description": "page index",
"name": "page_index",
"in": "query",
"required": true
},
{
- "type": "integer",
- "default": 50,
- "description": "size of per page",
+ "type": "string",
+ "description": "page size",
"name": "page_size",
"in": "query",
"required": true
@@ -1843,7 +1819,7 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetProjectResV1"
+ "$ref": "#/definitions/v1.GetAuditWhitelistResV1"
}
}
}
@@ -1854,26 +1830,30 @@
"ApiKeyAuth": []
}
],
- "description": "create project",
+ "description": "create a sql whitelist",
"consumes": [
"application/json"
],
- "produces": [
- "application/json"
- ],
"tags": [
- "project"
+ "audit_whitelist"
],
- "summary": "创建项目",
- "operationId": "createProjectV1",
+ "summary": "添加SQL白名单",
+ "operationId": "createAuditWhitelistV1",
"parameters": [
{
- "description": "create project request",
- "name": "project",
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "add sql whitelist req",
+ "name": "instance",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.CreateProjectReqV1"
+ "$ref": "#/definitions/v1.CreateAuditWhitelistReqV1"
}
}
],
@@ -1887,19 +1867,19 @@
}
}
},
- "/v1/projects/{project_name}/": {
- "get": {
+ "/v1/projects/{project_name}/audit_whitelist/{audit_whitelist_id}/": {
+ "delete": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get project detail",
+ "description": "remove sql white",
"tags": [
- "project"
+ "audit_whitelist"
],
- "summary": "获取项目详情",
- "operationId": "getProjectDetailV1",
+ "summary": "删除SQL白名单信息",
+ "operationId": "deleteAuditWhitelistByIdV1",
"parameters": [
{
"type": "string",
@@ -1907,43 +1887,20 @@
"name": "project_name",
"in": "path",
"required": true
+ },
+ {
+ "type": "string",
+ "description": "audit whitelist id",
+ "name": "audit_whitelist_id",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetProjectDetailResV1"
- }
- }
- }
- },
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "delete project",
- "tags": [
- "project"
- ],
- "summary": "删除项目",
- "operationId": "deleteProjectV1",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
@@ -1954,18 +1911,15 @@
"ApiKeyAuth": []
}
],
- "description": "update project",
+ "description": "update sql whitelist by id",
"consumes": [
"application/json"
],
- "produces": [
- "application/json"
- ],
"tags": [
- "project"
+ "audit_whitelist"
],
- "summary": "更新项目",
- "operationId": "updateProjectV1",
+ "summary": "更新SQL白名单",
+ "operationId": "UpdateAuditWhitelistByIdV1",
"parameters": [
{
"type": "string",
@@ -1975,52 +1929,21 @@
"required": true
},
{
- "description": "create project request",
- "name": "project",
+ "type": "string",
+ "description": "sql audit whitelist id",
+ "name": "audit_whitelist_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "update sql whitelist req",
+ "name": "instance",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.UpdateProjectReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.UpdateAuditWhitelistReqV1"
}
}
- }
- }
- },
- "/v1/projects/{project_name}/archive": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "archive project",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "project"
- ],
- "summary": "归档项目",
- "operationId": "archiveProjectV1",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- }
],
"responses": {
"200": {
@@ -2032,19 +1955,19 @@
}
}
},
- "/v1/projects/{project_name}/audit_plans": {
+ "/v1/projects/{project_name}/instance_tips": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get audit plan info list",
+ "description": "get instance tip list",
"tags": [
- "audit_plan"
+ "instance"
],
- "summary": "获取扫描任务信息列表",
- "operationId": "getAuditPlansV1",
+ "summary": "获取实例提示列表",
+ "operationId": "getInstanceTipListV1",
"parameters": [
{
"type": "string",
@@ -2055,67 +1978,51 @@
},
{
"type": "string",
- "description": "filter audit plan db type",
- "name": "filter_audit_plan_db_type",
- "in": "query"
- },
- {
- "type": "string",
- "description": "fuzzy search audit plan name",
- "name": "fuzzy_search_audit_plan_name",
+ "description": "filter db type",
+ "name": "filter_db_type",
"in": "query"
},
{
"type": "string",
- "description": "filter audit plan type",
- "name": "filter_audit_plan_type",
+ "description": "filter workflow template id",
+ "name": "filter_workflow_template_id",
"in": "query"
},
{
+ "enum": [
+ "create_audit_plan",
+ "create_workflow",
+ "sql_manage"
+ ],
"type": "string",
- "description": "filter audit plan instance name",
- "name": "filter_audit_plan_instance_name",
+ "description": "functional module",
+ "name": "functional_module",
"in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetAuditPlansResV1"
+ "$ref": "#/definitions/v1.GetInstanceTipsResV1"
}
}
}
- },
+ }
+ },
+ "/v1/projects/{project_name}/instances/connections": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "create audit plan",
- "consumes": [
- "application/json"
- ],
+ "description": "batch test instance db connections",
"tags": [
- "audit_plan"
+ "instance"
],
- "summary": "添加扫描任务",
- "operationId": "createAuditPlanV1",
+ "summary": "批量测试实例连通性(实例提交后)",
+ "operationId": "batchCheckInstanceIsConnectableByName",
"parameters": [
{
"type": "string",
@@ -2125,12 +2032,12 @@
"required": true
},
{
- "description": "create audit plan",
- "name": "audit_plan",
+ "description": "instances",
+ "name": "instances",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.CreateAuditPlanReqV1"
+ "$ref": "#/definitions/v1.BatchCheckInstanceConnectionsReqV1"
}
}
],
@@ -2138,25 +2045,25 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.BatchGetInstanceConnectionsResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/": {
+ "/v1/projects/{project_name}/instances/{instance_name}/connection": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get audit plan",
+ "description": "test instance db connection",
"tags": [
- "audit_plan"
+ "instance"
],
- "summary": "获取指定扫描任务",
- "operationId": "getAuditPlanV1",
+ "summary": "实例连通性测试(实例提交后)",
+ "operationId": "checkInstanceIsConnectableByNameV1",
"parameters": [
{
"type": "string",
@@ -2167,8 +2074,8 @@
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
+ "description": "instance name",
+ "name": "instance_name",
"in": "path",
"required": true
}
@@ -2177,23 +2084,25 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetAuditPlanResV1"
+ "$ref": "#/definitions/v1.GetInstanceConnectableResV1"
}
}
}
- },
- "delete": {
+ }
+ },
+ "/v1/projects/{project_name}/instances/{instance_name}/rules": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "delete audit plan",
+ "description": "get instance all rule",
"tags": [
- "audit_plan"
+ "instance"
],
- "summary": "删除扫描任务",
- "operationId": "deleteAuditPlanV1",
+ "summary": "获取实例应用的规则列表",
+ "operationId": "getInstanceRuleListV1",
"parameters": [
{
"type": "string",
@@ -2204,8 +2113,8 @@
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
+ "description": "instance name",
+ "name": "instance_name",
"in": "path",
"required": true
}
@@ -2214,23 +2123,25 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetRulesResV1"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v1/projects/{project_name}/instances/{instance_name}/schemas": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update audit plan",
+ "description": "instance schema list",
"tags": [
- "audit_plan"
+ "instance"
],
- "summary": "更新扫描任务",
- "operationId": "updateAuditPlanV1",
+ "summary": "实例 Schema 列表",
+ "operationId": "getInstanceSchemasV1",
"parameters": [
{
"type": "string",
@@ -2241,44 +2152,35 @@
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
+ "description": "instance name",
+ "name": "instance_name",
"in": "path",
"required": true
- },
- {
- "description": "update audit plan",
- "name": "audit_plan",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateAuditPlanReqV1"
- }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetInstanceSchemaResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/notify_config": {
+ "/v1/projects/{project_name}/instances/{instance_name}/schemas/{schema_name}/tables": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get audit plan notify config",
+ "description": "list table by schema",
"tags": [
- "audit_plan"
+ "instance"
],
- "summary": "获取扫描任务消息推送设置",
- "operationId": "getAuditPlanNotifyConfigV1",
+ "summary": "获取数据库下的所有表",
+ "operationId": "listTableBySchema",
"parameters": [
{
"type": "string",
@@ -2289,8 +2191,15 @@
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
+ "description": "instance name",
+ "name": "instance_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "schema name",
+ "name": "schema_name",
"in": "path",
"required": true
}
@@ -2299,23 +2208,25 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetAuditPlanNotifyConfigResV1"
+ "$ref": "#/definitions/v1.ListTableBySchemaResV1"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v1/projects/{project_name}/instances/{instance_name}/schemas/{schema_name}/tables/{table_name}/metadata": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update audit plan notify config",
+ "description": "get table metadata",
"tags": [
- "audit_plan"
+ "instance"
],
- "summary": "更新扫描任务通知设置",
- "operationId": "updateAuditPlanNotifyConfigV1",
+ "summary": "获取表元数据",
+ "operationId": "getTableMetadata",
"parameters": [
{
"type": "string",
@@ -2326,44 +2237,49 @@
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
+ "description": "instance name",
+ "name": "instance_name",
"in": "path",
"required": true
},
{
- "description": "update audit plan notify config",
- "name": "config",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateAuditPlanNotifyConfigReqV1"
- }
+ "type": "string",
+ "description": "schema name",
+ "name": "schema_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "table name",
+ "name": "table_name",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetTableMetadataResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/notify_config/test": {
+ "/v1/projects/{project_name}/rule_template_tips": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Test audit task message push",
+ "description": "get rule template tips in project",
"tags": [
- "audit_plan"
+ "rule_template"
],
- "summary": "测试扫描任务消息推送",
- "operationId": "testAuditPlanNotifyConfigV1",
+ "summary": "获取项目规则模板提示",
+ "operationId": "getProjectRuleTemplateTipsV1",
"parameters": [
{
"type": "string",
@@ -2374,35 +2290,34 @@
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
- "in": "path",
- "required": true
+ "description": "filter db type",
+ "name": "filter_db_type",
+ "in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.TestAuditPlanNotifyConfigResV1"
+ "$ref": "#/definitions/v1.GetRuleTemplateTipsResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports": {
+ "/v1/projects/{project_name}/rule_templates": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get audit plan report list",
+ "description": "get all rule template in a project",
"tags": [
- "audit_plan"
+ "rule_template"
],
- "summary": "获取指定扫描任务的报告列表",
- "operationId": "getAuditPlanReportsV1",
+ "summary": "项目规则模板列表",
+ "operationId": "getProjectRuleTemplateListV1",
"parameters": [
{
"type": "string",
@@ -2411,13 +2326,6 @@
"in": "path",
"required": true
},
- {
- "type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
- "in": "path",
- "required": true
- },
{
"type": "integer",
"description": "page index",
@@ -2437,25 +2345,26 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetAuditPlanReportsResV1"
+ "$ref": "#/definitions/v1.GetProjectRuleTemplatesResV1"
}
}
}
- }
- },
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/": {
- "get": {
+ },
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get audit plan report",
+ "description": "create a rule template in project",
+ "consumes": [
+ "application/json"
+ ],
"tags": [
- "audit_plan"
+ "rule_template"
],
- "summary": "获取指定扫描任务的SQL扫描记录统计信息",
- "operationId": "getAuditPlanReportV1",
+ "summary": "添加项目规则模板",
+ "operationId": "createProjectRuleTemplateV1",
"parameters": [
{
"type": "string",
@@ -2465,43 +2374,38 @@
"required": true
},
{
- "type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "audit plan report id",
- "name": "audit_plan_report_id",
- "in": "path",
- "required": true
+ "description": "add rule template request",
+ "name": "req",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.CreateProjectRuleTemplateReqV1"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetAuditPlanReportResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/export": {
+ "/v1/projects/{project_name}/rule_templates/{rule_template_name}/": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "export audit plan report as csv",
+ "description": "get rule template detail in project",
"tags": [
- "audit_plan"
+ "rule_template"
],
- "summary": "以csv的形式导出扫描报告",
- "operationId": "exportAuditPlanReportV1",
+ "summary": "获取项目规则模板信息",
+ "operationId": "getProjectRuleTemplateV1",
"parameters": [
{
"type": "string",
@@ -2512,42 +2416,39 @@
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
+ "description": "rule template name",
+ "name": "rule_template_name",
"in": "path",
"required": true
},
{
"type": "string",
- "description": "audit plan report id",
- "name": "audit_plan_report_id",
- "in": "path",
- "required": true
+ "description": "fuzzy rule,keyword for desc and annotation",
+ "name": "fuzzy_keyword_rule",
+ "in": "query"
}
],
"responses": {
"200": {
- "description": "get export audit plan report",
+ "description": "OK",
"schema": {
- "type": "file"
+ "$ref": "#/definitions/v1.GetProjectRuleTemplateResV1"
}
}
}
- }
- },
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls": {
- "get": {
+ },
+ "delete": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get audit plan report SQLs",
+ "description": "delete rule template in project",
"tags": [
- "audit_plan"
+ "rule_template"
],
- "summary": "获取指定扫描任务的SQL扫描详情",
- "operationId": "getAuditPlanReportsSQLsV1",
+ "summary": "删除项目规则模板",
+ "operationId": "deleteProjectRuleTemplateV1",
"parameters": [
{
"type": "string",
@@ -2558,56 +2459,33 @@
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "audit plan report id",
- "name": "audit_plan_report_id",
+ "description": "rule template name",
+ "name": "rule_template_name",
"in": "path",
"required": true
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetAuditPlanReportSQLsResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
- }
- },
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls/{number}/analysis": {
- "get": {
+ },
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get SQL explain and related table metadata for analysis",
+ "description": "update rule template in project",
"tags": [
- "audit_plan"
+ "rule_template"
],
- "summary": "获取task相关的SQL执行计划和表元数据",
- "operationId": "getTaskAnalysisData",
+ "summary": "更新项目规则模板",
+ "operationId": "updateProjectRuleTemplateV1",
"parameters": [
{
"type": "string",
@@ -2618,49 +2496,47 @@
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "audit plan report id",
- "name": "audit_plan_report_id",
+ "description": "rule template name",
+ "name": "rule_template_name",
"in": "path",
"required": true
},
{
- "type": "string",
- "description": "sql number",
- "name": "number",
- "in": "path",
- "required": true
+ "description": "update rule template request",
+ "name": "req",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.UpdateProjectRuleTemplateReqV1"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetAuditPlanAnalysisDataResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/sqls": {
- "get": {
+ "/v1/projects/{project_name}/rule_templates/{rule_template_name}/clone": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get audit plan SQLs",
+ "description": "clone a rule template in project",
+ "consumes": [
+ "application/json"
+ ],
"tags": [
- "audit_plan"
+ "rule_template"
],
- "summary": "获取指定扫描任务的SQLs信息(不包括扫描结果)",
- "operationId": "getAuditPlanSQLsV1",
+ "summary": "克隆项目规则模板",
+ "operationId": "cloneProjectRuleTemplateV1",
"parameters": [
{
"type": "string",
@@ -2671,50 +2547,44 @@
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
+ "description": "rule template name",
+ "name": "rule_template_name",
"in": "path",
"required": true
},
{
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
+ "description": "clone rule template request",
+ "name": "req",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.CloneProjectRuleTemplateReqV1"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetAuditPlanSQLsResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/sqls/full": {
- "post": {
+ "/v1/projects/{project_name}/rule_templates/{rule_template_name}/export": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "full sync audit plan SQLs",
+ "description": "export rule template in a project",
"tags": [
- "audit_plan"
+ "rule_template"
],
- "summary": "全量同步SQL到扫描任务",
- "operationId": "fullSyncAuditPlanSQLsV1",
- "deprecated": true,
+ "summary": "导出项目规则模板",
+ "operationId": "exportProjectRuleTemplateV1",
"parameters": [
{
"type": "string",
@@ -2725,105 +2595,94 @@
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
+ "description": "rule template name",
+ "name": "rule_template_name",
"in": "path",
"required": true
- },
- {
- "description": "full sync audit plan SQLs request",
- "name": "sqls",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.FullSyncAuditPlanSQLsReqV1"
- }
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "sqle rule template file",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "type": "file"
}
}
}
}
},
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/sqls/partial": {
- "post": {
+ "/v1/projects/{project_name}/sql_audit_records": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "partial sync audit plan SQLs",
+ "description": "get sql audit records",
"tags": [
- "audit_plan"
+ "sql_audit_record"
],
- "summary": "增量同步SQL到扫描任务",
- "operationId": "partialSyncAuditPlanSQLsV1",
- "deprecated": true,
+ "summary": "获取SQL审核记录列表",
+ "operationId": "getSQLAuditRecordsV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "fuzzy search tags",
+ "name": "fuzzy_search_tags",
+ "in": "query"
},
{
+ "enum": [
+ "auditing",
+ "successfully"
+ ],
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
- "in": "path",
- "required": true
+ "description": "filter sql audit status",
+ "name": "filter_sql_audit_status",
+ "in": "query"
},
{
- "description": "partial sync audit plan SQLs request",
- "name": "sqls",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.PartialSyncAuditPlanSQLsReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/projects/{project_name}/audit_plans/{audit_plan_name}/trigger": {
- "post": {
- "security": [
+ "type": "integer",
+ "description": "filter instance id",
+ "name": "filter_instance_id",
+ "in": "query"
+ },
{
- "ApiKeyAuth": []
- }
- ],
- "description": "trigger audit plan",
- "tags": [
- "audit_plan"
- ],
- "summary": "触发扫描任务",
- "operationId": "triggerAuditPlanV1",
- "parameters": [
+ "type": "string",
+ "description": "filter create time from",
+ "name": "filter_create_time_from",
+ "in": "query"
+ },
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
+ "description": "filter create time to",
+ "name": "filter_create_time_to",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter sql audit record ids",
+ "name": "filter_sql_audit_record_ids",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "size of per page",
+ "name": "page_size",
+ "in": "query",
"required": true
},
{
"type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
+ "description": "project name",
+ "name": "project_name",
"in": "path",
"required": true
}
@@ -2832,25 +2691,29 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.TriggerAuditPlanResV1"
+ "$ref": "#/definitions/v1.GetSQLAuditRecordsResV1"
}
}
}
- }
- },
- "/v1/projects/{project_name}/audit_whitelist": {
- "get": {
+ },
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get all whitelist",
+ "description": "SQL audit\n1. formData[sql]: sql content;\n2. file[input_sql_file]: it is a sql file;\n3. file[input_mybatis_xml_file]: it is mybatis xml file, sql will be parsed from it.\n4. file[input_zip_file]: it is ZIP file that sql will be parsed from xml or sql file inside it.\n5. formData[git_http_url]:the url which scheme is http(s) and end with .git.\n6. formData[git_user_name]:The name of the user who owns the repository read access.\n7. formData[git_user_password]:The password corresponding to git_user_name.",
+ "consumes": [
+ "multipart/form-data"
+ ],
+ "produces": [
+ "application/json"
+ ],
"tags": [
- "audit_whitelist"
+ "sql_audit_record"
],
- "summary": "获取Sql审核白名单",
- "operationId": "getAuditWhitelistV1",
+ "summary": "SQL审核",
+ "operationId": "CreateSQLAuditRecordV1",
"parameters": [
{
"type": "string",
@@ -2861,43 +2724,88 @@
},
{
"type": "string",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
+ "description": "instance name",
+ "name": "instance_name",
+ "in": "formData"
},
{
"type": "string",
- "description": "page size",
- "name": "page_size",
- "in": "query",
- "required": true
+ "description": "schema of instance",
+ "name": "instance_schema",
+ "in": "formData"
+ },
+ {
+ "type": "string",
+ "description": "db type of instance",
+ "name": "db_type",
+ "in": "formData"
+ },
+ {
+ "type": "string",
+ "description": "sqls for audit",
+ "name": "sqls",
+ "in": "formData"
+ },
+ {
+ "type": "file",
+ "description": "input SQL file",
+ "name": "input_sql_file",
+ "in": "formData"
+ },
+ {
+ "type": "file",
+ "description": "input mybatis XML file",
+ "name": "input_mybatis_xml_file",
+ "in": "formData"
+ },
+ {
+ "type": "file",
+ "description": "input ZIP file",
+ "name": "input_zip_file",
+ "in": "formData"
+ },
+ {
+ "type": "string",
+ "description": "git repository url",
+ "name": "git_http_url",
+ "in": "formData"
+ },
+ {
+ "type": "string",
+ "description": "the name of user to clone the repository",
+ "name": "git_user_name",
+ "in": "formData"
+ },
+ {
+ "type": "string",
+ "description": "the password corresponding to git_user_name",
+ "name": "git_user_password",
+ "in": "formData"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetAuditWhitelistResV1"
+ "$ref": "#/definitions/v1.CreateSQLAuditRecordResV1"
}
}
}
- },
- "post": {
+ }
+ },
+ "/v1/projects/{project_name}/sql_audit_records/tag_tips": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "create a sql whitelist",
- "consumes": [
- "application/json"
- ],
+ "description": "get sql audit record tag tips",
"tags": [
- "audit_whitelist"
+ "sql_audit_record"
],
- "summary": "添加SQL白名单",
- "operationId": "createAuditWhitelistV1",
+ "summary": "获取SQL审核记录标签列表",
+ "operationId": "GetSQLAuditRecordTagTipsV1",
"parameters": [
{
"type": "string",
@@ -2905,40 +2813,31 @@
"name": "project_name",
"in": "path",
"required": true
- },
- {
- "description": "add sql whitelist req",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.CreateAuditWhitelistReqV1"
- }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetSQLAuditRecordTagTipsResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/audit_whitelist/{audit_whitelist_id}/": {
- "delete": {
+ "/v1/projects/{project_name}/sql_audit_records/{sql_audit_record_id}/": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "remove sql white",
+ "description": "get sql audit record info",
"tags": [
- "audit_whitelist"
+ "sql_audit_record"
],
- "summary": "删除SQL白名单信息",
- "operationId": "deleteAuditWhitelistByIdV1",
+ "summary": "获取SQL审核记录信息",
+ "operationId": "getSQLAuditRecordV1",
"parameters": [
{
"type": "string",
@@ -2949,8 +2848,8 @@
},
{
"type": "string",
- "description": "audit whitelist id",
- "name": "audit_whitelist_id",
+ "description": "sql audit record id",
+ "name": "sql_audit_record_id",
"in": "path",
"required": true
}
@@ -2959,7 +2858,7 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetSQLAuditRecordResV1"
}
}
}
@@ -2970,15 +2869,15 @@
"ApiKeyAuth": []
}
],
- "description": "update sql whitelist by id",
+ "description": "update SQL audit record",
"consumes": [
"application/json"
],
"tags": [
- "audit_whitelist"
+ "sql_audit_record"
],
- "summary": "更新SQL白名单",
- "operationId": "UpdateAuditWhitelistByIdV1",
+ "summary": "更新SQL审核记录",
+ "operationId": "updateSQLAuditRecordV1",
"parameters": [
{
"type": "string",
@@ -2989,18 +2888,18 @@
},
{
"type": "string",
- "description": "sql audit whitelist id",
- "name": "audit_whitelist_id",
+ "description": "sql audit record id",
+ "name": "sql_audit_record_id",
"in": "path",
"required": true
},
{
- "description": "update sql whitelist req",
- "name": "instance",
+ "description": "update SQL audit record",
+ "name": "param",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.UpdateAuditWhitelistReqV1"
+ "$ref": "#/definitions/v1.UpdateSQLAuditRecordReqV1"
}
}
],
@@ -3014,19 +2913,20 @@
}
}
},
- "/v1/projects/{project_name}/instance_tips": {
+ "/v1/projects/{project_name}/sql_manages": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get instance tip list",
+ "description": "get sql manage list",
"tags": [
- "instance"
+ "SqlManage"
],
- "summary": "获取实例提示列表",
- "operationId": "getInstanceTipListV1",
+ "summary": "获取管控sql列表",
+ "operationId": "GetSqlManageList",
+ "deprecated": true,
"parameters": [
{
"type": "string",
@@ -3037,93 +2937,111 @@
},
{
"type": "string",
- "description": "filter db type",
- "name": "filter_db_type",
+ "description": "fuzzy search sql fingerprint",
+ "name": "fuzzy_search_sql_fingerprint",
"in": "query"
},
{
"type": "string",
- "description": "filter workflow template id",
- "name": "filter_workflow_template_id",
+ "description": "assignee",
+ "name": "filter_assignee",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "instance name",
+ "name": "filter_instance_name",
"in": "query"
},
{
"enum": [
- "create_audit_plan",
- "create_workflow",
- "sql_manage"
+ "audit_plan",
+ "sql_audit_record"
],
"type": "string",
- "description": "functional module",
- "name": "functional_module",
+ "description": "source",
+ "name": "filter_source",
"in": "query"
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetInstanceTipsResV1"
- }
- }
- }
- }
- },
- "/v1/projects/{project_name}/instances": {
- "get": {
- "security": [
+ },
{
- "ApiKeyAuth": []
- }
- ],
- "description": "get instance info list",
- "tags": [
- "instance"
- ],
- "summary": "获取实例信息列表",
- "operationId": "getInstanceListV1",
- "parameters": [
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ],
+ "type": "string",
+ "description": "audit level",
+ "name": "filter_audit_level",
+ "in": "query"
+ },
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "last audit start time from",
+ "name": "filter_last_audit_start_time_from",
+ "in": "query"
},
{
"type": "string",
- "description": "filter instance name",
- "name": "filter_instance_name",
+ "description": "last audit start time to",
+ "name": "filter_last_audit_start_time_to",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "unhandled",
+ "solved",
+ "ignored",
+ "manual_audited"
+ ],
+ "type": "string",
+ "description": "status",
+ "name": "filter_status",
"in": "query"
},
{
"type": "string",
- "description": "filter db type",
+ "description": "rule name",
+ "name": "filter_rule_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "db type",
"name": "filter_db_type",
"in": "query"
},
{
"type": "string",
- "description": "filter db host",
- "name": "filter_db_host",
+ "description": "fuzzy search endpoint",
+ "name": "fuzzy_search_endpoint",
"in": "query"
},
{
"type": "string",
- "description": "filter db port",
- "name": "filter_db_port",
+ "description": "fuzzy search schema name",
+ "name": "fuzzy_search_schema_name",
"in": "query"
},
{
+ "enum": [
+ "first_appear_timestamp",
+ "last_receive_timestamp",
+ "fp_count"
+ ],
"type": "string",
- "description": "filter db user",
- "name": "filter_db_user",
+ "description": "sort field",
+ "name": "sort_field",
"in": "query"
},
{
+ "enum": [
+ "asc",
+ "desc"
+ ],
"type": "string",
- "description": "filter rule template name",
- "name": "filter_rule_template_name",
+ "description": "sort order",
+ "name": "sort_order",
"in": "query"
},
{
@@ -3145,27 +3063,25 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetInstancesResV1"
+ "$ref": "#/definitions/v1.GetSqlManageListResp"
}
}
}
- },
- "post": {
+ }
+ },
+ "/v1/projects/{project_name}/sql_manages/batch": {
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "create a instance",
- "consumes": [
- "application/json"
- ],
+ "description": "batch update sql manage",
"tags": [
- "instance"
+ "SqlManage"
],
- "summary": "添加实例",
- "operationId": "createInstanceV1",
- "deprecated": true,
+ "summary": "批量更新SQL管控",
+ "operationId": "BatchUpdateSqlManage",
"parameters": [
{
"type": "string",
@@ -3175,12 +3091,12 @@
"required": true
},
{
- "description": "add instance",
- "name": "instance",
+ "description": "batch update sql manage request",
+ "name": "BatchUpdateSqlManageReq",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.CreateInstanceReqV1"
+ "$ref": "#/definitions/v1.BatchUpdateSqlManageReq"
}
}
],
@@ -3194,19 +3110,19 @@
}
}
},
- "/v1/projects/{project_name}/instances/connections": {
- "post": {
+ "/v1/projects/{project_name}/sql_manages/exports": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "batch test instance db connections",
+ "description": "export sql manage",
"tags": [
- "instance"
+ "SqlManage"
],
- "summary": "批量测试实例连通性(实例提交后)",
- "operationId": "batchCheckInstanceIsConnectableByName",
+ "summary": "导出SQL管控",
+ "operationId": "exportSqlManageV1",
"parameters": [
{
"type": "string",
@@ -3216,160 +3132,138 @@
"required": true
},
{
- "description": "instances",
- "name": "instances",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.BatchCheckInstanceConnectionsReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.BatchGetInstanceConnectionsResV1"
- }
- }
- }
- }
- },
- "/v1/projects/{project_name}/instances/{instance_name}/": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get instance db",
- "tags": [
- "instance"
- ],
- "summary": "获取实例信息",
- "operationId": "getInstanceV1",
- "parameters": [
+ "type": "string",
+ "description": "fuzzy search sql fingerprint",
+ "name": "fuzzy_search_sql_fingerprint",
+ "in": "query"
+ },
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "assignee",
+ "name": "filter_assignee",
+ "in": "query"
},
{
"type": "string",
"description": "instance name",
- "name": "instance_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetInstanceResV1"
- }
- }
- }
- },
- "delete": {
- "security": [
+ "name": "filter_instance_name",
+ "in": "query"
+ },
{
- "ApiKeyAuth": []
- }
- ],
- "description": "delete instance db",
- "tags": [
- "instance"
- ],
- "summary": "删除实例",
- "operationId": "deleteInstanceV1",
- "parameters": [
+ "enum": [
+ "audit_plan",
+ "sql_audit_record"
+ ],
+ "type": "string",
+ "description": "source",
+ "name": "filter_source",
+ "in": "query"
+ },
{
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ],
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "audit level",
+ "name": "filter_audit_level",
+ "in": "query"
},
{
"type": "string",
- "description": "instance name",
- "name": "instance_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- },
- "patch": {
- "security": [
+ "description": "last audit start time from",
+ "name": "filter_last_audit_start_time_from",
+ "in": "query"
+ },
{
- "ApiKeyAuth": []
- }
- ],
- "description": "update instance",
- "tags": [
- "instance"
- ],
- "summary": "更新实例",
- "operationId": "updateInstanceV1",
- "parameters": [
+ "type": "string",
+ "description": "last audit start time to",
+ "name": "filter_last_audit_start_time_to",
+ "in": "query"
+ },
{
+ "enum": [
+ "unhandled",
+ "solved",
+ "ignored",
+ "manual_audited"
+ ],
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "status",
+ "name": "filter_status",
+ "in": "query"
},
{
"type": "string",
- "description": "instance name",
- "name": "instance_name",
- "in": "path",
- "required": true
+ "description": "db type",
+ "name": "filter_db_type",
+ "in": "query"
},
{
- "description": "update instance request",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateInstanceReqV1"
- }
+ "type": "string",
+ "description": "rule name",
+ "name": "filter_rule_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "fuzzy search endpoint",
+ "name": "fuzzy_search_endpoint",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "fuzzy search schema name",
+ "name": "fuzzy_search_schema_name",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "first_appear_timestamp",
+ "last_receive_timestamp",
+ "fp_count"
+ ],
+ "type": "string",
+ "description": "sort field",
+ "name": "sort_field",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "asc",
+ "desc"
+ ],
+ "type": "string",
+ "description": "sort order",
+ "name": "sort_order",
+ "in": "query"
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "export sql manage",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "type": "file"
}
}
}
}
},
- "/v1/projects/{project_name}/instances/{instance_name}/connection": {
+ "/v1/projects/{project_name}/sql_manages/rule_tips": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "test instance db connection",
+ "description": "get sql manage rule tips",
"tags": [
- "instance"
+ "SqlManage"
],
- "summary": "实例连通性测试(实例提交后)",
- "operationId": "checkInstanceIsConnectableByNameV1",
+ "summary": "获取管控规则tips",
+ "operationId": "GetSqlManageRuleTips",
"parameters": [
{
"type": "string",
@@ -3377,38 +3271,31 @@
"name": "project_name",
"in": "path",
"required": true
- },
- {
- "type": "string",
- "description": "instance name",
- "name": "instance_name",
- "in": "path",
- "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetInstanceConnectableResV1"
+ "$ref": "#/definitions/v1.GetSqlManageRuleTipsResp"
}
}
}
}
},
- "/v1/projects/{project_name}/instances/{instance_name}/rules": {
+ "/v1/projects/{project_name}/sql_manages/{sql_manage_id}/sql_analysis": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get instance all rule",
+ "description": "get sql manage analysis",
"tags": [
- "instance"
+ "SqlManage"
],
- "summary": "获取实例应用的规则列表",
- "operationId": "getInstanceRuleListV1",
+ "summary": "获取SQL管控SQL分析",
+ "operationId": "GetSqlManageSqlAnalysisV1",
"parameters": [
{
"type": "string",
@@ -3419,8 +3306,8 @@
},
{
"type": "string",
- "description": "instance name",
- "name": "instance_name",
+ "description": "sql manage id",
+ "name": "sql_manage_id",
"in": "path",
"required": true
}
@@ -3429,25 +3316,25 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRulesResV1"
+ "$ref": "#/definitions/v1.GetSqlManageSqlAnalysisResp"
}
}
}
}
},
- "/v1/projects/{project_name}/instances/{instance_name}/schemas": {
+ "/v1/projects/{project_name}/statistic/audit_plans": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "instance schema list",
+ "description": "statistic audit plan",
"tags": [
- "instance"
+ "statistic"
],
- "summary": "实例 Schema 列表",
- "operationId": "getInstanceSchemasV1",
+ "summary": "获取各类型数据源上的扫描任务数量",
+ "operationId": "statisticAuditPlanV1",
"parameters": [
{
"type": "string",
@@ -3455,38 +3342,31 @@
"name": "project_name",
"in": "path",
"required": true
- },
- {
- "type": "string",
- "description": "instance name",
- "name": "instance_name",
- "in": "path",
- "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetInstanceSchemaResV1"
+ "$ref": "#/definitions/v1.StatisticAuditPlanResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/instances/{instance_name}/schemas/{schema_name}/tables": {
+ "/v1/projects/{project_name}/statistic/audited_sqls": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "list table by schema",
+ "description": "statistics audited sql",
"tags": [
- "instance"
+ "statistic"
],
- "summary": "获取数据库下的所有表",
- "operationId": "listTableBySchema",
+ "summary": "获取审核SQL总数,以及触发审核规则的SQL数量",
+ "operationId": "statisticsAuditedSQLV1",
"parameters": [
{
"type": "string",
@@ -3494,45 +3374,31 @@
"name": "project_name",
"in": "path",
"required": true
- },
- {
- "type": "string",
- "description": "instance name",
- "name": "instance_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "schema name",
- "name": "schema_name",
- "in": "path",
- "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.ListTableBySchemaResV1"
+ "$ref": "#/definitions/v1.StatisticsAuditedSQLResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/instances/{instance_name}/schemas/{schema_name}/tables/{table_name}/metadata": {
+ "/v1/projects/{project_name}/statistic/instance_health": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get table metadata",
+ "description": "get instance health",
"tags": [
- "instance"
+ "statistic"
],
- "summary": "获取表元数据",
- "operationId": "getTableMetadata",
+ "summary": "获取各类型数据源的健康情况",
+ "operationId": "GetInstanceHealthV1",
"parameters": [
{
"type": "string",
@@ -3540,79 +3406,32 @@
"name": "project_name",
"in": "path",
"required": true
- },
- {
- "type": "string",
- "description": "instance name",
- "name": "instance_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "schema name",
- "name": "schema_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "table name",
- "name": "table_name",
- "in": "path",
- "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetTableMetadataResV1"
+ "$ref": "#/definitions/v1.GetInstanceHealthResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/member_groups": {
+ "/v1/projects/{project_name}/statistic/project_score": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get member groups",
+ "description": "get project score",
"tags": [
- "user_group"
+ "statistic"
],
- "summary": "获取成员组列表",
- "operationId": "getMemberGroupsV1",
+ "summary": "获取项目分数",
+ "operationId": "GetProjectScoreV1",
"parameters": [
- {
- "type": "string",
- "description": "filter user group name",
- "name": "filter_user_group_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter instance name",
- "name": "filter_instance_name",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
- },
{
"type": "string",
"description": "project name",
@@ -3625,29 +3444,25 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetMemberGroupsRespV1"
+ "$ref": "#/definitions/v1.GetProjectScoreResV1"
}
}
}
- },
- "post": {
+ }
+ },
+ "/v1/projects/{project_name}/statistic/risk_audit_plans": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "add member group",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "get risk audit plan",
"tags": [
- "user_group"
+ "statistic"
],
- "summary": "添加成员组",
- "operationId": "addMemberGroupV1",
+ "summary": "获取扫描任务报告评分低于60的扫描任务",
+ "operationId": "getRiskAuditPlanV1",
"parameters": [
{
"type": "string",
@@ -3655,77 +3470,31 @@
"name": "project_name",
"in": "path",
"required": true
- },
- {
- "description": "add member group",
- "name": "data",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.CreateMemberGroupReqV1"
- }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetRiskAuditPlanResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/member_groups/{user_group_name}/": {
+ "/v1/projects/{project_name}/statistic/risk_workflow": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get member group",
+ "description": "statistic risk workflow",
"tags": [
- "user_group"
+ "statistic"
],
- "summary": "获取成员组信息",
- "operationId": "getMemberGroupV1",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "user group name",
- "name": "user_group_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetMemberGroupRespV1"
- }
- }
- }
- },
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "delete member group",
- "tags": [
- "user_group"
- ],
- "summary": "删除成员组",
- "operationId": "deleteMemberGroupV1",
+ "summary": "获取存在风险的工单",
+ "operationId": "statisticRiskWorkflowV1",
"parameters": [
{
"type": "string",
@@ -3733,42 +3502,31 @@
"name": "project_name",
"in": "path",
"required": true
- },
- {
- "type": "string",
- "description": "user group name",
- "name": "user_group_name",
- "in": "path",
- "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.StatisticRiskWorkflowResV1"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v1/projects/{project_name}/statistic/role_user": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update member group",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "get role user count",
"tags": [
- "user_group"
+ "statistic"
],
- "summary": "修改成员组",
- "operationId": "updateMemberGroupV1",
+ "summary": "获取各角色类型对应的成员数量",
+ "operationId": "getRoleUserCountV1",
"parameters": [
{
"type": "string",
@@ -3776,47 +3534,31 @@
"name": "project_name",
"in": "path",
"required": true
- },
- {
- "type": "string",
- "description": "user group name",
- "name": "user_group_name",
- "in": "path",
- "required": true
- },
- {
- "description": "update member_group",
- "name": "data",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateMemberGroupReqV1"
- }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetRoleUserCountResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/member_tips": {
+ "/v1/projects/{project_name}/statistic/workflow_status": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get member tip list",
+ "description": "statistic workflow status",
"tags": [
- "user"
+ "statistic"
],
- "summary": "获取成员提示列表",
- "operationId": "getMemberTipListV1",
+ "summary": "获取项目下工单各个状态的数量",
+ "operationId": "statisticWorkflowStatusV1",
"parameters": [
{
"type": "string",
@@ -3830,52 +3572,26 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetMemberTipsResV1"
+ "$ref": "#/definitions/v1.GetWorkflowStatusCountResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/members": {
+ "/v1/projects/{project_name}/statistics": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get members",
+ "description": "get project statistics",
"tags": [
- "user"
+ "statistic"
],
- "summary": "获取成员列表",
- "operationId": "getMembersV1",
+ "summary": "获取项目统计信息",
+ "operationId": "getProjectStatisticsV1",
"parameters": [
- {
- "type": "string",
- "description": "filter user name",
- "name": "filter_user_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter instance name",
- "name": "filter_instance_name",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
- },
{
"type": "string",
"description": "project name",
@@ -3888,18 +3604,20 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetMembersRespV1"
+ "$ref": "#/definitions/v1.GetProjectStatisticsResV1"
}
}
}
- },
+ }
+ },
+ "/v1/projects/{project_name}/task_groups": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "add member",
+ "description": "create tasks group.",
"consumes": [
"application/json"
],
@@ -3907,10 +3625,10 @@
"application/json"
],
"tags": [
- "user"
+ "task"
],
- "summary": "添加成员",
- "operationId": "addMemberV1",
+ "summary": "创建审核任务组",
+ "operationId": "createAuditTasksV1",
"parameters": [
{
"type": "string",
@@ -3920,12 +3638,12 @@
"required": true
},
{
- "description": "add member",
- "name": "data",
+ "description": "parameters for creating audit tasks group",
+ "name": "req",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.CreateMemberReqV1"
+ "$ref": "#/definitions/v1.CreateAuditTasksGroupReqV1"
}
}
],
@@ -3933,25 +3651,31 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.CreateAuditTasksGroupResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/members/{user_name}/": {
- "get": {
+ "/v1/projects/{project_name}/tasks/audits": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get member",
+ "description": "create and audit a task, you can upload sql content in three ways, any one can be used, but only one is effective.\n1. formData[sql]: sql content;\n2. file[input_sql_file]: it is a sql file;\n3. file[input_mybatis_xml_file]: it is mybatis xml file, sql will be parsed from it.",
+ "consumes": [
+ "multipart/form-data"
+ ],
+ "produces": [
+ "application/json"
+ ],
"tags": [
- "user"
+ "task"
],
- "summary": "获取成员信息",
- "operationId": "getMemberV1",
+ "summary": "创建Sql扫描任务并提交审核",
+ "operationId": "createAndAuditTaskV1",
"parameters": [
{
"type": "string",
@@ -3962,33 +3686,65 @@
},
{
"type": "string",
- "description": "user name",
- "name": "user_name",
- "in": "path",
+ "description": "instance name",
+ "name": "instance_name",
+ "in": "formData",
"required": true
+ },
+ {
+ "type": "string",
+ "description": "schema of instance",
+ "name": "instance_schema",
+ "in": "formData"
+ },
+ {
+ "type": "string",
+ "description": "sqls for audit",
+ "name": "sql",
+ "in": "formData"
+ },
+ {
+ "type": "file",
+ "description": "input SQL file",
+ "name": "input_sql_file",
+ "in": "formData"
+ },
+ {
+ "type": "file",
+ "description": "input mybatis XML file",
+ "name": "input_mybatis_xml_file",
+ "in": "formData"
+ },
+ {
+ "type": "file",
+ "description": "input ZIP file",
+ "name": "input_zip_file",
+ "in": "formData"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetMemberRespV1"
+ "$ref": "#/definitions/v1.GetAuditTaskResV1"
}
}
}
- },
- "delete": {
+ }
+ },
+ "/v1/projects/{project_name}/workflow_template": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "delete member",
+ "description": "get workflow template detail",
"tags": [
- "user"
+ "workflow"
],
- "summary": "删除成员",
- "operationId": "deleteMemberV1",
+ "summary": "获取审批流程模板详情",
+ "operationId": "getWorkflowTemplateV1",
"parameters": [
{
"type": "string",
@@ -3996,20 +3752,13 @@
"name": "project_name",
"in": "path",
"required": true
- },
- {
- "type": "string",
- "description": "user name",
- "name": "user_name",
- "in": "path",
- "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetWorkflowTemplateResV1"
}
}
}
@@ -4020,7 +3769,7 @@
"ApiKeyAuth": []
}
],
- "description": "update member",
+ "description": "update the workflow template",
"consumes": [
"application/json"
],
@@ -4028,10 +3777,10 @@
"application/json"
],
"tags": [
- "user"
+ "workflow"
],
- "summary": "修改成员",
- "operationId": "updateMemberV1",
+ "summary": "更新Sql审批流程模板",
+ "operationId": "updateWorkflowTemplateV1",
"parameters": [
{
"type": "string",
@@ -4041,19 +3790,12 @@
"required": true
},
{
- "type": "string",
- "description": "user name",
- "name": "user_name",
- "in": "path",
- "required": true
- },
- {
- "description": "update member",
- "name": "data",
+ "description": "create workflow template",
+ "name": "instance",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.UpdateMemberReqV1"
+ "$ref": "#/definitions/v1.UpdateWorkflowTemplateReqV1"
}
}
],
@@ -4067,64 +3809,94 @@
}
}
},
- "/v1/projects/{project_name}/rule_template_tips": {
+ "/v1/projects/{project_name}/workflows": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get rule template tips in project",
+ "description": "get workflow list",
"tags": [
- "rule_template"
+ "workflow"
],
- "summary": "获取项目规则模板提示",
- "operationId": "getProjectRuleTemplateTipsV1",
+ "summary": "获取工单列表",
+ "operationId": "getWorkflowsV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "filter subject",
+ "name": "filter_subject",
+ "in": "query"
},
{
"type": "string",
- "description": "filter db type",
- "name": "filter_db_type",
+ "description": "filter by workflow_id",
+ "name": "filter_workflow_id",
"in": "query"
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetRuleTemplateTipsResV1"
- }
- }
- }
- }
- },
- "/v1/projects/{project_name}/rule_templates": {
- "get": {
- "security": [
+ },
{
- "ApiKeyAuth": []
- }
- ],
- "description": "get all rule template in a project",
- "tags": [
- "rule_template"
- ],
- "summary": "项目规则模板列表",
- "operationId": "getProjectRuleTemplateListV1",
- "parameters": [
+ "type": "string",
+ "description": "fuzzy search by workflow description",
+ "name": "fuzzy_search_workflow_desc",
+ "in": "query"
+ },
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "filter create time from",
+ "name": "filter_create_time_from",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter create time to",
+ "name": "filter_create_time_to",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_task_execute_start_time_from",
+ "name": "filter_task_execute_start_time_from",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_task_execute_start_time_to",
+ "name": "filter_task_execute_start_time_to",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter create user id",
+ "name": "filter_create_user_id",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "wait_for_audit",
+ "wait_for_execution",
+ "rejected",
+ "executing",
+ "canceled",
+ "exec_failed",
+ "finished"
+ ],
+ "type": "string",
+ "description": "filter workflow status",
+ "name": "filter_status",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter current step assignee user id",
+ "name": "filter_current_step_assignee_user_id",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter instance name",
+ "name": "filter_task_instance_name",
+ "in": "query"
},
{
"type": "integer",
@@ -4139,13 +3911,26 @@
"name": "page_size",
"in": "query",
"required": true
+ },
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "fuzzy matching subject/workflow_id",
+ "name": "fuzzy_keyword",
+ "in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetProjectRuleTemplatesResV1"
+ "$ref": "#/definitions/v1.GetWorkflowsResV1"
}
}
}
@@ -4156,31 +3941,35 @@
"ApiKeyAuth": []
}
],
- "description": "create a rule template in project",
+ "description": "create workflow",
"consumes": [
"application/json"
],
+ "produces": [
+ "application/json"
+ ],
"tags": [
- "rule_template"
+ "workflow"
],
- "summary": "添加项目规则模板",
- "operationId": "createProjectRuleTemplateV1",
+ "summary": "创建工单",
+ "operationId": "createWorkflowV1",
+ "deprecated": true,
"parameters": [
+ {
+ "description": "create workflow request",
+ "name": "instance",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.CreateWorkflowReqV1"
+ }
+ },
{
"type": "string",
"description": "project name",
"name": "project_name",
"in": "path",
"required": true
- },
- {
- "description": "add rule template request",
- "name": "req",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.CreateProjectRuleTemplateReqV1"
- }
}
],
"responses": {
@@ -4193,19 +3982,20 @@
}
}
},
- "/v1/projects/{project_name}/rule_templates/{rule_template_name}/": {
- "get": {
+ "/v1/projects/{project_name}/workflows/cancel": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get rule template detail in project",
+ "description": "batch cancel workflows",
"tags": [
- "rule_template"
+ "workflow"
],
- "summary": "获取项目规则模板信息",
- "operationId": "getProjectRuleTemplateV1",
+ "summary": "批量取消工单",
+ "operationId": "batchCancelWorkflowsV1",
+ "deprecated": true,
"parameters": [
{
"type": "string",
@@ -4215,34 +4005,39 @@
"required": true
},
{
- "type": "string",
- "description": "rule template name",
- "name": "rule_template_name",
- "in": "path",
- "required": true
+ "description": "batch cancel workflows request",
+ "name": "BatchCancelWorkflowsReqV1",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.BatchCancelWorkflowsReqV1"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetProjectRuleTemplateResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
- },
- "delete": {
+ }
+ },
+ "/v1/projects/{project_name}/workflows/complete": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "delete rule template in project",
+ "description": "this api will directly change the work order status to finished without real online operation",
"tags": [
- "rule_template"
+ "workflow"
],
- "summary": "删除项目规则模板",
- "operationId": "deleteProjectRuleTemplateV1",
+ "summary": "批量完成工单",
+ "operationId": "batchCompleteWorkflowsV1",
+ "deprecated": true,
"parameters": [
{
"type": "string",
@@ -4252,11 +4047,13 @@
"required": true
},
{
- "type": "string",
- "description": "rule template name",
- "name": "rule_template_name",
- "in": "path",
- "required": true
+ "description": "batch complete workflows request",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.BatchCompleteWorkflowsReqV1"
+ }
}
],
"responses": {
@@ -4267,93 +4064,142 @@
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v1/projects/{project_name}/workflows/exports": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update rule template in project",
+ "description": "export workflow",
"tags": [
- "rule_template"
+ "workflow"
],
- "summary": "更新项目规则模板",
- "operationId": "updateProjectRuleTemplateV1",
+ "summary": "导出工单",
+ "operationId": "exportWorkflowV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "filter subject",
+ "name": "filter_subject",
+ "in": "query"
},
{
"type": "string",
- "description": "rule template name",
- "name": "rule_template_name",
+ "description": "fuzzy search by workflow description",
+ "name": "fuzzy_search_workflow_desc",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter create time from",
+ "name": "filter_create_time_from",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter create time to",
+ "name": "filter_create_time_to",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_task_execute_start_time_from",
+ "name": "filter_task_execute_start_time_from",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_task_execute_start_time_to",
+ "name": "filter_task_execute_start_time_to",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter create user id",
+ "name": "filter_create_user_id",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "wait_for_audit",
+ "wait_for_execution",
+ "rejected",
+ "executing",
+ "canceled",
+ "exec_failed",
+ "finished"
+ ],
+ "type": "string",
+ "description": "filter workflow status",
+ "name": "filter_status",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter current step assignee user id",
+ "name": "filter_current_step_assignee_user_id",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter instance name",
+ "name": "filter_task_instance_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
"in": "path",
"required": true
},
{
- "description": "update rule template request",
- "name": "req",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateProjectRuleTemplateReqV1"
- }
+ "type": "string",
+ "description": "fuzzy matching subject/workflow_id/desc",
+ "name": "fuzzy_keyword",
+ "in": "query"
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "export workflow",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "type": "file"
}
}
}
}
},
- "/v1/projects/{project_name}/rule_templates/{rule_template_name}/clone": {
+ "/v1/projects/{project_name}/workflows/{workflow_id}/tasks/terminate": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "clone a rule template in project",
- "consumes": [
- "application/json"
- ],
+ "description": "terminate multiple task by project and workflow",
"tags": [
- "rule_template"
+ "workflow"
],
- "summary": "克隆项目规则模板",
- "operationId": "cloneProjectRuleTemplateV1",
+ "summary": "终止工单下多个上线任务",
+ "operationId": "terminateMultipleTaskByWorkflowV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "workflow id",
+ "name": "workflow_id",
"in": "path",
"required": true
},
{
"type": "string",
- "description": "rule template name",
- "name": "rule_template_name",
+ "description": "project name",
+ "name": "project_name",
"in": "path",
"required": true
- },
- {
- "description": "clone rule template request",
- "name": "req",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.CloneProjectRuleTemplateReqV1"
- }
}
],
"responses": {
@@ -4366,20 +4212,27 @@
}
}
},
- "/v1/projects/{project_name}/rule_templates/{rule_template_name}/export": {
- "get": {
+ "/v1/projects/{project_name}/workflows/{workflow_id}/tasks/{task_id}/terminate": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "export rule template in a project",
+ "description": "execute one task on workflow",
"tags": [
- "rule_template"
+ "workflow"
],
- "summary": "导出项目规则模板",
- "operationId": "exportProjectRuleTemplateV1",
+ "summary": "终止单个上线任务",
+ "operationId": "terminateSingleTaskByWorkflowV1",
"parameters": [
+ {
+ "type": "string",
+ "description": "workflow id",
+ "name": "workflow_id",
+ "in": "path",
+ "required": true
+ },
{
"type": "string",
"description": "project name",
@@ -4389,88 +4242,42 @@
},
{
"type": "string",
- "description": "rule template name",
- "name": "rule_template_name",
+ "description": "task id",
+ "name": "task_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
- "description": "sqle rule template file",
+ "description": "OK",
"schema": {
- "type": "file"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/sql_audit_records": {
+ "/v1/projects/{project_name}/workflows/{workflow_name}/": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get sql audit records",
+ "description": "get workflow detail",
"tags": [
- "sql_audit_record"
+ "workflow"
],
- "summary": "获取SQL审核记录列表",
- "operationId": "getSQLAuditRecordsV1",
+ "summary": "获取工单详情",
+ "operationId": "getWorkflowV1",
+ "deprecated": true,
"parameters": [
{
"type": "string",
- "description": "fuzzy search tags",
- "name": "fuzzy_search_tags",
- "in": "query"
- },
- {
- "enum": [
- "auditing",
- "successfully"
- ],
- "type": "string",
- "description": "filter sql audit status",
- "name": "filter_sql_audit_status",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter instance name",
- "name": "filter_instance_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create time from",
- "name": "filter_create_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create time to",
- "name": "filter_create_time_to",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter sql audit record ids",
- "name": "filter_sql_audit_record_ids",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
+ "description": "workflow name",
+ "name": "workflow_name",
+ "in": "path",
"required": true
},
{
@@ -4485,121 +4292,79 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSQLAuditRecordsResV1"
+ "$ref": "#/definitions/v1.GetWorkflowResV1"
}
}
}
},
- "post": {
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "SQL audit\n1. formData[sql]: sql content;\n2. file[input_sql_file]: it is a sql file;\n3. file[input_mybatis_xml_file]: it is mybatis xml file, sql will be parsed from it.\n4. file[input_zip_file]: it is ZIP file that sql will be parsed from xml or sql file inside it.\n5. formData[git_http_url]:the url which scheme is http(s) and end with .git.\n6. formData[git_user_name]:The name of the user who owns the repository read access.\n7. formData[git_user_password]:The password corresponding to git_user_name.",
+ "description": "update workflow when it is rejected to creator.",
"consumes": [
- "multipart/form-data"
+ "application/json"
],
"produces": [
"application/json"
],
"tags": [
- "sql_audit_record"
+ "workflow"
],
- "summary": "SQL审核",
- "operationId": "CreateSQLAuditRecordV1",
+ "summary": "更新工单(驳回后才可更新)",
+ "operationId": "updateWorkflowV1",
+ "deprecated": true,
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "workflow name",
+ "name": "workflow_name",
"in": "path",
"required": true
},
{
"type": "string",
- "description": "instance name",
- "name": "instance_name",
- "in": "formData"
- },
- {
- "type": "string",
- "description": "schema of instance",
- "name": "instance_schema",
- "in": "formData"
- },
- {
- "type": "string",
- "description": "db type of instance",
- "name": "db_type",
- "in": "formData"
- },
- {
- "type": "string",
- "description": "sqls for audit",
- "name": "sqls",
- "in": "formData"
- },
- {
- "type": "file",
- "description": "input SQL file",
- "name": "input_sql_file",
- "in": "formData"
- },
- {
- "type": "file",
- "description": "input mybatis XML file",
- "name": "input_mybatis_xml_file",
- "in": "formData"
- },
- {
- "type": "file",
- "description": "input ZIP file",
- "name": "input_zip_file",
- "in": "formData"
- },
- {
- "type": "string",
- "description": "git repository url",
- "name": "git_http_url",
- "in": "formData"
- },
- {
- "type": "string",
- "description": "the name of user to clone the repository",
- "name": "git_user_name",
- "in": "formData"
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
},
{
- "type": "string",
- "description": "the password corresponding to git_user_name",
- "name": "git_user_password",
- "in": "formData"
+ "description": "update workflow request",
+ "name": "instance",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.UpdateWorkflowReqV1"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.CreateSQLAuditRecordResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/sql_audit_records/tag_tips": {
- "get": {
+ "/v1/projects/{project_name}/workflows/{workflow_name}/cancel": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get sql audit record tag tips",
+ "description": "cancel workflow",
"tags": [
- "sql_audit_record"
+ "workflow"
],
- "summary": "获取SQL审核记录标签列表",
- "operationId": "GetSQLAuditRecordTagTipsV1",
+ "summary": "审批关闭(中止)",
+ "operationId": "cancelWorkflowV1",
+ "deprecated": true,
"parameters": [
{
"type": "string",
@@ -4607,43 +4372,58 @@
"name": "project_name",
"in": "path",
"required": true
+ },
+ {
+ "type": "string",
+ "description": "workflow name",
+ "name": "workflow_name",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSQLAuditRecordTagTipsResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/sql_audit_records/{sql_audit_record_id}/": {
- "get": {
+ "/v1/projects/{project_name}/workflows/{workflow_name}/steps/{workflow_step_id}/approve": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get sql audit record info",
+ "description": "approve workflow",
"tags": [
- "sql_audit_record"
+ "workflow"
],
- "summary": "获取SQL审核记录信息",
- "operationId": "getSQLAuditRecordV1",
+ "summary": "审批通过",
+ "operationId": "approveWorkflowV1",
+ "deprecated": true,
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "workflow name",
+ "name": "workflow_name",
"in": "path",
"required": true
},
{
"type": "string",
- "description": "sql audit record id",
- "name": "sql_audit_record_id",
+ "description": "workflow step id",
+ "name": "workflow_step_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
"in": "path",
"required": true
}
@@ -4652,27 +4432,34 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSQLAuditRecordResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
- },
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
+ }
+ },
+ "/v1/projects/{project_name}/workflows/{workflow_name}/steps/{workflow_step_id}/reject": {
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
}
],
- "description": "update SQL audit record",
- "consumes": [
- "application/json"
- ],
+ "description": "reject workflow",
"tags": [
- "sql_audit_record"
+ "workflow"
],
- "summary": "更新SQL审核记录",
- "operationId": "updateSQLAuditRecordV1",
+ "summary": "审批驳回",
+ "operationId": "rejectWorkflowV1",
+ "deprecated": true,
"parameters": [
+ {
+ "type": "string",
+ "description": "workflow name",
+ "name": "workflow_name",
+ "in": "path",
+ "required": true
+ },
{
"type": "string",
"description": "project name",
@@ -4682,18 +4469,18 @@
},
{
"type": "string",
- "description": "sql audit record id",
- "name": "sql_audit_record_id",
+ "description": "workflow step id",
+ "name": "workflow_step_id",
"in": "path",
"required": true
},
{
- "description": "update SQL audit record",
- "name": "param",
+ "description": "workflow approve request",
+ "name": "workflow_approve",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.UpdateSQLAuditRecordReqV1"
+ "$ref": "#/definitions/v1.RejectWorkflowReqV1"
}
}
],
@@ -4707,149 +4494,33 @@
}
}
},
- "/v1/projects/{project_name}/sql_manages": {
+ "/v1/projects/{project_name}/workflows/{workflow_name}/tasks": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get sql manage list",
+ "description": "get summary of workflow instance tasks",
"tags": [
- "SqlManage"
+ "workflow"
],
- "summary": "获取管控sql列表",
- "operationId": "GetSqlManageList",
+ "summary": "获取工单数据源任务概览",
+ "operationId": "getSummaryOfInstanceTasksV1",
"deprecated": true,
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "workflow name",
+ "name": "workflow_name",
"in": "path",
"required": true
},
{
"type": "string",
- "description": "fuzzy search sql fingerprint",
- "name": "fuzzy_search_sql_fingerprint",
- "in": "query"
- },
- {
- "type": "string",
- "description": "assignee",
- "name": "filter_assignee",
- "in": "query"
- },
- {
- "type": "string",
- "description": "instance name",
- "name": "filter_instance_name",
- "in": "query"
- },
- {
- "enum": [
- "audit_plan",
- "sql_audit_record"
- ],
- "type": "string",
- "description": "source",
- "name": "filter_source",
- "in": "query"
- },
- {
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ],
- "type": "string",
- "description": "audit level",
- "name": "filter_audit_level",
- "in": "query"
- },
- {
- "type": "string",
- "description": "last audit start time from",
- "name": "filter_last_audit_start_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "last audit start time to",
- "name": "filter_last_audit_start_time_to",
- "in": "query"
- },
- {
- "enum": [
- "unhandled",
- "solved",
- "ignored",
- "manual_audited"
- ],
- "type": "string",
- "description": "status",
- "name": "filter_status",
- "in": "query"
- },
- {
- "type": "string",
- "description": "rule name",
- "name": "filter_rule_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "db type",
- "name": "filter_db_type",
- "in": "query"
- },
- {
- "type": "string",
- "description": "fuzzy search endpoint",
- "name": "fuzzy_search_endpoint",
- "in": "query"
- },
- {
- "type": "string",
- "description": "fuzzy search schema name",
- "name": "fuzzy_search_schema_name",
- "in": "query"
- },
- {
- "enum": [
- "first_appear_timestamp",
- "last_receive_timestamp",
- "fp_count"
- ],
- "type": "string",
- "description": "sort field",
- "name": "sort_field",
- "in": "query"
- },
- {
- "enum": [
- "asc",
- "desc"
- ],
- "type": "string",
- "description": "sort order",
- "name": "sort_order",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
"required": true
}
],
@@ -4857,41 +4528,40 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSqlManageListResp"
+ "$ref": "#/definitions/v1.GetWorkflowTasksResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/sql_manages/batch": {
- "patch": {
+ "/v1/projects/{project_name}/workflows/{workflow_name}/tasks/execute": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "batch update sql manage",
+ "description": "execute tasks on workflow",
"tags": [
- "SqlManage"
+ "workflow"
],
- "summary": "批量更新SQL管控",
- "operationId": "BatchUpdateSqlManage",
+ "summary": "多数据源批量上线",
+ "operationId": "executeTasksOnWorkflowV1",
+ "deprecated": true,
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "workflow name",
+ "name": "workflow_name",
"in": "path",
"required": true
},
{
- "description": "batch update sql manage request",
- "name": "BatchUpdateSqlManageReq",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.BatchUpdateSqlManageReq"
- }
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
}
],
"responses": {
@@ -4904,165 +4574,140 @@
}
}
},
- "/v1/projects/{project_name}/sql_manages/exports": {
- "get": {
+ "/v1/projects/{project_name}/workflows/{workflow_name}/tasks/{task_id}/execute": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "export sql manage",
+ "description": "execute one task on workflow",
"tags": [
- "SqlManage"
+ "workflow"
],
- "summary": "导出SQL管控",
- "operationId": "exportSqlManageV1",
+ "summary": "工单提交单个数据源上线",
+ "operationId": "executeOneTaskOnWorkflowV1",
+ "deprecated": true,
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "workflow name",
+ "name": "workflow_name",
"in": "path",
"required": true
},
{
"type": "string",
- "description": "fuzzy search sql fingerprint",
- "name": "fuzzy_search_sql_fingerprint",
- "in": "query"
- },
- {
- "type": "string",
- "description": "assignee",
- "name": "filter_assignee",
- "in": "query"
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
},
{
"type": "string",
- "description": "instance name",
- "name": "filter_instance_name",
- "in": "query"
- },
+ "description": "task id",
+ "name": "task_id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/controller.BaseRes"
+ }
+ }
+ }
+ }
+ },
+ "/v1/projects/{project_name}/workflows/{workflow_name}/tasks/{task_id}/schedule": {
+ "put": {
+ "security": [
{
- "enum": [
- "audit_plan",
- "sql_audit_record"
- ],
- "type": "string",
- "description": "source",
- "name": "filter_source",
- "in": "query"
- },
- {
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ],
- "type": "string",
- "description": "audit level",
- "name": "filter_audit_level",
- "in": "query"
- },
- {
- "type": "string",
- "description": "last audit start time from",
- "name": "filter_last_audit_start_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "last audit start time to",
- "name": "filter_last_audit_start_time_to",
- "in": "query"
- },
- {
- "enum": [
- "unhandled",
- "solved",
- "ignored",
- "manual_audited"
- ],
- "type": "string",
- "description": "status",
- "name": "filter_status",
- "in": "query"
- },
- {
- "type": "string",
- "description": "db type",
- "name": "filter_db_type",
- "in": "query"
- },
- {
- "type": "string",
- "description": "rule name",
- "name": "filter_rule_name",
- "in": "query"
- },
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "update workflow schedule.",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "workflow"
+ ],
+ "summary": "设置工单数据源定时上线时间(设置为空则代表取消定时时间,需要SQL审核流程都通过后才可以设置)",
+ "operationId": "updateWorkflowScheduleV1",
+ "deprecated": true,
+ "parameters": [
{
"type": "string",
- "description": "fuzzy search endpoint",
- "name": "fuzzy_search_endpoint",
- "in": "query"
+ "description": "workflow name",
+ "name": "workflow_name",
+ "in": "path",
+ "required": true
},
{
"type": "string",
- "description": "fuzzy search schema name",
- "name": "fuzzy_search_schema_name",
- "in": "query"
+ "description": "task id",
+ "name": "task_id",
+ "in": "path",
+ "required": true
},
{
- "enum": [
- "first_appear_timestamp",
- "last_receive_timestamp",
- "fp_count"
- ],
"type": "string",
- "description": "sort field",
- "name": "sort_field",
- "in": "query"
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
},
{
- "enum": [
- "asc",
- "desc"
- ],
- "type": "string",
- "description": "sort order",
- "name": "sort_order",
- "in": "query"
+ "description": "update workflow schedule request",
+ "name": "instance",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.UpdateWorkflowScheduleReqV1"
+ }
}
],
"responses": {
"200": {
- "description": "export sql manage",
+ "description": "OK",
"schema": {
- "type": "file"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/sql_manages/rule_tips": {
+ "/v1/rule_knowledge/db_types/{db_type}/custom_rules/{rule_name}/": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get sql manage rule tips",
+ "description": "get custom rule knowledge",
"tags": [
- "SqlManage"
+ "rule_template"
],
- "summary": "获取管控规则tips",
- "operationId": "GetSqlManageRuleTips",
+ "summary": "查看自定义规则知识库",
+ "operationId": "getCustomRuleKnowledgeV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "rule name",
+ "name": "rule_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "db type of rule",
+ "name": "db_type",
"in": "path",
"required": true
}
@@ -5071,69 +4716,83 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSqlManageRuleTipsResp"
+ "$ref": "#/definitions/v1.GetRuleKnowledgeResV1"
}
}
}
- }
- },
- "/v1/projects/{project_name}/sql_manages/{sql_manage_id}/sql_analysis": {
- "get": {
+ },
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get sql manage analysis",
+ "description": "update custom rule knowledge",
"tags": [
- "SqlManage"
+ "rule_template"
],
- "summary": "获取SQL管控SQL分析",
- "operationId": "GetSqlManageSqlAnalysisV1",
+ "summary": "更新自定义规则知识库",
+ "operationId": "updateCustomRuleKnowledge",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "rule name",
+ "name": "rule_name",
"in": "path",
"required": true
},
{
"type": "string",
- "description": "sql manage id",
- "name": "sql_manage_id",
+ "description": "db type of rule",
+ "name": "db_type",
"in": "path",
"required": true
+ },
+ {
+ "description": "update rule knowledge",
+ "name": "req",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.UpdateRuleKnowledgeReq"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSqlManageSqlAnalysisResp"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/statistic/audit_plans": {
+ "/v1/rule_knowledge/db_types/{db_type}/rules/{rule_name}/": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "statistic audit plan",
+ "description": "get rule knowledge",
"tags": [
- "statistic"
+ "rule_template"
],
- "summary": "获取各类型数据源上的扫描任务数量",
- "operationId": "statisticAuditPlanV1",
+ "summary": "查看规则知识库",
+ "operationId": "getRuleKnowledgeV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "rule name",
+ "name": "rule_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "db type of rule",
+ "name": "db_type",
"in": "path",
"required": true
}
@@ -5142,95 +4801,115 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.StatisticAuditPlanResV1"
+ "$ref": "#/definitions/v1.GetRuleKnowledgeResV1"
}
}
}
- }
- },
- "/v1/projects/{project_name}/statistic/audited_sqls": {
- "get": {
+ },
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "statistics audited sql",
+ "description": "update rule knowledge",
"tags": [
- "statistic"
+ "rule_template"
],
- "summary": "获取审核SQL总数,以及触发审核规则的SQL数量",
- "operationId": "statisticsAuditedSQLV1",
+ "summary": "更新规则知识库",
+ "operationId": "updateRuleKnowledge",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "rule name",
+ "name": "rule_name",
"in": "path",
"required": true
+ },
+ {
+ "type": "string",
+ "description": "db type of rule",
+ "name": "db_type",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "update rule knowledge",
+ "name": "req",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.UpdateRuleKnowledgeReq"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.StatisticsAuditedSQLResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/statistic/instance_health": {
+ "/v1/rule_template_tips": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get instance health",
+ "description": "get global rule template tips",
"tags": [
- "statistic"
+ "rule_template"
],
- "summary": "获取各类型数据源的健康情况",
- "operationId": "GetInstanceHealthV1",
+ "summary": "获取全局规则模板提示",
+ "operationId": "getRuleTemplateTipsV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "filter db type",
+ "name": "filter_db_type",
+ "in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetInstanceHealthResV1"
+ "$ref": "#/definitions/v1.GetRuleTemplateTipsResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/statistic/project_score": {
+ "/v1/rule_templates": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get project score",
+ "description": "get all global rule template",
"tags": [
- "statistic"
+ "rule_template"
],
- "summary": "获取项目分数",
- "operationId": "GetProjectScoreV1",
+ "summary": "全局规则模板列表",
+ "operationId": "getRuleTemplateListV1",
"parameters": [
{
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
+ "type": "integer",
+ "description": "page index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "size of per page",
+ "name": "page_size",
+ "in": "query",
"required": true
}
],
@@ -5238,63 +4917,69 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetProjectScoreResV1"
+ "$ref": "#/definitions/v1.GetRuleTemplatesResV1"
}
}
}
- }
- },
- "/v1/projects/{project_name}/statistic/risk_audit_plans": {
- "get": {
+ },
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get risk audit plan",
+ "description": "create a global rule template",
+ "consumes": [
+ "application/json"
+ ],
"tags": [
- "statistic"
+ "rule_template"
],
- "summary": "获取扫描任务报告评分低于60的扫描任务",
- "operationId": "getRiskAuditPlanV1",
+ "summary": "添加全局规则模板",
+ "operationId": "createRuleTemplateV1",
"parameters": [
{
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "add rule template request",
+ "name": "req",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.CreateRuleTemplateReqV1"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRiskAuditPlanResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/statistic/risk_workflow": {
- "get": {
+ "/v1/rule_templates/parse": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "statistic risk workflow",
+ "description": "parse rule template",
+ "consumes": [
+ "multipart/form-data"
+ ],
"tags": [
- "statistic"
+ "rule_template"
],
- "summary": "获取存在风险的工单",
- "operationId": "statisticRiskWorkflowV1",
+ "summary": "解析规则模板文件",
+ "operationId": "importProjectRuleTemplateV1",
"parameters": [
{
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
+ "type": "file",
+ "description": "SQLE rule template file",
+ "name": "rule_template_file",
+ "in": "formData",
"required": true
}
],
@@ -5302,62 +4987,66 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.StatisticRiskWorkflowResV1"
+ "$ref": "#/definitions/v1.ParseProjectRuleTemplateFileResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/statistic/role_user": {
+ "/v1/rule_templates/{rule_template_name}/": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get role user count",
+ "description": "get global rule template",
"tags": [
- "statistic"
+ "rule_template"
],
- "summary": "获取各角色类型对应的成员数量",
- "operationId": "getRoleUserCountV1",
+ "summary": "获取全局规则模板信息",
+ "operationId": "getRuleTemplateV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "rule template name",
+ "name": "rule_template_name",
"in": "path",
"required": true
+ },
+ {
+ "type": "string",
+ "description": "fuzzy rule,keyword for desc and annotation",
+ "name": "fuzzy_keyword_rule",
+ "in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRoleUserCountResV1"
+ "$ref": "#/definitions/v1.GetRuleTemplateResV1"
}
}
}
- }
- },
- "/v1/projects/{project_name}/statistic/workflow_status": {
- "get": {
+ },
+ "delete": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "statistic workflow status",
+ "description": "delete global rule template",
"tags": [
- "statistic"
+ "rule_template"
],
- "summary": "获取项目下工单各个状态的数量",
- "operationId": "statisticWorkflowStatusV1",
+ "summary": "删除全局规则模板",
+ "operationId": "deleteRuleTemplateV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "rule template name",
+ "name": "rule_template_name",
"in": "path",
"required": true
}
@@ -5366,78 +5055,82 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowStatusCountResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
- }
- },
- "/v1/projects/{project_name}/statistics": {
- "get": {
+ },
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get project statistics",
+ "description": "update global rule template",
"tags": [
- "statistic"
+ "rule_template"
],
- "summary": "获取项目统计信息",
- "operationId": "getProjectStatisticsV1",
+ "summary": "更新全局规则模板",
+ "operationId": "updateRuleTemplateV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "rule template name",
+ "name": "rule_template_name",
"in": "path",
"required": true
+ },
+ {
+ "description": "update rule template request",
+ "name": "req",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v1.UpdateRuleTemplateReqV1"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetProjectStatisticsResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/task_groups": {
+ "/v1/rule_templates/{rule_template_name}/clone": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "create tasks group.",
+ "description": "clone a rule template",
"consumes": [
"application/json"
],
- "produces": [
- "application/json"
- ],
"tags": [
- "task"
+ "rule_template"
],
- "summary": "创建审核任务组",
- "operationId": "createAuditTasksV1",
+ "summary": "克隆全局规则模板",
+ "operationId": "CloneRuleTemplateV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "rule template name",
+ "name": "rule_template_name",
"in": "path",
"required": true
},
{
- "description": "parameters for creating audit tasks group",
+ "description": "clone rule template request",
"name": "req",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.CreateAuditTasksGroupReqV1"
+ "$ref": "#/definitions/v1.CloneRuleTemplateReqV1"
}
}
],
@@ -5445,189 +5138,166 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.CreateAuditTasksGroupResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/projects/{project_name}/tasks/audits": {
- "post": {
+ "/v1/rule_templates/{rule_template_name}/export": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "create and audit a task, you can upload sql content in three ways, any one can be used, but only one is effective.\n1. formData[sql]: sql content;\n2. file[input_sql_file]: it is a sql file;\n3. file[input_mybatis_xml_file]: it is mybatis xml file, sql will be parsed from it.",
- "consumes": [
- "multipart/form-data"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "export rule template",
"tags": [
- "task"
+ "rule_template"
],
- "summary": "创建Sql扫描任务并提交审核",
- "operationId": "createAndAuditTaskV1",
+ "summary": "导出全局规则模板",
+ "operationId": "exportRuleTemplateV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "rule template name",
+ "name": "rule_template_name",
"in": "path",
"required": true
- },
- {
- "type": "string",
- "description": "instance name",
- "name": "instance_name",
- "in": "formData",
- "required": true
- },
- {
- "type": "string",
- "description": "schema of instance",
- "name": "instance_schema",
- "in": "formData"
- },
- {
- "type": "string",
- "description": "sqls for audit",
- "name": "sql",
- "in": "formData"
- },
- {
- "type": "file",
- "description": "input SQL file",
- "name": "input_sql_file",
- "in": "formData"
- },
- {
- "type": "file",
- "description": "input mybatis XML file",
- "name": "input_mybatis_xml_file",
- "in": "formData"
- },
- {
- "type": "file",
- "description": "input ZIP file",
- "name": "input_zip_file",
- "in": "formData"
}
],
"responses": {
"200": {
- "description": "OK",
+ "description": "sqle rule template file",
"schema": {
- "$ref": "#/definitions/v1.GetAuditTaskResV1"
+ "type": "file"
}
}
}
}
},
- "/v1/projects/{project_name}/unarchive": {
- "post": {
+ "/v1/rules": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "archive project",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "get all rule template",
"tags": [
- "project"
+ "rule_template"
],
- "summary": "取消归档项目",
- "operationId": "unarchiveProjectV1",
+ "summary": "规则列表",
+ "operationId": "getRuleListV1",
"parameters": [
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
+ "description": "filter db type",
+ "name": "filter_db_type",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "fuzzy rule,keyword for desc and annotation",
+ "name": "fuzzy_keyword_rule",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter global rule template name",
+ "name": "filter_global_rule_template_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter rule name list",
+ "name": "filter_rule_names",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetRulesResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflow_template": {
+ "/v1/sql_analysis": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get workflow template detail",
+ "description": "Direct get sql analysis result",
"tags": [
- "workflow"
+ "sql_analysis"
],
- "summary": "获取审批流程模板详情",
- "operationId": "getWorkflowTemplateV1",
+ "summary": "直接获取SQL分析结果",
+ "operationId": "directGetSQLAnalysisV1",
"parameters": [
{
"type": "string",
"description": "project name",
"name": "project_name",
- "in": "path",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "instance name",
+ "name": "instance_name",
+ "in": "query",
"required": true
+ },
+ {
+ "type": "string",
+ "description": "schema name",
+ "name": "schema_name",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "sql",
+ "name": "sql",
+ "in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowTemplateResV1"
+ "$ref": "#/definitions/v1.DirectGetSQLAnalysisResV1"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v1/sql_audit": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update the workflow template",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "Direct audit sql",
"tags": [
- "workflow"
+ "sql_audit"
],
- "summary": "更新Sql审批流程模板",
- "operationId": "updateWorkflowTemplateV1",
+ "summary": "直接审核SQL",
+ "operationId": "directAuditV1",
+ "deprecated": true,
"parameters": [
{
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "description": "create workflow template",
- "name": "instance",
+ "description": "sqls that should be audited",
+ "name": "req",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.UpdateWorkflowTemplateReqV1"
+ "$ref": "#/definitions/v1.DirectAuditReqV1"
}
}
],
@@ -5635,166 +5305,63 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.DirectAuditResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows": {
+ "/v1/statistic/instances/sql_average_execution_time": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get workflow list",
+ "description": "get average execution time of sql",
"tags": [
- "workflow"
+ "statistic"
],
- "summary": "获取工单列表",
- "operationId": "getWorkflowsV1",
+ "summary": "获取sql上线平均耗时,按平均耗时降序排列",
+ "operationId": "getSqlAverageExecutionTimeV1",
"parameters": [
- {
- "type": "string",
- "description": "filter subject",
- "name": "filter_subject",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter by workflow_id",
- "name": "filter_workflow_id",
- "in": "query"
- },
- {
- "type": "string",
- "description": "fuzzy search by workflow description",
- "name": "fuzzy_search_workflow_desc",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create time from",
- "name": "filter_create_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create time to",
- "name": "filter_create_time_to",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_task_execute_start_time_from",
- "name": "filter_task_execute_start_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_task_execute_start_time_to",
- "name": "filter_task_execute_start_time_to",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create user name",
- "name": "filter_create_user_name",
- "in": "query"
- },
- {
- "enum": [
- "wait_for_audit",
- "wait_for_execution",
- "rejected",
- "executing",
- "canceled",
- "exec_failed",
- "finished"
- ],
- "type": "string",
- "description": "filter workflow status",
- "name": "filter_status",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter current step assignee user name",
- "name": "filter_current_step_assignee_user_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter instance name",
- "name": "filter_task_instance_name",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
{
"type": "integer",
- "description": "size of per page",
- "name": "page_size",
+ "description": "the limit of result item number",
+ "name": "limit",
"in": "query",
"required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowsResV1"
+ "$ref": "#/definitions/v1.GetSqlAverageExecutionTimeResV1"
}
}
}
- },
- "post": {
+ }
+ },
+ "/v1/statistic/instances/sql_execution_fail_percent": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "create workflow",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "get sql execution fail percent",
"tags": [
- "workflow"
+ "statistic"
],
- "summary": "创建工单",
- "operationId": "createWorkflowV1",
- "deprecated": true,
+ "summary": "获取SQL上线失败率,按失败率降序排列",
+ "operationId": "getSqlExecutionFailPercentV1",
"parameters": [
{
- "description": "create workflow request",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.CreateWorkflowReqV1"
- }
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
+ "type": "integer",
+ "description": "the limit of result item number",
+ "name": "limit",
+ "in": "query",
"required": true
}
],
@@ -5802,309 +5369,177 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetSqlExecutionFailPercentResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/cancel": {
- "post": {
+ "/v1/statistic/instances/type_percent": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "batch cancel workflows",
+ "description": "get database instances' types percent",
"tags": [
- "workflow"
- ],
- "summary": "批量取消工单",
- "operationId": "batchCancelWorkflowsV1",
- "deprecated": true,
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "description": "batch cancel workflows request",
- "name": "BatchCancelWorkflowsReqV1",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.BatchCancelWorkflowsReqV1"
- }
- }
+ "statistic"
],
+ "summary": "获取数据源类型百分比",
+ "operationId": "getInstancesTypePercentV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetInstancesTypePercentResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/complete": {
- "post": {
+ "/v1/statistic/license/usage": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "this api will directly change the work order status to finished without real online operation",
+ "description": "get usage of license",
"tags": [
- "workflow"
+ "statistic"
],
- "summary": "批量完成工单",
- "operationId": "batchCompleteWorkflowsV1",
- "deprecated": true,
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "description": "batch complete workflows request",
- "name": "data",
- "in": "body",
- "required": true,
+ "summary": "获取License使用情况",
+ "operationId": "getLicenseUsageV1",
+ "responses": {
+ "200": {
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/v1.BatchCompleteWorkflowsReqV1"
+ "$ref": "#/definitions/v1.GetLicenseUsageResV1"
}
}
+ }
+ }
+ },
+ "/v1/statistic/workflows/audit_pass_percent": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get workflow audit pass percent",
+ "tags": [
+ "statistic"
],
+ "summary": "获取工单审核通过率",
+ "operationId": "getWorkflowAuditPassPercentV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetWorkflowAuditPassPercentResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/exports": {
+ "/v1/statistic/workflows/counts": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "export workflow",
+ "description": "get workflow counts",
"tags": [
- "workflow"
- ],
- "summary": "导出工单",
- "operationId": "exportWorkflowV1",
- "parameters": [
- {
- "type": "string",
- "description": "filter subject",
- "name": "filter_subject",
- "in": "query"
- },
- {
- "type": "string",
- "description": "fuzzy search by workflow description",
- "name": "fuzzy_search_workflow_desc",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create time from",
- "name": "filter_create_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create time to",
- "name": "filter_create_time_to",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_task_execute_start_time_from",
- "name": "filter_task_execute_start_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_task_execute_start_time_to",
- "name": "filter_task_execute_start_time_to",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create user name",
- "name": "filter_create_user_name",
- "in": "query"
- },
- {
- "enum": [
- "wait_for_audit",
- "wait_for_execution",
- "rejected",
- "executing",
- "canceled",
- "exec_failed",
- "finished"
- ],
- "type": "string",
- "description": "filter workflow status",
- "name": "filter_status",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter current step assignee user name",
- "name": "filter_current_step_assignee_user_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter instance name",
- "name": "filter_task_instance_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- }
+ "statistic"
],
+ "summary": "获取工单数量统计数据",
+ "operationId": "getWorkflowCountV1",
"responses": {
"200": {
- "description": "export workflow",
+ "description": "OK",
"schema": {
- "type": "file"
+ "$ref": "#/definitions/v1.GetWorkflowCountsResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/{workflow_id}/tasks/terminate": {
- "post": {
+ "/v1/statistic/workflows/duration_of_waiting_for_audit": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "terminate multiple task by project and workflow",
+ "description": "get duration from workflow being created to audited",
"tags": [
- "workflow"
- ],
- "summary": "终止工单下多个上线任务",
- "operationId": "terminateMultipleTaskByWorkflowV1",
- "parameters": [
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- }
+ "statistic"
],
+ "summary": "获取工单从创建到审核结束的平均时长",
+ "operationId": "getWorkflowDurationOfWaitingForAuditV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetWorkflowDurationOfWaitingForAuditResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/{workflow_id}/tasks/{task_id}/terminate": {
- "post": {
+ "/v1/statistic/workflows/duration_of_waiting_for_execution": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "execute one task on workflow",
+ "description": "get duration from workflow being created to executed",
"tags": [
- "workflow"
- ],
- "summary": "终止单个上线任务",
- "operationId": "terminateSingleTaskByWorkflowV1",
- "parameters": [
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- }
+ "statistic"
],
+ "summary": "获取工单各从审核完毕到执行上线的平均时长",
+ "operationId": "getWorkflowDurationOfWaitingForExecutionV1",
+ "deprecated": true,
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetWorkflowDurationOfWaitingForExecutionResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/{workflow_name}/": {
+ "/v1/statistic/workflows/each_day_counts": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get workflow detail",
+ "description": "get counts of created workflow each day",
"tags": [
- "workflow"
+ "statistic"
],
- "summary": "获取工单详情",
- "operationId": "getWorkflowV1",
- "deprecated": true,
+ "summary": "获取每天工单创建数量",
+ "operationId": "getWorkflowCreatedCountEachDayV1",
"parameters": [
{
"type": "string",
- "description": "workflow name",
- "name": "workflow_name",
- "in": "path",
+ "description": "filter date from.(format:yyyy-mm-dd)",
+ "name": "filter_date_from",
+ "in": "query",
"required": true
},
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
+ "description": "filter date to.(format:yyyy-mm-dd)",
+ "name": "filter_date_to",
+ "in": "query",
"required": true
}
],
@@ -6112,92 +5547,78 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowResV1"
+ "$ref": "#/definitions/v1.GetWorkflowCreatedCountsEachDayResV1"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v1/statistic/workflows/instance_type_percent": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update workflow when it is rejected to creator.",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "get workflows percent counted by instance type",
"tags": [
- "workflow"
+ "statistic"
],
- "summary": "更新工单(驳回后才可更新)",
- "operationId": "updateWorkflowV1",
- "deprecated": true,
- "parameters": [
- {
- "type": "string",
- "description": "workflow name",
- "name": "workflow_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "description": "update workflow request",
- "name": "instance",
- "in": "body",
- "required": true,
+ "summary": "获取按数据源类型统计的工单百分比",
+ "operationId": "getWorkflowPercentCountedByInstanceTypeV1",
+ "responses": {
+ "200": {
+ "description": "OK",
"schema": {
- "$ref": "#/definitions/v1.UpdateWorkflowReqV1"
+ "$ref": "#/definitions/v1.GetWorkflowPercentCountedByInstanceTypeResV1"
}
}
+ }
+ }
+ },
+ "/v1/statistic/workflows/pass_percent": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
],
+ "description": "get workflow pass percent",
+ "tags": [
+ "statistic"
+ ],
+ "summary": "获取工单通过率",
+ "operationId": "getWorkflowPassPercentV1",
+ "deprecated": true,
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetWorkflowPassPercentResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/{workflow_name}/cancel": {
- "post": {
+ "/v1/statistic/workflows/rejected_percent_group_by_creator": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "cancel workflow",
+ "description": "get workflows rejected percent group by creator. The result will be sorted by rejected percent in descending order",
"tags": [
- "workflow"
+ "statistic"
],
- "summary": "审批关闭(中止)",
- "operationId": "cancelWorkflowV1",
- "deprecated": true,
+ "summary": "获取各个用户提交的工单驳回率,按驳回率降序排列",
+ "operationId": "getWorkflowRejectedPercentGroupByCreatorV1",
"parameters": [
{
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "workflow name",
- "name": "workflow_name",
- "in": "path",
+ "type": "integer",
+ "description": "the limit of result item number",
+ "name": "limit",
+ "in": "query",
"required": true
}
],
@@ -6205,141 +5626,148 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetWorkflowRejectedPercentGroupByCreatorResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/{workflow_name}/steps/{workflow_step_id}/approve": {
- "post": {
+ "/v1/statistic/workflows/rejected_percent_group_by_instance": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "approve workflow",
+ "description": "get workflow rejected percent group by instance. The result will be sorted by rejected percent in descending order",
"tags": [
- "workflow"
+ "statistic"
],
- "summary": "审批通过",
- "operationId": "approveWorkflowV1",
+ "summary": "获取各个数据源相关的工单驳回率,按驳回率降序排列",
+ "operationId": "getWorkflowRejectedPercentGroupByInstanceV1",
"deprecated": true,
"parameters": [
{
- "type": "string",
- "description": "workflow name",
- "name": "workflow_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "workflow step id",
- "name": "workflow_step_id",
- "in": "path",
+ "type": "integer",
+ "description": "the limit of result item number",
+ "name": "limit",
+ "in": "query",
"required": true
- },
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/v1.GetWorkflowRejectedPercentGroupByInstanceResV1"
+ }
+ }
+ }
+ }
+ },
+ "/v1/statistic/workflows/status_count": {
+ "get": {
+ "security": [
{
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "ApiKeyAuth": []
}
],
+ "description": "get count of workflow status",
+ "tags": [
+ "statistic"
+ ],
+ "summary": "获取各种状态工单的数量",
+ "operationId": "getWorkflowStatusCountV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetWorkflowStatusCountResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/{workflow_name}/steps/{workflow_step_id}/reject": {
+ "/v1/task_groups/audit": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "reject workflow",
+ "description": "audit task group.\n1. formData[sql]: sql content;\n2. file[input_sql_file]: it is a sql file;\n3. file[input_mybatis_xml_file]: it is mybatis xml file, sql will be parsed from it.\n4. file[input_zip_file]: it is zip file, sql will be parsed from it.",
+ "consumes": [
+ "multipart/form-data"
+ ],
+ "produces": [
+ "application/json"
+ ],
"tags": [
- "workflow"
+ "task"
],
- "summary": "审批驳回",
- "operationId": "rejectWorkflowV1",
- "deprecated": true,
+ "summary": "审核任务组",
+ "operationId": "auditTaskGroupIdV1",
"parameters": [
{
- "type": "string",
- "description": "workflow name",
- "name": "workflow_name",
- "in": "path",
+ "type": "integer",
+ "description": "group id of tasks",
+ "name": "task_group_id",
+ "in": "formData",
"required": true
},
{
"type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
+ "description": "sqls for audit",
+ "name": "sql",
+ "in": "formData"
},
{
- "type": "string",
- "description": "workflow step id",
- "name": "workflow_step_id",
- "in": "path",
- "required": true
+ "type": "file",
+ "description": "input SQL file",
+ "name": "input_sql_file",
+ "in": "formData"
},
{
- "description": "workflow approve request",
- "name": "workflow_approve",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.RejectWorkflowReqV1"
- }
+ "type": "file",
+ "description": "input mybatis XML file",
+ "name": "input_mybatis_xml_file",
+ "in": "formData"
+ },
+ {
+ "type": "file",
+ "description": "input ZIP file",
+ "name": "input_zip_file",
+ "in": "formData"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.AuditTaskGroupResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/{workflow_name}/tasks": {
+ "/v1/tasks/audits/{task_id}/": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get summary of workflow instance tasks",
+ "description": "get task",
"tags": [
- "workflow"
+ "task"
],
- "summary": "获取工单数据源任务概览",
- "operationId": "getSummaryOfInstanceTasksV1",
- "deprecated": true,
+ "summary": "获取Sql扫描任务信息",
+ "operationId": "getAuditTaskV1",
"parameters": [
{
"type": "string",
- "description": "workflow name",
- "name": "workflow_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "task id",
+ "name": "task_id",
"in": "path",
"required": true
}
@@ -6348,38 +5776,30 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowTasksResV1"
+ "$ref": "#/definitions/v1.GetAuditTaskResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/{workflow_name}/tasks/execute": {
- "post": {
+ "/v1/tasks/audits/{task_id}/sql_content": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "execute tasks on workflow",
+ "description": "get SQL content for the audit task",
"tags": [
- "workflow"
+ "task"
],
- "summary": "多数据源批量上线",
- "operationId": "executeTasksOnWorkflowV1",
- "deprecated": true,
+ "summary": "获取指定扫描任务的SQL内容",
+ "operationId": "getAuditTaskSQLContentV1",
"parameters": [
{
"type": "string",
- "description": "workflow name",
- "name": "workflow_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
+ "description": "task id",
+ "name": "task_id",
"in": "path",
"required": true
}
@@ -6388,41 +5808,26 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetAuditTaskSQLContentResV1"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/{workflow_name}/tasks/{task_id}/execute": {
- "post": {
+ "/v1/tasks/audits/{task_id}/sql_file": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "execute one task on workflow",
+ "description": "download SQL file for the audit task",
"tags": [
- "workflow"
+ "task"
],
- "summary": "工单提交单个数据源上线",
- "operationId": "executeOneTaskOnWorkflowV1",
- "deprecated": true,
+ "summary": "下载指定扫描任务的SQL文件",
+ "operationId": "downloadAuditTaskSQLFileV1",
"parameters": [
- {
- "type": "string",
- "description": "workflow name",
- "name": "workflow_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
{
"type": "string",
"description": "task id",
@@ -6433,42 +5838,28 @@
],
"responses": {
"200": {
- "description": "OK",
+ "description": "sql file",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "type": "file"
}
}
}
}
},
- "/v1/projects/{project_name}/workflows/{workflow_name}/tasks/{task_id}/schedule": {
- "put": {
+ "/v1/tasks/audits/{task_id}/sql_report": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update workflow schedule.",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "download report file of all SQLs information belong to the specified audit task",
"tags": [
- "workflow"
+ "task"
],
- "summary": "设置工单数据源定时上线时间(设置为空则代表取消定时时间,需要SQL审核流程都通过后才可以设置)",
- "operationId": "updateWorkflowScheduleV1",
- "deprecated": true,
+ "summary": "下载指定扫描任务的SQLs信息报告",
+ "operationId": "downloadAuditTaskSQLReportV1",
"parameters": [
- {
- "type": "string",
- "description": "workflow name",
- "name": "workflow_name",
- "in": "path",
- "required": true
- },
{
"type": "string",
"description": "task id",
@@ -6477,91 +5868,95 @@
"required": true
},
{
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "description": "update workflow schedule request",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateWorkflowScheduleReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/role_tips": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
+ "type": "boolean",
+ "description": "select unique (fingerprint and audit result) for task sql",
+ "name": "no_duplicate",
+ "in": "query"
}
],
- "description": "get role tip list",
- "tags": [
- "role"
- ],
- "summary": "获取角色提示列表",
- "operationId": "getRoleTipListV1",
"responses": {
"200": {
- "description": "OK",
+ "description": "sql report csv file",
"schema": {
- "$ref": "#/definitions/v1.GetRoleTipsResV1"
+ "type": "file"
}
}
}
}
},
- "/v1/roles": {
+ "/v1/tasks/audits/{task_id}/sqls": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get role list",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "get information of all SQLs belong to the specified audit task",
"tags": [
- "role"
+ "task"
],
- "summary": "获取角色列表",
- "operationId": "getRoleListV1",
+ "summary": "获取指定扫描任务的SQLs信息",
+ "operationId": "getAuditTaskSQLsV1",
"parameters": [
{
"type": "string",
- "description": "filter role name",
- "name": "filter_role_name",
+ "description": "task id",
+ "name": "task_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "enum": [
+ "initialized",
+ "doing",
+ "succeeded",
+ "failed",
+ "manually_executed"
+ ],
+ "type": "string",
+ "description": "filter: exec status of task sql",
+ "name": "filter_exec_status",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "initialized",
+ "doing",
+ "finished"
+ ],
+ "type": "string",
+ "description": "filter: audit status of task sql",
+ "name": "filter_audit_status",
"in": "query"
},
{
- "type": "integer",
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ],
+ "type": "string",
+ "description": "filter: audit level of task sql",
+ "name": "filter_audit_level",
+ "in": "query"
+ },
+ {
+ "type": "boolean",
+ "description": "select unique (fingerprint and audit result) for task sql",
+ "name": "no_duplicate",
+ "in": "query"
+ },
+ {
+ "type": "string",
"description": "page index",
"name": "page_index",
"in": "query",
"required": true
},
{
- "type": "integer",
- "description": "size of per page",
+ "type": "string",
+ "description": "page size",
"name": "page_size",
"in": "query",
"required": true
@@ -6571,37 +5966,50 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRolesResV1"
+ "$ref": "#/definitions/v1.GetAuditTaskSQLsResV1"
}
}
}
- },
- "post": {
+ }
+ },
+ "/v1/tasks/audits/{task_id}/sqls/{number}": {
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "create role",
+ "description": "modify the relevant information of a certain SQL in the audit task",
"consumes": [
"application/json"
],
- "produces": [
- "application/json"
- ],
"tags": [
- "role"
+ "task"
],
- "summary": "创建角色",
- "operationId": "createRoleV1",
+ "summary": "修改扫描任务中某条SQL的相关信息",
+ "operationId": "updateAuditTaskSQLsV1",
"parameters": [
{
- "description": "create role",
- "name": "instance",
+ "type": "string",
+ "description": "task id",
+ "name": "task_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "sql number",
+ "name": "number",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "modify the relevant information of a certain SQL in the audit task",
+ "name": "audit_plan",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.CreateRoleReqV1"
+ "$ref": "#/definitions/v1.UpdateAuditTaskSQLsReqV1"
}
}
],
@@ -6615,30 +6023,31 @@
}
}
},
- "/v1/roles/{role_name}/": {
- "delete": {
+ "/v1/tasks/audits/{task_id}/sqls/{number}/analysis": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "delete role",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "get SQL explain and related table metadata for analysis",
"tags": [
- "role"
+ "task"
],
- "summary": "删除角色",
- "operationId": "deleteRoleV1",
+ "summary": "获取task相关的SQL执行计划和表元数据",
+ "operationId": "getTaskAnalysisData",
"parameters": [
{
"type": "string",
- "description": "role name",
- "name": "role_name",
+ "description": "task id",
+ "name": "task_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "sql number",
+ "name": "number",
"in": "path",
"required": true
}
@@ -6647,129 +6056,167 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetTaskAnalysisDataResV1"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v1/user_tips": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update role",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
+ "description": "get user tip list",
"tags": [
- "role"
+ "user"
],
- "summary": "更新角色信息",
- "operationId": "updateRoleV1",
+ "summary": "获取用户提示列表",
+ "operationId": "getUserTipListV1",
"parameters": [
{
"type": "string",
- "description": "role name",
- "name": "role_name",
- "in": "path",
+ "description": "project name",
+ "name": "filter_project",
+ "in": "query",
"required": true
- },
- {
- "description": "update role request",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateRoleReqV1"
- }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v1.GetUserTipsResV1"
}
}
}
}
},
- "/v1/rule_knowledge/db_types/{db_type}/custom_rules/{rule_name}/": {
+ "/v1/workflows": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get custom rule knowledge",
+ "description": "get global workflow list",
"tags": [
- "rule_template"
+ "workflow"
],
- "summary": "查看自定义规则知识库",
- "operationId": "getCustomRuleKnowledgeV1",
+ "summary": "获取全局工单列表",
+ "operationId": "getGlobalWorkflowsV1",
"parameters": [
{
"type": "string",
- "description": "rule name",
- "name": "rule_name",
- "in": "path",
- "required": true
+ "description": "filter subject",
+ "name": "filter_subject",
+ "in": "query"
},
{
"type": "string",
- "description": "db type of rule",
- "name": "db_type",
- "in": "path",
- "required": true
- }
- ],
+ "description": "filter create time from",
+ "name": "filter_create_time_from",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter create time to",
+ "name": "filter_create_time_to",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_task_execute_start_time_from",
+ "name": "filter_task_execute_start_time_from",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter_task_execute_start_time_to",
+ "name": "filter_task_execute_start_time_to",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter create user id",
+ "name": "filter_create_user_id",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "wait_for_audit",
+ "wait_for_execution",
+ "rejected",
+ "executing",
+ "canceled",
+ "exec_failed",
+ "finished"
+ ],
+ "type": "string",
+ "description": "filter workflow status",
+ "name": "filter_status",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter current step assignee user id",
+ "name": "filter_current_step_assignee_user_id",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "filter instance id",
+ "name": "filter_task_instance_name",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "size of per page",
+ "name": "page_size",
+ "in": "query",
+ "required": true
+ }
+ ],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRuleKnowledgeResV1"
+ "$ref": "#/definitions/v1.GetWorkflowsResV1"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v2/audit_files": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update custom rule knowledge",
+ "description": "Direct audit sql from SQL files and MyBatis files",
"tags": [
- "rule_template"
+ "sql_audit"
],
- "summary": "更新自定义规则知识库",
- "operationId": "updateCustomRuleKnowledge",
+ "summary": "直接从文件内容提取SQL并审核,SQL文件暂时只支持一次解析一个文件",
+ "operationId": "directAuditFilesV2",
"parameters": [
{
- "type": "string",
- "description": "rule name",
- "name": "rule_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "db type of rule",
- "name": "db_type",
- "in": "path",
- "required": true
- },
- {
- "description": "update rule knowledge",
+ "description": "files that should be audited",
"name": "req",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.UpdateRuleKnowledgeReq"
+ "$ref": "#/definitions/v2.DirectAuditFileReqV2"
}
}
],
@@ -6777,142 +6224,140 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v2.DirectAuditResV2"
}
}
}
}
},
- "/v1/rule_knowledge/db_types/{db_type}/rules/{rule_name}/": {
+ "/v2/configurations/drivers": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get rule knowledge",
+ "description": "get drivers",
"tags": [
- "rule_template"
- ],
- "summary": "查看规则知识库",
- "operationId": "getRuleKnowledgeV1",
- "parameters": [
- {
- "type": "string",
- "description": "rule name",
- "name": "rule_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "db type of rule",
- "name": "db_type",
- "in": "path",
- "required": true
- }
+ "configuration"
],
+ "summary": "获取当前 server 支持的审核类型",
+ "operationId": "getDriversV2",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRuleKnowledgeResV1"
+ "$ref": "#/definitions/v2.GetDriversRes"
}
}
}
- },
- "patch": {
+ }
+ },
+ "/v2/projects/{project_name}/audit_plans": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update rule knowledge",
+ "description": "get audit plan info list",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "更新规则知识库",
- "operationId": "updateRuleKnowledge",
+ "summary": "获取扫描任务信息列表",
+ "operationId": "getAuditPlansV2",
"parameters": [
{
"type": "string",
- "description": "rule name",
- "name": "rule_name",
+ "description": "project name",
+ "name": "project_name",
"in": "path",
"required": true
},
{
"type": "string",
- "description": "db type of rule",
- "name": "db_type",
- "in": "path",
- "required": true
+ "description": "filter audit plan db type",
+ "name": "filter_audit_plan_db_type",
+ "in": "query"
},
{
- "description": "update rule knowledge",
- "name": "req",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateRuleKnowledgeReq"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/rule_template_tips": {
- "get": {
- "security": [
+ "type": "string",
+ "description": "fuzzy search audit plan name",
+ "name": "fuzzy_search_audit_plan_name",
+ "in": "query"
+ },
{
- "ApiKeyAuth": []
- }
- ],
- "description": "get global rule template tips",
- "tags": [
- "rule_template"
- ],
- "summary": "获取全局规则模板提示",
- "operationId": "getRuleTemplateTipsV1",
- "parameters": [
+ "type": "string",
+ "description": "filter audit plan type",
+ "name": "filter_audit_plan_type",
+ "in": "query"
+ },
{
"type": "string",
- "description": "filter db type",
- "name": "filter_db_type",
+ "description": "filter audit plan instance name",
+ "name": "filter_audit_plan_instance_name",
"in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "size of per page",
+ "name": "page_size",
+ "in": "query",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRuleTemplateTipsResV1"
+ "$ref": "#/definitions/v2.GetAuditPlansResV2"
}
}
}
}
},
- "/v1/rule_templates": {
+ "/v2/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get all global rule template",
+ "description": "get audit plan report SQLs",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "全局规则模板列表",
- "operationId": "getRuleTemplateListV1",
+ "summary": "获取指定扫描任务的SQL扫描详情",
+ "operationId": "getAuditPlanReportsSQLs",
"parameters": [
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "audit plan report id",
+ "name": "audit_plan_report_id",
+ "in": "path",
+ "required": true
+ },
{
"type": "integer",
"description": "page index",
@@ -6932,100 +6377,51 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRuleTemplatesResV1"
+ "$ref": "#/definitions/v2.GetAuditPlanReportSQLsResV2"
}
}
}
- },
- "post": {
+ }
+ },
+ "/v2/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls/{number}/analysis": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "create a global rule template",
- "consumes": [
- "application/json"
- ],
+ "description": "get SQL explain and related table metadata for analysis",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "添加全局规则模板",
- "operationId": "createRuleTemplateV1",
+ "summary": "获取task相关的SQL执行计划和表元数据",
+ "operationId": "getAuditPlantAnalysisDataV2",
"parameters": [
{
- "description": "add rule template request",
- "name": "req",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.CreateRuleTemplateReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/rule_templates/parse": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "parse rule template",
- "consumes": [
- "multipart/form-data"
- ],
- "tags": [
- "rule_template"
- ],
- "summary": "解析规则模板文件",
- "operationId": "importProjectRuleTemplateV1",
- "parameters": [
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
{
- "type": "file",
- "description": "SQLE rule template file",
- "name": "rule_template_file",
- "in": "formData",
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
"required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.ParseProjectRuleTemplateFileResV1"
- }
- }
- }
- }
- },
- "/v1/rule_templates/{rule_template_name}/": {
- "get": {
- "security": [
+ },
{
- "ApiKeyAuth": []
- }
- ],
- "description": "get global rule template",
- "tags": [
- "rule_template"
- ],
- "summary": "获取全局规则模板信息",
- "operationId": "getRuleTemplateV1",
- "parameters": [
+ "type": "string",
+ "description": "audit plan report id",
+ "name": "audit_plan_report_id",
+ "in": "path",
+ "required": true
+ },
{
"type": "string",
- "description": "rule template name",
- "name": "rule_template_name",
+ "description": "sql number",
+ "name": "number",
"in": "path",
"required": true
}
@@ -7034,68 +6430,47 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRuleTemplateResV1"
+ "$ref": "#/definitions/v2.GetAuditPlanAnalysisDataResV2"
}
}
}
- },
- "delete": {
+ }
+ },
+ "/v2/projects/{project_name}/audit_plans/{audit_plan_name}/sqls/full": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "delete global rule template",
+ "description": "full sync audit plan SQLs",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "删除全局规则模板",
- "operationId": "deleteRuleTemplateV1",
+ "summary": "全量同步SQL到扫描任务",
+ "operationId": "fullSyncAuditPlanSQLsV2",
"parameters": [
{
"type": "string",
- "description": "rule template name",
- "name": "rule_template_name",
+ "description": "project name",
+ "name": "project_name",
"in": "path",
"required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- },
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "update global rule template",
- "tags": [
- "rule_template"
- ],
- "summary": "更新全局规则模板",
- "operationId": "updateRuleTemplateV1",
- "parameters": [
+ },
{
"type": "string",
- "description": "rule template name",
- "name": "rule_template_name",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
"in": "path",
"required": true
},
{
- "description": "update rule template request",
- "name": "req",
+ "description": "full sync audit plan SQLs request",
+ "name": "sqls",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.UpdateRuleTemplateReqV1"
+ "$ref": "#/definitions/v2.FullSyncAuditPlanSQLsReqV2"
}
}
],
@@ -7109,37 +6484,41 @@
}
}
},
- "/v1/rule_templates/{rule_template_name}/clone": {
+ "/v2/projects/{project_name}/audit_plans/{audit_plan_name}/sqls/partial": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "clone a rule template",
- "consumes": [
- "application/json"
- ],
+ "description": "partial sync audit plan SQLs",
"tags": [
- "rule_template"
+ "audit_plan"
],
- "summary": "克隆全局规则模板",
- "operationId": "CloneRuleTemplateV1",
+ "summary": "增量同步SQL到扫描任务",
+ "operationId": "partialSyncAuditPlanSQLsV2",
"parameters": [
{
"type": "string",
- "description": "rule template name",
- "name": "rule_template_name",
+ "description": "project name",
+ "name": "project_name",
"in": "path",
"required": true
},
{
- "description": "clone rule template request",
- "name": "req",
+ "type": "string",
+ "description": "audit plan name",
+ "name": "audit_plan_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "partial sync audit plan SQLs request",
+ "name": "sqls",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.CloneRuleTemplateReqV1"
+ "$ref": "#/definitions/v2.PartialSyncAuditPlanSQLsReqV2"
}
}
],
@@ -7153,276 +6532,355 @@
}
}
},
- "/v1/rule_templates/{rule_template_name}/export": {
+ "/v2/projects/{project_name}/instances/{instance_name}/": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "export rule template",
+ "description": "get instance db",
"tags": [
- "rule_template"
+ "instance"
],
- "summary": "导出全局规则模板",
- "operationId": "exportRuleTemplateV1",
+ "summary": "获取实例信息",
+ "operationId": "getInstanceV2",
"parameters": [
{
"type": "string",
- "description": "rule template name",
- "name": "rule_template_name",
+ "description": "project name",
+ "name": "project_name",
"in": "path",
"required": true
- }
- ],
- "responses": {
- "200": {
- "description": "sqle rule template file",
- "schema": {
- "type": "file"
- }
- }
- }
- }
- },
- "/v1/rules": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get all rule template",
- "tags": [
- "rule_template"
- ],
- "summary": "规则列表",
- "operationId": "getRuleListV1",
- "parameters": [
- {
- "type": "string",
- "description": "filter db type",
- "name": "filter_db_type",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter global rule template name",
- "name": "filter_global_rule_template_name",
- "in": "query"
},
{
"type": "string",
- "description": "filter rule name list",
- "name": "filter_rule_names",
- "in": "query"
+ "description": "instance name",
+ "name": "instance_name",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetRulesResV1"
+ "$ref": "#/definitions/v2.GetInstanceResV2"
}
}
}
}
},
- "/v1/sql_analysis": {
+ "/v2/projects/{project_name}/sql_manages": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Direct get sql analysis result",
+ "description": "get sql manage list",
"tags": [
- "sql_analysis"
+ "SqlManage"
],
- "summary": "直接获取SQL分析结果",
- "operationId": "directGetSQLAnalysisV1",
+ "summary": "获取管控sql列表",
+ "operationId": "GetSqlManageListV2",
"parameters": [
{
"type": "string",
"description": "project name",
"name": "project_name",
- "in": "query",
+ "in": "path",
"required": true
},
{
"type": "string",
- "description": "instance name",
- "name": "instance_name",
- "in": "query",
- "required": true
+ "description": "fuzzy search sql fingerprint",
+ "name": "fuzzy_search_sql_fingerprint",
+ "in": "query"
},
{
"type": "string",
- "description": "schema name",
- "name": "schema_name",
+ "description": "assignee",
+ "name": "filter_assignee",
"in": "query"
},
{
"type": "string",
- "description": "sql",
- "name": "sql",
+ "description": "instance name",
+ "name": "filter_instance_name",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "audit_plan",
+ "sql_audit_record"
+ ],
+ "type": "string",
+ "description": "source",
+ "name": "filter_source",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ],
+ "type": "string",
+ "description": "audit level",
+ "name": "filter_audit_level",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "last audit start time from",
+ "name": "filter_last_audit_start_time_from",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "last audit start time to",
+ "name": "filter_last_audit_start_time_to",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "unhandled",
+ "solved",
+ "ignored",
+ "manual_audited"
+ ],
+ "type": "string",
+ "description": "status",
+ "name": "filter_status",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "rule name",
+ "name": "filter_rule_name",
"in": "query"
+ },
+ {
+ "type": "string",
+ "description": "db type",
+ "name": "filter_db_type",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "fuzzy search endpoint",
+ "name": "fuzzy_search_endpoint",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "fuzzy search schema name",
+ "name": "fuzzy_search_schema_name",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "first_appear_timestamp",
+ "last_receive_timestamp",
+ "fp_count"
+ ],
+ "type": "string",
+ "description": "sort field",
+ "name": "sort_field",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "asc",
+ "desc"
+ ],
+ "type": "string",
+ "description": "sort order",
+ "name": "sort_order",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "size of per page",
+ "name": "page_size",
+ "in": "query",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.DirectGetSQLAnalysisResV1"
+ "$ref": "#/definitions/v2.GetSqlManageListResp"
}
}
}
}
},
- "/v1/sql_audit": {
+ "/v2/projects/{project_name}/workflows": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Direct audit sql",
+ "description": "create workflow",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
"tags": [
- "sql_audit"
+ "workflow"
],
- "summary": "直接审核SQL",
- "operationId": "directAuditV1",
- "deprecated": true,
+ "summary": "创建工单",
+ "operationId": "createWorkflowV2",
"parameters": [
{
- "description": "sqls that should be audited",
- "name": "req",
+ "description": "create workflow request",
+ "name": "instance",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.DirectAuditReqV1"
+ "$ref": "#/definitions/v2.CreateWorkflowReqV2"
}
+ },
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.DirectAuditResV1"
+ "$ref": "#/definitions/v2.CreateWorkflowResV2"
}
}
}
}
},
- "/v1/static/instance_logo": {
- "get": {
+ "/v2/projects/{project_name}/workflows/cancel": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get instance type logo",
+ "description": "batch cancel workflows",
"tags": [
- "instance"
+ "workflow"
],
- "summary": "获取实例类型logo",
- "operationId": "getInstanceTypeLogo",
+ "summary": "批量取消工单",
+ "operationId": "batchCancelWorkflowsV2",
"parameters": [
{
"type": "string",
- "description": "instance type",
- "name": "instance_type",
- "in": "query",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
"required": true
- }
- ],
- "responses": {
- "200": {
- "description": "get instance type logo",
+ },
+ {
+ "description": "batch cancel workflows request",
+ "name": "BatchCancelWorkflowsReqV2",
+ "in": "body",
+ "required": true,
"schema": {
- "type": "file"
+ "$ref": "#/definitions/v2.BatchCancelWorkflowsReqV2"
}
}
- }
- }
- },
- "/v1/static/logo": {
- "get": {
- "description": "get logo",
- "tags": [
- "configuration"
- ],
- "summary": "获取logo",
- "operationId": "getLogo",
- "parameters": [
- {
- "type": "string",
- "description": "timestamp",
- "name": "timestamp",
- "in": "query"
- }
],
"responses": {
"200": {
- "description": "get logo",
+ "description": "OK",
"schema": {
- "type": "file"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/statistic/instances/sql_average_execution_time": {
- "get": {
+ "/v2/projects/{project_name}/workflows/complete": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get average execution time of sql",
+ "description": "this api will directly change the work order status to finished without real online operation",
"tags": [
- "statistic"
+ "workflow"
],
- "summary": "获取sql上线平均耗时,按平均耗时降序排列",
- "operationId": "getSqlAverageExecutionTimeV1",
+ "summary": "批量完成工单",
+ "operationId": "batchCompleteWorkflowsV2",
"parameters": [
{
- "type": "integer",
- "description": "the limit of result item number",
- "name": "limit",
- "in": "query",
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
"required": true
+ },
+ {
+ "description": "batch complete workflows request",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v2.BatchCompleteWorkflowsReqV2"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSqlAverageExecutionTimeResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/statistic/instances/sql_execution_fail_percent": {
+ "/v2/projects/{project_name}/workflows/{workflow_id}/": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get sql execution fail percent",
+ "description": "get workflow detail",
"tags": [
- "statistic"
+ "workflow"
],
- "summary": "获取SQL上线失败率,按失败率降序排列",
- "operationId": "getSqlExecutionFailPercentV1",
+ "summary": "获取工单详情",
+ "operationId": "getWorkflowV2",
"parameters": [
{
- "type": "integer",
- "description": "the limit of result item number",
- "name": "limit",
- "in": "query",
+ "type": "string",
+ "description": "workflow id",
+ "name": "workflow_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
"required": true
}
],
@@ -7430,177 +6888,315 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSqlExecutionFailPercentResV1"
+ "$ref": "#/definitions/v2.GetWorkflowResV2"
}
}
}
- }
- },
- "/v1/statistic/instances/type_percent": {
- "get": {
+ },
+ "patch": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get database instances' types percent",
- "tags": [
- "statistic"
+ "description": "update workflow when it is rejected to creator.",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "workflow"
+ ],
+ "summary": "更新工单(驳回后才可更新)",
+ "operationId": "updateWorkflowV2",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "workflow id",
+ "name": "workflow_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "update workflow request",
+ "name": "instance",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v2.UpdateWorkflowReqV2"
+ }
+ }
],
- "summary": "获取数据源类型百分比",
- "operationId": "getInstancesTypePercentV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetInstancesTypePercentResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/statistic/license/usage": {
- "get": {
+ "/v2/projects/{project_name}/workflows/{workflow_id}/cancel": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get usage of license",
+ "description": "cancel workflow",
"tags": [
- "statistic"
+ "workflow"
+ ],
+ "summary": "审批关闭(中止)",
+ "operationId": "cancelWorkflowV2",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "workflow id",
+ "name": "workflow_id",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "获取License使用情况",
- "operationId": "getLicenseUsageV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetLicenseUsageResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/statistic/workflows/audit_pass_percent": {
- "get": {
+ "/v2/projects/{project_name}/workflows/{workflow_id}/steps/{workflow_step_id}/approve": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get workflow audit pass percent",
+ "description": "approve workflow",
"tags": [
- "statistic"
+ "workflow"
+ ],
+ "summary": "审批通过",
+ "operationId": "approveWorkflowV2",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "workflow id",
+ "name": "workflow_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "workflow step id",
+ "name": "workflow_step_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "获取工单审核通过率",
- "operationId": "getWorkflowAuditPassPercentV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowAuditPassPercentResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/statistic/workflows/counts": {
- "get": {
+ "/v2/projects/{project_name}/workflows/{workflow_id}/steps/{workflow_step_id}/reject": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get workflow counts",
+ "description": "reject workflow",
"tags": [
- "statistic"
+ "workflow"
+ ],
+ "summary": "审批驳回",
+ "operationId": "rejectWorkflowV2",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "workflow id",
+ "name": "workflow_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "workflow step id",
+ "name": "workflow_step_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "workflow approve request",
+ "name": "workflow_approve",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/v2.RejectWorkflowReqV2"
+ }
+ }
],
- "summary": "获取工单数量统计数据",
- "operationId": "getWorkflowCountV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowCountsResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/statistic/workflows/duration_of_waiting_for_audit": {
+ "/v2/projects/{project_name}/workflows/{workflow_id}/tasks": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get duration from workflow being created to audited",
+ "description": "get summary of workflow instance tasks",
"tags": [
- "statistic"
+ "workflow"
+ ],
+ "summary": "获取工单数据源任务概览",
+ "operationId": "getSummaryOfInstanceTasksV2",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "workflow id",
+ "name": "workflow_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "获取工单从创建到审核结束的平均时长",
- "operationId": "getWorkflowDurationOfWaitingForAuditV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowDurationOfWaitingForAuditResV1"
+ "$ref": "#/definitions/v2.GetWorkflowTasksResV2"
}
}
}
}
},
- "/v1/statistic/workflows/duration_of_waiting_for_execution": {
- "get": {
+ "/v2/projects/{project_name}/workflows/{workflow_id}/tasks/execute": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get duration from workflow being created to executed",
+ "description": "execute tasks on workflow",
"tags": [
- "statistic"
+ "workflow"
+ ],
+ "summary": "多数据源批量上线",
+ "operationId": "executeTasksOnWorkflowV2",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "workflow id",
+ "name": "workflow_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ }
],
- "summary": "获取工单各从审核完毕到执行上线的平均时长",
- "operationId": "getWorkflowDurationOfWaitingForExecutionV1",
- "deprecated": true,
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowDurationOfWaitingForExecutionResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/statistic/workflows/each_day_counts": {
- "get": {
+ "/v2/projects/{project_name}/workflows/{workflow_id}/tasks/{task_id}/execute": {
+ "post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get counts of created workflow each day",
+ "description": "execute one task on workflow",
"tags": [
- "statistic"
+ "workflow"
],
- "summary": "获取每天工单创建数量",
- "operationId": "getWorkflowCreatedCountEachDayV1",
+ "summary": "工单提交单个数据源上线",
+ "operationId": "executeOneTaskOnWorkflowV2",
"parameters": [
{
"type": "string",
- "description": "filter date from.(format:yyyy-mm-dd)",
- "name": "filter_date_from",
- "in": "query",
+ "description": "workflow id",
+ "name": "workflow_id",
+ "in": "path",
"required": true
},
{
"type": "string",
- "description": "filter date to.(format:yyyy-mm-dd)",
- "name": "filter_date_to",
- "in": "query",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "task id",
+ "name": "task_id",
+ "in": "path",
"required": true
}
],
@@ -7608,192 +7204,95 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowCreatedCountsEachDayResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/statistic/workflows/instance_type_percent": {
- "get": {
+ "/v2/projects/{project_name}/workflows/{workflow_id}/tasks/{task_id}/schedule": {
+ "put": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get workflows percent counted by instance type",
- "tags": [
- "statistic"
+ "description": "update workflow schedule.",
+ "consumes": [
+ "application/json"
],
- "summary": "获取按数据源类型统计的工单百分比",
- "operationId": "getWorkflowPercentCountedByInstanceTypeV1",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetWorkflowPercentCountedByInstanceTypeResV1"
- }
- }
- }
- }
- },
- "/v1/statistic/workflows/pass_percent": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get workflow pass percent",
- "tags": [
- "statistic"
- ],
- "summary": "获取工单通过率",
- "operationId": "getWorkflowPassPercentV1",
- "deprecated": true,
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetWorkflowPassPercentResV1"
- }
- }
- }
- }
- },
- "/v1/statistic/workflows/rejected_percent_group_by_creator": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
+ "produces": [
+ "application/json"
],
- "description": "get workflows rejected percent group by creator. The result will be sorted by rejected percent in descending order",
"tags": [
- "statistic"
+ "workflow"
],
- "summary": "获取各个用户提交的工单驳回率,按驳回率降序排列",
- "operationId": "getWorkflowRejectedPercentGroupByCreatorV1",
+ "summary": "设置工单数据源定时上线时间(设置为空则代表取消定时时间,需要SQL审核流程都通过后才可以设置)",
+ "operationId": "updateWorkflowScheduleV2",
"parameters": [
{
- "type": "integer",
- "description": "the limit of result item number",
- "name": "limit",
- "in": "query",
+ "type": "string",
+ "description": "workflow id",
+ "name": "workflow_id",
+ "in": "path",
"required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetWorkflowRejectedPercentGroupByCreatorResV1"
- }
- }
- }
- }
- },
- "/v1/statistic/workflows/rejected_percent_group_by_instance": {
- "get": {
- "security": [
+ },
{
- "ApiKeyAuth": []
- }
- ],
- "description": "get workflow rejected percent group by instance. The result will be sorted by rejected percent in descending order",
- "tags": [
- "statistic"
- ],
- "summary": "获取各个数据源相关的工单驳回率,按驳回率降序排列",
- "operationId": "getWorkflowRejectedPercentGroupByInstanceV1",
- "deprecated": true,
- "parameters": [
+ "type": "string",
+ "description": "task id",
+ "name": "task_id",
+ "in": "path",
+ "required": true
+ },
{
- "type": "integer",
- "description": "the limit of result item number",
- "name": "limit",
- "in": "query",
+ "type": "string",
+ "description": "project name",
+ "name": "project_name",
+ "in": "path",
"required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
+ },
+ {
+ "description": "update workflow schedule request",
+ "name": "instance",
+ "in": "body",
+ "required": true,
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowRejectedPercentGroupByInstanceResV1"
+ "$ref": "#/definitions/v2.UpdateWorkflowScheduleReqV2"
}
}
- }
- }
- },
- "/v1/statistic/workflows/status_count": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get count of workflow status",
- "tags": [
- "statistic"
],
- "summary": "获取各种状态工单的数量",
- "operationId": "getWorkflowStatusCountV1",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetWorkflowStatusCountResV1"
+ "$ref": "#/definitions/controller.BaseRes"
}
}
}
}
},
- "/v1/sync_instances": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get sync instance task list",
- "tags": [
- "sync_instance"
- ],
- "summary": "获取同步实例任务列表",
- "operationId": "GetSyncInstanceTaskList",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetSyncInstanceTaskListResV1"
- }
- }
- }
- },
+ "/v2/sql_audit": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "create sync instance task",
- "consumes": [
- "application/json"
- ],
+ "description": "Direct audit sql",
"tags": [
- "sync_instance"
+ "sql_audit"
],
- "summary": "创建同步实例任务",
- "operationId": "createSyncInstanceTaskV1",
+ "summary": "直接审核SQL",
+ "operationId": "directAuditV2",
+ "deprecated": true,
"parameters": [
{
- "description": "create sync instance task request",
- "name": "sync_task",
+ "description": "sqls that should be audited",
+ "name": "req",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/v1.CreateSyncInstanceTaskReqV1"
+ "$ref": "#/definitions/v2.DirectAuditReqV2"
}
}
],
@@ -7801,4745 +7300,496 @@
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/controller.BaseRes"
+ "$ref": "#/definitions/v2.DirectAuditResV2"
}
}
}
}
},
- "/v1/sync_instances/source_tips": {
+ "/v2/tasks/audits/{task_id}/sqls": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get sync task tips",
+ "description": "get information of all SQLs belong to the specified audit task",
"tags": [
- "sync_instance"
+ "task"
+ ],
+ "summary": "获取指定扫描任务的SQLs信息",
+ "operationId": "getAuditTaskSQLsV2",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "task id",
+ "name": "task_id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "enum": [
+ "initialized",
+ "doing",
+ "succeeded",
+ "failed",
+ "manually_executed",
+ "terminating",
+ "terminate_succeeded",
+ "terminate_failed"
+ ],
+ "type": "string",
+ "description": "filter: exec status of task sql",
+ "name": "filter_exec_status",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "initialized",
+ "doing",
+ "finished"
+ ],
+ "type": "string",
+ "description": "filter: audit status of task sql",
+ "name": "filter_audit_status",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ],
+ "type": "string",
+ "description": "filter: audit level of task sql",
+ "name": "filter_audit_level",
+ "in": "query"
+ },
+ {
+ "type": "boolean",
+ "description": "select unique (fingerprint and audit result) for task sql",
+ "name": "no_duplicate",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "page index",
+ "name": "page_index",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "page size",
+ "name": "page_size",
+ "in": "query",
+ "required": true
+ }
],
- "summary": "获取同步任务提示",
- "operationId": "GetSyncTaskSourceTips",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSyncTaskSourceTipsResV1"
+ "$ref": "#/definitions/v2.GetAuditTaskSQLsResV2"
}
}
}
}
},
- "/v1/sync_instances/{task_id}/": {
+ "/v2/tasks/audits/{task_id}/sqls/{number}/analysis": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get sync task detail",
+ "description": "get SQL explain and related table metadata for analysis",
"tags": [
- "sync_instance"
+ "task"
],
- "summary": "获取同步任务详情",
- "operationId": "GetSyncInstanceTask",
+ "summary": "获取task相关的SQL执行计划和表元数据",
+ "operationId": "getTaskAnalysisDataV2",
"parameters": [
{
"type": "string",
- "description": "sync task id",
+ "description": "task id",
"name": "task_id",
"in": "path",
"required": true
+ },
+ {
+ "type": "integer",
+ "description": "sql number",
+ "name": "number",
+ "in": "path",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/v1.GetSyncInstanceTaskResV1"
+ "$ref": "#/definitions/v2.GetTaskAnalysisDataResV2"
}
}
}
- },
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "delete sync instance task",
- "tags": [
- "sync_instance"
- ],
- "summary": "删除同步实例任务",
- "operationId": "deleteSyncInstanceTaskV1",
- "parameters": [
- {
- "type": "string",
- "description": "sync task id",
- "name": "task_id",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- },
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "update sync instance task",
- "tags": [
- "sync_instance"
- ],
- "summary": "更新同步实例任务",
- "operationId": "updateSyncInstanceTaskV1",
- "parameters": [
- {
- "type": "string",
- "description": "sync task id",
- "name": "task_id",
- "in": "path",
- "required": true
- },
- {
- "description": "update sync instance request",
- "name": "sync_task",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateSyncInstanceTaskReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/sync_instances/{task_id}/trigger": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "trigger sync instance",
- "tags": [
- "sync_instance"
- ],
- "summary": "触发同步实例",
- "operationId": "triggerSyncInstanceV1",
- "parameters": [
- {
- "type": "string",
- "description": "sync task id",
- "name": "task_id",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.TriggerSyncInstanceResV1"
- }
- }
- }
- }
- },
- "/v1/task_groups/audit": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "audit task group.\n1. formData[sql]: sql content;\n2. file[input_sql_file]: it is a sql file;\n3. file[input_mybatis_xml_file]: it is mybatis xml file, sql will be parsed from it.\n4. file[input_zip_file]: it is zip file, sql will be parsed from it.",
- "consumes": [
- "multipart/form-data"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "task"
- ],
- "summary": "审核任务组",
- "operationId": "auditTaskGroupIdV1",
- "parameters": [
- {
- "type": "integer",
- "description": "group id of tasks",
- "name": "task_group_id",
- "in": "formData",
- "required": true
- },
- {
- "type": "string",
- "description": "sqls for audit",
- "name": "sql",
- "in": "formData"
- },
- {
- "type": "file",
- "description": "input SQL file",
- "name": "input_sql_file",
- "in": "formData"
- },
- {
- "type": "file",
- "description": "input mybatis XML file",
- "name": "input_mybatis_xml_file",
- "in": "formData"
- },
- {
- "type": "file",
- "description": "input ZIP file",
- "name": "input_zip_file",
- "in": "formData"
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.AuditTaskGroupResV1"
- }
- }
- }
- }
- },
- "/v1/tasks/audits/{task_id}/": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get task",
- "tags": [
- "task"
- ],
- "summary": "获取Sql扫描任务信息",
- "operationId": "getAuditTaskV1",
- "parameters": [
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetAuditTaskResV1"
- }
- }
- }
- }
- },
- "/v1/tasks/audits/{task_id}/sql_content": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get SQL content for the audit task",
- "tags": [
- "task"
- ],
- "summary": "获取指定扫描任务的SQL内容",
- "operationId": "getAuditTaskSQLContentV1",
- "parameters": [
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetAuditTaskSQLContentResV1"
- }
- }
- }
- }
- },
- "/v1/tasks/audits/{task_id}/sql_file": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "download SQL file for the audit task",
- "tags": [
- "task"
- ],
- "summary": "下载指定扫描任务的SQL文件",
- "operationId": "downloadAuditTaskSQLFileV1",
- "parameters": [
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "sql file",
- "schema": {
- "type": "file"
- }
- }
- }
- }
- },
- "/v1/tasks/audits/{task_id}/sql_report": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "download report file of all SQLs information belong to the specified audit task",
- "tags": [
- "task"
- ],
- "summary": "下载指定扫描任务的SQLs信息报告",
- "operationId": "downloadAuditTaskSQLReportV1",
- "parameters": [
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- },
- {
- "type": "boolean",
- "description": "select unique (fingerprint and audit result) for task sql",
- "name": "no_duplicate",
- "in": "query"
- }
- ],
- "responses": {
- "200": {
- "description": "sql report csv file",
- "schema": {
- "type": "file"
- }
- }
- }
- }
- },
- "/v1/tasks/audits/{task_id}/sqls": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get information of all SQLs belong to the specified audit task",
- "tags": [
- "task"
- ],
- "summary": "获取指定扫描任务的SQLs信息",
- "operationId": "getAuditTaskSQLsV1",
- "parameters": [
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- },
- {
- "enum": [
- "initialized",
- "doing",
- "succeeded",
- "failed",
- "manually_executed"
- ],
- "type": "string",
- "description": "filter: exec status of task sql",
- "name": "filter_exec_status",
- "in": "query"
- },
- {
- "enum": [
- "initialized",
- "doing",
- "finished"
- ],
- "type": "string",
- "description": "filter: audit status of task sql",
- "name": "filter_audit_status",
- "in": "query"
- },
- {
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ],
- "type": "string",
- "description": "filter: audit level of task sql",
- "name": "filter_audit_level",
- "in": "query"
- },
- {
- "type": "boolean",
- "description": "select unique (fingerprint and audit result) for task sql",
- "name": "no_duplicate",
- "in": "query"
- },
- {
- "type": "string",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "string",
- "description": "page size",
- "name": "page_size",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetAuditTaskSQLsResV1"
- }
- }
- }
- }
- },
- "/v1/tasks/audits/{task_id}/sqls/{number}": {
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "modify the relevant information of a certain SQL in the audit task",
- "consumes": [
- "application/json"
- ],
- "tags": [
- "task"
- ],
- "summary": "修改扫描任务中某条SQL的相关信息",
- "operationId": "updateAuditTaskSQLsV1",
- "parameters": [
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "sql number",
- "name": "number",
- "in": "path",
- "required": true
- },
- {
- "description": "modify the relevant information of a certain SQL in the audit task",
- "name": "audit_plan",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateAuditTaskSQLsReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/tasks/audits/{task_id}/sqls/{number}/analysis": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get SQL explain and related table metadata for analysis",
- "tags": [
- "task"
- ],
- "summary": "获取task相关的SQL执行计划和表元数据",
- "operationId": "getTaskAnalysisData",
- "parameters": [
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- },
- {
- "type": "integer",
- "description": "sql number",
- "name": "number",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetTaskAnalysisDataResV1"
- }
- }
- }
- }
- },
- "/v1/user": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get current user info",
- "tags": [
- "user"
- ],
- "summary": "获取当前用户信息",
- "operationId": "getCurrentUserV1",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetUserDetailResV1"
- }
- }
- }
- },
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "update current user",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "user"
- ],
- "summary": "更新个人信息",
- "operationId": "updateCurrentUserV1",
- "parameters": [
- {
- "description": "update user",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateCurrentUserReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/user/password": {
- "put": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "update current user's password",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "user"
- ],
- "summary": "用户修改密码",
- "operationId": "UpdateCurrentUserPasswordV1",
- "parameters": [
- {
- "description": "update user's password",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateCurrentUserPasswordReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/user_group_tips": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get user group tip list",
- "tags": [
- "user_group"
- ],
- "summary": "获取用户组提示列表",
- "operationId": "getUserGroupTipListV1",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "filter_project",
- "in": "query"
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetUserGroupTipsResV1"
- }
- }
- }
- }
- },
- "/v1/user_groups": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get user group info list",
- "produces": [
- "application/json"
- ],
- "tags": [
- "user_group"
- ],
- "summary": "获取用户组列表",
- "operationId": "getUserGroupListV1",
- "parameters": [
- {
- "type": "string",
- "description": "filter user group name",
- "name": "filter_user_group_name",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetUserGroupsResV1"
- }
- }
- }
- },
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "create user group",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "user_group"
- ],
- "summary": "创建用户组",
- "operationId": "CreateUserGroupV1",
- "parameters": [
- {
- "description": "create user group",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.CreateUserGroupReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/user_groups/{user_group_name}/": {
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "delete user group",
- "tags": [
- "user_group"
- ],
- "summary": "删除用户组",
- "operationId": "deleteUserGroupV1",
- "parameters": [
- {
- "type": "string",
- "description": "user_group_name",
- "name": "user_group_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- },
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "update user group",
- "tags": [
- "user_group"
- ],
- "summary": "更新用户组",
- "operationId": "updateUserGroupV1",
- "parameters": [
- {
- "type": "string",
- "description": "user_group_name",
- "name": "user_group_name",
- "in": "path",
- "required": true
- },
- {
- "description": "update user group",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.PatchUserGroupReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/user_tips": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get user tip list",
- "tags": [
- "user"
- ],
- "summary": "获取用户提示列表",
- "operationId": "getUserTipListV1",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "filter_project",
- "in": "query"
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetUserTipsResV1"
- }
- }
- }
- }
- },
- "/v1/users": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get user info list",
- "tags": [
- "user"
- ],
- "summary": "获取用户信息列表",
- "operationId": "getUserListV1",
- "parameters": [
- {
- "type": "string",
- "description": "filter user name",
- "name": "filter_user_name",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetUsersResV1"
- }
- }
- }
- },
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "create user",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "user"
- ],
- "summary": "创建用户",
- "operationId": "createUserV1",
- "parameters": [
- {
- "description": "create user",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.CreateUserReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/users/{user_name}/": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get user info",
- "tags": [
- "user"
- ],
- "summary": "获取用户信息",
- "operationId": "getUserV1",
- "parameters": [
- {
- "type": "string",
- "description": "user name",
- "name": "user_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetUserDetailResV1"
- }
- }
- }
- },
- "delete": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "delete user",
- "tags": [
- "user"
- ],
- "summary": "删除用户",
- "operationId": "deleteUserV1",
- "parameters": [
- {
- "type": "string",
- "description": "user name",
- "name": "user_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- },
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "update user",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "user"
- ],
- "summary": "更新用户信息",
- "operationId": "updateUserV1",
- "parameters": [
- {
- "type": "string",
- "description": "user name",
- "name": "user_name",
- "in": "path",
- "required": true
- },
- {
- "description": "update user",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateUserReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/users/{user_name}/password": {
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "admin modifies the passwords of other users",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "user"
- ],
- "summary": "admin修改其他用户密码",
- "operationId": "UpdateOtherUserPasswordV1",
- "parameters": [
- {
- "type": "string",
- "description": "user name",
- "name": "user_name",
- "in": "path",
- "required": true
- },
- {
- "description": "change user's password",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UpdateOtherUserPasswordReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v1/workflows": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get global workflow list",
- "tags": [
- "workflow"
- ],
- "summary": "获取全局工单列表",
- "operationId": "getGlobalWorkflowsV1",
- "parameters": [
- {
- "type": "string",
- "description": "filter subject",
- "name": "filter_subject",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create time from",
- "name": "filter_create_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create time to",
- "name": "filter_create_time_to",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_task_execute_start_time_from",
- "name": "filter_task_execute_start_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter_task_execute_start_time_to",
- "name": "filter_task_execute_start_time_to",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter create user name",
- "name": "filter_create_user_name",
- "in": "query"
- },
- {
- "enum": [
- "wait_for_audit",
- "wait_for_execution",
- "rejected",
- "executing",
- "canceled",
- "exec_failed",
- "finished"
- ],
- "type": "string",
- "description": "filter workflow status",
- "name": "filter_status",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter current step assignee user name",
- "name": "filter_current_step_assignee_user_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter instance name",
- "name": "filter_task_instance_name",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v1.GetWorkflowsResV1"
- }
- }
- }
- }
- },
- "/v2/audit_files": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Direct audit sql from SQL files and MyBatis files",
- "tags": [
- "sql_audit"
- ],
- "summary": "直接从文件内容提取SQL并审核,SQL文件暂时只支持一次解析一个文件",
- "operationId": "directAuditFilesV2",
- "parameters": [
- {
- "description": "files that should be audited",
- "name": "req",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.DirectAuditFileReqV2"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.DirectAuditResV2"
- }
- }
- }
- }
- },
- "/v2/configurations/drivers": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get drivers",
- "tags": [
- "configuration"
- ],
- "summary": "获取当前 server 支持的审核类型",
- "operationId": "getDriversV2",
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetDriversRes"
- }
- }
- }
- }
- },
- "/v2/login": {
- "post": {
- "description": "user login",
- "tags": [
- "user"
- ],
- "summary": "用户登录",
- "operationId": "loginV2",
- "parameters": [
- {
- "description": "user login request",
- "name": "user",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v1.UserLoginReqV1"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/audit_plans": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get audit plan info list",
- "tags": [
- "audit_plan"
- ],
- "summary": "获取扫描任务信息列表",
- "operationId": "getAuditPlansV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "filter audit plan db type",
- "name": "filter_audit_plan_db_type",
- "in": "query"
- },
- {
- "type": "string",
- "description": "fuzzy search audit plan name",
- "name": "fuzzy_search_audit_plan_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter audit plan type",
- "name": "filter_audit_plan_type",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter audit plan instance name",
- "name": "filter_audit_plan_instance_name",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetAuditPlansResV2"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get audit plan report SQLs",
- "tags": [
- "audit_plan"
- ],
- "summary": "获取指定扫描任务的SQL扫描详情",
- "operationId": "getAuditPlanReportsSQLs",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "audit plan report id",
- "name": "audit_plan_report_id",
- "in": "path",
- "required": true
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetAuditPlanReportSQLsResV2"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls/{number}/analysis": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get SQL explain and related table metadata for analysis",
- "tags": [
- "audit_plan"
- ],
- "summary": "获取task相关的SQL执行计划和表元数据",
- "operationId": "getAuditPlantAnalysisDataV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "audit plan report id",
- "name": "audit_plan_report_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "sql number",
- "name": "number",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetAuditPlanAnalysisDataResV2"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/audit_plans/{audit_plan_name}/sqls/full": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "full sync audit plan SQLs",
- "tags": [
- "audit_plan"
- ],
- "summary": "全量同步SQL到扫描任务",
- "operationId": "fullSyncAuditPlanSQLsV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
- "in": "path",
- "required": true
- },
- {
- "description": "full sync audit plan SQLs request",
- "name": "sqls",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.FullSyncAuditPlanSQLsReqV2"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/audit_plans/{audit_plan_name}/sqls/partial": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "partial sync audit plan SQLs",
- "tags": [
- "audit_plan"
- ],
- "summary": "增量同步SQL到扫描任务",
- "operationId": "partialSyncAuditPlanSQLsV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "audit plan name",
- "name": "audit_plan_name",
- "in": "path",
- "required": true
- },
- {
- "description": "partial sync audit plan SQLs request",
- "name": "sqls",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.PartialSyncAuditPlanSQLsReqV2"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/instances": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get instance info list",
- "tags": [
- "instance"
- ],
- "summary": "获取实例信息列表",
- "operationId": "getInstanceListV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "filter instance name",
- "name": "filter_instance_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter db type",
- "name": "filter_db_type",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter db host",
- "name": "filter_db_host",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter db port",
- "name": "filter_db_port",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter db user",
- "name": "filter_db_user",
- "in": "query"
- },
- {
- "type": "string",
- "description": "filter rule template name",
- "name": "filter_rule_template_name",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetInstancesResV2"
- }
- }
- }
- },
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "create a instance",
- "consumes": [
- "application/json"
- ],
- "tags": [
- "instance"
- ],
- "summary": "添加实例",
- "operationId": "createInstanceV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "description": "add instance",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.CreateInstanceReqV2"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/instances/{instance_name}/": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get instance db",
- "tags": [
- "instance"
- ],
- "summary": "获取实例信息",
- "operationId": "getInstanceV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "instance name",
- "name": "instance_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetInstanceResV2"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/sql_manages": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get sql manage list",
- "tags": [
- "SqlManage"
- ],
- "summary": "获取管控sql列表",
- "operationId": "GetSqlManageListV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "fuzzy search sql fingerprint",
- "name": "fuzzy_search_sql_fingerprint",
- "in": "query"
- },
- {
- "type": "string",
- "description": "assignee",
- "name": "filter_assignee",
- "in": "query"
- },
- {
- "type": "string",
- "description": "instance name",
- "name": "filter_instance_name",
- "in": "query"
- },
- {
- "enum": [
- "audit_plan",
- "sql_audit_record"
- ],
- "type": "string",
- "description": "source",
- "name": "filter_source",
- "in": "query"
- },
- {
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ],
- "type": "string",
- "description": "audit level",
- "name": "filter_audit_level",
- "in": "query"
- },
- {
- "type": "string",
- "description": "last audit start time from",
- "name": "filter_last_audit_start_time_from",
- "in": "query"
- },
- {
- "type": "string",
- "description": "last audit start time to",
- "name": "filter_last_audit_start_time_to",
- "in": "query"
- },
- {
- "enum": [
- "unhandled",
- "solved",
- "ignored",
- "manual_audited"
- ],
- "type": "string",
- "description": "status",
- "name": "filter_status",
- "in": "query"
- },
- {
- "type": "string",
- "description": "rule name",
- "name": "filter_rule_name",
- "in": "query"
- },
- {
- "type": "string",
- "description": "db type",
- "name": "filter_db_type",
- "in": "query"
- },
- {
- "type": "string",
- "description": "fuzzy search endpoint",
- "name": "fuzzy_search_endpoint",
- "in": "query"
- },
- {
- "type": "string",
- "description": "fuzzy search schema name",
- "name": "fuzzy_search_schema_name",
- "in": "query"
- },
- {
- "enum": [
- "first_appear_timestamp",
- "last_receive_timestamp",
- "fp_count"
- ],
- "type": "string",
- "description": "sort field",
- "name": "sort_field",
- "in": "query"
- },
- {
- "enum": [
- "asc",
- "desc"
- ],
- "type": "string",
- "description": "sort order",
- "name": "sort_order",
- "in": "query"
- },
- {
- "type": "integer",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "integer",
- "description": "size of per page",
- "name": "page_size",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetSqlManageListResp"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "create workflow",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "workflow"
- ],
- "summary": "创建工单",
- "operationId": "createWorkflowV2",
- "parameters": [
- {
- "description": "create workflow request",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.CreateWorkflowReqV2"
- }
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.CreateWorkflowResV2"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows/cancel": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "batch cancel workflows",
- "tags": [
- "workflow"
- ],
- "summary": "批量取消工单",
- "operationId": "batchCancelWorkflowsV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "description": "batch cancel workflows request",
- "name": "BatchCancelWorkflowsReqV2",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.BatchCancelWorkflowsReqV2"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows/complete": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "this api will directly change the work order status to finished without real online operation",
- "tags": [
- "workflow"
- ],
- "summary": "批量完成工单",
- "operationId": "batchCompleteWorkflowsV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "description": "batch complete workflows request",
- "name": "data",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.BatchCompleteWorkflowsReqV2"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows/{workflow_id}/": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get workflow detail",
- "tags": [
- "workflow"
- ],
- "summary": "获取工单详情",
- "operationId": "getWorkflowV2",
- "parameters": [
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetWorkflowResV2"
- }
- }
- }
- },
- "patch": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "update workflow when it is rejected to creator.",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "workflow"
- ],
- "summary": "更新工单(驳回后才可更新)",
- "operationId": "updateWorkflowV2",
- "parameters": [
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "description": "update workflow request",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.UpdateWorkflowReqV2"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows/{workflow_id}/cancel": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "cancel workflow",
- "tags": [
- "workflow"
- ],
- "summary": "审批关闭(中止)",
- "operationId": "cancelWorkflowV2",
- "parameters": [
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows/{workflow_id}/steps/{workflow_step_id}/approve": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "approve workflow",
- "tags": [
- "workflow"
- ],
- "summary": "审批通过",
- "operationId": "approveWorkflowV2",
- "parameters": [
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "workflow step id",
- "name": "workflow_step_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows/{workflow_id}/steps/{workflow_step_id}/reject": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "reject workflow",
- "tags": [
- "workflow"
- ],
- "summary": "审批驳回",
- "operationId": "rejectWorkflowV2",
- "parameters": [
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "workflow step id",
- "name": "workflow_step_id",
- "in": "path",
- "required": true
- },
- {
- "description": "workflow approve request",
- "name": "workflow_approve",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.RejectWorkflowReqV2"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows/{workflow_id}/tasks": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get summary of workflow instance tasks",
- "tags": [
- "workflow"
- ],
- "summary": "获取工单数据源任务概览",
- "operationId": "getSummaryOfInstanceTasksV2",
- "parameters": [
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetWorkflowTasksResV2"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows/{workflow_id}/tasks/execute": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "execute tasks on workflow",
- "tags": [
- "workflow"
- ],
- "summary": "多数据源批量上线",
- "operationId": "executeTasksOnWorkflowV2",
- "parameters": [
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows/{workflow_id}/tasks/{task_id}/execute": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "execute one task on workflow",
- "tags": [
- "workflow"
- ],
- "summary": "工单提交单个数据源上线",
- "operationId": "executeOneTaskOnWorkflowV2",
- "parameters": [
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/projects/{project_name}/workflows/{workflow_id}/tasks/{task_id}/schedule": {
- "put": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "update workflow schedule.",
- "consumes": [
- "application/json"
- ],
- "produces": [
- "application/json"
- ],
- "tags": [
- "workflow"
- ],
- "summary": "设置工单数据源定时上线时间(设置为空则代表取消定时时间,需要SQL审核流程都通过后才可以设置)",
- "operationId": "updateWorkflowScheduleV2",
- "parameters": [
- {
- "type": "string",
- "description": "workflow id",
- "name": "workflow_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- },
- {
- "type": "string",
- "description": "project name",
- "name": "project_name",
- "in": "path",
- "required": true
- },
- {
- "description": "update workflow schedule request",
- "name": "instance",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.UpdateWorkflowScheduleReqV2"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/controller.BaseRes"
- }
- }
- }
- }
- },
- "/v2/sql_audit": {
- "post": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "Direct audit sql",
- "tags": [
- "sql_audit"
- ],
- "summary": "直接审核SQL",
- "operationId": "directAuditV2",
- "deprecated": true,
- "parameters": [
- {
- "description": "sqls that should be audited",
- "name": "req",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/v2.DirectAuditReqV2"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.DirectAuditResV2"
- }
- }
- }
- }
- },
- "/v2/tasks/audits/{task_id}/sqls": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get information of all SQLs belong to the specified audit task",
- "tags": [
- "task"
- ],
- "summary": "获取指定扫描任务的SQLs信息",
- "operationId": "getAuditTaskSQLsV2",
- "parameters": [
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- },
- {
- "enum": [
- "initialized",
- "doing",
- "succeeded",
- "failed",
- "manually_executed",
- "terminating",
- "terminate_succeeded",
- "terminate_failed"
- ],
- "type": "string",
- "description": "filter: exec status of task sql",
- "name": "filter_exec_status",
- "in": "query"
- },
- {
- "enum": [
- "initialized",
- "doing",
- "finished"
- ],
- "type": "string",
- "description": "filter: audit status of task sql",
- "name": "filter_audit_status",
- "in": "query"
- },
- {
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ],
- "type": "string",
- "description": "filter: audit level of task sql",
- "name": "filter_audit_level",
- "in": "query"
- },
- {
- "type": "boolean",
- "description": "select unique (fingerprint and audit result) for task sql",
- "name": "no_duplicate",
- "in": "query"
- },
- {
- "type": "string",
- "description": "page index",
- "name": "page_index",
- "in": "query",
- "required": true
- },
- {
- "type": "string",
- "description": "page size",
- "name": "page_size",
- "in": "query",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetAuditTaskSQLsResV2"
- }
- }
- }
- }
- },
- "/v2/tasks/audits/{task_id}/sqls/{number}/analysis": {
- "get": {
- "security": [
- {
- "ApiKeyAuth": []
- }
- ],
- "description": "get SQL explain and related table metadata for analysis",
- "tags": [
- "task"
- ],
- "summary": "获取task相关的SQL执行计划和表元数据",
- "operationId": "getTaskAnalysisDataV2",
- "parameters": [
- {
- "type": "string",
- "description": "task id",
- "name": "task_id",
- "in": "path",
- "required": true
- },
- {
- "type": "integer",
- "description": "sql number",
- "name": "number",
- "in": "path",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "schema": {
- "$ref": "#/definitions/v2.GetTaskAnalysisDataResV2"
- }
- }
- }
- }
- }
- },
- "definitions": {
- "controller.BaseRes": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.AffectRows": {
- "type": "object",
- "properties": {
- "count": {
- "type": "integer"
- },
- "err_message": {
- "type": "string"
- }
- }
- },
- "v1.AuditPlanCount": {
- "type": "object",
- "properties": {
- "audit_plan_count": {
- "type": "integer"
- },
- "audit_plan_desc": {
- "type": "string"
- },
- "audit_plan_type": {
- "type": "string"
- }
- }
- },
- "v1.AuditPlanMetaV1": {
- "type": "object",
- "properties": {
- "audit_plan_params": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanParamResV1"
- }
- },
- "audit_plan_type": {
- "type": "string"
- },
- "audit_plan_type_desc": {
- "type": "string"
- },
- "instance_type": {
- "type": "string"
- }
- }
- },
- "v1.AuditPlanParamReqV1": {
- "type": "object",
- "properties": {
- "key": {
- "type": "string"
- },
- "value": {
- "type": "string"
- }
- }
- },
- "v1.AuditPlanParamResV1": {
- "type": "object",
- "properties": {
- "desc": {
- "type": "string"
- },
- "key": {
- "type": "string"
- },
- "type": {
- "type": "string",
- "enum": [
- "string",
- "int",
- "bool"
- ]
- },
- "value": {
- "type": "string"
- }
- }
- },
- "v1.AuditPlanReportResV1": {
- "type": "object",
- "properties": {
- "audit_level": {
- "type": "string",
- "enum": [
- "normal",
- "notice",
- "warn",
- "error",
- ""
- ]
- },
- "audit_plan_report_id": {
- "type": "string",
- "example": "1"
- },
- "audit_plan_report_timestamp": {
- "type": "string",
- "example": "RFC3339"
- },
- "pass_rate": {
- "type": "number"
- },
- "score": {
- "type": "integer"
- }
- }
- },
- "v1.AuditPlanReportSQLResV1": {
- "type": "object",
- "properties": {
- "audit_plan_report_sql": {
- "type": "string",
- "example": "select * from t1 where id = 1"
- },
- "audit_plan_report_sql_audit_result": {
- "type": "string",
- "example": "same format as task audit result"
- },
- "number": {
- "type": "integer",
- "example": 1
- }
- }
- },
- "v1.AuditPlanResV1": {
- "type": "object",
- "properties": {
- "audit_plan_cron": {
- "type": "string",
- "example": "0 */2 * * *"
- },
- "audit_plan_db_type": {
- "type": "string",
- "example": "mysql"
- },
- "audit_plan_instance_database": {
- "type": "string",
- "example": "app1"
- },
- "audit_plan_instance_name": {
- "type": "string",
- "example": "test_mysql"
- },
- "audit_plan_meta": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditPlanMetaV1"
- },
- "audit_plan_name": {
- "type": "string",
- "example": "audit_for_java_app1"
- },
- "audit_plan_token": {
- "type": "string",
- "example": "it's a JWT Token for scanner"
- },
- "rule_template_name": {
- "type": "string",
- "example": "default_MySQL"
- }
- }
- },
- "v1.AuditPlanSQLHeadV1": {
- "type": "object",
- "properties": {
- "desc": {
- "type": "string"
- },
- "name": {
- "type": "string"
- },
- "type": {
- "type": "string",
- "enum": [
- "sql"
- ]
- }
- }
- },
- "v1.AuditPlanSQLReqV1": {
- "type": "object",
- "properties": {
- "audit_plan_sql_counter": {
- "type": "string",
- "example": "6"
- },
- "audit_plan_sql_fingerprint": {
- "type": "string",
- "example": "select * from t1 where id = ?"
- },
- "audit_plan_sql_last_receive_text": {
- "type": "string",
- "example": "select * from t1 where id = 1"
- },
- "audit_plan_sql_last_receive_timestamp": {
- "type": "string",
- "example": "RFC3339"
- },
- "audit_plan_sql_schema": {
- "type": "string",
- "example": "db1"
- },
- "db_user": {
- "type": "string",
- "example": "database_user001"
- },
- "endpoint": {
- "type": "string",
- "example": "10.186.1.2"
- },
- "first_query_at": {
- "type": "string",
- "example": "2023-09-12T02:48:01.317880Z"
- },
- "query_time_avg": {
- "type": "number",
- "example": 3.22
- },
- "query_time_max": {
- "type": "number",
- "example": 5.22
- }
- }
- },
- "v1.AuditPlanSQLResV1": {
- "type": "object",
- "properties": {
- "head": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanSQLHeadV1"
- }
- },
- "rows": {
- "type": "array",
- "items": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- }
- }
- }
- },
- "v1.AuditPlanTypesV1": {
- "type": "object",
- "properties": {
- "desc": {
- "type": "string"
- },
- "instance_type": {
- "type": "string",
- "enum": [
- "MySQL",
- "Oracle",
- "TiDB",
- "OceanBase For MySQL",
- ""
- ]
- },
- "type": {
- "type": "string"
- }
- }
- },
- "v1.AuditResDataV1": {
- "type": "object",
- "properties": {
- "audit_level": {
- "type": "string",
- "enum": [
- "normal",
- "notice",
- "warn",
- "error",
- ""
- ]
- },
- "pass_rate": {
- "type": "number"
- },
- "score": {
- "type": "integer"
- },
- "sql_results": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditSQLResV1"
- }
- }
- }
- },
- "v1.AuditResult": {
- "type": "object",
- "properties": {
- "level": {
- "type": "string",
- "example": "warn"
- },
- "message": {
- "type": "string",
- "example": "避免使用不必要的内置函数md5()"
- },
- "rule_name": {
- "type": "string"
- }
- }
- },
- "v1.AuditSQLResV1": {
- "type": "object",
- "properties": {
- "audit_level": {
- "type": "string"
- },
- "audit_result": {
- "type": "string"
- },
- "exec_sql": {
- "type": "string"
- },
- "number": {
- "type": "integer"
- }
- }
- },
- "v1.AuditTaskGroupRes": {
- "type": "object",
- "properties": {
- "task_group_id": {
- "type": "integer"
- },
- "tasks": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditTaskResV1"
- }
- }
- }
- },
- "v1.AuditTaskGroupResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditTaskGroupRes"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.AuditTaskResV1": {
- "type": "object",
- "properties": {
- "audit_level": {
- "type": "string",
- "enum": [
- "normal",
- "notice",
- "warn",
- "error",
- ""
- ]
- },
- "exec_end_time": {
- "type": "string"
- },
- "exec_start_time": {
- "type": "string"
- },
- "instance_db_type": {
- "type": "string"
- },
- "instance_name": {
- "type": "string"
- },
- "instance_schema": {
- "type": "string",
- "example": "db1"
- },
- "pass_rate": {
- "type": "number"
- },
- "score": {
- "type": "integer"
- },
- "sql_source": {
- "type": "string",
- "enum": [
- "form_data",
- "sql_file",
- "mybatis_xml_file",
- "audit_plan"
- ]
- },
- "status": {
- "type": "string",
- "enum": [
- "initialized",
- "audited",
- "executing",
- "exec_success",
- "exec_failed",
- "manually_executed"
- ]
- },
- "task_id": {
- "type": "integer"
- }
- }
- },
- "v1.AuditTaskSQLContentResV1": {
- "type": "object",
- "properties": {
- "sql": {
- "type": "string",
- "example": "alter table tb1 drop columns c1"
- }
- }
- },
- "v1.AuditTaskSQLResV1": {
- "type": "object",
- "properties": {
- "audit_level": {
- "type": "string"
- },
- "audit_result": {
- "type": "string"
- },
- "audit_status": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "exec_result": {
- "type": "string"
- },
- "exec_sql": {
- "type": "string"
- },
- "exec_status": {
- "type": "string"
- },
- "number": {
- "type": "integer"
- },
- "rollback_sql": {
- "type": "string"
- }
- }
- },
- "v1.AuditTasksGroupResV1": {
- "type": "object",
- "properties": {
- "task_group_id": {
- "type": "integer"
- }
- }
- },
- "v1.AuditWhitelistResV1": {
- "type": "object",
- "properties": {
- "audit_whitelist_id": {
- "type": "integer"
- },
- "desc": {
- "type": "string"
- },
- "match_type": {
- "type": "string"
- },
- "value": {
- "type": "string"
- }
- }
- },
- "v1.AuditedSQLCount": {
- "type": "object",
- "properties": {
- "risk_sql_count": {
- "type": "integer"
- },
- "total_sql_count": {
- "type": "integer"
- }
- }
- },
- "v1.BatchCancelWorkflowsReqV1": {
- "type": "object",
- "properties": {
- "workflow_names": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
- },
- "v1.BatchCheckInstanceConnectionsReqV1": {
- "type": "object",
- "properties": {
- "instances": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.InstanceForCheckConnection"
- }
- }
- }
- },
- "v1.BatchCompleteWorkflowsReqV1": {
- "type": "object",
- "properties": {
- "workflow_names": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
- },
- "v1.BatchGetInstanceConnectionsResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.InstanceConnectionResV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.BatchUpdateSqlManageReq": {
- "type": "object",
- "properties": {
- "assignees": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "remark": {
- "type": "string"
- },
- "sql_manage_id_list": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- },
- "status": {
- "type": "string",
- "enum": [
- "solved",
- "ignored",
- "manual_audited"
- ]
- }
- }
- },
- "v1.BindOauth2UserReqV1": {
- "type": "object",
- "properties": {
- "oauth2_token": {
- "type": "string"
- },
- "pwd": {
- "type": "string"
- },
- "user_name": {
- "type": "string"
- }
- }
- },
- "v1.BindOauth2UserResDataV1": {
- "type": "object",
- "properties": {
- "token": {
- "type": "string"
- }
- }
- },
- "v1.BindOauth2UserResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.BindOauth2UserResDataV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.BindRoleReqV1": {
- "type": "object",
- "properties": {
- "instance_name": {
- "type": "string"
- },
- "role_names": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
- },
- "v1.CheckLicenseResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "content": {
- "type": "string"
- },
- "license": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.LicenseItem"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.CloneProjectRuleTemplateReqV1": {
- "type": "object",
- "properties": {
- "desc": {
- "type": "string"
- },
- "instance_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "new_rule_template_name": {
- "type": "string"
- }
- }
- },
- "v1.CloneRuleTemplateReqV1": {
- "type": "object",
- "properties": {
- "desc": {
- "type": "string"
- },
- "new_rule_template_name": {
- "type": "string"
- }
- }
- },
- "v1.CompanyNotice": {
- "type": "object",
- "properties": {
- "notice_str": {
- "type": "string"
- }
- }
- },
- "v1.CreateAuditPlanReqV1": {
- "type": "object",
- "properties": {
- "audit_plan_cron": {
- "type": "string",
- "example": "0 */2 * * *"
- },
- "audit_plan_instance_database": {
- "type": "string",
- "example": "app1"
- },
- "audit_plan_instance_name": {
- "type": "string",
- "example": "test_mysql"
- },
- "audit_plan_instance_type": {
- "type": "string",
- "example": "mysql"
- },
- "audit_plan_name": {
- "type": "string",
- "example": "audit_plan_for_java_repo_1"
- },
- "audit_plan_params": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanParamReqV1"
- }
- },
- "audit_plan_type": {
- "type": "string",
- "example": "slow log"
- },
- "rule_template_name": {
- "type": "string",
- "example": "default_MySQL"
- }
- }
- },
- "v1.CreateAuditTasksGroupReqV1": {
- "type": "object",
- "properties": {
- "instances": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.InstanceForCreatingTask"
- }
- }
- }
- },
- "v1.CreateAuditTasksGroupResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditTasksGroupResV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.CreateAuditWhitelistReqV1": {
- "type": "object",
- "properties": {
- "desc": {
- "type": "string",
- "example": "used for rapid release"
- },
- "match_type": {
- "type": "string",
- "enum": [
- "exact_match",
- "fp_match"
- ],
- "example": "exact_match"
- },
- "value": {
- "type": "string",
- "example": "create table"
- }
- }
- },
- "v1.CreateCustomRuleReqV1": {
- "type": "object",
- "properties": {
- "annotation": {
- "type": "string",
- "example": "this is test rule"
- },
- "db_type": {
- "type": "string",
- "example": "MySQL"
- },
- "desc": {
- "type": "string",
- "example": "this is test rule"
- },
- "level": {
- "type": "string",
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ],
- "example": "notice"
- },
- "rule_script": {
- "type": "string"
- },
- "type": {
- "type": "string",
- "example": "DDL规则"
- }
- }
- },
- "v1.CreateInstanceReqV1": {
- "type": "object",
- "properties": {
- "additional_params": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.InstanceAdditionalParamReqV1"
- }
- },
- "db_host": {
- "type": "string",
- "example": "10.10.10.10"
- },
- "db_password": {
- "type": "string",
- "example": "123456"
- },
- "db_port": {
- "type": "string",
- "example": "3306"
- },
- "db_type": {
- "type": "string",
- "example": "mysql"
- },
- "db_user": {
- "type": "string",
- "example": "root"
- },
- "desc": {
- "type": "string",
- "example": "this is a test instance"
- },
- "instance_name": {
- "type": "string",
- "example": "test"
- },
- "maintenance_times": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.MaintenanceTimeReqV1"
- }
- },
- "rule_template_name": {
- "type": "string"
- },
- "sql_query_config": {
- "type": "object",
- "$ref": "#/definitions/v1.SQLQueryConfigReqV1"
- }
- }
- },
- "v1.CreateMemberGroupReqV1": {
- "type": "object",
- "properties": {
- "roles": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.BindRoleReqV1"
- }
- },
- "user_group_name": {
- "type": "string"
- }
- }
- },
- "v1.CreateMemberReqV1": {
- "type": "object",
- "properties": {
- "is_manager": {
- "type": "boolean"
- },
- "roles": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.BindRoleReqV1"
- }
- },
- "user_name": {
- "type": "string"
- }
- }
- },
- "v1.CreateProjectReqV1": {
- "type": "object",
- "properties": {
- "desc": {
- "type": "string"
- },
- "name": {
- "type": "string"
- }
- }
- },
- "v1.CreateProjectRuleTemplateReqV1": {
- "type": "object",
- "properties": {
- "db_type": {
- "type": "string"
- },
- "desc": {
- "type": "string"
- },
- "instance_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "rule_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.RuleReqV1"
- }
- },
- "rule_template_name": {
- "type": "string"
- }
- }
- },
- "v1.CreateRoleReqV1": {
- "type": "object",
- "properties": {
- "operation_code_list": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- },
- "role_desc": {
- "type": "string"
- },
- "role_name": {
- "type": "string"
- }
- }
- },
- "v1.CreateRuleTemplateReqV1": {
- "type": "object",
- "properties": {
- "db_type": {
- "type": "string"
- },
- "desc": {
- "type": "string"
- },
- "rule_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.RuleReqV1"
- }
- },
- "rule_template_name": {
- "type": "string"
- }
- }
- },
- "v1.CreateSQLAuditRecordResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.SQLAuditRecordResData"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.CreateSyncInstanceTaskReqV1": {
- "type": "object",
- "required": [
- "db_type",
- "global_rule_template",
- "source",
- "sync_instance_interval",
- "url",
- "version"
- ],
- "properties": {
- "db_type": {
- "type": "string",
- "example": "mysql"
- },
- "global_rule_template": {
- "type": "string",
- "example": "default_mysql"
- },
- "source": {
- "type": "string",
- "example": "actiontech-dmp"
- },
- "sync_instance_interval": {
- "type": "string",
- "example": "0 0 * * *"
- },
- "url": {
- "type": "string",
- "example": "http://10.186.62.56:10000"
- },
- "version": {
- "type": "string",
- "example": "5.23.01.0"
- }
- }
- },
- "v1.CreateUserGroupReqV1": {
- "type": "object",
- "properties": {
- "user_group_desc": {
- "type": "string",
- "example": "this is a group"
- },
- "user_group_name": {
- "type": "string",
- "example": "test"
- },
- "user_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
- },
- "v1.CreateUserReqV1": {
- "type": "object",
- "properties": {
- "email": {
- "type": "string",
- "example": "test@email.com"
- },
- "management_permission_code_list": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- },
- "phone": {
- "type": "string",
- "example": "18962136666"
- },
- "user_group_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "user_name": {
- "type": "string",
- "example": "test"
- },
- "user_password": {
- "type": "string",
- "example": "123456"
- },
- "wechat_id": {
- "type": "string",
- "example": "UserID"
- }
- }
- },
- "v1.CreateWorkflowReqV1": {
- "type": "object",
- "properties": {
- "desc": {
- "type": "string"
- },
- "task_ids": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- },
- "workflow_subject": {
- "type": "string"
- }
- }
- },
- "v1.CustomRuleResV1": {
- "type": "object",
- "properties": {
- "annotation": {
- "type": "string",
- "example": "this is test rule"
- },
- "db_type": {
- "type": "string",
- "example": "MySQL"
- },
- "desc": {
- "type": "string",
- "example": "this is test rule"
- },
- "level": {
- "type": "string",
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ],
- "example": "notice"
- },
- "rule_id": {
- "type": "string"
- },
- "rule_script": {
- "type": "string"
- },
- "type": {
- "type": "string",
- "example": "DDL规则"
- }
- }
- },
- "v1.DBTypeAuditPlan": {
- "type": "object",
- "properties": {
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanCount"
- }
- },
- "db_type": {
- "type": "string"
- }
- }
- },
- "v1.DBTypeHealth": {
- "type": "object",
- "properties": {
- "db_type": {
- "type": "string"
- },
- "health_instance_names": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "unhealth_instance_names": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
- },
- "v1.DashboardProjectTipV1": {
- "type": "object",
- "properties": {
- "project_name": {
- "type": "string"
- },
- "unfinished_workflow_count": {
- "description": "只统计与当前用户相关的未完成工单",
- "type": "integer"
- }
- }
- },
- "v1.DashboardResV1": {
- "type": "object",
- "properties": {
- "workflow_statistics": {
- "type": "object",
- "$ref": "#/definitions/v1.WorkflowStatisticsResV1"
- }
- }
- },
- "v1.DingTalkConfigurationV1": {
- "type": "object",
- "properties": {
- "app_key": {
- "type": "string"
- },
- "is_enable_ding_talk_notify": {
- "type": "boolean"
- }
- }
- },
- "v1.DirectAuditFileReqV1": {
- "type": "object",
- "properties": {
- "file_contents": {
- "description": "调用方不应该关心SQL是否被完美的拆分成独立的条目, 拆分SQL由SQLE实现\n每个数组元素是一个文件内容",
- "type": "array",
- "items": {
- "type": "string"
- },
- "example": [
- "select * from t1; select * from t2;"
- ]
- },
- "instance_name": {
- "type": "string",
- "example": "instance1"
- },
- "instance_type": {
- "type": "string",
- "example": "MySQL"
- },
- "project_name": {
- "type": "string",
- "example": "project1"
- },
- "schema_name": {
- "type": "string",
- "example": "schema1"
- },
- "sql_type": {
- "type": "string",
- "enum": [
- "sql",
- "mybatis",
- ""
- ],
- "example": "sql"
- }
- }
- },
- "v1.DirectAuditReqV1": {
- "type": "object",
- "properties": {
- "instance_name": {
- "type": "string",
- "example": "instance1"
- },
- "instance_type": {
- "type": "string",
- "example": "MySQL"
- },
- "project_name": {
- "type": "string",
- "example": "project1"
- },
- "schema_name": {
- "type": "string",
- "example": "schema1"
- },
- "sql_content": {
- "description": "调用方不应该关心SQL是否被完美的拆分成独立的条目, 拆分SQL由SQLE实现",
- "type": "string",
- "example": "select * from t1; select * from t2;"
- },
- "sql_type": {
- "type": "string",
- "enum": [
- "sql",
- "mybatis",
- ""
- ],
- "example": "sql"
- }
- }
- },
- "v1.DirectAuditResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditResDataV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.DirectGetSQLAnalysisResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.SqlAnalysisResDataV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.DriversResV1": {
- "type": "object",
- "properties": {
- "driver_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
- },
- "v1.ExplainClassicResult": {
- "type": "object",
- "properties": {
- "head": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.TableMetaItemHeadResV1"
- }
- },
- "rows": {
- "type": "array",
- "items": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- }
- }
- }
- },
- "v1.FeishuConfigurationV1": {
- "type": "object",
- "properties": {
- "app_id": {
- "type": "string"
- },
- "is_feishu_notification_enabled": {
- "type": "boolean"
- }
- }
- },
- "v1.FullSyncAuditPlanSQLsReqV1": {
- "type": "object",
- "properties": {
- "audit_plan_sql_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanSQLReqV1"
- }
- }
- }
- },
- "v1.GetAuditPlanAnalysisDataResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.GetSQLAnalysisDataResItemV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetAuditPlanMetasResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanMetaV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetAuditPlanNotifyConfigResDataV1": {
- "type": "object",
- "properties": {
- "enable_email_notify": {
- "type": "boolean"
- },
- "enable_web_hook_notify": {
- "type": "boolean"
- },
- "notify_interval": {
- "type": "integer"
- },
- "notify_level": {
- "type": "string"
- },
- "web_hook_template": {
- "type": "string"
- },
- "web_hook_url": {
- "type": "string"
- }
- }
- },
- "v1.GetAuditPlanNotifyConfigResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.GetAuditPlanNotifyConfigResDataV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetAuditPlanReportResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditPlanReportResV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetAuditPlanReportSQLsResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanReportSQLResV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
- }
- }
- },
- "v1.GetAuditPlanReportsResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanReportResV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
- }
- }
- },
- "v1.GetAuditPlanResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditPlanResV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetAuditPlanSQLsResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditPlanSQLResV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
- }
- }
- },
- "v1.GetAuditPlanTypesResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanTypesV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetAuditPlansResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanResV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
- }
- }
- },
- "v1.GetAuditTaskResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditTaskResV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetAuditTaskSQLContentResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditTaskSQLContentResV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetAuditTaskSQLsResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditTaskSQLResV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
- }
- }
- },
- "v1.GetAuditWhitelistResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditWhitelistResV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
- }
- }
- },
- "v1.GetCompanyNoticeResp": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.CompanyNotice"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetCustomRuleResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.CustomRuleResV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetCustomRulesResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.CustomRuleResV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetDashboardProjectTipsResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.DashboardProjectTipV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetDashboardResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.DashboardResV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetDingTalkConfigurationResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.DingTalkConfigurationV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetDriversResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.DriversResV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetFeishuAuditConfigurationResV1": {
+ }
+ }
+ },
+ "definitions": {
+ "controller.BaseRes": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"example": 0
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.FeishuConfigurationV1"
- },
"message": {
"type": "string",
"example": "ok"
}
}
},
- "v1.GetFeishuConfigurationResV1": {
+ "v1.AffectRows": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.FeishuConfigurationV1"
+ "count": {
+ "type": "integer"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "err_message": {
+ "type": "string"
}
}
},
- "v1.GetInstanceAdditionalMetasResV1": {
+ "v1.AuditPlanCount": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "audit_plan_count": {
+ "type": "integer"
},
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.InstanceAdditionalMetaV1"
- }
+ "audit_plan_desc": {
+ "type": "string"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "audit_plan_type": {
+ "type": "string"
}
}
},
- "v1.GetInstanceConnectableReqV1": {
+ "v1.AuditPlanMetaV1": {
"type": "object",
"properties": {
- "additional_params": {
+ "audit_plan_params": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.InstanceAdditionalParamReqV1"
+ "$ref": "#/definitions/v1.AuditPlanParamResV1"
}
},
- "db_type": {
- "type": "string",
- "example": "mysql"
- },
- "host": {
- "type": "string",
- "example": "10.10.10.10"
- },
- "password": {
- "type": "string",
- "example": "123456"
+ "audit_plan_type": {
+ "type": "string"
},
- "port": {
- "type": "string",
- "example": "3306"
+ "audit_plan_type_desc": {
+ "type": "string"
},
- "user": {
- "type": "string",
- "example": "root"
+ "instance_type": {
+ "type": "string"
}
}
},
- "v1.GetInstanceConnectableResV1": {
+ "v1.AuditPlanParamReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.InstanceConnectableResV1"
+ "key": {
+ "type": "string"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "value": {
+ "type": "string"
}
}
},
- "v1.GetInstanceHealthResV1": {
+ "v1.AuditPlanParamResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "desc": {
+ "type": "string"
},
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.DBTypeHealth"
- }
+ "key": {
+ "type": "string"
},
- "message": {
+ "type": {
"type": "string",
- "example": "ok"
+ "enum": [
+ "string",
+ "int",
+ "bool"
+ ]
+ },
+ "value": {
+ "type": "string"
}
}
},
- "v1.GetInstanceResV1": {
+ "v1.AuditPlanReportResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "audit_level": {
+ "type": "string",
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error",
+ ""
+ ]
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.InstanceResV1"
+ "audit_plan_report_id": {
+ "type": "string",
+ "example": "1"
},
- "message": {
+ "audit_plan_report_timestamp": {
"type": "string",
- "example": "ok"
+ "example": "RFC3339"
+ },
+ "pass_rate": {
+ "type": "number"
+ },
+ "score": {
+ "type": "integer"
}
}
},
- "v1.GetInstanceSchemaResV1": {
+ "v1.AuditPlanReportSQLResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.InstanceSchemaResV1"
+ "audit_plan_report_sql": {
+ "type": "string",
+ "example": "select * from t1 where id = 1"
},
- "message": {
+ "audit_plan_report_sql_audit_result": {
"type": "string",
- "example": "ok"
+ "example": "same format as task audit result"
+ },
+ "number": {
+ "type": "integer",
+ "example": 1
}
}
},
- "v1.GetInstanceTipsResV1": {
+ "v1.AuditPlanResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "audit_plan_cron": {
+ "type": "string",
+ "example": "0 */2 * * *"
},
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.InstanceTipResV1"
- }
+ "audit_plan_db_type": {
+ "type": "string",
+ "example": "mysql"
},
- "message": {
+ "audit_plan_instance_database": {
"type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetInstancesResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "example": "app1"
},
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.InstanceResV1"
- }
+ "audit_plan_instance_name": {
+ "type": "string",
+ "example": "test_mysql"
},
- "message": {
+ "audit_plan_meta": {
+ "type": "object",
+ "$ref": "#/definitions/v1.AuditPlanMetaV1"
+ },
+ "audit_plan_name": {
"type": "string",
- "example": "ok"
+ "example": "audit_for_java_app1"
},
- "total_nums": {
- "type": "integer"
+ "audit_plan_token": {
+ "type": "string",
+ "example": "it's a JWT Token for scanner"
+ },
+ "rule_template_name": {
+ "type": "string",
+ "example": "default_MySQL"
}
}
},
- "v1.GetInstancesTypePercentResV1": {
+ "v1.AuditPlanSQLHeadV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "desc": {
+ "type": "string"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.InstancesTypePercentV1"
+ "name": {
+ "type": "string"
},
- "message": {
+ "type": {
"type": "string",
- "example": "ok"
+ "enum": [
+ "sql"
+ ]
}
}
},
- "v1.GetLDAPConfigurationResV1": {
+ "v1.AuditPlanSQLReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "audit_plan_sql_counter": {
+ "type": "string",
+ "example": "6"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.LDAPConfigurationResV1"
+ "audit_plan_sql_fingerprint": {
+ "type": "string",
+ "example": "select * from t1 where id = ?"
+ },
+ "audit_plan_sql_last_receive_text": {
+ "type": "string",
+ "example": "select * from t1 where id = 1"
+ },
+ "audit_plan_sql_last_receive_timestamp": {
+ "type": "string",
+ "example": "RFC3339"
+ },
+ "audit_plan_sql_schema": {
+ "type": "string",
+ "example": "db1"
+ },
+ "db_user": {
+ "type": "string",
+ "example": "database_user001"
+ },
+ "endpoint": {
+ "type": "string",
+ "example": "10.186.1.2"
},
- "message": {
+ "first_query_at": {
"type": "string",
- "example": "ok"
+ "example": "2023-09-12T02:48:01.317880Z"
+ },
+ "query_time_avg": {
+ "type": "number",
+ "example": 3.22
+ },
+ "query_time_max": {
+ "type": "number",
+ "example": 5.22
}
}
},
- "v1.GetLicenseResV1": {
+ "v1.AuditPlanSQLResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "content": {
- "type": "string"
- },
- "license": {
+ "head": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.LicenseItem"
+ "$ref": "#/definitions/v1.AuditPlanSQLHeadV1"
}
},
- "message": {
- "type": "string",
- "example": "ok"
+ "rows": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
}
}
},
- "v1.GetLicenseUsageResV1": {
+ "v1.AuditPlanTypesV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.LicenseUsageV1"
+ "desc": {
+ "type": "string"
},
- "message": {
+ "instance_type": {
"type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetManagementPermissionsResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.ManagementPermissionResV1"
- }
+ "enum": [
+ "MySQL",
+ "Oracle",
+ "TiDB",
+ "OceanBase For MySQL",
+ ""
+ ]
},
- "message": {
- "type": "string",
- "example": "ok"
+ "type": {
+ "type": "string"
}
}
},
- "v1.GetMemberGroupRespDataV1": {
+ "v1.AuditResDataV1": {
"type": "object",
"properties": {
- "roles": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.BindRoleReqV1"
- }
+ "audit_level": {
+ "type": "string",
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error",
+ ""
+ ]
},
- "user_group_name": {
- "type": "string"
+ "pass_rate": {
+ "type": "number"
+ },
+ "score": {
+ "type": "integer"
},
- "users": {
+ "sql_results": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.MemberGroupUserItem"
+ "$ref": "#/definitions/v1.AuditSQLResV1"
}
}
}
},
- "v1.GetMemberGroupRespV1": {
+ "v1.AuditResult": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.GetMemberGroupRespDataV1"
+ "level": {
+ "type": "string",
+ "example": "warn"
},
"message": {
"type": "string",
- "example": "ok"
+ "example": "避免使用不必要的内置函数md5()"
+ },
+ "rule_name": {
+ "type": "string"
}
}
},
- "v1.GetMemberGroupsRespV1": {
+ "v1.AuditSQLResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "audit_level": {
+ "type": "string"
},
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.GetMemberGroupRespDataV1"
- }
+ "audit_result": {
+ "type": "string"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "exec_sql": {
+ "type": "string"
},
- "total_nums": {
+ "number": {
"type": "integer"
}
}
},
- "v1.GetMemberRespDataV1": {
+ "v1.AuditTaskGroupRes": {
"type": "object",
"properties": {
- "is_manager": {
- "type": "boolean"
+ "task_group_id": {
+ "type": "integer"
},
- "roles": {
+ "tasks": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.BindRoleReqV1"
+ "$ref": "#/definitions/v1.AuditTaskResV1"
}
- },
- "user_name": {
- "type": "string"
}
}
},
- "v1.GetMemberRespV1": {
+ "v1.AuditTaskGroupResV1": {
"type": "object",
"properties": {
"code": {
@@ -12548,7 +7798,7 @@
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.GetMemberRespDataV1"
+ "$ref": "#/definitions/v1.AuditTaskGroupRes"
},
"message": {
"type": "string",
@@ -12556,191 +7806,177 @@
}
}
},
- "v1.GetMemberTipsResV1": {
+ "v1.AuditTaskResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "audit_level": {
+ "type": "string",
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error",
+ ""
+ ]
},
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.MemberTipResV1"
- }
+ "exec_end_time": {
+ "type": "string"
},
- "message": {
+ "exec_start_time": {
+ "type": "string"
+ },
+ "instance_db_type": {
+ "type": "string"
+ },
+ "instance_name": {
+ "type": "string"
+ },
+ "instance_schema": {
"type": "string",
- "example": "ok"
+ "example": "db1"
+ },
+ "pass_rate": {
+ "type": "number"
+ },
+ "score": {
+ "type": "integer"
+ },
+ "sql_source": {
+ "type": "string",
+ "enum": [
+ "form_data",
+ "sql_file",
+ "mybatis_xml_file",
+ "audit_plan"
+ ]
+ },
+ "status": {
+ "type": "string",
+ "enum": [
+ "initialized",
+ "audited",
+ "executing",
+ "exec_success",
+ "exec_failed",
+ "manually_executed"
+ ]
+ },
+ "task_id": {
+ "type": "integer"
}
}
},
- "v1.GetMembersRespV1": {
+ "v1.AuditTaskSQLContentResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.GetMemberRespDataV1"
- }
- },
- "message": {
+ "sql": {
"type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
+ "example": "alter table tb1 drop columns c1"
}
}
},
- "v1.GetOauth2ConfigurationResDataV1": {
+ "v1.AuditTaskSQLResV1": {
"type": "object",
"properties": {
- "access_token_tag": {
+ "audit_level": {
"type": "string"
},
- "client_host": {
+ "audit_result": {
"type": "string"
},
- "client_id": {
+ "audit_status": {
"type": "string"
},
- "enable_oauth2": {
- "type": "boolean"
- },
- "login_tip": {
+ "description": {
"type": "string"
},
- "scopes": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "server_auth_url": {
+ "exec_result": {
"type": "string"
},
- "server_token_url": {
+ "exec_sql": {
"type": "string"
},
- "server_user_id_url": {
+ "exec_status": {
"type": "string"
},
- "user_id_tag": {
+ "number": {
+ "type": "integer"
+ },
+ "rollback_sql": {
"type": "string"
}
}
},
- "v1.GetOauth2ConfigurationResV1": {
+ "v1.AuditTasksGroupResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.GetOauth2ConfigurationResDataV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
+ "task_group_id": {
+ "type": "integer"
}
}
},
- "v1.GetOauth2TipsResDataV1": {
+ "v1.AuditWhitelistResV1": {
"type": "object",
"properties": {
- "enable_oauth2": {
- "type": "boolean"
+ "audit_whitelist_id": {
+ "type": "integer"
+ },
+ "desc": {
+ "type": "string"
+ },
+ "match_type": {
+ "type": "string"
},
- "login_tip": {
+ "value": {
"type": "string"
}
}
},
- "v1.GetOauth2TipsResV1": {
+ "v1.AuditedSQLCount": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.GetOauth2TipsResDataV1"
+ "risk_sql_count": {
+ "type": "integer"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "total_sql_count": {
+ "type": "integer"
}
}
},
- "v1.GetOperationActionListResV1": {
+ "v1.BatchCancelWorkflowsReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
+ "workflow_names": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.OperationActionList"
+ "type": "string"
}
- },
- "message": {
- "type": "string",
- "example": "ok"
}
}
},
- "v1.GetOperationRecordListResV1": {
+ "v1.BatchCheckInstanceConnectionsReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
+ "instances": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.OperationRecordList"
+ "$ref": "#/definitions/v1.InstanceForCheckConnection"
}
- },
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
}
}
},
- "v1.GetOperationTypeNamesListResV1": {
+ "v1.BatchCompleteWorkflowsReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
+ "workflow_names": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.OperationTypeNameList"
+ "type": "string"
}
- },
- "message": {
- "type": "string",
- "example": "ok"
}
}
},
- "v1.GetOperationsResV1": {
+ "v1.BatchGetInstanceConnectionsResV1": {
"type": "object",
"properties": {
"code": {
@@ -12750,7 +7986,7 @@
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.OperationResV1"
+ "$ref": "#/definitions/v1.InstanceConnectionResV1"
}
},
"message": {
@@ -12759,85 +7995,137 @@
}
}
},
- "v1.GetProjectDetailResV1": {
+ "v1.BatchUpdateSqlManageReq": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "assignees": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.ProjectDetailItem"
+ "remark": {
+ "type": "string"
},
- "message": {
+ "sql_manage_id_list": {
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ },
+ "status": {
"type": "string",
- "example": "ok"
+ "enum": [
+ "solved",
+ "ignored",
+ "manual_audited"
+ ]
}
}
},
- "v1.GetProjectResV1": {
+ "v1.CheckLicenseResV1": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"example": 0
},
- "data": {
+ "content": {
+ "type": "string"
+ },
+ "license": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.ProjectListItem"
+ "$ref": "#/definitions/v1.LicenseItem"
}
},
"message": {
"type": "string",
"example": "ok"
- },
- "total_nums": {
- "type": "integer"
}
}
},
- "v1.GetProjectRuleTemplateResV1": {
+ "v1.CloneProjectRuleTemplateReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "desc": {
+ "type": "string"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.RuleProjectTemplateDetailResV1"
+ "new_rule_template_name": {
+ "type": "string"
+ }
+ }
+ },
+ "v1.CloneRuleTemplateReqV1": {
+ "type": "object",
+ "properties": {
+ "desc": {
+ "type": "string"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "new_rule_template_name": {
+ "type": "string"
}
}
},
- "v1.GetProjectRuleTemplatesResV1": {
+ "v1.CompanyNotice": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "notice_str": {
+ "type": "string"
+ }
+ }
+ },
+ "v1.CreateAuditPlanReqV1": {
+ "type": "object",
+ "properties": {
+ "audit_plan_cron": {
+ "type": "string",
+ "example": "0 */2 * * *"
},
- "data": {
+ "audit_plan_instance_database": {
+ "type": "string",
+ "example": "app1"
+ },
+ "audit_plan_instance_name": {
+ "type": "string",
+ "example": "test_mysql"
+ },
+ "audit_plan_instance_type": {
+ "type": "string",
+ "example": "mysql"
+ },
+ "audit_plan_name": {
+ "type": "string",
+ "example": "audit_plan_for_java_repo_1"
+ },
+ "audit_plan_params": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.ProjectRuleTemplateResV1"
+ "$ref": "#/definitions/v1.AuditPlanParamReqV1"
}
},
- "message": {
+ "audit_plan_type": {
"type": "string",
- "example": "ok"
+ "example": "slow log"
},
- "total_nums": {
- "type": "integer"
+ "rule_template_name": {
+ "type": "string",
+ "example": "default_MySQL"
}
}
},
- "v1.GetProjectScoreResV1": {
+ "v1.CreateAuditTasksGroupReqV1": {
+ "type": "object",
+ "properties": {
+ "instances": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.InstanceForCreatingTask"
+ }
+ }
+ }
+ },
+ "v1.CreateAuditTasksGroupResV1": {
"type": "object",
"properties": {
"code": {
@@ -12846,7 +8134,7 @@
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.ProjectScore"
+ "$ref": "#/definitions/v1.AuditTasksGroupResV1"
},
"message": {
"type": "string",
@@ -12854,104 +8142,102 @@
}
}
},
- "v1.GetProjectStatisticsResDataV1": {
+ "v1.CreateAuditWhitelistReqV1": {
"type": "object",
"properties": {
- "audit_plan_total": {
- "type": "integer"
- },
- "instance_total": {
- "type": "integer"
- },
- "member_total": {
- "type": "integer"
- },
- "rule_template_total": {
- "type": "integer"
+ "desc": {
+ "type": "string",
+ "example": "used for rapid release"
},
- "whitelist_total": {
- "type": "integer"
+ "match_type": {
+ "type": "string",
+ "enum": [
+ "exact_match",
+ "fp_match"
+ ],
+ "example": "exact_match"
},
- "workflow_total": {
- "type": "integer"
+ "value": {
+ "type": "string",
+ "example": "create table"
}
}
},
- "v1.GetProjectStatisticsResV1": {
+ "v1.CreateCustomRuleReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "annotation": {
+ "type": "string",
+ "example": "this is test rule"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.GetProjectStatisticsResDataV1"
+ "db_type": {
+ "type": "string",
+ "example": "MySQL"
},
- "message": {
+ "desc": {
"type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetProjectTipsResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "example": "this is test rule"
+ },
+ "level": {
+ "type": "string",
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ],
+ "example": "notice"
},
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.ProjectTipResV1"
- }
+ "rule_script": {
+ "type": "string"
},
- "message": {
+ "type": {
"type": "string",
- "example": "ok"
+ "example": "DDL规则"
}
}
},
- "v1.GetRiskAuditPlanResV1": {
+ "v1.CreateProjectRuleTemplateReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "db_type": {
+ "type": "string"
},
- "data": {
+ "desc": {
+ "type": "string"
+ },
+ "rule_list": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.RiskAuditPlan"
+ "$ref": "#/definitions/v1.RuleReqV1"
}
},
- "message": {
- "type": "string",
- "example": "ok"
+ "rule_template_name": {
+ "type": "string"
}
}
},
- "v1.GetRoleTipsResV1": {
+ "v1.CreateRuleTemplateReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "db_type": {
+ "type": "string"
},
- "data": {
+ "desc": {
+ "type": "string"
+ },
+ "rule_list": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.RoleTipResV1"
+ "$ref": "#/definitions/v1.RuleReqV1"
}
},
- "message": {
- "type": "string",
- "example": "ok"
+ "rule_template_name": {
+ "type": "string"
}
}
},
- "v1.GetRoleUserCountResV1": {
+ "v1.CreateSQLAuditRecordResV1": {
"type": "object",
"properties": {
"code": {
@@ -12959,10 +8245,8 @@
"example": 0
},
"data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.RoleUserCount"
- }
+ "type": "object",
+ "$ref": "#/definitions/v1.SQLAuditRecordResData"
},
"message": {
"type": "string",
@@ -12970,174 +8254,190 @@
}
}
},
- "v1.GetRolesResV1": {
+ "v1.CreateWorkflowReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "desc": {
+ "type": "string"
},
- "data": {
+ "task_ids": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.RoleResV1"
+ "type": "integer"
}
},
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
+ "workflow_subject": {
+ "type": "string"
}
}
},
- "v1.GetRuleKnowledgeResV1": {
+ "v1.CustomRuleResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "annotation": {
+ "type": "string",
+ "example": "this is test rule"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.RuleKnowledgeResV1"
+ "db_type": {
+ "type": "string",
+ "example": "MySQL"
},
- "message": {
+ "desc": {
"type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetRuleTemplateResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "example": "this is test rule"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.RuleTemplateDetailResV1"
+ "level": {
+ "type": "string",
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ],
+ "example": "notice"
},
- "message": {
+ "rule_id": {
+ "type": "string"
+ },
+ "rule_script": {
+ "type": "string"
+ },
+ "type": {
"type": "string",
- "example": "ok"
+ "example": "DDL规则"
}
}
},
- "v1.GetRuleTemplateTipsResV1": {
+ "v1.DBTypeAuditPlan": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.RuleTemplateTipResV1"
+ "$ref": "#/definitions/v1.AuditPlanCount"
}
},
- "message": {
- "type": "string",
- "example": "ok"
+ "db_type": {
+ "type": "string"
}
}
},
- "v1.GetRuleTemplatesResV1": {
+ "v1.DBTypeHealth": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "db_type": {
+ "type": "string"
},
- "data": {
+ "health_instance_names": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.RuleTemplateResV1"
+ "type": "string"
}
},
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
+ "unhealth_instance_names": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
}
}
},
- "v1.GetRuleTypeByDBTypeResV1": {
+ "v1.DashboardResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.RuleTypeV1"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
+ "workflow_statistics": {
+ "type": "object",
+ "$ref": "#/definitions/v1.WorkflowStatisticsResV1"
}
}
},
- "v1.GetRulesResV1": {
+ "v1.DingTalkConfigurationV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.RuleResV1"
- }
+ "app_key": {
+ "type": "string"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "is_enable_ding_talk_notify": {
+ "type": "boolean"
}
}
},
- "v1.GetSMTPConfigurationResV1": {
+ "v1.DirectAuditFileReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "file_contents": {
+ "description": "调用方不应该关心SQL是否被完美的拆分成独立的条目, 拆分SQL由SQLE实现\n每个数组元素是一个文件内容",
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "example": [
+ "select * from t1; select * from t2;"
+ ]
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.SMTPConfigurationResV1"
+ "instance_name": {
+ "type": "string",
+ "example": "instance1"
},
- "message": {
+ "instance_type": {
"type": "string",
- "example": "ok"
+ "example": "MySQL"
+ },
+ "project_name": {
+ "type": "string",
+ "example": "project1"
+ },
+ "schema_name": {
+ "type": "string",
+ "example": "schema1"
+ },
+ "sql_type": {
+ "type": "string",
+ "enum": [
+ "sql",
+ "mybatis",
+ ""
+ ],
+ "example": "sql"
}
}
},
- "v1.GetSQLAnalysisDataResItemV1": {
+ "v1.DirectAuditReqV1": {
"type": "object",
"properties": {
- "sql_explain": {
- "type": "object",
- "$ref": "#/definitions/v1.SQLExplain"
+ "instance_name": {
+ "type": "string",
+ "example": "instance1"
+ },
+ "instance_type": {
+ "type": "string",
+ "example": "MySQL"
+ },
+ "project_name": {
+ "type": "string",
+ "example": "project1"
+ },
+ "schema_name": {
+ "type": "string",
+ "example": "schema1"
+ },
+ "sql_content": {
+ "description": "调用方不应该关心SQL是否被完美的拆分成独立的条目, 拆分SQL由SQLE实现",
+ "type": "string",
+ "example": "select * from t1; select * from t2;"
},
- "table_metas": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.TableMeta"
- }
+ "sql_type": {
+ "type": "string",
+ "enum": [
+ "sql",
+ "mybatis",
+ ""
+ ],
+ "example": "sql"
}
}
},
- "v1.GetSQLAuditRecordResV1": {
+ "v1.DirectAuditResV1": {
"type": "object",
"properties": {
"code": {
@@ -13146,7 +8446,7 @@
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.SQLAuditRecord"
+ "$ref": "#/definitions/v1.AuditResDataV1"
},
"message": {
"type": "string",
@@ -13154,7 +8454,7 @@
}
}
},
- "v1.GetSQLAuditRecordTagTipsResV1": {
+ "v1.DirectGetSQLAnalysisResV1": {
"type": "object",
"properties": {
"code": {
@@ -13164,7 +8464,7 @@
"data": {
"type": "array",
"items": {
- "type": "string"
+ "$ref": "#/definitions/v1.SqlAnalysisResDataV1"
}
},
"message": {
@@ -13173,88 +8473,60 @@
}
}
},
- "v1.GetSQLAuditRecordsResV1": {
+ "v1.DriversResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
+ "driver_name_list": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.SQLAuditRecord"
+ "type": "string"
}
- },
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
}
}
},
- "v1.GetSQLEInfoResDataV1": {
+ "v1.ExplainClassicResult": {
"type": "object",
"properties": {
- "logo_url": {
- "type": "string"
- },
- "title": {
- "type": "string"
+ "head": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.TableMetaItemHeadResV1"
+ }
},
- "version": {
- "type": "string"
+ "rows": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
}
}
},
- "v1.GetSQLEInfoResV1": {
+ "v1.FeishuConfigurationV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.GetSQLEInfoResDataV1"
+ "app_id": {
+ "type": "string"
},
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.GetSQLQueryConfigurationResDataV1": {
- "type": "object",
- "properties": {
- "enable_sql_query": {
+ "is_feishu_notification_enabled": {
"type": "boolean"
- },
- "sql_query_root_uri": {
- "type": "string"
}
}
},
- "v1.GetSQLQueryConfigurationResV1": {
+ "v1.FullSyncAuditPlanSQLsReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.GetSQLQueryConfigurationResDataV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
+ "audit_plan_sql_list": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.AuditPlanSQLReqV1"
+ }
}
}
},
- "v1.GetSqlAverageExecutionTimeResV1": {
+ "v1.GetAuditPlanAnalysisDataResV1": {
"type": "object",
"properties": {
"code": {
@@ -13262,10 +8534,8 @@
"example": 0
},
"data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.SqlAverageExecutionTime"
- }
+ "type": "object",
+ "$ref": "#/definitions/v1.GetSQLAnalysisDataResItemV1"
},
"message": {
"type": "string",
@@ -13273,7 +8543,7 @@
}
}
},
- "v1.GetSqlExecutionFailPercentResV1": {
+ "v1.GetAuditPlanMetasResV1": {
"type": "object",
"properties": {
"code": {
@@ -13283,7 +8553,7 @@
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.SqlExecutionFailPercent"
+ "$ref": "#/definitions/v1.AuditPlanMetaV1"
}
},
"message": {
@@ -13292,35 +8562,30 @@
}
}
},
- "v1.GetSqlManageListResp": {
+ "v1.GetAuditPlanNotifyConfigResDataV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.SqlManage"
- }
+ "enable_email_notify": {
+ "type": "boolean"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "enable_web_hook_notify": {
+ "type": "boolean"
},
- "sql_manage_bad_num": {
+ "notify_interval": {
"type": "integer"
},
- "sql_manage_optimized_num": {
- "type": "integer"
+ "notify_level": {
+ "type": "string"
},
- "sql_manage_total_num": {
- "type": "integer"
+ "web_hook_template": {
+ "type": "string"
+ },
+ "web_hook_url": {
+ "type": "string"
}
}
},
- "v1.GetSqlManageRuleTipsResp": {
+ "v1.GetAuditPlanNotifyConfigResV1": {
"type": "object",
"properties": {
"code": {
@@ -13328,10 +8593,8 @@
"example": 0
},
"data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.RuleTips"
- }
+ "type": "object",
+ "$ref": "#/definitions/v1.GetAuditPlanNotifyConfigResDataV1"
},
"message": {
"type": "string",
@@ -13339,7 +8602,7 @@
}
}
},
- "v1.GetSqlManageSqlAnalysisResp": {
+ "v1.GetAuditPlanReportResV1": {
"type": "object",
"properties": {
"code": {
@@ -13348,7 +8611,7 @@
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.SqlAnalysis"
+ "$ref": "#/definitions/v1.AuditPlanReportResV1"
},
"message": {
"type": "string",
@@ -13356,7 +8619,7 @@
}
}
},
- "v1.GetSyncInstanceTaskListResV1": {
+ "v1.GetAuditPlanReportSQLsResV1": {
"type": "object",
"properties": {
"code": {
@@ -13366,33 +8629,19 @@
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.InstanceTaskResV1"
+ "$ref": "#/definitions/v1.AuditPlanReportSQLResV1"
}
},
"message": {
"type": "string",
"example": "ok"
- }
- }
- },
- "v1.GetSyncInstanceTaskResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.InstanceTaskDetailResV1"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "total_nums": {
+ "type": "integer"
}
}
},
- "v1.GetSyncTaskSourceTipsResV1": {
+ "v1.GetAuditPlanReportsResV1": {
"type": "object",
"properties": {
"code": {
@@ -13402,33 +8651,19 @@
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.SyncTaskTipsResV1"
+ "$ref": "#/definitions/v1.AuditPlanReportResV1"
}
},
"message": {
"type": "string",
"example": "ok"
- }
- }
- },
- "v1.GetSystemVariablesResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.SystemVariablesResV1"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "total_nums": {
+ "type": "integer"
}
}
},
- "v1.GetTableMetadataResV1": {
+ "v1.GetAuditPlanResV1": {
"type": "object",
"properties": {
"code": {
@@ -13437,7 +8672,7 @@
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.InstanceTableMeta"
+ "$ref": "#/definitions/v1.AuditPlanResV1"
},
"message": {
"type": "string",
@@ -13445,22 +8680,7 @@
}
}
},
- "v1.GetTaskAnalysisDataResItemV1": {
- "type": "object",
- "properties": {
- "sql_explain": {
- "type": "object",
- "$ref": "#/definitions/v1.SQLExplain"
- },
- "table_metas": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.TableMeta"
- }
- }
- }
- },
- "v1.GetTaskAnalysisDataResV1": {
+ "v1.GetAuditPlanSQLsResV1": {
"type": "object",
"properties": {
"code": {
@@ -13469,32 +8689,18 @@
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.GetTaskAnalysisDataResItemV1"
+ "$ref": "#/definitions/v1.AuditPlanSQLResV1"
},
"message": {
"type": "string",
"example": "ok"
- }
- }
- },
- "v1.GetUserDetailResV1": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.UserDetailResV1"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "total_nums": {
+ "type": "integer"
}
}
},
- "v1.GetUserGroupTipsResV1": {
+ "v1.GetAuditPlanTypesResV1": {
"type": "object",
"properties": {
"code": {
@@ -13504,7 +8710,7 @@
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.UserGroupTipListItem"
+ "$ref": "#/definitions/v1.AuditPlanTypesV1"
}
},
"message": {
@@ -13513,7 +8719,7 @@
}
}
},
- "v1.GetUserGroupsResV1": {
+ "v1.GetAuditPlansResV1": {
"type": "object",
"properties": {
"code": {
@@ -13523,7 +8729,7 @@
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.UserGroupListItemResV1"
+ "$ref": "#/definitions/v1.AuditPlanResV1"
}
},
"message": {
@@ -13535,7 +8741,7 @@
}
}
},
- "v1.GetUserLoginResV1": {
+ "v1.GetAuditTaskResV1": {
"type": "object",
"properties": {
"code": {
@@ -13544,7 +8750,7 @@
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.UserLoginResV1"
+ "$ref": "#/definitions/v1.AuditTaskResV1"
},
"message": {
"type": "string",
@@ -13552,7 +8758,7 @@
}
}
},
- "v1.GetUserTipsResV1": {
+ "v1.GetAuditTaskSQLContentResV1": {
"type": "object",
"properties": {
"code": {
@@ -13560,10 +8766,8 @@
"example": 0
},
"data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.UserTipResV1"
- }
+ "type": "object",
+ "$ref": "#/definitions/v1.AuditTaskSQLContentResV1"
},
"message": {
"type": "string",
@@ -13571,7 +8775,7 @@
}
}
},
- "v1.GetUsersResV1": {
+ "v1.GetAuditTaskSQLsResV1": {
"type": "object",
"properties": {
"code": {
@@ -13581,7 +8785,7 @@
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.UserResV1"
+ "$ref": "#/definitions/v1.AuditTaskSQLResV1"
}
},
"message": {
@@ -13593,7 +8797,7 @@
}
}
},
- "v1.GetWeChatConfigurationResV1": {
+ "v1.GetAuditWhitelistResV1": {
"type": "object",
"properties": {
"code": {
@@ -13601,16 +8805,21 @@
"example": 0
},
"data": {
- "type": "object",
- "$ref": "#/definitions/v1.WeChatConfigurationResV1"
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.AuditWhitelistResV1"
+ }
},
"message": {
"type": "string",
"example": "ok"
+ },
+ "total_nums": {
+ "type": "integer"
}
}
},
- "v1.GetWorkflowAuditPassPercentResV1": {
+ "v1.GetCompanyNoticeResp": {
"type": "object",
"properties": {
"code": {
@@ -13619,7 +8828,7 @@
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.WorkflowAuditPassPercentV1"
+ "$ref": "#/definitions/v1.CompanyNotice"
},
"message": {
"type": "string",
@@ -13627,7 +8836,7 @@
}
}
},
- "v1.GetWorkflowCountsResV1": {
+ "v1.GetCustomRuleResV1": {
"type": "object",
"properties": {
"code": {
@@ -13636,7 +8845,7 @@
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.WorkflowCountsV1"
+ "$ref": "#/definitions/v1.CustomRuleResV1"
},
"message": {
"type": "string",
@@ -13644,7 +8853,7 @@
}
}
},
- "v1.GetWorkflowCreatedCountsEachDayResV1": {
+ "v1.GetCustomRulesResV1": {
"type": "object",
"properties": {
"code": {
@@ -13652,8 +8861,10 @@
"example": 0
},
"data": {
- "type": "object",
- "$ref": "#/definitions/v1.WorkflowCreatedCountsEachDayV1"
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.CustomRuleResV1"
+ }
},
"message": {
"type": "string",
@@ -13661,7 +8872,7 @@
}
}
},
- "v1.GetWorkflowDurationOfWaitingForAuditResV1": {
+ "v1.GetDashboardResV1": {
"type": "object",
"properties": {
"code": {
@@ -13670,7 +8881,7 @@
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.WorkflowStageDuration"
+ "$ref": "#/definitions/v1.DashboardResV1"
},
"message": {
"type": "string",
@@ -13678,7 +8889,7 @@
}
}
},
- "v1.GetWorkflowDurationOfWaitingForExecutionResV1": {
+ "v1.GetDingTalkConfigurationResV1": {
"type": "object",
"properties": {
"code": {
@@ -13687,7 +8898,7 @@
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.WorkflowStageDuration"
+ "$ref": "#/definitions/v1.DingTalkConfigurationV1"
},
"message": {
"type": "string",
@@ -13695,7 +8906,7 @@
}
}
},
- "v1.GetWorkflowPassPercentResV1": {
+ "v1.GetDriversResV1": {
"type": "object",
"properties": {
"code": {
@@ -13704,7 +8915,7 @@
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.WorkflowPassPercentV1"
+ "$ref": "#/definitions/v1.DriversResV1"
},
"message": {
"type": "string",
@@ -13712,7 +8923,7 @@
}
}
},
- "v1.GetWorkflowPercentCountedByInstanceTypeResV1": {
+ "v1.GetFeishuAuditConfigurationResV1": {
"type": "object",
"properties": {
"code": {
@@ -13721,7 +8932,7 @@
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.WorkflowPercentCountedByInstanceTypeV1"
+ "$ref": "#/definitions/v1.FeishuConfigurationV1"
},
"message": {
"type": "string",
@@ -13729,7 +8940,7 @@
}
}
},
- "v1.GetWorkflowRejectedPercentGroupByCreatorResV1": {
+ "v1.GetInstanceConnectableResV1": {
"type": "object",
"properties": {
"code": {
@@ -13737,10 +8948,8 @@
"example": 0
},
"data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.WorkflowRejectedPercentGroupByCreator"
- }
+ "type": "object",
+ "$ref": "#/definitions/v1.InstanceConnectableResV1"
},
"message": {
"type": "string",
@@ -13748,7 +8957,7 @@
}
}
},
- "v1.GetWorkflowRejectedPercentGroupByInstanceResV1": {
+ "v1.GetInstanceHealthResV1": {
"type": "object",
"properties": {
"code": {
@@ -13758,7 +8967,7 @@
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.WorkflowRejectedPercentGroupByInstance"
+ "$ref": "#/definitions/v1.DBTypeHealth"
}
},
"message": {
@@ -13767,7 +8976,7 @@
}
}
},
- "v1.GetWorkflowResV1": {
+ "v1.GetInstanceSchemaResV1": {
"type": "object",
"properties": {
"code": {
@@ -13776,7 +8985,7 @@
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.WorkflowResV1"
+ "$ref": "#/definitions/v1.InstanceSchemaResV1"
},
"message": {
"type": "string",
@@ -13784,7 +8993,7 @@
}
}
},
- "v1.GetWorkflowStatusCountResV1": {
+ "v1.GetInstanceTipsResV1": {
"type": "object",
"properties": {
"code": {
@@ -13792,8 +9001,10 @@
"example": 0
},
"data": {
- "type": "object",
- "$ref": "#/definitions/v1.WorkflowStatusCountV1"
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.InstanceTipResV1"
+ }
},
"message": {
"type": "string",
@@ -13801,70 +9012,37 @@
}
}
},
- "v1.GetWorkflowTasksItemV1": {
+ "v1.GetInstancesTypePercentResV1": {
"type": "object",
"properties": {
- "current_step_assignee_user_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "exec_end_time": {
- "type": "string"
- },
- "exec_start_time": {
- "type": "string"
- },
- "execution_user_name": {
- "type": "string"
- },
- "instance_maintenance_times": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.MaintenanceTimeResV1"
- }
- },
- "instance_name": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "schedule_time": {
- "type": "string"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.InstancesTypePercentV1"
},
- "status": {
+ "message": {
"type": "string",
- "enum": [
- "wait_for_audit",
- "wait_for_execution",
- "exec_scheduled",
- "exec_failed",
- "exec_succeeded",
- "executing",
- "manually_executed"
- ]
- },
- "task_id": {
- "type": "integer"
- },
- "task_pass_rate": {
- "type": "number"
- },
- "task_score": {
- "type": "integer"
+ "example": "ok"
}
}
},
- "v1.GetWorkflowTasksResV1": {
+ "v1.GetLicenseResV1": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"example": 0
},
- "data": {
+ "content": {
+ "type": "string"
+ },
+ "license": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.GetWorkflowTasksItemV1"
+ "$ref": "#/definitions/v1.LicenseItem"
}
},
"message": {
@@ -13873,7 +9051,7 @@
}
}
},
- "v1.GetWorkflowTemplateResV1": {
+ "v1.GetLicenseUsageResV1": {
"type": "object",
"properties": {
"code": {
@@ -13882,7 +9060,7 @@
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.WorkflowTemplateDetailResV1"
+ "$ref": "#/definitions/v1.LicenseUsageV1"
},
"message": {
"type": "string",
@@ -13890,7 +9068,7 @@
}
}
},
- "v1.GetWorkflowWebHookConfigResV1": {
+ "v1.GetOperationActionListResV1": {
"type": "object",
"properties": {
"code": {
@@ -13898,8 +9076,10 @@
"example": 0
},
"data": {
- "type": "object",
- "$ref": "#/definitions/v1.WebHookConfigV1"
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.OperationActionList"
+ }
},
"message": {
"type": "string",
@@ -13907,7 +9087,7 @@
}
}
},
- "v1.GetWorkflowsResV1": {
+ "v1.GetOperationRecordListResV1": {
"type": "object",
"properties": {
"code": {
@@ -13917,7 +9097,7 @@
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.WorkflowDetailResV1"
+ "$ref": "#/definitions/v1.OperationRecordList"
}
},
"message": {
@@ -13929,420 +9109,273 @@
}
}
},
- "v1.GlobalRuleTemplateInstance": {
- "type": "object",
- "properties": {
- "instance_name": {
- "type": "string"
- },
- "project_name": {
- "type": "string"
- }
- }
- },
- "v1.InstanceAdditionalMetaV1": {
- "type": "object",
- "properties": {
- "db_type": {
- "type": "string"
- },
- "params": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.InstanceAdditionalParamResV1"
- }
- }
- }
- },
- "v1.InstanceAdditionalParamReqV1": {
- "type": "object",
- "properties": {
- "name": {
- "type": "string"
- },
- "value": {
- "type": "string"
- }
- }
- },
- "v1.InstanceAdditionalParamResV1": {
- "type": "object",
- "properties": {
- "description": {
- "type": "string",
- "example": "参数项中文名"
- },
- "name": {
- "type": "string",
- "example": "param name"
- },
- "type": {
- "type": "string",
- "example": "int"
- },
- "value": {
- "type": "string",
- "example": "0"
- }
- }
- },
- "v1.InstanceConnectableResV1": {
- "type": "object",
- "properties": {
- "connect_error_message": {
- "type": "string"
- },
- "is_instance_connectable": {
- "type": "boolean"
- }
- }
- },
- "v1.InstanceConnectionResV1": {
- "type": "object",
- "properties": {
- "connect_error_message": {
- "type": "string"
- },
- "instance_name": {
- "type": "string"
- },
- "is_instance_connectable": {
- "type": "boolean"
- }
- }
- },
- "v1.InstanceForCheckConnection": {
- "type": "object",
- "properties": {
- "name": {
- "type": "string"
- }
- }
- },
- "v1.InstanceForCreatingTask": {
- "type": "object",
- "properties": {
- "instance_name": {
- "type": "string"
- },
- "instance_schema": {
- "type": "string"
- }
- }
- },
- "v1.InstanceResV1": {
+ "v1.GetOperationTypeNamesListResV1": {
"type": "object",
"properties": {
- "additional_params": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.InstanceAdditionalParamResV1"
- }
- },
- "db_host": {
- "type": "string",
- "example": "10.10.10.10"
- },
- "db_port": {
- "type": "string",
- "example": "3306"
- },
- "db_type": {
- "type": "string",
- "example": "mysql"
- },
- "db_user": {
- "type": "string",
- "example": "root"
- },
- "desc": {
- "type": "string",
- "example": "this is a instance"
- },
- "instance_name": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "maintenance_times": {
+ "data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.MaintenanceTimeResV1"
+ "$ref": "#/definitions/v1.OperationTypeNameList"
}
},
- "rule_template_name": {
- "type": "string"
- },
- "source": {
+ "message": {
"type": "string",
- "example": "SQLE"
- },
- "sql_query_config": {
- "type": "object",
- "$ref": "#/definitions/v1.SQLQueryConfigResV1"
+ "example": "ok"
}
}
},
- "v1.InstanceSchemaResV1": {
+ "v1.GetOperationsResV1": {
"type": "object",
"properties": {
- "schema_name_list": {
+ "code": {
+ "type": "integer",
+ "example": 0
+ },
+ "data": {
"type": "array",
"items": {
- "type": "string"
+ "$ref": "#/definitions/v1.OperationResV1"
}
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.InstanceTableMeta": {
+ "v1.GetProjectRuleTemplateResV1": {
"type": "object",
"properties": {
- "columns": {
- "type": "object",
- "$ref": "#/definitions/v1.TableColumns"
- },
- "create_table_sql": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "indexes": {
+ "data": {
"type": "object",
- "$ref": "#/definitions/v1.TableIndexes"
- },
- "name": {
- "type": "string"
+ "$ref": "#/definitions/v1.RuleProjectTemplateDetailResV1"
},
- "schema": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.InstanceTaskDetailResV1": {
+ "v1.GetProjectRuleTemplatesResV1": {
"type": "object",
"properties": {
- "db_type": {
- "type": "string",
- "example": "mysql"
- },
- "id": {
+ "code": {
"type": "integer",
- "example": 1
- },
- "rule_template": {
- "type": "string",
- "example": "default_mysql"
- },
- "source": {
- "type": "string",
- "example": "actiontech-dmp"
+ "example": 0
},
- "sync_instance_interval": {
- "type": "string",
- "example": "0 0 * * *"
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.ProjectRuleTemplateResV1"
+ }
},
- "url": {
+ "message": {
"type": "string",
- "example": "http://10.186.62.56:10000"
+ "example": "ok"
},
- "version": {
- "type": "string",
- "example": "1.23.1"
+ "total_nums": {
+ "type": "integer"
}
}
},
- "v1.InstanceTaskResV1": {
+ "v1.GetProjectScoreResV1": {
"type": "object",
"properties": {
- "db_type": {
- "type": "string",
- "example": "mysql"
- },
- "id": {
+ "code": {
"type": "integer",
- "example": 1
- },
- "last_sync_status": {
- "type": "string",
- "enum": [
- "succeeded",
- "failed"
- ],
- "example": "succeeded"
- },
- "last_sync_success_time": {
- "type": "string",
- "example": "2021-08-12 12:00:00"
- },
- "source": {
- "type": "string",
- "example": "actiontech-dmp"
+ "example": 0
},
- "url": {
- "type": "string",
- "example": "http://10.186.62.56:10000"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.ProjectScore"
},
- "version": {
+ "message": {
"type": "string",
- "example": "1.23.1"
+ "example": "ok"
}
}
},
- "v1.InstanceTipResV1": {
+ "v1.GetProjectStatisticsResDataV1": {
"type": "object",
"properties": {
- "host": {
- "type": "string"
+ "audit_plan_total": {
+ "type": "integer"
},
- "instance_name": {
- "type": "string"
+ "instance_total": {
+ "type": "integer"
},
- "instance_type": {
- "type": "string"
+ "member_total": {
+ "type": "integer"
},
- "port": {
- "type": "string"
+ "rule_template_total": {
+ "type": "integer"
},
- "workflow_template_id": {
+ "whitelist_total": {
+ "type": "integer"
+ },
+ "workflow_total": {
"type": "integer"
}
}
},
- "v1.InstanceTypePercent": {
+ "v1.GetProjectStatisticsResV1": {
"type": "object",
"properties": {
- "count": {
- "type": "integer"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "percent": {
- "type": "number"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.GetProjectStatisticsResDataV1"
},
- "type": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.InstancesTypePercentV1": {
+ "v1.GetRiskAuditPlanResV1": {
"type": "object",
"properties": {
- "instance_total_num": {
- "type": "integer"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "instance_type_percents": {
+ "data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.InstanceTypePercent"
+ "$ref": "#/definitions/v1.RiskAuditPlan"
}
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.LDAPConfigurationReqV1": {
+ "v1.GetRoleUserCountResV1": {
"type": "object",
"properties": {
- "enable_ldap": {
- "type": "boolean"
- },
- "enable_ssl": {
- "type": "boolean"
- },
- "ldap_connect_dn": {
- "type": "string"
- },
- "ldap_connect_pwd": {
- "type": "string"
- },
- "ldap_search_base_dn": {
- "type": "string"
- },
- "ldap_server_host": {
- "type": "string"
- },
- "ldap_server_port": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "ldap_user_email_rdn_key": {
- "type": "string"
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.RoleUserCount"
+ }
},
- "ldap_user_name_rdn_key": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.LDAPConfigurationResV1": {
+ "v1.GetRuleKnowledgeResV1": {
"type": "object",
"properties": {
- "enable_ldap": {
- "type": "boolean"
- },
- "enable_ssl": {
- "type": "boolean"
- },
- "ldap_connect_dn": {
- "type": "string"
- },
- "ldap_search_base_dn": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "ldap_server_host": {
- "type": "string"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.RuleKnowledgeResV1"
},
- "ldap_server_port": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
+ }
+ }
+ },
+ "v1.GetRuleTemplateResV1": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "ldap_user_email_rdn_key": {
- "type": "string"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.RuleTemplateDetailResV1"
},
- "ldap_user_name_rdn_key": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.LicenseItem": {
+ "v1.GetRuleTemplateTipsResV1": {
"type": "object",
"properties": {
- "description": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "limit": {
- "type": "string"
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.RuleTemplateTipResV1"
+ }
},
- "name": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.LicenseUsageItem": {
+ "v1.GetRuleTemplatesResV1": {
"type": "object",
"properties": {
- "is_limited": {
- "type": "boolean"
- },
- "limit": {
- "type": "integer"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "resource_type": {
- "type": "string"
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.RuleTemplateResV1"
+ }
},
- "resource_type_desc": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
},
- "used": {
+ "total_nums": {
"type": "integer"
}
}
},
- "v1.LicenseUsageV1": {
+ "v1.GetRuleTypeByDBTypeResV1": {
"type": "object",
"properties": {
- "instances_usage": {
+ "code": {
+ "type": "integer",
+ "example": 0
+ },
+ "data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.LicenseUsageItem"
+ "$ref": "#/definitions/v1.RuleTypeV1"
}
},
- "users_usage": {
- "type": "object",
- "$ref": "#/definitions/v1.LicenseUsageItem"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.ListTableBySchemaResV1": {
+ "v1.GetRulesResV1": {
"type": "object",
"properties": {
"code": {
@@ -14352,7 +9385,7 @@
"data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.Table"
+ "$ref": "#/definitions/v1.RuleResV1"
}
},
"message": {
@@ -14361,213 +9394,183 @@
}
}
},
- "v1.MaintenanceTimeReqV1": {
+ "v1.GetSQLAnalysisDataResItemV1": {
"type": "object",
"properties": {
- "maintenance_start_time": {
+ "sql_explain": {
"type": "object",
- "$ref": "#/definitions/v1.TimeReqV1"
+ "$ref": "#/definitions/v1.SQLExplain"
},
- "maintenance_stop_time": {
- "type": "object",
- "$ref": "#/definitions/v1.TimeReqV1"
+ "table_metas": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.TableMeta"
+ }
}
}
},
- "v1.MaintenanceTimeResV1": {
+ "v1.GetSQLAuditRecordResV1": {
"type": "object",
"properties": {
- "maintenance_start_time": {
- "type": "object",
- "$ref": "#/definitions/v1.TimeResV1"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "maintenance_stop_time": {
+ "data": {
"type": "object",
- "$ref": "#/definitions/v1.TimeResV1"
+ "$ref": "#/definitions/v1.SQLAuditRecord"
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.ManagementPermissionResV1": {
+ "v1.GetSQLAuditRecordTagTipsResV1": {
"type": "object",
"properties": {
"code": {
- "type": "integer"
+ "type": "integer",
+ "example": 0
},
- "desc": {
- "type": "string"
- }
- }
- },
- "v1.MemberGroupUserItem": {
- "type": "object",
- "properties": {
- "name": {
- "type": "string"
- }
- }
- },
- "v1.MemberTipResV1": {
- "type": "object",
- "properties": {
- "user_name": {
- "type": "string"
+ "data": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.Oauth2ConfigurationReqV1": {
+ "v1.GetSQLAuditRecordsResV1": {
"type": "object",
"properties": {
- "access_token_tag": {
- "type": "string"
- },
- "client_host": {
- "type": "string"
- },
- "client_id": {
- "type": "string"
- },
- "client_key": {
- "type": "string"
- },
- "enable_oauth2": {
- "type": "boolean"
- },
- "login_tip": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "scopes": {
+ "data": {
"type": "array",
"items": {
- "type": "string"
+ "$ref": "#/definitions/v1.SQLAuditRecord"
}
},
- "server_auth_url": {
- "type": "string"
- },
- "server_token_url": {
- "type": "string"
- },
- "server_user_id_url": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
},
- "user_id_tag": {
- "type": "string"
+ "total_nums": {
+ "type": "integer"
}
}
},
- "v1.Operation": {
+ "v1.GetSqlAverageExecutionTimeResV1": {
"type": "object",
"properties": {
- "op_code": {
- "type": "integer"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "op_desc": {
- "type": "string"
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.SqlAverageExecutionTime"
+ }
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.OperationActionList": {
+ "v1.GetSqlExecutionFailPercentResV1": {
"type": "object",
"properties": {
- "desc": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "operation_action": {
- "type": "string"
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.SqlExecutionFailPercent"
+ }
},
- "operation_type": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.OperationRecordList": {
+ "v1.GetSqlManageListResp": {
"type": "object",
"properties": {
- "id": {
- "type": "integer"
- },
- "operation_action": {
- "type": "string"
- },
- "operation_content": {
- "type": "string"
- },
- "operation_time": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "operation_type_name": {
- "type": "string"
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.SqlManage"
+ }
},
- "operation_user": {
- "type": "object",
- "$ref": "#/definitions/v1.OperationUser"
+ "message": {
+ "type": "string",
+ "example": "ok"
},
- "project_name": {
- "type": "string"
+ "sql_manage_bad_num": {
+ "type": "integer"
},
- "status": {
- "type": "string",
- "enum": [
- "succeeded",
- "failed"
- ]
- }
- }
- },
- "v1.OperationResV1": {
- "type": "object",
- "properties": {
- "op_code": {
+ "sql_manage_optimized_num": {
"type": "integer"
},
- "op_desc": {
- "type": "string"
+ "sql_manage_total_num": {
+ "type": "integer"
}
}
},
- "v1.OperationTypeNameList": {
+ "v1.GetSqlManageRuleTipsResp": {
"type": "object",
"properties": {
- "desc": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "operation_type_name": {
- "type": "string"
- }
- }
- },
- "v1.OperationUser": {
- "type": "object",
- "properties": {
- "ip": {
- "type": "string"
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.RuleTips"
+ }
},
- "user_name": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.ParseProjectRuleTemplateFileResDataV1": {
+ "v1.GetSqlManageSqlAnalysisResp": {
"type": "object",
"properties": {
- "db_type": {
- "type": "string"
- },
- "desc": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "name": {
- "type": "string"
+ "data": {
+ "description": "V1版本不能引用V2版本的结构体,所以只能复制一份",
+ "type": "object",
+ "$ref": "#/definitions/v1.SqlAnalysis"
},
- "rule_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.RuleResV1"
- }
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.ParseProjectRuleTemplateFileResV1": {
+ "v1.GetSystemVariablesResV1": {
"type": "object",
"properties": {
"code": {
@@ -14576,7 +9579,7 @@
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.ParseProjectRuleTemplateFileResDataV1"
+ "$ref": "#/definitions/v1.SystemVariablesResV1"
},
"message": {
"type": "string",
@@ -14584,795 +9587,708 @@
}
}
},
- "v1.PartialSyncAuditPlanSQLsReqV1": {
+ "v1.GetTableMetadataResV1": {
"type": "object",
"properties": {
- "audit_plan_sql_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditPlanSQLReqV1"
- }
+ "code": {
+ "type": "integer",
+ "example": 0
+ },
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.InstanceTableMeta"
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.PatchUserGroupReqV1": {
+ "v1.GetTaskAnalysisDataResItemV1": {
"type": "object",
"properties": {
- "is_disabled": {
- "type": "boolean"
- },
- "user_group_desc": {
- "type": "string",
- "example": "this is a group"
+ "sql_explain": {
+ "type": "object",
+ "$ref": "#/definitions/v1.SQLExplain"
},
- "user_name_list": {
+ "table_metas": {
"type": "array",
"items": {
- "type": "string"
+ "$ref": "#/definitions/v1.TableMeta"
}
}
}
},
- "v1.PerformanceStatistics": {
+ "v1.GetTaskAnalysisDataResV1": {
"type": "object",
"properties": {
- "affect_rows": {
+ "code": {
+ "type": "integer",
+ "example": 0
+ },
+ "data": {
"type": "object",
- "$ref": "#/definitions/v1.AffectRows"
- }
- }
- },
- "v1.PersonaliseReqV1": {
- "type": "object",
- "properties": {
- "title": {
- "type": "string"
+ "$ref": "#/definitions/v1.GetTaskAnalysisDataResItemV1"
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.ProjectDetailItem": {
+ "v1.GetUserTipsResV1": {
"type": "object",
"properties": {
- "archived": {
- "type": "boolean"
- },
- "create_time": {
- "type": "string"
- },
- "create_user_name": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "desc": {
- "type": "string"
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.UserTipResV1"
+ }
},
- "name": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.ProjectListItem": {
+ "v1.GetWorkflowAuditPassPercentResV1": {
"type": "object",
"properties": {
- "archived": {
- "type": "boolean"
- },
- "create_time": {
- "type": "string"
- },
- "create_user_name": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "desc": {
- "type": "string"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.WorkflowAuditPassPercentV1"
},
- "name": {
- "type": "string"
- }
- }
- },
- "v1.ProjectRuleTemplateInstance": {
- "type": "object",
- "properties": {
- "name": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.ProjectRuleTemplateResV1": {
+ "v1.GetWorkflowCountsResV1": {
"type": "object",
"properties": {
- "db_type": {
- "type": "string"
- },
- "desc": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "instance_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.ProjectRuleTemplateInstance"
- }
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.WorkflowCountsV1"
},
- "rule_template_name": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.ProjectScore": {
+ "v1.GetWorkflowCreatedCountsEachDayResV1": {
"type": "object",
"properties": {
- "score": {
- "type": "integer"
+ "code": {
+ "type": "integer",
+ "example": 0
+ },
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.WorkflowCreatedCountsEachDayV1"
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.ProjectTipResV1": {
+ "v1.GetWorkflowDurationOfWaitingForAuditResV1": {
"type": "object",
"properties": {
- "project_name": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
+ },
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.WorkflowStageDuration"
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.RejectWorkflowReqV1": {
+ "v1.GetWorkflowDurationOfWaitingForExecutionResV1": {
"type": "object",
"properties": {
- "reason": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
+ },
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.WorkflowStageDuration"
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.RiskAuditPlan": {
+ "v1.GetWorkflowPassPercentResV1": {
"type": "object",
"properties": {
- "audit_plan_name": {
- "type": "string"
- },
- "audit_plan_report_id": {
- "type": "integer"
- },
- "audit_plan_report_timestamp": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "risk_sql_count": {
- "type": "integer"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.WorkflowPassPercentV1"
},
- "trigger_audit_plan_time": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.RiskWorkflow": {
+ "v1.GetWorkflowPercentCountedByInstanceTypeResV1": {
"type": "object",
"properties": {
- "create_user_name": {
- "type": "string"
- },
- "update_time": {
- "type": "string"
- },
- "workflow_id": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "workflow_name": {
- "type": "string"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.WorkflowPercentCountedByInstanceTypeV1"
},
- "workflow_status": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.RoleResV1": {
+ "v1.GetWorkflowRejectedPercentGroupByCreatorResV1": {
"type": "object",
"properties": {
- "is_disabled": {
- "type": "boolean"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "operation_list": {
+ "data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.Operation"
+ "$ref": "#/definitions/v1.WorkflowRejectedPercentGroupByCreator"
}
},
- "role_desc": {
- "type": "string"
- },
- "role_name": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.RoleTipResV1": {
+ "v1.GetWorkflowRejectedPercentGroupByInstanceResV1": {
"type": "object",
"properties": {
- "operations": {
+ "code": {
+ "type": "integer",
+ "example": 0
+ },
+ "data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.Operation"
+ "$ref": "#/definitions/v1.WorkflowRejectedPercentGroupByInstance"
}
},
- "role_name": {
- "type": "string"
- }
- }
- },
- "v1.RoleUserCount": {
- "type": "object",
- "properties": {
- "count": {
- "type": "integer"
- },
- "role": {
- "type": "string"
- }
- }
- },
- "v1.RuleInfo": {
- "type": "object",
- "properties": {
- "annotation": {
- "type": "string",
- "example": "this is test rule"
- },
- "desc": {
+ "message": {
"type": "string",
- "example": "this is test rule"
+ "example": "ok"
}
}
},
- "v1.RuleKnowledgeResV1": {
+ "v1.GetWorkflowResV1": {
"type": "object",
"properties": {
- "knowledge_content": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "rule": {
+ "data": {
"type": "object",
- "$ref": "#/definitions/v1.RuleInfo"
+ "$ref": "#/definitions/v1.WorkflowResV1"
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.RuleParamReqV1": {
+ "v1.GetWorkflowStatusCountResV1": {
"type": "object",
"properties": {
- "key": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "value": {
- "type": "string"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.WorkflowStatusCountV1"
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.RuleParamResV1": {
+ "v1.GetWorkflowTasksItemV1": {
"type": "object",
"properties": {
- "desc": {
+ "current_step_assignee_user_name_list": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "exec_end_time": {
"type": "string"
},
- "key": {
+ "exec_start_time": {
"type": "string"
},
- "type": {
+ "execution_user_name": {
+ "type": "string"
+ },
+ "instance_maintenance_times": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.MaintenanceTimeResV1"
+ }
+ },
+ "instance_name": {
+ "type": "string"
+ },
+ "schedule_time": {
+ "type": "string"
+ },
+ "status": {
"type": "string",
"enum": [
- "string",
- "int",
- "bool"
+ "wait_for_audit",
+ "wait_for_execution",
+ "exec_scheduled",
+ "exec_failed",
+ "exec_succeeded",
+ "executing",
+ "manually_executed"
]
},
- "value": {
- "type": "string"
+ "task_id": {
+ "type": "integer"
+ },
+ "task_pass_rate": {
+ "type": "number"
+ },
+ "task_score": {
+ "type": "integer"
}
}
},
- "v1.RuleProjectTemplateDetailResV1": {
+ "v1.GetWorkflowTasksResV1": {
"type": "object",
"properties": {
- "db_type": {
- "type": "string"
- },
- "desc": {
- "type": "string"
- },
- "instance_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.ProjectRuleTemplateInstance"
- }
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "rule_list": {
+ "data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.RuleResV1"
+ "$ref": "#/definitions/v1.GetWorkflowTasksItemV1"
}
},
- "rule_template_name": {
- "type": "string"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.RuleReqV1": {
+ "v1.GetWorkflowTemplateResV1": {
"type": "object",
"properties": {
- "is_custom_rule": {
- "type": "boolean"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "level": {
- "type": "string",
- "example": "error"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.WorkflowTemplateDetailResV1"
},
- "name": {
+ "message": {
"type": "string",
- "example": "ddl_check_index_count"
+ "example": "ok"
+ }
+ }
+ },
+ "v1.GetWorkflowsResV1": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "params": {
+ "data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.RuleParamReqV1"
+ "$ref": "#/definitions/v1.WorkflowDetailResV1"
}
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
+ },
+ "total_nums": {
+ "type": "integer"
}
}
},
- "v1.RuleResV1": {
+ "v1.InstanceAdditionalParamResV1": {
"type": "object",
"properties": {
- "annotation": {
+ "description": {
"type": "string",
- "example": "避免多次 table rebuild 带来的消耗、以及对线上业务的影响"
+ "example": "参数项中文名"
},
- "db_type": {
+ "name": {
"type": "string",
- "example": "mysql"
- },
- "desc": {
- "type": "string"
- },
- "is_custom_rule": {
- "type": "boolean"
+ "example": "param name"
},
- "level": {
+ "type": {
"type": "string",
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ],
- "example": "error"
- },
- "params": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.RuleParamResV1"
- }
- },
- "rule_name": {
- "type": "string"
+ "example": "int"
},
- "type": {
+ "value": {
"type": "string",
- "example": "全局配置"
+ "example": "0"
}
}
},
- "v1.RuleRespV1": {
+ "v1.InstanceConnectableResV1": {
"type": "object",
"properties": {
- "desc": {
+ "connect_error_message": {
"type": "string"
},
- "rule_name": {
- "type": "string"
+ "is_instance_connectable": {
+ "type": "boolean"
}
}
},
- "v1.RuleTemplateDetailResV1": {
+ "v1.InstanceConnectionResV1": {
"type": "object",
"properties": {
- "db_type": {
+ "connect_error_message": {
"type": "string"
},
- "desc": {
+ "instance_name": {
"type": "string"
},
- "instance_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.GlobalRuleTemplateInstance"
- }
- },
- "rule_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.RuleResV1"
- }
- },
- "rule_template_name": {
- "type": "string"
+ "is_instance_connectable": {
+ "type": "boolean"
}
}
},
- "v1.RuleTemplateResV1": {
+ "v1.InstanceForCheckConnection": {
"type": "object",
"properties": {
- "db_type": {
- "type": "string"
- },
- "desc": {
- "type": "string"
- },
- "instance_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.GlobalRuleTemplateInstance"
- }
- },
- "rule_template_name": {
+ "name": {
"type": "string"
}
}
},
- "v1.RuleTemplateTipResV1": {
+ "v1.InstanceForCreatingTask": {
"type": "object",
"properties": {
- "db_type": {
+ "instance_name": {
"type": "string"
},
- "rule_template_name": {
+ "instance_schema": {
"type": "string"
}
}
},
- "v1.RuleTips": {
+ "v1.InstanceSchemaResV1": {
"type": "object",
"properties": {
- "db_type": {
- "type": "string"
- },
- "rule": {
+ "schema_name_list": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.RuleRespV1"
+ "type": "string"
}
}
}
},
- "v1.RuleTypeV1": {
- "type": "object",
- "properties": {
- "is_custom_rule_type": {
- "type": "boolean"
- },
- "rule_count": {
- "type": "integer"
- },
- "rule_type": {
- "type": "string"
- }
- }
- },
- "v1.SMTPConfigurationResV1": {
+ "v1.InstanceTableMeta": {
"type": "object",
"properties": {
- "enable_smtp_notify": {
- "type": "boolean"
- },
- "is_skip_verify": {
- "type": "boolean"
+ "columns": {
+ "type": "object",
+ "$ref": "#/definitions/v1.TableColumns"
},
- "smtp_host": {
+ "create_table_sql": {
"type": "string"
},
- "smtp_port": {
+ "indexes": {
+ "type": "object",
+ "$ref": "#/definitions/v1.TableIndexes"
+ },
+ "name": {
"type": "string"
},
- "smtp_username": {
+ "schema": {
"type": "string"
}
}
},
- "v1.SQLAuditRecord": {
+ "v1.InstanceTipResV1": {
"type": "object",
"properties": {
- "created_at": {
+ "host": {
"type": "string"
},
- "creator": {
+ "instance_id": {
"type": "string"
},
- "instance": {
- "type": "object",
- "$ref": "#/definitions/v1.SQLAuditRecordInstance"
- },
- "sql_audit_record_id": {
+ "instance_name": {
"type": "string"
},
- "sql_audit_status": {
+ "instance_type": {
"type": "string"
},
- "tags": {
- "type": "array",
- "items": {
- "type": "string"
- }
+ "port": {
+ "type": "string"
},
- "task": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditTaskResV1"
+ "workflow_template_id": {
+ "type": "integer"
}
}
},
- "v1.SQLAuditRecordInstance": {
+ "v1.InstanceTypePercent": {
"type": "object",
"properties": {
- "db_host": {
- "type": "string",
- "example": "10.10.10.10"
+ "count": {
+ "type": "integer"
},
- "db_port": {
- "type": "string",
- "example": "3306"
+ "percent": {
+ "type": "number"
+ },
+ "type": {
+ "type": "string"
}
}
},
- "v1.SQLAuditRecordResData": {
+ "v1.InstancesTypePercentV1": {
"type": "object",
"properties": {
- "sql_audit_record_id": {
- "type": "string"
+ "instance_total_num": {
+ "type": "integer"
},
- "task": {
- "type": "object",
- "$ref": "#/definitions/v1.AuditTaskResV1"
+ "instance_type_percents": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.InstanceTypePercent"
+ }
}
}
},
- "v1.SQLExplain": {
+ "v1.LicenseItem": {
"type": "object",
"properties": {
- "classic_result": {
- "description": "explain result in table format",
- "type": "object",
- "$ref": "#/definitions/v1.ExplainClassicResult"
- },
- "message": {
+ "description": {
"type": "string"
},
- "sql": {
+ "limit": {
"type": "string"
- }
- }
- },
- "v1.SQLQueryConfigReqV1": {
- "type": "object",
- "properties": {
- "allow_query_when_less_than_audit_level": {
- "type": "string",
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ],
- "example": "error"
- },
- "audit_enabled": {
- "type": "boolean",
- "example": false
- },
- "max_pre_query_rows": {
- "type": "integer",
- "example": 100
},
- "query_timeout_second": {
- "type": "integer",
- "example": 10
+ "name": {
+ "type": "string"
}
}
},
- "v1.SQLQueryConfigResV1": {
+ "v1.LicenseUsageItem": {
"type": "object",
"properties": {
- "allow_query_when_less_than_audit_level": {
- "type": "string",
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ]
- },
- "audit_enabled": {
+ "is_limited": {
"type": "boolean"
},
- "max_pre_query_rows": {
+ "limit": {
"type": "integer"
},
- "query_timeout_second": {
+ "resource_type": {
+ "type": "string"
+ },
+ "resource_type_desc": {
+ "type": "string"
+ },
+ "used": {
"type": "integer"
}
}
},
- "v1.Source": {
+ "v1.LicenseUsageV1": {
"type": "object",
"properties": {
- "audit_plan_name": {
- "type": "string"
- },
- "sql_audit_record_ids": {
+ "instances_usage": {
"type": "array",
"items": {
- "type": "string"
+ "$ref": "#/definitions/v1.LicenseUsageItem"
}
},
- "type": {
- "type": "string",
- "enum": [
- "audit_plan",
- "sql_audit_record"
- ]
- }
- }
- },
- "v1.SqlAnalysis": {
- "type": "object",
- "properties": {
- "performance_statistics": {
- "type": "object",
- "$ref": "#/definitions/v1.PerformanceStatistics"
- },
- "sql_explain": {
- "type": "object",
- "$ref": "#/definitions/v1.SQLExplain"
- },
- "table_metas": {
+ "users_usage": {
"type": "object",
- "$ref": "#/definitions/v1.TableMetas"
+ "$ref": "#/definitions/v1.LicenseUsageItem"
}
}
},
- "v1.SqlAnalysisResDataV1": {
+ "v1.ListTableBySchemaResV1": {
"type": "object",
"properties": {
- "sql_explain": {
- "type": "object",
- "$ref": "#/definitions/v1.SQLExplain"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "table_metas": {
+ "data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.TableMeta"
+ "$ref": "#/definitions/v1.Table"
}
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.SqlAverageExecutionTime": {
+ "v1.MaintenanceTimeResV1": {
"type": "object",
"properties": {
- "average_execution_seconds": {
- "type": "integer"
- },
- "instance_name": {
- "type": "string"
- },
- "max_execution_seconds": {
- "type": "integer"
+ "maintenance_start_time": {
+ "type": "object",
+ "$ref": "#/definitions/v1.TimeResV1"
},
- "min_execution_seconds": {
- "type": "integer"
+ "maintenance_stop_time": {
+ "type": "object",
+ "$ref": "#/definitions/v1.TimeResV1"
}
}
},
- "v1.SqlExecutionFailPercent": {
+ "v1.OperationActionList": {
"type": "object",
"properties": {
- "instance_name": {
+ "desc": {
"type": "string"
},
- "percent": {
- "type": "number"
+ "operation_action": {
+ "type": "string"
+ },
+ "operation_type": {
+ "type": "string"
}
}
},
- "v1.SqlManage": {
+ "v1.OperationRecordList": {
"type": "object",
"properties": {
- "appear_num": {
+ "id": {
"type": "integer"
},
- "assignees": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "audit_result": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.AuditResult"
- }
- },
- "endpoint": {
+ "operation_action": {
"type": "string"
},
- "first_appear_time": {
+ "operation_content": {
"type": "string"
},
- "id": {
- "type": "integer"
- },
- "instance_name": {
+ "operation_time": {
"type": "string"
},
- "last_appear_time": {
+ "operation_type_name": {
"type": "string"
},
- "remark": {
- "type": "string"
+ "operation_user": {
+ "type": "object",
+ "$ref": "#/definitions/v1.OperationUser"
},
- "schema_name": {
+ "project_name": {
"type": "string"
},
- "source": {
- "type": "object",
- "$ref": "#/definitions/v1.Source"
+ "status": {
+ "type": "string",
+ "enum": [
+ "succeeded",
+ "failed"
+ ]
+ }
+ }
+ },
+ "v1.OperationResV1": {
+ "type": "object",
+ "properties": {
+ "op_code": {
+ "type": "integer"
},
- "sql": {
+ "op_desc": {
+ "type": "string"
+ }
+ }
+ },
+ "v1.OperationTypeNameList": {
+ "type": "object",
+ "properties": {
+ "desc": {
"type": "string"
},
- "sql_fingerprint": {
+ "operation_type_name": {
"type": "string"
- },
- "status": {
- "type": "string",
- "enum": [
- "unhandled",
- "solved",
- "ignored",
- "manual_audited"
- ]
}
}
},
- "v1.StatisticAuditPlanResV1": {
+ "v1.OperationUser": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.DBTypeAuditPlan"
- }
+ "ip": {
+ "type": "string"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "user_name": {
+ "type": "string"
}
}
},
- "v1.StatisticRiskWorkflowResV1": {
+ "v1.ParseProjectRuleTemplateFileResDataV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "db_type": {
+ "type": "string"
},
- "data": {
+ "desc": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "rule_list": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.RiskWorkflow"
+ "$ref": "#/definitions/v1.RuleResV1"
}
- },
- "message": {
- "type": "string",
- "example": "ok"
}
}
},
- "v1.StatisticsAuditedSQLResV1": {
+ "v1.ParseProjectRuleTemplateFileResV1": {
"type": "object",
"properties": {
"code": {
@@ -15381,424 +10297,421 @@
},
"data": {
"type": "object",
- "$ref": "#/definitions/v1.AuditedSQLCount"
+ "$ref": "#/definitions/v1.ParseProjectRuleTemplateFileResDataV1"
},
"message": {
"type": "string",
"example": "ok"
- },
- "risk_rate": {
- "type": "integer"
- }
- }
- },
- "v1.SyncInstanceResV1": {
- "type": "object",
- "properties": {
- "is_sync_instance_success": {
- "type": "boolean",
- "example": true
- },
- "sync_error_message": {
- "type": "string"
}
}
},
- "v1.SyncTaskTipsResV1": {
+ "v1.PartialSyncAuditPlanSQLsReqV1": {
"type": "object",
"properties": {
- "db_types": {
+ "audit_plan_sql_list": {
"type": "array",
"items": {
- "type": "string"
+ "$ref": "#/definitions/v1.AuditPlanSQLReqV1"
}
- },
- "source": {
- "type": "string",
- "example": "actiontech-dmp"
}
}
},
- "v1.SystemVariablesResV1": {
+ "v1.PerformanceStatistics": {
"type": "object",
"properties": {
- "operation_record_expired_hours": {
- "type": "integer"
- },
- "url": {
- "type": "string"
- },
- "workflow_expired_hours": {
- "type": "integer"
+ "affect_rows": {
+ "type": "object",
+ "$ref": "#/definitions/v1.AffectRows"
}
}
},
- "v1.Table": {
+ "v1.ProjectRuleTemplateResV1": {
"type": "object",
"properties": {
- "name": {
+ "db_type": {
+ "type": "string"
+ },
+ "desc": {
+ "type": "string"
+ },
+ "rule_template_name": {
"type": "string"
}
}
},
- "v1.TableColumns": {
+ "v1.ProjectScore": {
"type": "object",
"properties": {
- "head": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.TableMetaItemHeadResV1"
- }
- },
- "rows": {
- "type": "array",
- "items": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- }
+ "score": {
+ "type": "integer"
}
}
},
- "v1.TableIndexes": {
+ "v1.RejectWorkflowReqV1": {
"type": "object",
"properties": {
- "head": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.TableMetaItemHeadResV1"
- }
- },
- "rows": {
- "type": "array",
- "items": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- }
+ "reason": {
+ "type": "string"
}
}
},
- "v1.TableMeta": {
+ "v1.RiskAuditPlan": {
"type": "object",
"properties": {
- "columns": {
- "type": "object",
- "$ref": "#/definitions/v1.TableColumns"
- },
- "create_table_sql": {
+ "audit_plan_name": {
"type": "string"
},
- "indexes": {
- "type": "object",
- "$ref": "#/definitions/v1.TableIndexes"
+ "audit_plan_report_id": {
+ "type": "integer"
},
- "message": {
+ "audit_plan_report_timestamp": {
"type": "string"
},
- "name": {
- "type": "string"
+ "risk_sql_count": {
+ "type": "integer"
},
- "schema": {
+ "trigger_audit_plan_time": {
"type": "string"
}
}
},
- "v1.TableMetaItemHeadResV1": {
+ "v1.RiskWorkflow": {
"type": "object",
"properties": {
- "desc": {
+ "create_user_name": {
"type": "string"
},
- "field_name": {
+ "update_time": {
+ "type": "string"
+ },
+ "workflow_id": {
+ "type": "string"
+ },
+ "workflow_name": {
+ "type": "string"
+ },
+ "workflow_status": {
"type": "string"
}
}
},
- "v1.TableMetas": {
+ "v1.RoleUserCount": {
"type": "object",
"properties": {
- "err_message": {
- "type": "string"
+ "count": {
+ "type": "integer"
},
- "table_meta_items": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.TableMeta"
- }
+ "role": {
+ "type": "string"
}
}
},
- "v1.TestAuditPlanNotifyConfigResDataV1": {
+ "v1.RuleInfo": {
"type": "object",
"properties": {
- "is_notify_send_normal": {
- "type": "boolean"
+ "annotation": {
+ "type": "string",
+ "example": "this is test rule"
},
- "send_error_message": {
- "type": "string"
+ "desc": {
+ "type": "string",
+ "example": "this is test rule"
}
}
},
- "v1.TestAuditPlanNotifyConfigResV1": {
+ "v1.RuleKnowledgeResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "knowledge_content": {
+ "type": "string"
},
- "data": {
+ "rule": {
"type": "object",
- "$ref": "#/definitions/v1.TestAuditPlanNotifyConfigResDataV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
+ "$ref": "#/definitions/v1.RuleInfo"
}
}
},
- "v1.TestDingTalkConfigResDataV1": {
+ "v1.RuleParamReqV1": {
"type": "object",
"properties": {
- "is_ding_talk_send_normal": {
- "type": "boolean"
+ "key": {
+ "type": "string"
},
- "send_error_message": {
+ "value": {
"type": "string"
}
}
},
- "v1.TestDingTalkConfigResV1": {
+ "v1.RuleParamResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "desc": {
+ "type": "string"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.TestDingTalkConfigResDataV1"
+ "key": {
+ "type": "string"
},
- "message": {
+ "type": {
"type": "string",
- "example": "ok"
+ "enum": [
+ "string",
+ "int",
+ "bool"
+ ]
+ },
+ "value": {
+ "type": "string"
}
}
},
- "v1.TestFeishuConfigResDataV1": {
+ "v1.RuleProjectTemplateDetailResV1": {
"type": "object",
"properties": {
- "error_message": {
+ "db_type": {
"type": "string"
},
- "is_message_sent_normally": {
- "type": "boolean"
+ "desc": {
+ "type": "string"
+ },
+ "rule_list": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.RuleResV1"
+ }
+ },
+ "rule_template_name": {
+ "type": "string"
}
}
},
- "v1.TestFeishuConfigResV1": {
+ "v1.RuleReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "is_custom_rule": {
+ "type": "boolean"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.TestFeishuConfigResDataV1"
+ "level": {
+ "type": "string",
+ "example": "error"
},
- "message": {
+ "name": {
"type": "string",
- "example": "ok"
+ "example": "ddl_check_index_count"
+ },
+ "params": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.RuleParamReqV1"
+ }
}
}
},
- "v1.TestFeishuConfigurationReqV1": {
+ "v1.RuleResV1": {
"type": "object",
"properties": {
- "account": {
+ "annotation": {
+ "type": "string",
+ "example": "避免多次 table rebuild 带来的消耗、以及对线上业务的影响"
+ },
+ "db_type": {
+ "type": "string",
+ "example": "mysql"
+ },
+ "desc": {
"type": "string"
},
- "account_type": {
+ "is_custom_rule": {
+ "type": "boolean"
+ },
+ "level": {
"type": "string",
"enum": [
- "email",
- "phone"
- ]
- }
- }
- },
- "v1.TestSMTPConfigurationReqV1": {
- "type": "object",
- "properties": {
- "recipient_addr": {
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ],
+ "example": "error"
+ },
+ "params": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.RuleParamResV1"
+ }
+ },
+ "rule_name": {
"type": "string"
+ },
+ "type": {
+ "type": "string",
+ "example": "全局配置"
}
}
},
- "v1.TestSMTPConfigurationResDataV1": {
+ "v1.RuleRespV1": {
"type": "object",
"properties": {
- "is_smtp_send_normal": {
- "type": "boolean"
+ "desc": {
+ "type": "string"
},
- "send_error_message": {
+ "rule_name": {
"type": "string"
}
}
},
- "v1.TestSMTPConfigurationResV1": {
+ "v1.RuleTemplateDetailResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "db_type": {
+ "type": "string"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.TestSMTPConfigurationResDataV1"
+ "desc": {
+ "type": "string"
},
- "message": {
- "type": "string",
- "example": "ok"
- }
- }
- },
- "v1.TestWeChatConfigurationReqV1": {
- "type": "object",
- "properties": {
- "recipient_id": {
+ "rule_list": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.RuleResV1"
+ }
+ },
+ "rule_template_name": {
"type": "string"
}
}
},
- "v1.TestWeChatConfigurationResDataV1": {
+ "v1.RuleTemplateResV1": {
"type": "object",
"properties": {
- "is_wechat_send_normal": {
- "type": "boolean"
+ "db_type": {
+ "type": "string"
},
- "send_error_message": {
+ "desc": {
+ "type": "string"
+ },
+ "rule_template_name": {
"type": "string"
}
}
},
- "v1.TestWeChatConfigurationResV1": {
+ "v1.RuleTemplateTipResV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "db_type": {
+ "type": "string"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.TestWeChatConfigurationResDataV1"
+ "rule_template_id": {
+ "type": "string"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "rule_template_name": {
+ "type": "string"
}
}
},
- "v1.TestWorkflowWebHookConfigResDataV1": {
+ "v1.RuleTips": {
"type": "object",
"properties": {
- "send_error_message": {
+ "db_type": {
"type": "string"
+ },
+ "rule": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.RuleRespV1"
+ }
}
}
},
- "v1.TestWorkflowWebHookConfigResV1": {
+ "v1.RuleTypeV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "is_custom_rule_type": {
+ "type": "boolean"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.TestWorkflowWebHookConfigResDataV1"
+ "rule_count": {
+ "type": "integer"
},
- "message": {
- "type": "string",
- "example": "ok"
+ "rule_type": {
+ "type": "string"
}
}
},
- "v1.TimeReqV1": {
+ "v1.SQLAuditRecord": {
"type": "object",
"properties": {
- "hour": {
- "type": "integer"
+ "created_at": {
+ "type": "string"
},
- "minute": {
- "type": "integer"
+ "creator": {
+ "type": "string"
+ },
+ "instance": {
+ "type": "object",
+ "$ref": "#/definitions/v1.SQLAuditRecordInstance"
+ },
+ "sql_audit_record_id": {
+ "type": "string"
+ },
+ "sql_audit_status": {
+ "type": "string"
+ },
+ "tags": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "task": {
+ "type": "object",
+ "$ref": "#/definitions/v1.AuditTaskResV1"
}
}
},
- "v1.TimeResV1": {
+ "v1.SQLAuditRecordInstance": {
"type": "object",
"properties": {
- "hour": {
- "type": "integer"
+ "db_host": {
+ "type": "string",
+ "example": "10.10.10.10"
},
- "minute": {
- "type": "integer"
+ "db_port": {
+ "type": "string",
+ "example": "3306"
}
}
},
- "v1.TriggerAuditPlanResV1": {
+ "v1.SQLAuditRecordResData": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "sql_audit_record_id": {
+ "type": "string"
},
- "data": {
+ "task": {
"type": "object",
- "$ref": "#/definitions/v1.AuditPlanReportResV1"
- },
- "message": {
- "type": "string",
- "example": "ok"
+ "$ref": "#/definitions/v1.AuditTaskResV1"
}
}
},
- "v1.TriggerSyncInstanceResV1": {
+ "v1.SQLExplain": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
+ "classic_result": {
+ "description": "explain result in table format",
"type": "object",
- "$ref": "#/definitions/v1.SyncInstanceResV1"
+ "$ref": "#/definitions/v1.ExplainClassicResult"
},
"message": {
- "type": "string",
- "example": "ok"
+ "type": "string"
+ },
+ "sql": {
+ "type": "string"
}
}
},
- "v1.UpdateAuditPlanNotifyConfigReqV1": {
+ "v1.SQLQueryConfigResV1": {
"type": "object",
"properties": {
- "enable_email_notify": {
- "type": "boolean"
- },
- "enable_web_hook_notify": {
- "type": "boolean"
- },
- "notify_interval": {
- "type": "integer",
- "default": 10
- },
- "notify_level": {
+ "allow_query_when_less_than_audit_level": {
"type": "string",
- "default": "warn",
"enum": [
"normal",
"notice",
@@ -15806,715 +10719,731 @@
"error"
]
},
- "web_hook_template": {
- "type": "string"
+ "audit_enabled": {
+ "type": "boolean"
},
- "web_hook_url": {
- "type": "string"
+ "max_pre_query_rows": {
+ "type": "integer"
+ },
+ "query_timeout_second": {
+ "type": "integer"
}
}
},
- "v1.UpdateAuditPlanReqV1": {
+ "v1.Source": {
"type": "object",
"properties": {
- "audit_plan_cron": {
- "type": "string",
- "example": "0 */2 * * *"
- },
- "audit_plan_instance_database": {
- "type": "string",
- "example": "app1"
- },
- "audit_plan_instance_name": {
- "type": "string",
- "example": "test_mysql"
+ "audit_plan_name": {
+ "type": "string"
},
- "audit_plan_params": {
+ "sql_audit_record_ids": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.AuditPlanParamReqV1"
+ "type": "string"
}
},
- "rule_template_name": {
+ "type": {
"type": "string",
- "example": "default_MySQL"
+ "enum": [
+ "audit_plan",
+ "sql_audit_record"
+ ]
}
}
},
- "v1.UpdateAuditTaskSQLsReqV1": {
+ "v1.SqlAnalysis": {
"type": "object",
"properties": {
- "description": {
- "type": "string"
+ "performance_statistics": {
+ "type": "object",
+ "$ref": "#/definitions/v1.PerformanceStatistics"
+ },
+ "sql_explain": {
+ "type": "object",
+ "$ref": "#/definitions/v1.SQLExplain"
+ },
+ "table_metas": {
+ "type": "object",
+ "$ref": "#/definitions/v1.TableMetas"
}
}
},
- "v1.UpdateAuditWhitelistReqV1": {
+ "v1.SqlAnalysisResDataV1": {
"type": "object",
"properties": {
- "desc": {
- "type": "string",
- "example": "used for rapid release"
- },
- "match_type": {
- "type": "string",
- "enum": [
- "exact_match",
- "fp_match"
- ],
- "example": "exact_match"
+ "sql_explain": {
+ "type": "object",
+ "$ref": "#/definitions/v1.SQLExplain"
},
- "value": {
- "type": "string",
- "example": "create table"
+ "table_metas": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.TableMeta"
+ }
}
}
},
- "v1.UpdateCompanyNoticeReq": {
+ "v1.SqlAverageExecutionTime": {
"type": "object",
"properties": {
- "notice_str": {
+ "average_execution_seconds": {
+ "type": "integer"
+ },
+ "instance_name": {
"type": "string"
+ },
+ "max_execution_seconds": {
+ "type": "integer"
+ },
+ "min_execution_seconds": {
+ "type": "integer"
}
}
},
- "v1.UpdateCurrentUserPasswordReqV1": {
+ "v1.SqlExecutionFailPercent": {
"type": "object",
"properties": {
- "new_password": {
+ "instance_name": {
"type": "string"
},
- "password": {
- "type": "string"
+ "percent": {
+ "type": "number"
}
}
},
- "v1.UpdateCurrentUserReqV1": {
+ "v1.SqlManage": {
"type": "object",
"properties": {
- "email": {
+ "appear_num": {
+ "type": "integer"
+ },
+ "assignees": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "audit_result": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.AuditResult"
+ }
+ },
+ "endpoint": {
"type": "string"
},
- "phone": {
+ "first_appear_time": {
"type": "string"
},
- "wechat_id": {
- "type": "string",
- "example": "UserID"
- }
- }
- },
- "v1.UpdateCustomRuleReqV1": {
- "type": "object",
- "properties": {
- "annotation": {
- "type": "string",
- "example": "this is test rule"
+ "id": {
+ "type": "integer"
},
- "desc": {
- "type": "string",
- "example": "this is test rule"
+ "instance_name": {
+ "type": "string"
},
- "level": {
- "type": "string",
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ],
- "example": "notice"
+ "last_appear_time": {
+ "type": "string"
},
- "rule_script": {
+ "remark": {
"type": "string"
},
- "type": {
- "type": "string",
- "example": "DDL规则"
- }
- }
- },
- "v1.UpdateDingTalkConfigurationReqV1": {
- "type": "object",
- "required": [
- "app_key",
- "app_secret",
- "is_enable_ding_talk_notify"
- ],
- "properties": {
- "app_key": {
+ "schema_name": {
"type": "string"
},
- "app_secret": {
+ "source": {
+ "type": "object",
+ "$ref": "#/definitions/v1.Source"
+ },
+ "sql": {
"type": "string"
},
- "is_enable_ding_talk_notify": {
- "type": "boolean"
+ "sql_fingerprint": {
+ "type": "string"
+ },
+ "status": {
+ "type": "string",
+ "enum": [
+ "unhandled",
+ "solved",
+ "ignored",
+ "manual_audited"
+ ]
}
}
},
- "v1.UpdateFeishuConfigurationReqV1": {
+ "v1.StatisticAuditPlanResV1": {
"type": "object",
- "required": [
- "app_id",
- "app_secret",
- "is_feishu_notification_enabled"
- ],
"properties": {
- "app_id": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "app_secret": {
- "type": "string"
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.DBTypeAuditPlan"
+ }
},
- "is_feishu_notification_enabled": {
- "type": "boolean"
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.UpdateInstanceReqV1": {
+ "v1.StatisticRiskWorkflowResV1": {
"type": "object",
"properties": {
- "additional_params": {
+ "code": {
+ "type": "integer",
+ "example": 0
+ },
+ "data": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.InstanceAdditionalParamReqV1"
+ "$ref": "#/definitions/v1.RiskWorkflow"
}
},
- "db_host": {
- "type": "string",
- "example": "10.10.10.10"
- },
- "db_password": {
- "type": "string",
- "example": "123456"
- },
- "db_port": {
- "type": "string",
- "example": "3306"
- },
- "db_type": {
+ "message": {
"type": "string",
- "example": "mysql"
+ "example": "ok"
+ }
+ }
+ },
+ "v1.StatisticsAuditedSQLResV1": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "db_user": {
- "type": "string",
- "example": "root"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.AuditedSQLCount"
},
- "desc": {
+ "message": {
"type": "string",
- "example": "this is a test instance"
+ "example": "ok"
},
- "maintenance_times": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.MaintenanceTimeReqV1"
- }
+ "risk_rate": {
+ "type": "integer"
+ }
+ }
+ },
+ "v1.SystemVariablesResV1": {
+ "type": "object",
+ "properties": {
+ "operation_record_expired_hours": {
+ "type": "integer"
},
- "rule_template_name": {
+ "url": {
"type": "string"
},
- "sql_query_config": {
- "type": "object",
- "$ref": "#/definitions/v1.SQLQueryConfigReqV1"
+ "workflow_expired_hours": {
+ "type": "integer"
+ }
+ }
+ },
+ "v1.Table": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
}
}
},
- "v1.UpdateMemberGroupReqV1": {
+ "v1.TableColumns": {
"type": "object",
"properties": {
- "roles": {
+ "head": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.TableMetaItemHeadResV1"
+ }
+ },
+ "rows": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.BindRoleReqV1"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
},
- "v1.UpdateMemberReqV1": {
+ "v1.TableIndexes": {
"type": "object",
"properties": {
- "is_manager": {
- "type": "boolean"
+ "head": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.TableMetaItemHeadResV1"
+ }
},
- "roles": {
+ "rows": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.BindRoleReqV1"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
}
}
}
},
- "v1.UpdateOtherUserPasswordReqV1": {
+ "v1.TableMeta": {
"type": "object",
"properties": {
- "password": {
+ "columns": {
+ "type": "object",
+ "$ref": "#/definitions/v1.TableColumns"
+ },
+ "create_table_sql": {
+ "type": "string"
+ },
+ "indexes": {
+ "type": "object",
+ "$ref": "#/definitions/v1.TableIndexes"
+ },
+ "message": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "schema": {
"type": "string"
}
}
},
- "v1.UpdateProjectReqV1": {
+ "v1.TableMetaItemHeadResV1": {
"type": "object",
"properties": {
"desc": {
"type": "string"
+ },
+ "field_name": {
+ "type": "string"
}
}
},
- "v1.UpdateProjectRuleTemplateReqV1": {
+ "v1.TableMetas": {
"type": "object",
"properties": {
- "desc": {
+ "err_message": {
"type": "string"
},
- "instance_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "example": [
- "mysql-xxx"
- ]
- },
- "rule_list": {
+ "table_meta_items": {
"type": "array",
"items": {
- "$ref": "#/definitions/v1.RuleReqV1"
+ "$ref": "#/definitions/v1.TableMeta"
}
}
}
},
- "v1.UpdateRoleReqV1": {
+ "v1.TestAuditPlanNotifyConfigResDataV1": {
"type": "object",
"properties": {
- "is_disabled": {
+ "is_notify_send_normal": {
"type": "boolean"
},
- "operation_code_list": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- },
- "role_desc": {
+ "send_error_message": {
"type": "string"
}
}
},
- "v1.UpdateRuleKnowledgeReq": {
+ "v1.TestAuditPlanNotifyConfigResV1": {
"type": "object",
"properties": {
- "knowledge_content": {
- "type": "string"
+ "code": {
+ "type": "integer",
+ "example": 0
+ },
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.TestAuditPlanNotifyConfigResDataV1"
+ },
+ "message": {
+ "type": "string",
+ "example": "ok"
}
}
},
- "v1.UpdateRuleTemplateReqV1": {
+ "v1.TestDingTalkConfigResDataV1": {
"type": "object",
"properties": {
- "desc": {
- "type": "string"
+ "is_ding_talk_send_normal": {
+ "type": "boolean"
},
- "rule_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.RuleReqV1"
- }
+ "send_error_message": {
+ "type": "string"
}
}
},
- "v1.UpdateSMTPConfigurationReqV1": {
+ "v1.TestDingTalkConfigResV1": {
"type": "object",
"properties": {
- "enable_smtp_notify": {
- "type": "boolean"
- },
- "is_skip_verify": {
- "type": "boolean"
- },
- "smtp_host": {
- "type": "string",
- "example": "smtp.email.qq.com"
- },
- "smtp_password": {
- "type": "string",
- "example": "123"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "smtp_port": {
- "type": "string",
- "example": "465"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.TestDingTalkConfigResDataV1"
},
- "smtp_username": {
+ "message": {
"type": "string",
- "example": "test@qq.com"
+ "example": "ok"
}
}
},
- "v1.UpdateSQLAuditRecordReqV1": {
+ "v1.TestFeishuConfigResDataV1": {
"type": "object",
"properties": {
- "tags": {
- "type": "array",
- "items": {
- "type": "string"
- }
+ "error_message": {
+ "type": "string"
+ },
+ "is_message_sent_normally": {
+ "type": "boolean"
}
}
},
- "v1.UpdateSyncInstanceTaskReqV1": {
+ "v1.TestFeishuConfigResV1": {
"type": "object",
"properties": {
- "global_rule_template": {
- "type": "string",
- "example": "default_mysql"
- },
- "sync_instance_interval": {
- "type": "string",
- "example": "0 0 * * *"
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "url": {
- "type": "string",
- "example": "http://10.186.62.56:10000"
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.TestFeishuConfigResDataV1"
},
- "version": {
+ "message": {
"type": "string",
- "example": "5.23.01.0"
+ "example": "ok"
}
}
},
- "v1.UpdateSystemVariablesReqV1": {
+ "v1.TestFeishuConfigurationReqV1": {
"type": "object",
"properties": {
- "operation_record_expired_hours": {
- "type": "integer",
- "example": 2160
+ "account": {
+ "type": "string"
},
- "url": {
+ "account_type": {
"type": "string",
- "example": "http://10.186.61.32:8080"
- },
- "workflow_expired_hours": {
- "type": "integer",
- "example": 720
+ "enum": [
+ "email",
+ "phone"
+ ]
}
}
},
- "v1.UpdateUserReqV1": {
+ "v1.TimeResV1": {
"type": "object",
"properties": {
- "email": {
- "type": "string"
- },
- "is_disabled": {
- "type": "boolean"
- },
- "management_permission_code_list": {
- "type": "array",
- "items": {
- "type": "integer"
- }
+ "hour": {
+ "type": "integer"
},
- "phone": {
- "type": "string"
+ "minute": {
+ "type": "integer"
+ }
+ }
+ },
+ "v1.TriggerAuditPlanResV1": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer",
+ "example": 0
},
- "user_group_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- }
+ "data": {
+ "type": "object",
+ "$ref": "#/definitions/v1.AuditPlanReportResV1"
},
- "wechat_id": {
+ "message": {
"type": "string",
- "example": "UserID"
+ "example": "ok"
}
}
},
- "v1.UpdateWeChatConfigurationReqV1": {
+ "v1.UpdateAuditPlanNotifyConfigReqV1": {
"type": "object",
"properties": {
- "agent_id": {
- "type": "integer"
+ "enable_email_notify": {
+ "type": "boolean"
},
- "corp_id": {
- "type": "string"
+ "enable_web_hook_notify": {
+ "type": "boolean"
},
- "corp_secret": {
- "type": "string"
+ "notify_interval": {
+ "type": "integer",
+ "default": 10
},
- "enable_wechat_notify": {
- "type": "boolean"
+ "notify_level": {
+ "type": "string",
+ "default": "warn",
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ]
},
- "proxy_ip": {
+ "web_hook_template": {
"type": "string"
},
- "safe_enabled": {
- "type": "boolean"
+ "web_hook_url": {
+ "type": "string"
}
}
},
- "v1.UpdateWorkflowReqV1": {
+ "v1.UpdateAuditPlanReqV1": {
"type": "object",
"properties": {
- "task_ids": {
+ "audit_plan_cron": {
+ "type": "string",
+ "example": "0 */2 * * *"
+ },
+ "audit_plan_instance_database": {
+ "type": "string",
+ "example": "app1"
+ },
+ "audit_plan_instance_name": {
+ "type": "string",
+ "example": "test_mysql"
+ },
+ "audit_plan_params": {
"type": "array",
"items": {
- "type": "integer"
+ "$ref": "#/definitions/v1.AuditPlanParamReqV1"
}
+ },
+ "rule_template_name": {
+ "type": "string",
+ "example": "default_MySQL"
}
}
},
- "v1.UpdateWorkflowScheduleReqV1": {
+ "v1.UpdateAuditTaskSQLsReqV1": {
"type": "object",
"properties": {
- "schedule_time": {
+ "description": {
"type": "string"
}
}
},
- "v1.UpdateWorkflowTemplateReqV1": {
+ "v1.UpdateAuditWhitelistReqV1": {
"type": "object",
"properties": {
- "allow_submit_when_less_audit_level": {
- "type": "string",
- "enum": [
- "normal",
- "notice",
- "warn",
- "error"
- ]
- },
"desc": {
- "type": "string"
+ "type": "string",
+ "example": "used for rapid release"
},
- "instance_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- }
+ "match_type": {
+ "type": "string",
+ "enum": [
+ "exact_match",
+ "fp_match"
+ ],
+ "example": "exact_match"
},
- "workflow_step_template_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.WorkFlowStepTemplateReqV1"
- }
+ "value": {
+ "type": "string",
+ "example": "create table"
}
}
},
- "v1.UploadLogoResDataV1": {
+ "v1.UpdateCompanyNoticeReq": {
"type": "object",
"properties": {
- "logo_url": {
+ "notice_str": {
"type": "string"
}
}
},
- "v1.UploadLogoResV1": {
+ "v1.UpdateCustomRuleReqV1": {
"type": "object",
"properties": {
- "code": {
- "type": "integer",
- "example": 0
+ "annotation": {
+ "type": "string",
+ "example": "this is test rule"
},
- "data": {
- "type": "object",
- "$ref": "#/definitions/v1.UploadLogoResDataV1"
+ "desc": {
+ "type": "string",
+ "example": "this is test rule"
},
- "message": {
+ "level": {
"type": "string",
- "example": "ok"
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ],
+ "example": "notice"
+ },
+ "rule_script": {
+ "type": "string"
+ },
+ "type": {
+ "type": "string",
+ "example": "DDL规则"
}
}
},
- "v1.UserBindProjectResV1": {
+ "v1.UpdateDingTalkConfigurationReqV1": {
"type": "object",
+ "required": [
+ "app_key",
+ "app_secret",
+ "is_enable_ding_talk_notify"
+ ],
"properties": {
- "is_manager": {
- "type": "boolean"
+ "app_key": {
+ "type": "string"
},
- "project_name": {
+ "app_secret": {
"type": "string"
+ },
+ "is_enable_ding_talk_notify": {
+ "type": "boolean"
}
}
},
- "v1.UserDetailResV1": {
+ "v1.UpdateFeishuConfigurationReqV1": {
"type": "object",
+ "required": [
+ "app_id",
+ "app_secret",
+ "is_feishu_notification_enabled"
+ ],
"properties": {
- "bind_projects": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.UserBindProjectResV1"
- }
- },
- "email": {
+ "app_id": {
"type": "string"
},
- "is_admin": {
- "type": "boolean"
- },
- "is_disabled": {
- "type": "boolean"
- },
- "login_type": {
+ "app_secret": {
"type": "string"
},
- "management_permission_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.ManagementPermissionResV1"
- }
- },
- "phone": {
+ "is_feishu_notification_enabled": {
+ "type": "boolean"
+ }
+ }
+ },
+ "v1.UpdateProjectRuleTemplateReqV1": {
+ "type": "object",
+ "properties": {
+ "desc": {
"type": "string"
},
- "user_group_name_list": {
+ "rule_list": {
"type": "array",
"items": {
- "type": "string"
+ "$ref": "#/definitions/v1.RuleReqV1"
}
- },
- "user_name": {
- "type": "string"
- },
- "wechat_id": {
- "type": "string"
}
}
},
- "v1.UserGroupListItemResV1": {
+ "v1.UpdateRuleKnowledgeReq": {
"type": "object",
"properties": {
- "is_disabled": {
- "type": "boolean"
- },
- "user_group_desc": {
- "type": "string"
- },
- "user_group_name": {
+ "knowledge_content": {
"type": "string"
- },
- "user_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- }
}
}
},
- "v1.UserGroupTipListItem": {
+ "v1.UpdateRuleTemplateReqV1": {
"type": "object",
"properties": {
- "user_group_name": {
+ "desc": {
"type": "string"
},
- "user_names": {
+ "rule_list": {
"type": "array",
"items": {
- "type": "string"
+ "$ref": "#/definitions/v1.RuleReqV1"
}
}
}
},
- "v1.UserLoginReqV1": {
+ "v1.UpdateSQLAuditRecordReqV1": {
"type": "object",
"properties": {
- "password": {
- "type": "string",
- "example": "123456"
- },
- "username": {
- "type": "string",
- "example": "test"
+ "tags": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
}
}
},
- "v1.UserLoginResV1": {
+ "v1.UpdateSystemVariablesReqV1": {
"type": "object",
"properties": {
- "token": {
+ "operation_record_expired_hours": {
+ "type": "integer",
+ "example": 2160
+ },
+ "url": {
"type": "string",
- "example": "this is a jwt token string"
+ "example": "http://10.186.61.32:8080"
+ },
+ "workflow_expired_hours": {
+ "type": "integer",
+ "example": 720
}
}
},
- "v1.UserResV1": {
+ "v1.UpdateWorkflowReqV1": {
"type": "object",
"properties": {
- "email": {
- "type": "string"
- },
- "is_disabled": {
- "type": "boolean"
- },
- "login_type": {
- "type": "string"
- },
- "management_permission_list": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.ManagementPermissionResV1"
- }
- },
- "phone": {
- "type": "string"
- },
- "user_group_name_list": {
+ "task_ids": {
"type": "array",
"items": {
- "type": "string"
+ "type": "integer"
}
- },
- "user_name": {
- "type": "string"
- },
- "wechat_id": {
- "type": "string"
}
}
},
- "v1.UserTipResV1": {
+ "v1.UpdateWorkflowScheduleReqV1": {
"type": "object",
"properties": {
- "user_name": {
+ "schedule_time": {
"type": "string"
}
}
},
- "v1.WeChatConfigurationResV1": {
+ "v1.UpdateWorkflowTemplateReqV1": {
"type": "object",
"properties": {
- "agent_id": {
- "type": "integer"
- },
- "corp_id": {
- "type": "string"
- },
- "enable_wechat_notify": {
- "type": "boolean"
+ "allow_submit_when_less_audit_level": {
+ "type": "string",
+ "enum": [
+ "normal",
+ "notice",
+ "warn",
+ "error"
+ ]
},
- "proxy_ip": {
+ "desc": {
"type": "string"
},
- "safe_enabled": {
- "type": "boolean"
+ "workflow_step_template_list": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/v1.WorkFlowStepTemplateReqV1"
+ }
}
}
},
- "v1.WebHookConfigV1": {
+ "v1.UserTipResV1": {
"type": "object",
"properties": {
- "enable": {
- "type": "boolean"
- },
- "max_retry_times": {
- "type": "integer"
- },
- "retry_interval_seconds": {
- "type": "integer"
- },
- "token": {
+ "user_id": {
"type": "string"
},
- "url": {
+ "user_name": {
"type": "string"
}
}
@@ -16525,7 +11454,7 @@
"approved_by_authorized": {
"type": "boolean"
},
- "assignee_user_name_list": {
+ "assignee_user_id_list": {
"type": "array",
"items": {
"type": "string"
@@ -16552,7 +11481,7 @@
"approved_by_authorized": {
"type": "boolean"
},
- "assignee_user_name_list": {
+ "assignee_user_id_list": {
"type": "array",
"items": {
"type": "string"
@@ -16921,11 +11850,8 @@
"desc": {
"type": "string"
},
- "instance_name_list": {
- "type": "array",
- "items": {
- "type": "string"
- }
+ "update_time": {
+ "type": "string"
},
"workflow_step_template_list": {
"type": "array",
@@ -17150,6 +12076,9 @@
},
"rollback_sql": {
"type": "string"
+ },
+ "sql_source_file": {
+ "type": "string"
}
}
},
@@ -17175,58 +12104,6 @@
}
}
},
- "v2.CreateInstanceReqV2": {
- "type": "object",
- "properties": {
- "additional_params": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.InstanceAdditionalParamReqV1"
- }
- },
- "db_host": {
- "type": "string",
- "example": "10.10.10.10"
- },
- "db_password": {
- "type": "string",
- "example": "123456"
- },
- "db_port": {
- "type": "string",
- "example": "3306"
- },
- "db_type": {
- "type": "string",
- "example": "mysql"
- },
- "db_user": {
- "type": "string",
- "example": "root"
- },
- "desc": {
- "type": "string",
- "example": "this is a test instance"
- },
- "instance_name": {
- "type": "string",
- "example": "test"
- },
- "maintenance_times": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v1.MaintenanceTimeReqV1"
- }
- },
- "rule_template_name": {
- "type": "string"
- },
- "sql_query_config": {
- "type": "object",
- "$ref": "#/definitions/v1.SQLQueryConfigReqV1"
- }
- }
- },
"v2.CreateWorkflowReqV2": {
"type": "object",
"properties": {
@@ -17493,28 +12370,6 @@
}
}
},
- "v2.GetInstancesResV2": {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "example": 0
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/v2.InstanceResV2"
- }
- },
- "message": {
- "type": "string",
- "example": "ok"
- },
- "total_nums": {
- "type": "integer"
- }
- }
- },
"v2.GetSqlManageListResp": {
"type": "object",
"properties": {
diff --git a/sqle/docs/swagger.yaml b/sqle/docs/swagger.yaml
index 4c9f4f962b..8cee801762 100644
--- a/sqle/docs/swagger.yaml
+++ b/sqle/docs/swagger.yaml
@@ -401,41 +401,6 @@ definitions:
- manual_audited
type: string
type: object
- v1.BindOauth2UserReqV1:
- properties:
- oauth2_token:
- type: string
- pwd:
- type: string
- user_name:
- type: string
- type: object
- v1.BindOauth2UserResDataV1:
- properties:
- token:
- type: string
- type: object
- v1.BindOauth2UserResV1:
- properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v1.BindOauth2UserResDataV1'
- type: object
- message:
- example: ok
- type: string
- type: object
- v1.BindRoleReqV1:
- properties:
- instance_name:
- type: string
- role_names:
- items:
- type: string
- type: array
- type: object
v1.CheckLicenseResV1:
properties:
code:
@@ -455,10 +420,6 @@ definitions:
properties:
desc:
type: string
- instance_name_list:
- items:
- type: string
- type: array
new_rule_template_name:
type: string
type: object
@@ -561,80 +522,12 @@ definitions:
example: DDL规则
type: string
type: object
- v1.CreateInstanceReqV1:
- properties:
- additional_params:
- items:
- $ref: '#/definitions/v1.InstanceAdditionalParamReqV1'
- type: array
- db_host:
- example: 10.10.10.10
- type: string
- db_password:
- example: "123456"
- type: string
- db_port:
- example: "3306"
- type: string
- db_type:
- example: mysql
- type: string
- db_user:
- example: root
- type: string
- desc:
- example: this is a test instance
- type: string
- instance_name:
- example: test
- type: string
- maintenance_times:
- items:
- $ref: '#/definitions/v1.MaintenanceTimeReqV1'
- type: array
- rule_template_name:
- type: string
- sql_query_config:
- $ref: '#/definitions/v1.SQLQueryConfigReqV1'
- type: object
- type: object
- v1.CreateMemberGroupReqV1:
- properties:
- roles:
- items:
- $ref: '#/definitions/v1.BindRoleReqV1'
- type: array
- user_group_name:
- type: string
- type: object
- v1.CreateMemberReqV1:
- properties:
- is_manager:
- type: boolean
- roles:
- items:
- $ref: '#/definitions/v1.BindRoleReqV1'
- type: array
- user_name:
- type: string
- type: object
- v1.CreateProjectReqV1:
- properties:
- desc:
- type: string
- name:
- type: string
- type: object
v1.CreateProjectRuleTemplateReqV1:
properties:
db_type:
type: string
desc:
type: string
- instance_name_list:
- items:
- type: string
- type: array
rule_list:
items:
$ref: '#/definitions/v1.RuleReqV1'
@@ -642,17 +535,6 @@ definitions:
rule_template_name:
type: string
type: object
- v1.CreateRoleReqV1:
- properties:
- operation_code_list:
- items:
- type: integer
- type: array
- role_desc:
- type: string
- role_name:
- type: string
- type: object
v1.CreateRuleTemplateReqV1:
properties:
db_type:
@@ -678,73 +560,6 @@ definitions:
example: ok
type: string
type: object
- v1.CreateSyncInstanceTaskReqV1:
- properties:
- db_type:
- example: mysql
- type: string
- global_rule_template:
- example: default_mysql
- type: string
- source:
- example: actiontech-dmp
- type: string
- sync_instance_interval:
- example: 0 0 * * *
- type: string
- url:
- example: http://10.186.62.56:10000
- type: string
- version:
- example: 5.23.01.0
- type: string
- required:
- - db_type
- - global_rule_template
- - source
- - sync_instance_interval
- - url
- - version
- type: object
- v1.CreateUserGroupReqV1:
- properties:
- user_group_desc:
- example: this is a group
- type: string
- user_group_name:
- example: test
- type: string
- user_name_list:
- items:
- type: string
- type: array
- type: object
- v1.CreateUserReqV1:
- properties:
- email:
- example: test@email.com
- type: string
- management_permission_code_list:
- items:
- type: integer
- type: array
- phone:
- example: "18962136666"
- type: string
- user_group_name_list:
- items:
- type: string
- type: array
- user_name:
- example: test
- type: string
- user_password:
- example: "123456"
- type: string
- wechat_id:
- example: UserID
- type: string
- type: object
v1.CreateWorkflowReqV1:
properties:
desc:
@@ -805,14 +620,6 @@ definitions:
type: string
type: array
type: object
- v1.DashboardProjectTipV1:
- properties:
- project_name:
- type: string
- unfinished_workflow_count:
- description: 只统计与当前用户相关的未完成工单
- type: integer
- type: object
v1.DashboardResV1:
properties:
workflow_statistics:
@@ -1181,19 +988,6 @@ definitions:
example: ok
type: string
type: object
- v1.GetDashboardProjectTipsResV1:
- properties:
- code:
- example: 0
- type: integer
- data:
- items:
- $ref: '#/definitions/v1.DashboardProjectTipV1'
- type: array
- message:
- example: ok
- type: string
- type: object
v1.GetDashboardResV1:
properties:
code:
@@ -1242,53 +1036,6 @@ definitions:
example: ok
type: string
type: object
- v1.GetFeishuConfigurationResV1:
- properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v1.FeishuConfigurationV1'
- type: object
- message:
- example: ok
- type: string
- type: object
- v1.GetInstanceAdditionalMetasResV1:
- properties:
- code:
- example: 0
- type: integer
- data:
- items:
- $ref: '#/definitions/v1.InstanceAdditionalMetaV1'
- type: array
- message:
- example: ok
- type: string
- type: object
- v1.GetInstanceConnectableReqV1:
- properties:
- additional_params:
- items:
- $ref: '#/definitions/v1.InstanceAdditionalParamReqV1'
- type: array
- db_type:
- example: mysql
- type: string
- host:
- example: 10.10.10.10
- type: string
- password:
- example: "123456"
- type: string
- port:
- example: "3306"
- type: string
- user:
- example: root
- type: string
- type: object
v1.GetInstanceConnectableResV1:
properties:
code:
@@ -1314,18 +1061,6 @@ definitions:
example: ok
type: string
type: object
- v1.GetInstanceResV1:
- properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v1.InstanceResV1'
- type: object
- message:
- example: ok
- type: string
- type: object
v1.GetInstanceSchemaResV1:
properties:
code:
@@ -1351,21 +1086,6 @@ definitions:
example: ok
type: string
type: object
- v1.GetInstancesResV1:
- properties:
- code:
- example: 0
- type: integer
- data:
- items:
- $ref: '#/definitions/v1.InstanceResV1'
- type: array
- message:
- example: ok
- type: string
- total_nums:
- type: integer
- type: object
v1.GetInstancesTypePercentResV1:
properties:
code:
@@ -1378,18 +1098,6 @@ definitions:
example: ok
type: string
type: object
- v1.GetLDAPConfigurationResV1:
- properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v1.LDAPConfigurationResV1'
- type: object
- message:
- example: ok
- type: string
- type: object
v1.GetLicenseResV1:
properties:
code:
@@ -1417,240 +1125,197 @@ definitions:
example: ok
type: string
type: object
- v1.GetManagementPermissionsResV1:
+ v1.GetOperationActionListResV1:
properties:
code:
example: 0
type: integer
data:
items:
- $ref: '#/definitions/v1.ManagementPermissionResV1'
+ $ref: '#/definitions/v1.OperationActionList'
type: array
message:
example: ok
type: string
type: object
- v1.GetMemberGroupRespDataV1:
- properties:
- roles:
- items:
- $ref: '#/definitions/v1.BindRoleReqV1'
- type: array
- user_group_name:
- type: string
- users:
- items:
- $ref: '#/definitions/v1.MemberGroupUserItem'
- type: array
- type: object
- v1.GetMemberGroupRespV1:
+ v1.GetOperationRecordListResV1:
properties:
code:
example: 0
type: integer
data:
- $ref: '#/definitions/v1.GetMemberGroupRespDataV1'
- type: object
+ items:
+ $ref: '#/definitions/v1.OperationRecordList'
+ type: array
message:
example: ok
type: string
+ total_nums:
+ type: integer
type: object
- v1.GetMemberGroupsRespV1:
+ v1.GetOperationTypeNamesListResV1:
properties:
code:
example: 0
type: integer
data:
items:
- $ref: '#/definitions/v1.GetMemberGroupRespDataV1'
+ $ref: '#/definitions/v1.OperationTypeNameList'
type: array
message:
example: ok
type: string
- total_nums:
- type: integer
type: object
- v1.GetMemberRespDataV1:
+ v1.GetOperationsResV1:
properties:
- is_manager:
- type: boolean
- roles:
+ code:
+ example: 0
+ type: integer
+ data:
items:
- $ref: '#/definitions/v1.BindRoleReqV1'
+ $ref: '#/definitions/v1.OperationResV1'
type: array
- user_name:
+ message:
+ example: ok
type: string
type: object
- v1.GetMemberRespV1:
+ v1.GetProjectRuleTemplateResV1:
properties:
code:
example: 0
type: integer
data:
- $ref: '#/definitions/v1.GetMemberRespDataV1'
+ $ref: '#/definitions/v1.RuleProjectTemplateDetailResV1'
type: object
message:
example: ok
type: string
type: object
- v1.GetMemberTipsResV1:
+ v1.GetProjectRuleTemplatesResV1:
properties:
code:
example: 0
type: integer
data:
items:
- $ref: '#/definitions/v1.MemberTipResV1'
+ $ref: '#/definitions/v1.ProjectRuleTemplateResV1'
type: array
message:
example: ok
type: string
+ total_nums:
+ type: integer
type: object
- v1.GetMembersRespV1:
+ v1.GetProjectScoreResV1:
properties:
code:
example: 0
type: integer
data:
- items:
- $ref: '#/definitions/v1.GetMemberRespDataV1'
- type: array
+ $ref: '#/definitions/v1.ProjectScore'
+ type: object
message:
example: ok
type: string
- total_nums:
- type: integer
type: object
- v1.GetOauth2ConfigurationResDataV1:
+ v1.GetProjectStatisticsResDataV1:
properties:
- access_token_tag:
- type: string
- client_host:
- type: string
- client_id:
- type: string
- enable_oauth2:
- type: boolean
- login_tip:
- type: string
- scopes:
- items:
- type: string
- type: array
- server_auth_url:
- type: string
- server_token_url:
- type: string
- server_user_id_url:
- type: string
- user_id_tag:
- type: string
- type: object
- v1.GetOauth2ConfigurationResV1:
- properties:
- code:
- example: 0
+ audit_plan_total:
+ type: integer
+ instance_total:
+ type: integer
+ member_total:
+ type: integer
+ rule_template_total:
+ type: integer
+ whitelist_total:
+ type: integer
+ workflow_total:
type: integer
- data:
- $ref: '#/definitions/v1.GetOauth2ConfigurationResDataV1'
- type: object
- message:
- example: ok
- type: string
- type: object
- v1.GetOauth2TipsResDataV1:
- properties:
- enable_oauth2:
- type: boolean
- login_tip:
- type: string
type: object
- v1.GetOauth2TipsResV1:
+ v1.GetProjectStatisticsResV1:
properties:
code:
example: 0
type: integer
data:
- $ref: '#/definitions/v1.GetOauth2TipsResDataV1'
+ $ref: '#/definitions/v1.GetProjectStatisticsResDataV1'
type: object
message:
example: ok
type: string
type: object
- v1.GetOperationActionListResV1:
+ v1.GetRiskAuditPlanResV1:
properties:
code:
example: 0
type: integer
data:
items:
- $ref: '#/definitions/v1.OperationActionList'
+ $ref: '#/definitions/v1.RiskAuditPlan'
type: array
message:
example: ok
type: string
type: object
- v1.GetOperationRecordListResV1:
+ v1.GetRoleUserCountResV1:
properties:
code:
example: 0
type: integer
data:
items:
- $ref: '#/definitions/v1.OperationRecordList'
+ $ref: '#/definitions/v1.RoleUserCount'
type: array
message:
example: ok
type: string
- total_nums:
- type: integer
type: object
- v1.GetOperationTypeNamesListResV1:
+ v1.GetRuleKnowledgeResV1:
properties:
code:
example: 0
type: integer
data:
- items:
- $ref: '#/definitions/v1.OperationTypeNameList'
- type: array
+ $ref: '#/definitions/v1.RuleKnowledgeResV1'
+ type: object
message:
example: ok
type: string
type: object
- v1.GetOperationsResV1:
+ v1.GetRuleTemplateResV1:
properties:
code:
example: 0
type: integer
data:
- items:
- $ref: '#/definitions/v1.OperationResV1'
- type: array
+ $ref: '#/definitions/v1.RuleTemplateDetailResV1'
+ type: object
message:
example: ok
type: string
type: object
- v1.GetProjectDetailResV1:
+ v1.GetRuleTemplateTipsResV1:
properties:
code:
example: 0
type: integer
data:
- $ref: '#/definitions/v1.ProjectDetailItem'
- type: object
+ items:
+ $ref: '#/definitions/v1.RuleTemplateTipResV1'
+ type: array
message:
example: ok
type: string
type: object
- v1.GetProjectResV1:
+ v1.GetRuleTemplatesResV1:
properties:
code:
example: 0
type: integer
data:
items:
- $ref: '#/definitions/v1.ProjectListItem'
+ $ref: '#/definitions/v1.RuleTemplateResV1'
type: array
message:
example: ok
@@ -1658,2644 +1323,2296 @@ definitions:
total_nums:
type: integer
type: object
- v1.GetProjectRuleTemplateResV1:
+ v1.GetRuleTypeByDBTypeResV1:
properties:
code:
example: 0
type: integer
data:
- $ref: '#/definitions/v1.RuleProjectTemplateDetailResV1'
- type: object
+ items:
+ $ref: '#/definitions/v1.RuleTypeV1'
+ type: array
message:
example: ok
type: string
type: object
- v1.GetProjectRuleTemplatesResV1:
+ v1.GetRulesResV1:
properties:
code:
example: 0
type: integer
data:
items:
- $ref: '#/definitions/v1.ProjectRuleTemplateResV1'
+ $ref: '#/definitions/v1.RuleResV1'
type: array
message:
example: ok
type: string
- total_nums:
- type: integer
type: object
- v1.GetProjectScoreResV1:
+ v1.GetSQLAnalysisDataResItemV1:
+ properties:
+ sql_explain:
+ $ref: '#/definitions/v1.SQLExplain'
+ type: object
+ table_metas:
+ items:
+ $ref: '#/definitions/v1.TableMeta'
+ type: array
+ type: object
+ v1.GetSQLAuditRecordResV1:
properties:
code:
example: 0
type: integer
data:
- $ref: '#/definitions/v1.ProjectScore'
+ $ref: '#/definitions/v1.SQLAuditRecord'
type: object
message:
example: ok
type: string
type: object
- v1.GetProjectStatisticsResDataV1:
- properties:
- audit_plan_total:
- type: integer
- instance_total:
- type: integer
- member_total:
- type: integer
- rule_template_total:
- type: integer
- whitelist_total:
- type: integer
- workflow_total:
- type: integer
- type: object
- v1.GetProjectStatisticsResV1:
+ v1.GetSQLAuditRecordTagTipsResV1:
properties:
code:
example: 0
type: integer
data:
- $ref: '#/definitions/v1.GetProjectStatisticsResDataV1'
- type: object
+ items:
+ type: string
+ type: array
message:
example: ok
type: string
type: object
- v1.GetProjectTipsResV1:
+ v1.GetSQLAuditRecordsResV1:
properties:
code:
example: 0
type: integer
data:
items:
- $ref: '#/definitions/v1.ProjectTipResV1'
+ $ref: '#/definitions/v1.SQLAuditRecord'
type: array
message:
example: ok
type: string
+ total_nums:
+ type: integer
type: object
- v1.GetRiskAuditPlanResV1:
+ v1.GetSqlAverageExecutionTimeResV1:
properties:
code:
example: 0
type: integer
data:
items:
- $ref: '#/definitions/v1.RiskAuditPlan'
+ $ref: '#/definitions/v1.SqlAverageExecutionTime'
type: array
message:
example: ok
type: string
type: object
- v1.GetRoleTipsResV1:
+ v1.GetSqlExecutionFailPercentResV1:
properties:
code:
example: 0
type: integer
data:
items:
- $ref: '#/definitions/v1.RoleTipResV1'
+ $ref: '#/definitions/v1.SqlExecutionFailPercent'
type: array
message:
example: ok
type: string
type: object
- v1.GetRoleUserCountResV1:
+ v1.GetSqlManageListResp:
properties:
code:
example: 0
type: integer
data:
items:
- $ref: '#/definitions/v1.RoleUserCount'
+ $ref: '#/definitions/v1.SqlManage'
type: array
message:
example: ok
type: string
+ sql_manage_bad_num:
+ type: integer
+ sql_manage_optimized_num:
+ type: integer
+ sql_manage_total_num:
+ type: integer
type: object
- v1.GetRolesResV1:
+ v1.GetSqlManageRuleTipsResp:
properties:
code:
example: 0
type: integer
data:
items:
- $ref: '#/definitions/v1.RoleResV1'
+ $ref: '#/definitions/v1.RuleTips'
type: array
message:
example: ok
type: string
- total_nums:
- type: integer
type: object
- v1.GetRuleKnowledgeResV1:
+ v1.GetSqlManageSqlAnalysisResp:
properties:
code:
example: 0
type: integer
data:
- $ref: '#/definitions/v1.RuleKnowledgeResV1'
+ $ref: '#/definitions/v1.SqlAnalysis'
+ description: V1版本不能引用V2版本的结构体,所以只能复制一份
type: object
message:
example: ok
type: string
type: object
- v1.GetRuleTemplateResV1:
+ v1.GetSystemVariablesResV1:
properties:
code:
example: 0
type: integer
data:
- $ref: '#/definitions/v1.RuleTemplateDetailResV1'
+ $ref: '#/definitions/v1.SystemVariablesResV1'
type: object
message:
example: ok
type: string
type: object
- v1.GetRuleTemplateTipsResV1:
+ v1.GetTableMetadataResV1:
properties:
code:
example: 0
type: integer
data:
- items:
- $ref: '#/definitions/v1.RuleTemplateTipResV1'
- type: array
+ $ref: '#/definitions/v1.InstanceTableMeta'
+ type: object
message:
example: ok
type: string
type: object
- v1.GetRuleTemplatesResV1:
+ v1.GetTaskAnalysisDataResItemV1:
+ properties:
+ sql_explain:
+ $ref: '#/definitions/v1.SQLExplain'
+ type: object
+ table_metas:
+ items:
+ $ref: '#/definitions/v1.TableMeta'
+ type: array
+ type: object
+ v1.GetTaskAnalysisDataResV1:
properties:
code:
example: 0
type: integer
data:
- items:
- $ref: '#/definitions/v1.RuleTemplateResV1'
- type: array
+ $ref: '#/definitions/v1.GetTaskAnalysisDataResItemV1'
+ type: object
message:
example: ok
type: string
- total_nums:
- type: integer
type: object
- v1.GetRuleTypeByDBTypeResV1:
+ v1.GetUserTipsResV1:
properties:
code:
example: 0
type: integer
data:
items:
- $ref: '#/definitions/v1.RuleTypeV1'
+ $ref: '#/definitions/v1.UserTipResV1'
type: array
message:
example: ok
type: string
type: object
- v1.GetRulesResV1:
+ v1.GetWorkflowAuditPassPercentResV1:
properties:
code:
example: 0
type: integer
data:
- items:
- $ref: '#/definitions/v1.RuleResV1'
- type: array
+ $ref: '#/definitions/v1.WorkflowAuditPassPercentV1'
+ type: object
message:
example: ok
type: string
type: object
- v1.GetSMTPConfigurationResV1:
+ v1.GetWorkflowCountsResV1:
properties:
code:
example: 0
type: integer
data:
- $ref: '#/definitions/v1.SMTPConfigurationResV1'
+ $ref: '#/definitions/v1.WorkflowCountsV1'
type: object
message:
example: ok
type: string
type: object
- v1.GetSQLAnalysisDataResItemV1:
- properties:
- sql_explain:
- $ref: '#/definitions/v1.SQLExplain'
- type: object
- table_metas:
- items:
- $ref: '#/definitions/v1.TableMeta'
- type: array
- type: object
- v1.GetSQLAuditRecordResV1:
+ v1.GetWorkflowCreatedCountsEachDayResV1:
properties:
code:
example: 0
type: integer
data:
- $ref: '#/definitions/v1.SQLAuditRecord'
+ $ref: '#/definitions/v1.WorkflowCreatedCountsEachDayV1'
type: object
message:
example: ok
type: string
type: object
- v1.GetSQLAuditRecordTagTipsResV1:
+ v1.GetWorkflowDurationOfWaitingForAuditResV1:
properties:
code:
example: 0
type: integer
data:
- items:
- type: string
- type: array
+ $ref: '#/definitions/v1.WorkflowStageDuration'
+ type: object
message:
example: ok
type: string
type: object
- v1.GetSQLAuditRecordsResV1:
+ v1.GetWorkflowDurationOfWaitingForExecutionResV1:
properties:
code:
example: 0
type: integer
data:
- items:
- $ref: '#/definitions/v1.SQLAuditRecord'
- type: array
+ $ref: '#/definitions/v1.WorkflowStageDuration'
+ type: object
message:
example: ok
type: string
- total_nums:
- type: integer
- type: object
- v1.GetSQLEInfoResDataV1:
- properties:
- logo_url:
- type: string
- title:
- type: string
- version:
- type: string
type: object
- v1.GetSQLEInfoResV1:
+ v1.GetWorkflowPassPercentResV1:
properties:
code:
example: 0
type: integer
data:
- $ref: '#/definitions/v1.GetSQLEInfoResDataV1'
+ $ref: '#/definitions/v1.WorkflowPassPercentV1'
type: object
message:
example: ok
type: string
type: object
- v1.GetSQLQueryConfigurationResDataV1:
- properties:
- enable_sql_query:
- type: boolean
- sql_query_root_uri:
- type: string
- type: object
- v1.GetSQLQueryConfigurationResV1:
+ v1.GetWorkflowPercentCountedByInstanceTypeResV1:
properties:
code:
example: 0
type: integer
data:
- $ref: '#/definitions/v1.GetSQLQueryConfigurationResDataV1'
+ $ref: '#/definitions/v1.WorkflowPercentCountedByInstanceTypeV1'
type: object
message:
example: ok
type: string
type: object
- v1.GetSqlAverageExecutionTimeResV1:
+ v1.GetWorkflowRejectedPercentGroupByCreatorResV1:
properties:
code:
example: 0
type: integer
data:
items:
- $ref: '#/definitions/v1.SqlAverageExecutionTime'
+ $ref: '#/definitions/v1.WorkflowRejectedPercentGroupByCreator'
type: array
message:
example: ok
type: string
type: object
- v1.GetSqlExecutionFailPercentResV1:
+ v1.GetWorkflowRejectedPercentGroupByInstanceResV1:
properties:
code:
example: 0
type: integer
data:
items:
- $ref: '#/definitions/v1.SqlExecutionFailPercent'
+ $ref: '#/definitions/v1.WorkflowRejectedPercentGroupByInstance'
type: array
message:
example: ok
type: string
type: object
- v1.GetSqlManageListResp:
+ v1.GetWorkflowResV1:
properties:
code:
example: 0
type: integer
data:
- items:
- $ref: '#/definitions/v1.SqlManage'
- type: array
+ $ref: '#/definitions/v1.WorkflowResV1'
+ type: object
message:
example: ok
type: string
- sql_manage_bad_num:
- type: integer
- sql_manage_optimized_num:
- type: integer
- sql_manage_total_num:
- type: integer
type: object
- v1.GetSqlManageRuleTipsResp:
+ v1.GetWorkflowStatusCountResV1:
properties:
code:
example: 0
type: integer
data:
- items:
- $ref: '#/definitions/v1.RuleTips'
- type: array
- message:
+ $ref: '#/definitions/v1.WorkflowStatusCountV1'
+ type: object
+ message:
example: ok
type: string
type: object
- v1.GetSqlManageSqlAnalysisResp:
+ v1.GetWorkflowTasksItemV1:
properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v1.SqlAnalysis'
- type: object
- message:
- example: ok
+ current_step_assignee_user_name_list:
+ items:
+ type: string
+ type: array
+ exec_end_time:
+ type: string
+ exec_start_time:
+ type: string
+ execution_user_name:
+ type: string
+ instance_maintenance_times:
+ items:
+ $ref: '#/definitions/v1.MaintenanceTimeResV1'
+ type: array
+ instance_name:
+ type: string
+ schedule_time:
+ type: string
+ status:
+ enum:
+ - wait_for_audit
+ - wait_for_execution
+ - exec_scheduled
+ - exec_failed
+ - exec_succeeded
+ - executing
+ - manually_executed
type: string
+ task_id:
+ type: integer
+ task_pass_rate:
+ type: number
+ task_score:
+ type: integer
type: object
- v1.GetSyncInstanceTaskListResV1:
+ v1.GetWorkflowTasksResV1:
properties:
code:
example: 0
type: integer
data:
items:
- $ref: '#/definitions/v1.InstanceTaskResV1'
+ $ref: '#/definitions/v1.GetWorkflowTasksItemV1'
type: array
message:
example: ok
type: string
type: object
- v1.GetSyncInstanceTaskResV1:
+ v1.GetWorkflowTemplateResV1:
properties:
code:
example: 0
type: integer
data:
- $ref: '#/definitions/v1.InstanceTaskDetailResV1'
+ $ref: '#/definitions/v1.WorkflowTemplateDetailResV1'
type: object
message:
example: ok
type: string
type: object
- v1.GetSyncTaskSourceTipsResV1:
+ v1.GetWorkflowsResV1:
properties:
code:
example: 0
type: integer
data:
items:
- $ref: '#/definitions/v1.SyncTaskTipsResV1'
+ $ref: '#/definitions/v1.WorkflowDetailResV1'
type: array
message:
example: ok
type: string
+ total_nums:
+ type: integer
type: object
- v1.GetSystemVariablesResV1:
+ v1.InstanceAdditionalParamResV1:
properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v1.SystemVariablesResV1'
- type: object
- message:
- example: ok
+ description:
+ example: 参数项中文名
+ type: string
+ name:
+ example: param name
+ type: string
+ type:
+ example: int
+ type: string
+ value:
+ example: "0"
type: string
type: object
- v1.GetTableMetadataResV1:
+ v1.InstanceConnectableResV1:
properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v1.InstanceTableMeta'
- type: object
- message:
- example: ok
+ connect_error_message:
type: string
+ is_instance_connectable:
+ type: boolean
type: object
- v1.GetTaskAnalysisDataResItemV1:
+ v1.InstanceConnectionResV1:
properties:
- sql_explain:
- $ref: '#/definitions/v1.SQLExplain'
- type: object
- table_metas:
- items:
- $ref: '#/definitions/v1.TableMeta'
- type: array
+ connect_error_message:
+ type: string
+ instance_name:
+ type: string
+ is_instance_connectable:
+ type: boolean
type: object
- v1.GetTaskAnalysisDataResV1:
+ v1.InstanceForCheckConnection:
properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v1.GetTaskAnalysisDataResItemV1'
- type: object
- message:
- example: ok
+ name:
type: string
type: object
- v1.GetUserDetailResV1:
+ v1.InstanceForCreatingTask:
properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v1.UserDetailResV1'
- type: object
- message:
- example: ok
+ instance_name:
+ type: string
+ instance_schema:
type: string
type: object
- v1.GetUserGroupTipsResV1:
+ v1.InstanceSchemaResV1:
properties:
- code:
- example: 0
- type: integer
- data:
+ schema_name_list:
items:
- $ref: '#/definitions/v1.UserGroupTipListItem'
+ type: string
type: array
- message:
- example: ok
+ type: object
+ v1.InstanceTableMeta:
+ properties:
+ columns:
+ $ref: '#/definitions/v1.TableColumns'
+ type: object
+ create_table_sql:
+ type: string
+ indexes:
+ $ref: '#/definitions/v1.TableIndexes'
+ type: object
+ name:
+ type: string
+ schema:
type: string
type: object
- v1.GetUserGroupsResV1:
+ v1.InstanceTipResV1:
properties:
- code:
- example: 0
- type: integer
- data:
- items:
- $ref: '#/definitions/v1.UserGroupListItemResV1'
- type: array
- message:
- example: ok
+ host:
type: string
- total_nums:
+ instance_id:
+ type: string
+ instance_name:
+ type: string
+ instance_type:
+ type: string
+ port:
+ type: string
+ workflow_template_id:
type: integer
type: object
- v1.GetUserLoginResV1:
+ v1.InstanceTypePercent:
properties:
- code:
- example: 0
+ count:
type: integer
- data:
- $ref: '#/definitions/v1.UserLoginResV1'
- type: object
- message:
- example: ok
+ percent:
+ type: number
+ type:
type: string
type: object
- v1.GetUserTipsResV1:
+ v1.InstancesTypePercentV1:
properties:
- code:
- example: 0
+ instance_total_num:
type: integer
- data:
+ instance_type_percents:
items:
- $ref: '#/definitions/v1.UserTipResV1'
+ $ref: '#/definitions/v1.InstanceTypePercent'
type: array
- message:
- example: ok
+ type: object
+ v1.LicenseItem:
+ properties:
+ description:
+ type: string
+ limit:
+ type: string
+ name:
type: string
type: object
- v1.GetUsersResV1:
+ v1.LicenseUsageItem:
properties:
- code:
- example: 0
+ is_limited:
+ type: boolean
+ limit:
type: integer
- data:
- items:
- $ref: '#/definitions/v1.UserResV1'
- type: array
- message:
- example: ok
+ resource_type:
type: string
- total_nums:
+ resource_type_desc:
+ type: string
+ used:
type: integer
type: object
- v1.GetWeChatConfigurationResV1:
+ v1.LicenseUsageV1:
properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v1.WeChatConfigurationResV1'
+ instances_usage:
+ items:
+ $ref: '#/definitions/v1.LicenseUsageItem'
+ type: array
+ users_usage:
+ $ref: '#/definitions/v1.LicenseUsageItem'
type: object
- message:
- example: ok
- type: string
type: object
- v1.GetWorkflowAuditPassPercentResV1:
+ v1.ListTableBySchemaResV1:
properties:
code:
example: 0
type: integer
data:
- $ref: '#/definitions/v1.WorkflowAuditPassPercentV1'
- type: object
+ items:
+ $ref: '#/definitions/v1.Table'
+ type: array
message:
example: ok
type: string
type: object
- v1.GetWorkflowCountsResV1:
+ v1.MaintenanceTimeResV1:
properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v1.WorkflowCountsV1'
+ maintenance_start_time:
+ $ref: '#/definitions/v1.TimeResV1'
+ type: object
+ maintenance_stop_time:
+ $ref: '#/definitions/v1.TimeResV1'
type: object
- message:
- example: ok
- type: string
type: object
- v1.GetWorkflowCreatedCountsEachDayResV1:
+ v1.OperationActionList:
properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v1.WorkflowCreatedCountsEachDayV1'
- type: object
- message:
- example: ok
+ desc:
type: string
- type: object
- v1.GetWorkflowDurationOfWaitingForAuditResV1:
- properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v1.WorkflowStageDuration'
- type: object
- message:
- example: ok
+ operation_action:
+ type: string
+ operation_type:
type: string
type: object
- v1.GetWorkflowDurationOfWaitingForExecutionResV1:
+ v1.OperationRecordList:
properties:
- code:
- example: 0
+ id:
type: integer
- data:
- $ref: '#/definitions/v1.WorkflowStageDuration'
+ operation_action:
+ type: string
+ operation_content:
+ type: string
+ operation_time:
+ type: string
+ operation_type_name:
+ type: string
+ operation_user:
+ $ref: '#/definitions/v1.OperationUser'
type: object
- message:
- example: ok
+ project_name:
+ type: string
+ status:
+ enum:
+ - succeeded
+ - failed
type: string
type: object
- v1.GetWorkflowPassPercentResV1:
+ v1.OperationResV1:
properties:
- code:
- example: 0
+ op_code:
type: integer
- data:
- $ref: '#/definitions/v1.WorkflowPassPercentV1'
- type: object
- message:
- example: ok
+ op_desc:
type: string
type: object
- v1.GetWorkflowPercentCountedByInstanceTypeResV1:
+ v1.OperationTypeNameList:
properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v1.WorkflowPercentCountedByInstanceTypeV1'
- type: object
- message:
- example: ok
+ desc:
+ type: string
+ operation_type_name:
type: string
type: object
- v1.GetWorkflowRejectedPercentGroupByCreatorResV1:
+ v1.OperationUser:
properties:
- code:
- example: 0
- type: integer
- data:
- items:
- $ref: '#/definitions/v1.WorkflowRejectedPercentGroupByCreator'
- type: array
- message:
- example: ok
+ ip:
+ type: string
+ user_name:
type: string
type: object
- v1.GetWorkflowRejectedPercentGroupByInstanceResV1:
+ v1.ParseProjectRuleTemplateFileResDataV1:
properties:
- code:
- example: 0
- type: integer
- data:
+ db_type:
+ type: string
+ desc:
+ type: string
+ name:
+ type: string
+ rule_list:
items:
- $ref: '#/definitions/v1.WorkflowRejectedPercentGroupByInstance'
+ $ref: '#/definitions/v1.RuleResV1'
type: array
- message:
- example: ok
- type: string
type: object
- v1.GetWorkflowResV1:
+ v1.ParseProjectRuleTemplateFileResV1:
properties:
code:
example: 0
type: integer
data:
- $ref: '#/definitions/v1.WorkflowResV1'
+ $ref: '#/definitions/v1.ParseProjectRuleTemplateFileResDataV1'
type: object
message:
example: ok
type: string
type: object
- v1.GetWorkflowStatusCountResV1:
+ v1.PartialSyncAuditPlanSQLsReqV1:
properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v1.WorkflowStatusCountV1'
+ audit_plan_sql_list:
+ items:
+ $ref: '#/definitions/v1.AuditPlanSQLReqV1'
+ type: array
+ type: object
+ v1.PerformanceStatistics:
+ properties:
+ affect_rows:
+ $ref: '#/definitions/v1.AffectRows'
type: object
- message:
- example: ok
- type: string
type: object
- v1.GetWorkflowTasksItemV1:
+ v1.ProjectRuleTemplateResV1:
properties:
- current_step_assignee_user_name_list:
- items:
- type: string
- type: array
- exec_end_time:
- type: string
- exec_start_time:
- type: string
- execution_user_name:
- type: string
- instance_maintenance_times:
- items:
- $ref: '#/definitions/v1.MaintenanceTimeResV1'
- type: array
- instance_name:
+ db_type:
type: string
- schedule_time:
+ desc:
type: string
- status:
- enum:
- - wait_for_audit
- - wait_for_execution
- - exec_scheduled
- - exec_failed
- - exec_succeeded
- - executing
- - manually_executed
+ rule_template_name:
type: string
- task_id:
- type: integer
- task_pass_rate:
- type: number
- task_score:
- type: integer
type: object
- v1.GetWorkflowTasksResV1:
+ v1.ProjectScore:
properties:
- code:
- example: 0
+ score:
type: integer
- data:
- items:
- $ref: '#/definitions/v1.GetWorkflowTasksItemV1'
- type: array
- message:
- example: ok
+ type: object
+ v1.RejectWorkflowReqV1:
+ properties:
+ reason:
type: string
type: object
- v1.GetWorkflowTemplateResV1:
+ v1.RiskAuditPlan:
properties:
- code:
- example: 0
+ audit_plan_name:
+ type: string
+ audit_plan_report_id:
type: integer
- data:
- $ref: '#/definitions/v1.WorkflowTemplateDetailResV1'
- type: object
- message:
- example: ok
+ audit_plan_report_timestamp:
+ type: string
+ risk_sql_count:
+ type: integer
+ trigger_audit_plan_time:
type: string
type: object
- v1.GetWorkflowWebHookConfigResV1:
+ v1.RiskWorkflow:
properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v1.WebHookConfigV1'
- type: object
- message:
- example: ok
+ create_user_name:
+ type: string
+ update_time:
+ type: string
+ workflow_id:
+ type: string
+ workflow_name:
+ type: string
+ workflow_status:
type: string
type: object
- v1.GetWorkflowsResV1:
+ v1.RoleUserCount:
properties:
- code:
- example: 0
+ count:
type: integer
- data:
- items:
- $ref: '#/definitions/v1.WorkflowDetailResV1'
- type: array
- message:
- example: ok
+ role:
type: string
- total_nums:
- type: integer
type: object
- v1.GlobalRuleTemplateInstance:
+ v1.RuleInfo:
properties:
- instance_name:
+ annotation:
+ example: this is test rule
type: string
- project_name:
+ desc:
+ example: this is test rule
type: string
type: object
- v1.InstanceAdditionalMetaV1:
+ v1.RuleKnowledgeResV1:
properties:
- db_type:
+ knowledge_content:
type: string
- params:
- items:
- $ref: '#/definitions/v1.InstanceAdditionalParamResV1'
- type: array
+ rule:
+ $ref: '#/definitions/v1.RuleInfo'
+ type: object
type: object
- v1.InstanceAdditionalParamReqV1:
+ v1.RuleParamReqV1:
properties:
- name:
+ key:
type: string
value:
type: string
type: object
- v1.InstanceAdditionalParamResV1:
+ v1.RuleParamResV1:
properties:
- description:
- example: 参数项中文名
+ desc:
type: string
- name:
- example: param name
+ key:
type: string
type:
- example: int
+ enum:
+ - string
+ - int
+ - bool
type: string
value:
- example: "0"
type: string
type: object
- v1.InstanceConnectableResV1:
- properties:
- connect_error_message:
- type: string
- is_instance_connectable:
- type: boolean
- type: object
- v1.InstanceConnectionResV1:
+ v1.RuleProjectTemplateDetailResV1:
properties:
- connect_error_message:
+ db_type:
type: string
- instance_name:
+ desc:
type: string
- is_instance_connectable:
- type: boolean
- type: object
- v1.InstanceForCheckConnection:
- properties:
- name:
+ rule_list:
+ items:
+ $ref: '#/definitions/v1.RuleResV1'
+ type: array
+ rule_template_name:
type: string
type: object
- v1.InstanceForCreatingTask:
+ v1.RuleReqV1:
properties:
- instance_name:
+ is_custom_rule:
+ type: boolean
+ level:
+ example: error
type: string
- instance_schema:
+ name:
+ example: ddl_check_index_count
type: string
- type: object
- v1.InstanceResV1:
- properties:
- additional_params:
+ params:
items:
- $ref: '#/definitions/v1.InstanceAdditionalParamResV1'
+ $ref: '#/definitions/v1.RuleParamReqV1'
type: array
- db_host:
- example: 10.10.10.10
- type: string
- db_port:
- example: "3306"
+ type: object
+ v1.RuleResV1:
+ properties:
+ annotation:
+ example: 避免多次 table rebuild 带来的消耗、以及对线上业务的影响
type: string
db_type:
example: mysql
type: string
- db_user:
- example: root
- type: string
desc:
- example: this is a instance
type: string
- instance_name:
+ is_custom_rule:
+ type: boolean
+ level:
+ enum:
+ - normal
+ - notice
+ - warn
+ - error
+ example: error
type: string
- maintenance_times:
+ params:
items:
- $ref: '#/definitions/v1.MaintenanceTimeResV1'
+ $ref: '#/definitions/v1.RuleParamResV1'
type: array
- rule_template_name:
+ rule_name:
type: string
- source:
- example: SQLE
+ type:
+ example: 全局配置
type: string
- sql_query_config:
- $ref: '#/definitions/v1.SQLQueryConfigResV1'
- type: object
- type: object
- v1.InstanceSchemaResV1:
- properties:
- schema_name_list:
- items:
- type: string
- type: array
type: object
- v1.InstanceTableMeta:
+ v1.RuleRespV1:
properties:
- columns:
- $ref: '#/definitions/v1.TableColumns'
- type: object
- create_table_sql:
- type: string
- indexes:
- $ref: '#/definitions/v1.TableIndexes'
- type: object
- name:
+ desc:
type: string
- schema:
+ rule_name:
type: string
type: object
- v1.InstanceTaskDetailResV1:
+ v1.RuleTemplateDetailResV1:
properties:
db_type:
- example: mysql
- type: string
- id:
- example: 1
- type: integer
- rule_template:
- example: default_mysql
type: string
- source:
- example: actiontech-dmp
- type: string
- sync_instance_interval:
- example: 0 0 * * *
- type: string
- url:
- example: http://10.186.62.56:10000
+ desc:
type: string
- version:
- example: 1.23.1
+ rule_list:
+ items:
+ $ref: '#/definitions/v1.RuleResV1'
+ type: array
+ rule_template_name:
type: string
type: object
- v1.InstanceTaskResV1:
+ v1.RuleTemplateResV1:
properties:
db_type:
- example: mysql
- type: string
- id:
- example: 1
- type: integer
- last_sync_status:
- enum:
- - succeeded
- - failed
- example: succeeded
- type: string
- last_sync_success_time:
- example: "2021-08-12 12:00:00"
type: string
- source:
- example: actiontech-dmp
- type: string
- url:
- example: http://10.186.62.56:10000
+ desc:
type: string
- version:
- example: 1.23.1
+ rule_template_name:
type: string
type: object
- v1.InstanceTipResV1:
+ v1.RuleTemplateTipResV1:
properties:
- host:
- type: string
- instance_name:
+ db_type:
type: string
- instance_type:
+ rule_template_id:
type: string
- port:
+ rule_template_name:
type: string
- workflow_template_id:
- type: integer
type: object
- v1.InstanceTypePercent:
+ v1.RuleTips:
properties:
- count:
- type: integer
- percent:
- type: number
- type:
+ db_type:
type: string
- type: object
- v1.InstancesTypePercentV1:
- properties:
- instance_total_num:
- type: integer
- instance_type_percents:
+ rule:
items:
- $ref: '#/definitions/v1.InstanceTypePercent'
+ $ref: '#/definitions/v1.RuleRespV1'
type: array
type: object
- v1.LDAPConfigurationReqV1:
+ v1.RuleTypeV1:
properties:
- enable_ldap:
- type: boolean
- enable_ssl:
+ is_custom_rule_type:
type: boolean
- ldap_connect_dn:
- type: string
- ldap_connect_pwd:
- type: string
- ldap_search_base_dn:
- type: string
- ldap_server_host:
- type: string
- ldap_server_port:
- type: string
- ldap_user_email_rdn_key:
- type: string
- ldap_user_name_rdn_key:
+ rule_count:
+ type: integer
+ rule_type:
type: string
type: object
- v1.LDAPConfigurationResV1:
+ v1.SQLAuditRecord:
properties:
- enable_ldap:
- type: boolean
- enable_ssl:
- type: boolean
- ldap_connect_dn:
+ created_at:
type: string
- ldap_search_base_dn:
+ creator:
type: string
- ldap_server_host:
+ instance:
+ $ref: '#/definitions/v1.SQLAuditRecordInstance'
+ type: object
+ sql_audit_record_id:
type: string
- ldap_server_port:
+ sql_audit_status:
type: string
- ldap_user_email_rdn_key:
+ tags:
+ items:
+ type: string
+ type: array
+ task:
+ $ref: '#/definitions/v1.AuditTaskResV1'
+ type: object
+ type: object
+ v1.SQLAuditRecordInstance:
+ properties:
+ db_host:
+ example: 10.10.10.10
type: string
- ldap_user_name_rdn_key:
+ db_port:
+ example: "3306"
type: string
type: object
- v1.LicenseItem:
+ v1.SQLAuditRecordResData:
properties:
- description:
+ sql_audit_record_id:
type: string
- limit:
+ task:
+ $ref: '#/definitions/v1.AuditTaskResV1'
+ type: object
+ type: object
+ v1.SQLExplain:
+ properties:
+ classic_result:
+ $ref: '#/definitions/v1.ExplainClassicResult'
+ description: explain result in table format
+ type: object
+ message:
type: string
- name:
+ sql:
type: string
type: object
- v1.LicenseUsageItem:
+ v1.SQLQueryConfigResV1:
properties:
- is_limited:
+ allow_query_when_less_than_audit_level:
+ enum:
+ - normal
+ - notice
+ - warn
+ - error
+ type: string
+ audit_enabled:
type: boolean
- limit:
+ max_pre_query_rows:
type: integer
- resource_type:
- type: string
- resource_type_desc:
- type: string
- used:
+ query_timeout_second:
type: integer
type: object
- v1.LicenseUsageV1:
+ v1.Source:
properties:
- instances_usage:
+ audit_plan_name:
+ type: string
+ sql_audit_record_ids:
items:
- $ref: '#/definitions/v1.LicenseUsageItem'
+ type: string
type: array
- users_usage:
- $ref: '#/definitions/v1.LicenseUsageItem'
- type: object
+ type:
+ enum:
+ - audit_plan
+ - sql_audit_record
+ type: string
type: object
- v1.ListTableBySchemaResV1:
+ v1.SqlAnalysis:
properties:
- code:
- example: 0
- type: integer
- data:
- items:
- $ref: '#/definitions/v1.Table'
- type: array
- message:
- example: ok
- type: string
- type: object
- v1.MaintenanceTimeReqV1:
- properties:
- maintenance_start_time:
- $ref: '#/definitions/v1.TimeReqV1'
+ performance_statistics:
+ $ref: '#/definitions/v1.PerformanceStatistics'
type: object
- maintenance_stop_time:
- $ref: '#/definitions/v1.TimeReqV1'
+ sql_explain:
+ $ref: '#/definitions/v1.SQLExplain'
+ type: object
+ table_metas:
+ $ref: '#/definitions/v1.TableMetas'
type: object
type: object
- v1.MaintenanceTimeResV1:
+ v1.SqlAnalysisResDataV1:
properties:
- maintenance_start_time:
- $ref: '#/definitions/v1.TimeResV1'
- type: object
- maintenance_stop_time:
- $ref: '#/definitions/v1.TimeResV1'
+ sql_explain:
+ $ref: '#/definitions/v1.SQLExplain'
type: object
+ table_metas:
+ items:
+ $ref: '#/definitions/v1.TableMeta'
+ type: array
type: object
- v1.ManagementPermissionResV1:
+ v1.SqlAverageExecutionTime:
properties:
- code:
+ average_execution_seconds:
type: integer
- desc:
- type: string
- type: object
- v1.MemberGroupUserItem:
- properties:
- name:
+ instance_name:
type: string
+ max_execution_seconds:
+ type: integer
+ min_execution_seconds:
+ type: integer
type: object
- v1.MemberTipResV1:
+ v1.SqlExecutionFailPercent:
properties:
- user_name:
+ instance_name:
type: string
+ percent:
+ type: number
type: object
- v1.Oauth2ConfigurationReqV1:
+ v1.SqlManage:
properties:
- access_token_tag:
- type: string
- client_host:
- type: string
- client_id:
- type: string
- client_key:
- type: string
- enable_oauth2:
- type: boolean
- login_tip:
- type: string
- scopes:
+ appear_num:
+ type: integer
+ assignees:
items:
type: string
type: array
- server_auth_url:
- type: string
- server_token_url:
- type: string
- server_user_id_url:
- type: string
- user_id_tag:
- type: string
- type: object
- v1.Operation:
- properties:
- op_code:
- type: integer
- op_desc:
- type: string
- type: object
- v1.OperationActionList:
- properties:
- desc:
- type: string
- operation_action:
+ audit_result:
+ items:
+ $ref: '#/definitions/v1.AuditResult'
+ type: array
+ endpoint:
type: string
- operation_type:
+ first_appear_time:
type: string
- type: object
- v1.OperationRecordList:
- properties:
id:
type: integer
- operation_action:
+ instance_name:
type: string
- operation_content:
+ last_appear_time:
type: string
- operation_time:
+ remark:
type: string
- operation_type_name:
+ schema_name:
type: string
- operation_user:
- $ref: '#/definitions/v1.OperationUser'
+ source:
+ $ref: '#/definitions/v1.Source'
type: object
- project_name:
+ sql:
+ type: string
+ sql_fingerprint:
type: string
status:
enum:
- - succeeded
- - failed
+ - unhandled
+ - solved
+ - ignored
+ - manual_audited
type: string
type: object
- v1.OperationResV1:
+ v1.StatisticAuditPlanResV1:
properties:
- op_code:
+ code:
+ example: 0
type: integer
- op_desc:
- type: string
- type: object
- v1.OperationTypeNameList:
- properties:
- desc:
- type: string
- operation_type_name:
- type: string
- type: object
- v1.OperationUser:
- properties:
- ip:
- type: string
- user_name:
+ data:
+ items:
+ $ref: '#/definitions/v1.DBTypeAuditPlan'
+ type: array
+ message:
+ example: ok
type: string
type: object
- v1.ParseProjectRuleTemplateFileResDataV1:
+ v1.StatisticRiskWorkflowResV1:
properties:
- db_type:
- type: string
- desc:
- type: string
- name:
- type: string
- rule_list:
+ code:
+ example: 0
+ type: integer
+ data:
items:
- $ref: '#/definitions/v1.RuleResV1'
+ $ref: '#/definitions/v1.RiskWorkflow'
type: array
+ message:
+ example: ok
+ type: string
type: object
- v1.ParseProjectRuleTemplateFileResV1:
+ v1.StatisticsAuditedSQLResV1:
properties:
code:
example: 0
type: integer
data:
- $ref: '#/definitions/v1.ParseProjectRuleTemplateFileResDataV1'
+ $ref: '#/definitions/v1.AuditedSQLCount'
type: object
message:
example: ok
type: string
+ risk_rate:
+ type: integer
type: object
- v1.PartialSyncAuditPlanSQLsReqV1:
+ v1.SystemVariablesResV1:
properties:
- audit_plan_sql_list:
- items:
- $ref: '#/definitions/v1.AuditPlanSQLReqV1'
- type: array
+ operation_record_expired_hours:
+ type: integer
+ url:
+ type: string
+ workflow_expired_hours:
+ type: integer
type: object
- v1.PatchUserGroupReqV1:
+ v1.Table:
properties:
- is_disabled:
- type: boolean
- user_group_desc:
- example: this is a group
+ name:
type: string
- user_name_list:
- items:
- type: string
- type: array
type: object
- v1.PerformanceStatistics:
+ v1.TableColumns:
properties:
- affect_rows:
- $ref: '#/definitions/v1.AffectRows'
- type: object
+ head:
+ items:
+ $ref: '#/definitions/v1.TableMetaItemHeadResV1'
+ type: array
+ rows:
+ items:
+ additionalProperties:
+ type: string
+ type: object
+ type: array
type: object
- v1.PersonaliseReqV1:
+ v1.TableIndexes:
properties:
- title:
- type: string
+ head:
+ items:
+ $ref: '#/definitions/v1.TableMetaItemHeadResV1'
+ type: array
+ rows:
+ items:
+ additionalProperties:
+ type: string
+ type: object
+ type: array
type: object
- v1.ProjectDetailItem:
+ v1.TableMeta:
properties:
- archived:
- type: boolean
- create_time:
- type: string
- create_user_name:
+ columns:
+ $ref: '#/definitions/v1.TableColumns'
+ type: object
+ create_table_sql:
type: string
- desc:
+ indexes:
+ $ref: '#/definitions/v1.TableIndexes'
+ type: object
+ message:
type: string
name:
type: string
+ schema:
+ type: string
type: object
- v1.ProjectListItem:
+ v1.TableMetaItemHeadResV1:
properties:
- archived:
- type: boolean
- create_time:
- type: string
- create_user_name:
- type: string
desc:
type: string
- name:
- type: string
- type: object
- v1.ProjectRuleTemplateInstance:
- properties:
- name:
+ field_name:
type: string
type: object
- v1.ProjectRuleTemplateResV1:
+ v1.TableMetas:
properties:
- db_type:
- type: string
- desc:
+ err_message:
type: string
- instance_list:
+ table_meta_items:
items:
- $ref: '#/definitions/v1.ProjectRuleTemplateInstance'
+ $ref: '#/definitions/v1.TableMeta'
type: array
- rule_template_name:
+ type: object
+ v1.TestAuditPlanNotifyConfigResDataV1:
+ properties:
+ is_notify_send_normal:
+ type: boolean
+ send_error_message:
type: string
type: object
- v1.ProjectScore:
+ v1.TestAuditPlanNotifyConfigResV1:
properties:
- score:
+ code:
+ example: 0
type: integer
+ data:
+ $ref: '#/definitions/v1.TestAuditPlanNotifyConfigResDataV1'
+ type: object
+ message:
+ example: ok
+ type: string
type: object
- v1.ProjectTipResV1:
+ v1.TestDingTalkConfigResDataV1:
properties:
- project_name:
+ is_ding_talk_send_normal:
+ type: boolean
+ send_error_message:
type: string
type: object
- v1.RejectWorkflowReqV1:
+ v1.TestDingTalkConfigResV1:
properties:
- reason:
+ code:
+ example: 0
+ type: integer
+ data:
+ $ref: '#/definitions/v1.TestDingTalkConfigResDataV1'
+ type: object
+ message:
+ example: ok
type: string
type: object
- v1.RiskAuditPlan:
+ v1.TestFeishuConfigResDataV1:
properties:
- audit_plan_name:
- type: string
- audit_plan_report_id:
- type: integer
- audit_plan_report_timestamp:
- type: string
- risk_sql_count:
- type: integer
- trigger_audit_plan_time:
+ error_message:
type: string
+ is_message_sent_normally:
+ type: boolean
type: object
- v1.RiskWorkflow:
+ v1.TestFeishuConfigResV1:
properties:
- create_user_name:
- type: string
- update_time:
- type: string
- workflow_id:
- type: string
- workflow_name:
- type: string
- workflow_status:
+ code:
+ example: 0
+ type: integer
+ data:
+ $ref: '#/definitions/v1.TestFeishuConfigResDataV1'
+ type: object
+ message:
+ example: ok
type: string
type: object
- v1.RoleResV1:
+ v1.TestFeishuConfigurationReqV1:
properties:
- is_disabled:
- type: boolean
- operation_list:
- items:
- $ref: '#/definitions/v1.Operation'
- type: array
- role_desc:
+ account:
type: string
- role_name:
+ account_type:
+ enum:
+ - email
+ - phone
type: string
type: object
- v1.RoleTipResV1:
+ v1.TimeResV1:
properties:
- operations:
- items:
- $ref: '#/definitions/v1.Operation'
- type: array
- role_name:
- type: string
+ hour:
+ type: integer
+ minute:
+ type: integer
type: object
- v1.RoleUserCount:
+ v1.TriggerAuditPlanResV1:
properties:
- count:
+ code:
+ example: 0
type: integer
- role:
+ data:
+ $ref: '#/definitions/v1.AuditPlanReportResV1'
+ type: object
+ message:
+ example: ok
type: string
type: object
- v1.RuleInfo:
+ v1.UpdateAuditPlanNotifyConfigReqV1:
properties:
- annotation:
- example: this is test rule
+ enable_email_notify:
+ type: boolean
+ enable_web_hook_notify:
+ type: boolean
+ notify_interval:
+ default: 10
+ type: integer
+ notify_level:
+ default: warn
+ enum:
+ - normal
+ - notice
+ - warn
+ - error
type: string
- desc:
- example: this is test rule
+ web_hook_template:
+ type: string
+ web_hook_url:
type: string
type: object
- v1.RuleKnowledgeResV1:
+ v1.UpdateAuditPlanReqV1:
properties:
- knowledge_content:
+ audit_plan_cron:
+ example: 0 */2 * * *
+ type: string
+ audit_plan_instance_database:
+ example: app1
+ type: string
+ audit_plan_instance_name:
+ example: test_mysql
+ type: string
+ audit_plan_params:
+ items:
+ $ref: '#/definitions/v1.AuditPlanParamReqV1'
+ type: array
+ rule_template_name:
+ example: default_MySQL
type: string
- rule:
- $ref: '#/definitions/v1.RuleInfo'
- type: object
type: object
- v1.RuleParamReqV1:
+ v1.UpdateAuditTaskSQLsReqV1:
properties:
- key:
- type: string
- value:
+ description:
type: string
type: object
- v1.RuleParamResV1:
+ v1.UpdateAuditWhitelistReqV1:
properties:
desc:
+ example: used for rapid release
type: string
- key:
- type: string
- type:
+ match_type:
enum:
- - string
- - int
- - bool
+ - exact_match
+ - fp_match
+ example: exact_match
type: string
value:
+ example: create table
type: string
type: object
- v1.RuleProjectTemplateDetailResV1:
- properties:
- db_type:
- type: string
- desc:
- type: string
- instance_list:
- items:
- $ref: '#/definitions/v1.ProjectRuleTemplateInstance'
- type: array
- rule_list:
- items:
- $ref: '#/definitions/v1.RuleResV1'
- type: array
- rule_template_name:
- type: string
- type: object
- v1.RuleReqV1:
+ v1.UpdateCompanyNoticeReq:
properties:
- is_custom_rule:
- type: boolean
- level:
- example: error
- type: string
- name:
- example: ddl_check_index_count
+ notice_str:
type: string
- params:
- items:
- $ref: '#/definitions/v1.RuleParamReqV1'
- type: array
type: object
- v1.RuleResV1:
+ v1.UpdateCustomRuleReqV1:
properties:
annotation:
- example: 避免多次 table rebuild 带来的消耗、以及对线上业务的影响
- type: string
- db_type:
- example: mysql
+ example: this is test rule
type: string
desc:
+ example: this is test rule
type: string
- is_custom_rule:
- type: boolean
level:
enum:
- normal
- notice
- warn
- error
- example: error
+ example: notice
type: string
- params:
- items:
- $ref: '#/definitions/v1.RuleParamResV1'
- type: array
- rule_name:
+ rule_script:
type: string
type:
- example: 全局配置
+ example: DDL规则
type: string
type: object
- v1.RuleRespV1:
+ v1.UpdateDingTalkConfigurationReqV1:
properties:
- desc:
+ app_key:
type: string
- rule_name:
+ app_secret:
type: string
+ is_enable_ding_talk_notify:
+ type: boolean
+ required:
+ - app_key
+ - app_secret
+ - is_enable_ding_talk_notify
type: object
- v1.RuleTemplateDetailResV1:
+ v1.UpdateFeishuConfigurationReqV1:
properties:
- db_type:
+ app_id:
+ type: string
+ app_secret:
type: string
+ is_feishu_notification_enabled:
+ type: boolean
+ required:
+ - app_id
+ - app_secret
+ - is_feishu_notification_enabled
+ type: object
+ v1.UpdateProjectRuleTemplateReqV1:
+ properties:
desc:
type: string
- instance_list:
- items:
- $ref: '#/definitions/v1.GlobalRuleTemplateInstance'
- type: array
rule_list:
items:
- $ref: '#/definitions/v1.RuleResV1'
+ $ref: '#/definitions/v1.RuleReqV1'
type: array
- rule_template_name:
- type: string
type: object
- v1.RuleTemplateResV1:
+ v1.UpdateRuleKnowledgeReq:
properties:
- db_type:
+ knowledge_content:
type: string
+ type: object
+ v1.UpdateRuleTemplateReqV1:
+ properties:
desc:
type: string
- instance_list:
+ rule_list:
items:
- $ref: '#/definitions/v1.GlobalRuleTemplateInstance'
+ $ref: '#/definitions/v1.RuleReqV1'
type: array
- rule_template_name:
- type: string
- type: object
- v1.RuleTemplateTipResV1:
- properties:
- db_type:
- type: string
- rule_template_name:
- type: string
type: object
- v1.RuleTips:
+ v1.UpdateSQLAuditRecordReqV1:
properties:
- db_type:
- type: string
- rule:
+ tags:
items:
- $ref: '#/definitions/v1.RuleRespV1'
+ type: string
type: array
type: object
- v1.RuleTypeV1:
+ v1.UpdateSystemVariablesReqV1:
properties:
- is_custom_rule_type:
- type: boolean
- rule_count:
+ operation_record_expired_hours:
+ example: 2160
type: integer
- rule_type:
- type: string
- type: object
- v1.SMTPConfigurationResV1:
- properties:
- enable_smtp_notify:
- type: boolean
- is_skip_verify:
- type: boolean
- smtp_host:
- type: string
- smtp_port:
- type: string
- smtp_username:
+ url:
+ example: http://10.186.61.32:8080
type: string
+ workflow_expired_hours:
+ example: 720
+ type: integer
type: object
- v1.SQLAuditRecord:
+ v1.UpdateWorkflowReqV1:
properties:
- created_at:
- type: string
- creator:
- type: string
- instance:
- $ref: '#/definitions/v1.SQLAuditRecordInstance'
- type: object
- sql_audit_record_id:
- type: string
- sql_audit_status:
- type: string
- tags:
+ task_ids:
items:
- type: string
+ type: integer
type: array
- task:
- $ref: '#/definitions/v1.AuditTaskResV1'
- type: object
- type: object
- v1.SQLAuditRecordInstance:
- properties:
- db_host:
- example: 10.10.10.10
- type: string
- db_port:
- example: "3306"
- type: string
- type: object
- v1.SQLAuditRecordResData:
- properties:
- sql_audit_record_id:
- type: string
- task:
- $ref: '#/definitions/v1.AuditTaskResV1'
- type: object
type: object
- v1.SQLExplain:
+ v1.UpdateWorkflowScheduleReqV1:
properties:
- classic_result:
- $ref: '#/definitions/v1.ExplainClassicResult'
- description: explain result in table format
- type: object
- message:
- type: string
- sql:
+ schedule_time:
type: string
type: object
- v1.SQLQueryConfigReqV1:
+ v1.UpdateWorkflowTemplateReqV1:
properties:
- allow_query_when_less_than_audit_level:
+ allow_submit_when_less_audit_level:
enum:
- normal
- notice
- warn
- error
- example: error
type: string
- audit_enabled:
- example: false
- type: boolean
- max_pre_query_rows:
- example: 100
- type: integer
- query_timeout_second:
- example: 10
- type: integer
+ desc:
+ type: string
+ workflow_step_template_list:
+ items:
+ $ref: '#/definitions/v1.WorkFlowStepTemplateReqV1'
+ type: array
type: object
- v1.SQLQueryConfigResV1:
+ v1.UserTipResV1:
properties:
- allow_query_when_less_than_audit_level:
- enum:
- - normal
- - notice
- - warn
- - error
+ user_id:
+ type: string
+ user_name:
type: string
- audit_enabled:
- type: boolean
- max_pre_query_rows:
- type: integer
- query_timeout_second:
- type: integer
type: object
- v1.Source:
+ v1.WorkFlowStepTemplateReqV1:
properties:
- audit_plan_name:
- type: string
- sql_audit_record_ids:
+ approved_by_authorized:
+ type: boolean
+ assignee_user_id_list:
items:
type: string
type: array
+ desc:
+ type: string
+ execute_by_authorized:
+ type: boolean
type:
enum:
- - audit_plan
- - sql_audit_record
+ - sql_review
+ - sql_execute
type: string
type: object
- v1.SqlAnalysis:
- properties:
- performance_statistics:
- $ref: '#/definitions/v1.PerformanceStatistics'
- type: object
- sql_explain:
- $ref: '#/definitions/v1.SQLExplain'
- type: object
- table_metas:
- $ref: '#/definitions/v1.TableMetas'
- type: object
- type: object
- v1.SqlAnalysisResDataV1:
+ v1.WorkFlowStepTemplateResV1:
properties:
- sql_explain:
- $ref: '#/definitions/v1.SQLExplain'
- type: object
- table_metas:
+ approved_by_authorized:
+ type: boolean
+ assignee_user_id_list:
items:
- $ref: '#/definitions/v1.TableMeta'
+ type: string
type: array
- type: object
- v1.SqlAverageExecutionTime:
- properties:
- average_execution_seconds:
+ desc:
+ type: string
+ execute_by_authorized:
+ type: boolean
+ number:
type: integer
- instance_name:
+ type:
type: string
- max_execution_seconds:
+ type: object
+ v1.WorkflowAuditPassPercentV1:
+ properties:
+ audit_pass_percent:
+ type: number
+ type: object
+ v1.WorkflowCountsV1:
+ properties:
+ today_count:
type: integer
- min_execution_seconds:
+ total:
type: integer
type: object
- v1.SqlExecutionFailPercent:
+ v1.WorkflowCreatedCountsEachDayItem:
properties:
- instance_name:
+ date:
+ example: "2022-08-24"
type: string
- percent:
- type: number
+ value:
+ type: integer
type: object
- v1.SqlManage:
+ v1.WorkflowCreatedCountsEachDayV1:
properties:
- appear_num:
- type: integer
- assignees:
- items:
- type: string
- type: array
- audit_result:
+ samples:
items:
- $ref: '#/definitions/v1.AuditResult'
+ $ref: '#/definitions/v1.WorkflowCreatedCountsEachDayItem'
type: array
- endpoint:
- type: string
- first_appear_time:
- type: string
- id:
- type: integer
- instance_name:
- type: string
- last_appear_time:
+ type: object
+ v1.WorkflowDetailResV1:
+ properties:
+ create_time:
type: string
- remark:
+ create_user_name:
type: string
- schema_name:
+ current_step_assignee_user_name_list:
+ items:
+ type: string
+ type: array
+ current_step_type:
+ enum:
+ - sql_review
+ - sql_execute
type: string
- source:
- $ref: '#/definitions/v1.Source'
- type: object
- sql:
+ desc:
type: string
- sql_fingerprint:
+ project_name:
type: string
status:
enum:
- - unhandled
- - solved
- - ignored
- - manual_audited
+ - wait_for_audit
+ - wait_for_execution
+ - rejected
+ - canceled
+ - exec_failed
+ - executing
+ - finished
+ type: string
+ workflow_id:
+ type: string
+ workflow_name:
type: string
type: object
- v1.StatisticAuditPlanResV1:
+ v1.WorkflowPassPercentV1:
properties:
- code:
- example: 0
+ audit_pass_percent:
+ type: number
+ execution_success_percent:
+ type: number
+ type: object
+ v1.WorkflowPercentCountedByInstanceType:
+ properties:
+ count:
type: integer
- data:
- items:
- $ref: '#/definitions/v1.DBTypeAuditPlan'
- type: array
- message:
- example: ok
+ instance_type:
type: string
+ percent:
+ type: number
type: object
- v1.StatisticRiskWorkflowResV1:
+ v1.WorkflowPercentCountedByInstanceTypeV1:
properties:
- code:
- example: 0
- type: integer
- data:
+ workflow_percents:
items:
- $ref: '#/definitions/v1.RiskWorkflow'
+ $ref: '#/definitions/v1.WorkflowPercentCountedByInstanceType'
type: array
- message:
- example: ok
- type: string
+ workflow_total_num:
+ type: integer
type: object
- v1.StatisticsAuditedSQLResV1:
+ v1.WorkflowRecordResV1:
properties:
- code:
- example: 0
+ current_step_number:
type: integer
- data:
- $ref: '#/definitions/v1.AuditedSQLCount'
- type: object
- message:
- example: ok
- type: string
- risk_rate:
- type: integer
- type: object
- v1.SyncInstanceResV1:
- properties:
- is_sync_instance_success:
- example: true
- type: boolean
- sync_error_message:
+ status:
+ enum:
+ - wait_for_audit
+ - wait_for_execution
+ - rejected
+ - canceled
+ - exec_failed
+ - executing
+ - finished
type: string
- type: object
- v1.SyncTaskTipsResV1:
- properties:
- db_types:
+ tasks:
items:
- type: string
+ $ref: '#/definitions/v1.WorkflowTaskItem'
+ type: array
+ workflow_step_list:
+ items:
+ $ref: '#/definitions/v1.WorkflowStepResV1'
type: array
- source:
- example: actiontech-dmp
- type: string
type: object
- v1.SystemVariablesResV1:
+ v1.WorkflowRejectedPercentGroupByCreator:
properties:
- operation_record_expired_hours:
- type: integer
- url:
+ creator:
type: string
- workflow_expired_hours:
+ rejected_percent:
+ type: number
+ workflow_total_num:
type: integer
type: object
- v1.Table:
+ v1.WorkflowRejectedPercentGroupByInstance:
properties:
- name:
+ instance_name:
type: string
+ rejected_percent:
+ type: number
+ workflow_total_num:
+ type: integer
type: object
- v1.TableColumns:
- properties:
- head:
- items:
- $ref: '#/definitions/v1.TableMetaItemHeadResV1'
- type: array
- rows:
- items:
- additionalProperties:
- type: string
- type: object
- type: array
- type: object
- v1.TableIndexes:
- properties:
- head:
- items:
- $ref: '#/definitions/v1.TableMetaItemHeadResV1'
- type: array
- rows:
- items:
- additionalProperties:
- type: string
- type: object
- type: array
- type: object
- v1.TableMeta:
+ v1.WorkflowResV1:
properties:
- columns:
- $ref: '#/definitions/v1.TableColumns'
- type: object
- create_table_sql:
- type: string
- indexes:
- $ref: '#/definitions/v1.TableIndexes'
- type: object
- message:
- type: string
- name:
+ create_time:
type: string
- schema:
+ create_user_name:
type: string
- type: object
- v1.TableMetaItemHeadResV1:
- properties:
desc:
type: string
- field_name:
- type: string
- type: object
- v1.TableMetas:
- properties:
- err_message:
+ mode:
+ enum:
+ - same_sqls
+ - different_sqls
type: string
- table_meta_items:
+ record:
+ $ref: '#/definitions/v1.WorkflowRecordResV1'
+ type: object
+ record_history_list:
items:
- $ref: '#/definitions/v1.TableMeta'
+ $ref: '#/definitions/v1.WorkflowRecordResV1'
type: array
- type: object
- v1.TestAuditPlanNotifyConfigResDataV1:
- properties:
- is_notify_send_normal:
- type: boolean
- send_error_message:
+ workflow_name:
type: string
type: object
- v1.TestAuditPlanNotifyConfigResV1:
+ v1.WorkflowStageDuration:
properties:
- code:
- example: 0
+ minutes:
type: integer
- data:
- $ref: '#/definitions/v1.TestAuditPlanNotifyConfigResDataV1'
- type: object
- message:
- example: ok
- type: string
type: object
- v1.TestDingTalkConfigResDataV1:
+ v1.WorkflowStatisticsResV1:
properties:
- is_ding_talk_send_normal:
- type: boolean
- send_error_message:
- type: string
+ my_need_execute_workflow_number:
+ type: integer
+ my_need_review_workflow_number:
+ type: integer
+ my_on_process_workflow_number:
+ type: integer
+ my_rejected_workflow_number:
+ type: integer
+ need_me_to_execute_workflow_number:
+ type: integer
+ need_me_to_review_workflow_number:
+ type: integer
type: object
- v1.TestDingTalkConfigResV1:
+ v1.WorkflowStatusCountV1:
properties:
- code:
- example: 0
+ closed_count:
+ type: integer
+ executing_count:
+ type: integer
+ executing_failed_count:
+ type: integer
+ execution_success_count:
+ type: integer
+ rejected_count:
+ type: integer
+ waiting_for_audit_count:
+ type: integer
+ waiting_for_execution_count:
type: integer
- data:
- $ref: '#/definitions/v1.TestDingTalkConfigResDataV1'
- type: object
- message:
- example: ok
- type: string
type: object
- v1.TestFeishuConfigResDataV1:
+ v1.WorkflowStepResV1:
properties:
- error_message:
+ assignee_user_name_list:
+ items:
+ type: string
+ type: array
+ desc:
type: string
- is_message_sent_normally:
- type: boolean
- type: object
- v1.TestFeishuConfigResV1:
- properties:
- code:
- example: 0
+ number:
type: integer
- data:
- $ref: '#/definitions/v1.TestFeishuConfigResDataV1'
- type: object
- message:
- example: ok
+ operation_time:
type: string
- type: object
- v1.TestFeishuConfigurationReqV1:
- properties:
- account:
+ operation_user_name:
type: string
- account_type:
+ reason:
+ type: string
+ state:
enum:
- - email
- - phone
+ - initialized
+ - approved
+ - rejected
+ type: string
+ type:
+ enum:
+ - create_workflow
+ - update_workflow
+ - sql_review
+ - sql_execute
type: string
+ workflow_step_id:
+ type: integer
type: object
- v1.TestSMTPConfigurationReqV1:
+ v1.WorkflowTaskItem:
properties:
- recipient_addr:
- type: string
+ task_id:
+ type: integer
type: object
- v1.TestSMTPConfigurationResDataV1:
+ v1.WorkflowTemplateDetailResV1:
properties:
- is_smtp_send_normal:
- type: boolean
- send_error_message:
+ allow_submit_when_less_audit_level:
+ enum:
+ - normal
+ - notice
+ - warn
+ - error
+ type: string
+ desc:
+ type: string
+ update_time:
+ type: string
+ workflow_step_template_list:
+ items:
+ $ref: '#/definitions/v1.WorkFlowStepTemplateResV1'
+ type: array
+ workflow_template_name:
type: string
type: object
- v1.TestSMTPConfigurationResV1:
+ v2.AffectRows:
properties:
- code:
- example: 0
+ count:
type: integer
- data:
- $ref: '#/definitions/v1.TestSMTPConfigurationResDataV1'
- type: object
- message:
- example: ok
+ err_message:
type: string
type: object
- v1.TestWeChatConfigurationReqV1:
+ v2.AuditPlanReportSQLResV2:
properties:
- recipient_id:
+ audit_plan_report_sql:
+ example: select * from t1 where id = 1
type: string
+ audit_plan_report_sql_audit_result:
+ items:
+ $ref: '#/definitions/v2.AuditResult'
+ type: array
+ number:
+ example: 1
+ type: integer
type: object
- v1.TestWeChatConfigurationResDataV1:
- properties:
- is_wechat_send_normal:
- type: boolean
- send_error_message:
- type: string
- type: object
- v1.TestWeChatConfigurationResV1:
- properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v1.TestWeChatConfigurationResDataV1'
- type: object
- message:
- example: ok
- type: string
- type: object
- v1.TestWorkflowWebHookConfigResDataV1:
- properties:
- send_error_message:
- type: string
- type: object
- v1.TestWorkflowWebHookConfigResV1:
- properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v1.TestWorkflowWebHookConfigResDataV1'
- type: object
- message:
- example: ok
- type: string
- type: object
- v1.TimeReqV1:
- properties:
- hour:
- type: integer
- minute:
- type: integer
- type: object
- v1.TimeResV1:
- properties:
- hour:
- type: integer
- minute:
- type: integer
- type: object
- v1.TriggerAuditPlanResV1:
- properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v1.AuditPlanReportResV1'
- type: object
- message:
- example: ok
- type: string
- type: object
- v1.TriggerSyncInstanceResV1:
- properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v1.SyncInstanceResV1'
- type: object
- message:
- example: ok
- type: string
- type: object
- v1.UpdateAuditPlanNotifyConfigReqV1:
- properties:
- enable_email_notify:
- type: boolean
- enable_web_hook_notify:
- type: boolean
- notify_interval:
- default: 10
- type: integer
- notify_level:
- default: warn
- enum:
- - normal
- - notice
- - warn
- - error
- type: string
- web_hook_template:
- type: string
- web_hook_url:
- type: string
- type: object
- v1.UpdateAuditPlanReqV1:
+ v2.AuditPlanResV2:
properties:
audit_plan_cron:
example: 0 */2 * * *
type: string
+ audit_plan_db_type:
+ example: mysql
+ type: string
audit_plan_instance_database:
example: app1
type: string
audit_plan_instance_name:
example: test_mysql
type: string
- audit_plan_params:
- items:
- $ref: '#/definitions/v1.AuditPlanParamReqV1'
- type: array
- rule_template_name:
- example: default_MySQL
+ audit_plan_meta:
+ $ref: '#/definitions/v1.AuditPlanMetaV1'
+ type: object
+ audit_plan_name:
+ example: audit_for_java_app1
type: string
- type: object
- v1.UpdateAuditTaskSQLsReqV1:
- properties:
- description:
+ audit_plan_token:
+ example: it's a JWT Token for scanner
type: string
+ rule_template:
+ $ref: '#/definitions/v2.RuleTemplateV2'
+ type: object
type: object
- v1.UpdateAuditWhitelistReqV1:
+ v2.AuditPlanSQLReqV2:
properties:
- desc:
- example: used for rapid release
- type: string
- match_type:
- enum:
- - exact_match
- - fp_match
- example: exact_match
- type: string
- value:
- example: create table
+ audit_plan_sql_counter:
+ example: "6"
type: string
- type: object
- v1.UpdateCompanyNoticeReq:
- properties:
- notice_str:
+ audit_plan_sql_fingerprint:
+ example: select * from t1 where id = ?
type: string
- type: object
- v1.UpdateCurrentUserPasswordReqV1:
- properties:
- new_password:
+ audit_plan_sql_last_receive_text:
+ example: select * from t1 where id = 1
type: string
- password:
+ audit_plan_sql_last_receive_timestamp:
+ example: RFC3339
type: string
- type: object
- v1.UpdateCurrentUserReqV1:
- properties:
- email:
+ audit_plan_sql_schema:
+ example: db1
type: string
- phone:
+ db_user:
+ example: database_user001
type: string
- wechat_id:
- example: UserID
+ endpoints:
+ items:
+ type: string
+ type: array
+ first_query_at:
+ example: "2023-09-12T02:48:01.317880Z"
type: string
+ query_time_avg:
+ example: 3.22
+ type: number
+ query_time_max:
+ example: 5.22
+ type: number
type: object
- v1.UpdateCustomRuleReqV1:
+ v2.AuditResDataV2:
properties:
- annotation:
- example: this is test rule
- type: string
- desc:
- example: this is test rule
- type: string
- level:
+ audit_level:
enum:
- normal
- notice
- warn
- error
- example: notice
- type: string
- rule_script:
- type: string
- type:
- example: DDL规则
+ - ""
type: string
+ pass_rate:
+ type: number
+ score:
+ type: integer
+ sql_results:
+ items:
+ $ref: '#/definitions/v2.AuditSQLResV2'
+ type: array
type: object
- v1.UpdateDingTalkConfigurationReqV1:
+ v2.AuditResult:
properties:
- app_key:
+ db_type:
type: string
- app_secret:
+ level:
+ example: warn
+ type: string
+ message:
+ example: 避免使用不必要的内置函数md5()
+ type: string
+ rule_name:
type: string
- is_enable_ding_talk_notify:
- type: boolean
- required:
- - app_key
- - app_secret
- - is_enable_ding_talk_notify
type: object
- v1.UpdateFeishuConfigurationReqV1:
+ v2.AuditSQLResV2:
properties:
- app_id:
+ audit_level:
type: string
- app_secret:
+ audit_result:
+ items:
+ $ref: '#/definitions/v2.AuditResult'
+ type: array
+ exec_sql:
type: string
- is_feishu_notification_enabled:
- type: boolean
- required:
- - app_id
- - app_secret
- - is_feishu_notification_enabled
+ number:
+ type: integer
type: object
- v1.UpdateInstanceReqV1:
+ v2.AuditTaskSQLResV2:
properties:
- additional_params:
+ audit_level:
+ type: string
+ audit_result:
items:
- $ref: '#/definitions/v1.InstanceAdditionalParamReqV1'
+ $ref: '#/definitions/v2.AuditResult'
type: array
- db_host:
- example: 10.10.10.10
+ audit_status:
type: string
- db_password:
- example: "123456"
+ description:
type: string
- db_port:
- example: "3306"
+ exec_result:
type: string
- db_type:
- example: mysql
+ exec_sql:
type: string
- db_user:
- example: root
+ exec_status:
type: string
- desc:
- example: this is a test instance
+ number:
+ type: integer
+ rollback_sql:
type: string
- maintenance_times:
- items:
- $ref: '#/definitions/v1.MaintenanceTimeReqV1'
- type: array
- rule_template_name:
+ sql_source_file:
type: string
- sql_query_config:
- $ref: '#/definitions/v1.SQLQueryConfigReqV1'
- type: object
type: object
- v1.UpdateMemberGroupReqV1:
+ v2.BatchCancelWorkflowsReqV2:
properties:
- roles:
+ workflow_id_list:
items:
- $ref: '#/definitions/v1.BindRoleReqV1'
+ type: string
type: array
type: object
- v1.UpdateMemberReqV1:
+ v2.BatchCompleteWorkflowsReqV2:
properties:
- is_manager:
- type: boolean
- roles:
+ workflow_id_list:
items:
- $ref: '#/definitions/v1.BindRoleReqV1'
+ type: string
type: array
type: object
- v1.UpdateOtherUserPasswordReqV1:
- properties:
- password:
- type: string
- type: object
- v1.UpdateProjectReqV1:
+ v2.CreateWorkflowReqV2:
properties:
desc:
type: string
- type: object
- v1.UpdateProjectRuleTemplateReqV1:
- properties:
- desc:
- type: string
- instance_name_list:
- example:
- - mysql-xxx
- items:
- type: string
- type: array
- rule_list:
- items:
- $ref: '#/definitions/v1.RuleReqV1'
- type: array
- type: object
- v1.UpdateRoleReqV1:
- properties:
- is_disabled:
- type: boolean
- operation_code_list:
+ task_ids:
items:
type: integer
type: array
- role_desc:
- type: string
- type: object
- v1.UpdateRuleKnowledgeReq:
- properties:
- knowledge_content:
+ workflow_subject:
type: string
type: object
- v1.UpdateRuleTemplateReqV1:
+ v2.CreateWorkflowResV2:
properties:
- desc:
+ code:
+ example: 0
+ type: integer
+ data:
+ $ref: '#/definitions/v2.CreateWorkflowResV2Data'
+ type: object
+ message:
+ example: ok
type: string
- rule_list:
- items:
- $ref: '#/definitions/v1.RuleReqV1'
- type: array
type: object
- v1.UpdateSMTPConfigurationReqV1:
+ v2.CreateWorkflowResV2Data:
properties:
- enable_smtp_notify:
- type: boolean
- is_skip_verify:
- type: boolean
- smtp_host:
- example: smtp.email.qq.com
- type: string
- smtp_password:
- example: "123"
- type: string
- smtp_port:
- example: "465"
- type: string
- smtp_username:
- example: test@qq.com
+ workflow_id:
type: string
type: object
- v1.UpdateSQLAuditRecordReqV1:
+ v2.DirectAuditFileReqV2:
properties:
- tags:
+ file_contents:
+ description: |-
+ 调用方不应该关心SQL是否被完美的拆分成独立的条目, 拆分SQL由SQLE实现
+ 每个数组元素是一个文件内容
+ example:
+ - select * from t1; select * from t2;
items:
type: string
type: array
- type: object
- v1.UpdateSyncInstanceTaskReqV1:
- properties:
- global_rule_template:
- example: default_mysql
+ instance_name:
+ example: instance1
type: string
- sync_instance_interval:
- example: 0 0 * * *
+ instance_type:
+ example: MySQL
type: string
- url:
- example: http://10.186.62.56:10000
+ project_name:
+ example: project1
type: string
- version:
- example: 5.23.01.0
+ schema_name:
+ example: schema1
type: string
- type: object
- v1.UpdateSystemVariablesReqV1:
- properties:
- operation_record_expired_hours:
- example: 2160
- type: integer
- url:
- example: http://10.186.61.32:8080
+ sql_type:
+ enum:
+ - sql
+ - mybatis
+ - ""
+ example: sql
type: string
- workflow_expired_hours:
- example: 720
- type: integer
type: object
- v1.UpdateUserReqV1:
+ v2.DirectAuditReqV2:
properties:
- email:
+ instance_type:
+ example: MySQL
type: string
- is_disabled:
- type: boolean
- management_permission_code_list:
- items:
- type: integer
- type: array
- phone:
+ sql_content:
+ description: 调用方不应该关心SQL是否被完美的拆分成独立的条目, 拆分SQL由SQLE实现
+ example: select * from t1; select * from t2;
type: string
- user_group_name_list:
- items:
- type: string
- type: array
- wechat_id:
- example: UserID
+ sql_type:
+ enum:
+ - sql
+ - mybatis
+ - ""
+ example: sql
type: string
type: object
- v1.UpdateWeChatConfigurationReqV1:
+ v2.DirectAuditResV2:
properties:
- agent_id:
+ code:
+ example: 0
type: integer
- corp_id:
- type: string
- corp_secret:
- type: string
- enable_wechat_notify:
- type: boolean
- proxy_ip:
+ data:
+ $ref: '#/definitions/v2.AuditResDataV2'
+ type: object
+ message:
+ example: ok
type: string
- safe_enabled:
- type: boolean
- type: object
- v1.UpdateWorkflowReqV1:
- properties:
- task_ids:
- items:
- type: integer
- type: array
type: object
- v1.UpdateWorkflowScheduleReqV1:
+ v2.DriverMeta:
properties:
- schedule_time:
+ default_port:
+ type: integer
+ driver_name:
+ type: string
+ logo_url:
type: string
type: object
- v1.UpdateWorkflowTemplateReqV1:
+ v2.FullSyncAuditPlanSQLsReqV2:
properties:
- allow_submit_when_less_audit_level:
- enum:
- - normal
- - notice
- - warn
- - error
- type: string
- desc:
- type: string
- instance_name_list:
- items:
- type: string
- type: array
- workflow_step_template_list:
+ audit_plan_sql_list:
items:
- $ref: '#/definitions/v1.WorkFlowStepTemplateReqV1'
+ $ref: '#/definitions/v2.AuditPlanSQLReqV2'
type: array
type: object
- v1.UploadLogoResDataV1:
- properties:
- logo_url:
- type: string
- type: object
- v1.UploadLogoResV1:
+ v2.GetAuditPlanAnalysisDataResV2:
properties:
code:
example: 0
type: integer
data:
- $ref: '#/definitions/v1.UploadLogoResDataV1'
+ $ref: '#/definitions/v2.TaskAnalysisDataV2'
type: object
message:
example: ok
type: string
type: object
- v1.UserBindProjectResV1:
+ v2.GetAuditPlanReportSQLsResV2:
properties:
- is_manager:
- type: boolean
- project_name:
+ code:
+ example: 0
+ type: integer
+ data:
+ items:
+ $ref: '#/definitions/v2.AuditPlanReportSQLResV2'
+ type: array
+ message:
+ example: ok
type: string
+ total_nums:
+ type: integer
type: object
- v1.UserDetailResV1:
+ v2.GetAuditPlansResV2:
properties:
- bind_projects:
+ code:
+ example: 0
+ type: integer
+ data:
items:
- $ref: '#/definitions/v1.UserBindProjectResV1'
+ $ref: '#/definitions/v2.AuditPlanResV2'
type: array
- email:
- type: string
- is_admin:
- type: boolean
- is_disabled:
- type: boolean
- login_type:
+ message:
+ example: ok
type: string
- management_permission_list:
+ total_nums:
+ type: integer
+ type: object
+ v2.GetAuditTaskSQLsResV2:
+ properties:
+ code:
+ example: 0
+ type: integer
+ data:
items:
- $ref: '#/definitions/v1.ManagementPermissionResV1'
+ $ref: '#/definitions/v2.AuditTaskSQLResV2'
type: array
- phone:
+ message:
+ example: ok
type: string
- user_group_name_list:
+ total_nums:
+ type: integer
+ type: object
+ v2.GetDriversRes:
+ properties:
+ code:
+ example: 0
+ type: integer
+ data:
items:
- type: string
+ $ref: '#/definitions/v2.DriverMeta'
type: array
- user_name:
- type: string
- wechat_id:
+ message:
+ example: ok
type: string
type: object
- v1.UserGroupListItemResV1:
+ v2.GetInstanceResV2:
properties:
- is_disabled:
- type: boolean
- user_group_desc:
- type: string
- user_group_name:
+ code:
+ example: 0
+ type: integer
+ data:
+ $ref: '#/definitions/v2.InstanceResV2'
+ type: object
+ message:
+ example: ok
type: string
- user_name_list:
- items:
- type: string
- type: array
type: object
- v1.UserGroupTipListItem:
+ v2.GetSqlManageListResp:
properties:
- user_group_name:
- type: string
- user_names:
+ code:
+ example: 0
+ type: integer
+ data:
items:
- type: string
+ $ref: '#/definitions/v2.SqlManage'
type: array
+ message:
+ example: ok
+ type: string
+ sql_manage_bad_num:
+ type: integer
+ sql_manage_optimized_num:
+ type: integer
+ sql_manage_total_num:
+ type: integer
type: object
- v1.UserLoginReqV1:
+ v2.GetTaskAnalysisDataResV2:
properties:
- password:
- example: "123456"
- type: string
- username:
- example: test
+ code:
+ example: 0
+ type: integer
+ data:
+ $ref: '#/definitions/v2.TaskAnalysisDataV2'
+ type: object
+ message:
+ example: ok
type: string
type: object
- v1.UserLoginResV1:
+ v2.GetWorkflowResV2:
properties:
- token:
- example: this is a jwt token string
+ code:
+ example: 0
+ type: integer
+ data:
+ $ref: '#/definitions/v2.WorkflowResV2'
+ type: object
+ message:
+ example: ok
type: string
type: object
- v1.UserResV1:
+ v2.GetWorkflowTasksItemV2:
properties:
- email:
- type: string
- is_disabled:
- type: boolean
- login_type:
- type: string
- management_permission_list:
+ current_step_assignee_user_name_list:
items:
- $ref: '#/definitions/v1.ManagementPermissionResV1'
+ type: string
type: array
- phone:
+ exec_end_time:
+ type: string
+ exec_start_time:
+ type: string
+ execution_user_name:
type: string
- user_group_name_list:
+ instance_maintenance_times:
items:
- type: string
+ $ref: '#/definitions/v1.MaintenanceTimeResV1'
type: array
- user_name:
+ instance_name:
type: string
- wechat_id:
+ schedule_time:
type: string
- type: object
- v1.UserTipResV1:
- properties:
- user_name:
+ status:
+ enum:
+ - wait_for_audit
+ - wait_for_execution
+ - exec_scheduled
+ - exec_failed
+ - exec_succeeded
+ - executing
+ - manually_executed
+ - terminating
+ - terminate_succeeded
+ - terminate_failed
type: string
- type: object
- v1.WeChatConfigurationResV1:
- properties:
- agent_id:
+ task_id:
+ type: integer
+ task_pass_rate:
+ type: number
+ task_score:
type: integer
- corp_id:
- type: string
- enable_wechat_notify:
- type: boolean
- proxy_ip:
- type: string
- safe_enabled:
- type: boolean
type: object
- v1.WebHookConfigV1:
+ v2.GetWorkflowTasksResV2:
properties:
- enable:
- type: boolean
- max_retry_times:
- type: integer
- retry_interval_seconds:
+ code:
+ example: 0
type: integer
- token:
- type: string
- url:
+ data:
+ items:
+ $ref: '#/definitions/v2.GetWorkflowTasksItemV2'
+ type: array
+ message:
+ example: ok
type: string
type: object
- v1.WorkFlowStepTemplateReqV1:
+ v2.InstanceResV2:
properties:
- approved_by_authorized:
- type: boolean
- assignee_user_name_list:
+ additional_params:
items:
- type: string
+ $ref: '#/definitions/v1.InstanceAdditionalParamResV1'
type: array
+ db_host:
+ example: 10.10.10.10
+ type: string
+ db_port:
+ example: "3306"
+ type: string
+ db_type:
+ example: mysql
+ type: string
+ db_user:
+ example: root
+ type: string
desc:
+ example: this is a instance
type: string
- execute_by_authorized:
- type: boolean
- type:
- enum:
- - sql_review
- - sql_execute
+ instance_name:
type: string
- type: object
- v1.WorkFlowStepTemplateResV1:
- properties:
- approved_by_authorized:
- type: boolean
- assignee_user_name_list:
+ maintenance_times:
items:
- type: string
+ $ref: '#/definitions/v1.MaintenanceTimeResV1'
type: array
- desc:
- type: string
- execute_by_authorized:
- type: boolean
- number:
- type: integer
- type:
+ rule_template:
+ $ref: '#/definitions/v2.RuleTemplateV2'
+ type: object
+ source:
+ example: SQLE
type: string
+ sql_query_config:
+ $ref: '#/definitions/v1.SQLQueryConfigResV1'
+ type: object
type: object
- v1.WorkflowAuditPassPercentV1:
+ v2.PartialSyncAuditPlanSQLsReqV2:
properties:
- audit_pass_percent:
- type: number
+ audit_plan_sql_list:
+ items:
+ $ref: '#/definitions/v2.AuditPlanSQLReqV2'
+ type: array
type: object
- v1.WorkflowCountsV1:
+ v2.PerformanceStatistics:
properties:
- today_count:
- type: integer
- total:
- type: integer
+ affect_rows:
+ $ref: '#/definitions/v2.AffectRows'
+ type: object
type: object
- v1.WorkflowCreatedCountsEachDayItem:
+ v2.RejectWorkflowReqV2:
properties:
- date:
- example: "2022-08-24"
+ reason:
type: string
- value:
- type: integer
type: object
- v1.WorkflowCreatedCountsEachDayV1:
+ v2.RuleTemplateV2:
properties:
- samples:
- items:
- $ref: '#/definitions/v1.WorkflowCreatedCountsEachDayItem'
- type: array
+ is_global_rule_template:
+ type: boolean
+ name:
+ type: string
type: object
- v1.WorkflowDetailResV1:
+ v2.SQLExplain:
properties:
- create_time:
+ classic_result:
+ $ref: '#/definitions/v1.ExplainClassicResult'
+ type: object
+ err_message:
type: string
- create_user_name:
+ sql:
type: string
- current_step_assignee_user_name_list:
+ type: object
+ v2.SqlManage:
+ properties:
+ assignees:
items:
type: string
type: array
- current_step_type:
- enum:
- - sql_review
- - sql_execute
+ audit_result:
+ items:
+ $ref: '#/definitions/v1.AuditResult'
+ type: array
+ endpoints:
+ items:
+ type: string
+ type: array
+ first_appear_timestamp:
type: string
- desc:
+ fp_count:
+ type: integer
+ id:
+ type: integer
+ instance_name:
type: string
- project_name:
+ last_receive_timestamp:
type: string
- status:
- enum:
- - wait_for_audit
- - wait_for_execution
- - rejected
- - canceled
- - exec_failed
- - executing
- - finished
+ remark:
type: string
- workflow_id:
+ schema_name:
type: string
- workflow_name:
+ source:
+ $ref: '#/definitions/v1.Source'
+ type: object
+ sql:
+ type: string
+ sql_fingerprint:
+ type: string
+ status:
+ enum:
+ - unhandled
+ - solved
+ - ignored
+ - manual_audited
type: string
type: object
- v1.WorkflowPassPercentV1:
+ v2.TableMetas:
properties:
- audit_pass_percent:
- type: number
- execution_success_percent:
- type: number
+ err_message:
+ type: string
+ table_meta_items:
+ items:
+ $ref: '#/definitions/v1.TableMeta'
+ type: array
type: object
- v1.WorkflowPercentCountedByInstanceType:
+ v2.TaskAnalysisDataV2:
properties:
- count:
- type: integer
- instance_type:
- type: string
- percent:
- type: number
+ performance_statistics:
+ $ref: '#/definitions/v2.PerformanceStatistics'
+ type: object
+ sql_explain:
+ $ref: '#/definitions/v2.SQLExplain'
+ type: object
+ table_metas:
+ $ref: '#/definitions/v2.TableMetas'
+ type: object
type: object
- v1.WorkflowPercentCountedByInstanceTypeV1:
+ v2.UpdateWorkflowReqV2:
properties:
- workflow_percents:
+ task_ids:
items:
- $ref: '#/definitions/v1.WorkflowPercentCountedByInstanceType'
+ type: integer
type: array
- workflow_total_num:
- type: integer
type: object
- v1.WorkflowRecordResV1:
+ v2.UpdateWorkflowScheduleReqV2:
+ properties:
+ schedule_time:
+ type: string
+ type: object
+ v2.WorkflowRecordResV2:
properties:
current_step_number:
type: integer
@@ -4311,34 +3628,16 @@ definitions:
type: string
tasks:
items:
- $ref: '#/definitions/v1.WorkflowTaskItem'
+ $ref: '#/definitions/v2.WorkflowTaskItem'
type: array
workflow_step_list:
items:
- $ref: '#/definitions/v1.WorkflowStepResV1'
+ $ref: '#/definitions/v2.WorkflowStepResV2'
type: array
type: object
- v1.WorkflowRejectedPercentGroupByCreator:
+ v2.WorkflowResV2:
properties:
- creator:
- type: string
- rejected_percent:
- type: number
- workflow_total_num:
- type: integer
- type: object
- v1.WorkflowRejectedPercentGroupByInstance:
- properties:
- instance_name:
- type: string
- rejected_percent:
- type: number
- workflow_total_num:
- type: integer
- type: object
- v1.WorkflowResV1:
- properties:
- create_time:
+ create_time:
type: string
create_user_name:
type: string
@@ -4350,53 +3649,18 @@ definitions:
- different_sqls
type: string
record:
- $ref: '#/definitions/v1.WorkflowRecordResV1'
+ $ref: '#/definitions/v2.WorkflowRecordResV2'
type: object
record_history_list:
items:
- $ref: '#/definitions/v1.WorkflowRecordResV1'
+ $ref: '#/definitions/v2.WorkflowRecordResV2'
type: array
+ workflow_id:
+ type: string
workflow_name:
type: string
type: object
- v1.WorkflowStageDuration:
- properties:
- minutes:
- type: integer
- type: object
- v1.WorkflowStatisticsResV1:
- properties:
- my_need_execute_workflow_number:
- type: integer
- my_need_review_workflow_number:
- type: integer
- my_on_process_workflow_number:
- type: integer
- my_rejected_workflow_number:
- type: integer
- need_me_to_execute_workflow_number:
- type: integer
- need_me_to_review_workflow_number:
- type: integer
- type: object
- v1.WorkflowStatusCountV1:
- properties:
- closed_count:
- type: integer
- executing_count:
- type: integer
- executing_failed_count:
- type: integer
- execution_success_count:
- type: integer
- rejected_count:
- type: integer
- waiting_for_audit_count:
- type: integer
- waiting_for_execution_count:
- type: integer
- type: object
- v1.WorkflowStepResV1:
+ v2.WorkflowStepResV2:
properties:
assignee_user_name_list:
items:
@@ -4420,2034 +3684,106 @@ definitions:
type: string
type:
enum:
- - create_workflow
- - update_workflow
- - sql_review
- - sql_execute
- type: string
- workflow_step_id:
- type: integer
- type: object
- v1.WorkflowTaskItem:
- properties:
- task_id:
- type: integer
- type: object
- v1.WorkflowTemplateDetailResV1:
- properties:
- allow_submit_when_less_audit_level:
- enum:
- - normal
- - notice
- - warn
- - error
- type: string
- desc:
- type: string
- instance_name_list:
- items:
- type: string
- type: array
- workflow_step_template_list:
- items:
- $ref: '#/definitions/v1.WorkFlowStepTemplateResV1'
- type: array
- workflow_template_name:
- type: string
- type: object
- v2.AffectRows:
- properties:
- count:
- type: integer
- err_message:
- type: string
- type: object
- v2.AuditPlanReportSQLResV2:
- properties:
- audit_plan_report_sql:
- example: select * from t1 where id = 1
- type: string
- audit_plan_report_sql_audit_result:
- items:
- $ref: '#/definitions/v2.AuditResult'
- type: array
- number:
- example: 1
- type: integer
- type: object
- v2.AuditPlanResV2:
- properties:
- audit_plan_cron:
- example: 0 */2 * * *
- type: string
- audit_plan_db_type:
- example: mysql
- type: string
- audit_plan_instance_database:
- example: app1
- type: string
- audit_plan_instance_name:
- example: test_mysql
- type: string
- audit_plan_meta:
- $ref: '#/definitions/v1.AuditPlanMetaV1'
- type: object
- audit_plan_name:
- example: audit_for_java_app1
- type: string
- audit_plan_token:
- example: it's a JWT Token for scanner
- type: string
- rule_template:
- $ref: '#/definitions/v2.RuleTemplateV2'
- type: object
- type: object
- v2.AuditPlanSQLReqV2:
- properties:
- audit_plan_sql_counter:
- example: "6"
- type: string
- audit_plan_sql_fingerprint:
- example: select * from t1 where id = ?
- type: string
- audit_plan_sql_last_receive_text:
- example: select * from t1 where id = 1
- type: string
- audit_plan_sql_last_receive_timestamp:
- example: RFC3339
- type: string
- audit_plan_sql_schema:
- example: db1
- type: string
- db_user:
- example: database_user001
- type: string
- endpoints:
- items:
- type: string
- type: array
- first_query_at:
- example: "2023-09-12T02:48:01.317880Z"
- type: string
- query_time_avg:
- example: 3.22
- type: number
- query_time_max:
- example: 5.22
- type: number
- type: object
- v2.AuditResDataV2:
- properties:
- audit_level:
- enum:
- - normal
- - notice
- - warn
- - error
- - ""
- type: string
- pass_rate:
- type: number
- score:
- type: integer
- sql_results:
- items:
- $ref: '#/definitions/v2.AuditSQLResV2'
- type: array
- type: object
- v2.AuditResult:
- properties:
- db_type:
- type: string
- level:
- example: warn
- type: string
- message:
- example: 避免使用不必要的内置函数md5()
- type: string
- rule_name:
- type: string
- type: object
- v2.AuditSQLResV2:
- properties:
- audit_level:
- type: string
- audit_result:
- items:
- $ref: '#/definitions/v2.AuditResult'
- type: array
- exec_sql:
- type: string
- number:
- type: integer
- type: object
- v2.AuditTaskSQLResV2:
- properties:
- audit_level:
- type: string
- audit_result:
- items:
- $ref: '#/definitions/v2.AuditResult'
- type: array
- audit_status:
- type: string
- description:
- type: string
- exec_result:
- type: string
- exec_sql:
- type: string
- exec_status:
- type: string
- number:
- type: integer
- rollback_sql:
- type: string
- type: object
- v2.BatchCancelWorkflowsReqV2:
- properties:
- workflow_id_list:
- items:
- type: string
- type: array
- type: object
- v2.BatchCompleteWorkflowsReqV2:
- properties:
- workflow_id_list:
- items:
- type: string
- type: array
- type: object
- v2.CreateInstanceReqV2:
- properties:
- additional_params:
- items:
- $ref: '#/definitions/v1.InstanceAdditionalParamReqV1'
- type: array
- db_host:
- example: 10.10.10.10
- type: string
- db_password:
- example: "123456"
- type: string
- db_port:
- example: "3306"
- type: string
- db_type:
- example: mysql
- type: string
- db_user:
- example: root
- type: string
- desc:
- example: this is a test instance
- type: string
- instance_name:
- example: test
- type: string
- maintenance_times:
- items:
- $ref: '#/definitions/v1.MaintenanceTimeReqV1'
- type: array
- rule_template_name:
- type: string
- sql_query_config:
- $ref: '#/definitions/v1.SQLQueryConfigReqV1'
- type: object
- type: object
- v2.CreateWorkflowReqV2:
- properties:
- desc:
- type: string
- task_ids:
- items:
- type: integer
- type: array
- workflow_subject:
- type: string
- type: object
- v2.CreateWorkflowResV2:
- properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v2.CreateWorkflowResV2Data'
- type: object
- message:
- example: ok
- type: string
- type: object
- v2.CreateWorkflowResV2Data:
- properties:
- workflow_id:
- type: string
- type: object
- v2.DirectAuditFileReqV2:
- properties:
- file_contents:
- description: |-
- 调用方不应该关心SQL是否被完美的拆分成独立的条目, 拆分SQL由SQLE实现
- 每个数组元素是一个文件内容
- example:
- - select * from t1; select * from t2;
- items:
- type: string
- type: array
- instance_name:
- example: instance1
- type: string
- instance_type:
- example: MySQL
- type: string
- project_name:
- example: project1
- type: string
- schema_name:
- example: schema1
- type: string
- sql_type:
- enum:
- - sql
- - mybatis
- - ""
- example: sql
- type: string
- type: object
- v2.DirectAuditReqV2:
- properties:
- instance_type:
- example: MySQL
- type: string
- sql_content:
- description: 调用方不应该关心SQL是否被完美的拆分成独立的条目, 拆分SQL由SQLE实现
- example: select * from t1; select * from t2;
- type: string
- sql_type:
- enum:
- - sql
- - mybatis
- - ""
- example: sql
- type: string
- type: object
- v2.DirectAuditResV2:
- properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v2.AuditResDataV2'
- type: object
- message:
- example: ok
- type: string
- type: object
- v2.DriverMeta:
- properties:
- default_port:
- type: integer
- driver_name:
- type: string
- logo_url:
- type: string
- type: object
- v2.FullSyncAuditPlanSQLsReqV2:
- properties:
- audit_plan_sql_list:
- items:
- $ref: '#/definitions/v2.AuditPlanSQLReqV2'
- type: array
- type: object
- v2.GetAuditPlanAnalysisDataResV2:
- properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v2.TaskAnalysisDataV2'
- type: object
- message:
- example: ok
- type: string
- type: object
- v2.GetAuditPlanReportSQLsResV2:
- properties:
- code:
- example: 0
- type: integer
- data:
- items:
- $ref: '#/definitions/v2.AuditPlanReportSQLResV2'
- type: array
- message:
- example: ok
- type: string
- total_nums:
- type: integer
- type: object
- v2.GetAuditPlansResV2:
- properties:
- code:
- example: 0
- type: integer
- data:
- items:
- $ref: '#/definitions/v2.AuditPlanResV2'
- type: array
- message:
- example: ok
- type: string
- total_nums:
- type: integer
- type: object
- v2.GetAuditTaskSQLsResV2:
- properties:
- code:
- example: 0
- type: integer
- data:
- items:
- $ref: '#/definitions/v2.AuditTaskSQLResV2'
- type: array
- message:
- example: ok
- type: string
- total_nums:
- type: integer
- type: object
- v2.GetDriversRes:
- properties:
- code:
- example: 0
- type: integer
- data:
- items:
- $ref: '#/definitions/v2.DriverMeta'
- type: array
- message:
- example: ok
- type: string
- type: object
- v2.GetInstanceResV2:
- properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v2.InstanceResV2'
- type: object
- message:
- example: ok
- type: string
- type: object
- v2.GetInstancesResV2:
- properties:
- code:
- example: 0
- type: integer
- data:
- items:
- $ref: '#/definitions/v2.InstanceResV2'
- type: array
- message:
- example: ok
- type: string
- total_nums:
- type: integer
- type: object
- v2.GetSqlManageListResp:
- properties:
- code:
- example: 0
- type: integer
- data:
- items:
- $ref: '#/definitions/v2.SqlManage'
- type: array
- message:
- example: ok
- type: string
- sql_manage_bad_num:
- type: integer
- sql_manage_optimized_num:
- type: integer
- sql_manage_total_num:
- type: integer
- type: object
- v2.GetTaskAnalysisDataResV2:
- properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v2.TaskAnalysisDataV2'
- type: object
- message:
- example: ok
- type: string
- type: object
- v2.GetWorkflowResV2:
- properties:
- code:
- example: 0
- type: integer
- data:
- $ref: '#/definitions/v2.WorkflowResV2'
- type: object
- message:
- example: ok
- type: string
- type: object
- v2.GetWorkflowTasksItemV2:
- properties:
- current_step_assignee_user_name_list:
- items:
- type: string
- type: array
- exec_end_time:
- type: string
- exec_start_time:
- type: string
- execution_user_name:
- type: string
- instance_maintenance_times:
- items:
- $ref: '#/definitions/v1.MaintenanceTimeResV1'
- type: array
- instance_name:
- type: string
- schedule_time:
- type: string
- status:
- enum:
- - wait_for_audit
- - wait_for_execution
- - exec_scheduled
- - exec_failed
- - exec_succeeded
- - executing
- - manually_executed
- - terminating
- - terminate_succeeded
- - terminate_failed
- type: string
- task_id:
- type: integer
- task_pass_rate:
- type: number
- task_score:
- type: integer
- type: object
- v2.GetWorkflowTasksResV2:
- properties:
- code:
- example: 0
- type: integer
- data:
- items:
- $ref: '#/definitions/v2.GetWorkflowTasksItemV2'
- type: array
- message:
- example: ok
- type: string
- type: object
- v2.InstanceResV2:
- properties:
- additional_params:
- items:
- $ref: '#/definitions/v1.InstanceAdditionalParamResV1'
- type: array
- db_host:
- example: 10.10.10.10
- type: string
- db_port:
- example: "3306"
- type: string
- db_type:
- example: mysql
- type: string
- db_user:
- example: root
- type: string
- desc:
- example: this is a instance
- type: string
- instance_name:
- type: string
- maintenance_times:
- items:
- $ref: '#/definitions/v1.MaintenanceTimeResV1'
- type: array
- rule_template:
- $ref: '#/definitions/v2.RuleTemplateV2'
- type: object
- source:
- example: SQLE
- type: string
- sql_query_config:
- $ref: '#/definitions/v1.SQLQueryConfigResV1'
- type: object
- type: object
- v2.PartialSyncAuditPlanSQLsReqV2:
- properties:
- audit_plan_sql_list:
- items:
- $ref: '#/definitions/v2.AuditPlanSQLReqV2'
- type: array
- type: object
- v2.PerformanceStatistics:
- properties:
- affect_rows:
- $ref: '#/definitions/v2.AffectRows'
- type: object
- type: object
- v2.RejectWorkflowReqV2:
- properties:
- reason:
- type: string
- type: object
- v2.RuleTemplateV2:
- properties:
- is_global_rule_template:
- type: boolean
- name:
- type: string
- type: object
- v2.SQLExplain:
- properties:
- classic_result:
- $ref: '#/definitions/v1.ExplainClassicResult'
- type: object
- err_message:
- type: string
- sql:
- type: string
- type: object
- v2.SqlManage:
- properties:
- assignees:
- items:
- type: string
- type: array
- audit_result:
- items:
- $ref: '#/definitions/v1.AuditResult'
- type: array
- endpoints:
- items:
- type: string
- type: array
- first_appear_timestamp:
- type: string
- fp_count:
- type: integer
- id:
- type: integer
- instance_name:
- type: string
- last_receive_timestamp:
- type: string
- remark:
- type: string
- schema_name:
- type: string
- source:
- $ref: '#/definitions/v1.Source'
- type: object
- sql:
- type: string
- sql_fingerprint:
- type: string
- status:
- enum:
- - unhandled
- - solved
- - ignored
- - manual_audited
- type: string
- type: object
- v2.TableMetas:
- properties:
- err_message:
- type: string
- table_meta_items:
- items:
- $ref: '#/definitions/v1.TableMeta'
- type: array
- type: object
- v2.TaskAnalysisDataV2:
- properties:
- performance_statistics:
- $ref: '#/definitions/v2.PerformanceStatistics'
- type: object
- sql_explain:
- $ref: '#/definitions/v2.SQLExplain'
- type: object
- table_metas:
- $ref: '#/definitions/v2.TableMetas'
- type: object
- type: object
- v2.UpdateWorkflowReqV2:
- properties:
- task_ids:
- items:
- type: integer
- type: array
- type: object
- v2.UpdateWorkflowScheduleReqV2:
- properties:
- schedule_time:
- type: string
- type: object
- v2.WorkflowRecordResV2:
- properties:
- current_step_number:
- type: integer
- status:
- enum:
- - wait_for_audit
- - wait_for_execution
- - rejected
- - canceled
- - exec_failed
- - executing
- - finished
- type: string
- tasks:
- items:
- $ref: '#/definitions/v2.WorkflowTaskItem'
- type: array
- workflow_step_list:
- items:
- $ref: '#/definitions/v2.WorkflowStepResV2'
- type: array
- type: object
- v2.WorkflowResV2:
- properties:
- create_time:
- type: string
- create_user_name:
- type: string
- desc:
- type: string
- mode:
- enum:
- - same_sqls
- - different_sqls
- type: string
- record:
- $ref: '#/definitions/v2.WorkflowRecordResV2'
- type: object
- record_history_list:
- items:
- $ref: '#/definitions/v2.WorkflowRecordResV2'
- type: array
- workflow_id:
- type: string
- workflow_name:
- type: string
- type: object
- v2.WorkflowStepResV2:
- properties:
- assignee_user_name_list:
- items:
- type: string
- type: array
- desc:
- type: string
- number:
- type: integer
- operation_time:
- type: string
- operation_user_name:
- type: string
- reason:
- type: string
- state:
- enum:
- - initialized
- - approved
- - rejected
- type: string
- type:
- enum:
- - create_workflow
- - update_workflow
- - sql_review
- - sql_execute
- type: string
- workflow_step_id:
- type: integer
- type: object
- v2.WorkflowTaskItem:
- properties:
- task_id:
- type: integer
- type: object
-info:
- contact: {}
- description: This is a sample server for dev.
- license: {}
- title: Sqle API Docs
- version: "1.0"
-paths:
- /v1/audit_files:
- post:
- description: Direct audit sql from SQL files and MyBatis files
- operationId: directAuditFilesV1
- parameters:
- - description: files that should be audited
- in: body
- name: req
- required: true
- schema:
- $ref: '#/definitions/v1.DirectAuditFileReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.DirectAuditResV1'
- security:
- - ApiKeyAuth: []
- summary: 直接从文件内容提取SQL并审核,SQL文件暂时只支持一次解析一个文件
- tags:
- - sql_audit
- /v1/audit_plan_metas:
- get:
- description: get audit plan metas
- operationId: getAuditPlanMetasV1
- parameters:
- - description: filter instance type
- in: query
- name: filter_instance_type
- type: string
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetAuditPlanMetasResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取扫描任务元信息
- tags:
- - audit_plan
- /v1/audit_plan_types:
- get:
- description: get audit plan types
- operationId: getAuditPlanTypesV1
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetAuditPlanTypesResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取扫描任务类型
- tags:
- - audit_plan
- /v1/basic_info:
- get:
- description: get sqle basic info
- operationId: getSQLEInfoV1
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetSQLEInfoResV1'
- summary: 获取 sqle 基本信息
- tags:
- - global
- /v1/company_notice:
- get:
- description: get company notice info
- operationId: getCompanyNotice
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetCompanyNoticeResp'
- security:
- - ApiKeyAuth: []
- summary: 获取企业公告
- tags:
- - companyNotice
- patch:
- consumes:
- - application/json
- description: update company notice info
- operationId: updateCompanyNotice
- parameters:
- - description: company notice
- in: body
- name: companyNotice
- required: true
- schema:
- $ref: '#/definitions/v1.UpdateCompanyNoticeReq'
- produces:
- - application/json
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 更新企业公告
- tags:
- - companyNotice
- /v1/configurations/ding_talk:
- get:
- description: get dingTalk configuration
- operationId: getDingTalkConfigurationV1
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetDingTalkConfigurationResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取 dingTalk 配置
- tags:
- - configuration
- patch:
- consumes:
- - application/json
- description: update DingTalk configuration
- operationId: updateDingTalkConfigurationV1
- parameters:
- - description: update DingTalk configuration req
- in: body
- name: instance
- required: true
- schema:
- $ref: '#/definitions/v1.UpdateDingTalkConfigurationReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 添加或更新 DingTalk 配置
- tags:
- - configuration
- /v1/configurations/ding_talk/test:
- post:
- consumes:
- - application/json
- description: test DingTalk configuration
- operationId: testDingTalkConfigV1
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.TestDingTalkConfigResV1'
- security:
- - ApiKeyAuth: []
- summary: 测试 DingTalk 配置
- tags:
- - configuration
- /v1/configurations/drivers:
- get:
- description: get drivers
- operationId: getDriversV1
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetDriversResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取当前 server 支持的审核类型
- tags:
- - configuration
- /v1/configurations/feishu:
- get:
- description: get feishu configuration
- operationId: getFeishuConfigurationV1
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetFeishuConfigurationResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取飞书配置
- tags:
- - configuration
- patch:
- consumes:
- - application/json
- description: update feishu configuration
- operationId: updateFeishuConfigurationV1
- parameters:
- - description: update feishu configuration req
- in: body
- name: param
- required: true
- schema:
- $ref: '#/definitions/v1.UpdateFeishuConfigurationReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 添加或更新飞书配置
- tags:
- - configuration
- /v1/configurations/feishu/test:
- post:
- consumes:
- - application/json
- description: test feishu configuration
- operationId: testFeishuConfigV1
- parameters:
- - description: test feishu configuration req
- in: body
- name: req
- required: true
- schema:
- $ref: '#/definitions/v1.TestFeishuConfigurationReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.TestFeishuConfigResV1'
- security:
- - ApiKeyAuth: []
- summary: 测试飞书配置
- tags:
- - configuration
- /v1/configurations/feishu_audit:
- get:
- description: get feishu audit configuration
- operationId: getFeishuAuditConfigurationV1
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetFeishuAuditConfigurationResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取飞书审核配置
- tags:
- - configuration
- patch:
- consumes:
- - application/json
- description: update feishu audit configuration
- operationId: updateFeishuAuditConfigurationV1
- parameters:
- - description: update feishu audit configuration req
- in: body
- name: param
- required: true
- schema:
- $ref: '#/definitions/v1.UpdateFeishuConfigurationReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 添加或更新飞书配置
- tags:
- - configuration
- /v1/configurations/feishu_audit/test:
- post:
- consumes:
- - application/json
- description: test feishu audit configuration
- operationId: testFeishuAuditConfigV1
- parameters:
- - description: test feishu configuration req
- in: body
- name: req
- required: true
- schema:
- $ref: '#/definitions/v1.TestFeishuConfigurationReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.TestFeishuConfigResV1'
- security:
- - ApiKeyAuth: []
- summary: 测试飞书审批配置
- tags:
- - configuration
- /v1/configurations/ldap:
- get:
- description: get LDAP configuration
- operationId: getLDAPConfigurationV1
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetLDAPConfigurationResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取 LDAP 配置
- tags:
- - configuration
- patch:
- consumes:
- - application/json
- description: update LDAP configuration
- operationId: updateLDAPConfigurationV1
- parameters:
- - description: update LDAP configuration req
- in: body
- name: instance
- required: true
- schema:
- $ref: '#/definitions/v1.LDAPConfigurationReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 添加 LDAP 配置
- tags:
- - configuration
- /v1/configurations/license:
- get:
- description: get sqle license
- operationId: getSQLELicenseV1
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetLicenseResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取 sqle license
- tags:
- - configuration
- post:
- consumes:
- - multipart/form-data
- description: set sqle license
- operationId: setSQLELicenseV1
- parameters:
- - description: SQLE license file
- in: formData
- name: license_file
- required: true
- type: file
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 导入 sqle license
- tags:
- - configuration
- /v1/configurations/license/check:
- post:
- consumes:
- - multipart/form-data
- description: parse and check sqle license
- operationId: checkSQLELicenseV1
- parameters:
- - description: SQLE license file
- in: formData
- name: license_file
- required: true
- type: file
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.CheckLicenseResV1'
- security:
- - ApiKeyAuth: []
- summary: 解析和校验 sqle license
- tags:
- - configuration
- /v1/configurations/license/info:
- get:
- description: get the information needed to generate the sqle license
- operationId: GetSQLELicenseInfoV1
- responses:
- "200":
- description: server info
- schema:
- type: file
- security:
- - ApiKeyAuth: []
- summary: 获取生成 sqle license需要的的信息
- tags:
- - configuration
- /v1/configurations/oauth2:
- get:
- description: get Oauth2 configuration
- operationId: getOauth2ConfigurationV1
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetOauth2ConfigurationResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取 Oauth2 配置
- tags:
- - configuration
- patch:
- consumes:
- - application/json
- description: update Oauth2 configuration
- operationId: updateOauth2ConfigurationV1
- parameters:
- - description: update Oauth2 configuration req
- in: body
- name: conf
- required: true
- schema:
- $ref: '#/definitions/v1.Oauth2ConfigurationReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 修改 Oauth2 配置
- tags:
- - configuration
- /v1/configurations/oauth2/tips:
- get:
- description: get Oauth2 tips
- operationId: getOauth2Tips
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetOauth2TipsResV1'
- summary: 获取 Oauth2 基本信息
- tags:
- - configuration
- /v1/configurations/personalise:
- patch:
- description: update personalise config
- operationId: personalise
- parameters:
- - description: personalise req
- in: body
- name: conf
- required: true
- schema:
- $ref: '#/definitions/v1.PersonaliseReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 更新个性化设置
- tags:
- - configuration
- /v1/configurations/personalise/logo:
- post:
- consumes:
- - multipart/form-data
- description: upload logo
- operationId: uploadLogo
- parameters:
- - description: logo file
- in: formData
- name: logo
- required: true
- type: file
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.UploadLogoResV1'
- security:
- - ApiKeyAuth: []
- summary: 上传Logo
- tags:
- - configuration
- /v1/configurations/smtp:
- get:
- description: get SMTP configuration
- operationId: getSMTPConfigurationV1
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetSMTPConfigurationResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取 SMTP 配置
- tags:
- - configuration
- patch:
- consumes:
- - application/json
- description: update SMTP configuration
- operationId: updateSMTPConfigurationV1
- parameters:
- - description: update SMTP configuration req
- in: body
- name: instance
- required: true
- schema:
- $ref: '#/definitions/v1.UpdateSMTPConfigurationReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 添加 SMTP 配置
- tags:
- - configuration
- /v1/configurations/smtp/test:
- post:
- consumes:
- - application/json
- description: test SMTP configuration
- operationId: testSMTPConfigurationV1
- parameters:
- - description: test SMTP configuration req
- in: body
- name: req
- required: true
- schema:
- $ref: '#/definitions/v1.TestSMTPConfigurationReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.TestSMTPConfigurationResV1'
- security:
- - ApiKeyAuth: []
- summary: 测试 邮箱 配置
- tags:
- - configuration
- /v1/configurations/sql_query:
- get:
- description: get sqle query configuration
- operationId: getSQLQueryConfiguration
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetSQLQueryConfigurationResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取SQL查询配置信息
- tags:
- - configuration
- /v1/configurations/system_variables:
- get:
- description: get system variables
- operationId: getSystemVariablesV1
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetSystemVariablesResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取系统变量
- tags:
- - configuration
- patch:
- consumes:
- - application/json
- description: update system variables
- operationId: updateSystemVariablesV1
- parameters:
- - description: update system variables request
- in: body
- name: instance
- required: true
- schema:
- $ref: '#/definitions/v1.UpdateSystemVariablesReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 修改系统变量
- tags:
- - configuration
- /v1/configurations/webhook:
- get:
- description: get workflow webhook config
- operationId: getGlobalWorkflowWebHookConfig
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetWorkflowWebHookConfigResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取全局工单 WebHook 配置
- tags:
- - configuration
- patch:
- description: update webhook config
- operationId: updateGlobalWebHookConfig
- parameters:
- - description: update webhook config
- in: body
- name: request
- required: true
- schema:
- $ref: '#/definitions/v1.WebHookConfigV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 更新工单 WebHook 配置
- tags:
- - configuration
- /v1/configurations/webhook/test:
- post:
- description: test workflow webhook config
- operationId: testGlobalWorkflowWebHookConfig
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.TestWorkflowWebHookConfigResV1'
- security:
- - ApiKeyAuth: []
- summary: 测试全局工单 WebHook 配置
- tags:
- - configuration
- /v1/configurations/wechat:
- get:
- description: get WeChat configuration
- operationId: getWeChatConfigurationV1
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetWeChatConfigurationResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取 企业微信 配置
- tags:
- - configuration
- patch:
- consumes:
- - application/json
- description: update WeChat configuration
- operationId: updateWeChatConfigurationV1
- parameters:
- - description: update WeChat configuration req
- in: body
- name: instance
- required: true
- schema:
- $ref: '#/definitions/v1.UpdateWeChatConfigurationReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 添加 企业微信 配置
- tags:
- - configuration
- /v1/configurations/wechat/test:
- post:
- consumes:
- - application/json
- description: test WeChat configuration
- operationId: testWeChatConfigurationV1
- parameters:
- - description: test WeChat configuration req
- in: body
- name: instance
- required: true
- schema:
- $ref: '#/definitions/v1.TestWeChatConfigurationReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.TestWeChatConfigurationResV1'
- security:
- - ApiKeyAuth: []
- summary: 测试 企业微信 配置
- tags:
- - configuration
- /v1/custom_rules:
- get:
- description: get all custom rule template
- operationId: getCustomRulesV1
- parameters:
- - description: filter db type
- in: query
- name: filter_db_type
- type: string
- - description: filter desc
- in: query
- name: filter_desc
- type: string
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetCustomRulesResV1'
- security:
- - ApiKeyAuth: []
- summary: 自定义规则列表
- tags:
- - rule_template
- post:
- description: create custom rule
- operationId: createCustomRuleV1
- parameters:
- - description: add custom rule
- in: body
- name: instance
- required: true
- schema:
- $ref: '#/definitions/v1.CreateCustomRuleReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 添加自定义规则
- tags:
- - rule_template
- /v1/custom_rules/{db_type}/rule_types:
- get:
- description: get rule type by db type
- operationId: getRuleTypeByDBTypeV1
- parameters:
- - description: db type
- in: query
- name: db_type
- required: true
- type: string
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetRuleTypeByDBTypeResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取规则分类
- tags:
- - rule_template
- /v1/custom_rules/{rule_id}:
- delete:
- description: delete custom rule
- operationId: deleteCustomRuleV1
- parameters:
- - description: rule id
- in: path
- name: rule_id
- required: true
- type: string
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 删除自定义规则
- tags:
- - rule_template
- get:
- description: get custom rule by rule_id
- operationId: getCustomRuleV1
- parameters:
- - description: rule id
- in: path
- name: rule_id
- required: true
- type: string
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetCustomRuleResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取自定义规则
- tags:
- - rule_template
- patch:
- description: update custom rule
- operationId: updateCustomRuleV1
- parameters:
- - description: rule id
- in: path
- name: rule_id
- required: true
- type: string
- - description: update custom rule
- in: body
- name: instance
- required: true
- schema:
- $ref: '#/definitions/v1.UpdateCustomRuleReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 更新自定义规则
- tags:
- - rule_template
- /v1/dashboard:
- get:
- description: get dashboard info
- operationId: getDashboardV1
- parameters:
- - description: filter project name
- in: query
- name: filter_project_name
- type: string
- produces:
- - application/json
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetDashboardResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取 dashboard 信息
- tags:
- - dashboard
- /v1/dashboard/project_tips:
- get:
- description: get dashboard project tips
- operationId: getDashboardProjectTipsV1
- produces:
- - application/json
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetDashboardProjectTipsResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取dashboard项目提示列表
- tags:
- - dashboard
- /v1/instance_additional_metas:
- get:
- description: get instance additional metas
- operationId: getInstanceAdditionalMetas
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetInstanceAdditionalMetasResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取实例的额外属性列表
- tags:
- - instance
- /v1/instance_connection:
- post:
- consumes:
- - application/json
- description: test instance db connection 注:可直接提交创建实例接口的body,该接口的json 内容是创建实例的
- json 的子集
- operationId: checkInstanceIsConnectableV1
- parameters:
- - description: instance info
- in: body
- name: instance
- required: true
- schema:
- $ref: '#/definitions/v1.GetInstanceConnectableReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetInstanceConnectableResV1'
- security:
- - ApiKeyAuth: []
- summary: 实例连通性测试(实例提交前)
- tags:
- - instance
- /v1/login:
- post:
- description: user login
- operationId: loginV1
- parameters:
- - description: user login request
- in: body
- name: user
- required: true
- schema:
- $ref: '#/definitions/v1.UserLoginReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetUserLoginResV1'
- summary: 用户登录
- tags:
- - user
- /v1/logout:
- post:
- description: user logout
- operationId: logoutV1
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- summary: 用户登出
- tags:
- - user
- /v1/management_permissions:
- get:
- description: get platform management permissions
- operationId: GetManagementPermissionsV1
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetManagementPermissionsResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取平台管理权限列表
- tags:
- - management_permission
- /v1/oauth2/link:
- get:
- description: oauth2 link
- operationId: Oauth2Link
- summary: oauth2通过此链接跳转到第三方登录网址
- tags:
- - oauth2
- /v1/oauth2/user/bind:
- post:
- description: bind Oauth2 user to sqle
- operationId: bindOauth2User
- parameters:
- - description: bind oauth2 user req
- in: body
- name: conf
- required: true
- schema:
- $ref: '#/definitions/v1.BindOauth2UserReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.BindOauth2UserResV1'
- summary: 绑定 Oauth2 和 sqle用户
- tags:
- - oauth2
- /v1/operation_records:
- get:
- description: Get operation record list
- operationId: getOperationRecordListV1
- parameters:
- - description: filter_operate_time_from
- in: query
- name: filter_operate_time_from
- type: string
- - description: filter_operate_time_to
- in: query
- name: filter_operate_time_to
- type: string
- - description: filter_operate_project_name
- in: query
- name: filter_operate_project_name
- type: string
- - description: fuzzy_search_operate_user_name
- in: query
- name: fuzzy_search_operate_user_name
- type: string
- - description: filter_operate_type_name
- in: query
- name: filter_operate_type_name
- type: string
- - description: filter_operate_action
- in: query
- name: filter_operate_action
- type: string
- - description: page_index
- in: query
- name: page_index
- required: true
- type: integer
- - description: page_size
- in: query
- name: page_size
- required: true
- type: integer
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetOperationRecordListResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取操作记录列表
- tags:
- - OperationRecord
- /v1/operation_records/exports:
- get:
- description: Export operation record list
- operationId: getExportOperationRecordListV1
- parameters:
- - description: filter_operate_time_from
- in: query
- name: filter_operate_time_from
- type: string
- - description: filter_operate_time_to
- in: query
- name: filter_operate_time_to
- type: string
- - description: filter_operate_project_name
- in: query
- name: filter_operate_project_name
- type: string
- - description: fuzzy_search_operate_user_name
- in: query
- name: fuzzy_search_operate_user_name
- type: string
- - description: filter_operate_type_name
- in: query
- name: filter_operate_type_name
- type: string
- - description: filter_operate_action
- in: query
- name: filter_operate_action
- type: string
- responses:
- "200":
- description: get export operation record list
- schema:
- type: file
- security:
- - ApiKeyAuth: []
- summary: 导出操作记录列表
- tags:
- - OperationRecord
- /v1/operation_records/operation_actions:
- get:
- description: Get operation action list
- operationId: getOperationActionList
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetOperationActionListResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取操作内容列表
- tags:
- - OperationRecord
- /v1/operation_records/operation_type_names:
- get:
- description: Get operation type name list
- operationId: GetOperationTypeNameList
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetOperationTypeNamesListResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取操作类型名列表
- tags:
- - OperationRecord
- /v1/operations:
- get:
- description: get permission operations
- operationId: GetOperationsV1
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetOperationsResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取权限动作列表
- tags:
- - operation
- /v1/project_tips:
- get:
- description: get project tip list
- operationId: getProjectTipsV1
- parameters:
- - description: functional module
- enum:
- - operation_record
- in: query
- name: functional_module
+ - create_workflow
+ - update_workflow
+ - sql_review
+ - sql_execute
type: string
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetProjectTipsResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取项目提示列表
- tags:
- - project
- /v1/projects:
- get:
- description: get project list
- operationId: getProjectListV1
- parameters:
- - description: page index
- in: query
- name: page_index
- required: true
+ workflow_step_id:
type: integer
- - default: 50
- description: size of per page
- in: query
- name: page_size
- required: true
+ type: object
+ v2.WorkflowTaskItem:
+ properties:
+ task_id:
type: integer
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetProjectResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取项目列表
- tags:
- - project
+ type: object
+info:
+ contact: {}
+ description: This is a sample server for dev.
+ license: {}
+ title: Sqle API Docs
+ version: "1.0"
+paths:
+ /v1/audit_files:
post:
- consumes:
- - application/json
- description: create project
- operationId: createProjectV1
+ description: Direct audit sql from SQL files and MyBatis files
+ operationId: directAuditFilesV1
parameters:
- - description: create project request
+ - description: files that should be audited
in: body
- name: project
+ name: req
required: true
schema:
- $ref: '#/definitions/v1.CreateProjectReqV1'
- produces:
- - application/json
+ $ref: '#/definitions/v1.DirectAuditFileReqV1'
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.DirectAuditResV1'
security:
- ApiKeyAuth: []
- summary: 创建项目
+ summary: 直接从文件内容提取SQL并审核,SQL文件暂时只支持一次解析一个文件
tags:
- - project
- /v1/projects/{project_name}/:
- delete:
- description: delete project
- operationId: deleteProjectV1
+ - sql_audit
+ /v1/audit_plan_metas:
+ get:
+ description: get audit plan metas
+ operationId: getAuditPlanMetasV1
parameters:
- - description: project name
- in: path
- name: project_name
- required: true
+ - description: filter instance type
+ in: query
+ name: filter_instance_type
type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetAuditPlanMetasResV1'
security:
- ApiKeyAuth: []
- summary: 删除项目
+ summary: 获取扫描任务元信息
tags:
- - project
+ - audit_plan
+ /v1/audit_plan_types:
get:
- description: get project detail
- operationId: getProjectDetailV1
- parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
+ description: get audit plan types
+ operationId: getAuditPlanTypesV1
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetProjectDetailResV1'
+ $ref: '#/definitions/v1.GetAuditPlanTypesResV1'
security:
- ApiKeyAuth: []
- summary: 获取项目详情
+ summary: 获取扫描任务类型
tags:
- - project
- patch:
- consumes:
- - application/json
- description: update project
- operationId: updateProjectV1
- parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: create project request
- in: body
- name: project
- required: true
- schema:
- $ref: '#/definitions/v1.UpdateProjectReqV1'
- produces:
- - application/json
+ - audit_plan
+ /v1/company_notice:
+ get:
+ description: get company notice info
+ operationId: getCompanyNotice
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetCompanyNoticeResp'
security:
- ApiKeyAuth: []
- summary: 更新项目
+ summary: 获取企业公告
tags:
- - project
- /v1/projects/{project_name}/archive:
- post:
+ - companyNotice
+ patch:
consumes:
- application/json
- description: archive project
- operationId: archiveProjectV1
+ description: update company notice info
+ operationId: updateCompanyNotice
parameters:
- - description: project name
- in: path
- name: project_name
+ - description: company notice
+ in: body
+ name: companyNotice
required: true
- type: string
+ schema:
+ $ref: '#/definitions/v1.UpdateCompanyNoticeReq'
produces:
- application/json
responses:
@@ -6457,97 +3793,35 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 归档项目
+ summary: 更新企业公告
tags:
- - project
- /v1/projects/{project_name}/audit_plans:
+ - companyNotice
+ /v1/configurations/ding_talk:
get:
- description: get audit plan info list
- operationId: getAuditPlansV1
- parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: filter audit plan db type
- in: query
- name: filter_audit_plan_db_type
- type: string
- - description: fuzzy search audit plan name
- in: query
- name: fuzzy_search_audit_plan_name
- type: string
- - description: filter audit plan type
- in: query
- name: filter_audit_plan_type
- type: string
- - description: filter audit plan instance name
- in: query
- name: filter_audit_plan_instance_name
- type: string
- - description: page index
- in: query
- name: page_index
- required: true
- type: integer
- - description: size of per page
- in: query
- name: page_size
- required: true
- type: integer
+ description: get dingTalk configuration
+ operationId: getDingTalkConfigurationV1
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetAuditPlansResV1'
+ $ref: '#/definitions/v1.GetDingTalkConfigurationResV1'
security:
- ApiKeyAuth: []
- summary: 获取扫描任务信息列表
+ summary: 获取 dingTalk 配置
tags:
- - audit_plan
- post:
+ - configuration
+ patch:
consumes:
- application/json
- description: create audit plan
- operationId: createAuditPlanV1
+ description: update DingTalk configuration
+ operationId: updateDingTalkConfigurationV1
parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: create audit plan
+ - description: update DingTalk configuration req
in: body
- name: audit_plan
+ name: instance
required: true
schema:
- $ref: '#/definitions/v1.CreateAuditPlanReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 添加扫描任务
- tags:
- - audit_plan
- /v1/projects/{project_name}/audit_plans/{audit_plan_name}/:
- delete:
- description: delete audit plan
- operationId: deleteAuditPlanV1
- parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: audit plan name
- in: path
- name: audit_plan_name
- required: true
- type: string
+ $ref: '#/definitions/v1.UpdateDingTalkConfigurationReqV1'
responses:
"200":
description: OK
@@ -6555,108 +3829,65 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 删除扫描任务
+ summary: 添加或更新 DingTalk 配置
tags:
- - audit_plan
- get:
- description: get audit plan
- operationId: getAuditPlanV1
- parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: audit plan name
- in: path
- name: audit_plan_name
- required: true
- type: string
+ - configuration
+ /v1/configurations/ding_talk/test:
+ post:
+ consumes:
+ - application/json
+ description: test DingTalk configuration
+ operationId: testDingTalkConfigV1
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetAuditPlanResV1'
+ $ref: '#/definitions/v1.TestDingTalkConfigResV1'
security:
- ApiKeyAuth: []
- summary: 获取指定扫描任务
- tags:
- - audit_plan
- patch:
- description: update audit plan
- operationId: updateAuditPlanV1
- parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: audit plan name
- in: path
- name: audit_plan_name
- required: true
- type: string
- - description: update audit plan
- in: body
- name: audit_plan
- required: true
- schema:
- $ref: '#/definitions/v1.UpdateAuditPlanReqV1'
+ summary: 测试 DingTalk 配置
+ tags:
+ - configuration
+ /v1/configurations/drivers:
+ get:
+ description: get drivers
+ operationId: getDriversV1
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetDriversResV1'
security:
- ApiKeyAuth: []
- summary: 更新扫描任务
+ summary: 获取当前 server 支持的审核类型
tags:
- - audit_plan
- /v1/projects/{project_name}/audit_plans/{audit_plan_name}/notify_config:
+ - configuration
+ /v1/configurations/feishu_audit:
get:
- description: get audit plan notify config
- operationId: getAuditPlanNotifyConfigV1
- parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: audit plan name
- in: path
- name: audit_plan_name
- required: true
- type: string
+ description: get feishu audit configuration
+ operationId: getFeishuAuditConfigurationV1
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetAuditPlanNotifyConfigResV1'
+ $ref: '#/definitions/v1.GetFeishuAuditConfigurationResV1'
security:
- ApiKeyAuth: []
- summary: 获取扫描任务消息推送设置
+ summary: 获取飞书审核配置
tags:
- - audit_plan
+ - configuration
patch:
- description: update audit plan notify config
- operationId: updateAuditPlanNotifyConfigV1
+ consumes:
+ - application/json
+ description: update feishu audit configuration
+ operationId: updateFeishuAuditConfigurationV1
parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: audit plan name
- in: path
- name: audit_plan_name
- required: true
- type: string
- - description: update audit plan notify config
+ - description: update feishu audit configuration req
in: body
- name: config
+ name: param
required: true
schema:
- $ref: '#/definitions/v1.UpdateAuditPlanNotifyConfigReqV1'
+ $ref: '#/definitions/v1.UpdateFeishuConfigurationReqV1'
responses:
"200":
description: OK
@@ -6664,261 +3895,129 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 更新扫描任务通知设置
+ summary: 添加或更新飞书配置
tags:
- - audit_plan
- /v1/projects/{project_name}/audit_plans/{audit_plan_name}/notify_config/test:
- get:
- description: Test audit task message push
- operationId: testAuditPlanNotifyConfigV1
+ - configuration
+ /v1/configurations/feishu_audit/test:
+ post:
+ consumes:
+ - application/json
+ description: test feishu audit configuration
+ operationId: testFeishuAuditConfigV1
parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: audit plan name
- in: path
- name: audit_plan_name
+ - description: test feishu configuration req
+ in: body
+ name: req
required: true
- type: string
+ schema:
+ $ref: '#/definitions/v1.TestFeishuConfigurationReqV1'
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.TestAuditPlanNotifyConfigResV1'
+ $ref: '#/definitions/v1.TestFeishuConfigResV1'
security:
- ApiKeyAuth: []
- summary: 测试扫描任务消息推送
+ summary: 测试飞书审批配置
tags:
- - audit_plan
- /v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports:
+ - configuration
+ /v1/configurations/license:
get:
- description: get audit plan report list
- operationId: getAuditPlanReportsV1
- parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: audit plan name
- in: path
- name: audit_plan_name
- required: true
- type: string
- - description: page index
- in: query
- name: page_index
- required: true
- type: integer
- - description: size of per page
- in: query
- name: page_size
- required: true
- type: integer
+ description: get sqle license
+ operationId: getSQLELicenseV1
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetAuditPlanReportsResV1'
+ $ref: '#/definitions/v1.GetLicenseResV1'
security:
- ApiKeyAuth: []
- summary: 获取指定扫描任务的报告列表
+ summary: 获取 sqle license
tags:
- - audit_plan
- /v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/:
- get:
- description: get audit plan report
- operationId: getAuditPlanReportV1
+ - configuration
+ post:
+ consumes:
+ - multipart/form-data
+ description: set sqle license
+ operationId: setSQLELicenseV1
parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: audit plan name
- in: path
- name: audit_plan_name
- required: true
- type: string
- - description: audit plan report id
- in: path
- name: audit_plan_report_id
+ - description: SQLE license file
+ in: formData
+ name: license_file
required: true
- type: string
+ type: file
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetAuditPlanReportResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取指定扫描任务的SQL扫描记录统计信息
- tags:
- - audit_plan
- /v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/export:
- get:
- description: export audit plan report as csv
- operationId: exportAuditPlanReportV1
- parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: audit plan name
- in: path
- name: audit_plan_name
- required: true
- type: string
- - description: audit plan report id
- in: path
- name: audit_plan_report_id
- required: true
- type: string
- responses:
- "200":
- description: get export audit plan report
- schema:
- type: file
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 以csv的形式导出扫描报告
+ summary: 导入 sqle license
tags:
- - audit_plan
- /v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls:
- get:
- description: get audit plan report SQLs
- operationId: getAuditPlanReportsSQLsV1
+ - configuration
+ /v1/configurations/license/check:
+ post:
+ consumes:
+ - multipart/form-data
+ description: parse and check sqle license
+ operationId: checkSQLELicenseV1
parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: audit plan name
- in: path
- name: audit_plan_name
- required: true
- type: string
- - description: audit plan report id
- in: path
- name: audit_plan_report_id
- required: true
- type: string
- - description: page index
- in: query
- name: page_index
- required: true
- type: integer
- - description: size of per page
- in: query
- name: page_size
+ - description: SQLE license file
+ in: formData
+ name: license_file
required: true
- type: integer
+ type: file
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetAuditPlanReportSQLsResV1'
+ $ref: '#/definitions/v1.CheckLicenseResV1'
security:
- ApiKeyAuth: []
- summary: 获取指定扫描任务的SQL扫描详情
- tags:
- - audit_plan
- /v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls/{number}/analysis:
- get:
- description: get SQL explain and related table metadata for analysis
- operationId: getTaskAnalysisData
- parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: audit plan name
- in: path
- name: audit_plan_name
- required: true
- type: string
- - description: audit plan report id
- in: path
- name: audit_plan_report_id
- required: true
- type: string
- - description: sql number
- in: path
- name: number
- required: true
- type: string
+ summary: 解析和校验 sqle license
+ tags:
+ - configuration
+ /v1/configurations/license/info:
+ get:
+ description: get the information needed to generate the sqle license
+ operationId: GetSQLELicenseInfoV1
responses:
"200":
- description: OK
+ description: server info
schema:
- $ref: '#/definitions/v1.GetAuditPlanAnalysisDataResV1'
+ type: file
security:
- ApiKeyAuth: []
- summary: 获取task相关的SQL执行计划和表元数据
+ summary: 获取生成 sqle license需要的的信息
tags:
- - audit_plan
- /v1/projects/{project_name}/audit_plans/{audit_plan_name}/sqls:
+ - configuration
+ /v1/configurations/system_variables:
get:
- description: get audit plan SQLs
- operationId: getAuditPlanSQLsV1
- parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: audit plan name
- in: path
- name: audit_plan_name
- required: true
- type: string
- - description: page index
- in: query
- name: page_index
- required: true
- type: integer
- - description: size of per page
- in: query
- name: page_size
- required: true
- type: integer
+ description: get system variables
+ operationId: getSystemVariablesV1
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetAuditPlanSQLsResV1'
+ $ref: '#/definitions/v1.GetSystemVariablesResV1'
security:
- ApiKeyAuth: []
- summary: 获取指定扫描任务的SQLs信息(不包括扫描结果)
+ summary: 获取系统变量
tags:
- - audit_plan
- /v1/projects/{project_name}/audit_plans/{audit_plan_name}/sqls/full:
- post:
- deprecated: true
- description: full sync audit plan SQLs
- operationId: fullSyncAuditPlanSQLsV1
+ - configuration
+ patch:
+ consumes:
+ - application/json
+ description: update system variables
+ operationId: updateSystemVariablesV1
parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: audit plan name
- in: path
- name: audit_plan_name
- required: true
- type: string
- - description: full sync audit plan SQLs request
+ - description: update system variables request
in: body
- name: sqls
+ name: instance
required: true
schema:
- $ref: '#/definitions/v1.FullSyncAuditPlanSQLsReqV1'
+ $ref: '#/definitions/v1.UpdateSystemVariablesReqV1'
responses:
"200":
description: OK
@@ -6926,113 +4025,82 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 全量同步SQL到扫描任务
+ summary: 修改系统变量
tags:
- - audit_plan
- /v1/projects/{project_name}/audit_plans/{audit_plan_name}/sqls/partial:
- post:
- deprecated: true
- description: partial sync audit plan SQLs
- operationId: partialSyncAuditPlanSQLsV1
+ - configuration
+ /v1/custom_rules:
+ get:
+ description: get all custom rule template
+ operationId: getCustomRulesV1
parameters:
- - description: project name
- in: path
- name: project_name
- required: true
+ - description: filter db type
+ in: query
+ name: filter_db_type
type: string
- - description: audit plan name
- in: path
- name: audit_plan_name
- required: true
+ - description: filter desc
+ in: query
+ name: filter_desc
type: string
- - description: partial sync audit plan SQLs request
- in: body
- name: sqls
- required: true
- schema:
- $ref: '#/definitions/v1.PartialSyncAuditPlanSQLsReqV1'
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetCustomRulesResV1'
security:
- ApiKeyAuth: []
- summary: 增量同步SQL到扫描任务
+ summary: 自定义规则列表
tags:
- - audit_plan
- /v1/projects/{project_name}/audit_plans/{audit_plan_name}/trigger:
+ - rule_template
post:
- description: trigger audit plan
- operationId: triggerAuditPlanV1
+ description: create custom rule
+ operationId: createCustomRuleV1
parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: audit plan name
- in: path
- name: audit_plan_name
+ - description: add custom rule
+ in: body
+ name: instance
required: true
- type: string
+ schema:
+ $ref: '#/definitions/v1.CreateCustomRuleReqV1'
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.TriggerAuditPlanResV1'
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 触发扫描任务
+ summary: 添加自定义规则
tags:
- - audit_plan
- /v1/projects/{project_name}/audit_whitelist:
+ - rule_template
+ /v1/custom_rules/{db_type}/rule_types:
get:
- description: get all whitelist
- operationId: getAuditWhitelistV1
+ description: get rule type by db type
+ operationId: getRuleTypeByDBTypeV1
parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: page index
- in: query
- name: page_index
- required: true
- type: string
- - description: page size
+ - description: db type
in: query
- name: page_size
+ name: db_type
required: true
type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetAuditWhitelistResV1'
+ $ref: '#/definitions/v1.GetRuleTypeByDBTypeResV1'
security:
- ApiKeyAuth: []
- summary: 获取Sql审核白名单
+ summary: 获取规则分类
tags:
- - audit_whitelist
- post:
- consumes:
- - application/json
- description: create a sql whitelist
- operationId: createAuditWhitelistV1
+ - rule_template
+ /v1/custom_rules/{rule_id}:
+ delete:
+ description: delete custom rule
+ operationId: deleteCustomRuleV1
parameters:
- - description: project name
+ - description: rule id
in: path
- name: project_name
+ name: rule_id
required: true
type: string
- - description: add sql whitelist req
- in: body
- name: instance
- required: true
- schema:
- $ref: '#/definitions/v1.CreateAuditWhitelistReqV1'
responses:
"200":
description: OK
@@ -7040,56 +4108,43 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 添加SQL白名单
+ summary: 删除自定义规则
tags:
- - audit_whitelist
- /v1/projects/{project_name}/audit_whitelist/{audit_whitelist_id}/:
- delete:
- description: remove sql white
- operationId: deleteAuditWhitelistByIdV1
+ - rule_template
+ get:
+ description: get custom rule by rule_id
+ operationId: getCustomRuleV1
parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: audit whitelist id
+ - description: rule id
in: path
- name: audit_whitelist_id
+ name: rule_id
required: true
type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetCustomRuleResV1'
security:
- ApiKeyAuth: []
- summary: 删除SQL白名单信息
+ summary: 获取自定义规则
tags:
- - audit_whitelist
+ - rule_template
patch:
- consumes:
- - application/json
- description: update sql whitelist by id
- operationId: UpdateAuditWhitelistByIdV1
+ description: update custom rule
+ operationId: updateCustomRuleV1
parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: sql audit whitelist id
+ - description: rule id
in: path
- name: audit_whitelist_id
+ name: rule_id
required: true
type: string
- - description: update sql whitelist req
+ - description: update custom rule
in: body
name: instance
required: true
schema:
- $ref: '#/definitions/v1.UpdateAuditWhitelistReqV1'
+ $ref: '#/definitions/v1.UpdateCustomRuleReqV1'
responses:
"200":
description: OK
@@ -7097,85 +4152,65 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 更新SQL白名单
+ summary: 更新自定义规则
tags:
- - audit_whitelist
- /v1/projects/{project_name}/instance_tips:
+ - rule_template
+ /v1/dashboard:
get:
- description: get instance tip list
- operationId: getInstanceTipListV1
- parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: filter db type
- in: query
- name: filter_db_type
- type: string
- - description: filter workflow template id
- in: query
- name: filter_workflow_template_id
- type: string
- - description: functional module
- enum:
- - create_audit_plan
- - create_workflow
- - sql_manage
+ description: get dashboard info
+ operationId: getDashboardV1
+ parameters:
+ - description: filter project name
in: query
- name: functional_module
+ name: filter_project_name
type: string
+ produces:
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetInstanceTipsResV1'
+ $ref: '#/definitions/v1.GetDashboardResV1'
security:
- ApiKeyAuth: []
- summary: 获取实例提示列表
+ summary: 获取 dashboard 信息
tags:
- - instance
- /v1/projects/{project_name}/instances:
+ - dashboard
+ /v1/operation_records:
get:
- description: get instance info list
- operationId: getInstanceListV1
+ description: Get operation record list
+ operationId: getOperationRecordListV1
parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: filter instance name
+ - description: filter_operate_time_from
in: query
- name: filter_instance_name
+ name: filter_operate_time_from
type: string
- - description: filter db type
+ - description: filter_operate_time_to
in: query
- name: filter_db_type
+ name: filter_operate_time_to
type: string
- - description: filter db host
+ - description: filter_operate_project_name
in: query
- name: filter_db_host
+ name: filter_operate_project_name
type: string
- - description: filter db port
+ - description: fuzzy_search_operate_user_name
in: query
- name: filter_db_port
+ name: fuzzy_search_operate_user_name
type: string
- - description: filter db user
+ - description: filter_operate_type_name
in: query
- name: filter_db_user
+ name: filter_operate_type_name
type: string
- - description: filter rule template name
+ - description: filter_operate_action
in: query
- name: filter_rule_template_name
+ name: filter_operate_action
type: string
- - description: page index
+ - description: page_index
in: query
name: page_index
required: true
type: integer
- - description: size of per page
+ - description: page_size
in: query
name: page_size
required: true
@@ -7184,342 +4219,290 @@ paths:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetInstancesResV1'
+ $ref: '#/definitions/v1.GetOperationRecordListResV1'
security:
- ApiKeyAuth: []
- summary: 获取实例信息列表
+ summary: 获取操作记录列表
tags:
- - instance
- post:
- consumes:
- - application/json
- deprecated: true
- description: create a instance
- operationId: createInstanceV1
+ - OperationRecord
+ /v1/operation_records/exports:
+ get:
+ description: Export operation record list
+ operationId: getExportOperationRecordListV1
parameters:
- - description: project name
- in: path
- name: project_name
- required: true
+ - description: filter_operate_time_from
+ in: query
+ name: filter_operate_time_from
type: string
- - description: add instance
- in: body
- name: instance
- required: true
- schema:
- $ref: '#/definitions/v1.CreateInstanceReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 添加实例
- tags:
- - instance
- /v1/projects/{project_name}/instances/{instance_name}/:
- delete:
- description: delete instance db
- operationId: deleteInstanceV1
- parameters:
- - description: project name
- in: path
- name: project_name
- required: true
+ - description: filter_operate_time_to
+ in: query
+ name: filter_operate_time_to
type: string
- - description: instance name
- in: path
- name: instance_name
- required: true
+ - description: filter_operate_project_name
+ in: query
+ name: filter_operate_project_name
+ type: string
+ - description: fuzzy_search_operate_user_name
+ in: query
+ name: fuzzy_search_operate_user_name
+ type: string
+ - description: filter_operate_type_name
+ in: query
+ name: filter_operate_type_name
+ type: string
+ - description: filter_operate_action
+ in: query
+ name: filter_operate_action
type: string
responses:
"200":
- description: OK
+ description: get export operation record list
schema:
- $ref: '#/definitions/controller.BaseRes'
+ type: file
security:
- ApiKeyAuth: []
- summary: 删除实例
+ summary: 导出操作记录列表
tags:
- - instance
+ - OperationRecord
+ /v1/operation_records/operation_actions:
get:
- description: get instance db
- operationId: getInstanceV1
- parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: instance name
- in: path
- name: instance_name
- required: true
- type: string
+ description: Get operation action list
+ operationId: getOperationActionList
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetInstanceResV1'
+ $ref: '#/definitions/v1.GetOperationActionListResV1'
security:
- ApiKeyAuth: []
- summary: 获取实例信息
+ summary: 获取操作内容列表
tags:
- - instance
- patch:
- description: update instance
- operationId: updateInstanceV1
- parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: instance name
- in: path
- name: instance_name
- required: true
- type: string
- - description: update instance request
- in: body
- name: instance
- required: true
- schema:
- $ref: '#/definitions/v1.UpdateInstanceReqV1'
+ - OperationRecord
+ /v1/operation_records/operation_type_names:
+ get:
+ description: Get operation type name list
+ operationId: GetOperationTypeNameList
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetOperationTypeNamesListResV1'
security:
- ApiKeyAuth: []
- summary: 更新实例
+ summary: 获取操作类型名列表
tags:
- - instance
- /v1/projects/{project_name}/instances/{instance_name}/connection:
+ - OperationRecord
+ /v1/operations:
get:
- description: test instance db connection
- operationId: checkInstanceIsConnectableByNameV1
- parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: instance name
- in: path
- name: instance_name
- required: true
- type: string
+ description: get permission operations
+ operationId: GetOperationsV1
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetInstanceConnectableResV1'
+ $ref: '#/definitions/v1.GetOperationsResV1'
security:
- ApiKeyAuth: []
- summary: 实例连通性测试(实例提交后)
+ summary: 获取权限动作列表
tags:
- - instance
- /v1/projects/{project_name}/instances/{instance_name}/rules:
+ - operation
+ /v1/projects/{project_name}/audit_plans:
get:
- description: get instance all rule
- operationId: getInstanceRuleListV1
+ description: get audit plan info list
+ operationId: getAuditPlansV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: instance name
- in: path
- name: instance_name
- required: true
+ - description: filter audit plan db type
+ in: query
+ name: filter_audit_plan_db_type
+ type: string
+ - description: fuzzy search audit plan name
+ in: query
+ name: fuzzy_search_audit_plan_name
+ type: string
+ - description: filter audit plan type
+ in: query
+ name: filter_audit_plan_type
+ type: string
+ - description: filter audit plan instance name
+ in: query
+ name: filter_audit_plan_instance_name
type: string
+ - description: page index
+ in: query
+ name: page_index
+ required: true
+ type: integer
+ - description: size of per page
+ in: query
+ name: page_size
+ required: true
+ type: integer
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetRulesResV1'
+ $ref: '#/definitions/v1.GetAuditPlansResV1'
security:
- ApiKeyAuth: []
- summary: 获取实例应用的规则列表
+ summary: 获取扫描任务信息列表
tags:
- - instance
- /v1/projects/{project_name}/instances/{instance_name}/schemas:
- get:
- description: instance schema list
- operationId: getInstanceSchemasV1
+ - audit_plan
+ post:
+ consumes:
+ - application/json
+ description: create audit plan
+ operationId: createAuditPlanV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: instance name
- in: path
- name: instance_name
+ - description: create audit plan
+ in: body
+ name: audit_plan
required: true
- type: string
+ schema:
+ $ref: '#/definitions/v1.CreateAuditPlanReqV1'
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetInstanceSchemaResV1'
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 实例 Schema 列表
+ summary: 添加扫描任务
tags:
- - instance
- /v1/projects/{project_name}/instances/{instance_name}/schemas/{schema_name}/tables:
- get:
- description: list table by schema
- operationId: listTableBySchema
- parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: instance name
+ - audit_plan
+ /v1/projects/{project_name}/audit_plans/{audit_plan_name}/:
+ delete:
+ description: delete audit plan
+ operationId: deleteAuditPlanV1
+ parameters:
+ - description: project name
in: path
- name: instance_name
+ name: project_name
required: true
type: string
- - description: schema name
+ - description: audit plan name
in: path
- name: schema_name
+ name: audit_plan_name
required: true
type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.ListTableBySchemaResV1'
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 获取数据库下的所有表
+ summary: 删除扫描任务
tags:
- - instance
- /v1/projects/{project_name}/instances/{instance_name}/schemas/{schema_name}/tables/{table_name}/metadata:
+ - audit_plan
get:
- description: get table metadata
- operationId: getTableMetadata
+ description: get audit plan
+ operationId: getAuditPlanV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: instance name
- in: path
- name: instance_name
- required: true
- type: string
- - description: schema name
- in: path
- name: schema_name
- required: true
- type: string
- - description: table name
+ - description: audit plan name
in: path
- name: table_name
+ name: audit_plan_name
required: true
type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetTableMetadataResV1'
+ $ref: '#/definitions/v1.GetAuditPlanResV1'
security:
- ApiKeyAuth: []
- summary: 获取表元数据
+ summary: 获取指定扫描任务
tags:
- - instance
- /v1/projects/{project_name}/instances/connections:
- post:
- description: batch test instance db connections
- operationId: batchCheckInstanceIsConnectableByName
+ - audit_plan
+ patch:
+ description: update audit plan
+ operationId: updateAuditPlanV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: instances
+ - description: audit plan name
+ in: path
+ name: audit_plan_name
+ required: true
+ type: string
+ - description: update audit plan
in: body
- name: instances
+ name: audit_plan
required: true
schema:
- $ref: '#/definitions/v1.BatchCheckInstanceConnectionsReqV1'
+ $ref: '#/definitions/v1.UpdateAuditPlanReqV1'
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.BatchGetInstanceConnectionsResV1'
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 批量测试实例连通性(实例提交后)
+ summary: 更新扫描任务
tags:
- - instance
- /v1/projects/{project_name}/member_groups:
+ - audit_plan
+ /v1/projects/{project_name}/audit_plans/{audit_plan_name}/notify_config:
get:
- description: get member groups
- operationId: getMemberGroupsV1
+ description: get audit plan notify config
+ operationId: getAuditPlanNotifyConfigV1
parameters:
- - description: filter user group name
- in: query
- name: filter_user_group_name
- type: string
- - description: filter instance name
- in: query
- name: filter_instance_name
- type: string
- - description: page index
- in: query
- name: page_index
- required: true
- type: integer
- - description: size of per page
- in: query
- name: page_size
- required: true
- type: integer
- description: project name
in: path
name: project_name
required: true
type: string
+ - description: audit plan name
+ in: path
+ name: audit_plan_name
+ required: true
+ type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetMemberGroupsRespV1'
+ $ref: '#/definitions/v1.GetAuditPlanNotifyConfigResV1'
security:
- ApiKeyAuth: []
- summary: 获取成员组列表
+ summary: 获取扫描任务消息推送设置
tags:
- - user_group
- post:
- consumes:
- - application/json
- description: add member group
- operationId: addMemberGroupV1
+ - audit_plan
+ patch:
+ description: update audit plan notify config
+ operationId: updateAuditPlanNotifyConfigV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: add member group
+ - description: audit plan name
+ in: path
+ name: audit_plan_name
+ required: true
+ type: string
+ - description: update audit plan notify config
in: body
- name: data
+ name: config
required: true
schema:
- $ref: '#/definitions/v1.CreateMemberGroupReqV1'
- produces:
- - application/json
+ $ref: '#/definitions/v1.UpdateAuditPlanNotifyConfigReqV1'
responses:
"200":
description: OK
@@ -7527,124 +4510,148 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 添加成员组
+ summary: 更新扫描任务通知设置
tags:
- - user_group
- /v1/projects/{project_name}/member_groups/{user_group_name}/:
- delete:
- description: delete member group
- operationId: deleteMemberGroupV1
+ - audit_plan
+ /v1/projects/{project_name}/audit_plans/{audit_plan_name}/notify_config/test:
+ get:
+ description: Test audit task message push
+ operationId: testAuditPlanNotifyConfigV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: user group name
+ - description: audit plan name
in: path
- name: user_group_name
+ name: audit_plan_name
required: true
type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.TestAuditPlanNotifyConfigResV1'
security:
- ApiKeyAuth: []
- summary: 删除成员组
+ summary: 测试扫描任务消息推送
tags:
- - user_group
+ - audit_plan
+ /v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports:
get:
- description: get member group
- operationId: getMemberGroupV1
+ description: get audit plan report list
+ operationId: getAuditPlanReportsV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: user group name
+ - description: audit plan name
in: path
- name: user_group_name
+ name: audit_plan_name
required: true
type: string
+ - description: page index
+ in: query
+ name: page_index
+ required: true
+ type: integer
+ - description: size of per page
+ in: query
+ name: page_size
+ required: true
+ type: integer
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetMemberGroupRespV1'
+ $ref: '#/definitions/v1.GetAuditPlanReportsResV1'
security:
- ApiKeyAuth: []
- summary: 获取成员组信息
+ summary: 获取指定扫描任务的报告列表
tags:
- - user_group
- patch:
- consumes:
- - application/json
- description: update member group
- operationId: updateMemberGroupV1
+ - audit_plan
+ /v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/:
+ get:
+ description: get audit plan report
+ operationId: getAuditPlanReportV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: user group name
+ - description: audit plan name
in: path
- name: user_group_name
+ name: audit_plan_name
required: true
type: string
- - description: update member_group
- in: body
- name: data
+ - description: audit plan report id
+ in: path
+ name: audit_plan_report_id
required: true
- schema:
- $ref: '#/definitions/v1.UpdateMemberGroupReqV1'
- produces:
- - application/json
+ type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetAuditPlanReportResV1'
security:
- ApiKeyAuth: []
- summary: 修改成员组
+ summary: 获取指定扫描任务的SQL扫描记录统计信息
tags:
- - user_group
- /v1/projects/{project_name}/member_tips:
+ - audit_plan
+ /v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/export:
get:
- description: get member tip list
- operationId: getMemberTipListV1
+ description: export audit plan report as csv
+ operationId: exportAuditPlanReportV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
+ - description: audit plan name
+ in: path
+ name: audit_plan_name
+ required: true
+ type: string
+ - description: audit plan report id
+ in: path
+ name: audit_plan_report_id
+ required: true
+ type: string
responses:
"200":
- description: OK
+ description: get export audit plan report
schema:
- $ref: '#/definitions/v1.GetMemberTipsResV1'
+ type: file
security:
- ApiKeyAuth: []
- summary: 获取成员提示列表
+ summary: 以csv的形式导出扫描报告
tags:
- - user
- /v1/projects/{project_name}/members:
+ - audit_plan
+ /v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls:
get:
- description: get members
- operationId: getMembersV1
+ description: get audit plan report SQLs
+ operationId: getAuditPlanReportsSQLsV1
parameters:
- - description: filter user name
- in: query
- name: filter_user_name
+ - description: project name
+ in: path
+ name: project_name
+ required: true
type: string
- - description: filter instance name
- in: query
- name: filter_instance_name
+ - description: audit plan name
+ in: path
+ name: audit_plan_name
+ required: true
+ type: string
+ - description: audit plan report id
+ in: path
+ name: audit_plan_report_id
+ required: true
type: string
- description: page index
in: query
@@ -7656,123 +4663,140 @@ paths:
name: page_size
required: true
type: integer
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetMembersRespV1'
+ $ref: '#/definitions/v1.GetAuditPlanReportSQLsResV1'
security:
- ApiKeyAuth: []
- summary: 获取成员列表
+ summary: 获取指定扫描任务的SQL扫描详情
tags:
- - user
- post:
- consumes:
- - application/json
- description: add member
- operationId: addMemberV1
+ - audit_plan
+ /v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls/{number}/analysis:
+ get:
+ description: get SQL explain and related table metadata for analysis
+ operationId: getTaskAnalysisData
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: add member
- in: body
- name: data
+ - description: audit plan name
+ in: path
+ name: audit_plan_name
required: true
- schema:
- $ref: '#/definitions/v1.CreateMemberReqV1'
- produces:
- - application/json
+ type: string
+ - description: audit plan report id
+ in: path
+ name: audit_plan_report_id
+ required: true
+ type: string
+ - description: sql number
+ in: path
+ name: number
+ required: true
+ type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetAuditPlanAnalysisDataResV1'
security:
- ApiKeyAuth: []
- summary: 添加成员
+ summary: 获取task相关的SQL执行计划和表元数据
tags:
- - user
- /v1/projects/{project_name}/members/{user_name}/:
- delete:
- description: delete member
- operationId: deleteMemberV1
+ - audit_plan
+ /v1/projects/{project_name}/audit_plans/{audit_plan_name}/sqls:
+ get:
+ description: get audit plan SQLs
+ operationId: getAuditPlanSQLsV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: user name
+ - description: audit plan name
in: path
- name: user_name
+ name: audit_plan_name
+ required: true
+ type: string
+ - description: page index
+ in: query
+ name: page_index
+ required: true
+ type: integer
+ - description: size of per page
+ in: query
+ name: page_size
required: true
- type: string
+ type: integer
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetAuditPlanSQLsResV1'
security:
- ApiKeyAuth: []
- summary: 删除成员
+ summary: 获取指定扫描任务的SQLs信息(不包括扫描结果)
tags:
- - user
- get:
- description: get member
- operationId: getMemberV1
+ - audit_plan
+ /v1/projects/{project_name}/audit_plans/{audit_plan_name}/sqls/full:
+ post:
+ deprecated: true
+ description: full sync audit plan SQLs
+ operationId: fullSyncAuditPlanSQLsV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: user name
+ - description: audit plan name
in: path
- name: user_name
+ name: audit_plan_name
required: true
type: string
+ - description: full sync audit plan SQLs request
+ in: body
+ name: sqls
+ required: true
+ schema:
+ $ref: '#/definitions/v1.FullSyncAuditPlanSQLsReqV1'
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetMemberRespV1'
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 获取成员信息
+ summary: 全量同步SQL到扫描任务
tags:
- - user
- patch:
- consumes:
- - application/json
- description: update member
- operationId: updateMemberV1
+ - audit_plan
+ /v1/projects/{project_name}/audit_plans/{audit_plan_name}/sqls/partial:
+ post:
+ deprecated: true
+ description: partial sync audit plan SQLs
+ operationId: partialSyncAuditPlanSQLsV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: user name
+ - description: audit plan name
in: path
- name: user_name
+ name: audit_plan_name
required: true
type: string
- - description: update member
+ - description: partial sync audit plan SQLs request
in: body
- name: data
+ name: sqls
required: true
schema:
- $ref: '#/definitions/v1.UpdateMemberReqV1'
- produces:
- - application/json
+ $ref: '#/definitions/v1.PartialSyncAuditPlanSQLsReqV1'
responses:
"200":
description: OK
@@ -7780,37 +4804,38 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 修改成员
+ summary: 增量同步SQL到扫描任务
tags:
- - user
- /v1/projects/{project_name}/rule_template_tips:
- get:
- description: get rule template tips in project
- operationId: getProjectRuleTemplateTipsV1
+ - audit_plan
+ /v1/projects/{project_name}/audit_plans/{audit_plan_name}/trigger:
+ post:
+ description: trigger audit plan
+ operationId: triggerAuditPlanV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: filter db type
- in: query
- name: filter_db_type
+ - description: audit plan name
+ in: path
+ name: audit_plan_name
+ required: true
type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetRuleTemplateTipsResV1'
+ $ref: '#/definitions/v1.TriggerAuditPlanResV1'
security:
- ApiKeyAuth: []
- summary: 获取项目规则模板提示
+ summary: 触发扫描任务
tags:
- - rule_template
- /v1/projects/{project_name}/rule_templates:
+ - audit_plan
+ /v1/projects/{project_name}/audit_whitelist:
get:
- description: get all rule template in a project
- operationId: getProjectRuleTemplateListV1
+ description: get all whitelist
+ operationId: getAuditWhitelistV1
parameters:
- description: project name
in: path
@@ -7821,39 +4846,39 @@ paths:
in: query
name: page_index
required: true
- type: integer
- - description: size of per page
+ type: string
+ - description: page size
in: query
name: page_size
required: true
- type: integer
+ type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetProjectRuleTemplatesResV1'
+ $ref: '#/definitions/v1.GetAuditWhitelistResV1'
security:
- ApiKeyAuth: []
- summary: 项目规则模板列表
+ summary: 获取Sql审核白名单
tags:
- - rule_template
+ - audit_whitelist
post:
consumes:
- application/json
- description: create a rule template in project
- operationId: createProjectRuleTemplateV1
+ description: create a sql whitelist
+ operationId: createAuditWhitelistV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: add rule template request
+ - description: add sql whitelist req
in: body
- name: req
+ name: instance
required: true
schema:
- $ref: '#/definitions/v1.CreateProjectRuleTemplateReqV1'
+ $ref: '#/definitions/v1.CreateAuditWhitelistReqV1'
responses:
"200":
description: OK
@@ -7861,22 +4886,22 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 添加项目规则模板
+ summary: 添加SQL白名单
tags:
- - rule_template
- /v1/projects/{project_name}/rule_templates/{rule_template_name}/:
+ - audit_whitelist
+ /v1/projects/{project_name}/audit_whitelist/{audit_whitelist_id}/:
delete:
- description: delete rule template in project
- operationId: deleteProjectRuleTemplateV1
+ description: remove sql white
+ operationId: deleteAuditWhitelistByIdV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: rule template name
+ - description: audit whitelist id
in: path
- name: rule_template_name
+ name: audit_whitelist_id
required: true
type: string
responses:
@@ -7886,53 +4911,31 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 删除项目规则模板
- tags:
- - rule_template
- get:
- description: get rule template detail in project
- operationId: getProjectRuleTemplateV1
- parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: rule template name
- in: path
- name: rule_template_name
- required: true
- type: string
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetProjectRuleTemplateResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取项目规则模板信息
+ summary: 删除SQL白名单信息
tags:
- - rule_template
+ - audit_whitelist
patch:
- description: update rule template in project
- operationId: updateProjectRuleTemplateV1
+ consumes:
+ - application/json
+ description: update sql whitelist by id
+ operationId: UpdateAuditWhitelistByIdV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: rule template name
+ - description: sql audit whitelist id
in: path
- name: rule_template_name
+ name: audit_whitelist_id
required: true
type: string
- - description: update rule template request
+ - description: update sql whitelist req
in: body
- name: req
+ name: instance
required: true
schema:
- $ref: '#/definitions/v1.UpdateProjectRuleTemplateReqV1'
+ $ref: '#/definitions/v1.UpdateAuditWhitelistReqV1'
responses:
"200":
description: OK
@@ -7940,137 +4943,99 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 更新项目规则模板
+ summary: 更新SQL白名单
tags:
- - rule_template
- /v1/projects/{project_name}/rule_templates/{rule_template_name}/clone:
- post:
- consumes:
- - application/json
- description: clone a rule template in project
- operationId: cloneProjectRuleTemplateV1
+ - audit_whitelist
+ /v1/projects/{project_name}/instance_tips:
+ get:
+ description: get instance tip list
+ operationId: getInstanceTipListV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: rule template name
- in: path
- name: rule_template_name
- required: true
+ - description: filter db type
+ in: query
+ name: filter_db_type
+ type: string
+ - description: filter workflow template id
+ in: query
+ name: filter_workflow_template_id
+ type: string
+ - description: functional module
+ enum:
+ - create_audit_plan
+ - create_workflow
+ - sql_manage
+ in: query
+ name: functional_module
type: string
- - description: clone rule template request
- in: body
- name: req
- required: true
- schema:
- $ref: '#/definitions/v1.CloneProjectRuleTemplateReqV1'
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetInstanceTipsResV1'
security:
- ApiKeyAuth: []
- summary: 克隆项目规则模板
+ summary: 获取实例提示列表
tags:
- - rule_template
- /v1/projects/{project_name}/rule_templates/{rule_template_name}/export:
+ - instance
+ /v1/projects/{project_name}/instances/{instance_name}/connection:
get:
- description: export rule template in a project
- operationId: exportProjectRuleTemplateV1
+ description: test instance db connection
+ operationId: checkInstanceIsConnectableByNameV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: rule template name
+ - description: instance name
in: path
- name: rule_template_name
+ name: instance_name
required: true
type: string
responses:
"200":
- description: sqle rule template file
+ description: OK
schema:
- type: file
+ $ref: '#/definitions/v1.GetInstanceConnectableResV1'
security:
- ApiKeyAuth: []
- summary: 导出项目规则模板
+ summary: 实例连通性测试(实例提交后)
tags:
- - rule_template
- /v1/projects/{project_name}/sql_audit_records:
- get:
- description: get sql audit records
- operationId: getSQLAuditRecordsV1
- parameters:
- - description: fuzzy search tags
- in: query
- name: fuzzy_search_tags
- type: string
- - description: filter sql audit status
- enum:
- - auditing
- - successfully
- in: query
- name: filter_sql_audit_status
- type: string
- - description: filter instance name
- in: query
- name: filter_instance_name
- type: string
- - description: filter create time from
- in: query
- name: filter_create_time_from
- type: string
- - description: filter create time to
- in: query
- name: filter_create_time_to
- type: string
- - description: filter sql audit record ids
- in: query
- name: filter_sql_audit_record_ids
- type: string
- - description: page index
- in: query
- name: page_index
- required: true
- type: integer
- - description: size of per page
- in: query
- name: page_size
- required: true
- type: integer
+ - instance
+ /v1/projects/{project_name}/instances/{instance_name}/rules:
+ get:
+ description: get instance all rule
+ operationId: getInstanceRuleListV1
+ parameters:
- description: project name
in: path
name: project_name
required: true
type: string
+ - description: instance name
+ in: path
+ name: instance_name
+ required: true
+ type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetSQLAuditRecordsResV1'
+ $ref: '#/definitions/v1.GetRulesResV1'
security:
- ApiKeyAuth: []
- summary: 获取SQL审核记录列表
+ summary: 获取实例应用的规则列表
tags:
- - sql_audit_record
- post:
- consumes:
- - multipart/form-data
- description: |-
- SQL audit
- 1. formData[sql]: sql content;
- 2. file[input_sql_file]: it is a sql file;
- 3. file[input_mybatis_xml_file]: it is mybatis xml file, sql will be parsed from it.
- 4. file[input_zip_file]: it is ZIP file that sql will be parsed from xml or sql file inside it.
- 5. formData[git_http_url]:the url which scheme is http(s) and end with .git.
- 6. formData[git_user_name]:The name of the user who owns the repository read access.
- 7. formData[git_user_password]:The password corresponding to git_user_name.
- operationId: CreateSQLAuditRecordV1
+ - instance
+ /v1/projects/{project_name}/instances/{instance_name}/schemas:
+ get:
+ description: instance schema list
+ operationId: getInstanceSchemasV1
parameters:
- description: project name
in: path
@@ -8078,282 +5043,182 @@ paths:
required: true
type: string
- description: instance name
- in: formData
+ in: path
name: instance_name
+ required: true
type: string
- - description: schema of instance
- in: formData
- name: instance_schema
- type: string
- - description: db type of instance
- in: formData
- name: db_type
- type: string
- - description: sqls for audit
- in: formData
- name: sqls
- type: string
- - description: input SQL file
- in: formData
- name: input_sql_file
- type: file
- - description: input mybatis XML file
- in: formData
- name: input_mybatis_xml_file
- type: file
- - description: input ZIP file
- in: formData
- name: input_zip_file
- type: file
- - description: git repository url
- in: formData
- name: git_http_url
- type: string
- - description: the name of user to clone the repository
- in: formData
- name: git_user_name
- type: string
- - description: the password corresponding to git_user_name
- in: formData
- name: git_user_password
- type: string
- produces:
- - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.CreateSQLAuditRecordResV1'
+ $ref: '#/definitions/v1.GetInstanceSchemaResV1'
security:
- ApiKeyAuth: []
- summary: SQL审核
+ summary: 实例 Schema 列表
tags:
- - sql_audit_record
- /v1/projects/{project_name}/sql_audit_records/{sql_audit_record_id}/:
+ - instance
+ /v1/projects/{project_name}/instances/{instance_name}/schemas/{schema_name}/tables:
get:
- description: get sql audit record info
- operationId: getSQLAuditRecordV1
+ description: list table by schema
+ operationId: listTableBySchema
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: sql audit record id
+ - description: instance name
in: path
- name: sql_audit_record_id
+ name: instance_name
+ required: true
+ type: string
+ - description: schema name
+ in: path
+ name: schema_name
required: true
type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetSQLAuditRecordResV1'
+ $ref: '#/definitions/v1.ListTableBySchemaResV1'
security:
- ApiKeyAuth: []
- summary: 获取SQL审核记录信息
+ summary: 获取数据库下的所有表
tags:
- - sql_audit_record
- patch:
- consumes:
- - application/json
- description: update SQL audit record
- operationId: updateSQLAuditRecordV1
+ - instance
+ /v1/projects/{project_name}/instances/{instance_name}/schemas/{schema_name}/tables/{table_name}/metadata:
+ get:
+ description: get table metadata
+ operationId: getTableMetadata
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: sql audit record id
+ - description: instance name
in: path
- name: sql_audit_record_id
+ name: instance_name
required: true
type: string
- - description: update SQL audit record
- in: body
- name: param
+ - description: schema name
+ in: path
+ name: schema_name
required: true
- schema:
- $ref: '#/definitions/v1.UpdateSQLAuditRecordReqV1'
+ type: string
+ - description: table name
+ in: path
+ name: table_name
+ required: true
+ type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetTableMetadataResV1'
security:
- ApiKeyAuth: []
- summary: 更新SQL审核记录
+ summary: 获取表元数据
tags:
- - sql_audit_record
- /v1/projects/{project_name}/sql_audit_records/tag_tips:
- get:
- description: get sql audit record tag tips
- operationId: GetSQLAuditRecordTagTipsV1
+ - instance
+ /v1/projects/{project_name}/instances/connections:
+ post:
+ description: batch test instance db connections
+ operationId: batchCheckInstanceIsConnectableByName
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
+ - description: instances
+ in: body
+ name: instances
+ required: true
+ schema:
+ $ref: '#/definitions/v1.BatchCheckInstanceConnectionsReqV1'
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetSQLAuditRecordTagTipsResV1'
+ $ref: '#/definitions/v1.BatchGetInstanceConnectionsResV1'
security:
- ApiKeyAuth: []
- summary: 获取SQL审核记录标签列表
+ summary: 批量测试实例连通性(实例提交后)
tags:
- - sql_audit_record
- /v1/projects/{project_name}/sql_manages:
+ - instance
+ /v1/projects/{project_name}/rule_template_tips:
get:
- deprecated: true
- description: get sql manage list
- operationId: GetSqlManageList
+ description: get rule template tips in project
+ operationId: getProjectRuleTemplateTipsV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: fuzzy search sql fingerprint
- in: query
- name: fuzzy_search_sql_fingerprint
- type: string
- - description: assignee
- in: query
- name: filter_assignee
- type: string
- - description: instance name
- in: query
- name: filter_instance_name
- type: string
- - description: source
- enum:
- - audit_plan
- - sql_audit_record
- in: query
- name: filter_source
- type: string
- - description: audit level
- enum:
- - normal
- - notice
- - warn
- - error
- in: query
- name: filter_audit_level
- type: string
- - description: last audit start time from
- in: query
- name: filter_last_audit_start_time_from
- type: string
- - description: last audit start time to
- in: query
- name: filter_last_audit_start_time_to
- type: string
- - description: status
- enum:
- - unhandled
- - solved
- - ignored
- - manual_audited
- in: query
- name: filter_status
- type: string
- - description: rule name
- in: query
- name: filter_rule_name
- type: string
- - description: db type
+ - description: filter db type
in: query
name: filter_db_type
type: string
- - description: fuzzy search endpoint
- in: query
- name: fuzzy_search_endpoint
- type: string
- - description: fuzzy search schema name
- in: query
- name: fuzzy_search_schema_name
- type: string
- - description: sort field
- enum:
- - first_appear_timestamp
- - last_receive_timestamp
- - fp_count
- in: query
- name: sort_field
- type: string
- - description: sort order
- enum:
- - asc
- - desc
- in: query
- name: sort_order
- type: string
- - description: page index
- in: query
- name: page_index
- required: true
- type: integer
- - description: size of per page
- in: query
- name: page_size
- required: true
- type: integer
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetSqlManageListResp'
+ $ref: '#/definitions/v1.GetRuleTemplateTipsResV1'
security:
- ApiKeyAuth: []
- summary: 获取管控sql列表
+ summary: 获取项目规则模板提示
tags:
- - SqlManage
- /v1/projects/{project_name}/sql_manages/{sql_manage_id}/sql_analysis:
- get:
- description: get sql manage analysis
- operationId: GetSqlManageSqlAnalysisV1
+ - rule_template
+ /v1/projects/{project_name}/rule_templates:
+ get:
+ description: get all rule template in a project
+ operationId: getProjectRuleTemplateListV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: sql manage id
- in: path
- name: sql_manage_id
+ - description: page index
+ in: query
+ name: page_index
required: true
- type: string
+ type: integer
+ - description: size of per page
+ in: query
+ name: page_size
+ required: true
+ type: integer
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetSqlManageSqlAnalysisResp'
+ $ref: '#/definitions/v1.GetProjectRuleTemplatesResV1'
security:
- ApiKeyAuth: []
- summary: 获取SQL管控SQL分析
+ summary: 项目规则模板列表
tags:
- - SqlManage
- /v1/projects/{project_name}/sql_manages/batch:
- patch:
- description: batch update sql manage
- operationId: BatchUpdateSqlManage
+ - rule_template
+ post:
+ consumes:
+ - application/json
+ description: create a rule template in project
+ operationId: createProjectRuleTemplateV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: batch update sql manage request
+ - description: add rule template request
in: body
- name: BatchUpdateSqlManageReq
+ name: req
required: true
schema:
- $ref: '#/definitions/v1.BatchUpdateSqlManageReq'
+ $ref: '#/definitions/v1.CreateProjectRuleTemplateReqV1'
responses:
"200":
description: OK
@@ -8361,190 +5226,192 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 批量更新SQL管控
+ summary: 添加项目规则模板
tags:
- - SqlManage
- /v1/projects/{project_name}/sql_manages/exports:
- get:
- description: export sql manage
- operationId: exportSqlManageV1
+ - rule_template
+ /v1/projects/{project_name}/rule_templates/{rule_template_name}/:
+ delete:
+ description: delete rule template in project
+ operationId: deleteProjectRuleTemplateV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: fuzzy search sql fingerprint
- in: query
- name: fuzzy_search_sql_fingerprint
- type: string
- - description: assignee
- in: query
- name: filter_assignee
- type: string
- - description: instance name
- in: query
- name: filter_instance_name
- type: string
- - description: source
- enum:
- - audit_plan
- - sql_audit_record
- in: query
- name: filter_source
- type: string
- - description: audit level
- enum:
- - normal
- - notice
- - warn
- - error
- in: query
- name: filter_audit_level
- type: string
- - description: last audit start time from
- in: query
- name: filter_last_audit_start_time_from
- type: string
- - description: last audit start time to
- in: query
- name: filter_last_audit_start_time_to
- type: string
- - description: status
- enum:
- - unhandled
- - solved
- - ignored
- - manual_audited
- in: query
- name: filter_status
- type: string
- - description: db type
- in: query
- name: filter_db_type
- type: string
- - description: rule name
- in: query
- name: filter_rule_name
- type: string
- - description: fuzzy search endpoint
- in: query
- name: fuzzy_search_endpoint
- type: string
- - description: fuzzy search schema name
- in: query
- name: fuzzy_search_schema_name
- type: string
- - description: sort field
- enum:
- - first_appear_timestamp
- - last_receive_timestamp
- - fp_count
- in: query
- name: sort_field
- type: string
- - description: sort order
- enum:
- - asc
- - desc
- in: query
- name: sort_order
+ - description: rule template name
+ in: path
+ name: rule_template_name
+ required: true
type: string
responses:
"200":
- description: export sql manage
+ description: OK
schema:
- type: file
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 导出SQL管控
+ summary: 删除项目规则模板
tags:
- - SqlManage
- /v1/projects/{project_name}/sql_manages/rule_tips:
+ - rule_template
get:
- description: get sql manage rule tips
- operationId: GetSqlManageRuleTips
+ description: get rule template detail in project
+ operationId: getProjectRuleTemplateV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
+ - description: rule template name
+ in: path
+ name: rule_template_name
+ required: true
+ type: string
+ - description: fuzzy rule,keyword for desc and annotation
+ in: query
+ name: fuzzy_keyword_rule
+ type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetSqlManageRuleTipsResp'
+ $ref: '#/definitions/v1.GetProjectRuleTemplateResV1'
security:
- ApiKeyAuth: []
- summary: 获取管控规则tips
+ summary: 获取项目规则模板信息
tags:
- - SqlManage
- /v1/projects/{project_name}/statistic/audit_plans:
- get:
- description: statistic audit plan
- operationId: statisticAuditPlanV1
+ - rule_template
+ patch:
+ description: update rule template in project
+ operationId: updateProjectRuleTemplateV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
+ - description: rule template name
+ in: path
+ name: rule_template_name
+ required: true
+ type: string
+ - description: update rule template request
+ in: body
+ name: req
+ required: true
+ schema:
+ $ref: '#/definitions/v1.UpdateProjectRuleTemplateReqV1'
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.StatisticAuditPlanResV1'
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 获取各类型数据源上的扫描任务数量
+ summary: 更新项目规则模板
tags:
- - statistic
- /v1/projects/{project_name}/statistic/audited_sqls:
- get:
- description: statistics audited sql
- operationId: statisticsAuditedSQLV1
+ - rule_template
+ /v1/projects/{project_name}/rule_templates/{rule_template_name}/clone:
+ post:
+ consumes:
+ - application/json
+ description: clone a rule template in project
+ operationId: cloneProjectRuleTemplateV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
+ - description: rule template name
+ in: path
+ name: rule_template_name
+ required: true
+ type: string
+ - description: clone rule template request
+ in: body
+ name: req
+ required: true
+ schema:
+ $ref: '#/definitions/v1.CloneProjectRuleTemplateReqV1'
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.StatisticsAuditedSQLResV1'
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 获取审核SQL总数,以及触发审核规则的SQL数量
+ summary: 克隆项目规则模板
tags:
- - statistic
- /v1/projects/{project_name}/statistic/instance_health:
+ - rule_template
+ /v1/projects/{project_name}/rule_templates/{rule_template_name}/export:
get:
- description: get instance health
- operationId: GetInstanceHealthV1
+ description: export rule template in a project
+ operationId: exportProjectRuleTemplateV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
+ - description: rule template name
+ in: path
+ name: rule_template_name
+ required: true
+ type: string
responses:
"200":
- description: OK
+ description: sqle rule template file
schema:
- $ref: '#/definitions/v1.GetInstanceHealthResV1'
+ type: file
security:
- ApiKeyAuth: []
- summary: 获取各类型数据源的健康情况
+ summary: 导出项目规则模板
tags:
- - statistic
- /v1/projects/{project_name}/statistic/project_score:
+ - rule_template
+ /v1/projects/{project_name}/sql_audit_records:
get:
- description: get project score
- operationId: GetProjectScoreV1
+ description: get sql audit records
+ operationId: getSQLAuditRecordsV1
parameters:
+ - description: fuzzy search tags
+ in: query
+ name: fuzzy_search_tags
+ type: string
+ - description: filter sql audit status
+ enum:
+ - auditing
+ - successfully
+ in: query
+ name: filter_sql_audit_status
+ type: string
+ - description: filter instance id
+ in: query
+ name: filter_instance_id
+ type: integer
+ - description: filter create time from
+ in: query
+ name: filter_create_time_from
+ type: string
+ - description: filter create time to
+ in: query
+ name: filter_create_time_to
+ type: string
+ - description: filter sql audit record ids
+ in: query
+ name: filter_sql_audit_record_ids
+ type: string
+ - description: page index
+ in: query
+ name: page_index
+ required: true
+ type: integer
+ - description: size of per page
+ in: query
+ name: page_size
+ required: true
+ type: integer
- description: project name
in: path
name: project_name
@@ -8554,258 +5421,308 @@ paths:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetProjectScoreResV1'
+ $ref: '#/definitions/v1.GetSQLAuditRecordsResV1'
security:
- ApiKeyAuth: []
- summary: 获取项目分数
+ summary: 获取SQL审核记录列表
tags:
- - statistic
- /v1/projects/{project_name}/statistic/risk_audit_plans:
- get:
- description: get risk audit plan
- operationId: getRiskAuditPlanV1
+ - sql_audit_record
+ post:
+ consumes:
+ - multipart/form-data
+ description: |-
+ SQL audit
+ 1. formData[sql]: sql content;
+ 2. file[input_sql_file]: it is a sql file;
+ 3. file[input_mybatis_xml_file]: it is mybatis xml file, sql will be parsed from it.
+ 4. file[input_zip_file]: it is ZIP file that sql will be parsed from xml or sql file inside it.
+ 5. formData[git_http_url]:the url which scheme is http(s) and end with .git.
+ 6. formData[git_user_name]:The name of the user who owns the repository read access.
+ 7. formData[git_user_password]:The password corresponding to git_user_name.
+ operationId: CreateSQLAuditRecordV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
+ - description: instance name
+ in: formData
+ name: instance_name
+ type: string
+ - description: schema of instance
+ in: formData
+ name: instance_schema
+ type: string
+ - description: db type of instance
+ in: formData
+ name: db_type
+ type: string
+ - description: sqls for audit
+ in: formData
+ name: sqls
+ type: string
+ - description: input SQL file
+ in: formData
+ name: input_sql_file
+ type: file
+ - description: input mybatis XML file
+ in: formData
+ name: input_mybatis_xml_file
+ type: file
+ - description: input ZIP file
+ in: formData
+ name: input_zip_file
+ type: file
+ - description: git repository url
+ in: formData
+ name: git_http_url
+ type: string
+ - description: the name of user to clone the repository
+ in: formData
+ name: git_user_name
+ type: string
+ - description: the password corresponding to git_user_name
+ in: formData
+ name: git_user_password
+ type: string
+ produces:
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetRiskAuditPlanResV1'
+ $ref: '#/definitions/v1.CreateSQLAuditRecordResV1'
security:
- ApiKeyAuth: []
- summary: 获取扫描任务报告评分低于60的扫描任务
+ summary: SQL审核
tags:
- - statistic
- /v1/projects/{project_name}/statistic/risk_workflow:
+ - sql_audit_record
+ /v1/projects/{project_name}/sql_audit_records/{sql_audit_record_id}/:
get:
- description: statistic risk workflow
- operationId: statisticRiskWorkflowV1
+ description: get sql audit record info
+ operationId: getSQLAuditRecordV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.StatisticRiskWorkflowResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取存在风险的工单
- tags:
- - statistic
- /v1/projects/{project_name}/statistic/role_user:
- get:
- description: get role user count
- operationId: getRoleUserCountV1
- parameters:
- - description: project name
+ - description: sql audit record id
in: path
- name: project_name
+ name: sql_audit_record_id
required: true
type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetRoleUserCountResV1'
+ $ref: '#/definitions/v1.GetSQLAuditRecordResV1'
security:
- ApiKeyAuth: []
- summary: 获取各角色类型对应的成员数量
+ summary: 获取SQL审核记录信息
tags:
- - statistic
- /v1/projects/{project_name}/statistic/workflow_status:
- get:
- description: statistic workflow status
- operationId: statisticWorkflowStatusV1
+ - sql_audit_record
+ patch:
+ consumes:
+ - application/json
+ description: update SQL audit record
+ operationId: updateSQLAuditRecordV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetWorkflowStatusCountResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取项目下工单各个状态的数量
- tags:
- - statistic
- /v1/projects/{project_name}/statistics:
- get:
- description: get project statistics
- operationId: getProjectStatisticsV1
- parameters:
- - description: project name
+ - description: sql audit record id
in: path
- name: project_name
+ name: sql_audit_record_id
required: true
type: string
+ - description: update SQL audit record
+ in: body
+ name: param
+ required: true
+ schema:
+ $ref: '#/definitions/v1.UpdateSQLAuditRecordReqV1'
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetProjectStatisticsResV1'
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 获取项目统计信息
+ summary: 更新SQL审核记录
tags:
- - statistic
- /v1/projects/{project_name}/task_groups:
- post:
- consumes:
- - application/json
- description: create tasks group.
- operationId: createAuditTasksV1
+ - sql_audit_record
+ /v1/projects/{project_name}/sql_audit_records/tag_tips:
+ get:
+ description: get sql audit record tag tips
+ operationId: GetSQLAuditRecordTagTipsV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: parameters for creating audit tasks group
- in: body
- name: req
- required: true
- schema:
- $ref: '#/definitions/v1.CreateAuditTasksGroupReqV1'
- produces:
- - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.CreateAuditTasksGroupResV1'
+ $ref: '#/definitions/v1.GetSQLAuditRecordTagTipsResV1'
security:
- ApiKeyAuth: []
- summary: 创建审核任务组
+ summary: 获取SQL审核记录标签列表
tags:
- - task
- /v1/projects/{project_name}/tasks/audits:
- post:
- consumes:
- - multipart/form-data
- description: |-
- create and audit a task, you can upload sql content in three ways, any one can be used, but only one is effective.
- 1. formData[sql]: sql content;
- 2. file[input_sql_file]: it is a sql file;
- 3. file[input_mybatis_xml_file]: it is mybatis xml file, sql will be parsed from it.
- operationId: createAndAuditTaskV1
+ - sql_audit_record
+ /v1/projects/{project_name}/sql_manages:
+ get:
+ deprecated: true
+ description: get sql manage list
+ operationId: GetSqlManageList
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
+ - description: fuzzy search sql fingerprint
+ in: query
+ name: fuzzy_search_sql_fingerprint
+ type: string
+ - description: assignee
+ in: query
+ name: filter_assignee
+ type: string
- description: instance name
- in: formData
- name: instance_name
- required: true
+ in: query
+ name: filter_instance_name
type: string
- - description: schema of instance
- in: formData
- name: instance_schema
+ - description: source
+ enum:
+ - audit_plan
+ - sql_audit_record
+ in: query
+ name: filter_source
+ type: string
+ - description: audit level
+ enum:
+ - normal
+ - notice
+ - warn
+ - error
+ in: query
+ name: filter_audit_level
+ type: string
+ - description: last audit start time from
+ in: query
+ name: filter_last_audit_start_time_from
+ type: string
+ - description: last audit start time to
+ in: query
+ name: filter_last_audit_start_time_to
+ type: string
+ - description: status
+ enum:
+ - unhandled
+ - solved
+ - ignored
+ - manual_audited
+ in: query
+ name: filter_status
+ type: string
+ - description: rule name
+ in: query
+ name: filter_rule_name
+ type: string
+ - description: db type
+ in: query
+ name: filter_db_type
+ type: string
+ - description: fuzzy search endpoint
+ in: query
+ name: fuzzy_search_endpoint
+ type: string
+ - description: fuzzy search schema name
+ in: query
+ name: fuzzy_search_schema_name
+ type: string
+ - description: sort field
+ enum:
+ - first_appear_timestamp
+ - last_receive_timestamp
+ - fp_count
+ in: query
+ name: sort_field
type: string
- - description: sqls for audit
- in: formData
- name: sql
+ - description: sort order
+ enum:
+ - asc
+ - desc
+ in: query
+ name: sort_order
type: string
- - description: input SQL file
- in: formData
- name: input_sql_file
- type: file
- - description: input mybatis XML file
- in: formData
- name: input_mybatis_xml_file
- type: file
- - description: input ZIP file
- in: formData
- name: input_zip_file
- type: file
- produces:
- - application/json
+ - description: page index
+ in: query
+ name: page_index
+ required: true
+ type: integer
+ - description: size of per page
+ in: query
+ name: page_size
+ required: true
+ type: integer
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetAuditTaskResV1'
+ $ref: '#/definitions/v1.GetSqlManageListResp'
security:
- ApiKeyAuth: []
- summary: 创建Sql扫描任务并提交审核
+ summary: 获取管控sql列表
tags:
- - task
- /v1/projects/{project_name}/unarchive:
- post:
- consumes:
- - application/json
- description: archive project
- operationId: unarchiveProjectV1
+ - SqlManage
+ /v1/projects/{project_name}/sql_manages/{sql_manage_id}/sql_analysis:
+ get:
+ description: get sql manage analysis
+ operationId: GetSqlManageSqlAnalysisV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- produces:
- - application/json
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 取消归档项目
- tags:
- - project
- /v1/projects/{project_name}/workflow_template:
- get:
- description: get workflow template detail
- operationId: getWorkflowTemplateV1
- parameters:
- - description: project name
+ - description: sql manage id
in: path
- name: project_name
+ name: sql_manage_id
required: true
type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetWorkflowTemplateResV1'
+ $ref: '#/definitions/v1.GetSqlManageSqlAnalysisResp'
security:
- ApiKeyAuth: []
- summary: 获取审批流程模板详情
+ summary: 获取SQL管控SQL分析
tags:
- - workflow
+ - SqlManage
+ /v1/projects/{project_name}/sql_manages/batch:
patch:
- consumes:
- - application/json
- description: update the workflow template
- operationId: updateWorkflowTemplateV1
+ description: batch update sql manage
+ operationId: BatchUpdateSqlManage
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: create workflow template
+ - description: batch update sql manage request
in: body
- name: instance
+ name: BatchUpdateSqlManageReq
required: true
schema:
- $ref: '#/definitions/v1.UpdateWorkflowTemplateReqV1'
- produces:
- - application/json
+ $ref: '#/definitions/v1.BatchUpdateSqlManageReq'
responses:
"200":
description: OK
@@ -8813,161 +5730,150 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 更新Sql审批流程模板
+ summary: 批量更新SQL管控
tags:
- - workflow
- /v1/projects/{project_name}/workflows:
+ - SqlManage
+ /v1/projects/{project_name}/sql_manages/exports:
get:
- description: get workflow list
- operationId: getWorkflowsV1
+ description: export sql manage
+ operationId: exportSqlManageV1
parameters:
- - description: filter subject
- in: query
- name: filter_subject
+ - description: project name
+ in: path
+ name: project_name
+ required: true
type: string
- - description: filter by workflow_id
+ - description: fuzzy search sql fingerprint
in: query
- name: filter_workflow_id
+ name: fuzzy_search_sql_fingerprint
type: string
- - description: fuzzy search by workflow description
+ - description: assignee
in: query
- name: fuzzy_search_workflow_desc
+ name: filter_assignee
type: string
- - description: filter create time from
+ - description: instance name
in: query
- name: filter_create_time_from
+ name: filter_instance_name
type: string
- - description: filter create time to
+ - description: source
+ enum:
+ - audit_plan
+ - sql_audit_record
in: query
- name: filter_create_time_to
+ name: filter_source
type: string
- - description: filter_task_execute_start_time_from
+ - description: audit level
+ enum:
+ - normal
+ - notice
+ - warn
+ - error
in: query
- name: filter_task_execute_start_time_from
+ name: filter_audit_level
type: string
- - description: filter_task_execute_start_time_to
+ - description: last audit start time from
in: query
- name: filter_task_execute_start_time_to
+ name: filter_last_audit_start_time_from
type: string
- - description: filter create user name
+ - description: last audit start time to
in: query
- name: filter_create_user_name
+ name: filter_last_audit_start_time_to
type: string
- - description: filter workflow status
+ - description: status
enum:
- - wait_for_audit
- - wait_for_execution
- - rejected
- - executing
- - canceled
- - exec_failed
- - finished
+ - unhandled
+ - solved
+ - ignored
+ - manual_audited
in: query
name: filter_status
type: string
- - description: filter current step assignee user name
+ - description: db type
in: query
- name: filter_current_step_assignee_user_name
+ name: filter_db_type
type: string
- - description: filter instance name
+ - description: rule name
in: query
- name: filter_task_instance_name
+ name: filter_rule_name
type: string
- - description: page index
+ - description: fuzzy search endpoint
in: query
- name: page_index
- required: true
- type: integer
- - description: size of per page
+ name: fuzzy_search_endpoint
+ type: string
+ - description: fuzzy search schema name
in: query
- name: page_size
- required: true
- type: integer
- - description: project name
- in: path
- name: project_name
- required: true
+ name: fuzzy_search_schema_name
+ type: string
+ - description: sort field
+ enum:
+ - first_appear_timestamp
+ - last_receive_timestamp
+ - fp_count
+ in: query
+ name: sort_field
+ type: string
+ - description: sort order
+ enum:
+ - asc
+ - desc
+ in: query
+ name: sort_order
type: string
responses:
"200":
- description: OK
+ description: export sql manage
schema:
- $ref: '#/definitions/v1.GetWorkflowsResV1'
+ type: file
security:
- ApiKeyAuth: []
- summary: 获取工单列表
+ summary: 导出SQL管控
tags:
- - workflow
- post:
- consumes:
- - application/json
- deprecated: true
- description: create workflow
- operationId: createWorkflowV1
+ - SqlManage
+ /v1/projects/{project_name}/sql_manages/rule_tips:
+ get:
+ description: get sql manage rule tips
+ operationId: GetSqlManageRuleTips
parameters:
- - description: create workflow request
- in: body
- name: instance
- required: true
- schema:
- $ref: '#/definitions/v1.CreateWorkflowReqV1'
- description: project name
in: path
name: project_name
required: true
type: string
- produces:
- - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetSqlManageRuleTipsResp'
security:
- ApiKeyAuth: []
- summary: 创建工单
+ summary: 获取管控规则tips
tags:
- - workflow
- /v1/projects/{project_name}/workflows/{workflow_id}/tasks/{task_id}/terminate:
- post:
- description: execute one task on workflow
- operationId: terminateSingleTaskByWorkflowV1
+ - SqlManage
+ /v1/projects/{project_name}/statistic/audit_plans:
+ get:
+ description: statistic audit plan
+ operationId: statisticAuditPlanV1
parameters:
- - description: workflow id
- in: path
- name: workflow_id
- required: true
- type: string
- description: project name
in: path
name: project_name
required: true
type: string
- - description: task id
- in: path
- name: task_id
- required: true
- type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.StatisticAuditPlanResV1'
security:
- ApiKeyAuth: []
- summary: 终止单个上线任务
+ summary: 获取各类型数据源上的扫描任务数量
tags:
- - workflow
- /v1/projects/{project_name}/workflows/{workflow_id}/tasks/terminate:
- post:
- description: terminate multiple task by project and workflow
- operationId: terminateMultipleTaskByWorkflowV1
+ - statistic
+ /v1/projects/{project_name}/statistic/audited_sqls:
+ get:
+ description: statistics audited sql
+ operationId: statisticsAuditedSQLV1
parameters:
- - description: workflow id
- in: path
- name: workflow_id
- required: true
- type: string
- description: project name
in: path
name: project_name
@@ -8977,23 +5883,17 @@ paths:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.StatisticsAuditedSQLResV1'
security:
- ApiKeyAuth: []
- summary: 终止工单下多个上线任务
+ summary: 获取审核SQL总数,以及触发审核规则的SQL数量
tags:
- - workflow
- /v1/projects/{project_name}/workflows/{workflow_name}/:
+ - statistic
+ /v1/projects/{project_name}/statistic/instance_health:
get:
- deprecated: true
- description: get workflow detail
- operationId: getWorkflowV1
+ description: get instance health
+ operationId: GetInstanceHealthV1
parameters:
- - description: workflow name
- in: path
- name: workflow_name
- required: true
- type: string
- description: project name
in: path
name: project_name
@@ -9003,89 +5903,57 @@ paths:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetWorkflowResV1'
+ $ref: '#/definitions/v1.GetInstanceHealthResV1'
security:
- ApiKeyAuth: []
- summary: 获取工单详情
+ summary: 获取各类型数据源的健康情况
tags:
- - workflow
- patch:
- consumes:
- - application/json
- deprecated: true
- description: update workflow when it is rejected to creator.
- operationId: updateWorkflowV1
+ - statistic
+ /v1/projects/{project_name}/statistic/project_score:
+ get:
+ description: get project score
+ operationId: GetProjectScoreV1
parameters:
- - description: workflow name
- in: path
- name: workflow_name
- required: true
- type: string
- description: project name
in: path
name: project_name
required: true
type: string
- - description: update workflow request
- in: body
- name: instance
- required: true
- schema:
- $ref: '#/definitions/v1.UpdateWorkflowReqV1'
- produces:
- - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetProjectScoreResV1'
security:
- ApiKeyAuth: []
- summary: 更新工单(驳回后才可更新)
+ summary: 获取项目分数
tags:
- - workflow
- /v1/projects/{project_name}/workflows/{workflow_name}/cancel:
- post:
- deprecated: true
- description: cancel workflow
- operationId: cancelWorkflowV1
+ - statistic
+ /v1/projects/{project_name}/statistic/risk_audit_plans:
+ get:
+ description: get risk audit plan
+ operationId: getRiskAuditPlanV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: workflow name
- in: path
- name: workflow_name
- required: true
- type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetRiskAuditPlanResV1'
security:
- ApiKeyAuth: []
- summary: 审批关闭(中止)
+ summary: 获取扫描任务报告评分低于60的扫描任务
tags:
- - workflow
- /v1/projects/{project_name}/workflows/{workflow_name}/steps/{workflow_step_id}/approve:
- post:
- deprecated: true
- description: approve workflow
- operationId: approveWorkflowV1
+ - statistic
+ /v1/projects/{project_name}/statistic/risk_workflow:
+ get:
+ description: statistic risk workflow
+ operationId: statisticRiskWorkflowV1
parameters:
- - description: workflow name
- in: path
- name: workflow_name
- required: true
- type: string
- - description: workflow step id
- in: path
- name: workflow_step_id
- required: true
- type: string
- description: project name
in: path
name: project_name
@@ -9095,60 +5963,37 @@ paths:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.StatisticRiskWorkflowResV1'
security:
- ApiKeyAuth: []
- summary: 审批通过
+ summary: 获取存在风险的工单
tags:
- - workflow
- /v1/projects/{project_name}/workflows/{workflow_name}/steps/{workflow_step_id}/reject:
- post:
- deprecated: true
- description: reject workflow
- operationId: rejectWorkflowV1
+ - statistic
+ /v1/projects/{project_name}/statistic/role_user:
+ get:
+ description: get role user count
+ operationId: getRoleUserCountV1
parameters:
- - description: workflow name
- in: path
- name: workflow_name
- required: true
- type: string
- description: project name
in: path
name: project_name
required: true
type: string
- - description: workflow step id
- in: path
- name: workflow_step_id
- required: true
- type: string
- - description: workflow approve request
- in: body
- name: workflow_approve
- required: true
- schema:
- $ref: '#/definitions/v1.RejectWorkflowReqV1'
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetRoleUserCountResV1'
security:
- ApiKeyAuth: []
- summary: 审批驳回
+ summary: 获取各角色类型对应的成员数量
tags:
- - workflow
- /v1/projects/{project_name}/workflows/{workflow_name}/tasks:
+ - statistic
+ /v1/projects/{project_name}/statistic/workflow_status:
get:
- deprecated: true
- description: get summary of workflow instance tasks
- operationId: getSummaryOfInstanceTasksV1
+ description: statistic workflow status
+ operationId: statisticWorkflowStatusV1
parameters:
- - description: workflow name
- in: path
- name: workflow_name
- required: true
- type: string
- description: project name
in: path
name: project_name
@@ -9158,155 +6003,154 @@ paths:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetWorkflowTasksResV1'
+ $ref: '#/definitions/v1.GetWorkflowStatusCountResV1'
security:
- ApiKeyAuth: []
- summary: 获取工单数据源任务概览
+ summary: 获取项目下工单各个状态的数量
tags:
- - workflow
- /v1/projects/{project_name}/workflows/{workflow_name}/tasks/{task_id}/execute:
- post:
- deprecated: true
- description: execute one task on workflow
- operationId: executeOneTaskOnWorkflowV1
+ - statistic
+ /v1/projects/{project_name}/statistics:
+ get:
+ description: get project statistics
+ operationId: getProjectStatisticsV1
parameters:
- - description: workflow name
- in: path
- name: workflow_name
- required: true
- type: string
- description: project name
in: path
name: project_name
required: true
type: string
- - description: task id
- in: path
- name: task_id
- required: true
- type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetProjectStatisticsResV1'
security:
- ApiKeyAuth: []
- summary: 工单提交单个数据源上线
+ summary: 获取项目统计信息
tags:
- - workflow
- /v1/projects/{project_name}/workflows/{workflow_name}/tasks/{task_id}/schedule:
- put:
+ - statistic
+ /v1/projects/{project_name}/task_groups:
+ post:
consumes:
- application/json
- deprecated: true
- description: update workflow schedule.
- operationId: updateWorkflowScheduleV1
+ description: create tasks group.
+ operationId: createAuditTasksV1
parameters:
- - description: workflow name
- in: path
- name: workflow_name
- required: true
- type: string
- - description: task id
- in: path
- name: task_id
- required: true
- type: string
- description: project name
in: path
name: project_name
required: true
type: string
- - description: update workflow schedule request
+ - description: parameters for creating audit tasks group
in: body
- name: instance
+ name: req
required: true
schema:
- $ref: '#/definitions/v1.UpdateWorkflowScheduleReqV1'
+ $ref: '#/definitions/v1.CreateAuditTasksGroupReqV1'
produces:
- application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.CreateAuditTasksGroupResV1'
security:
- ApiKeyAuth: []
- summary: 设置工单数据源定时上线时间(设置为空则代表取消定时时间,需要SQL审核流程都通过后才可以设置)
+ summary: 创建审核任务组
tags:
- - workflow
- /v1/projects/{project_name}/workflows/{workflow_name}/tasks/execute:
+ - task
+ /v1/projects/{project_name}/tasks/audits:
post:
- deprecated: true
- description: execute tasks on workflow
- operationId: executeTasksOnWorkflowV1
+ consumes:
+ - multipart/form-data
+ description: |-
+ create and audit a task, you can upload sql content in three ways, any one can be used, but only one is effective.
+ 1. formData[sql]: sql content;
+ 2. file[input_sql_file]: it is a sql file;
+ 3. file[input_mybatis_xml_file]: it is mybatis xml file, sql will be parsed from it.
+ operationId: createAndAuditTaskV1
parameters:
- - description: workflow name
- in: path
- name: workflow_name
- required: true
- type: string
- description: project name
in: path
name: project_name
required: true
type: string
+ - description: instance name
+ in: formData
+ name: instance_name
+ required: true
+ type: string
+ - description: schema of instance
+ in: formData
+ name: instance_schema
+ type: string
+ - description: sqls for audit
+ in: formData
+ name: sql
+ type: string
+ - description: input SQL file
+ in: formData
+ name: input_sql_file
+ type: file
+ - description: input mybatis XML file
+ in: formData
+ name: input_mybatis_xml_file
+ type: file
+ - description: input ZIP file
+ in: formData
+ name: input_zip_file
+ type: file
+ produces:
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetAuditTaskResV1'
security:
- ApiKeyAuth: []
- summary: 多数据源批量上线
+ summary: 创建Sql扫描任务并提交审核
tags:
- - workflow
- /v1/projects/{project_name}/workflows/cancel:
- post:
- deprecated: true
- description: batch cancel workflows
- operationId: batchCancelWorkflowsV1
+ - task
+ /v1/projects/{project_name}/workflow_template:
+ get:
+ description: get workflow template detail
+ operationId: getWorkflowTemplateV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: batch cancel workflows request
- in: body
- name: BatchCancelWorkflowsReqV1
- required: true
- schema:
- $ref: '#/definitions/v1.BatchCancelWorkflowsReqV1'
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetWorkflowTemplateResV1'
security:
- ApiKeyAuth: []
- summary: 批量取消工单
+ summary: 获取审批流程模板详情
tags:
- workflow
- /v1/projects/{project_name}/workflows/complete:
- post:
- deprecated: true
- description: this api will directly change the work order status to finished
- without real online operation
- operationId: batchCompleteWorkflowsV1
+ patch:
+ consumes:
+ - application/json
+ description: update the workflow template
+ operationId: updateWorkflowTemplateV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- - description: batch complete workflows request
+ - description: create workflow template
in: body
- name: data
+ name: instance
required: true
schema:
- $ref: '#/definitions/v1.BatchCompleteWorkflowsReqV1'
+ $ref: '#/definitions/v1.UpdateWorkflowTemplateReqV1'
+ produces:
+ - application/json
responses:
"200":
description: OK
@@ -9314,18 +6158,22 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 批量完成工单
+ summary: 更新Sql审批流程模板
tags:
- workflow
- /v1/projects/{project_name}/workflows/exports:
+ /v1/projects/{project_name}/workflows:
get:
- description: export workflow
- operationId: exportWorkflowV1
+ description: get workflow list
+ operationId: getWorkflowsV1
parameters:
- description: filter subject
in: query
name: filter_subject
type: string
+ - description: filter by workflow_id
+ in: query
+ name: filter_workflow_id
+ type: string
- description: fuzzy search by workflow description
in: query
name: fuzzy_search_workflow_desc
@@ -9346,9 +6194,9 @@ paths:
in: query
name: filter_task_execute_start_time_to
type: string
- - description: filter create user name
+ - description: filter create user id
in: query
- name: filter_create_user_name
+ name: filter_create_user_id
type: string
- description: filter workflow status
enum:
@@ -9362,54 +6210,14 @@ paths:
in: query
name: filter_status
type: string
- - description: filter current step assignee user name
+ - description: filter current step assignee user id
in: query
- name: filter_current_step_assignee_user_name
+ name: filter_current_step_assignee_user_id
type: string
- description: filter instance name
in: query
name: filter_task_instance_name
type: string
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- responses:
- "200":
- description: export workflow
- schema:
- type: file
- security:
- - ApiKeyAuth: []
- summary: 导出工单
- tags:
- - workflow
- /v1/role_tips:
- get:
- description: get role tip list
- operationId: getRoleTipListV1
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetRoleTipsResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取角色提示列表
- tags:
- - role
- /v1/roles:
- get:
- consumes:
- - application/json
- description: get role list
- operationId: getRoleListV1
- parameters:
- - description: filter role name
- in: query
- name: filter_role_name
- type: string
- description: page index
in: query
name: page_index
@@ -9420,140 +6228,45 @@ paths:
name: page_size
required: true
type: integer
- produces:
- - application/json
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetRolesResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取角色列表
- tags:
- - role
- post:
- consumes:
- - application/json
- description: create role
- operationId: createRoleV1
- parameters:
- - description: create role
- in: body
- name: instance
- required: true
- schema:
- $ref: '#/definitions/v1.CreateRoleReqV1'
- produces:
- - application/json
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 创建角色
- tags:
- - role
- /v1/roles/{role_name}/:
- delete:
- consumes:
- - application/json
- description: delete role
- operationId: deleteRoleV1
- parameters:
- - description: role name
+ - description: project name
in: path
- name: role_name
+ name: project_name
required: true
type: string
- produces:
- - application/json
+ - description: fuzzy matching subject/workflow_id
+ in: query
+ name: fuzzy_keyword
+ type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetWorkflowsResV1'
security:
- ApiKeyAuth: []
- summary: 删除角色
+ summary: 获取工单列表
tags:
- - role
- patch:
+ - workflow
+ post:
consumes:
- application/json
- description: update role
- operationId: updateRoleV1
+ deprecated: true
+ description: create workflow
+ operationId: createWorkflowV1
parameters:
- - description: role name
- in: path
- name: role_name
- required: true
- type: string
- - description: update role request
+ - description: create workflow request
in: body
name: instance
required: true
schema:
- $ref: '#/definitions/v1.UpdateRoleReqV1'
- produces:
- - application/json
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 更新角色信息
- tags:
- - role
- /v1/rule_knowledge/db_types/{db_type}/custom_rules/{rule_name}/:
- get:
- description: get custom rule knowledge
- operationId: getCustomRuleKnowledgeV1
- parameters:
- - description: rule name
- in: path
- name: rule_name
- required: true
- type: string
- - description: db type of rule
- in: path
- name: db_type
- required: true
- type: string
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetRuleKnowledgeResV1'
- security:
- - ApiKeyAuth: []
- summary: 查看自定义规则知识库
- tags:
- - rule_template
- patch:
- description: update custom rule knowledge
- operationId: updateCustomRuleKnowledge
- parameters:
- - description: rule name
- in: path
- name: rule_name
- required: true
- type: string
- - description: db type of rule
+ $ref: '#/definitions/v1.CreateWorkflowReqV1'
+ - description: project name
in: path
- name: db_type
+ name: project_name
required: true
type: string
- - description: update rule knowledge
- in: body
- name: req
- required: true
- schema:
- $ref: '#/definitions/v1.UpdateRuleKnowledgeReq'
+ produces:
+ - application/json
responses:
"200":
description: OK
@@ -9561,54 +6274,29 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 更新自定义规则知识库
+ summary: 创建工单
tags:
- - rule_template
- /v1/rule_knowledge/db_types/{db_type}/rules/{rule_name}/:
- get:
- description: get rule knowledge
- operationId: getRuleKnowledgeV1
+ - workflow
+ /v1/projects/{project_name}/workflows/{workflow_id}/tasks/{task_id}/terminate:
+ post:
+ description: execute one task on workflow
+ operationId: terminateSingleTaskByWorkflowV1
parameters:
- - description: rule name
- in: path
- name: rule_name
- required: true
- type: string
- - description: db type of rule
+ - description: workflow id
in: path
- name: db_type
+ name: workflow_id
required: true
type: string
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetRuleKnowledgeResV1'
- security:
- - ApiKeyAuth: []
- summary: 查看规则知识库
- tags:
- - rule_template
- patch:
- description: update rule knowledge
- operationId: updateRuleKnowledge
- parameters:
- - description: rule name
+ - description: project name
in: path
- name: rule_name
+ name: project_name
required: true
type: string
- - description: db type of rule
+ - description: task id
in: path
- name: db_type
+ name: task_id
required: true
type: string
- - description: update rule knowledge
- in: body
- name: req
- required: true
- schema:
- $ref: '#/definitions/v1.UpdateRuleKnowledgeReq'
responses:
"200":
description: OK
@@ -9616,65 +6304,85 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 更新规则知识库
+ summary: 终止单个上线任务
tags:
- - rule_template
- /v1/rule_template_tips:
- get:
- description: get global rule template tips
- operationId: getRuleTemplateTipsV1
+ - workflow
+ /v1/projects/{project_name}/workflows/{workflow_id}/tasks/terminate:
+ post:
+ description: terminate multiple task by project and workflow
+ operationId: terminateMultipleTaskByWorkflowV1
parameters:
- - description: filter db type
- in: query
- name: filter_db_type
+ - description: workflow id
+ in: path
+ name: workflow_id
+ required: true
+ type: string
+ - description: project name
+ in: path
+ name: project_name
+ required: true
type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetRuleTemplateTipsResV1'
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 获取全局规则模板提示
+ summary: 终止工单下多个上线任务
tags:
- - rule_template
- /v1/rule_templates:
+ - workflow
+ /v1/projects/{project_name}/workflows/{workflow_name}/:
get:
- description: get all global rule template
- operationId: getRuleTemplateListV1
+ deprecated: true
+ description: get workflow detail
+ operationId: getWorkflowV1
parameters:
- - description: page index
- in: query
- name: page_index
+ - description: workflow name
+ in: path
+ name: workflow_name
required: true
- type: integer
- - description: size of per page
- in: query
- name: page_size
+ type: string
+ - description: project name
+ in: path
+ name: project_name
required: true
- type: integer
+ type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetRuleTemplatesResV1'
+ $ref: '#/definitions/v1.GetWorkflowResV1'
security:
- ApiKeyAuth: []
- summary: 全局规则模板列表
+ summary: 获取工单详情
tags:
- - rule_template
- post:
+ - workflow
+ patch:
consumes:
- application/json
- description: create a global rule template
- operationId: createRuleTemplateV1
+ deprecated: true
+ description: update workflow when it is rejected to creator.
+ operationId: updateWorkflowV1
parameters:
- - description: add rule template request
+ - description: workflow name
+ in: path
+ name: workflow_name
+ required: true
+ type: string
+ - description: project name
+ in: path
+ name: project_name
+ required: true
+ type: string
+ - description: update workflow request
in: body
- name: req
+ name: instance
required: true
schema:
- $ref: '#/definitions/v1.CreateRuleTemplateReqV1'
+ $ref: '#/definitions/v1.UpdateWorkflowReqV1'
+ produces:
+ - application/json
responses:
"200":
description: OK
@@ -9682,17 +6390,23 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 添加全局规则模板
+ summary: 更新工单(驳回后才可更新)
tags:
- - rule_template
- /v1/rule_templates/{rule_template_name}/:
- delete:
- description: delete global rule template
- operationId: deleteRuleTemplateV1
+ - workflow
+ /v1/projects/{project_name}/workflows/{workflow_name}/cancel:
+ post:
+ deprecated: true
+ description: cancel workflow
+ operationId: cancelWorkflowV1
parameters:
- - description: rule template name
+ - description: project name
in: path
- name: rule_template_name
+ name: project_name
+ required: true
+ type: string
+ - description: workflow name
+ in: path
+ name: workflow_name
required: true
type: string
responses:
@@ -9702,43 +6416,30 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 删除全局规则模板
+ summary: 审批关闭(中止)
tags:
- - rule_template
- get:
- description: get global rule template
- operationId: getRuleTemplateV1
+ - workflow
+ /v1/projects/{project_name}/workflows/{workflow_name}/steps/{workflow_step_id}/approve:
+ post:
+ deprecated: true
+ description: approve workflow
+ operationId: approveWorkflowV1
parameters:
- - description: rule template name
+ - description: workflow name
in: path
- name: rule_template_name
+ name: workflow_name
required: true
type: string
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetRuleTemplateResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取全局规则模板信息
- tags:
- - rule_template
- patch:
- description: update global rule template
- operationId: updateRuleTemplateV1
- parameters:
- - description: rule template name
+ - description: workflow step id
in: path
- name: rule_template_name
+ name: workflow_step_id
required: true
type: string
- - description: update rule template request
- in: body
- name: req
+ - description: project name
+ in: path
+ name: project_name
required: true
- schema:
- $ref: '#/definitions/v1.UpdateRuleTemplateReqV1'
+ type: string
responses:
"200":
description: OK
@@ -9746,27 +6447,36 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 更新全局规则模板
+ summary: 审批通过
tags:
- - rule_template
- /v1/rule_templates/{rule_template_name}/clone:
+ - workflow
+ /v1/projects/{project_name}/workflows/{workflow_name}/steps/{workflow_step_id}/reject:
post:
- consumes:
- - application/json
- description: clone a rule template
- operationId: CloneRuleTemplateV1
+ deprecated: true
+ description: reject workflow
+ operationId: rejectWorkflowV1
parameters:
- - description: rule template name
+ - description: workflow name
in: path
- name: rule_template_name
+ name: workflow_name
required: true
type: string
- - description: clone rule template request
+ - description: project name
+ in: path
+ name: project_name
+ required: true
+ type: string
+ - description: workflow step id
+ in: path
+ name: workflow_step_id
+ required: true
+ type: string
+ - description: workflow approve request
in: body
- name: req
+ name: workflow_approve
required: true
schema:
- $ref: '#/definitions/v1.CloneRuleTemplateReqV1'
+ $ref: '#/definitions/v1.RejectWorkflowReqV1'
responses:
"200":
description: OK
@@ -9774,432 +6484,522 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 克隆全局规则模板
+ summary: 审批驳回
tags:
- - rule_template
- /v1/rule_templates/{rule_template_name}/export:
+ - workflow
+ /v1/projects/{project_name}/workflows/{workflow_name}/tasks:
get:
- description: export rule template
- operationId: exportRuleTemplateV1
+ deprecated: true
+ description: get summary of workflow instance tasks
+ operationId: getSummaryOfInstanceTasksV1
parameters:
- - description: rule template name
+ - description: workflow name
in: path
- name: rule_template_name
+ name: workflow_name
+ required: true
+ type: string
+ - description: project name
+ in: path
+ name: project_name
required: true
type: string
responses:
"200":
- description: sqle rule template file
+ description: OK
schema:
- type: file
+ $ref: '#/definitions/v1.GetWorkflowTasksResV1'
security:
- ApiKeyAuth: []
- summary: 导出全局规则模板
+ summary: 获取工单数据源任务概览
tags:
- - rule_template
- /v1/rule_templates/parse:
+ - workflow
+ /v1/projects/{project_name}/workflows/{workflow_name}/tasks/{task_id}/execute:
post:
- consumes:
- - multipart/form-data
- description: parse rule template
- operationId: importProjectRuleTemplateV1
+ deprecated: true
+ description: execute one task on workflow
+ operationId: executeOneTaskOnWorkflowV1
parameters:
- - description: SQLE rule template file
- in: formData
- name: rule_template_file
+ - description: workflow name
+ in: path
+ name: workflow_name
required: true
- type: file
+ type: string
+ - description: project name
+ in: path
+ name: project_name
+ required: true
+ type: string
+ - description: task id
+ in: path
+ name: task_id
+ required: true
+ type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.ParseProjectRuleTemplateFileResV1'
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 解析规则模板文件
+ summary: 工单提交单个数据源上线
tags:
- - rule_template
- /v1/rules:
- get:
- description: get all rule template
- operationId: getRuleListV1
+ - workflow
+ /v1/projects/{project_name}/workflows/{workflow_name}/tasks/{task_id}/schedule:
+ put:
+ consumes:
+ - application/json
+ deprecated: true
+ description: update workflow schedule.
+ operationId: updateWorkflowScheduleV1
parameters:
- - description: filter db type
- in: query
- name: filter_db_type
+ - description: workflow name
+ in: path
+ name: workflow_name
+ required: true
type: string
- - description: filter global rule template name
- in: query
- name: filter_global_rule_template_name
+ - description: task id
+ in: path
+ name: task_id
+ required: true
type: string
- - description: filter rule name list
- in: query
- name: filter_rule_names
+ - description: project name
+ in: path
+ name: project_name
+ required: true
type: string
+ - description: update workflow schedule request
+ in: body
+ name: instance
+ required: true
+ schema:
+ $ref: '#/definitions/v1.UpdateWorkflowScheduleReqV1'
+ produces:
+ - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetRulesResV1'
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 规则列表
+ summary: 设置工单数据源定时上线时间(设置为空则代表取消定时时间,需要SQL审核流程都通过后才可以设置)
tags:
- - rule_template
- /v1/sql_analysis:
- get:
- description: Direct get sql analysis result
- operationId: directGetSQLAnalysisV1
+ - workflow
+ /v1/projects/{project_name}/workflows/{workflow_name}/tasks/execute:
+ post:
+ deprecated: true
+ description: execute tasks on workflow
+ operationId: executeTasksOnWorkflowV1
parameters:
- - description: project name
- in: query
- name: project_name
+ - description: workflow name
+ in: path
+ name: workflow_name
required: true
type: string
- - description: instance name
- in: query
- name: instance_name
+ - description: project name
+ in: path
+ name: project_name
required: true
type: string
- - description: schema name
- in: query
- name: schema_name
- type: string
- - description: sql
- in: query
- name: sql
- type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.DirectGetSQLAnalysisResV1'
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 直接获取SQL分析结果
+ summary: 多数据源批量上线
tags:
- - sql_analysis
- /v1/sql_audit:
+ - workflow
+ /v1/projects/{project_name}/workflows/cancel:
post:
deprecated: true
- description: Direct audit sql
- operationId: directAuditV1
+ description: batch cancel workflows
+ operationId: batchCancelWorkflowsV1
parameters:
- - description: sqls that should be audited
+ - description: project name
+ in: path
+ name: project_name
+ required: true
+ type: string
+ - description: batch cancel workflows request
in: body
- name: req
+ name: BatchCancelWorkflowsReqV1
required: true
schema:
- $ref: '#/definitions/v1.DirectAuditReqV1'
+ $ref: '#/definitions/v1.BatchCancelWorkflowsReqV1'
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.DirectAuditResV1'
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 直接审核SQL
+ summary: 批量取消工单
tags:
- - sql_audit
- /v1/static/instance_logo:
- get:
- description: get instance type logo
- operationId: getInstanceTypeLogo
+ - workflow
+ /v1/projects/{project_name}/workflows/complete:
+ post:
+ deprecated: true
+ description: this api will directly change the work order status to finished
+ without real online operation
+ operationId: batchCompleteWorkflowsV1
parameters:
- - description: instance type
- in: query
- name: instance_type
+ - description: project name
+ in: path
+ name: project_name
required: true
type: string
+ - description: batch complete workflows request
+ in: body
+ name: data
+ required: true
+ schema:
+ $ref: '#/definitions/v1.BatchCompleteWorkflowsReqV1'
responses:
"200":
- description: get instance type logo
+ description: OK
schema:
- type: file
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 获取实例类型logo
+ summary: 批量完成工单
tags:
- - instance
- /v1/static/logo:
+ - workflow
+ /v1/projects/{project_name}/workflows/exports:
get:
- description: get logo
- operationId: getLogo
+ description: export workflow
+ operationId: exportWorkflowV1
parameters:
- - description: timestamp
+ - description: filter subject
in: query
- name: timestamp
+ name: filter_subject
type: string
- responses:
- "200":
- description: get logo
- schema:
- type: file
- summary: 获取logo
- tags:
- - configuration
- /v1/statistic/instances/sql_average_execution_time:
- get:
- description: get average execution time of sql
- operationId: getSqlAverageExecutionTimeV1
- parameters:
- - description: the limit of result item number
+ - description: fuzzy search by workflow description
in: query
- name: limit
+ name: fuzzy_search_workflow_desc
+ type: string
+ - description: filter create time from
+ in: query
+ name: filter_create_time_from
+ type: string
+ - description: filter create time to
+ in: query
+ name: filter_create_time_to
+ type: string
+ - description: filter_task_execute_start_time_from
+ in: query
+ name: filter_task_execute_start_time_from
+ type: string
+ - description: filter_task_execute_start_time_to
+ in: query
+ name: filter_task_execute_start_time_to
+ type: string
+ - description: filter create user id
+ in: query
+ name: filter_create_user_id
+ type: string
+ - description: filter workflow status
+ enum:
+ - wait_for_audit
+ - wait_for_execution
+ - rejected
+ - executing
+ - canceled
+ - exec_failed
+ - finished
+ in: query
+ name: filter_status
+ type: string
+ - description: filter current step assignee user id
+ in: query
+ name: filter_current_step_assignee_user_id
+ type: string
+ - description: filter instance name
+ in: query
+ name: filter_task_instance_name
+ type: string
+ - description: project name
+ in: path
+ name: project_name
required: true
- type: integer
+ type: string
+ - description: fuzzy matching subject/workflow_id/desc
+ in: query
+ name: fuzzy_keyword
+ type: string
responses:
"200":
- description: OK
+ description: export workflow
schema:
- $ref: '#/definitions/v1.GetSqlAverageExecutionTimeResV1'
+ type: file
security:
- ApiKeyAuth: []
- summary: 获取sql上线平均耗时,按平均耗时降序排列
+ summary: 导出工单
tags:
- - statistic
- /v1/statistic/instances/sql_execution_fail_percent:
+ - workflow
+ /v1/rule_knowledge/db_types/{db_type}/custom_rules/{rule_name}/:
get:
- description: get sql execution fail percent
- operationId: getSqlExecutionFailPercentV1
+ description: get custom rule knowledge
+ operationId: getCustomRuleKnowledgeV1
parameters:
- - description: the limit of result item number
- in: query
- name: limit
+ - description: rule name
+ in: path
+ name: rule_name
required: true
- type: integer
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetSqlExecutionFailPercentResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取SQL上线失败率,按失败率降序排列
- tags:
- - statistic
- /v1/statistic/instances/type_percent:
- get:
- description: get database instances' types percent
- operationId: getInstancesTypePercentV1
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetInstancesTypePercentResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取数据源类型百分比
- tags:
- - statistic
- /v1/statistic/license/usage:
- get:
- description: get usage of license
- operationId: getLicenseUsageV1
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetLicenseUsageResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取License使用情况
- tags:
- - statistic
- /v1/statistic/workflows/audit_pass_percent:
- get:
- description: get workflow audit pass percent
- operationId: getWorkflowAuditPassPercentV1
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetWorkflowAuditPassPercentResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取工单审核通过率
- tags:
- - statistic
- /v1/statistic/workflows/counts:
- get:
- description: get workflow counts
- operationId: getWorkflowCountV1
+ type: string
+ - description: db type of rule
+ in: path
+ name: db_type
+ required: true
+ type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetWorkflowCountsResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取工单数量统计数据
- tags:
- - statistic
- /v1/statistic/workflows/duration_of_waiting_for_audit:
- get:
- description: get duration from workflow being created to audited
- operationId: getWorkflowDurationOfWaitingForAuditV1
+ $ref: '#/definitions/v1.GetRuleKnowledgeResV1'
+ security:
+ - ApiKeyAuth: []
+ summary: 查看自定义规则知识库
+ tags:
+ - rule_template
+ patch:
+ description: update custom rule knowledge
+ operationId: updateCustomRuleKnowledge
+ parameters:
+ - description: rule name
+ in: path
+ name: rule_name
+ required: true
+ type: string
+ - description: db type of rule
+ in: path
+ name: db_type
+ required: true
+ type: string
+ - description: update rule knowledge
+ in: body
+ name: req
+ required: true
+ schema:
+ $ref: '#/definitions/v1.UpdateRuleKnowledgeReq'
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetWorkflowDurationOfWaitingForAuditResV1'
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 获取工单从创建到审核结束的平均时长
+ summary: 更新自定义规则知识库
tags:
- - statistic
- /v1/statistic/workflows/duration_of_waiting_for_execution:
+ - rule_template
+ /v1/rule_knowledge/db_types/{db_type}/rules/{rule_name}/:
get:
- deprecated: true
- description: get duration from workflow being created to executed
- operationId: getWorkflowDurationOfWaitingForExecutionV1
+ description: get rule knowledge
+ operationId: getRuleKnowledgeV1
+ parameters:
+ - description: rule name
+ in: path
+ name: rule_name
+ required: true
+ type: string
+ - description: db type of rule
+ in: path
+ name: db_type
+ required: true
+ type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetWorkflowDurationOfWaitingForExecutionResV1'
+ $ref: '#/definitions/v1.GetRuleKnowledgeResV1'
security:
- ApiKeyAuth: []
- summary: 获取工单各从审核完毕到执行上线的平均时长
+ summary: 查看规则知识库
tags:
- - statistic
- /v1/statistic/workflows/each_day_counts:
- get:
- description: get counts of created workflow each day
- operationId: getWorkflowCreatedCountEachDayV1
+ - rule_template
+ patch:
+ description: update rule knowledge
+ operationId: updateRuleKnowledge
parameters:
- - description: filter date from.(format:yyyy-mm-dd)
- in: query
- name: filter_date_from
+ - description: rule name
+ in: path
+ name: rule_name
required: true
type: string
- - description: filter date to.(format:yyyy-mm-dd)
- in: query
- name: filter_date_to
+ - description: db type of rule
+ in: path
+ name: db_type
required: true
type: string
+ - description: update rule knowledge
+ in: body
+ name: req
+ required: true
+ schema:
+ $ref: '#/definitions/v1.UpdateRuleKnowledgeReq'
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetWorkflowCreatedCountsEachDayResV1'
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 获取每天工单创建数量
+ summary: 更新规则知识库
tags:
- - statistic
- /v1/statistic/workflows/instance_type_percent:
+ - rule_template
+ /v1/rule_template_tips:
get:
- description: get workflows percent counted by instance type
- operationId: getWorkflowPercentCountedByInstanceTypeV1
+ description: get global rule template tips
+ operationId: getRuleTemplateTipsV1
+ parameters:
+ - description: filter db type
+ in: query
+ name: filter_db_type
+ type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetWorkflowPercentCountedByInstanceTypeResV1'
+ $ref: '#/definitions/v1.GetRuleTemplateTipsResV1'
security:
- ApiKeyAuth: []
- summary: 获取按数据源类型统计的工单百分比
+ summary: 获取全局规则模板提示
tags:
- - statistic
- /v1/statistic/workflows/pass_percent:
+ - rule_template
+ /v1/rule_templates:
get:
- deprecated: true
- description: get workflow pass percent
- operationId: getWorkflowPassPercentV1
+ description: get all global rule template
+ operationId: getRuleTemplateListV1
+ parameters:
+ - description: page index
+ in: query
+ name: page_index
+ required: true
+ type: integer
+ - description: size of per page
+ in: query
+ name: page_size
+ required: true
+ type: integer
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetWorkflowPassPercentResV1'
+ $ref: '#/definitions/v1.GetRuleTemplatesResV1'
security:
- ApiKeyAuth: []
- summary: 获取工单通过率
+ summary: 全局规则模板列表
tags:
- - statistic
- /v1/statistic/workflows/rejected_percent_group_by_creator:
- get:
- description: get workflows rejected percent group by creator. The result will
- be sorted by rejected percent in descending order
- operationId: getWorkflowRejectedPercentGroupByCreatorV1
+ - rule_template
+ post:
+ consumes:
+ - application/json
+ description: create a global rule template
+ operationId: createRuleTemplateV1
parameters:
- - description: the limit of result item number
- in: query
- name: limit
+ - description: add rule template request
+ in: body
+ name: req
required: true
- type: integer
+ schema:
+ $ref: '#/definitions/v1.CreateRuleTemplateReqV1'
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetWorkflowRejectedPercentGroupByCreatorResV1'
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 获取各个用户提交的工单驳回率,按驳回率降序排列
+ summary: 添加全局规则模板
tags:
- - statistic
- /v1/statistic/workflows/rejected_percent_group_by_instance:
- get:
- deprecated: true
- description: get workflow rejected percent group by instance. The result will
- be sorted by rejected percent in descending order
- operationId: getWorkflowRejectedPercentGroupByInstanceV1
+ - rule_template
+ /v1/rule_templates/{rule_template_name}/:
+ delete:
+ description: delete global rule template
+ operationId: deleteRuleTemplateV1
parameters:
- - description: the limit of result item number
- in: query
- name: limit
+ - description: rule template name
+ in: path
+ name: rule_template_name
required: true
- type: integer
+ type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetWorkflowRejectedPercentGroupByInstanceResV1'
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 获取各个数据源相关的工单驳回率,按驳回率降序排列
+ summary: 删除全局规则模板
tags:
- - statistic
- /v1/statistic/workflows/status_count:
+ - rule_template
get:
- description: get count of workflow status
- operationId: getWorkflowStatusCountV1
+ description: get global rule template
+ operationId: getRuleTemplateV1
+ parameters:
+ - description: rule template name
+ in: path
+ name: rule_template_name
+ required: true
+ type: string
+ - description: fuzzy rule,keyword for desc and annotation
+ in: query
+ name: fuzzy_keyword_rule
+ type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetWorkflowStatusCountResV1'
+ $ref: '#/definitions/v1.GetRuleTemplateResV1'
security:
- ApiKeyAuth: []
- summary: 获取各种状态工单的数量
+ summary: 获取全局规则模板信息
tags:
- - statistic
- /v1/sync_instances:
- get:
- description: get sync instance task list
- operationId: GetSyncInstanceTaskList
+ - rule_template
+ patch:
+ description: update global rule template
+ operationId: updateRuleTemplateV1
+ parameters:
+ - description: rule template name
+ in: path
+ name: rule_template_name
+ required: true
+ type: string
+ - description: update rule template request
+ in: body
+ name: req
+ required: true
+ schema:
+ $ref: '#/definitions/v1.UpdateRuleTemplateReqV1'
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetSyncInstanceTaskListResV1'
+ $ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 获取同步实例任务列表
+ summary: 更新全局规则模板
tags:
- - sync_instance
+ - rule_template
+ /v1/rule_templates/{rule_template_name}/clone:
post:
consumes:
- application/json
- description: create sync instance task
- operationId: createSyncInstanceTaskV1
+ description: clone a rule template
+ operationId: CloneRuleTemplateV1
parameters:
- - description: create sync instance task request
+ - description: rule template name
+ in: path
+ name: rule_template_name
+ required: true
+ type: string
+ - description: clone rule template request
in: body
- name: sync_task
+ name: req
required: true
schema:
- $ref: '#/definitions/v1.CreateSyncInstanceTaskReqV1'
+ $ref: '#/definitions/v1.CloneRuleTemplateReqV1'
responses:
"200":
description: OK
@@ -10207,621 +7007,588 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 创建同步实例任务
+ summary: 克隆全局规则模板
tags:
- - sync_instance
- /v1/sync_instances/{task_id}/:
- delete:
- description: delete sync instance task
- operationId: deleteSyncInstanceTaskV1
+ - rule_template
+ /v1/rule_templates/{rule_template_name}/export:
+ get:
+ description: export rule template
+ operationId: exportRuleTemplateV1
parameters:
- - description: sync task id
+ - description: rule template name
in: path
- name: task_id
+ name: rule_template_name
required: true
type: string
+ responses:
+ "200":
+ description: sqle rule template file
+ schema:
+ type: file
+ security:
+ - ApiKeyAuth: []
+ summary: 导出全局规则模板
+ tags:
+ - rule_template
+ /v1/rule_templates/parse:
+ post:
+ consumes:
+ - multipart/form-data
+ description: parse rule template
+ operationId: importProjectRuleTemplateV1
+ parameters:
+ - description: SQLE rule template file
+ in: formData
+ name: rule_template_file
+ required: true
+ type: file
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.ParseProjectRuleTemplateFileResV1'
security:
- ApiKeyAuth: []
- summary: 删除同步实例任务
+ summary: 解析规则模板文件
tags:
- - sync_instance
+ - rule_template
+ /v1/rules:
get:
- description: get sync task detail
- operationId: GetSyncInstanceTask
+ description: get all rule template
+ operationId: getRuleListV1
parameters:
- - description: sync task id
- in: path
- name: task_id
- required: true
+ - description: filter db type
+ in: query
+ name: filter_db_type
+ type: string
+ - description: fuzzy rule,keyword for desc and annotation
+ in: query
+ name: fuzzy_keyword_rule
+ type: string
+ - description: filter global rule template name
+ in: query
+ name: filter_global_rule_template_name
+ type: string
+ - description: filter rule name list
+ in: query
+ name: filter_rule_names
type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetSyncInstanceTaskResV1'
+ $ref: '#/definitions/v1.GetRulesResV1'
security:
- ApiKeyAuth: []
- summary: 获取同步任务详情
+ summary: 规则列表
tags:
- - sync_instance
- patch:
- description: update sync instance task
- operationId: updateSyncInstanceTaskV1
+ - rule_template
+ /v1/sql_analysis:
+ get:
+ description: Direct get sql analysis result
+ operationId: directGetSQLAnalysisV1
parameters:
- - description: sync task id
- in: path
- name: task_id
+ - description: project name
+ in: query
+ name: project_name
required: true
type: string
- - description: update sync instance request
- in: body
- name: sync_task
+ - description: instance name
+ in: query
+ name: instance_name
required: true
- schema:
- $ref: '#/definitions/v1.UpdateSyncInstanceTaskReqV1'
+ type: string
+ - description: schema name
+ in: query
+ name: schema_name
+ type: string
+ - description: sql
+ in: query
+ name: sql
+ type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.DirectGetSQLAnalysisResV1'
security:
- ApiKeyAuth: []
- summary: 更新同步实例任务
+ summary: 直接获取SQL分析结果
tags:
- - sync_instance
- /v1/sync_instances/{task_id}/trigger:
+ - sql_analysis
+ /v1/sql_audit:
post:
- description: trigger sync instance
- operationId: triggerSyncInstanceV1
+ deprecated: true
+ description: Direct audit sql
+ operationId: directAuditV1
parameters:
- - description: sync task id
- in: path
- name: task_id
+ - description: sqls that should be audited
+ in: body
+ name: req
required: true
- type: string
+ schema:
+ $ref: '#/definitions/v1.DirectAuditReqV1'
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.TriggerSyncInstanceResV1'
+ $ref: '#/definitions/v1.DirectAuditResV1'
security:
- ApiKeyAuth: []
- summary: 触发同步实例
+ summary: 直接审核SQL
tags:
- - sync_instance
- /v1/sync_instances/source_tips:
+ - sql_audit
+ /v1/statistic/instances/sql_average_execution_time:
get:
- description: get sync task tips
- operationId: GetSyncTaskSourceTips
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetSyncTaskSourceTipsResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取同步任务提示
- tags:
- - sync_instance
- /v1/task_groups/audit:
- post:
- consumes:
- - multipart/form-data
- description: |-
- audit task group.
- 1. formData[sql]: sql content;
- 2. file[input_sql_file]: it is a sql file;
- 3. file[input_mybatis_xml_file]: it is mybatis xml file, sql will be parsed from it.
- 4. file[input_zip_file]: it is zip file, sql will be parsed from it.
- operationId: auditTaskGroupIdV1
+ description: get average execution time of sql
+ operationId: getSqlAverageExecutionTimeV1
parameters:
- - description: group id of tasks
- in: formData
- name: task_group_id
+ - description: the limit of result item number
+ in: query
+ name: limit
required: true
type: integer
- - description: sqls for audit
- in: formData
- name: sql
- type: string
- - description: input SQL file
- in: formData
- name: input_sql_file
- type: file
- - description: input mybatis XML file
- in: formData
- name: input_mybatis_xml_file
- type: file
- - description: input ZIP file
- in: formData
- name: input_zip_file
- type: file
- produces:
- - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.AuditTaskGroupResV1'
+ $ref: '#/definitions/v1.GetSqlAverageExecutionTimeResV1'
security:
- ApiKeyAuth: []
- summary: 审核任务组
+ summary: 获取sql上线平均耗时,按平均耗时降序排列
tags:
- - task
- /v1/tasks/audits/{task_id}/:
+ - statistic
+ /v1/statistic/instances/sql_execution_fail_percent:
get:
- description: get task
- operationId: getAuditTaskV1
+ description: get sql execution fail percent
+ operationId: getSqlExecutionFailPercentV1
parameters:
- - description: task id
- in: path
- name: task_id
+ - description: the limit of result item number
+ in: query
+ name: limit
required: true
- type: string
+ type: integer
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetAuditTaskResV1'
+ $ref: '#/definitions/v1.GetSqlExecutionFailPercentResV1'
security:
- ApiKeyAuth: []
- summary: 获取Sql扫描任务信息
+ summary: 获取SQL上线失败率,按失败率降序排列
tags:
- - task
- /v1/tasks/audits/{task_id}/sql_content:
+ - statistic
+ /v1/statistic/instances/type_percent:
get:
- description: get SQL content for the audit task
- operationId: getAuditTaskSQLContentV1
- parameters:
- - description: task id
- in: path
- name: task_id
- required: true
- type: string
+ description: get database instances' types percent
+ operationId: getInstancesTypePercentV1
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetAuditTaskSQLContentResV1'
+ $ref: '#/definitions/v1.GetInstancesTypePercentResV1'
security:
- ApiKeyAuth: []
- summary: 获取指定扫描任务的SQL内容
+ summary: 获取数据源类型百分比
tags:
- - task
- /v1/tasks/audits/{task_id}/sql_file:
+ - statistic
+ /v1/statistic/license/usage:
get:
- description: download SQL file for the audit task
- operationId: downloadAuditTaskSQLFileV1
- parameters:
- - description: task id
- in: path
- name: task_id
- required: true
- type: string
+ description: get usage of license
+ operationId: getLicenseUsageV1
responses:
"200":
- description: sql file
+ description: OK
schema:
- type: file
+ $ref: '#/definitions/v1.GetLicenseUsageResV1'
security:
- ApiKeyAuth: []
- summary: 下载指定扫描任务的SQL文件
+ summary: 获取License使用情况
tags:
- - task
- /v1/tasks/audits/{task_id}/sql_report:
+ - statistic
+ /v1/statistic/workflows/audit_pass_percent:
get:
- description: download report file of all SQLs information belong to the specified
- audit task
- operationId: downloadAuditTaskSQLReportV1
- parameters:
- - description: task id
- in: path
- name: task_id
- required: true
- type: string
- - description: select unique (fingerprint and audit result) for task sql
- in: query
- name: no_duplicate
- type: boolean
+ description: get workflow audit pass percent
+ operationId: getWorkflowAuditPassPercentV1
responses:
"200":
- description: sql report csv file
+ description: OK
schema:
- type: file
- security:
- - ApiKeyAuth: []
- summary: 下载指定扫描任务的SQLs信息报告
- tags:
- - task
- /v1/tasks/audits/{task_id}/sqls:
- get:
- description: get information of all SQLs belong to the specified audit task
- operationId: getAuditTaskSQLsV1
- parameters:
- - description: task id
- in: path
- name: task_id
- required: true
- type: string
- - description: 'filter: exec status of task sql'
- enum:
- - initialized
- - doing
- - succeeded
- - failed
- - manually_executed
- in: query
- name: filter_exec_status
- type: string
- - description: 'filter: audit status of task sql'
- enum:
- - initialized
- - doing
- - finished
- in: query
- name: filter_audit_status
- type: string
- - description: 'filter: audit level of task sql'
- enum:
- - normal
- - notice
- - warn
- - error
- in: query
- name: filter_audit_level
- type: string
- - description: select unique (fingerprint and audit result) for task sql
- in: query
- name: no_duplicate
- type: boolean
- - description: page index
- in: query
- name: page_index
- required: true
- type: string
- - description: page size
- in: query
- name: page_size
- required: true
- type: string
+ $ref: '#/definitions/v1.GetWorkflowAuditPassPercentResV1'
+ security:
+ - ApiKeyAuth: []
+ summary: 获取工单审核通过率
+ tags:
+ - statistic
+ /v1/statistic/workflows/counts:
+ get:
+ description: get workflow counts
+ operationId: getWorkflowCountV1
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetAuditTaskSQLsResV1'
+ $ref: '#/definitions/v1.GetWorkflowCountsResV1'
security:
- ApiKeyAuth: []
- summary: 获取指定扫描任务的SQLs信息
+ summary: 获取工单数量统计数据
tags:
- - task
- /v1/tasks/audits/{task_id}/sqls/{number}:
- patch:
- consumes:
- - application/json
- description: modify the relevant information of a certain SQL in the audit task
- operationId: updateAuditTaskSQLsV1
- parameters:
- - description: task id
- in: path
- name: task_id
- required: true
- type: string
- - description: sql number
- in: path
- name: number
- required: true
- type: string
- - description: modify the relevant information of a certain SQL in the audit
- task
- in: body
- name: audit_plan
- required: true
- schema:
- $ref: '#/definitions/v1.UpdateAuditTaskSQLsReqV1'
+ - statistic
+ /v1/statistic/workflows/duration_of_waiting_for_audit:
+ get:
+ description: get duration from workflow being created to audited
+ operationId: getWorkflowDurationOfWaitingForAuditV1
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetWorkflowDurationOfWaitingForAuditResV1'
security:
- ApiKeyAuth: []
- summary: 修改扫描任务中某条SQL的相关信息
+ summary: 获取工单从创建到审核结束的平均时长
tags:
- - task
- /v1/tasks/audits/{task_id}/sqls/{number}/analysis:
+ - statistic
+ /v1/statistic/workflows/duration_of_waiting_for_execution:
get:
- description: get SQL explain and related table metadata for analysis
- operationId: getTaskAnalysisData
+ deprecated: true
+ description: get duration from workflow being created to executed
+ operationId: getWorkflowDurationOfWaitingForExecutionV1
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/v1.GetWorkflowDurationOfWaitingForExecutionResV1'
+ security:
+ - ApiKeyAuth: []
+ summary: 获取工单各从审核完毕到执行上线的平均时长
+ tags:
+ - statistic
+ /v1/statistic/workflows/each_day_counts:
+ get:
+ description: get counts of created workflow each day
+ operationId: getWorkflowCreatedCountEachDayV1
parameters:
- - description: task id
- in: path
- name: task_id
+ - description: filter date from.(format:yyyy-mm-dd)
+ in: query
+ name: filter_date_from
required: true
type: string
- - description: sql number
- in: path
- name: number
+ - description: filter date to.(format:yyyy-mm-dd)
+ in: query
+ name: filter_date_to
required: true
- type: integer
+ type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetTaskAnalysisDataResV1'
+ $ref: '#/definitions/v1.GetWorkflowCreatedCountsEachDayResV1'
security:
- ApiKeyAuth: []
- summary: 获取task相关的SQL执行计划和表元数据
+ summary: 获取每天工单创建数量
tags:
- - task
- /v1/user:
+ - statistic
+ /v1/statistic/workflows/instance_type_percent:
get:
- description: get current user info
- operationId: getCurrentUserV1
+ description: get workflows percent counted by instance type
+ operationId: getWorkflowPercentCountedByInstanceTypeV1
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetUserDetailResV1'
+ $ref: '#/definitions/v1.GetWorkflowPercentCountedByInstanceTypeResV1'
security:
- ApiKeyAuth: []
- summary: 获取当前用户信息
+ summary: 获取按数据源类型统计的工单百分比
tags:
- - user
- patch:
- consumes:
- - application/json
- description: update current user
- operationId: updateCurrentUserV1
- parameters:
- - description: update user
- in: body
- name: instance
- required: true
- schema:
- $ref: '#/definitions/v1.UpdateCurrentUserReqV1'
- produces:
- - application/json
+ - statistic
+ /v1/statistic/workflows/pass_percent:
+ get:
+ deprecated: true
+ description: get workflow pass percent
+ operationId: getWorkflowPassPercentV1
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetWorkflowPassPercentResV1'
security:
- ApiKeyAuth: []
- summary: 更新个人信息
+ summary: 获取工单通过率
tags:
- - user
- /v1/user/password:
- put:
- consumes:
- - application/json
- description: update current user's password
- operationId: UpdateCurrentUserPasswordV1
+ - statistic
+ /v1/statistic/workflows/rejected_percent_group_by_creator:
+ get:
+ description: get workflows rejected percent group by creator. The result will
+ be sorted by rejected percent in descending order
+ operationId: getWorkflowRejectedPercentGroupByCreatorV1
parameters:
- - description: update user's password
- in: body
- name: instance
+ - description: the limit of result item number
+ in: query
+ name: limit
required: true
- schema:
- $ref: '#/definitions/v1.UpdateCurrentUserPasswordReqV1'
- produces:
- - application/json
+ type: integer
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetWorkflowRejectedPercentGroupByCreatorResV1'
security:
- ApiKeyAuth: []
- summary: 用户修改密码
+ summary: 获取各个用户提交的工单驳回率,按驳回率降序排列
tags:
- - user
- /v1/user_group_tips:
+ - statistic
+ /v1/statistic/workflows/rejected_percent_group_by_instance:
get:
- description: get user group tip list
- operationId: getUserGroupTipListV1
+ deprecated: true
+ description: get workflow rejected percent group by instance. The result will
+ be sorted by rejected percent in descending order
+ operationId: getWorkflowRejectedPercentGroupByInstanceV1
parameters:
- - description: project name
+ - description: the limit of result item number
in: query
- name: filter_project
- type: string
+ name: limit
+ required: true
+ type: integer
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetUserGroupTipsResV1'
+ $ref: '#/definitions/v1.GetWorkflowRejectedPercentGroupByInstanceResV1'
security:
- ApiKeyAuth: []
- summary: 获取用户组提示列表
+ summary: 获取各个数据源相关的工单驳回率,按驳回率降序排列
tags:
- - user_group
- /v1/user_groups:
+ - statistic
+ /v1/statistic/workflows/status_count:
get:
- description: get user group info list
- operationId: getUserGroupListV1
+ description: get count of workflow status
+ operationId: getWorkflowStatusCountV1
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/v1.GetWorkflowStatusCountResV1'
+ security:
+ - ApiKeyAuth: []
+ summary: 获取各种状态工单的数量
+ tags:
+ - statistic
+ /v1/task_groups/audit:
+ post:
+ consumes:
+ - multipart/form-data
+ description: |-
+ audit task group.
+ 1. formData[sql]: sql content;
+ 2. file[input_sql_file]: it is a sql file;
+ 3. file[input_mybatis_xml_file]: it is mybatis xml file, sql will be parsed from it.
+ 4. file[input_zip_file]: it is zip file, sql will be parsed from it.
+ operationId: auditTaskGroupIdV1
parameters:
- - description: filter user group name
- in: query
- name: filter_user_group_name
- type: string
- - description: page index
- in: query
- name: page_index
- required: true
- type: integer
- - description: size of per page
- in: query
- name: page_size
+ - description: group id of tasks
+ in: formData
+ name: task_group_id
required: true
type: integer
+ - description: sqls for audit
+ in: formData
+ name: sql
+ type: string
+ - description: input SQL file
+ in: formData
+ name: input_sql_file
+ type: file
+ - description: input mybatis XML file
+ in: formData
+ name: input_mybatis_xml_file
+ type: file
+ - description: input ZIP file
+ in: formData
+ name: input_zip_file
+ type: file
produces:
- application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetUserGroupsResV1'
+ $ref: '#/definitions/v1.AuditTaskGroupResV1'
security:
- ApiKeyAuth: []
- summary: 获取用户组列表
+ summary: 审核任务组
tags:
- - user_group
- post:
- consumes:
- - application/json
- description: create user group
- operationId: CreateUserGroupV1
+ - task
+ /v1/tasks/audits/{task_id}/:
+ get:
+ description: get task
+ operationId: getAuditTaskV1
parameters:
- - description: create user group
- in: body
- name: instance
+ - description: task id
+ in: path
+ name: task_id
required: true
- schema:
- $ref: '#/definitions/v1.CreateUserGroupReqV1'
- produces:
- - application/json
+ type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetAuditTaskResV1'
security:
- ApiKeyAuth: []
- summary: 创建用户组
+ summary: 获取Sql扫描任务信息
tags:
- - user_group
- /v1/user_groups/{user_group_name}/:
- delete:
- description: delete user group
- operationId: deleteUserGroupV1
+ - task
+ /v1/tasks/audits/{task_id}/sql_content:
+ get:
+ description: get SQL content for the audit task
+ operationId: getAuditTaskSQLContentV1
+ parameters:
+ - description: task id
+ in: path
+ name: task_id
+ required: true
+ type: string
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/v1.GetAuditTaskSQLContentResV1'
+ security:
+ - ApiKeyAuth: []
+ summary: 获取指定扫描任务的SQL内容
+ tags:
+ - task
+ /v1/tasks/audits/{task_id}/sql_file:
+ get:
+ description: download SQL file for the audit task
+ operationId: downloadAuditTaskSQLFileV1
parameters:
- - description: user_group_name
+ - description: task id
in: path
- name: user_group_name
+ name: task_id
required: true
type: string
responses:
"200":
- description: OK
+ description: sql file
schema:
- $ref: '#/definitions/controller.BaseRes'
+ type: file
security:
- ApiKeyAuth: []
- summary: 删除用户组
+ summary: 下载指定扫描任务的SQL文件
tags:
- - user_group
- patch:
- description: update user group
- operationId: updateUserGroupV1
+ - task
+ /v1/tasks/audits/{task_id}/sql_report:
+ get:
+ description: download report file of all SQLs information belong to the specified
+ audit task
+ operationId: downloadAuditTaskSQLReportV1
parameters:
- - description: user_group_name
+ - description: task id
in: path
- name: user_group_name
+ name: task_id
required: true
type: string
- - description: update user group
- in: body
- name: instance
- required: true
- schema:
- $ref: '#/definitions/v1.PatchUserGroupReqV1'
+ - description: select unique (fingerprint and audit result) for task sql
+ in: query
+ name: no_duplicate
+ type: boolean
responses:
"200":
- description: OK
+ description: sql report csv file
schema:
- $ref: '#/definitions/controller.BaseRes'
+ type: file
security:
- ApiKeyAuth: []
- summary: 更新用户组
+ summary: 下载指定扫描任务的SQLs信息报告
tags:
- - user_group
- /v1/user_tips:
+ - task
+ /v1/tasks/audits/{task_id}/sqls:
get:
- description: get user tip list
- operationId: getUserTipListV1
+ description: get information of all SQLs belong to the specified audit task
+ operationId: getAuditTaskSQLsV1
parameters:
- - description: project name
+ - description: task id
+ in: path
+ name: task_id
+ required: true
+ type: string
+ - description: 'filter: exec status of task sql'
+ enum:
+ - initialized
+ - doing
+ - succeeded
+ - failed
+ - manually_executed
in: query
- name: filter_project
+ name: filter_exec_status
type: string
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetUserTipsResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取用户提示列表
- tags:
- - user
- /v1/users:
- get:
- description: get user info list
- operationId: getUserListV1
- parameters:
- - description: filter user name
+ - description: 'filter: audit status of task sql'
+ enum:
+ - initialized
+ - doing
+ - finished
+ in: query
+ name: filter_audit_status
+ type: string
+ - description: 'filter: audit level of task sql'
+ enum:
+ - normal
+ - notice
+ - warn
+ - error
in: query
- name: filter_user_name
+ name: filter_audit_level
type: string
+ - description: select unique (fingerprint and audit result) for task sql
+ in: query
+ name: no_duplicate
+ type: boolean
- description: page index
in: query
name: page_index
required: true
- type: integer
- - description: size of per page
+ type: string
+ - description: page size
in: query
name: page_size
required: true
- type: integer
+ type: string
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/v1.GetUsersResV1'
+ $ref: '#/definitions/v1.GetAuditTaskSQLsResV1'
security:
- ApiKeyAuth: []
- summary: 获取用户信息列表
+ summary: 获取指定扫描任务的SQLs信息
tags:
- - user
- post:
+ - task
+ /v1/tasks/audits/{task_id}/sqls/{number}:
+ patch:
consumes:
- application/json
- description: create user
- operationId: createUserV1
+ description: modify the relevant information of a certain SQL in the audit task
+ operationId: updateAuditTaskSQLsV1
parameters:
- - description: create user
- in: body
- name: instance
+ - description: task id
+ in: path
+ name: task_id
required: true
- schema:
- $ref: '#/definitions/v1.CreateUserReqV1'
- produces:
- - application/json
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 创建用户
- tags:
- - user
- /v1/users/{user_name}/:
- delete:
- description: delete user
- operationId: deleteUserV1
- parameters:
- - description: user name
+ type: string
+ - description: sql number
in: path
- name: user_name
+ name: number
required: true
type: string
+ - description: modify the relevant information of a certain SQL in the audit
+ task
+ in: body
+ name: audit_plan
+ required: true
+ schema:
+ $ref: '#/definitions/v1.UpdateAuditTaskSQLsReqV1'
responses:
"200":
description: OK
@@ -10829,85 +7596,52 @@ paths:
$ref: '#/definitions/controller.BaseRes'
security:
- ApiKeyAuth: []
- summary: 删除用户
+ summary: 修改扫描任务中某条SQL的相关信息
tags:
- - user
+ - task
+ /v1/tasks/audits/{task_id}/sqls/{number}/analysis:
get:
- description: get user info
- operationId: getUserV1
+ description: get SQL explain and related table metadata for analysis
+ operationId: getTaskAnalysisData
parameters:
- - description: user name
+ - description: task id
in: path
- name: user_name
+ name: task_id
required: true
type: string
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v1.GetUserDetailResV1'
- security:
- - ApiKeyAuth: []
- summary: 获取用户信息
- tags:
- - user
- patch:
- consumes:
- - application/json
- description: update user
- operationId: updateUserV1
- parameters:
- - description: user name
+ - description: sql number
in: path
- name: user_name
- required: true
- type: string
- - description: update user
- in: body
- name: instance
+ name: number
required: true
- schema:
- $ref: '#/definitions/v1.UpdateUserReqV1'
- produces:
- - application/json
+ type: integer
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetTaskAnalysisDataResV1'
security:
- ApiKeyAuth: []
- summary: 更新用户信息
+ summary: 获取task相关的SQL执行计划和表元数据
tags:
- - user
- /v1/users/{user_name}/password:
- patch:
- consumes:
- - application/json
- description: admin modifies the passwords of other users
- operationId: UpdateOtherUserPasswordV1
+ - task
+ /v1/user_tips:
+ get:
+ description: get user tip list
+ operationId: getUserTipListV1
parameters:
- - description: user name
- in: path
- name: user_name
+ - description: project name
+ in: query
+ name: filter_project
required: true
type: string
- - description: change user's password
- in: body
- name: instance
- required: true
- schema:
- $ref: '#/definitions/v1.UpdateOtherUserPasswordReqV1'
- produces:
- - application/json
responses:
"200":
description: OK
schema:
- $ref: '#/definitions/controller.BaseRes'
+ $ref: '#/definitions/v1.GetUserTipsResV1'
security:
- ApiKeyAuth: []
- summary: admin修改其他用户密码
+ summary: 获取用户提示列表
tags:
- user
/v1/workflows:
@@ -10935,9 +7669,9 @@ paths:
in: query
name: filter_task_execute_start_time_to
type: string
- - description: filter create user name
+ - description: filter create user id
in: query
- name: filter_create_user_name
+ name: filter_create_user_id
type: string
- description: filter workflow status
enum:
@@ -10951,11 +7685,11 @@ paths:
in: query
name: filter_status
type: string
- - description: filter current step assignee user name
+ - description: filter current step assignee user id
in: query
- name: filter_current_step_assignee_user_name
+ name: filter_current_step_assignee_user_id
type: string
- - description: filter instance name
+ - description: filter instance id
in: query
name: filter_task_instance_name
type: string
@@ -11014,25 +7748,6 @@ paths:
summary: 获取当前 server 支持的审核类型
tags:
- configuration
- /v2/login:
- post:
- description: user login
- operationId: loginV2
- parameters:
- - description: user login request
- in: body
- name: user
- required: true
- schema:
- $ref: '#/definitions/v1.UserLoginReqV1'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- summary: 用户登录
- tags:
- - user
/v2/projects/{project_name}/audit_plans:
get:
description: get audit plan info list
@@ -11216,87 +7931,6 @@ paths:
summary: 增量同步SQL到扫描任务
tags:
- audit_plan
- /v2/projects/{project_name}/instances:
- get:
- description: get instance info list
- operationId: getInstanceListV2
- parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: filter instance name
- in: query
- name: filter_instance_name
- type: string
- - description: filter db type
- in: query
- name: filter_db_type
- type: string
- - description: filter db host
- in: query
- name: filter_db_host
- type: string
- - description: filter db port
- in: query
- name: filter_db_port
- type: string
- - description: filter db user
- in: query
- name: filter_db_user
- type: string
- - description: filter rule template name
- in: query
- name: filter_rule_template_name
- type: string
- - description: page index
- in: query
- name: page_index
- required: true
- type: integer
- - description: size of per page
- in: query
- name: page_size
- required: true
- type: integer
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/v2.GetInstancesResV2'
- security:
- - ApiKeyAuth: []
- summary: 获取实例信息列表
- tags:
- - instance
- post:
- consumes:
- - application/json
- description: create a instance
- operationId: createInstanceV2
- parameters:
- - description: project name
- in: path
- name: project_name
- required: true
- type: string
- - description: add instance
- in: body
- name: instance
- required: true
- schema:
- $ref: '#/definitions/v2.CreateInstanceReqV2'
- responses:
- "200":
- description: OK
- schema:
- $ref: '#/definitions/controller.BaseRes'
- security:
- - ApiKeyAuth: []
- summary: 添加实例
- tags:
- - instance
/v2/projects/{project_name}/instances/{instance_name}/:
get:
description: get instance db
diff --git a/sqle/driver/mysql/audit_test.go b/sqle/driver/mysql/audit_test.go
index 827ed62907..8070cb7bd1 100644
--- a/sqle/driver/mysql/audit_test.go
+++ b/sqle/driver/mysql/audit_test.go
@@ -7029,6 +7029,37 @@ func TestMustMatchLeftMostPrefix(t *testing.T) {
Sql: `select * from exist_tb_9 where v2 = 1 union select * from exist_tb_8 where v2 = 1`,
TriggerRule: false,
},
+ // select subquery
+ {
+ Name: "select-subquery",
+ Sql: `select * from (select * from exist_tb_9) t where t.v1 > 1`,
+ TriggerRule: false,
+ },
+ {
+ Name: "select-subquery",
+ Sql: `select * from (select * from exist_tb_9) t where t.v1 in (1,2,3)`,
+ TriggerRule: false,
+ },
+ {
+ Name: "select-subquery",
+ Sql: `select * from (select * from exist_tb_9) t left join exist_tb_8 t1 on t.id=t1.id where t1.v1 in (1,2,3)`,
+ TriggerRule: true,
+ },
+ {
+ Name: "select-subquery",
+ Sql: `select * from (select * from exist_tb_9) t left join exist_tb_8 t1 on t.id=t1.id where t1.v1 > 1`,
+ TriggerRule: true,
+ },
+ {
+ Name: "select-subquery",
+ Sql: `select * from (select * from exist_tb_8) t left join exist_tb_9 t1 on t.id=t1.id where t1.v3 > 1`,
+ TriggerRule: false,
+ },
+ {
+ Name: "select-subquery",
+ Sql: `select * from (select * from exist_tb_8) t left join exist_tb_9 t1 on t.id=t1.id where t1.v3 in (1, 2, 3)`,
+ TriggerRule: false,
+ },
}
rule := rulepkg.RuleHandlerMap[rulepkg.DMLMustMatchLeftMostPrefix].Rule
@@ -7282,6 +7313,22 @@ func TestMustUseLeftMostPrefix(t *testing.T) {
Sql: `select * from exist_tb_9 where v2 = 1 union select * from exist_tb_8 where v2 = 1`,
TriggerRule: true,
},
+ // select subquery
+ {
+ Name: "select-subquery",
+ Sql: `select * from (select * from exist_tb_9) t where v3=1`,
+ TriggerRule: false,
+ },
+ {
+ Name: "select-subquery",
+ Sql: `select * from (select * from exist_tb_8) t left join exist_tb_9 t1 on t.id=t1.id where t1.v3=1`,
+ TriggerRule: true,
+ },
+ {
+ Name: "select-subquery",
+ Sql: `select * from (select * from exist_tb_9) t left join exist_tb_8 t1 on t.id=t1.id where t.v3=1`,
+ TriggerRule: false,
+ },
}
rule := rulepkg.RuleHandlerMap[rulepkg.DMLMustUseLeftMostPrefix].Rule
diff --git a/sqle/driver/mysql/rule/rule.go b/sqle/driver/mysql/rule/rule.go
index 87c5dac3b6..071d02ee35 100644
--- a/sqle/driver/mysql/rule/rule.go
+++ b/sqle/driver/mysql/rule/rule.go
@@ -17,7 +17,6 @@ import (
"github.com/actiontech/sqle/sqle/driver/mysql/util"
driverV2 "github.com/actiontech/sqle/sqle/driver/v2"
"github.com/actiontech/sqle/sqle/log"
- "github.com/actiontech/sqle/sqle/pkg/params"
"github.com/actiontech/sqle/sqle/utils"
"github.com/pingcap/parser/ast"
@@ -297,2134 +296,6 @@ const (
DefaultMultiParamsSecondKeyName = "multi_params_second_key"
)
-var RuleHandlers = []RuleHandler{
- // config
- {
- Rule: driverV2.Rule{
- Name: ConfigDMLRollbackMaxRows,
- Desc: "在 DML 语句中预计影响行数超过指定值则不回滚",
- Annotation: "大事务回滚,容易影响数据库性能,使得业务发生波动;具体规则阈值可以根据业务需求调整,默认值:1000",
- //Value: "1000",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeGlobalConfig,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "1000",
- Desc: "最大影响行数",
- Type: params.ParamTypeInt,
- },
- },
- },
- Func: nil,
- },
- {
- Rule: driverV2.Rule{
- Name: ConfigDDLOSCMinSize,
- Desc: "改表时,表空间超过指定大小(MB)审核时输出osc改写建议",
- Annotation: "开启该规则后会对大表的DDL语句给出 pt-osc工具的改写建议【需要参考命令进行手工执行,后续会支持自动执行】;直接对大表进行DDL变更时可能会导致长时间锁表问题,影响业务可持续性。具体对大表定义的阈值可以根据业务需求调整,默认值:1024",
- //Value: "16",
- Level: driverV2.RuleLevelNormal,
- Category: RuleTypeGlobalConfig,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "1024",
- Desc: "表空间大小(MB)",
- Type: params.ParamTypeInt,
- },
- },
- },
- Func: nil,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckTableSize,
- Desc: "不建议对数据量过大的表执行DDL操作",
- Annotation: "大表执行DDL,耗时较久且负载较高,长时间占用锁资源,会影响数据库性能;具体规则阈值可以根据业务需求调整,默认值:1024",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDDLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "1024",
- Desc: "表空间大小(MB)",
- Type: params.ParamTypeInt,
- },
- },
- },
- Message: "执行DDL的表 %v 空间不建议超过 %vMB",
- OnlyAuditNotExecutedSQL: true,
- Func: checkDDLTableSize,
- }, {
- Rule: driverV2.Rule{
- Name: DDLCheckIndexTooMany,
- Desc: "单字段上的索引数量不建议超过阈值",
- Annotation: "单字段上存在过多索引,一般情况下这些索引都是没有存在价值的;相反,还会降低数据增加删除时的性能,特别是对频繁更新的表来说,负面影响更大;具体规则阈值可以根据业务需求调整,默认值:2",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeIndexingConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "2",
- Desc: "单字段的索引数最大值",
- Type: params.ParamTypeInt,
- },
- },
- },
- Message: "字段 %v 上的索引数量不建议超过%v个",
- NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}, &ast.CreateIndexStmt{}},
- Func: checkIndex,
- },
- {
- Rule: driverV2.Rule{
- Name: ConfigDMLExplainPreCheckEnable,
- Desc: "使用EXPLAIN加强预检查能力",
- Annotation: "通过 EXPLAIN 的形式将待上线的DML进行SQL是否能正确执行的检查,提前发现语句的错误,提高上线成功率",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeGlobalConfig,
- },
- Func: nil,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckRedundantIndex,
- Desc: "不建议创建冗余索引",
- Annotation: "MySQL需要单独维护重复的索引,冗余索引增加维护成本,并且优化器在优化查询时需要逐个进行代价计算,影响查询性能",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeIndexOptimization,
- },
- Message: "%v",
- AllowOffline: true,
- NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}, &ast.CreateIndexStmt{}},
- Func: checkIndex,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckTableSize,
- Desc: "不建议对数据量过大的表执行DML操作",
- Annotation: "DML操作大表,耗时较久且负载较高,容易影响数据库性能;具体规则阈值可以根据业务需求调整,默认值:1024",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "1024",
- Desc: "表空间大小(MB)",
- Type: params.ParamTypeInt,
- },
- },
- },
- Message: "执行DML的表 %v 空间不建议超过 %vMB",
- Func: checkDMLTableSize,
- },
- {
- Rule: driverV2.Rule{
- Name: ConfigOptimizeIndexEnabled,
- Desc: "索引创建建议",
- Annotation: "通过该规则开启索引优化建议,提供两个参数配置来定义索引优化建议的行为。1. 计算列基数阈值:配置当表数据量超过多少行时不再计算列的区分度来排序索引优先级,防止对大表进行操作影响性能;2. 联合索引最大列数:限制联合索引给到的列数最大值,防止给出建议的联合索引不符合其他SQL标准",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeIndexOptimization,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultMultiParamsFirstKeyName,
- Value: "1000000",
- Desc: "计算列基数阈值",
- Type: params.ParamTypeInt,
- },
- ¶ms.Param{
- Key: DefaultMultiParamsSecondKeyName,
- Value: "3",
- Desc: "联合索引最大列数",
- Type: params.ParamTypeInt,
- },
- },
- },
- },
-
- {
- Rule: driverV2.Rule{
- Name: ConfigSQLIsExecuted,
- Desc: "停用上线审核模式",
- Annotation: "启用该规则来兼容事后审核的场景,对于事后采集的DDL 和 DML 语句将不再进行上线校验。例如库表元数据的扫描任务可开启该规则",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeGlobalConfig,
- },
- },
-
- {
- Rule: driverV2.Rule{
- Name: ConfigDDLGhostMinSize,
- Desc: "改表时,表空间超过指定大小(MB)时使用gh-ost上线",
- Annotation: "开启该规则后会自动对大表的DDL操作使用gh-ost 工具进行在线改表;直接对大表进行DDL变更时可能会导致长时间锁表问题,影响业务可持续性。具体对大表定义的阈值可以根据业务需求调整,默认值:1024",
- //Value: "16",
- Level: driverV2.RuleLevelNormal,
- Category: RuleTypeGlobalConfig,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "1024",
- Desc: "表空间大小(MB)",
- Type: params.ParamTypeInt,
- },
- },
- },
- Func: nil,
- },
-
- // rule
- {
- Rule: driverV2.Rule{
- Name: DDLCheckPKWithoutIfNotExists,
- Desc: "新建表建议加入 IF NOT EXISTS,保证重复执行不报错",
- Annotation: "新建表如果表已经存在,不添加IF NOT EXISTS CREATE执行SQL会报错,建议开启此规则,避免SQL实际执行报错",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeUsageSuggestion,
- },
- Message: "新建表建议加入 IF NOT EXISTS,保证重复执行不报错",
- AllowOffline: true,
- Func: checkIfNotExist,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckObjectNameLength,
- Desc: "表名、列名、索引名的长度不建议超过阈值",
- Annotation: "通过配置该规则可以规范指定业务的对象命名长度,具体长度可以自定义设置,默认最大长度:64。是MySQL规定标识符命名最大长度为64字节",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeNamingConvention,
- //Value: "64",
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "64",
- Desc: "最大长度(字节)",
- Type: params.ParamTypeInt,
- },
- },
- },
- Message: "表名、列名、索引名的长度不建议大于%v字节",
- AllowOffline: true,
- Func: checkNewObjectName,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckObjectNameIsUpperAndLowerLetterMixed,
- Desc: "数据库对象命名不建议大小写字母混合",
- Annotation: "数据库对象命名规范,不推荐采用大小写混用的形式建议词语之间使用下划线连接,提高代码可读性",
- Category: RuleTypeNamingConvention,
- Level: driverV2.RuleLevelNotice,
- },
- Message: "数据库对象命名不建议大小写字母混合,以下对象命名不规范:%v",
- Func: checkIsObjectNameUpperAndLowerLetterMixed,
- AllowOffline: true,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckPKNotExist,
- Desc: "表必须有主键",
- Annotation: "主键使数据达到全局唯一,可提高数据检索效率",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeIndexingConvention,
- },
- Message: "表必须有主键",
- AllowOffline: true,
- NotAllowOfflineStmts: []ast.Node{&ast.AlterTableStmt{}},
- NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}},
- Func: checkPrimaryKey,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckPKWithoutAutoIncrement,
- Desc: "主键建议使用自增",
- Annotation: "自增主键,数字型速度快,而且是增量增长,占用空间小,更快速的做数据插入操作,避免增加维护索引的开销",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeIndexingConvention,
- },
- Message: "主键建议使用自增",
- AllowOffline: true,
- NotAllowOfflineStmts: []ast.Node{&ast.AlterTableStmt{}},
- NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}},
- Func: checkPrimaryKey,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckPKWithoutBigintUnsigned,
- Desc: "主键建议使用 BIGINT 无符号类型,即 BIGINT UNSIGNED",
- Annotation: "BIGINT UNSIGNED拥有更大的取值范围,建议开启此规则,避免发生溢出",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeIndexingConvention,
- },
- Message: "主键建议使用 BIGINT 无符号类型,即 BIGINT UNSIGNED",
- AllowOffline: true,
- NotAllowOfflineStmts: []ast.Node{&ast.AlterTableStmt{}},
- NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}},
- Func: checkPrimaryKey,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckJoinFieldType,
- Desc: "建议JOIN字段类型保持一致",
- Annotation: "JOIN字段类型不一致会导致类型不匹配发生隐式准换,建议开启此规则,避免索引失效",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- Message: "建议JOIN字段类型保持一致, 否则会导致隐式转换",
- AllowOffline: false,
- Func: checkJoinFieldType,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckHasJoinCondition,
- Desc: "建议连接操作指定连接条件",
- Annotation: "指定连接条件可以确保连接操作的正确性和可靠性,如果没有指定连接条件,可能会导致连接失败或连接不正确的情况。",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- Message: "建议连接操作指定连接条件,JOIN字段后必须有ON条件",
- AllowOffline: true,
- Func: checkHasJoinCondition,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckColumnCharLength,
- Desc: "CHAR长度大于20时,必须使用VARCHAR类型",
- Annotation: "VARCHAR是变长字段,存储空间小,可节省存储空间,同时相对较小的字段检索效率显然也要高些",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDDLConvention,
- },
- Message: "CHAR长度大于20时,必须使用VARCHAR类型",
- AllowOffline: true,
- Func: checkStringType,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckFieldNotNUllMustContainDefaultValue,
- Desc: "建议字段约束为NOT NULL时带默认值",
- Annotation: "如存在NOT NULL且不带默认值的字段,INSERT时不包含该字段,会导致插入报错",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDDLConvention,
- },
- Message: "建议字段约束为NOT NULL时带默认值,以下字段不规范:%v",
- AllowOffline: true,
- Func: checkFieldNotNUllMustContainDefaultValue,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLDisableFK,
- Desc: "禁止使用外键",
- Annotation: "外键在高并发场景下性能较差,容易造成死锁,同时不利于后期维护(拆分、迁移)",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeIndexingConvention,
- },
- Message: "禁止使用外键",
- AllowOffline: true,
- Func: checkForeignKey,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLDisableAlterFieldUseFirstAndAfter,
- Desc: "ALTER表字段禁止使用FIRST,AFTER",
- Annotation: "FIRST,AFTER 的ALTER操作通过COPY TABLE的方式完成,对业务影响较大",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDDLConvention,
- },
- Message: "ALTER表字段禁止使用FIRST,AFTER",
- AllowOffline: true,
- Func: disableAlterUseFirstAndAfter,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckCreateTimeColumn,
- Desc: "建议建表DDL包含创建时间字段且默认值为CURRENT_TIMESTAMP",
- Annotation: "使用CREATE_TIME字段,有利于问题查找跟踪和检索数据,同时避免后期对数据生命周期管理不便 ,默认值为CURRENT_TIMESTAMP可保证时间的准确性",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDDLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "CREATE_TIME",
- Desc: "创建时间字段名",
- Type: params.ParamTypeString,
- },
- },
- },
- Message: "建议建表DDL包含%v字段且默认值为CURRENT_TIMESTAMP",
- AllowOffline: true,
- Func: checkFieldCreateTime,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckIndexCount,
- Desc: "索引个数建议不超过阈值",
- Annotation: "在表上建立的每个索引都会增加存储开销,索引对于插入、删除、更新操作也会增加处理上的开销,太多与不充分、不正确的索引对性能都毫无益处;具体规则阈值可以根据业务需求调整,默认值:5",
- Level: driverV2.RuleLevelNotice,
- //Value: "5",
- Category: RuleTypeIndexingConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "5",
- Desc: "最大索引个数",
- Type: params.ParamTypeInt,
- },
- },
- },
- Message: "索引个数建议不超过%v个",
- AllowOffline: true,
- NotAllowOfflineStmts: []ast.Node{&ast.AlterTableStmt{}, &ast.CreateIndexStmt{}},
- NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}, &ast.CreateIndexStmt{}},
- Func: checkIndex,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckUpdateTimeColumn,
- Desc: "建表DDL需要包含更新时间字段且默认值为CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP",
- Annotation: "使用更新时间字段,有利于问题查找跟踪和检索数据,同时避免后期对数据生命周期管理不便 ,默认值为UPDATE_TIME可保证时间的准确性",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDDLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "UPDATE_TIME",
- Desc: "更新时间字段名",
- Type: params.ParamTypeString,
- },
- },
- },
- Message: "建表DDL需要包含%v字段且默认值为CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP",
- AllowOffline: true,
- Func: checkFieldUpdateTime,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckCompositeIndexMax,
- Desc: "复合索引的列数量不建议超过阈值",
- Annotation: "复合索引会根据索引列数创建对应组合的索引,列数越多,创建的索引越多,每个索引都会增加磁盘空间的开销,同时增加索引维护的开销;具体规则阈值可以根据业务需求调整,默认值:3",
- Level: driverV2.RuleLevelNotice,
- //Value: "3",
- Category: RuleTypeIndexingConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "3",
- Desc: "最大索引列数量",
- Type: params.ParamTypeInt,
- },
- },
- },
- Message: "复合索引的列数量不建议超过%v个",
- AllowOffline: true,
- NotAllowOfflineStmts: []ast.Node{&ast.AlterTableStmt{}, &ast.CreateIndexStmt{}},
- NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}, &ast.CreateIndexStmt{}},
- Func: checkIndex,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckIndexNotNullConstraint,
- Desc: "索引字段需要有非空约束",
- Annotation: "索引字段上如果没有非空约束,则表记录与索引记录不会完全映射。",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeIndexingConvention,
- },
- Message: "这些索引字段(%v)需要有非空约束",
- AllowOffline: true,
- NotAllowOfflineStmts: []ast.Node{&ast.AlterTableStmt{}, &ast.CreateIndexStmt{}},
- Func: checkIndexNotNullConstraint,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckObjectNameUsingKeyword,
- Desc: "数据库对象命名禁止使用保留字",
- Annotation: "通过配置该规则可以规范指定业务的数据对象命名规则,避免发生冲突,以及混淆",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeNamingConvention,
- },
- Message: "数据库对象命名禁止使用保留字 %s",
- AllowOffline: true,
- Func: checkNewObjectName,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckObjectNameUseCN,
- Desc: "数据库对象命名只能使用英文、下划线或数字,首字母必须是英文",
- Annotation: "通过配置该规则可以规范指定业务的数据对象命名规则",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeNamingConvention,
- },
- Message: "数据库对象命名只能使用英文、下划线或数字,首字母必须是英文",
- AllowOffline: true,
- Func: checkNewObjectName,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckTableDBEngine,
- Desc: "建议使用指定数据库引擎",
- Annotation: "通过配置该规则可以规范指定业务的数据库引擎,具体规则可以自定义设置。默认值是INNODB,INNODB 支持事务,支持行级锁,更好的恢复性,高并发下性能更好",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDDLConvention,
- //Value: "Innodb",
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "Innodb",
- Desc: "数据库引擎",
- Type: params.ParamTypeString,
- },
- },
- },
- Message: "建议使用%v数据库引擎",
- AllowOffline: false,
- Func: checkEngine,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckTableCharacterSet,
- Desc: "建议使用指定数据库字符集",
- Annotation: "通过该规则约束全局的数据库字符集,避免创建非预期的字符集,防止业务侧出现“乱码”等问题。建议项目内库表使用统一的字符集和字符集排序,部分连表查询的情况下字段的字符集或排序规则不一致可能会导致索引失效且不易发现",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDDLConvention,
- //Value: "utf8mb4",
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "utf8mb4",
- Desc: "数据库字符集",
- Type: params.ParamTypeString,
- },
- },
- },
- Message: "建议使用%v数据库字符集",
- AllowOffline: false,
- Func: checkCharacterSet,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckIndexedColumnWithBlob,
- Desc: "禁止将BLOB类型的列加入索引",
- Annotation: "BLOB类型属于大字段类型,作为索引会占用很大的存储空间",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeIndexingConvention,
- },
- Message: "禁止将BLOB类型的列加入索引",
- AllowOffline: true,
- NotAllowOfflineStmts: []ast.Node{&ast.AlterTableStmt{}, &ast.CreateIndexStmt{}},
- NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}, &ast.CreateIndexStmt{}},
- Func: disableAddIndexForColumnsTypeBlob,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckWhereIsInvalid,
- Desc: "禁止使用没有WHERE条件或者WHERE条件恒为TRUE的SQL",
- Annotation: "SQL缺少WHERE条件在执行时会进行全表扫描产生额外开销,建议在大数据量高并发环境下开启,避免影响数据库查询性能",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDMLConvention,
- },
- Message: "禁止使用没有WHERE条件或者WHERE条件恒为TRUE的SQL",
- AllowOffline: true,
- Func: checkSelectWhere,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckAlterTableNeedMerge,
- Desc: "存在多条对同一个表的修改语句,建议合并成一个ALTER语句",
- Annotation: "避免多次 TABLE REBUILD 带来的消耗、以及对线上业务的影响",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeUsageSuggestion,
- },
- Message: "已存在对该表的修改语句,建议合并成一个ALTER语句",
- AllowOffline: false,
- OnlyAuditNotExecutedSQL: true,
- Func: checkMergeAlterTable,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLDisableSelectAllColumn,
- Desc: "不建议使用SELECT *",
- Annotation: "当表结构变更时,使用*通配符选择所有列将导致查询行为会发生更改,与业务期望不符;同时SELECT * 中的无用字段会带来不必要的磁盘I/O,以及网络开销,且无法覆盖索引进而回表,大幅度降低查询效率",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDMLConvention,
- },
- Message: "不建议使用SELECT *",
- AllowOffline: true,
- Func: checkSelectAll,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLDisableDropStatement,
- Desc: "禁止除索引外的DROP操作",
- Annotation: "DROP是DDL,数据变更不会写入日志,无法进行回滚;建议开启此规则,避免误删除操作",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeUsageSuggestion,
- },
- Message: "禁止除索引外的DROP操作",
- AllowOffline: true,
- Func: disableDropStmt,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckTableWithoutComment,
- Desc: "表建议添加注释",
- Annotation: "表添加注释能够使表的意义更明确,方便日后的维护",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDDLConvention,
- },
- Message: "表建议添加注释",
- AllowOffline: true,
- Func: checkTableWithoutComment,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckColumnWithoutComment,
- Desc: "列建议添加注释",
- Annotation: "列添加注释能够使列的意义更明确,方便日后的维护",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDDLConvention,
- },
- Message: "列建议添加注释",
- AllowOffline: true,
- Func: checkColumnWithoutComment,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckIndexPrefix,
- Desc: "建议普通索引使用固定前缀",
- Annotation: "通过配置该规则可以规范指定业务的索引命名规则,具体命名规范可以自定义设置,默认提示值:idx_",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeNamingConvention,
- //Value: "idx_",
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "idx_",
- Desc: "索引前缀",
- Type: params.ParamTypeString,
- },
- },
- },
- Message: "建议普通索引要以\"%v\"为前缀",
- AllowOffline: true,
- Func: checkIndexPrefix,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckUniqueIndexPrefix,
- Desc: "建议UNIQUE索引使用固定前缀",
- Annotation: "通过配置该规则可以规范指定业务的UNIQUE索引命名规则,具体命名规范可以自定义设置,默认提示值:uniq_",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeNamingConvention,
- //Value: "uniq_",
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "uniq_",
- Desc: "索引前缀",
- Type: params.ParamTypeString,
- },
- },
- },
- Message: "建议UNIQUE索引要以\"%v\"为前缀",
- AllowOffline: true,
- Func: checkUniqIndexPrefix,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckUniqueIndex,
- Desc: "建议UNIQUE索引名使用 IDX_UK_表名_字段名",
- Annotation: "通过配置该规则可以规范指定业务的UNIQUE索引命名规则",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeNamingConvention,
- },
- Message: "建议UNIQUE索引名使用 IDX_UK_表名_字段名",
- AllowOffline: true,
- Func: checkUniqIndex,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckColumnWithoutDefault,
- Desc: "除了自增列及大字段列之外,每个列都必须添加默认值",
- Annotation: "列添加默认值,可避免列为NULL值时对查询的影响",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDDLConvention,
- },
- Message: "除了自增列及大字段列之外,每个列都必须添加默认值",
- AllowOffline: true,
- Func: checkColumnWithoutDefault,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckColumnTimestampWithoutDefault,
- Desc: "TIMESTAMP 类型的列必须添加默认值",
- Annotation: "TIMESTAMP添加默认值,可避免出现全为0的日期格式与业务预期不符",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDDLConvention,
- },
- Message: "TIMESTAMP 类型的列必须添加默认值",
- AllowOffline: true,
- Func: checkColumnTimestampWithoutDefault,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckColumnBlobWithNotNull,
- Desc: "BLOB 和 TEXT 类型的字段不建议设置为 NOT NULL",
- Annotation: "BLOB 和 TEXT 类型的字段无法指定默认值,如插入数据不指定字段默认为NULL,如果添加了 NOT NULL 限制,写入数据时又未对该字段指定值会导致写入失败",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDDLConvention,
- },
- Message: "BLOB 和 TEXT 类型的字段不建议设置为 NOT NULL",
- AllowOffline: true,
- Func: checkColumnBlobNotNull,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckColumnBlobDefaultIsNotNull,
- Desc: "BLOB 和 TEXT 类型的字段默认值只能为NULL",
- Annotation: "在SQL_MODE严格模式下BLOB 和 TEXT 类型无法设置默认值,如插入数据不指定值,字段会被设置为NULL",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDDLConvention,
- },
- Message: "BLOB 和 TEXT 类型的字段默认值只能为NULL",
- AllowOffline: true,
- Func: checkColumnBlobDefaultNull,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckAutoIncrementFieldNum,
- Desc: "建表时,自增字段只能设置一个",
- Annotation: "MySQL InnoDB,MyISAM 引擎不允许存在多个自增字段,设置多个自增字段会导致上线失败。",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDDLConvention,
- },
- AllowOffline: true,
- Message: "建表时,自增字段只能设置一个",
- Func: checkAutoIncrementFieldNum,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckAllIndexNotNullConstraint,
- Desc: "建议为至少一个索引添加非空约束",
- Annotation: "所有索引字段均未做非空约束,请确认下表索引规划的合理性。",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDDLConvention,
- },
- AllowOffline: true,
- Message: "建议为至少一个索引添加非空约束",
- Func: checkAllIndexNotNullConstraint,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckWithLimit,
- Desc: "DELETE/UPDATE 语句不能有LIMIT条件",
- Annotation: "DELETE/UPDATE 语句使用LIMIT条件将随机选取数据进行删除或者更新,业务无法预期",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDMLConvention,
- },
- Message: "DELETE/UPDATE 语句不能有LIMIT条件",
- AllowOffline: true,
- Func: checkDMLWithLimit,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckSelectLimit,
- Desc: "SELECT 语句需要带LIMIT",
- Annotation: "如果查询的扫描行数很大,可能会导致优化器选择错误的索引甚至不走索引;具体规则阈值可以根据业务需求调整,默认值:1000",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "1000",
- Desc: "最大查询行数",
- Type: params.ParamTypeInt,
- },
- },
- },
- Message: "SELECT 语句需要带LIMIT,且限制数不得超过%v",
- AllowOffline: true,
- Func: checkSelectLimit,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckWithOrderBy,
- Desc: "DELETE/UPDATE 语句不能有ORDER BY",
- Annotation: "DELETE/UPDATE 存在ORDER BY会使用排序,带来无谓的开销",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDMLConvention,
- },
- Message: "DELETE/UPDATE 语句不能有ORDER BY",
- AllowOffline: true,
- Func: checkDMLWithOrderBy,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckSelectWithOrderBy,
- Desc: "SELECT 语句不能有ORDER BY",
- Annotation: "ORDER BY 对查询性能影响较大,同时不便于优化维护,建议将排序部分放到业务处理",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- Message: "SELECT 语句不能有ORDER BY",
- AllowOffline: true,
- Func: checkSelectWithOrderBy,
- },
- {
- // TODO: 修改level以适配默认模板
- Rule: driverV2.Rule{
- Name: DMLCheckInsertColumnsExist,
- Desc: "INSERT 语句需要指定COLUMN",
- Annotation: "当表结构发生变更,INSERT请求不明确指定列名,会发生插入数据不匹配的情况;建议开启此规则,避免插入结果与业务预期不符",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDMLConvention,
- },
- Message: "INSERT 语句需要指定COLUMN",
- AllowOffline: true,
- Func: checkDMLWithInsertColumnExist,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckBatchInsertListsMax,
- Desc: "单条INSERT语句,建议批量插入不超过阈值",
- Annotation: "避免大事务,以及降低发生回滚对业务的影响;具体规则阈值可以根据业务需求调整,默认值:100",
- Level: driverV2.RuleLevelNotice,
- //Value: "5000",
- Category: RuleTypeDMLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "100",
- Desc: "最大插入行数",
- Type: params.ParamTypeInt,
- },
- },
- },
- Message: "单条INSERT语句,建议批量插入不超过%v条",
- AllowOffline: true,
- Func: checkDMLWithBatchInsertMaxLimits,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckInQueryNumber,
- Desc: "WHERE条件内IN语句中的参数个数不能超过阈值",
- Annotation: "当IN值过多时,有可能会导致查询进行全表扫描,使得MySQL性能急剧下降;具体规则阈值可以根据业务需求调整,默认值:50",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "50",
- Desc: "in语句参数最大个数",
- Type: params.ParamTypeInt,
- },
- },
- },
- Message: "WHERE条件内IN语句中的参数已有%v个,不建议超过阙值%v",
- AllowOffline: true,
- Func: checkInQueryLimit,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckPKProhibitAutoIncrement,
- Desc: "不建议主键使用自增",
- Annotation: "后期维护相对不便,过于依赖数据库自增机制达到全局唯一,不易拆分,容易造成主键冲突",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeIndexingConvention,
- },
- Message: "不建议主键使用自增",
- AllowOffline: true,
- NotAllowOfflineStmts: []ast.Node{&ast.AlterTableStmt{}},
- NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}},
- Func: checkPrimaryKey,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckWhereExistFunc,
- Desc: "避免对条件字段使用函数操作",
- Annotation: "对条件字段做函数操作,可能会破坏索引值的有序性,导致优化器选择放弃走索引,使查询性能大幅度降低",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDMLConvention,
- },
- Message: "避免对条件字段使用函数操作",
- AllowOffline: false,
- Func: checkWhereExistFunc,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckWhereExistNot,
- Desc: "不建议对条件字段使用负向查询",
- Annotation: "使用负向查询,将导致全表扫描,出现慢SQL",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDMLConvention,
- },
- Message: "不建议对条件字段使用负向查询",
- AllowOffline: true,
- Func: checkSelectWhere,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLWhereExistNull,
- Desc: "不建议对条件字段使用 NULL 值判断",
- Annotation: "使用 IS NULL 或 IS NOT NULL 可能导致查询放弃使用索引而进行全表扫描",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDMLConvention,
- },
- Message: "不建议对条件字段使用 NULL 值判断",
- Func: checkWhereExistNull,
- AllowOffline: true,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckWhereExistImplicitConversion,
- Desc: "不建议在WHERE条件中使用与过滤字段不一致的数据类型",
- Annotation: "WHERE条件中使用与过滤字段不一致的数据类型会引发隐式数据类型转换,导致查询有无法命中索引的风险,在高并发、大数据量的情况下,不走索引会使得数据库的查询性能严重下降",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDMLConvention,
- },
- Message: "不建议在WHERE条件中使用与过滤字段不一致的数据类型",
- Func: checkWhereColumnImplicitConversion,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckLimitMustExist,
- Desc: "建议DELETE/UPDATE 语句带有LIMIT条件",
- Annotation: "LIMIT条件可以降低写错 SQL 的代价(删错数据),同时避免长事务影响业务",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- Message: "建议DELETE/UPDATE 语句带有LIMIT条件",
- Func: checkDMLLimitExist,
- AllowOffline: true,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckWhereExistScalarSubquery,
- Desc: "不建议使用标量子查询",
- Annotation: "标量子查询存在多次访问同一张表的问题,执行开销大效率低,可使用LEFT JOIN 替代标量子查询",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDMLConvention,
- },
- Message: "不建议使用标量子查询",
- AllowOffline: true,
- Func: checkSelectWhere,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckIndexesExistBeforeCreateConstraints,
- Desc: "对字段创建约束前,建议先创建索引",
- Annotation: "创建约束前,先行创建索引,约束可作用于二级索引,避免全表扫描,提高性能",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeIndexingConvention,
- },
- Message: "对字段创建约束前,建议先创建索引",
- OnlyAuditNotExecutedSQL: true,
- Func: checkIndexesExistBeforeCreatConstraints,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckSelectForUpdate,
- Desc: "不建议使用SELECT FOR UPDATE",
- Annotation: "SELECT FOR UPDATE 会对查询结果集中每行数据都添加排他锁,其他线程对该记录的更新与删除操作都会阻塞,在高并发下,容易造成数据库大量锁等待,影响数据库查询性能",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDMLConvention,
- },
- Message: "不建议使用SELECT FOR UPDATE",
- Func: checkDMLSelectForUpdate,
- AllowOffline: true,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckDatabaseCollation,
- Desc: "建议使用规定的数据库排序规则",
- Annotation: "通过该规则约束全局的数据库排序规则,避免创建非预期的数据库排序规则,防止业务侧出现排序结果非预期等问题。建议项目内库表使用统一的字符集和字符集排序,部分连表查询的情况下字段的字符集或排序规则不一致可能会导致索引失效且不易发现",
- Level: driverV2.RuleLevelNotice,
- //Value: "utf8mb4_0900_ai_ci",
- Category: RuleTypeDDLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "utf8mb4_0900_ai_ci",
- Desc: "数据库排序规则",
- Type: params.ParamTypeString,
- },
- },
- },
- Message: "建议使用规定的数据库排序规则为%s",
- Func: checkCollationDatabase,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckDecimalTypeColumn,
- Desc: "精确浮点数建议使用DECIMAL",
- Annotation: "对于浮点数运算,DECIMAL精确度较高",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDDLConvention,
- },
- Message: "精确浮点数建议使用DECIMAL",
- Func: checkDecimalTypeColumn,
- AllowOffline: true,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckBigintInsteadOfDecimal,
- Desc: "建议用BIGINT类型代替DECIMAL",
- Annotation: "因为CPU不支持对DECIMAL的直接运算,只是MySQL自身实现了DECIMAL的高精度计算,但是计算代价高,并且存储同样范围值的时候,空间占用也更多;使用BIGINT代替DECIMAL,可根据小数的位数乘以相应的倍数,即可达到精确的浮点存储计算,避免DECIMAL计算代价高的问题",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDDLConvention,
- },
- Message: "建议列%s用BIGINT类型代替DECIMAL",
- Func: checkBigintInsteadOfDecimal,
- AllowOffline: true,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckSubQueryNestNum,
- Desc: "子查询嵌套层数不建议超过阈值",
- Annotation: "子查询嵌套层数超过阈值,有些情况下,子查询并不能使用到索引。同时对于返回结果集比较大的子查询,会产生大量的临时表,消耗过多的CPU和IO资源,产生大量的慢查询",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "3",
- Desc: "子查询嵌套层数不建议超过阈值",
- Type: params.ParamTypeInt,
- },
- },
- },
- Message: "子查询嵌套层数超过阈值%v",
- Func: checkSubQueryNestNum,
- AllowOffline: true,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckNeedlessFunc,
- Desc: "避免使用不必要的内置函数",
- Annotation: "通过配置该规则可以指定业务中需要禁止使用的内置函数,使用内置函数可能会导致SQL无法走索引或者产生一些非预期的结果。实际需要禁用的函数可通过规则设置",
- Level: driverV2.RuleLevelNotice,
- //Value: "sha(),sqrt(),md5()",
- Category: RuleTypeDMLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "sha(),sqrt(),md5()",
- Desc: "指定的函数集合(逗号分割)",
- Type: params.ParamTypeString,
- },
- },
- },
- Message: "避免使用不必要的内置函数%v",
- Func: checkNeedlessFunc,
- AllowOffline: true,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckDatabaseSuffix,
- Desc: "建议数据库名称使用固定后缀结尾",
- Annotation: "通过配置该规则可以规范指定业务的数据库命名规则,具体命名规范可以自定义设置,默认提示值:_DB",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeNamingConvention,
- //Value: "_DB",
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "_DB",
- Desc: "数据库名称后缀",
- Type: params.ParamTypeString,
- },
- },
- },
- Message: "建议数据库名称以\"%v\"结尾",
- Func: checkDatabaseSuffix,
- AllowOffline: true,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckPKName,
- Desc: "建议主键命名为\"PK_表名\"",
- Annotation: "通过配置该规则可以规范指定业务的主键命名规则",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeNamingConvention,
- },
- Message: "建议主键命名为\"PK_表名\"",
- Func: checkPKIndexName,
- AllowOffline: true,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckTransactionIsolationLevel,
- Desc: "事物隔离级别建议设置成RC",
- Annotation: "RC避免了脏读的现象,但没有解决幻读的问题;使用RR,能避免幻读,但是由于引入间隙锁导致加锁的范围可能扩大,从而会影响并发,还容易造成死锁,所以在大多数业务场景下,幻读出现的机率较少,RC基本上能满足业务需求",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeUsageSuggestion,
- },
- Message: "事物隔离级别建议设置成RC",
- Func: checkTransactionIsolationLevel,
- AllowOffline: true,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckFuzzySearch,
- Desc: "禁止使用全模糊搜索或左模糊搜索",
- Annotation: "使用全模糊搜索或左模糊搜索将导致查询无法使用索引,导致全表扫描",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDMLConvention,
- },
- Message: "禁止使用全模糊搜索或左模糊搜索",
- AllowOffline: true,
- Func: checkSelectWhere,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckTablePartition,
- Desc: "不建议使用分区表相关功能",
- Annotation: "分区表在物理上表现为多个文件,在逻辑上表现为一个表,跨分区查询效率可能更低,建议采用物理分表的方式管理大数据",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeUsageSuggestion,
- },
- Message: "不建议使用分区表相关功能",
- AllowOffline: true,
- Func: checkTablePartition,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckNumberOfJoinTables,
- Desc: "使用JOIN连接表查询建议不超过阈值",
- Annotation: "表关联越多,意味着各种驱动关系组合就越多,比较各种结果集的执行成本的代价也就越高,进而SQL查询性能会大幅度下降;具体规则阈值可以根据业务需求调整,默认值:3",
- Level: driverV2.RuleLevelNotice,
- //Value: "3",
- Category: RuleTypeDMLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "3",
- Desc: "最大连接表个数",
- Type: params.ParamTypeInt,
- },
- },
- },
- Message: "使用JOIN连接表查询建议不超过%v张",
- AllowOffline: true,
- Func: checkNumberOfJoinTables,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckIfAfterUnionDistinct,
- Desc: "建议使用UNION ALL,替代UNION",
- Annotation: "UNION会按照字段的顺序进行排序同时去重,UNION ALL只是简单的将两个结果合并后就返回,从效率上看,UNION ALL 要比UNION快很多;如果合并的两个结果集中允许包含重复数据且不需要排序时的话,建议开启此规则,使用UNION ALL替代UNION",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDMLConvention,
- },
- Message: "建议使用UNION ALL,替代UNION",
- AllowOffline: true,
- Func: checkIsAfterUnionDistinct,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckIsExistLimitOffset,
- Desc: "使用分页查询时,避免使用偏移量",
- Annotation: "例如:LIMIT N OFFSET M 或 LIMIT M,N。当偏移量m过大的时候,查询效率会很低,因为MySQL是先查出m+n个数据,然后抛弃掉前m个数据;对于有大数据量的MySQL表来说,使用LIMIT分页存在很严重的性能问题",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDMLConvention,
- },
- Message: "使用分页查询时,避免使用偏移量",
- AllowOffline: true,
- Func: checkIsExistLimitOffset,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckIndexOption,
- Desc: "建议索引字段对区分度大于阈值",
- Annotation: "选择区分度高的字段作为索引,可快速定位数据;区分度太低,无法有效利用索引,甚至可能需要扫描大量数据页,拖慢SQL;具体规则阈值可以根据业务需求调整,默认值:70",
- Level: driverV2.RuleLevelNotice,
- //Value: "0.7",
- Category: RuleTypeIndexOptimization,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "70",
- Desc: "可选择性(百分比)",
- Type: params.ParamTypeInt,
- },
- },
- },
- Message: "索引 %v 未超过区分度阈值 百分之%v, 不建议选为索引",
- AllowOffline: false,
- Func: checkIndexOption,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckColumnEnumNotice,
- Desc: "不建议使用 ENUM 类型",
- Annotation: "ENUM类型不是SQL标准,移植性较差,后期如修改或增加枚举值需重建整张表,代价较大,且无法通过字面量值进行排序",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDDLConvention,
- },
- Message: "不建议使用 ENUM 类型",
- AllowOffline: true,
- Func: checkColumnEnumNotice,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckColumnSetNotice,
- Desc: "不建议使用 SET 类型",
- Annotation: "集合的修改需要重新定义列,后期修改的代价大,建议在业务层实现",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDDLConvention,
- },
- Message: "不建议使用 SET 类型",
- AllowOffline: true,
- Func: checkColumnSetNotice,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckColumnBlobNotice,
- Desc: "不建议使用 BLOB 或 TEXT 类型",
- Annotation: "BLOB 或 TEXT 类型消耗大量的网络和IO带宽,同时在该表上的DML操作都会变得很慢",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDDLConvention,
- },
- Message: "不建议使用 BLOB 或 TEXT 类型",
- AllowOffline: true,
- Func: checkColumnBlobNotice,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckExplainAccessTypeAll,
- //Value: "10000",
- Desc: "全表扫描时,扫描行数不建议超过指定行数(默认值:10000)",
- Annotation: "全表扫描时,扫描行数不建议超过指定行数是为了避免性能问题;具体规则阈值可以根据业务需求调整,默认值:10000;如果设置为0,全表扫描都会触发规则",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "10000",
- Desc: "最大扫描行数",
- Type: params.ParamTypeInt,
- },
- },
- },
- Message: "该查询使用了全表扫描并且扫描行数为%v",
- AllowOffline: false,
- Func: checkExplain,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckExplainExtraUsingFilesort,
- Desc: "不建议使用文件排序",
- Annotation: "大数据量的情况下,文件排序意味着SQL性能较低,会增加OS的开销,影响数据库性能",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- Message: "不建议使用文件排序",
- AllowOffline: false,
- Func: checkExplain,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckExplainExtraUsingTemporary,
- Desc: "不建议使用临时表",
- Annotation: "大数据量的情况下,临时表意味着SQL性能较低,会增加OS的开销,影响数据库性能",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- Message: "不建议使用临时表",
- AllowOffline: false,
- Func: checkExplain,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckCreateView,
- Desc: "禁止使用视图",
- Annotation: "视图的查询性能较差,同时基表结构变更,需要对视图进行维护,如果视图可读性差且包含复杂的逻辑,都会增加维护的成本",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeUsageSuggestion,
- },
- Message: "禁止使用视图",
- AllowOffline: true,
- Func: checkCreateView,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckCreateTrigger,
- Desc: "禁止使用触发器",
- Annotation: "触发器难以开发和维护,不能高效移植,且在复杂的逻辑以及高并发下,容易出现死锁影响业务",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeUsageSuggestion,
- },
- Message: "禁止使用触发器",
- AllowOffline: true,
- Func: checkCreateTrigger,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckCreateFunction,
- Desc: "禁止使用自定义函数",
- Annotation: "自定义函数,维护较差,且依赖性高会导致SQL无法跨库使用",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeUsageSuggestion,
- },
- Message: "禁止使用自定义函数",
- AllowOffline: true,
- Func: checkCreateFunction,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckCreateProcedure,
- Desc: "禁止使用存储过程",
- Annotation: "存储过程在一定程度上会使程序难以调试和拓展,各种数据库的存储过程语法相差很大,给将来的数据库移植带来很大的困难,且会极大的增加出现BUG的概率",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeUsageSuggestion,
- },
- Message: "禁止使用存储过程",
- AllowOffline: true,
- Func: checkCreateProcedure,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLDisableTypeTimestamp,
- Desc: "不建议使用TIMESTAMP字段",
- Annotation: "TIMESTAMP 有最大值限制('2038-01-19 03:14:07' UTC),且会时区转换的问题",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDDLConvention,
- },
- Message: "不建议使用TIMESTAMP字段",
- AllowOffline: true,
- Func: disableUseTypeTimestampField,
- },
- {
- Rule: driverV2.Rule{ //select a as id, id , b as user from mysql.user;
- Name: DMLCheckAlias,
- Desc: "别名不建议与表或列的名字相同",
- Annotation: "表或列的别名与其真实名称相同, 这样的别名会使得查询更难去分辨",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- Message: "这些别名(%v)与列名或表名相同",
- Func: checkAlias,
- },
- {
- Rule: driverV2.Rule{ //ALTER TABLE test CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
- Name: DDLHintUpdateTableCharsetWillNotUpdateFieldCharset,
- Desc: "不建议修改表的默认字符集",
- Annotation: "修改表的默认字符集,只会影响后续新增的字段,不会修表已有字段的字符集;如需修改整张表所有字段的字符集建议开启此规则",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDDLConvention,
- },
- Message: "不建议修改表的默认字符集",
- Func: hintUpdateTableCharsetWillNotUpdateFieldCharset,
- }, {
- Rule: driverV2.Rule{ //ALTER TABLE tbl DROP COLUMN col;
- Name: DDLHintDropColumn,
- Desc: "禁止进行删除列的操作",
- Annotation: "业务逻辑与删除列依赖未完全消除,列被删除后可能导致程序异常(无法正常读写)的情况;开启该规则,SQLE将提醒删除列为高危操作",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDDLConvention,
- },
- Message: "禁止进行删除列的操作",
- Func: hintDropColumn,
- }, {
- Rule: driverV2.Rule{ //ALTER TABLE tbl DROP PRIMARY KEY;
- Name: DDLHintDropPrimaryKey,
- Desc: "禁止进行删除主键的操作",
- Annotation: "删除已有约束会影响已有业务逻辑;开启该规则,SQLE将提醒删除主键为高危操作",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDDLConvention,
- },
- Message: "禁止进行删除主键的操作",
- Func: hintDropPrimaryKey,
- }, {
- Rule: driverV2.Rule{ //ALTER TABLE tbl DROP FOREIGN KEY a;
- Name: DDLHintDropForeignKey,
- Desc: "禁止进行删除外键的操作",
- Annotation: "删除已有约束会影响已有业务逻辑;开启该规则,SQLE将提醒删除外键为高危操作",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDDLConvention,
- },
- Message: "禁止进行删除外键的操作",
- Func: hintDropForeignKey,
- },
- {
- Rule: driverV2.Rule{ //select * from user where id like "a";
- Name: DMLNotRecommendNotWildcardLike,
- Desc: "不建议使用没有通配符的 LIKE 查询",
- Annotation: "不包含通配符的 LIKE 查询逻辑上与等值查询相同,建议使用等值查询替代",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- Message: "不建议使用没有通配符的 LIKE 查询",
- Func: notRecommendNotWildcardLike,
- }, {
- Rule: driverV2.Rule{ //SELECT * FROM tb WHERE col IN (NULL);
- Name: DMLHintInNullOnlyFalse,
- Desc: "避免使用 IN (NULL) 或者 NOT IN (NULL)",
- Annotation: "查询条件永远非真,这将导致查询无匹配到的结果",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDMLConvention,
- },
- Message: "避免使用IN (NULL)/NOT IN (NULL) ,该用法永远非真将导致条件失效",
- Func: hintInNullOnlyFalse,
- }, {
- Rule: driverV2.Rule{ //select * from user where id in (a);
- Name: DMLNotRecommendIn,
- Desc: "不建议使用IN",
- Annotation: "当IN值过多时,有可能会导致查询进行全表扫描,使得MySQL性能急剧下降",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- Message: "不建议使用IN",
- Func: notRecommendIn,
- },
- {
- Rule: driverV2.Rule{ //select * from user where id = ' 1';
- Name: DMLCheckSpacesAroundTheString,
- Desc: "引号中的字符串开头或结尾不建议包含空格",
- Annotation: "字符串前后存在空格将可能导致查询判断逻辑出错,如在MySQL 5.5中'a'和'a '在查询中被认为是相同的值",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDMLConvention,
- },
- Message: "引号中的字符串开头或结尾不建议包含空格",
- Func: checkSpacesAroundTheString,
- }, {
- Rule: driverV2.Rule{ //CREATE TABLE tb (a varchar(10) default '“');
- Name: DDLCheckFullWidthQuotationMarks,
- Desc: "DDL语句中不建议使用中文全角引号",
- Annotation: "建议开启此规则,可避免MySQL会将中文全角引号识别为命名的一部分,执行结果与业务预期不符",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDDLConvention,
- },
- Message: "DDL语句中不建议使用中文全角引号,这可能是书写错误",
- Func: checkFullWidthQuotationMarks,
- }, {
- Rule: driverV2.Rule{ //select name from tbl where id < 1000 order by rand(1)
- Name: DMLNotRecommendOrderByRand,
- Desc: "不建议使用 ORDER BY RAND()",
- Annotation: "ORDER BY RAND()使用了临时表,同时还要对其进行排序,在数据量很大的情况下会增加服务器负载以及增加查询时间",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- Message: "不建议使用 ORDER BY RAND()",
- Func: notRecommendOrderByRand,
- }, {
- Rule: driverV2.Rule{ //select col1,col2 from tbl group by 1
- Name: DMLNotRecommendGroupByConstant,
- Desc: "不建议对常量进行 GROUP BY",
- Annotation: "GROUP BY 1 表示按第一列进行GROUP BY;在GROUP BY子句中使用数字,而不是表达式或列名称,当查询列顺序改变时,会导致查询逻辑出现问题",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- Message: "不建议对常量进行 GROUP BY",
- Func: notRecommendGroupByConstant,
- }, {
- Rule: driverV2.Rule{ //select c1,c2,c3 from t1 where c1='foo' order by c2 desc, c3 asc
- Name: DMLCheckSortDirection,
- Desc: "不建议在 ORDER BY 语句中对多个不同条件使用不同方向的排序",
- Annotation: "在 MySQL 8.0 之前当 ORDER BY 多个列指定的排序方向不同时将无法使用已经建立的索引。在MySQL8.0 之后可以建立对应的排序顺序的联合索引来优化",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- Message: "不建议在 ORDER BY 语句中对多个不同条件使用不同方向的排序",
- Func: checkSortDirection,
- }, {
- Rule: driverV2.Rule{ //select col1,col2 from tbl group by 1
- Name: DMLHintGroupByRequiresConditions,
- Desc: "建议为GROUP BY语句添加ORDER BY条件",
- Annotation: "在5.7中,MySQL默认会对’GROUP BY col1, …’按如下顺序’ORDER BY col1,…’隐式排序,导致产生无谓的排序,带来额外的开销;在8.0中,则不会出现这种情况。如果不需要排序建议显示添加’ORDER BY NULL’",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- Message: "建议为GROUP BY语句添加ORDER BY条件",
- Func: hintGroupByRequiresConditions,
- }, {
- Rule: driverV2.Rule{ //select description from film where title ='ACADEMY DINOSAUR' order by length-language_id;
- Name: DMLNotRecommendGroupByExpression,
- Desc: "不建议ORDER BY 的条件为表达式",
- Annotation: "当ORDER BY条件为表达式或函数时会使用到临时表,如果在未指定WHERE或WHERE条件返回的结果集较大时性能会很差",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- Message: "不建议ORDER BY 的条件为表达式",
- Func: notRecommendGroupByExpression,
- }, {
- Rule: driverV2.Rule{ //select description from film where title ='ACADEMY DINOSAUR' order by length-language_id;
- Name: DMLCheckSQLLength,
- Desc: "建议将过长的SQL分解成几个简单的SQL",
- Annotation: "过长的SQL可读性较差,难以维护,且容易引发性能问题;具体规则阈值可以根据业务需求调整,默认值:1024",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDMLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "1024",
- Desc: "SQL最大长度",
- Type: params.ParamTypeInt,
- },
- },
- },
- Message: "建议将过长的SQL分解成几个简单的SQL",
- Func: checkSQLLength,
- }, {
- Rule: driverV2.Rule{ //SELECT s.c_id,count(s.c_id) FROM s where c = test GROUP BY s.c_id HAVING s.c_id <> '1660' AND s.c_id <> '2' order by s.c_id
- Name: DMLNotRecommendHaving,
- Desc: "不建议使用 HAVING 子句",
- Annotation: "对于索引字段,放在HAVING子句中时不会走索引;建议将HAVING子句改写为WHERE中的查询条件,可以在查询处理期间使用索引,提高SQL的执行效率",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- Message: "不建议使用 HAVING 子句",
- Func: notRecommendHaving,
- }, {
- Rule: driverV2.Rule{ //delete from tbl
- Name: DMLHintUseTruncateInsteadOfDelete,
- Desc: "删除全表时建议使用 TRUNCATE 替代 DELETE",
- Annotation: "TRUNCATE TABLE 比 DELETE 速度快,且使用的系统和事务日志资源少,同时TRUNCATE后表所占用的空间会被释放,而DELETE后需要手工执行OPTIMIZE才能释放表空间",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDMLConvention,
- },
- Message: "删除全表时建议使用 TRUNCATE 替代 DELETE",
- Func: hintUseTruncateInsteadOfDelete,
- }, {
- Rule: driverV2.Rule{ //update mysql.func set name ="hello";
- Name: DMLNotRecommendUpdatePK,
- Desc: "不建议UPDATE主键",
- Annotation: "主键索引数据列的顺序就是表记录的物理存储顺序,频繁更新主键将导致整个表记录的顺序的调整,会耗费相当大的资源",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDMLConvention,
- },
- Message: "不建议UPDATE主键",
- Func: notRecommendUpdatePK,
- }, {
- Rule: driverV2.Rule{ //create table t(c1 int,c2 int,c3 int,c4 int,c5 int,c6 int);
- Name: DDLCheckColumnQuantity,
- Desc: "表的列数不建议超过阈值",
- Annotation: "避免在OLTP系统上做宽表设计,后期对性能影响很大;具体规则阈值可根据业务需求调整,默认值:40",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDDLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "40",
- Desc: "最大列数",
- Type: params.ParamTypeInt,
- },
- },
- },
- Message: "表的列数不建议超过阈值",
- Func: checkColumnQuantity,
- AllowOffline: true,
- }, {
- Rule: driverV2.Rule{ //CREATE TABLE `tb2` ( `id` int(11) DEFAULT NULL, `col` char(10) CHARACTER SET utf8 DEFAULT NULL)
- Name: DDLRecommendTableColumnCharsetSame,
- Desc: "建议列与表使用同一个字符集",
- Annotation: "统一字符集可以避免由于字符集转换产生的乱码,不同的字符集进行比较前需要进行转换会造成索引失效",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDDLConvention,
- },
- Message: "建议列与表使用同一个字符集",
- Func: recommendTableColumnCharsetSame,
- }, {
- Rule: driverV2.Rule{ //CREATE TABLE tab (a INT(1));
- Name: DDLCheckColumnTypeInteger,
- Desc: "整型定义建议采用 INT(10) 或 BIGINT(20)",
- Annotation: "INT(M) 或 BIGINT(M),M 表示最大显示宽度,可存储最大值的宽度分别为10、20,采用 INT(10) 或 BIGINT(20)可避免发生显示截断的可能",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDDLConvention,
- },
- Message: "整型定义建议采用 INT(10) 或 BIGINT(20)",
- Func: checkColumnTypeInteger,
- }, {
- Rule: driverV2.Rule{ //CREATE TABLE tab (a varchar(3500));
- Name: DDLCheckVarcharSize,
- Desc: "定义VARCHAR 长度时不建议大于阈值",
- Annotation: "MySQL建立索引时没有限制索引的大小,索引长度会默认采用的该字段的长度,VARCHAR 定义长度越长建立的索引存储大小越大;具体规则阈值可以根据业务需求调整,默认值:1024",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDDLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "1024",
- Desc: "VARCHAR最大长度",
- Type: params.ParamTypeInt,
- },
- },
- },
- Message: "定义VARCHAR 长度时不建议大于阈值, 阈值为%d",
- Func: checkVarcharSize,
- }, {
- Rule: driverV2.Rule{ //select id from t where substring(name,1,3)='abc'
- Name: DMLNotRecommendFuncInWhere,
- Desc: "应避免在 WHERE 条件中使用函数或其他运算符",
- Annotation: "函数或运算符会导致查询无法利用表中的索引,该查询将会全表扫描,性能较差",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- Message: "应避免在 WHERE 条件中使用函数或其他运算符",
- Func: notRecommendFuncInWhere,
- }, {
- Rule: driverV2.Rule{ //SELECT SYSDATE();
- Name: DMLNotRecommendSysdate,
- Desc: "不建议使用 SYSDATE() 函数",
- Annotation: "当SYSDATE()函数在基于STATEMENT模式的主从环境下可能造成数据的不一致,因为语句在主库中执行到日志传递到备库,存在时间差,到备库执行的时候就会变成不同的时间值,建议采取ROW模式的复制环境",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDMLConvention,
- },
- Message: "不建议使用 SYSDATE() 函数",
- Func: notRecommendSysdate,
- }, {
- Rule: driverV2.Rule{ //SELECT SUM(COL) FROM tbl;
- Name: DMLHintSumFuncTips,
- Desc: "避免使用 SUM(COL)",
- Annotation: "当某一列的值全是NULL时,COUNT(COL)的返回结果为0,但SUM(COL)的返回结果为NULL,因此使用SUM()时需注意NPE问题(指数据返回NULL);如业务需避免NPE问题,建议开启此规则",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDMLConvention,
- },
- Message: "避免使用 SUM(COL) ,该用法存在返回NULL值导致程序空指针的风险",
- Func: hintSumFuncTips,
- }, {
- Rule: driverV2.Rule{
- Name: DMLHintCountFuncWithCol,
- Desc: "避免使用 COUNT(COL)",
- Annotation: "建议使用COUNT(*),因为使用 COUNT(COL) 需要对表进行全表扫描,这可能会导致性能下降。",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDMLConvention,
- },
- Message: "避免使用 COUNT(COL)",
- Func: hintCountFuncWithCol,
- AllowOffline: true,
- }, {
- Rule: driverV2.Rule{
- Name: DDLCheckColumnQuantityInPK,
- Desc: "主键包含的列数不建议超过阈值",
- Annotation: "主建中的列过多,会导致二级索引占用更多的空间,同时增加索引维护的开销;具体规则阈值可根据业务需求调整,默认值:2",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDDLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "2",
- Desc: "最大列数",
- Type: params.ParamTypeInt,
- },
- },
- },
- Message: "主键包含的列数不建议超过阈值",
- Func: checkColumnQuantityInPK,
- }, {
- Rule: driverV2.Rule{ //select col1,col2 from tbl where name=xx limit 10
- Name: DMLHintLimitMustBeCombinedWithOrderBy,
- Desc: "LIMIT 查询建议使用ORDER BY",
- Annotation: "没有ORDER BY的LIMIT会导致非确定性的结果可能与业务需求不符,这取决于执行计划",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDMLConvention,
- },
- Message: "LIMIT 查询建议使用ORDER BY",
- Func: hintLimitMustBeCombinedWithOrderBy,
- },
- {
- Rule: driverV2.Rule{ //TRUNCATE TABLE tbl_name
- Name: DMLHintTruncateTips,
- Desc: "不建议使用TRUNCATE操作",
- Annotation: "TRUNCATE是DLL,数据不能回滚,在没有备份情况下,谨慎使用TRUNCATE",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDMLConvention,
- },
- Message: "不建议使用TRUNCATE操作",
- Func: hintTruncateTips,
- }, {
- Rule: driverV2.Rule{ //delete from t where col = 'condition'
- Name: DMLHintDeleteTips,
- Desc: "建议在执行DELETE/DROP/TRUNCATE等操作前进行备份",
- Annotation: "DROP/TRUNCATE是DDL,操作立即生效,不会写入日志,所以无法回滚,在执行高危操作之前对数据进行备份是很有必要的",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDMLConvention,
- },
- Message: "建议在执行DELETE/DROP/TRUNCATE等操作前进行备份",
- Func: hintDeleteTips,
- }, {
- Rule: driverV2.Rule{ //SELECT BENCHMARK(10, RAND())
- Name: DMLCheckSQLInjectionFunc,
- Desc: "不建议使用常见 SQL 注入函数",
- Annotation: "攻击者通过SQL注入,可未经授权可访问数据库中的数据,存在盗取用户信息,造成用户数据泄露等安全漏洞问题",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- Message: "不建议使用常见 SQL 注入函数",
- Func: checkSQLInjectionFunc,
- }, {
- Rule: driverV2.Rule{ //select col1,col2 from tbl where type!=0
- Name: DMLCheckNotEqualSymbol,
- Desc: "建议使用'<>'代替'!='",
- Annotation: "'!=' 是非标准的运算符,'<>' 才是SQL中标准的不等于运算符",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDMLConvention,
- },
- Message: "建议使用'<>'代替'!='",
- Func: checkNotEqualSymbol,
- }, {
- Rule: driverV2.Rule{ //select col1,col2,col3 from table1 where col2 in(select col from table2)
- Name: DMLNotRecommendSubquery,
- Desc: "不推荐使用子查询",
- Annotation: "有些情况下,子查询并不能使用到索引,同时对于返回结果集比较大的子查询,会产生大量的临时表,消耗过多的CPU和IO资源,产生大量的慢查询",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDMLConvention,
- },
- Message: "不推荐使用子查询",
- Func: notRecommendSubquery,
- }, {
- Rule: driverV2.Rule{ //SELECT * FROM staff WHERE name IN (SELECT NAME FROM customer ORDER BY name LIMIT 1)
- Name: DMLCheckSubqueryLimit,
- Desc: "不建议在子查询中使用LIMIT",
- Annotation: "部分MySQL版本不支持在子查询中进行'LIMIT & IN/ALL/ANY/SOME'",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- Message: "不建议在子查询中使用LIMIT",
- Func: checkSubqueryLimit,
- }, {
- Rule: driverV2.Rule{ //CREATE TABLE tbl (a int) AUTO_INCREMENT = 10;
- Name: DDLCheckAutoIncrement,
- Desc: "表的初始AUTO_INCREMENT值建议为0",
- Annotation: "创建表时AUTO_INCREMENT设置为0则自增从1开始,可以避免数据空洞。例如在导出表结构DDL时,表结构内AUTO_INCREMENT通常为当前的自增值,如果建表时没有把AUTO_INCREMENT设置为0,那么通过该DDL进行建表操作会导致自增值从一个无意义数字开始。",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDDLConvention,
- },
- Message: "表的初始AUTO_INCREMENT值建议为0",
- Func: checkAutoIncrement,
- }, {
- Rule: driverV2.Rule{ // rename table t1 to t2;
- Name: DDLNotAllowRenaming,
- Desc: "禁止使用RENAME或CHANGE对表名字段名进行修改",
- Annotation: "RENAME/CHANGE 表名/列名会对线上业务不停机发布造成影响,如需这种操作应当DBA手工干预",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDDLConvention,
- },
- AllowOffline: true,
- Message: "禁止使用RENAME或CHANGE对表名字段名进行修改",
- Func: ddlNotAllowRenaming,
- }, {
- Rule: driverV2.Rule{
- Name: DMLCheckExplainFullIndexScan,
- Desc: "不建议对表进行全索引扫描",
- Annotation: "在数据量大的情况下索引全扫描严重影响SQL性能。",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- AllowOffline: false,
- Message: "不建议对表进行全索引扫描",
- Func: checkExplain,
- }, {
- Rule: driverV2.Rule{
- Name: DMLCheckLimitOffsetNum,
- Desc: "不建议LIMIT的偏移OFFSET大于阈值",
- Annotation: "因为OFFSET指定了结果集的起始位置,如果起始位置过大,那么 MySQL 需要处理更多的数据才能返回结果集,这可能会导致查询性能下降。",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDMLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "100",
- Desc: "offset 大小",
- Type: params.ParamTypeInt,
- },
- },
- },
- Message: "不建议LIMIT的偏移OFFSET大于阈值,OFFSET=%v(阈值为%v)",
- AllowOffline: true,
- Func: checkLimitOffsetNum,
- }, {
- Rule: driverV2.Rule{
- Name: DMLCheckUpdateOrDeleteHasWhere,
- Desc: "建议UPDATE/DELETE操作使用WHERE条件",
- Annotation: "因为这些语句的目的是修改数据库中的数据,需要使用 WHERE 条件来过滤需要更新或删除的记录,以确保数据的正确性。另外,使用 WHERE 条件还可以提高查询性能。",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDMLConvention,
- },
- Message: "建议UPDATE/DELETE操作使用WHERE条件",
- AllowOffline: true,
- Func: checkUpdateOrDeleteHasWhere,
- }, {
- Rule: driverV2.Rule{
- Name: DMLCheckSortColumnLength,
- Desc: "禁止对长字段排序",
- Annotation: "对例如VARCHAR(2000)这样的长字段进行ORDER BY、DISTINCT、GROUP BY、UNION之类的操作,会引发排序,有性能隐患",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeUsageSuggestion,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "2000",
- Desc: "可排序字段的最大长度",
- Type: params.ParamTypeInt,
- },
- },
- },
- AllowOffline: false,
- Message: "长度超过阈值的字段不建议用于ORDER BY、DISTINCT、GROUP BY、UNION,这些字段有:%v",
- Func: checkSortColumnLength,
- }, {
- Rule: driverV2.Rule{
- Name: AllCheckPrepareStatementPlaceholders,
- Desc: "绑定的变量个数不建议超过阈值",
- Annotation: "因为过度使用绑定变量会增加查询的复杂度,从而降低查询性能。过度使用绑定变量还会增加维护成本。默认阈值:100",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeUsageSuggestion,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "100",
- Desc: "最大绑定变量数量",
- Type: params.ParamTypeInt,
- },
- },
- },
- AllowOffline: true,
- Message: "使用绑定变量数量为 %v,不建议超过设定阈值 %v",
- Func: checkPrepareStatementPlaceholders,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckExplainExtraUsingIndexForSkipScan,
- Desc: "不建议对表进行索引跳跃扫描",
- Annotation: "索引扫描是跳跃扫描,未遵循最左匹配原则,可能降低索引的使用效率,影响查询性能",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDMLConvention,
- },
- AllowOffline: false,
- Message: "不建议对表进行索引跳跃扫描",
- Func: checkExplain,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckAffectedRows,
- Desc: "UPDATE/DELETE操作影响行数不建议超过阈值",
- Annotation: "如果 DML 操作影响行数过多,会导致查询性能下降,因为需要扫描更多的数据。",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDMLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "10000",
- Desc: "最大影响行数",
- Type: params.ParamTypeInt,
- },
- },
- },
- AllowOffline: false,
- Message: "UPDATE/DELETE操作影响行数不建议超过阈值,影响行数为 %v,超过设定阈值 %v",
- Func: checkAffectedRows,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckSameTableJoinedMultipleTimes,
- Desc: "不建议对同一张表连接多次",
- Annotation: "如果对单表查询多次,会导致查询性能下降。",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDMLConvention,
- },
- AllowOffline: false,
- Message: "表%v被连接多次",
- Func: checkSameTableJoinedMultipleTimes,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckExplainUsingIndex,
- Desc: "SQL查询条件需要走索引",
- Annotation: "使用索引可以显著提高SQL查询的性能。",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- AllowOffline: false,
- Message: "建议使用索引以优化 SQL 查询性能",
- Func: checkExplain,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckInsertSelect,
- Desc: "不建议使用INSERT ... SELECT",
- Annotation: "使用 INSERT ... SELECT 在默认事务隔离级别下,可能会导致对查询的表施加表级锁。",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- AllowOffline: true,
- Message: "不建议使用INSERT ... SELECT",
- Func: checkInsertSelect,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckAggregate,
- Desc: "不建议使用聚合函数",
- Annotation: "不建议使用SQL聚合函数,是为了确保查询的简单性、高性能和数据一致性。",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDMLConvention,
- },
- AllowOffline: true,
- Message: "不建议使用聚合函数计算",
- Func: checkAggregateFunc,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckColumnNotNULL,
- Desc: "表字段建议有NOT NULL约束",
- Annotation: "表字段建议有 NOT NULL 约束,可确保数据的完整性,防止插入空值,提升查询准确性。",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDDLConvention,
- },
- AllowOffline: false,
- Message: "建议字段%v设置NOT NULL约束",
- Func: checkColumnNotNull,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckIndexSelectivity,
- Desc: "建议连库查询时,确保SQL执行计划中使用的索引区分度大于阈值",
- Annotation: "确保SQL执行计划中使用的高索引区分度,有助于提升查询性能并优化查询效率。",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDMLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "70",
- Desc: "可选择性(百分比)",
- Type: params.ParamTypeInt,
- },
- },
- },
- AllowOffline: false,
- Message: "索引:%v,未超过区分度阈值:%v,建议使用超过阈值的索引。",
- Func: checkIndexSelectivity,
- },
- {
- // 该规则只适用于库表元数据扫描并且需要与停用上线审核模式规则一起使用
- Rule: driverV2.Rule{
- Name: DDLCheckTableRows,
- Desc: "表行数超过阈值,建议对表进行拆分",
- Annotation: "当表行数超过阈值时,对表进行拆分有助于提高数据库性能和查询速度。",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeUsageSuggestion,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "1000",
- Desc: "表行数(万)",
- Type: params.ParamTypeInt,
- },
- },
- },
- Message: "表行数超过阈值,建议对表进行拆分",
- Func: checkTableRows,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckCompositeIndexDistinction,
- Desc: "建议在组合索引中将区分度高的字段靠前放",
- Annotation: "将区分度高的字段靠前放置在组合索引中有助于提高索引的查询性能,因为它能更快地减小数据范围,提高检索效率。",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDDLConvention,
- },
- AllowOffline: false,
- Message: "建议在组合索引中将区分度高的字段靠前放,%v",
- Func: checkCompositeIndexSelectivity,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLAvoidText,
- Desc: "使用TEXT 类型的字段建议和原表进行分拆,与原表主键单独组成另外一个表进行存放",
- Annotation: "将TEXT类型的字段与原表主键分拆成另一个表可以提高数据库性能和查询速度,减少不必要的 I/O 操作。",
- Level: driverV2.RuleLevelNotice,
- Category: RuleTypeDDLConvention,
- },
- AllowOffline: true,
- Message: "字段:%v为TEXT类型,建议和原表进行分拆,与原表主键单独组成另外一个表进行存放",
- Func: checkText,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckSelectRows,
- Desc: "查询数据量超过阈值,筛选条件必须带上主键或者索引",
- Annotation: "筛选条件必须带上主键或索引可提高查询性能和减少全表扫描的成本。",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDMLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "10",
- Desc: "查询数据量(万)",
- Type: params.ParamTypeInt,
- },
- },
- },
- AllowOffline: false,
- Message: "查询数据量超过阈值,筛选条件必须带上主键或者索引",
- Func: checkSelectRows,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckScanRows,
- Desc: "扫描行数超过阈值,筛选条件必须带上主键或者索引",
- Annotation: "筛选条件必须带上主键或索引可降低数据库查询的时间复杂度,提高查询效率。",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDMLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "10",
- Desc: "扫描行数量(万)",
- Type: params.ParamTypeInt,
- },
- },
- },
- AllowOffline: false,
- Message: "扫描行数超过阈值,筛选条件必须带上主键或者索引",
- Func: checkScanRows,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLMustUseLeftMostPrefix,
- Desc: "使用联合索引时,必须使用联合索引的首字段",
- Annotation: "使用联合索引时,不包含首字段会导致联合索引失效",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeIndexInvalidation,
- },
- AllowOffline: false,
- Message: "使用联合索引时,必须使用联合索引的首字段",
- Func: mustMatchLeftMostPrefix,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLMustMatchLeftMostPrefix,
- Desc: "禁止对联合索引左侧字段进行IN 、OR等非等值查询",
- Annotation: "对联合索引左侧字段进行IN 、OR等非等值查询会导致联合索引失效",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeIndexInvalidation,
- },
- AllowOffline: false,
- Message: "对联合索引左侧字段进行IN 、OR等非等值查询会导致联合索引失效",
- Func: mustMatchLeftMostPrefix,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckJoinFieldUseIndex,
- Desc: "JOIN字段必须包含索引",
- Annotation: "JOIN字段包含索引可提高连接操作的性能和查询速度。",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeIndexInvalidation,
- },
- AllowOffline: false,
- Message: "JOIN字段必须包含索引",
- Func: checkJoinFieldUseIndex,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckJoinFieldCharacterSetAndCollation,
- Desc: "连接表字段的字符集和排序规则必须一致",
- Annotation: "连接表字段的字符集和排序规则一致可避免数据不一致和查询错误,确保连接操作正确执行。",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeIndexInvalidation,
- },
- AllowOffline: false,
- Message: "连接表字段的字符集和排序规则必须一致",
- Func: checkJoinFieldCharacterSetAndCollation,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLCheckMathComputationOrFuncOnIndex,
- Desc: "禁止对索引列进行数学运算和使用函数",
- Annotation: "对索引列进行数学运算和使用函数会导致索引失效,从而导致全表扫描,影响查询性能。",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeIndexInvalidation,
- },
- AllowOffline: false,
- Message: "禁止对索引列进行数学运算和使用函数",
- Func: checkMathComputationOrFuncOnIndex,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLSQLExplainLowestLevel,
- Desc: "SQL执行计划中type字段建议满足规定的级别",
- Annotation: "验证 SQL 执行计划中的 type 字段,确保满足要求级别,以保证查询性能。",
- Level: driverV2.RuleLevelWarn,
- Category: RuleTypeDDLConvention,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "range,ref,const,eq_ref,system,NULL",
- Desc: "查询计划type等级,以英文逗号隔开",
- Type: params.ParamTypeString,
- },
- },
- },
- AllowOffline: false,
- Message: "建议修改SQL,确保执行计划中type字段可以满足规定中的任一等级:%v",
- Func: checkSQLExplainLowestLevel,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLAvoidFullText,
- Desc: "禁止使用全文索引",
- Annotation: "全文索引的使用会增加存储开销,并对写操作性能产生一定影响。",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeUsageSuggestion,
- },
- AllowOffline: true,
- Message: "禁止使用全文索引",
- Func: avoidFullText,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLAvoidGeometry,
- Desc: "禁止使用空间字段和空间索引",
- Annotation: "使用空间字段和空间索引会增加存储需求,对数据库性能造成一定影响",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeUsageSuggestion,
- },
- AllowOffline: true,
- Message: "禁止使用空间字段和空间索引",
- Func: avoidGeometry,
- },
- {
- Rule: driverV2.Rule{
- Name: DMLAvoidWhereEqualNull,
- Desc: "WHERE子句中禁止将NULL值与其他字段或值进行比较运算",
- Annotation: "NULL在SQL中属于特殊值,无法与普通值进行比较。例如:column = NULL恒为false,即使column存在null值也不会查询出来,所以column = NULL应该写为column is NULL",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeDMLConvention,
- },
- AllowOffline: true,
- Message: "WHERE子句中禁止将NULL值与其他字段或值进行比较运算",
- Func: avoidWhereEqualNull,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLAvoidEvent,
- Desc: "禁止使用event",
- Annotation: "使用event会增加数据库的维护难度和依赖性,并且也会造成安全问题。",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeUsageSuggestion,
- },
- AllowOffline: true,
- Message: "禁止使用event",
- Func: avoidEvent,
- },
- {
- Rule: driverV2.Rule{
- Name: DDLCheckCharLength,
- Desc: "禁止char, varchar类型字段字符长度总和超过阈值",
- Annotation: "使用过长或者过多的varchar,char字段可能会增加业务逻辑的复杂性;如果字段平均长度过大时,会占用更多的存储空间。",
- Level: driverV2.RuleLevelError,
- Category: RuleTypeUsageSuggestion,
- Params: params.Params{
- ¶ms.Param{
- Key: DefaultSingleParamKeyName,
- Value: "2000",
- Desc: "字符长度",
- Type: params.ParamTypeInt,
- },
- },
- },
- AllowOffline: false,
- Message: "禁止char, varchar类型字段字符长度总和超过阈值 %v",
- Func: checkCharLength,
- },
-}
-
func checkMathComputationOrFuncOnIndex(input *RuleHandlerInput) error {
switch stmt := input.Node.(type) {
case *ast.SelectStmt:
@@ -7439,11 +5310,22 @@ func mustMatchLeftMostPrefix(input *RuleHandlerInput) error {
return nil
}
+ isAllSubquery := true
+ for _, table := range tables {
+ if _, ok := table.Source.(*ast.TableName); ok {
+ isAllSubquery = false
+ break
+ }
+ }
+ if isAllSubquery {
+ return nil
+ }
+
for alias, cols := range tablesFromCondition {
table, err := util.ConvertAliasToTable(alias, tables)
if err != nil {
log.NewEntry().Errorf("convert table alias failed, sqle: %v, error: %v", input.Node.Text(), err)
- return fmt.Errorf("convert table alias failed: %v", err)
+ return nil
}
createTable, exist, err := input.Ctx.GetCreateTableStmt(table)
if err != nil {
diff --git a/sqle/driver/mysql/rule/rule_list.go b/sqle/driver/mysql/rule/rule_list.go
new file mode 100644
index 0000000000..310fce3276
--- /dev/null
+++ b/sqle/driver/mysql/rule/rule_list.go
@@ -0,0 +1,2137 @@
+//go:build !trial
+// +build !trial
+
+package rule
+
+import (
+ driverV2 "github.com/actiontech/sqle/sqle/driver/v2"
+ "github.com/actiontech/sqle/sqle/pkg/params"
+ "github.com/pingcap/parser/ast"
+)
+
+var RuleHandlers = []RuleHandler{
+ {
+ Rule: driverV2.Rule{
+ Name: ConfigDMLRollbackMaxRows,
+ Desc: "在 DML 语句中预计影响行数超过指定值则不回滚",
+ Annotation: "大事务回滚,容易影响数据库性能,使得业务发生波动;具体规则阈值可以根据业务需求调整,默认值:1000",
+ //Value: "1000",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeGlobalConfig,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "1000",
+ Desc: "最大影响行数",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Func: nil,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: ConfigDDLOSCMinSize,
+ Desc: "改表时,表空间超过指定大小(MB)审核时输出osc改写建议",
+ Annotation: "开启该规则后会对大表的DDL语句给出 pt-osc工具的改写建议【需要参考命令进行手工执行,后续会支持自动执行】;直接对大表进行DDL变更时可能会导致长时间锁表问题,影响业务可持续性。具体对大表定义的阈值可以根据业务需求调整,默认值:1024",
+ //Value: "16",
+ Level: driverV2.RuleLevelNormal,
+ Category: RuleTypeGlobalConfig,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "1024",
+ Desc: "表空间大小(MB)",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Func: nil,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckTableSize,
+ Desc: "不建议对数据量过大的表执行DDL操作",
+ Annotation: "大表执行DDL,耗时较久且负载较高,长时间占用锁资源,会影响数据库性能;具体规则阈值可以根据业务需求调整,默认值:1024",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDDLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "1024",
+ Desc: "表空间大小(MB)",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Message: "执行DDL的表 %v 空间不建议超过 %vMB",
+ OnlyAuditNotExecutedSQL: true,
+ Func: checkDDLTableSize,
+ }, {
+ Rule: driverV2.Rule{
+ Name: DDLCheckIndexTooMany,
+ Desc: "单字段上的索引数量不建议超过阈值",
+ Annotation: "单字段上存在过多索引,一般情况下这些索引都是没有存在价值的;相反,还会降低数据增加删除时的性能,特别是对频繁更新的表来说,负面影响更大;具体规则阈值可以根据业务需求调整,默认值:2",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeIndexingConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "2",
+ Desc: "单字段的索引数最大值",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Message: "字段 %v 上的索引数量不建议超过%v个",
+ NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}, &ast.CreateIndexStmt{}},
+ Func: checkIndex,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: ConfigDMLExplainPreCheckEnable,
+ Desc: "使用EXPLAIN加强预检查能力",
+ Annotation: "通过 EXPLAIN 的形式将待上线的DML进行SQL是否能正确执行的检查,提前发现语句的错误,提高上线成功率",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeGlobalConfig,
+ },
+ Func: nil,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckRedundantIndex,
+ Desc: "不建议创建冗余索引",
+ Annotation: "MySQL需要单独维护重复的索引,冗余索引增加维护成本,并且优化器在优化查询时需要逐个进行代价计算,影响查询性能",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeIndexOptimization,
+ },
+ Message: "%v",
+ AllowOffline: true,
+ NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}, &ast.CreateIndexStmt{}},
+ Func: checkIndex,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckTableSize,
+ Desc: "不建议对数据量过大的表执行DML操作",
+ Annotation: "DML操作大表,耗时较久且负载较高,容易影响数据库性能;具体规则阈值可以根据业务需求调整,默认值:1024",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "1024",
+ Desc: "表空间大小(MB)",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Message: "执行DML的表 %v 空间不建议超过 %vMB",
+ Func: checkDMLTableSize,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: ConfigOptimizeIndexEnabled,
+ Desc: "索引创建建议",
+ Annotation: "通过该规则开启索引优化建议,提供两个参数配置来定义索引优化建议的行为。1. 计算列基数阈值:配置当表数据量超过多少行时不再计算列的区分度来排序索引优先级,防止对大表进行操作影响性能;2. 联合索引最大列数:限制联合索引给到的列数最大值,防止给出建议的联合索引不符合其他SQL标准",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeIndexOptimization,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultMultiParamsFirstKeyName,
+ Value: "1000000",
+ Desc: "计算列基数阈值",
+ Type: params.ParamTypeInt,
+ },
+ ¶ms.Param{
+ Key: DefaultMultiParamsSecondKeyName,
+ Value: "3",
+ Desc: "联合索引最大列数",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ },
+
+ {
+ Rule: driverV2.Rule{
+ Name: ConfigSQLIsExecuted,
+ Desc: "停用上线审核模式",
+ Annotation: "启用该规则来兼容事后审核的场景,对于事后采集的DDL 和 DML 语句将不再进行上线校验。例如库表元数据的扫描任务可开启该规则",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeGlobalConfig,
+ },
+ },
+
+ {
+ Rule: driverV2.Rule{
+ Name: ConfigDDLGhostMinSize,
+ Desc: "改表时,表空间超过指定大小(MB)时使用gh-ost上线",
+ Annotation: "开启该规则后会自动对大表的DDL操作使用gh-ost 工具进行在线改表;直接对大表进行DDL变更时可能会导致长时间锁表问题,影响业务可持续性。具体对大表定义的阈值可以根据业务需求调整,默认值:1024",
+ //Value: "16",
+ Level: driverV2.RuleLevelNormal,
+ Category: RuleTypeGlobalConfig,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "1024",
+ Desc: "表空间大小(MB)",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Func: nil,
+ },
+
+ // rule
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckPKWithoutIfNotExists,
+ Desc: "新建表建议加入 IF NOT EXISTS,保证重复执行不报错",
+ Annotation: "新建表如果表已经存在,不添加IF NOT EXISTS CREATE执行SQL会报错,建议开启此规则,避免SQL实际执行报错",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeUsageSuggestion,
+ },
+ Message: "新建表建议加入 IF NOT EXISTS,保证重复执行不报错",
+ AllowOffline: true,
+ Func: checkIfNotExist,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckObjectNameLength,
+ Desc: "表名、列名、索引名的长度不建议超过阈值",
+ Annotation: "通过配置该规则可以规范指定业务的对象命名长度,具体长度可以自定义设置,默认最大长度:64。是MySQL规定标识符命名最大长度为64字节",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeNamingConvention,
+ //Value: "64",
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "64",
+ Desc: "最大长度(字节)",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Message: "表名、列名、索引名的长度不建议大于%v字节",
+ AllowOffline: true,
+ Func: checkNewObjectName,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckObjectNameIsUpperAndLowerLetterMixed,
+ Desc: "数据库对象命名不建议大小写字母混合",
+ Annotation: "数据库对象命名规范,不推荐采用大小写混用的形式建议词语之间使用下划线连接,提高代码可读性",
+ Category: RuleTypeNamingConvention,
+ Level: driverV2.RuleLevelNotice,
+ },
+ Message: "数据库对象命名不建议大小写字母混合,以下对象命名不规范:%v",
+ Func: checkIsObjectNameUpperAndLowerLetterMixed,
+ AllowOffline: true,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckPKNotExist,
+ Desc: "表必须有主键",
+ Annotation: "主键使数据达到全局唯一,可提高数据检索效率",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeIndexingConvention,
+ },
+ Message: "表必须有主键",
+ AllowOffline: true,
+ NotAllowOfflineStmts: []ast.Node{&ast.AlterTableStmt{}},
+ NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}},
+ Func: checkPrimaryKey,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckPKWithoutAutoIncrement,
+ Desc: "主键建议使用自增",
+ Annotation: "自增主键,数字型速度快,而且是增量增长,占用空间小,更快速的做数据插入操作,避免增加维护索引的开销",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeIndexingConvention,
+ },
+ Message: "主键建议使用自增",
+ AllowOffline: true,
+ NotAllowOfflineStmts: []ast.Node{&ast.AlterTableStmt{}},
+ NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}},
+ Func: checkPrimaryKey,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckPKWithoutBigintUnsigned,
+ Desc: "主键建议使用 BIGINT 无符号类型,即 BIGINT UNSIGNED",
+ Annotation: "BIGINT UNSIGNED拥有更大的取值范围,建议开启此规则,避免发生溢出",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeIndexingConvention,
+ },
+ Message: "主键建议使用 BIGINT 无符号类型,即 BIGINT UNSIGNED",
+ AllowOffline: true,
+ NotAllowOfflineStmts: []ast.Node{&ast.AlterTableStmt{}},
+ NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}},
+ Func: checkPrimaryKey,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckJoinFieldType,
+ Desc: "建议JOIN字段类型保持一致",
+ Annotation: "JOIN字段类型不一致会导致类型不匹配发生隐式准换,建议开启此规则,避免索引失效",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "建议JOIN字段类型保持一致, 否则会导致隐式转换",
+ AllowOffline: false,
+ Func: checkJoinFieldType,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckHasJoinCondition,
+ Desc: "建议连接操作指定连接条件",
+ Annotation: "指定连接条件可以确保连接操作的正确性和可靠性,如果没有指定连接条件,可能会导致连接失败或连接不正确的情况。",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "建议连接操作指定连接条件,JOIN字段后必须有ON条件",
+ AllowOffline: true,
+ Func: checkHasJoinCondition,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckColumnCharLength,
+ Desc: "CHAR长度大于20时,必须使用VARCHAR类型",
+ Annotation: "VARCHAR是变长字段,存储空间小,可节省存储空间,同时相对较小的字段检索效率显然也要高些",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "CHAR长度大于20时,必须使用VARCHAR类型",
+ AllowOffline: true,
+ Func: checkStringType,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckFieldNotNUllMustContainDefaultValue,
+ Desc: "建议字段约束为NOT NULL时带默认值",
+ Annotation: "如存在NOT NULL且不带默认值的字段,INSERT时不包含该字段,会导致插入报错",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "建议字段约束为NOT NULL时带默认值,以下字段不规范:%v",
+ AllowOffline: true,
+ Func: checkFieldNotNUllMustContainDefaultValue,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLDisableFK,
+ Desc: "禁止使用外键",
+ Annotation: "外键在高并发场景下性能较差,容易造成死锁,同时不利于后期维护(拆分、迁移)",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeIndexingConvention,
+ },
+ Message: "禁止使用外键",
+ AllowOffline: true,
+ Func: checkForeignKey,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLDisableAlterFieldUseFirstAndAfter,
+ Desc: "ALTER表字段禁止使用FIRST,AFTER",
+ Annotation: "FIRST,AFTER 的ALTER操作通过COPY TABLE的方式完成,对业务影响较大",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "ALTER表字段禁止使用FIRST,AFTER",
+ AllowOffline: true,
+ Func: disableAlterUseFirstAndAfter,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckCreateTimeColumn,
+ Desc: "建议建表DDL包含创建时间字段且默认值为CURRENT_TIMESTAMP",
+ Annotation: "使用CREATE_TIME字段,有利于问题查找跟踪和检索数据,同时避免后期对数据生命周期管理不便 ,默认值为CURRENT_TIMESTAMP可保证时间的准确性",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDDLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "CREATE_TIME",
+ Desc: "创建时间字段名",
+ Type: params.ParamTypeString,
+ },
+ },
+ },
+ Message: "建议建表DDL包含%v字段且默认值为CURRENT_TIMESTAMP",
+ AllowOffline: true,
+ Func: checkFieldCreateTime,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckIndexCount,
+ Desc: "索引个数建议不超过阈值",
+ Annotation: "在表上建立的每个索引都会增加存储开销,索引对于插入、删除、更新操作也会增加处理上的开销,太多与不充分、不正确的索引对性能都毫无益处;具体规则阈值可以根据业务需求调整,默认值:5",
+ Level: driverV2.RuleLevelNotice,
+ //Value: "5",
+ Category: RuleTypeIndexingConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "5",
+ Desc: "最大索引个数",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Message: "索引个数建议不超过%v个",
+ AllowOffline: true,
+ NotAllowOfflineStmts: []ast.Node{&ast.AlterTableStmt{}, &ast.CreateIndexStmt{}},
+ NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}, &ast.CreateIndexStmt{}},
+ Func: checkIndex,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckUpdateTimeColumn,
+ Desc: "建表DDL需要包含更新时间字段且默认值为CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP",
+ Annotation: "使用更新时间字段,有利于问题查找跟踪和检索数据,同时避免后期对数据生命周期管理不便 ,默认值为UPDATE_TIME可保证时间的准确性",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDDLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "UPDATE_TIME",
+ Desc: "更新时间字段名",
+ Type: params.ParamTypeString,
+ },
+ },
+ },
+ Message: "建表DDL需要包含%v字段且默认值为CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP",
+ AllowOffline: true,
+ Func: checkFieldUpdateTime,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckCompositeIndexMax,
+ Desc: "复合索引的列数量不建议超过阈值",
+ Annotation: "复合索引会根据索引列数创建对应组合的索引,列数越多,创建的索引越多,每个索引都会增加磁盘空间的开销,同时增加索引维护的开销;具体规则阈值可以根据业务需求调整,默认值:3",
+ Level: driverV2.RuleLevelNotice,
+ //Value: "3",
+ Category: RuleTypeIndexingConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "3",
+ Desc: "最大索引列数量",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Message: "复合索引的列数量不建议超过%v个",
+ AllowOffline: true,
+ NotAllowOfflineStmts: []ast.Node{&ast.AlterTableStmt{}, &ast.CreateIndexStmt{}},
+ NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}, &ast.CreateIndexStmt{}},
+ Func: checkIndex,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckIndexNotNullConstraint,
+ Desc: "索引字段需要有非空约束",
+ Annotation: "索引字段上如果没有非空约束,则表记录与索引记录不会完全映射。",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeIndexingConvention,
+ },
+ Message: "这些索引字段(%v)需要有非空约束",
+ AllowOffline: true,
+ NotAllowOfflineStmts: []ast.Node{&ast.AlterTableStmt{}, &ast.CreateIndexStmt{}},
+ Func: checkIndexNotNullConstraint,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckObjectNameUsingKeyword,
+ Desc: "数据库对象命名禁止使用保留字",
+ Annotation: "通过配置该规则可以规范指定业务的数据对象命名规则,避免发生冲突,以及混淆",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeNamingConvention,
+ },
+ Message: "数据库对象命名禁止使用保留字 %s",
+ AllowOffline: true,
+ Func: checkNewObjectName,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckObjectNameUseCN,
+ Desc: "数据库对象命名只能使用英文、下划线或数字,首字母必须是英文",
+ Annotation: "通过配置该规则可以规范指定业务的数据对象命名规则",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeNamingConvention,
+ },
+ Message: "数据库对象命名只能使用英文、下划线或数字,首字母必须是英文",
+ AllowOffline: true,
+ Func: checkNewObjectName,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckTableDBEngine,
+ Desc: "建议使用指定数据库引擎",
+ Annotation: "通过配置该规则可以规范指定业务的数据库引擎,具体规则可以自定义设置。默认值是INNODB,INNODB 支持事务,支持行级锁,更好的恢复性,高并发下性能更好",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDDLConvention,
+ //Value: "Innodb",
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "Innodb",
+ Desc: "数据库引擎",
+ Type: params.ParamTypeString,
+ },
+ },
+ },
+ Message: "建议使用%v数据库引擎",
+ AllowOffline: false,
+ Func: checkEngine,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckTableCharacterSet,
+ Desc: "建议使用指定数据库字符集",
+ Annotation: "通过该规则约束全局的数据库字符集,避免创建非预期的字符集,防止业务侧出现“乱码”等问题。建议项目内库表使用统一的字符集和字符集排序,部分连表查询的情况下字段的字符集或排序规则不一致可能会导致索引失效且不易发现",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDDLConvention,
+ //Value: "utf8mb4",
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "utf8mb4",
+ Desc: "数据库字符集",
+ Type: params.ParamTypeString,
+ },
+ },
+ },
+ Message: "建议使用%v数据库字符集",
+ AllowOffline: false,
+ Func: checkCharacterSet,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckIndexedColumnWithBlob,
+ Desc: "禁止将BLOB类型的列加入索引",
+ Annotation: "BLOB类型属于大字段类型,作为索引会占用很大的存储空间",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeIndexingConvention,
+ },
+ Message: "禁止将BLOB类型的列加入索引",
+ AllowOffline: true,
+ NotAllowOfflineStmts: []ast.Node{&ast.AlterTableStmt{}, &ast.CreateIndexStmt{}},
+ NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}, &ast.CreateIndexStmt{}},
+ Func: disableAddIndexForColumnsTypeBlob,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckWhereIsInvalid,
+ Desc: "禁止使用没有WHERE条件或者WHERE条件恒为TRUE的SQL",
+ Annotation: "SQL缺少WHERE条件在执行时会进行全表扫描产生额外开销,建议在大数据量高并发环境下开启,避免影响数据库查询性能",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "禁止使用没有WHERE条件或者WHERE条件恒为TRUE的SQL",
+ AllowOffline: true,
+ Func: checkSelectWhere,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckAlterTableNeedMerge,
+ Desc: "存在多条对同一个表的修改语句,建议合并成一个ALTER语句",
+ Annotation: "避免多次 TABLE REBUILD 带来的消耗、以及对线上业务的影响",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeUsageSuggestion,
+ },
+ Message: "已存在对该表的修改语句,建议合并成一个ALTER语句",
+ AllowOffline: false,
+ OnlyAuditNotExecutedSQL: true,
+ Func: checkMergeAlterTable,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLDisableSelectAllColumn,
+ Desc: "不建议使用SELECT *",
+ Annotation: "当表结构变更时,使用*通配符选择所有列将导致查询行为会发生更改,与业务期望不符;同时SELECT * 中的无用字段会带来不必要的磁盘I/O,以及网络开销,且无法覆盖索引进而回表,大幅度降低查询效率",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不建议使用SELECT *",
+ AllowOffline: true,
+ Func: checkSelectAll,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLDisableDropStatement,
+ Desc: "禁止除索引外的DROP操作",
+ Annotation: "DROP是DDL,数据变更不会写入日志,无法进行回滚;建议开启此规则,避免误删除操作",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeUsageSuggestion,
+ },
+ Message: "禁止除索引外的DROP操作",
+ AllowOffline: true,
+ Func: disableDropStmt,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckTableWithoutComment,
+ Desc: "表建议添加注释",
+ Annotation: "表添加注释能够使表的意义更明确,方便日后的维护",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "表建议添加注释",
+ AllowOffline: true,
+ Func: checkTableWithoutComment,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckColumnWithoutComment,
+ Desc: "列建议添加注释",
+ Annotation: "列添加注释能够使列的意义更明确,方便日后的维护",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "列建议添加注释",
+ AllowOffline: true,
+ Func: checkColumnWithoutComment,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckIndexPrefix,
+ Desc: "建议普通索引使用固定前缀",
+ Annotation: "通过配置该规则可以规范指定业务的索引命名规则,具体命名规范可以自定义设置,默认提示值:idx_",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeNamingConvention,
+ //Value: "idx_",
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "idx_",
+ Desc: "索引前缀",
+ Type: params.ParamTypeString,
+ },
+ },
+ },
+ Message: "建议普通索引要以\"%v\"为前缀",
+ AllowOffline: true,
+ Func: checkIndexPrefix,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckUniqueIndexPrefix,
+ Desc: "建议UNIQUE索引使用固定前缀",
+ Annotation: "通过配置该规则可以规范指定业务的UNIQUE索引命名规则,具体命名规范可以自定义设置,默认提示值:uniq_",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeNamingConvention,
+ //Value: "uniq_",
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "uniq_",
+ Desc: "索引前缀",
+ Type: params.ParamTypeString,
+ },
+ },
+ },
+ Message: "建议UNIQUE索引要以\"%v\"为前缀",
+ AllowOffline: true,
+ Func: checkUniqIndexPrefix,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckUniqueIndex,
+ Desc: "建议UNIQUE索引名使用 IDX_UK_表名_字段名",
+ Annotation: "通过配置该规则可以规范指定业务的UNIQUE索引命名规则",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeNamingConvention,
+ },
+ Message: "建议UNIQUE索引名使用 IDX_UK_表名_字段名",
+ AllowOffline: true,
+ Func: checkUniqIndex,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckColumnWithoutDefault,
+ Desc: "除了自增列及大字段列之外,每个列都必须添加默认值",
+ Annotation: "列添加默认值,可避免列为NULL值时对查询的影响",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "除了自增列及大字段列之外,每个列都必须添加默认值",
+ AllowOffline: true,
+ Func: checkColumnWithoutDefault,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckColumnTimestampWithoutDefault,
+ Desc: "TIMESTAMP 类型的列必须添加默认值",
+ Annotation: "TIMESTAMP添加默认值,可避免出现全为0的日期格式与业务预期不符",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "TIMESTAMP 类型的列必须添加默认值",
+ AllowOffline: true,
+ Func: checkColumnTimestampWithoutDefault,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckColumnBlobWithNotNull,
+ Desc: "BLOB 和 TEXT 类型的字段不建议设置为 NOT NULL",
+ Annotation: "BLOB 和 TEXT 类型的字段无法指定默认值,如插入数据不指定字段默认为NULL,如果添加了 NOT NULL 限制,写入数据时又未对该字段指定值会导致写入失败",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "BLOB 和 TEXT 类型的字段不建议设置为 NOT NULL",
+ AllowOffline: true,
+ Func: checkColumnBlobNotNull,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckColumnBlobDefaultIsNotNull,
+ Desc: "BLOB 和 TEXT 类型的字段默认值只能为NULL",
+ Annotation: "在SQL_MODE严格模式下BLOB 和 TEXT 类型无法设置默认值,如插入数据不指定值,字段会被设置为NULL",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "BLOB 和 TEXT 类型的字段默认值只能为NULL",
+ AllowOffline: true,
+ Func: checkColumnBlobDefaultNull,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckAutoIncrementFieldNum,
+ Desc: "建表时,自增字段只能设置一个",
+ Annotation: "MySQL InnoDB,MyISAM 引擎不允许存在多个自增字段,设置多个自增字段会导致上线失败。",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDDLConvention,
+ },
+ AllowOffline: true,
+ Message: "建表时,自增字段只能设置一个",
+ Func: checkAutoIncrementFieldNum,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckAllIndexNotNullConstraint,
+ Desc: "建议为至少一个索引添加非空约束",
+ Annotation: "所有索引字段均未做非空约束,请确认下表索引规划的合理性。",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDDLConvention,
+ },
+ AllowOffline: true,
+ Message: "建议为至少一个索引添加非空约束",
+ Func: checkAllIndexNotNullConstraint,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckWithLimit,
+ Desc: "DELETE/UPDATE 语句不能有LIMIT条件",
+ Annotation: "DELETE/UPDATE 语句使用LIMIT条件将随机选取数据进行删除或者更新,业务无法预期",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "DELETE/UPDATE 语句不能有LIMIT条件",
+ AllowOffline: true,
+ Func: checkDMLWithLimit,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckSelectLimit,
+ Desc: "SELECT 语句需要带LIMIT",
+ Annotation: "如果查询的扫描行数很大,可能会导致优化器选择错误的索引甚至不走索引;具体规则阈值可以根据业务需求调整,默认值:1000",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "1000",
+ Desc: "最大查询行数",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Message: "SELECT 语句需要带LIMIT,且限制数不得超过%v",
+ AllowOffline: true,
+ Func: checkSelectLimit,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckWithOrderBy,
+ Desc: "DELETE/UPDATE 语句不能有ORDER BY",
+ Annotation: "DELETE/UPDATE 存在ORDER BY会使用排序,带来无谓的开销",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "DELETE/UPDATE 语句不能有ORDER BY",
+ AllowOffline: true,
+ Func: checkDMLWithOrderBy,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckSelectWithOrderBy,
+ Desc: "SELECT 语句不能有ORDER BY",
+ Annotation: "ORDER BY 对查询性能影响较大,同时不便于优化维护,建议将排序部分放到业务处理",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "SELECT 语句不能有ORDER BY",
+ AllowOffline: true,
+ Func: checkSelectWithOrderBy,
+ },
+ {
+ // TODO: 修改level以适配默认模板
+ Rule: driverV2.Rule{
+ Name: DMLCheckInsertColumnsExist,
+ Desc: "INSERT 语句需要指定COLUMN",
+ Annotation: "当表结构发生变更,INSERT请求不明确指定列名,会发生插入数据不匹配的情况;建议开启此规则,避免插入结果与业务预期不符",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "INSERT 语句需要指定COLUMN",
+ AllowOffline: true,
+ Func: checkDMLWithInsertColumnExist,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckBatchInsertListsMax,
+ Desc: "单条INSERT语句,建议批量插入不超过阈值",
+ Annotation: "避免大事务,以及降低发生回滚对业务的影响;具体规则阈值可以根据业务需求调整,默认值:100",
+ Level: driverV2.RuleLevelNotice,
+ //Value: "5000",
+ Category: RuleTypeDMLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "100",
+ Desc: "最大插入行数",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Message: "单条INSERT语句,建议批量插入不超过%v条",
+ AllowOffline: true,
+ Func: checkDMLWithBatchInsertMaxLimits,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckInQueryNumber,
+ Desc: "WHERE条件内IN语句中的参数个数不能超过阈值",
+ Annotation: "当IN值过多时,有可能会导致查询进行全表扫描,使得MySQL性能急剧下降;具体规则阈值可以根据业务需求调整,默认值:50",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "50",
+ Desc: "in语句参数最大个数",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Message: "WHERE条件内IN语句中的参数已有%v个,不建议超过阙值%v",
+ AllowOffline: true,
+ Func: checkInQueryLimit,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckPKProhibitAutoIncrement,
+ Desc: "不建议主键使用自增",
+ Annotation: "后期维护相对不便,过于依赖数据库自增机制达到全局唯一,不易拆分,容易造成主键冲突",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeIndexingConvention,
+ },
+ Message: "不建议主键使用自增",
+ AllowOffline: true,
+ NotAllowOfflineStmts: []ast.Node{&ast.AlterTableStmt{}},
+ NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}},
+ Func: checkPrimaryKey,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckWhereExistFunc,
+ Desc: "避免对条件字段使用函数操作",
+ Annotation: "对条件字段做函数操作,可能会破坏索引值的有序性,导致优化器选择放弃走索引,使查询性能大幅度降低",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "避免对条件字段使用函数操作",
+ AllowOffline: false,
+ Func: checkWhereExistFunc,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckWhereExistNot,
+ Desc: "不建议对条件字段使用负向查询",
+ Annotation: "使用负向查询,将导致全表扫描,出现慢SQL",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不建议对条件字段使用负向查询",
+ AllowOffline: true,
+ Func: checkSelectWhere,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLWhereExistNull,
+ Desc: "不建议对条件字段使用 NULL 值判断",
+ Annotation: "使用 IS NULL 或 IS NOT NULL 可能导致查询放弃使用索引而进行全表扫描",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不建议对条件字段使用 NULL 值判断",
+ Func: checkWhereExistNull,
+ AllowOffline: true,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckWhereExistImplicitConversion,
+ Desc: "不建议在WHERE条件中使用与过滤字段不一致的数据类型",
+ Annotation: "WHERE条件中使用与过滤字段不一致的数据类型会引发隐式数据类型转换,导致查询有无法命中索引的风险,在高并发、大数据量的情况下,不走索引会使得数据库的查询性能严重下降",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不建议在WHERE条件中使用与过滤字段不一致的数据类型",
+ Func: checkWhereColumnImplicitConversion,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckLimitMustExist,
+ Desc: "建议DELETE/UPDATE 语句带有LIMIT条件",
+ Annotation: "LIMIT条件可以降低写错 SQL 的代价(删错数据),同时避免长事务影响业务",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "建议DELETE/UPDATE 语句带有LIMIT条件",
+ Func: checkDMLLimitExist,
+ AllowOffline: true,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckWhereExistScalarSubquery,
+ Desc: "不建议使用标量子查询",
+ Annotation: "标量子查询存在多次访问同一张表的问题,执行开销大效率低,可使用LEFT JOIN 替代标量子查询",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不建议使用标量子查询",
+ AllowOffline: true,
+ Func: checkSelectWhere,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckIndexesExistBeforeCreateConstraints,
+ Desc: "对字段创建约束前,建议先创建索引",
+ Annotation: "创建约束前,先行创建索引,约束可作用于二级索引,避免全表扫描,提高性能",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeIndexingConvention,
+ },
+ Message: "对字段创建约束前,建议先创建索引",
+ OnlyAuditNotExecutedSQL: true,
+ Func: checkIndexesExistBeforeCreatConstraints,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckSelectForUpdate,
+ Desc: "不建议使用SELECT FOR UPDATE",
+ Annotation: "SELECT FOR UPDATE 会对查询结果集中每行数据都添加排他锁,其他线程对该记录的更新与删除操作都会阻塞,在高并发下,容易造成数据库大量锁等待,影响数据库查询性能",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不建议使用SELECT FOR UPDATE",
+ Func: checkDMLSelectForUpdate,
+ AllowOffline: true,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckDatabaseCollation,
+ Desc: "建议使用规定的数据库排序规则",
+ Annotation: "通过该规则约束全局的数据库排序规则,避免创建非预期的数据库排序规则,防止业务侧出现排序结果非预期等问题。建议项目内库表使用统一的字符集和字符集排序,部分连表查询的情况下字段的字符集或排序规则不一致可能会导致索引失效且不易发现",
+ Level: driverV2.RuleLevelNotice,
+ //Value: "utf8mb4_0900_ai_ci",
+ Category: RuleTypeDDLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "utf8mb4_0900_ai_ci",
+ Desc: "数据库排序规则",
+ Type: params.ParamTypeString,
+ },
+ },
+ },
+ Message: "建议使用规定的数据库排序规则为%s",
+ Func: checkCollationDatabase,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckDecimalTypeColumn,
+ Desc: "精确浮点数建议使用DECIMAL",
+ Annotation: "对于浮点数运算,DECIMAL精确度较高",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "精确浮点数建议使用DECIMAL",
+ Func: checkDecimalTypeColumn,
+ AllowOffline: true,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckBigintInsteadOfDecimal,
+ Desc: "建议用BIGINT类型代替DECIMAL",
+ Annotation: "因为CPU不支持对DECIMAL的直接运算,只是MySQL自身实现了DECIMAL的高精度计算,但是计算代价高,并且存储同样范围值的时候,空间占用也更多;使用BIGINT代替DECIMAL,可根据小数的位数乘以相应的倍数,即可达到精确的浮点存储计算,避免DECIMAL计算代价高的问题",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "建议列%s用BIGINT类型代替DECIMAL",
+ Func: checkBigintInsteadOfDecimal,
+ AllowOffline: true,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckSubQueryNestNum,
+ Desc: "子查询嵌套层数不建议超过阈值",
+ Annotation: "子查询嵌套层数超过阈值,有些情况下,子查询并不能使用到索引。同时对于返回结果集比较大的子查询,会产生大量的临时表,消耗过多的CPU和IO资源,产生大量的慢查询",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "3",
+ Desc: "子查询嵌套层数不建议超过阈值",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Message: "子查询嵌套层数超过阈值%v",
+ Func: checkSubQueryNestNum,
+ AllowOffline: true,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckNeedlessFunc,
+ Desc: "避免使用不必要的内置函数",
+ Annotation: "通过配置该规则可以指定业务中需要禁止使用的内置函数,使用内置函数可能会导致SQL无法走索引或者产生一些非预期的结果。实际需要禁用的函数可通过规则设置",
+ Level: driverV2.RuleLevelNotice,
+ //Value: "sha(),sqrt(),md5()",
+ Category: RuleTypeDMLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "sha(),sqrt(),md5()",
+ Desc: "指定的函数集合(逗号分割)",
+ Type: params.ParamTypeString,
+ },
+ },
+ },
+ Message: "避免使用不必要的内置函数%v",
+ Func: checkNeedlessFunc,
+ AllowOffline: true,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckDatabaseSuffix,
+ Desc: "建议数据库名称使用固定后缀结尾",
+ Annotation: "通过配置该规则可以规范指定业务的数据库命名规则,具体命名规范可以自定义设置,默认提示值:_DB",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeNamingConvention,
+ //Value: "_DB",
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "_DB",
+ Desc: "数据库名称后缀",
+ Type: params.ParamTypeString,
+ },
+ },
+ },
+ Message: "建议数据库名称以\"%v\"结尾",
+ Func: checkDatabaseSuffix,
+ AllowOffline: true,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckPKName,
+ Desc: "建议主键命名为\"PK_表名\"",
+ Annotation: "通过配置该规则可以规范指定业务的主键命名规则",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeNamingConvention,
+ },
+ Message: "建议主键命名为\"PK_表名\"",
+ Func: checkPKIndexName,
+ AllowOffline: true,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckTransactionIsolationLevel,
+ Desc: "事物隔离级别建议设置成RC",
+ Annotation: "RC避免了脏读的现象,但没有解决幻读的问题;使用RR,能避免幻读,但是由于引入间隙锁导致加锁的范围可能扩大,从而会影响并发,还容易造成死锁,所以在大多数业务场景下,幻读出现的机率较少,RC基本上能满足业务需求",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeUsageSuggestion,
+ },
+ Message: "事物隔离级别建议设置成RC",
+ Func: checkTransactionIsolationLevel,
+ AllowOffline: true,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckFuzzySearch,
+ Desc: "禁止使用全模糊搜索或左模糊搜索",
+ Annotation: "使用全模糊搜索或左模糊搜索将导致查询无法使用索引,导致全表扫描",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "禁止使用全模糊搜索或左模糊搜索",
+ AllowOffline: true,
+ Func: checkSelectWhere,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckTablePartition,
+ Desc: "不建议使用分区表相关功能",
+ Annotation: "分区表在物理上表现为多个文件,在逻辑上表现为一个表,跨分区查询效率可能更低,建议采用物理分表的方式管理大数据",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeUsageSuggestion,
+ },
+ Message: "不建议使用分区表相关功能",
+ AllowOffline: true,
+ Func: checkTablePartition,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckNumberOfJoinTables,
+ Desc: "使用JOIN连接表查询建议不超过阈值",
+ Annotation: "表关联越多,意味着各种驱动关系组合就越多,比较各种结果集的执行成本的代价也就越高,进而SQL查询性能会大幅度下降;具体规则阈值可以根据业务需求调整,默认值:3",
+ Level: driverV2.RuleLevelNotice,
+ //Value: "3",
+ Category: RuleTypeDMLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "3",
+ Desc: "最大连接表个数",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Message: "使用JOIN连接表查询建议不超过%v张",
+ AllowOffline: true,
+ Func: checkNumberOfJoinTables,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckIfAfterUnionDistinct,
+ Desc: "建议使用UNION ALL,替代UNION",
+ Annotation: "UNION会按照字段的顺序进行排序同时去重,UNION ALL只是简单的将两个结果合并后就返回,从效率上看,UNION ALL 要比UNION快很多;如果合并的两个结果集中允许包含重复数据且不需要排序时的话,建议开启此规则,使用UNION ALL替代UNION",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "建议使用UNION ALL,替代UNION",
+ AllowOffline: true,
+ Func: checkIsAfterUnionDistinct,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckIsExistLimitOffset,
+ Desc: "使用分页查询时,避免使用偏移量",
+ Annotation: "例如:LIMIT N OFFSET M 或 LIMIT M,N。当偏移量m过大的时候,查询效率会很低,因为MySQL是先查出m+n个数据,然后抛弃掉前m个数据;对于有大数据量的MySQL表来说,使用LIMIT分页存在很严重的性能问题",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "使用分页查询时,避免使用偏移量",
+ AllowOffline: true,
+ Func: checkIsExistLimitOffset,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckIndexOption,
+ Desc: "建议索引字段对区分度大于阈值",
+ Annotation: "选择区分度高的字段作为索引,可快速定位数据;区分度太低,无法有效利用索引,甚至可能需要扫描大量数据页,拖慢SQL;具体规则阈值可以根据业务需求调整,默认值:70",
+ Level: driverV2.RuleLevelNotice,
+ //Value: "0.7",
+ Category: RuleTypeIndexOptimization,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "70",
+ Desc: "可选择性(百分比)",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Message: "索引 %v 未超过区分度阈值 百分之%v, 不建议选为索引",
+ AllowOffline: false,
+ Func: checkIndexOption,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckColumnEnumNotice,
+ Desc: "不建议使用 ENUM 类型",
+ Annotation: "ENUM类型不是SQL标准,移植性较差,后期如修改或增加枚举值需重建整张表,代价较大,且无法通过字面量值进行排序",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "不建议使用 ENUM 类型",
+ AllowOffline: true,
+ Func: checkColumnEnumNotice,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckColumnSetNotice,
+ Desc: "不建议使用 SET 类型",
+ Annotation: "集合的修改需要重新定义列,后期修改的代价大,建议在业务层实现",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "不建议使用 SET 类型",
+ AllowOffline: true,
+ Func: checkColumnSetNotice,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckColumnBlobNotice,
+ Desc: "不建议使用 BLOB 或 TEXT 类型",
+ Annotation: "BLOB 或 TEXT 类型消耗大量的网络和IO带宽,同时在该表上的DML操作都会变得很慢",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "不建议使用 BLOB 或 TEXT 类型",
+ AllowOffline: true,
+ Func: checkColumnBlobNotice,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckExplainAccessTypeAll,
+ //Value: "10000",
+ Desc: "全表扫描时,扫描行数不建议超过指定行数(默认值:10000)",
+ Annotation: "全表扫描时,扫描行数不建议超过指定行数是为了避免性能问题;具体规则阈值可以根据业务需求调整,默认值:10000;如果设置为0,全表扫描都会触发规则",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "10000",
+ Desc: "最大扫描行数",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Message: "该查询使用了全表扫描并且扫描行数为%v",
+ AllowOffline: false,
+ Func: checkExplain,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckExplainExtraUsingFilesort,
+ Desc: "不建议使用文件排序",
+ Annotation: "大数据量的情况下,文件排序意味着SQL性能较低,会增加OS的开销,影响数据库性能",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不建议使用文件排序",
+ AllowOffline: false,
+ Func: checkExplain,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckExplainExtraUsingTemporary,
+ Desc: "不建议使用临时表",
+ Annotation: "大数据量的情况下,临时表意味着SQL性能较低,会增加OS的开销,影响数据库性能",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不建议使用临时表",
+ AllowOffline: false,
+ Func: checkExplain,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckCreateView,
+ Desc: "禁止使用视图",
+ Annotation: "视图的查询性能较差,同时基表结构变更,需要对视图进行维护,如果视图可读性差且包含复杂的逻辑,都会增加维护的成本",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeUsageSuggestion,
+ },
+ Message: "禁止使用视图",
+ AllowOffline: true,
+ Func: checkCreateView,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckCreateTrigger,
+ Desc: "禁止使用触发器",
+ Annotation: "触发器难以开发和维护,不能高效移植,且在复杂的逻辑以及高并发下,容易出现死锁影响业务",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeUsageSuggestion,
+ },
+ Message: "禁止使用触发器",
+ AllowOffline: true,
+ Func: checkCreateTrigger,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckCreateFunction,
+ Desc: "禁止使用自定义函数",
+ Annotation: "自定义函数,维护较差,且依赖性高会导致SQL无法跨库使用",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeUsageSuggestion,
+ },
+ Message: "禁止使用自定义函数",
+ AllowOffline: true,
+ Func: checkCreateFunction,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckCreateProcedure,
+ Desc: "禁止使用存储过程",
+ Annotation: "存储过程在一定程度上会使程序难以调试和拓展,各种数据库的存储过程语法相差很大,给将来的数据库移植带来很大的困难,且会极大的增加出现BUG的概率",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeUsageSuggestion,
+ },
+ Message: "禁止使用存储过程",
+ AllowOffline: true,
+ Func: checkCreateProcedure,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLDisableTypeTimestamp,
+ Desc: "不建议使用TIMESTAMP字段",
+ Annotation: "TIMESTAMP 有最大值限制('2038-01-19 03:14:07' UTC),且会时区转换的问题",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "不建议使用TIMESTAMP字段",
+ AllowOffline: true,
+ Func: disableUseTypeTimestampField,
+ },
+ {
+ Rule: driverV2.Rule{ //select a as id, id , b as user from mysql.user;
+ Name: DMLCheckAlias,
+ Desc: "别名不建议与表或列的名字相同",
+ Annotation: "表或列的别名与其真实名称相同, 这样的别名会使得查询更难去分辨",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "这些别名(%v)与列名或表名相同",
+ Func: checkAlias,
+ },
+ {
+ Rule: driverV2.Rule{ //ALTER TABLE test CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
+ Name: DDLHintUpdateTableCharsetWillNotUpdateFieldCharset,
+ Desc: "不建议修改表的默认字符集",
+ Annotation: "修改表的默认字符集,只会影响后续新增的字段,不会修表已有字段的字符集;如需修改整张表所有字段的字符集建议开启此规则",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "不建议修改表的默认字符集",
+ Func: hintUpdateTableCharsetWillNotUpdateFieldCharset,
+ }, {
+ Rule: driverV2.Rule{ //ALTER TABLE tbl DROP COLUMN col;
+ Name: DDLHintDropColumn,
+ Desc: "禁止进行删除列的操作",
+ Annotation: "业务逻辑与删除列依赖未完全消除,列被删除后可能导致程序异常(无法正常读写)的情况;开启该规则,SQLE将提醒删除列为高危操作",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "禁止进行删除列的操作",
+ Func: hintDropColumn,
+ }, {
+ Rule: driverV2.Rule{ //ALTER TABLE tbl DROP PRIMARY KEY;
+ Name: DDLHintDropPrimaryKey,
+ Desc: "禁止进行删除主键的操作",
+ Annotation: "删除已有约束会影响已有业务逻辑;开启该规则,SQLE将提醒删除主键为高危操作",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "禁止进行删除主键的操作",
+ Func: hintDropPrimaryKey,
+ }, {
+ Rule: driverV2.Rule{ //ALTER TABLE tbl DROP FOREIGN KEY a;
+ Name: DDLHintDropForeignKey,
+ Desc: "禁止进行删除外键的操作",
+ Annotation: "删除已有约束会影响已有业务逻辑;开启该规则,SQLE将提醒删除外键为高危操作",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "禁止进行删除外键的操作",
+ Func: hintDropForeignKey,
+ },
+ {
+ Rule: driverV2.Rule{ //select * from user where id like "a";
+ Name: DMLNotRecommendNotWildcardLike,
+ Desc: "不建议使用没有通配符的 LIKE 查询",
+ Annotation: "不包含通配符的 LIKE 查询逻辑上与等值查询相同,建议使用等值查询替代",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不建议使用没有通配符的 LIKE 查询",
+ Func: notRecommendNotWildcardLike,
+ }, {
+ Rule: driverV2.Rule{ //SELECT * FROM tb WHERE col IN (NULL);
+ Name: DMLHintInNullOnlyFalse,
+ Desc: "避免使用 IN (NULL) 或者 NOT IN (NULL)",
+ Annotation: "查询条件永远非真,这将导致查询无匹配到的结果",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "避免使用IN (NULL)/NOT IN (NULL) ,该用法永远非真将导致条件失效",
+ Func: hintInNullOnlyFalse,
+ }, {
+ Rule: driverV2.Rule{ //select * from user where id in (a);
+ Name: DMLNotRecommendIn,
+ Desc: "不建议使用IN",
+ Annotation: "当IN值过多时,有可能会导致查询进行全表扫描,使得MySQL性能急剧下降",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不建议使用IN",
+ Func: notRecommendIn,
+ },
+ {
+ Rule: driverV2.Rule{ //select * from user where id = ' 1';
+ Name: DMLCheckSpacesAroundTheString,
+ Desc: "引号中的字符串开头或结尾不建议包含空格",
+ Annotation: "字符串前后存在空格将可能导致查询判断逻辑出错,如在MySQL 5.5中'a'和'a '在查询中被认为是相同的值",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "引号中的字符串开头或结尾不建议包含空格",
+ Func: checkSpacesAroundTheString,
+ }, {
+ Rule: driverV2.Rule{ //CREATE TABLE tb (a varchar(10) default '“');
+ Name: DDLCheckFullWidthQuotationMarks,
+ Desc: "DDL语句中不建议使用中文全角引号",
+ Annotation: "建议开启此规则,可避免MySQL会将中文全角引号识别为命名的一部分,执行结果与业务预期不符",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "DDL语句中不建议使用中文全角引号,这可能是书写错误",
+ Func: checkFullWidthQuotationMarks,
+ }, {
+ Rule: driverV2.Rule{ //select name from tbl where id < 1000 order by rand(1)
+ Name: DMLNotRecommendOrderByRand,
+ Desc: "不建议使用 ORDER BY RAND()",
+ Annotation: "ORDER BY RAND()使用了临时表,同时还要对其进行排序,在数据量很大的情况下会增加服务器负载以及增加查询时间",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不建议使用 ORDER BY RAND()",
+ Func: notRecommendOrderByRand,
+ }, {
+ Rule: driverV2.Rule{ //select col1,col2 from tbl group by 1
+ Name: DMLNotRecommendGroupByConstant,
+ Desc: "不建议对常量进行 GROUP BY",
+ Annotation: "GROUP BY 1 表示按第一列进行GROUP BY;在GROUP BY子句中使用数字,而不是表达式或列名称,当查询列顺序改变时,会导致查询逻辑出现问题",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不建议对常量进行 GROUP BY",
+ Func: notRecommendGroupByConstant,
+ }, {
+ Rule: driverV2.Rule{ //select c1,c2,c3 from t1 where c1='foo' order by c2 desc, c3 asc
+ Name: DMLCheckSortDirection,
+ Desc: "不建议在 ORDER BY 语句中对多个不同条件使用不同方向的排序",
+ Annotation: "在 MySQL 8.0 之前当 ORDER BY 多个列指定的排序方向不同时将无法使用已经建立的索引。在MySQL8.0 之后可以建立对应的排序顺序的联合索引来优化",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不建议在 ORDER BY 语句中对多个不同条件使用不同方向的排序",
+ Func: checkSortDirection,
+ }, {
+ Rule: driverV2.Rule{ //select col1,col2 from tbl group by 1
+ Name: DMLHintGroupByRequiresConditions,
+ Desc: "建议为GROUP BY语句添加ORDER BY条件",
+ Annotation: "在5.7中,MySQL默认会对’GROUP BY col1, …’按如下顺序’ORDER BY col1,…’隐式排序,导致产生无谓的排序,带来额外的开销;在8.0中,则不会出现这种情况。如果不需要排序建议显示添加’ORDER BY NULL’",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "建议为GROUP BY语句添加ORDER BY条件",
+ Func: hintGroupByRequiresConditions,
+ }, {
+ Rule: driverV2.Rule{ //select description from film where title ='ACADEMY DINOSAUR' order by length-language_id;
+ Name: DMLNotRecommendGroupByExpression,
+ Desc: "不建议ORDER BY 的条件为表达式",
+ Annotation: "当ORDER BY条件为表达式或函数时会使用到临时表,如果在未指定WHERE或WHERE条件返回的结果集较大时性能会很差",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不建议ORDER BY 的条件为表达式",
+ Func: notRecommendGroupByExpression,
+ }, {
+ Rule: driverV2.Rule{ //select description from film where title ='ACADEMY DINOSAUR' order by length-language_id;
+ Name: DMLCheckSQLLength,
+ Desc: "建议将过长的SQL分解成几个简单的SQL",
+ Annotation: "过长的SQL可读性较差,难以维护,且容易引发性能问题;具体规则阈值可以根据业务需求调整,默认值:1024",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDMLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "1024",
+ Desc: "SQL最大长度",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Message: "建议将过长的SQL分解成几个简单的SQL",
+ Func: checkSQLLength,
+ }, {
+ Rule: driverV2.Rule{ //SELECT s.c_id,count(s.c_id) FROM s where c = test GROUP BY s.c_id HAVING s.c_id <> '1660' AND s.c_id <> '2' order by s.c_id
+ Name: DMLNotRecommendHaving,
+ Desc: "不建议使用 HAVING 子句",
+ Annotation: "对于索引字段,放在HAVING子句中时不会走索引;建议将HAVING子句改写为WHERE中的查询条件,可以在查询处理期间使用索引,提高SQL的执行效率",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不建议使用 HAVING 子句",
+ Func: notRecommendHaving,
+ }, {
+ Rule: driverV2.Rule{ //delete from tbl
+ Name: DMLHintUseTruncateInsteadOfDelete,
+ Desc: "删除全表时建议使用 TRUNCATE 替代 DELETE",
+ Annotation: "TRUNCATE TABLE 比 DELETE 速度快,且使用的系统和事务日志资源少,同时TRUNCATE后表所占用的空间会被释放,而DELETE后需要手工执行OPTIMIZE才能释放表空间",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "删除全表时建议使用 TRUNCATE 替代 DELETE",
+ Func: hintUseTruncateInsteadOfDelete,
+ }, {
+ Rule: driverV2.Rule{ //update mysql.func set name ="hello";
+ Name: DMLNotRecommendUpdatePK,
+ Desc: "不建议UPDATE主键",
+ Annotation: "主键索引数据列的顺序就是表记录的物理存储顺序,频繁更新主键将导致整个表记录的顺序的调整,会耗费相当大的资源",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不建议UPDATE主键",
+ Func: notRecommendUpdatePK,
+ }, {
+ Rule: driverV2.Rule{ //create table t(c1 int,c2 int,c3 int,c4 int,c5 int,c6 int);
+ Name: DDLCheckColumnQuantity,
+ Desc: "表的列数不建议超过阈值",
+ Annotation: "避免在OLTP系统上做宽表设计,后期对性能影响很大;具体规则阈值可根据业务需求调整,默认值:40",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDDLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "40",
+ Desc: "最大列数",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Message: "表的列数不建议超过阈值",
+ Func: checkColumnQuantity,
+ AllowOffline: true,
+ }, {
+ Rule: driverV2.Rule{ //CREATE TABLE `tb2` ( `id` int(11) DEFAULT NULL, `col` char(10) CHARACTER SET utf8 DEFAULT NULL)
+ Name: DDLRecommendTableColumnCharsetSame,
+ Desc: "建议列与表使用同一个字符集",
+ Annotation: "统一字符集可以避免由于字符集转换产生的乱码,不同的字符集进行比较前需要进行转换会造成索引失效",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "建议列与表使用同一个字符集",
+ Func: recommendTableColumnCharsetSame,
+ }, {
+ Rule: driverV2.Rule{ //CREATE TABLE tab (a INT(1));
+ Name: DDLCheckColumnTypeInteger,
+ Desc: "整型定义建议采用 INT(10) 或 BIGINT(20)",
+ Annotation: "INT(M) 或 BIGINT(M),M 表示最大显示宽度,可存储最大值的宽度分别为10、20,采用 INT(10) 或 BIGINT(20)可避免发生显示截断的可能",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "整型定义建议采用 INT(10) 或 BIGINT(20)",
+ Func: checkColumnTypeInteger,
+ }, {
+ Rule: driverV2.Rule{ //CREATE TABLE tab (a varchar(3500));
+ Name: DDLCheckVarcharSize,
+ Desc: "定义VARCHAR 长度时不建议大于阈值",
+ Annotation: "MySQL建立索引时没有限制索引的大小,索引长度会默认采用的该字段的长度,VARCHAR 定义长度越长建立的索引存储大小越大;具体规则阈值可以根据业务需求调整,默认值:1024",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDDLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "1024",
+ Desc: "VARCHAR最大长度",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Message: "定义VARCHAR 长度时不建议大于阈值, 阈值为%d",
+ Func: checkVarcharSize,
+ }, {
+ Rule: driverV2.Rule{ //select id from t where substring(name,1,3)='abc'
+ Name: DMLNotRecommendFuncInWhere,
+ Desc: "应避免在 WHERE 条件中使用函数或其他运算符",
+ Annotation: "函数或运算符会导致查询无法利用表中的索引,该查询将会全表扫描,性能较差",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "应避免在 WHERE 条件中使用函数或其他运算符",
+ Func: notRecommendFuncInWhere,
+ }, {
+ Rule: driverV2.Rule{ //SELECT SYSDATE();
+ Name: DMLNotRecommendSysdate,
+ Desc: "不建议使用 SYSDATE() 函数",
+ Annotation: "当SYSDATE()函数在基于STATEMENT模式的主从环境下可能造成数据的不一致,因为语句在主库中执行到日志传递到备库,存在时间差,到备库执行的时候就会变成不同的时间值,建议采取ROW模式的复制环境",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不建议使用 SYSDATE() 函数",
+ Func: notRecommendSysdate,
+ }, {
+ Rule: driverV2.Rule{ //SELECT SUM(COL) FROM tbl;
+ Name: DMLHintSumFuncTips,
+ Desc: "避免使用 SUM(COL)",
+ Annotation: "当某一列的值全是NULL时,COUNT(COL)的返回结果为0,但SUM(COL)的返回结果为NULL,因此使用SUM()时需注意NPE问题(指数据返回NULL);如业务需避免NPE问题,建议开启此规则",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "避免使用 SUM(COL) ,该用法存在返回NULL值导致程序空指针的风险",
+ Func: hintSumFuncTips,
+ }, {
+ Rule: driverV2.Rule{
+ Name: DMLHintCountFuncWithCol,
+ Desc: "避免使用 COUNT(COL)",
+ Annotation: "建议使用COUNT(*),因为使用 COUNT(COL) 需要对表进行全表扫描,这可能会导致性能下降。",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "避免使用 COUNT(COL)",
+ Func: hintCountFuncWithCol,
+ AllowOffline: true,
+ }, {
+ Rule: driverV2.Rule{
+ Name: DDLCheckColumnQuantityInPK,
+ Desc: "主键包含的列数不建议超过阈值",
+ Annotation: "主建中的列过多,会导致二级索引占用更多的空间,同时增加索引维护的开销;具体规则阈值可根据业务需求调整,默认值:2",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDDLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "2",
+ Desc: "最大列数",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Message: "主键包含的列数不建议超过阈值",
+ Func: checkColumnQuantityInPK,
+ }, {
+ Rule: driverV2.Rule{ //select col1,col2 from tbl where name=xx limit 10
+ Name: DMLHintLimitMustBeCombinedWithOrderBy,
+ Desc: "LIMIT 查询建议使用ORDER BY",
+ Annotation: "没有ORDER BY的LIMIT会导致非确定性的结果可能与业务需求不符,这取决于执行计划",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "LIMIT 查询建议使用ORDER BY",
+ Func: hintLimitMustBeCombinedWithOrderBy,
+ },
+ {
+ Rule: driverV2.Rule{ //TRUNCATE TABLE tbl_name
+ Name: DMLHintTruncateTips,
+ Desc: "不建议使用TRUNCATE操作",
+ Annotation: "TRUNCATE是DLL,数据不能回滚,在没有备份情况下,谨慎使用TRUNCATE",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不建议使用TRUNCATE操作",
+ Func: hintTruncateTips,
+ }, {
+ Rule: driverV2.Rule{ //delete from t where col = 'condition'
+ Name: DMLHintDeleteTips,
+ Desc: "建议在执行DELETE/DROP/TRUNCATE等操作前进行备份",
+ Annotation: "DROP/TRUNCATE是DDL,操作立即生效,不会写入日志,所以无法回滚,在执行高危操作之前对数据进行备份是很有必要的",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "建议在执行DELETE/DROP/TRUNCATE等操作前进行备份",
+ Func: hintDeleteTips,
+ }, {
+ Rule: driverV2.Rule{ //SELECT BENCHMARK(10, RAND())
+ Name: DMLCheckSQLInjectionFunc,
+ Desc: "不建议使用常见 SQL 注入函数",
+ Annotation: "攻击者通过SQL注入,可未经授权可访问数据库中的数据,存在盗取用户信息,造成用户数据泄露等安全漏洞问题",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不建议使用常见 SQL 注入函数",
+ Func: checkSQLInjectionFunc,
+ }, {
+ Rule: driverV2.Rule{ //select col1,col2 from tbl where type!=0
+ Name: DMLCheckNotEqualSymbol,
+ Desc: "建议使用'<>'代替'!='",
+ Annotation: "'!=' 是非标准的运算符,'<>' 才是SQL中标准的不等于运算符",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "建议使用'<>'代替'!='",
+ Func: checkNotEqualSymbol,
+ }, {
+ Rule: driverV2.Rule{ //select col1,col2,col3 from table1 where col2 in(select col from table2)
+ Name: DMLNotRecommendSubquery,
+ Desc: "不推荐使用子查询",
+ Annotation: "有些情况下,子查询并不能使用到索引,同时对于返回结果集比较大的子查询,会产生大量的临时表,消耗过多的CPU和IO资源,产生大量的慢查询",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不推荐使用子查询",
+ Func: notRecommendSubquery,
+ }, {
+ Rule: driverV2.Rule{ //SELECT * FROM staff WHERE name IN (SELECT NAME FROM customer ORDER BY name LIMIT 1)
+ Name: DMLCheckSubqueryLimit,
+ Desc: "不建议在子查询中使用LIMIT",
+ Annotation: "部分MySQL版本不支持在子查询中进行'LIMIT & IN/ALL/ANY/SOME'",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "不建议在子查询中使用LIMIT",
+ Func: checkSubqueryLimit,
+ }, {
+ Rule: driverV2.Rule{ //CREATE TABLE tbl (a int) AUTO_INCREMENT = 10;
+ Name: DDLCheckAutoIncrement,
+ Desc: "表的初始AUTO_INCREMENT值建议为0",
+ Annotation: "创建表时AUTO_INCREMENT设置为0则自增从1开始,可以避免数据空洞。例如在导出表结构DDL时,表结构内AUTO_INCREMENT通常为当前的自增值,如果建表时没有把AUTO_INCREMENT设置为0,那么通过该DDL进行建表操作会导致自增值从一个无意义数字开始。",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "表的初始AUTO_INCREMENT值建议为0",
+ Func: checkAutoIncrement,
+ }, {
+ Rule: driverV2.Rule{ // rename table t1 to t2;
+ Name: DDLNotAllowRenaming,
+ Desc: "禁止使用RENAME或CHANGE对表名字段名进行修改",
+ Annotation: "RENAME/CHANGE 表名/列名会对线上业务不停机发布造成影响,如需这种操作应当DBA手工干预",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDDLConvention,
+ },
+ AllowOffline: true,
+ Message: "禁止使用RENAME或CHANGE对表名字段名进行修改",
+ Func: ddlNotAllowRenaming,
+ }, {
+ Rule: driverV2.Rule{
+ Name: DMLCheckExplainFullIndexScan,
+ Desc: "不建议对表进行全索引扫描",
+ Annotation: "在数据量大的情况下索引全扫描严重影响SQL性能。",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ AllowOffline: false,
+ Message: "不建议对表进行全索引扫描",
+ Func: checkExplain,
+ }, {
+ Rule: driverV2.Rule{
+ Name: DMLCheckLimitOffsetNum,
+ Desc: "不建议LIMIT的偏移OFFSET大于阈值",
+ Annotation: "因为OFFSET指定了结果集的起始位置,如果起始位置过大,那么 MySQL 需要处理更多的数据才能返回结果集,这可能会导致查询性能下降。",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDMLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "100",
+ Desc: "offset 大小",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Message: "不建议LIMIT的偏移OFFSET大于阈值,OFFSET=%v(阈值为%v)",
+ AllowOffline: true,
+ Func: checkLimitOffsetNum,
+ }, {
+ Rule: driverV2.Rule{
+ Name: DMLCheckUpdateOrDeleteHasWhere,
+ Desc: "建议UPDATE/DELETE操作使用WHERE条件",
+ Annotation: "因为这些语句的目的是修改数据库中的数据,需要使用 WHERE 条件来过滤需要更新或删除的记录,以确保数据的正确性。另外,使用 WHERE 条件还可以提高查询性能。",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "建议UPDATE/DELETE操作使用WHERE条件",
+ AllowOffline: true,
+ Func: checkUpdateOrDeleteHasWhere,
+ }, {
+ Rule: driverV2.Rule{
+ Name: DMLCheckSortColumnLength,
+ Desc: "禁止对长字段排序",
+ Annotation: "对例如VARCHAR(2000)这样的长字段进行ORDER BY、DISTINCT、GROUP BY、UNION之类的操作,会引发排序,有性能隐患",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeUsageSuggestion,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "2000",
+ Desc: "可排序字段的最大长度",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ AllowOffline: false,
+ Message: "长度超过阈值的字段不建议用于ORDER BY、DISTINCT、GROUP BY、UNION,这些字段有:%v",
+ Func: checkSortColumnLength,
+ }, {
+ Rule: driverV2.Rule{
+ Name: AllCheckPrepareStatementPlaceholders,
+ Desc: "绑定的变量个数不建议超过阈值",
+ Annotation: "因为过度使用绑定变量会增加查询的复杂度,从而降低查询性能。过度使用绑定变量还会增加维护成本。默认阈值:100",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeUsageSuggestion,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "100",
+ Desc: "最大绑定变量数量",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ AllowOffline: true,
+ Message: "使用绑定变量数量为 %v,不建议超过设定阈值 %v",
+ Func: checkPrepareStatementPlaceholders,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckExplainExtraUsingIndexForSkipScan,
+ Desc: "不建议对表进行索引跳跃扫描",
+ Annotation: "索引扫描是跳跃扫描,未遵循最左匹配原则,可能降低索引的使用效率,影响查询性能",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDMLConvention,
+ },
+ AllowOffline: false,
+ Message: "不建议对表进行索引跳跃扫描",
+ Func: checkExplain,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckAffectedRows,
+ Desc: "UPDATE/DELETE操作影响行数不建议超过阈值",
+ Annotation: "如果 DML 操作影响行数过多,会导致查询性能下降,因为需要扫描更多的数据。",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDMLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "10000",
+ Desc: "最大影响行数",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ AllowOffline: false,
+ Message: "UPDATE/DELETE操作影响行数不建议超过阈值,影响行数为 %v,超过设定阈值 %v",
+ Func: checkAffectedRows,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckSameTableJoinedMultipleTimes,
+ Desc: "不建议对同一张表连接多次",
+ Annotation: "如果对单表查询多次,会导致查询性能下降。",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDMLConvention,
+ },
+ AllowOffline: false,
+ Message: "表%v被连接多次",
+ Func: checkSameTableJoinedMultipleTimes,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckExplainUsingIndex,
+ Desc: "SQL查询条件需要走索引",
+ Annotation: "使用索引可以显著提高SQL查询的性能。",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ AllowOffline: false,
+ Message: "建议使用索引以优化 SQL 查询性能",
+ Func: checkExplain,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckInsertSelect,
+ Desc: "不建议使用INSERT ... SELECT",
+ Annotation: "使用 INSERT ... SELECT 在默认事务隔离级别下,可能会导致对查询的表施加表级锁。",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ AllowOffline: true,
+ Message: "不建议使用INSERT ... SELECT",
+ Func: checkInsertSelect,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckAggregate,
+ Desc: "不建议使用聚合函数",
+ Annotation: "不建议使用SQL聚合函数,是为了确保查询的简单性、高性能和数据一致性。",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ AllowOffline: true,
+ Message: "不建议使用聚合函数计算",
+ Func: checkAggregateFunc,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckColumnNotNULL,
+ Desc: "表字段建议有NOT NULL约束",
+ Annotation: "表字段建议有 NOT NULL 约束,可确保数据的完整性,防止插入空值,提升查询准确性。",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDDLConvention,
+ },
+ AllowOffline: false,
+ Message: "建议字段%v设置NOT NULL约束",
+ Func: checkColumnNotNull,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckIndexSelectivity,
+ Desc: "建议连库查询时,确保SQL执行计划中使用的索引区分度大于阈值",
+ Annotation: "确保SQL执行计划中使用的高索引区分度,有助于提升查询性能并优化查询效率。",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDMLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "70",
+ Desc: "可选择性(百分比)",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ AllowOffline: false,
+ Message: "索引:%v,未超过区分度阈值:%v,建议使用超过阈值的索引。",
+ Func: checkIndexSelectivity,
+ },
+ {
+ // 该规则只适用于库表元数据扫描并且需要与停用上线审核模式规则一起使用
+ Rule: driverV2.Rule{
+ Name: DDLCheckTableRows,
+ Desc: "表行数超过阈值,建议对表进行拆分",
+ Annotation: "当表行数超过阈值时,对表进行拆分有助于提高数据库性能和查询速度。",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeUsageSuggestion,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "1000",
+ Desc: "表行数(万)",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Message: "表行数超过阈值,建议对表进行拆分",
+ Func: checkTableRows,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckCompositeIndexDistinction,
+ Desc: "建议在组合索引中将区分度高的字段靠前放",
+ Annotation: "将区分度高的字段靠前放置在组合索引中有助于提高索引的查询性能,因为它能更快地减小数据范围,提高检索效率。",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDDLConvention,
+ },
+ AllowOffline: false,
+ Message: "建议在组合索引中将区分度高的字段靠前放,%v",
+ Func: checkCompositeIndexSelectivity,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLAvoidText,
+ Desc: "使用TEXT 类型的字段建议和原表进行分拆,与原表主键单独组成另外一个表进行存放",
+ Annotation: "将TEXT类型的字段与原表主键分拆成另一个表可以提高数据库性能和查询速度,减少不必要的 I/O 操作。",
+ Level: driverV2.RuleLevelNotice,
+ Category: RuleTypeDDLConvention,
+ },
+ AllowOffline: true,
+ Message: "字段:%v为TEXT类型,建议和原表进行分拆,与原表主键单独组成另外一个表进行存放",
+ Func: checkText,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckSelectRows,
+ Desc: "查询数据量超过阈值,筛选条件必须带上主键或者索引",
+ Annotation: "筛选条件必须带上主键或索引可提高查询性能和减少全表扫描的成本。",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDMLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "10",
+ Desc: "查询数据量(万)",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ AllowOffline: false,
+ Message: "查询数据量超过阈值,筛选条件必须带上主键或者索引",
+ Func: checkSelectRows,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckScanRows,
+ Desc: "扫描行数超过阈值,筛选条件必须带上主键或者索引",
+ Annotation: "筛选条件必须带上主键或索引可降低数据库查询的时间复杂度,提高查询效率。",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDMLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "10",
+ Desc: "扫描行数量(万)",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ AllowOffline: false,
+ Message: "扫描行数超过阈值,筛选条件必须带上主键或者索引",
+ Func: checkScanRows,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLMustUseLeftMostPrefix,
+ Desc: "使用联合索引时,必须使用联合索引的首字段",
+ Annotation: "使用联合索引时,不包含首字段会导致联合索引失效",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeIndexInvalidation,
+ },
+ AllowOffline: false,
+ Message: "使用联合索引时,必须使用联合索引的首字段",
+ Func: mustMatchLeftMostPrefix,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLMustMatchLeftMostPrefix,
+ Desc: "禁止对联合索引左侧字段进行IN 、OR等非等值查询",
+ Annotation: "对联合索引左侧字段进行IN 、OR等非等值查询会导致联合索引失效",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeIndexInvalidation,
+ },
+ AllowOffline: false,
+ Message: "对联合索引左侧字段进行IN 、OR等非等值查询会导致联合索引失效",
+ Func: mustMatchLeftMostPrefix,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckJoinFieldUseIndex,
+ Desc: "JOIN字段必须包含索引",
+ Annotation: "JOIN字段包含索引可提高连接操作的性能和查询速度。",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeIndexInvalidation,
+ },
+ AllowOffline: false,
+ Message: "JOIN字段必须包含索引",
+ Func: checkJoinFieldUseIndex,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckJoinFieldCharacterSetAndCollation,
+ Desc: "连接表字段的字符集和排序规则必须一致",
+ Annotation: "连接表字段的字符集和排序规则一致可避免数据不一致和查询错误,确保连接操作正确执行。",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeIndexInvalidation,
+ },
+ AllowOffline: false,
+ Message: "连接表字段的字符集和排序规则必须一致",
+ Func: checkJoinFieldCharacterSetAndCollation,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckMathComputationOrFuncOnIndex,
+ Desc: "禁止对索引列进行数学运算和使用函数",
+ Annotation: "对索引列进行数学运算和使用函数会导致索引失效,从而导致全表扫描,影响查询性能。",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeIndexInvalidation,
+ },
+ AllowOffline: false,
+ Message: "禁止对索引列进行数学运算和使用函数",
+ Func: checkMathComputationOrFuncOnIndex,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLSQLExplainLowestLevel,
+ Desc: "SQL执行计划中type字段建议满足规定的级别",
+ Annotation: "验证 SQL 执行计划中的 type 字段,确保满足要求级别,以保证查询性能。",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDDLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "range,ref,const,eq_ref,system,NULL",
+ Desc: "查询计划type等级,以英文逗号隔开",
+ Type: params.ParamTypeString,
+ },
+ },
+ },
+ AllowOffline: false,
+ Message: "建议修改SQL,确保执行计划中type字段可以满足规定中的任一等级:%v",
+ Func: checkSQLExplainLowestLevel,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLAvoidFullText,
+ Desc: "禁止使用全文索引",
+ Annotation: "全文索引的使用会增加存储开销,并对写操作性能产生一定影响。",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeUsageSuggestion,
+ },
+ AllowOffline: true,
+ Message: "禁止使用全文索引",
+ Func: avoidFullText,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLAvoidGeometry,
+ Desc: "禁止使用空间字段和空间索引",
+ Annotation: "使用空间字段和空间索引会增加存储需求,对数据库性能造成一定影响",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeUsageSuggestion,
+ },
+ AllowOffline: true,
+ Message: "禁止使用空间字段和空间索引",
+ Func: avoidGeometry,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLAvoidWhereEqualNull,
+ Desc: "WHERE子句中禁止将NULL值与其他字段或值进行比较运算",
+ Annotation: "NULL在SQL中属于特殊值,无法与普通值进行比较。例如:column = NULL恒为false,即使column存在null值也不会查询出来,所以column = NULL应该写为column is NULL",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDMLConvention,
+ },
+ AllowOffline: true,
+ Message: "WHERE子句中禁止将NULL值与其他字段或值进行比较运算",
+ Func: avoidWhereEqualNull,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLAvoidEvent,
+ Desc: "禁止使用event",
+ Annotation: "使用event会增加数据库的维护难度和依赖性,并且也会造成安全问题。",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeUsageSuggestion,
+ },
+ AllowOffline: true,
+ Message: "禁止使用event",
+ Func: avoidEvent,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckCharLength,
+ Desc: "禁止char, varchar类型字段字符长度总和超过阈值",
+ Annotation: "使用过长或者过多的varchar,char字段可能会增加业务逻辑的复杂性;如果字段平均长度过大时,会占用更多的存储空间。",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeUsageSuggestion,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "2000",
+ Desc: "字符长度",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ AllowOffline: false,
+ Message: "禁止char, varchar类型字段字符长度总和超过阈值 %v",
+ Func: checkCharLength,
+ },
+}
diff --git a/sqle/driver/mysql/rule/rule_list_trial.go b/sqle/driver/mysql/rule/rule_list_trial.go
new file mode 100644
index 0000000000..56541514f0
--- /dev/null
+++ b/sqle/driver/mysql/rule/rule_list_trial.go
@@ -0,0 +1,223 @@
+//go:build trial
+// +build trial
+
+package rule
+
+import (
+ driverV2 "github.com/actiontech/sqle/sqle/driver/v2"
+ "github.com/actiontech/sqle/sqle/pkg/params"
+ "github.com/pingcap/parser/ast"
+)
+
+func init() {
+ RuleHandlers = []RuleHandler{
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckFuzzySearch,
+ Desc: "禁止使用全模糊搜索或左模糊搜索",
+ Annotation: "使用全模糊搜索或左模糊搜索将导致查询无法使用索引,导致全表扫描",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "禁止使用全模糊搜索或左模糊搜索",
+ AllowOffline: true,
+ Func: checkSelectWhere,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckJoinFieldType,
+ Desc: "建议JOIN字段类型保持一致",
+ Annotation: "JOIN字段类型不一致会导致类型不匹配发生隐式准换,建议开启此规则,避免索引失效",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "建议JOIN字段类型保持一致, 否则会导致隐式转换",
+ AllowOffline: false,
+ Func: checkJoinFieldType,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLRecommendTableColumnCharsetSame,
+ Desc: "建议列与表使用同一个字符集",
+ Annotation: "统一字符集可以避免由于字符集转换产生的乱码,不同的字符集进行比较前需要进行转换会造成索引失效",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "建议列与表使用同一个字符集",
+ Func: recommendTableColumnCharsetSame,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckColumnTimestampWithoutDefault,
+ Desc: "TIMESTAMP 类型的列必须添加默认值",
+ Annotation: "TIMESTAMP添加默认值,可避免出现全为0的日期格式与业务预期不符",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "TIMESTAMP 类型的列必须添加默认值",
+ AllowOffline: true,
+ Func: checkColumnTimestampWithoutDefault,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckIndexPrefix,
+ Desc: "建议普通索引使用固定前缀",
+ Annotation: "通过配置该规则可以规范指定业务的索引命名规则,具体命名规范可以自定义设置,默认提示值:idx_",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeNamingConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "idx_",
+ Desc: "索引前缀",
+ Type: params.ParamTypeString,
+ },
+ },
+ },
+ Message: "建议普通索引要以\"%v\"为前缀",
+ AllowOffline: true,
+ Func: checkIndexPrefix,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckPKNotExist,
+ Desc: "表必须有主键",
+ Annotation: "主键使数据达到全局唯一,可提高数据检索效率",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeIndexingConvention,
+ },
+ Message: "表必须有主键",
+ AllowOffline: true,
+ NotAllowOfflineStmts: []ast.Node{&ast.AlterTableStmt{}},
+ NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}},
+ Func: checkPrimaryKey,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: ConfigDMLExplainPreCheckEnable,
+ Desc: "使用EXPLAIN加强预检查能力",
+ Annotation: "通过 EXPLAIN 的形式将待上线的DML进行SQL是否能正确执行的检查,提前发现语句的错误,提高上线成功率",
+ Level: driverV2.RuleLevelWarn,
+ Category: RuleTypeGlobalConfig,
+ },
+ Func: nil,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckIndexCount,
+ Desc: "索引个数建议不超过阈值",
+ Annotation: "在表上建立的每个索引都会增加存储开销,索引对于插入、删除、更新操作也会增加处理上的开销,太多与不充分、不正确的索引对性能都毫无益处;具体规则阈值可以根据业务需求调整,默认值:5",
+ Level: driverV2.RuleLevelNotice,
+ //Value: "5",
+ Category: RuleTypeIndexingConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "5",
+ Desc: "最大索引个数",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ Message: "索引个数建议不超过%v个",
+ AllowOffline: true,
+ NotAllowOfflineStmts: []ast.Node{&ast.AlterTableStmt{}, &ast.CreateIndexStmt{}},
+ NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}, &ast.CreateIndexStmt{}},
+ Func: checkIndex,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckPKWithoutAutoIncrement,
+ Desc: "主键建议使用自增",
+ Annotation: "自增主键,数字型速度快,而且是增量增长,占用空间小,更快速的做数据插入操作,避免增加维护索引的开销",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeIndexingConvention,
+ },
+ Message: "主键建议使用自增",
+ AllowOffline: true,
+ NotAllowOfflineStmts: []ast.Node{&ast.AlterTableStmt{}},
+ NotSupportExecutedSQLAuditStmts: []ast.Node{&ast.AlterTableStmt{}},
+ Func: checkPrimaryKey,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckObjectNameUsingKeyword,
+ Desc: "数据库对象命名禁止使用保留字",
+ Annotation: "通过配置该规则可以规范指定业务的数据对象命名规则,避免发生冲突,以及混淆",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeNamingConvention,
+ },
+ Message: "数据库对象命名禁止使用保留字 %s",
+ AllowOffline: true,
+ Func: checkNewObjectName,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckMathComputationOrFuncOnIndex,
+ Desc: "禁止对索引列进行数学运算和使用函数",
+ Annotation: "对索引列进行数学运算和使用函数会导致索引失效,从而导致全表扫描,影响查询性能。",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeIndexInvalidation,
+ },
+ AllowOffline: false,
+ Message: "禁止对索引列进行数学运算和使用函数",
+ Func: checkMathComputationOrFuncOnIndex,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLDisableDropStatement,
+ Desc: "禁止除索引外的DROP操作",
+ Annotation: "DROP是DDL,数据变更不会写入日志,无法进行回滚;建议开启此规则,避免误删除操作",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeUsageSuggestion,
+ },
+ Message: "禁止除索引外的DROP操作",
+ AllowOffline: true,
+ Func: disableDropStmt,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckScanRows,
+ Desc: "扫描行数超过阈值,筛选条件必须带上主键或者索引",
+ Annotation: "筛选条件必须带上主键或索引可降低数据库查询的时间复杂度,提高查询效率。",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDMLConvention,
+ Params: params.Params{
+ ¶ms.Param{
+ Key: DefaultSingleParamKeyName,
+ Value: "10",
+ Desc: "扫描行数量(万)",
+ Type: params.ParamTypeInt,
+ },
+ },
+ },
+ AllowOffline: false,
+ Message: "扫描行数超过阈值,筛选条件必须带上主键或者索引",
+ Func: checkScanRows,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DMLCheckWhereIsInvalid,
+ Desc: "禁止使用没有WHERE条件或者WHERE条件恒为TRUE的SQL",
+ Annotation: "SQL缺少WHERE条件在执行时会进行全表扫描产生额外开销,建议在大数据量高并发环境下开启,避免影响数据库查询性能",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDMLConvention,
+ },
+ Message: "禁止使用没有WHERE条件或者WHERE条件恒为TRUE的SQL",
+ AllowOffline: true,
+ Func: checkSelectWhere,
+ },
+ {
+ Rule: driverV2.Rule{
+ Name: DDLCheckColumnWithoutDefault,
+ Desc: "除了自增列及大字段列之外,每个列都必须添加默认值",
+ Annotation: "列添加默认值,可避免列为NULL值时对查询的影响",
+ Level: driverV2.RuleLevelError,
+ Category: RuleTypeDDLConvention,
+ },
+ Message: "除了自增列及大字段列之外,每个列都必须添加默认值",
+ AllowOffline: true,
+ Func: checkColumnWithoutDefault,
+ },
+ }
+}
diff --git a/sqle/errors/errors.go b/sqle/errors/errors.go
index 64f6063c1e..d3e91ff525 100644
--- a/sqle/errors/errors.go
+++ b/sqle/errors/errors.go
@@ -138,3 +138,7 @@ func NewNotSupportGetTaskAnalysisDataErr() error {
func NewTaskNoExistOrNoAccessErr() error {
return New(DataNotExist, fmt.Errorf("task is not exist or you can't access it"))
}
+
+func NewInstanceNoExistErr() error {
+ return New(DataNotExist, fmt.Errorf("instance is not exist"))
+}
diff --git a/sqle/model/audit_plan.go b/sqle/model/audit_plan.go
index 31095bb2fd..6facc48526 100644
--- a/sqle/model/audit_plan.go
+++ b/sqle/model/audit_plan.go
@@ -15,13 +15,13 @@ import (
type AuditPlan struct {
Model
- ProjectId uint `gorm:"index; not null"`
- Name string `json:"name" gorm:"not null;index"`
- CronExpression string `json:"cron_expression" gorm:"not null"`
- DBType string `json:"db_type" gorm:"not null"`
- Token string `json:"token" gorm:"not null"`
- InstanceName string `json:"instance_name"`
- CreateUserID uint
+ ProjectId ProjectUID `gorm:"index; not null"`
+ Name string `json:"name" gorm:"not null;index"`
+ CronExpression string `json:"cron_expression" gorm:"not null"`
+ DBType string `json:"db_type" gorm:"not null"`
+ Token string `json:"token" gorm:"not null"`
+ InstanceName string `json:"instance_name"`
+ CreateUserID string `json:"create_user_id"`
InstanceDatabase string `json:"instance_database"`
Type string `json:"type"`
RuleTemplateName string `json:"rule_template_name"`
@@ -34,7 +34,9 @@ type AuditPlan struct {
WebHookURL string `json:"web_hook_url"`
WebHookTemplate string `json:"web_hook_template"`
- CreateUser *User `gorm:"foreignkey:CreateUserId"`
+ ProjectStatus string `gorm:"default:'active'"` // dms-todo: 暂时将项目状态放在这里
+
+ // CreateUser *User // TODO 移除 `gorm:"foreignkey:CreateUserId"`
Instance *Instance `gorm:"foreignkey:InstanceName;association_foreignkey:Name"`
AuditPlanSQLs []*AuditPlanSQLV2 `gorm:"foreignkey:AuditPlanID"`
}
@@ -110,9 +112,8 @@ func (s *Storage) GetAuditPlans() ([]*AuditPlan, error) {
func (s *Storage) GetActiveAuditPlans() ([]*AuditPlan, error) {
var aps []*AuditPlan
- err := s.db.Model(AuditPlan{}).Preload("Instance").
- Joins("LEFT JOIN projects ON projects.id = audit_plans.project_id").
- Where(fmt.Sprintf("projects.status = '%v'", ProjectStatusActive)).
+ err := s.db.Model(AuditPlan{}).
+ Where("project_status = ?", ProjectStatusActive).
Find(&aps).Error
return aps, errors.New(errors.ConnectStorageError, err)
}
@@ -137,20 +138,18 @@ func (s *Storage) GetAuditPlanById(id uint) (*AuditPlan, bool, error) {
func (s *Storage) GetActiveAuditPlanById(id uint) (*AuditPlan, bool, error) {
ap := &AuditPlan{}
- err := s.db.Model(AuditPlan{}).Preload("Instance").
- Joins("LEFT JOIN projects ON projects.id = audit_plans.project_id").
- Where(fmt.Sprintf("projects.status = '%v'", ProjectStatusActive)).
- Where("audit_plans.id = ?", id).Find(ap).Error
+ err := s.db.Model(AuditPlan{}).
+ Where("project_status = ?", ProjectStatusActive).
+ Where("id = ?", id).Find(ap).Error
if err == gorm.ErrRecordNotFound {
return ap, false, nil
}
return ap, true, errors.New(errors.ConnectStorageError, err)
}
-func (s *Storage) GetAuditPlanFromProjectByName(projectName, AuditPlanName string) (*AuditPlan, bool, error) {
+func (s *Storage) GetAuditPlanFromProjectByName(projectId, AuditPlanName string) (*AuditPlan, bool, error) {
ap := &AuditPlan{}
- err := s.db.Model(AuditPlan{}).Preload("Instance").Joins("LEFT JOIN projects ON projects.id = audit_plans.project_id").
- Where("projects.name = ? AND audit_plans.name = ?", projectName, AuditPlanName).Find(ap).Error
+ err := s.db.Model(AuditPlan{}).Where("project_id = ? AND name = ?", projectId, AuditPlanName).Find(ap).Error
if err == gorm.ErrRecordNotFound {
return ap, false, nil
}
@@ -313,35 +312,35 @@ func (s *Storage) UpdateAuditPlanById(id uint, attrs map[string]interface{}) err
return errors.New(errors.ConnectStorageError, err)
}
-func (s *Storage) GetAuditPlanTotalByProjectName(projectName string) (uint64, error) {
- var count uint64
- err := s.db.
- Table("audit_plans").
- Joins("LEFT JOIN projects ON audit_plans.project_id = projects.id").
- Where("projects.name = ?", projectName).
- Where("audit_plans.deleted_at IS NULL").
- Count(&count).
- Error
- return count, errors.ConnectStorageErrWrapper(err)
-}
-
-func (s *Storage) GetAuditPlanIDsByProjectName(projectName string) ([]uint, error) {
- ids := []struct {
- ID uint `json:"id"`
- }{}
- err := s.db.Table("audit_plans").
- Select("audit_plans.id").
- Joins("LEFT JOIN projects ON projects.id = audit_plans.project_id").
- Where("projects.name = ?", projectName).
- Find(&ids).Error
-
- resp := []uint{}
- for _, id := range ids {
- resp = append(resp, id.ID)
- }
-
- return resp, errors.ConnectStorageErrWrapper(err)
-}
+// func (s *Storage) GetAuditPlanTotalByProjectName(projectName string) (uint64, error) {
+// var count uint64
+// err := s.db.
+// Table("audit_plans").
+// Joins("LEFT JOIN projects ON audit_plans.project_id = projects.id").
+// Where("projects.name = ?", projectName).
+// Where("audit_plans.deleted_at IS NULL").
+// Count(&count).
+// Error
+// return count, errors.ConnectStorageErrWrapper(err)
+// }
+
+// func (s *Storage) GetAuditPlanIDsByProjectName(projectName string) ([]uint, error) {
+// ids := []struct {
+// ID uint `json:"id"`
+// }{}
+// err := s.db.Table("audit_plans").
+// Select("audit_plans.id").
+// Joins("LEFT JOIN projects ON projects.id = audit_plans.project_id").
+// Where("projects.name = ?", projectName).
+// Find(&ids).Error
+
+// resp := []uint{}
+// for _, id := range ids {
+// resp = append(resp, id.ID)
+// }
+
+// return resp, errors.ConnectStorageErrWrapper(err)
+// }
// GetLatestAuditPlanIds 获取所有变更过的记录,包括删除
func (s *Storage) GetLatestAuditPlanRecords(after time.Time) ([]*AuditPlan, error) {
@@ -357,15 +356,14 @@ type RiskAuditPlan struct {
RiskSqlCOUNT uint `json:"risk_sql_count"`
}
-func (s *Storage) GetRiskAuditPlan(projectName string) ([]*RiskAuditPlan, error) {
+func (s *Storage) GetRiskAuditPlan(projectUid string) ([]*RiskAuditPlan, error) {
var RiskAuditPlans []*RiskAuditPlan
err := s.db.Model(AuditPlan{}).
Select(`reports.id report_id, audit_plans.name audit_plan_name, reports.created_at report_create_at,
count(case when JSON_TYPE(report_sqls.audit_results)<>'NULL' then 1 else null end) risk_sql_count`).
Joins("left join audit_plan_reports_v2 reports on audit_plans.id=reports.audit_plan_id").
Joins("left join audit_plan_report_sqls_v2 report_sqls on report_sqls.audit_plan_report_id=reports.id").
- Joins("left join projects on projects.id=audit_plans.project_id").
- Where("reports.score<60 and projects.name=? and audit_plans.deleted_at is NULL", projectName).
+ Where("reports.score<60 and audit_plans.project_id=? and audit_plans.deleted_at is NULL", projectUid).
Group("audit_plans.name, reports.created_at, audit_plans.created_at, reports.id").
Order("reports.created_at desc").Scan(&RiskAuditPlans).Error
@@ -377,13 +375,12 @@ func (s *Storage) GetRiskAuditPlan(projectName string) ([]*RiskAuditPlan, error)
}
// 使用子查询获取最新的report时间,然后再获取最新report的sql数量和触发规则的sql数量
-func (s *Storage) GetAuditPlanSQLCountAndTriggerRuleCountByProject(projectName string) (SqlCountAndTriggerRuleCount, error) {
+func (s *Storage) GetAuditPlanSQLCountAndTriggerRuleCountByProject(projectUid string) (SqlCountAndTriggerRuleCount, error) {
sqlCountAndTriggerRuleCount := SqlCountAndTriggerRuleCount{}
subQuery := s.db.Model(&AuditPlan{}).
Select("audit_plans.id as audit_plan_id, MAX(audit_plan_reports_v2.created_at) as latest_created_at").
Joins("left join audit_plan_reports_v2 on audit_plan_reports_v2.audit_plan_id=audit_plans.id").
- Joins("left join projects on audit_plans.project_id=projects.id").
- Where("projects.name=? and audit_plans.deleted_at is null and audit_plan_reports_v2.id is not null", projectName).
+ Where("audit_plans.project_id=? and audit_plans.deleted_at is null and audit_plan_reports_v2.id is not null", projectUid).
Group("audit_plans.id").
SubQuery()
@@ -391,9 +388,8 @@ func (s *Storage) GetAuditPlanSQLCountAndTriggerRuleCountByProject(projectName s
Select("count(report_sqls.id) sql_count, count(case when JSON_TYPE(report_sqls.audit_results)<>'NULL' then 1 else null end) trigger_rule_count").
Joins("left join audit_plan_reports_v2 reports on reports.audit_plan_id=audit_plans.id").
Joins("left join audit_plan_report_sqls_v2 report_sqls on report_sqls.audit_plan_report_id=reports.id").
- Joins("left join projects on audit_plans.project_id=projects.id").
Joins("join (?) as sq on audit_plans.id=sq.audit_plan_id and reports.created_at=sq.latest_created_at", subQuery).
- Where("projects.name=? and audit_plans.deleted_at is null", projectName).
+ Where("audit_plans.project_id=? and audit_plans.deleted_at is null", projectUid).
Scan(&sqlCountAndTriggerRuleCount).Error
return sqlCountAndTriggerRuleCount, errors.ConnectStorageErrWrapper(err)
@@ -405,12 +401,11 @@ type DBTypeAuditPlanCount struct {
AuditPlanCount uint `json:"audit_plan_count"`
}
-func (s *Storage) GetDBTypeAuditPlanCountByProject(projectName string) ([]*DBTypeAuditPlanCount, error) {
+func (s *Storage) GetDBTypeAuditPlanCountByProject(projectUid string) ([]*DBTypeAuditPlanCount, error) {
dBTypeAuditPlanCounts := []*DBTypeAuditPlanCount{}
err := s.db.Model(AuditPlan{}).
Select("audit_plans.db_type, audit_plans.type, count(1) audit_plan_count").
- Joins("left join projects on audit_plans.project_id=projects.id").
- Where("projects.name=?", projectName).
+ Where("audit_plans.project_id=?", projectUid).
Group("audit_plans.db_type, audit_plans.type").Scan(&dBTypeAuditPlanCounts).Error
return dBTypeAuditPlanCounts, errors.New(errors.ConnectStorageError, err)
}
diff --git a/sqle/model/audit_plan_list.go b/sqle/model/audit_plan_list.go
index 2ecd513f62..d315c9d2d1 100644
--- a/sqle/model/audit_plan_list.go
+++ b/sqle/model/audit_plan_list.go
@@ -37,16 +37,13 @@ SELECT COUNT(*)
var auditPlanBodyTpl = `
{{ define "body" }}
-FROM audit_plans
-LEFT JOIN users ON audit_plans.create_user_id = users.id
-LEFT JOIN projects ON audit_plans.project_id = projects.id
+FROM audit_plans
WHERE audit_plans.deleted_at IS NULL
-AND users.deleted_at IS NULL
{{- if not .current_user_is_admin }}
AND (
-users.login_name = :current_user_name
+audit_plans.create_user_id = :current_user_id
{{- if .accessible_instances_name }}
OR instance_name IN ( {{ .accessible_instances_name }} )
{{- end }}
@@ -69,8 +66,8 @@ AND audit_plans.type = :filter_audit_plan_type
AND audit_plans.instance_name = :filter_audit_plan_instance_name
{{- end }}
-{{- if .filter_project_name }}
-AND projects.name = :filter_project_name
+{{- if .filter_project_id }}
+AND audit_plans.project_id = :filter_project_id
{{- end }}
{{ end }}
diff --git a/sqle/model/audit_plan_list_test.go b/sqle/model/audit_plan_list_test.go
index 782aea4400..68537a53c8 100644
--- a/sqle/model/audit_plan_list_test.go
+++ b/sqle/model/audit_plan_list_test.go
@@ -12,14 +12,11 @@ import (
func TestStorage_GetAuditPlansByReq(t *testing.T) {
// 1. test for common user
tableAndRowOfSQL := `
- FROM audit_plans
- LEFT JOIN users ON audit_plans.create_user_id = users.id
- LEFT JOIN projects ON audit_plans.project_id = projects.id
- WHERE audit_plans.deleted_at IS NULL
- AND users.deleted_at IS NULL
- AND (
- users.login_name = ?
- )
+ FROM
+ audit_plans
+WHERE
+ audit_plans.deleted_at IS NULL
+ AND ( audit_plans.create_user_id = ? )
AND audit_plans.db_type = ?
`
mockDB, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
@@ -33,7 +30,7 @@ func TestStorage_GetAuditPlansByReq(t *testing.T) {
"COUNT(*)",
}).AddRow("2"))
nameFields := map[string]interface{}{
- "current_user_name": 1,
+ "current_user_id": 1,
"filter_audit_plan_db_type": "mysql",
"limit": 100,
"offset": 10}
@@ -47,11 +44,10 @@ func TestStorage_GetAuditPlansByReq(t *testing.T) {
// 2. test for admin user
tableAndRowOfSQL1 := `
- FROM audit_plans
- LEFT JOIN users ON audit_plans.create_user_id = users.id
- LEFT JOIN projects ON audit_plans.project_id = projects.id
- WHERE audit_plans.deleted_at IS NULL
- AND users.deleted_at IS NULL
+ FROM
+ audit_plans
+WHERE
+ audit_plans.deleted_at IS NULL
`
mockDB, mock, err = sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
assert.NoError(t, err)
@@ -66,7 +62,7 @@ func TestStorage_GetAuditPlansByReq(t *testing.T) {
mock.ExpectPrepare(fmt.Sprintf(`SELECT COUNT(*) %v`, tableAndRowOfSQL1)).
ExpectQuery().WillReturnRows(sqlmock.NewRows([]string{"COUNT(*)"}).AddRow("2"))
nameFields = map[string]interface{}{
- "current_user_name": 1,
+ "current_user_id": 1,
"current_user_is_admin": true,
"limit": 100,
"offset": 10}
@@ -120,29 +116,32 @@ func TestStorage_GetAuditPlanSQLsByReq(t *testing.T) {
func TestStorage_GetAuditPlanReportsByReq(t *testing.T) {
tableAndRowOfSQL := `
- FROM audit_plan_reports_v2 AS reports
- JOIN audit_plans ON audit_plans.id = reports.audit_plan_id
- JOIN projects ON projects.id = audit_plans.project_id
- WHERE reports.deleted_at IS NULL
- AND audit_plans.deleted_at IS NULL
- AND audit_plans.name = ?
- AND projects.name = ?
- ORDER BY reports.created_at DESC , reports.id DESC
+ FROM
+ audit_plan_reports_v2 AS reports
+ JOIN audit_plans ON audit_plans.id = reports.audit_plan_id
+WHERE
+ reports.deleted_at IS NULL
+ AND audit_plans.deleted_at IS NULL
+ AND audit_plans.name = ?
+ AND audit_plans.project_id = ?
+ORDER BY
+ reports.created_at DESC ,
+ reports.id DESC
`
mockDB, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
assert.NoError(t, err)
defer mockDB.Close()
InitMockStorage(mockDB)
mock.ExpectPrepare(fmt.Sprintf(`SELECT reports.id, reports.score , reports.pass_rate, reports.audit_level, reports.created_at %v LIMIT ? OFFSET ?`, tableAndRowOfSQL)).
- ExpectQuery().WithArgs("audit_plan_for_jave_repo", "project_1", 100, 10).WillReturnRows(sqlmock.NewRows([]string{
+ ExpectQuery().WithArgs("audit_plan_for_jave_repo", "1", 100, 10).WillReturnRows(sqlmock.NewRows([]string{
"id", "score", "pass_rate", "audit_level", "created_at"}).
AddRow("1", 100, 1, "normal", "2021-09-01T13:46:13+08:00"))
mock.ExpectPrepare(fmt.Sprintf(`SELECT COUNT(*) %v`, tableAndRowOfSQL)).
- ExpectQuery().WithArgs("audit_plan_for_jave_repo", "project_1").WillReturnRows(sqlmock.NewRows([]string{"COUNT(*)"}).AddRow("2"))
+ ExpectQuery().WithArgs("audit_plan_for_jave_repo", "1").WillReturnRows(sqlmock.NewRows([]string{"COUNT(*)"}).AddRow("2"))
nameFields := map[string]interface{}{
"audit_plan_name": "audit_plan_for_jave_repo",
- "project_name": "project_1",
+ "project_id": "1",
"limit": 100,
"offset": 10}
result, count, err := GetStorage().GetAuditPlanReportsByReq(nameFields)
diff --git a/sqle/model/audit_plan_report.go b/sqle/model/audit_plan_report.go
index 8ab009f286..df0208bed0 100644
--- a/sqle/model/audit_plan_report.go
+++ b/sqle/model/audit_plan_report.go
@@ -48,12 +48,11 @@ func (s *Storage) GetAuditPlanReportSQLV2ByReportIDAndNumber(reportId, number ui
return auditPlanReportSQLV2, true, errors.New(errors.ConnectStorageError, err)
}
-func (s *Storage) GetAuditPlanReportByProjectName(projectName string) ([]*AuditPlanReportV2, error) {
+func (s *Storage) GetAuditPlanReportByProjectName(projectUid string) ([]*AuditPlanReportV2, error) {
auditPlanReportV2Slice := []*AuditPlanReportV2{}
err := s.db.Model(&AuditPlanReportV2{}).
Joins("left join audit_plans on audit_plans.id=audit_plan_reports_v2.audit_plan_id").
- Joins("left join projects on projects.id=audit_plans.project_id").
- Where("projects.name=? and audit_plans.deleted_at is NULL", projectName).Find(&auditPlanReportV2Slice).Error
+ Where("audit_plans.project_id=? and audit_plans.deleted_at is NULL", projectUid).Find(&auditPlanReportV2Slice).Error
return auditPlanReportV2Slice, errors.ConnectStorageErrWrapper(err)
}
@@ -64,23 +63,25 @@ type LatestAuditPlanReportScore struct {
}
// 使用子查询获取最新的report的生成时间,再去获取report相关信息
-func (s *Storage) GetLatestAuditPlanReportScoreFromInstanceByProject(projectName string) ([]*LatestAuditPlanReportScore, error) {
+func (s *Storage) GetLatestAuditPlanReportScoreFromInstanceByProject(projectUid string, instanceNames []string) ([]*LatestAuditPlanReportScore, error) {
+ if len(instanceNames) == 0 {
+ return nil, nil
+ }
+
var latestAuditPlanReportScore []*LatestAuditPlanReportScore
subQuery := s.db.Model(&AuditPlanReportV2{}).
Select("audit_plans.db_type, audit_plans.instance_name, MAX(audit_plan_reports_v2.created_at) as latest_created_at").
Joins("left join audit_plans on audit_plan_reports_v2.audit_plan_id=audit_plans.id").
- Joins("left join projects on audit_plans.project_id=projects.id").
- Where("projects.name=?", projectName).
+ Where("audit_plans.project_id=?", projectUid).
+ Where("audit_plans.instance_name in (?)", instanceNames).
Group("audit_plans.db_type, audit_plans.instance_name").
SubQuery()
err := s.db.Model(&AuditPlanReportV2{}).
Select("audit_plans.db_type, audit_plans.instance_name, audit_plan_reports_v2.score").
Joins("left join audit_plans on audit_plan_reports_v2.audit_plan_id=audit_plans.id").
- Joins("left join projects on audit_plans.project_id=projects.id").
- Joins("left join instances on audit_plans.instance_name=instances.name").
Joins("join (?) as sq on audit_plans.db_type=sq.db_type and audit_plans.instance_name=sq.instance_name and audit_plan_reports_v2.created_at=sq.latest_created_at", subQuery).
- Where("projects.name=? and instances.deleted_at is null and audit_plans.deleted_at is null and instances.id is not null", projectName).
+ Where("audit_plans.project_id=? and audit_plans.deleted_at is null", projectUid).
Scan(&latestAuditPlanReportScore).Error
return latestAuditPlanReportScore, errors.ConnectStorageErrWrapper(err)
@@ -88,7 +89,7 @@ func (s *Storage) GetLatestAuditPlanReportScoreFromInstanceByProject(projectName
func (s *Storage) GetReportWithAuditPlanByReportID(reportId int) (auditPlanReportV2 *AuditPlanReportV2, exist bool, err error) {
auditPlanReportV2 = &AuditPlanReportV2{}
- err = s.db.Preload("AuditPlan").Preload("AuditPlan.CreateUser", UnScopedFunc).Preload("AuditPlanReportSQLs").Where("id=?", reportId).Find(auditPlanReportV2).Error
+ err = s.db.Preload("AuditPlan").Preload("AuditPlanReportSQLs").Where("id=?", reportId).Find(auditPlanReportV2).Error
if err == gorm.ErrRecordNotFound {
return auditPlanReportV2, false, nil
}
diff --git a/sqle/model/audit_plan_report_list.go b/sqle/model/audit_plan_report_list.go
index 94a945c8a1..0fce957526 100644
--- a/sqle/model/audit_plan_report_list.go
+++ b/sqle/model/audit_plan_report_list.go
@@ -31,12 +31,11 @@ var auditPlanReportBodyTpl = `
FROM audit_plan_reports_v2 AS reports
JOIN audit_plans ON audit_plans.id = reports.audit_plan_id
-JOIN projects ON projects.id = audit_plans.project_id
WHERE reports.deleted_at IS NULL
AND audit_plans.deleted_at IS NULL
AND audit_plans.name = :audit_plan_name
-AND projects.name = :project_name
+AND audit_plans.project_id = :project_id
ORDER BY reports.created_at DESC , reports.id DESC
diff --git a/sqle/model/audit_plan_test.go b/sqle/model/audit_plan_test.go
index 48e2c37374..a3b37ce51c 100644
--- a/sqle/model/audit_plan_test.go
+++ b/sqle/model/audit_plan_test.go
@@ -56,38 +56,38 @@ func TestStorage_GetAuditPlanByName(t *testing.T) {
assert.NoError(t, err)
}
-func TestStorage_GetAuditPlanFromProjectByName(t *testing.T) {
- // 1. test record exist
- mockDB, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
- assert.NoError(t, err)
- InitMockStorage(mockDB)
- mock.ExpectQuery("SELECT `audit_plans`.* FROM `audit_plans` LEFT JOIN projects ON projects.id = audit_plans.project_id WHERE `audit_plans`.`deleted_at` IS NULL AND ((projects.name = ? AND audit_plans.name = ?))").
- WithArgs("project_1", "audit_plan_for_java_repo1").
- WillReturnRows(sqlmock.NewRows([]string{"name"}).AddRow("audit_plan_1"))
- mock.ExpectClose()
- ap, exist, err := GetStorage().GetAuditPlanFromProjectByName("project_1", "audit_plan_for_java_repo1")
- assert.NoError(t, err)
- assert.True(t, exist)
- assert.Equal(t, "audit_plan_1", ap.Name)
- mockDB.Close()
- err = mock.ExpectationsWereMet()
- assert.NoError(t, err)
-
- // 2. test record not exist
- mockDB, mock, err = sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
- assert.NoError(t, err)
- InitMockStorage(mockDB)
- mock.ExpectQuery("SELECT `audit_plans`.* FROM `audit_plans` LEFT JOIN projects ON projects.id = audit_plans.project_id WHERE `audit_plans`.`deleted_at` IS NULL AND ((projects.name = ? AND audit_plans.name = ?))").
- WithArgs("project_1", "audit_plan_for_java_repo1").
- WillReturnRows(sqlmock.NewRows([]string{"name"}))
- mock.ExpectClose()
- _, exist, err = GetStorage().GetAuditPlanFromProjectByName("project_1", "audit_plan_for_java_repo1")
- assert.NoError(t, err)
- assert.False(t, exist)
- mockDB.Close()
- err = mock.ExpectationsWereMet()
- assert.NoError(t, err)
-}
+// func TestStorage_GetAuditPlanFromProjectByName(t *testing.T) {
+// // 1. test record exist
+// mockDB, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
+// assert.NoError(t, err)
+// InitMockStorage(mockDB)
+// mock.ExpectQuery("SELECT `audit_plans`.* FROM `audit_plans` LEFT JOIN projects ON projects.id = audit_plans.project_id WHERE `audit_plans`.`deleted_at` IS NULL AND ((projects.name = ? AND audit_plans.name = ?))").
+// WithArgs("project_1", "audit_plan_for_java_repo1").
+// WillReturnRows(sqlmock.NewRows([]string{"name"}).AddRow("audit_plan_1"))
+// mock.ExpectClose()
+// ap, exist, err := GetStorage().GetAuditPlanFromProjectByName("project_1", "audit_plan_for_java_repo1")
+// assert.NoError(t, err)
+// assert.True(t, exist)
+// assert.Equal(t, "audit_plan_1", ap.Name)
+// mockDB.Close()
+// err = mock.ExpectationsWereMet()
+// assert.NoError(t, err)
+
+// // 2. test record not exist
+// mockDB, mock, err = sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
+// assert.NoError(t, err)
+// InitMockStorage(mockDB)
+// mock.ExpectQuery("SELECT `audit_plans`.* FROM `audit_plans` LEFT JOIN projects ON projects.id = audit_plans.project_id WHERE `audit_plans`.`deleted_at` IS NULL AND ((projects.name = ? AND audit_plans.name = ?))").
+// WithArgs("project_1", "audit_plan_for_java_repo1").
+// WillReturnRows(sqlmock.NewRows([]string{"name"}))
+// mock.ExpectClose()
+// _, exist, err = GetStorage().GetAuditPlanFromProjectByName("project_1", "audit_plan_for_java_repo1")
+// assert.NoError(t, err)
+// assert.False(t, exist)
+// mockDB.Close()
+// err = mock.ExpectationsWereMet()
+// assert.NoError(t, err)
+// }
func TestStorage_GetAuditPlanSQLs(t *testing.T) {
mockDB, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
diff --git a/sqle/model/cloud_beaver.go b/sqle/model/cloud_beaver.go
index 4f09e53c63..4ad32d7dc4 100644
--- a/sqle/model/cloud_beaver.go
+++ b/sqle/model/cloud_beaver.go
@@ -1,68 +1,68 @@
package model
-import (
- "fmt"
+// import (
+// "fmt"
- "github.com/actiontech/sqle/sqle/errors"
+// "github.com/actiontech/sqle/sqle/errors"
- "github.com/jinzhu/gorm"
-)
+// "github.com/jinzhu/gorm"
+// )
-type CloudBeaverUserCache struct {
- SQLEUserID uint `json:"sqle_user_id" gorm:"column:sqle_user_id;primary_key"`
- CloudBeaverUserID string `json:"cloud_beaver_user_id" gorm:"column:cloud_beaver_user_id"`
- SQLEFingerprint string `json:"sqle_fingerprint" gorm:"column:sqle_fingerprint"`
-}
+// type CloudBeaverUserCache struct {
+// SQLEUserID uint `json:"sqle_user_id" gorm:"column:sqle_user_id;primary_key"`
+// CloudBeaverUserID string `json:"cloud_beaver_user_id" gorm:"column:cloud_beaver_user_id"`
+// SQLEFingerprint string `json:"sqle_fingerprint" gorm:"column:sqle_fingerprint"`
+// }
-func (s *Storage) GetCloudBeaverUserCacheByCBUserID(id string) (*CloudBeaverUserCache, bool, error) {
- c := &CloudBeaverUserCache{}
- err := s.db.Where("cloud_beaver_user_id = ?", id).Find(c).Error
- if err == gorm.ErrRecordNotFound {
- return c, false, nil
- }
+// func (s *Storage) GetCloudBeaverUserCacheByCBUserID(id string) (*CloudBeaverUserCache, bool, error) {
+// c := &CloudBeaverUserCache{}
+// err := s.db.Where("cloud_beaver_user_id = ?", id).Find(c).Error
+// if err == gorm.ErrRecordNotFound {
+// return c, false, nil
+// }
- return c, true, errors.New(errors.ConnectStorageError, err)
-}
+// return c, true, errors.New(errors.ConnectStorageError, err)
+// }
-func (s *Storage) UpdateCloudBeaverUserCache(sqleUserID uint, CloudBeaverUserID string) error {
- user, exist, err := s.GetUserByID(sqleUserID)
- if err != nil {
- return err
- }
- if !exist {
- return errors.New(errors.ConnectStorageError, fmt.Errorf("sqle user not exist"))
- }
+// func (s *Storage) UpdateCloudBeaverUserCache(sqleUserID uint, CloudBeaverUserID string) error {
+// user, exist, err := s.GetUserByID(sqleUserID)
+// if err != nil {
+// return err
+// }
+// if !exist {
+// return errors.New(errors.ConnectStorageError, fmt.Errorf("sqle user not exist"))
+// }
- err = s.db.Table("cloud_beaver_user_caches").Save(&CloudBeaverUserCache{
- SQLEUserID: sqleUserID,
- CloudBeaverUserID: CloudBeaverUserID,
- SQLEFingerprint: user.FingerPrint(),
- }).Error
- return errors.New(errors.ConnectStorageError, err)
-}
+// err = s.db.Table("cloud_beaver_user_caches").Save(&CloudBeaverUserCache{
+// SQLEUserID: sqleUserID,
+// CloudBeaverUserID: CloudBeaverUserID,
+// SQLEFingerprint: user.FingerPrint(),
+// }).Error
+// return errors.New(errors.ConnectStorageError, err)
+// }
-type CloudBeaverInstanceCache struct {
- CloudBeaverInstanceID string `json:"cloud_beaver_instance_id"`
- SQLEInstanceID uint `json:"sqle_instance_id" gorm:"primary_key"`
- SQLEInstanceFingerprint string `json:"sqle_instance_fingerprint"`
-}
+// type CloudBeaverInstanceCache struct {
+// CloudBeaverInstanceID string `json:"cloud_beaver_instance_id"`
+// SQLEInstanceID uint `json:"sqle_instance_id" gorm:"primary_key"`
+// SQLEInstanceFingerprint string `json:"sqle_instance_fingerprint"`
+// }
-func (s *Storage) GetCloudBeaverInstanceCacheBySQLEInstIDs(ids []uint) ([]*CloudBeaverInstanceCache, error) {
- c := []*CloudBeaverInstanceCache{}
- err := s.db.Where("sqle_instance_id in (?)", ids).Find(&c).Error
- if err == gorm.ErrRecordNotFound {
- return c, nil
- }
+// func (s *Storage) GetCloudBeaverInstanceCacheBySQLEInstIDs(ids []uint) ([]*CloudBeaverInstanceCache, error) {
+// c := []*CloudBeaverInstanceCache{}
+// err := s.db.Where("sqle_instance_id in (?)", ids).Find(&c).Error
+// if err == gorm.ErrRecordNotFound {
+// return c, nil
+// }
- return c, errors.New(errors.ConnectStorageError, err)
-}
+// return c, errors.New(errors.ConnectStorageError, err)
+// }
-func (s *Storage) GetCloudBeaverInstanceCacheByCBInstIDs(ids []string) ([]*CloudBeaverInstanceCache, error) {
- c := []*CloudBeaverInstanceCache{}
- err := s.db.Where("cloud_beaver_instance_id in (?)", ids).Find(&c).Error
- if err == gorm.ErrRecordNotFound {
- return c, nil
- }
+// func (s *Storage) GetCloudBeaverInstanceCacheByCBInstIDs(ids []string) ([]*CloudBeaverInstanceCache, error) {
+// c := []*CloudBeaverInstanceCache{}
+// err := s.db.Where("cloud_beaver_instance_id in (?)", ids).Find(&c).Error
+// if err == gorm.ErrRecordNotFound {
+// return c, nil
+// }
- return c, errors.New(errors.ConnectStorageError, err)
-}
+// return c, errors.New(errors.ConnectStorageError, err)
+// }
diff --git a/sqle/model/configuration.go b/sqle/model/configuration.go
index 2cbf603efd..1551278de9 100644
--- a/sqle/model/configuration.go
+++ b/sqle/model/configuration.go
@@ -1,310 +1,18 @@
package model
import (
- "database/sql"
- e "errors"
"fmt"
"strconv"
- "strings"
+ e "errors"
+
+ dmsCommonAes "github.com/actiontech/dms/pkg/dms-common/pkg/aes"
"github.com/actiontech/sqle/sqle/errors"
"github.com/actiontech/sqle/sqle/log"
- "github.com/actiontech/sqle/sqle/notification/webhook"
- "github.com/actiontech/sqle/sqle/utils"
-
"github.com/jinzhu/gorm"
)
const globalConfigurationTablePrefix = "global_configuration"
-
-// SMTPConfiguration store SMTP server configuration.
-type SMTPConfiguration struct {
- Model
- EnableSMTPNotify sql.NullBool `json:"enable_smtp_notify" gorm:"default:true"`
- Host string `json:"smtp_host" gorm:"column:smtp_host; not null"`
- Port string `json:"smtp_port" gorm:"column:smtp_port; not null"`
- Username string `json:"smtp_username" gorm:"column:smtp_username; not null"`
- Password string `json:"-" gorm:"-"`
- SecretPassword string `json:"secret_smtp_password" gorm:"column:secret_smtp_password; not null"`
- IsSkipVerify bool `json:"is_skip_verify" gorm:"default:false; not null"`
-}
-
-func (i *SMTPConfiguration) TableName() string {
- return fmt.Sprintf("%v_smtp", globalConfigurationTablePrefix)
-}
-
-// BeforeSave is a hook implement gorm model before exec create.
-func (i *SMTPConfiguration) BeforeSave() error {
- return i.encryptPassword()
-}
-
-func (i *SMTPConfiguration) encryptPassword() error {
- if i == nil {
- return nil
- }
- data, err := utils.AesEncrypt(i.Password)
- if err != nil {
- return err
- }
- i.SecretPassword = data
- return nil
-}
-
-// AfterFind is a hook implement gorm model after query, ignore err if query from db.
-func (i *SMTPConfiguration) AfterFind() error {
- err := i.decryptPassword()
- if err != nil {
- log.NewEntry().Errorf("decrypt password for SMTP server configuration failed, error: %v", err)
- }
- return nil
-}
-
-func (i *SMTPConfiguration) decryptPassword() error {
- if i == nil {
- return nil
- }
- if i.Password == "" {
- data, err := utils.AesDecrypt(i.SecretPassword)
- if err != nil {
- return err
- }
- i.Password = data
- }
- return nil
-}
-
-func (s *Storage) GetSMTPConfiguration() (*SMTPConfiguration, bool, error) {
- smtpC := new(SMTPConfiguration)
- err := s.db.Last(smtpC).Error
- if err == gorm.ErrRecordNotFound {
- return smtpC, false, nil
- }
- return smtpC, true, errors.New(errors.ConnectStorageError, err)
-}
-
-// WeChatConfiguration store WeChat configuration.
-type WeChatConfiguration struct {
- Model
- EnableWeChatNotify bool `json:"enable_wechat_notify" gorm:"not null"`
- CorpID string `json:"corp_id" gorm:"not null"`
- CorpSecret string `json:"-" gorm:"-"`
- EncryptedCorpSecret string `json:"encrypted_corp_secret" gorm:"not null"`
- AgentID int `json:"agent_id" gorm:"not null"`
- SafeEnabled bool `json:"safe_enabled" gorm:"not null"`
- ProxyIP string `json:"proxy_ip"`
-}
-
-func (i *WeChatConfiguration) TableName() string {
- return fmt.Sprintf("%v_wechat", globalConfigurationTablePrefix)
-}
-
-// BeforeSave is a hook implement gorm model before exec create.
-func (i *WeChatConfiguration) BeforeSave() error {
- return i.encryptPassword()
-}
-
-func (i *WeChatConfiguration) encryptPassword() error {
- if i == nil {
- return nil
- }
- data, err := utils.AesEncrypt(i.CorpSecret)
- if err != nil {
- return err
- }
- i.EncryptedCorpSecret = data
- return nil
-}
-
-// AfterFind is a hook implement gorm model after query, ignore err if query from db.
-func (i *WeChatConfiguration) AfterFind() error {
- err := i.decryptPassword()
- if err != nil {
- log.NewEntry().Errorf("decrypt password for WeChat server configuration failed, error: %v", err)
- }
- return nil
-}
-
-func (i *WeChatConfiguration) decryptPassword() error {
- if i == nil {
- return nil
- }
- if i.CorpSecret == "" {
- data, err := utils.AesDecrypt(i.EncryptedCorpSecret)
- if err != nil {
- return err
- }
- i.CorpSecret = data
- }
- return nil
-}
-
-func (s *Storage) GetWeChatConfiguration() (*WeChatConfiguration, bool, error) {
- wechatC := new(WeChatConfiguration)
- err := s.db.Last(wechatC).Error
- if err == gorm.ErrRecordNotFound {
- return wechatC, false, nil
- }
- return wechatC, true, errors.New(errors.ConnectStorageError, err)
-}
-
-// LDAPConfiguration store ldap server configuration.
-type LDAPConfiguration struct {
- Model
- // whether the ldap is enabled
- Enable bool `json:"enable" gorm:"not null"`
- // whether the ssl is enabled
- EnableSSL bool `json:"enable_ssl" gorm:"not null"`
- // ldap server's ip
- Host string `json:"host" gorm:"not null"`
- // ldap server's port
- Port string `json:"port" gorm:"not null"`
- // the DN of the ldap administrative user for verification
- ConnectDn string `json:"connect_dn" gorm:"not null"`
- // the password of the ldap administrative user for verification
- ConnectPassword string `json:"-" gorm:"-"`
- // the secret password of the ldap administrative user for verification
- ConnectSecretPassword string `json:"connect_secret_password" gorm:"not null"`
- // base dn used for ldap verification
- BaseDn string `json:"base_dn" gorm:"not null"`
- // the key corresponding to the user name in ldap
- UserNameRdnKey string `json:"ldap_user_name_rdn_key" gorm:"not null"`
- // the key corresponding to the user email in ldap
- UserEmailRdnKey string `json:"ldap_user_email_rdn_key" gorm:"not null"`
-}
-
-func (i *LDAPConfiguration) TableName() string {
- return fmt.Sprintf("%v_ldap", globalConfigurationTablePrefix)
-}
-
-// BeforeSave is a hook implement gorm model before exec create
-func (i *LDAPConfiguration) BeforeSave() error {
- return i.encryptPassword()
-}
-
-// AfterFind is a hook implement gorm model after query, ignore err if query from db
-func (i *LDAPConfiguration) AfterFind() error {
- err := i.decryptPassword()
- if err != nil {
- log.NewEntry().Errorf("decrypt password for ldap administrative user failed, error: %v", err)
- }
- return nil
-}
-
-func (i *LDAPConfiguration) decryptPassword() error {
- if i == nil {
- return nil
- }
- if i.ConnectPassword == "" {
- data, err := utils.AesDecrypt(i.ConnectSecretPassword)
- if err != nil {
- return err
- } else {
- i.ConnectPassword = data
- }
- }
- return nil
-}
-
-func (i *LDAPConfiguration) encryptPassword() error {
- if i == nil {
- return nil
- }
- data, err := utils.AesEncrypt(i.ConnectPassword)
- if err != nil {
- return err
- }
- i.ConnectSecretPassword = data
- return nil
-}
-
-func (s *Storage) GetLDAPConfiguration() (*LDAPConfiguration, bool, error) {
- ldapC := new(LDAPConfiguration)
- err := s.db.Last(ldapC).Error
- if err == gorm.ErrRecordNotFound {
- return ldapC, false, nil
- }
- return ldapC, true, errors.New(errors.ConnectStorageError, err)
-}
-
-// Oauth2Configuration store ldap server configuration.
-type Oauth2Configuration struct {
- Model
- EnableOauth2 bool `json:"enable_oauth2" gorm:"column:enable_oauth2"`
- ClientID string `json:"client_id" gorm:"column:client_id"`
- ClientKey string `json:"-" gorm:"-"`
- ClientSecret string `json:"client_secret" gorm:"client_secret"`
- ClientHost string `json:"client_host" gorm:"column:client_host"`
- ServerAuthUrl string `json:"server_auth_url" gorm:"column:server_auth_url"`
- ServerTokenUrl string `json:"server_token_url" gorm:"column:server_token_url"`
- ServerUserIdUrl string `json:"server_user_id_url" gorm:"column:server_user_id_url"`
- Scopes string `json:"scopes" gorm:"column:scopes"`
- AccessTokenTag string `json:"access_token_tag" gorm:"column:access_token_tag"`
- UserIdTag string `json:"user_id_tag" gorm:"column:user_id_tag"`
- LoginTip string `json:"login_tip" gorm:"column:login_tip; default:'使用第三方账户登录'"`
-}
-
-func (i *Oauth2Configuration) GetScopes() []string {
- return strings.Split(i.Scopes, ",")
-}
-
-func (i *Oauth2Configuration) SetScopes(s []string) {
- i.Scopes = strings.Join(s, ",")
-}
-
-func (i *Oauth2Configuration) TableName() string {
- return fmt.Sprintf("%v_oauth2", globalConfigurationTablePrefix)
-}
-
-// BeforeSave is a hook implement gorm model before exec create
-func (i *Oauth2Configuration) BeforeSave() error {
- return i.encryptPassword()
-}
-
-// AfterFind is a hook implement gorm model after query, ignore err if query from db
-func (i *Oauth2Configuration) AfterFind() error {
- err := i.decryptPassword()
- if err != nil {
- log.NewEntry().Errorf("decrypt password for ldap administrative user failed, error: %v", err)
- }
- return nil
-}
-
-func (i *Oauth2Configuration) decryptPassword() error {
- if i == nil {
- return nil
- }
- if i.ClientKey == "" {
- data, err := utils.AesDecrypt(i.ClientSecret)
- if err != nil {
- return err
- } else {
- i.ClientKey = data
- }
- }
- return nil
-}
-
-func (i *Oauth2Configuration) encryptPassword() error {
- if i == nil {
- return nil
- }
- data, err := utils.AesEncrypt(i.ClientKey)
- if err != nil {
- return err
- }
- i.ClientSecret = data
- return nil
-}
-
-func (s *Storage) GetOauth2Configuration() (*Oauth2Configuration, bool, error) {
- oauth2C := new(Oauth2Configuration)
- err := s.db.Last(oauth2C).Error
- if err == gorm.ErrRecordNotFound {
- return oauth2C, false, nil
- }
- return oauth2C, true, errors.New(errors.ConnectStorageError, err)
-}
-
const (
SystemVariableWorkflowExpiredHours = "system_variable_workflow_expired_hours"
SystemVariableSqleUrl = "system_variable_sqle_url"
@@ -418,7 +126,7 @@ func (i *IM) encryptAppSecret() error {
if i == nil {
return nil
}
- data, err := utils.AesEncrypt(i.AppSecret)
+ data, err := dmsCommonAes.AesEncrypt(i.AppSecret)
if err != nil {
return err
}
@@ -440,7 +148,7 @@ func (i *IM) decryptAppSecret() error {
return nil
}
if i.AppSecret == "" {
- data, err := utils.AesDecrypt(i.EncryptAppSecret)
+ data, err := dmsCommonAes.AesDecrypt(i.EncryptAppSecret)
if err != nil {
return err
}
@@ -485,13 +193,13 @@ const (
type DingTalkInstance struct {
Model
ApproveInstanceCode string `json:"approve_instance" gorm:"column:approve_instance"`
- WorkflowId uint `json:"workflow_id" gorm:"column:workflow_id"`
+ WorkflowId string `json:"workflow_id" gorm:"column:workflow_id"`
// 审批实例 taskID
TaskID int64 `json:"task_id" gorm:"column:task_id"`
Status string `json:"status" gorm:"default:\"initialized\""`
}
-func (s *Storage) GetDingTalkInstanceByWorkflowID(workflowId uint) (*DingTalkInstance, bool, error) {
+func (s *Storage) GetDingTalkInstanceByWorkflowID(workflowId string) (*DingTalkInstance, bool, error) {
dti := new(DingTalkInstance)
err := s.db.Where("workflow_id = ?", workflowId).Last(&dti).Error
if err == gorm.ErrRecordNotFound {
@@ -500,7 +208,7 @@ func (s *Storage) GetDingTalkInstanceByWorkflowID(workflowId uint) (*DingTalkIns
return dti, true, errors.New(errors.ConnectStorageError, err)
}
-func (s *Storage) GetDingTalkInstanceListByWorkflowIDs(workflowIds []uint) ([]DingTalkInstance, error) {
+func (s *Storage) GetDingTalkInstanceListByWorkflowIDs(workflowIds []string) ([]DingTalkInstance, error) {
var dingTalkInstances []DingTalkInstance
err := s.db.Model(&DingTalkInstance{}).Where("workflow_id IN (?)", workflowIds).Find(&dingTalkInstances).Error
if err != nil {
@@ -510,7 +218,7 @@ func (s *Storage) GetDingTalkInstanceListByWorkflowIDs(workflowIds []uint) ([]Di
}
// batch updates ding_talk_instances'status into input status by workflow_ids, the status should be like ApproveStatusXXX in model package.
-func (s *Storage) BatchUpdateStatusOfDingTalkInstance(workflowIds []uint, status string) error {
+func (s *Storage) BatchUpdateStatusOfDingTalkInstance(workflowIds []string, status string) error {
err := s.db.Model(&DingTalkInstance{}).Where("workflow_id IN (?)", workflowIds).Updates(map[string]interface{}{"status": status}).Error
if err != nil {
return err
@@ -536,13 +244,13 @@ const (
type FeishuInstance struct {
Model
ApproveInstanceCode string `json:"approve_instance" gorm:"column:approve_instance"`
- WorkflowId uint `json:"workflow_id" gorm:"column:workflow_id"`
+ WorkflowId string `json:"workflow_id" gorm:"column:workflow_id"`
// 审批实例 taskID
TaskID string `json:"task_id" gorm:"column:task_id"`
Status string `json:"status" gorm:"default:\"INITIALIZED\""`
}
-func (s *Storage) GetFeishuInstanceListByWorkflowIDs(workflowIds []uint) ([]FeishuInstance, error) {
+func (s *Storage) GetFeishuInstanceListByWorkflowIDs(workflowIds []string) ([]FeishuInstance, error) {
var feishuInstList []FeishuInstance
err := s.db.Model(&FeishuInstance{}).Where("workflow_id IN (?)", workflowIds).Find(&feishuInstList).Error
if err != nil {
@@ -551,7 +259,7 @@ func (s *Storage) GetFeishuInstanceListByWorkflowIDs(workflowIds []uint) ([]Feis
return feishuInstList, nil
}
-func (s *Storage) BatchUpdateStatusOfFeishuInstance(workflowIds []uint, status string) error {
+func (s *Storage) BatchUpdateStatusOfFeishuInstance(workflowIds []string, status string) error {
err := s.db.Model(&FeishuInstance{}).Where("workflow_id IN (?)", workflowIds).Updates(map[string]interface{}{"status": status}).Error
if err != nil {
return err
@@ -559,7 +267,7 @@ func (s *Storage) BatchUpdateStatusOfFeishuInstance(workflowIds []uint, status s
return nil
}
-func (s *Storage) GetFeishuInstanceByWorkflowID(workflowId uint) (*FeishuInstance, bool, error) {
+func (s *Storage) GetFeishuInstanceByWorkflowID(workflowId string) (*FeishuInstance, bool, error) {
fi := new(FeishuInstance)
err := s.db.Where("workflow_id = ?", workflowId).Last(&fi).Error
if e.Is(err, gorm.ErrRecordNotFound) {
@@ -576,91 +284,3 @@ func (s *Storage) GetFeishuInstByStatus(status string) ([]FeishuInstance, error)
}
return feishuInst, nil
}
-
-type PersonaliseConfig struct {
- Model
- Title string `json:"title" gorm:"column:title"`
-}
-
-func (i *PersonaliseConfig) TableName() string {
- return fmt.Sprintf("%v_personalise", globalConfigurationTablePrefix)
-}
-
-type LogoConfig struct {
- Model
- Logo []byte `json:"logo" gorm:"type:mediumblob"`
-}
-
-func (i *LogoConfig) TableName() string {
- return fmt.Sprintf("%v_logo", globalConfigurationTablePrefix)
-}
-
-type WebHookConfig struct {
- Model
- Enable bool `json:"enable" gorm:"default:true;not null"`
- MaxRetryTimes int `json:"max_retry_times" gorm:"not null"`
- RetryIntervalSeconds int `json:"retry_interval_seconds" gorm:"not null"`
- Token string `json:"-" gorm:"-"`
- EncryptedToken string `json:"encrypted_token" gorm:"not null"`
- URL string `json:"url" gorm:"not null"`
-}
-
-func (i *WebHookConfig) TableName() string {
- return fmt.Sprintf("%v_webhook", globalConfigurationTablePrefix)
-}
-
-func (i *WebHookConfig) BeforeSave() error {
- return i.encryptPassword()
-}
-
-func (i *WebHookConfig) AfterSave() error {
- webhook.UpdateWorkflowConfig(i.Enable, i.MaxRetryTimes,
- i.RetryIntervalSeconds, i.URL, i.Token)
- return nil
-}
-
-func (i *WebHookConfig) AfterFind() error {
- err := i.decryptPassword()
- if err != nil {
- log.NewEntry().Errorf("decrypt app secret for web configuration failed, error: %v", err)
- }
- return nil
-}
-
-func (i *WebHookConfig) encryptPassword() error {
- if i == nil {
- return nil
- }
- if i.Token == "" {
- i.EncryptedToken = ""
- return nil
- }
- data, err := utils.AesEncrypt(i.Token)
- if err != nil {
- return err
- }
- i.EncryptedToken = data
- return nil
-}
-
-func (i *WebHookConfig) decryptPassword() error {
- if i == nil || len(i.EncryptedToken) == 0 {
- return nil
- }
- data, err := utils.AesDecrypt(i.EncryptedToken)
- if err != nil {
- return err
- }
- i.Token = data
- return nil
-}
-
-func (s *Storage) GetWorkflowWebHookConfig() (*WebHookConfig, bool, error) {
- cfg := &WebHookConfig{}
- err := s.db.Last(&cfg).Error
-
- if err == gorm.ErrRecordNotFound {
- return cfg, false, nil
- }
- return cfg, true, errors.ConnectStorageErrWrapper(err)
-}
diff --git a/sqle/model/instance.go b/sqle/model/instance.go
index 91c79cc09f..06edf54d90 100644
--- a/sqle/model/instance.go
+++ b/sqle/model/instance.go
@@ -2,14 +2,11 @@ package model
import (
"fmt"
- "strings"
+ dmsCommonAes "github.com/actiontech/dms/pkg/dms-common/pkg/aes"
"github.com/actiontech/sqle/sqle/errors"
"github.com/actiontech/sqle/sqle/log"
"github.com/actiontech/sqle/sqle/pkg/params"
- "github.com/actiontech/sqle/sqle/utils"
-
- "github.com/jinzhu/gorm"
)
const InstanceSourceSQLE string = "SQLE"
@@ -18,8 +15,10 @@ const InstanceSourceSQLE string = "SQLE"
// NOTE: related model:
// - ProjectMemberRole, ProjectMemberGroupRole
type Instance struct {
- Model
- ProjectId uint `gorm:"index; not null"`
+ ID uint64 `json:"id"`
+ RuleTemplateId uint64 `json:"rule_template_id"`
+ RuleTemplateName string `json:"rule_template_name"`
+ ProjectId string `gorm:"index; not null"`
// has created composite index: [id, name] by gorm#AddIndex
Name string `json:"name" gorm:"not null;index" example:""`
DbType string `json:"db_type" gorm:"column:db_type; not null" example:"mysql"`
@@ -41,6 +40,10 @@ type Instance struct {
WorkflowTemplate *WorkflowTemplate `gorm:"foreignkey:WorkflowTemplateId"`
}
+func (i *Instance) GetIDStr() string {
+ return fmt.Sprintf("%d", i.ID)
+}
+
// BeforeSave is a hook implement gorm model before exec create
func (i *Instance) BeforeSave() error {
return i.encryptPassword()
@@ -60,7 +63,7 @@ func (i *Instance) decryptPassword() error {
return nil
}
if i.Password == "" {
- data, err := utils.AesDecrypt(i.SecretPassword)
+ data, err := dmsCommonAes.AesDecrypt(i.SecretPassword)
if err != nil {
return err
} else {
@@ -75,7 +78,7 @@ func (i *Instance) encryptPassword() error {
return nil
}
if i.SecretPassword == "" {
- data, err := utils.AesEncrypt(i.Password)
+ data, err := dmsCommonAes.AesEncrypt(i.Password)
if err != nil {
return err
}
@@ -91,218 +94,93 @@ func (i *Instance) Fingerprint() string {
"host":"%v",
"port":"%v",
"user":"%v",
- "secret_password":"%v",
+ "password":"%v",
"additional_params":"%v"
}
-`, i.ID, i.Host, i.Port, i.User, i.SecretPassword, i.AdditionalParams)
-}
-
-func (s *Storage) GetInstanceById(id string) (*Instance, bool, error) {
- instance := &Instance{}
- err := s.db.Preload("RuleTemplates").Where("id = ?", id).First(instance).Error
- if err == gorm.ErrRecordNotFound {
- return instance, false, nil
- }
- return instance, true, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetInstancesFromActiveProjectByIds(ids []uint) ([]*Instance, error) {
- instances := []*Instance{}
- err := s.db.Joins("LEFT JOIN projects ON projects.id = instances.project_id").
- Where("instances.id IN (?)", ids).
- Where("projects.status = ?", ProjectStatusActive).
- Find(&instances).Error
- return instances, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetInstancesByIds(ids []uint) (instances []*Instance, err error) {
- distinctIds := utils.RemoveDuplicateUint(ids)
- return instances, s.db.Model(&Instance{}).Where("id in (?)", distinctIds).Scan(&instances).Error
-}
-
-func (s *Storage) GetAllInstance() ([]*Instance, error) {
- i := []*Instance{}
- err := s.db.Preload("RuleTemplates").Find(&i).Error
- return i, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetInstanceByNameAndProjectName(instName, projectName string) (*Instance, bool, error) {
- instance := &Instance{}
- err := s.db.Joins("JOIN projects on projects.id = instances.project_id").Where("projects.name = ?", projectName).Where("instances.name = ?", instName).First(instance).Error
- if err == gorm.ErrRecordNotFound {
- return instance, false, nil
- }
- return instance, true, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetInstanceByNameAndProjectID(instName string, projectID uint) (*Instance, bool, error) {
- instance := &Instance{}
- err := s.db.Where("instances.project_id = ?", projectID).Where("instances.name = ?", instName).First(instance).Error
- if err == gorm.ErrRecordNotFound {
- return instance, false, nil
- }
- return instance, true, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetInstancesBySyncTaskId(projectID, syncTaskID uint) ([]*Instance, error) {
- instances := []*Instance{}
- if err := s.db.Where("project_id = ? and sync_instance_task_id = ?", projectID, syncTaskID).Find(&instances).Error; err != nil {
- return nil, errors.ConnectStorageErrWrapper(err)
- }
- return instances, nil
-}
-
-func (s *Storage) DeleteInstance(instance *Instance) error {
- err := s.DeleteRoleByInstanceID(instance.ID)
- if err != nil {
- return errors.ConnectStorageErrWrapper(err)
- }
- err = s.Delete(instance)
- if err != nil {
- return errors.ConnectStorageErrWrapper(err)
- }
- return nil
-}
-
-func (s *Storage) GetInstanceDetailByNameAndProjectName(instName string, projectName string) (*Instance, bool, error) {
- instance := &Instance{}
- err := s.db.Preload("WorkflowTemplate").Preload("RuleTemplates").
- Joins("JOIN projects on projects.id = instances.project_id").
- Where("instances.name = ?", instName).Where("projects.name = ?", projectName).First(instance).Error
- if err == gorm.ErrRecordNotFound {
- return instance, false, nil
- }
- return instance, true, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetInstancesByType(dbType string) ([]*Instance, error) {
- instances := []*Instance{}
- err := s.db.Where("db_type = ?", dbType).Find(&instances).Error
- return instances, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetInstancesByNamesAndProjectName(instNames []string, projectName string) ([]*Instance, error) {
- instances := []*Instance{}
- err := s.db.Joins("JOIN projects on projects.id = instances.project_id").
- Where("projects.name = ?", projectName).
- Where("instances.name in (?)", instNames).
- Find(&instances).Error
- return instances, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) UpdateInstanceById(InstanceId uint, attrs ...interface{}) error {
- err := s.db.Table("instances").Where("id = ?", InstanceId).Update(attrs...).Error
- return errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) UpdateInstanceRuleTemplates(instance *Instance, ts ...*RuleTemplate) error {
- err := s.db.Model(instance).Association("RuleTemplates").Replace(ts).Error
- return errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) UpdateInstanceRoles(instance *Instance, rs ...*Role) error {
- err := s.db.Model(instance).Association("Roles").Replace(rs).Error
- return errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetAndCheckInstanceExist(instanceNames []string, projectName string) (instances []*Instance, err error) {
- instances, err = s.GetInstancesByNamesAndProjectName(instanceNames, projectName)
- if err != nil {
- return instances, err
- }
- existInstanceNames := map[string]struct{}{}
- for _, instance := range instances {
- existInstanceNames[instance.Name] = struct{}{}
- }
- notExistInstanceNames := []string{}
- for _, instanceName := range instanceNames {
- if _, ok := existInstanceNames[instanceName]; !ok {
- notExistInstanceNames = append(notExistInstanceNames, instanceName)
- }
- }
- if len(notExistInstanceNames) > 0 {
- return instances, errors.New(errors.DataNotExist,
- fmt.Errorf("instance %s not exist", strings.Join(notExistInstanceNames, ", ")))
- }
- return instances, nil
-}
-
-func (s *Storage) GetInstanceNamesByWorkflowTemplateId(id uint) ([]string, error) {
- var instances []*Instance
- err := s.db.Select("name").Where("workflow_template_id = ?", id).Find(&instances).Error
- if err != nil {
- return []string{}, errors.New(errors.ConnectStorageError, err)
- }
- names := make([]string, 0, len(instances))
- for _, instance := range instances {
- names = append(names, instance.Name)
- }
- return names, nil
-}
-
-func getDeduplicatedInstanceIds(instances []*Instance) []uint {
- instanceIds := make([]uint, len(instances))
- for i, inst := range instances {
- instanceIds[i] = inst.ID
- }
- instanceIds = utils.RemoveDuplicateUint(instanceIds)
- return instanceIds
-}
-
-func (s *Storage) GetInstanceTipsByTypeAndTempID(dbType string, tempID uint32, projectName string) (instances []*Instance, err error) {
- query := s.db.Model(&Instance{}).Select("instances.name, instances.db_type, instances.db_host, instances.db_port, instances.workflow_template_id").Group("instances.id")
-
- if dbType != "" {
- query = query.Where("db_type = ?", dbType)
- }
-
- if tempID != 0 {
- query = query.Where("workflow_template_id = ?", tempID)
- }
-
- if projectName != "" {
- query = query.Joins("LEFT JOIN projects ON projects.id = instances.project_id").Where("projects.name = ?", projectName)
- }
-
- return instances, query.Scan(&instances).Error
-}
-
-func (s *Storage) GetAllInstanceCountByType(dbTypes ...string) (int64, error) {
- var count int64
- return count, s.db.Model(&Instance{}).Where("db_type in (?)", dbTypes).Count(&count).Error
-}
+`, i.ID, i.Host, i.Port, i.User, i.Password, i.AdditionalParams)
+}
+
+// func (s *Storage) GetInstancesFromActiveProjectByIds(ids []uint) ([]*Instance, error) {
+// instances := []*Instance{}
+// err := s.db.Joins("LEFT JOIN projects ON projects.id = instances.project_id").
+// Where("instances.id IN (?)", ids).
+// Where("projects.status = ?", ProjectStatusActive).
+// Find(&instances).Error
+// return instances, errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) GetAllInstance() ([]*Instance, error) {
+// i := []*Instance{}
+// err := s.db.Preload("RuleTemplates").Find(&i).Error
+// return i, errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) GetInstanceByNameAndProjectName(instName, projectName string) (*Instance, bool, error) {
+// instance := &Instance{}
+// err := s.db.Joins("JOIN projects on projects.id = instances.project_id").Where("projects.name = ?", projectName).Where("instances.name = ?", instName).First(instance).Error
+// if err == gorm.ErrRecordNotFound {
+// return instance, false, nil
+// }
+// return instance, true, errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) GetInstances(instIds []string) ([]*Instance, bool, error) {
+// instances := []*Instance{}
+// err := s.db.Where("instances.id in (?)", instIds).Find(&instances).Error
+// if err == gorm.ErrRecordNotFound {
+// return instances, false, nil
+// }
+// return instances, true, errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) DeleteInstance(instance *Instance) error {
+// err := s.DeleteRoleByInstanceID(instance.ID)
+// if err != nil {
+// return errors.ConnectStorageErrWrapper(err)
+// }
+// err = s.Delete(instance)
+// if err != nil {
+// return errors.ConnectStorageErrWrapper(err)
+// }
+// return nil
+// }
+
+// func (s *Storage) UpdateInstanceById(InstanceId uint, attrs ...interface{}) error {
+// err := s.db.Table("instances").Where("id = ?", InstanceId).Update(attrs...).Error
+// return errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) UpdateInstanceRoles(instance *Instance, rs ...*Role) error {
+// err := s.db.Model(instance).Association("Roles").Replace(rs).Error
+// return errors.New(errors.ConnectStorageError, err)
+// }
type TypeCount struct {
DBType string `json:"db_type"`
Count int64 `json:"count"`
}
-func (s *Storage) GetAllInstanceCount() ([]*TypeCount, error) {
- var counts []*TypeCount
- return counts, s.db.Table("instances").Select("db_type, count(*) as count").Where("deleted_at is NULL").Group("db_type").Find(&counts).Error
-}
-
-func (s *Storage) GetInstanceTipsByUser(user *User, dbType string, projectName string) (
- instances []*Instance, err error) {
+// func (s *Storage) GetInstanceTipsByUser(user *User, dbType string, projectName string) (
+// instances []*Instance, err error) {
- isMember, err := s.IsProjectMember(user.Name, projectName)
- if err != nil {
- return nil, err
- }
- if IsDefaultAdminUser(user.Name) || isMember {
- return s.GetInstanceTipsByTypeAndTempID(dbType, 0, projectName)
- }
+// isMember, err := s.IsProjectMember(user.Name, projectName)
+// if err != nil {
+// return nil, err
+// }
+// if IsDefaultAdminUser(user.Name) || isMember {
+// return s.GetInstanceTipsByTypeAndTempID(dbType, 0, projectName)
+// }
- return []*Instance{}, nil
-}
+// return []*Instance{}, nil
+// }
-func getInstanceIDsFromInstances(instances []*Instance) (ids []uint) {
+/*func GetInstanceIDsFromInstances(instances []*Instance) (ids []uint) {
ids = make([]uint, len(instances))
for i := range instances {
ids[i] = instances[i].ID
}
return ids
-}
+}*/
//SELECT instances.id
//FROM instances
@@ -362,135 +240,118 @@ func getInstanceIDsFromInstances(instances []*Instance) (ids []uint) {
//AND role_operations.op_code IN (20200)
//GROUP BY instances.id
-func (s *Storage) CheckInstancesExist(projectName string, instNames []string) (bool, error) {
- instNames = utils.RemoveDuplicate(instNames)
-
- var count int
- err := s.db.Model(&Instance{}).
- Joins("JOIN projects ON projects.id = instances.project_id").
- Where("projects.name = ?", projectName).
- Where("instances.name in (?)", instNames).
- Count(&count).Error
- return len(instNames) == count, errors.ConnectStorageErrWrapper(err)
-}
-
-func (s *Storage) getInstanceBindCacheByNames(instNames []string, projectName string) (map[string] /*inst name*/ uint /*inst id*/, error) {
- instNames = utils.RemoveDuplicate(instNames)
-
- insts, err := s.GetInstancesByNamesAndProjectName(instNames, projectName)
- if err != nil {
- return nil, err
- }
-
- if len(insts) != len(instNames) {
- return nil, errors.NewDataNotExistErr("some instances don't exist")
- }
-
- instCache := map[string] /*inst name*/ uint /*inst id*/ {}
-
- for _, inst := range insts {
- instCache[inst.Name] = inst.ID
- }
-
- return instCache, nil
-}
-
-type SyncTaskInstance struct {
- Instances []*Instance
- RuleTemplate *RuleTemplate
- NeedDeletedInstances []*Instance
-}
-
-func (s *Storage) BatchUpdateSyncTask(instTemplate *SyncTaskInstance) error {
- err := s.Tx(func(tx *gorm.DB) error {
- for _, instance := range instTemplate.Instances {
- if err := tx.Save(instance).Error; err != nil {
- return err
- }
-
- if err := s.UpdateInstanceRuleTemplates(instance, instTemplate.RuleTemplate); err != nil {
- return err
- }
- }
-
- for _, instance := range instTemplate.NeedDeletedInstances {
- if err := s.DeleteInstance(instance); err != nil {
- return err
- }
- }
-
- return nil
- })
-
- if err != nil {
- return errors.ConnectStorageErrWrapper(err)
- }
-
- return nil
-}
-
-func (s *Storage) GetInstancesNamesByRuleTemplateAndProject(
- ruleTemplateName string, projectID uint) (instanceNames []string, err error) {
-
- var instances []*Instance
-
- err = s.db.Model(&Instance{}).
- Select("instances.name").
- Joins("LEFT JOIN instance_rule_template AS irt ON irt.instance_id=instances.id").
- Joins("LEFT JOIN rule_templates ON rule_templates.id=irt.rule_template_id").
- Where("instances.project_id=?", projectID).
- Where("rule_templates.name=?", ruleTemplateName).Find(&instances).Error
+// type SyncTaskInstance struct {
+// Instances []*Instance
+// RuleTemplate *RuleTemplate
+// NeedDeletedInstances []*Instance
+// }
+
+// func (s *Storage) BatchUpdateSyncTask(instTemplate *SyncTaskInstance) error {
+// err := s.Tx(func(tx *gorm.DB) error {
+// for _, instance := range instTemplate.Instances {
+// if err := tx.Save(instance).Error; err != nil {
+// return err
+// }
+
+// if err := s.UpdateInstanceRuleTemplates(instance, instTemplate.RuleTemplate); err != nil {
+// return err
+// }
+// }
+
+// for _, instance := range instTemplate.NeedDeletedInstances {
+// if err := s.DeleteInstance(instance); err != nil {
+// return err
+// }
+// }
+
+// return nil
+// })
+
+// if err != nil {
+// return errors.ConnectStorageErrWrapper(err)
+// }
+
+// return nil
+// }
+
+// GetSqlExecutionFailCount 获取sql上线失败统计
+func (s *Storage) GetSqlExecutionFailCount() ([]SqlExecutionCount, error) {
+ var sqlExecutionFailCount []SqlExecutionCount
+
+ err := s.db.Model(&Workflow{}).Select("t.instance_id, count(*) as count").
+ Joins("left join workflow_records wr on workflows.workflow_record_id = wr.id").
+ Joins("left join workflow_instance_records wir on wr.id = wir.workflow_record_id").
+ Joins("left join tasks t on wir.task_id = t.id").
+ Where("t.status = ?", TaskStatusExecuteFailed).
+ Where("t.exec_start_at is not null").
+ Where("t.exec_end_at is not null").
+ Group("t.instance_id").
+ Scan(&sqlExecutionFailCount).Error
if err != nil {
return nil, errors.ConnectStorageErrWrapper(err)
}
- instanceNames = make([]string, len(instances))
- for i := range instances {
- instanceNames[i] = instances[i].Name
- }
-
- return instanceNames, nil
+ return sqlExecutionFailCount, nil
}
-func (s *Storage) GetInstancesNamesByRuleTemplate(
- ruleTemplateName string) (instanceNames []string, err error) {
+// GetSqlExecutionTotalCount 获取sql上线总数统计
+// 上线总数(根据数据源划分)是指:正在上线,上线成功,上线失败 task的总数
+func (s *Storage) GetSqlExecutionTotalCount() ([]SqlExecutionCount, error) {
+ var sqlExecutionTotalCount []SqlExecutionCount
- var instances []*Instance
-
- err = s.db.Model(&Instance{}).
- Select("instances.name").
- Joins("LEFT JOIN instance_rule_template AS irt ON irt.instance_id=instances.id").
- Joins("LEFT JOIN rule_templates ON rule_templates.id=irt.rule_template_id").
- Where("rule_templates.name=?", ruleTemplateName).Find(&instances).Error
+ err := s.db.Model(&Workflow{}).Select("t.instance_id, count(*) as count").
+ Joins("left join workflow_records wr on workflows.workflow_record_id = wr.id").
+ Joins("left join workflow_instance_records wir on wr.id = wir.workflow_record_id").
+ Joins("left join tasks t on wir.task_id = t.id").
+ Where("t.status not in (?)", []string{TaskStatusInit, TaskStatusAudited}).
+ Where("t.exec_start_at is not null").
+ Group("t.instance_id").
+ Scan(&sqlExecutionTotalCount).Error
if err != nil {
return nil, errors.ConnectStorageErrWrapper(err)
}
- instanceNames = make([]string, len(instances))
- for i := range instances {
- instanceNames[i] = instances[i].Name
- }
-
- return instanceNames, nil
+ return sqlExecutionTotalCount, nil
}
type InstanceWorkFlowStatusCount struct {
DbType string `json:"db_type"`
InstanceName string `json:"instance_name"`
StatusCount uint `json:"status_count"`
+ InstanceId uint64 `json:"instance_id"`
}
-func (s *Storage) GetInstanceWorkFlowStatusCountByProject(projectName string, queryStatus []string) ([]*InstanceWorkFlowStatusCount, error) {
+func (s *Storage) GetInstanceWorkFlowStatusCountByProject(instances []*Instance, queryStatus []string) ([]*InstanceWorkFlowStatusCount, error) {
var instanceWorkFlowStatusCount []*InstanceWorkFlowStatusCount
- err := s.db.Model(&Instance{}).
- Select("instances.db_type, instances.name instance_name, count(case when workflow_records.status in (?) then 1 else null end) status_count", queryStatus).
- Joins("left join workflow_instance_records on instances.id=workflow_instance_records.instance_id").
- Joins("left join workflow_records on workflow_instance_records.workflow_record_id=workflow_records.id").
- Joins("inner join workflows on workflow_records.id=workflows.workflow_record_id").
- Joins("left join projects on instances.project_id=projects.id").
- Where("projects.name=?", projectName).
- Group("instances.db_type, instances.name").
+ instanceIds := make([]uint64, 0)
+ var instanceMap = make(map[uint64]InstanceWorkFlowStatusCount)
+ for _, instance := range instances {
+ instanceMap[instance.ID] = InstanceWorkFlowStatusCount{
+ DbType: instance.DbType,
+ InstanceName: instance.Name,
+ }
+ instanceIds = append(instanceIds, instance.ID)
+ }
+
+ err := s.db.Model(&WorkflowInstanceRecord{}).
+ Select("workflow_instance_records.instance_id, count(case when workflow_records.status in (?) then 1 else null end) status_count", queryStatus).
+ Joins("join workflow_records on workflow_instance_records.workflow_record_id=workflow_records.id").
+ Joins("join workflows on workflow_records.id=workflows.workflow_record_id").
+ Where("workflow_instance_records.instance_id in (?)", instanceIds).
+ Group("workflow_instance_records.instance_id").
Scan(&instanceWorkFlowStatusCount).Error
- return instanceWorkFlowStatusCount, errors.ConnectStorageErrWrapper(err)
+
+ if err != nil {
+ return nil, errors.ConnectStorageErrWrapper(err)
+ }
+
+ for i, item := range instanceWorkFlowStatusCount {
+ if instance, ok := instanceMap[item.InstanceId]; ok {
+ instanceWorkFlowStatusCount[i].DbType = instance.DbType
+ instanceWorkFlowStatusCount[i].InstanceName = instance.InstanceName
+ }
+ }
+
+ return instanceWorkFlowStatusCount, nil
}
diff --git a/sqle/model/instance_list.go b/sqle/model/instance_list.go
index baad60c727..fce6746c2f 100644
--- a/sqle/model/instance_list.go
+++ b/sqle/model/instance_list.go
@@ -1,104 +1,104 @@
package model
-import (
- "fmt"
-
- "github.com/actiontech/sqle/sqle/errors"
-)
-
-type InstanceDetail struct {
- Name string `json:"name"`
- DbType string `json:"db_type"`
- Desc string `json:"desc"`
- Host string `json:"db_host"`
- Port string `json:"db_port"`
- User string `json:"db_user"`
- MaintenancePeriod Periods `json:"maintenance_period" gorm:"text"`
- RuleTemplateNames RowList `json:"rule_template_names"`
- SqlQueryConfig SqlQueryConfig `json:"sql_query_config"`
- Source string `json:"source"`
-}
-
-var instancesQueryTpl = `SELECT inst.name, inst.db_type, inst.desc, inst.db_host,
-inst.db_port, inst.db_user, inst.maintenance_period, inst.sql_query_config, inst.source,
-GROUP_CONCAT(DISTINCT COALESCE(rt.name,'')) AS rule_template_names
-FROM instances AS inst
-LEFT JOIN instance_rule_template AS inst_rt ON inst.id = inst_rt.instance_id
-LEFT JOIN rule_templates AS rt ON inst_rt.rule_template_id = rt.id AND rt.deleted_at IS NULL
-WHERE
-inst.id in (SELECT DISTINCT(inst.id)
-
-{{- template "body" . -}}
-)
-GROUP BY inst.id
-{{- if .limit }}
-LIMIT :limit OFFSET :offset
-{{- end -}}
-`
-
-var instancesCountTpl = `SELECT COUNT(DISTINCT inst.id)
-
-{{- template "body" . -}}
-`
-
-var instancesQueryBodyTpl = `
-{{ define "body" }}
-FROM instances AS inst
-LEFT JOIN instance_rule_template AS inst_rt ON inst.id = inst_rt.instance_id
-LEFT JOIN rule_templates AS rt ON inst_rt.rule_template_id = rt.id AND rt.deleted_at IS NULL
-LEFT JOIN projects AS p ON inst.project_id = p.id
-
-WHERE inst.deleted_at IS NULL
-
-AND p.name = :filter_project_name
-
-{{- if .filter_instance_name }}
-AND inst.name = :filter_instance_name
-{{- end }}
-
-{{- if .filter_db_host }}
-AND inst.db_host = :filter_db_host
-{{- end }}
-
-{{- if .filter_db_port }}
-AND inst.db_port = :filter_db_port
-{{- end }}
-
-{{- if .filter_db_user }}
-AND inst.db_user = :filter_db_user
-{{- end }}
-
-{{- if .filter_db_type }}
-AND inst.db_type = :filter_db_type
-{{- end }}
-
-{{- if .filter_rule_template_name }}
-AND rt.name = :filter_rule_template_name
-{{- end }}
-
-{{- end }}
-`
-
-func (s *Storage) GetInstancesByReq(data map[string]interface{}, user *User) (
- result []*InstanceDetail, count uint64, err error) {
-
- if data["filter_project_name"] == "" {
- return nil, 0, errors.New(errors.DataInvalid, fmt.Errorf("project name can not be empty"))
- }
-
- err = s.getListResult(instancesQueryBodyTpl, instancesQueryTpl, data, &result)
- if err != nil {
- return result, 0, err
- }
-
- count, err = s.getCountResult(instancesQueryBodyTpl, instancesCountTpl, data)
- return result, count, err
-
-}
-
-func (s *Storage) GetInstanceTotalByProjectName(projectName string) (uint64, error) {
- data := map[string]interface{}{
- "filter_project_name": projectName,
- }
- return s.getCountResult(instancesQueryBodyTpl, instancesCountTpl, data)
-}
+// import (
+// "fmt"
+
+// "github.com/actiontech/sqle/sqle/errors"
+// )
+
+// type InstanceDetail struct {
+// Name string `json:"name"`
+// DbType string `json:"db_type"`
+// Desc string `json:"desc"`
+// Host string `json:"db_host"`
+// Port string `json:"db_port"`
+// User string `json:"db_user"`
+// MaintenancePeriod Periods `json:"maintenance_period" gorm:"text"`
+// RuleTemplateNames RowList `json:"rule_template_names"`
+// SqlQueryConfig SqlQueryConfig `json:"sql_query_config"`
+// Source string `json:"source"`
+// }
+
+// var instancesQueryTpl = `SELECT inst.name, inst.db_type, inst.desc, inst.db_host,
+// inst.db_port, inst.db_user, inst.maintenance_period, inst.sql_query_config, inst.source,
+// GROUP_CONCAT(DISTINCT COALESCE(rt.name,'')) AS rule_template_names
+// FROM instances AS inst
+// LEFT JOIN instance_rule_template AS inst_rt ON inst.id = inst_rt.instance_id
+// LEFT JOIN rule_templates AS rt ON inst_rt.rule_template_id = rt.id AND rt.deleted_at IS NULL
+// WHERE
+// inst.id in (SELECT DISTINCT(inst.id)
+
+// {{- template "body" . -}}
+// )
+// GROUP BY inst.id
+// {{- if .limit }}
+// LIMIT :limit OFFSET :offset
+// {{- end -}}
+// `
+
+// var instancesCountTpl = `SELECT COUNT(DISTINCT inst.id)
+
+// {{- template "body" . -}}
+// `
+
+// var instancesQueryBodyTpl = `
+// {{ define "body" }}
+// FROM instances AS inst
+// LEFT JOIN instance_rule_template AS inst_rt ON inst.id = inst_rt.instance_id
+// LEFT JOIN rule_templates AS rt ON inst_rt.rule_template_id = rt.id AND rt.deleted_at IS NULL
+// LEFT JOIN projects AS p ON inst.project_id = p.id
+
+// WHERE inst.deleted_at IS NULL
+
+// AND p.name = :filter_project_name
+
+// {{- if .filter_instance_name }}
+// AND inst.name = :filter_instance_name
+// {{- end }}
+
+// {{- if .filter_db_host }}
+// AND inst.db_host = :filter_db_host
+// {{- end }}
+
+// {{- if .filter_db_port }}
+// AND inst.db_port = :filter_db_port
+// {{- end }}
+
+// {{- if .filter_db_user }}
+// AND inst.db_user = :filter_db_user
+// {{- end }}
+
+// {{- if .filter_db_type }}
+// AND inst.db_type = :filter_db_type
+// {{- end }}
+
+// {{- if .filter_rule_template_name }}
+// AND rt.name = :filter_rule_template_name
+// {{- end }}
+
+// {{- end }}
+// `
+
+// func (s *Storage) GetInstancesByReq(data map[string]interface{}, user *User) (
+// result []*InstanceDetail, count uint64, err error) {
+
+// if data["filter_project_name"] == "" {
+// return nil, 0, errors.New(errors.DataInvalid, fmt.Errorf("project name can not be empty"))
+// }
+
+// err = s.getListResult(instancesQueryBodyTpl, instancesQueryTpl, data, &result)
+// if err != nil {
+// return result, 0, err
+// }
+
+// count, err = s.getCountResult(instancesQueryBodyTpl, instancesCountTpl, data)
+// return result, count, err
+
+// }
+
+// func (s *Storage) GetInstanceTotalByProjectName(projectName string) (uint64, error) {
+// data := map[string]interface{}{
+// "filter_project_name": projectName,
+// }
+// return s.getCountResult(instancesQueryBodyTpl, instancesCountTpl, data)
+// }
diff --git a/sqle/model/management_permission.go b/sqle/model/management_permission.go
index 0c5388354d..0761e19238 100644
--- a/sqle/model/management_permission.go
+++ b/sqle/model/management_permission.go
@@ -1,117 +1,117 @@
package model
-import (
- "github.com/actiontech/sqle/sqle/errors"
- "github.com/actiontech/sqle/sqle/utils"
-
- "github.com/jinzhu/gorm"
-)
-
-// NOTE: related model:
-// - model.User
-type ManagementPermission struct {
- Model
- UserId uint `gorm:"index"`
- PermissionCode uint `gorm:"comment:'平台管理权限'"`
-}
-
-const (
- // management permission list
-
- // 创建项目
- ManagementPermissionCreateProject uint = iota + 1
-)
-
-var managementPermission2Desc = map[uint]string{
- ManagementPermissionCreateProject: "创建项目",
-}
-
-func GetManagementPermissionDesc(code uint) string {
- desc, ok := managementPermission2Desc[code]
- if !ok {
- desc = "未知权限"
- }
- return desc
-}
-
-func GetManagementPermission() map[uint] /*code*/ string /*desc*/ {
- resp := map[uint]string{}
- for u, s := range managementPermission2Desc {
- resp[u] = s
- }
- return resp
-}
-
-func (s *Storage) UpdateManagementPermission(userID uint, permissionCode []uint) error {
- return s.Tx(func(txDB *gorm.DB) error {
- err := updateManagementPermission(txDB, userID, permissionCode)
- if err != nil {
- txDB.Rollback()
- return errors.ConnectStorageErrWrapper(err)
- }
- return nil
- })
-}
-
-func updateManagementPermission(txDB *gorm.DB, userID uint, permissionCode []uint) error {
- if err := txDB.Where("user_id = ?", userID).Delete(&ManagementPermission{}).Error; err != nil {
- return err
- }
- for _, code := range permissionCode {
- if err := txDB.Create(&ManagementPermission{
- UserId: userID,
- PermissionCode: code,
- }).Error; err != nil {
- return err
- }
- }
- return nil
-}
-
-func (s *Storage) GetManagementPermissionByUserID(userID uint) ([]uint, error) {
- code := []*struct {
- PermissionCode uint
- }{}
- err := s.db.Table("management_permissions").Select("permission_code").Where("user_id = ?", userID).Where("deleted_at IS NULL").Find(&code).Error
- resp := []uint{}
- for _, c := range code {
- resp = append(resp, c.PermissionCode)
- }
- return resp, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetManagementPermissionByUserIDs(userIDs []uint) (map[uint] /*user id*/ []uint /*codes*/, error) {
- p := []*ManagementPermission{}
- err := s.db.Table("management_permissions").Select("user_id,permission_code").Where("user_id in (?)", userIDs).Where("deleted_at IS NULL").Scan(&p).Error
-
- resp := map[uint][]uint{}
- for _, permission := range p {
- resp[permission.UserId] = append(resp[permission.UserId], permission.PermissionCode)
- }
-
- for id := range resp {
- resp[id] = utils.RemoveDuplicateUint(resp[id])
- }
-
- return resp, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) CheckUserHaveManagementPermission(userID uint, code []uint) (bool, error) {
- code = utils.RemoveDuplicateUint(code)
-
- user, _, err := s.GetUserByID(userID)
- if err != nil {
- return false, err
- }
- if user.Name == DefaultAdminUser {
- return true, nil
- }
-
- var count int
- err = s.db.Model(&ManagementPermission{}).
- Where("user_id = ?", userID).
- Where("permission_code in (?)", code).
- Count(&count).Error
-
- return count == len(code), errors.ConnectStorageErrWrapper(err)
-}
\ No newline at end of file
+// import (
+// "github.com/actiontech/sqle/sqle/errors"
+// "github.com/actiontech/sqle/sqle/utils"
+
+// "github.com/jinzhu/gorm"
+// )
+
+// // NOTE: related model:
+// // - model.User
+// type ManagementPermission struct {
+// Model
+// UserId uint `gorm:"index"`
+// PermissionCode uint `gorm:"comment:'平台管理权限'"`
+// }
+
+// const (
+// // management permission list
+
+// // 创建项目
+// ManagementPermissionCreateProject uint = iota + 1
+// )
+
+// var managementPermission2Desc = map[uint]string{
+// ManagementPermissionCreateProject: "创建项目",
+// }
+
+// func GetManagementPermissionDesc(code uint) string {
+// desc, ok := managementPermission2Desc[code]
+// if !ok {
+// desc = "未知权限"
+// }
+// return desc
+// }
+
+// func GetManagementPermission() map[uint] /*code*/ string /*desc*/ {
+// resp := map[uint]string{}
+// for u, s := range managementPermission2Desc {
+// resp[u] = s
+// }
+// return resp
+// }
+
+// func (s *Storage) UpdateManagementPermission(userID uint, permissionCode []uint) error {
+// return s.Tx(func(txDB *gorm.DB) error {
+// err := updateManagementPermission(txDB, userID, permissionCode)
+// if err != nil {
+// txDB.Rollback()
+// return errors.ConnectStorageErrWrapper(err)
+// }
+// return nil
+// })
+// }
+
+// func updateManagementPermission(txDB *gorm.DB, userID uint, permissionCode []uint) error {
+// if err := txDB.Where("user_id = ?", userID).Delete(&ManagementPermission{}).Error; err != nil {
+// return err
+// }
+// for _, code := range permissionCode {
+// if err := txDB.Create(&ManagementPermission{
+// UserId: userID,
+// PermissionCode: code,
+// }).Error; err != nil {
+// return err
+// }
+// }
+// return nil
+// }
+
+// func (s *Storage) GetManagementPermissionByUserID(userID uint) ([]uint, error) {
+// code := []*struct {
+// PermissionCode uint
+// }{}
+// err := s.db.Table("management_permissions").Select("permission_code").Where("user_id = ?", userID).Where("deleted_at IS NULL").Find(&code).Error
+// resp := []uint{}
+// for _, c := range code {
+// resp = append(resp, c.PermissionCode)
+// }
+// return resp, errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) GetManagementPermissionByUserIDs(userIDs []uint) (map[uint] /*user id*/ []uint /*codes*/, error) {
+// p := []*ManagementPermission{}
+// err := s.db.Table("management_permissions").Select("user_id,permission_code").Where("user_id in (?)", userIDs).Where("deleted_at IS NULL").Scan(&p).Error
+
+// resp := map[uint][]uint{}
+// for _, permission := range p {
+// resp[permission.UserId] = append(resp[permission.UserId], permission.PermissionCode)
+// }
+
+// for id := range resp {
+// resp[id] = utils.RemoveDuplicateUint(resp[id])
+// }
+
+// return resp, errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) CheckUserHaveManagementPermission(userID uint, code []uint) (bool, error) {
+// code = utils.RemoveDuplicateUint(code)
+
+// user, _, err := s.GetUserByID(userID)
+// if err != nil {
+// return false, err
+// }
+// if user.Name == DefaultAdminUser {
+// return true, nil
+// }
+
+// var count int
+// err = s.db.Model(&ManagementPermission{}).
+// Where("user_id = ?", userID).
+// Where("permission_code in (?)", code).
+// Count(&count).Error
+
+// return count == len(code), errors.ConnectStorageErrWrapper(err)
+// }
diff --git a/sqle/model/project.go b/sqle/model/project.go
index a5e5578c2a..5858a22eed 100644
--- a/sqle/model/project.go
+++ b/sqle/model/project.go
@@ -1,567 +1,22 @@
package model
-import (
- "database/sql"
- "fmt"
+// import (
+// "database/sql"
+// "fmt"
- driverV2 "github.com/actiontech/sqle/sqle/driver/v2"
- "github.com/actiontech/sqle/sqle/errors"
- "github.com/actiontech/sqle/sqle/utils"
+// driverV2 "github.com/actiontech/sqle/sqle/driver/v2"
+// "github.com/actiontech/sqle/sqle/errors"
+// "github.com/actiontech/sqle/sqle/utils"
- "github.com/jinzhu/gorm"
-)
+// "github.com/jinzhu/gorm"
+// )
+
+const ProjectIdForGlobalRuleTemplate = "0"
-const ProjectIdForGlobalRuleTemplate = 0
+type ProjectUID string
const (
ProjectStatusArchived = "archived"
ProjectStatusActive = "active"
)
-type Project struct {
- Model
- Name string
- Desc string
-
- Status string `gorm:"default:'active'"`
-
- CreateUserId uint `gorm:"not null"`
- CreateUser *User `gorm:"foreignkey:CreateUserId"`
-
- Managers []*User `gorm:"many2many:project_manager;"`
- Members []*User `gorm:"many2many:project_user;"`
- UserGroups []*UserGroup `gorm:"many2many:project_user_group;"`
-
- Workflows []*Workflow `gorm:"foreignkey:ProjectId"`
- AuditPlans []*AuditPlan `gorm:"foreignkey:ProjectId"`
- Instances []*Instance `gorm:"foreignkey:ProjectId"`
- SqlWhitelist []*SqlWhitelist `gorm:"foreignkey:ProjectId"`
- RuleTemplates []*RuleTemplate `gorm:"foreignkey:ProjectId"`
-
- WorkflowTemplateId uint `gorm:"not null"`
- WorkflowTemplate *WorkflowTemplate `gorm:"foreignkey:WorkflowTemplateId"`
-}
-
-func (p *Project) IsArchived() bool {
- return p.Status == ProjectStatusArchived
-}
-
-// IsProjectExist 用于判断当前是否存在项目, 而非某个项目是否存在
-func (s *Storage) IsProjectExist() (bool, error) {
- var count uint
- err := s.db.Model(&Project{}).Count(&count).Error
- return count > 0, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) CreateProject(name string, desc string, createUserID uint) error {
- wt := &WorkflowTemplate{
- Name: fmt.Sprintf("%v-WorkflowTemplate", name),
- Desc: fmt.Sprintf("%v 默认模板", name),
- AllowSubmitWhenLessAuditLevel: string(driverV2.RuleLevelWarn),
- Steps: []*WorkflowStepTemplate{
- {
- Number: 1,
- Typ: WorkflowStepTypeSQLReview,
- ApprovedByAuthorized: sql.NullBool{
- Bool: true,
- Valid: true,
- },
- },
- {
- Number: 2,
- Typ: WorkflowStepTypeSQLExecute,
- ExecuteByAuthorized: sql.NullBool{
- Bool: true,
- Valid: true,
- },
- },
- },
- }
-
- return s.TxExec(func(tx *sql.Tx) error {
- templateID, err := saveWorkflowTemplate(wt, tx)
- if err != nil {
- return err
- }
-
- result, err := tx.Exec("INSERT INTO projects (`name`, `desc`, `create_user_id`,`workflow_template_id`) values (?, ?, ?,?)", name, desc, createUserID, templateID)
- if err != nil {
- return err
- }
- projectID, err := result.LastInsertId()
- if err != nil {
- return err
- }
- _, err = tx.Exec("INSERT INTO project_manager (`project_id`, `user_id`) VALUES (?, ?)", projectID, createUserID)
- if err != nil {
- return err
- }
- _, err = tx.Exec("INSERT INTO project_user (`project_id`, `user_id`) VALUES (?, ?)", projectID, createUserID)
- if err != nil {
- return err
- }
-
- return nil
- })
-}
-
-func (s *Storage) UpdateProjectInfoByID(projectName string, attr map[string]interface{}) error {
- err := s.db.Table("projects").Where("name = ?", projectName).Update(attr).Error
- return errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetProjectByID(projectID uint) (*Project, bool, error) {
- p := &Project{}
- err := s.db.Model(&Project{}).Where("id = ?", projectID).Find(p).Error
- if err == gorm.ErrRecordNotFound {
- return p, false, nil
- }
- return p, true, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetProjectByName(projectName string) (*Project, bool, error) {
- p := &Project{}
- err := s.db.Preload("CreateUser").Preload("Members").Preload("Managers").Preload("Instances").
- Where("name = ?", projectName).First(p).Error
- if err == gorm.ErrRecordNotFound {
- return p, false, nil
- }
- return p, true, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetProjectTips(userName string) ([]*Project, error) {
- p := []*Project{}
- query := s.db.Table("projects").Select("DISTINCT projects.name,projects.id")
-
- var err error
- if userName != DefaultAdminUser {
- err = query.Joins("LEFT JOIN project_user on project_user.project_id = projects.id").
- Joins("LEFT JOIN users on users.id = project_user.user_id").
- Joins("LEFT JOIN project_user_group on project_user_group.project_id = projects.id").
- Joins("LEFT JOIN user_group_users on project_user_group.user_group_id = user_group_users.user_group_id").
- Joins("LEFT JOIN users as u on u.id = user_group_users.user_id").
- Where("(users.login_name = ? AND users.stat = 0) OR (u.login_name = ? AND u.stat = 0)", userName, userName).Find(&p).Error
- } else {
- err = query.Find(&p).Error
- }
-
- if err == gorm.ErrRecordNotFound {
- err = nil
- }
- return p, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) IsUserInProject(userName, projectName string) (bool, error) {
- query := `
-SELECT EXISTS(
-SELECT users.login_name
-FROM users
-LEFT JOIN project_user on project_user.user_id = users.id
-LEFT JOIN projects on project_user.project_id = projects.id
-LEFT JOIN user_group_users on users.id = user_group_users.user_id
-LEFT JOIN project_user_group on user_group_users.user_group_id = project_user_group.user_group_id
-LEFT JOIN projects as p on project_user_group.project_id = p.id
-WHERE users.stat = 0
-AND users.deleted_at IS NULL
-AND users.login_name = ?
-AND(
- projects.name = ?
-OR
- p.name = ?
-)) AS exist
-`
- var exist struct {
- Exist bool `json:"exist"`
- }
- err := s.db.Raw(query, userName, projectName, projectName).Find(&exist).Error
- return exist.Exist, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) CheckUserIsMember(userName, projectName string) (bool, error) {
- query := `
-SELECT EXISTS(
-SELECT 1
-FROM project_user
-LEFT JOIN projects ON projects.id = project_user.project_id
-LEFT JOIN users ON users.id = project_user.user_id
-WHERE users.stat = 0
-AND users.deleted_at IS NULL
-AND users.login_name = ?
-AND projects.name = ?
-AND projects.deleted_at IS NULL
-) AS exist
-`
- var exist struct {
- Exist bool `json:"exist"`
- }
- err := s.db.Raw(query, userName, projectName).Find(&exist).Error
- return exist.Exist, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) CheckUserGroupIsMember(groupName, projectName string) (bool, error) {
- query := `
-SELECT EXISTS(
-SELECT 1
-FROM project_user_group
-LEFT JOIN projects ON projects.id = project_user_group.project_id
-LEFT JOIN user_groups ON user_groups.id = project_user_group.user_group_id
-WHERE user_groups.stat = 0
-AND user_groups.deleted_at IS NULL
-AND user_groups.name = ?
-AND projects.name = ?
-AND projects.deleted_at IS NULL
-) AS exist
-`
- var exist struct {
- Exist bool `json:"exist"`
- }
- err := s.db.Raw(query, groupName, projectName).Find(&exist).Error
- return exist.Exist, errors.New(errors.ConnectStorageError, err)
-}
-
-type ProjectAndInstance struct {
- InstanceName string `json:"instance_name"`
- ProjectName string `json:"project_name"`
-}
-
-func (s *Storage) GetProjectNamesByInstanceIds(instanceIds []uint) (map[uint] /*instance id*/ ProjectAndInstance, error) {
- instanceIds = utils.RemoveDuplicateUint(instanceIds)
- type record struct {
- InstanceId uint `json:"instance_id"`
- InstanceName string `json:"instance_name"`
- ProjectName string `json:"project_name"`
- }
- records := []record{}
- err := s.db.Table("instances").
- Joins("LEFT JOIN projects ON projects.id = instances.project_id").
- Select("instances.id AS instance_id, instances.name AS instance_name, projects.name AS project_name").
- Where("instances.id IN (?)", instanceIds).
- Find(&records).Error
-
- if err != nil {
- return nil, errors.New(errors.ConnectStorageError, err)
- }
-
- res := make(map[uint]ProjectAndInstance, len(records))
- for _, r := range records {
- res[r.InstanceId] = ProjectAndInstance{
- InstanceName: r.InstanceName,
- ProjectName: r.ProjectName,
- }
- }
-
- return res, nil
-}
-
-func (s *Storage) AddMember(userName, projectName string, isManager bool, bindRole []BindRole) error {
- user, exist, err := s.GetUserByName(userName)
- if err != nil {
- return errors.ConnectStorageErrWrapper(err)
- }
- if !exist {
- return errors.ConnectStorageErrWrapper(fmt.Errorf("user not exist"))
- }
-
- project, exist, err := s.GetProjectByName(projectName)
- if err != nil {
- return errors.ConnectStorageErrWrapper(err)
- }
- if !exist {
- return errors.ConnectStorageErrWrapper(fmt.Errorf("project not exist"))
- }
-
- return errors.New(errors.ConnectStorageError, s.db.Transaction(func(tx *gorm.DB) error {
-
- if err = tx.Exec("INSERT INTO project_user (project_id, user_id) VALUES (?,?)", project.ID, user.ID).Error; err != nil {
- return errors.ConnectStorageErrWrapper(err)
- }
-
- if isManager {
- if err = tx.Exec("INSERT INTO project_manager (project_id, user_id) VALUES (?,?)", project.ID, user.ID).Error; err != nil {
- return errors.ConnectStorageErrWrapper(err)
- }
- }
-
- err = s.updateUserRoles(tx, user, projectName, bindRole)
- if err != nil {
- return errors.ConnectStorageErrWrapper(err)
- }
- return nil
- }))
-}
-
-func (s *Storage) AddProjectManager(userName, projectName string) error {
- sql := `
-INSERT INTO project_manager
-SELECT projects.id AS project_id , users.id AS user_id
-FROM projects
-JOIN users
-WHERE projects.name = ?
-AND users.login_name = ?
-AND users.deleted_at is null
-LIMIT 1
-`
-
- return errors.ConnectStorageErrWrapper(s.db.Exec(sql, projectName, userName).Error)
-}
-
-func (s *Storage) RemoveProjectManager(userName, projectName string) error {
- sql := `
-DELETE project_manager
-FROM project_manager
-JOIN projects ON project_manager.project_id = projects.id
-JOIN users ON project_manager.user_id = users.id
-WHERE projects.name = ?
-AND users.login_name = ?
-AND users.deleted_at is null
-`
-
- return errors.ConnectStorageErrWrapper(s.db.Exec(sql, projectName, userName).Error)
-}
-
-func (s *Storage) RemoveMember(userName, projectName string) error {
- sql := `
-DELETE project_user, project_manager, project_member_roles
-FROM project_user
-LEFT JOIN project_manager ON project_user.project_id = project_manager.project_id
- AND project_user.user_id = project_manager.user_id
-LEFT JOIN projects ON project_user.project_id = projects.id
-LEFT JOIN users ON project_user.user_id = users.id
-LEFT JOIN project_member_roles ON project_member_roles.user_id = users.id
-WHERE
-users.login_name = ?
-AND
-projects.name = ?
-`
-
- return errors.ConnectStorageErrWrapper(s.db.Exec(sql, userName, projectName).Error)
-}
-
-func (s *Storage) AddMemberGroup(groupName, projectName string, bindRole []BindRole) error {
- group, exist, err := s.GetUserGroupByName(groupName)
- if err != nil {
- return errors.ConnectStorageErrWrapper(err)
- }
- if !exist {
- return errors.ConnectStorageErrWrapper(fmt.Errorf("user group not exist"))
- }
-
- project, exist, err := s.GetProjectByName(projectName)
- if err != nil {
- return errors.ConnectStorageErrWrapper(err)
- }
- if !exist {
- return errors.ConnectStorageErrWrapper(fmt.Errorf("project not exist"))
- }
-
- return errors.New(errors.ConnectStorageError, s.db.Transaction(func(tx *gorm.DB) error {
-
- if err = tx.Exec("INSERT INTO project_user_group (project_id, user_group_id) VALUES (?,?)", project.ID, group.ID).Error; err != nil {
- return errors.ConnectStorageErrWrapper(err)
- }
-
- err = s.updateUserGroupRoles(tx, group, projectName, bindRole)
- if err != nil {
- return errors.ConnectStorageErrWrapper(err)
- }
- return nil
- }))
-}
-
-func (s *Storage) RemoveMemberGroup(groupName, projectName string) error {
- sql := `
-DELETE project_user_group, project_member_group_roles
-FROM project_user_group
-LEFT JOIN projects ON project_user_group.project_id = projects.id
-LEFT JOIN user_groups ON project_user_group.user_group_id = user_groups.id
-LEFT JOIN project_member_group_roles ON project_member_group_roles.user_group_id = user_groups.id
-WHERE
-user_groups.name = ?
-AND
-projects.name = ?
-`
-
- return errors.ConnectStorageErrWrapper(s.db.Exec(sql, groupName, projectName).Error)
-}
-
-type GetMemberGroupFilter struct {
- FilterProjectName *string
- FilterUserGroupName *string
- FilterInstanceName *string
- Limit *uint32
- Offset *uint32
-}
-
-func generateMemberGroupQueryCriteria(query *gorm.DB, filter GetMemberGroupFilter) (*gorm.DB, error) {
- if filter.FilterProjectName == nil {
- return nil, errors.ConnectStorageErrWrapper(fmt.Errorf("project name cannot be empty"))
- }
-
- query = query.Model(&UserGroup{}).
- Preload("Users").
- Joins("LEFT JOIN project_user_group ON project_user_group.user_group_id = user_groups.id").
- Joins("LEFT JOIN projects ON projects.id = project_user_group.project_id").
- Where("user_groups.stat = 0").
- Where("user_groups.deleted_at IS NULL").
- Where("projects.deleted_at IS NULL").
- Where("projects.name = ?", *filter.FilterProjectName).
- Group("user_groups.id")
-
- if filter.Limit != nil {
- query = query.Limit(*filter.Limit).Offset(*filter.Offset)
- }
- if filter.FilterUserGroupName != nil {
- query = query.Where("user_groups.name = ?", *filter.FilterUserGroupName)
- }
- if filter.FilterInstanceName != nil {
- query = query.
- Joins("LEFT JOIN instances ON instances.project_id = projects.id").
- Where("instances.deleted_at IS NULL").
- Joins("JOIN project_member_group_roles ON project_member_group_roles.user_group_id = user_groups.id AND project_member_group_roles.instance_id = instances.id").
- Where("instances.name = ?", *filter.FilterInstanceName)
- }
- return query, nil
-}
-
-func (s *Storage) GetMemberGroups(filter GetMemberGroupFilter) ([]*UserGroup, error) {
- group := []*UserGroup{}
- query, err := generateMemberGroupQueryCriteria(s.db, filter)
- if err != nil {
- return nil, err
- }
- err = query.Find(&group).Error
- return group, errors.ConnectStorageErrWrapper(err)
-}
-
-func (s *Storage) GetMemberGroupCount(filter GetMemberGroupFilter) (uint64, error) {
- // count要查总数, 清掉limit
- filter.Limit = nil
- filter.Offset = nil
-
- var count uint64
- query, err := generateMemberGroupQueryCriteria(s.db, filter)
- if err != nil {
- return 0, err
- }
- err = query.Count(&count).Error
- return count, errors.ConnectStorageErrWrapper(err)
-}
-
-func (s *Storage) GetMemberGroupByGroupName(projectName, groupName string) (*UserGroup, error) {
- group := &UserGroup{}
- err := s.db.Joins("LEFT JOIN project_user_group ON project_user_group.user_group_id = user_groups.id").
- Joins("LEFT JOIN projects ON project_user_group.project_id = projects.id").
- Where("projects.name = ?", projectName).
- Where("user_groups.name = ?", groupName).
- Find(group).Error
- return group, errors.ConnectStorageErrWrapper(err)
-}
-
-func (s *Storage) RemoveMemberFromAllProjectByUserID(userID uint) error {
- sql := `
-DELETE project_user, project_manager, project_member_roles
-FROM project_user
-LEFT JOIN project_manager ON project_user.project_id = project_manager.project_id
- AND project_user.user_id = project_manager.user_id
-LEFT JOIN project_member_roles ON project_member_roles.user_id = ?
-LEFT JOIN users ON project_user.user_id = users.id
-WHERE
-users.id = ?
-`
-
- return errors.ConnectStorageErrWrapper(s.db.Exec(sql, userID, userID).Error)
-}
-
-func (s *Storage) RemoveMemberGroupFromAllProjectByUserGroupID(userGroupID uint) error {
- sql := `
-DELETE project_user_group, project_member_group_roles
-FROM project_user_group
-LEFT JOIN projects ON project_user_group.project_id = projects.id
-LEFT JOIN user_groups ON project_user_group.user_group_id = user_groups.id
-LEFT JOIN project_member_group_roles ON project_member_group_roles.user_group_id = ?
-WHERE
-user_groups.id = ?
-`
-
- return errors.ConnectStorageErrWrapper(s.db.Exec(sql, userGroupID, userGroupID).Error)
-}
-
-func (s *Storage) IsLastProjectManager(userName, projectName string) (bool, error) {
-
- project, _, err := s.GetProjectByName(projectName)
- if err != nil {
- return true, err
- }
-
- return len(project.Managers) == 1 && project.Managers[0].Name == userName, nil
-}
-
-// 检查用户是否是某一个项目的最后一个管理员
-func (s *Storage) IsLastProjectManagerOfAnyProjectByUserID(userID uint) (bool, error) {
-
- sql := `
-select count(1) as count
-from project_manager
-where project_id in(
- select distinct project_id
- from project_manager
- where user_id = ?
- )
-group by project_id;
-`
-
- var count []*struct {
- Count int `json:"count"`
- }
- err := s.db.Raw(sql, userID).Scan(&count).Error
- if err != nil {
- return true, errors.ConnectStorageErrWrapper(err)
- }
-
- for _, c := range count {
- if c.Count == 1 {
- return true, nil
- }
- }
- return false, nil
-}
-
-func (s *Storage) CheckUserHasManagementPermission(userID uint, code []uint) (bool, error) {
- code = utils.RemoveDuplicateUint(code)
-
- user, _, err := s.GetUserByID(userID)
- if err != nil {
- return false, err
- }
- if user.Name == DefaultAdminUser {
- return true, nil
- }
-
- var count int
- err = s.db.Model(&ManagementPermission{}).
- Where("user_id = ?", userID).
- Where("permission_code in (?)", code).
- Count(&count).Error
-
- return count == len(code), errors.ConnectStorageErrWrapper(err)
-}
-
-func (s *Storage) GetManagedProjects(userID uint) ([]*Project, error) {
- p := []*Project{}
- err := s.db.Joins("LEFT JOIN project_manager ON project_manager.project_id = projects.id").
- Where("project_manager.user_id = ?", userID).
- Find(&p).Error
- return p, errors.ConnectStorageErrWrapper(err)
-}
-
-func (s *Storage) IsProjectArchived(projectName string) (bool, error) {
- proj := &Project{}
- err := s.db.Select("status").Where("name = ?", projectName).First(&proj).Error
- if err == gorm.ErrRecordNotFound {
- return false, fmt.Errorf("project doesn't exist")
- }
- if err != nil {
- return false, err
- }
- return proj.Status == ProjectStatusArchived, nil
-}
diff --git a/sqle/model/project_list.go b/sqle/model/project_list.go
index 7096ab1e87..4fc603e0c4 100644
--- a/sqle/model/project_list.go
+++ b/sqle/model/project_list.go
@@ -1,172 +1,171 @@
package model
-import (
- "fmt"
- "time"
-
- "github.com/actiontech/sqle/sqle/errors"
-)
-
-type ProjectDetail struct {
- Name string `json:"name"`
- Desc string `json:"desc"`
- CreateUserName string `json:"create_user_name"`
- CreateTime time.Time `json:"create_time"`
- Status string `json:"status"`
-}
-
-var projectsQueryTpl = `SELECT
-DISTINCT projects.name , projects.` + "`desc`" + `, cu.login_name as create_user_name, projects.created_at as create_time, projects.status as status
-
-{{- template "body" . -}}
-
-{{ if .limit }}
-LIMIT :limit OFFSET :offset
-{{ end }}
-`
-
-var projectsCountTpl = `SELECT COUNT(DISTINCT projects.id)
-
-{{- template "body" . -}}
-`
-
-var projectsQueryBodyTpl = `
-{{ define "body" }}
-
-FROM projects
-LEFT JOIN project_user ON project_user.project_id = projects.id
-LEFT JOIN users ON users.id = project_user.user_id
-LEFT JOIN project_user_group ON project_user_group.project_id = projects.id
-LEFT JOIN user_group_users ON project_user_group.user_group_id = user_group_users.user_group_id
-LEFT JOIN users AS u ON u.id = user_group_users.user_id
-LEFT JOIN users AS cu ON cu.id = projects.create_user_id
-WHERE
-projects.deleted_at IS NULL
-
-{{ if .filter_user_name }}
-AND
-((
- users.login_name = :filter_user_name
- AND users.deleted_at IS NULL
- AND users.stat = 0
-)
-OR (
- u.login_name = :filter_user_name
- AND u.deleted_at IS NULL
- AND u.stat = 0
-))
-{{ end }}
-
-
-{{ end }}
-`
-
-func (s *Storage) GetProjectsByReq(data map[string]interface{}) (
- result []*ProjectDetail, count uint64, err error) {
-
- if data["filter_user_name"] == DefaultAdminUser {
- delete(data, "filter_user_name")
- }
-
- err = s.getListResult(projectsQueryBodyTpl, projectsQueryTpl, data, &result)
- if err != nil {
- return result, 0, err
- }
- count, err = s.getCountResult(projectsQueryBodyTpl, projectsCountTpl, data)
- return result, count, err
-}
-
-type MemberDetail struct {
- UserName string `json:"user_name"`
- IsManager bool `json:"is_manager"`
-}
-
-var membersQueryTpl = `
-SELECT DISTINCT users.login_name AS user_name
-
-{{ template "body" . }}
-
-{{ if .limit }}
-LIMIT :limit OFFSET :offset
-{{ end }}
-
-`
-
-var membersCountTpl = `
-SELECT COUNT(DISTINCT project_user.user_id)
-{{ template "body" . }}
-`
-
-var membersQueryBodyTpl = `
-{{ define "body" }}
-
-FROM project_user
-LEFT JOIN users ON users.id = project_user.user_id
-LEFT JOIN projects ON projects.id = project_user.project_id
-
-{{ if .filter_instance_name }}
-LEFT JOIN instances ON instances.project_id = projects.id
-{{ end }}
-
-{{ if .filter_instance_name }}
-JOIN project_member_roles ON project_member_roles.user_id = users.id AND project_member_roles.instance_id = instances.id
-{{ end }}
-
-WHERE users.stat = 0
-AND users.deleted_at IS NULL
-AND projects.deleted_at IS NULL
-
-{{ if .filter_instance_name }}
-AND instances.deleted_at IS NULL
-{{ end }}
-
-AND projects.name = :filter_project_name
-
-{{ if .filter_user_name }}
-AND users.login_name = :filter_user_name
-{{ end }}
-
-{{ if .filter_instance_name }}
-AND instances.name = :filter_instance_name
-{{ end }}
-
-{{ end }}
-`
-
-func (s *Storage) GetMembersByReq(data map[string]interface{}) (
- result []*MemberDetail, count uint64, err error) {
-
- if data["filter_project_name"] == nil {
- return nil, 0, errors.New(errors.DataInvalid, fmt.Errorf("project name must be exist"))
- }
-
- members := []*struct {
- UserName string `json:"user_name"`
- }{}
- err = s.getListResult(membersQueryBodyTpl, membersQueryTpl, data, &members)
- if err != nil {
- return result, 0, err
- }
-
- project, _, err := s.GetProjectByName(fmt.Sprintf("%v", data["filter_project_name"]))
- if err != nil {
- return result, 0, err
- }
-
- for _, member := range members {
- isManager := false
- for _, manager := range project.Managers {
- if manager.Name == member.UserName {
- isManager = true
- break
- }
- }
- result = append(result, &MemberDetail{
- UserName: member.UserName,
- IsManager: isManager,
- })
- }
-
- count, err = s.getCountResult(membersQueryBodyTpl, membersCountTpl, data)
- return result, count, err
-}
+// import (
+// "fmt"
+// "time"
+
+// "github.com/actiontech/sqle/sqle/errors"
+// )
+
+// type ProjectDetail struct {
+// Name string `json:"name"`
+// Desc string `json:"desc"`
+// CreateUserName string `json:"create_user_name"`
+// CreateTime time.Time `json:"create_time"`
+// Status string `json:"status"`
+// }
+
+// var projectsQueryTpl = `SELECT
+// DISTINCT projects.name , projects.` + "`desc`" + `, cu.login_name as create_user_name, projects.created_at as create_time, projects.status as status
+
+// {{- template "body" . -}}
+
+// {{ if .limit }}
+// LIMIT :limit OFFSET :offset
+// {{ end }}
+// `
+
+// var projectsCountTpl = `SELECT COUNT(DISTINCT projects.id)
+
+// {{- template "body" . -}}
+// `
+
+// var projectsQueryBodyTpl = `
+// {{ define "body" }}
+
+// FROM projects
+// LEFT JOIN project_user ON project_user.project_id = projects.id
+// LEFT JOIN users ON users.id = project_user.user_id
+// LEFT JOIN project_user_group ON project_user_group.project_id = projects.id
+// LEFT JOIN user_group_users ON project_user_group.user_group_id = user_group_users.user_group_id
+// LEFT JOIN users AS u ON u.id = user_group_users.user_id
+// LEFT JOIN users AS cu ON cu.id = projects.create_user_id
+// WHERE
+// projects.deleted_at IS NULL
+
+// {{ if .filter_user_name }}
+// AND
+// ((
+// users.login_name = :filter_user_name
+// AND users.deleted_at IS NULL
+// AND users.stat = 0
+// )
+// OR (
+// u.login_name = :filter_user_name
+// AND u.deleted_at IS NULL
+// AND u.stat = 0
+// ))
+// {{ end }}
+
+// {{ end }}
+// `
+
+// func (s *Storage) GetProjectsByReq(data map[string]interface{}) (
+// result []*ProjectDetail, count uint64, err error) {
+
+// if data["filter_user_name"] == DefaultAdminUser {
+// delete(data, "filter_user_name")
+// }
+
+// err = s.getListResult(projectsQueryBodyTpl, projectsQueryTpl, data, &result)
+// if err != nil {
+// return result, 0, err
+// }
+// count, err = s.getCountResult(projectsQueryBodyTpl, projectsCountTpl, data)
+// return result, count, err
+// }
+
+// type MemberDetail struct {
+// UserName string `json:"user_name"`
+// IsManager bool `json:"is_manager"`
+// }
+
+// var membersQueryTpl = `
+// SELECT DISTINCT users.login_name AS user_name
+
+// {{ template "body" . }}
+
+// {{ if .limit }}
+// LIMIT :limit OFFSET :offset
+// {{ end }}
+
+// `
+
+// var membersCountTpl = `
+// SELECT COUNT(DISTINCT project_user.user_id)
+// {{ template "body" . }}
+// `
+
+// var membersQueryBodyTpl = `
+// {{ define "body" }}
+
+// FROM project_user
+// LEFT JOIN users ON users.id = project_user.user_id
+// LEFT JOIN projects ON projects.id = project_user.project_id
+
+// {{ if .filter_instance_name }}
+// LEFT JOIN instances ON instances.project_id = projects.id
+// {{ end }}
+
+// {{ if .filter_instance_name }}
+// JOIN project_member_roles ON project_member_roles.user_id = users.id AND project_member_roles.instance_id = instances.id
+// {{ end }}
+
+// WHERE users.stat = 0
+// AND users.deleted_at IS NULL
+// AND projects.deleted_at IS NULL
+
+// {{ if .filter_instance_name }}
+// AND instances.deleted_at IS NULL
+// {{ end }}
+
+// AND projects.name = :filter_project_name
+
+// {{ if .filter_user_name }}
+// AND users.login_name = :filter_user_name
+// {{ end }}
+
+// {{ if .filter_instance_name }}
+// AND instances.name = :filter_instance_name
+// {{ end }}
+
+// {{ end }}
+// `
+
+// func (s *Storage) GetMembersByReq(data map[string]interface{}) (
+// result []*MemberDetail, count uint64, err error) {
+
+// if data["filter_project_name"] == nil {
+// return nil, 0, errors.New(errors.DataInvalid, fmt.Errorf("project name must be exist"))
+// }
+
+// members := []*struct {
+// UserName string `json:"user_name"`
+// }{}
+// err = s.getListResult(membersQueryBodyTpl, membersQueryTpl, data, &members)
+// if err != nil {
+// return result, 0, err
+// }
+
+// project, _, err := s.GetProjectByName(fmt.Sprintf("%v", data["filter_project_name"]))
+// if err != nil {
+// return result, 0, err
+// }
+
+// for _, member := range members {
+// isManager := false
+// for _, manager := range project.Managers {
+// if manager.Name == member.UserName {
+// isManager = true
+// break
+// }
+// }
+// result = append(result, &MemberDetail{
+// UserName: member.UserName,
+// IsManager: isManager,
+// })
+// }
+
+// count, err = s.getCountResult(membersQueryBodyTpl, membersCountTpl, data)
+// return result, count, err
+// }
diff --git a/sqle/model/project_permission.go b/sqle/model/project_permission.go
index 689cc18c8e..150ec48f59 100644
--- a/sqle/model/project_permission.go
+++ b/sqle/model/project_permission.go
@@ -1,468 +1,499 @@
package model
-import (
- "github.com/actiontech/sqle/sqle/errors"
- "github.com/jinzhu/gorm"
-)
-
-/*
-
-instance permission.
-
-*/
-
-var queryInstanceUserWithOp = `
-SELECT
-
-{{- template "select_fields" . -}}
-
-FROM instances
-{{- if .project_name }}
-LEFT JOIN projects ON instances.project_id = projects.id
-{{- end }}
-LEFT JOIN project_member_roles ON instances.id = project_member_roles.instance_id
-LEFT JOIN users ON project_member_roles.user_id = users.id AND users.deleted_at IS NULL AND users.stat = 0
-LEFT JOIN roles ON project_member_roles.role_id = roles.id AND roles.deleted_at IS NULL AND roles.stat = 0
-LEFT JOIN role_operations ON role_operations.role_id = roles.id
-WHERE
-instances.deleted_at IS NULL
-AND users.id = :user_id
-AND role_operations.op_code IN (:op_codes)
-
-{{- if .instance_ids }}
-AND instances.id IN (:instance_ids)
-{{- end }}
-
-{{- if .project_name }}
-AND projects.name = :project_name
-{{- end }}
-
-{{- if .db_type }}
-AND instances.db_type = :db_type
-{{- end }}
-GROUP BY instances.id
-
-UNION
-SELECT
-
-{{- template "select_fields" . -}}
-
-FROM instances
-{{- if .project_name }}
-LEFT JOIN projects ON instances.project_id = projects.id
-{{- end }}
-LEFT JOIN project_member_group_roles ON instances.id = project_member_group_roles.instance_id
-LEFT JOIN roles ON roles.id = project_member_group_roles.role_id AND roles.deleted_at IS NULL AND roles.stat = 0
-LEFT JOIN role_operations ON role_operations.role_id = roles.id
-LEFT JOIN user_groups ON project_member_group_roles.user_group_id = user_groups.id AND user_groups.deleted_at IS NULL AND user_groups.stat = 0
-JOIN user_group_users ON user_groups.id = user_group_users.user_group_id
-JOIN users ON users.id = user_group_users.user_id AND users.deleted_at IS NULL AND users.stat=0
-WHERE
-instances.deleted_at IS NULL
-AND users.id = :user_id
-AND role_operations.op_code IN (:op_codes)
-
-{{- if .instance_ids }}
-AND instances.id IN (:instance_ids)
-{{- end }}
-
-{{- if .project_name }}
-AND projects.name = :project_name
-{{- end }}
-
-{{- if .db_type }}
-AND instances.db_type = :db_type
-{{- end }}
-GROUP BY instances.id
-
-UNION
-SELECT
-
-{{- template "select_fields" . -}}
-
-FROM instances
-LEFT JOIN projects ON instances.project_id = projects.id
-LEFT JOIN project_manager ON project_manager.project_id = projects.id
-LEFT JOIN users ON project_manager.user_id = users.id AND users.deleted_at IS NULL AND users.stat = 0
-WHERE
-instances.deleted_at IS NULL
-AND users.id = :user_id
-
-{{- if .instance_ids }}
-AND instances.id IN (:instance_ids)
-{{- end }}
-
-{{- if .project_name }}
-AND projects.name = :project_name
-{{- end }}
-
-{{- if .db_type }}
-AND instances.db_type = :db_type
-{{- end }}
-GROUP BY instances.id
-
-`
-
-func (s *Storage) filterUserHasOpInstances(user *User, instanceIds []uint, ops []uint) ([]*Instance, error) {
- var instanceRecords []*Instance
- data := map[string]interface{}{
- "instance_ids": instanceIds,
- "op_codes": ops,
- "user_id": user.ID,
- }
- fields := `
-{{ define "select_fields" }}
-instances.id
-{{ end }}
- `
- err := s.getTemplateQueryResult(data, &instanceRecords, queryInstanceUserWithOp, fields)
- if err != nil {
- return nil, errors.ConnectStorageErrWrapper(err)
- }
- return instanceRecords, nil
-}
-
-func (s *Storage) CheckUserHasOpToInstances(user *User, instances []*Instance, ops []uint) (bool, error) {
- instanceIds := getDeduplicatedInstanceIds(instances)
- instanceRecords, err := s.filterUserHasOpInstances(user, instanceIds, ops)
- if err != nil {
- return false, err
- }
- return len(instanceRecords) == len(instanceIds), nil
-}
-
-func (s *Storage) CheckUserHasOpToAnyInstance(user *User, instances []*Instance, ops []uint) (bool, error) {
- instanceIds := getDeduplicatedInstanceIds(instances)
- instanceRecords, err := s.filterUserHasOpInstances(user, instanceIds, ops)
- if err != nil {
- return false, err
- }
- return len(instanceRecords) > 0, nil
-}
-
-func (s *Storage) GetUserCanOpInstances(user *User, ops []uint) ([]*Instance, error) {
- var instances []*Instance
- data := map[string]interface{}{
- "op_codes": ops,
- "user_id": user.ID,
- }
- fields := `
-{{ define "select_fields" }}
-instances.id, instances.name
-{{ end }}
-`
- err := s.getTemplateQueryResult(data, &instances, queryInstanceUserWithOp, fields)
- if err != nil {
- return instances, errors.ConnectStorageErrWrapper(err)
- }
- return instances, nil
-}
-
-func (s *Storage) GetUserCanOpInstancesFromProject(user *User, projectName string, ops []uint) ([]*Instance, error) {
- var instances []*Instance
- data := map[string]interface{}{
- "op_codes": ops,
- "user_id": user.ID,
- "project_name": projectName,
- }
- fields := `
-{{ define "select_fields" }}
-instances.id, instances.name
-{{ end }}
-`
- err := s.getTemplateQueryResult(data, &instances, queryInstanceUserWithOp, fields)
- if err != nil {
- return instances, errors.ConnectStorageErrWrapper(err)
- }
- return instances, nil
-}
-
-func (s *Storage) GetInstanceTipsByUserAndOperation(user *User, dbType, projectName string, opCode ...int) (
- instances []*Instance, err error) {
-
- isProjectManager, err := s.IsProjectManager(user.Name, projectName)
- if err != nil {
- return nil, err
- }
-
- if IsDefaultAdminUser(user.Name) || isProjectManager {
- return s.GetInstanceTipsByTypeAndTempID(dbType, 0, projectName)
- }
- return s.getInstanceTipsByUserAndOperation(user, dbType, projectName, opCode...)
-}
-
-func (s *Storage) getInstanceTipsByUserAndOperation(user *User, dbType string, projectName string, opCode ...int) ([]*Instance, error) {
- var instances []*Instance
- data := map[string]interface{}{
- "op_codes": opCode,
- "user_id": user.ID,
- "project_name": projectName,
- "db_type": dbType,
- }
- fields := `
-{{ define "select_fields" }}
-instances.id, instances.name, instances.db_host as host, instances.db_port as port, instances.db_type
-{{ end }}
- `
- err := s.getTemplateQueryResult(data, &instances, queryInstanceUserWithOp, fields)
- if err != nil {
- return instances, errors.ConnectStorageErrWrapper(err)
- }
- return instances, nil
-}
-
-func (s *Storage) UserCanAccessInstance(user *User, instance *Instance) (
- ok bool, err error) {
-
- isManager, err := s.IsProjectManagerByID(user.ID, instance.ProjectId)
- if err != nil {
- return false, err
- }
-
- if IsDefaultAdminUser(user.Name) || isManager {
- return true, nil
- }
-
- type countStruct struct {
- Count int `json:"count"`
- }
-
- query := `
-SELECT COUNT(1) AS count
-FROM instances
-LEFT JOIN project_member_roles ON project_member_roles.instance_id = instances.id
-LEFT JOIN users ON users.id = project_member_roles.user_id
-WHERE instances.deleted_at IS NULL
-AND users.stat = 0
-AND users.deleted_at IS NULL
-AND instances.id = ?
-AND users.id = ?
-GROUP BY instances.id
-UNION
-SELECT instances.id
-FROM instances
-LEFT JOIN project_member_group_roles ON project_member_group_roles.instance_id = instances.id
-JOIN user_group_users ON project_member_group_roles.user_group_id = user_group_users.user_group_id
-JOIN users ON users.id = user_group_users.user_id
-WHERE instances.deleted_at IS NULL
-AND users.stat = 0
-AND users.deleted_at IS NULL
-AND instances.id = ?
-AND users.id = ?
-GROUP BY instances.id
-`
- var cnt countStruct
- err = s.db.Unscoped().Raw(query, instance.ID, user.ID, instance.ID, user.ID).Scan(&cnt).Error
- if err != nil {
- if gorm.IsRecordNotFoundError(err) {
- return false, nil
- }
- return false, errors.New(errors.ConnectStorageError, err)
- }
- return cnt.Count > 0, nil
-}
-
-func (s *Storage) GetWithOperationUserFromInstance(instance *Instance, opCode ...int) (users []*User, err error) {
- query := `
- SELECT users.id, users.login_name
- FROM users
- LEFT JOIN project_member_roles ON users.id = project_member_roles.user_id
- LEFT JOIN roles ON project_member_roles.role_id = roles.id AND roles.deleted_at IS NULL AND roles.stat = 0
- LEFT JOIN role_operations ON role_operations.role_id = roles.id
- WHERE
- users.deleted_at IS NULL
- AND users.stat = 0
- AND project_member_roles.instance_id = ?
- AND role_operations.op_code IN (?)
-
- UNION
- SELECT users.id, users.login_name
- FROM users
- LEFT JOIN user_group_users ON users.id = user_group_users.user_id
- LEFT JOIN user_groups ON user_group_users.user_group_id = user_groups.id AND user_groups.stat = 0
- LEFT JOIN project_member_group_roles ON user_groups.id = project_member_group_roles.user_group_id
- LEFT JOIN roles ON project_member_group_roles.role_id = roles.id AND roles.deleted_at IS NULL AND roles.stat = 0
- LEFT JOIN role_operations ON role_operations.role_id = roles.id
- WHERE
- users.deleted_at IS NULL
- AND users.stat = 0
- AND project_member_group_roles.instance_id = ?
- AND role_operations.op_code IN (?)
- `
- err = s.db.Raw(query, instance.ID, opCode, instance.ID, opCode).Scan(&users).Error
- if err != nil {
- return nil, errors.ConnectStorageErrWrapper(err)
- }
- return
-}
-
-/*
-
-workflow permission.
-
-*/
-
-func (s *Storage) UserCanAccessWorkflow(user *User, workflow *Workflow) (bool, error) {
+import "github.com/actiontech/sqle/sqle/errors"
+
+// import (
+// "github.com/actiontech/sqle/sqle/errors"
+// "github.com/jinzhu/gorm"
+// )
+
+// /*
+
+// instance permission.
+
+// */
+
+// var queryInstanceUserWithOp = `
+// SELECT
+
+// {{- template "select_fields" . -}}
+
+// FROM instances
+// {{- if .project_name }}
+// LEFT JOIN projects ON instances.project_id = projects.id
+// {{- end }}
+// LEFT JOIN project_member_roles ON instances.id = project_member_roles.instance_id
+// LEFT JOIN users ON project_member_roles.user_id = users.id AND users.deleted_at IS NULL AND users.stat = 0
+// LEFT JOIN roles ON project_member_roles.role_id = roles.id AND roles.deleted_at IS NULL AND roles.stat = 0
+// LEFT JOIN role_operations ON role_operations.role_id = roles.id
+// WHERE
+// instances.deleted_at IS NULL
+// AND users.id = :user_id
+// AND role_operations.op_code IN (:op_codes)
+
+// {{- if .instance_ids }}
+// AND instances.id IN (:instance_ids)
+// {{- end }}
+
+// {{- if .project_name }}
+// AND projects.name = :project_name
+// {{- end }}
+
+// {{- if .db_type }}
+// AND instances.db_type = :db_type
+// {{- end }}
+// GROUP BY instances.id
+
+// UNION
+// SELECT
+
+// {{- template "select_fields" . -}}
+
+// FROM instances
+// {{- if .project_name }}
+// LEFT JOIN projects ON instances.project_id = projects.id
+// {{- end }}
+// LEFT JOIN project_member_group_roles ON instances.id = project_member_group_roles.instance_id
+// LEFT JOIN roles ON roles.id = project_member_group_roles.role_id AND roles.deleted_at IS NULL AND roles.stat = 0
+// LEFT JOIN role_operations ON role_operations.role_id = roles.id
+// LEFT JOIN user_groups ON project_member_group_roles.user_group_id = user_groups.id AND user_groups.deleted_at IS NULL AND user_groups.stat = 0
+// JOIN user_group_users ON user_groups.id = user_group_users.user_group_id
+// JOIN users ON users.id = user_group_users.user_id AND users.deleted_at IS NULL AND users.stat=0
+// WHERE
+// instances.deleted_at IS NULL
+// AND users.id = :user_id
+// AND role_operations.op_code IN (:op_codes)
+
+// {{- if .instance_ids }}
+// AND instances.id IN (:instance_ids)
+// {{- end }}
+
+// {{- if .project_name }}
+// AND projects.name = :project_name
+// {{- end }}
+
+// {{- if .db_type }}
+// AND instances.db_type = :db_type
+// {{- end }}
+// GROUP BY instances.id
+
+// UNION
+// SELECT
+
+// {{- template "select_fields" . -}}
+
+// FROM instances
+// LEFT JOIN projects ON instances.project_id = projects.id
+// LEFT JOIN project_manager ON project_manager.project_id = projects.id
+// LEFT JOIN users ON project_manager.user_id = users.id AND users.deleted_at IS NULL AND users.stat = 0
+// WHERE
+// instances.deleted_at IS NULL
+// AND users.id = :user_id
+
+// {{- if .instance_ids }}
+// AND instances.id IN (:instance_ids)
+// {{- end }}
+
+// {{- if .project_name }}
+// AND projects.name = :project_name
+// {{- end }}
+
+// {{- if .db_type }}
+// AND instances.db_type = :db_type
+// {{- end }}
+// GROUP BY instances.id
+
+// `
+
+// func (s *Storage) filterUserHasOpInstances(user *User, instanceIds []uint, ops []uint) ([]*Instance, error) {
+// var instanceRecords []*Instance
+// data := map[string]interface{}{
+// "instance_ids": instanceIds,
+// "op_codes": ops,
+// "user_id": user.ID,
+// }
+// fields := `
+// {{ define "select_fields" }}
+// instances.id
+// {{ end }}
+// `
+// err := s.getTemplateQueryResult(data, &instanceRecords, queryInstanceUserWithOp, fields)
+// if err != nil {
+// return nil, errors.ConnectStorageErrWrapper(err)
+// }
+// return instanceRecords, nil
+// }
+
+// func (s *Storage) CheckUserHasOpToInstances(user *User, instances []*Instance, ops []uint) (bool, error) {
+// instanceIds := getDeduplicatedInstanceIds(instances)
+// instanceRecords, err := s.filterUserHasOpInstances(user, instanceIds, ops)
+// if err != nil {
+// return false, err
+// }
+// return len(instanceRecords) == len(instanceIds), nil
+// }
+
+// func (s *Storage) CheckUserHasOpToAnyInstance(user *User, instances []*Instance, ops []uint) (bool, error) {
+// instanceIds := getDeduplicatedInstanceIds(instances)
+// instanceRecords, err := s.filterUserHasOpInstances(user, instanceIds, ops)
+// if err != nil {
+// return false, err
+// }
+// return len(instanceRecords) > 0, nil
+// }
+
+// func (s *Storage) GetUserCanOpInstances(user *User, ops []uint) ([]*Instance, error) {
+// var instances []*Instance
+// data := map[string]interface{}{
+// "op_codes": ops,
+// "user_id": user.ID,
+// }
+// fields := `
+// {{ define "select_fields" }}
+// instances.id, instances.name
+// {{ end }}
+// `
+// err := s.getTemplateQueryResult(data, &instances, queryInstanceUserWithOp, fields)
+// if err != nil {
+// return instances, errors.ConnectStorageErrWrapper(err)
+// }
+// return instances, nil
+// }
+
+// func (s *Storage) GetUserCanOpInstancesFromProject(user *User, projectName string, ops []uint) ([]*Instance, error) {
+// var instances []*Instance
+// data := map[string]interface{}{
+// "op_codes": ops,
+// "user_id": user.ID,
+// "project_name": projectName,
+// }
+// fields := `
+// {{ define "select_fields" }}
+// instances.id, instances.name
+// {{ end }}
+// `
+// err := s.getTemplateQueryResult(data, &instances, queryInstanceUserWithOp, fields)
+// if err != nil {
+// return instances, errors.ConnectStorageErrWrapper(err)
+// }
+// return instances, nil
+// }
+
+// func (s *Storage) GetInstanceTipsByUserAndOperation(user *User, dbType, projectName string, opCode ...int) (
+// instances []*Instance, err error) {
+
+// isProjectManager, err := s.IsProjectManager(user.Name, projectName)
+// if err != nil {
+// return nil, err
+// }
+
+// if IsDefaultAdminUser(user.Name) || isProjectManager {
+// return s.GetInstanceTipsByTypeAndTempID(dbType, 0, projectName)
+// }
+// return s.getInstanceTipsByUserAndOperation(user, dbType, projectName, opCode...)
+// }
+
+// func (s *Storage) getInstanceTipsByUserAndOperation(user *User, dbType string, projectName string, opCode ...int) ([]*Instance, error) {
+// var instances []*Instance
+// data := map[string]interface{}{
+// "op_codes": opCode,
+// "user_id": user.ID,
+// "project_name": projectName,
+// "db_type": dbType,
+// }
+// fields := `
+// {{ define "select_fields" }}
+// instances.id, instances.name, instances.db_host as host, instances.db_port as port, instances.db_type
+// {{ end }}
+// `
+// err := s.getTemplateQueryResult(data, &instances, queryInstanceUserWithOp, fields)
+// if err != nil {
+// return instances, errors.ConnectStorageErrWrapper(err)
+// }
+// return instances, nil
+// }
+
+// func (s *Storage) UserCanAccessInstance(user *User, instance *Instance) (
+// ok bool, err error) {
+
+// isManager, err := s.IsProjectManagerByID(user.ID, instance.ProjectId)
+// if err != nil {
+// return false, err
+// }
+
+// if IsDefaultAdminUser(user.Name) || isManager {
+// return true, nil
+// }
+
+// type countStruct struct {
+// Count int `json:"count"`
+// }
+
+// query := `
+// SELECT COUNT(1) AS count
+// FROM instances
+// LEFT JOIN project_member_roles ON project_member_roles.instance_id = instances.id
+// LEFT JOIN users ON users.id = project_member_roles.user_id
+// WHERE instances.deleted_at IS NULL
+// AND users.stat = 0
+// AND users.deleted_at IS NULL
+// AND instances.id = ?
+// AND users.id = ?
+// GROUP BY instances.id
+// UNION
+// SELECT instances.id
+// FROM instances
+// LEFT JOIN project_member_group_roles ON project_member_group_roles.instance_id = instances.id
+// JOIN user_group_users ON project_member_group_roles.user_group_id = user_group_users.user_group_id
+// JOIN users ON users.id = user_group_users.user_id
+// WHERE instances.deleted_at IS NULL
+// AND users.stat = 0
+// AND users.deleted_at IS NULL
+// AND instances.id = ?
+// AND users.id = ?
+// GROUP BY instances.id
+// `
+// var cnt countStruct
+// err = s.db.Unscoped().Raw(query, instance.ID, user.ID, instance.ID, user.ID).Scan(&cnt).Error
+// if err != nil {
+// if gorm.IsRecordNotFoundError(err) {
+// return false, nil
+// }
+// return false, errors.New(errors.ConnectStorageError, err)
+// }
+// return cnt.Count > 0, nil
+// }
+
+// func (s *Storage) GetWithOperationUserFromInstance(instance *Instance, opCode ...int) (users []*User, err error) {
+// query := `
+// SELECT users.id, users.login_name
+// FROM users
+// LEFT JOIN project_member_roles ON users.id = project_member_roles.user_id
+// LEFT JOIN roles ON project_member_roles.role_id = roles.id AND roles.deleted_at IS NULL AND roles.stat = 0
+// LEFT JOIN role_operations ON role_operations.role_id = roles.id
+// WHERE
+// users.deleted_at IS NULL
+// AND users.stat = 0
+// AND project_member_roles.instance_id = ?
+// AND role_operations.op_code IN (?)
+
+// UNION
+// SELECT users.id, users.login_name
+// FROM users
+// LEFT JOIN user_group_users ON users.id = user_group_users.user_id
+// LEFT JOIN user_groups ON user_group_users.user_group_id = user_groups.id AND user_groups.stat = 0
+// LEFT JOIN project_member_group_roles ON user_groups.id = project_member_group_roles.user_group_id
+// LEFT JOIN roles ON project_member_group_roles.role_id = roles.id AND roles.deleted_at IS NULL AND roles.stat = 0
+// LEFT JOIN role_operations ON role_operations.role_id = roles.id
+// WHERE
+// users.deleted_at IS NULL
+// AND users.stat = 0
+// AND project_member_group_roles.instance_id = ?
+// AND role_operations.op_code IN (?)
+// `
+// err = s.db.Raw(query, instance.ID, opCode, instance.ID, opCode).Scan(&users).Error
+// if err != nil {
+// return nil, errors.ConnectStorageErrWrapper(err)
+// }
+// return
+// }
+
+// /*
+
+// workflow permission.
+
+// */
+
+// func (s *Storage) UserCanAccessWorkflow(user *User, workflow *Workflow) (bool, error) {
+// query := `SELECT count(w.id) FROM workflows AS w
+// JOIN workflow_records AS wr ON w.workflow_record_id = wr.id AND w.id = ?
+// LEFT JOIN workflow_steps AS cur_ws ON wr.current_workflow_step_id = cur_ws.id
+// LEFT JOIN workflow_step_templates AS cur_wst ON cur_ws.workflow_step_template_id = cur_wst.id
+// LEFT JOIN workflow_step_user AS cur_wst_re_user ON cur_ws.id = cur_wst_re_user.workflow_step_id
+// LEFT JOIN users AS cur_ass_user ON cur_wst_re_user.user_id = cur_ass_user.id AND cur_ass_user.stat=0
+// LEFT JOIN workflow_steps AS op_ws ON w.id = op_ws.workflow_id AND op_ws.state != "initialized"
+// LEFT JOIN workflow_step_templates AS op_wst ON op_ws.workflow_step_template_id = op_wst.id
+// LEFT JOIN workflow_step_user AS op_wst_re_user ON op_ws.id = op_wst_re_user.workflow_step_id
+// LEFT JOIN users AS op_ass_user ON op_wst_re_user.user_id = op_ass_user.id AND op_ass_user.stat=0
+// where w.deleted_at IS NULL
+// AND (w.create_user_id = ? OR cur_ass_user.id = ? OR op_ass_user.id = ?)
+// `
+// var count uint
+// err := s.db.Raw(query, workflow.ID, user.ID, user.ID, user.ID).Count(&count).Error
+// if err != nil {
+// return false, errors.New(errors.ConnectStorageError, err)
+// }
+// return count > 0, nil
+// }
+
+// /*
+
+// workflow permission. TODO DMS权限接口替换掉UserCanAccessWorkflow
+
+// 去除了与用户表关联关系(TODO 用户不可用时需要判断)
+// LEFT JOIN users AS cur_ass_user ON cur_wst_re_user.user_id = cur_ass_user.id AND cur_ass_user.stat=0
+// LEFT JOIN users AS op_ass_user ON op_wst_re_user.user_id = op_ass_user.id AND op_ass_user.stat=0
+// LEFT JOIN workflow_step_user AS cur_wst_re_user ON cur_ws.id = cur_wst_re_user.workflow_step_id
+// LEFT JOIN workflow_step_user AS op_wst_re_user ON op_ws.id = op_wst_re_user.workflow_step_id
+// */
+
+func (s *Storage) UserCanAccessWorkflow(userId string, workflow *Workflow) (bool, error) {
query := `SELECT count(w.id) FROM workflows AS w
-JOIN workflow_records AS wr ON w.workflow_record_id = wr.id AND w.id = ?
+JOIN workflow_records AS wr ON w.workflow_record_id = wr.id AND w.workflow_id = ?
LEFT JOIN workflow_steps AS cur_ws ON wr.current_workflow_step_id = cur_ws.id
LEFT JOIN workflow_step_templates AS cur_wst ON cur_ws.workflow_step_template_id = cur_wst.id
-LEFT JOIN workflow_step_user AS cur_wst_re_user ON cur_ws.id = cur_wst_re_user.workflow_step_id
-LEFT JOIN users AS cur_ass_user ON cur_wst_re_user.user_id = cur_ass_user.id AND cur_ass_user.stat=0
LEFT JOIN workflow_steps AS op_ws ON w.id = op_ws.workflow_id AND op_ws.state != "initialized"
LEFT JOIN workflow_step_templates AS op_wst ON op_ws.workflow_step_template_id = op_wst.id
-LEFT JOIN workflow_step_user AS op_wst_re_user ON op_ws.id = op_wst_re_user.workflow_step_id
-LEFT JOIN users AS op_ass_user ON op_wst_re_user.user_id = op_ass_user.id AND op_ass_user.stat=0
where w.deleted_at IS NULL
-AND (w.create_user_id = ? OR cur_ass_user.id = ? OR op_ass_user.id = ?)
+AND (w.create_user_id = ? OR cur_ws.assignees REGEXP ? OR op_ws.assignees REGEXP ?)
`
var count uint
- err := s.db.Raw(query, workflow.ID, user.ID, user.ID, user.ID).Count(&count).Error
+ err := s.db.Raw(query, workflow.WorkflowId, userId, userId, userId).Count(&count).Error
if err != nil {
return false, errors.New(errors.ConnectStorageError, err)
}
return count > 0, nil
}
-// GetCanAuditWorkflowUsers will return admin user if no qualified user is found, preventing the process from being stuck because no user can operate
-func (s *Storage) GetCanAuditWorkflowUsers(instance *Instance) (users []*User, err error) {
- users, err = s.GetWithOperationUserFromInstance(instance, OP_WORKFLOW_AUDIT)
- if err != nil {
- return
- }
- if len(users) != 0 {
- return
- }
- return s.GetUsersByNames([]string{DefaultAdminUser})
-}
-
-// GetCanExecuteWorkflowUsers will return admin user if no qualified user is found, preventing the process from being stuck because no user can operate
-func (s *Storage) GetCanExecuteWorkflowUsers(instance *Instance) (users []*User, err error) {
- users, err = s.GetWithOperationUserFromInstance(instance, OP_WORKFLOW_EXECUTE)
- if err != nil {
- return
- }
- if len(users) != 0 {
- return
- }
- return s.GetUsersByNames([]string{DefaultAdminUser})
-}
-
-/*
-
-audit plan permission.
-
-*/
-
-func (s *Storage) CheckUserCanCreateAuditPlan(user *User, projectName, instName string) (bool, error) {
- if IsDefaultAdminUser(user.Name) {
- return true, nil
- }
-
- isManager, err := s.IsProjectManager(user.Name, projectName)
- if err != nil {
- return false, err
- }
-
- if isManager {
- return true, nil
- }
-
- // todo: check it in db, don't get all instances.
- instances, err := s.GetUserCanOpInstancesFromProject(user, projectName, []uint{OP_AUDIT_PLAN_SAVE})
- if err != nil {
- return false, err
- }
- for _, instance := range instances {
- if instName == instance.Name {
- return true, nil
- }
- }
- return false, nil
-}
-
-/*
-
-project permission.
-
-*/
-
-func (s *Storage) CheckUserCanUpdateProject(projectName string, userID uint) (bool, error) {
- user, exist, err := s.GetUserByID(userID)
- if err != nil || !exist {
- return false, err
- }
-
- if user.Name == DefaultAdminUser {
- return true, nil
- }
-
- project, exist, err := s.GetProjectByName(projectName)
- if err != nil || !exist {
- return false, err
- }
-
- for _, manager := range project.Managers {
- if manager.ID == userID {
- return true, nil
- }
- }
- return false, nil
-}
-
-func (s *Storage) IsProjectManager(userName string, projectName string) (bool, error) {
- var count uint
-
- err := s.db.Table("project_manager").
- Joins("LEFT JOIN projects ON projects.id = project_manager.project_id").
- Joins("LEFT JOIN users ON project_manager.user_id = users.id").
- Where("users.login_name = ?", userName).
- Where("users.stat = 0").
- Where("projects.name = ?", projectName).
- Where("users.deleted_at IS NULL").
- Where("projects.deleted_at IS NULL").
- Count(&count).Error
-
- return count > 0, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) IsProjectManagerByID(userID, projectID uint) (bool, error) {
- var count uint
-
- err := s.db.Table("project_manager").
- Joins("LEFT JOIN projects ON projects.id = project_manager.project_id").
- Joins("LEFT JOIN users ON project_manager.user_id = users.id").
- Where("users.id = ?", userID).
- Where("users.stat = 0").
- Where("project_manager.project_id = ?", projectID).
- Where("users.deleted_at IS NULL").
- Where("projects.deleted_at IS NULL").
- Count(&count).Error
-
- return count > 0, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) IsProjectMember(userName, projectName string) (bool, error) {
- query := `
-SELECT EXISTS(
-SELECT users.login_name
-FROM users
-LEFT JOIN project_user on project_user.user_id = users.id
-LEFT JOIN projects on project_user.project_id = projects.id
-LEFT JOIN user_group_users on users.id = user_group_users.user_id
-LEFT JOIN project_user_group on user_group_users.user_group_id = project_user_group.user_group_id
-LEFT JOIN projects as p on project_user_group.project_id = p.id
-WHERE users.stat = 0
-AND users.login_name = ?
-AND(
- projects.name = ?
-OR
- p.name = ?
-)) AS exist
-`
- var exist struct {
- Exist bool `json:"exist"`
- }
- err := s.db.Raw(query, userName, projectName, projectName).Find(&exist).Error
- return exist.Exist, errors.New(errors.ConnectStorageError, err)
-}
+// // GetCanAuditWorkflowUsers will return admin user if no qualified user is found, preventing the process from being stuck because no user can operate
+// func (s *Storage) GetCanAuditWorkflowUsers(instance *Instance) (users []*User, err error) {
+// users, err = s.GetWithOperationUserFromInstance(instance, OP_WORKFLOW_AUDIT)
+// if err != nil {
+// return
+// }
+// if len(users) != 0 {
+// return
+// }
+// return s.GetUsersByNames([]string{DefaultAdminUser})
+// }
+
+// // GetCanExecuteWorkflowUsers will return admin user if no qualified user is found, preventing the process from being stuck because no user can operate
+// func (s *Storage) GetCanExecuteWorkflowUsers(instance *Instance) (users []*User, err error) {
+// users, err = s.GetWithOperationUserFromInstance(instance, OP_WORKFLOW_EXECUTE)
+// if err != nil {
+// return
+// }
+// if len(users) != 0 {
+// return
+// }
+// return s.GetUsersByNames([]string{DefaultAdminUser})
+// }
+
+// /*
+
+// audit plan permission.
+
+// */
+
+// func (s *Storage) CheckUserCanCreateAuditPlan(user *User, projectName, instName string) (bool, error) {
+// if IsDefaultAdminUser(user.Name) {
+// return true, nil
+// }
+
+// isManager, err := s.IsProjectManager(user.Name, projectName)
+// if err != nil {
+// return false, err
+// }
+
+// if isManager {
+// return true, nil
+// }
+
+// // todo: check it in db, don't get all instances.
+// instances, err := s.GetUserCanOpInstancesFromProject(user, projectName, []uint{OP_AUDIT_PLAN_SAVE})
+// if err != nil {
+// return false, err
+// }
+// for _, instance := range instances {
+// if instName == instance.Name {
+// return true, nil
+// }
+// }
+// return false, nil
+// }
+
+// /*
+
+// project permission.
+
+// */
+
+// func (s *Storage) CheckUserCanUpdateProject(projectName string, userID uint) (bool, error) {
+// user, exist, err := s.GetUserByID(userID)
+// if err != nil || !exist {
+// return false, err
+// }
+
+// if user.Name == DefaultAdminUser {
+// return true, nil
+// }
+
+// project, exist, err := s.GetProjectByName(projectName)
+// if err != nil || !exist {
+// return false, err
+// }
+
+// for _, manager := range project.Managers {
+// if manager.ID == userID {
+// return true, nil
+// }
+// }
+// return false, nil
+// }
+
+// func (s *Storage) IsProjectManager(userName string, projectName string) (bool, error) {
+// var count uint
+
+// err := s.db.Table("project_manager").
+// Joins("LEFT JOIN projects ON projects.id = project_manager.project_id").
+// Joins("LEFT JOIN users ON project_manager.user_id = users.id").
+// Where("users.login_name = ?", userName).
+// Where("users.stat = 0").
+// Where("projects.name = ?", projectName).
+// Where("users.deleted_at IS NULL").
+// Where("projects.deleted_at IS NULL").
+// Count(&count).Error
+
+// return count > 0, errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) IsProjectManagerByID(userID, projectID uint) (bool, error) {
+// var count uint
+
+// err := s.db.Table("project_manager").
+// Joins("LEFT JOIN projects ON projects.id = project_manager.project_id").
+// Joins("LEFT JOIN users ON project_manager.user_id = users.id").
+// Where("users.id = ?", userID).
+// Where("users.stat = 0").
+// Where("project_manager.project_id = ?", projectID).
+// Where("users.deleted_at IS NULL").
+// Where("projects.deleted_at IS NULL").
+// Count(&count).Error
+
+// return count > 0, errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) IsProjectMember(userName, projectName string) (bool, error) {
+// query := `
+// SELECT EXISTS(
+// SELECT users.login_name
+// FROM users
+// LEFT JOIN project_user on project_user.user_id = users.id
+// LEFT JOIN projects on project_user.project_id = projects.id
+// LEFT JOIN user_group_users on users.id = user_group_users.user_id
+// LEFT JOIN project_user_group on user_group_users.user_group_id = project_user_group.user_group_id
+// LEFT JOIN projects as p on project_user_group.project_id = p.id
+// WHERE users.stat = 0
+// AND users.login_name = ?
+// AND(
+// projects.name = ?
+// OR
+// p.name = ?
+// )) AS exist
+// `
+// var exist struct {
+// Exist bool `json:"exist"`
+// }
+// err := s.db.Raw(query, userName, projectName, projectName).Find(&exist).Error
+// return exist.Exist, errors.New(errors.ConnectStorageError, err)
+// }
diff --git a/sqle/model/project_permission_test.go b/sqle/model/project_permission_test.go
index 30bd796e89..93d682ffc5 100644
--- a/sqle/model/project_permission_test.go
+++ b/sqle/model/project_permission_test.go
@@ -1,268 +1,268 @@
package model
-import (
- "testing"
+// import (
+// "testing"
- sqlmock "github.com/DATA-DOG/go-sqlmock"
- "github.com/stretchr/testify/assert"
-)
+// sqlmock "github.com/DATA-DOG/go-sqlmock"
+// "github.com/stretchr/testify/assert"
+// )
-func TestStorage_CheckUserHasOpToInstances(t *testing.T) {
- // 1. test for common user
- query := `
-SELECT
-instances.id
-FROM instances
-LEFT JOIN project_member_roles ON instances.id = project_member_roles.instance_id
-LEFT JOIN users ON project_member_roles.user_id = users.id AND users.deleted_at IS NULL AND users.stat = 0
-LEFT JOIN roles ON project_member_roles.role_id = roles.id AND roles.deleted_at IS NULL AND roles.stat = 0
-LEFT JOIN role_operations ON role_operations.role_id = roles.id
-WHERE
-instances.deleted_at IS NULL
-AND users.id = ?
-AND role_operations.op_code IN (?)
-AND instances.id IN (?, ?)
-GROUP BY instances.id
+// func TestStorage_CheckUserHasOpToInstances(t *testing.T) {
+// // 1. test for common user
+// query := `
+// SELECT
+// instances.id
+// FROM instances
+// LEFT JOIN project_member_roles ON instances.id = project_member_roles.instance_id
+// LEFT JOIN users ON project_member_roles.user_id = users.id AND users.deleted_at IS NULL AND users.stat = 0
+// LEFT JOIN roles ON project_member_roles.role_id = roles.id AND roles.deleted_at IS NULL AND roles.stat = 0
+// LEFT JOIN role_operations ON role_operations.role_id = roles.id
+// WHERE
+// instances.deleted_at IS NULL
+// AND users.id = ?
+// AND role_operations.op_code IN (?)
+// AND instances.id IN (?, ?)
+// GROUP BY instances.id
-UNION
-SELECT
-instances.id
-FROM instances
-LEFT JOIN project_member_group_roles ON instances.id = project_member_group_roles.instance_id
-LEFT JOIN roles ON roles.id = project_member_group_roles.role_id AND roles.deleted_at IS NULL AND roles.stat = 0
-LEFT JOIN role_operations ON role_operations.role_id = roles.id
-LEFT JOIN user_groups ON project_member_group_roles.user_group_id = user_groups.id AND user_groups.deleted_at IS NULL AND user_groups.stat = 0
-JOIN user_group_users ON user_groups.id = user_group_users.user_group_id
-JOIN users ON users.id = user_group_users.user_id AND users.deleted_at IS NULL AND users.stat=0
-WHERE
-instances.deleted_at IS NULL
-AND users.id = ?
-AND role_operations.op_code IN (?)
-AND instances.id IN (?, ?)
-GROUP BY instances.id
+// UNION
+// SELECT
+// instances.id
+// FROM instances
+// LEFT JOIN project_member_group_roles ON instances.id = project_member_group_roles.instance_id
+// LEFT JOIN roles ON roles.id = project_member_group_roles.role_id AND roles.deleted_at IS NULL AND roles.stat = 0
+// LEFT JOIN role_operations ON role_operations.role_id = roles.id
+// LEFT JOIN user_groups ON project_member_group_roles.user_group_id = user_groups.id AND user_groups.deleted_at IS NULL AND user_groups.stat = 0
+// JOIN user_group_users ON user_groups.id = user_group_users.user_group_id
+// JOIN users ON users.id = user_group_users.user_id AND users.deleted_at IS NULL AND users.stat=0
+// WHERE
+// instances.deleted_at IS NULL
+// AND users.id = ?
+// AND role_operations.op_code IN (?)
+// AND instances.id IN (?, ?)
+// GROUP BY instances.id
-UNION
-SELECT instances.id
-FROM instances
-LEFT JOIN projects ON instances.project_id = projects.id
-LEFT JOIN project_manager ON project_manager.project_id = projects.id
-LEFT JOIN users ON project_manager.user_id = users.id AND users.deleted_at IS NULL AND users.stat = 0
-WHERE instances.deleted_at IS NULL
-AND users.id = ?
-AND instances.id IN (?, ?)
-GROUP BY instances.id
-`
- mockDB, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
- assert.NoError(t, err)
- InitMockStorage(mockDB)
- mock.ExpectQuery(query).WithArgs(1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2).
- WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(1).AddRow(2))
+// UNION
+// SELECT instances.id
+// FROM instances
+// LEFT JOIN projects ON instances.project_id = projects.id
+// LEFT JOIN project_manager ON project_manager.project_id = projects.id
+// LEFT JOIN users ON project_manager.user_id = users.id AND users.deleted_at IS NULL AND users.stat = 0
+// WHERE instances.deleted_at IS NULL
+// AND users.id = ?
+// AND instances.id IN (?, ?)
+// GROUP BY instances.id
+// `
+// mockDB, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
+// assert.NoError(t, err)
+// InitMockStorage(mockDB)
+// mock.ExpectQuery(query).WithArgs(1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2).
+// WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(1).AddRow(2))
- inst1 := &Instance{}
- inst1.ID = 1
- inst2 := &Instance{}
- inst2.ID = 2
+// inst1 := &Instance{}
+// inst1.ID = 1
+// inst2 := &Instance{}
+// inst2.ID = 2
- user := &User{}
- user.ID = 1
- exist, err := GetStorage().CheckUserHasOpToInstances(user, []*Instance{inst1, inst2}, []uint{1})
- assert.NoError(t, err)
- assert.Equal(t, true, exist)
- mockDB.Close()
-}
+// user := &User{}
+// user.ID = 1
+// exist, err := GetStorage().CheckUserHasOpToInstances(user, []*Instance{inst1, inst2}, []uint{1})
+// assert.NoError(t, err)
+// assert.Equal(t, true, exist)
+// mockDB.Close()
+// }
-func Test_GetUserCanOpInstances(t *testing.T) {
- query := `
- SELECT
- instances.id, instances.name
- FROM instances
- LEFT JOIN project_member_roles ON instances.id = project_member_roles.instance_id
- LEFT JOIN users ON project_member_roles.user_id = users.id AND users.deleted_at IS NULL AND users.stat = 0
- LEFT JOIN roles ON project_member_roles.role_id = roles.id AND roles.deleted_at IS NULL AND roles.stat = 0
- LEFT JOIN role_operations ON role_operations.role_id = roles.id
- WHERE
- instances.deleted_at IS NULL
- AND users.id = ?
- AND role_operations.op_code IN (?, ?, ?)
- GROUP BY instances.id
+// func Test_GetUserCanOpInstances(t *testing.T) {
+// query := `
+// SELECT
+// instances.id, instances.name
+// FROM instances
+// LEFT JOIN project_member_roles ON instances.id = project_member_roles.instance_id
+// LEFT JOIN users ON project_member_roles.user_id = users.id AND users.deleted_at IS NULL AND users.stat = 0
+// LEFT JOIN roles ON project_member_roles.role_id = roles.id AND roles.deleted_at IS NULL AND roles.stat = 0
+// LEFT JOIN role_operations ON role_operations.role_id = roles.id
+// WHERE
+// instances.deleted_at IS NULL
+// AND users.id = ?
+// AND role_operations.op_code IN (?, ?, ?)
+// GROUP BY instances.id
- UNION
- SELECT
- instances.id, instances.name
- FROM instances
- LEFT JOIN project_member_group_roles ON instances.id = project_member_group_roles.instance_id
- LEFT JOIN roles ON roles.id = project_member_group_roles.role_id AND roles.deleted_at IS NULL AND roles.stat = 0
- LEFT JOIN role_operations ON role_operations.role_id = roles.id
- LEFT JOIN user_groups ON project_member_group_roles.user_group_id = user_groups.id AND user_groups.deleted_at IS NULL AND user_groups.stat = 0
- JOIN user_group_users ON user_groups.id = user_group_users.user_group_id
- JOIN users ON users.id = user_group_users.user_id AND users.deleted_at IS NULL AND users.stat=0
- WHERE
- instances.deleted_at IS NULL
- AND users.id = ?
- AND role_operations.op_code IN (?, ?, ?)
- GROUP BY instances.id
+// UNION
+// SELECT
+// instances.id, instances.name
+// FROM instances
+// LEFT JOIN project_member_group_roles ON instances.id = project_member_group_roles.instance_id
+// LEFT JOIN roles ON roles.id = project_member_group_roles.role_id AND roles.deleted_at IS NULL AND roles.stat = 0
+// LEFT JOIN role_operations ON role_operations.role_id = roles.id
+// LEFT JOIN user_groups ON project_member_group_roles.user_group_id = user_groups.id AND user_groups.deleted_at IS NULL AND user_groups.stat = 0
+// JOIN user_group_users ON user_groups.id = user_group_users.user_group_id
+// JOIN users ON users.id = user_group_users.user_id AND users.deleted_at IS NULL AND users.stat=0
+// WHERE
+// instances.deleted_at IS NULL
+// AND users.id = ?
+// AND role_operations.op_code IN (?, ?, ?)
+// GROUP BY instances.id
- UNION
- SELECT
- instances.id, instances.name
- FROM instances
- LEFT JOIN projects ON instances.project_id = projects.id
- LEFT JOIN project_manager ON project_manager.project_id = projects.id
- LEFT JOIN users ON project_manager.user_id = users.id AND users.deleted_at IS NULL AND users.stat = 0
- WHERE
- instances.deleted_at IS NULL
- AND users.id = ?
- GROUP BY instances.id
- `
- mockDB, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
- assert.NoError(t, err)
- InitMockStorage(mockDB)
- mock.ExpectQuery(query).WithArgs(1, 1, 2, 3, 1, 1, 2, 3, 1).
- WillReturnRows(sqlmock.NewRows([]string{"id", "name"}).AddRow(1, "inst_1").AddRow(2, "inst_2"))
+// UNION
+// SELECT
+// instances.id, instances.name
+// FROM instances
+// LEFT JOIN projects ON instances.project_id = projects.id
+// LEFT JOIN project_manager ON project_manager.project_id = projects.id
+// LEFT JOIN users ON project_manager.user_id = users.id AND users.deleted_at IS NULL AND users.stat = 0
+// WHERE
+// instances.deleted_at IS NULL
+// AND users.id = ?
+// GROUP BY instances.id
+// `
+// mockDB, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
+// assert.NoError(t, err)
+// InitMockStorage(mockDB)
+// mock.ExpectQuery(query).WithArgs(1, 1, 2, 3, 1, 1, 2, 3, 1).
+// WillReturnRows(sqlmock.NewRows([]string{"id", "name"}).AddRow(1, "inst_1").AddRow(2, "inst_2"))
- user := &User{}
- user.ID = 1
- instances, err := GetStorage().GetUserCanOpInstances(user, []uint{1, 2, 3})
- assert.NoError(t, err)
- assert.Equal(t, 2, len(instances))
- assert.Equal(t, uint(1), instances[0].ID)
- assert.Equal(t, "inst_1", instances[0].Name)
- assert.Equal(t, uint(2), instances[1].ID)
- assert.Equal(t, "inst_2", instances[1].Name)
- mockDB.Close()
-}
+// user := &User{}
+// user.ID = 1
+// instances, err := GetStorage().GetUserCanOpInstances(user, []uint{1, 2, 3})
+// assert.NoError(t, err)
+// assert.Equal(t, 2, len(instances))
+// assert.Equal(t, uint(1), instances[0].ID)
+// assert.Equal(t, "inst_1", instances[0].Name)
+// assert.Equal(t, uint(2), instances[1].ID)
+// assert.Equal(t, "inst_2", instances[1].Name)
+// mockDB.Close()
+// }
-func Test_GetUserCanOpInstancesFromProject(t *testing.T) {
- query := `
- SELECT
- instances.id, instances.name
- FROM instances
- LEFT JOIN projects ON instances.project_id = projects.id
- LEFT JOIN project_member_roles ON instances.id = project_member_roles.instance_id
- LEFT JOIN users ON project_member_roles.user_id = users.id AND users.deleted_at IS NULL AND users.stat = 0
- LEFT JOIN roles ON project_member_roles.role_id = roles.id AND roles.deleted_at IS NULL AND roles.stat = 0
- LEFT JOIN role_operations ON role_operations.role_id = roles.id
- WHERE
- instances.deleted_at IS NULL
- AND users.id = ?
- AND role_operations.op_code IN (?)
- AND projects.name = ?
- GROUP BY instances.id
+// func Test_GetUserCanOpInstancesFromProject(t *testing.T) {
+// query := `
+// SELECT
+// instances.id, instances.name
+// FROM instances
+// LEFT JOIN projects ON instances.project_id = projects.id
+// LEFT JOIN project_member_roles ON instances.id = project_member_roles.instance_id
+// LEFT JOIN users ON project_member_roles.user_id = users.id AND users.deleted_at IS NULL AND users.stat = 0
+// LEFT JOIN roles ON project_member_roles.role_id = roles.id AND roles.deleted_at IS NULL AND roles.stat = 0
+// LEFT JOIN role_operations ON role_operations.role_id = roles.id
+// WHERE
+// instances.deleted_at IS NULL
+// AND users.id = ?
+// AND role_operations.op_code IN (?)
+// AND projects.name = ?
+// GROUP BY instances.id
- UNION
- SELECT
- instances.id, instances.name
- FROM instances
- LEFT JOIN projects ON instances.project_id = projects.id
- LEFT JOIN project_member_group_roles ON instances.id = project_member_group_roles.instance_id
- LEFT JOIN roles ON roles.id = project_member_group_roles.role_id AND roles.deleted_at IS NULL AND roles.stat = 0
- LEFT JOIN role_operations ON role_operations.role_id = roles.id
- LEFT JOIN user_groups ON project_member_group_roles.user_group_id = user_groups.id AND user_groups.deleted_at IS NULL AND user_groups.stat = 0
- JOIN user_group_users ON user_groups.id = user_group_users.user_group_id
- JOIN users ON users.id = user_group_users.user_id AND users.deleted_at IS NULL AND users.stat=0
- WHERE
- instances.deleted_at IS NULL
- AND users.id = ?
- AND role_operations.op_code IN (?)
- AND projects.name = ?
- GROUP BY instances.id
+// UNION
+// SELECT
+// instances.id, instances.name
+// FROM instances
+// LEFT JOIN projects ON instances.project_id = projects.id
+// LEFT JOIN project_member_group_roles ON instances.id = project_member_group_roles.instance_id
+// LEFT JOIN roles ON roles.id = project_member_group_roles.role_id AND roles.deleted_at IS NULL AND roles.stat = 0
+// LEFT JOIN role_operations ON role_operations.role_id = roles.id
+// LEFT JOIN user_groups ON project_member_group_roles.user_group_id = user_groups.id AND user_groups.deleted_at IS NULL AND user_groups.stat = 0
+// JOIN user_group_users ON user_groups.id = user_group_users.user_group_id
+// JOIN users ON users.id = user_group_users.user_id AND users.deleted_at IS NULL AND users.stat=0
+// WHERE
+// instances.deleted_at IS NULL
+// AND users.id = ?
+// AND role_operations.op_code IN (?)
+// AND projects.name = ?
+// GROUP BY instances.id
- UNION
- SELECT
- instances.id, instances.name
- FROM instances
- LEFT JOIN projects ON instances.project_id = projects.id
- LEFT JOIN project_manager ON project_manager.project_id = projects.id
- LEFT JOIN users ON project_manager.user_id = users.id AND users.deleted_at IS NULL AND users.stat = 0
- WHERE
- instances.deleted_at IS NULL
- AND users.id = ?
- AND projects.name = ?
- GROUP BY instances.id
- `
- mockDB, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
- assert.NoError(t, err)
- InitMockStorage(mockDB)
- mock.ExpectQuery(query).WithArgs(1, 1, "project_1", 1, 1, "project_1", 1, "project_1").
- WillReturnRows(sqlmock.NewRows([]string{"id", "name"}).AddRow(1, "inst_1").AddRow(2, "inst_2"))
+// UNION
+// SELECT
+// instances.id, instances.name
+// FROM instances
+// LEFT JOIN projects ON instances.project_id = projects.id
+// LEFT JOIN project_manager ON project_manager.project_id = projects.id
+// LEFT JOIN users ON project_manager.user_id = users.id AND users.deleted_at IS NULL AND users.stat = 0
+// WHERE
+// instances.deleted_at IS NULL
+// AND users.id = ?
+// AND projects.name = ?
+// GROUP BY instances.id
+// `
+// mockDB, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
+// assert.NoError(t, err)
+// InitMockStorage(mockDB)
+// mock.ExpectQuery(query).WithArgs(1, 1, "project_1", 1, 1, "project_1", 1, "project_1").
+// WillReturnRows(sqlmock.NewRows([]string{"id", "name"}).AddRow(1, "inst_1").AddRow(2, "inst_2"))
- user := &User{}
- user.ID = 1
- instances, err := GetStorage().GetUserCanOpInstancesFromProject(user, "project_1", []uint{1})
- assert.NoError(t, err)
- assert.Equal(t, 2, len(instances))
- assert.Equal(t, uint(1), instances[0].ID)
- assert.Equal(t, "inst_1", instances[0].Name)
- assert.Equal(t, uint(2), instances[1].ID)
- assert.Equal(t, "inst_2", instances[1].Name)
- mockDB.Close()
-}
+// user := &User{}
+// user.ID = 1
+// instances, err := GetStorage().GetUserCanOpInstancesFromProject(user, "project_1", []uint{1})
+// assert.NoError(t, err)
+// assert.Equal(t, 2, len(instances))
+// assert.Equal(t, uint(1), instances[0].ID)
+// assert.Equal(t, "inst_1", instances[0].Name)
+// assert.Equal(t, uint(2), instances[1].ID)
+// assert.Equal(t, "inst_2", instances[1].Name)
+// mockDB.Close()
+// }
-func Test_GetInstanceTipsByUserAndOperation(t *testing.T) {
- query := `
- SELECT
- instances.id, instances.name, instances.db_host as host, instances.db_port as port, instances.db_type
- FROM instances
- LEFT JOIN projects ON instances.project_id = projects.id
- LEFT JOIN project_member_roles ON instances.id = project_member_roles.instance_id
- LEFT JOIN users ON project_member_roles.user_id = users.id AND users.deleted_at IS NULL AND users.stat = 0
- LEFT JOIN roles ON project_member_roles.role_id = roles.id AND roles.deleted_at IS NULL AND roles.stat = 0
- LEFT JOIN role_operations ON role_operations.role_id = roles.id
- WHERE
- instances.deleted_at IS NULL
- AND users.id = ?
- AND role_operations.op_code IN (?, ?)
- AND projects.name = ?
- AND instances.db_type = ?
- GROUP BY instances.id
+// func Test_GetInstanceTipsByUserAndOperation(t *testing.T) {
+// query := `
+// SELECT
+// instances.id, instances.name, instances.db_host as host, instances.db_port as port, instances.db_type
+// FROM instances
+// LEFT JOIN projects ON instances.project_id = projects.id
+// LEFT JOIN project_member_roles ON instances.id = project_member_roles.instance_id
+// LEFT JOIN users ON project_member_roles.user_id = users.id AND users.deleted_at IS NULL AND users.stat = 0
+// LEFT JOIN roles ON project_member_roles.role_id = roles.id AND roles.deleted_at IS NULL AND roles.stat = 0
+// LEFT JOIN role_operations ON role_operations.role_id = roles.id
+// WHERE
+// instances.deleted_at IS NULL
+// AND users.id = ?
+// AND role_operations.op_code IN (?, ?)
+// AND projects.name = ?
+// AND instances.db_type = ?
+// GROUP BY instances.id
- UNION
- SELECT
- instances.id, instances.name, instances.db_host as host, instances.db_port as port, instances.db_type
- FROM instances
- LEFT JOIN projects ON instances.project_id = projects.id
- LEFT JOIN project_member_group_roles ON instances.id = project_member_group_roles.instance_id
- LEFT JOIN roles ON roles.id = project_member_group_roles.role_id AND roles.deleted_at IS NULL AND roles.stat = 0
- LEFT JOIN role_operations ON role_operations.role_id = roles.id
- LEFT JOIN user_groups ON project_member_group_roles.user_group_id = user_groups.id AND user_groups.deleted_at IS NULL AND user_groups.stat = 0
- JOIN user_group_users ON user_groups.id = user_group_users.user_group_id
- JOIN users ON users.id = user_group_users.user_id AND users.deleted_at IS NULL AND users.stat=0
- WHERE
- instances.deleted_at IS NULL
- AND users.id = ?
- AND role_operations.op_code IN (?, ?)
- AND projects.name = ?
- AND instances.db_type = ?
- GROUP BY instances.id
+// UNION
+// SELECT
+// instances.id, instances.name, instances.db_host as host, instances.db_port as port, instances.db_type
+// FROM instances
+// LEFT JOIN projects ON instances.project_id = projects.id
+// LEFT JOIN project_member_group_roles ON instances.id = project_member_group_roles.instance_id
+// LEFT JOIN roles ON roles.id = project_member_group_roles.role_id AND roles.deleted_at IS NULL AND roles.stat = 0
+// LEFT JOIN role_operations ON role_operations.role_id = roles.id
+// LEFT JOIN user_groups ON project_member_group_roles.user_group_id = user_groups.id AND user_groups.deleted_at IS NULL AND user_groups.stat = 0
+// JOIN user_group_users ON user_groups.id = user_group_users.user_group_id
+// JOIN users ON users.id = user_group_users.user_id AND users.deleted_at IS NULL AND users.stat=0
+// WHERE
+// instances.deleted_at IS NULL
+// AND users.id = ?
+// AND role_operations.op_code IN (?, ?)
+// AND projects.name = ?
+// AND instances.db_type = ?
+// GROUP BY instances.id
- UNION
- SELECT
- instances.id, instances.name, instances.db_host as host, instances.db_port as port, instances.db_type
- FROM instances
- LEFT JOIN projects ON instances.project_id = projects.id
- LEFT JOIN project_manager ON project_manager.project_id = projects.id
- LEFT JOIN users ON project_manager.user_id = users.id AND users.deleted_at IS NULL AND users.stat = 0
- WHERE
- instances.deleted_at IS NULL
- AND users.id = ?
- AND projects.name = ?
- AND instances.db_type = ?
- GROUP BY instances.id
- `
- mockDB, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
- assert.NoError(t, err)
- InitMockStorage(mockDB)
- mock.ExpectQuery(query).WithArgs(1, 1, 2, "project_1", "MySQL", 1, 1, 2, "project_1", "MySQL", 1, "project_1", "MySQL").
- WillReturnRows(sqlmock.NewRows([]string{"id", "name", "db_type"}).AddRow(1, "inst_1", "MySQL").AddRow(2, "inst_2", "Oracle"))
+// UNION
+// SELECT
+// instances.id, instances.name, instances.db_host as host, instances.db_port as port, instances.db_type
+// FROM instances
+// LEFT JOIN projects ON instances.project_id = projects.id
+// LEFT JOIN project_manager ON project_manager.project_id = projects.id
+// LEFT JOIN users ON project_manager.user_id = users.id AND users.deleted_at IS NULL AND users.stat = 0
+// WHERE
+// instances.deleted_at IS NULL
+// AND users.id = ?
+// AND projects.name = ?
+// AND instances.db_type = ?
+// GROUP BY instances.id
+// `
+// mockDB, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual))
+// assert.NoError(t, err)
+// InitMockStorage(mockDB)
+// mock.ExpectQuery(query).WithArgs(1, 1, 2, "project_1", "MySQL", 1, 1, 2, "project_1", "MySQL", 1, "project_1", "MySQL").
+// WillReturnRows(sqlmock.NewRows([]string{"id", "name", "db_type"}).AddRow(1, "inst_1", "MySQL").AddRow(2, "inst_2", "Oracle"))
- user := &User{}
- user.ID = 1
- instances, err := GetStorage().getInstanceTipsByUserAndOperation(user, "MySQL", "project_1", 1, 2)
- assert.NoError(t, err)
- assert.Equal(t, 2, len(instances))
- assert.Equal(t, uint(1), instances[0].ID)
- assert.Equal(t, "MySQL", instances[0].DbType)
- assert.Equal(t, uint(2), instances[1].ID)
- assert.Equal(t, "Oracle", instances[1].DbType)
- mockDB.Close()
-}
+// user := &User{}
+// user.ID = 1
+// instances, err := GetStorage().getInstanceTipsByUserAndOperation(user, "MySQL", "project_1", 1, 2)
+// assert.NoError(t, err)
+// assert.Equal(t, 2, len(instances))
+// assert.Equal(t, uint(1), instances[0].ID)
+// assert.Equal(t, "MySQL", instances[0].DbType)
+// assert.Equal(t, uint(2), instances[1].ID)
+// assert.Equal(t, "Oracle", instances[1].DbType)
+// mockDB.Close()
+// }
diff --git a/sqle/model/role.go b/sqle/model/role.go
index 3bdf6a7879..e9305f31b3 100644
--- a/sqle/model/role.go
+++ b/sqle/model/role.go
@@ -1,451 +1,451 @@
package model
-import (
- "fmt"
- "strings"
-
- "github.com/actiontech/sqle/sqle/errors"
- "github.com/actiontech/sqle/sqle/utils"
-
- "github.com/jinzhu/gorm"
-)
-
-// NOTE: related model:
-// - RoleOperation, ProjectMemberRole, ProjectMemberGroupRole
-type Role struct {
- Model
- Name string `gorm:"index"`
- Desc string
- Stat uint `json:"stat" gorm:"not null; default: 0; comment:'0:正常 1:被禁用'"`
-}
-
-// NOTE: related model:
-// - Role, User, Instance
-type ProjectMemberRole struct {
- Model
- UserID uint `json:"user_id" gorm:"not null"`
- InstanceID uint `json:"instance_id" gorm:"not null"`
- RoleID uint `json:"role_id" gorm:"not null"`
-}
-
-// NOTE: related model:
-// - Role, UserGroup, Instance
-type ProjectMemberGroupRole struct {
- Model
- UserGroupID uint `json:"user_group_id" gorm:"not null"`
- InstanceID uint `json:"instance_id" gorm:"not null"`
- RoleID uint `json:"role_id" gorm:"not null"`
-}
-
-type BindRole struct {
- InstanceName string `json:"instance_name" valid:"required"`
- RoleNames []string `json:"role_names" valid:"required"`
-}
-
-func (s *Storage) UpdateUserRoles(userName, projectName string, bindRoles []BindRole) error {
- user, exist, err := s.GetUserByName(userName)
- if err != nil {
- return errors.ConnectStorageErrWrapper(err)
- }
- if !exist {
- return errors.ConnectStorageErrWrapper(fmt.Errorf("user not exist"))
- }
-
- return s.db.Transaction(func(tx *gorm.DB) error {
- return errors.ConnectStorageErrWrapper(s.updateUserRoles(tx, user, projectName, bindRoles))
- })
-}
-
-// 每次更新都是全量更新 InstID+UserID 定位到的角色
-func (s *Storage) updateUserRoles(tx *gorm.DB, user *User, projectName string, bindRoles []BindRole) error {
- // 获取实例ID和角色ID
- instNames := []string{}
- roleNames := []string{}
- for _, role := range bindRoles {
- instNames = append(instNames, role.InstanceName)
- roleNames = append(roleNames, role.RoleNames...)
- }
-
- instCache, err := s.getInstanceBindCacheByNames(instNames, projectName)
- if err != nil {
- return err
- }
-
- roleCache, err := s.getRoleBindIDByNames(roleNames)
- if err != nil {
- return err
- }
-
- // 删掉所有旧数据
- err = tx.Exec(`
-DELETE project_member_roles
-FROM project_member_roles
-LEFT JOIN project_user ON project_user.user_id = project_member_roles.user_id
-LEFT JOIN projects ON projects.id = project_user.project_id
-JOIN instances ON projects.id = instances.project_id AND project_member_roles.instance_id = instances.id
-WHERE project_member_roles.user_id = ?
-AND projects.name = ?
-`, user.ID, projectName).Error
- if err != nil {
- return err
- }
-
- // 写入新数据
- duplicate := map[string]struct{}{}
- for _, role := range bindRoles {
- for _, name := range role.RoleNames {
- roleFg := fmt.Sprintf("%v-%v-%v", name, role.InstanceName, user.ID)
- if _, ok := duplicate[roleFg]; ok {
- continue
- }
- duplicate[roleFg] = struct{}{}
- if err = tx.Save(&ProjectMemberRole{
- RoleID: roleCache[name],
- InstanceID: instCache[role.InstanceName],
- UserID: user.ID,
- }).Error; err != nil {
- return err
- }
- }
- }
-
- return nil
-}
-
-func (s *Storage) UpdateUserGroupRoles(groupName, projectName string, bindRoles []BindRole) error {
- user, exist, err := s.GetUserGroupByName(groupName)
- if err != nil {
- return errors.ConnectStorageErrWrapper(err)
- }
- if !exist {
- return errors.ConnectStorageErrWrapper(fmt.Errorf("user not exist"))
- }
-
- return s.db.Transaction(func(tx *gorm.DB) error {
- return errors.ConnectStorageErrWrapper(s.updateUserGroupRoles(tx, user, projectName, bindRoles))
- })
-}
-
-// 每次更新都是全量更新 InstID+UserGroupID 定位到的角色
-func (s *Storage) updateUserGroupRoles(tx *gorm.DB, group *UserGroup, projectName string, bindRoles []BindRole) error {
-
- // 获取实例ID和角色ID
- instNames := []string{}
- roleNames := []string{}
- for _, role := range bindRoles {
- instNames = append(instNames, role.InstanceName)
- roleNames = append(roleNames, role.RoleNames...)
- }
-
- instCache, err := s.getInstanceBindCacheByNames(instNames, projectName)
- if err != nil {
- return err
- }
-
- roleCache, err := s.getRoleBindIDByNames(roleNames)
- if err != nil {
- return err
- }
-
- // 删掉所有旧数据
- err = tx.Exec(`
-DELETE project_member_group_roles
-FROM project_member_group_roles
-LEFT JOIN project_user_group ON project_user_group.user_group_id = project_member_group_roles.user_group_id
-LEFT JOIN projects ON projects.id = project_user_group.project_id
-JOIN instances ON projects.id = instances.project_id AND project_member_group_roles.instance_id = instances.id
-WHERE project_member_group_roles.user_group_id = ?
-AND projects.name = ?
-`, group.ID, projectName).Error
- if err != nil {
- return err
- }
-
- // 写入新数据
- duplicate := map[string]struct{}{}
- for _, role := range bindRoles {
- for _, name := range role.RoleNames {
- roleFg := fmt.Sprintf("%v-%v-%v", name, role.InstanceName, group.ID)
- if _, ok := duplicate[roleFg]; ok {
- continue
- }
- duplicate[roleFg] = struct{}{}
- if err = tx.Save(&ProjectMemberGroupRole{
- RoleID: roleCache[name],
- InstanceID: instCache[role.InstanceName],
- UserGroupID: group.ID,
- }).Error; err != nil {
- return err
- }
- }
- }
-
- return nil
-}
-
-func (s *Storage) getRoleBindIDByNames(roleNames []string) (map[string] /*role name*/ uint /*role id*/, error) {
- roleNames = utils.RemoveDuplicate(roleNames)
-
- roles, err := s.GetRolesByNames(roleNames)
- if err != nil {
- return nil, err
- }
-
- if len(roles) != len(roleNames) {
- return nil, errors.NewDataNotExistErr("some roles don't exist")
- }
-
- roleCache := map[string] /*role name*/ uint /*role id*/ {}
- for _, role := range roles {
- roleCache[role.Name] = role.ID
- }
-
- return roleCache, nil
-}
-
-func (s *Storage) GetBindRolesByMemberNames(names []string, projectName string) (map[string] /*member name*/ []BindRole, error) {
- roles := []*struct {
- UserName string `json:"user_name"`
- InstanceName string `json:"instance_name"`
- RoleName string `json:"role_name"`
- }{}
-
- err := s.db.Table("project_member_roles").
- Select("users.login_name AS user_name , instances.name AS instance_name , roles.name AS role_name").
- Joins("LEFT JOIN users ON users.id = project_member_roles.user_id").
- Joins("LEFT JOIN instances ON instances.id = project_member_roles.instance_id").
- Joins("LEFT JOIN projects ON projects.id = instances.project_id").
- Joins("LEFT JOIN roles ON roles.id = project_member_roles.role_id").
- Where("project_member_roles.deleted_at IS NULL").
- Where("projects.deleted_at IS NULL").
- Where("users.deleted_at IS NULL").
- Where("instances.deleted_at IS NULL").
- Where("roles.deleted_at IS NULL").
- Where("projects.name = ?", projectName).
- Where("users.login_name in (?)", names).
- Scan(&roles).Error
-
- if err != nil {
- return nil, errors.ConnectStorageErrWrapper(err)
- }
-
- removeDuplicate := map[string]struct{}{}
- resp := map[string][]BindRole{}
-
-A:
- for _, role := range roles {
- // 去重
- fg := role.RoleName + role.InstanceName + role.UserName
- if _, ok := removeDuplicate[fg]; ok {
- continue
- }
- removeDuplicate[fg] = struct{}{}
-
- // resp中已有此用户+实例的信息时走这里
- for i, bindRole := range resp[role.UserName] {
- if bindRole.InstanceName == role.InstanceName {
- resp[role.UserName][i].RoleNames = append(resp[role.UserName][i].RoleNames, role.RoleName)
- continue A
- }
- }
- // resp还没记录过此用户或此用户+实例的信息时走这里
- resp[role.UserName] = append(resp[role.UserName], BindRole{
- InstanceName: role.InstanceName,
- RoleNames: []string{role.RoleName},
- })
- }
-
- return resp, nil
-}
-
-func (s *Storage) GetBindRolesByMemberGroupNames(names []string, projectName string) (map[string] /*member group name*/ []BindRole, error) {
- roles := []*struct {
- GroupName string `json:"group_name"`
- InstanceName string `json:"instance_name"`
- RoleName string `json:"role_name"`
- }{}
-
- err := s.db.Table("project_member_group_roles").
- Select("user_groups.name AS group_name , instances.name AS instance_name , roles.name AS role_name").
- Joins("LEFT JOIN user_groups ON user_groups.id = project_member_group_roles.user_group_id").
- Joins("LEFT JOIN instances ON instances.id = project_member_group_roles.instance_id").
- Joins("LEFT JOIN projects ON projects.id = instances.project_id").
- Joins("LEFT JOIN roles ON roles.id = project_member_group_roles.role_id").
- Where("project_member_group_roles.deleted_at IS NULL").
- Where("projects.deleted_at IS NULL").
- Where("user_groups.deleted_at IS NULL").
- Where("instances.deleted_at IS NULL").
- Where("roles.deleted_at IS NULL").
- Where("projects.name = ?", projectName).
- Where("user_groups.name in (?)", names).
- Scan(&roles).Error
-
- if err != nil {
- return nil, errors.ConnectStorageErrWrapper(err)
- }
-
- removeDuplicate := map[string]struct{}{}
- resp := map[string][]BindRole{}
-
-A:
- for _, role := range roles {
- // 去重
- fg := role.RoleName + role.InstanceName + role.GroupName
- if _, ok := removeDuplicate[fg]; ok {
- continue
- }
- removeDuplicate[fg] = struct{}{}
-
- // resp中已有此用户组+实例的信息时走这里
- for i, bindRole := range resp[role.GroupName] {
- if bindRole.InstanceName == role.InstanceName {
- resp[role.GroupName][i].RoleNames = append(resp[role.GroupName][i].RoleNames, role.RoleName)
- continue A
- }
- }
- // resp还没记录过此用户或此用户+实例的信息时走这里
- resp[role.GroupName] = append(resp[role.GroupName], BindRole{
- InstanceName: role.InstanceName,
- RoleNames: []string{role.RoleName},
- })
- }
-
- return resp, nil
-}
-
-func (s *Storage) GetRoleByName(name string) (*Role, bool, error) {
- role := &Role{}
- err := s.db.Where("name = ?", name).Find(role).Error
- if err == gorm.ErrRecordNotFound {
- return role, false, nil
- }
- return role, true, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetRolesByNames(names []string) ([]*Role, error) {
- roles := []*Role{}
- err := s.db.Where("name in (?)", names).Find(&roles).Error
- return roles, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) UpdateRoleUsers(role *Role, users ...*User) error {
- err := s.db.Model(role).Association("Users").Replace(users).Error
- return errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) UpdateRoleInstances(role *Role, instances ...*Instance) error {
- err := s.db.Model(role).Association("Instances").Replace(instances).Error
- return errors.New(errors.ConnectStorageError, err)
-}
-
-var roleTipsQueryTpl = `SELECT roles.name,
-GROUP_CONCAT(DISTINCT COALESCE(role_operations.op_code,'')) AS operations_codes
-{{ template "body" . }}
-GROUP BY roles.id
-`
-
-var roleTipsQueryBodyTpl = `
-{{ define "body" }}
-FROM roles
-LEFT JOIN role_operations ON role_operations.role_id = roles.id AND role_operations.deleted_at IS NULL
-WHERE
-roles.deleted_at IS NULL
-
-{{- end }}
-`
-
-type RoleTips struct {
- Name string `json:"name"`
- OperationsCodes RowList `json:"operations_codes"`
-}
-
-func (s *Storage) GetAllRoleTip() ([]*RoleTips, error) {
- result := []*RoleTips{}
- err := s.getListResult(roleTipsQueryBodyTpl, roleTipsQueryTpl, nil, &result)
- if err != nil {
- return nil, err
- }
- return result, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetAndCheckRoleExist(roleNames []string) (roles []*Role, err error) {
- roles, err = s.GetRolesByNames(roleNames)
- if err != nil {
- return roles, err
- }
- existRoleNames := map[string]struct{}{}
- for _, role := range roles {
- existRoleNames[role.Name] = struct{}{}
- }
- notExistRoleNames := []string{}
- for _, roleName := range roleNames {
- if _, ok := existRoleNames[roleName]; !ok {
- notExistRoleNames = append(notExistRoleNames, roleName)
- }
- }
- if len(notExistRoleNames) > 0 {
- return roles, errors.New(errors.DataNotExist,
- fmt.Errorf("user role %s not exist", strings.Join(notExistRoleNames, ", ")))
- }
- return roles, nil
-}
-
-func (s *Storage) SaveRoleAndAssociations(role *Role,
- opCodes []uint) (err error) {
- return s.Tx(func(txDB *gorm.DB) (err error) {
-
- // save role
- if err = txDB.Save(role).Error; err != nil {
- return errors.ConnectStorageErrWrapper(err)
- }
-
- // sync operations
- {
- if opCodes != nil {
- if err := s.ReplaceRoleOperationsByOpCodes(role.ID, opCodes); err != nil {
- return err
- }
- }
- }
-
- return
- })
-}
-
-func (s *Storage) DeleteRoleAndAssociations(role *Role) error {
- return s.Tx(func(txDB *gorm.DB) (err error) {
-
- // delete role
- if err = txDB.Delete(role).Error; err != nil {
- txDB.Rollback()
- return errors.ConnectStorageErrWrapper(err)
- }
-
- // delete role operations
- if err = s.DeleteRoleOperationByRoleID(role.ID); err != nil {
- txDB.Rollback()
- return err
- }
-
- return nil
- })
-}
-
-func (s *Storage) CheckRolesExist(roleNames []string) (bool, error) {
- roleNames = utils.RemoveDuplicate(roleNames)
-
- var count int
- err := s.db.Model(&Role{}).Where("name in (?)", roleNames).Count(&count).Error
- return len(roleNames) == count, errors.ConnectStorageErrWrapper(err)
-}
-
-func (s *Storage) DeleteRoleByInstanceID(instanceID uint) error {
- sql := `
-DELETE project_member_roles, project_member_group_roles
-FROM project_member_roles
-LEFT JOIN project_member_group_roles ON project_member_roles.instance_id = project_member_group_roles.instance_id
-WHERE project_member_roles.instance_id = ?
-`
-
- return errors.ConnectStorageErrWrapper(s.db.Exec(sql, instanceID).Error)
-}
+// import (
+// "fmt"
+// "strings"
+
+// "github.com/actiontech/sqle/sqle/errors"
+// "github.com/actiontech/sqle/sqle/utils"
+
+// "github.com/jinzhu/gorm"
+// )
+
+// // NOTE: related model:
+// // - RoleOperation, ProjectMemberRole, ProjectMemberGroupRole
+// type Role struct {
+// Model
+// Name string `gorm:"index"`
+// Desc string
+// Stat uint `json:"stat" gorm:"not null; default: 0; comment:'0:正常 1:被禁用'"`
+// }
+
+// // NOTE: related model:
+// // - Role, User, Instance
+// type ProjectMemberRole struct {
+// Model
+// UserID uint `json:"user_id" gorm:"not null"`
+// InstanceID uint `json:"instance_id" gorm:"not null"`
+// RoleID uint `json:"role_id" gorm:"not null"`
+// }
+
+// // NOTE: related model:
+// // - Role, UserGroup, Instance
+// type ProjectMemberGroupRole struct {
+// Model
+// UserGroupID uint `json:"user_group_id" gorm:"not null"`
+// InstanceID uint `json:"instance_id" gorm:"not null"`
+// RoleID uint `json:"role_id" gorm:"not null"`
+// }
+
+// type BindRole struct {
+// InstanceName string `json:"instance_name" valid:"required"`
+// RoleNames []string `json:"role_names" valid:"required"`
+// }
+
+// func (s *Storage) UpdateUserRoles(userName, projectName string, bindRoles []BindRole) error {
+// user, exist, err := s.GetUserByName(userName)
+// if err != nil {
+// return errors.ConnectStorageErrWrapper(err)
+// }
+// if !exist {
+// return errors.ConnectStorageErrWrapper(fmt.Errorf("user not exist"))
+// }
+
+// return s.db.Transaction(func(tx *gorm.DB) error {
+// return errors.ConnectStorageErrWrapper(s.updateUserRoles(tx, user, projectName, bindRoles))
+// })
+// }
+
+// // 每次更新都是全量更新 InstID+UserID 定位到的角色
+// func (s *Storage) updateUserRoles(tx *gorm.DB, user *User, projectName string, bindRoles []BindRole) error {
+// // 获取实例ID和角色ID
+// instNames := []string{}
+// roleNames := []string{}
+// for _, role := range bindRoles {
+// instNames = append(instNames, role.InstanceName)
+// roleNames = append(roleNames, role.RoleNames...)
+// }
+
+// instCache, err := s.getInstanceBindCacheByNames(instNames, projectName)
+// if err != nil {
+// return err
+// }
+
+// roleCache, err := s.getRoleBindIDByNames(roleNames)
+// if err != nil {
+// return err
+// }
+
+// // 删掉所有旧数据
+// err = tx.Exec(`
+// DELETE project_member_roles
+// FROM project_member_roles
+// LEFT JOIN project_user ON project_user.user_id = project_member_roles.user_id
+// LEFT JOIN projects ON projects.id = project_user.project_id
+// JOIN instances ON projects.id = instances.project_id AND project_member_roles.instance_id = instances.id
+// WHERE project_member_roles.user_id = ?
+// AND projects.name = ?
+// `, user.ID, projectName).Error
+// if err != nil {
+// return err
+// }
+
+// // 写入新数据
+// duplicate := map[string]struct{}{}
+// for _, role := range bindRoles {
+// for _, name := range role.RoleNames {
+// roleFg := fmt.Sprintf("%v-%v-%v", name, role.InstanceName, user.ID)
+// if _, ok := duplicate[roleFg]; ok {
+// continue
+// }
+// duplicate[roleFg] = struct{}{}
+// if err = tx.Save(&ProjectMemberRole{
+// RoleID: roleCache[name],
+// InstanceID: instCache[role.InstanceName],
+// UserID: user.ID,
+// }).Error; err != nil {
+// return err
+// }
+// }
+// }
+
+// return nil
+// }
+
+// func (s *Storage) UpdateUserGroupRoles(groupName, projectName string, bindRoles []BindRole) error {
+// user, exist, err := s.GetUserGroupByName(groupName)
+// if err != nil {
+// return errors.ConnectStorageErrWrapper(err)
+// }
+// if !exist {
+// return errors.ConnectStorageErrWrapper(fmt.Errorf("user not exist"))
+// }
+
+// return s.db.Transaction(func(tx *gorm.DB) error {
+// return errors.ConnectStorageErrWrapper(s.updateUserGroupRoles(tx, user, projectName, bindRoles))
+// })
+// }
+
+// // 每次更新都是全量更新 InstID+UserGroupID 定位到的角色
+// func (s *Storage) updateUserGroupRoles(tx *gorm.DB, group *UserGroup, projectName string, bindRoles []BindRole) error {
+
+// // 获取实例ID和角色ID
+// instNames := []string{}
+// roleNames := []string{}
+// for _, role := range bindRoles {
+// instNames = append(instNames, role.InstanceName)
+// roleNames = append(roleNames, role.RoleNames...)
+// }
+
+// instCache, err := s.getInstanceBindCacheByNames(instNames, projectName)
+// if err != nil {
+// return err
+// }
+
+// roleCache, err := s.getRoleBindIDByNames(roleNames)
+// if err != nil {
+// return err
+// }
+
+// // 删掉所有旧数据
+// err = tx.Exec(`
+// DELETE project_member_group_roles
+// FROM project_member_group_roles
+// LEFT JOIN project_user_group ON project_user_group.user_group_id = project_member_group_roles.user_group_id
+// LEFT JOIN projects ON projects.id = project_user_group.project_id
+// JOIN instances ON projects.id = instances.project_id AND project_member_group_roles.instance_id = instances.id
+// WHERE project_member_group_roles.user_group_id = ?
+// AND projects.name = ?
+// `, group.ID, projectName).Error
+// if err != nil {
+// return err
+// }
+
+// // 写入新数据
+// duplicate := map[string]struct{}{}
+// for _, role := range bindRoles {
+// for _, name := range role.RoleNames {
+// roleFg := fmt.Sprintf("%v-%v-%v", name, role.InstanceName, group.ID)
+// if _, ok := duplicate[roleFg]; ok {
+// continue
+// }
+// duplicate[roleFg] = struct{}{}
+// if err = tx.Save(&ProjectMemberGroupRole{
+// RoleID: roleCache[name],
+// InstanceID: instCache[role.InstanceName],
+// UserGroupID: group.ID,
+// }).Error; err != nil {
+// return err
+// }
+// }
+// }
+
+// return nil
+// }
+
+// func (s *Storage) getRoleBindIDByNames(roleNames []string) (map[string] /*role name*/ uint /*role id*/, error) {
+// roleNames = utils.RemoveDuplicate(roleNames)
+
+// roles, err := s.GetRolesByNames(roleNames)
+// if err != nil {
+// return nil, err
+// }
+
+// if len(roles) != len(roleNames) {
+// return nil, errors.NewDataNotExistErr("some roles don't exist")
+// }
+
+// roleCache := map[string] /*role name*/ uint /*role id*/ {}
+// for _, role := range roles {
+// roleCache[role.Name] = role.ID
+// }
+
+// return roleCache, nil
+// }
+
+// func (s *Storage) GetBindRolesByMemberNames(names []string, projectName string) (map[string] /*member name*/ []BindRole, error) {
+// roles := []*struct {
+// UserName string `json:"user_name"`
+// InstanceName string `json:"instance_name"`
+// RoleName string `json:"role_name"`
+// }{}
+
+// err := s.db.Table("project_member_roles").
+// Select("users.login_name AS user_name , instances.name AS instance_name , roles.name AS role_name").
+// Joins("LEFT JOIN users ON users.id = project_member_roles.user_id").
+// Joins("LEFT JOIN instances ON instances.id = project_member_roles.instance_id").
+// Joins("LEFT JOIN projects ON projects.id = instances.project_id").
+// Joins("LEFT JOIN roles ON roles.id = project_member_roles.role_id").
+// Where("project_member_roles.deleted_at IS NULL").
+// Where("projects.deleted_at IS NULL").
+// Where("users.deleted_at IS NULL").
+// Where("instances.deleted_at IS NULL").
+// Where("roles.deleted_at IS NULL").
+// Where("projects.name = ?", projectName).
+// Where("users.login_name in (?)", names).
+// Scan(&roles).Error
+
+// if err != nil {
+// return nil, errors.ConnectStorageErrWrapper(err)
+// }
+
+// removeDuplicate := map[string]struct{}{}
+// resp := map[string][]BindRole{}
+
+// A:
+// for _, role := range roles {
+// // 去重
+// fg := role.RoleName + role.InstanceName + role.UserName
+// if _, ok := removeDuplicate[fg]; ok {
+// continue
+// }
+// removeDuplicate[fg] = struct{}{}
+
+// // resp中已有此用户+实例的信息时走这里
+// for i, bindRole := range resp[role.UserName] {
+// if bindRole.InstanceName == role.InstanceName {
+// resp[role.UserName][i].RoleNames = append(resp[role.UserName][i].RoleNames, role.RoleName)
+// continue A
+// }
+// }
+// // resp还没记录过此用户或此用户+实例的信息时走这里
+// resp[role.UserName] = append(resp[role.UserName], BindRole{
+// InstanceName: role.InstanceName,
+// RoleNames: []string{role.RoleName},
+// })
+// }
+
+// return resp, nil
+// }
+
+// func (s *Storage) GetBindRolesByMemberGroupNames(names []string, projectName string) (map[string] /*member group name*/ []BindRole, error) {
+// roles := []*struct {
+// GroupName string `json:"group_name"`
+// InstanceName string `json:"instance_name"`
+// RoleName string `json:"role_name"`
+// }{}
+
+// err := s.db.Table("project_member_group_roles").
+// Select("user_groups.name AS group_name , instances.name AS instance_name , roles.name AS role_name").
+// Joins("LEFT JOIN user_groups ON user_groups.id = project_member_group_roles.user_group_id").
+// Joins("LEFT JOIN instances ON instances.id = project_member_group_roles.instance_id").
+// Joins("LEFT JOIN projects ON projects.id = instances.project_id").
+// Joins("LEFT JOIN roles ON roles.id = project_member_group_roles.role_id").
+// Where("project_member_group_roles.deleted_at IS NULL").
+// Where("projects.deleted_at IS NULL").
+// Where("user_groups.deleted_at IS NULL").
+// Where("instances.deleted_at IS NULL").
+// Where("roles.deleted_at IS NULL").
+// Where("projects.name = ?", projectName).
+// Where("user_groups.name in (?)", names).
+// Scan(&roles).Error
+
+// if err != nil {
+// return nil, errors.ConnectStorageErrWrapper(err)
+// }
+
+// removeDuplicate := map[string]struct{}{}
+// resp := map[string][]BindRole{}
+
+// A:
+// for _, role := range roles {
+// // 去重
+// fg := role.RoleName + role.InstanceName + role.GroupName
+// if _, ok := removeDuplicate[fg]; ok {
+// continue
+// }
+// removeDuplicate[fg] = struct{}{}
+
+// // resp中已有此用户组+实例的信息时走这里
+// for i, bindRole := range resp[role.GroupName] {
+// if bindRole.InstanceName == role.InstanceName {
+// resp[role.GroupName][i].RoleNames = append(resp[role.GroupName][i].RoleNames, role.RoleName)
+// continue A
+// }
+// }
+// // resp还没记录过此用户或此用户+实例的信息时走这里
+// resp[role.GroupName] = append(resp[role.GroupName], BindRole{
+// InstanceName: role.InstanceName,
+// RoleNames: []string{role.RoleName},
+// })
+// }
+
+// return resp, nil
+// }
+
+// func (s *Storage) GetRoleByName(name string) (*Role, bool, error) {
+// role := &Role{}
+// err := s.db.Where("name = ?", name).Find(role).Error
+// if err == gorm.ErrRecordNotFound {
+// return role, false, nil
+// }
+// return role, true, errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) GetRolesByNames(names []string) ([]*Role, error) {
+// roles := []*Role{}
+// err := s.db.Where("name in (?)", names).Find(&roles).Error
+// return roles, errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) UpdateRoleUsers(role *Role, users ...*User) error {
+// err := s.db.Model(role).Association("Users").Replace(users).Error
+// return errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) UpdateRoleInstances(role *Role, instances ...*Instance) error {
+// err := s.db.Model(role).Association("Instances").Replace(instances).Error
+// return errors.New(errors.ConnectStorageError, err)
+// }
+
+// var roleTipsQueryTpl = `SELECT roles.name,
+// GROUP_CONCAT(DISTINCT COALESCE(role_operations.op_code,'')) AS operations_codes
+// {{ template "body" . }}
+// GROUP BY roles.id
+// `
+
+// var roleTipsQueryBodyTpl = `
+// {{ define "body" }}
+// FROM roles
+// LEFT JOIN role_operations ON role_operations.role_id = roles.id AND role_operations.deleted_at IS NULL
+// WHERE
+// roles.deleted_at IS NULL
+
+// {{- end }}
+// `
+
+// type RoleTips struct {
+// Name string `json:"name"`
+// OperationsCodes RowList `json:"operations_codes"`
+// }
+
+// func (s *Storage) GetAllRoleTip() ([]*RoleTips, error) {
+// result := []*RoleTips{}
+// err := s.getListResult(roleTipsQueryBodyTpl, roleTipsQueryTpl, nil, &result)
+// if err != nil {
+// return nil, err
+// }
+// return result, errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) GetAndCheckRoleExist(roleNames []string) (roles []*Role, err error) {
+// roles, err = s.GetRolesByNames(roleNames)
+// if err != nil {
+// return roles, err
+// }
+// existRoleNames := map[string]struct{}{}
+// for _, role := range roles {
+// existRoleNames[role.Name] = struct{}{}
+// }
+// notExistRoleNames := []string{}
+// for _, roleName := range roleNames {
+// if _, ok := existRoleNames[roleName]; !ok {
+// notExistRoleNames = append(notExistRoleNames, roleName)
+// }
+// }
+// if len(notExistRoleNames) > 0 {
+// return roles, errors.New(errors.DataNotExist,
+// fmt.Errorf("user role %s not exist", strings.Join(notExistRoleNames, ", ")))
+// }
+// return roles, nil
+// }
+
+// func (s *Storage) SaveRoleAndAssociations(role *Role,
+// opCodes []uint) (err error) {
+// return s.Tx(func(txDB *gorm.DB) (err error) {
+
+// // save role
+// if err = txDB.Save(role).Error; err != nil {
+// return errors.ConnectStorageErrWrapper(err)
+// }
+
+// // sync operations
+// {
+// if opCodes != nil {
+// if err := s.ReplaceRoleOperationsByOpCodes(role.ID, opCodes); err != nil {
+// return err
+// }
+// }
+// }
+
+// return
+// })
+// }
+
+// func (s *Storage) DeleteRoleAndAssociations(role *Role) error {
+// return s.Tx(func(txDB *gorm.DB) (err error) {
+
+// // delete role
+// if err = txDB.Delete(role).Error; err != nil {
+// txDB.Rollback()
+// return errors.ConnectStorageErrWrapper(err)
+// }
+
+// // delete role operations
+// if err = s.DeleteRoleOperationByRoleID(role.ID); err != nil {
+// txDB.Rollback()
+// return err
+// }
+
+// return nil
+// })
+// }
+
+// func (s *Storage) CheckRolesExist(roleNames []string) (bool, error) {
+// roleNames = utils.RemoveDuplicate(roleNames)
+
+// var count int
+// err := s.db.Model(&Role{}).Where("name in (?)", roleNames).Count(&count).Error
+// return len(roleNames) == count, errors.ConnectStorageErrWrapper(err)
+// }
+
+// func (s *Storage) DeleteRoleByInstanceID(instanceID uint) error {
+// sql := `
+// DELETE project_member_roles, project_member_group_roles
+// FROM project_member_roles
+// LEFT JOIN project_member_group_roles ON project_member_roles.instance_id = project_member_group_roles.instance_id
+// WHERE project_member_roles.instance_id = ?
+// `
+
+// return errors.ConnectStorageErrWrapper(s.db.Exec(sql, instanceID).Error)
+// }
diff --git a/sqle/model/role_list.go b/sqle/model/role_list.go
index c7adde0cc9..8cab2f5b9f 100644
--- a/sqle/model/role_list.go
+++ b/sqle/model/role_list.go
@@ -5,69 +5,69 @@ import (
"text/template"
)
-type RoleDetail struct {
- Id int
- Name string `json:"name"`
- Desc string `json:"desc"`
- UserNames RowList `json:"user_names"`
- InstanceNames RowList `json:"instance_names"`
-
- // New fields: Stat, UserGroupNames, OperationsCodes
- // Issue: https://github.com/actiontech/sqle/issues/228
- // Version: >= sqle-v1.2202.0
- Stat int `json:"stat"`
- UserGroupNames RowList `json:"user_group_names"`
- OperationsCodes RowList `json:"operations_codes"`
-}
-
-func (rd *RoleDetail) IsDisabled() bool {
- return rd.Stat == Disabled
-}
-
-var rolesQueryTpl = `SELECT roles.id, roles.name, roles.desc, roles.stat,
-GROUP_CONCAT(DISTINCT COALESCE(role_operations.op_code,'')) AS operations_codes
-FROM roles
-LEFT JOIN role_operations ON role_operations.role_id = roles.id AND role_operations.deleted_at IS NULL
-WHERE
-roles.id in (SELECT DISTINCT(roles.id)
-
-{{- template "body" . -}}
-)
-GROUP BY roles.id
-{{- if .limit }}
-LIMIT :limit OFFSET :offset
-{{- end -}}
-`
-
-var rolesCountTpl = `SELECT COUNT(DISTINCT roles.id)
-
-{{- template "body" . -}}
-`
-
-var rolesQueryBodyTpl = `
-{{ define "body" }}
-FROM roles
-LEFT JOIN role_operations ON role_operations.role_id = roles.id AND role_operations.deleted_at IS NULL
-WHERE
-roles.deleted_at IS NULL
-
-{{- if .filter_role_name }}
-AND roles.name = :filter_role_name
-{{- end }}
-
-{{- end }}
-`
-
-func (s *Storage) GetRolesByReq(data map[string]interface{}) (
- result []*RoleDetail, count uint64, err error) {
-
- err = s.getListResult(rolesQueryBodyTpl, rolesQueryTpl, data, &result)
- if err != nil {
- return result, 0, err
- }
- count, err = s.getCountResult(rolesQueryBodyTpl, rolesCountTpl, data)
- return result, count, err
-}
+// type RoleDetail struct {
+// Id int
+// Name string `json:"name"`
+// Desc string `json:"desc"`
+// UserNames RowList `json:"user_names"`
+// InstanceNames RowList `json:"instance_names"`
+
+// // New fields: Stat, UserGroupNames, OperationsCodes
+// // Issue: https://github.com/actiontech/sqle/issues/228
+// // Version: >= sqle-v1.2202.0
+// Stat int `json:"stat"`
+// UserGroupNames RowList `json:"user_group_names"`
+// OperationsCodes RowList `json:"operations_codes"`
+// }
+
+// func (rd *RoleDetail) IsDisabled() bool {
+// return rd.Stat == Disabled
+// }
+
+// var rolesQueryTpl = `SELECT roles.id, roles.name, roles.desc, roles.stat,
+// GROUP_CONCAT(DISTINCT COALESCE(role_operations.op_code,'')) AS operations_codes
+// FROM roles
+// LEFT JOIN role_operations ON role_operations.role_id = roles.id AND role_operations.deleted_at IS NULL
+// WHERE
+// roles.id in (SELECT DISTINCT(roles.id)
+
+// {{- template "body" . -}}
+// )
+// GROUP BY roles.id
+// {{- if .limit }}
+// LIMIT :limit OFFSET :offset
+// {{- end -}}
+// `
+
+// var rolesCountTpl = `SELECT COUNT(DISTINCT roles.id)
+
+// {{- template "body" . -}}
+// `
+
+// var rolesQueryBodyTpl = `
+// {{ define "body" }}
+// FROM roles
+// LEFT JOIN role_operations ON role_operations.role_id = roles.id AND role_operations.deleted_at IS NULL
+// WHERE
+// roles.deleted_at IS NULL
+
+// {{- if .filter_role_name }}
+// AND roles.name = :filter_role_name
+// {{- end }}
+
+// {{- end }}
+// `
+
+// func (s *Storage) GetRolesByReq(data map[string]interface{}) (
+// result []*RoleDetail, count uint64, err error) {
+
+// err = s.getListResult(rolesQueryBodyTpl, rolesQueryTpl, data, &result)
+// if err != nil {
+// return result, 0, err
+// }
+// count, err = s.getCountResult(rolesQueryBodyTpl, rolesCountTpl, data)
+// return result, count, err
+// }
func getSelectQuery(bodyTpl, queryTpl string, data interface{}) (string, error) {
var buff bytes.Buffer
@@ -140,13 +140,13 @@ func (s *Storage) getCountResult(bodyTpl, countTpl string, data map[string]inter
return count, nil
}
-func GetRoleIDsFromRoles(roles []*Role) (roleIDs []uint) {
+// func GetRoleIDsFromRoles(roles []*Role) (roleIDs []uint) {
- roleIDs = make([]uint, len(roles))
+// roleIDs = make([]uint, len(roles))
- for i := range roles {
- roleIDs[i] = roles[i].ID
- }
+// for i := range roles {
+// roleIDs[i] = roles[i].ID
+// }
- return roleIDs
-}
+// return roleIDs
+// }
diff --git a/sqle/model/rule.go b/sqle/model/rule.go
index f88adfc371..50c0442aa6 100644
--- a/sqle/model/rule.go
+++ b/sqle/model/rule.go
@@ -13,11 +13,10 @@ import (
type RuleTemplate struct {
Model
// global rule-template has no ProjectId
- ProjectId uint `gorm:"index"`
+ ProjectId ProjectUID `gorm:"index"`
Name string `json:"name"`
Desc string `json:"desc"`
DBType string `json:"db_type"`
- Instances []Instance `json:"instance_list" gorm:"many2many:instance_rule_template"`
RuleList []RuleTemplateRule `json:"rule_list" gorm:"foreignkey:rule_template_id;association_foreignkey:id"`
CustomRuleList []RuleTemplateCustomRule `json:"custom_rule_list" gorm:"foreignkey:rule_template_id;association_foreignkey:id"`
}
@@ -147,13 +146,11 @@ func (s *Storage) GetRuleTemplatesByInstance(inst *Instance) ([]RuleTemplate, er
return associationRT, errors.New(errors.ConnectStorageError, err)
}
-func (s *Storage) GetRuleTemplateNamesByProjectName(projectName string) ([]string, error) {
+func (s *Storage) GetRuleTemplateNamesByProjectId(projectId string) ([]string, error) {
records := []*RuleTemplate{}
err := s.db.Model(&RuleTemplate{}).
- Select("rule_templates.name").
- Joins("LEFT JOIN projects ON projects.id = rule_templates.project_id").
- Where("projects.deleted_at is null").
- Where("projects.name = ?", projectName).
+ Select("name").
+ Where("project_id = ?", projectId).
Find(&records).
Error
if err != nil {
@@ -167,7 +164,7 @@ func (s *Storage) GetRuleTemplateNamesByProjectName(projectName string) ([]strin
return templateNames, nil
}
-func (s *Storage) GetRuleTemplatesByInstanceNameAndProjectId(name string, projectId uint) (*RuleTemplate, bool, error) {
+func (s *Storage) GetRuleTemplatesByInstanceNameAndProjectId(name string, projectId string) (*RuleTemplate, bool, error) {
t := &RuleTemplate{}
err := s.db.Joins("JOIN `instance_rule_template` ON `rule_templates`.`id` = `instance_rule_template`.`rule_template_id`").
Joins("JOIN `instances` ON `instance_rule_template`.`instance_id` = `instances`.`id`").
@@ -179,8 +176,8 @@ func (s *Storage) GetRuleTemplatesByInstanceNameAndProjectId(name string, projec
return t, true, errors.New(errors.ConnectStorageError, err)
}
-func (s *Storage) GetRulesFromRuleTemplateByName(projectIds []uint, name string) ([]*Rule, []*CustomRule, error) {
- tpl, exist, err := s.GetRuleTemplateDetailByNameAndProjectIds(projectIds, name)
+func (s *Storage) GetRulesFromRuleTemplateByName(projectIds []string, name string) ([]*Rule, []*CustomRule, error) {
+ tpl, exist, err := s.GetRuleTemplateDetailByNameAndProjectIds(projectIds, name, "")
if !exist {
return nil, nil, errors.New(errors.DataNotExist, err)
}
@@ -199,21 +196,22 @@ func (s *Storage) GetRulesFromRuleTemplateByName(projectIds []uint, name string)
return rules, customRules, nil
}
-func (s *Storage) GetAllRulesByInstanceId(instanceId string) ([]*Rule, []*CustomRule, error) {
- instance, _, err := s.GetInstanceById(instanceId)
- if err != nil {
- return nil, nil, errors.New(errors.ConnectStorageError, err)
- }
- templates := instance.RuleTemplates
- if len(templates) <= 0 {
- return nil, nil, nil
+func (s *Storage) GetAllRulesByInstance(instance *Instance) ([]*Rule, []*CustomRule, error) {
+ var template RuleTemplate
+
+ if err := s.db.Where("id = ? ", instance.RuleTemplateId).First(&template).Error; err != nil {
+ if err != gorm.ErrRecordNotFound {
+ return nil, nil, errors.New(errors.ConnectStorageError, err)
+ } else {
+ return nil, nil, nil
+ }
}
- tplName := templates[0].Name
+
// 数据源可以绑定全局模板和项目模板
- return s.GetRulesFromRuleTemplateByName([]uint{instance.ProjectId, ProjectIdForGlobalRuleTemplate}, tplName)
+ return s.GetRulesFromRuleTemplateByName([]string{instance.ProjectId, ProjectIdForGlobalRuleTemplate}, instance.RuleTemplateName)
}
-func (s *Storage) GetRuleTemplateByProjectIdAndName(projectId uint, name string) (*RuleTemplate, bool, error) {
+func (s *Storage) GetRuleTemplateByProjectIdAndName(projectId, name string) (*RuleTemplate, bool, error) {
t := &RuleTemplate{}
err := s.db.Where("name = ?", name).Where("project_id = ?", projectId).First(t).Error
if err == gorm.ErrRecordNotFound {
@@ -222,7 +220,7 @@ func (s *Storage) GetRuleTemplateByProjectIdAndName(projectId uint, name string)
return t, true, errors.New(errors.ConnectStorageError, err)
}
-func (s *Storage) GetGlobalAndProjectRuleTemplateByNameAndProjectId(name string, projectId uint) (*RuleTemplate, bool, error) {
+func (s *Storage) GetGlobalAndProjectRuleTemplateByNameAndProjectId(name string, projectId string) (*RuleTemplate, bool, error) {
t := &RuleTemplate{}
err := s.db.Table("rule_templates").
Where("rule_templates.name = ?", name).
@@ -234,18 +232,24 @@ func (s *Storage) GetGlobalAndProjectRuleTemplateByNameAndProjectId(name string,
return t, true, errors.New(errors.ConnectStorageError, err)
}
-func (s *Storage) IsRuleTemplateExistFromAnyProject(name string) (bool, error) {
+func (s *Storage) IsRuleTemplateExistFromAnyProject(projectId ProjectUID, name string) (bool, error) {
var count int
- err := s.db.Model(&RuleTemplate{}).Where("name = ?", name).Count(&count).Error
+ err := s.db.Model(&RuleTemplate{}).Where("name = ? and project_id = ?", name, string(projectId)).Count(&count).Error
return count > 0, errors.ConnectStorageErrWrapper(err)
}
-func (s *Storage) GetRuleTemplateDetailByNameAndProjectIds(projectIds []uint, name string) (*RuleTemplate, bool, error) {
+func (s *Storage) GetRuleTemplateDetailByNameAndProjectIds(projectIds []string, name string, fuzzy_keyword_rule string) (*RuleTemplate, bool, error) {
dbOrder := func(db *gorm.DB) *gorm.DB {
return db.Order("rule_template_rule.rule_name ASC")
}
+ fuzzy_condition := func(db *gorm.DB) *gorm.DB {
+ if fuzzy_keyword_rule == "" {
+ return db
+ }
+ return db.Where("`desc` like ? OR annotation like ?", fmt.Sprintf("%%%s%%", fuzzy_keyword_rule), fmt.Sprintf("%%%s%%", fuzzy_keyword_rule))
+ }
t := &RuleTemplate{Name: name}
- err := s.db.Preload("RuleList", dbOrder).Preload("RuleList.Rule").Preload("Instances").Preload("CustomRuleList.CustomRule").
+ err := s.db.Preload("RuleList", dbOrder).Preload("RuleList.Rule", fuzzy_condition).Preload("CustomRuleList.CustomRule", fuzzy_condition).
Where(t).
Where("project_id IN (?)", projectIds).
First(t).Error
@@ -276,11 +280,6 @@ func (s *Storage) UpdateRuleTemplateRules(tpl *RuleTemplate, rules ...RuleTempla
return errors.New(errors.ConnectStorageError, err)
}
-func (s *Storage) UpdateRuleTemplateInstances(tpl *RuleTemplate, instances ...*Instance) error {
- err := s.db.Model(tpl).Association("Instances").Replace(instances).Error
- return errors.New(errors.ConnectStorageError, err)
-}
-
func (s *Storage) CloneRuleTemplateRules(source, destination *RuleTemplate) error {
return s.UpdateRuleTemplateRules(destination, source.RuleList...)
}
@@ -299,10 +298,17 @@ func GetRuleMapFromAllArray(allRules ...[]Rule) map[string]Rule {
return ruleMap
}
-func (s *Storage) GetRuleTemplateTips(projectId uint, dbType string) ([]*RuleTemplate, error) {
+func (s *Storage) GetRuleTemplateById(id uint64) (*RuleTemplate, error) {
+ ruleTemplate := new(RuleTemplate)
+
+ err := s.db.Where("id = ?", id).First(ruleTemplate).Error
+ return ruleTemplate, errors.New(errors.ConnectStorageError, err)
+}
+
+func (s *Storage) GetRuleTemplateTips(projectId, dbType string) ([]*RuleTemplate, error) {
ruleTemplates := []*RuleTemplate{}
- db := s.db.Select("name, db_type").Where("project_id = ?", projectId)
+ db := s.db.Select("id,name, db_type").Where("project_id = ?", projectId)
if dbType != "" {
db = db.Where("db_type = ?", dbType)
}
@@ -365,7 +371,7 @@ func (s *Storage) GetAndCheckRuleExist(ruleNames []string, dbType string) (map[s
return existRules, nil
}
-func (s *Storage) IsRuleTemplateExist(ruleTemplateName string, projectIds []uint) (bool, error) {
+func (s *Storage) IsRuleTemplateExist(ruleTemplateName string, projectIds []string) (bool, error) {
if len(projectIds) <= 0 {
return false, nil
}
@@ -400,7 +406,7 @@ func (s *Storage) GetAuditPlanNamesByRuleTemplate(
}
func (s *Storage) GetAuditPlanNamesByRuleTemplateAndProject(
- ruleTemplateName string, projectID uint) (auditPlanNames []string, err error) {
+ ruleTemplateName string, projectID string) (auditPlanNames []string, err error) {
var auditPlans []*AuditPlan
@@ -576,21 +582,21 @@ func (s *Storage) UpdateRuleTemplateCustomRules(tpl *RuleTemplate, rules ...Rule
return errors.New(errors.ConnectStorageError, err)
}
-func (s *Storage) GetAllRulesByTmpNameAndProjectIdInstanceDBType(ruleTemplateName string, projectId *uint,
+func (s *Storage) GetAllRulesByTmpNameAndProjectIdInstanceDBType(ruleTemplateName string, projectId string,
inst *Instance, dbType string) (rules []*Rule, customRules []*CustomRule, err error) {
if ruleTemplateName != "" {
- if projectId == nil {
+ if projectId == "" {
return nil, nil, errors.New(errors.DataInvalid,
fmt.Errorf("project id is needed when rule template name is given"))
}
- rules, customRules, err = s.GetRulesFromRuleTemplateByName([]uint{*projectId, ProjectIdForGlobalRuleTemplate}, ruleTemplateName)
+ rules, customRules, err = s.GetRulesFromRuleTemplateByName([]string{projectId, ProjectIdForGlobalRuleTemplate}, ruleTemplateName)
} else {
if inst != nil {
- rules, customRules, err = s.GetAllRulesByInstanceId(fmt.Sprintf("%v", inst.ID))
+ rules, customRules, err = s.GetAllRulesByInstance(inst)
} else {
templateName := s.GetDefaultRuleTemplateName(dbType)
// 默认规则模板从全局模板里拿
- rules, customRules, err = s.GetRulesFromRuleTemplateByName([]uint{ProjectIdForGlobalRuleTemplate}, templateName)
+ rules, customRules, err = s.GetRulesFromRuleTemplateByName([]string{ProjectIdForGlobalRuleTemplate}, templateName)
}
}
if err != nil {
diff --git a/sqle/model/rule_list.go b/sqle/model/rule_list.go
index a269c1fc92..ab8ddc16a0 100644
--- a/sqle/model/rule_list.go
+++ b/sqle/model/rule_list.go
@@ -1,37 +1,27 @@
package model
import (
+ "fmt"
"strings"
-
- "github.com/actiontech/sqle/sqle/errors"
)
type RuleTemplateDetail struct {
- Name string `json:"name"`
- Desc string `json:"desc"`
- DBType string `json:"db_type"`
- InstanceIds RowList `json:"instance_ids"`
- InstanceNames RowList `json:"instance_names"`
+ Name string `json:"name"`
+ Desc string `json:"desc"`
+ DBType string `json:"db_type"`
+ // InstanceIds RowList `json:"instance_ids"`
+ // InstanceNames RowList `json:"instance_names"`
}
-var ruleTemplatesQueryTpl = `SELECT rt1.name, rt1.desc, rt1.db_type,
-GROUP_CONCAT(DISTINCT COALESCE(instances.id,'')) AS instance_ids,
-GROUP_CONCAT(DISTINCT COALESCE(instances.name,'')) AS instance_names
-FROM rule_templates AS rt1
-LEFT JOIN instance_rule_template ON rt1.id = instance_rule_template.rule_template_id
-LEFT JOIN instances ON instance_rule_template.instance_id = instances.id AND instances.deleted_at IS NULL
-WHERE (SELECT COUNT(DISTINCT(rule_templates.id))
-
+var ruleTemplatesQueryTpl = `SELECT rule_templates.name, rule_templates.desc, rule_templates.db_type
{{- template "body" . }}
-AND rt1.id = rule_templates.id
-) > 0
-GROUP BY rt1.id
+
{{- if .limit }}
LIMIT :limit OFFSET :offset
{{- end -}}
`
-var ruleTemplatesCountTpl = `SELECT COUNT(DISTINCT rule_templates.id)
+var ruleTemplatesCountTpl = `SELECT COUNT(DISTINCT id)
{{- template "body" . -}}
`
@@ -39,15 +29,9 @@ var ruleTemplatesCountTpl = `SELECT COUNT(DISTINCT rule_templates.id)
var ruleTemplatesQueryBodyTpl = `
{{ define "body" }}
FROM rule_templates
-LEFT JOIN instance_rule_template ON rule_templates.id = instance_rule_template.rule_template_id
-LEFT JOIN instances ON instance_rule_template.instance_id = instances.id AND instances.deleted_at IS NULL
WHERE
-rule_templates.deleted_at IS NULL
-AND rule_templates.project_id = :project_id
-
-{{- if .filter_instance_name }}
-AND instances.name = :filter_instance_name
-{{- end }}
+deleted_at IS NULL
+AND project_id = :project_id
{{- end }}
`
@@ -62,18 +46,6 @@ func (s *Storage) GetRuleTemplatesByReq(data map[string]interface{}) (
return result, count, err
}
-func (s *Storage) GetRuleTemplateTotalByProjectName(projectName string) (uint64, error) {
- var count uint64
- err := s.db.
- Table("rule_templates").
- Joins("LEFT JOIN projects ON rule_templates.project_id = projects.id").
- Where("projects.name = ?", projectName).
- Where("rule_templates.deleted_at IS NULL").
- Count(&count).
- Error
- return count, errors.ConnectStorageErrWrapper(err)
-}
-
func (s *Storage) GetRulesByReq(data map[string]interface{}) (
result []*Rule, err error) {
db := s.db
@@ -91,6 +63,9 @@ func (s *Storage) GetRulesByReq(data map[string]interface{}) (
db = db.Where("rules.name in (?)", strings.Split(namesStr, ","))
}
}
+ if data["fuzzy_keyword_rule"] != "" {
+ db = db.Where("rules.`desc` like ? OR rules.annotation like ?", fmt.Sprintf("%%%s%%", data["fuzzy_keyword_rule"]), fmt.Sprintf("%%%s%%", data["fuzzy_keyword_rule"]))
+ }
err = db.Find(&result).Error
return result, err
}
@@ -113,6 +88,9 @@ func (s *Storage) GetCustomRulesByReq(data map[string]interface{}) (
db = db.Where("custom_rules.rule_id in (?)", strings.Split(namesStr, ","))
}
}
+ if data["fuzzy_keyword_rule"] != "" {
+ db = db.Where("custom_rules.`desc` like ? OR custom_rules.annotation like ?", fmt.Sprintf("%%%s%%", data["fuzzy_keyword_rule"]), fmt.Sprintf("%%%s%%", data["fuzzy_keyword_rule"]))
+ }
err = db.Find(&result).Error
return result, err
-}
\ No newline at end of file
+}
diff --git a/sqle/model/sql_audit_record.go b/sqle/model/sql_audit_record.go
index 9cdcae64dd..7a5d953bd9 100644
--- a/sqle/model/sql_audit_record.go
+++ b/sqle/model/sql_audit_record.go
@@ -15,8 +15,8 @@ type SQLAuditRecordTags struct {
type SQLAuditRecord struct {
Model
- ProjectId uint `gorm:"index;not null"`
- CreatorId uint `gorm:"not null"`
+ ProjectId string `gorm:"index;not null"`
+ CreatorId string `gorm:"not null"`
AuditRecordId string `gorm:"unique;not null"`
Tags JSON
@@ -44,15 +44,7 @@ func (s *Storage) UpdateSQLAuditRecordById(SQLAuditRecordId string, data SQLAudi
return errors.New(errors.ConnectStorageError, err)
}
-func (s *Storage) IsSQLAuditRecordBelongToCurrentUser(userId, projectId uint, SQLAuditRecordId string) (bool, error) {
- isManager, err := s.IsProjectManagerByID(userId, projectId)
- if err != nil {
- return false, errors.New(errors.ConnectStorageError, fmt.Errorf("check project manager failed: %v", err))
- }
- if isManager {
- return true, nil
- }
-
+func (s *Storage) IsSQLAuditRecordBelongToCurrentUser(userId, projectId string, SQLAuditRecordId string) (bool, error) {
count := 0
if err := s.db.Table("sql_audit_records").
Where("audit_record_id = ?", SQLAuditRecordId).
@@ -63,9 +55,9 @@ func (s *Storage) IsSQLAuditRecordBelongToCurrentUser(userId, projectId uint, SQ
return count == 1, nil
}
-func (s *Storage) GetSQLAuditRecordById(projectId uint, SQLAuditRecordId string) (record *SQLAuditRecord, exist bool, err error) {
+func (s *Storage) GetSQLAuditRecordById(projectId string, SQLAuditRecordId string) (record *SQLAuditRecord, exist bool, err error) {
record = &SQLAuditRecord{}
- if err = s.db.Preload("Task").Preload("Task.Instance").Preload("Task.ExecuteSQLs").
+ if err = s.db.Preload("Task").Preload("Task.ExecuteSQLs").
Where("project_id = ?", projectId).Where("audit_record_id = ?", SQLAuditRecordId).
Find(&record).Error; err != nil && err == gorm.ErrRecordNotFound {
return nil, false, nil
diff --git a/sqle/model/sql_audit_record_list.go b/sqle/model/sql_audit_record_list.go
index 7fedb6baec..109e30e719 100644
--- a/sqle/model/sql_audit_record_list.go
+++ b/sqle/model/sql_audit_record_list.go
@@ -10,11 +10,9 @@ import (
type SQLAuditRecordListItem struct {
AuditRecordId string `json:"audit_record_id"`
RecordCreatedAt *time.Time `json:"record_created_at"`
- CreatorName string `json:"creator_name"`
+ CreatorId string `json:"creator_id"`
Tags sql.NullString `json:"tags"`
- InstanceName sql.NullString `json:"instance_name"`
- InstanceHost sql.NullString `json:"instance_host"`
- InstancePort sql.NullString `json:"instance_port"`
+ InstanceId uint64 `json:"instance_id"`
TaskId uint `json:"task_id"`
DbType string `json:"db_type"`
InstanceSchema string `json:"instance_schema"`
@@ -29,12 +27,10 @@ var sqlAuditRecordQueryTpl = `
SELECT sql_audit_records.audit_record_id AS audit_record_id,
sql_audit_records.created_at AS record_created_at,
sql_audit_records.tags AS tags,
- create_user.login_name AS creator_name,
- instances.name AS instance_name,
- instances.db_host AS instance_host,
- instances.db_port AS instance_port,
+ sql_audit_records.creator_id AS creator_id,
tasks.id AS task_id,
tasks.db_type AS db_type,
+ tasks.instance_id AS instance_id,
tasks.instance_schema AS instance_schema,
tasks.audit_level AS audit_level,
tasks.status AS task_status,
@@ -58,17 +54,14 @@ SELECT COUNT(*)
var sqlAuditRecordQueryBodyTpl = `
{{ define "body" }}
FROM sql_audit_records
-LEFT JOIN projects AS p ON sql_audit_records.project_id = p.id
-LEFT JOIN users AS create_user ON sql_audit_records.creator_id = create_user.id
LEFT JOIN tasks ON sql_audit_records.task_id = tasks.id
-LEFT JOIN instances ON tasks.instance_id = instances.id
WHERE
sql_audit_records.deleted_at IS NULL
-AND p.name = :filter_project_name
+AND sql_audit_records.project_id = :filter_project_id
{{- if .check_user_can_access }}
-AND create_user.id = :filter_creator_id
+AND sql_audit_records.creator_id = :filter_creator_id
{{- end }}
{{- if .fuzzy_search_tags }}
@@ -83,8 +76,8 @@ AND tasks.status = :filter_task_status
AND tasks.status <> :filter_task_status_exclude
{{- end }}
-{{- if .filter_instance_name }}
-AND instances.name = :filter_instance_name
+{{- if .filter_instance_id }}
+AND tasks.instance_id = :filter_instance_id
{{- end }}
{{- if .filter_create_time_from }}
diff --git a/sqle/model/sql_manage.go b/sqle/model/sql_manage.go
index 86828a2723..82cdf151a6 100644
--- a/sqle/model/sql_manage.go
+++ b/sqle/model/sql_manage.go
@@ -18,12 +18,11 @@ type SqlManage struct {
InstanceName string `json:"instance_name"`
SchemaName string `json:"schema_name"`
- Assignees []*User `gorm:"many2many:sql_manage_assignees;"`
- Status string `json:"status" gorm:"default:\"unhandled\""`
- Remark string `json:"remark" gorm:"type:varchar(4000)"`
+ Assignees string `json:"assignees"`
+ Status string `json:"status" gorm:"default:\"unhandled\""`
+ Remark string `json:"remark" gorm:"type:varchar(4000)"`
- ProjectId uint `json:"project_id"`
- Project *Project `gorm:"foreignkey:ProjectId"`
+ ProjectId string `json:"project_id"`
AuditPlanId uint `json:"audit_plan_id"`
AuditPlan *AuditPlan `gorm:"foreignkey:AuditPlanId"`
diff --git a/sqle/model/sql_whitelist.go b/sqle/model/sql_whitelist.go
index 5fda788b09..68d6f708e1 100644
--- a/sqle/model/sql_whitelist.go
+++ b/sqle/model/sql_whitelist.go
@@ -15,7 +15,7 @@ const (
type SqlWhitelist struct {
Model
- ProjectId uint `gorm:"index; not null"`
+ ProjectId ProjectUID `gorm:"index; not null"`
// Value store SQL text.
Value string `json:"value" gorm:"not null;type:text"`
CapitalizedValue string `json:"-" gorm:"-"`
@@ -41,12 +41,24 @@ func (s SqlWhitelist) TableName() string {
return "sql_whitelist"
}
-func (s *Storage) GetSqlWhitelistByIdAndProjectName(sqlWhiteId, projectName string) (*SqlWhitelist, bool, error) {
+// func (s *Storage) GetSqlWhitelistByIdAndProjectName(sqlWhiteId, projectName string) (*SqlWhitelist, bool, error) {
+// sqlWhitelist := &SqlWhitelist{}
+// err := s.db.Table("sql_whitelist").
+// Joins("LEFT JOIN projects ON projects.id = sql_whitelist.project_id").
+// Where("sql_whitelist.id = ?", sqlWhiteId).
+// Where("projects.name = ?", projectName).
+// First(sqlWhitelist).Error
+// if err == gorm.ErrRecordNotFound {
+// return sqlWhitelist, false, nil
+// }
+// return sqlWhitelist, true, errors.New(errors.ConnectStorageError, err)
+// }
+
+func (s *Storage) GetSqlWhitelistByIdAndProjectUID(sqlWhiteId string, projectUID ProjectUID) (*SqlWhitelist, bool, error) {
sqlWhitelist := &SqlWhitelist{}
err := s.db.Table("sql_whitelist").
- Joins("LEFT JOIN projects ON projects.id = sql_whitelist.project_id").
Where("sql_whitelist.id = ?", sqlWhiteId).
- Where("projects.name = ?", projectName).
+ Where("project_id = ?", projectUID).
First(sqlWhitelist).Error
if err == gorm.ErrRecordNotFound {
return sqlWhitelist, false, nil
@@ -54,12 +66,29 @@ func (s *Storage) GetSqlWhitelistByIdAndProjectName(sqlWhiteId, projectName stri
return sqlWhitelist, true, errors.New(errors.ConnectStorageError, err)
}
-func (s *Storage) GetSqlWhitelistByProjectName(pageIndex, pageSize uint32, projectName string) ([]SqlWhitelist, uint32, error) {
+// func (s *Storage) GetSqlWhitelistByProjectName(pageIndex, pageSize uint32, projectName string) ([]SqlWhitelist, uint32, error) {
+// var count uint32
+// sqlWhitelist := []SqlWhitelist{}
+// query := s.db.Table("sql_whitelist").
+// Joins("LEFT JOIN projects ON projects.id = sql_whitelist.project_id").
+// Where("projects.name = ?", projectName)
+// if pageSize == 0 {
+// err := query.Order("id desc").Find(&sqlWhitelist).Count(&count).Error
+// return sqlWhitelist, count, errors.New(errors.ConnectStorageError, err)
+// }
+// err := query.Count(&count).Error
+// if err != nil {
+// return sqlWhitelist, 0, errors.New(errors.ConnectStorageError, err)
+// }
+// err = query.Offset((pageIndex - 1) * pageSize).Limit(pageSize).Order("id desc").Find(&sqlWhitelist).Error
+// return sqlWhitelist, count, errors.New(errors.ConnectStorageError, err)
+// }
+
+func (s *Storage) GetSqlWhitelistByProjectUID(pageIndex, pageSize uint32, projectUID ProjectUID) ([]SqlWhitelist, uint32, error) {
var count uint32
sqlWhitelist := []SqlWhitelist{}
query := s.db.Table("sql_whitelist").
- Joins("LEFT JOIN projects ON projects.id = sql_whitelist.project_id").
- Where("projects.name = ?", projectName)
+ Where("project_id = ?", projectUID)
if pageSize == 0 {
err := query.Order("id desc").Find(&sqlWhitelist).Count(&count).Error
return sqlWhitelist, count, errors.New(errors.ConnectStorageError, err)
@@ -72,25 +101,22 @@ func (s *Storage) GetSqlWhitelistByProjectName(pageIndex, pageSize uint32, proje
return sqlWhitelist, count, errors.New(errors.ConnectStorageError, err)
}
-
-func (s *Storage) GetSqlWhitelistByInstanceId(instanceId uint) ([]SqlWhitelist, error) {
+func (s *Storage) GetSqlWhitelistByProjectId(projectId string) ([]SqlWhitelist, error) {
sqlWhitelist := []SqlWhitelist{}
err := s.db.Table("sql_whitelist").
- Joins("LEFT JOIN instances ON sql_whitelist.project_id = instances.project_id").
- Where("instances.id = ?", instanceId).
+ Where("sql_whitelist.project_id = ?", projectId).
Find(&sqlWhitelist).Error
- return sqlWhitelist, errors.New(errors.ConnectStorageError, err)
+ return sqlWhitelist, errors.New(errors.ConnectStorageError, err)
}
-
-func (s *Storage) GetSqlWhitelistTotalByProjectName(projectName string) (uint64, error) {
- var count uint64
- err := s.db.
- Table("sql_whitelist").
- Joins("LEFT JOIN projects ON sql_whitelist.project_id = projects.id").
- Where("projects.name = ?", projectName).
- Where("sql_whitelist.deleted_at IS NULL").
- Count(&count).
- Error
- return count, errors.ConnectStorageErrWrapper(err)
-}
+// func (s *Storage) GetSqlWhitelistTotalByProjectName(projectName string) (uint64, error) {
+// var count uint64
+// err := s.db.
+// Table("sql_whitelist").
+// Joins("LEFT JOIN projects ON sql_whitelist.project_id = projects.id").
+// Where("projects.name = ?", projectName).
+// Where("sql_whitelist.deleted_at IS NULL").
+// Count(&count).
+// Error
+// return count, errors.ConnectStorageErrWrapper(err)
+// }
diff --git a/sqle/model/sync_instance_task.go b/sqle/model/sync_instance_task.go
index 360cc8cbdf..98a3d651a2 100644
--- a/sqle/model/sync_instance_task.go
+++ b/sqle/model/sync_instance_task.go
@@ -1,21 +1,21 @@
package model
-import (
- "time"
-)
+// import (
+// "time"
+// )
-type SyncInstanceTask struct {
- Model
- Source string `json:"source" gorm:"not null"`
- Version string `json:"version" gorm:"not null"`
- URL string `json:"url" gorm:"not null"`
- DbType string `json:"db_type" gorm:"not null"`
- RuleTemplateID uint `json:"rule_template_id" gorm:"not null"`
- // Cron表达式
- SyncInstanceInterval string `json:"sync_instance_interval" gorm:"not null"`
- LastSyncStatus string `json:"last_sync_status" gorm:"default:\"initialized\""`
- LastSyncSuccessTime *time.Time `json:"last_sync_success_time"`
+// type SyncInstanceTask struct {
+// Model
+// Source string `json:"source" gorm:"not null"`
+// Version string `json:"version" gorm:"not null"`
+// URL string `json:"url" gorm:"not null"`
+// DbType string `json:"db_type" gorm:"not null"`
+// RuleTemplateID uint `json:"rule_template_id" gorm:"not null"`
+// // Cron表达式
+// SyncInstanceInterval string `json:"sync_instance_interval" gorm:"not null"`
+// LastSyncStatus string `json:"last_sync_status" gorm:"default:\"initialized\""`
+// LastSyncSuccessTime *time.Time `json:"last_sync_success_time"`
- // 关系表
- RuleTemplate *RuleTemplate `gorm:"foreignKey:RuleTemplateID"`
-}
+// // 关系表
+// RuleTemplate *RuleTemplate `gorm:"foreignKey:RuleTemplateID"`
+// }
diff --git a/sqle/model/task.go b/sqle/model/task.go
index 6f482d3fa0..84ca78bd59 100644
--- a/sqle/model/task.go
+++ b/sqle/model/task.go
@@ -40,7 +40,7 @@ const TaskExecResultOK = "OK"
type Task struct {
Model
- InstanceId uint `json:"instance_id"`
+ InstanceId uint64 `json:"instance_id"`
Schema string `json:"instance_schema" gorm:"column:instance_schema" example:"db1"`
PassRate float64 `json:"pass_rate"`
Score int32 `json:"score"`
@@ -49,12 +49,11 @@ type Task struct {
DBType string `json:"db_type" gorm:"default:'mysql'" example:"mysql"`
Status string `json:"status" gorm:"default:\"initialized\""`
GroupId uint `json:"group_id" gorm:"column:group_id"`
- CreateUserId uint
+ CreateUserId uint64
ExecStartAt *time.Time
ExecEndAt *time.Time
- CreateUser *User `gorm:"foreignkey:CreateUserId"`
- Instance *Instance `json:"-" gorm:"foreignkey:InstanceId"`
+ Instance *Instance
ExecuteSQLs []*ExecuteSQL `json:"-" gorm:"foreignkey:TaskId"`
RollbackSQLs []*RollbackSQL `json:"-" gorm:"foreignkey:TaskId"`
}
@@ -280,7 +279,7 @@ func (s *Storage) GetTaskStatusByID(id string) (string, error) {
func (s *Storage) GetTaskById(taskId string) (*Task, bool, error) {
task := &Task{}
- err := s.db.Where("id = ?", taskId).Preload("Instance").First(task).Error
+ err := s.db.Where("id = ?", taskId).First(task).Error
if err == gorm.ErrRecordNotFound {
return nil, false, nil
}
@@ -289,7 +288,7 @@ func (s *Storage) GetTaskById(taskId string) (*Task, bool, error) {
func (s *Storage) GetTasksByIds(taskIds []uint) (tasks []*Task, foundAllIds bool, err error) {
taskIds = utils.RemoveDuplicateUint(taskIds)
- err = s.db.Where("id IN (?)", taskIds).Preload("Instance").Find(&tasks).Error
+ err = s.db.Where("id IN (?)", taskIds).Find(&tasks).Error
if err != nil {
return nil, false, errors.New(errors.ConnectStorageError, err)
}
@@ -301,7 +300,7 @@ func (s *Storage) GetTasksByIds(taskIds []uint) (tasks []*Task, foundAllIds bool
func (s *Storage) GetTaskDetailById(taskId string) (*Task, bool, error) {
task := &Task{}
- err := s.db.Where("id = ?", taskId).Preload("Instance").
+ err := s.db.Where("id = ?", taskId).
Preload("ExecuteSQLs").Preload("RollbackSQLs").First(task).Error
if err == gorm.ErrRecordNotFound {
return nil, false, nil
@@ -425,11 +424,11 @@ func (s *Storage) GetRelatedDDLTask(task *Task) ([]Task, error) {
Schema: task.Schema,
PassRate: 1,
Status: TaskStatusAudited,
- }).Preload("Instance").Preload("ExecuteSQLs").Find(&tasks).Error
+ }).Preload("ExecuteSQLs").Find(&tasks).Error
return tasks, errors.New(errors.ConnectStorageError, err)
}
-func (s *Storage) GetTaskByInstanceId(instanceId uint) ([]Task, error) {
+func (s *Storage) GetTaskByInstanceId(instanceId uint64) ([]Task, error) {
tasks := []Task{}
err := s.db.Where(&Task{InstanceId: instanceId}).Find(&tasks).Error
return tasks, errors.New(errors.ConnectStorageError, err)
@@ -564,7 +563,7 @@ type TaskGroup struct {
func (s *Storage) GetTaskGroupByGroupId(groupId uint) (*TaskGroup, error) {
taskGroup := &TaskGroup{}
- err := s.db.Preload("Tasks").Preload("Tasks.Instance").
+ err := s.db.Preload("Tasks").
Where("id = ?", groupId).Find(&taskGroup).Error
return taskGroup, errors.New(errors.ConnectStorageError, err)
}
@@ -596,48 +595,6 @@ func (s *Storage) GetSqlAvgExecutionTimeStatistic(limit uint) ([]*SqlExecuteStat
}
type SqlExecutionCount struct {
- InstanceName string `json:"instance_name"`
- Count uint `json:"count"`
-}
-
-// GetSqlExecutionFailCount 获取sql上线失败统计
-func (s *Storage) GetSqlExecutionFailCount() ([]SqlExecutionCount, error) {
- var sqlExecutionFailCount []SqlExecutionCount
-
- err := s.db.Model(&Workflow{}).Select("i.name as instance_name, count(*) as count").
- Joins("left join workflow_records wr on workflows.workflow_record_id = wr.id").
- Joins("left join workflow_instance_records wir on wr.id = wir.workflow_record_id").
- Joins("left join tasks t on wir.task_id = t.id").
- Joins("left join instances i on t.instance_id = i.id").
- Where("t.status = ?", TaskStatusExecuteFailed).
- Where("t.exec_start_at is not null").
- Where("t.exec_end_at is not null").
- Group("t.instance_id").
- Scan(&sqlExecutionFailCount).Error
- if err != nil {
- return nil, errors.ConnectStorageErrWrapper(err)
- }
-
- return sqlExecutionFailCount, nil
-}
-
-// GetSqlExecutionTotalCount 获取sql上线总数统计
-// 上线总数(根据数据源划分)是指:正在上线,上线成功,上线失败 task的总数
-func (s *Storage) GetSqlExecutionTotalCount() ([]SqlExecutionCount, error) {
- var sqlExecutionTotalCount []SqlExecutionCount
-
- err := s.db.Model(&Workflow{}).Select("i.name as instance_name, count(*) as count").
- Joins("left join workflow_records wr on workflows.workflow_record_id = wr.id").
- Joins("left join workflow_instance_records wir on wr.id = wir.workflow_record_id").
- Joins("left join tasks t on wir.task_id = t.id").
- Joins("left join instances i on t.instance_id = i.id").
- Where("t.status not in (?)", []string{TaskStatusInit, TaskStatusAudited}).
- Where("t.exec_start_at is not null").
- Group("t.instance_id").
- Scan(&sqlExecutionTotalCount).Error
- if err != nil {
- return nil, errors.ConnectStorageErrWrapper(err)
- }
-
- return sqlExecutionTotalCount, nil
+ Count uint `json:"count"`
+ InstanceId uint64 `json:"instance_id"`
}
diff --git a/sqle/model/user.go b/sqle/model/user.go
index c22a9d031b..2637f69229 100644
--- a/sqle/model/user.go
+++ b/sqle/model/user.go
@@ -5,9 +5,6 @@ import (
"strings"
"github.com/actiontech/sqle/sqle/errors"
- "github.com/actiontech/sqle/sqle/log"
- "github.com/actiontech/sqle/sqle/utils"
- "github.com/jinzhu/gorm"
)
const (
@@ -39,292 +36,292 @@ type User struct {
SecretPassword string `json:"secret_password" gorm:"not null;column:password"`
UserAuthenticationType UserAuthenticationType `json:"user_authentication_type" gorm:"not null"`
- UserGroups []*UserGroup `gorm:"many2many:user_group_users"`
- Stat uint `json:"stat" gorm:"not null; default: 0; comment:'0:正常 1:被禁用'"`
- ThirdPartyUserID string `json:"third_party_user_id"`
+ // UserGroups []*UserGroup `gorm:"many2many:user_group_users"`
+ Stat uint `json:"stat" gorm:"not null; default: 0; comment:'0:正常 1:被禁用'"`
+ ThirdPartyUserID string `json:"third_party_user_id"`
WorkflowStepTemplates []*WorkflowStepTemplate `gorm:"many2many:workflow_step_template_user"`
WorkflowInstanceRecords []*WorkflowInstanceRecord `gorm:"many2many:workflow_instance_record_user"`
}
-func (u *User) IsDisabled() bool {
- return u.Stat == Disabled
-}
-
-func (u *User) SetStat(stat uint) {
- u.Stat = stat
-}
-
-// BeforeSave is a hook implement gorm model before exec create
-func (i *User) BeforeSave() error {
- return i.encryptPassword()
-}
-
-// AfterFind is a hook implement gorm model after query, ignore err if query from db
-func (i *User) AfterFind() error {
- err := i.decryptPassword()
- if err != nil {
- log.NewEntry().Errorf("decrypt password for user %s failed, error: %v", i.Name, err)
- }
- return nil
-}
-
-func (i *User) decryptPassword() error {
- if i == nil {
- return nil
- }
- if i.Password == "" {
- data, err := utils.AesDecrypt(i.SecretPassword)
- if err != nil {
- return err
- } else {
- i.Password = data
- }
- }
- return nil
-}
-
-func (i *User) encryptPassword() error {
- if i == nil {
- return nil
- }
- if i.SecretPassword == "" {
- data, err := utils.AesEncrypt(i.Password)
- if err != nil {
- return err
- }
- i.SecretPassword = data
- }
- return nil
-}
+// // BeforeSave is a hook implement gorm model before exec create
+// func (i *User) BeforeSave() error {
+// return i.encryptPassword()
+// }
+
+// // AfterFind is a hook implement gorm model after query, ignore err if query from db
+// func (i *User) AfterFind() error {
+// err := i.decryptPassword()
+// if err != nil {
+// log.NewEntry().Errorf("decrypt password for user %s failed, error: %v", i.Name, err)
+// }
+// return nil
+// }
+
+// func (i *User) decryptPassword() error {
+// if i == nil {
+// return nil
+// }
+// if i.Password == "" {
+// data, err := utils.AesDecrypt(i.SecretPassword)
+// if err != nil {
+// return err
+// } else {
+// i.Password = data
+// }
+// }
+// return nil
+// }
+
+// func (i *User) encryptPassword() error {
+// if i == nil {
+// return nil
+// }
+// if i.SecretPassword == "" {
+// data, err := utils.AesEncrypt(i.Password)
+// if err != nil {
+// return err
+// }
+// i.SecretPassword = data
+// }
+// return nil
+// }
func (i *User) FingerPrint() string {
return fmt.Sprintf(`{"id":"%v", "secret_password":"%v" }`, i.ID, i.SecretPassword)
}
-func (s *Storage) GetUserByThirdPartyUserID(thirdPartyUserID string) (*User, bool, error) {
- t := &User{}
- err := s.db.Where("third_party_user_id = ?", thirdPartyUserID).First(t).Error
- if err == gorm.ErrRecordNotFound {
- return t, false, nil
- }
- return t, true, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetUserByName(name string) (*User, bool, error) {
- t := &User{}
- err := s.db.Where("login_name = ?", name).First(t).Error
- if err == gorm.ErrRecordNotFound {
- return t, false, nil
- }
- return t, true, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetUserDetailByName(name string) (*User, bool, error) {
- t := &User{}
- err := s.db.Preload("UserGroups").
- Where("login_name = ?", name).First(t).Error
- if err == gorm.ErrRecordNotFound {
- return t, false, nil
- }
- return t, true, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetUsersByNames(names []string) ([]*User, error) {
- users := []*User{}
- err := s.db.Where("login_name in (?)", names).Find(&users).Error
- return users, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetUserTipsByProject(projectName string) ([]*User, error) {
- if projectName == "" {
- return s.GetAllUserTip()
- }
-
- query := `
-SELECT DISTINCT users.login_name
-FROM users
-LEFT JOIN project_user on project_user.user_id = users.id
-LEFT JOIN projects on project_user.project_id = projects.id
-LEFT JOIN user_group_users on users.id = user_group_users.user_id
-LEFT JOIN project_user_group on user_group_users.user_group_id = project_user_group.user_group_id
-LEFT JOIN projects as p on project_user_group.project_id = p.id
-WHERE users.stat = 0
-AND(
- projects.name = ?
- AND
- projects.deleted_at IS NULL
-OR
- p.name = ?
- AND
- p.deleted_at IS NULL
-)
-`
-
- var users []*User
- err := s.db.Raw(query, projectName, projectName).Scan(&users).Error
-
- return users, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetAllUserTip() ([]*User, error) {
- users := []*User{}
- err := s.db.Select("login_name").Where("stat=0").Find(&users).Error
- return users, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetAllUserCount() (int64, error) {
- var count int64
- return count, s.db.Model(&User{}).Count(&count).Error
-}
-
-func (s *Storage) GetAndCheckUserExist(userNames []string) (users []*User, err error) {
- users, err = s.GetUsersByNames(userNames)
- if err != nil {
- return users, err
- }
- existUserNames := map[string]struct{}{}
+// func (s *Storage) GetUserByThirdPartyUserID(thirdPartyUserID string) (*User, bool, error) {
+// t := &User{}
+// err := s.db.Where("third_party_user_id = ?", thirdPartyUserID).First(t).Error
+// if err == gorm.ErrRecordNotFound {
+// return t, false, nil
+// }
+// return t, true, errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) GetUserByName(name string) (*User, bool, error) {
+// t := &User{}
+// err := s.db.Where("login_name = ?", name).First(t).Error
+// if err == gorm.ErrRecordNotFound {
+// return t, false, nil
+// }
+// return t, true, errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) GetUserDetailByName(name string) (*User, bool, error) {
+// t := &User{}
+// err := s.db.Preload("UserGroups").
+// Where("login_name = ?", name).First(t).Error
+// if err == gorm.ErrRecordNotFound {
+// return t, false, nil
+// }
+// return t, true, errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) GetUsersByNames(names []string) ([]*User, error) {
+// users := []*User{}
+// err := s.db.Where("login_name in (?)", names).Find(&users).Error
+// return users, errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) GetUserTipsByProject(projectName string) ([]*User, error) {
+// if projectName == "" {
+// return s.GetAllUserTip()
+// }
+
+// query := `
+// SELECT DISTINCT users.login_name
+// FROM users
+// LEFT JOIN project_user on project_user.user_id = users.id
+// LEFT JOIN projects on project_user.project_id = projects.id
+// LEFT JOIN user_group_users on users.id = user_group_users.user_id
+// LEFT JOIN project_user_group on user_group_users.user_group_id = project_user_group.user_group_id
+// LEFT JOIN projects as p on project_user_group.project_id = p.id
+// WHERE users.stat = 0
+// AND(
+// projects.name = ?
+// AND
+// projects.deleted_at IS NULL
+// OR
+// p.name = ?
+// AND
+// p.deleted_at IS NULL
+// )
+// `
+
+// var users []*User
+// err := s.db.Raw(query, projectName, projectName).Scan(&users).Error
+
+// return users, errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) GetAllUserTip() ([]*User, error) {
+// users := []*User{}
+// err := s.db.Select("login_name").Where("stat=0").Find(&users).Error
+// return users, errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) GetAllUserCount() (int64, error) {
+// var count int64
+// return count, s.db.Model(&User{}).Count(&count).Error
+// }
+
+// func (s *Storage) GetAndCheckUserExist(userNames []string) (users []*User, err error) {
+// users, err = s.GetUsersByNames(userNames)
+// if err != nil {
+// return users, err
+// }
+// existUserNames := map[string]struct{}{}
+// for _, user := range users {
+// existUserNames[user.Name] = struct{}{}
+// }
+// notExistUserNames := []string{}
+// for _, userName := range userNames {
+// if _, ok := existUserNames[userName]; !ok {
+// notExistUserNames = append(notExistUserNames, userName)
+// }
+// }
+// if len(notExistUserNames) > 0 {
+// return users, errors.New(errors.DataNotExist,
+// fmt.Errorf("user %s not exist", strings.Join(notExistUserNames, ", ")))
+// }
+// return users, nil
+// }
+
+// func (s *Storage) UpdatePassword(user *User, newPassword string) error {
+// user.Password = newPassword
+// // User{}.encryptPassword(): SecretPassword为空时才会对密码进行加密操作
+// user.SecretPassword = ""
+// return s.Save(user)
+// }
+
+// func (s *Storage) UserHasRunningWorkflow(userId uint) (bool, error) {
+// // count how many running workflows have been assigned to this user
+// query := `SELECT COUNT(user_id) FROM users
+// LEFT JOIN workflow_step_user wstu ON users.id = wstu.user_id
+// LEFT JOIN workflow_steps ws ON wstu.workflow_step_id = ws.id
+// LEFT JOIN workflow_records wr ON ws.workflow_record_id = wr.id
+// WHERE users.id = ? AND wr.status IN (?) AND ws.state = ?;`
+// var count uint
+// err := s.db.Raw(query, userId, []string{WorkflowStatusWaitForAudit, WorkflowStatusWaitForExecution}, WorkflowStepStateInit).Count(&count).Error
+// if err != nil {
+// return false, errors.New(errors.ConnectStorageError, err)
+// }
+// if count > 0 {
+// return true, nil
+// }
+
+// // count how many running workflows have been created by this user
+// var workflows []*Workflow
+// err = s.db.Model(workflows).
+// Preload("Record", "status IN (?)", []string{WorkflowStatusWaitForAudit, WorkflowStatusWaitForExecution}).
+// Where("create_user_id = ?", userId).
+// Find(&workflows).Error
+// return len(workflows) > 0 && workflows[0].Record != nil, errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) UserHasBindWorkflowTemplate(user *User) (bool, error) {
+// count := 0
+// err := s.db.Table("workflow_templates").
+// Joins("join workflow_step_templates on workflow_templates.id = workflow_step_templates.workflow_template_id").
+// Joins("join workflow_step_template_user on workflow_step_templates.id = workflow_step_template_user.workflow_step_template_id").
+// Where("workflow_templates.deleted_at is null").
+// Where("workflow_step_template_user.user_id = ?", user.ID).
+// Count(&count).Error
+// return count > 0, errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) SaveUserAndAssociations(
+// user *User, userGroups []*UserGroup, managementPermissionCodes *[]uint) (err error) {
+// return s.Tx(func(txDB *gorm.DB) error {
+
+// // User
+// if err := txDB.Save(user).Error; err != nil {
+// txDB.Rollback()
+// return errors.ConnectStorageErrWrapper(err)
+// }
+
+// // user groups
+// if userGroups != nil {
+// if err := txDB.Model(user).
+// Association("UserGroups").
+// Replace(userGroups).Error; err != nil {
+// txDB.Rollback()
+// return errors.ConnectStorageErrWrapper(err)
+// }
+// }
+
+// // permission
+// if managementPermissionCodes != nil {
+// if err := updateManagementPermission(txDB, user.ID, *managementPermissionCodes); err != nil {
+// txDB.Rollback()
+// return errors.ConnectStorageErrWrapper(err)
+// }
+// }
+
+// return nil
+// })
+// }
+
+// func (s *Storage) GetUserByID(id uint) (*User, bool, error) {
+// u := &User{}
+// err := s.db.Model(User{}).Where("id = ?", id).Find(u).Error
+// if err == gorm.ErrRecordNotFound {
+// return u, false, nil
+// }
+// return u, true, errors.New(errors.ConnectStorageError, err)
+// }
+
+// func (s *Storage) GetUserTotalInProjectByProjectName(projectName string) (uint64, error) {
+// sql := `
+// SELECT
+// COUNT(DISTINCT users.id)
+// FROM
+// users
+// LEFT JOIN project_user ON users.id = project_user.user_id
+// LEFT JOIN projects AS p ON p.id = project_user.project_id
+// LEFT JOIN user_group_users ON user_group_users.user_id = users.id
+// LEFT JOIN project_user_group ON project_user_group.user_group_id = user_group_users.user_group_id
+// LEFT JOIN projects AS pg ON pg.id = project_user_group.project_id
+// WHERE
+// users.deleted_at IS NULL
+// AND(
+// (
+// p.name = ?
+// AND
+// p.deleted_at IS NULL
+// )
+// OR
+// (
+// pg.name = ?
+// AND
+// pg.deleted_at IS NULL
+// )
+// )
+// `
+// var count uint64
+// err := s.db.Raw(sql, projectName, projectName).Count(&count).Error
+// return count, errors.ConnectStorageErrWrapper(err)
+// }
+
+// func (s *Storage) GetMemberTips(projectName string) ([]*User, error) {
+// users := []*User{}
+// err := s.db.Model(&User{}).Select("login_name").
+// Joins("LEFT JOIN project_user ON project_user.user_id = users.id").
+// Joins("LEFT JOIN projects ON projects.id = project_user.project_id").
+// Where("projects.deleted_at IS NULL").
+// Where("projects.name = ?", projectName).
+// Find(&users).Error
+// return users, errors.ConnectStorageErrWrapper(err)
+// }
+
+func genIdsByUsers(users []*User) string {
+ ids := make([]string, 0)
for _, user := range users {
- existUserNames[user.Name] = struct{}{}
- }
- notExistUserNames := []string{}
- for _, userName := range userNames {
- if _, ok := existUserNames[userName]; !ok {
- notExistUserNames = append(notExistUserNames, userName)
- }
- }
- if len(notExistUserNames) > 0 {
- return users, errors.New(errors.DataNotExist,
- fmt.Errorf("user %s not exist", strings.Join(notExistUserNames, ", ")))
- }
- return users, nil
-}
-
-func (s *Storage) UpdatePassword(user *User, newPassword string) error {
- user.Password = newPassword
- // User{}.encryptPassword(): SecretPassword为空时才会对密码进行加密操作
- user.SecretPassword = ""
- return s.Save(user)
-}
-
-func (s *Storage) UserHasRunningWorkflow(userId uint) (bool, error) {
- // count how many running workflows have been assigned to this user
- query := `SELECT COUNT(user_id) FROM users
-LEFT JOIN workflow_step_user wstu ON users.id = wstu.user_id
-LEFT JOIN workflow_steps ws ON wstu.workflow_step_id = ws.id
-LEFT JOIN workflow_records wr ON ws.workflow_record_id = wr.id
-WHERE users.id = ? AND wr.status IN (?) AND ws.state = ?;`
- var count uint
- err := s.db.Raw(query, userId, []string{WorkflowStatusWaitForAudit, WorkflowStatusWaitForExecution}, WorkflowStepStateInit).Count(&count).Error
- if err != nil {
- return false, errors.New(errors.ConnectStorageError, err)
- }
- if count > 0 {
- return true, nil
- }
-
- // count how many running workflows have been created by this user
- var workflows []*Workflow
- err = s.db.Model(workflows).
- Preload("Record", "status IN (?)", []string{WorkflowStatusWaitForAudit, WorkflowStatusWaitForExecution}).
- Where("create_user_id = ?", userId).
- Find(&workflows).Error
- return len(workflows) > 0 && workflows[0].Record != nil, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) UserHasBindWorkflowTemplate(user *User) (bool, error) {
- count := 0
- err := s.db.Table("workflow_templates").
- Joins("join workflow_step_templates on workflow_templates.id = workflow_step_templates.workflow_template_id").
- Joins("join workflow_step_template_user on workflow_step_templates.id = workflow_step_template_user.workflow_step_template_id").
- Where("workflow_templates.deleted_at is null").
- Where("workflow_step_template_user.user_id = ?", user.ID).
- Count(&count).Error
- return count > 0, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) SaveUserAndAssociations(
- user *User, userGroups []*UserGroup, managementPermissionCodes *[]uint) (err error) {
- return s.Tx(func(txDB *gorm.DB) error {
-
- // User
- if err := txDB.Save(user).Error; err != nil {
- txDB.Rollback()
- return errors.ConnectStorageErrWrapper(err)
- }
-
- // user groups
- if userGroups != nil {
- if err := txDB.Model(user).
- Association("UserGroups").
- Replace(userGroups).Error; err != nil {
- txDB.Rollback()
- return errors.ConnectStorageErrWrapper(err)
- }
- }
-
- // permission
- if managementPermissionCodes != nil {
- if err := updateManagementPermission(txDB, user.ID, *managementPermissionCodes); err != nil {
- txDB.Rollback()
- return errors.ConnectStorageErrWrapper(err)
- }
- }
-
- return nil
- })
-}
-
-func (s *Storage) GetUserByID(id uint) (*User, bool, error) {
- u := &User{}
- err := s.db.Model(User{}).Where("id = ?", id).Find(u).Error
- if err == gorm.ErrRecordNotFound {
- return u, false, nil
+ ids = append(ids, user.GetIDStr())
}
- return u, true, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetUserTotalInProjectByProjectName(projectName string) (uint64, error) {
- sql := `
-SELECT
- COUNT(DISTINCT users.id)
-FROM
- users
- LEFT JOIN project_user ON users.id = project_user.user_id
- LEFT JOIN projects AS p ON p.id = project_user.project_id
- LEFT JOIN user_group_users ON user_group_users.user_id = users.id
- LEFT JOIN project_user_group ON project_user_group.user_group_id = user_group_users.user_group_id
- LEFT JOIN projects AS pg ON pg.id = project_user_group.project_id
-WHERE
- users.deleted_at IS NULL
-AND(
- (
- p.name = ?
- AND
- p.deleted_at IS NULL
- )
- OR
- (
- pg.name = ?
- AND
- pg.deleted_at IS NULL
- )
-)
-`
- var count uint64
- err := s.db.Raw(sql, projectName, projectName).Count(&count).Error
- return count, errors.ConnectStorageErrWrapper(err)
-}
-
-func (s *Storage) GetMemberTips(projectName string) ([]*User, error) {
- users := []*User{}
- err := s.db.Model(&User{}).Select("login_name").
- Joins("LEFT JOIN project_user ON project_user.user_id = users.id").
- Joins("LEFT JOIN projects ON projects.id = project_user.project_id").
- Where("projects.deleted_at IS NULL").
- Where("projects.name = ?", projectName).
- Find(&users).Error
- return users, errors.ConnectStorageErrWrapper(err)
+ return strings.Join(ids, ",")
}
type UserRole struct {
@@ -357,17 +354,18 @@ func (s *Storage) GetUserRoleFromUserGroupByProjectName(projectName string) ([]*
return userRoles, errors.ConnectStorageErrWrapper(err)
}
-func GetDistinctOfUsers(users1, users2 []*User) []*User {
- resUsers := users1
+func GetDistinctOfUsers(users1, users2 []*User) []string {
+ resUsers := make([]string, 0)
m := make(map[uint]struct{})
for _, user := range users1 {
m[user.ID] = struct{}{}
+ resUsers = append(resUsers, user.GetIDStr())
}
for _, user := range users2 {
_, ok := m[user.ID]
if !ok {
- resUsers = append(resUsers, user)
+ resUsers = append(resUsers, user.GetIDStr())
}
}
diff --git a/sqle/model/user_group.go b/sqle/model/user_group.go
index 5d21017dda..7f24e6919a 100644
--- a/sqle/model/user_group.go
+++ b/sqle/model/user_group.go
@@ -1,205 +1,205 @@
package model
-import (
- "strings"
-
- "github.com/actiontech/sqle/sqle/errors"
- "github.com/jinzhu/gorm"
-)
-
-// NOTE: related model:
-// - ProjectMemberGroupRole
-type UserGroup struct {
- Model
- Name string `json:"name" gorm:"index"`
- Desc string `json:"desc" gorm:"column:description"`
- Users []*User `gorm:"many2many:user_group_users"`
- Stat uint `json:"stat" gorm:"comment:'0:active,1:disabled'"`
-}
-
-func (ug *UserGroup) TableName() string {
- return "user_groups"
-}
-
-func (ug *UserGroup) SetStat(stat int) {
- ug.Stat = uint(stat)
-}
-
-func (ug *UserGroup) IsDisabled() bool {
- return ug.Stat == Disabled
-}
-
-func (s *Storage) GetUserGroupByName(name string) (
- userGroup *UserGroup, isExist bool, err error) {
- userGroup = &UserGroup{}
-
- err = s.db.Where("name = ?", name).First(userGroup).Error
- if gorm.IsRecordNotFoundError(err) {
- return nil, false, nil
- }
-
- return userGroup, true, err
-}
-
-func (s *Storage) SaveUserGroupAndAssociations(
- ug *UserGroup, us []*User) (err error) {
-
- return s.Tx(func(txDB *gorm.DB) error {
- if err := txDB.Save(ug).Error; err != nil {
- return err
- }
-
- // save user group users
- if us != nil {
- if err := txDB.Model(ug).Association("Users").Replace(us).Error; err != nil {
- return err
- }
- }
-
- return nil
- })
-}
-
-var userGroupTipsQueryTpl = `SELECT
-user_groups.name AS group_name,
-GROUP_CONCAT(DISTINCT COALESCE(users.login_name,'')) AS user_names
-{{- template "body" . }}
-GROUP BY user_groups.id
-`
-
-var userGroupTipsQueryBodyTpl = `
-{{ define "body" }}
-FROM user_groups
-LEFT JOIN user_group_users ON user_groups.id = user_group_users.user_group_id
-LEFT JOIN users ON user_group_users.user_id = users.id AND users.deleted_at IS NULL
-
-{{- if .project_name }}
-LEFT JOIN project_user_group on project_user_group.user_group_id = user_groups.id
-LEFT JOIN projects on project_user_group.project_id = projects.id
-{{- end }}
-
-WHERE user_groups.deleted_at IS NULL
-AND user_groups.stat=0
-
-{{- if .project_name }}
-AND projects.name = :project_name
-AND projects.deleted_at IS NULL
-{{- end }}
-
-{{- end }}
-
-`
-
-type UserGroupTips struct {
- Name string `json:"group_name"`
- UserNames RowList `json:"user_names"`
-}
-
-func (s *Storage) GetUserGroupTipByProject(data map[string]interface{}) ([]*UserGroupTips, error) {
- results := []*UserGroupTips{}
- err := s.getListResult(userGroupTipsQueryTpl, userGroupTipsQueryBodyTpl, data, &results)
- if err != nil {
- return nil, err
- }
-
- return results, errors.New(errors.ConnectStorageError, err)
-}
-
-var userGroupsQueryTpl = `SELECT
-user_groups.id,
-user_groups.name,
-user_groups.description,
-user_groups.stat,
-GROUP_CONCAT(DISTINCT COALESCE(users.login_name,'')) AS user_names
-FROM user_groups
-LEFT JOIN user_group_users ON user_groups.id = user_group_users.user_group_id
-LEFT JOIN users ON user_group_users.user_id = users.id AND users.deleted_at IS NULL
-WHERE
-user_groups.id IN (SELECT DISTINCT(user_groups.id)
-
-{{- template "body" . -}}
-)
-GROUP BY user_groups.id
-{{- if .limit }}
-LIMIT :limit OFFSET :offset
-{{- end -}}
-`
-
-var userGroupCountTpl = `SELECT COUNT(DISTINCT user_groups.id)
-
-{{- template "body" . -}}
-`
-var userGroupsQueryBodyTpl = `
-{{ define "body" }}
-FROM user_groups
-LEFT JOIN user_group_users ON user_groups.id = user_group_users.user_group_id
-LEFT JOIN users ON user_group_users.user_id = users.id AND users.deleted_at IS NULL
-WHERE
-user_groups.deleted_at IS NULL
-
-{{- if .filter_user_group_name }}
-AND user_groups.name = :filter_user_group_name
-{{- end -}}
-
-{{- end }}
-`
-
-type UserGroupDetail struct {
- Id int
- Name string `json:"name"`
- Desc string `json:"description"`
- Stat uint `json:"stat"`
- UserNames RowList `json:"user_names"`
-}
-
-func (ugd *UserGroupDetail) IsDisabled() bool {
- return ugd.Stat == Disabled
-}
-
-func (s *Storage) GetUserGroupsByReq(data map[string]interface{}) (
- results []*UserGroupDetail, count uint64, err error) {
-
- err = s.getListResult(userGroupsQueryBodyTpl, userGroupsQueryTpl, data, &results)
- if err != nil {
- return nil, 0, err
- }
-
- count, err = s.getCountResult(userGroupsQueryBodyTpl, userGroupCountTpl, data)
- return results, count, err
-}
-
-func (s *Storage) GetUserGroupsByNames(names []string) (ugs []*UserGroup, err error) {
- ugs = []*UserGroup{}
- err = s.db.Where("name IN (?)", names).Find(&ugs).Error
- return ugs, errors.ConnectStorageErrWrapper(err)
-}
-
-func (s *Storage) GetAndCheckUserGroupExist(userGroupNames []string) (ugs []*UserGroup, err error) {
- ugs, err = s.GetUserGroupsByNames(userGroupNames)
- if err != nil {
- return nil, err
- }
-
- existUserGroupNames := map[string]struct{}{}
- {
- for i := range ugs {
- existUserGroupNames[ugs[i].Name] = struct{}{}
- }
- }
-
- notExistUserGroupNames := []string{}
- {
- for i := range userGroupNames {
- if _, ok := existUserGroupNames[userGroupNames[i]]; !ok {
- notExistUserGroupNames = append(notExistUserGroupNames, userGroupNames[i])
- }
- }
- }
-
- if len(notExistUserGroupNames) > 0 {
- return ugs, errors.NewDataNotExistErr("user group <%v> not exist",
- strings.Join(notExistUserGroupNames, ", "))
- }
-
- return ugs, nil
-}
+// import (
+// "strings"
+
+// "github.com/actiontech/sqle/sqle/errors"
+// "github.com/jinzhu/gorm"
+// )
+
+// // NOTE: related model:
+// // - ProjectMemberGroupRole
+// type UserGroup struct {
+// Model
+// Name string `json:"name" gorm:"index"`
+// Desc string `json:"desc" gorm:"column:description"`
+// Users []*User `gorm:"many2many:user_group_users"`
+// Stat uint `json:"stat" gorm:"comment:'0:active,1:disabled'"`
+// }
+
+// func (ug *UserGroup) TableName() string {
+// return "user_groups"
+// }
+
+// func (ug *UserGroup) SetStat(stat int) {
+// ug.Stat = uint(stat)
+// }
+
+// func (ug *UserGroup) IsDisabled() bool {
+// return ug.Stat == Disabled
+// }
+
+// func (s *Storage) GetUserGroupByName(name string) (
+// userGroup *UserGroup, isExist bool, err error) {
+// userGroup = &UserGroup{}
+
+// err = s.db.Where("name = ?", name).First(userGroup).Error
+// if gorm.IsRecordNotFoundError(err) {
+// return nil, false, nil
+// }
+
+// return userGroup, true, err
+// }
+
+// func (s *Storage) SaveUserGroupAndAssociations(
+// ug *UserGroup, us []*User) (err error) {
+
+// return s.Tx(func(txDB *gorm.DB) error {
+// if err := txDB.Save(ug).Error; err != nil {
+// return err
+// }
+
+// // save user group users
+// if us != nil {
+// if err := txDB.Model(ug).Association("Users").Replace(us).Error; err != nil {
+// return err
+// }
+// }
+
+// return nil
+// })
+// }
+
+// var userGroupTipsQueryTpl = `SELECT
+// user_groups.name AS group_name,
+// GROUP_CONCAT(DISTINCT COALESCE(users.login_name,'')) AS user_names
+// {{- template "body" . }}
+// GROUP BY user_groups.id
+// `
+
+// var userGroupTipsQueryBodyTpl = `
+// {{ define "body" }}
+// FROM user_groups
+// LEFT JOIN user_group_users ON user_groups.id = user_group_users.user_group_id
+// LEFT JOIN users ON user_group_users.user_id = users.id AND users.deleted_at IS NULL
+
+// {{- if .project_name }}
+// LEFT JOIN project_user_group on project_user_group.user_group_id = user_groups.id
+// LEFT JOIN projects on project_user_group.project_id = projects.id
+// {{- end }}
+
+// WHERE user_groups.deleted_at IS NULL
+// AND user_groups.stat=0
+
+// {{- if .project_name }}
+// AND projects.name = :project_name
+// AND projects.deleted_at IS NULL
+// {{- end }}
+
+// {{- end }}
+
+// `
+
+// type UserGroupTips struct {
+// Name string `json:"group_name"`
+// UserNames RowList `json:"user_names"`
+// }
+
+// func (s *Storage) GetUserGroupTipByProject(data map[string]interface{}) ([]*UserGroupTips, error) {
+// results := []*UserGroupTips{}
+// err := s.getListResult(userGroupTipsQueryTpl, userGroupTipsQueryBodyTpl, data, &results)
+// if err != nil {
+// return nil, err
+// }
+
+// return results, errors.New(errors.ConnectStorageError, err)
+// }
+
+// var userGroupsQueryTpl = `SELECT
+// user_groups.id,
+// user_groups.name,
+// user_groups.description,
+// user_groups.stat,
+// GROUP_CONCAT(DISTINCT COALESCE(users.login_name,'')) AS user_names
+// FROM user_groups
+// LEFT JOIN user_group_users ON user_groups.id = user_group_users.user_group_id
+// LEFT JOIN users ON user_group_users.user_id = users.id AND users.deleted_at IS NULL
+// WHERE
+// user_groups.id IN (SELECT DISTINCT(user_groups.id)
+
+// {{- template "body" . -}}
+// )
+// GROUP BY user_groups.id
+// {{- if .limit }}
+// LIMIT :limit OFFSET :offset
+// {{- end -}}
+// `
+
+// var userGroupCountTpl = `SELECT COUNT(DISTINCT user_groups.id)
+
+// {{- template "body" . -}}
+// `
+// var userGroupsQueryBodyTpl = `
+// {{ define "body" }}
+// FROM user_groups
+// LEFT JOIN user_group_users ON user_groups.id = user_group_users.user_group_id
+// LEFT JOIN users ON user_group_users.user_id = users.id AND users.deleted_at IS NULL
+// WHERE
+// user_groups.deleted_at IS NULL
+
+// {{- if .filter_user_group_name }}
+// AND user_groups.name = :filter_user_group_name
+// {{- end -}}
+
+// {{- end }}
+// `
+
+// type UserGroupDetail struct {
+// Id int
+// Name string `json:"name"`
+// Desc string `json:"description"`
+// Stat uint `json:"stat"`
+// UserNames RowList `json:"user_names"`
+// }
+
+// func (ugd *UserGroupDetail) IsDisabled() bool {
+// return ugd.Stat == Disabled
+// }
+
+// func (s *Storage) GetUserGroupsByReq(data map[string]interface{}) (
+// results []*UserGroupDetail, count uint64, err error) {
+
+// err = s.getListResult(userGroupsQueryBodyTpl, userGroupsQueryTpl, data, &results)
+// if err != nil {
+// return nil, 0, err
+// }
+
+// count, err = s.getCountResult(userGroupsQueryBodyTpl, userGroupCountTpl, data)
+// return results, count, err
+// }
+
+// func (s *Storage) GetUserGroupsByNames(names []string) (ugs []*UserGroup, err error) {
+// ugs = []*UserGroup{}
+// err = s.db.Where("name IN (?)", names).Find(&ugs).Error
+// return ugs, errors.ConnectStorageErrWrapper(err)
+// }
+
+// func (s *Storage) GetAndCheckUserGroupExist(userGroupNames []string) (ugs []*UserGroup, err error) {
+// ugs, err = s.GetUserGroupsByNames(userGroupNames)
+// if err != nil {
+// return nil, err
+// }
+
+// existUserGroupNames := map[string]struct{}{}
+// {
+// for i := range ugs {
+// existUserGroupNames[ugs[i].Name] = struct{}{}
+// }
+// }
+
+// notExistUserGroupNames := []string{}
+// {
+// for i := range userGroupNames {
+// if _, ok := existUserGroupNames[userGroupNames[i]]; !ok {
+// notExistUserGroupNames = append(notExistUserGroupNames, userGroupNames[i])
+// }
+// }
+// }
+
+// if len(notExistUserGroupNames) > 0 {
+// return ugs, errors.NewDataNotExistErr("user group <%v> not exist",
+// strings.Join(notExistUserGroupNames, ", "))
+// }
+
+// return ugs, nil
+// }
diff --git a/sqle/model/user_list.go b/sqle/model/user_list.go
index db28e7e8db..cf46b63020 100644
--- a/sqle/model/user_list.go
+++ b/sqle/model/user_list.go
@@ -1,62 +1,62 @@
package model
-import "database/sql"
-
-type UserDetail struct {
- Id int
- Name string `json:"login_name"`
- Email string
- Phone sql.NullString `json:"phone"`
- WeChatID sql.NullString `json:"wechat_id"`
- LoginType string `json:"user_authentication_type"`
- Stat int `json:"stat"`
- RoleNames RowList `json:"role_names"`
- UserGroupNames RowList `json:"user_group_names"`
-}
-
-func (u *UserDetail) IsDisabled() bool {
- return u.Stat == Disabled
-}
-
-var usersQueryTpl = `SELECT
-users.id, users.login_name, users.email, users.phone, users.wechat_id,
-users.user_authentication_type, users.stat,
-GROUP_CONCAT(DISTINCT COALESCE(user_groups.name,'')) AS user_group_names
-FROM users
-LEFT JOIN user_group_users ON users.id = user_group_users.user_id
-LEFT JOIN user_groups ON user_group_users.user_group_id = user_groups.id AND user_groups.deleted_at IS NULL
-WHERE
-users.id in (SELECT DISTINCT(users.id)
-{{- template "body" . -}}
-)
-GROUP BY users.id
-{{- if .limit }}
-LIMIT :limit OFFSET :offset
-{{- end -}}
-`
-
-var usersCountTpl = `SELECT COUNT(DISTINCT users.id)
-{{- template "body" . -}}
-`
-
-var usersQueryBodyTpl = `
-{{ define "body" }}
-FROM users
-WHERE
-users.deleted_at IS NULL
-{{- if .filter_user_name }}
-AND users.login_name = :filter_user_name
-{{- end }}
-{{- end }}
-`
-
-func (s *Storage) GetUsersByReq(data map[string]interface{}) (
- result []*UserDetail, count uint64, err error) {
-
- err = s.getListResult(usersQueryBodyTpl, usersQueryTpl, data, &result)
- if err != nil {
- return result, 0, err
- }
- count, err = s.getCountResult(usersQueryBodyTpl, usersCountTpl, data)
- return result, count, err
-}
+// import "database/sql"
+
+// type UserDetail struct {
+// Id int
+// Name string `json:"login_name"`
+// Email string
+// Phone sql.NullString `json:"phone"`
+// WeChatID sql.NullString `json:"wechat_id"`
+// LoginType string `json:"user_authentication_type"`
+// Stat int `json:"stat"`
+// RoleNames RowList `json:"role_names"`
+// UserGroupNames RowList `json:"user_group_names"`
+// }
+
+// func (u *UserDetail) IsDisabled() bool {
+// return u.Stat == Disabled
+// }
+
+// var usersQueryTpl = `SELECT
+// users.id, users.login_name, users.email, users.phone, users.wechat_id,
+// users.user_authentication_type, users.stat,
+// GROUP_CONCAT(DISTINCT COALESCE(user_groups.name,'')) AS user_group_names
+// FROM users
+// LEFT JOIN user_group_users ON users.id = user_group_users.user_id
+// LEFT JOIN user_groups ON user_group_users.user_group_id = user_groups.id AND user_groups.deleted_at IS NULL
+// WHERE
+// users.id in (SELECT DISTINCT(users.id)
+// {{- template "body" . -}}
+// )
+// GROUP BY users.id
+// {{- if .limit }}
+// LIMIT :limit OFFSET :offset
+// {{- end -}}
+// `
+
+// var usersCountTpl = `SELECT COUNT(DISTINCT users.id)
+// {{- template "body" . -}}
+// `
+
+// var usersQueryBodyTpl = `
+// {{ define "body" }}
+// FROM users
+// WHERE
+// users.deleted_at IS NULL
+// {{- if .filter_user_name }}
+// AND users.login_name = :filter_user_name
+// {{- end }}
+// {{- end }}
+// `
+
+// func (s *Storage) GetUsersByReq(data map[string]interface{}) (
+// result []*UserDetail, count uint64, err error) {
+
+// err = s.getListResult(usersQueryBodyTpl, usersQueryTpl, data, &result)
+// if err != nil {
+// return result, 0, err
+// }
+// count, err = s.getCountResult(usersQueryBodyTpl, usersCountTpl, data)
+// return result, count, err
+// }
diff --git a/sqle/model/utils.go b/sqle/model/utils.go
index 61210aef1e..8e1f4ad4f3 100644
--- a/sqle/model/utils.go
+++ b/sqle/model/utils.go
@@ -84,6 +84,10 @@ type Model struct {
DeletedAt *time.Time `json:"-" sql:"index"`
}
+func (m Model) GetIDStr() string {
+ return fmt.Sprintf("%d", m.ID)
+}
+
func NewStorage(user, password, host, port, schema string, debug bool) (*Storage, error) {
log.Logger().Infof("connecting to storage, host: %s, port: %s, user: %s, schema: %s",
host, port, user, schema)
@@ -111,22 +115,14 @@ var autoMigrateList = []interface{}{
&AuditPlanSQLV2{},
&AuditPlan{},
&ExecuteSQL{},
- &Instance{},
- &WeChatConfiguration{},
- &LDAPConfiguration{},
- &Oauth2Configuration{},
&RoleOperation{},
- &Role{},
&RollbackSQL{},
&RuleTemplateRule{},
&RuleTemplate{},
&Rule{},
- &SMTPConfiguration{},
&SqlWhitelist{},
&SystemVariable{},
&Task{},
- &UserGroup{},
- &User{},
&WorkflowRecord{},
&WorkflowStepTemplate{},
&WorkflowStep{},
@@ -136,20 +132,10 @@ var autoMigrateList = []interface{}{
&SqlQueryHistory{},
&TaskGroup{},
&WorkflowInstanceRecord{},
- &CloudBeaverUserCache{},
- &CloudBeaverInstanceCache{},
- &Project{},
- &ProjectMemberRole{},
- &ProjectMemberGroupRole{},
- &ManagementPermission{},
+ &FeishuInstance{},
&IM{},
&DingTalkInstance{},
- &FeishuInstance{},
- &SyncInstanceTask{},
&OperationRecord{},
- &PersonaliseConfig{},
- &LogoConfig{},
- &WebHookConfig{},
&CustomRule{},
&RuleTemplateCustomRule{},
&SQLAuditRecord{},
@@ -166,26 +152,12 @@ func (s *Storage) AutoMigrate() error {
if err != nil {
return errors.New(errors.ConnectStorageError, err)
}
- err = s.db.Model(&User{}).AddIndex("idx_users_id_name", "id", "login_name").Error
- if err != nil {
- return errors.New(errors.ConnectStorageError, err)
- }
- err = s.db.Model(&Instance{}).AddIndex("idx_instances_id_name", "id", "name").Error
- if err != nil {
- return errors.New(errors.ConnectStorageError, err)
- }
err = s.db.Model(AuditPlanSQLV2{}).AddUniqueIndex("uniq_audit_plan_sqls_v2_audit_plan_id_fingerprint_md5",
"audit_plan_id", "fingerprint_md5").Error
if err != nil {
return errors.New(errors.ConnectStorageError, err)
}
- err = s.db.Model(&ProjectMemberRole{}).AddUniqueIndex("uniq_project_member_roles_user_id_instance_id_role_id",
- "user_id", "instance_id", "role_id").Error
- if err != nil {
- return errors.New(errors.ConnectStorageError, err)
- }
- err = s.db.Model(&ProjectMemberGroupRole{}).AddUniqueIndex("uniq_project_user_group_role_user_group_id_instance_id_role_id",
- "user_group_id", "instance_id", "role_id").Error
+ err = s.db.Model(BlackListAuditPlanSQL{}).AddUniqueIndex("uniq_type_content", "filter_type", "filter_content").Error
if err != nil {
return errors.New(errors.ConnectStorageError, err)
}
@@ -194,10 +166,6 @@ func (s *Storage) AutoMigrate() error {
return errors.New(errors.ConnectStorageError, err)
}
- err = s.db.Model(BlackListAuditPlanSQL{}).AddUniqueIndex("uniq_type_content", "filter_type", "filter_content").Error
- if err != nil {
- return errors.New(errors.ConnectStorageError, err)
- }
if s.db.Dialect().HasColumn(Rule{}.TableName(), "is_default") {
if err = s.db.Model(&Rule{}).DropColumn("is_default").Error; err != nil {
return errors.New(errors.ConnectStorageError, err)
@@ -264,39 +232,56 @@ func (s *Storage) CreateRulesIfNotExist(rules map[string][]*driverV2.Rule) error
return nil
}
-func (s *Storage) CreateDefaultRole() error {
- roles, err := s.GetAllRoleTip()
+// func (s *Storage) CreateDefaultRole() error {
+// roles, err := s.GetAllRoleTip()
+// if err != nil {
+// return err
+// }
+// if len(roles) > 0 {
+// return nil
+// }
+
+// // dev
+// err = s.SaveRoleAndAssociations(&Role{
+// Name: "dev",
+// Desc: "dev",
+// }, []uint{OP_WORKFLOW_SAVE, OP_AUDIT_PLAN_SAVE, OP_SQL_QUERY_QUERY})
+// if err != nil {
+// return err
+// }
+
+// // dba
+// err = s.SaveRoleAndAssociations(&Role{
+// Name: "dba",
+// Desc: "dba",
+// }, []uint{OP_WORKFLOW_AUDIT, OP_SQL_QUERY_QUERY})
+// if err != nil {
+// return err
+// }
+
+// return nil
+// }
+
+const DefaultProjectUid string = "700300"
+
+func (s *Storage) CreateDefaultWorkflowTemplateIfNotExist() error {
+ _, exist, err := s.GetWorkflowTemplateByProjectId(ProjectUID(DefaultProjectUid))
if err != nil {
return err
}
- if len(roles) > 0 {
- return nil
- }
-
- // dev
- err = s.SaveRoleAndAssociations(&Role{
- Name: "dev",
- Desc: "dev",
- }, []uint{OP_WORKFLOW_SAVE, OP_AUDIT_PLAN_SAVE, OP_SQL_QUERY_QUERY})
- if err != nil {
- return err
- }
-
- // dba
- err = s.SaveRoleAndAssociations(&Role{
- Name: "dba",
- Desc: "dba",
- }, []uint{OP_WORKFLOW_AUDIT, OP_SQL_QUERY_QUERY})
- if err != nil {
- return err
+ if !exist {
+ td := DefaultWorkflowTemplate(DefaultProjectUid)
+ err = s.SaveWorkflowTemplate(td)
+ if err != nil {
+ return err
+ }
}
-
return nil
}
-func (s *Storage) CreateDefaultTemplate(rules map[string][]*driverV2.Rule) error {
+func (s *Storage) CreateDefaultTemplateIfNotExist(projectId ProjectUID, rules map[string][]*driverV2.Rule) error {
for dbType, r := range rules {
templateName := s.GetDefaultRuleTemplateName(dbType)
- exist, err := s.IsRuleTemplateExistFromAnyProject(templateName)
+ exist, err := s.IsRuleTemplateExistFromAnyProject(projectId, templateName)
if err != nil {
return xerrors.Wrap(err, "get rule template failed")
}
@@ -305,9 +290,10 @@ func (s *Storage) CreateDefaultTemplate(rules map[string][]*driverV2.Rule) error
}
t := &RuleTemplate{
- Name: templateName,
- Desc: "默认规则模板",
- DBType: dbType,
+ ProjectId: projectId,
+ Name: templateName,
+ Desc: "默认规则模板",
+ DBType: dbType,
}
if err := s.Save(t); err != nil {
return err
@@ -339,42 +325,34 @@ func (s *Storage) GetDefaultRuleTemplateName(dbType string) string {
return fmt.Sprintf("default_%v", dbType)
}
-func (s *Storage) CreateAdminUser() error {
- _, exist, err := s.GetUserByName(DefaultAdminUser)
- if err != nil {
- return err
- }
- if !exist {
- return s.Save(&User{
- Name: DefaultAdminUser,
- Password: "admin",
- })
- }
- return nil
-}
+// func (s *Storage) CreateAdminUser() error {
+// _, exist, err := s.GetUserByName(DefaultAdminUser)
+// if err != nil {
+// return err
+// }
+// if !exist {
+// return s.Save(&User{
+// Name: DefaultAdminUser,
+// Password: "admin",
+// })
+// }
+// return nil
+// }
const DefaultProject = "default"
-func (s *Storage) CreateDefaultProject() error {
- exist, err := s.IsProjectExist()
- if err != nil {
- return err
- }
- if exist {
- return nil
- }
-
- defaultUser, exist, err := s.GetUserByName(DefaultAdminUser)
- if err != nil {
- return err
- }
- if !exist {
- return fmt.Errorf("admin not exist, unable to create project")
- }
-
- err = s.CreateProject(DefaultProject, "", defaultUser.ID)
- return err
-}
+// func (s *Storage) CreateDefaultProject() error {
+// exist, err := s.IsProjectExist()
+// if err != nil {
+// return err
+// }
+// if exist {
+// return nil
+// }
+
+// err = s.CreateProject(DefaultProject, "", 700200 /* TODO 从公共包传?*/)
+// return err
+// }
func (s *Storage) Exist(model interface{}) (bool, error) {
var count int
diff --git a/sqle/model/workflow.go b/sqle/model/workflow.go
index b5ab1a2fd8..58d4829c3c 100644
--- a/sqle/model/workflow.go
+++ b/sqle/model/workflow.go
@@ -3,23 +3,24 @@ package model
import (
"database/sql"
"fmt"
- "strconv"
+ "strings"
"time"
+ driverV2 "github.com/actiontech/sqle/sqle/driver/v2"
"github.com/actiontech/sqle/sqle/errors"
+
"github.com/jinzhu/gorm"
)
-var UnScopedFunc = func(db *gorm.DB) *gorm.DB { return db.Unscoped() }
-
type WorkflowTemplate struct {
Model
+ ProjectId ProjectUID `gorm:"index; not null"`
Name string
Desc string
AllowSubmitWhenLessAuditLevel string
- Steps []*WorkflowStepTemplate `json:"-" gorm:"foreignkey:workflowTemplateId"`
- Instances []*Instance `gorm:"foreignkey:WorkflowTemplateId"`
+ Steps []*WorkflowStepTemplate `json:"-" gorm:"foreignkey:workflowTemplateId"`
+ // Instances []*Instance `gorm:"foreignkey:WorkflowTemplateId"`
}
const (
@@ -38,7 +39,34 @@ type WorkflowStepTemplate struct {
ApprovedByAuthorized sql.NullBool `gorm:"column:approved_by_authorized"`
ExecuteByAuthorized sql.NullBool `gorm:"column:execute_by_authorized"`
- Users []*User `gorm:"many2many:workflow_step_template_user"`
+ Users string // `gorm:"many2many:workflow_step_template_user"` // dms-todo: 调整存储格式
+}
+
+func DefaultWorkflowTemplate(projectId string) *WorkflowTemplate {
+ return &WorkflowTemplate{
+ ProjectId: ProjectUID(projectId),
+ Name: fmt.Sprintf("%s-WorkflowTemplate", projectId),
+ Desc: fmt.Sprintf("%s 默认模板", projectId),
+ AllowSubmitWhenLessAuditLevel: string(driverV2.RuleLevelWarn),
+ Steps: []*WorkflowStepTemplate{
+ {
+ Number: 1,
+ Typ: WorkflowStepTypeSQLReview,
+ ApprovedByAuthorized: sql.NullBool{
+ Bool: true,
+ Valid: true,
+ },
+ },
+ {
+ Number: 2,
+ Typ: WorkflowStepTypeSQLExecute,
+ ExecuteByAuthorized: sql.NullBool{
+ Bool: true,
+ Valid: true,
+ },
+ },
+ },
+ }
}
func (s *Storage) GetWorkflowTemplateByName(name string) (*WorkflowTemplate, bool, error) {
@@ -59,15 +87,24 @@ func (s *Storage) GetWorkflowTemplateById(id uint) (*WorkflowTemplate, bool, err
return workflowTemplate, true, errors.New(errors.ConnectStorageError, err)
}
+func (s *Storage) GetWorkflowTemplateByProjectId(projectId ProjectUID) (*WorkflowTemplate, bool, error) {
+ workflowTemplate := &WorkflowTemplate{}
+ err := s.db.Where("project_id = ?", projectId).First(workflowTemplate).Error
+ if err == gorm.ErrRecordNotFound {
+ return workflowTemplate, false, nil
+ }
+ return workflowTemplate, true, errors.New(errors.ConnectStorageError, err)
+}
+
func (s *Storage) GetWorkflowStepsByTemplateId(id uint) ([]*WorkflowStepTemplate, error) {
steps := []*WorkflowStepTemplate{}
- err := s.db.Preload("Users").Where("workflow_template_id = ?", id).Find(&steps).Error
+ err := s.db.Where("workflow_template_id = ?", id).Find(&steps).Error
return steps, errors.New(errors.ConnectStorageError, err)
}
func (s *Storage) GetWorkflowStepsDetailByTemplateId(id uint) ([]*WorkflowStepTemplate, error) {
steps := []*WorkflowStepTemplate{}
- err := s.db.Preload("Users").Where("workflow_template_id = ?", id).Find(&steps).Error
+ err := s.db.Where("workflow_template_id = ?", id).Find(&steps).Error
return steps, errors.New(errors.ConnectStorageError, err)
}
@@ -79,8 +116,8 @@ func (s *Storage) SaveWorkflowTemplate(template *WorkflowTemplate) error {
}
func saveWorkflowTemplate(template *WorkflowTemplate, tx *sql.Tx) (templateId int64, err error) {
- result, err := tx.Exec("INSERT INTO workflow_templates (name, `desc`, `allow_submit_when_less_audit_level`) values (?, ?, ?)",
- template.Name, template.Desc, template.AllowSubmitWhenLessAuditLevel)
+ result, err := tx.Exec("INSERT INTO workflow_templates (name, `desc`, `allow_submit_when_less_audit_level`, `project_id`) values (?, ?, ?, ?)",
+ template.Name, template.Desc, template.AllowSubmitWhenLessAuditLevel, template.ProjectId)
if err != nil {
return 0, err
}
@@ -90,8 +127,8 @@ func saveWorkflowTemplate(template *WorkflowTemplate, tx *sql.Tx) (templateId in
}
template.ID = uint(templateId)
for _, step := range template.Steps {
- result, err = tx.Exec("INSERT INTO workflow_step_templates (step_number, workflow_template_id, type, `desc`, approved_by_authorized,execute_by_authorized) values (?,?,?,?,?,?)",
- step.Number, templateId, step.Typ, step.Desc, step.ApprovedByAuthorized, step.ExecuteByAuthorized)
+ result, err = tx.Exec("INSERT INTO workflow_step_templates (step_number, workflow_template_id, type, users, `desc`, approved_by_authorized,execute_by_authorized) values (?,?,?,?,?,?,?)",
+ step.Number, templateId, step.Typ, step.Users, step.Desc, step.ApprovedByAuthorized, step.ExecuteByAuthorized)
if err != nil {
return 0, err
}
@@ -100,13 +137,6 @@ func saveWorkflowTemplate(template *WorkflowTemplate, tx *sql.Tx) (templateId in
return 0, err
}
step.ID = uint(stepId)
- for _, user := range step.Users {
- _, err = tx.Exec("INSERT INTO workflow_step_template_user (workflow_step_template_id, user_id) values (?,?)",
- stepId, user.ID)
- if err != nil {
- return 0, err
- }
- }
}
return templateId, nil
}
@@ -119,8 +149,8 @@ func (s *Storage) UpdateWorkflowTemplateSteps(templateId uint, steps []*Workflow
return err
}
for _, step := range steps {
- result, err := tx.Exec("INSERT INTO workflow_step_templates (step_number, workflow_template_id, type, `desc`, approved_by_authorized,execute_by_authorized) values (?,?,?,?,?,?)",
- step.Number, templateId, step.Typ, step.Desc, step.ApprovedByAuthorized, step.ExecuteByAuthorized)
+ result, err := tx.Exec("INSERT INTO workflow_step_templates (step_number, workflow_template_id, type,users, `desc`, approved_by_authorized,execute_by_authorized) values (?,?,?,?,?,?,?)",
+ step.Number, templateId, step.Typ, step.Users, step.Desc, step.ApprovedByAuthorized, step.ExecuteByAuthorized)
if err != nil {
return err
}
@@ -129,23 +159,16 @@ func (s *Storage) UpdateWorkflowTemplateSteps(templateId uint, steps []*Workflow
return err
}
step.ID = uint(stepId)
- for _, user := range step.Users {
- _, err = tx.Exec("INSERT INTO workflow_step_template_user (workflow_step_template_id, user_id) values (?,?)",
- stepId, user.ID)
- if err != nil {
- return err
- }
- }
}
return nil
})
}
-func (s *Storage) UpdateWorkflowTemplateInstances(workflowTemplate *WorkflowTemplate,
- instances ...*Instance) error {
- err := s.db.Model(workflowTemplate).Association("Instances").Replace(instances).Error
- return errors.New(errors.ConnectStorageError, err)
-}
+// func (s *Storage) UpdateWorkflowTemplateInstances(workflowTemplate *WorkflowTemplate,
+// instances ...*Instance) error {
+// err := s.db.Model(workflowTemplate).Association("Instances").Replace(instances).Error
+// return errors.New(errors.ConnectStorageError, err)
+// }
func (s *Storage) GetWorkflowTemplateTip() ([]*WorkflowTemplate, error) {
templates := []*WorkflowTemplate{}
@@ -158,15 +181,15 @@ type Workflow struct {
Subject string
WorkflowId string `gorm:"unique"`
Desc string `gorm:"type:varchar(3000)"`
- CreateUserId uint
+ CreateUserId string
WorkflowRecordId uint
- ProjectId uint `gorm:"index; not null"`
+ ProjectId ProjectUID `gorm:"index; not null"`
- CreateUser *User `gorm:"foreignkey:CreateUserId"`
- Record *WorkflowRecord `gorm:"foreignkey:WorkflowRecordId"`
- Project *Project `gorm:"foreignkey:ProjectId"`
- RecordHistory []*WorkflowRecord `gorm:"many2many:workflow_record_history;"`
- Mode string
+ Record *WorkflowRecord `gorm:"foreignkey:WorkflowRecordId"`
+ // Project *Project `gorm:"foreignkey:ProjectId"`
+ RecordHistory []*WorkflowRecord `gorm:"many2many:workflow_record_history"`
+
+ Mode string
}
const (
@@ -207,42 +230,31 @@ type WorkflowInstanceRecord struct {
Model
TaskId uint `gorm:"index"`
WorkflowRecordId uint `gorm:"index; not null"`
- InstanceId uint
+ InstanceId uint64
ScheduledAt *time.Time
- ScheduleUserId uint
+ ScheduleUserId string
// 用于区分工单处于上线步骤时,某个数据源是否已上线,因为数据源可以分批上线
IsSQLExecuted bool
- ExecutionUserId uint
+ ExecutionUserId string
- ExecutionAssignees []*User `gorm:"many2many:workflow_instance_record_user"`
- Instance *Instance `gorm:"foreignkey:InstanceId"`
- Task *Task `gorm:"foreignkey:TaskId"`
- User *User `gorm:"foreignkey:ExecutionUserId"`
-}
-
-func (wir *WorkflowInstanceRecord) ExecuteUserName() string {
- if wir.User == nil {
- return ""
- }
- return wir.User.Name
+ Instance *Instance `gorm:"foreignkey:InstanceId"`
+ Task *Task `gorm:"foreignkey:TaskId"`
+ // User *User `gorm:"foreignkey:ExecutionUserId"`
+ ExecutionAssignees string
}
func (s *Storage) GetWorkInstanceRecordByTaskId(id string) (instanceRecord WorkflowInstanceRecord, err error) {
return instanceRecord, s.db.Where("task_id = ?", id).First(&instanceRecord).Error
}
-func (s *Storage) GetInstanceByTaskIDList(taskIds []uint) (instances []*Instance, err error) {
- var instanceRecords []*WorkflowInstanceRecord
- err = s.db.Model(&WorkflowInstanceRecord{}).Preload("Instance").Where("task_id in (?)", taskIds).Find(&instanceRecords).Error
+func (s *Storage) GetWorkInstanceRecordByTaskIds(taskIds []uint) ([]*WorkflowInstanceRecord, error) {
+ var workflowInstanceRecords []*WorkflowInstanceRecord
+ err := s.db.Model(&WorkflowInstanceRecord{}).Where("task_id in (?)", taskIds).Find(&workflowInstanceRecords).Error
if err != nil {
return nil, errors.New(errors.ConnectStorageError, err)
}
- for _, instanceRecord := range instanceRecords {
- instances = append(instances, instanceRecord.Instance)
- }
-
- return instances, nil
+ return workflowInstanceRecords, nil
}
const (
@@ -253,17 +265,17 @@ const (
type WorkflowStep struct {
Model
- OperationUserId uint
+ OperationUserId string
OperateAt *time.Time
- WorkflowId uint `gorm:"index; not null"`
+ WorkflowId string `gorm:"index; not null"`
WorkflowRecordId uint `gorm:"index; not null"`
WorkflowStepTemplateId uint `gorm:"index; not null"`
State string `gorm:"default:\"initialized\""`
Reason string
- Assignees []*User `gorm:"many2many:workflow_step_user"`
- Template *WorkflowStepTemplate `gorm:"foreignkey:WorkflowStepTemplateId"`
- OperationUser *User `gorm:"foreignkey:OperationUserId"`
+ Assignees string // `gorm:"many2many:workflow_step_user"`
+ Template *WorkflowStepTemplate `gorm:"foreignkey:WorkflowStepTemplateId"`
+ // OperationUser string // `gorm:"foreignkey:OperationUserId"`
}
func (ws *WorkflowStep) OperationTime() string {
@@ -273,13 +285,6 @@ func (ws *WorkflowStep) OperationTime() string {
return ws.OperateAt.Format("2006-01-02 15:04:05")
}
-func (ws *WorkflowStep) OperationUserName() string {
- if ws.OperationUser == nil {
- return ""
- }
- return ws.OperationUser.Name
-}
-
func generateWorkflowStepByTemplate(stepsTemplate []*WorkflowStepTemplate, allInspector []*User, allExecutor []*User) []*WorkflowStep {
steps := make([]*WorkflowStep, 0, len(stepsTemplate))
for i, st := range stepsTemplate {
@@ -289,10 +294,10 @@ func generateWorkflowStepByTemplate(stepsTemplate []*WorkflowStepTemplate, allIn
Assignees: st.Users,
}
if st.ApprovedByAuthorized.Bool {
- step.Assignees = allInspector
+ step.Assignees = genIdsByUsers(allInspector)
}
if i == len(stepsTemplate)-1 && st.ExecuteByAuthorized.Bool {
- step.Assignees = allExecutor
+ step.Assignees = genIdsByUsers(allExecutor)
}
steps = append(steps, step)
@@ -305,30 +310,23 @@ func (w *Workflow) cloneWorkflowStep() []*WorkflowStep {
for _, step := range w.Record.Steps {
steps = append(steps, &WorkflowStep{
WorkflowStepTemplateId: step.Template.ID,
- WorkflowId: w.ID,
+ WorkflowId: w.WorkflowId,
Assignees: step.Assignees,
})
}
return steps
}
-func (w *Workflow) CreateUserName() string {
- if w.CreateUser != nil {
- return w.CreateUser.Name
- }
- return ""
-}
-
func (w *Workflow) CurrentStep() *WorkflowStep {
return w.Record.CurrentStep
}
-func (w *Workflow) CurrentAssigneeUser() []*User {
+func (w *Workflow) CurrentAssigneeUser() []string {
currentStep := w.CurrentStep()
if currentStep == nil {
- return []*User{}
+ return []string{}
}
- return currentStep.Assignees
+ return strings.Split(currentStep.Assignees, ",")
}
func (w *Workflow) NextStep() *WorkflowStep {
@@ -361,8 +359,8 @@ func (w *Workflow) IsOperationUser(user *User) bool {
if w.CurrentStep() == nil {
return false
}
- for _, assUser := range w.CurrentStep().Assignees {
- if user.ID == assUser.ID {
+ for _, assUser := range strings.Split(w.CurrentStep().Assignees, ",") {
+ if user.GetIDStr() == assUser {
return true
}
}
@@ -389,7 +387,7 @@ func (w *Workflow) GetTaskIds() []uint {
return taskIds
}
-func (s *Storage) CreateWorkflowV2(subject, workflowId, desc string, user *User, tasks []*Task, stepTemplates []*WorkflowStepTemplate, projectId uint) error {
+func (s *Storage) CreateWorkflowV2(subject, workflowId, desc string, user *User, tasks []*Task, stepTemplates []*WorkflowStepTemplate, projectId ProjectUID, getOpExecUser func([]*Task) (canAuditUsers [][]*User, canExecUsers [][]*User)) error {
if len(tasks) <= 0 {
return errors.New(errors.DataConflict, fmt.Errorf("there is no task for creating workflow"))
}
@@ -431,7 +429,7 @@ func (s *Storage) CreateWorkflowV2(subject, workflowId, desc string, user *User,
WorkflowId: workflowId,
Desc: desc,
ProjectId: projectId,
- CreateUserId: user.ID,
+ CreateUserId: user.GetIDStr(),
Mode: workflowMode,
WorkflowRecordId: record.ID,
}
@@ -442,22 +440,7 @@ func (s *Storage) CreateWorkflowV2(subject, workflowId, desc string, user *User,
return errors.New(errors.ConnectStorageError, err)
}
- allUsers := make([][]*User, len(tasks))
- allExecutor := make([][]*User, len(tasks))
- for i, task := range tasks {
- users, err := s.GetCanAuditWorkflowUsers(task.Instance)
- if err != nil {
- return err
- }
- allUsers[i] = users
-
- executor, err := s.GetCanExecuteWorkflowUsers(task.Instance)
- if err != nil {
- return err
- }
- allExecutor[i] = executor
- }
-
+ allUsers, allExecutor := getOpExecUser(tasks)
canOptUsers := allUsers[0]
canExecUsers := allExecutor[0]
for i := 1; i < len(allUsers); i++ {
@@ -466,9 +449,12 @@ func (s *Storage) CreateWorkflowV2(subject, workflowId, desc string, user *User,
}
if len(canOptUsers) == 0 || len(canExecUsers) == 0 {
- adminUser, _, err := s.GetUserByName(DefaultAdminUser)
- if err != nil {
- return err
+ // TODO 获取管理用户
+ adminUser := &User{
+ Model: Model{
+ ID: 700200,
+ },
+ Name: "admin",
}
if len(canOptUsers) == 0 {
canOptUsers = append(canOptUsers, adminUser)
@@ -486,21 +472,11 @@ func (s *Storage) CreateWorkflowV2(subject, workflowId, desc string, user *User,
for _, instanceRecord := range instanceRecords {
instRecord := instanceRecord
instRecord.WorkflowRecordId = record.ID
- assignees := instRecord.ExecutionAssignees
- // 置为nil,防止用户被更新
- // 相关issue:https://github.com/actiontech/sqle/issues/1775
- instRecord.ExecutionAssignees = nil
err = tx.Save(instRecord).Error
if err != nil {
tx.Rollback()
return errors.New(errors.ConnectStorageError, err)
}
-
- err = tx.Model(instRecord).Association("ExecutionAssignees").Replace(assignees).Error
- if err != nil {
- tx.Rollback()
- return errors.New(errors.ConnectStorageError, err)
- }
}
}
@@ -510,19 +486,12 @@ func (s *Storage) CreateWorkflowV2(subject, workflowId, desc string, user *User,
for _, step := range steps {
currentStep := step
currentStep.WorkflowRecordId = record.ID
- currentStep.WorkflowId = workflow.ID
- users := currentStep.Assignees
- currentStep.Assignees = nil
+ currentStep.WorkflowId = workflow.WorkflowId
err = tx.Save(currentStep).Error
if err != nil {
tx.Rollback()
return errors.New(errors.ConnectStorageError, err)
}
- err = tx.Model(currentStep).Association("Assignees").Replace(users).Error
- if err != nil {
- tx.Rollback()
- return errors.New(errors.ConnectStorageError, err)
- }
}
if len(steps) > 0 {
@@ -550,7 +519,7 @@ func UpdateInstanceRecord(stepTemplates []*WorkflowStepTemplate, tasks []*Task,
if isExecuteByAuthorized {
distinctOfUsers := GetDistinctOfUsers(stepExecUsers, allExecutor[i])
- instanceRecords[i].ExecutionAssignees = distinctOfUsers
+ instanceRecords[i].ExecutionAssignees = strings.Join(distinctOfUsers, ",")
} else {
instanceRecords[i].ExecutionAssignees = stepTemplateAssignees
}
@@ -587,18 +556,11 @@ func (s *Storage) UpdateWorkflowRecord(w *Workflow, tasks []*Task) error {
for _, step := range steps {
currentStep := step
currentStep.WorkflowRecordId = record.ID
- users := currentStep.Assignees
- currentStep.Assignees = nil
err = tx.Save(currentStep).Error
if err != nil {
tx.Rollback()
return errors.New(errors.ConnectStorageError, err)
}
- err = tx.Model(currentStep).Association("Assignees").Replace(users).Error
- if err != nil {
- tx.Rollback()
- return errors.New(errors.ConnectStorageError, err)
- }
}
if len(steps) > 0 {
err = tx.Model(record).Update("current_workflow_step_id", steps[0].ID).Error
@@ -616,7 +578,7 @@ func (s *Storage) UpdateWorkflowRecord(w *Workflow, tasks []*Task) error {
}
// update workflow record to new
- if err := tx.Model(&Workflow{}).Where("id = ?", w.ID).
+ if err := tx.Model(&Workflow{}).Where("workflow_id = ?", w.WorkflowId).
Update("workflow_record_id", record.ID).Error; err != nil {
tx.Rollback()
return errors.New(errors.ConnectStorageError, err)
@@ -670,8 +632,8 @@ func updateWorkflowStatus(tx *gorm.DB, w *Workflow) error {
func updateWorkflowStep(tx *gorm.DB, operateStep *WorkflowStep) error {
// 必须保证更新前的操作用户未填写,通过数据库的特性保证数据不会重复写
- db := tx.Exec("UPDATE workflow_steps SET operation_user_id = ?, operate_at = ?, state = ?, reason = ? WHERE id = ? AND operation_user_id = 0",
- operateStep.OperationUserId, operateStep.OperateAt, operateStep.State, operateStep.Reason, operateStep.ID)
+ db := tx.Exec("UPDATE workflow_steps SET operation_user_id = ?, operate_at = ?, state = ?, reason = ? WHERE id = ? AND operation_user_id = ?",
+ operateStep.OperationUserId, operateStep.OperateAt, operateStep.State, operateStep.Reason, operateStep.ID, "")
if db.Error != nil {
return db.Error
}
@@ -734,7 +696,7 @@ func (s *Storage) UpdateWorkflowRecordByID(id uint, workFlow map[string]interfac
return s.db.Model(&WorkflowRecord{}).Where("id = ?", id).Updates(workFlow).Error
}
-func (s *Storage) UpdateInstanceRecordSchedule(ir *WorkflowInstanceRecord, userId uint, scheduleTime *time.Time) error {
+func (s *Storage) UpdateInstanceRecordSchedule(ir *WorkflowInstanceRecord, userId string, scheduleTime *time.Time) error {
err := s.db.Model(&WorkflowInstanceRecord{}).Where("id = ?", ir.ID).Update(map[string]interface{}{
"scheduled_at": scheduleTime,
"schedule_user_id": userId,
@@ -745,11 +707,11 @@ func (s *Storage) UpdateInstanceRecordSchedule(ir *WorkflowInstanceRecord, userI
func (s *Storage) getWorkflowStepsByRecordIds(ids []uint) ([]*WorkflowStep, error) {
steps := []*WorkflowStep{}
err := s.db.Where("workflow_record_id in (?)", ids).
- Preload("Assignees").
- Preload("OperationUser").Find(&steps).Error
+ Find(&steps).Error
if err != nil {
return nil, errors.New(errors.ConnectStorageError, err)
}
+
stepTemplateIds := make([]uint, 0, len(steps))
for _, step := range steps {
stepTemplateIds = append(stepTemplateIds, step.WorkflowStepTemplateId)
@@ -771,7 +733,7 @@ func (s *Storage) getWorkflowStepsByRecordIds(ids []uint) ([]*WorkflowStep, erro
func (s *Storage) getWorkflowInstanceRecordsByRecordId(id uint) ([]*WorkflowInstanceRecord, error) {
instanceRecords := []*WorkflowInstanceRecord{}
- err := s.db.Preload("Instance").Preload("Task").Preload("ExecutionAssignees").Where("workflow_record_id = ?", id).
+ err := s.db.Preload("Task").Where("workflow_record_id = ?", id).
Find(&instanceRecords).Error
if err != nil {
return nil, errors.New(errors.ConnectStorageError, err)
@@ -779,64 +741,20 @@ func (s *Storage) getWorkflowInstanceRecordsByRecordId(id uint) ([]*WorkflowInst
return instanceRecords, nil
}
-func (s *Storage) GetWorkflowDetailByTaskID(taskID uint) (*Workflow, error) {
- workflow, exist, err := s.GetWorkflowByTaskId(taskID)
- if err != nil {
- return nil, err
- }
- if !exist {
- return nil, fmt.Errorf("workflow not exist by task_id(%v)", taskID)
- }
-
- workflow, exist, err = s.GetWorkflowDetailById(strconv.Itoa(int(workflow.ID)))
- if err != nil {
- return nil, err
- }
- if !exist {
- return nil, fmt.Errorf("workflow not exist by workflow.id(%v)", workflow.ID)
- }
-
- return workflow, nil
-}
-
-func (s *Storage) GetWorkflowDetailById(id string) (*Workflow, bool, error) {
+func (s *Storage) GetWorkflowByProjectAndWorkflowId(projectId, workflowId string) (*Workflow, bool, error) {
workflow := &Workflow{}
- err := s.db.Preload("CreateUser", func(db *gorm.DB) *gorm.DB { return db.Unscoped() }).
- Preload("Record").Preload("Project").
- Where("id = ?", id).First(workflow).Error
+ err := s.db.Preload("Record").Where("project_id = ?", projectId).Where("workflow_id = ?", workflowId).
+ First(&workflow).Error
if err == gorm.ErrRecordNotFound {
- return nil, false, nil
- }
- if err != nil {
- return nil, false, errors.New(errors.ConnectStorageError, err)
- }
- if workflow.Record == nil {
- return nil, false, errors.New(errors.DataConflict, fmt.Errorf("workflow record not exist"))
- }
-
- instanceRecords, err := s.getWorkflowInstanceRecordsByRecordId(workflow.Record.ID)
- if err != nil {
- return nil, false, errors.New(errors.ConnectStorageError, err)
+ return workflow, false, nil
}
- workflow.Record.InstanceRecords = instanceRecords
- steps, err := s.getWorkflowStepsByRecordIds([]uint{workflow.Record.ID})
- if err != nil {
- return nil, false, errors.New(errors.ConnectStorageError, err)
- }
- workflow.Record.Steps = steps
- for _, step := range steps {
- if step.ID == workflow.Record.CurrentWorkflowStepId {
- workflow.Record.CurrentStep = step
- }
- }
- return workflow, true, nil
+ return workflow, true, errors.New(errors.ConnectStorageError, err)
}
-func (s *Storage) GetWorkflowExportById(id string) (*Workflow, bool, error) {
+func (s *Storage) GetWorkflowExportById(workflowId string) (*Workflow, bool, error) {
w := new(Workflow)
- err := s.db.Preload("CreateUser", UnScopedFunc).
- Preload("Record").Where("id = ?", id).First(&w).Error
+ err := s.db.Preload("Record").Where("workflow_id = ?", workflowId).First(&w).Error
if err == gorm.ErrRecordNotFound {
return nil, false, nil
}
@@ -849,8 +767,7 @@ func (s *Storage) GetWorkflowExportById(id string) (*Workflow, bool, error) {
}
instanceRecordList := make([]*WorkflowInstanceRecord, 0)
- err = s.db.Preload("Instance", UnScopedFunc).Preload("Task").
- Preload("User", UnScopedFunc).
+ err = s.db.Preload("Task").
Where("workflow_record_id = ?", w.Record.ID).
Find(&instanceRecordList).Error
if err != nil {
@@ -867,9 +784,7 @@ func (s *Storage) GetWorkflowExportById(id string) (*Workflow, bool, error) {
w.Record.InstanceRecords = instanceRecordList
steps := make([]*WorkflowStep, 0)
- err = s.db.Where("workflow_record_id = ?", w.Record.ID).
- Preload("OperationUser", UnScopedFunc).
- Find(&steps).Error
+ err = s.db.Where("workflow_record_id = ?", w.Record.ID).Find(&steps).Error
if err != nil {
return nil, false, errors.New(errors.ConnectStorageError, err)
}
@@ -878,49 +793,13 @@ func (s *Storage) GetWorkflowExportById(id string) (*Workflow, bool, error) {
return w, true, nil
}
-func (s *Storage) GetWorkflowDetailBySubject(projectName, workflowName string) (*Workflow, bool, error) {
+func (s *Storage) GetWorkflowDetailWithoutInstancesByWorkflowID(projectId, workflowID string) (*Workflow, bool, error) {
workflow := &Workflow{}
- err := s.db.Model(&Workflow{}).Preload("CreateUser", func(db *gorm.DB) *gorm.DB { return db.Unscoped() }).
- Preload("Record").Joins("left join projects on workflows.project_id = projects.id").
- Where("subject = ?", workflowName).
- Where("projects.name = ?", projectName).
- First(workflow).Error
- if err == gorm.ErrRecordNotFound {
- return nil, false, nil
- }
- if err != nil {
- return nil, false, errors.New(errors.ConnectStorageError, err)
- }
- if workflow.Record == nil {
- return nil, false, errors.New(errors.DataConflict, fmt.Errorf("workflow record not exist"))
- }
-
- instanceRecords, err := s.getWorkflowInstanceRecordsByRecordId(workflow.Record.ID)
- if err != nil {
- return nil, false, errors.New(errors.ConnectStorageError, err)
- }
- workflow.Record.InstanceRecords = instanceRecords
-
- steps, err := s.getWorkflowStepsByRecordIds([]uint{workflow.Record.ID})
- if err != nil {
- return nil, false, errors.New(errors.ConnectStorageError, err)
+ db := s.db.Model(&Workflow{}).Preload("Record").Where("workflow_id = ?", workflowID)
+ if projectId != "" {
+ db = db.Where("project_id = ?", projectId)
}
- workflow.Record.Steps = steps
- for _, step := range steps {
- if step.ID == workflow.Record.CurrentWorkflowStepId {
- workflow.Record.CurrentStep = step
- }
- }
- return workflow, true, nil
-}
-
-func (s *Storage) GetWorkflowDetailByWorkflowID(projectName, workflowID string) (*Workflow, bool, error) {
- workflow := &Workflow{}
- err := s.db.Model(&Workflow{}).Preload("CreateUser", func(db *gorm.DB) *gorm.DB { return db.Unscoped() }).
- Preload("Record").Joins("left join projects on workflows.project_id = projects.id").
- Where("workflow_id = ?", workflowID).
- Where("projects.name = ?", projectName).
- First(workflow).Error
+ err := db.First(workflow).Error
if err == gorm.ErrRecordNotFound {
return nil, false, nil
}
@@ -950,7 +829,7 @@ func (s *Storage) GetWorkflowDetailByWorkflowID(projectName, workflowID string)
return workflow, true, nil
}
-func (s *Storage) GetWorkflowHistoryById(id string) ([]*WorkflowRecord, error) {
+func (s *Storage) GetWorkflowHistoryById(id uint) ([]*WorkflowRecord, error) {
records := []*WorkflowRecord{}
err := s.db.Model(&WorkflowRecord{}).Select("workflow_records.*").
Joins("JOIN workflow_record_history AS wrh ON workflow_records.id = wrh.workflow_record_id").
@@ -1029,7 +908,7 @@ func (s *Storage) DeleteWorkflow(workflow *Workflow) error {
}
func (s *Storage) deleteWorkflow(tx *gorm.DB, workflow *Workflow) error {
- err := tx.Exec("DELETE FROM workflows WHERE id = ?", workflow.ID).Error
+ err := tx.Exec("DELETE FROM workflows WHERE workflow_id = ?", workflow.WorkflowId).Error
if err != nil {
return err
}
@@ -1037,7 +916,7 @@ func (s *Storage) deleteWorkflow(tx *gorm.DB, workflow *Workflow) error {
if err != nil {
return err
}
- err = tx.Exec("DELETE FROM workflow_steps WHERE workflow_id = ?", workflow.ID).Error
+ err = tx.Exec("DELETE FROM workflow_steps WHERE workflow_id = ?", workflow.WorkflowId).Error
if err != nil {
return err
}
@@ -1054,7 +933,7 @@ func (s *Storage) deleteWorkflow(tx *gorm.DB, workflow *Workflow) error {
func (s *Storage) GetExpiredWorkflows(start time.Time) ([]*Workflow, error) {
workflows := []*Workflow{}
- err := s.db.Model(&Workflow{}).Select("workflows.id, workflows.workflow_record_id").
+ err := s.db.Model(&Workflow{}).Select("workflows.id,workflows.workflow_id, workflows.workflow_record_id").
Joins("LEFT JOIN workflow_records ON workflows.workflow_record_id = workflow_records.id").
Where("workflows.created_at < ? "+
"AND (workflow_records.status = 'finished' "+
@@ -1067,7 +946,7 @@ func (s *Storage) GetExpiredWorkflows(start time.Time) ([]*Workflow, error) {
func (s *Storage) GetNeedScheduledWorkflows() ([]*Workflow, error) {
workflows := []*Workflow{}
- err := s.db.Model(&Workflow{}).Select("workflows.id, workflows.workflow_record_id").
+ err := s.db.Model(&Workflow{}).Select("workflows.id,workflows.workflow_id, workflows.workflow_record_id").
Joins("LEFT JOIN workflow_records ON workflows.workflow_record_id = workflow_records.id").
Joins("LEFT JOIN workflow_instance_records ON workflow_records.id = workflow_instance_records.workflow_record_id").
Where("workflow_records.status = 'wait_for_execution' "+
@@ -1087,7 +966,7 @@ func (s *Storage) GetWorkflowBySubject(subject string) (*Workflow, bool, error)
return workflow, true, errors.New(errors.ConnectStorageError, err)
}
-func (s *Storage) IsWorkflowUnFinishedByInstanceId(instanceId uint) (bool, error) {
+func (s *Storage) IsWorkflowUnFinishedByInstanceId(instanceId int64) (bool, error) {
count := 0
err := s.db.Table("workflow_records").
Joins("LEFT JOIN workflow_instance_records ON workflow_records.id = workflow_instance_records.workflow_record_id").
@@ -1098,21 +977,26 @@ func (s *Storage) IsWorkflowUnFinishedByInstanceId(instanceId uint) (bool, error
return count > 0, errors.New(errors.ConnectStorageError, err)
}
-func (s *Storage) GetInstancesByWorkflowID(workflowID uint) ([]*Instance, error) {
+func (s *Storage) GetInstanceIdsByWorkflowID(workflowID string) ([]uint64, error) {
query := `
-SELECT instances.id ,instances.maintenance_period
+SELECT wir.instance_id id
FROM workflows AS w
LEFT JOIN workflow_records AS wr ON wr.id = w.workflow_record_id
LEFT JOIN workflow_instance_records AS wir ON wr.id = wir.workflow_record_id
-LEFT JOIN instances ON instances.id = wir.instance_id
WHERE
-w.id = ?`
+w.workflow_id = ?`
instances := []*Instance{}
err := s.db.Raw(query, workflowID).Scan(&instances).Error
if err != nil {
return nil, errors.ConnectStorageErrWrapper(err)
}
- return instances, err
+
+ instanceIds := make([]uint64, 0, len(instances))
+ for _, instance := range instances {
+ instanceIds = append(instanceIds, instance.ID)
+ }
+
+ return instanceIds, err
}
// GetWorkFlowStepIdsHasAudit 返回走完所有审核流程的workflow_steps的id
@@ -1201,15 +1085,14 @@ func (s *Storage) GetWorkflowCountByStatus(status string) (int, error) {
}
// 执行成功, 执行失败, 已取消三种工单会被当作已结束工单
-func (s *Storage) HasNotEndWorkflowByProjectName(projectName string) (bool, error) {
+func (s *Storage) HasNotEndWorkflowByProjectId(projectId string) (bool, error) {
endStatus := []string{WorkflowStatusExecFailed, WorkflowStatusFinish, WorkflowStatusCancel}
var count int
err := s.db.Table("workflows").
Joins("LEFT JOIN workflow_records ON workflows.workflow_record_id = workflow_records.id").
- Joins("LEFT JOIN projects ON projects.id = workflows.project_id").
Where("workflow_records.status NOT IN (?)", endStatus).
- Where("projects.name = ?", projectName).
+ Where("workflows.project_id = ?", projectId).
Count(&count).Error
return count > 0, err
}
@@ -1259,20 +1142,20 @@ func (s *Storage) GetWorkflowDailyCountBetweenStartTimeAndEndTime(startTime, end
}
type WorkflowTasksSummaryDetail struct {
- WorkflowRecordStatus string `json:"workflow_record_status"`
- TaskId uint `json:"task_id"`
- TaskExecStartAt *time.Time `json:"task_exec_start_at"`
- TaskExecEndAt *time.Time `json:"task_exec_end_at"`
- TaskPassRate float64 `json:"task_pass_rate"`
- TaskScore int32 `json:"task_score"`
- TaskStatus string `json:"task_status"`
- InstanceName string `json:"instance_name"`
- InstanceDeletedAt *time.Time `json:"instance_deleted_at"`
- InstanceMaintenancePeriod Periods `json:"instance_maintenance_period" gorm:"text"`
- InstanceScheduledAt *time.Time `json:"instance_scheduled_at"`
- ExecutionUserDeletedAt *time.Time `json:"execution_user_deleted_at"`
- ExecutionUserName string `json:"execution_user_name"`
- CurrentStepAssigneeUsers RowList `json:"current_step_assignee_users"`
+ WorkflowRecordStatus string `json:"workflow_record_status"`
+ TaskId uint `json:"task_id"`
+ TaskExecStartAt *time.Time `json:"task_exec_start_at"`
+ TaskExecEndAt *time.Time `json:"task_exec_end_at"`
+ TaskPassRate float64 `json:"task_pass_rate"`
+ TaskScore int32 `json:"task_score"`
+ TaskStatus string `json:"task_status"`
+ InstanceId uint64 `json:"instance_id"`
+ InstanceName string `json:"instance_name"`
+ InstanceDeletedAt *time.Time `json:"instance_deleted_at"`
+ InstanceMaintenancePeriod Periods `json:"instance_maintenance_period" gorm:"text"`
+ InstanceScheduledAt *time.Time `json:"instance_scheduled_at"`
+ ExecutionUserId string `json:"execution_user_id"`
+ CurrentStepAssigneeUserIds sql.NullString `json:"current_step_assignee_user_ids"`
}
var workflowStepSummaryQueryTpl = `
@@ -1283,16 +1166,16 @@ SELECT wr.status AS workflow
tasks.pass_rate AS task_pass_rate,
tasks.score AS task_score,
tasks.status AS task_status,
- inst.name AS instance_name,
- inst.deleted_at AS instance_deleted_at,
- inst.maintenance_period AS instance_maintenance_period,
+ tasks.instance_id AS instance_id,
wir.scheduled_at AS instance_scheduled_at,
- exec_user.deleted_at AS execution_user_deleted_at,
- COALESCE(exec_user.login_name, '') AS execution_user_name,
- GROUP_CONCAT(DISTINCT COALESCE(curr_ass_user.login_name, '')) AS current_step_assignee_users
+ wir.execution_user_id AS execution_user_id,
+ curr_ws.assignees AS current_step_assignee_user_ids
{{- template "body" . -}}
-GROUP BY tasks.id, wir.id
+{{- if .is_executing }}
+ORDER BY curr_ws.id DESC
+LIMIT 1
+{{- end }}
`
var workflowStepSummaryQueryBodyTplV2 = `
@@ -1300,18 +1183,14 @@ var workflowStepSummaryQueryBodyTplV2 = `
FROM workflow_instance_records AS wir
LEFT JOIN workflow_records AS wr ON wir.workflow_record_id = wr.id
LEFT JOIN workflows AS w ON w.workflow_record_id = wr.id
-LEFT JOIN projects ON projects.id = w.project_id
-LEFT JOIN users AS exec_user ON wir.execution_user_id = exec_user.id
LEFT JOIN tasks ON wir.task_id = tasks.id
-LEFT JOIN instances AS inst ON tasks.instance_id = inst.id
LEFT JOIN workflow_steps AS curr_ws ON wr.current_workflow_step_id = curr_ws.id
-LEFT JOIN workflow_step_user AS curr_ws_user ON curr_ws.id = curr_ws_user.workflow_step_id
-LEFT JOIN users AS curr_ass_user ON curr_ws_user.user_id = curr_ass_user.id
+
WHERE
w.deleted_at IS NULL
AND w.workflow_id = :workflow_id
-AND projects.name = :project_name
+AND w.project_id = :project_id
{{ end }}
`
@@ -1319,8 +1198,8 @@ AND projects.name = :project_name
func (s *Storage) GetWorkflowStepSummaryByReqV2(data map[string]interface{}) (
result []*WorkflowTasksSummaryDetail, err error) {
- if data["workflow_id"] == nil || data["project_name"] == nil {
- return result, errors.New(errors.DataInvalid, fmt.Errorf("project name and workflow name must be specified"))
+ if data["workflow_id"] == nil || data["project_id"] == nil {
+ return result, errors.New(errors.DataInvalid, fmt.Errorf("project id and workflow name must be specified"))
}
err = s.getListResult(workflowStepSummaryQueryBodyTplV2, workflowStepSummaryQueryTpl, data, &result)
@@ -1339,16 +1218,12 @@ SELECT wr.status A
tasks.pass_rate AS task_pass_rate,
tasks.score AS task_score,
tasks.status AS task_status,
- inst.name AS instance_name,
- inst.deleted_at AS instance_deleted_at,
- inst.maintenance_period AS instance_maintenance_period,
+ tasks.instance_id AS instance_id,
wir.scheduled_at AS instance_scheduled_at,
- exec_user.deleted_at AS execution_user_deleted_at,
- COALESCE(exec_user.login_name, '') AS execution_user_name,
+ wir.execution_user_id AS execution_user_id,
IF(tasks.status = 'audited' || tasks.status = 'executing' ||
- tasks.status = 'terminating', GROUP_CONCAT(ass_user.login_name), '') AS current_step_assignee_users
+ tasks.status = 'terminating', wir.execution_assignees, '') AS current_step_assignee_user_ids
{{- template "body" . -}}
-GROUP BY tasks.id, wir.id
`
var workflowTaskSummaryQueryBodyTpl = `
@@ -1356,20 +1231,15 @@ var workflowTaskSummaryQueryBodyTpl = `
FROM workflow_instance_records AS wir
LEFT JOIN workflow_records AS wr ON wir.workflow_record_id = wr.id
LEFT JOIN workflows AS w ON w.workflow_record_id = wr.id
- LEFT JOIN projects ON projects.id = w.project_id
- LEFT JOIN users AS exec_user ON wir.execution_user_id = exec_user.id
LEFT JOIN tasks ON wir.task_id = tasks.id
- LEFT JOIN instances AS inst ON tasks.instance_id = inst.id
- LEFT JOIN workflow_instance_record_user wiru ON wir.id = wiru.workflow_instance_record_id
- LEFT JOIN users ass_user ON ass_user.id = wiru.user_id
-WHERE w.deleted_at IS NULL
- AND w.workflow_id = :workflow_id
- AND projects.name = :project_name
+ WHERE w.deleted_at IS NULL
+ AND w.workflow_id = :workflow_id
+ AND w.project_id = :project_id
{{ end }}
`
func (s *Storage) GetWorkflowTaskSummaryByReq(data map[string]interface{}) (result []*WorkflowTasksSummaryDetail, err error) {
- if data["workflow_id"] == nil || data["project_name"] == nil {
+ if data["workflow_id"] == nil || data["project_id"] == nil {
return result, errors.New(errors.DataInvalid, fmt.Errorf("project name and workflow name must be specified"))
}
@@ -1393,24 +1263,10 @@ func (s *Storage) GetTasksByWorkFlowRecordID(id uint) ([]*Task, error) {
return tasks, nil
}
-func (s *Storage) GetWorkflowByProjectAndWorkflowName(projectName, workflowName string) (*Workflow, bool, error) {
+func (s *Storage) GetWorkflowByProjectAndWorkflowName(projectId, workflowName string) (*Workflow, bool, error) {
workflow := &Workflow{}
- err := s.db.Model(&Workflow{}).Joins("left join projects on workflows.project_id = projects.id").
- Where("projects.name = ?", projectName).
- Where("workflows.subject = ?", workflowName).
- First(&workflow).Error
- if err == gorm.ErrRecordNotFound {
- return workflow, false, nil
- }
-
- return workflow, true, errors.New(errors.ConnectStorageError, err)
-}
-
-func (s *Storage) GetWorkflowByProjectNameAndWorkflowId(projectName, workflowId string) (*Workflow, bool, error) {
- workflow := &Workflow{}
- err := s.db.Model(&Workflow{}).Preload("Record").Joins("left join projects on workflows.project_id = projects.id").
- Where("projects.name = ?", projectName).
- Where("workflows.workflow_id = ?", workflowId).
+ err := s.db.Model(&Workflow{}).Where("project_id = ?", projectId).
+ Where("subject = ?", workflowName).
First(&workflow).Error
if err == gorm.ErrRecordNotFound {
return workflow, false, nil
@@ -1419,7 +1275,7 @@ func (s *Storage) GetWorkflowByProjectNameAndWorkflowId(projectName, workflowId
return workflow, true, errors.New(errors.ConnectStorageError, err)
}
-func (s *Storage) GetWorkflowsByProjectID(projectID uint) ([]*Workflow, error) {
+func (s *Storage) GetWorkflowsByProjectID(projectID ProjectUID) ([]*Workflow, error) {
workflows := []*Workflow{}
err := s.db.Model(&Workflow{}).Where("project_id = ?", projectID).Scan(&workflows).Error
return workflows, errors.ConnectStorageErrWrapper(err)
@@ -1436,22 +1292,21 @@ func (s *Storage) GetWorkflowNamesByIDs(ids []string) ([]string, error) {
}
type WorkflowStatusDetail struct {
- Subject string `json:"subject"`
- WorkflowId string `json:"workflow_id"`
- Status string `json:"status"`
- LoginName string `json:"login_name"`
- UpdatedAt *time.Time `json:"updated_at"`
+ Subject string `json:"subject"`
+ WorkflowId string `json:"workflow_id"`
+ Status string `json:"status"`
+ CreateUserId string `json:"create_user_id"`
+ LoginName string `json:"login_name"`
+ UpdatedAt *time.Time `json:"updated_at"`
}
-func (s *Storage) GetProjectWorkflowStatusDetail(projectName string, queryStatus []string) ([]WorkflowStatusDetail, error) {
+func (s *Storage) GetProjectWorkflowStatusDetail(projectUid string, queryStatus []string) ([]WorkflowStatusDetail, error) {
WorkflowStatusDetails := []WorkflowStatusDetail{}
err := s.db.Model(&Workflow{}).
- Select("workflows.subject, workflows.workflow_id, wr.status, wr.updated_at, users.login_name").
+ Select("workflows.subject, workflows.workflow_id, wr.status, wr.updated_at, workflows.create_user_id").
Joins("left join workflow_records wr on workflows.workflow_record_id = wr.id").
- Joins("left join users on users.id=workflows.create_user_id").
- Joins("left join projects on projects.id=workflows.project_id").
- Where("wr.status in (?) and projects.name=?", queryStatus, projectName).
+ Where("wr.status in (?) and workflows.project_id=?", queryStatus, projectUid).
Order("wr.updated_at desc").
Scan(&WorkflowStatusDetails).Error
if err != nil {
@@ -1465,25 +1320,23 @@ type SqlCountAndTriggerRuleCount struct {
TriggerRuleCount uint `json:"trigger_rule_count"`
}
-func (s *Storage) GetSqlCountAndTriggerRuleCountFromWorkflowByProject(projectName string) (SqlCountAndTriggerRuleCount, error) {
+func (s *Storage) GetSqlCountAndTriggerRuleCountFromWorkflowByProject(projectUid string) (SqlCountAndTriggerRuleCount, error) {
sqlCountAndTriggerRuleCount := SqlCountAndTriggerRuleCount{}
err := s.db.Model(&Workflow{}).
Select("count(1) sql_count, count(case when JSON_TYPE(execute_sql_detail.audit_results)<>'NULL' then 1 else null end) trigger_rule_count").
Joins("left join workflow_instance_records on workflows.workflow_record_id=workflow_instance_records.workflow_record_id").
Joins("left join tasks on workflow_instance_records.task_id=tasks.id").
Joins("left join execute_sql_detail on execute_sql_detail.task_id=tasks.id").
- Joins("left join projects on projects.id=workflows.project_id").
- Where("projects.name=?", projectName).
+ Where("workflows.project_id=?", projectUid).
Scan(&sqlCountAndTriggerRuleCount).Error
return sqlCountAndTriggerRuleCount, errors.ConnectStorageErrWrapper(err)
}
-func (s *Storage) GetWorkflowCountByStatusAndProject(status string, projectName string) (int, error) {
+func (s *Storage) GetWorkflowCountByStatusAndProject(status string, projectUid string) (int, error) {
var count int
err := s.db.Table("workflows").
Joins("left join workflow_records on workflows.workflow_record_id = workflow_records.id").
- Joins("left join projects on projects.id=workflows.project_id").
- Where("workflow_records.status = ? and projects.name=?", status, projectName).
+ Where("workflow_records.status = ? and workflows.project_id=?", status, projectUid).
Count(&count).Error
if err != nil {
return 0, errors.New(errors.ConnectStorageError, err)
diff --git a/sqle/model/workflow_list.go b/sqle/model/workflow_list.go
index f5012a00d9..7cfcdb356e 100644
--- a/sqle/model/workflow_list.go
+++ b/sqle/model/workflow_list.go
@@ -3,36 +3,34 @@ package model
import (
"database/sql"
"time"
-
- "github.com/actiontech/sqle/sqle/utils"
)
type WorkflowListDetail struct {
- ProjectName string `json:"project_name"`
- Subject string `json:"subject"`
- WorkflowId string `json:"workflow_id"`
- Desc string `json:"desc"`
- CreateUser sql.NullString `json:"create_user_name"`
- CreateUserDeletedAt *time.Time `json:"create_user_deleted_at"`
- CreateTime *time.Time `json:"create_time"`
- CurrentStepType sql.NullString `json:"current_step_type" enums:"sql_review,sql_execute"`
- CurrentStepAssigneeUser RowList `json:"current_step_assignee_user_name_list"`
- Status string `json:"status"`
- TaskInstanceType RowList `json:"task_instance_type"`
+ ProjectId string `json:"project_id"`
+ Subject string `json:"subject"`
+ WorkflowId string `json:"workflow_id"`
+ Desc string `json:"desc"`
+ CreateUser sql.NullString `json:"create_user_id"`
+ CreateUserDeletedAt *time.Time `json:"create_user_deleted_at"`
+ CreateTime *time.Time `json:"create_time"`
+ CurrentStepType sql.NullString `json:"current_step_type" enums:"sql_review,sql_execute"`
+ CurrentStepAssigneeUserIds sql.NullString `json:"current_step_assignee_user_id_list"`
+ Status string `json:"status"`
+ TaskInstanceType RowList `json:"task_instance_type"`
}
var workflowsQueryTpl = `
-SELECT p.name AS project_name,
+SELECT
+ w.project_id,
w.subject,
w.workflow_id,
w.desc,
- create_user.login_name AS create_user_name,
- create_user.deleted_at AS create_user_deleted_at,
+ w.create_user_id,
+ CAST("" AS DATETIME) AS create_user_deleted_at,
w.created_at AS create_time,
curr_wst.type AS current_step_type,
- GROUP_CONCAT(DISTINCT COALESCE(curr_ass_user.login_name, '')) AS current_step_assignee_user_name_list,
- wr.status,
- GROUP_CONCAT(inst.db_type) AS task_instance_type
+ curr_ws.assignees AS current_step_assignee_user_id_list,
+ wr.status
{{- template "body" . -}}
GROUP BY w.id
ORDER BY w.id DESC
@@ -56,25 +54,15 @@ ORDER BY w.id DESC
var workflowsQueryBodyTpl = `
{{ define "body" }}
FROM workflows w
-LEFT JOIN projects AS p ON w.project_id = p.id
-LEFT JOIN users AS create_user ON w.create_user_id = create_user.id
LEFT JOIN workflow_records AS wr ON w.workflow_record_id = wr.id
LEFT JOIN workflow_instance_records wir on wir.workflow_record_id = wr.id
LEFT JOIN tasks ON wir.task_id = tasks.id
-LEFT JOIN instances AS inst ON tasks.instance_id = inst.id
LEFT JOIN workflow_steps AS curr_ws ON wr.current_workflow_step_id = curr_ws.id
LEFT JOIN workflow_step_templates AS curr_wst ON curr_ws.workflow_step_template_id = curr_wst.id
-LEFT JOIN workflow_step_user AS curr_wst_re_user ON curr_ws.id = curr_wst_re_user.workflow_step_id
-LEFT JOIN users AS curr_ass_user ON curr_wst_re_user.user_id = curr_ass_user.id
-LEFT JOIN workflow_instance_record_user wiru ON wiru.workflow_instance_record_id = wir.id
-LEFT JOIN users inst_assign_user ON inst_assign_user.id = wiru.user_id
{{- if .check_user_can_access }}
LEFT JOIN workflow_steps AS all_ws ON w.id = all_ws.workflow_id AND all_ws.state !='initialized'
LEFT JOIN workflow_step_templates AS all_wst ON all_ws.workflow_step_template_id = all_wst.id
-LEFT JOIN workflow_step_user AS all_wst_re_user ON all_ws.id = all_wst_re_user.workflow_step_id
-LEFT JOIN users AS all_ass_user ON all_wst_re_user.user_id = all_ass_user.id
-LEFT JOIN workflow_instance_record_user all_wiru ON all_wiru.workflow_instance_record_id = wir.id
{{- end }}
WHERE
w.deleted_at IS NULL
@@ -82,14 +70,14 @@ w.deleted_at IS NULL
{{- if .check_user_can_access }}
AND (
w.create_user_id = :current_user_id
-OR curr_ass_user.id = :current_user_id
-OR all_ass_user.id = :current_user_id
+OR all_ws.assignees REGEXP :current_user_id
+OR curr_ws.assignees REGEXP :current_user_id
OR IF(wr.status = 'wait_for_execution'
- , all_wiru.user_id = :current_user_id
- , '')
+ , wir.execution_assignees REGEXP :current_user_id
+ , '')
{{- if .viewable_instance_ids }}
-OR inst.id IN ( {{ .viewable_instance_ids }})
+OR tasks.instance_id IN ( {{ .viewable_instance_ids }})
{{- end }}
)
@@ -115,8 +103,8 @@ AND tasks.exec_start_at > :filter_task_execute_start_time_from
AND tasks.exec_start_at < :filter_task_execute_start_time_to
{{- end }}
-{{- if .filter_create_user_name }}
-AND create_user.login_name = :filter_create_user_name
+{{- if .filter_create_user_id }}
+AND w.create_user_id = :filter_create_user_id
{{- end }}
{{- if .filter_current_step_type }}
@@ -127,10 +115,10 @@ AND curr_wst.type = :filter_current_step_type
AND wr.status IN (:filter_status)
{{- end }}
-{{- if .filter_current_step_assignee_user_name }}
-AND (curr_ass_user.login_name = :filter_current_step_assignee_user_name
+{{- if .filter_current_step_assignee_user_id }}
+AND (curr_ws.assignees REGEXP :filter_current_step_assignee_user_id
OR IF(wr.status = 'wait_for_execution'
- , inst_assign_user.login_name = :filter_current_step_assignee_user_name
+ , wir.execution_assignees REGEXP :filter_current_step_assignee_user_id
, '')
)
{{- end }}
@@ -147,34 +135,21 @@ AND inst.name = :filter_task_instance_name
AND w.workflow_id = :filter_workflow_id
{{- end }}
-{{- if .fuzzy_search_workflow_desc }}
-AND w.desc LIKE '%{{ .fuzzy_search_workflow_desc }}%'
+{{- if .filter_project_id }}
+AND w.project_id = :filter_project_id
{{- end }}
-{{- if .filter_project_name }}
-AND p.name = :filter_project_name
+{{- if .fuzzy_keyword }}
+AND (w.subject like :fuzzy_keyword or w.workflow_id like :fuzzy_keyword or w.desc like :fuzzy_keyword)
{{- end }}
{{ end }}
`
-func (s *Storage) GetWorkflowsByReq(data map[string]interface{}, user *User) (
+func (s *Storage) GetWorkflowsByReq(data map[string]interface{}) (
result []*WorkflowListDetail, count uint64, err error) {
- var ids []uint
- {
- instances, err := s.GetUserCanOpInstances(user, []uint{OP_WORKFLOW_VIEW_OTHERS})
- if err != nil {
- return result, 0, err
- }
- ids = getInstanceIDsFromInstances(instances)
- }
-
- if len(ids) > 0 {
- data["viewable_instance_ids"] = utils.JoinUintSliceToString(ids, ", ")
- }
-
err = s.getListResult(workflowsQueryBodyTpl, workflowsQueryTpl, data, &result)
if err != nil {
return result, 0, err
@@ -189,15 +164,16 @@ func (s *Storage) GetWorkflowCountByReq(data map[string]interface{}) (uint64, er
return s.getCountResult(workflowsQueryBodyTpl, workflowsCountTpl, data)
}
-func (s *Storage) GetWorkflowTotalByProjectName(projectName string) (uint64, error) {
- data := map[string]interface{}{
- "filter_project_name": projectName,
- }
- return s.GetWorkflowCountByReq(data)
-}
+// func (s *Storage) GetWorkflowTotalByProjectId(projectId string) (uint64, error) {
+// data := map[string]interface{}{
+// "filter_project_id": projectId,
+// }
+// return s.GetWorkflowCountByReq(data)
+// }
+// dms-todo: using project id as name, 临时方案
var projectWorkflowCountTpl = `
-SELECT p.name AS project_name, COUNT(DISTINCT w.id) AS workflow_count
+SELECT w.project_id AS project_name, COUNT(DISTINCT w.id) AS workflow_count
{{- template "body" . -}}
GROUP BY p.name
`
@@ -255,19 +231,6 @@ func (s *Storage) GetWorkflowTemplatesByReq(data map[string]interface{}) (
}
func (s *Storage) GetExportWorkflowIDListByReq(data map[string]interface{}, user *User) (idList []string, err error) {
- var ids []uint
- {
- instances, err := s.GetUserCanOpInstances(user, []uint{OP_WORKFLOW_VIEW_OTHERS})
- if err != nil {
- return idList, err
- }
- ids = getInstanceIDsFromInstances(instances)
- }
-
- if len(ids) > 0 {
- data["viewable_instance_ids"] = utils.JoinUintSliceToString(ids, ", ")
- }
-
err = s.getListResult(workflowsQueryBodyTpl, exportWorkflowIDListTpl, data, &idList)
if err != nil {
return idList, err
diff --git a/sqle/notification/email.go b/sqle/notification/email.go
deleted file mode 100644
index dce125a8a2..0000000000
--- a/sqle/notification/email.go
+++ /dev/null
@@ -1,67 +0,0 @@
-package notification
-
-import (
- "crypto/tls"
- "fmt"
- "strconv"
- "strings"
-
- "github.com/actiontech/sqle/sqle/model"
-
- "gopkg.in/gomail.v2"
-)
-
-func init() {
- Notifiers = append(Notifiers, &EmailNotifier{})
-}
-
-type EmailNotifier struct{}
-
-func (n *EmailNotifier) Notify(notification Notification, users []*model.User) error {
- // workflow has been finished.
- if len(users) == 0 {
- return nil
- }
-
- var emails []string
- for _, user := range users {
- if user.Email != "" {
- emails = append(emails, user.Email)
- }
- }
-
- // no user has configured email, don't send.
- if len(emails) == 0 {
- return nil
- }
-
- s := model.GetStorage()
- smtpC, exist, err := s.GetSMTPConfiguration()
- if err != nil {
- return err
- }
- if !exist {
- return nil
- }
-
- if !smtpC.EnableSMTPNotify.Bool {
- return nil
- }
-
- message := gomail.NewMessage()
- message.SetHeader("From", smtpC.Username)
- message.SetHeader("To", emails...)
- message.SetHeader("Subject", notification.NotificationSubject())
- body := notification.NotificationBody()
- message.SetBody("text/html", strings.Replace(body, "\n", " \n", -1))
-
- port, _ := strconv.Atoi(smtpC.Port)
- dialer := gomail.NewDialer(smtpC.Host, port, smtpC.Username, smtpC.Password)
- if smtpC.IsSkipVerify {
- dialer.TLSConfig = &tls.Config{InsecureSkipVerify: true}
- }
- if err := dialer.DialAndSend(message); err != nil {
- return fmt.Errorf("send email to %v error: %v", emails, err)
- }
- return nil
-}
diff --git a/sqle/notification/feishu.go b/sqle/notification/feishu.go
deleted file mode 100644
index 3cf5594fee..0000000000
--- a/sqle/notification/feishu.go
+++ /dev/null
@@ -1,91 +0,0 @@
-package notification
-
-import (
- "fmt"
- "strings"
-
- "github.com/actiontech/sqle/sqle/log"
- "github.com/actiontech/sqle/sqle/model"
- "github.com/actiontech/sqle/sqle/pkg/im/feishu"
- larkContact "github.com/larksuite/oapi-sdk-go/v3/service/contact/v3"
- larkIm "github.com/larksuite/oapi-sdk-go/v3/service/im/v1"
-)
-
-func init() {
- Notifiers = append(Notifiers, &FeishuNotifier{})
-}
-
-type FeishuNotifier struct{}
-
-func (n *FeishuNotifier) Notify(notification Notification, users []*model.User) error {
- // workflow has been finished.
- if len(users) == 0 {
- return nil
- }
-
- s := model.GetStorage()
- cfg, exist, err := s.GetImConfigByType(model.ImTypeFeishu)
- if err != nil {
- return fmt.Errorf("get im config failed: %v", err)
- }
- if !exist {
- return nil
- }
-
- if !cfg.IsEnable {
- return nil
- }
-
- // 通过邮箱、手机从飞书获取用户ids
- var emails, mobiles []string
- userCount := 0
- for _, u := range users {
- if u.Email == "" && u.Phone == "" {
- continue
- }
- if u.Email != "" {
- emails = append(emails, u.Email)
- }
- if u.Phone != "" {
- mobiles = append(mobiles, u.Phone)
- }
- userCount++
- if userCount == feishu.MaxCountOfIdThatUsedToFindUser {
- break
- }
- }
-
- client := feishu.NewFeishuClient(cfg.AppKey, cfg.AppSecret)
- feishuUsers, err := client.GetUsersByEmailOrMobileWithLimitation(emails, mobiles, larkContact.UserIdTypeGetUserUserId)
- if err != nil {
- return fmt.Errorf("get user_ids from feishu failed: %v", err)
- }
-
- content, err := BuildFeishuMessageBody(notification)
- if err != nil {
- return fmt.Errorf("convert content failed: %v", err)
- }
- errMsgs := []string{}
- l := log.NewEntry()
- for id, u := range feishuUsers {
- l.Infof("send message to feishu, email=%v, phone=%v, userId=%v", u.Email, u.Mobile, id)
- if err = client.SendMessage(feishu.FeishuReceiverIdTypeUserId, id, feishu.FeishuSendMessageMsgTypePost, content); err != nil {
- errMsgs = append(errMsgs, fmt.Sprintf("send message to feishu failed: %v; email=%v; phone=%v", err, u.Email, u.Mobile))
- }
- }
- if len(errMsgs) > 0 {
- return fmt.Errorf(strings.Join(errMsgs, "\n"))
- }
- return nil
-}
-
-func BuildFeishuMessageBody(n Notification) (string, error) {
- zhCnPostText := &larkIm.MessagePostText{Text: n.NotificationBody()}
- zhCnMessagePostContent := &larkIm.MessagePostContent{Title: n.NotificationSubject(), Content: [][]larkIm.MessagePostElement{{zhCnPostText}}}
- messagePostText := &larkIm.MessagePost{ZhCN: zhCnMessagePostContent}
- content, err := messagePostText.String()
- if err != nil {
- return "", err
- }
- return content, nil
-}
diff --git a/sqle/notification/notification.go b/sqle/notification/notification.go
index f3425b4d45..f75bb6c1d7 100644
--- a/sqle/notification/notification.go
+++ b/sqle/notification/notification.go
@@ -2,15 +2,19 @@ package notification
import (
"bytes"
+ "context"
"fmt"
"strings"
"sync"
"time"
+ v1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+ "github.com/actiontech/dms/pkg/dms-common/dmsobject"
+ "github.com/actiontech/sqle/sqle/api/controller"
+ "github.com/actiontech/sqle/sqle/dms"
driverV2 "github.com/actiontech/sqle/sqle/driver/v2"
"github.com/actiontech/sqle/sqle/log"
"github.com/actiontech/sqle/sqle/model"
- "github.com/actiontech/sqle/sqle/notification/webhook"
)
type Notification interface {
@@ -26,16 +30,14 @@ type WorkflowNotifyConfig struct {
SQLEUrl *string
}
-var Notifiers = []Notifier{}
-
-func Notify(notification Notification, users []*model.User) error {
- for _, n := range Notifiers {
- err := n.Notify(notification, users)
- if err != nil {
- return err
- }
- }
- return nil
+func Notify(notification Notification, userIds []string) error {
+ return dmsobject.Notify(context.TODO(), controller.GetDMSServerAddress(), v1.NotificationReq{
+ Notification: &v1.Notification{
+ NotificationSubject: notification.NotificationSubject(),
+ NotificationBody: notification.NotificationBody(),
+ UserUids: userIds,
+ },
+ })
}
type WorkflowNotifyType int
@@ -118,7 +120,7 @@ func (w *WorkflowNotification) NotificationBody() string {
w.workflow.Subject,
w.workflow.WorkflowId,
w.workflow.Desc,
- w.workflow.CreateUserName(),
+ dms.GetUserNameWithDelTag(w.workflow.CreateUserId),
w.workflow.CreatedAt)
}
@@ -132,21 +134,41 @@ func (w *WorkflowNotification) NotificationBody() string {
w.workflow.Subject,
w.workflow.WorkflowId,
w.workflow.Desc,
- w.workflow.CreateUserName(),
+ dms.GetUserNameWithDelTag(w.workflow.CreateUserId),
w.workflow.CreatedAt)
buf.WriteString(head)
if w.config.SQLEUrl != nil {
buf.WriteString(fmt.Sprintf("\n- 工单链接: %v/project/%v/order/%v",
strings.TrimRight(*w.config.SQLEUrl, "/"),
- w.workflow.Project.Name,
+ w.workflow.ProjectId,
w.workflow.WorkflowId,
))
} else {
buf.WriteString("\n- 工单链接: 请在系统设置-全局配置中补充全局url")
}
+ instanceIds := make([]uint64, 0, len(tasks))
+ for _, task := range tasks {
+ instanceIds = append(instanceIds, task.InstanceId)
+ }
+
+ instances, err := dms.GetInstancesInProjectByIds(context.Background(), string(w.workflow.ProjectId), instanceIds)
+ if err != nil {
+ buf.WriteString(fmt.Sprintf("\n 获取数据源实例失败: %v\n", err))
+ return buf.String()
+ }
+
+ instanceMap := map[uint64]*model.Instance{}
+ for _, instance := range instances {
+ instanceMap[instance.ID] = instance
+ }
+
for _, t := range tasks {
+ if instance, ok := instanceMap[t.InstanceId]; ok {
+ t.Instance = instance
+ }
+
buf.WriteString("\n--------------\n")
buf.WriteString(w.buildNotifyBody(t))
}
@@ -207,40 +229,33 @@ func (w *WorkflowNotification) buildNotifyBody(task *model.Task) string {
}
}
-func (w *WorkflowNotification) notifyUser() []*model.User {
+func (w *WorkflowNotification) notifyUser() []string {
switch w.notifyType {
case WorkflowNotifyTypeApprove, WorkflowNotifyTypeCreate:
return w.workflow.CurrentAssigneeUser()
// if workflow is rejected, the creator needs to be notified.
case WorkflowNotifyTypeReject:
- return []*model.User{
- w.workflow.CreateUser,
+ return []string{
+ w.workflow.CreateUserId,
}
// if workflow is executed, the creator and executor needs to be notified.
case WorkflowNotifyTypeExecuteSuccess, WorkflowNotifyTypeExecuteFail:
- users := []*model.User{
- w.workflow.CreateUser,
+ users := []string{
+ w.workflow.CreateUserId,
}
- if executeUser := w.workflow.FinalStep().OperationUser; executeUser != nil {
+ if executeUser := w.workflow.FinalStep().OperationUserId; executeUser != "" {
users = append(users, executeUser)
}
return users
default:
- return []*model.User{}
+ return []string{}
}
}
func notifyWorkflowWebhook(workflow *model.Workflow, wt WorkflowNotifyType) {
- cfg := webhook.WorkflowCfg
- if cfg == nil {
- log.NewEntry().Error("workflow webhook failed: config missing")
- return
- }
- if !cfg.Enable {
- return
- }
- err := workflowSendRequest(getWorkflowNotifyTypeAction(wt), workflow.Project.Name, workflow.
+ // dms-todo 使用projectid代替name
+ err := workflowSendRequest(getWorkflowNotifyTypeAction(wt), string(workflow.ProjectId), workflow.
WorkflowId, workflow.Subject, workflow.Record.Status)
if err != nil {
log.NewEntry().Errorf("workflow webhook failed: %v", err)
@@ -253,28 +268,26 @@ func notifyWorkflow(sqleUrl string, workflow *model.Workflow, wt WorkflowNotifyT
config.SQLEUrl = &sqleUrl
}
wn := NewWorkflowNotification(workflow, wt, config)
- users := wn.notifyUser()
+ userIds := wn.notifyUser()
// workflow has been finished.
- if len(users) == 0 {
+ if len(userIds) == 0 {
return
}
- err := Notify(wn, users)
+
+ err := Notify(wn, userIds)
if err != nil {
log.NewEntry().Errorf("notify workflow error, %v", err)
}
}
-func NotifyWorkflow(workflowId string, wt WorkflowNotifyType) {
+func NotifyWorkflow(projectId, workflowId string, wt WorkflowNotifyType) {
s := model.GetStorage()
- workflow, exist, err := s.GetWorkflowDetailById(workflowId)
+ workflow, err := dms.GetWorkflowDetailByWorkflowId(projectId, workflowId, s.GetWorkflowDetailWithoutInstancesByWorkflowID)
if err != nil {
- log.NewEntry().Errorf("notify workflow error, %v", err)
- return
- }
- if !exist {
log.NewEntry().Error("notify workflow error, workflow not exits")
return
}
+
go func() { notifyWorkflowWebhook(workflow, wt) }()
sqleUrl, err := s.GetSqleUrl()
@@ -329,10 +342,10 @@ func (a *AuditPlanNotification) NotificationBody() string {
a.report.AuditLevel,
))
- if a.config.SQLEUrl != nil && a.config.ProjectName != nil {
+ if a.config.SQLEUrl != nil && a.auditPlan.ProjectId != "" {
builder.WriteString(fmt.Sprintf("\n- 扫描任务链接: %v/project/%v/auditPlan/detail/%v/report/%v",
strings.TrimRight(*a.config.SQLEUrl, "/"),
- *a.config.ProjectName,
+ a.auditPlan.ProjectId,
a.auditPlan.Name,
a.report.ID,
))
@@ -358,10 +371,10 @@ func NotifyAuditPlan(auditPlanId uint, report *model.AuditPlanReportV2) error {
if err != nil {
return err
}
- ap.CreateUser, _, err = s.GetUserByID(ap.CreateUserID)
- if err != nil {
- return err
- }
+ // ap.CreateUser, _, err = s.GetUserByID(ap.CreateUserID)
+ // if err != nil {
+ // return err
+ // }
url, err := s.GetSqleUrl()
if err != nil {
return err
@@ -371,11 +384,12 @@ func NotifyAuditPlan(auditPlanId uint, report *model.AuditPlanReportV2) error {
if len(url) > 0 {
config.SQLEUrl = &url
- project, _, err := s.GetProjectByID(ap.ProjectId)
- if err != nil {
- return err
- }
- config.ProjectName = &project.Name
+ // dms-todo: 从 dms 获取 project 名称,但最终考虑将告警移走.
+ // project, _, err := s.GetProjectByID(ap.ProjectId)
+ // if err != nil {
+ // return err
+ // }
+ // config.ProjectName = &project.Name
}
if driverV2.RuleLevelLessOrEqual(ap.NotifyLevel, report.AuditLevel) {
@@ -393,16 +407,16 @@ func GetAuditPlanNotifier() *AuditPlanNotifier {
}
type AuditPlanNotifier struct {
- lastSend map[string] /*audit plan name*/ time.Time /*last send time*/
- mutex *sync.RWMutex
- emailNotifier *EmailNotifier
+ lastSend map[string] /*audit plan name*/ time.Time /*last send time*/
+ mutex *sync.RWMutex
+ // emailNotifier *EmailNotifier
}
func NewAuditPlanNotifier() *AuditPlanNotifier {
return &AuditPlanNotifier{
- lastSend: map[string]time.Time{},
- mutex: &sync.RWMutex{},
- emailNotifier: &EmailNotifier{},
+ lastSend: map[string]time.Time{},
+ mutex: &sync.RWMutex{},
+ // emailNotifier: &EmailNotifier{},
}
}
@@ -429,7 +443,12 @@ func (n *AuditPlanNotifier) shouldNotify(auditPlan *model.AuditPlan) bool {
func (n *AuditPlanNotifier) Send(notification Notification, auditPlan *model.AuditPlan) (err error) {
if auditPlan.EnableEmailNotify {
- err = n.sendEmail(notification, auditPlan.CreateUser)
+ user, err := dms.GetUser(context.TODO(), auditPlan.CreateUserID, controller.GetDMSServerAddress())
+ if err != nil {
+ log.NewEntry().Errorf("get user error, %v", err)
+ return err
+ }
+ err = n.sendEmail(notification, user)
if err != nil {
return err
}
@@ -444,7 +463,14 @@ func (n *AuditPlanNotifier) Send(notification Notification, auditPlan *model.Aud
}
func (n *AuditPlanNotifier) sendEmail(notification Notification, user *model.User) error {
- return n.emailNotifier.Notify(notification, []*model.User{user})
+ // dms-todo 只发送邮件告警
+ return dmsobject.Notify(context.TODO(), controller.GetDMSServerAddress(), v1.NotificationReq{
+ Notification: &v1.Notification{
+ NotificationSubject: notification.NotificationSubject(),
+ NotificationBody: notification.NotificationBody(),
+ UserUids: []string{user.GetIDStr()},
+ },
+ })
}
func (n *AuditPlanNotifier) updateRecord(auditPlanName string) {
diff --git a/sqle/notification/webhook.go b/sqle/notification/webhook.go
index 4daa891f44..fe486e2121 100644
--- a/sqle/notification/webhook.go
+++ b/sqle/notification/webhook.go
@@ -1,15 +1,13 @@
package notification
import (
- "bytes"
+ "context"
"encoding/json"
- "fmt"
- "io/ioutil"
- "net/http"
"time"
- "github.com/actiontech/sqle/sqle/notification/webhook"
- "github.com/actiontech/sqle/sqle/utils/retry"
+ v1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+ "github.com/actiontech/dms/pkg/dms-common/dmsobject"
+ "github.com/actiontech/sqle/sqle/api/controller"
)
type webHookRequestBody struct {
@@ -30,21 +28,13 @@ type httpBodyPayload struct {
Workflow *workflowPayload `json:"workflow"`
}
-func TestWorkflowConfig() (err error) {
- return workflowSendRequest("create",
- "test_project", "1658637666259832832", "test_workflow", "wait_for_audit")
-}
+// func TestWorkflowConfig() (err error) {
+// return workflowSendRequest("create",
+// "test_project", "1658637666259832832", "test_workflow", "wait_for_audit")
+// }
func workflowSendRequest(action,
projectName, workflowID, workflowSubject, workflowStatus string) (err error) {
- cfg := webhook.WorkflowCfg
- if cfg == nil {
- return fmt.Errorf("workflow webhook config missing")
- }
-
- if cfg.URL == "" {
- return fmt.Errorf("url is missing, please check webhook config")
- }
reqBody := &webHookRequestBody{
Event: "workflow",
@@ -65,32 +55,11 @@ func workflowSendRequest(action,
return err
}
- req, err := http.NewRequest(http.MethodPost, cfg.URL, bytes.NewBuffer(b))
- if err != nil {
- return
- }
- if cfg.Token != "" {
- req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", cfg.Token))
- }
-
- doneChan := make(chan struct{})
- return retry.Do(func() error {
- resp, err := http.DefaultClient.Do(req)
- if err != nil {
- return err
- }
- defer resp.Body.Close()
-
- if resp.StatusCode == http.StatusOK {
- return nil
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- return err
- }
- return fmt.Errorf("response status_code(%v) body(%s)", resp.StatusCode, respBytes)
- }, doneChan,
- retry.Delay(time.Duration(cfg.RetryIntervalSeconds)*time.Second),
- retry.Attempts(uint(cfg.MaxRetryTimes)))
+ return dmsobject.WebHookSendMessage(context.TODO(), controller.GetDMSServerAddress(), &v1.WebHookSendMessageReq{
+ WebHookMessage: &v1.WebHooksMessage{
+ Message: string(b),
+ TriggerEventType: v1.TriggerEventTypeWorkflow,
+ },
+ })
}
diff --git a/sqle/notification/wechat.go b/sqle/notification/wechat.go
deleted file mode 100644
index 453da036c5..0000000000
--- a/sqle/notification/wechat.go
+++ /dev/null
@@ -1,102 +0,0 @@
-package notification
-
-import (
- "fmt"
- "net"
- "net/http"
- "net/url"
- "strings"
- "time"
-
- "github.com/actiontech/sqle/sqle/model"
-
- "gopkg.in/chanxuehong/wechat.v1/corp"
- "gopkg.in/chanxuehong/wechat.v1/corp/message/send"
-)
-
-func init() {
- Notifiers = append(Notifiers, &WeChatNotifier{})
-}
-
-type WeChatNotifier struct{}
-
-func (n *WeChatNotifier) Notify(notification Notification, users []*model.User) error {
- // workflow has been finished.
- if len(users) == 0 {
- return nil
- }
- wechatUsers := map[string] /*user name*/ string /*wechat id*/ {}
- for _, user := range users {
- if user.WeChatID != "" {
- wechatUsers[user.Name] = user.WeChatID
- }
- }
-
- // no user has configured wechat, don't send.
- if len(wechatUsers) == 0 {
- return nil
- }
-
- s := model.GetStorage()
- wechatC, exist, err := s.GetWeChatConfiguration()
- if err != nil {
- return err
- }
- if !exist {
- return nil
- }
- if !wechatC.EnableWeChatNotify {
- return nil
- }
-
- client := generateWeChatClient(wechatC)
- safe := 0
- if wechatC.SafeEnabled {
- safe = 1
- }
- errs := []string{}
- for name, id := range wechatUsers {
- req := &send.Text{
- MessageHeader: send.MessageHeader{
- ToUser: id,
- MsgType: "text",
- AgentId: int64(wechatC.AgentID),
- Safe: &safe,
- },
- }
- req.Text.Content = fmt.Sprintf("%v \n\n %v", notification.NotificationSubject(), notification.NotificationBody())
- _, err := client.SendText(req)
- if err != nil {
- errs = append(errs, fmt.Sprintf("send message to %v failed, error: %v", name, err))
- }
- }
- if len(errs) > 0 {
- return fmt.Errorf("%v", strings.Join(errs, "\n"))
- }
- return nil
-}
-
-func generateWeChatClient(conf *model.WeChatConfiguration) *send.Client {
- proxy := http.ProxyFromEnvironment
- if conf.ProxyIP != "" {
- proxy = func(req *http.Request) (*url.URL, error) {
- return url.Parse(conf.ProxyIP)
- }
- }
- var transport http.RoundTripper = &http.Transport{
- Proxy: proxy,
- DialContext: (&net.Dialer{
- Timeout: 30 * time.Second,
- KeepAlive: 30 * time.Second,
- }).DialContext,
- MaxIdleConns: 100,
- IdleConnTimeout: 90 * time.Second,
- TLSHandshakeTimeout: 10 * time.Second,
- ExpectContinueTimeout: 1 * time.Second,
- }
- httpClient := &http.Client{
- Transport: transport,
- }
- accessTokenServer := corp.NewDefaultAccessTokenServer(conf.CorpID, conf.CorpSecret, httpClient)
- return send.NewClient(accessTokenServer, httpClient)
-}
diff --git a/sqle/pkg/im/dingding/dingding.go b/sqle/pkg/im/dingding/dingding.go
index 3d4f025310..c1b2421fb3 100644
--- a/sqle/pkg/im/dingding/dingding.go
+++ b/sqle/pkg/im/dingding/dingding.go
@@ -167,7 +167,7 @@ func (d *DingTalk) CreateApprovalTemplate() error {
processCode = *resp.Body.Result.ProcessCode
}
goto End
- // https://github.com/actiontech/sqle/issues/1487
+ // https://github.com/actiontech/sqle/issues/1487
} else if !tea.BoolValue(util.Empty(sdkErr.Code)) && *sdkErr.Code == "formName.error" {
getProcessCodeByNameHeaders := &dingTalkWorkflow.GetProcessCodeByNameHeaders{}
getProcessCodeByNameHeaders.XAcsDingtalkAccessToken = tea.String(token)
@@ -210,7 +210,7 @@ End:
// CreateApprovalInstance
// https://open.dingtalk.com/document/orgapp-server/create-an-approval-instance
-func (d *DingTalk) CreateApprovalInstance(workflowName string, workflowId uint, originUserId *string, userIds []*string, auditResult, projectName, desc, workflowUrl string) error {
+func (d *DingTalk) CreateApprovalInstance(workflowName string, workflowId string, originUserId *string, userIds []*string, auditResult, projectName, desc, workflowUrl string) error {
token, err := GetToken(d.AppKey, d.AppSecret)
if err != nil {
return fmt.Errorf("get token error: %v", err)
@@ -283,7 +283,7 @@ func (d *DingTalk) CreateApprovalInstance(workflowName string, workflowId uint,
// UpdateApprovalStatus
// https://open.dingtalk.com/document/orgapp-server/approve-or-reject-the-approval-task
-func (d *DingTalk) UpdateApprovalStatus(workflowId uint, status, userId, reason string) error {
+func (d *DingTalk) UpdateApprovalStatus(workflowId string, status, userId, reason string) error {
s := model.GetStorage()
dingTalkInstance, exist, err := s.GetDingTalkInstanceByWorkflowID(workflowId)
if err != nil {
diff --git a/sqle/pkg/im/im.go b/sqle/pkg/im/im.go
index dd49586fce..b2df3fa293 100644
--- a/sqle/pkg/im/im.go
+++ b/sqle/pkg/im/im.go
@@ -5,6 +5,9 @@ import (
"fmt"
"strings"
+ "github.com/actiontech/dms/pkg/dms-common/dmsobject"
+ "github.com/actiontech/sqle/sqle/api/controller"
+ "github.com/actiontech/sqle/sqle/dms"
"github.com/actiontech/sqle/sqle/log"
"github.com/actiontech/sqle/sqle/model"
"github.com/actiontech/sqle/sqle/pkg/im/dingding"
@@ -56,25 +59,40 @@ func CreateApprovalTemplate(imType string) {
}
}
-func CreateApprove(id string) {
+func CreateApprove(projectId, workflowId string) {
newLog := log.NewEntry()
s := model.GetStorage()
- workflow, exist, err := s.GetWorkflowDetailById(id)
+ workflow, err := dms.GetWorkflowDetailByWorkflowId(projectId, workflowId, s.GetWorkflowDetailWithoutInstancesByWorkflowID)
if err != nil {
- newLog.Error("get workflow detail error: ", err)
- return
- }
- if !exist {
newLog.Error("workflow not exist")
return
}
+ user, err := dms.GetUser(context.TODO(), workflow.CreateUserId, dms.GetDMSServerAddress())
+ if err != nil {
+ newLog.Errorf("get user phone failed err: %v", err)
+ return
+ }
+ if user.Phone == "" {
+ newLog.Error("create user phone is empty")
+ return
+ }
if workflow.CurrentStep() == nil {
- newLog.Infof("workflow %v has no current step, no need to create approve instance", workflow.ID)
+ newLog.Infof("workflow %v has no current step, no need to create approve instance", workflow.WorkflowId)
+ }
+
+ if len(workflow.Record.Steps) == 1 || workflow.CurrentStep() == workflow.Record.Steps[len(workflow.Record.Steps)-1] {
+ newLog.Infof("workflow %v only has one approve step or has been approved, no need to create approve instance", workflow.WorkflowId)
return
}
- users := workflow.CurrentAssigneeUser()
+ assignUserIds := workflow.CurrentAssigneeUser()
+
+ assignUsers, err := dms.GetUsers(context.TODO(), assignUserIds, controller.GetDMSServerAddress())
+ if err != nil {
+ newLog.Errorf("get user error: %v", err)
+ return
+ }
ims, err := s.GetAllIMConfig()
if err != nil {
@@ -94,7 +112,7 @@ func CreateApprove(id string) {
}
sqleUrl := systemVariables[model.SystemVariableSqleUrl].Value
- workflowUrl := fmt.Sprintf("%v/project/%s/order/%s", sqleUrl, workflow.Project.Name, workflow.WorkflowId)
+ workflowUrl := fmt.Sprintf("%v/project/%s/order/%s", sqleUrl, workflow.ProjectId, workflow.WorkflowId)
if sqleUrl == "" {
newLog.Errorf("sqle url is empty")
workflowUrl = ""
@@ -103,14 +121,14 @@ func CreateApprove(id string) {
switch im.Type {
case model.ImTypeDingTalk:
if len(workflow.Record.Steps) == 1 || workflow.CurrentStep() == workflow.Record.Steps[len(workflow.Record.Steps)-1] {
- newLog.Infof("workflow %v is the last step, no need to create approve instance", workflow.ID)
+ newLog.Infof("workflow %v is the last step, no need to create approve instance", workflow.WorkflowId)
return
}
- if workflow.CreateUser.Phone == "" {
- newLog.Error("create user phone is empty")
- return
- }
+ // if workflow.CreateUser.Phone == "" {
+ // newLog.Error("create user phone is empty")
+ // return
+ // }
var tableRows []string
for _, record := range workflow.Record.InstanceRecords {
@@ -126,35 +144,37 @@ func CreateApprove(id string) {
AppSecret: im.AppSecret,
ProcessCode: im.ProcessCode,
}
-
- createUserId, err := dingTalk.GetUserIDByPhone(workflow.CreateUser.Phone)
+ workflowCreateUser, err := dmsobject.GetUser(context.TODO(), workflow.CreateUserId, dms.GetDMSServerAddress())
+ if err != nil {
+ newLog.Errorf("get user error: %v", err)
+ return
+ }
+ createUserId, err := dingTalk.GetUserIDByPhone(workflowCreateUser.Phone)
if err != nil {
newLog.Errorf("get origin user id by phone error: %v", err)
continue
}
- userIds := make([]*string, 0, len(users))
- for _, user := range users {
+ var userIds []*string
+ for _, assignUser := range assignUsers {
if user.Phone == "" {
- newLog.Infof("user %v phone is empty, skip", user.ID)
+ newLog.Infof("user %v phone is empty, skip", assignUser)
continue
}
-
- userId, err := dingTalk.GetUserIDByPhone(user.Phone)
+ userId, err := dingTalk.GetUserIDByPhone(assignUser.Phone)
if err != nil {
newLog.Errorf("get user id by phone error: %v", err)
continue
}
-
userIds = append(userIds, userId)
}
- if err := dingTalk.CreateApprovalInstance(workflow.Subject, workflow.ID, createUserId, userIds, auditResult, workflow.Project.Name, workflow.Desc, workflowUrl); err != nil {
+ if err := dingTalk.CreateApprovalInstance(workflow.Subject, workflow.WorkflowId, createUserId, userIds, auditResult, string(workflow.ProjectId), workflow.Desc, workflowUrl); err != nil {
newLog.Errorf("create dingtalk approval instance error: %v", err)
continue
}
case model.ImTypeFeishuAudit:
- if err := CreateFeishuAuditInst(context.TODO(), im, workflow, users, workflowUrl); err != nil {
+ if err := CreateFeishuAuditInst(context.TODO(), im, workflow, assignUsers, workflowUrl); err != nil {
newLog.Errorf("create feishu audit instance error: %v", err)
continue
}
@@ -164,7 +184,7 @@ func CreateApprove(id string) {
}
}
-func UpdateApprove(workflowId uint, user *model.User, status, reason string) {
+func UpdateApprove(workflowId string, user *model.User, status, reason string) {
newLog := log.NewEntry()
s := model.GetStorage()
@@ -205,7 +225,7 @@ func UpdateApprove(workflowId uint, user *model.User, status, reason string) {
}
}
-func BatchCancelApprove(workflowIds []uint, user *model.User) {
+func BatchCancelApprove(workflowIds []string, user *model.User) {
newLog := log.NewEntry()
s := model.GetStorage()
ims, err := s.GetAllIMConfig()
diff --git a/sqle/pkg/im/im_ce.go b/sqle/pkg/im/im_ce.go
index 803bd748d8..6d0d10a1da 100644
--- a/sqle/pkg/im/im_ce.go
+++ b/sqle/pkg/im/im_ce.go
@@ -20,10 +20,10 @@ func CreateFeishuAuditInst(ctx context.Context, im model.IM, workflow *model.Wor
return ErrCommunityEditionNotSupportFeishuAudit
}
-func UpdateFeishuAuditStatus(ctx context.Context, im model.IM, workflowId uint, user *model.User, status string, reason string) error {
+func UpdateFeishuAuditStatus(ctx context.Context, im model.IM, workflowId string, user *model.User, status string, reason string) error {
return ErrCommunityEditionNotSupportFeishuAudit
}
-func CancelFeishuAuditInst(ctx context.Context, im model.IM, workflowIDs []uint, user *model.User) error {
+func CancelFeishuAuditInst(ctx context.Context, im model.IM, workflowIDs []string, user *model.User) error {
return ErrCommunityEditionNotSupportFeishuAudit
}
diff --git a/sqle/server/audit.go b/sqle/server/audit.go
index ba81eea268..9b7e5f8bd7 100644
--- a/sqle/server/audit.go
+++ b/sqle/server/audit.go
@@ -17,13 +17,13 @@ import (
"github.com/sirupsen/logrus"
)
-func Audit(l *logrus.Entry, task *model.Task, projectId *uint, ruleTemplateName string) (err error) {
+func Audit(l *logrus.Entry, task *model.Task, projectId *model.ProjectUID, ruleTemplateName string) (err error) {
return HookAudit(l, task, &EmptyAuditHook{}, projectId, ruleTemplateName)
}
-func HookAudit(l *logrus.Entry, task *model.Task, hook AuditHook, projectId *uint, ruleTemplateName string) (err error) {
+func HookAudit(l *logrus.Entry, task *model.Task, hook AuditHook, projectId *model.ProjectUID, ruleTemplateName string) (err error) {
st := model.GetStorage()
- rules, customRules, err := st.GetAllRulesByTmpNameAndProjectIdInstanceDBType(ruleTemplateName, projectId, task.Instance, task.DBType)
+ rules, customRules, err := st.GetAllRulesByTmpNameAndProjectIdInstanceDBType(ruleTemplateName, string(*projectId), task.Instance, task.DBType)
if err != nil {
return err
}
@@ -33,6 +33,11 @@ func HookAudit(l *logrus.Entry, task *model.Task, hook AuditHook, projectId *uin
}
defer plugin.Close(context.TODO())
+ // possible task is self build object, not model.Task{}
+ if task.Instance == nil {
+ task.Instance = &model.Instance{ProjectId: string(*projectId)}
+ }
+
return hookAudit(l, task, plugin, hook, customRules)
}
@@ -40,7 +45,7 @@ const AuditSchema = "AuditSchema"
func DirectAuditByInstance(l *logrus.Entry, sql, schemaName string, instance *model.Instance) (*model.Task, error) {
st := model.GetStorage()
- rules, customRules, err := st.GetAllRulesByTmpNameAndProjectIdInstanceDBType("", nil, instance, instance.DbType)
+ rules, customRules, err := st.GetAllRulesByTmpNameAndProjectIdInstanceDBType("", "", instance, instance.DbType)
if err != nil {
return nil, err
}
@@ -59,9 +64,9 @@ func DirectAuditByInstance(l *logrus.Entry, sql, schemaName string, instance *mo
return task, audit(l, task, plugin, customRules)
}
-func AuditSQLByDBType(l *logrus.Entry, sql string, dbType string, projectId *uint, ruleTemplateName string) (*model.Task, error) {
+func AuditSQLByDBType(l *logrus.Entry, sql string, dbType string) (*model.Task, error) {
st := model.GetStorage()
- rules, customRules, err := st.GetAllRulesByTmpNameAndProjectIdInstanceDBType(ruleTemplateName, projectId, nil, dbType)
+ rules, customRules, err := st.GetAllRulesByTmpNameAndProjectIdInstanceDBType("", "", nil, dbType)
if err != nil {
return nil, err
}
@@ -125,7 +130,12 @@ func hookAudit(l *logrus.Entry, task *model.Task, p driver.Plugin, hook AuditHoo
}()
st := model.GetStorage()
- whitelist, err := st.GetSqlWhitelistByInstanceId(task.InstanceId)
+
+ projectId := ""
+ if task.Instance != nil {
+ projectId = task.Instance.ProjectId
+ }
+ whitelist, err := st.GetSqlWhitelistByProjectId(projectId)
if err != nil {
return err
}
diff --git a/sqle/server/auditplan/huawei_task.go b/sqle/server/auditplan/huawei_task.go
new file mode 100644
index 0000000000..afdbd99148
--- /dev/null
+++ b/sqle/server/auditplan/huawei_task.go
@@ -0,0 +1,325 @@
+package auditplan
+
+import (
+ "fmt"
+ "strconv"
+ "time"
+
+ "github.com/actiontech/sqle/sqle/model"
+ "github.com/actiontech/sqle/sqle/utils"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
+
+ rdsCoreRegion "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/region"
+ rds "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3"
+ rdsModel "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model"
+ rdsRegion "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/region"
+ "github.com/percona/go-mysql/query"
+ "github.com/sirupsen/logrus"
+)
+
+const huaweiCloudRequestTimeFormat = "2006-01-02T15:04:05-0700"
+const huaweiCloudResponseTimeFormat = "2006-01-02T15:04:05"
+
+type SqlFromHuaweiCloud struct {
+ sql string
+ executionStartTime time.Time
+ schema string
+}
+
+func NewHuaweiRdsMySQLSlowLogTask(entry *logrus.Entry, ap *model.AuditPlan) Task {
+ sqlCollector := newSQLCollector(entry, ap)
+ a := &HuaweiRdsMySQLSlowLogTask{}
+ task := &huaweiRdsMySQLTask{
+ sqlCollector: sqlCollector,
+ lastEndTime: nil,
+ pullLogs: a.pullLogs,
+ }
+ sqlCollector.do = task.collectorDo
+ a.huaweiRdsMySQLTask = task
+ return a
+}
+
+type HuaweiRdsMySQLSlowLogTask struct {
+ *huaweiRdsMySQLTask
+}
+
+func (hr *HuaweiRdsMySQLSlowLogTask) pullLogs(client *rds.RdsClient, instanceId string, startTime, endTime time.Time, pageSize, pageNum int32) (sqls []SqlFromHuaweiCloud, err error) {
+ request := hr.newSlowSqlsRequest(instanceId, startTime, endTime, pageSize, pageNum)
+ response := &rdsModel.ListSlowLogsResponse{}
+
+ tryErr := func() (err error) {
+ defer func() {
+ if r := recover(); r != nil {
+ if e, ok := r.(error); ok {
+ err = e
+ } else {
+ err = fmt.Errorf("panic: %v", r)
+ }
+ }
+ }()
+ response, err = client.ListSlowLogs(request)
+ if err != nil {
+ return err
+ }
+ return nil
+ }()
+
+ if tryErr != nil {
+ return nil, fmt.Errorf("get huawei cloud slow log failed: %+v", tryErr)
+ }
+
+ sqls = make([]SqlFromHuaweiCloud, len(*response.SlowLogList))
+ for i, slowRecord := range *response.SlowLogList {
+ execStartTime, err := time.Parse(huaweiCloudResponseTimeFormat, utils.NvlString(&slowRecord.StartTime))
+ if err != nil {
+ return nil, fmt.Errorf("parse huawei cloud execution-start-time failed: %v", err)
+ }
+ sqls[i] = SqlFromHuaweiCloud{
+ sql: utils.NvlString(&slowRecord.QuerySample),
+ executionStartTime: execStartTime,
+ schema: slowRecord.Database,
+ }
+ }
+ return sqls, nil
+}
+
+func (at *HuaweiRdsMySQLSlowLogTask) Audit() (*AuditResultResp, error) {
+ task := &model.Task{
+ DBType: at.ap.DBType,
+ }
+ return at.baseTask.audit(task)
+}
+
+// huaweiRdsMySQLTask implement the Task interface.
+//
+// huaweiRdsMySQLTask is a loop task which collect slow log from ali rds MySQL instance.
+type huaweiRdsMySQLTask struct {
+ *sqlCollector
+ lastEndTime *time.Time
+ pullLogs func(client *rds.RdsClient, instanceId string, startTime, endTime time.Time, pageSize, pageNum int32) (sqls []SqlFromHuaweiCloud, err error)
+}
+
+var staticFields = map[string]struct{}{
+ "af-south-1": {},
+ "cn-north-4": {},
+ "cn-north-1": {},
+ "cn-east-2": {},
+ "cn-east-3": {},
+ "cn-south-1": {},
+ "cn-southwest-2": {},
+ "ap-southeast-2": {},
+ "ap-southeast-1": {},
+ "ap-southeast-3": {},
+ "ru-northwest-2": {},
+ "sa-brazil-1": {},
+ "la-north-2": {},
+ "cn-south-2": {},
+ "na-mexico-1": {},
+ "la-south-2": {},
+ "cn-north-9": {},
+ "cn-north-2": {},
+ "tr-west-1": {},
+ "ap-southeast-4": {},
+ "ae-ad-1": {},
+ "eu-west-101": {},
+}
+
+func isHuaweiRdsRegionExist(region string) bool {
+ var provider = rdsCoreRegion.DefaultProviderChain("RDS")
+ reg := provider.GetRegion(region)
+ if reg == nil {
+ _, exist := staticFields[region]
+ return exist
+ }
+ return true
+}
+
+func (at *huaweiRdsMySQLTask) collectorDo() {
+ //1. Load Configuration
+ // if at.ap.InstanceName == "" {
+ // at.logger.Warnf("instance is not configured")
+ // return
+ // }
+ accessKeyId := at.ap.Params.GetParam(paramKeyAccessKeyId).String()
+ if accessKeyId == "" {
+ at.logger.Warnf("huawei cloud access key id is not configured")
+ return
+ }
+ secretAccessKey := at.ap.Params.GetParam(paramKeyAccessKeySecret).String()
+ if secretAccessKey == "" {
+ at.logger.Warnf("huawei cloud secret access key is not configured")
+ return
+ }
+ projectId := at.ap.Params.GetParam(paramKeyProjectId).String()
+ if projectId == "" {
+ at.logger.Warnf("huawei cloud project id is not configured")
+ return
+ }
+ instanceId := at.ap.Params.GetParam(paramKeyDBInstanceId).String()
+ if instanceId == "" {
+ at.logger.Warnf("huawei cloud instance id is not configured")
+ return
+ }
+ region := at.ap.Params.GetParam(paramKeyRegion).String()
+ if region == "" {
+ at.logger.Warnf("huawei cloud region is not configured")
+ return
+ }
+ if !isHuaweiRdsRegionExist(region) {
+ at.logger.Warnf("huawei cloud region is not exist")
+ return
+ }
+ periodHours := at.ap.Params.GetParam(paramKeyFirstSqlsScrappedInLastPeriodHours).String()
+ if periodHours == "" {
+ at.logger.Warnf("huawei cloud period hours is not configured")
+ return
+ }
+ firstScrapInLastHours, err := strconv.Atoi(periodHours)
+ if err != nil {
+ at.sqlCollector.logger.Warnf("convert first sqls scrapped in last period hours failed: %v", err)
+ return
+ }
+
+ if firstScrapInLastHours == 0 {
+ firstScrapInLastHours = 24
+ }
+ theMaxSupportedDays := 30 // 支持往前查看慢日志的最大天数
+ hoursDuringADay := 24
+ if firstScrapInLastHours > theMaxSupportedDays*hoursDuringADay {
+ at.logger.Warnf("Can not get slow logs from so early time. firstScrapInLastHours=%v", firstScrapInLastHours)
+ return
+ }
+ //2. Init Client
+ client := at.CreateClient(accessKeyId, secretAccessKey, projectId, region)
+ if client == nil {
+ at.logger.Warnf("create client for huawei rdb mysql failed")
+ return
+ }
+
+ // 3. Request for slow logs
+
+ now := time.Now()
+ slowSqls := []SqlFromHuaweiCloud{}
+ var pageNum int32 = 1
+ var pageSize int32 = 100
+ var startTime time.Time
+ if at.isFirstScrap() {
+ startTime = now.Add(time.Duration(-1*firstScrapInLastHours) * time.Hour)
+ } else {
+ startTime = *at.lastEndTime
+ }
+
+ for {
+ newSlowSqls, err := at.pullLogs(client, instanceId, startTime, now, pageSize, pageNum)
+ if err != nil {
+ at.logger.Warnf("pull rds logs failed: %v", err)
+ return
+ }
+ filteredNewSlowSqls := at.filterSlowSqlsByExecutionTime(newSlowSqls, startTime)
+ slowSqls = append(slowSqls, filteredNewSlowSqls...)
+
+ if len(newSlowSqls) < int(pageSize) {
+ break
+ }
+ pageNum++
+ }
+
+ //4. Merge SQL
+ mergedSlowSqls := mergeSQLsFromHuaweiCloud(slowSqls)
+ if len(mergedSlowSqls) > 0 {
+ if at.isFirstScrap() {
+ err = at.persist.OverrideAuditPlanSQLs(at.ap.ID, at.convertSQLInfosToModelSQLs(mergedSlowSqls, now))
+ if err != nil {
+ at.logger.Errorf("save sqls to storage fail, error: %v", err)
+ return
+ }
+ } else {
+ err = at.persist.UpdateDefaultAuditPlanSQLs(at.ap.ID, at.convertSQLInfosToModelSQLs(mergedSlowSqls, now))
+ if err != nil {
+ at.logger.Errorf("save sqls to storage fail, error: %v", err)
+ return
+ }
+ }
+ }
+ // update lastEndTime
+ // 查询的起始时间为上一次查询到的最后一条慢语句的开始执行时间
+ if len(slowSqls) > 0 {
+ lastSlowSql := slowSqls[len(slowSqls)-1]
+ at.lastEndTime = &lastSlowSql.executionStartTime
+ }
+
+}
+
+func (at *huaweiRdsMySQLTask) convertSQLInfosToModelSQLs(sqls []sqlInfo, now time.Time) []*model.AuditPlanSQLV2 {
+ return convertRawSlowSQLWitchFromSqlInfo(sqls, now)
+}
+
+func mergeSQLsFromHuaweiCloud(sqls []SqlFromHuaweiCloud) []sqlInfo {
+ sqlInfos := []sqlInfo{}
+
+ counter := map[string]int /*slice subscript*/ {}
+ for _, sql := range sqls {
+ fp := query.Fingerprint(sql.sql)
+ if index, exist := counter[fp]; exist {
+ sqlInfos[index].counter += 1
+ sqlInfos[index].fingerprint = fp
+ sqlInfos[index].sql = sql.sql
+ sqlInfos[index].schema = sql.schema
+ } else {
+ sqlInfos = append(sqlInfos, sqlInfo{
+ counter: 1,
+ fingerprint: fp,
+ sql: sql.sql,
+ schema: sql.schema,
+ })
+ counter[fp] = len(sqlInfos) - 1
+ }
+
+ }
+ return sqlInfos
+}
+func (at *huaweiRdsMySQLTask) CreateClient(accessKeyId, secretAccessKey, projectId, region string) *rds.RdsClient {
+ defer func() {
+ if err := recover(); err != nil {
+ at.logger.Warnf("in huawei rds of audit plan, recovered from panic: %+v", err)
+ }
+ }()
+ credential := basic.NewCredentialsBuilder().
+ WithAk(accessKeyId).
+ WithSk(secretAccessKey).
+ WithProjectId(projectId).
+ Build()
+ hcClient := rds.RdsClientBuilder().
+ WithRegion(rdsRegion.ValueOf(region)).
+ WithCredential(credential).
+ Build()
+ return rds.NewRdsClient(hcClient)
+}
+
+func (at *huaweiRdsMySQLTask) newSlowSqlsRequest(instanceId string, startTime, endTime time.Time, pageSize, pageNum int32) *rdsModel.ListSlowLogsRequest {
+ startDate := startTime.Format(huaweiCloudRequestTimeFormat)
+ endDate := endTime.Format(huaweiCloudRequestTimeFormat)
+
+ return &rdsModel.ListSlowLogsRequest{
+ InstanceId: instanceId,
+ StartDate: startDate,
+ EndDate: endDate,
+ Offset: &pageNum,
+ Limit: &pageSize,
+ }
+}
+
+func (at *huaweiRdsMySQLTask) isFirstScrap() bool {
+ return at.lastEndTime == nil
+}
+
+// 因为查询的起始时间为上一次查询到的最后一条慢语句的executionStartTime(精确到秒),而查询起始时间只能精确到分钟,所以有可能还是会查询到上一次查询过的慢语句,需要将其过滤掉
+func (at *huaweiRdsMySQLTask) filterSlowSqlsByExecutionTime(slowSqls []SqlFromHuaweiCloud, executionTime time.Time) (res []SqlFromHuaweiCloud) {
+ for _, sql := range slowSqls {
+ if !sql.executionStartTime.After(executionTime) {
+ continue
+ }
+ res = append(res, sql)
+ }
+ return
+}
diff --git a/sqle/server/auditplan/manager.go b/sqle/server/auditplan/manager.go
index 1a5025a4fb..4b29d35844 100644
--- a/sqle/server/auditplan/manager.go
+++ b/sqle/server/auditplan/manager.go
@@ -5,6 +5,7 @@ import (
"fmt"
"time"
+ "github.com/actiontech/sqle/sqle/dms"
"github.com/actiontech/sqle/sqle/errors"
"github.com/actiontech/sqle/sqle/log"
"github.com/actiontech/sqle/sqle/model"
@@ -147,7 +148,7 @@ func (mgr *Manager) Start() {
func (mgr *Manager) sync() error {
// 全量同步智能扫描任务,仅需成功做一次
if !mgr.isFullSyncDone {
- aps, err := mgr.persist.GetActiveAuditPlans()
+ aps, err := dms.GetActiveAuditPlansWithInstance(mgr.persist.GetActiveAuditPlans)
if err != nil {
return err
}
diff --git a/sqle/server/auditplan/manager_test.go b/sqle/server/auditplan/manager_test.go
index ff0d0c9679..f8978a32c3 100644
--- a/sqle/server/auditplan/manager_test.go
+++ b/sqle/server/auditplan/manager_test.go
@@ -26,16 +26,16 @@ func TestManager(t *testing.T) {
nextTime := m.lastSyncTime.Add(5 * time.Second)
// test init
- mockHandle.ExpectQuery("SELECT `audit_plans`.* FROM `audit_plans` LEFT JOIN projects ON projects.id = audit_plans.project_id WHERE `audit_plans`.`deleted_at` IS NULL AND ((projects.status = 'active'))").
- WithArgs().
+ mockHandle.ExpectQuery("SELECT * FROM `audit_plans` WHERE `audit_plans`.`deleted_at` IS NULL AND ((project_status = ?))").
+ WithArgs("active").
WillReturnRows(sqlmock.NewRows([]string{"id", "name", "type", "cron_expression"}).AddRow(1, "test_ap_1", "default", "*/1 * * * *"))
mockHandle.ExpectQuery("SELECT id, updated_at FROM `audit_plans` WHERE (updated_at > ?) ORDER BY updated_at").
WithArgs(m.lastSyncTime).
WillReturnRows(sqlmock.NewRows([]string{"id", "updated_at"}).AddRow(2, nextTime))
- mockHandle.ExpectQuery("SELECT `audit_plans`.* FROM `audit_plans` LEFT JOIN projects ON projects.id = audit_plans.project_id WHERE `audit_plans`.`deleted_at` IS NULL AND ((projects.status = 'active') AND (audit_plans.id = ?))").
- WithArgs(2).
+ mockHandle.ExpectQuery("SELECT * FROM `audit_plans` WHERE `audit_plans`.`deleted_at` IS NULL AND ((project_status = ?) AND (id = ?)) ").
+ WithArgs("active", 2).
WillReturnRows(sqlmock.NewRows([]string{"id", "name", "type", "cron_expression"}).AddRow(2, "test_ap_2", "default", "*/2 * * * *"))
assert.NoError(t, m.sync())
@@ -65,8 +65,8 @@ func TestManager(t *testing.T) {
WithArgs(nextTime).
WillReturnRows(sqlmock.NewRows([]string{"id", "updated_at"}).AddRow(3, nextTimeMore))
- mockHandle.ExpectQuery("SELECT `audit_plans`.* FROM `audit_plans` LEFT JOIN projects ON projects.id = audit_plans.project_id WHERE `audit_plans`.`deleted_at` IS NULL AND ((projects.status = 'active') AND (audit_plans.id = ?))").
- WithArgs(3).
+ mockHandle.ExpectQuery("SELECT * FROM `audit_plans` WHERE `audit_plans`.`deleted_at` IS NULL AND ((project_status = ?) AND (id = ?))").
+ WithArgs("active", 3).
WillReturnRows(sqlmock.NewRows([]string{"id", "name", "type", "cron_expression"}).AddRow(3, "test_ap_3", "default", "*/3 * * * *"))
m.sync()
@@ -87,8 +87,8 @@ func TestManager(t *testing.T) {
WithArgs(nextTimeMore).
WillReturnRows(sqlmock.NewRows([]string{"id", "updated_at"}).AddRow(3, nextTimeMore2))
- mockHandle.ExpectQuery("SELECT `audit_plans`.* FROM `audit_plans` LEFT JOIN projects ON projects.id = audit_plans.project_id WHERE `audit_plans`.`deleted_at` IS NULL AND ((projects.status = 'active') AND (audit_plans.id = ?))").
- WithArgs(3).
+ mockHandle.ExpectQuery("SELECT * FROM `audit_plans` WHERE `audit_plans`.`deleted_at` IS NULL AND ((project_status = ?) AND (id = ?))").
+ WithArgs("active", 3).
WillReturnRows(sqlmock.NewRows([]string{"id", "name", "type", "cron_expression"}))
m.sync()
diff --git a/sqle/server/auditplan/mananger_comm.go b/sqle/server/auditplan/mananger_comm.go
index fb52257882..ca2765651e 100644
--- a/sqle/server/auditplan/mananger_comm.go
+++ b/sqle/server/auditplan/mananger_comm.go
@@ -25,11 +25,11 @@ func NewSyncFromAuditPlan(auditReport *model.AuditPlanReportV2, filterSqls []*mo
type SyncFromSqlAuditRecord struct {
Task *model.Task
SqlFpMap map[string]string
- ProjectId uint
+ ProjectId string
SqlAuditRecordID uint
}
-func NewSyncFromSqlAudit(task *model.Task, fpMap map[string]string, projectID uint, sqlAuditID uint) SqlManager {
+func NewSyncFromSqlAudit(task *model.Task, fpMap map[string]string, projectID string, sqlAuditID uint) SqlManager {
return &SyncFromSqlAuditRecord{
Task: task,
ProjectId: projectID,
diff --git a/sqle/server/auditplan/meta.go b/sqle/server/auditplan/meta.go
index 89d12ef98d..42b45f75df 100644
--- a/sqle/server/auditplan/meta.go
+++ b/sqle/server/auditplan/meta.go
@@ -19,18 +19,19 @@ type Meta struct {
}
const (
- TypeDefault = "default"
- TypeMySQLSlowLog = "mysql_slow_log"
- TypeMySQLMybatis = "mysql_mybatis"
- TypeMySQLSchemaMeta = "mysql_schema_meta"
- TypeMySQLProcesslist = "mysql_processlist"
- TypeAliRdsMySQLSlowLog = "ali_rds_mysql_slow_log"
- TypeAliRdsMySQLAuditLog = "ali_rds_mysql_audit_log"
- TypeOracleTopSQL = "oracle_top_sql"
- TypeTiDBAuditLog = "tidb_audit_log"
- TypeAllAppExtract = "all_app_extract"
- TypeBaiduRdsMySQLSlowLog = "baidu_rds_mysql_slow_log"
- TypeSQLFile = "sql_file"
+ TypeDefault = "default"
+ TypeMySQLSlowLog = "mysql_slow_log"
+ TypeMySQLMybatis = "mysql_mybatis"
+ TypeMySQLSchemaMeta = "mysql_schema_meta"
+ TypeMySQLProcesslist = "mysql_processlist"
+ TypeAliRdsMySQLSlowLog = "ali_rds_mysql_slow_log"
+ TypeAliRdsMySQLAuditLog = "ali_rds_mysql_audit_log"
+ TypeHuaweiRdsMySQLSlowLog = "huawei_rds_mysql_slow_log"
+ TypeOracleTopSQL = "oracle_top_sql"
+ TypeTiDBAuditLog = "tidb_audit_log"
+ TypeAllAppExtract = "all_app_extract"
+ TypeBaiduRdsMySQLSlowLog = "baidu_rds_mysql_slow_log"
+ TypeSQLFile = "sql_file"
)
const (
@@ -51,6 +52,8 @@ const (
paramKeyAccessKeySecret = "access_key_secret"
paramKeyRdsPath = "rds_path"
paramKeyFirstSqlsScrappedInLastPeriodHours = "first_sqls_scrapped_in_last_period_hours"
+ paramKeyProjectId = "project_id"
+ paramKeyRegion = "region"
)
var Metas = []Meta{
@@ -272,6 +275,50 @@ var Metas = []Meta{
},
},
},
+ {
+ Type: TypeHuaweiRdsMySQLSlowLog,
+ Desc: "华为云RDS MySQL慢日志",
+ InstanceType: InstanceTypeMySQL,
+ CreateTask: NewHuaweiRdsMySQLSlowLogTask,
+ Params: []*params.Param{
+ {
+ Key: paramKeyProjectId,
+ Desc: "项目ID",
+ Value: "",
+ Type: params.ParamTypeString,
+ },
+ {
+ Key: paramKeyDBInstanceId,
+ Desc: "实例ID",
+ Value: "",
+ Type: params.ParamTypeString,
+ },
+ {
+ Key: paramKeyAccessKeyId,
+ Desc: "Access Key ID",
+ Value: "",
+ Type: params.ParamTypeString,
+ },
+ {
+ Key: paramKeyAccessKeySecret,
+ Desc: "Access Key Secret",
+ Value: "",
+ Type: params.ParamTypeString,
+ },
+ {
+ Key: paramKeyFirstSqlsScrappedInLastPeriodHours,
+ Desc: "启动任务时拉取慢日志的时间范围(单位:小时,最大30天)",
+ Value: "",
+ Type: params.ParamTypeInt,
+ },
+ {
+ Key: paramKeyRegion,
+ Desc: "当前RDS实例所在的地区(示例:cn-east-2)",
+ Value: "",
+ Type: params.ParamTypeString,
+ },
+ },
+ },
{
Type: TypeOracleTopSQL,
Desc: "Oracle TOP SQL",
diff --git a/sqle/server/auditplan/task.go b/sqle/server/auditplan/task.go
index 0325f7a790..24ef084b7f 100644
--- a/sqle/server/auditplan/task.go
+++ b/sqle/server/auditplan/task.go
@@ -11,6 +11,7 @@ import (
"sync"
"time"
+ "github.com/actiontech/sqle/sqle/dms"
"github.com/actiontech/sqle/sqle/driver/mysql/executor"
driverV2 "github.com/actiontech/sqle/sqle/driver/v2"
"github.com/actiontech/sqle/sqle/errors"
@@ -261,9 +262,23 @@ func NewDefaultTask(entry *logrus.Entry, ap *model.AuditPlan) Task {
}
func (at *DefaultTask) Audit() (*AuditResultResp, error) {
- task, err := getTaskWithInstanceByAuditPlan(at.ap, at.persist)
- if err != nil {
- return nil, err
+ var task *model.Task
+ if at.ap.InstanceName == "" {
+ task = &model.Task{
+ DBType: at.ap.DBType,
+ }
+ } else {
+ ctx, cancel := context.WithTimeout(context.Background(), time.Second*20)
+ defer cancel()
+ instance, _, err := dms.GetInstanceInProjectByName(ctx, string(at.ap.ProjectId), at.ap.InstanceName)
+ if err != nil {
+ return nil, err
+ }
+ task = &model.Task{
+ Instance: instance,
+ Schema: at.ap.InstanceDatabase,
+ DBType: at.ap.DBType,
+ }
}
return at.baseTask.audit(task)
}
@@ -358,7 +373,7 @@ func getTaskWithInstanceByAuditPlan(ap *model.AuditPlan, persist *model.Storage)
DBType: ap.DBType,
}
} else {
- instance, _, err := persist.GetInstanceByNameAndProjectID(ap.InstanceName, ap.ProjectId)
+ instance, _, err := dms.GetInstanceInProjectByName(context.TODO(), string(ap.ProjectId), ap.InstanceName)
if err != nil {
return nil, err
}
@@ -393,7 +408,10 @@ func (at *SchemaMetaTask) collectorDo() {
at.logger.Warnf("instance schema is not configured")
return
}
- instance, _, err := at.persist.GetInstanceByNameAndProjectID(at.ap.InstanceName, at.ap.ProjectId)
+
+ ctx, cancel := context.WithTimeout(context.Background(), time.Second*20)
+ defer cancel()
+ instance, _, err := dms.GetInstanceInProjectByName(ctx, string(at.ap.ProjectId), at.ap.InstanceName)
if err != nil {
return
}
@@ -512,7 +530,10 @@ func (at *OracleTopSQLTask) collectorDo() {
return
}
- inst, _, err := at.persist.GetInstanceByNameAndProjectID(at.ap.InstanceName, at.ap.ProjectId)
+ ctx, cancel := context.WithTimeout(context.Background(), time.Second*20)
+ defer cancel()
+ inst, _, err := dms.GetInstanceInProjectByName(ctx, string(at.ap.ProjectId), at.ap.InstanceName)
+
if err != nil {
at.logger.Warnf("get instance fail, error: %v", err)
return
@@ -536,7 +557,7 @@ func (at *OracleTopSQLTask) collectorDo() {
}
defer db.Close()
- ctx, cancel := context.WithCancel(context.Background())
+ ctx, cancel = context.WithCancel(context.Background())
defer cancel()
sqls, err := db.QueryTopSQLs(ctx, at.ap.Params.GetParam("top_n").Int(), at.ap.Params.GetParam("order_by_column").String())
@@ -645,7 +666,10 @@ func (at *TiDBAuditLogTask) Audit() (*AuditResultResp, error) {
DBType: at.ap.DBType,
}
} else {
- instance, _, err := at.persist.GetInstanceByNameAndProjectID(at.ap.InstanceName, at.ap.ProjectId)
+ ctx, cancel := context.WithTimeout(context.Background(), time.Second*20)
+ defer cancel()
+
+ instance, _, err := dms.GetInstanceInProjectByName(ctx, string(at.ap.ProjectId), at.ap.InstanceName)
if err != nil {
return nil, err
}
@@ -1230,7 +1254,11 @@ func (at *MySQLProcesslistTask) collectorDo() {
at.logger.Warnf("instance is not configured")
return
}
- instance, _, err := at.persist.GetInstanceByNameAndProjectID(at.ap.InstanceName, at.ap.ProjectId)
+ ctx, cancel := context.WithTimeout(context.Background(), time.Second*20)
+ defer cancel()
+
+ instance, _, err := dms.GetInstanceInProjectByName(ctx, string(at.ap.ProjectId), at.ap.InstanceName)
+
if err != nil {
return
}
diff --git a/sqle/server/clean.go b/sqle/server/clean.go
index 00bc66e847..c8337b65a2 100644
--- a/sqle/server/clean.go
+++ b/sqle/server/clean.go
@@ -50,10 +50,10 @@ func (j *CleanJob) CleanExpiredWorkflows(entry *logrus.Entry) {
for _, workflow := range workflows {
err := st.DeleteWorkflow(workflow)
if err != nil {
- entry.Errorf("clean workflow %d error: %s", workflow.ID, err)
+ entry.Errorf("clean workflow %s error: %s", workflow.WorkflowId, err)
break
}
- hasDeletedWorkflowIds = append(hasDeletedWorkflowIds, strconv.FormatUint(uint64(workflow.ID), 10))
+ hasDeletedWorkflowIds = append(hasDeletedWorkflowIds, workflow.WorkflowId)
}
if len(hasDeletedWorkflowIds) > 0 {
entry.Infof("clean workflow [%s] success", strings.Join(hasDeletedWorkflowIds, ", "))
diff --git a/sqle/server/ding_talk.go b/sqle/server/ding_talk.go
index 7628b5b795..aa0d1c5477 100644
--- a/sqle/server/ding_talk.go
+++ b/sqle/server/ding_talk.go
@@ -1,10 +1,12 @@
package server
import (
+ "context"
"fmt"
- "strconv"
+ "strings"
"time"
+ "github.com/actiontech/sqle/sqle/dms"
"github.com/actiontech/sqle/sqle/model"
imPkg "github.com/actiontech/sqle/sqle/pkg/im"
"github.com/actiontech/sqle/sqle/pkg/im/dingding"
@@ -53,23 +55,21 @@ func (j *DingTalkJob) dingTalkRotation(entry *logrus.Entry) {
switch *approval.Result {
case model.ApproveStatusAgree:
- workflow, exist, err := st.GetWorkflowDetailById(strconv.Itoa(int(dingTalkInstance.WorkflowId)))
+ workflow, err := dms.GetWorkflowDetailByWorkflowId("", dingTalkInstance.WorkflowId, st.GetWorkflowDetailWithoutInstancesByWorkflowID)
if err != nil {
entry.Errorf("get workflow detail error: %v", err)
continue
}
- if !exist {
- entry.Errorf("workflow not exist, id: %d", dingTalkInstance.WorkflowId)
- continue
- }
+
if workflow.Record.Status == model.WorkflowStatusCancel {
- entry.Errorf("workflow has canceled skip, id: %d", dingTalkInstance.WorkflowId)
+ entry.Errorf("workflow has canceled skip, id: %s", dingTalkInstance.WorkflowId)
continue
}
nextStep := workflow.NextStep()
userId := *approval.OperationRecords[1].UserId
+
user, err := getUserByUserId(d, userId, workflow.CurrentStep().Assignees)
if err != nil {
entry.Errorf("get user by user id error: %v", err)
@@ -88,21 +88,18 @@ func (j *DingTalkJob) dingTalkRotation(entry *logrus.Entry) {
}
if nextStep.Template.Typ != model.WorkflowStepTypeSQLExecute {
- imPkg.CreateApprove(strconv.Itoa(int(workflow.ID)))
+ imPkg.CreateApprove(string(workflow.ProjectId), workflow.WorkflowId)
}
case model.ApproveStatusRefuse:
- workflow, exist, err := st.GetWorkflowDetailById(strconv.Itoa(int(dingTalkInstance.WorkflowId)))
+ workflow, err := dms.GetWorkflowDetailByWorkflowId("", dingTalkInstance.WorkflowId, st.GetWorkflowDetailWithoutInstancesByWorkflowID)
if err != nil {
entry.Errorf("get workflow detail error: %v", err)
continue
}
- if !exist {
- entry.Errorf("workflow not exist, id: %d", dingTalkInstance.WorkflowId)
- continue
- }
+
if workflow.Record.Status == model.WorkflowStatusCancel {
- entry.Errorf("workflow has canceled skip, id: %d", dingTalkInstance.WorkflowId)
+ entry.Errorf("workflow has canceled skip, id: %s", dingTalkInstance.WorkflowId)
continue
}
@@ -138,15 +135,19 @@ func (j *DingTalkJob) dingTalkRotation(entry *logrus.Entry) {
}
}
-func getUserByUserId(d *dingding.DingTalk, userId string, assignees []*model.User) (*model.User, error) {
+func getUserByUserId(d *dingding.DingTalk, userId string, assigneesUsers string) (*model.User, error) {
+ userMaps, err := dms.GetMapUsers(context.TODO(), strings.Split(assigneesUsers, ","), dms.GetDMSServerAddress())
+ if err != nil {
+ return nil, err
+ }
phone, err := d.GetMobileByUserID(userId)
if err != nil {
return nil, fmt.Errorf("get user mobile error: %v", err)
}
- for _, assignee := range assignees {
- if assignee.Phone == phone {
- return assignee, nil
+ for _, assigneeUser := range userMaps {
+ if assigneeUser.Phone == phone {
+ return assigneeUser, nil
}
}
diff --git a/sqle/server/sqled.go b/sqle/server/sqled.go
index 0fec30951d..ed1567210c 100644
--- a/sqle/server/sqled.go
+++ b/sqle/server/sqled.go
@@ -8,6 +8,7 @@ import (
"sync"
"time"
+ "github.com/actiontech/sqle/sqle/dms"
"github.com/actiontech/sqle/sqle/driver"
"github.com/actiontech/sqle/sqle/utils"
"github.com/go-sql-driver/mysql"
@@ -65,6 +66,7 @@ func (s *Sqled) addTask(taskId string, typ int) (*action, error) {
var p driver.Plugin
var rules []*model.Rule
var customRules []*model.CustomRule
+ var instance *model.Instance
st := model.GetStorage()
// var drvMgr driver.DriverManager
entry := log.NewEntry().WithField("task_id", taskId)
@@ -92,6 +94,18 @@ func (s *Sqled) addTask(taskId string, typ int) (*action, error) {
err = errors.New(errors.TaskNotExist, fmt.Errorf("task not exist"))
goto Error
}
+ if task.InstanceId != 0 {
+ instance, exist, err = dms.GetInstancesById(context.Background(), task.InstanceId)
+ if err != nil {
+ goto Error
+ }
+ if !exist {
+ err = errors.New(errors.DataNotExist, fmt.Errorf("instance not exist"))
+ goto Error
+ }
+
+ task.Instance = instance
+ }
if err = action.validation(task); err != nil {
goto Error
@@ -99,7 +113,7 @@ func (s *Sqled) addTask(taskId string, typ int) (*action, error) {
action.task = task
// plugin will be closed by drvMgr in Sqled.do().
- rules, customRules, err = st.GetAllRulesByTmpNameAndProjectIdInstanceDBType("", nil, task.Instance, task.DBType)
+ rules, customRules, err = st.GetAllRulesByTmpNameAndProjectIdInstanceDBType("", "", task.Instance, task.DBType)
if err != nil {
goto Error
}
diff --git a/sqle/server/sqled_test.go b/sqle/server/sqled_test.go
index d5d936085a..f0ba502009 100644
--- a/sqle/server/sqled_test.go
+++ b/sqle/server/sqled_test.go
@@ -164,8 +164,8 @@ func Test_action_audit_UpdateTask(t *testing.T) {
}
act := getAction([]string{"select * from t1"}, ActionTypeAudit, &mockDriver{})
- mock.ExpectQuery(regexp.QuoteMeta("SELECT `sql_whitelist`.* FROM `sql_whitelist` LEFT JOIN instances ON sql_whitelist.project_id = instances.project_id WHERE `sql_whitelist`.`deleted_at` IS NULL AND ((instances.id = ?))")).
- WithArgs(1).
+ mock.ExpectQuery(regexp.QuoteMeta("SELECT * FROM `sql_whitelist` WHERE `sql_whitelist`.`deleted_at` IS NULL AND ((sql_whitelist.project_id = ?))")).
+ WithArgs("").
WillReturnRows(sqlmock.NewRows([]string{"value", "match_type"}).AddRow(whitelist.Value, whitelist.MatchType))
mock.ExpectBegin()
@@ -208,13 +208,13 @@ func Test_action_execute(t *testing.T) {
return nil
})
- gomonkey.ApplyMethod(reflect.TypeOf(&model.Storage{}), "GetRulesFromRuleTemplateByName", func(_ *model.Storage, _ []uint, _ string) ([]*model.Rule, []*model.CustomRule, error) {
+ gomonkey.ApplyMethod(reflect.TypeOf(&model.Storage{}), "GetRulesFromRuleTemplateByName", func(_ *model.Storage, _ []string, _ string) ([]*model.Rule, []*model.CustomRule, error) {
return nil, nil, nil
})
}
newDriver := func() (driver.Plugin, error) {
- rules, _, err := model.GetStorage().GetAllRulesByTmpNameAndProjectIdInstanceDBType("", nil, nil, driverV2.DriverTypeMySQL)
+ rules, _, err := model.GetStorage().GetAllRulesByTmpNameAndProjectIdInstanceDBType("", "", nil, driverV2.DriverTypeMySQL)
if err != nil {
return nil, err
}
diff --git a/sqle/server/workflow_schedule.go b/sqle/server/workflow_schedule.go
index ebec281615..fd8bfd5d9e 100644
--- a/sqle/server/workflow_schedule.go
+++ b/sqle/server/workflow_schedule.go
@@ -1,13 +1,16 @@
package server
import (
+ "context"
"fmt"
"strconv"
"strings"
"sync"
"time"
+ dmsV1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
"github.com/actiontech/sqle/sqle/common"
+ "github.com/actiontech/sqle/sqle/dms"
"github.com/actiontech/sqle/sqle/errors"
"github.com/actiontech/sqle/sqle/log"
"github.com/actiontech/sqle/sqle/model"
@@ -37,15 +40,11 @@ func (j *WorkflowScheduleJob) WorkflowSchedule(entry *logrus.Entry) {
}
now := time.Now()
for _, workflow := range workflows {
- w, exist, err := st.GetWorkflowDetailById(strconv.Itoa(int(workflow.ID)))
+ w, err := dms.GetWorkflowDetailByWorkflowId(string(workflow.ProjectId), workflow.WorkflowId, st.GetWorkflowDetailWithoutInstancesByWorkflowID)
if err != nil {
entry.Errorf("get workflow from storage error: %v", err)
return
}
- if !exist {
- entry.Errorf("workflow %s not found", workflow.Subject)
- return
- }
currentStep := w.CurrentStep()
if currentStep == nil {
@@ -58,7 +57,7 @@ func (j *WorkflowScheduleJob) WorkflowSchedule(entry *logrus.Entry) {
}
entry.Infof("start to execute scheduled workflow %s", w.Subject)
- needExecuteTaskIds := map[uint]uint{}
+ needExecuteTaskIds := map[uint]string{}
for _, ir := range w.Record.InstanceRecords {
if !ir.IsSQLExecuted && ir.ScheduledAt != nil && ir.ScheduledAt.Before(now) {
needExecuteTaskIds[ir.TaskId] = ir.ScheduleUserId
@@ -76,7 +75,7 @@ func (j *WorkflowScheduleJob) WorkflowSchedule(entry *logrus.Entry) {
}
}
-func ExecuteWorkflow(workflow *model.Workflow, needExecTaskIdToUserId map[uint]uint) error {
+func ExecuteWorkflow(workflow *model.Workflow, needExecTaskIdToUserId map[uint]string) error {
s := model.GetStorage()
// get task and check connection before to execute it.
@@ -89,6 +88,14 @@ func ExecuteWorkflow(workflow *model.Workflow, needExecTaskIdToUserId map[uint]u
if !exist {
return errors.New(errors.DataNotExist, fmt.Errorf("task is not exist. taskID=%v", taskId))
}
+ instance, exist, err := dms.GetInstancesById(context.Background(), task.InstanceId)
+ if err != nil {
+ return err
+ }
+ if !exist {
+ return errors.New(errors.DataNotExist, fmt.Errorf("instance is not exist. instanceId=%v", task.InstanceId))
+ }
+ task.Instance = instance
if task.Instance == nil {
return errors.New(errors.DataNotExist, fmt.Errorf("instance is not exist"))
}
@@ -152,9 +159,9 @@ func ExecuteWorkflow(workflow *model.Workflow, needExecTaskIdToUserId map[uint]u
}
if err != nil || task.Status == model.TaskStatusExecuteFailed {
- go notification.NotifyWorkflow(fmt.Sprintf("%v", workflow.ID), notification.WorkflowNotifyTypeExecuteFail)
+ go notification.NotifyWorkflow(string(workflow.ProjectId), workflow.WorkflowId, notification.WorkflowNotifyTypeExecuteFail)
} else {
- go notification.NotifyWorkflow(fmt.Sprintf("%v", workflow.ID), notification.WorkflowNotifyTypeExecuteSuccess)
+ go notification.NotifyWorkflow(string(workflow.ProjectId), workflow.WorkflowId, notification.WorkflowNotifyTypeExecuteSuccess)
}
}()
@@ -225,7 +232,7 @@ func ApproveWorkflowProcess(workflow *model.Workflow, user *model.User, s *model
currentStep.State = model.WorkflowStepStateApprove
now := time.Now()
currentStep.OperateAt = &now
- currentStep.OperationUserId = user.ID
+ currentStep.OperationUserId = user.GetIDStr()
nextStep := workflow.NextStep()
workflow.Record.CurrentWorkflowStepId = nextStep.ID
if nextStep.Template.Typ == model.WorkflowStepTypeSQLExecute {
@@ -237,7 +244,7 @@ func ApproveWorkflowProcess(workflow *model.Workflow, user *model.User, s *model
return fmt.Errorf("update workflow status failed, %v", err)
}
- go notification.NotifyWorkflow(strconv.Itoa(int(workflow.ID)), notification.WorkflowNotifyTypeApprove)
+ go notification.NotifyWorkflow(string(workflow.ProjectId), workflow.WorkflowId, notification.WorkflowNotifyTypeApprove)
return nil
}
@@ -248,7 +255,7 @@ func RejectWorkflowProcess(workflow *model.Workflow, reason string, user *model.
currentStep.Reason = reason
now := time.Now()
currentStep.OperateAt = &now
- currentStep.OperationUserId = user.ID
+ currentStep.OperationUserId = user.GetIDStr()
workflow.Record.Status = model.WorkflowStatusReject
workflow.Record.CurrentWorkflowStepId = 0
@@ -257,26 +264,23 @@ func RejectWorkflowProcess(workflow *model.Workflow, reason string, user *model.
return fmt.Errorf("update workflow status failed, %v", err)
}
- go notification.NotifyWorkflow(fmt.Sprintf("%v", workflow.ID), notification.WorkflowNotifyTypeReject)
+ go notification.NotifyWorkflow(string(workflow.ProjectId), workflow.WorkflowId, notification.WorkflowNotifyTypeReject)
return nil
}
-func ExecuteTasksProcess(workflowId string, projectName string, user *model.User) error {
+func ExecuteTasksProcess(workflowId string, projectUid string, user *model.User) error {
s := model.GetStorage()
- workflow, exist, err := s.GetWorkflowDetailById(workflowId)
+ workflow, err := dms.GetWorkflowDetailByWorkflowId(projectUid, workflowId, s.GetWorkflowDetailWithoutInstancesByWorkflowID)
if err != nil {
return err
}
- if !exist {
- return err
- }
- if err := PrepareForWorkflowExecution(projectName, workflow, user); err != nil {
+ if err = PrepareForWorkflowExecution(projectUid, workflow, user); err != nil {
return err
}
- needExecTaskIds, err := GetNeedExecTaskIds(s, workflow, user)
+ needExecTaskIds, err := GetNeedExecTaskIds(workflow, user)
if err != nil {
return err
}
@@ -289,8 +293,8 @@ func ExecuteTasksProcess(workflowId string, projectName string, user *model.User
return nil
}
-func PrepareForWorkflowExecution(projectName string, workflow *model.Workflow, user *model.User) error {
- err := CheckCurrentUserCanOperateWorkflowByUser(user, &model.Project{Name: projectName}, workflow, []uint{})
+func PrepareForWorkflowExecution(projectUid string, workflow *model.Workflow, user *model.User) error {
+ err := CheckCurrentUserCanOperateWorkflowByUser(user, projectUid, workflow, []dmsV1.OpPermissionType{})
if err != nil {
return err
}
@@ -312,10 +316,10 @@ func PrepareForWorkflowExecution(projectName string, workflow *model.Workflow, u
return nil
}
-func GetNeedExecTaskIds(s *model.Storage, workflow *model.Workflow, user *model.User) (taskIds map[uint] /*task id*/ uint /*user id*/, err error) {
- instances, err := s.GetInstancesByWorkflowID(workflow.ID)
- if err != nil {
- return nil, err
+func GetNeedExecTaskIds(workflow *model.Workflow, user *model.User) (taskIds map[uint] /*task id*/ string /*user id*/, err error) {
+ instances := make([]*model.Instance, 0, len(workflow.Record.InstanceRecords))
+ for _, item := range workflow.Record.InstanceRecords {
+ instances = append(instances, item.Instance)
}
// 有不在运维时间内的instances报错
var cannotExecuteInstanceNames []string
@@ -330,32 +334,32 @@ func GetNeedExecTaskIds(s *model.Storage, workflow *model.Workflow, user *model.
}
// 定时的instances和已上线的跳过
- needExecTaskIds := make(map[uint]uint)
+ needExecTaskIds := make(map[uint]string)
for _, instRecord := range workflow.Record.InstanceRecords {
if instRecord.ScheduledAt != nil || instRecord.IsSQLExecuted {
continue
}
- needExecTaskIds[instRecord.TaskId] = user.ID
+ needExecTaskIds[instRecord.TaskId] = user.GetIDStr()
}
return needExecTaskIds, nil
}
-func CheckCurrentUserCanOperateWorkflowByUser(user *model.User, project *model.Project, workflow *model.Workflow, ops []uint) error {
+func CheckCurrentUserCanOperateWorkflowByUser(user *model.User, projectUid string, workflow *model.Workflow, ops []dmsV1.OpPermissionType) error {
if user.Name == model.DefaultAdminUser {
return nil
}
s := model.GetStorage()
-
- isManager, err := s.IsProjectManager(user.Name, project.Name)
+ up, err := dms.NewUserPermission(user.GetIDStr(), projectUid)
if err != nil {
return err
}
+ isManager := up.IsProjectAdmin()
if isManager {
return nil
}
- access, err := s.UserCanAccessWorkflow(user, workflow)
+ access, err := s.UserCanAccessWorkflow(user.GetIDStr(), workflow)
if err != nil {
return err
}
@@ -363,16 +367,10 @@ func CheckCurrentUserCanOperateWorkflowByUser(user *model.User, project *model.P
return nil
}
if len(ops) > 0 {
- instances, err := s.GetInstancesByWorkflowID(workflow.ID)
- if err != nil {
- return err
- }
- ok, err := s.CheckUserHasOpToInstances(user, instances, ops)
- if err != nil {
- return err
- }
- if ok {
- return nil
+ for _, item := range workflow.Record.InstanceRecords {
+ if !up.CanOpInstanceNoAdmin(item.Instance.GetIDStr(), ops...) {
+ return ErrWorkflowNoAccess
+ }
}
}
diff --git a/sqle/sqled.go b/sqle/sqled.go
index 4502b0f81f..f9212ec3ff 100644
--- a/sqle/sqled.go
+++ b/sqle/sqled.go
@@ -6,55 +6,63 @@ import (
"os/signal"
"syscall"
+ dmsCommonAes "github.com/actiontech/dms/pkg/dms-common/pkg/aes"
+ "github.com/actiontech/dms/pkg/dms-common/pkg/http"
"github.com/actiontech/sqle/sqle/api"
- "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/service"
+ "github.com/actiontech/sqle/sqle/dms"
+
+ // "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper/service"
"github.com/actiontech/sqle/sqle/config"
"github.com/actiontech/sqle/sqle/driver"
"github.com/actiontech/sqle/sqle/log"
"github.com/actiontech/sqle/sqle/model"
- "github.com/actiontech/sqle/sqle/notification/webhook"
"github.com/actiontech/sqle/sqle/server"
"github.com/actiontech/sqle/sqle/server/cluster"
- "github.com/actiontech/sqle/sqle/utils"
"github.com/facebookgo/grace/gracenet"
)
-func Run(config *config.Config) error {
+func Run(options *config.SqleOptions) error {
// init logger
- sqleCnf := config.Server.SqleCnf
+ sqleCnf := options.Service
log.InitLogger(sqleCnf.LogPath, sqleCnf.LogMaxSizeMB, sqleCnf.LogMaxBackupNumber)
defer log.ExitLogger()
log.Logger().Infoln("starting sqled server")
defer log.Logger().Info("stop sqled server")
- if sqleCnf.EnableClusterMode && sqleCnf.ServerId == "" {
+ if sqleCnf.EnableClusterMode && options.ID == 0 {
return fmt.Errorf("server id is required on cluster mode")
}
- secretKey := sqleCnf.SecretKey
+ secretKey := options.SecretKey
if secretKey != "" {
- if err := utils.SetSecretKey([]byte(secretKey)); err != nil {
- return fmt.Errorf("set secret key error, %v, check your secret key in config file", err)
+ // reset jwt singing key, default dms token
+ if err := http.ResetJWTSigningKeyAndDefaultToken(secretKey); err != nil {
+ return err
+ }
+
+ // reset aes secret key
+ if err := dmsCommonAes.ResetAesSecretKey(secretKey); err != nil {
+ return err
}
}
defer driver.GetPluginManager().Stop()
- if err := driver.GetPluginManager().Start(sqleCnf.PluginPath, config.Server.PluginConfig); err != nil {
+ if err := driver.GetPluginManager().Start(sqleCnf.PluginPath, options.Service.PluginConfig); err != nil {
return fmt.Errorf("init plugins error: %v", err)
}
- service.InitSQLQueryConfig(sqleCnf.SqleServerPort, sqleCnf.EnableHttps, config.Server.SQLQueryConfig)
+ // service.InitSQLQueryConfig(sqleCnf.SqleServerPort, sqleCnf.EnableHttps, config.Server.SQLQueryConfig)
- dbConfig := config.Server.DBCnf.MysqlCnf
+ dbConfig := options.Service.Database
dbPassword := dbConfig.Password
// Support using secret mysql password in sqled config, read secret_mysql_password first,
// but you can still use mysql_password to be compatible with older versions.
secretPassword := dbConfig.SecretPassword
if secretPassword != "" {
- password, err := utils.AesDecrypt(secretPassword)
+ password, err := dmsCommonAes.AesDecrypt(secretPassword)
if err != nil {
return fmt.Errorf("read db info from config file error, %d", err)
}
@@ -68,25 +76,27 @@ func Run(config *config.Config) error {
}
model.InitStorage(s)
+ err = dms.RegisterAsDMSTarget(options)
+ if err != nil {
+ return fmt.Errorf("register to dms failed :%v", err)
+ }
+
if sqleCnf.AutoMigrateTable {
if err := s.AutoMigrate(); err != nil {
return fmt.Errorf("auto migrate table failed: %v", err)
}
+
+ err := s.CreateDefaultWorkflowTemplateIfNotExist()
+ if err != nil {
+ return fmt.Errorf("create workflow template failed: %v", err)
+ }
if err := s.CreateRulesIfNotExist(driver.GetPluginManager().GetAllRules()); err != nil {
return fmt.Errorf("create rules failed while auto migrating table: %v", err)
}
- if err := s.CreateDefaultTemplate(driver.GetPluginManager().GetAllRules()); err != nil {
+
+ if err := s.CreateDefaultTemplateIfNotExist(model.ProjectIdForGlobalRuleTemplate, driver.GetPluginManager().GetAllRules()); err != nil {
return fmt.Errorf("create default template failed while auto migrating table: %v", err)
}
- if err := s.CreateAdminUser(); err != nil {
- return fmt.Errorf("create default admin user failed while auto migrating table: %v", err)
- }
- if err := s.CreateDefaultProject(); err != nil {
- return fmt.Errorf("create default project failed while auto migrating table: %v", err)
- }
- if err := s.CreateDefaultRole(); err != nil {
- return fmt.Errorf("create default rule failed while auto migrating table: %v", err)
- }
}
exitChan := make(chan struct{})
server.InitSqled(exitChan)
@@ -96,28 +106,18 @@ func Run(config *config.Config) error {
cluster.IsClusterMode = true
log.Logger().Infoln("running sqled server on cluster mode")
node = cluster.DefaultNode
- node.Join(sqleCnf.ServerId)
+ node.Join(fmt.Sprintf("%v", options.ID))
defer node.Leave()
} else {
node = &cluster.NoClusterNode{}
}
- // webhook
- {
- cfg, _, err := s.GetWorkflowWebHookConfig()
- if err != nil {
- return fmt.Errorf("get workflow webhook config failed: %v", err)
- }
- webhook.UpdateWorkflowConfig(cfg.Enable,
- cfg.MaxRetryTimes, cfg.RetryIntervalSeconds, cfg.URL, cfg.Token)
- }
-
jm := server.NewServerJobManger(node)
jm.Start()
defer jm.Stop()
net := &gracenet.Net{}
- go api.StartApi(net, exitChan, sqleCnf)
+ go api.StartApi(net, exitChan, options)
killChan := make(chan os.Signal, 1)
// os.Kill is like kill -9 which kills a process immediately, can't be caught
diff --git a/vendor/github.com/99designs/gqlgen/LICENSE b/vendor/github.com/99designs/gqlgen/LICENSE
deleted file mode 100644
index 10bb21c07e..0000000000
--- a/vendor/github.com/99designs/gqlgen/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2020 gqlgen authors
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/99designs/gqlgen/api/generate.go b/vendor/github.com/99designs/gqlgen/api/generate.go
deleted file mode 100644
index 6619dd5cd2..0000000000
--- a/vendor/github.com/99designs/gqlgen/api/generate.go
+++ /dev/null
@@ -1,139 +0,0 @@
-package api
-
-import (
- "fmt"
- "regexp"
- "syscall"
-
- "github.com/99designs/gqlgen/codegen"
- "github.com/99designs/gqlgen/codegen/config"
- "github.com/99designs/gqlgen/plugin"
- "github.com/99designs/gqlgen/plugin/federation"
- "github.com/99designs/gqlgen/plugin/modelgen"
- "github.com/99designs/gqlgen/plugin/resolvergen"
-)
-
-func Generate(cfg *config.Config, option ...Option) error {
- _ = syscall.Unlink(cfg.Exec.Filename)
- if cfg.Model.IsDefined() {
- _ = syscall.Unlink(cfg.Model.Filename)
- }
-
- plugins := []plugin.Plugin{}
- if cfg.Model.IsDefined() {
- plugins = append(plugins, modelgen.New())
- }
- plugins = append(plugins, resolvergen.New())
- if cfg.Federation.IsDefined() {
- if cfg.Federation.Version == 0 { // default to using the user's choice of version, but if unset, try to sort out which federation version to use
- urlRegex := regexp.MustCompile(`(?s)@link.*\(.*url:.*?"(.*?)"[^)]+\)`) // regex to grab the url of a link directive, should it exist
-
- // check the sources, and if one is marked as federation v2, we mark the entirety to be generated using that format
- for _, v := range cfg.Sources {
- cfg.Federation.Version = 1
- urlString := urlRegex.FindStringSubmatch(v.Input)
- if urlString != nil && urlString[1] == "https://specs.apollo.dev/federation/v2.0" {
- cfg.Federation.Version = 2
- break
- }
- }
- }
- plugins = append([]plugin.Plugin{federation.New(cfg.Federation.Version)}, plugins...)
- }
-
- for _, o := range option {
- o(cfg, &plugins)
- }
-
- for _, p := range plugins {
- if inj, ok := p.(plugin.EarlySourceInjector); ok {
- if s := inj.InjectSourceEarly(); s != nil {
- cfg.Sources = append(cfg.Sources, s)
- }
- }
- }
-
- if err := cfg.LoadSchema(); err != nil {
- return fmt.Errorf("failed to load schema: %w", err)
- }
-
- for _, p := range plugins {
- if inj, ok := p.(plugin.LateSourceInjector); ok {
- if s := inj.InjectSourceLate(cfg.Schema); s != nil {
- cfg.Sources = append(cfg.Sources, s)
- }
- }
- }
-
- // LoadSchema again now we have everything
- if err := cfg.LoadSchema(); err != nil {
- return fmt.Errorf("failed to load schema: %w", err)
- }
-
- if err := cfg.Init(); err != nil {
- return fmt.Errorf("generating core failed: %w", err)
- }
-
- for _, p := range plugins {
- if mut, ok := p.(plugin.ConfigMutator); ok {
- err := mut.MutateConfig(cfg)
- if err != nil {
- return fmt.Errorf("%s: %w", p.Name(), err)
- }
- }
- }
- // Merge again now that the generated models have been injected into the typemap
- data, err := codegen.BuildData(cfg)
- if err != nil {
- return fmt.Errorf("merging type systems failed: %w", err)
- }
-
- if err = codegen.GenerateCode(data); err != nil {
- return fmt.Errorf("generating core failed: %w", err)
- }
-
- if !cfg.SkipModTidy {
- if err = cfg.Packages.ModTidy(); err != nil {
- return fmt.Errorf("tidy failed: %w", err)
- }
- }
-
- for _, p := range plugins {
- if mut, ok := p.(plugin.CodeGenerator); ok {
- err := mut.GenerateCode(data)
- if err != nil {
- return fmt.Errorf("%s: %w", p.Name(), err)
- }
- }
- }
-
- if err = codegen.GenerateCode(data); err != nil {
- return fmt.Errorf("generating core failed: %w", err)
- }
-
- if !cfg.SkipValidation {
- if err := validate(cfg); err != nil {
- return fmt.Errorf("validation failed: %w", err)
- }
- }
-
- return nil
-}
-
-func validate(cfg *config.Config) error {
- roots := []string{cfg.Exec.ImportPath()}
- if cfg.Model.IsDefined() {
- roots = append(roots, cfg.Model.ImportPath())
- }
-
- if cfg.Resolver.IsDefined() {
- roots = append(roots, cfg.Resolver.ImportPath())
- }
-
- cfg.Packages.LoadAll(roots...)
- errs := cfg.Packages.Errors()
- if len(errs) > 0 {
- return errs
- }
- return nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/api/option.go b/vendor/github.com/99designs/gqlgen/api/option.go
deleted file mode 100644
index d376193dfe..0000000000
--- a/vendor/github.com/99designs/gqlgen/api/option.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package api
-
-import (
- "github.com/99designs/gqlgen/codegen/config"
- "github.com/99designs/gqlgen/plugin"
-)
-
-type Option func(cfg *config.Config, plugins *[]plugin.Plugin)
-
-func NoPlugins() Option {
- return func(cfg *config.Config, plugins *[]plugin.Plugin) {
- *plugins = nil
- }
-}
-
-func AddPlugin(p plugin.Plugin) Option {
- return func(cfg *config.Config, plugins *[]plugin.Plugin) {
- *plugins = append(*plugins, p)
- }
-}
-
-// PrependPlugin prepends plugin any existing plugins
-func PrependPlugin(p plugin.Plugin) Option {
- return func(cfg *config.Config, plugins *[]plugin.Plugin) {
- *plugins = append([]plugin.Plugin{p}, *plugins...)
- }
-}
-
-// ReplacePlugin replaces any existing plugin with a matching plugin name
-func ReplacePlugin(p plugin.Plugin) Option {
- return func(cfg *config.Config, plugins *[]plugin.Plugin) {
- if plugins != nil {
- found := false
- ps := *plugins
- for i, o := range ps {
- if p.Name() == o.Name() {
- ps[i] = p
- found = true
- }
- }
- if !found {
- ps = append(ps, p)
- }
- *plugins = ps
- }
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/args.go b/vendor/github.com/99designs/gqlgen/codegen/args.go
deleted file mode 100644
index 0fd30fffd5..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/args.go
+++ /dev/null
@@ -1,122 +0,0 @@
-package codegen
-
-import (
- "fmt"
- "go/types"
- "strings"
-
- "github.com/99designs/gqlgen/codegen/config"
- "github.com/99designs/gqlgen/codegen/templates"
- "github.com/vektah/gqlparser/v2/ast"
-)
-
-type ArgSet struct {
- Args []*FieldArgument
- FuncDecl string
-}
-
-type FieldArgument struct {
- *ast.ArgumentDefinition
- TypeReference *config.TypeReference
- VarName string // The name of the var in go
- Object *Object // A link back to the parent object
- Default interface{} // The default value
- Directives []*Directive
- Value interface{} // value set in Data
-}
-
-// ImplDirectives get not Builtin and location ARGUMENT_DEFINITION directive
-func (f *FieldArgument) ImplDirectives() []*Directive {
- d := make([]*Directive, 0)
- for i := range f.Directives {
- if !f.Directives[i].Builtin && f.Directives[i].IsLocation(ast.LocationArgumentDefinition) {
- d = append(d, f.Directives[i])
- }
- }
-
- return d
-}
-
-func (f *FieldArgument) DirectiveObjName() string {
- return "rawArgs"
-}
-
-func (f *FieldArgument) Stream() bool {
- return f.Object != nil && f.Object.Stream
-}
-
-func (b *builder) buildArg(obj *Object, arg *ast.ArgumentDefinition) (*FieldArgument, error) {
- tr, err := b.Binder.TypeReference(arg.Type, nil)
- if err != nil {
- return nil, err
- }
-
- argDirs, err := b.getDirectives(arg.Directives)
- if err != nil {
- return nil, err
- }
- newArg := FieldArgument{
- ArgumentDefinition: arg,
- TypeReference: tr,
- Object: obj,
- VarName: templates.ToGoPrivate(arg.Name),
- Directives: argDirs,
- }
-
- if arg.DefaultValue != nil {
- newArg.Default, err = arg.DefaultValue.Value(nil)
- if err != nil {
- return nil, fmt.Errorf("default value is not valid: %w", err)
- }
- }
-
- return &newArg, nil
-}
-
-func (b *builder) bindArgs(field *Field, sig *types.Signature, params *types.Tuple) ([]*FieldArgument, error) {
- n := params.Len()
- newArgs := make([]*FieldArgument, 0, len(field.Args))
- // Accept variadic methods (i.e. have optional parameters).
- if params.Len() > len(field.Args) && sig.Variadic() {
- n = len(field.Args)
- }
-nextArg:
- for j := 0; j < n; j++ {
- param := params.At(j)
- for _, oldArg := range field.Args {
- if strings.EqualFold(oldArg.Name, param.Name()) {
- tr, err := b.Binder.TypeReference(oldArg.Type, param.Type())
- if err != nil {
- return nil, err
- }
- oldArg.TypeReference = tr
-
- newArgs = append(newArgs, oldArg)
- continue nextArg
- }
- }
-
- // no matching arg found, abort
- return nil, fmt.Errorf("arg %s not in schema", param.Name())
- }
-
- return newArgs, nil
-}
-
-func (a *Data) Args() map[string][]*FieldArgument {
- ret := map[string][]*FieldArgument{}
- for _, o := range a.Objects {
- for _, f := range o.Fields {
- if len(f.Args) > 0 {
- ret[f.ArgsFunc()] = f.Args
- }
- }
- }
-
- for _, d := range a.Directives() {
- if len(d.Args) > 0 {
- ret[d.ArgsFunc()] = d.Args
- }
- }
- return ret
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/args.gotpl b/vendor/github.com/99designs/gqlgen/codegen/args.gotpl
deleted file mode 100644
index 7b541ae1f2..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/args.gotpl
+++ /dev/null
@@ -1,36 +0,0 @@
-{{ range $name, $args := .Args }}
-func (ec *executionContext) {{ $name }}(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- {{- range $i, $arg := . }}
- var arg{{$i}} {{ $arg.TypeReference.GO | ref}}
- if tmp, ok := rawArgs[{{$arg.Name|quote}}]; ok {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField({{$arg.Name|quote}}))
- {{- if $arg.ImplDirectives }}
- directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) }
- {{ template "implDirectives" $arg }}
- tmp, err = directive{{$arg.ImplDirectives|len}}(ctx)
- if err != nil {
- return nil, graphql.ErrorOnPath(ctx, err)
- }
- if data, ok := tmp.({{ $arg.TypeReference.GO | ref }}) ; ok {
- arg{{$i}} = data
- {{- if $arg.TypeReference.IsNilable }}
- } else if tmp == nil {
- arg{{$i}} = nil
- {{- end }}
- } else {
- return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be {{ $arg.TypeReference.GO }}`, tmp))
- }
- {{- else }}
- arg{{$i}}, err = ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp)
- if err != nil {
- return nil, err
- }
- {{- end }}
- }
- args[{{$arg.Name|quote}}] = arg{{$i}}
- {{- end }}
- return args, nil
-}
-{{ end }}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/complexity.go b/vendor/github.com/99designs/gqlgen/codegen/complexity.go
deleted file mode 100644
index e9c6a20ee8..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/complexity.go
+++ /dev/null
@@ -1,11 +0,0 @@
-package codegen
-
-func (o *Object) UniqueFields() map[string][]*Field {
- m := map[string][]*Field{}
-
- for _, f := range o.Fields {
- m[f.GoFieldName] = append(m[f.GoFieldName], f)
- }
-
- return m
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/config/binder.go b/vendor/github.com/99designs/gqlgen/codegen/config/binder.go
deleted file mode 100644
index bedc23bc61..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/config/binder.go
+++ /dev/null
@@ -1,493 +0,0 @@
-package config
-
-import (
- "errors"
- "fmt"
- "go/token"
- "go/types"
-
- "golang.org/x/tools/go/packages"
-
- "github.com/99designs/gqlgen/codegen/templates"
- "github.com/99designs/gqlgen/internal/code"
- "github.com/vektah/gqlparser/v2/ast"
-)
-
-var ErrTypeNotFound = errors.New("unable to find type")
-
-// Binder connects graphql types to golang types using static analysis
-type Binder struct {
- pkgs *code.Packages
- schema *ast.Schema
- cfg *Config
- References []*TypeReference
- SawInvalid bool
- objectCache map[string]map[string]types.Object
-}
-
-func (c *Config) NewBinder() *Binder {
- return &Binder{
- pkgs: c.Packages,
- schema: c.Schema,
- cfg: c,
- }
-}
-
-func (b *Binder) TypePosition(typ types.Type) token.Position {
- named, isNamed := typ.(*types.Named)
- if !isNamed {
- return token.Position{
- Filename: "unknown",
- }
- }
-
- return b.ObjectPosition(named.Obj())
-}
-
-func (b *Binder) ObjectPosition(typ types.Object) token.Position {
- if typ == nil {
- return token.Position{
- Filename: "unknown",
- }
- }
- pkg := b.pkgs.Load(typ.Pkg().Path())
- return pkg.Fset.Position(typ.Pos())
-}
-
-func (b *Binder) FindTypeFromName(name string) (types.Type, error) {
- pkgName, typeName := code.PkgAndType(name)
- return b.FindType(pkgName, typeName)
-}
-
-func (b *Binder) FindType(pkgName string, typeName string) (types.Type, error) {
- if pkgName == "" {
- if typeName == "map[string]interface{}" {
- return MapType, nil
- }
-
- if typeName == "interface{}" {
- return InterfaceType, nil
- }
- }
-
- obj, err := b.FindObject(pkgName, typeName)
- if err != nil {
- return nil, err
- }
-
- if fun, isFunc := obj.(*types.Func); isFunc {
- return fun.Type().(*types.Signature).Params().At(0).Type(), nil
- }
- return obj.Type(), nil
-}
-
-var (
- MapType = types.NewMap(types.Typ[types.String], types.NewInterfaceType(nil, nil).Complete())
- InterfaceType = types.NewInterfaceType(nil, nil)
-)
-
-func (b *Binder) DefaultUserObject(name string) (types.Type, error) {
- models := b.cfg.Models[name].Model
- if len(models) == 0 {
- return nil, fmt.Errorf(name + " not found in typemap")
- }
-
- if models[0] == "map[string]interface{}" {
- return MapType, nil
- }
-
- if models[0] == "interface{}" {
- return InterfaceType, nil
- }
-
- pkgName, typeName := code.PkgAndType(models[0])
- if pkgName == "" {
- return nil, fmt.Errorf("missing package name for %s", name)
- }
-
- obj, err := b.FindObject(pkgName, typeName)
- if err != nil {
- return nil, err
- }
-
- return obj.Type(), nil
-}
-
-func (b *Binder) FindObject(pkgName string, typeName string) (types.Object, error) {
- if pkgName == "" {
- return nil, fmt.Errorf("package cannot be nil")
- }
-
- pkg := b.pkgs.LoadWithTypes(pkgName)
- if pkg == nil {
- err := b.pkgs.Errors()
- if err != nil {
- return nil, fmt.Errorf("package could not be loaded: %s.%s: %w", pkgName, typeName, err)
- }
- return nil, fmt.Errorf("required package was not loaded: %s.%s", pkgName, typeName)
- }
-
- if b.objectCache == nil {
- b.objectCache = make(map[string]map[string]types.Object, b.pkgs.Count())
- }
-
- defsIndex, ok := b.objectCache[pkgName]
- if !ok {
- defsIndex = indexDefs(pkg)
- b.objectCache[pkgName] = defsIndex
- }
-
- // function based marshalers take precedence
- if val, ok := defsIndex["Marshal"+typeName]; ok {
- return val, nil
- }
-
- if val, ok := defsIndex[typeName]; ok {
- return val, nil
- }
-
- return nil, fmt.Errorf("%w: %s.%s", ErrTypeNotFound, pkgName, typeName)
-}
-
-func indexDefs(pkg *packages.Package) map[string]types.Object {
- res := make(map[string]types.Object)
-
- scope := pkg.Types.Scope()
- for astNode, def := range pkg.TypesInfo.Defs {
- // only look at defs in the top scope
- if def == nil {
- continue
- }
- parent := def.Parent()
- if parent == nil || parent != scope {
- continue
- }
-
- if _, ok := res[astNode.Name]; !ok {
- // The above check may not be really needed, it is only here to have a consistent behavior with
- // previous implementation of FindObject() function which only honored the first inclusion of a def.
- // If this is still needed, we can consider something like sync.Map.LoadOrStore() to avoid two lookups.
- res[astNode.Name] = def
- }
- }
-
- return res
-}
-
-func (b *Binder) PointerTo(ref *TypeReference) *TypeReference {
- newRef := *ref
- newRef.GO = types.NewPointer(ref.GO)
- b.References = append(b.References, &newRef)
- return &newRef
-}
-
-// TypeReference is used by args and field types. The Definition can refer to both input and output types.
-type TypeReference struct {
- Definition *ast.Definition
- GQL *ast.Type
- GO types.Type // Type of the field being bound. Could be a pointer or a value type of Target.
- Target types.Type // The actual type that we know how to bind to. May require pointer juggling when traversing to fields.
- CastType types.Type // Before calling marshalling functions cast from/to this base type
- Marshaler *types.Func // When using external marshalling functions this will point to the Marshal function
- Unmarshaler *types.Func // When using external marshalling functions this will point to the Unmarshal function
- IsMarshaler bool // Does the type implement graphql.Marshaler and graphql.Unmarshaler
- IsContext bool // Is the Marshaler/Unmarshaller the context version; applies to either the method or interface variety.
-}
-
-func (ref *TypeReference) Elem() *TypeReference {
- if p, isPtr := ref.GO.(*types.Pointer); isPtr {
- newRef := *ref
- newRef.GO = p.Elem()
- return &newRef
- }
-
- if ref.IsSlice() {
- newRef := *ref
- newRef.GO = ref.GO.(*types.Slice).Elem()
- newRef.GQL = ref.GQL.Elem
- return &newRef
- }
- return nil
-}
-
-func (t *TypeReference) IsPtr() bool {
- _, isPtr := t.GO.(*types.Pointer)
- return isPtr
-}
-
-// fix for https://github.com/golang/go/issues/31103 may make it possible to remove this (may still be useful)
-func (t *TypeReference) IsPtrToPtr() bool {
- if p, isPtr := t.GO.(*types.Pointer); isPtr {
- _, isPtr := p.Elem().(*types.Pointer)
- return isPtr
- }
- return false
-}
-
-func (t *TypeReference) IsNilable() bool {
- return IsNilable(t.GO)
-}
-
-func (t *TypeReference) IsSlice() bool {
- _, isSlice := t.GO.(*types.Slice)
- return t.GQL.Elem != nil && isSlice
-}
-
-func (t *TypeReference) IsPtrToSlice() bool {
- if t.IsPtr() {
- _, isPointerToSlice := t.GO.(*types.Pointer).Elem().(*types.Slice)
- return isPointerToSlice
- }
- return false
-}
-
-func (t *TypeReference) IsNamed() bool {
- _, isSlice := t.GO.(*types.Named)
- return isSlice
-}
-
-func (t *TypeReference) IsStruct() bool {
- _, isStruct := t.GO.Underlying().(*types.Struct)
- return isStruct
-}
-
-func (t *TypeReference) IsScalar() bool {
- return t.Definition.Kind == ast.Scalar
-}
-
-func (t *TypeReference) UniquenessKey() string {
- nullability := "O"
- if t.GQL.NonNull {
- nullability = "N"
- }
-
- elemNullability := ""
- if t.GQL.Elem != nil && t.GQL.Elem.NonNull {
- // Fix for #896
- elemNullability = "ᚄ"
- }
- return nullability + t.Definition.Name + "2" + templates.TypeIdentifier(t.GO) + elemNullability
-}
-
-func (t *TypeReference) MarshalFunc() string {
- if t.Definition == nil {
- panic(errors.New("Definition missing for " + t.GQL.Name()))
- }
-
- if t.Definition.Kind == ast.InputObject {
- return ""
- }
-
- return "marshal" + t.UniquenessKey()
-}
-
-func (t *TypeReference) UnmarshalFunc() string {
- if t.Definition == nil {
- panic(errors.New("Definition missing for " + t.GQL.Name()))
- }
-
- if !t.Definition.IsInputType() {
- return ""
- }
-
- return "unmarshal" + t.UniquenessKey()
-}
-
-func (t *TypeReference) IsTargetNilable() bool {
- return IsNilable(t.Target)
-}
-
-func (b *Binder) PushRef(ret *TypeReference) {
- b.References = append(b.References, ret)
-}
-
-func isMap(t types.Type) bool {
- if t == nil {
- return true
- }
- _, ok := t.(*types.Map)
- return ok
-}
-
-func isIntf(t types.Type) bool {
- if t == nil {
- return true
- }
- _, ok := t.(*types.Interface)
- return ok
-}
-
-func (b *Binder) TypeReference(schemaType *ast.Type, bindTarget types.Type) (ret *TypeReference, err error) {
- if !isValid(bindTarget) {
- b.SawInvalid = true
- return nil, fmt.Errorf("%s has an invalid type", schemaType.Name())
- }
-
- var pkgName, typeName string
- def := b.schema.Types[schemaType.Name()]
- defer func() {
- if err == nil && ret != nil {
- b.PushRef(ret)
- }
- }()
-
- if len(b.cfg.Models[schemaType.Name()].Model) == 0 {
- return nil, fmt.Errorf("%s was not found", schemaType.Name())
- }
-
- for _, model := range b.cfg.Models[schemaType.Name()].Model {
- if model == "map[string]interface{}" {
- if !isMap(bindTarget) {
- continue
- }
- return &TypeReference{
- Definition: def,
- GQL: schemaType,
- GO: MapType,
- }, nil
- }
-
- if model == "interface{}" {
- if !isIntf(bindTarget) {
- continue
- }
- return &TypeReference{
- Definition: def,
- GQL: schemaType,
- GO: InterfaceType,
- }, nil
- }
-
- pkgName, typeName = code.PkgAndType(model)
- if pkgName == "" {
- return nil, fmt.Errorf("missing package name for %s", schemaType.Name())
- }
-
- ref := &TypeReference{
- Definition: def,
- GQL: schemaType,
- }
-
- obj, err := b.FindObject(pkgName, typeName)
- if err != nil {
- return nil, err
- }
-
- if fun, isFunc := obj.(*types.Func); isFunc {
- ref.GO = fun.Type().(*types.Signature).Params().At(0).Type()
- ref.IsContext = fun.Type().(*types.Signature).Results().At(0).Type().String() == "github.com/99designs/gqlgen/graphql.ContextMarshaler"
- ref.Marshaler = fun
- ref.Unmarshaler = types.NewFunc(0, fun.Pkg(), "Unmarshal"+typeName, nil)
- } else if hasMethod(obj.Type(), "MarshalGQLContext") && hasMethod(obj.Type(), "UnmarshalGQLContext") {
- ref.GO = obj.Type()
- ref.IsContext = true
- ref.IsMarshaler = true
- } else if hasMethod(obj.Type(), "MarshalGQL") && hasMethod(obj.Type(), "UnmarshalGQL") {
- ref.GO = obj.Type()
- ref.IsMarshaler = true
- } else if underlying := basicUnderlying(obj.Type()); def.IsLeafType() && underlying != nil && underlying.Kind() == types.String {
- // TODO delete before v1. Backwards compatibility case for named types wrapping strings (see #595)
-
- ref.GO = obj.Type()
- ref.CastType = underlying
-
- underlyingRef, err := b.TypeReference(&ast.Type{NamedType: "String"}, nil)
- if err != nil {
- return nil, err
- }
-
- ref.Marshaler = underlyingRef.Marshaler
- ref.Unmarshaler = underlyingRef.Unmarshaler
- } else {
- ref.GO = obj.Type()
- }
-
- ref.Target = ref.GO
- ref.GO = b.CopyModifiersFromAst(schemaType, ref.GO)
-
- if bindTarget != nil {
- if err = code.CompatibleTypes(ref.GO, bindTarget); err != nil {
- continue
- }
- ref.GO = bindTarget
- }
-
- return ref, nil
- }
-
- return nil, fmt.Errorf("%s is incompatible with %s", schemaType.Name(), bindTarget.String())
-}
-
-func isValid(t types.Type) bool {
- basic, isBasic := t.(*types.Basic)
- if !isBasic {
- return true
- }
- return basic.Kind() != types.Invalid
-}
-
-func (b *Binder) CopyModifiersFromAst(t *ast.Type, base types.Type) types.Type {
- if t.Elem != nil {
- child := b.CopyModifiersFromAst(t.Elem, base)
- if _, isStruct := child.Underlying().(*types.Struct); isStruct && !b.cfg.OmitSliceElementPointers {
- child = types.NewPointer(child)
- }
- return types.NewSlice(child)
- }
-
- var isInterface bool
- if named, ok := base.(*types.Named); ok {
- _, isInterface = named.Underlying().(*types.Interface)
- }
-
- if !isInterface && !IsNilable(base) && !t.NonNull {
- return types.NewPointer(base)
- }
-
- return base
-}
-
-func IsNilable(t types.Type) bool {
- if namedType, isNamed := t.(*types.Named); isNamed {
- return IsNilable(namedType.Underlying())
- }
- _, isPtr := t.(*types.Pointer)
- _, isMap := t.(*types.Map)
- _, isInterface := t.(*types.Interface)
- _, isSlice := t.(*types.Slice)
- _, isChan := t.(*types.Chan)
- return isPtr || isMap || isInterface || isSlice || isChan
-}
-
-func hasMethod(it types.Type, name string) bool {
- if ptr, isPtr := it.(*types.Pointer); isPtr {
- it = ptr.Elem()
- }
- namedType, ok := it.(*types.Named)
- if !ok {
- return false
- }
-
- for i := 0; i < namedType.NumMethods(); i++ {
- if namedType.Method(i).Name() == name {
- return true
- }
- }
- return false
-}
-
-func basicUnderlying(it types.Type) *types.Basic {
- if ptr, isPtr := it.(*types.Pointer); isPtr {
- it = ptr.Elem()
- }
- namedType, ok := it.(*types.Named)
- if !ok {
- return nil
- }
-
- if basic, ok := namedType.Underlying().(*types.Basic); ok {
- return basic
- }
-
- return nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/config/config.go b/vendor/github.com/99designs/gqlgen/codegen/config/config.go
deleted file mode 100644
index c6de8625f0..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/config/config.go
+++ /dev/null
@@ -1,656 +0,0 @@
-package config
-
-import (
- "bytes"
- "fmt"
- "os"
- "path/filepath"
- "regexp"
- "sort"
- "strings"
-
- "github.com/99designs/gqlgen/internal/code"
- "github.com/vektah/gqlparser/v2"
- "github.com/vektah/gqlparser/v2/ast"
- "gopkg.in/yaml.v3"
-)
-
-type Config struct {
- SchemaFilename StringList `yaml:"schema,omitempty"`
- Exec ExecConfig `yaml:"exec"`
- Model PackageConfig `yaml:"model,omitempty"`
- Federation PackageConfig `yaml:"federation,omitempty"`
- Resolver ResolverConfig `yaml:"resolver,omitempty"`
- AutoBind []string `yaml:"autobind"`
- Models TypeMap `yaml:"models,omitempty"`
- StructTag string `yaml:"struct_tag,omitempty"`
- Directives map[string]DirectiveConfig `yaml:"directives,omitempty"`
- OmitSliceElementPointers bool `yaml:"omit_slice_element_pointers,omitempty"`
- OmitGetters bool `yaml:"omit_getters,omitempty"`
- StructFieldsAlwaysPointers bool `yaml:"struct_fields_always_pointers,omitempty"`
- ResolversAlwaysReturnPointers bool `yaml:"resolvers_always_return_pointers,omitempty"`
- SkipValidation bool `yaml:"skip_validation,omitempty"`
- SkipModTidy bool `yaml:"skip_mod_tidy,omitempty"`
- Sources []*ast.Source `yaml:"-"`
- Packages *code.Packages `yaml:"-"`
- Schema *ast.Schema `yaml:"-"`
-
- // Deprecated: use Federation instead. Will be removed next release
- Federated bool `yaml:"federated,omitempty"`
-}
-
-var cfgFilenames = []string{".gqlgen.yml", "gqlgen.yml", "gqlgen.yaml"}
-
-// DefaultConfig creates a copy of the default config
-func DefaultConfig() *Config {
- return &Config{
- SchemaFilename: StringList{"schema.graphql"},
- Model: PackageConfig{Filename: "models_gen.go"},
- Exec: ExecConfig{Filename: "generated.go"},
- Directives: map[string]DirectiveConfig{},
- Models: TypeMap{},
- StructFieldsAlwaysPointers: true,
- ResolversAlwaysReturnPointers: true,
- }
-}
-
-// LoadDefaultConfig loads the default config so that it is ready to be used
-func LoadDefaultConfig() (*Config, error) {
- config := DefaultConfig()
-
- for _, filename := range config.SchemaFilename {
- filename = filepath.ToSlash(filename)
- var err error
- var schemaRaw []byte
- schemaRaw, err = os.ReadFile(filename)
- if err != nil {
- return nil, fmt.Errorf("unable to open schema: %w", err)
- }
-
- config.Sources = append(config.Sources, &ast.Source{Name: filename, Input: string(schemaRaw)})
- }
-
- return config, nil
-}
-
-// LoadConfigFromDefaultLocations looks for a config file in the current directory, and all parent directories
-// walking up the tree. The closest config file will be returned.
-func LoadConfigFromDefaultLocations() (*Config, error) {
- cfgFile, err := findCfg()
- if err != nil {
- return nil, err
- }
-
- err = os.Chdir(filepath.Dir(cfgFile))
- if err != nil {
- return nil, fmt.Errorf("unable to enter config dir: %w", err)
- }
- return LoadConfig(cfgFile)
-}
-
-var path2regex = strings.NewReplacer(
- `.`, `\.`,
- `*`, `.+`,
- `\`, `[\\/]`,
- `/`, `[\\/]`,
-)
-
-// LoadConfig reads the gqlgen.yml config file
-func LoadConfig(filename string) (*Config, error) {
- config := DefaultConfig()
-
- b, err := os.ReadFile(filename)
- if err != nil {
- return nil, fmt.Errorf("unable to read config: %w", err)
- }
-
- dec := yaml.NewDecoder(bytes.NewReader(b))
- dec.KnownFields(true)
-
- if err := dec.Decode(config); err != nil {
- return nil, fmt.Errorf("unable to parse config: %w", err)
- }
-
- if err := CompleteConfig(config); err != nil {
- return nil, err
- }
-
- return config, nil
-}
-
-// CompleteConfig fills in the schema and other values to a config loaded from
-// YAML.
-func CompleteConfig(config *Config) error {
- defaultDirectives := map[string]DirectiveConfig{
- "skip": {SkipRuntime: true},
- "include": {SkipRuntime: true},
- "deprecated": {SkipRuntime: true},
- "specifiedBy": {SkipRuntime: true},
- }
-
- for key, value := range defaultDirectives {
- if _, defined := config.Directives[key]; !defined {
- config.Directives[key] = value
- }
- }
-
- preGlobbing := config.SchemaFilename
- config.SchemaFilename = StringList{}
- for _, f := range preGlobbing {
- var matches []string
-
- // for ** we want to override default globbing patterns and walk all
- // subdirectories to match schema files.
- if strings.Contains(f, "**") {
- pathParts := strings.SplitN(f, "**", 2)
- rest := strings.TrimPrefix(strings.TrimPrefix(pathParts[1], `\`), `/`)
- // turn the rest of the glob into a regex, anchored only at the end because ** allows
- // for any number of dirs in between and walk will let us match against the full path name
- globRe := regexp.MustCompile(path2regex.Replace(rest) + `$`)
-
- if err := filepath.Walk(pathParts[0], func(path string, info os.FileInfo, err error) error {
- if err != nil {
- return err
- }
-
- if globRe.MatchString(strings.TrimPrefix(path, pathParts[0])) {
- matches = append(matches, path)
- }
-
- return nil
- }); err != nil {
- return fmt.Errorf("failed to walk schema at root %s: %w", pathParts[0], err)
- }
- } else {
- var err error
- matches, err = filepath.Glob(f)
- if err != nil {
- return fmt.Errorf("failed to glob schema filename %s: %w", f, err)
- }
- }
-
- for _, m := range matches {
- if config.SchemaFilename.Has(m) {
- continue
- }
- config.SchemaFilename = append(config.SchemaFilename, m)
- }
- }
-
- for _, filename := range config.SchemaFilename {
- filename = filepath.ToSlash(filename)
- var err error
- var schemaRaw []byte
- schemaRaw, err = os.ReadFile(filename)
- if err != nil {
- return fmt.Errorf("unable to open schema: %w", err)
- }
-
- config.Sources = append(config.Sources, &ast.Source{Name: filename, Input: string(schemaRaw)})
- }
- return nil
-}
-
-func (c *Config) Init() error {
- if c.Packages == nil {
- c.Packages = &code.Packages{}
- }
-
- if c.Schema == nil {
- if err := c.LoadSchema(); err != nil {
- return err
- }
- }
-
- err := c.injectTypesFromSchema()
- if err != nil {
- return err
- }
-
- err = c.autobind()
- if err != nil {
- return err
- }
-
- c.injectBuiltins()
- // prefetch all packages in one big packages.Load call
- c.Packages.LoadAll(c.packageList()...)
-
- // check everything is valid on the way out
- err = c.check()
- if err != nil {
- return err
- }
-
- return nil
-}
-
-func (c *Config) packageList() []string {
- pkgs := []string{
- "github.com/99designs/gqlgen/graphql",
- "github.com/99designs/gqlgen/graphql/introspection",
- }
- pkgs = append(pkgs, c.Models.ReferencedPackages()...)
- pkgs = append(pkgs, c.AutoBind...)
- return pkgs
-}
-
-func (c *Config) ReloadAllPackages() {
- c.Packages.ReloadAll(c.packageList()...)
-}
-
-func (c *Config) injectTypesFromSchema() error {
- c.Directives["goModel"] = DirectiveConfig{
- SkipRuntime: true,
- }
-
- c.Directives["goField"] = DirectiveConfig{
- SkipRuntime: true,
- }
-
- c.Directives["goTag"] = DirectiveConfig{
- SkipRuntime: true,
- }
-
- for _, schemaType := range c.Schema.Types {
- if schemaType == c.Schema.Query || schemaType == c.Schema.Mutation || schemaType == c.Schema.Subscription {
- continue
- }
-
- if bd := schemaType.Directives.ForName("goModel"); bd != nil {
- if ma := bd.Arguments.ForName("model"); ma != nil {
- if mv, err := ma.Value.Value(nil); err == nil {
- c.Models.Add(schemaType.Name, mv.(string))
- }
- }
- if ma := bd.Arguments.ForName("models"); ma != nil {
- if mvs, err := ma.Value.Value(nil); err == nil {
- for _, mv := range mvs.([]interface{}) {
- c.Models.Add(schemaType.Name, mv.(string))
- }
- }
- }
- }
-
- if schemaType.Kind == ast.Object || schemaType.Kind == ast.InputObject {
- for _, field := range schemaType.Fields {
- if fd := field.Directives.ForName("goField"); fd != nil {
- forceResolver := c.Models[schemaType.Name].Fields[field.Name].Resolver
- fieldName := c.Models[schemaType.Name].Fields[field.Name].FieldName
-
- if ra := fd.Arguments.ForName("forceResolver"); ra != nil {
- if fr, err := ra.Value.Value(nil); err == nil {
- forceResolver = fr.(bool)
- }
- }
-
- if na := fd.Arguments.ForName("name"); na != nil {
- if fr, err := na.Value.Value(nil); err == nil {
- fieldName = fr.(string)
- }
- }
-
- if c.Models[schemaType.Name].Fields == nil {
- c.Models[schemaType.Name] = TypeMapEntry{
- Model: c.Models[schemaType.Name].Model,
- Fields: map[string]TypeMapField{},
- }
- }
-
- c.Models[schemaType.Name].Fields[field.Name] = TypeMapField{
- FieldName: fieldName,
- Resolver: forceResolver,
- }
- }
- }
- }
- }
-
- return nil
-}
-
-type TypeMapEntry struct {
- Model StringList `yaml:"model"`
- Fields map[string]TypeMapField `yaml:"fields,omitempty"`
-}
-
-type TypeMapField struct {
- Resolver bool `yaml:"resolver"`
- FieldName string `yaml:"fieldName"`
- GeneratedMethod string `yaml:"-"`
-}
-
-type StringList []string
-
-func (a *StringList) UnmarshalYAML(unmarshal func(interface{}) error) error {
- var single string
- err := unmarshal(&single)
- if err == nil {
- *a = []string{single}
- return nil
- }
-
- var multi []string
- err = unmarshal(&multi)
- if err != nil {
- return err
- }
-
- *a = multi
- return nil
-}
-
-func (a StringList) Has(file string) bool {
- for _, existing := range a {
- if existing == file {
- return true
- }
- }
- return false
-}
-
-func (c *Config) check() error {
- if c.Models == nil {
- c.Models = TypeMap{}
- }
-
- type FilenamePackage struct {
- Filename string
- Package string
- Declaree string
- }
-
- fileList := map[string][]FilenamePackage{}
-
- if err := c.Models.Check(); err != nil {
- return fmt.Errorf("config.models: %w", err)
- }
- if err := c.Exec.Check(); err != nil {
- return fmt.Errorf("config.exec: %w", err)
- }
- fileList[c.Exec.ImportPath()] = append(fileList[c.Exec.ImportPath()], FilenamePackage{
- Filename: c.Exec.Filename,
- Package: c.Exec.Package,
- Declaree: "exec",
- })
-
- if c.Model.IsDefined() {
- if err := c.Model.Check(); err != nil {
- return fmt.Errorf("config.model: %w", err)
- }
- fileList[c.Model.ImportPath()] = append(fileList[c.Model.ImportPath()], FilenamePackage{
- Filename: c.Model.Filename,
- Package: c.Model.Package,
- Declaree: "model",
- })
- }
- if c.Resolver.IsDefined() {
- if err := c.Resolver.Check(); err != nil {
- return fmt.Errorf("config.resolver: %w", err)
- }
- fileList[c.Resolver.ImportPath()] = append(fileList[c.Resolver.ImportPath()], FilenamePackage{
- Filename: c.Resolver.Filename,
- Package: c.Resolver.Package,
- Declaree: "resolver",
- })
- }
- if c.Federation.IsDefined() {
- if err := c.Federation.Check(); err != nil {
- return fmt.Errorf("config.federation: %w", err)
- }
- fileList[c.Federation.ImportPath()] = append(fileList[c.Federation.ImportPath()], FilenamePackage{
- Filename: c.Federation.Filename,
- Package: c.Federation.Package,
- Declaree: "federation",
- })
- if c.Federation.ImportPath() != c.Exec.ImportPath() {
- return fmt.Errorf("federation and exec must be in the same package")
- }
- }
- if c.Federated {
- return fmt.Errorf("federated has been removed, instead use\nfederation:\n filename: path/to/federated.go")
- }
-
- for importPath, pkg := range fileList {
- for _, file1 := range pkg {
- for _, file2 := range pkg {
- if file1.Package != file2.Package {
- return fmt.Errorf("%s and %s define the same import path (%s) with different package names (%s vs %s)",
- file1.Declaree,
- file2.Declaree,
- importPath,
- file1.Package,
- file2.Package,
- )
- }
- }
- }
- }
-
- return nil
-}
-
-type TypeMap map[string]TypeMapEntry
-
-func (tm TypeMap) Exists(typeName string) bool {
- _, ok := tm[typeName]
- return ok
-}
-
-func (tm TypeMap) UserDefined(typeName string) bool {
- m, ok := tm[typeName]
- return ok && len(m.Model) > 0
-}
-
-func (tm TypeMap) Check() error {
- for typeName, entry := range tm {
- for _, model := range entry.Model {
- if strings.LastIndex(model, ".") < strings.LastIndex(model, "/") {
- return fmt.Errorf("model %s: invalid type specifier \"%s\" - you need to specify a struct to map to", typeName, entry.Model)
- }
- }
- }
- return nil
-}
-
-func (tm TypeMap) ReferencedPackages() []string {
- var pkgs []string
-
- for _, typ := range tm {
- for _, model := range typ.Model {
- if model == "map[string]interface{}" || model == "interface{}" {
- continue
- }
- pkg, _ := code.PkgAndType(model)
- if pkg == "" || inStrSlice(pkgs, pkg) {
- continue
- }
- pkgs = append(pkgs, code.QualifyPackagePath(pkg))
- }
- }
-
- sort.Slice(pkgs, func(i, j int) bool {
- return pkgs[i] > pkgs[j]
- })
- return pkgs
-}
-
-func (tm TypeMap) Add(name string, goType string) {
- modelCfg := tm[name]
- modelCfg.Model = append(modelCfg.Model, goType)
- tm[name] = modelCfg
-}
-
-type DirectiveConfig struct {
- SkipRuntime bool `yaml:"skip_runtime"`
-}
-
-func inStrSlice(haystack []string, needle string) bool {
- for _, v := range haystack {
- if needle == v {
- return true
- }
- }
-
- return false
-}
-
-// findCfg searches for the config file in this directory and all parents up the tree
-// looking for the closest match
-func findCfg() (string, error) {
- dir, err := os.Getwd()
- if err != nil {
- return "", fmt.Errorf("unable to get working dir to findCfg: %w", err)
- }
-
- cfg := findCfgInDir(dir)
-
- for cfg == "" && dir != filepath.Dir(dir) {
- dir = filepath.Dir(dir)
- cfg = findCfgInDir(dir)
- }
-
- if cfg == "" {
- return "", os.ErrNotExist
- }
-
- return cfg, nil
-}
-
-func findCfgInDir(dir string) string {
- for _, cfgName := range cfgFilenames {
- path := filepath.Join(dir, cfgName)
- if _, err := os.Stat(path); err == nil {
- return path
- }
- }
- return ""
-}
-
-func (c *Config) autobind() error {
- if len(c.AutoBind) == 0 {
- return nil
- }
-
- ps := c.Packages.LoadAll(c.AutoBind...)
-
- for _, t := range c.Schema.Types {
- if c.Models.UserDefined(t.Name) {
- continue
- }
-
- for i, p := range ps {
- if p == nil || p.Module == nil {
- return fmt.Errorf("unable to load %s - make sure you're using an import path to a package that exists", c.AutoBind[i])
- }
- if t := p.Types.Scope().Lookup(t.Name); t != nil {
- c.Models.Add(t.Name(), t.Pkg().Path()+"."+t.Name())
- break
- }
- }
- }
-
- for i, t := range c.Models {
- for j, m := range t.Model {
- pkg, typename := code.PkgAndType(m)
-
- // skip anything that looks like an import path
- if strings.Contains(pkg, "/") {
- continue
- }
-
- for _, p := range ps {
- if p.Name != pkg {
- continue
- }
- if t := p.Types.Scope().Lookup(typename); t != nil {
- c.Models[i].Model[j] = t.Pkg().Path() + "." + t.Name()
- break
- }
- }
- }
- }
-
- return nil
-}
-
-func (c *Config) injectBuiltins() {
- builtins := TypeMap{
- "__Directive": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.Directive"}},
- "__DirectiveLocation": {Model: StringList{"github.com/99designs/gqlgen/graphql.String"}},
- "__Type": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.Type"}},
- "__TypeKind": {Model: StringList{"github.com/99designs/gqlgen/graphql.String"}},
- "__Field": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.Field"}},
- "__EnumValue": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.EnumValue"}},
- "__InputValue": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.InputValue"}},
- "__Schema": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.Schema"}},
- "Float": {Model: StringList{"github.com/99designs/gqlgen/graphql.FloatContext"}},
- "String": {Model: StringList{"github.com/99designs/gqlgen/graphql.String"}},
- "Boolean": {Model: StringList{"github.com/99designs/gqlgen/graphql.Boolean"}},
- "Int": {Model: StringList{
- "github.com/99designs/gqlgen/graphql.Int",
- "github.com/99designs/gqlgen/graphql.Int32",
- "github.com/99designs/gqlgen/graphql.Int64",
- }},
- "ID": {
- Model: StringList{
- "github.com/99designs/gqlgen/graphql.ID",
- "github.com/99designs/gqlgen/graphql.IntID",
- },
- },
- }
-
- for typeName, entry := range builtins {
- if !c.Models.Exists(typeName) {
- c.Models[typeName] = entry
- }
- }
-
- // These are additional types that are injected if defined in the schema as scalars.
- extraBuiltins := TypeMap{
- "Time": {Model: StringList{"github.com/99designs/gqlgen/graphql.Time"}},
- "Map": {Model: StringList{"github.com/99designs/gqlgen/graphql.Map"}},
- "Upload": {Model: StringList{"github.com/99designs/gqlgen/graphql.Upload"}},
- "Any": {Model: StringList{"github.com/99designs/gqlgen/graphql.Any"}},
- }
-
- for typeName, entry := range extraBuiltins {
- if t, ok := c.Schema.Types[typeName]; !c.Models.Exists(typeName) && ok && t.Kind == ast.Scalar {
- c.Models[typeName] = entry
- }
- }
-}
-
-func (c *Config) LoadSchema() error {
- if c.Packages != nil {
- c.Packages = &code.Packages{}
- }
-
- if err := c.check(); err != nil {
- return err
- }
-
- schema, err := gqlparser.LoadSchema(c.Sources...)
- if err != nil {
- return err
- }
-
- if schema.Query == nil {
- schema.Query = &ast.Definition{
- Kind: ast.Object,
- Name: "Query",
- }
- schema.Types["Query"] = schema.Query
- }
-
- c.Schema = schema
- return nil
-}
-
-func abs(path string) string {
- absPath, err := filepath.Abs(path)
- if err != nil {
- panic(err)
- }
- return filepath.ToSlash(absPath)
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/config/exec.go b/vendor/github.com/99designs/gqlgen/codegen/config/exec.go
deleted file mode 100644
index fe1dccd21d..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/config/exec.go
+++ /dev/null
@@ -1,97 +0,0 @@
-package config
-
-import (
- "fmt"
- "go/types"
- "path/filepath"
- "strings"
-
- "github.com/99designs/gqlgen/internal/code"
-)
-
-type ExecConfig struct {
- Package string `yaml:"package,omitempty"`
- Layout ExecLayout `yaml:"layout,omitempty"` // Default: single-file
-
- // Only for single-file layout:
- Filename string `yaml:"filename,omitempty"`
-
- // Only for follow-schema layout:
- FilenameTemplate string `yaml:"filename_template,omitempty"` // String template with {name} as placeholder for base name.
- DirName string `yaml:"dir"`
-}
-
-type ExecLayout string
-
-var (
- // Write all generated code to a single file.
- ExecLayoutSingleFile ExecLayout = "single-file"
- // Write generated code to a directory, generating one Go source file for each GraphQL schema file.
- ExecLayoutFollowSchema ExecLayout = "follow-schema"
-)
-
-func (r *ExecConfig) Check() error {
- if r.Layout == "" {
- r.Layout = ExecLayoutSingleFile
- }
-
- switch r.Layout {
- case ExecLayoutSingleFile:
- if r.Filename == "" {
- return fmt.Errorf("filename must be specified when using single-file layout")
- }
- if !strings.HasSuffix(r.Filename, ".go") {
- return fmt.Errorf("filename should be path to a go source file when using single-file layout")
- }
- r.Filename = abs(r.Filename)
- case ExecLayoutFollowSchema:
- if r.DirName == "" {
- return fmt.Errorf("dir must be specified when using follow-schema layout")
- }
- r.DirName = abs(r.DirName)
- default:
- return fmt.Errorf("invalid layout %s", r.Layout)
- }
-
- if strings.ContainsAny(r.Package, "./\\") {
- return fmt.Errorf("package should be the output package name only, do not include the output filename")
- }
-
- if r.Package == "" && r.Dir() != "" {
- r.Package = code.NameForDir(r.Dir())
- }
-
- return nil
-}
-
-func (r *ExecConfig) ImportPath() string {
- if r.Dir() == "" {
- return ""
- }
- return code.ImportPathForDir(r.Dir())
-}
-
-func (r *ExecConfig) Dir() string {
- switch r.Layout {
- case ExecLayoutSingleFile:
- if r.Filename == "" {
- return ""
- }
- return filepath.Dir(r.Filename)
- case ExecLayoutFollowSchema:
- return abs(r.DirName)
- default:
- panic("invalid layout " + r.Layout)
- }
-}
-
-func (r *ExecConfig) Pkg() *types.Package {
- if r.Dir() == "" {
- return nil
- }
- return types.NewPackage(r.ImportPath(), r.Package)
-}
-
-func (r *ExecConfig) IsDefined() bool {
- return r.Filename != "" || r.DirName != ""
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/config/package.go b/vendor/github.com/99designs/gqlgen/codegen/config/package.go
deleted file mode 100644
index faacd1496f..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/config/package.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package config
-
-import (
- "fmt"
- "go/types"
- "path/filepath"
- "strings"
-
- "github.com/99designs/gqlgen/internal/code"
-)
-
-type PackageConfig struct {
- Filename string `yaml:"filename,omitempty"`
- Package string `yaml:"package,omitempty"`
- Version int `yaml:"version,omitempty"`
-}
-
-func (c *PackageConfig) ImportPath() string {
- if !c.IsDefined() {
- return ""
- }
- return code.ImportPathForDir(c.Dir())
-}
-
-func (c *PackageConfig) Dir() string {
- if !c.IsDefined() {
- return ""
- }
- return filepath.Dir(c.Filename)
-}
-
-func (c *PackageConfig) Pkg() *types.Package {
- if !c.IsDefined() {
- return nil
- }
- return types.NewPackage(c.ImportPath(), c.Package)
-}
-
-func (c *PackageConfig) IsDefined() bool {
- return c.Filename != ""
-}
-
-func (c *PackageConfig) Check() error {
- if strings.ContainsAny(c.Package, "./\\") {
- return fmt.Errorf("package should be the output package name only, do not include the output filename")
- }
- if c.Filename == "" {
- return fmt.Errorf("filename must be specified")
- }
- if !strings.HasSuffix(c.Filename, ".go") {
- return fmt.Errorf("filename should be path to a go source file")
- }
-
- c.Filename = abs(c.Filename)
-
- // If Package is not set, first attempt to load the package at the output dir. If that fails
- // fallback to just the base dir name of the output filename.
- if c.Package == "" {
- c.Package = code.NameForDir(c.Dir())
- }
-
- return nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/config/resolver.go b/vendor/github.com/99designs/gqlgen/codegen/config/resolver.go
deleted file mode 100644
index cd03f18872..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/config/resolver.go
+++ /dev/null
@@ -1,100 +0,0 @@
-package config
-
-import (
- "fmt"
- "go/types"
- "path/filepath"
- "strings"
-
- "github.com/99designs/gqlgen/internal/code"
-)
-
-type ResolverConfig struct {
- Filename string `yaml:"filename,omitempty"`
- FilenameTemplate string `yaml:"filename_template,omitempty"`
- Package string `yaml:"package,omitempty"`
- Type string `yaml:"type,omitempty"`
- Layout ResolverLayout `yaml:"layout,omitempty"`
- DirName string `yaml:"dir"`
-}
-
-type ResolverLayout string
-
-var (
- LayoutSingleFile ResolverLayout = "single-file"
- LayoutFollowSchema ResolverLayout = "follow-schema"
-)
-
-func (r *ResolverConfig) Check() error {
- if r.Layout == "" {
- r.Layout = LayoutSingleFile
- }
- if r.Type == "" {
- r.Type = "Resolver"
- }
-
- switch r.Layout {
- case LayoutSingleFile:
- if r.Filename == "" {
- return fmt.Errorf("filename must be specified with layout=%s", r.Layout)
- }
- if !strings.HasSuffix(r.Filename, ".go") {
- return fmt.Errorf("filename should be path to a go source file with layout=%s", r.Layout)
- }
- r.Filename = abs(r.Filename)
- case LayoutFollowSchema:
- if r.DirName == "" {
- return fmt.Errorf("dirname must be specified with layout=%s", r.Layout)
- }
- r.DirName = abs(r.DirName)
- if r.Filename == "" {
- r.Filename = filepath.Join(r.DirName, "resolver.go")
- } else {
- r.Filename = abs(r.Filename)
- }
- default:
- return fmt.Errorf("invalid layout %s. must be %s or %s", r.Layout, LayoutSingleFile, LayoutFollowSchema)
- }
-
- if strings.ContainsAny(r.Package, "./\\") {
- return fmt.Errorf("package should be the output package name only, do not include the output filename")
- }
-
- if r.Package == "" && r.Dir() != "" {
- r.Package = code.NameForDir(r.Dir())
- }
-
- return nil
-}
-
-func (r *ResolverConfig) ImportPath() string {
- if r.Dir() == "" {
- return ""
- }
- return code.ImportPathForDir(r.Dir())
-}
-
-func (r *ResolverConfig) Dir() string {
- switch r.Layout {
- case LayoutSingleFile:
- if r.Filename == "" {
- return ""
- }
- return filepath.Dir(r.Filename)
- case LayoutFollowSchema:
- return r.DirName
- default:
- panic("invalid layout " + r.Layout)
- }
-}
-
-func (r *ResolverConfig) Pkg() *types.Package {
- if r.Dir() == "" {
- return nil
- }
- return types.NewPackage(r.ImportPath(), r.Package)
-}
-
-func (r *ResolverConfig) IsDefined() bool {
- return r.Filename != "" || r.DirName != ""
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/data.go b/vendor/github.com/99designs/gqlgen/codegen/data.go
deleted file mode 100644
index 592140ae6c..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/data.go
+++ /dev/null
@@ -1,233 +0,0 @@
-package codegen
-
-import (
- "fmt"
- "os"
- "path/filepath"
- "sort"
- "strings"
-
- "github.com/vektah/gqlparser/v2/ast"
-
- "github.com/99designs/gqlgen/codegen/config"
-)
-
-// Data is a unified model of the code to be generated. Plugins may modify this structure to do things like implement
-// resolvers or directives automatically (eg grpc, validation)
-type Data struct {
- Config *config.Config
- Schema *ast.Schema
- // If a schema is broken up into multiple Data instance, each representing part of the schema,
- // AllDirectives should contain the directives for the entire schema. Directives() can
- // then be used to get the directives that were defined in this Data instance's sources.
- // If a single Data instance is used for the entire schema, AllDirectives and Directives()
- // will be identical.
- // AllDirectives should rarely be used directly.
- AllDirectives DirectiveList
- Objects Objects
- Inputs Objects
- Interfaces map[string]*Interface
- ReferencedTypes map[string]*config.TypeReference
- ComplexityRoots map[string]*Object
-
- QueryRoot *Object
- MutationRoot *Object
- SubscriptionRoot *Object
- AugmentedSources []AugmentedSource
-}
-
-func (d *Data) HasEmbeddableSources() bool {
- hasEmbeddableSources := false
- for _, s := range d.AugmentedSources {
- if s.Embeddable {
- hasEmbeddableSources = true
- }
- }
- return hasEmbeddableSources
-}
-
-// AugmentedSource contains extra information about graphql schema files which is not known directly from the Config.Sources data
-type AugmentedSource struct {
- // path relative to Config.Exec.Filename
- RelativePath string
- Embeddable bool
- BuiltIn bool
- Source string
-}
-
-type builder struct {
- Config *config.Config
- Schema *ast.Schema
- Binder *config.Binder
- Directives map[string]*Directive
-}
-
-// Get only the directives which are defined in the config's sources.
-func (d *Data) Directives() DirectiveList {
- res := DirectiveList{}
- for k, directive := range d.AllDirectives {
- for _, s := range d.Config.Sources {
- if directive.Position.Src.Name == s.Name {
- res[k] = directive
- break
- }
- }
- }
- return res
-}
-
-func BuildData(cfg *config.Config) (*Data, error) {
- // We reload all packages to allow packages to be compared correctly.
- cfg.ReloadAllPackages()
-
- b := builder{
- Config: cfg,
- Schema: cfg.Schema,
- }
-
- b.Binder = b.Config.NewBinder()
-
- var err error
- b.Directives, err = b.buildDirectives()
- if err != nil {
- return nil, err
- }
-
- dataDirectives := make(map[string]*Directive)
- for name, d := range b.Directives {
- if !d.Builtin {
- dataDirectives[name] = d
- }
- }
-
- s := Data{
- Config: cfg,
- AllDirectives: dataDirectives,
- Schema: b.Schema,
- Interfaces: map[string]*Interface{},
- }
-
- for _, schemaType := range b.Schema.Types {
- switch schemaType.Kind {
- case ast.Object:
- obj, err := b.buildObject(schemaType)
- if err != nil {
- return nil, fmt.Errorf("unable to build object definition: %w", err)
- }
-
- s.Objects = append(s.Objects, obj)
- case ast.InputObject:
- input, err := b.buildObject(schemaType)
- if err != nil {
- return nil, fmt.Errorf("unable to build input definition: %w", err)
- }
-
- s.Inputs = append(s.Inputs, input)
-
- case ast.Union, ast.Interface:
- s.Interfaces[schemaType.Name], err = b.buildInterface(schemaType)
- if err != nil {
- return nil, fmt.Errorf("unable to bind to interface: %w", err)
- }
- }
- }
-
- if s.Schema.Query != nil {
- s.QueryRoot = s.Objects.ByName(s.Schema.Query.Name)
- } else {
- return nil, fmt.Errorf("query entry point missing")
- }
-
- if s.Schema.Mutation != nil {
- s.MutationRoot = s.Objects.ByName(s.Schema.Mutation.Name)
- }
-
- if s.Schema.Subscription != nil {
- s.SubscriptionRoot = s.Objects.ByName(s.Schema.Subscription.Name)
- }
-
- if err := b.injectIntrospectionRoots(&s); err != nil {
- return nil, err
- }
-
- s.ReferencedTypes = b.buildTypes()
-
- sort.Slice(s.Objects, func(i, j int) bool {
- return s.Objects[i].Definition.Name < s.Objects[j].Definition.Name
- })
-
- sort.Slice(s.Inputs, func(i, j int) bool {
- return s.Inputs[i].Definition.Name < s.Inputs[j].Definition.Name
- })
-
- if b.Binder.SawInvalid {
- // if we have a syntax error, show it
- err := cfg.Packages.Errors()
- if len(err) > 0 {
- return nil, err
- }
-
- // otherwise show a generic error message
- return nil, fmt.Errorf("invalid types were encountered while traversing the go source code, this probably means the invalid code generated isnt correct. add try adding -v to debug")
- }
- aSources := []AugmentedSource{}
- for _, s := range cfg.Sources {
- wd, err := os.Getwd()
- if err != nil {
- return nil, fmt.Errorf("failed to get working directory: %w", err)
- }
- outputDir := cfg.Exec.Dir()
- sourcePath := filepath.Join(wd, s.Name)
- relative, err := filepath.Rel(outputDir, sourcePath)
- if err != nil {
- return nil, fmt.Errorf("failed to compute path of %s relative to %s: %w", sourcePath, outputDir, err)
- }
- relative = filepath.ToSlash(relative)
- embeddable := true
- if strings.HasPrefix(relative, "..") || s.BuiltIn {
- embeddable = false
- }
- aSources = append(aSources, AugmentedSource{
- RelativePath: relative,
- Embeddable: embeddable,
- BuiltIn: s.BuiltIn,
- Source: s.Input,
- })
- }
- s.AugmentedSources = aSources
-
- return &s, nil
-}
-
-func (b *builder) injectIntrospectionRoots(s *Data) error {
- obj := s.Objects.ByName(b.Schema.Query.Name)
- if obj == nil {
- return fmt.Errorf("root query type must be defined")
- }
-
- __type, err := b.buildField(obj, &ast.FieldDefinition{
- Name: "__type",
- Type: ast.NamedType("__Type", nil),
- Arguments: []*ast.ArgumentDefinition{
- {
- Name: "name",
- Type: ast.NonNullNamedType("String", nil),
- },
- },
- })
- if err != nil {
- return err
- }
-
- __schema, err := b.buildField(obj, &ast.FieldDefinition{
- Name: "__schema",
- Type: ast.NamedType("__Schema", nil),
- })
- if err != nil {
- return err
- }
-
- obj.Fields = append(obj.Fields, __type, __schema)
-
- return nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/directive.go b/vendor/github.com/99designs/gqlgen/codegen/directive.go
deleted file mode 100644
index 973061129a..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/directive.go
+++ /dev/null
@@ -1,174 +0,0 @@
-package codegen
-
-import (
- "fmt"
- "strconv"
- "strings"
-
- "github.com/99designs/gqlgen/codegen/templates"
- "github.com/vektah/gqlparser/v2/ast"
-)
-
-type DirectiveList map[string]*Directive
-
-// LocationDirectives filter directives by location
-func (dl DirectiveList) LocationDirectives(location string) DirectiveList {
- return locationDirectives(dl, ast.DirectiveLocation(location))
-}
-
-type Directive struct {
- *ast.DirectiveDefinition
- Name string
- Args []*FieldArgument
- Builtin bool
-}
-
-// IsLocation check location directive
-func (d *Directive) IsLocation(location ...ast.DirectiveLocation) bool {
- for _, l := range d.Locations {
- for _, a := range location {
- if l == a {
- return true
- }
- }
- }
-
- return false
-}
-
-func locationDirectives(directives DirectiveList, location ...ast.DirectiveLocation) map[string]*Directive {
- mDirectives := make(map[string]*Directive)
- for name, d := range directives {
- if d.IsLocation(location...) {
- mDirectives[name] = d
- }
- }
- return mDirectives
-}
-
-func (b *builder) buildDirectives() (map[string]*Directive, error) {
- directives := make(map[string]*Directive, len(b.Schema.Directives))
-
- for name, dir := range b.Schema.Directives {
- if _, ok := directives[name]; ok {
- return nil, fmt.Errorf("directive with name %s already exists", name)
- }
-
- var args []*FieldArgument
- for _, arg := range dir.Arguments {
- tr, err := b.Binder.TypeReference(arg.Type, nil)
- if err != nil {
- return nil, err
- }
-
- newArg := &FieldArgument{
- ArgumentDefinition: arg,
- TypeReference: tr,
- VarName: templates.ToGoPrivate(arg.Name),
- }
-
- if arg.DefaultValue != nil {
- var err error
- newArg.Default, err = arg.DefaultValue.Value(nil)
- if err != nil {
- return nil, fmt.Errorf("default value for directive argument %s(%s) is not valid: %w", dir.Name, arg.Name, err)
- }
- }
- args = append(args, newArg)
- }
-
- directives[name] = &Directive{
- DirectiveDefinition: dir,
- Name: name,
- Args: args,
- Builtin: b.Config.Directives[name].SkipRuntime,
- }
- }
-
- return directives, nil
-}
-
-func (b *builder) getDirectives(list ast.DirectiveList) ([]*Directive, error) {
- dirs := make([]*Directive, len(list))
- for i, d := range list {
- argValues := make(map[string]interface{}, len(d.Arguments))
- for _, da := range d.Arguments {
- val, err := da.Value.Value(nil)
- if err != nil {
- return nil, err
- }
- argValues[da.Name] = val
- }
- def, ok := b.Directives[d.Name]
- if !ok {
- return nil, fmt.Errorf("directive %s not found", d.Name)
- }
-
- var args []*FieldArgument
- for _, a := range def.Args {
- value := a.Default
- if argValue, ok := argValues[a.Name]; ok {
- value = argValue
- }
- args = append(args, &FieldArgument{
- ArgumentDefinition: a.ArgumentDefinition,
- Value: value,
- VarName: a.VarName,
- TypeReference: a.TypeReference,
- })
- }
- dirs[i] = &Directive{
- Name: d.Name,
- Args: args,
- DirectiveDefinition: list[i].Definition,
- Builtin: b.Config.Directives[d.Name].SkipRuntime,
- }
-
- }
-
- return dirs, nil
-}
-
-func (d *Directive) ArgsFunc() string {
- if len(d.Args) == 0 {
- return ""
- }
-
- return "dir_" + d.Name + "_args"
-}
-
-func (d *Directive) CallArgs() string {
- args := []string{"ctx", "obj", "n"}
-
- for _, arg := range d.Args {
- args = append(args, "args["+strconv.Quote(arg.Name)+"].("+templates.CurrentImports.LookupType(arg.TypeReference.GO)+")")
- }
-
- return strings.Join(args, ", ")
-}
-
-func (d *Directive) ResolveArgs(obj string, next int) string {
- args := []string{"ctx", obj, fmt.Sprintf("directive%d", next)}
-
- for _, arg := range d.Args {
- dArg := arg.VarName
- if arg.Value == nil && arg.Default == nil {
- dArg = "nil"
- }
-
- args = append(args, dArg)
- }
-
- return strings.Join(args, ", ")
-}
-
-func (d *Directive) Declaration() string {
- res := ucFirst(d.Name) + " func(ctx context.Context, obj interface{}, next graphql.Resolver"
-
- for _, arg := range d.Args {
- res += fmt.Sprintf(", %s %s", templates.ToGoPrivate(arg.Name), templates.CurrentImports.LookupType(arg.TypeReference.GO))
- }
-
- res += ") (res interface{}, err error)"
- return res
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/directives.gotpl b/vendor/github.com/99designs/gqlgen/codegen/directives.gotpl
deleted file mode 100644
index 23bcf0f879..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/directives.gotpl
+++ /dev/null
@@ -1,149 +0,0 @@
-{{ define "implDirectives" }}{{ $in := .DirectiveObjName }}
- {{- range $i, $directive := .ImplDirectives -}}
- directive{{add $i 1}} := func(ctx context.Context) (interface{}, error) {
- {{- range $arg := $directive.Args }}
- {{- if notNil "Value" $arg }}
- {{ $arg.VarName }}, err := ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, {{ $arg.Value | dump }})
- if err != nil{
- return nil, err
- }
- {{- else if notNil "Default" $arg }}
- {{ $arg.VarName }}, err := ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, {{ $arg.Default | dump }})
- if err != nil{
- return nil, err
- }
- {{- end }}
- {{- end }}
- if ec.directives.{{$directive.Name|ucFirst}} == nil {
- return nil, errors.New("directive {{$directive.Name}} is not implemented")
- }
- return ec.directives.{{$directive.Name|ucFirst}}({{$directive.ResolveArgs $in $i }})
- }
- {{ end -}}
-{{ end }}
-
-{{define "queryDirectives"}}
- for _, d := range obj.Directives {
- switch d.Name {
- {{- range $directive := . }}
- case "{{$directive.Name}}":
- {{- if $directive.Args }}
- rawArgs := d.ArgumentMap(ec.Variables)
- args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs)
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- {{- end }}
- n := next
- next = func(ctx context.Context) (interface{}, error) {
- if ec.directives.{{$directive.Name|ucFirst}} == nil {
- return nil, errors.New("directive {{$directive.Name}} is not implemented")
- }
- return ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}})
- }
- {{- end }}
- }
- }
- tmp, err := next(ctx)
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if data, ok := tmp.(graphql.Marshaler); ok {
- return data
- }
- ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp)
- return graphql.Null
-{{end}}
-
-{{ if .Directives.LocationDirectives "QUERY" }}
-func (ec *executionContext) _queryMiddleware(ctx context.Context, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) graphql.Marshaler {
- {{ template "queryDirectives" .Directives.LocationDirectives "QUERY" }}
-}
-{{ end }}
-
-{{ if .Directives.LocationDirectives "MUTATION" }}
-func (ec *executionContext) _mutationMiddleware(ctx context.Context, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) graphql.Marshaler {
- {{ template "queryDirectives" .Directives.LocationDirectives "MUTATION" }}
-}
-{{ end }}
-
-{{ if .Directives.LocationDirectives "SUBSCRIPTION" }}
-func (ec *executionContext) _subscriptionMiddleware(ctx context.Context, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) func(ctx context.Context) graphql.Marshaler {
- for _, d := range obj.Directives {
- switch d.Name {
- {{- range $directive := .Directives.LocationDirectives "SUBSCRIPTION" }}
- case "{{$directive.Name}}":
- {{- if $directive.Args }}
- rawArgs := d.ArgumentMap(ec.Variables)
- args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs)
- if err != nil {
- ec.Error(ctx, err)
- return func(ctx context.Context) graphql.Marshaler {
- return graphql.Null
- }
- }
- {{- end }}
- n := next
- next = func(ctx context.Context) (interface{}, error) {
- if ec.directives.{{$directive.Name|ucFirst}} == nil {
- return nil, errors.New("directive {{$directive.Name}} is not implemented")
- }
- return ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}})
- }
- {{- end }}
- }
- }
- tmp, err := next(ctx)
- if err != nil {
- ec.Error(ctx, err)
- return func(ctx context.Context) graphql.Marshaler {
- return graphql.Null
- }
- }
- if data, ok := tmp.(func(ctx context.Context) graphql.Marshaler); ok {
- return data
- }
- ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp)
- return func(ctx context.Context) graphql.Marshaler {
- return graphql.Null
- }
-}
-{{ end }}
-
-{{ if .Directives.LocationDirectives "FIELD" }}
- func (ec *executionContext) _fieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) interface{} {
- {{- if .Directives.LocationDirectives "FIELD" }}
- fc := graphql.GetFieldContext(ctx)
- for _, d := range fc.Field.Directives {
- switch d.Name {
- {{- range $directive := .Directives.LocationDirectives "FIELD" }}
- case "{{$directive.Name}}":
- {{- if $directive.Args }}
- rawArgs := d.ArgumentMap(ec.Variables)
- args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs)
- if err != nil {
- ec.Error(ctx, err)
- return nil
- }
- {{- end }}
- n := next
- next = func(ctx context.Context) (interface{}, error) {
- if ec.directives.{{$directive.Name|ucFirst}} == nil {
- return nil, errors.New("directive {{$directive.Name}} is not implemented")
- }
- return ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}})
- }
- {{- end }}
- }
- }
- {{- end }}
- res, err := ec.ResolverMiddleware(ctx, next)
- if err != nil {
- ec.Error(ctx, err)
- return nil
- }
- return res
- }
-{{ end }}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/field.go b/vendor/github.com/99designs/gqlgen/codegen/field.go
deleted file mode 100644
index a33cc18e5a..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/field.go
+++ /dev/null
@@ -1,580 +0,0 @@
-package codegen
-
-import (
- "errors"
- "fmt"
- "go/types"
- "log"
- "reflect"
- "strconv"
- "strings"
-
- "github.com/99designs/gqlgen/codegen/config"
- "github.com/99designs/gqlgen/codegen/templates"
- "github.com/vektah/gqlparser/v2/ast"
- "golang.org/x/text/cases"
- "golang.org/x/text/language"
-)
-
-type Field struct {
- *ast.FieldDefinition
-
- TypeReference *config.TypeReference
- GoFieldType GoFieldType // The field type in go, if any
- GoReceiverName string // The name of method & var receiver in go, if any
- GoFieldName string // The name of the method or var in go, if any
- IsResolver bool // Does this field need a resolver
- Args []*FieldArgument // A list of arguments to be passed to this field
- MethodHasContext bool // If this is bound to a go method, does the method also take a context
- NoErr bool // If this is bound to a go method, does that method have an error as the second argument
- VOkFunc bool // If this is bound to a go method, is it of shape (interface{}, bool)
- Object *Object // A link back to the parent object
- Default interface{} // The default value
- Stream bool // does this field return a channel?
- Directives []*Directive
-}
-
-func (b *builder) buildField(obj *Object, field *ast.FieldDefinition) (*Field, error) {
- dirs, err := b.getDirectives(field.Directives)
- if err != nil {
- return nil, err
- }
-
- f := Field{
- FieldDefinition: field,
- Object: obj,
- Directives: dirs,
- GoFieldName: templates.ToGo(field.Name),
- GoFieldType: GoFieldVariable,
- GoReceiverName: "obj",
- }
-
- if field.DefaultValue != nil {
- var err error
- f.Default, err = field.DefaultValue.Value(nil)
- if err != nil {
- return nil, fmt.Errorf("default value %s is not valid: %w", field.Name, err)
- }
- }
-
- for _, arg := range field.Arguments {
- newArg, err := b.buildArg(obj, arg)
- if err != nil {
- return nil, err
- }
- f.Args = append(f.Args, newArg)
- }
-
- if err = b.bindField(obj, &f); err != nil {
- f.IsResolver = true
- if errors.Is(err, config.ErrTypeNotFound) {
- return nil, err
- }
- log.Println(err.Error())
- }
-
- if f.IsResolver && b.Config.ResolversAlwaysReturnPointers && !f.TypeReference.IsPtr() && f.TypeReference.IsStruct() {
- f.TypeReference = b.Binder.PointerTo(f.TypeReference)
- }
-
- return &f, nil
-}
-
-func (b *builder) bindField(obj *Object, f *Field) (errret error) {
- defer func() {
- if f.TypeReference == nil {
- tr, err := b.Binder.TypeReference(f.Type, nil)
- if err != nil {
- errret = err
- }
- f.TypeReference = tr
- }
- if f.TypeReference != nil {
- dirs, err := b.getDirectives(f.TypeReference.Definition.Directives)
- if err != nil {
- errret = err
- }
- for _, dir := range obj.Directives {
- if dir.IsLocation(ast.LocationInputObject) {
- dirs = append(dirs, dir)
- }
- }
- f.Directives = append(dirs, f.Directives...)
- }
- }()
-
- f.Stream = obj.Stream
-
- switch {
- case f.Name == "__schema":
- f.GoFieldType = GoFieldMethod
- f.GoReceiverName = "ec"
- f.GoFieldName = "introspectSchema"
- return nil
- case f.Name == "__type":
- f.GoFieldType = GoFieldMethod
- f.GoReceiverName = "ec"
- f.GoFieldName = "introspectType"
- return nil
- case f.Name == "_entities":
- f.GoFieldType = GoFieldMethod
- f.GoReceiverName = "ec"
- f.GoFieldName = "__resolve_entities"
- f.MethodHasContext = true
- f.NoErr = true
- return nil
- case f.Name == "_service":
- f.GoFieldType = GoFieldMethod
- f.GoReceiverName = "ec"
- f.GoFieldName = "__resolve__service"
- f.MethodHasContext = true
- return nil
- case obj.Root:
- f.IsResolver = true
- return nil
- case b.Config.Models[obj.Name].Fields[f.Name].Resolver:
- f.IsResolver = true
- return nil
- case obj.Type == config.MapType:
- f.GoFieldType = GoFieldMap
- return nil
- case b.Config.Models[obj.Name].Fields[f.Name].FieldName != "":
- f.GoFieldName = b.Config.Models[obj.Name].Fields[f.Name].FieldName
- }
-
- target, err := b.findBindTarget(obj.Type.(*types.Named), f.GoFieldName)
- if err != nil {
- return err
- }
-
- pos := b.Binder.ObjectPosition(target)
-
- switch target := target.(type) {
- case nil:
- objPos := b.Binder.TypePosition(obj.Type)
- return fmt.Errorf(
- "%s:%d adding resolver method for %s.%s, nothing matched",
- objPos.Filename,
- objPos.Line,
- obj.Name,
- f.Name,
- )
-
- case *types.Func:
- sig := target.Type().(*types.Signature)
- if sig.Results().Len() == 1 {
- f.NoErr = true
- } else if s := sig.Results(); s.Len() == 2 && s.At(1).Type().String() == "bool" {
- f.VOkFunc = true
- } else if sig.Results().Len() != 2 {
- return fmt.Errorf("method has wrong number of args")
- }
- params := sig.Params()
- // If the first argument is the context, remove it from the comparison and set
- // the MethodHasContext flag so that the context will be passed to this model's method
- if params.Len() > 0 && params.At(0).Type().String() == "context.Context" {
- f.MethodHasContext = true
- vars := make([]*types.Var, params.Len()-1)
- for i := 1; i < params.Len(); i++ {
- vars[i-1] = params.At(i)
- }
- params = types.NewTuple(vars...)
- }
-
- // Try to match target function's arguments with GraphQL field arguments.
- newArgs, err := b.bindArgs(f, sig, params)
- if err != nil {
- return fmt.Errorf("%s:%d: %w", pos.Filename, pos.Line, err)
- }
-
- // Try to match target function's return types with GraphQL field return type
- result := sig.Results().At(0)
- tr, err := b.Binder.TypeReference(f.Type, result.Type())
- if err != nil {
- return err
- }
-
- // success, args and return type match. Bind to method
- f.GoFieldType = GoFieldMethod
- f.GoReceiverName = "obj"
- f.GoFieldName = target.Name()
- f.Args = newArgs
- f.TypeReference = tr
-
- return nil
-
- case *types.Var:
- tr, err := b.Binder.TypeReference(f.Type, target.Type())
- if err != nil {
- return err
- }
-
- // success, bind to var
- f.GoFieldType = GoFieldVariable
- f.GoReceiverName = "obj"
- f.GoFieldName = target.Name()
- f.TypeReference = tr
-
- return nil
- default:
- panic(fmt.Errorf("unknown bind target %T for %s", target, f.Name))
- }
-}
-
-// findBindTarget attempts to match the name to a field or method on a Type
-// with the following priorites:
-// 1. Any Fields with a struct tag (see config.StructTag). Errors if more than one match is found
-// 2. Any method or field with a matching name. Errors if more than one match is found
-// 3. Same logic again for embedded fields
-func (b *builder) findBindTarget(t types.Type, name string) (types.Object, error) {
- // NOTE: a struct tag will override both methods and fields
- // Bind to struct tag
- found, err := b.findBindStructTagTarget(t, name)
- if found != nil || err != nil {
- return found, err
- }
-
- // Search for a method to bind to
- foundMethod, err := b.findBindMethodTarget(t, name)
- if err != nil {
- return nil, err
- }
-
- // Search for a field to bind to
- foundField, err := b.findBindFieldTarget(t, name)
- if err != nil {
- return nil, err
- }
-
- switch {
- case foundField == nil && foundMethod != nil:
- // Bind to method
- return foundMethod, nil
- case foundField != nil && foundMethod == nil:
- // Bind to field
- return foundField, nil
- case foundField != nil && foundMethod != nil:
- // Error
- return nil, fmt.Errorf("found more than one way to bind for %s", name)
- }
-
- // Search embeds
- return b.findBindEmbedsTarget(t, name)
-}
-
-func (b *builder) findBindStructTagTarget(in types.Type, name string) (types.Object, error) {
- if b.Config.StructTag == "" {
- return nil, nil
- }
-
- switch t := in.(type) {
- case *types.Named:
- return b.findBindStructTagTarget(t.Underlying(), name)
- case *types.Struct:
- var found types.Object
- for i := 0; i < t.NumFields(); i++ {
- field := t.Field(i)
- if !field.Exported() || field.Embedded() {
- continue
- }
- tags := reflect.StructTag(t.Tag(i))
- if val, ok := tags.Lookup(b.Config.StructTag); ok && equalFieldName(val, name) {
- if found != nil {
- return nil, fmt.Errorf("tag %s is ambigious; multiple fields have the same tag value of %s", b.Config.StructTag, val)
- }
-
- found = field
- }
- }
-
- return found, nil
- }
-
- return nil, nil
-}
-
-func (b *builder) findBindMethodTarget(in types.Type, name string) (types.Object, error) {
- switch t := in.(type) {
- case *types.Named:
- if _, ok := t.Underlying().(*types.Interface); ok {
- return b.findBindMethodTarget(t.Underlying(), name)
- }
-
- return b.findBindMethoderTarget(t.Method, t.NumMethods(), name)
- case *types.Interface:
- // FIX-ME: Should use ExplicitMethod here? What's the difference?
- return b.findBindMethoderTarget(t.Method, t.NumMethods(), name)
- }
-
- return nil, nil
-}
-
-func (b *builder) findBindMethoderTarget(methodFunc func(i int) *types.Func, methodCount int, name string) (types.Object, error) {
- var found types.Object
- for i := 0; i < methodCount; i++ {
- method := methodFunc(i)
- if !method.Exported() || !strings.EqualFold(method.Name(), name) {
- continue
- }
-
- if found != nil {
- return nil, fmt.Errorf("found more than one matching method to bind for %s", name)
- }
-
- found = method
- }
-
- return found, nil
-}
-
-func (b *builder) findBindFieldTarget(in types.Type, name string) (types.Object, error) {
- switch t := in.(type) {
- case *types.Named:
- return b.findBindFieldTarget(t.Underlying(), name)
- case *types.Struct:
- var found types.Object
- for i := 0; i < t.NumFields(); i++ {
- field := t.Field(i)
- if !field.Exported() || !equalFieldName(field.Name(), name) {
- continue
- }
-
- if found != nil {
- return nil, fmt.Errorf("found more than one matching field to bind for %s", name)
- }
-
- found = field
- }
-
- return found, nil
- }
-
- return nil, nil
-}
-
-func (b *builder) findBindEmbedsTarget(in types.Type, name string) (types.Object, error) {
- switch t := in.(type) {
- case *types.Named:
- return b.findBindEmbedsTarget(t.Underlying(), name)
- case *types.Struct:
- return b.findBindStructEmbedsTarget(t, name)
- case *types.Interface:
- return b.findBindInterfaceEmbedsTarget(t, name)
- }
-
- return nil, nil
-}
-
-func (b *builder) findBindStructEmbedsTarget(strukt *types.Struct, name string) (types.Object, error) {
- var found types.Object
- for i := 0; i < strukt.NumFields(); i++ {
- field := strukt.Field(i)
- if !field.Embedded() {
- continue
- }
-
- fieldType := field.Type()
- if ptr, ok := fieldType.(*types.Pointer); ok {
- fieldType = ptr.Elem()
- }
-
- f, err := b.findBindTarget(fieldType, name)
- if err != nil {
- return nil, err
- }
-
- if f != nil && found != nil {
- return nil, fmt.Errorf("found more than one way to bind for %s", name)
- }
-
- if f != nil {
- found = f
- }
- }
-
- return found, nil
-}
-
-func (b *builder) findBindInterfaceEmbedsTarget(iface *types.Interface, name string) (types.Object, error) {
- var found types.Object
- for i := 0; i < iface.NumEmbeddeds(); i++ {
- embeddedType := iface.EmbeddedType(i)
-
- f, err := b.findBindTarget(embeddedType, name)
- if err != nil {
- return nil, err
- }
-
- if f != nil && found != nil {
- return nil, fmt.Errorf("found more than one way to bind for %s", name)
- }
-
- if f != nil {
- found = f
- }
- }
-
- return found, nil
-}
-
-func (f *Field) HasDirectives() bool {
- return len(f.ImplDirectives()) > 0
-}
-
-func (f *Field) DirectiveObjName() string {
- if f.Object.Root {
- return "nil"
- }
- return f.GoReceiverName
-}
-
-func (f *Field) ImplDirectives() []*Directive {
- var d []*Directive
- loc := ast.LocationFieldDefinition
- if f.Object.IsInputType() {
- loc = ast.LocationInputFieldDefinition
- }
- for i := range f.Directives {
- if !f.Directives[i].Builtin &&
- (f.Directives[i].IsLocation(loc, ast.LocationObject) || f.Directives[i].IsLocation(loc, ast.LocationInputObject)) {
- d = append(d, f.Directives[i])
- }
- }
- return d
-}
-
-func (f *Field) IsReserved() bool {
- return strings.HasPrefix(f.Name, "__")
-}
-
-func (f *Field) IsMethod() bool {
- return f.GoFieldType == GoFieldMethod
-}
-
-func (f *Field) IsVariable() bool {
- return f.GoFieldType == GoFieldVariable
-}
-
-func (f *Field) IsMap() bool {
- return f.GoFieldType == GoFieldMap
-}
-
-func (f *Field) IsConcurrent() bool {
- if f.Object.DisableConcurrency {
- return false
- }
- return f.MethodHasContext || f.IsResolver
-}
-
-func (f *Field) GoNameUnexported() string {
- return templates.ToGoPrivate(f.Name)
-}
-
-func (f *Field) ShortInvocation() string {
- caser := cases.Title(language.English, cases.NoLower)
- if f.Object.Kind == ast.InputObject {
- return fmt.Sprintf("%s().%s(ctx, &it, data)", caser.String(f.Object.Definition.Name), f.GoFieldName)
- }
- return fmt.Sprintf("%s().%s(%s)", caser.String(f.Object.Definition.Name), f.GoFieldName, f.CallArgs())
-}
-
-func (f *Field) ArgsFunc() string {
- if len(f.Args) == 0 {
- return ""
- }
-
- return "field_" + f.Object.Definition.Name + "_" + f.Name + "_args"
-}
-
-func (f *Field) FieldContextFunc() string {
- return "fieldContext_" + f.Object.Definition.Name + "_" + f.Name
-}
-
-func (f *Field) ChildFieldContextFunc(name string) string {
- return "fieldContext_" + f.TypeReference.Definition.Name + "_" + name
-}
-
-func (f *Field) ResolverType() string {
- if !f.IsResolver {
- return ""
- }
-
- return fmt.Sprintf("%s().%s(%s)", f.Object.Definition.Name, f.GoFieldName, f.CallArgs())
-}
-
-func (f *Field) ShortResolverDeclaration() string {
- if f.Object.Kind == ast.InputObject {
- return fmt.Sprintf("(ctx context.Context, obj %s, data %s) error",
- templates.CurrentImports.LookupType(f.Object.Reference()),
- templates.CurrentImports.LookupType(f.TypeReference.GO),
- )
- }
-
- res := "(ctx context.Context"
-
- if !f.Object.Root {
- res += fmt.Sprintf(", obj %s", templates.CurrentImports.LookupType(f.Object.Reference()))
- }
- for _, arg := range f.Args {
- res += fmt.Sprintf(", %s %s", arg.VarName, templates.CurrentImports.LookupType(arg.TypeReference.GO))
- }
-
- result := templates.CurrentImports.LookupType(f.TypeReference.GO)
- if f.Object.Stream {
- result = "<-chan " + result
- }
-
- res += fmt.Sprintf(") (%s, error)", result)
- return res
-}
-
-func (f *Field) ComplexitySignature() string {
- res := "func(childComplexity int"
- for _, arg := range f.Args {
- res += fmt.Sprintf(", %s %s", arg.VarName, templates.CurrentImports.LookupType(arg.TypeReference.GO))
- }
- res += ") int"
- return res
-}
-
-func (f *Field) ComplexityArgs() string {
- args := make([]string, len(f.Args))
- for i, arg := range f.Args {
- args[i] = "args[" + strconv.Quote(arg.Name) + "].(" + templates.CurrentImports.LookupType(arg.TypeReference.GO) + ")"
- }
-
- return strings.Join(args, ", ")
-}
-
-func (f *Field) CallArgs() string {
- args := make([]string, 0, len(f.Args)+2)
-
- if f.IsResolver {
- args = append(args, "rctx")
-
- if !f.Object.Root {
- args = append(args, "obj")
- }
- } else if f.MethodHasContext {
- args = append(args, "ctx")
- }
-
- for _, arg := range f.Args {
- tmp := "fc.Args[" + strconv.Quote(arg.Name) + "].(" + templates.CurrentImports.LookupType(arg.TypeReference.GO) + ")"
-
- if iface, ok := arg.TypeReference.GO.(*types.Interface); ok && iface.Empty() {
- tmp = fmt.Sprintf(`
- func () interface{} {
- if fc.Args["%s"] == nil {
- return nil
- }
- return fc.Args["%s"].(interface{})
- }()`, arg.Name, arg.Name,
- )
- }
-
- args = append(args, tmp)
- }
-
- return strings.Join(args, ", ")
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/field.gotpl b/vendor/github.com/99designs/gqlgen/codegen/field.gotpl
deleted file mode 100644
index e47b958dda..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/field.gotpl
+++ /dev/null
@@ -1,158 +0,0 @@
-{{- range $object := .Objects }}{{- range $field := $object.Fields }}
-
-func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Context, field graphql.CollectedField{{ if not $object.Root }}, obj {{$object.Reference | ref}}{{end}}) (ret {{ if $object.Stream }}func(ctx context.Context){{ end }}graphql.Marshaler) {
- {{- $null := "graphql.Null" }}
- {{- if $object.Stream }}
- {{- $null = "nil" }}
- {{- end }}
- fc, err := ec.{{ $field.FieldContextFunc }}(ctx, field)
- if err != nil {
- return {{ $null }}
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func () {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = {{ $null }}
- }
- }()
- {{- if $.AllDirectives.LocationDirectives "FIELD" }}
- resTmp := ec._fieldMiddleware(ctx, {{if $object.Root}}nil{{else}}obj{{end}}, func(rctx context.Context) (interface{}, error) {
- {{ template "field" $field }}
- })
- {{ else }}
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- {{ template "field" $field }}
- })
- if err != nil {
- ec.Error(ctx, err)
- return {{ $null }}
- }
- {{- end }}
- if resTmp == nil {
- {{- if $field.TypeReference.GQL.NonNull }}
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- {{- end }}
- return {{ $null }}
- }
- {{- if $object.Stream }}
- return func(ctx context.Context) graphql.Marshaler {
- select {
- case res, ok := <-resTmp.(<-chan {{$field.TypeReference.GO | ref}}):
- if !ok {
- return nil
- }
- return graphql.WriterFunc(func(w io.Writer) {
- w.Write([]byte{'{'})
- graphql.MarshalString(field.Alias).MarshalGQL(w)
- w.Write([]byte{':'})
- ec.{{ $field.TypeReference.MarshalFunc }}(ctx, field.Selections, res).MarshalGQL(w)
- w.Write([]byte{'}'})
- })
- case <-ctx.Done():
- return nil
- }
- }
- {{- else }}
- res := resTmp.({{$field.TypeReference.GO | ref}})
- fc.Result = res
- return ec.{{ $field.TypeReference.MarshalFunc }}(ctx, field.Selections, res)
- {{- end }}
-}
-
-func (ec *executionContext) {{ $field.FieldContextFunc }}(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: {{quote $field.Object.Name}},
- Field: field,
- IsMethod: {{or $field.IsMethod $field.IsResolver}},
- IsResolver: {{ $field.IsResolver }},
- Child: func (ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- {{- if not $field.TypeReference.Definition.Fields }}
- return nil, errors.New("field of type {{ $field.TypeReference.Definition.Name }} does not have child fields")
- {{- else if ne $field.TypeReference.Definition.Kind "OBJECT" }}
- return nil, errors.New("FieldContext.Child cannot be called on type {{ $field.TypeReference.Definition.Kind }}")
- {{- else }}
- switch field.Name {
- {{- range $f := $field.TypeReference.Definition.Fields }}
- case "{{ $f.Name }}":
- return ec.{{ $field.ChildFieldContextFunc $f.Name }}(ctx, field)
- {{- end }}
- }
- return nil, fmt.Errorf("no field named %q was found under type {{ $field.TypeReference.Definition.Name }}", field.Name)
- {{- end }}
- },
- }
- {{- if $field.Args }}
- defer func () {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.{{ $field.ArgsFunc }}(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return
- }
- {{- end }}
- return fc, nil
-}
-
-{{- end }}{{- end}}
-
-{{ define "field" }}
- {{- if .HasDirectives -}}
- directive0 := func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- {{ template "fieldDefinition" . }}
- }
- {{ template "implDirectives" . }}
- tmp, err := directive{{.ImplDirectives|len}}(rctx)
- if err != nil {
- return nil, graphql.ErrorOnPath(ctx, err)
- }
- if tmp == nil {
- return nil, nil
- }
- if data, ok := tmp.({{if .Stream}}<-chan {{end}}{{ .TypeReference.GO | ref }}) ; ok {
- return data, nil
- }
- return nil, fmt.Errorf(`unexpected type %T from directive, should be {{if .Stream}}<-chan {{end}}{{ .TypeReference.GO }}`, tmp)
- {{- else -}}
- ctx = rctx // use context from middleware stack in children
- {{ template "fieldDefinition" . }}
- {{- end -}}
-{{ end }}
-
-{{ define "fieldDefinition" }}
- {{- if .IsResolver -}}
- return ec.resolvers.{{ .ShortInvocation }}
- {{- else if .IsMap -}}
- switch v := {{.GoReceiverName}}[{{.Name|quote}}].(type) {
- case {{if .Stream}}<-chan {{end}}{{.TypeReference.GO | ref}}:
- return v, nil
- case {{if .Stream}}<-chan {{end}}{{.TypeReference.Elem.GO | ref}}:
- return &v, nil
- case nil:
- return ({{.TypeReference.GO | ref}})(nil), nil
- default:
- return nil, fmt.Errorf("unexpected type %T for field %s", v, {{ .Name | quote}})
- }
- {{- else if .IsMethod -}}
- {{- if .VOkFunc -}}
- v, ok := {{.GoReceiverName}}.{{.GoFieldName}}({{ .CallArgs }})
- if !ok {
- return nil, nil
- }
- return v, nil
- {{- else if .NoErr -}}
- return {{.GoReceiverName}}.{{.GoFieldName}}({{ .CallArgs }}), nil
- {{- else -}}
- return {{.GoReceiverName}}.{{.GoFieldName}}({{ .CallArgs }})
- {{- end -}}
- {{- else if .IsVariable -}}
- return {{.GoReceiverName}}.{{.GoFieldName}}, nil
- {{- end }}
-{{- end }}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/generate.go b/vendor/github.com/99designs/gqlgen/codegen/generate.go
deleted file mode 100644
index 1ce8c329dc..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/generate.go
+++ /dev/null
@@ -1,220 +0,0 @@
-package codegen
-
-import (
- "embed"
- "errors"
- "fmt"
- "os"
- "path/filepath"
- "runtime"
- "strings"
-
- "github.com/99designs/gqlgen/codegen/config"
- "github.com/99designs/gqlgen/codegen/templates"
- "github.com/vektah/gqlparser/v2/ast"
-)
-
-//go:embed *.gotpl
-var codegenTemplates embed.FS
-
-func GenerateCode(data *Data) error {
- if !data.Config.Exec.IsDefined() {
- return fmt.Errorf("missing exec config")
- }
-
- switch data.Config.Exec.Layout {
- case config.ExecLayoutSingleFile:
- return generateSingleFile(data)
- case config.ExecLayoutFollowSchema:
- return generatePerSchema(data)
- }
-
- return fmt.Errorf("unrecognized exec layout %s", data.Config.Exec.Layout)
-}
-
-func generateSingleFile(data *Data) error {
- return templates.Render(templates.Options{
- PackageName: data.Config.Exec.Package,
- Filename: data.Config.Exec.Filename,
- Data: data,
- RegionTags: true,
- GeneratedHeader: true,
- Packages: data.Config.Packages,
- TemplateFS: codegenTemplates,
- })
-}
-
-func generatePerSchema(data *Data) error {
- err := generateRootFile(data)
- if err != nil {
- return err
- }
-
- builds := map[string]*Data{}
-
- err = addObjects(data, &builds)
- if err != nil {
- return err
- }
-
- err = addInputs(data, &builds)
- if err != nil {
- return err
- }
-
- err = addInterfaces(data, &builds)
- if err != nil {
- return err
- }
-
- err = addReferencedTypes(data, &builds)
- if err != nil {
- return err
- }
-
- for filename, build := range builds {
- if filename == "" {
- continue
- }
-
- dir := data.Config.Exec.DirName
- path := filepath.Join(dir, filename)
-
- err = templates.Render(templates.Options{
- PackageName: data.Config.Exec.Package,
- Filename: path,
- Data: build,
- RegionTags: true,
- GeneratedHeader: true,
- Packages: data.Config.Packages,
- TemplateFS: codegenTemplates,
- })
- if err != nil {
- return err
- }
- }
-
- return nil
-}
-
-func filename(p *ast.Position, config *config.Config) string {
- name := "common!"
- if p != nil && p.Src != nil {
- gqlname := filepath.Base(p.Src.Name)
- ext := filepath.Ext(p.Src.Name)
- name = strings.TrimSuffix(gqlname, ext)
- }
-
- filenameTempl := config.Exec.FilenameTemplate
- if filenameTempl == "" {
- filenameTempl = "{name}.generated.go"
- }
-
- return strings.ReplaceAll(filenameTempl, "{name}", name)
-}
-
-func addBuild(filename string, p *ast.Position, data *Data, builds *map[string]*Data) {
- buildConfig := *data.Config
- if p != nil {
- buildConfig.Sources = []*ast.Source{p.Src}
- }
-
- (*builds)[filename] = &Data{
- Config: &buildConfig,
- QueryRoot: data.QueryRoot,
- MutationRoot: data.MutationRoot,
- SubscriptionRoot: data.SubscriptionRoot,
- AllDirectives: data.AllDirectives,
- }
-}
-
-// Root file contains top-level definitions that should not be duplicated across the generated
-// files for each schema file.
-func generateRootFile(data *Data) error {
- dir := data.Config.Exec.DirName
- path := filepath.Join(dir, "root_.generated.go")
-
- _, thisFile, _, _ := runtime.Caller(0)
- rootDir := filepath.Dir(thisFile)
- templatePath := filepath.Join(rootDir, "root_.gotpl")
- templateBytes, err := os.ReadFile(templatePath)
- if err != nil {
- return err
- }
- template := string(templateBytes)
-
- return templates.Render(templates.Options{
- PackageName: data.Config.Exec.Package,
- Template: template,
- Filename: path,
- Data: data,
- RegionTags: false,
- GeneratedHeader: true,
- Packages: data.Config.Packages,
- TemplateFS: codegenTemplates,
- })
-}
-
-func addObjects(data *Data, builds *map[string]*Data) error {
- for _, o := range data.Objects {
- filename := filename(o.Position, data.Config)
- if (*builds)[filename] == nil {
- addBuild(filename, o.Position, data, builds)
- }
-
- (*builds)[filename].Objects = append((*builds)[filename].Objects, o)
- }
- return nil
-}
-
-func addInputs(data *Data, builds *map[string]*Data) error {
- for _, in := range data.Inputs {
- filename := filename(in.Position, data.Config)
- if (*builds)[filename] == nil {
- addBuild(filename, in.Position, data, builds)
- }
-
- (*builds)[filename].Inputs = append((*builds)[filename].Inputs, in)
- }
- return nil
-}
-
-func addInterfaces(data *Data, builds *map[string]*Data) error {
- for k, inf := range data.Interfaces {
- filename := filename(inf.Position, data.Config)
- if (*builds)[filename] == nil {
- addBuild(filename, inf.Position, data, builds)
- }
- build := (*builds)[filename]
-
- if build.Interfaces == nil {
- build.Interfaces = map[string]*Interface{}
- }
- if build.Interfaces[k] != nil {
- return errors.New("conflicting interface keys")
- }
-
- build.Interfaces[k] = inf
- }
- return nil
-}
-
-func addReferencedTypes(data *Data, builds *map[string]*Data) error {
- for k, rt := range data.ReferencedTypes {
- filename := filename(rt.Definition.Position, data.Config)
- if (*builds)[filename] == nil {
- addBuild(filename, rt.Definition.Position, data, builds)
- }
- build := (*builds)[filename]
-
- if build.ReferencedTypes == nil {
- build.ReferencedTypes = map[string]*config.TypeReference{}
- }
- if build.ReferencedTypes[k] != nil {
- return errors.New("conflicting referenced type keys")
- }
-
- build.ReferencedTypes[k] = rt
- }
- return nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl b/vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl
deleted file mode 100644
index 0998c77502..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl
+++ /dev/null
@@ -1,258 +0,0 @@
-{{ reserveImport "context" }}
-{{ reserveImport "fmt" }}
-{{ reserveImport "io" }}
-{{ reserveImport "strconv" }}
-{{ reserveImport "time" }}
-{{ reserveImport "sync" }}
-{{ reserveImport "sync/atomic" }}
-{{ reserveImport "errors" }}
-{{ reserveImport "bytes" }}
-{{ reserveImport "embed" }}
-
-{{ reserveImport "github.com/vektah/gqlparser/v2" "gqlparser" }}
-{{ reserveImport "github.com/vektah/gqlparser/v2/ast" }}
-{{ reserveImport "github.com/99designs/gqlgen/graphql" }}
-{{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }}
-
-
-{{ if eq .Config.Exec.Layout "single-file" }}
- // NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.
- func NewExecutableSchema(cfg Config) graphql.ExecutableSchema {
- return &executableSchema{
- resolvers: cfg.Resolvers,
- directives: cfg.Directives,
- complexity: cfg.Complexity,
- }
- }
-
- type Config struct {
- Resolvers ResolverRoot
- Directives DirectiveRoot
- Complexity ComplexityRoot
- }
-
- type ResolverRoot interface {
- {{- range $object := .Objects -}}
- {{ if $object.HasResolvers -}}
- {{ucFirst $object.Name}}() {{ucFirst $object.Name}}Resolver
- {{ end }}
- {{- end }}
- {{- range $object := .Inputs -}}
- {{ if $object.HasResolvers -}}
- {{ucFirst $object.Name}}() {{ucFirst $object.Name}}Resolver
- {{ end }}
-{{- end }}
-}
-
- type DirectiveRoot struct {
- {{ range $directive := .Directives }}
- {{- $directive.Declaration }}
- {{ end }}
- }
-
- type ComplexityRoot struct {
- {{ range $object := .Objects }}
- {{ if not $object.IsReserved -}}
- {{ ucFirst $object.Name }} struct {
- {{ range $_, $fields := $object.UniqueFields }}
- {{- $field := index $fields 0 -}}
- {{ if not $field.IsReserved -}}
- {{ $field.GoFieldName }} {{ $field.ComplexitySignature }}
- {{ end }}
- {{- end }}
- }
- {{- end }}
- {{ end }}
- }
-{{ end }}
-
-{{ range $object := .Objects -}}
- {{ if $object.HasResolvers }}
- type {{ucFirst $object.Name}}Resolver interface {
- {{ range $field := $object.Fields -}}
- {{- if $field.IsResolver }}
- {{- $field.GoFieldName}}{{ $field.ShortResolverDeclaration }}
- {{- end }}
- {{ end }}
- }
- {{- end }}
-{{- end }}
-
-{{ range $object := .Inputs -}}
- {{ if $object.HasResolvers }}
- type {{$object.Name}}Resolver interface {
- {{ range $field := $object.Fields -}}
- {{- if $field.IsResolver }}
- {{- $field.GoFieldName}}{{ $field.ShortResolverDeclaration }}
- {{- end }}
- {{ end }}
- }
- {{- end }}
-{{- end }}
-
-{{ if eq .Config.Exec.Layout "single-file" }}
- type executableSchema struct {
- resolvers ResolverRoot
- directives DirectiveRoot
- complexity ComplexityRoot
- }
-
- func (e *executableSchema) Schema() *ast.Schema {
- return parsedSchema
- }
-
- func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) {
- ec := executionContext{nil, e}
- _ = ec
- switch typeName + "." + field {
- {{ range $object := .Objects }}
- {{ if not $object.IsReserved }}
- {{ range $_, $fields := $object.UniqueFields }}
- {{- $len := len $fields }}
- {{- range $i, $field := $fields }}
- {{- $last := eq (add $i 1) $len }}
- {{- if not $field.IsReserved }}
- {{- if eq $i 0 }}case {{ end }}"{{$object.Name}}.{{$field.Name}}"{{ if not $last }},{{ else }}:
- if e.complexity.{{ucFirst $object.Name}}.{{$field.GoFieldName}} == nil {
- break
- }
- {{ if $field.Args }}
- args, err := ec.{{ $field.ArgsFunc }}(context.TODO(),rawArgs)
- if err != nil {
- return 0, false
- }
- {{ end }}
- return e.complexity.{{ucFirst $object.Name}}.{{$field.GoFieldName}}(childComplexity{{if $field.Args}}, {{$field.ComplexityArgs}} {{ end }}), true
- {{ end }}
- {{- end }}
- {{- end }}
- {{ end }}
- {{ end }}
- {{ end }}
- }
- return 0, false
- }
-
- func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler {
- rc := graphql.GetOperationContext(ctx)
- ec := executionContext{rc, e}
- inputUnmarshalMap := graphql.BuildUnmarshalerMap(
- {{- range $input := .Inputs -}}
- {{ if not $input.HasUnmarshal }}
- ec.unmarshalInput{{ $input.Name }},
- {{- end }}
- {{- end }}
- )
- first := true
-
- switch rc.Operation.Operation {
- {{- if .QueryRoot }} case ast.Query:
- return func(ctx context.Context) *graphql.Response {
- if !first { return nil }
- first = false
- ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap)
- {{ if .Directives.LocationDirectives "QUERY" -}}
- data := ec._queryMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){
- return ec._{{.QueryRoot.Name}}(ctx, rc.Operation.SelectionSet), nil
- })
- {{- else -}}
- data := ec._{{.QueryRoot.Name}}(ctx, rc.Operation.SelectionSet)
- {{- end }}
- var buf bytes.Buffer
- data.MarshalGQL(&buf)
-
- return &graphql.Response{
- Data: buf.Bytes(),
- }
- }
- {{ end }}
-
- {{- if .MutationRoot }} case ast.Mutation:
- return func(ctx context.Context) *graphql.Response {
- if !first { return nil }
- first = false
- ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap)
- {{ if .Directives.LocationDirectives "MUTATION" -}}
- data := ec._mutationMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){
- return ec._{{.MutationRoot.Name}}(ctx, rc.Operation.SelectionSet), nil
- })
- {{- else -}}
- data := ec._{{.MutationRoot.Name}}(ctx, rc.Operation.SelectionSet)
- {{- end }}
- var buf bytes.Buffer
- data.MarshalGQL(&buf)
-
- return &graphql.Response{
- Data: buf.Bytes(),
- }
- }
- {{ end }}
-
- {{- if .SubscriptionRoot }} case ast.Subscription:
- {{ if .Directives.LocationDirectives "SUBSCRIPTION" -}}
- next := ec._subscriptionMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){
- return ec._{{.SubscriptionRoot.Name}}(ctx, rc.Operation.SelectionSet),nil
- })
- {{- else -}}
- next := ec._{{.SubscriptionRoot.Name}}(ctx, rc.Operation.SelectionSet)
- {{- end }}
-
- var buf bytes.Buffer
- return func(ctx context.Context) *graphql.Response {
- buf.Reset()
- data := next(ctx)
-
- if data == nil {
- return nil
- }
- data.MarshalGQL(&buf)
-
- return &graphql.Response{
- Data: buf.Bytes(),
- }
- }
- {{ end }}
- default:
- return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation"))
- }
- }
-
- type executionContext struct {
- *graphql.OperationContext
- *executableSchema
- }
-
- func (ec *executionContext) introspectSchema() (*introspection.Schema, error) {
- if ec.DisableIntrospection {
- return nil, errors.New("introspection disabled")
- }
- return introspection.WrapSchema(parsedSchema), nil
- }
-
- func (ec *executionContext) introspectType(name string) (*introspection.Type, error) {
- if ec.DisableIntrospection {
- return nil, errors.New("introspection disabled")
- }
- return introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name]), nil
- }
-
- {{if .HasEmbeddableSources }}
- //go:embed{{- range $source := .AugmentedSources }}{{if $source.Embeddable}} {{$source.RelativePath|quote}}{{end}}{{- end }}
- var sourcesFS embed.FS
-
- func sourceData(filename string) string {
- data, err := sourcesFS.ReadFile(filename)
- if err != nil {
- panic(fmt.Sprintf("codegen problem: %s not available", filename))
- }
- return string(data)
- }
- {{- end }}
-
- var sources = []*ast.Source{
- {{- range $source := .AugmentedSources }}
- {Name: {{$source.RelativePath|quote}}, Input: {{if (not $source.Embeddable)}}{{$source.Source|rawQuote}}{{else}}sourceData({{$source.RelativePath|quote}}){{end}}, BuiltIn: {{$source.BuiltIn}}},
- {{- end }}
- }
- var parsedSchema = gqlparser.MustLoadSchema(sources...)
-{{ end }}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/input.gotpl b/vendor/github.com/99designs/gqlgen/codegen/input.gotpl
deleted file mode 100644
index 116fe9ce76..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/input.gotpl
+++ /dev/null
@@ -1,77 +0,0 @@
-{{- range $input := .Inputs }}
- {{- if not .HasUnmarshal }}
- func (ec *executionContext) unmarshalInput{{ .Name }}(ctx context.Context, obj interface{}) ({{.Type | ref}}, error) {
- var it {{.Type | ref}}
- asMap := map[string]interface{}{}
- for k, v := range obj.(map[string]interface{}) {
- asMap[k] = v
- }
- {{ range $field := .Fields}}
- {{- if notNil "Default" $field }}
- if _, present := asMap[{{$field.Name|quote}}] ; !present {
- asMap[{{$field.Name|quote}}] = {{ $field.Default | dump }}
- }
- {{- end}}
- {{- end }}
-
- fieldsInOrder := [...]string{ {{ range .Fields }}{{ quote .Name }},{{ end }} }
- for _, k := range fieldsInOrder {
- v, ok := asMap[k]
- if !ok {
- continue
- }
- switch k {
- {{- range $field := .Fields }}
- case {{$field.Name|quote}}:
- var err error
-
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField({{$field.Name|quote}}))
- {{- if $field.ImplDirectives }}
- directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $field.TypeReference.UnmarshalFunc }}(ctx, v) }
- {{ template "implDirectives" $field }}
- tmp, err := directive{{$field.ImplDirectives|len}}(ctx)
- if err != nil {
- return it, graphql.ErrorOnPath(ctx, err)
- }
- if data, ok := tmp.({{ $field.TypeReference.GO | ref }}) ; ok {
- {{- if $field.IsResolver }}
- if err = ec.resolvers.{{ $field.ShortInvocation }}; err != nil {
- return it, err
- }
- {{- else }}
- it.{{$field.GoFieldName}} = data
- {{- end }}
- {{- if $field.TypeReference.IsNilable }}
- {{- if not $field.IsResolver }}
- } else if tmp == nil {
- it.{{$field.GoFieldName}} = nil
- {{- end }}
- {{- end }}
- } else {
- err := fmt.Errorf(`unexpected type %T from directive, should be {{ $field.TypeReference.GO }}`, tmp)
- return it, graphql.ErrorOnPath(ctx, err)
- }
- {{- else }}
- {{- if $field.IsResolver }}
- data, err := ec.{{ $field.TypeReference.UnmarshalFunc }}(ctx, v)
- if err != nil {
- return it, err
- }
- if err = ec.resolvers.{{ $field.ShortInvocation }}; err != nil {
- return it, err
- }
- {{- else }}
- it.{{$field.GoFieldName}}, err = ec.{{ $field.TypeReference.UnmarshalFunc }}(ctx, v)
- if err != nil {
- return it, err
- }
- {{- end }}
- {{- end }}
- {{- end }}
- }
- }
-
- return it, nil
- }
- {{- end }}
-{{ end }}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/interface.go b/vendor/github.com/99designs/gqlgen/codegen/interface.go
deleted file mode 100644
index cdc4d4d32e..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/interface.go
+++ /dev/null
@@ -1,87 +0,0 @@
-package codegen
-
-import (
- "fmt"
- "go/types"
-
- "github.com/vektah/gqlparser/v2/ast"
-
- "github.com/99designs/gqlgen/codegen/config"
-)
-
-type Interface struct {
- *ast.Definition
- Type types.Type
- Implementors []InterfaceImplementor
- InTypemap bool
-}
-
-type InterfaceImplementor struct {
- *ast.Definition
-
- Type types.Type
- TakeRef bool
-}
-
-func (b *builder) buildInterface(typ *ast.Definition) (*Interface, error) {
- obj, err := b.Binder.DefaultUserObject(typ.Name)
- if err != nil {
- panic(err)
- }
-
- i := &Interface{
- Definition: typ,
- Type: obj,
- InTypemap: b.Config.Models.UserDefined(typ.Name),
- }
-
- interfaceType, err := findGoInterface(i.Type)
- if interfaceType == nil || err != nil {
- return nil, fmt.Errorf("%s is not an interface", i.Type)
- }
-
- for _, implementor := range b.Schema.GetPossibleTypes(typ) {
- obj, err := b.Binder.DefaultUserObject(implementor.Name)
- if err != nil {
- return nil, fmt.Errorf("%s has no backing go type", implementor.Name)
- }
-
- implementorType, err := findGoNamedType(obj)
- if err != nil {
- return nil, fmt.Errorf("can not find backing go type %s: %w", obj.String(), err)
- } else if implementorType == nil {
- return nil, fmt.Errorf("can not find backing go type %s", obj.String())
- }
-
- anyValid := false
-
- // first check if the value receiver can be nil, eg can we type switch on case Thing:
- if types.Implements(implementorType, interfaceType) {
- i.Implementors = append(i.Implementors, InterfaceImplementor{
- Definition: implementor,
- Type: obj,
- TakeRef: !types.IsInterface(obj),
- })
- anyValid = true
- }
-
- // then check if the pointer receiver can be nil, eg can we type switch on case *Thing:
- if types.Implements(types.NewPointer(implementorType), interfaceType) {
- i.Implementors = append(i.Implementors, InterfaceImplementor{
- Definition: implementor,
- Type: types.NewPointer(obj),
- })
- anyValid = true
- }
-
- if !anyValid {
- return nil, fmt.Errorf("%s does not satisfy the interface %s", implementorType.String(), i.Type.String())
- }
- }
-
- return i, nil
-}
-
-func (i *InterfaceImplementor) CanBeNil() bool {
- return config.IsNilable(i.Type)
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/interface.gotpl b/vendor/github.com/99designs/gqlgen/codegen/interface.gotpl
deleted file mode 100644
index e9d560c8f6..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/interface.gotpl
+++ /dev/null
@@ -1,21 +0,0 @@
-{{- range $interface := .Interfaces }}
-
-func (ec *executionContext) _{{$interface.Name}}(ctx context.Context, sel ast.SelectionSet, obj {{$interface.Type | ref}}) graphql.Marshaler {
- switch obj := (obj).(type) {
- case nil:
- return graphql.Null
- {{- range $implementor := $interface.Implementors }}
- case {{$implementor.Type | ref}}:
- {{- if $implementor.CanBeNil }}
- if obj == nil {
- return graphql.Null
- }
- {{- end }}
- return ec._{{$implementor.Name}}(ctx, sel, {{ if $implementor.TakeRef }}&{{ end }}obj)
- {{- end }}
- default:
- panic(fmt.Errorf("unexpected type %T", obj))
- }
-}
-
-{{- end }}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/object.go b/vendor/github.com/99designs/gqlgen/codegen/object.go
deleted file mode 100644
index a9cb34061b..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/object.go
+++ /dev/null
@@ -1,171 +0,0 @@
-package codegen
-
-import (
- "fmt"
- "go/types"
- "strconv"
- "strings"
- "unicode"
-
- "github.com/99designs/gqlgen/codegen/config"
- "github.com/vektah/gqlparser/v2/ast"
- "golang.org/x/text/cases"
- "golang.org/x/text/language"
-)
-
-type GoFieldType int
-
-const (
- GoFieldUndefined GoFieldType = iota
- GoFieldMethod
- GoFieldVariable
- GoFieldMap
-)
-
-type Object struct {
- *ast.Definition
-
- Type types.Type
- ResolverInterface types.Type
- Root bool
- Fields []*Field
- Implements []*ast.Definition
- DisableConcurrency bool
- Stream bool
- Directives []*Directive
-}
-
-func (b *builder) buildObject(typ *ast.Definition) (*Object, error) {
- dirs, err := b.getDirectives(typ.Directives)
- if err != nil {
- return nil, fmt.Errorf("%s: %w", typ.Name, err)
- }
- caser := cases.Title(language.English, cases.NoLower)
- obj := &Object{
- Definition: typ,
- Root: b.Schema.Query == typ || b.Schema.Mutation == typ || b.Schema.Subscription == typ,
- DisableConcurrency: typ == b.Schema.Mutation,
- Stream: typ == b.Schema.Subscription,
- Directives: dirs,
- ResolverInterface: types.NewNamed(
- types.NewTypeName(0, b.Config.Exec.Pkg(), caser.String(typ.Name)+"Resolver", nil),
- nil,
- nil,
- ),
- }
-
- if !obj.Root {
- goObject, err := b.Binder.DefaultUserObject(typ.Name)
- if err != nil {
- return nil, err
- }
- obj.Type = goObject
- }
-
- for _, intf := range b.Schema.GetImplements(typ) {
- obj.Implements = append(obj.Implements, b.Schema.Types[intf.Name])
- }
-
- for _, field := range typ.Fields {
- if strings.HasPrefix(field.Name, "__") {
- continue
- }
-
- var f *Field
- f, err = b.buildField(obj, field)
- if err != nil {
- return nil, err
- }
-
- obj.Fields = append(obj.Fields, f)
- }
-
- return obj, nil
-}
-
-func (o *Object) Reference() types.Type {
- if config.IsNilable(o.Type) {
- return o.Type
- }
- return types.NewPointer(o.Type)
-}
-
-type Objects []*Object
-
-func (o *Object) Implementors() string {
- satisfiedBy := strconv.Quote(o.Name)
- for _, s := range o.Implements {
- satisfiedBy += ", " + strconv.Quote(s.Name)
- }
- return "[]string{" + satisfiedBy + "}"
-}
-
-func (o *Object) HasResolvers() bool {
- for _, f := range o.Fields {
- if f.IsResolver {
- return true
- }
- }
- return false
-}
-
-func (o *Object) HasUnmarshal() bool {
- if o.Type == config.MapType {
- return true
- }
- for i := 0; i < o.Type.(*types.Named).NumMethods(); i++ {
- if o.Type.(*types.Named).Method(i).Name() == "UnmarshalGQL" {
- return true
- }
- }
- return false
-}
-
-func (o *Object) HasDirectives() bool {
- if len(o.Directives) > 0 {
- return true
- }
- for _, f := range o.Fields {
- if f.HasDirectives() {
- return true
- }
- }
-
- return false
-}
-
-func (o *Object) IsConcurrent() bool {
- for _, f := range o.Fields {
- if f.IsConcurrent() {
- return true
- }
- }
- return false
-}
-
-func (o *Object) IsReserved() bool {
- return strings.HasPrefix(o.Definition.Name, "__")
-}
-
-func (o *Object) Description() string {
- return o.Definition.Description
-}
-
-func (os Objects) ByName(name string) *Object {
- for i, o := range os {
- if strings.EqualFold(o.Definition.Name, name) {
- return os[i]
- }
- }
- return nil
-}
-
-func ucFirst(s string) string {
- if s == "" {
- return ""
- }
-
- r := []rune(s)
- r[0] = unicode.ToUpper(r[0])
- return string(r)
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/object.gotpl b/vendor/github.com/99designs/gqlgen/codegen/object.gotpl
deleted file mode 100644
index 1fbdfacec1..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/object.gotpl
+++ /dev/null
@@ -1,112 +0,0 @@
-{{- range $object := .Objects }}
-
-var {{ $object.Name|lcFirst}}Implementors = {{$object.Implementors}}
-
-{{- if .Stream }}
-func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.SelectionSet) func(ctx context.Context) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, {{$object.Name|lcFirst}}Implementors)
- ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{
- Object: {{$object.Name|quote}},
- })
- if len(fields) != 1 {
- ec.Errorf(ctx, "must subscribe to exactly one stream")
- return nil
- }
-
- switch fields[0].Name {
- {{- range $field := $object.Fields }}
- case "{{$field.Name}}":
- return ec._{{$object.Name}}_{{$field.Name}}(ctx, fields[0])
- {{- end }}
- default:
- panic("unknown field " + strconv.Quote(fields[0].Name))
- }
-}
-{{- else }}
-func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.SelectionSet{{ if not $object.Root }},obj {{$object.Reference | ref }}{{ end }}) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, {{$object.Name|lcFirst}}Implementors)
- {{- if $object.Root }}
- ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{
- Object: {{$object.Name|quote}},
- })
- {{end}}
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- {{- if $object.Root }}
- innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{
- Object: field.Name,
- Field: field,
- })
- {{end}}
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString({{$object.Name|quote}})
- {{- range $field := $object.Fields }}
- case "{{$field.Name}}":
- {{- if $field.IsConcurrent }}
- field := field
-
- innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._{{$object.Name}}_{{$field.Name}}(ctx, field{{if not $object.Root}}, obj{{end}})
- {{- if $field.TypeReference.GQL.NonNull }}
- if res == graphql.Null {
- {{- if $object.IsConcurrent }}
- atomic.AddUint32(&invalids, 1)
- {{- else }}
- invalids++
- {{- end }}
- }
- {{- end }}
- return res
- }
-
- {{if $object.Root}}
- rrm := func(ctx context.Context) graphql.Marshaler {
- return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
- }
- {{end}}
-
- out.Concurrently(i, func() graphql.Marshaler {
- {{- if $object.Root -}}
- return rrm(innerCtx)
- {{- else -}}
- return innerFunc(ctx)
- {{end}}
- })
- {{- else }}
- {{if $object.Root}}
- out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._{{$object.Name}}_{{$field.Name}}(ctx, field)
- })
- {{else}}
- out.Values[i] = ec._{{$object.Name}}_{{$field.Name}}(ctx, field, obj)
- {{end}}
-
- {{- if $field.TypeReference.GQL.NonNull }}
- if out.Values[i] == graphql.Null {
- {{- if $object.IsConcurrent }}
- atomic.AddUint32(&invalids, 1)
- {{- else }}
- invalids++
- {{- end }}
- }
- {{- end }}
- {{- end }}
- {{- end }}
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 { return graphql.Null }
- return out
-}
-{{- end }}
-
-{{- end }}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/root_.gotpl b/vendor/github.com/99designs/gqlgen/codegen/root_.gotpl
deleted file mode 100644
index 2f2a98262e..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/root_.gotpl
+++ /dev/null
@@ -1,230 +0,0 @@
-{{ reserveImport "context" }}
-{{ reserveImport "fmt" }}
-{{ reserveImport "io" }}
-{{ reserveImport "strconv" }}
-{{ reserveImport "time" }}
-{{ reserveImport "sync" }}
-{{ reserveImport "sync/atomic" }}
-{{ reserveImport "errors" }}
-{{ reserveImport "bytes" }}
-{{ reserveImport "embed" }}
-
-{{ reserveImport "github.com/vektah/gqlparser/v2" "gqlparser" }}
-{{ reserveImport "github.com/vektah/gqlparser/v2/ast" }}
-{{ reserveImport "github.com/99designs/gqlgen/graphql" }}
-{{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }}
-
-// NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.
-func NewExecutableSchema(cfg Config) graphql.ExecutableSchema {
- return &executableSchema{
- resolvers: cfg.Resolvers,
- directives: cfg.Directives,
- complexity: cfg.Complexity,
- }
-}
-
-type Config struct {
- Resolvers ResolverRoot
- Directives DirectiveRoot
- Complexity ComplexityRoot
-}
-
-type ResolverRoot interface {
-{{- range $object := .Objects -}}
- {{ if $object.HasResolvers -}}
- {{ucFirst $object.Name}}() {{ucFirst $object.Name}}Resolver
- {{ end }}
-{{- end }}
-{{- range $object := .Inputs -}}
- {{ if $object.HasResolvers -}}
- {{ucFirst $object.Name}}() {{ucFirst $object.Name}}Resolver
- {{ end }}
-{{- end }}
-}
-
-type DirectiveRoot struct {
-{{ range $directive := .Directives }}
- {{- $directive.Declaration }}
-{{ end }}
-}
-
-type ComplexityRoot struct {
-{{ range $object := .Objects }}
- {{ if not $object.IsReserved -}}
- {{ ucFirst $object.Name }} struct {
- {{ range $_, $fields := $object.UniqueFields }}
- {{- $field := index $fields 0 -}}
- {{ if not $field.IsReserved -}}
- {{ $field.GoFieldName }} {{ $field.ComplexitySignature }}
- {{ end }}
- {{- end }}
- }
- {{- end }}
-{{ end }}
-}
-
-type executableSchema struct {
- resolvers ResolverRoot
- directives DirectiveRoot
- complexity ComplexityRoot
-}
-
-func (e *executableSchema) Schema() *ast.Schema {
- return parsedSchema
-}
-
-func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) {
- ec := executionContext{nil, e}
- _ = ec
- switch typeName + "." + field {
- {{ range $object := .Objects }}
- {{ if not $object.IsReserved }}
- {{ range $_, $fields := $object.UniqueFields }}
- {{- $len := len $fields }}
- {{- range $i, $field := $fields }}
- {{- $last := eq (add $i 1) $len }}
- {{- if not $field.IsReserved }}
- {{- if eq $i 0 }}case {{ end }}"{{$object.Name}}.{{$field.Name}}"{{ if not $last }},{{ else }}:
- if e.complexity.{{ucFirst $object.Name }}.{{$field.GoFieldName}} == nil {
- break
- }
- {{ if $field.Args }}
- args, err := ec.{{ $field.ArgsFunc }}(context.TODO(),rawArgs)
- if err != nil {
- return 0, false
- }
- {{ end }}
- return e.complexity.{{ucFirst $object.Name}}.{{$field.GoFieldName}}(childComplexity{{if $field.Args}}, {{$field.ComplexityArgs}} {{ end }}), true
- {{ end }}
- {{- end }}
- {{- end }}
- {{ end }}
- {{ end }}
- {{ end }}
- }
- return 0, false
-}
-
-func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler {
- rc := graphql.GetOperationContext(ctx)
- ec := executionContext{rc, e}
- inputUnmarshalMap := graphql.BuildUnmarshalerMap(
- {{- range $input := .Inputs -}}
- {{ if not $input.HasUnmarshal }}
- ec.unmarshalInput{{ $input.Name }},
- {{- end }}
- {{- end }}
- )
- first := true
-
- switch rc.Operation.Operation {
- {{- if .QueryRoot }} case ast.Query:
- return func(ctx context.Context) *graphql.Response {
- if !first { return nil }
- first = false
- ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap)
- {{ if .Directives.LocationDirectives "QUERY" -}}
- data := ec._queryMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){
- return ec._{{.QueryRoot.Name}}(ctx, rc.Operation.SelectionSet), nil
- })
- {{- else -}}
- data := ec._{{.QueryRoot.Name}}(ctx, rc.Operation.SelectionSet)
- {{- end }}
- var buf bytes.Buffer
- data.MarshalGQL(&buf)
-
- return &graphql.Response{
- Data: buf.Bytes(),
- }
- }
- {{ end }}
-
- {{- if .MutationRoot }} case ast.Mutation:
- return func(ctx context.Context) *graphql.Response {
- if !first { return nil }
- first = false
- ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap)
- {{ if .Directives.LocationDirectives "MUTATION" -}}
- data := ec._mutationMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){
- return ec._{{.MutationRoot.Name}}(ctx, rc.Operation.SelectionSet), nil
- })
- {{- else -}}
- data := ec._{{.MutationRoot.Name}}(ctx, rc.Operation.SelectionSet)
- {{- end }}
- var buf bytes.Buffer
- data.MarshalGQL(&buf)
-
- return &graphql.Response{
- Data: buf.Bytes(),
- }
- }
- {{ end }}
-
- {{- if .SubscriptionRoot }} case ast.Subscription:
- {{ if .Directives.LocationDirectives "SUBSCRIPTION" -}}
- next := ec._subscriptionMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){
- return ec._{{.SubscriptionRoot.Name}}(ctx, rc.Operation.SelectionSet),nil
- })
- {{- else -}}
- next := ec._{{.SubscriptionRoot.Name}}(ctx, rc.Operation.SelectionSet)
- {{- end }}
-
- var buf bytes.Buffer
- return func(ctx context.Context) *graphql.Response {
- buf.Reset()
- data := next(ctx)
-
- if data == nil {
- return nil
- }
- data.MarshalGQL(&buf)
-
- return &graphql.Response{
- Data: buf.Bytes(),
- }
- }
- {{ end }}
- default:
- return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation"))
- }
-}
-
-type executionContext struct {
- *graphql.OperationContext
- *executableSchema
-}
-
-func (ec *executionContext) introspectSchema() (*introspection.Schema, error) {
- if ec.DisableIntrospection {
- return nil, errors.New("introspection disabled")
- }
- return introspection.WrapSchema(parsedSchema), nil
-}
-
-func (ec *executionContext) introspectType(name string) (*introspection.Type, error) {
- if ec.DisableIntrospection {
- return nil, errors.New("introspection disabled")
- }
- return introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name]), nil
-}
-
-
-{{if .HasEmbeddableSources }}
-//go:embed{{- range $source := .AugmentedSources }}{{if $source.Embeddable}} {{$source.RelativePath|quote}}{{end}}{{- end }}
-var sourcesFS embed.FS
-
-func sourceData(filename string) string {
- data, err := sourcesFS.ReadFile(filename)
- if err != nil {
- panic(fmt.Sprintf("codegen problem: %s not available", filename))
- }
- return string(data)
-}
-{{- end}}
-
-var sources = []*ast.Source{
-{{- range $source := .AugmentedSources }}
- {Name: {{$source.RelativePath|quote}}, Input: {{if (not $source.Embeddable)}}{{$source.Source|rawQuote}}{{else}}sourceData({{$source.RelativePath|quote}}){{end}}, BuiltIn: {{$source.BuiltIn}}},
-{{- end }}
-}
-var parsedSchema = gqlparser.MustLoadSchema(sources...)
diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/import.go b/vendor/github.com/99designs/gqlgen/codegen/templates/import.go
deleted file mode 100644
index 00a82ea5ef..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/templates/import.go
+++ /dev/null
@@ -1,139 +0,0 @@
-package templates
-
-import (
- "fmt"
- "go/types"
- "strconv"
- "strings"
-
- "github.com/99designs/gqlgen/internal/code"
-)
-
-type Import struct {
- Name string
- Path string
- Alias string
-}
-
-type Imports struct {
- imports []*Import
- destDir string
- packages *code.Packages
-}
-
-func (i *Import) String() string {
- if strings.HasSuffix(i.Path, i.Alias) {
- return strconv.Quote(i.Path)
- }
-
- return i.Alias + " " + strconv.Quote(i.Path)
-}
-
-func (s *Imports) String() string {
- res := ""
- for i, imp := range s.imports {
- if i != 0 {
- res += "\n"
- }
- res += imp.String()
- }
- return res
-}
-
-func (s *Imports) Reserve(path string, aliases ...string) (string, error) {
- if path == "" {
- panic("empty ambient import")
- }
-
- // if we are referencing our own package we dont need an import
- if code.ImportPathForDir(s.destDir) == path {
- return "", nil
- }
-
- name := s.packages.NameForPackage(path)
- var alias string
- if len(aliases) != 1 {
- alias = name
- } else {
- alias = aliases[0]
- }
-
- if existing := s.findByPath(path); existing != nil {
- if existing.Alias == alias {
- return "", nil
- }
- return "", fmt.Errorf("ambient import already exists")
- }
-
- if alias := s.findByAlias(alias); alias != nil {
- return "", fmt.Errorf("ambient import collides on an alias")
- }
-
- s.imports = append(s.imports, &Import{
- Name: name,
- Path: path,
- Alias: alias,
- })
-
- return "", nil
-}
-
-func (s *Imports) Lookup(path string) string {
- if path == "" {
- return ""
- }
-
- path = code.NormalizeVendor(path)
-
- // if we are referencing our own package we dont need an import
- if code.ImportPathForDir(s.destDir) == path {
- return ""
- }
-
- if existing := s.findByPath(path); existing != nil {
- return existing.Alias
- }
-
- imp := &Import{
- Name: s.packages.NameForPackage(path),
- Path: path,
- }
- s.imports = append(s.imports, imp)
-
- alias := imp.Name
- i := 1
- for s.findByAlias(alias) != nil {
- alias = imp.Name + strconv.Itoa(i)
- i++
- if i > 1000 {
- panic(fmt.Errorf("too many collisions, last attempt was %s", alias))
- }
- }
- imp.Alias = alias
-
- return imp.Alias
-}
-
-func (s *Imports) LookupType(t types.Type) string {
- return types.TypeString(t, func(i *types.Package) string {
- return s.Lookup(i.Path())
- })
-}
-
-func (s Imports) findByPath(importPath string) *Import {
- for _, imp := range s.imports {
- if imp.Path == importPath {
- return imp
- }
- }
- return nil
-}
-
-func (s Imports) findByAlias(alias string) *Import {
- for _, imp := range s.imports {
- if imp.Alias == alias {
- return imp
- }
- }
- return nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/templates.go b/vendor/github.com/99designs/gqlgen/codegen/templates/templates.go
deleted file mode 100644
index 159df77c9c..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/templates/templates.go
+++ /dev/null
@@ -1,740 +0,0 @@
-package templates
-
-import (
- "bytes"
- "fmt"
- "go/types"
- "io/fs"
- "os"
- "path/filepath"
- "reflect"
- "regexp"
- "runtime"
- "sort"
- "strconv"
- "strings"
- "sync"
- "text/template"
- "unicode"
-
- "github.com/99designs/gqlgen/internal/code"
-
- "github.com/99designs/gqlgen/internal/imports"
-)
-
-// CurrentImports keeps track of all the import declarations that are needed during the execution of a plugin.
-// this is done with a global because subtemplates currently get called in functions. Lets aim to remove this eventually.
-var CurrentImports *Imports
-
-// Options specify various parameters to rendering a template.
-type Options struct {
- // PackageName is a helper that specifies the package header declaration.
- // In other words, when you write the template you don't need to specify `package X`
- // at the top of the file. By providing PackageName in the Options, the Render
- // function will do that for you.
- PackageName string
- // Template is a string of the entire template that
- // will be parsed and rendered. If it's empty,
- // the plugin processor will look for .gotpl files
- // in the same directory of where you wrote the plugin.
- Template string
-
- // Use the go:embed API to collect all the template files you want to pass into Render
- // this is an alternative to passing the Template option
- TemplateFS fs.FS
-
- // Filename is the name of the file that will be
- // written to the system disk once the template is rendered.
- Filename string
- RegionTags bool
- GeneratedHeader bool
- // PackageDoc is documentation written above the package line
- PackageDoc string
- // FileNotice is notice written below the package line
- FileNotice string
- // Data will be passed to the template execution.
- Data interface{}
- Funcs template.FuncMap
-
- // Packages cache, you can find me on config.Config
- Packages *code.Packages
-}
-
-var (
- modelNamesMu sync.Mutex
- modelNames = make(map[string]string, 0)
- goNameRe = regexp.MustCompile("[^a-zA-Z0-9_]")
-)
-
-// Render renders a gql plugin template from the given Options. Render is an
-// abstraction of the text/template package that makes it easier to write gqlgen
-// plugins. If Options.Template is empty, the Render function will look for `.gotpl`
-// files inside the directory where you wrote the plugin.
-func Render(cfg Options) error {
- if CurrentImports != nil {
- panic(fmt.Errorf("recursive or concurrent call to RenderToFile detected"))
- }
- CurrentImports = &Imports{packages: cfg.Packages, destDir: filepath.Dir(cfg.Filename)}
-
- funcs := Funcs()
- for n, f := range cfg.Funcs {
- funcs[n] = f
- }
-
- t := template.New("").Funcs(funcs)
- t, err := parseTemplates(cfg, t)
- if err != nil {
- return err
- }
-
- roots := make([]string, 0, len(t.Templates()))
- for _, template := range t.Templates() {
- // templates that end with _.gotpl are special files we don't want to include
- if strings.HasSuffix(template.Name(), "_.gotpl") ||
- // filter out templates added with {{ template xxx }} syntax inside the template file
- !strings.HasSuffix(template.Name(), ".gotpl") {
- continue
- }
-
- roots = append(roots, template.Name())
- }
-
- // then execute all the important looking ones in order, adding them to the same file
- sort.Slice(roots, func(i, j int) bool {
- // important files go first
- if strings.HasSuffix(roots[i], "!.gotpl") {
- return true
- }
- if strings.HasSuffix(roots[j], "!.gotpl") {
- return false
- }
- return roots[i] < roots[j]
- })
-
- var buf bytes.Buffer
- for _, root := range roots {
- if cfg.RegionTags {
- buf.WriteString("\n// region " + center(70, "*", " "+root+" ") + "\n")
- }
- err := t.Lookup(root).Execute(&buf, cfg.Data)
- if err != nil {
- return fmt.Errorf("%s: %w", root, err)
- }
- if cfg.RegionTags {
- buf.WriteString("\n// endregion " + center(70, "*", " "+root+" ") + "\n")
- }
- }
-
- var result bytes.Buffer
- if cfg.GeneratedHeader {
- result.WriteString("// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.\n\n")
- }
- if cfg.PackageDoc != "" {
- result.WriteString(cfg.PackageDoc + "\n")
- }
- result.WriteString("package ")
- result.WriteString(cfg.PackageName)
- result.WriteString("\n\n")
- if cfg.FileNotice != "" {
- result.WriteString(cfg.FileNotice)
- result.WriteString("\n\n")
- }
- result.WriteString("import (\n")
- result.WriteString(CurrentImports.String())
- result.WriteString(")\n")
- _, err = buf.WriteTo(&result)
- if err != nil {
- return err
- }
- CurrentImports = nil
-
- err = write(cfg.Filename, result.Bytes(), cfg.Packages)
- if err != nil {
- return err
- }
-
- cfg.Packages.Evict(code.ImportPathForDir(filepath.Dir(cfg.Filename)))
- return nil
-}
-
-func parseTemplates(cfg Options, t *template.Template) (*template.Template, error) {
- if cfg.Template != "" {
- var err error
- t, err = t.New("template.gotpl").Parse(cfg.Template)
- if err != nil {
- return nil, fmt.Errorf("error with provided template: %w", err)
- }
- return t, nil
- }
-
- var fileSystem fs.FS
- if cfg.TemplateFS != nil {
- fileSystem = cfg.TemplateFS
- } else {
- // load path relative to calling source file
- _, callerFile, _, _ := runtime.Caller(1)
- rootDir := filepath.Dir(callerFile)
- fileSystem = os.DirFS(rootDir)
- }
-
- t, err := t.ParseFS(fileSystem, "*.gotpl")
- if err != nil {
- return nil, fmt.Errorf("locating templates: %w", err)
- }
-
- return t, nil
-}
-
-func center(width int, pad string, s string) string {
- if len(s)+2 > width {
- return s
- }
- lpad := (width - len(s)) / 2
- rpad := width - (lpad + len(s))
- return strings.Repeat(pad, lpad) + s + strings.Repeat(pad, rpad)
-}
-
-func Funcs() template.FuncMap {
- return template.FuncMap{
- "ucFirst": UcFirst,
- "lcFirst": LcFirst,
- "quote": strconv.Quote,
- "rawQuote": rawQuote,
- "dump": Dump,
- "ref": ref,
- "ts": TypeIdentifier,
- "call": Call,
- "prefixLines": prefixLines,
- "notNil": notNil,
- "reserveImport": CurrentImports.Reserve,
- "lookupImport": CurrentImports.Lookup,
- "go": ToGo,
- "goPrivate": ToGoPrivate,
- "goModelName": ToGoModelName,
- "goPrivateModelName": ToGoPrivateModelName,
- "add": func(a, b int) int {
- return a + b
- },
- "render": func(filename string, tpldata interface{}) (*bytes.Buffer, error) {
- return render(resolveName(filename, 0), tpldata)
- },
- }
-}
-
-func UcFirst(s string) string {
- if s == "" {
- return ""
- }
- r := []rune(s)
- r[0] = unicode.ToUpper(r[0])
- return string(r)
-}
-
-func LcFirst(s string) string {
- if s == "" {
- return ""
- }
-
- r := []rune(s)
- r[0] = unicode.ToLower(r[0])
- return string(r)
-}
-
-func isDelimiter(c rune) bool {
- return c == '-' || c == '_' || unicode.IsSpace(c)
-}
-
-func ref(p types.Type) string {
- return CurrentImports.LookupType(p)
-}
-
-var pkgReplacer = strings.NewReplacer(
- "/", "ᚋ",
- ".", "ᚗ",
- "-", "ᚑ",
- "~", "א",
-)
-
-func TypeIdentifier(t types.Type) string {
- res := ""
- for {
- switch it := t.(type) {
- case *types.Pointer:
- t.Underlying()
- res += "ᚖ"
- t = it.Elem()
- case *types.Slice:
- res += "ᚕ"
- t = it.Elem()
- case *types.Named:
- res += pkgReplacer.Replace(it.Obj().Pkg().Path())
- res += "ᚐ"
- res += it.Obj().Name()
- return res
- case *types.Basic:
- res += it.Name()
- return res
- case *types.Map:
- res += "map"
- return res
- case *types.Interface:
- res += "interface"
- return res
- default:
- panic(fmt.Errorf("unexpected type %T", it))
- }
- }
-}
-
-func Call(p *types.Func) string {
- pkg := CurrentImports.Lookup(p.Pkg().Path())
-
- if pkg != "" {
- pkg += "."
- }
-
- if p.Type() != nil {
- // make sure the returned type is listed in our imports.
- ref(p.Type().(*types.Signature).Results().At(0).Type())
- }
-
- return pkg + p.Name()
-}
-
-func resetModelNames() {
- modelNamesMu.Lock()
- defer modelNamesMu.Unlock()
- modelNames = make(map[string]string, 0)
-}
-
-func buildGoModelNameKey(parts []string) string {
- const sep = ":"
- return strings.Join(parts, sep)
-}
-
-func goModelName(primaryToGoFunc func(string) string, parts []string) string {
- modelNamesMu.Lock()
- defer modelNamesMu.Unlock()
-
- var (
- goNameKey string
- partLen int
-
- nameExists = func(n string) bool {
- for _, v := range modelNames {
- if n == v {
- return true
- }
- }
- return false
- }
-
- applyToGoFunc = func(parts []string) string {
- var out string
- switch len(parts) {
- case 0:
- return ""
- case 1:
- return primaryToGoFunc(parts[0])
- default:
- out = primaryToGoFunc(parts[0])
- }
- for _, p := range parts[1:] {
- out = fmt.Sprintf("%s%s", out, ToGo(p))
- }
- return out
- }
-
- applyValidGoName = func(parts []string) string {
- var out string
- for _, p := range parts {
- out = fmt.Sprintf("%s%s", out, replaceInvalidCharacters(p))
- }
- return out
- }
- )
-
- // build key for this entity
- goNameKey = buildGoModelNameKey(parts)
-
- // determine if we've seen this entity before, and reuse if so
- if goName, ok := modelNames[goNameKey]; ok {
- return goName
- }
-
- // attempt first pass
- if goName := applyToGoFunc(parts); !nameExists(goName) {
- modelNames[goNameKey] = goName
- return goName
- }
-
- // determine number of parts
- partLen = len(parts)
-
- // if there is only 1 part, append incrementing number until no conflict
- if partLen == 1 {
- base := applyToGoFunc(parts)
- for i := 0; ; i++ {
- tmp := fmt.Sprintf("%s%d", base, i)
- if !nameExists(tmp) {
- modelNames[goNameKey] = tmp
- return tmp
- }
- }
- }
-
- // best effort "pretty" name
- for i := partLen - 1; i >= 1; i-- {
- tmp := fmt.Sprintf("%s%s", applyToGoFunc(parts[0:i]), applyValidGoName(parts[i:]))
- if !nameExists(tmp) {
- modelNames[goNameKey] = tmp
- return tmp
- }
- }
-
- // finally, fallback to just adding an incrementing number
- base := applyToGoFunc(parts)
- for i := 0; ; i++ {
- tmp := fmt.Sprintf("%s%d", base, i)
- if !nameExists(tmp) {
- modelNames[goNameKey] = tmp
- return tmp
- }
- }
-}
-
-func ToGoModelName(parts ...string) string {
- return goModelName(ToGo, parts)
-}
-
-func ToGoPrivateModelName(parts ...string) string {
- return goModelName(ToGoPrivate, parts)
-}
-
-func replaceInvalidCharacters(in string) string {
- return goNameRe.ReplaceAllLiteralString(in, "_")
-}
-
-func wordWalkerFunc(private bool, nameRunes *[]rune) func(*wordInfo) {
- return func(info *wordInfo) {
- word := info.Word
-
- switch {
- case private && info.WordOffset == 0:
- if strings.ToUpper(word) == word || strings.ToLower(word) == word {
- // ID → id, CAMEL → camel
- word = strings.ToLower(info.Word)
- } else {
- // ITicket → iTicket
- word = LcFirst(info.Word)
- }
-
- case info.MatchCommonInitial:
- word = strings.ToUpper(word)
-
- case !info.HasCommonInitial && (strings.ToUpper(word) == word || strings.ToLower(word) == word):
- // FOO or foo → Foo
- // FOo → FOo
- word = UcFirst(strings.ToLower(word))
- }
-
- *nameRunes = append(*nameRunes, []rune(word)...)
- }
-}
-
-func ToGo(name string) string {
- if name == "_" {
- return "_"
- }
- runes := make([]rune, 0, len(name))
-
- wordWalker(name, wordWalkerFunc(false, &runes))
-
- return string(runes)
-}
-
-func ToGoPrivate(name string) string {
- if name == "_" {
- return "_"
- }
- runes := make([]rune, 0, len(name))
-
- wordWalker(name, wordWalkerFunc(true, &runes))
-
- return sanitizeKeywords(string(runes))
-}
-
-type wordInfo struct {
- WordOffset int
- Word string
- MatchCommonInitial bool
- HasCommonInitial bool
-}
-
-// This function is based on the following code.
-// https://github.com/golang/lint/blob/06c8688daad7faa9da5a0c2f163a3d14aac986ca/lint.go#L679
-func wordWalker(str string, f func(*wordInfo)) {
- runes := []rune(strings.TrimFunc(str, isDelimiter))
- w, i, wo := 0, 0, 0 // index of start of word, scan, word offset
- hasCommonInitial := false
- for i+1 <= len(runes) {
- eow := false // whether we hit the end of a word
- switch {
- case i+1 == len(runes):
- eow = true
- case isDelimiter(runes[i+1]):
- // underscore; shift the remainder forward over any run of underscores
- eow = true
- n := 1
- for i+n+1 < len(runes) && isDelimiter(runes[i+n+1]) {
- n++
- }
-
- // Leave at most one underscore if the underscore is between two digits
- if i+n+1 < len(runes) && unicode.IsDigit(runes[i]) && unicode.IsDigit(runes[i+n+1]) {
- n--
- }
-
- copy(runes[i+1:], runes[i+n+1:])
- runes = runes[:len(runes)-n]
- case unicode.IsLower(runes[i]) && !unicode.IsLower(runes[i+1]):
- // lower->non-lower
- eow = true
- }
- i++
-
- // [w,i) is a word.
- word := string(runes[w:i])
- if !eow && commonInitialisms[word] && !unicode.IsLower(runes[i]) {
- // through
- // split IDFoo → ID, Foo
- // but URLs → URLs
- } else if !eow {
- if commonInitialisms[word] {
- hasCommonInitial = true
- }
- continue
- }
-
- matchCommonInitial := false
- if commonInitialisms[strings.ToUpper(word)] {
- hasCommonInitial = true
- matchCommonInitial = true
- }
-
- f(&wordInfo{
- WordOffset: wo,
- Word: word,
- MatchCommonInitial: matchCommonInitial,
- HasCommonInitial: hasCommonInitial,
- })
- hasCommonInitial = false
- w = i
- wo++
- }
-}
-
-var keywords = []string{
- "break",
- "default",
- "func",
- "interface",
- "select",
- "case",
- "defer",
- "go",
- "map",
- "struct",
- "chan",
- "else",
- "goto",
- "package",
- "switch",
- "const",
- "fallthrough",
- "if",
- "range",
- "type",
- "continue",
- "for",
- "import",
- "return",
- "var",
- "_",
-}
-
-// sanitizeKeywords prevents collisions with go keywords for arguments to resolver functions
-func sanitizeKeywords(name string) string {
- for _, k := range keywords {
- if name == k {
- return name + "Arg"
- }
- }
- return name
-}
-
-// commonInitialisms is a set of common initialisms.
-// Only add entries that are highly unlikely to be non-initialisms.
-// For instance, "ID" is fine (Freudian code is rare), but "AND" is not.
-var commonInitialisms = map[string]bool{
- "ACL": true,
- "API": true,
- "ASCII": true,
- "CPU": true,
- "CSS": true,
- "CSV": true,
- "DNS": true,
- "EOF": true,
- "GUID": true,
- "HTML": true,
- "HTTP": true,
- "HTTPS": true,
- "ICMP": true,
- "ID": true,
- "IP": true,
- "JSON": true,
- "KVK": true,
- "LHS": true,
- "PDF": true,
- "PGP": true,
- "QPS": true,
- "QR": true,
- "RAM": true,
- "RHS": true,
- "RPC": true,
- "SLA": true,
- "SMTP": true,
- "SQL": true,
- "SSH": true,
- "SVG": true,
- "TCP": true,
- "TLS": true,
- "TTL": true,
- "UDP": true,
- "UI": true,
- "UID": true,
- "URI": true,
- "URL": true,
- "UTF8": true,
- "UUID": true,
- "VM": true,
- "XML": true,
- "XMPP": true,
- "XSRF": true,
- "XSS": true,
-}
-
-func rawQuote(s string) string {
- return "`" + strings.ReplaceAll(s, "`", "`+\"`\"+`") + "`"
-}
-
-func notNil(field string, data interface{}) bool {
- v := reflect.ValueOf(data)
-
- if v.Kind() == reflect.Ptr {
- v = v.Elem()
- }
- if v.Kind() != reflect.Struct {
- return false
- }
- val := v.FieldByName(field)
-
- return val.IsValid() && !val.IsNil()
-}
-
-func Dump(val interface{}) string {
- switch val := val.(type) {
- case int:
- return strconv.Itoa(val)
- case int64:
- return fmt.Sprintf("%d", val)
- case float64:
- return fmt.Sprintf("%f", val)
- case string:
- return strconv.Quote(val)
- case bool:
- return strconv.FormatBool(val)
- case nil:
- return "nil"
- case []interface{}:
- var parts []string
- for _, part := range val {
- parts = append(parts, Dump(part))
- }
- return "[]interface{}{" + strings.Join(parts, ",") + "}"
- case map[string]interface{}:
- buf := bytes.Buffer{}
- buf.WriteString("map[string]interface{}{")
- var keys []string
- for key := range val {
- keys = append(keys, key)
- }
- sort.Strings(keys)
-
- for _, key := range keys {
- data := val[key]
-
- buf.WriteString(strconv.Quote(key))
- buf.WriteString(":")
- buf.WriteString(Dump(data))
- buf.WriteString(",")
- }
- buf.WriteString("}")
- return buf.String()
- default:
- panic(fmt.Errorf("unsupported type %T", val))
- }
-}
-
-func prefixLines(prefix, s string) string {
- return prefix + strings.ReplaceAll(s, "\n", "\n"+prefix)
-}
-
-func resolveName(name string, skip int) string {
- if name[0] == '.' {
- // load path relative to calling source file
- _, callerFile, _, _ := runtime.Caller(skip + 1)
- return filepath.Join(filepath.Dir(callerFile), name[1:])
- }
-
- // load path relative to this directory
- _, callerFile, _, _ := runtime.Caller(0)
- return filepath.Join(filepath.Dir(callerFile), name)
-}
-
-func render(filename string, tpldata interface{}) (*bytes.Buffer, error) {
- t := template.New("").Funcs(Funcs())
-
- b, err := os.ReadFile(filename)
- if err != nil {
- return nil, err
- }
-
- t, err = t.New(filepath.Base(filename)).Parse(string(b))
- if err != nil {
- panic(err)
- }
-
- buf := &bytes.Buffer{}
- return buf, t.Execute(buf, tpldata)
-}
-
-func write(filename string, b []byte, packages *code.Packages) error {
- err := os.MkdirAll(filepath.Dir(filename), 0o755)
- if err != nil {
- return fmt.Errorf("failed to create directory: %w", err)
- }
-
- formatted, err := imports.Prune(filename, b, packages)
- if err != nil {
- fmt.Fprintf(os.Stderr, "gofmt failed on %s: %s\n", filepath.Base(filename), err.Error())
- formatted = b
- }
-
- err = os.WriteFile(filename, formatted, 0o644)
- if err != nil {
- return fmt.Errorf("failed to write %s: %w", filename, err)
- }
-
- return nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/test.gotpl b/vendor/github.com/99designs/gqlgen/codegen/templates/test.gotpl
deleted file mode 100644
index 07b8462a6a..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/templates/test.gotpl
+++ /dev/null
@@ -1 +0,0 @@
-this is my test package
diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/test_.gotpl b/vendor/github.com/99designs/gqlgen/codegen/templates/test_.gotpl
deleted file mode 100644
index c74258f3e1..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/templates/test_.gotpl
+++ /dev/null
@@ -1 +0,0 @@
-this will not be included
diff --git a/vendor/github.com/99designs/gqlgen/codegen/type.go b/vendor/github.com/99designs/gqlgen/codegen/type.go
deleted file mode 100644
index 20b09dc975..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/type.go
+++ /dev/null
@@ -1,32 +0,0 @@
-package codegen
-
-import (
- "fmt"
-
- "github.com/99designs/gqlgen/codegen/config"
-)
-
-func (b *builder) buildTypes() map[string]*config.TypeReference {
- ret := map[string]*config.TypeReference{}
- for _, ref := range b.Binder.References {
- processType(ret, ref)
- }
- return ret
-}
-
-func processType(ret map[string]*config.TypeReference, ref *config.TypeReference) {
- key := ref.UniquenessKey()
- if existing, found := ret[key]; found {
- // Simplistic check of content which is obviously different.
- existingGQL := fmt.Sprintf("%v", existing.GQL)
- newGQL := fmt.Sprintf("%v", ref.GQL)
- if existingGQL != newGQL {
- panic(fmt.Sprintf("non-unique key \"%s\", trying to replace %s with %s", key, existingGQL, newGQL))
- }
- }
- ret[key] = ref
-
- if ref.IsSlice() || ref.IsPtrToSlice() || ref.IsPtrToPtr() {
- processType(ret, ref.Elem())
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/type.gotpl b/vendor/github.com/99designs/gqlgen/codegen/type.gotpl
deleted file mode 100644
index d5c3919588..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/type.gotpl
+++ /dev/null
@@ -1,192 +0,0 @@
-{{- range $type := .ReferencedTypes }}
- {{ with $type.UnmarshalFunc }}
- func (ec *executionContext) {{ . }}(ctx context.Context, v interface{}) ({{ $type.GO | ref }}, error) {
- {{- if and $type.IsNilable (not $type.GQL.NonNull) (not $type.IsPtrToPtr) }}
- if v == nil { return nil, nil }
- {{- end }}
- {{- if $type.IsPtrToSlice }}
- res, err := ec.{{ $type.Elem.UnmarshalFunc }}(ctx, v)
- return &res, graphql.ErrorOnPath(ctx, err)
- {{- else if $type.IsSlice }}
- var vSlice []interface{}
- if v != nil {
- vSlice = graphql.CoerceList(v)
- }
- var err error
- res := make([]{{$type.GO.Elem | ref}}, len(vSlice))
- for i := range vSlice {
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
- res[i], err = ec.{{ $type.Elem.UnmarshalFunc }}(ctx, vSlice[i])
- if err != nil {
- return nil, err
- }
- }
- return res, nil
- {{- else if and $type.IsPtrToPtr (not $type.Unmarshaler) (not $type.IsMarshaler) }}
- var pres {{ $type.Elem.GO | ref }}
- if v != nil {
- res, err := ec.{{ $type.Elem.UnmarshalFunc }}(ctx, v)
- if err != nil {
- return nil, graphql.ErrorOnPath(ctx, err)
- }
- pres = res
- }
- return &pres, nil
- {{- else }}
- {{- if $type.Unmarshaler }}
- {{- if $type.CastType }}
- {{- if $type.IsContext }}
- tmp, err := {{ $type.Unmarshaler | call }}(ctx, v)
- {{- else }}
- tmp, err := {{ $type.Unmarshaler | call }}(v)
- {{- end }}
- {{- if and $type.IsNilable $type.Elem }}
- res := {{ $type.Elem.GO | ref }}(tmp)
- {{- else}}
- res := {{ $type.GO | ref }}(tmp)
- {{- end }}
- {{- else}}
- {{- if $type.IsContext }}
- res, err := {{ $type.Unmarshaler | call }}(ctx, v)
- {{- else }}
- res, err := {{ $type.Unmarshaler | call }}(v)
- {{- end }}
- {{- end }}
- {{- if and $type.IsTargetNilable (not $type.IsNilable) }}
- return *res, graphql.ErrorOnPath(ctx, err)
- {{- else if and (not $type.IsTargetNilable) $type.IsNilable }}
- return &res, graphql.ErrorOnPath(ctx, err)
- {{- else}}
- return res, graphql.ErrorOnPath(ctx, err)
- {{- end }}
- {{- else if eq ($type.GO | ref) "map[string]interface{}" }}
- return v.(map[string]interface{}), nil
- {{- else if $type.IsMarshaler }}
- {{- if and $type.IsNilable $type.Elem }}
- var res = new({{ $type.Elem.GO | ref }})
- {{- else}}
- var res {{ $type.GO | ref }}
- {{- end }}
- {{- if $type.IsContext }}
- err := res.UnmarshalGQLContext(ctx, v)
- {{- else }}
- err := res.UnmarshalGQL(v)
- {{- end }}
- return res, graphql.ErrorOnPath(ctx, err)
- {{- else }}
- res, err := ec.unmarshalInput{{ $type.GQL.Name }}(ctx, v)
- {{- if $type.IsNilable }}
- return &res, graphql.ErrorOnPath(ctx, err)
- {{- else}}
- return res, graphql.ErrorOnPath(ctx, err)
- {{- end }}
- {{- end }}
- {{- end }}
- }
- {{- end }}
-
- {{ with $type.MarshalFunc }}
- func (ec *executionContext) {{ . }}(ctx context.Context, sel ast.SelectionSet, v {{ $type.GO | ref }}) graphql.Marshaler {
- {{- if $type.IsPtrToSlice }}
- return ec.{{ $type.Elem.MarshalFunc }}(ctx, sel, *v)
- {{- else if $type.IsSlice }}
- {{- if not $type.GQL.NonNull }}
- if v == nil {
- return graphql.Null
- }
- {{- end }}
- ret := make(graphql.Array, len(v))
- {{- if not $type.IsScalar }}
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- {{- end }}
- for i := range v {
- {{- if not $type.IsScalar }}
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.{{ $type.Elem.MarshalFunc }}(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
- {{ else }}
- ret[i] = ec.{{ $type.Elem.MarshalFunc }}(ctx, sel, v[i])
- {{- end }}
- }
- {{ if not $type.IsScalar }} wg.Wait() {{ end }}
- {{ if $type.Elem.GQL.NonNull }}
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
- {{ end }}
- return ret
- {{- else if and $type.IsPtrToPtr (not $type.Unmarshaler) (not $type.IsMarshaler) }}
- if v == nil {
- return graphql.Null
- }
- return ec.{{ $type.Elem.MarshalFunc }}(ctx, sel, *v)
- {{- else }}
- {{- if $type.IsNilable }}
- if v == nil {
- {{- if $type.GQL.NonNull }}
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- {{- end }}
- return graphql.Null
- }
- {{- end }}
- {{- if $type.IsMarshaler }}
- {{- if $type.IsContext }}
- return graphql.WrapContextMarshaler(ctx, v)
- {{- else }}
- return v
- {{- end }}
- {{- else if $type.Marshaler }}
- {{- $v := "v" }}
- {{- if and $type.IsTargetNilable (not $type.IsNilable) }}
- {{- $v = "&v" }}
- {{- else if and (not $type.IsTargetNilable) $type.IsNilable }}
- {{- $v = "*v" }}
- {{- end }}
- res := {{ $type.Marshaler | call }}({{- if $type.CastType }}{{ $type.CastType | ref }}({{ $v }}){{else}}{{ $v }}{{- end }})
- {{- if $type.GQL.NonNull }}
- if res == graphql.Null {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "the requested element is null which the schema does not allow")
- }
- }
- {{- end }}
- {{- if $type.IsContext }}
- return graphql.WrapContextMarshaler(ctx, res)
- {{- else }}
- return res
- {{- end }}
- {{- else }}
- return ec._{{$type.Definition.Name}}(ctx, sel, {{ if not $type.IsNilable}}&{{end}} v)
- {{- end }}
- {{- end }}
- }
- {{- end }}
-{{- end }}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/util.go b/vendor/github.com/99designs/gqlgen/codegen/util.go
deleted file mode 100644
index fa2ceed3df..0000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/util.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package codegen
-
-import (
- "fmt"
- "go/types"
- "strings"
-)
-
-func findGoNamedType(def types.Type) (*types.Named, error) {
- if def == nil {
- return nil, nil
- }
-
- namedType, ok := def.(*types.Named)
- if !ok {
- return nil, fmt.Errorf("expected %s to be a named type, instead found %T\n", def.String(), def)
- }
-
- return namedType, nil
-}
-
-func findGoInterface(def types.Type) (*types.Interface, error) {
- if def == nil {
- return nil, nil
- }
- namedType, err := findGoNamedType(def)
- if err != nil {
- return nil, err
- }
- if namedType == nil {
- return nil, nil
- }
-
- underlying, ok := namedType.Underlying().(*types.Interface)
- if !ok {
- return nil, fmt.Errorf("expected %s to be a named interface, instead found %s", def.String(), namedType.String())
- }
-
- return underlying, nil
-}
-
-func equalFieldName(source, target string) bool {
- source = strings.ReplaceAll(source, "_", "")
- target = strings.ReplaceAll(target, "_", "")
- return strings.EqualFold(source, target)
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/any.go b/vendor/github.com/99designs/gqlgen/graphql/any.go
deleted file mode 100644
index 6ea8bf2eae..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/any.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package graphql
-
-import (
- "encoding/json"
- "io"
-)
-
-func MarshalAny(v interface{}) Marshaler {
- return WriterFunc(func(w io.Writer) {
- err := json.NewEncoder(w).Encode(v)
- if err != nil {
- panic(err)
- }
- })
-}
-
-func UnmarshalAny(v interface{}) (interface{}, error) {
- return v, nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/bool.go b/vendor/github.com/99designs/gqlgen/graphql/bool.go
deleted file mode 100644
index f435e0c098..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/bool.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package graphql
-
-import (
- "fmt"
- "io"
- "strings"
-)
-
-func MarshalBoolean(b bool) Marshaler {
- if b {
- return WriterFunc(func(w io.Writer) { w.Write(trueLit) })
- }
- return WriterFunc(func(w io.Writer) { w.Write(falseLit) })
-}
-
-func UnmarshalBoolean(v interface{}) (bool, error) {
- switch v := v.(type) {
- case string:
- return strings.ToLower(v) == "true", nil
- case int:
- return v != 0, nil
- case bool:
- return v, nil
- default:
- return false, fmt.Errorf("%T is not a bool", v)
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/cache.go b/vendor/github.com/99designs/gqlgen/graphql/cache.go
deleted file mode 100644
index fe86ca3502..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/cache.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package graphql
-
-import "context"
-
-// Cache is a shared store for APQ and query AST caching
-type Cache interface {
- // Get looks up a key's value from the cache.
- Get(ctx context.Context, key string) (value interface{}, ok bool)
-
- // Add adds a value to the cache.
- Add(ctx context.Context, key string, value interface{})
-}
-
-// MapCache is the simplest implementation of a cache, because it can not evict it should only be used in tests
-type MapCache map[string]interface{}
-
-// Get looks up a key's value from the cache.
-func (m MapCache) Get(ctx context.Context, key string) (value interface{}, ok bool) {
- v, ok := m[key]
- return v, ok
-}
-
-// Add adds a value to the cache.
-func (m MapCache) Add(ctx context.Context, key string, value interface{}) { m[key] = value }
-
-type NoCache struct{}
-
-func (n NoCache) Get(ctx context.Context, key string) (value interface{}, ok bool) { return nil, false }
-func (n NoCache) Add(ctx context.Context, key string, value interface{}) {}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/coercion.go b/vendor/github.com/99designs/gqlgen/graphql/coercion.go
deleted file mode 100644
index d3d3c18b2b..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/coercion.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package graphql
-
-import (
- "encoding/json"
-)
-
-// CoerceList applies coercion from a single value to a list.
-func CoerceList(v interface{}) []interface{} {
- var vSlice []interface{}
- if v != nil {
- switch v := v.(type) {
- case []interface{}:
- // already a slice no coercion required
- vSlice = v
- case []string:
- if len(v) > 0 {
- vSlice = []interface{}{v[0]}
- }
- case []json.Number:
- if len(v) > 0 {
- vSlice = []interface{}{v[0]}
- }
- case []bool:
- if len(v) > 0 {
- vSlice = []interface{}{v[0]}
- }
- case []map[string]interface{}:
- if len(v) > 0 {
- vSlice = []interface{}{v[0]}
- }
- case []float64:
- if len(v) > 0 {
- vSlice = []interface{}{v[0]}
- }
- case []float32:
- if len(v) > 0 {
- vSlice = []interface{}{v[0]}
- }
- case []int:
- if len(v) > 0 {
- vSlice = []interface{}{v[0]}
- }
- case []int32:
- if len(v) > 0 {
- vSlice = []interface{}{v[0]}
- }
- case []int64:
- if len(v) > 0 {
- vSlice = []interface{}{v[0]}
- }
- default:
- vSlice = []interface{}{v}
- }
- }
- return vSlice
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/context_field.go b/vendor/github.com/99designs/gqlgen/graphql/context_field.go
deleted file mode 100644
index 1f9a6e88db..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/context_field.go
+++ /dev/null
@@ -1,113 +0,0 @@
-package graphql
-
-import (
- "context"
- "time"
-
- "github.com/vektah/gqlparser/v2/ast"
-)
-
-type key string
-
-const resolverCtx key = "resolver_context"
-
-// Deprecated: Use FieldContext instead
-type ResolverContext = FieldContext
-
-type FieldContext struct {
- Parent *FieldContext
- // The name of the type this field belongs to
- Object string
- // These are the args after processing, they can be mutated in middleware to change what the resolver will get.
- Args map[string]interface{}
- // The raw field
- Field CollectedField
- // The index of array in path.
- Index *int
- // The result object of resolver
- Result interface{}
- // IsMethod indicates if the resolver is a method
- IsMethod bool
- // IsResolver indicates if the field has a user-specified resolver
- IsResolver bool
- // Child allows getting a child FieldContext by its field collection description.
- // Note that, the returned child FieldContext represents the context as it was
- // before the execution of the field resolver. For example:
- //
- // srv.AroundFields(func(ctx context.Context, next graphql.Resolver) (interface{}, error) {
- // fc := graphql.GetFieldContext(ctx)
- // op := graphql.GetOperationContext(ctx)
- // collected := graphql.CollectFields(opCtx, fc.Field.Selections, []string{"User"})
- //
- // child, err := fc.Child(ctx, collected[0])
- // if err != nil {
- // return nil, err
- // }
- // fmt.Println("child context %q with args: %v", child.Field.Name, child.Args)
- //
- // return next(ctx)
- // })
- //
- Child func(context.Context, CollectedField) (*FieldContext, error)
-}
-
-type FieldStats struct {
- // When field execution started
- Started time.Time
-
- // When argument marshaling finished
- ArgumentsCompleted time.Time
-
- // When the field completed running all middleware. Not available inside field middleware!
- Completed time.Time
-}
-
-func (r *FieldContext) Path() ast.Path {
- var path ast.Path
- for it := r; it != nil; it = it.Parent {
- if it.Index != nil {
- path = append(path, ast.PathIndex(*it.Index))
- } else if it.Field.Field != nil {
- path = append(path, ast.PathName(it.Field.Alias))
- }
- }
-
- // because we are walking up the chain, all the elements are backwards, do an inplace flip.
- for i := len(path)/2 - 1; i >= 0; i-- {
- opp := len(path) - 1 - i
- path[i], path[opp] = path[opp], path[i]
- }
-
- return path
-}
-
-// Deprecated: Use GetFieldContext instead
-func GetResolverContext(ctx context.Context) *ResolverContext {
- return GetFieldContext(ctx)
-}
-
-func GetFieldContext(ctx context.Context) *FieldContext {
- if val, ok := ctx.Value(resolverCtx).(*FieldContext); ok {
- return val
- }
- return nil
-}
-
-func WithFieldContext(ctx context.Context, rc *FieldContext) context.Context {
- rc.Parent = GetFieldContext(ctx)
- return context.WithValue(ctx, resolverCtx, rc)
-}
-
-func equalPath(a ast.Path, b ast.Path) bool {
- if len(a) != len(b) {
- return false
- }
-
- for i := 0; i < len(a); i++ {
- if a[i] != b[i] {
- return false
- }
- }
-
- return true
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/context_operation.go b/vendor/github.com/99designs/gqlgen/graphql/context_operation.go
deleted file mode 100644
index 0518ecc6ba..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/context_operation.go
+++ /dev/null
@@ -1,117 +0,0 @@
-package graphql
-
-import (
- "context"
- "errors"
- "net/http"
-
- "github.com/vektah/gqlparser/v2/ast"
-)
-
-// Deprecated: Please update all references to OperationContext instead
-type RequestContext = OperationContext
-
-type OperationContext struct {
- RawQuery string
- Variables map[string]interface{}
- OperationName string
- Doc *ast.QueryDocument
- Headers http.Header
-
- Operation *ast.OperationDefinition
- DisableIntrospection bool
- RecoverFunc RecoverFunc
- ResolverMiddleware FieldMiddleware
- RootResolverMiddleware RootFieldMiddleware
-
- Stats Stats
-}
-
-func (c *OperationContext) Validate(ctx context.Context) error {
- if c.Doc == nil {
- return errors.New("field 'Doc'is required")
- }
- if c.RawQuery == "" {
- return errors.New("field 'RawQuery' is required")
- }
- if c.Variables == nil {
- c.Variables = make(map[string]interface{})
- }
- if c.ResolverMiddleware == nil {
- return errors.New("field 'ResolverMiddleware' is required")
- }
- if c.RootResolverMiddleware == nil {
- return errors.New("field 'RootResolverMiddleware' is required")
- }
- if c.RecoverFunc == nil {
- c.RecoverFunc = DefaultRecover
- }
-
- return nil
-}
-
-const operationCtx key = "operation_context"
-
-// Deprecated: Please update all references to GetOperationContext instead
-func GetRequestContext(ctx context.Context) *RequestContext {
- return GetOperationContext(ctx)
-}
-
-func GetOperationContext(ctx context.Context) *OperationContext {
- if val, ok := ctx.Value(operationCtx).(*OperationContext); ok && val != nil {
- return val
- }
- panic("missing operation context")
-}
-
-func WithOperationContext(ctx context.Context, rc *OperationContext) context.Context {
- return context.WithValue(ctx, operationCtx, rc)
-}
-
-// HasOperationContext checks if the given context is part of an ongoing operation
-//
-// Some errors can happen outside of an operation, eg json unmarshal errors.
-func HasOperationContext(ctx context.Context) bool {
- _, ok := ctx.Value(operationCtx).(*OperationContext)
- return ok
-}
-
-// This is just a convenient wrapper method for CollectFields
-func CollectFieldsCtx(ctx context.Context, satisfies []string) []CollectedField {
- resctx := GetFieldContext(ctx)
- return CollectFields(GetOperationContext(ctx), resctx.Field.Selections, satisfies)
-}
-
-// CollectAllFields returns a slice of all GraphQL field names that were selected for the current resolver context.
-// The slice will contain the unique set of all field names requested regardless of fragment type conditions.
-func CollectAllFields(ctx context.Context) []string {
- resctx := GetFieldContext(ctx)
- collected := CollectFields(GetOperationContext(ctx), resctx.Field.Selections, nil)
- uniq := make([]string, 0, len(collected))
-Next:
- for _, f := range collected {
- for _, name := range uniq {
- if name == f.Name {
- continue Next
- }
- }
- uniq = append(uniq, f.Name)
- }
- return uniq
-}
-
-// Errorf sends an error string to the client, passing it through the formatter.
-// Deprecated: use graphql.AddErrorf(ctx, err) instead
-func (c *OperationContext) Errorf(ctx context.Context, format string, args ...interface{}) {
- AddErrorf(ctx, format, args...)
-}
-
-// Error sends an error to the client, passing it through the formatter.
-// Deprecated: use graphql.AddError(ctx, err) instead
-func (c *OperationContext) Error(ctx context.Context, err error) {
- AddError(ctx, err)
-}
-
-func (c *OperationContext) Recover(ctx context.Context, err interface{}) error {
- return ErrorOnPath(ctx, c.RecoverFunc(ctx, err))
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/context_path.go b/vendor/github.com/99designs/gqlgen/graphql/context_path.go
deleted file mode 100644
index a46ed83ddc..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/context_path.go
+++ /dev/null
@@ -1,77 +0,0 @@
-package graphql
-
-import (
- "context"
-
- "github.com/vektah/gqlparser/v2/ast"
-)
-
-const fieldInputCtx key = "path_context"
-
-type PathContext struct {
- ParentField *FieldContext
- Parent *PathContext
- Field *string
- Index *int
-}
-
-func (fic *PathContext) Path() ast.Path {
- var path ast.Path
- for it := fic; it != nil; it = it.Parent {
- if it.Index != nil {
- path = append(path, ast.PathIndex(*it.Index))
- } else if it.Field != nil {
- path = append(path, ast.PathName(*it.Field))
- }
- }
-
- // because we are walking up the chain, all the elements are backwards, do an inplace flip.
- for i := len(path)/2 - 1; i >= 0; i-- {
- opp := len(path) - 1 - i
- path[i], path[opp] = path[opp], path[i]
- }
-
- if fic.ParentField != nil {
- fieldPath := fic.ParentField.Path()
- return append(fieldPath, path...)
-
- }
-
- return path
-}
-
-func NewPathWithField(field string) *PathContext {
- return &PathContext{Field: &field}
-}
-
-func NewPathWithIndex(index int) *PathContext {
- return &PathContext{Index: &index}
-}
-
-func WithPathContext(ctx context.Context, fic *PathContext) context.Context {
- if fieldContext := GetFieldContext(ctx); fieldContext != nil {
- fic.ParentField = fieldContext
- }
- if fieldInputContext := GetPathContext(ctx); fieldInputContext != nil {
- fic.Parent = fieldInputContext
- }
-
- return context.WithValue(ctx, fieldInputCtx, fic)
-}
-
-func GetPathContext(ctx context.Context) *PathContext {
- if val, ok := ctx.Value(fieldInputCtx).(*PathContext); ok {
- return val
- }
- return nil
-}
-
-func GetPath(ctx context.Context) ast.Path {
- if pc := GetPathContext(ctx); pc != nil {
- return pc.Path()
- }
- if fc := GetFieldContext(ctx); fc != nil {
- return fc.Path()
- }
- return nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/context_response.go b/vendor/github.com/99designs/gqlgen/graphql/context_response.go
deleted file mode 100644
index c128fdb49c..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/context_response.go
+++ /dev/null
@@ -1,153 +0,0 @@
-package graphql
-
-import (
- "context"
- "fmt"
- "sync"
-
- "github.com/vektah/gqlparser/v2/gqlerror"
-)
-
-type responseContext struct {
- errorPresenter ErrorPresenterFunc
- recover RecoverFunc
-
- errors gqlerror.List
- errorsMu sync.Mutex
-
- extensions map[string]interface{}
- extensionsMu sync.Mutex
-}
-
-const resultCtx key = "result_context"
-
-func getResponseContext(ctx context.Context) *responseContext {
- val, ok := ctx.Value(resultCtx).(*responseContext)
- if !ok {
- panic("missing response context")
- }
- return val
-}
-
-func WithResponseContext(ctx context.Context, presenterFunc ErrorPresenterFunc, recoverFunc RecoverFunc) context.Context {
- return context.WithValue(ctx, resultCtx, &responseContext{
- errorPresenter: presenterFunc,
- recover: recoverFunc,
- })
-}
-
-// AddErrorf writes a formatted error to the client, first passing it through the error presenter.
-func AddErrorf(ctx context.Context, format string, args ...interface{}) {
- AddError(ctx, fmt.Errorf(format, args...))
-}
-
-// AddError sends an error to the client, first passing it through the error presenter.
-func AddError(ctx context.Context, err error) {
- c := getResponseContext(ctx)
-
- presentedError := c.errorPresenter(ctx, ErrorOnPath(ctx, err))
-
- c.errorsMu.Lock()
- defer c.errorsMu.Unlock()
- c.errors = append(c.errors, presentedError)
-}
-
-func Recover(ctx context.Context, err interface{}) (userMessage error) {
- c := getResponseContext(ctx)
- return ErrorOnPath(ctx, c.recover(ctx, err))
-}
-
-// HasFieldError returns true if the given field has already errored
-func HasFieldError(ctx context.Context, rctx *FieldContext) bool {
- c := getResponseContext(ctx)
-
- c.errorsMu.Lock()
- defer c.errorsMu.Unlock()
-
- if len(c.errors) == 0 {
- return false
- }
-
- path := rctx.Path()
- for _, err := range c.errors {
- if equalPath(err.Path, path) {
- return true
- }
- }
- return false
-}
-
-// GetFieldErrors returns a list of errors that occurred in the given field
-func GetFieldErrors(ctx context.Context, rctx *FieldContext) gqlerror.List {
- c := getResponseContext(ctx)
-
- c.errorsMu.Lock()
- defer c.errorsMu.Unlock()
-
- if len(c.errors) == 0 {
- return nil
- }
-
- path := rctx.Path()
- var errs gqlerror.List
- for _, err := range c.errors {
- if equalPath(err.Path, path) {
- errs = append(errs, err)
- }
- }
- return errs
-}
-
-func GetErrors(ctx context.Context) gqlerror.List {
- resCtx := getResponseContext(ctx)
- resCtx.errorsMu.Lock()
- defer resCtx.errorsMu.Unlock()
-
- if len(resCtx.errors) == 0 {
- return nil
- }
-
- errs := resCtx.errors
- cpy := make(gqlerror.List, len(errs))
- for i := range errs {
- errCpy := *errs[i]
- cpy[i] = &errCpy
- }
- return cpy
-}
-
-// RegisterExtension allows you to add a new extension into the graphql response
-func RegisterExtension(ctx context.Context, key string, value interface{}) {
- c := getResponseContext(ctx)
- c.extensionsMu.Lock()
- defer c.extensionsMu.Unlock()
-
- if c.extensions == nil {
- c.extensions = make(map[string]interface{})
- }
-
- if _, ok := c.extensions[key]; ok {
- panic(fmt.Errorf("extension already registered for key %s", key))
- }
-
- c.extensions[key] = value
-}
-
-// GetExtensions returns any extensions registered in the current result context
-func GetExtensions(ctx context.Context) map[string]interface{} {
- ext := getResponseContext(ctx).extensions
- if ext == nil {
- return map[string]interface{}{}
- }
-
- return ext
-}
-
-func GetExtension(ctx context.Context, name string) interface{} {
- ext := getResponseContext(ctx).extensions
- if ext == nil {
- return nil
- }
-
- return ext[name]
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/context_root_field.go b/vendor/github.com/99designs/gqlgen/graphql/context_root_field.go
deleted file mode 100644
index 1bf4d13b84..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/context_root_field.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package graphql
-
-import (
- "context"
-)
-
-const rootResolverCtx key = "root_resolver_context"
-
-type RootFieldContext struct {
- // The name of the type this field belongs to
- Object string
- // The raw field
- Field CollectedField
-}
-
-func GetRootFieldContext(ctx context.Context) *RootFieldContext {
- if val, ok := ctx.Value(rootResolverCtx).(*RootFieldContext); ok {
- return val
- }
- return nil
-}
-
-func WithRootFieldContext(ctx context.Context, rc *RootFieldContext) context.Context {
- return context.WithValue(ctx, rootResolverCtx, rc)
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/errcode/codes.go b/vendor/github.com/99designs/gqlgen/graphql/errcode/codes.go
deleted file mode 100644
index 854b206f4e..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/errcode/codes.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package errcode
-
-import (
- "github.com/vektah/gqlparser/v2/gqlerror"
-)
-
-const (
- ValidationFailed = "GRAPHQL_VALIDATION_FAILED"
- ParseFailed = "GRAPHQL_PARSE_FAILED"
-)
-
-type ErrorKind int
-
-const (
- // issues with graphql (validation, parsing). 422s in http, GQL_ERROR in websocket
- KindProtocol ErrorKind = iota
- // user errors, 200s in http, GQL_DATA in websocket
- KindUser
-)
-
-var codeType = map[string]ErrorKind{
- ValidationFailed: KindProtocol,
- ParseFailed: KindProtocol,
-}
-
-// RegisterErrorType should be called by extensions that want to customize the http status codes for
-// errors they return
-func RegisterErrorType(code string, kind ErrorKind) {
- codeType[code] = kind
-}
-
-// Set the error code on a given graphql error extension
-func Set(err error, value string) {
- if err == nil {
- return
- }
- gqlErr, ok := err.(*gqlerror.Error)
- if !ok {
- return
- }
-
- if gqlErr.Extensions == nil {
- gqlErr.Extensions = map[string]interface{}{}
- }
-
- gqlErr.Extensions["code"] = value
-}
-
-// get the kind of the first non User error, defaults to User if no errors have a custom extension
-func GetErrorKind(errs gqlerror.List) ErrorKind {
- for _, err := range errs {
- if code, ok := err.Extensions["code"].(string); ok {
- if kind, ok := codeType[code]; ok && kind != KindUser {
- return kind
- }
- }
- }
-
- return KindUser
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/error.go b/vendor/github.com/99designs/gqlgen/graphql/error.go
deleted file mode 100644
index f816bef6b8..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/error.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package graphql
-
-import (
- "context"
- "errors"
-
- "github.com/vektah/gqlparser/v2/gqlerror"
-)
-
-type ErrorPresenterFunc func(ctx context.Context, err error) *gqlerror.Error
-
-func DefaultErrorPresenter(ctx context.Context, err error) *gqlerror.Error {
- var gqlErr *gqlerror.Error
- if errors.As(err, &gqlErr) {
- return gqlErr
- }
- return gqlerror.WrapPath(GetPath(ctx), err)
-}
-
-func ErrorOnPath(ctx context.Context, err error) error {
- if err == nil {
- return nil
- }
- var gqlErr *gqlerror.Error
- if errors.As(err, &gqlErr) {
- if gqlErr.Path == nil {
- gqlErr.Path = GetPath(ctx)
- }
- // Return the original error to avoid losing any attached annotation
- return err
- }
- return gqlerror.WrapPath(GetPath(ctx), err)
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/executable_schema.go b/vendor/github.com/99designs/gqlgen/graphql/executable_schema.go
deleted file mode 100644
index 6189162288..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/executable_schema.go
+++ /dev/null
@@ -1,167 +0,0 @@
-//go:generate go run github.com/matryer/moq -out executable_schema_mock.go . ExecutableSchema
-
-package graphql
-
-import (
- "context"
- "fmt"
-
- "github.com/vektah/gqlparser/v2/ast"
-)
-
-type ExecutableSchema interface {
- Schema() *ast.Schema
-
- Complexity(typeName, fieldName string, childComplexity int, args map[string]interface{}) (int, bool)
- Exec(ctx context.Context) ResponseHandler
-}
-
-// CollectFields returns the set of fields from an ast.SelectionSet where all collected fields satisfy at least one of the GraphQL types
-// passed through satisfies. Providing an empty or nil slice for satisfies will return collect all fields regardless of fragment
-// type conditions.
-func CollectFields(reqCtx *OperationContext, selSet ast.SelectionSet, satisfies []string) []CollectedField {
- return collectFields(reqCtx, selSet, satisfies, map[string]bool{})
-}
-
-func collectFields(reqCtx *OperationContext, selSet ast.SelectionSet, satisfies []string, visited map[string]bool) []CollectedField {
- groupedFields := make([]CollectedField, 0, len(selSet))
-
- for _, sel := range selSet {
- switch sel := sel.(type) {
- case *ast.Field:
- if !shouldIncludeNode(sel.Directives, reqCtx.Variables) {
- continue
- }
- f := getOrCreateAndAppendField(&groupedFields, sel.Name, sel.Alias, sel.ObjectDefinition, func() CollectedField {
- return CollectedField{Field: sel}
- })
-
- f.Selections = append(f.Selections, sel.SelectionSet...)
-
- case *ast.InlineFragment:
- if !shouldIncludeNode(sel.Directives, reqCtx.Variables) {
- continue
- }
- if len(satisfies) > 0 && !instanceOf(sel.TypeCondition, satisfies) {
- continue
- }
- for _, childField := range collectFields(reqCtx, sel.SelectionSet, satisfies, visited) {
- f := getOrCreateAndAppendField(&groupedFields, childField.Name, childField.Alias, childField.ObjectDefinition, func() CollectedField { return childField })
- f.Selections = append(f.Selections, childField.Selections...)
- }
-
- case *ast.FragmentSpread:
- if !shouldIncludeNode(sel.Directives, reqCtx.Variables) {
- continue
- }
- fragmentName := sel.Name
- if _, seen := visited[fragmentName]; seen {
- continue
- }
- visited[fragmentName] = true
-
- fragment := reqCtx.Doc.Fragments.ForName(fragmentName)
- if fragment == nil {
- // should never happen, validator has already run
- panic(fmt.Errorf("missing fragment %s", fragmentName))
- }
-
- if len(satisfies) > 0 && !instanceOf(fragment.TypeCondition, satisfies) {
- continue
- }
-
- for _, childField := range collectFields(reqCtx, fragment.SelectionSet, satisfies, visited) {
- f := getOrCreateAndAppendField(&groupedFields, childField.Name, childField.Alias, childField.ObjectDefinition, func() CollectedField { return childField })
- f.Selections = append(f.Selections, childField.Selections...)
- }
-
- default:
- panic(fmt.Errorf("unsupported %T", sel))
- }
- }
-
- return groupedFields
-}
-
-type CollectedField struct {
- *ast.Field
-
- Selections ast.SelectionSet
-}
-
-func instanceOf(val string, satisfies []string) bool {
- for _, s := range satisfies {
- if val == s {
- return true
- }
- }
- return false
-}
-
-func getOrCreateAndAppendField(c *[]CollectedField, name string, alias string, objectDefinition *ast.Definition, creator func() CollectedField) *CollectedField {
- for i, cf := range *c {
- if cf.Name == name && cf.Alias == alias {
- if cf.ObjectDefinition == objectDefinition {
- return &(*c)[i]
- }
-
- if cf.ObjectDefinition == nil || objectDefinition == nil {
- continue
- }
-
- if cf.ObjectDefinition.Name == objectDefinition.Name {
- return &(*c)[i]
- }
-
- for _, ifc := range objectDefinition.Interfaces {
- if ifc == cf.ObjectDefinition.Name {
- return &(*c)[i]
- }
- }
- for _, ifc := range cf.ObjectDefinition.Interfaces {
- if ifc == objectDefinition.Name {
- return &(*c)[i]
- }
- }
- }
- }
-
- f := creator()
-
- *c = append(*c, f)
- return &(*c)[len(*c)-1]
-}
-
-func shouldIncludeNode(directives ast.DirectiveList, variables map[string]interface{}) bool {
- if len(directives) == 0 {
- return true
- }
-
- skip, include := false, true
-
- if d := directives.ForName("skip"); d != nil {
- skip = resolveIfArgument(d, variables)
- }
-
- if d := directives.ForName("include"); d != nil {
- include = resolveIfArgument(d, variables)
- }
-
- return !skip && include
-}
-
-func resolveIfArgument(d *ast.Directive, variables map[string]interface{}) bool {
- arg := d.Arguments.ForName("if")
- if arg == nil {
- panic(fmt.Sprintf("%s: argument 'if' not defined", d.Name))
- }
- value, err := arg.Value.Value(variables)
- if err != nil {
- panic(err)
- }
- ret, ok := value.(bool)
- if !ok {
- panic(fmt.Sprintf("%s: argument 'if' is not a boolean", d.Name))
- }
- return ret
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/executable_schema_mock.go b/vendor/github.com/99designs/gqlgen/graphql/executable_schema_mock.go
deleted file mode 100644
index 5d7433162f..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/executable_schema_mock.go
+++ /dev/null
@@ -1,172 +0,0 @@
-// Code generated by moq; DO NOT EDIT.
-// github.com/matryer/moq
-
-package graphql
-
-import (
- "context"
- "github.com/vektah/gqlparser/v2/ast"
- "sync"
-)
-
-// Ensure, that ExecutableSchemaMock does implement ExecutableSchema.
-// If this is not the case, regenerate this file with moq.
-var _ ExecutableSchema = &ExecutableSchemaMock{}
-
-// ExecutableSchemaMock is a mock implementation of ExecutableSchema.
-//
-// func TestSomethingThatUsesExecutableSchema(t *testing.T) {
-//
-// // make and configure a mocked ExecutableSchema
-// mockedExecutableSchema := &ExecutableSchemaMock{
-// ComplexityFunc: func(typeName string, fieldName string, childComplexity int, args map[string]interface{}) (int, bool) {
-// panic("mock out the Complexity method")
-// },
-// ExecFunc: func(ctx context.Context) ResponseHandler {
-// panic("mock out the Exec method")
-// },
-// SchemaFunc: func() *ast.Schema {
-// panic("mock out the Schema method")
-// },
-// }
-//
-// // use mockedExecutableSchema in code that requires ExecutableSchema
-// // and then make assertions.
-//
-// }
-type ExecutableSchemaMock struct {
- // ComplexityFunc mocks the Complexity method.
- ComplexityFunc func(typeName string, fieldName string, childComplexity int, args map[string]interface{}) (int, bool)
-
- // ExecFunc mocks the Exec method.
- ExecFunc func(ctx context.Context) ResponseHandler
-
- // SchemaFunc mocks the Schema method.
- SchemaFunc func() *ast.Schema
-
- // calls tracks calls to the methods.
- calls struct {
- // Complexity holds details about calls to the Complexity method.
- Complexity []struct {
- // TypeName is the typeName argument value.
- TypeName string
- // FieldName is the fieldName argument value.
- FieldName string
- // ChildComplexity is the childComplexity argument value.
- ChildComplexity int
- // Args is the args argument value.
- Args map[string]interface{}
- }
- // Exec holds details about calls to the Exec method.
- Exec []struct {
- // Ctx is the ctx argument value.
- Ctx context.Context
- }
- // Schema holds details about calls to the Schema method.
- Schema []struct {
- }
- }
- lockComplexity sync.RWMutex
- lockExec sync.RWMutex
- lockSchema sync.RWMutex
-}
-
-// Complexity calls ComplexityFunc.
-func (mock *ExecutableSchemaMock) Complexity(typeName string, fieldName string, childComplexity int, args map[string]interface{}) (int, bool) {
- if mock.ComplexityFunc == nil {
- panic("ExecutableSchemaMock.ComplexityFunc: method is nil but ExecutableSchema.Complexity was just called")
- }
- callInfo := struct {
- TypeName string
- FieldName string
- ChildComplexity int
- Args map[string]interface{}
- }{
- TypeName: typeName,
- FieldName: fieldName,
- ChildComplexity: childComplexity,
- Args: args,
- }
- mock.lockComplexity.Lock()
- mock.calls.Complexity = append(mock.calls.Complexity, callInfo)
- mock.lockComplexity.Unlock()
- return mock.ComplexityFunc(typeName, fieldName, childComplexity, args)
-}
-
-// ComplexityCalls gets all the calls that were made to Complexity.
-// Check the length with:
-// len(mockedExecutableSchema.ComplexityCalls())
-func (mock *ExecutableSchemaMock) ComplexityCalls() []struct {
- TypeName string
- FieldName string
- ChildComplexity int
- Args map[string]interface{}
-} {
- var calls []struct {
- TypeName string
- FieldName string
- ChildComplexity int
- Args map[string]interface{}
- }
- mock.lockComplexity.RLock()
- calls = mock.calls.Complexity
- mock.lockComplexity.RUnlock()
- return calls
-}
-
-// Exec calls ExecFunc.
-func (mock *ExecutableSchemaMock) Exec(ctx context.Context) ResponseHandler {
- if mock.ExecFunc == nil {
- panic("ExecutableSchemaMock.ExecFunc: method is nil but ExecutableSchema.Exec was just called")
- }
- callInfo := struct {
- Ctx context.Context
- }{
- Ctx: ctx,
- }
- mock.lockExec.Lock()
- mock.calls.Exec = append(mock.calls.Exec, callInfo)
- mock.lockExec.Unlock()
- return mock.ExecFunc(ctx)
-}
-
-// ExecCalls gets all the calls that were made to Exec.
-// Check the length with:
-// len(mockedExecutableSchema.ExecCalls())
-func (mock *ExecutableSchemaMock) ExecCalls() []struct {
- Ctx context.Context
-} {
- var calls []struct {
- Ctx context.Context
- }
- mock.lockExec.RLock()
- calls = mock.calls.Exec
- mock.lockExec.RUnlock()
- return calls
-}
-
-// Schema calls SchemaFunc.
-func (mock *ExecutableSchemaMock) Schema() *ast.Schema {
- if mock.SchemaFunc == nil {
- panic("ExecutableSchemaMock.SchemaFunc: method is nil but ExecutableSchema.Schema was just called")
- }
- callInfo := struct {
- }{}
- mock.lockSchema.Lock()
- mock.calls.Schema = append(mock.calls.Schema, callInfo)
- mock.lockSchema.Unlock()
- return mock.SchemaFunc()
-}
-
-// SchemaCalls gets all the calls that were made to Schema.
-// Check the length with:
-// len(mockedExecutableSchema.SchemaCalls())
-func (mock *ExecutableSchemaMock) SchemaCalls() []struct {
-} {
- var calls []struct {
- }
- mock.lockSchema.RLock()
- calls = mock.calls.Schema
- mock.lockSchema.RUnlock()
- return calls
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/executor/executor.go b/vendor/github.com/99designs/gqlgen/graphql/executor/executor.go
deleted file mode 100644
index c46a007b99..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/executor/executor.go
+++ /dev/null
@@ -1,221 +0,0 @@
-package executor
-
-import (
- "context"
-
- "github.com/99designs/gqlgen/graphql"
- "github.com/99designs/gqlgen/graphql/errcode"
- "github.com/vektah/gqlparser/v2/ast"
- "github.com/vektah/gqlparser/v2/gqlerror"
- "github.com/vektah/gqlparser/v2/parser"
- "github.com/vektah/gqlparser/v2/validator"
-)
-
-// Executor executes graphql queries against a schema.
-type Executor struct {
- es graphql.ExecutableSchema
- extensions []graphql.HandlerExtension
- ext extensions
-
- errorPresenter graphql.ErrorPresenterFunc
- recoverFunc graphql.RecoverFunc
- queryCache graphql.Cache
-}
-
-var _ graphql.GraphExecutor = &Executor{}
-
-// New creates a new Executor with the given schema, and a default error and
-// recovery callbacks, and no query cache or extensions.
-func New(es graphql.ExecutableSchema) *Executor {
- e := &Executor{
- es: es,
- errorPresenter: graphql.DefaultErrorPresenter,
- recoverFunc: graphql.DefaultRecover,
- queryCache: graphql.NoCache{},
- ext: processExtensions(nil),
- }
- return e
-}
-
-func (e *Executor) CreateOperationContext(
- ctx context.Context,
- params *graphql.RawParams,
-) (*graphql.OperationContext, gqlerror.List) {
- rc := &graphql.OperationContext{
- DisableIntrospection: true,
- RecoverFunc: e.recoverFunc,
- ResolverMiddleware: e.ext.fieldMiddleware,
- RootResolverMiddleware: e.ext.rootFieldMiddleware,
- Stats: graphql.Stats{
- Read: params.ReadTime,
- OperationStart: graphql.GetStartTime(ctx),
- },
- }
- ctx = graphql.WithOperationContext(ctx, rc)
-
- for _, p := range e.ext.operationParameterMutators {
- if err := p.MutateOperationParameters(ctx, params); err != nil {
- return rc, gqlerror.List{err}
- }
- }
-
- rc.RawQuery = params.Query
- rc.OperationName = params.OperationName
- rc.Headers = params.Headers
-
- var listErr gqlerror.List
- rc.Doc, listErr = e.parseQuery(ctx, &rc.Stats, params.Query)
- if len(listErr) != 0 {
- return rc, listErr
- }
-
- rc.Operation = rc.Doc.Operations.ForName(params.OperationName)
- if rc.Operation == nil {
- err := gqlerror.Errorf("operation %s not found", params.OperationName)
- errcode.Set(err, errcode.ValidationFailed)
- return rc, gqlerror.List{err}
- }
-
- var err error
- rc.Variables, err = validator.VariableValues(e.es.Schema(), rc.Operation, params.Variables)
-
- if err != nil {
- gqlErr, ok := err.(*gqlerror.Error)
- if ok {
- errcode.Set(gqlErr, errcode.ValidationFailed)
- return rc, gqlerror.List{gqlErr}
- }
- }
- rc.Stats.Validation.End = graphql.Now()
-
- for _, p := range e.ext.operationContextMutators {
- if err := p.MutateOperationContext(ctx, rc); err != nil {
- return rc, gqlerror.List{err}
- }
- }
-
- return rc, nil
-}
-
-func (e *Executor) DispatchOperation(
- ctx context.Context,
- rc *graphql.OperationContext,
-) (graphql.ResponseHandler, context.Context) {
- ctx = graphql.WithOperationContext(ctx, rc)
-
- var innerCtx context.Context
- res := e.ext.operationMiddleware(ctx, func(ctx context.Context) graphql.ResponseHandler {
- innerCtx = ctx
-
- tmpResponseContext := graphql.WithResponseContext(ctx, e.errorPresenter, e.recoverFunc)
- responses := e.es.Exec(tmpResponseContext)
- if errs := graphql.GetErrors(tmpResponseContext); errs != nil {
- return graphql.OneShot(&graphql.Response{Errors: errs})
- }
-
- return func(ctx context.Context) *graphql.Response {
- ctx = graphql.WithResponseContext(ctx, e.errorPresenter, e.recoverFunc)
- resp := e.ext.responseMiddleware(ctx, func(ctx context.Context) *graphql.Response {
- resp := responses(ctx)
- if resp == nil {
- return nil
- }
- resp.Errors = append(resp.Errors, graphql.GetErrors(ctx)...)
- resp.Extensions = graphql.GetExtensions(ctx)
- return resp
- })
- if resp == nil {
- return nil
- }
-
- return resp
- }
- })
-
- return res, innerCtx
-}
-
-func (e *Executor) DispatchError(ctx context.Context, list gqlerror.List) *graphql.Response {
- ctx = graphql.WithResponseContext(ctx, e.errorPresenter, e.recoverFunc)
- for _, gErr := range list {
- graphql.AddError(ctx, gErr)
- }
-
- resp := e.ext.responseMiddleware(ctx, func(ctx context.Context) *graphql.Response {
- resp := &graphql.Response{
- Errors: graphql.GetErrors(ctx),
- }
- resp.Extensions = graphql.GetExtensions(ctx)
- return resp
- })
-
- return resp
-}
-
-func (e *Executor) PresentRecoveredError(ctx context.Context, err interface{}) error {
- return e.errorPresenter(ctx, e.recoverFunc(ctx, err))
-}
-
-func (e *Executor) SetQueryCache(cache graphql.Cache) {
- e.queryCache = cache
-}
-
-func (e *Executor) SetErrorPresenter(f graphql.ErrorPresenterFunc) {
- e.errorPresenter = f
-}
-
-func (e *Executor) SetRecoverFunc(f graphql.RecoverFunc) {
- e.recoverFunc = f
-}
-
-// parseQuery decodes the incoming query and validates it, pulling from cache if present.
-//
-// NOTE: This should NOT look at variables, they will change per request. It should only parse and
-// validate
-// the raw query string.
-func (e *Executor) parseQuery(
- ctx context.Context,
- stats *graphql.Stats,
- query string,
-) (*ast.QueryDocument, gqlerror.List) {
- stats.Parsing.Start = graphql.Now()
-
- if doc, ok := e.queryCache.Get(ctx, query); ok {
- now := graphql.Now()
-
- stats.Parsing.End = now
- stats.Validation.Start = now
- return doc.(*ast.QueryDocument), nil
- }
-
- doc, err := parser.ParseQuery(&ast.Source{Input: query})
- if err != nil {
- gqlErr, ok := err.(*gqlerror.Error)
- if ok {
- errcode.Set(gqlErr, errcode.ParseFailed)
- return nil, gqlerror.List{gqlErr}
- }
- }
- stats.Parsing.End = graphql.Now()
-
- stats.Validation.Start = graphql.Now()
-
- if len(doc.Operations) == 0 {
- err = gqlerror.Errorf("no operation provided")
- gqlErr, _ := err.(*gqlerror.Error)
- errcode.Set(err, errcode.ValidationFailed)
- return nil, gqlerror.List{gqlErr}
- }
-
- listErr := validator.Validate(e.es.Schema(), doc)
- if len(listErr) != 0 {
- for _, e := range listErr {
- errcode.Set(e, errcode.ValidationFailed)
- }
- return nil, listErr
- }
-
- e.queryCache.Add(ctx, query, doc)
-
- return doc, nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/executor/extensions.go b/vendor/github.com/99designs/gqlgen/graphql/executor/extensions.go
deleted file mode 100644
index a8eebf110c..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/executor/extensions.go
+++ /dev/null
@@ -1,195 +0,0 @@
-package executor
-
-import (
- "context"
- "fmt"
-
- "github.com/99designs/gqlgen/graphql"
-)
-
-// Use adds the given extension to this Executor.
-func (e *Executor) Use(extension graphql.HandlerExtension) {
- if err := extension.Validate(e.es); err != nil {
- panic(err)
- }
-
- switch extension.(type) {
- case graphql.OperationParameterMutator,
- graphql.OperationContextMutator,
- graphql.OperationInterceptor,
- graphql.RootFieldInterceptor,
- graphql.FieldInterceptor,
- graphql.ResponseInterceptor:
- e.extensions = append(e.extensions, extension)
- e.ext = processExtensions(e.extensions)
-
- default:
- panic(fmt.Errorf("cannot Use %T as a gqlgen handler extension because it does not implement any extension hooks", extension))
- }
-}
-
-// AroundFields is a convenience method for creating an extension that only implements field middleware
-func (e *Executor) AroundFields(f graphql.FieldMiddleware) {
- e.Use(aroundFieldFunc(f))
-}
-
-// AroundRootFields is a convenience method for creating an extension that only implements root field middleware
-func (e *Executor) AroundRootFields(f graphql.RootFieldMiddleware) {
- e.Use(aroundRootFieldFunc(f))
-}
-
-// AroundOperations is a convenience method for creating an extension that only implements operation middleware
-func (e *Executor) AroundOperations(f graphql.OperationMiddleware) {
- e.Use(aroundOpFunc(f))
-}
-
-// AroundResponses is a convenience method for creating an extension that only implements response middleware
-func (e *Executor) AroundResponses(f graphql.ResponseMiddleware) {
- e.Use(aroundRespFunc(f))
-}
-
-type extensions struct {
- operationMiddleware graphql.OperationMiddleware
- responseMiddleware graphql.ResponseMiddleware
- rootFieldMiddleware graphql.RootFieldMiddleware
- fieldMiddleware graphql.FieldMiddleware
- operationParameterMutators []graphql.OperationParameterMutator
- operationContextMutators []graphql.OperationContextMutator
-}
-
-func processExtensions(exts []graphql.HandlerExtension) extensions {
- e := extensions{
- operationMiddleware: func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler {
- return next(ctx)
- },
- responseMiddleware: func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response {
- return next(ctx)
- },
- rootFieldMiddleware: func(ctx context.Context, next graphql.RootResolver) graphql.Marshaler {
- return next(ctx)
- },
- fieldMiddleware: func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) {
- return next(ctx)
- },
- }
-
- // this loop goes backwards so the first extension is the outer most middleware and runs first.
- for i := len(exts) - 1; i >= 0; i-- {
- p := exts[i]
- if p, ok := p.(graphql.OperationInterceptor); ok {
- previous := e.operationMiddleware
- e.operationMiddleware = func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler {
- return p.InterceptOperation(ctx, func(ctx context.Context) graphql.ResponseHandler {
- return previous(ctx, next)
- })
- }
- }
-
- if p, ok := p.(graphql.ResponseInterceptor); ok {
- previous := e.responseMiddleware
- e.responseMiddleware = func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response {
- return p.InterceptResponse(ctx, func(ctx context.Context) *graphql.Response {
- return previous(ctx, next)
- })
- }
- }
-
- if p, ok := p.(graphql.RootFieldInterceptor); ok {
- previous := e.rootFieldMiddleware
- e.rootFieldMiddleware = func(ctx context.Context, next graphql.RootResolver) graphql.Marshaler {
- return p.InterceptRootField(ctx, func(ctx context.Context) graphql.Marshaler {
- return previous(ctx, next)
- })
- }
- }
-
- if p, ok := p.(graphql.FieldInterceptor); ok {
- previous := e.fieldMiddleware
- e.fieldMiddleware = func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) {
- return p.InterceptField(ctx, func(ctx context.Context) (res interface{}, err error) {
- return previous(ctx, next)
- })
- }
- }
- }
-
- for _, p := range exts {
- if p, ok := p.(graphql.OperationParameterMutator); ok {
- e.operationParameterMutators = append(e.operationParameterMutators, p)
- }
-
- if p, ok := p.(graphql.OperationContextMutator); ok {
- e.operationContextMutators = append(e.operationContextMutators, p)
- }
- }
-
- return e
-}
-
-type aroundOpFunc func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler
-
-func (r aroundOpFunc) ExtensionName() string {
- return "InlineOperationFunc"
-}
-
-func (r aroundOpFunc) Validate(schema graphql.ExecutableSchema) error {
- if r == nil {
- return fmt.Errorf("OperationFunc can not be nil")
- }
- return nil
-}
-
-func (r aroundOpFunc) InterceptOperation(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler {
- return r(ctx, next)
-}
-
-type aroundRespFunc func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response
-
-func (r aroundRespFunc) ExtensionName() string {
- return "InlineResponseFunc"
-}
-
-func (r aroundRespFunc) Validate(schema graphql.ExecutableSchema) error {
- if r == nil {
- return fmt.Errorf("ResponseFunc can not be nil")
- }
- return nil
-}
-
-func (r aroundRespFunc) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response {
- return r(ctx, next)
-}
-
-type aroundFieldFunc func(ctx context.Context, next graphql.Resolver) (res interface{}, err error)
-
-func (f aroundFieldFunc) ExtensionName() string {
- return "InlineFieldFunc"
-}
-
-func (f aroundFieldFunc) Validate(schema graphql.ExecutableSchema) error {
- if f == nil {
- return fmt.Errorf("FieldFunc can not be nil")
- }
- return nil
-}
-
-func (f aroundFieldFunc) InterceptField(ctx context.Context, next graphql.Resolver) (res interface{}, err error) {
- return f(ctx, next)
-}
-
-type aroundRootFieldFunc func(ctx context.Context, next graphql.RootResolver) graphql.Marshaler
-
-func (f aroundRootFieldFunc) ExtensionName() string {
- return "InlineRootFieldFunc"
-}
-
-func (f aroundRootFieldFunc) Validate(schema graphql.ExecutableSchema) error {
- if f == nil {
- return fmt.Errorf("RootFieldFunc can not be nil")
- }
- return nil
-}
-
-func (f aroundRootFieldFunc) InterceptRootField(ctx context.Context, next graphql.RootResolver) graphql.Marshaler {
- return f(ctx, next)
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/fieldset.go b/vendor/github.com/99designs/gqlgen/graphql/fieldset.go
deleted file mode 100644
index 351e266fdb..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/fieldset.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package graphql
-
-import (
- "io"
- "sync"
-)
-
-type FieldSet struct {
- fields []CollectedField
- Values []Marshaler
- delayed []delayedResult
-}
-
-type delayedResult struct {
- i int
- f func() Marshaler
-}
-
-func NewFieldSet(fields []CollectedField) *FieldSet {
- return &FieldSet{
- fields: fields,
- Values: make([]Marshaler, len(fields)),
- }
-}
-
-func (m *FieldSet) Concurrently(i int, f func() Marshaler) {
- m.delayed = append(m.delayed, delayedResult{i: i, f: f})
-}
-
-func (m *FieldSet) Dispatch() {
- if len(m.delayed) == 1 {
- // only one concurrent task, no need to spawn a goroutine or deal create waitgroups
- d := m.delayed[0]
- m.Values[d.i] = d.f()
- } else if len(m.delayed) > 1 {
- // more than one concurrent task, use the main goroutine to do one, only spawn goroutines for the others
-
- var wg sync.WaitGroup
- for _, d := range m.delayed[1:] {
- wg.Add(1)
- go func(d delayedResult) {
- m.Values[d.i] = d.f()
- wg.Done()
- }(d)
- }
-
- m.Values[m.delayed[0].i] = m.delayed[0].f()
- wg.Wait()
- }
-}
-
-func (m *FieldSet) MarshalGQL(writer io.Writer) {
- writer.Write(openBrace)
- for i, field := range m.fields {
- if i != 0 {
- writer.Write(comma)
- }
- writeQuotedString(writer, field.Alias)
- writer.Write(colon)
- m.Values[i].MarshalGQL(writer)
- }
- writer.Write(closeBrace)
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/float.go b/vendor/github.com/99designs/gqlgen/graphql/float.go
deleted file mode 100644
index ccb825ddb8..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/float.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package graphql
-
-import (
- "context"
- "encoding/json"
- "fmt"
- "io"
- "math"
- "strconv"
-)
-
-func MarshalFloat(f float64) Marshaler {
- return WriterFunc(func(w io.Writer) {
- io.WriteString(w, fmt.Sprintf("%g", f))
- })
-}
-
-func UnmarshalFloat(v interface{}) (float64, error) {
- switch v := v.(type) {
- case string:
- return strconv.ParseFloat(v, 64)
- case int:
- return float64(v), nil
- case int64:
- return float64(v), nil
- case float64:
- return v, nil
- case json.Number:
- return strconv.ParseFloat(string(v), 64)
- default:
- return 0, fmt.Errorf("%T is not an float", v)
- }
-}
-
-func MarshalFloatContext(f float64) ContextMarshaler {
- return ContextWriterFunc(func(ctx context.Context, w io.Writer) error {
- if math.IsInf(f, 0) || math.IsNaN(f) {
- return fmt.Errorf("cannot marshal infinite no NaN float values")
- }
- io.WriteString(w, fmt.Sprintf("%g", f))
- return nil
- })
-}
-
-func UnmarshalFloatContext(ctx context.Context, v interface{}) (float64, error) {
- return UnmarshalFloat(v)
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/handler.go b/vendor/github.com/99designs/gqlgen/graphql/handler.go
deleted file mode 100644
index cd358740c8..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/handler.go
+++ /dev/null
@@ -1,131 +0,0 @@
-package graphql
-
-import (
- "context"
- "net/http"
- "strconv"
- "strings"
-
- "github.com/vektah/gqlparser/v2/gqlerror"
-)
-
-type (
- OperationMiddleware func(ctx context.Context, next OperationHandler) ResponseHandler
- OperationHandler func(ctx context.Context) ResponseHandler
-
- ResponseHandler func(ctx context.Context) *Response
- ResponseMiddleware func(ctx context.Context, next ResponseHandler) *Response
-
- Resolver func(ctx context.Context) (res interface{}, err error)
- FieldMiddleware func(ctx context.Context, next Resolver) (res interface{}, err error)
-
- RootResolver func(ctx context.Context) Marshaler
- RootFieldMiddleware func(ctx context.Context, next RootResolver) Marshaler
-
- RawParams struct {
- Query string `json:"query"`
- OperationName string `json:"operationName"`
- Variables map[string]interface{} `json:"variables"`
- Extensions map[string]interface{} `json:"extensions"`
- Headers http.Header `json:"headers"`
-
- ReadTime TraceTiming `json:"-"`
- }
-
- GraphExecutor interface {
- CreateOperationContext(ctx context.Context, params *RawParams) (*OperationContext, gqlerror.List)
- DispatchOperation(ctx context.Context, rc *OperationContext) (ResponseHandler, context.Context)
- DispatchError(ctx context.Context, list gqlerror.List) *Response
- }
-
- // HandlerExtension adds functionality to the http handler. See the list of possible hook points below
- // Its important to understand the lifecycle of a graphql request and the terminology we use in gqlgen
- // before working with these
- //
- // +--- REQUEST POST /graphql --------------------------------------------+
- // | +- OPERATION query OpName { viewer { name } } -----------------------+ |
- // | | RESPONSE { "data": { "viewer": { "name": "bob" } } } | |
- // | +- OPERATION subscription OpName2 { chat { message } } --------------+ |
- // | | RESPONSE { "data": { "chat": { "message": "hello" } } } | |
- // | | RESPONSE { "data": { "chat": { "message": "byee" } } } | |
- // | +--------------------------------------------------------------------+ |
- // +------------------------------------------------------------------------+
- HandlerExtension interface {
- // ExtensionName should be a CamelCase string version of the extension which may be shown in stats and logging.
- ExtensionName() string
- // Validate is called when adding an extension to the server, it allows validation against the servers schema.
- Validate(schema ExecutableSchema) error
- }
-
- // OperationParameterMutator is called before creating a request context. allows manipulating the raw query
- // on the way in.
- OperationParameterMutator interface {
- MutateOperationParameters(ctx context.Context, request *RawParams) *gqlerror.Error
- }
-
- // OperationContextMutator is called after creating the request context, but before executing the root resolver.
- OperationContextMutator interface {
- MutateOperationContext(ctx context.Context, rc *OperationContext) *gqlerror.Error
- }
-
- // OperationInterceptor is called for each incoming query, for basic requests the writer will be invoked once,
- // for subscriptions it will be invoked multiple times.
- OperationInterceptor interface {
- InterceptOperation(ctx context.Context, next OperationHandler) ResponseHandler
- }
-
- // ResponseInterceptor is called around each graphql operation response. This can be called many times for a single
- // operation the case of subscriptions.
- ResponseInterceptor interface {
- InterceptResponse(ctx context.Context, next ResponseHandler) *Response
- }
-
- RootFieldInterceptor interface {
- InterceptRootField(ctx context.Context, next RootResolver) Marshaler
- }
-
- // FieldInterceptor called around each field
- FieldInterceptor interface {
- InterceptField(ctx context.Context, next Resolver) (res interface{}, err error)
- }
-
- // Transport provides support for different wire level encodings of graphql requests, eg Form, Get, Post, Websocket
- Transport interface {
- Supports(r *http.Request) bool
- Do(w http.ResponseWriter, r *http.Request, exec GraphExecutor)
- }
-)
-
-type Status int
-
-func (p *RawParams) AddUpload(upload Upload, key, path string) *gqlerror.Error {
- if !strings.HasPrefix(path, "variables.") {
- return gqlerror.Errorf("invalid operations paths for key %s", key)
- }
-
- var ptr interface{} = p.Variables
- parts := strings.Split(path, ".")
-
- // skip the first part (variables) because we started there
- for i, p := range parts[1:] {
- last := i == len(parts)-2
- if ptr == nil {
- return gqlerror.Errorf("path is missing \"variables.\" prefix, key: %s, path: %s", key, path)
- }
- if index, parseNbrErr := strconv.Atoi(p); parseNbrErr == nil {
- if last {
- ptr.([]interface{})[index] = upload
- } else {
- ptr = ptr.([]interface{})[index]
- }
- } else {
- if last {
- ptr.(map[string]interface{})[p] = upload
- } else {
- ptr = ptr.(map[string]interface{})[p]
- }
- }
- }
-
- return nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/id.go b/vendor/github.com/99designs/gqlgen/graphql/id.go
deleted file mode 100644
index b24605d1d8..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/id.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package graphql
-
-import (
- "encoding/json"
- "fmt"
- "io"
- "strconv"
-)
-
-func MarshalID(s string) Marshaler {
- return MarshalString(s)
-}
-
-func UnmarshalID(v interface{}) (string, error) {
- switch v := v.(type) {
- case string:
- return v, nil
- case json.Number:
- return string(v), nil
- case int:
- return strconv.Itoa(v), nil
- case int64:
- return strconv.FormatInt(v, 10), nil
- case float64:
- return fmt.Sprintf("%f", v), nil
- case bool:
- if v {
- return "true", nil
- } else {
- return "false", nil
- }
- case nil:
- return "null", nil
- default:
- return "", fmt.Errorf("%T is not a string", v)
- }
-}
-
-func MarshalIntID(i int) Marshaler {
- return WriterFunc(func(w io.Writer) {
- writeQuotedString(w, strconv.Itoa(i))
- })
-}
-
-func UnmarshalIntID(v interface{}) (int, error) {
- switch v := v.(type) {
- case string:
- return strconv.Atoi(v)
- case int:
- return v, nil
- case int64:
- return int(v), nil
- case json.Number:
- return strconv.Atoi(string(v))
- default:
- return 0, fmt.Errorf("%T is not an int", v)
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/input.go b/vendor/github.com/99designs/gqlgen/graphql/input.go
deleted file mode 100644
index 88c3efaa6e..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/input.go
+++ /dev/null
@@ -1,55 +0,0 @@
-package graphql
-
-import (
- "context"
- "errors"
- "reflect"
-)
-
-const unmarshalInputCtx key = "unmarshal_input_context"
-
-// BuildUnmarshalerMap returns a map of unmarshal functions of the ExecutableContext
-// to use with the WithUnmarshalerMap function.
-func BuildUnmarshalerMap(unmarshaler ...interface{}) map[reflect.Type]reflect.Value {
- maps := make(map[reflect.Type]reflect.Value)
- for _, v := range unmarshaler {
- ft := reflect.TypeOf(v)
- if ft.Kind() == reflect.Func {
- maps[ft.Out(0)] = reflect.ValueOf(v)
- }
- }
-
- return maps
-}
-
-// WithUnmarshalerMap returns a new context with a map from input types to their unmarshaler functions.
-func WithUnmarshalerMap(ctx context.Context, maps map[reflect.Type]reflect.Value) context.Context {
- return context.WithValue(ctx, unmarshalInputCtx, maps)
-}
-
-// UnmarshalInputFromContext allows unmarshaling input object from a context.
-func UnmarshalInputFromContext(ctx context.Context, raw, v interface{}) error {
- m, ok := ctx.Value(unmarshalInputCtx).(map[reflect.Type]reflect.Value)
- if m == nil || !ok {
- return errors.New("graphql: the input context is empty")
- }
-
- rv := reflect.ValueOf(v)
- if rv.Kind() != reflect.Ptr || rv.IsNil() {
- return errors.New("graphql: input must be a non-nil pointer")
- }
- if fn, ok := m[rv.Elem().Type()]; ok {
- res := fn.Call([]reflect.Value{
- reflect.ValueOf(ctx),
- reflect.ValueOf(raw),
- })
- if err := res[1].Interface(); err != nil {
- return err.(error)
- }
-
- rv.Elem().Set(res[0])
- return nil
- }
-
- return errors.New("graphql: no unmarshal function found")
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/int.go b/vendor/github.com/99designs/gqlgen/graphql/int.go
deleted file mode 100644
index 57d0d589ba..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/int.go
+++ /dev/null
@@ -1,79 +0,0 @@
-package graphql
-
-import (
- "encoding/json"
- "fmt"
- "io"
- "strconv"
-)
-
-func MarshalInt(i int) Marshaler {
- return WriterFunc(func(w io.Writer) {
- io.WriteString(w, strconv.Itoa(i))
- })
-}
-
-func UnmarshalInt(v interface{}) (int, error) {
- switch v := v.(type) {
- case string:
- return strconv.Atoi(v)
- case int:
- return v, nil
- case int64:
- return int(v), nil
- case json.Number:
- return strconv.Atoi(string(v))
- default:
- return 0, fmt.Errorf("%T is not an int", v)
- }
-}
-
-func MarshalInt64(i int64) Marshaler {
- return WriterFunc(func(w io.Writer) {
- io.WriteString(w, strconv.FormatInt(i, 10))
- })
-}
-
-func UnmarshalInt64(v interface{}) (int64, error) {
- switch v := v.(type) {
- case string:
- return strconv.ParseInt(v, 10, 64)
- case int:
- return int64(v), nil
- case int64:
- return v, nil
- case json.Number:
- return strconv.ParseInt(string(v), 10, 64)
- default:
- return 0, fmt.Errorf("%T is not an int", v)
- }
-}
-
-func MarshalInt32(i int32) Marshaler {
- return WriterFunc(func(w io.Writer) {
- io.WriteString(w, strconv.FormatInt(int64(i), 10))
- })
-}
-
-func UnmarshalInt32(v interface{}) (int32, error) {
- switch v := v.(type) {
- case string:
- iv, err := strconv.ParseInt(v, 10, 32)
- if err != nil {
- return 0, err
- }
- return int32(iv), nil
- case int:
- return int32(v), nil
- case int64:
- return int32(v), nil
- case json.Number:
- iv, err := strconv.ParseInt(string(v), 10, 32)
- if err != nil {
- return 0, err
- }
- return int32(iv), nil
- default:
- return 0, fmt.Errorf("%T is not an int", v)
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/introspection/introspection.go b/vendor/github.com/99designs/gqlgen/graphql/introspection/introspection.go
deleted file mode 100644
index 8482d62a86..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/introspection/introspection.go
+++ /dev/null
@@ -1,101 +0,0 @@
-// introspection implements the spec defined in https://github.com/facebook/graphql/blob/master/spec/Section%204%20--%20Introspection.md#schema-introspection
-package introspection
-
-import "github.com/vektah/gqlparser/v2/ast"
-
-type (
- Directive struct {
- Name string
- description string
- Locations []string
- Args []InputValue
- IsRepeatable bool
- }
-
- EnumValue struct {
- Name string
- description string
- deprecation *ast.Directive
- }
-
- Field struct {
- Name string
- description string
- Type *Type
- Args []InputValue
- deprecation *ast.Directive
- }
-
- InputValue struct {
- Name string
- description string
- DefaultValue *string
- Type *Type
- }
-)
-
-func WrapSchema(schema *ast.Schema) *Schema {
- return &Schema{schema: schema}
-}
-
-func (f *EnumValue) Description() *string {
- if f.description == "" {
- return nil
- }
- return &f.description
-}
-
-func (f *EnumValue) IsDeprecated() bool {
- return f.deprecation != nil
-}
-
-func (f *EnumValue) DeprecationReason() *string {
- if f.deprecation == nil {
- return nil
- }
-
- reason := f.deprecation.Arguments.ForName("reason")
- if reason == nil {
- return nil
- }
-
- return &reason.Value.Raw
-}
-
-func (f *Field) Description() *string {
- if f.description == "" {
- return nil
- }
- return &f.description
-}
-
-func (f *Field) IsDeprecated() bool {
- return f.deprecation != nil
-}
-
-func (f *Field) DeprecationReason() *string {
- if f.deprecation == nil {
- return nil
- }
-
- reason := f.deprecation.Arguments.ForName("reason")
- if reason == nil {
- return nil
- }
-
- return &reason.Value.Raw
-}
-
-func (f *InputValue) Description() *string {
- if f.description == "" {
- return nil
- }
- return &f.description
-}
-
-func (f *Directive) Description() *string {
- if f.description == "" {
- return nil
- }
- return &f.description
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/introspection/query.go b/vendor/github.com/99designs/gqlgen/graphql/introspection/query.go
deleted file mode 100644
index 389a5d85c0..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/introspection/query.go
+++ /dev/null
@@ -1,106 +0,0 @@
-package introspection
-
-// Query is the query generated by graphiql to determine type information
-const Query = `
-query IntrospectionQuery {
- __schema {
- description
- queryType {
- name
- }
- mutationType {
- name
- }
- subscriptionType {
- name
- }
- types {
- ...FullType
- }
- directives {
- name
- description
- locations
- args {
- ...InputValue
- }
- }
- }
-}
-
-fragment FullType on __Type {
- kind
- name
- description
- specifiedByURL
- fields(includeDeprecated: true) {
- name
- description
- args {
- ...InputValue
- }
- type {
- ...TypeRef
- }
- isDeprecated
- deprecationReason
- }
- inputFields {
- ...InputValue
- }
- interfaces {
- ...TypeRef
- }
- enumValues(includeDeprecated: true) {
- name
- description
- isDeprecated
- deprecationReason
- }
- possibleTypes {
- ...TypeRef
- }
-}
-
-fragment InputValue on __InputValue {
- name
- description
- type {
- ...TypeRef
- }
- defaultValue
-}
-
-fragment TypeRef on __Type {
- kind
- name
- ofType {
- kind
- name
- ofType {
- kind
- name
- ofType {
- kind
- name
- ofType {
- kind
- name
- ofType {
- kind
- name
- ofType {
- kind
- name
- ofType {
- kind
- name
- }
- }
- }
- }
- }
- }
- }
-}
-`
diff --git a/vendor/github.com/99designs/gqlgen/graphql/introspection/schema.go b/vendor/github.com/99designs/gqlgen/graphql/introspection/schema.go
deleted file mode 100644
index b7b0ad94e0..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/introspection/schema.go
+++ /dev/null
@@ -1,93 +0,0 @@
-package introspection
-
-import (
- "sort"
- "strings"
-
- "github.com/vektah/gqlparser/v2/ast"
-)
-
-type Schema struct {
- schema *ast.Schema
-}
-
-func (s *Schema) Description() *string {
- if s.schema.Description == "" {
- return nil
- }
- return &s.schema.Description
-}
-
-func (s *Schema) Types() []Type {
- typeIndex := map[string]Type{}
- typeNames := make([]string, 0, len(s.schema.Types))
- for _, typ := range s.schema.Types {
- if strings.HasPrefix(typ.Name, "__") {
- continue
- }
- typeNames = append(typeNames, typ.Name)
- typeIndex[typ.Name] = *WrapTypeFromDef(s.schema, typ)
- }
- sort.Strings(typeNames)
-
- types := make([]Type, len(typeNames))
- for i, t := range typeNames {
- types[i] = typeIndex[t]
- }
- return types
-}
-
-func (s *Schema) QueryType() *Type {
- return WrapTypeFromDef(s.schema, s.schema.Query)
-}
-
-func (s *Schema) MutationType() *Type {
- return WrapTypeFromDef(s.schema, s.schema.Mutation)
-}
-
-func (s *Schema) SubscriptionType() *Type {
- return WrapTypeFromDef(s.schema, s.schema.Subscription)
-}
-
-func (s *Schema) Directives() []Directive {
- dIndex := map[string]Directive{}
- dNames := make([]string, 0, len(s.schema.Directives))
-
- for _, d := range s.schema.Directives {
- dNames = append(dNames, d.Name)
- dIndex[d.Name] = s.directiveFromDef(d)
- }
- sort.Strings(dNames)
-
- res := make([]Directive, len(dNames))
- for i, d := range dNames {
- res[i] = dIndex[d]
- }
-
- return res
-}
-
-func (s *Schema) directiveFromDef(d *ast.DirectiveDefinition) Directive {
- locs := make([]string, len(d.Locations))
- for i, loc := range d.Locations {
- locs[i] = string(loc)
- }
-
- args := make([]InputValue, len(d.Arguments))
- for i, arg := range d.Arguments {
- args[i] = InputValue{
- Name: arg.Name,
- description: arg.Description,
- DefaultValue: defaultValue(arg.DefaultValue),
- Type: WrapTypeFromType(s.schema, arg.Type),
- }
- }
-
- return Directive{
- Name: d.Name,
- description: d.Description,
- Locations: locs,
- Args: args,
- IsRepeatable: d.IsRepeatable,
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/introspection/type.go b/vendor/github.com/99designs/gqlgen/graphql/introspection/type.go
deleted file mode 100644
index c50733d0df..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/introspection/type.go
+++ /dev/null
@@ -1,191 +0,0 @@
-package introspection
-
-import (
- "strings"
-
- "github.com/vektah/gqlparser/v2/ast"
-)
-
-type Type struct {
- schema *ast.Schema
- def *ast.Definition
- typ *ast.Type
-}
-
-func WrapTypeFromDef(s *ast.Schema, def *ast.Definition) *Type {
- if def == nil {
- return nil
- }
- return &Type{schema: s, def: def}
-}
-
-func WrapTypeFromType(s *ast.Schema, typ *ast.Type) *Type {
- if typ == nil {
- return nil
- }
-
- if !typ.NonNull && typ.NamedType != "" {
- return &Type{schema: s, def: s.Types[typ.NamedType]}
- }
- return &Type{schema: s, typ: typ}
-}
-
-func (t *Type) Kind() string {
- if t.typ != nil {
- if t.typ.NonNull {
- return "NON_NULL"
- }
-
- if t.typ.Elem != nil {
- return "LIST"
- }
- } else {
- return string(t.def.Kind)
- }
-
- panic("UNKNOWN")
-}
-
-func (t *Type) Name() *string {
- if t.def == nil {
- return nil
- }
- return &t.def.Name
-}
-
-func (t *Type) Description() *string {
- if t.def == nil || t.def.Description == "" {
- return nil
- }
- return &t.def.Description
-}
-
-func (t *Type) Fields(includeDeprecated bool) []Field {
- if t.def == nil || (t.def.Kind != ast.Object && t.def.Kind != ast.Interface) {
- return []Field{}
- }
- fields := []Field{}
- for _, f := range t.def.Fields {
- if strings.HasPrefix(f.Name, "__") {
- continue
- }
-
- if !includeDeprecated && f.Directives.ForName("deprecated") != nil {
- continue
- }
-
- var args []InputValue
- for _, arg := range f.Arguments {
- args = append(args, InputValue{
- Type: WrapTypeFromType(t.schema, arg.Type),
- Name: arg.Name,
- description: arg.Description,
- DefaultValue: defaultValue(arg.DefaultValue),
- })
- }
-
- fields = append(fields, Field{
- Name: f.Name,
- description: f.Description,
- Args: args,
- Type: WrapTypeFromType(t.schema, f.Type),
- deprecation: f.Directives.ForName("deprecated"),
- })
- }
- return fields
-}
-
-func (t *Type) InputFields() []InputValue {
- if t.def == nil || t.def.Kind != ast.InputObject {
- return []InputValue{}
- }
-
- res := []InputValue{}
- for _, f := range t.def.Fields {
- res = append(res, InputValue{
- Name: f.Name,
- description: f.Description,
- Type: WrapTypeFromType(t.schema, f.Type),
- DefaultValue: defaultValue(f.DefaultValue),
- })
- }
- return res
-}
-
-func defaultValue(value *ast.Value) *string {
- if value == nil {
- return nil
- }
- val := value.String()
- return &val
-}
-
-func (t *Type) Interfaces() []Type {
- if t.def == nil || t.def.Kind != ast.Object {
- return []Type{}
- }
-
- res := []Type{}
- for _, intf := range t.def.Interfaces {
- res = append(res, *WrapTypeFromDef(t.schema, t.schema.Types[intf]))
- }
-
- return res
-}
-
-func (t *Type) PossibleTypes() []Type {
- if t.def == nil || (t.def.Kind != ast.Interface && t.def.Kind != ast.Union) {
- return []Type{}
- }
-
- res := []Type{}
- for _, pt := range t.schema.GetPossibleTypes(t.def) {
- res = append(res, *WrapTypeFromDef(t.schema, pt))
- }
- return res
-}
-
-func (t *Type) EnumValues(includeDeprecated bool) []EnumValue {
- if t.def == nil || t.def.Kind != ast.Enum {
- return []EnumValue{}
- }
-
- res := []EnumValue{}
- for _, val := range t.def.EnumValues {
- if !includeDeprecated && val.Directives.ForName("deprecated") != nil {
- continue
- }
-
- res = append(res, EnumValue{
- Name: val.Name,
- description: val.Description,
- deprecation: val.Directives.ForName("deprecated"),
- })
- }
- return res
-}
-
-func (t *Type) OfType() *Type {
- if t.typ == nil {
- return nil
- }
- if t.typ.NonNull {
- // fake non null nodes
- cpy := *t.typ
- cpy.NonNull = false
-
- return WrapTypeFromType(t.schema, &cpy)
- }
- return WrapTypeFromType(t.schema, t.typ.Elem)
-}
-
-func (t *Type) SpecifiedByURL() *string {
- directive := t.def.Directives.ForName("specifiedBy")
- if t.def.Kind != ast.Scalar || directive == nil {
- return nil
- }
- // def: directive @specifiedBy(url: String!) on SCALAR
- // the argument "url" is required.
- url := directive.Arguments.ForName("url")
- return &url.Value.Raw
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/jsonw.go b/vendor/github.com/99designs/gqlgen/graphql/jsonw.go
deleted file mode 100644
index 54e293f1ad..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/jsonw.go
+++ /dev/null
@@ -1,93 +0,0 @@
-package graphql
-
-import (
- "context"
- "io"
-)
-
-var (
- nullLit = []byte(`null`)
- trueLit = []byte(`true`)
- falseLit = []byte(`false`)
- openBrace = []byte(`{`)
- closeBrace = []byte(`}`)
- openBracket = []byte(`[`)
- closeBracket = []byte(`]`)
- colon = []byte(`:`)
- comma = []byte(`,`)
-)
-
-var (
- Null = &lit{nullLit}
- True = &lit{trueLit}
- False = &lit{falseLit}
-)
-
-type Marshaler interface {
- MarshalGQL(w io.Writer)
-}
-
-type Unmarshaler interface {
- UnmarshalGQL(v interface{}) error
-}
-
-type ContextMarshaler interface {
- MarshalGQLContext(ctx context.Context, w io.Writer) error
-}
-
-type ContextUnmarshaler interface {
- UnmarshalGQLContext(ctx context.Context, v interface{}) error
-}
-
-type contextMarshalerAdapter struct {
- Context context.Context
- ContextMarshaler
-}
-
-func WrapContextMarshaler(ctx context.Context, m ContextMarshaler) Marshaler {
- return contextMarshalerAdapter{Context: ctx, ContextMarshaler: m}
-}
-
-func (a contextMarshalerAdapter) MarshalGQL(w io.Writer) {
- err := a.MarshalGQLContext(a.Context, w)
- if err != nil {
- AddError(a.Context, err)
- Null.MarshalGQL(w)
- }
-}
-
-type WriterFunc func(writer io.Writer)
-
-func (f WriterFunc) MarshalGQL(w io.Writer) {
- f(w)
-}
-
-type ContextWriterFunc func(ctx context.Context, writer io.Writer) error
-
-func (f ContextWriterFunc) MarshalGQLContext(ctx context.Context, w io.Writer) error {
- return f(ctx, w)
-}
-
-type Array []Marshaler
-
-func (a Array) MarshalGQL(writer io.Writer) {
- writer.Write(openBracket)
- for i, val := range a {
- if i != 0 {
- writer.Write(comma)
- }
- val.MarshalGQL(writer)
- }
- writer.Write(closeBracket)
-}
-
-type lit struct{ b []byte }
-
-func (l lit) MarshalGQL(w io.Writer) {
- w.Write(l.b)
-}
-
-func (l lit) MarshalGQLContext(ctx context.Context, w io.Writer) error {
- w.Write(l.b)
- return nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/map.go b/vendor/github.com/99designs/gqlgen/graphql/map.go
deleted file mode 100644
index 1e91d1d98c..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/map.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package graphql
-
-import (
- "encoding/json"
- "fmt"
- "io"
-)
-
-func MarshalMap(val map[string]interface{}) Marshaler {
- return WriterFunc(func(w io.Writer) {
- err := json.NewEncoder(w).Encode(val)
- if err != nil {
- panic(err)
- }
- })
-}
-
-func UnmarshalMap(v interface{}) (map[string]interface{}, error) {
- if m, ok := v.(map[string]interface{}); ok {
- return m, nil
- }
-
- return nil, fmt.Errorf("%T is not a map", v)
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/oneshot.go b/vendor/github.com/99designs/gqlgen/graphql/oneshot.go
deleted file mode 100644
index 01fa15f896..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/oneshot.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package graphql
-
-import "context"
-
-func OneShot(resp *Response) ResponseHandler {
- var oneshot bool
-
- return func(context context.Context) *Response {
- if oneshot {
- return nil
- }
- oneshot = true
-
- return resp
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/recovery.go b/vendor/github.com/99designs/gqlgen/graphql/recovery.go
deleted file mode 100644
index 9bc0e47e1d..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/recovery.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package graphql
-
-import (
- "context"
- "fmt"
- "os"
- "runtime/debug"
-
- "github.com/vektah/gqlparser/v2/gqlerror"
-)
-
-type RecoverFunc func(ctx context.Context, err interface{}) (userMessage error)
-
-func DefaultRecover(ctx context.Context, err interface{}) error {
- fmt.Fprintln(os.Stderr, err)
- fmt.Fprintln(os.Stderr)
- debug.PrintStack()
-
- return gqlerror.Errorf("internal system error")
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/response.go b/vendor/github.com/99designs/gqlgen/graphql/response.go
deleted file mode 100644
index 0d36049a33..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/response.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package graphql
-
-import (
- "context"
- "encoding/json"
- "fmt"
-
- "github.com/vektah/gqlparser/v2/gqlerror"
-)
-
-// Errors are intentionally serialized first based on the advice in
-// https://github.com/facebook/graphql/commit/7b40390d48680b15cb93e02d46ac5eb249689876#diff-757cea6edf0288677a9eea4cfc801d87R107
-// and https://github.com/facebook/graphql/pull/384
-type Response struct {
- Errors gqlerror.List `json:"errors,omitempty"`
- Data json.RawMessage `json:"data"`
- Extensions map[string]interface{} `json:"extensions,omitempty"`
-}
-
-func ErrorResponse(ctx context.Context, messagef string, args ...interface{}) *Response {
- return &Response{
- Errors: gqlerror.List{{Message: fmt.Sprintf(messagef, args...)}},
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/root.go b/vendor/github.com/99designs/gqlgen/graphql/root.go
deleted file mode 100644
index 3405d18054..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/root.go
+++ /dev/null
@@ -1,7 +0,0 @@
-package graphql
-
-type Query struct{}
-
-type Mutation struct{}
-
-type Subscription struct{}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/stats.go b/vendor/github.com/99designs/gqlgen/graphql/stats.go
deleted file mode 100644
index a52e143ebe..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/stats.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package graphql
-
-import (
- "context"
- "fmt"
- "time"
-)
-
-type Stats struct {
- OperationStart time.Time
- Read TraceTiming
- Parsing TraceTiming
- Validation TraceTiming
-
- // Stats collected by handler extensions. Dont use directly, the extension should provide a type safe way to
- // access this.
- extension map[string]interface{}
-}
-
-type TraceTiming struct {
- Start time.Time
- End time.Time
-}
-
-var ctxTraceStart key = "trace_start"
-
-// StartOperationTrace captures the current time and stores it in context. This will eventually be added to request
-// context but we want to grab it as soon as possible. For transports that can only handle a single graphql query
-// per http requests you dont need to call this at all, the server will do it for you. For transports that handle
-// multiple (eg batching, subscriptions) this should be called before decoding each request.
-func StartOperationTrace(ctx context.Context) context.Context {
- return context.WithValue(ctx, ctxTraceStart, Now())
-}
-
-// GetStartTime should only be called by the handler package, it will be set into request context
-// as Stats.Start
-func GetStartTime(ctx context.Context) time.Time {
- t, ok := ctx.Value(ctxTraceStart).(time.Time)
- if !ok {
- panic(fmt.Sprintf("missing start time: %T", ctx.Value(ctxTraceStart)))
- }
- return t
-}
-
-func (c *Stats) SetExtension(name string, data interface{}) {
- if c.extension == nil {
- c.extension = map[string]interface{}{}
- }
- c.extension[name] = data
-}
-
-func (c *Stats) GetExtension(name string) interface{} {
- if c.extension == nil {
- return nil
- }
- return c.extension[name]
-}
-
-// Now is time.Now, except in tests. Then it can be whatever you want it to be.
-var Now = time.Now
diff --git a/vendor/github.com/99designs/gqlgen/graphql/string.go b/vendor/github.com/99designs/gqlgen/graphql/string.go
deleted file mode 100644
index 742e50cc3b..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/string.go
+++ /dev/null
@@ -1,70 +0,0 @@
-package graphql
-
-import (
- "fmt"
- "io"
- "strconv"
-)
-
-const encodeHex = "0123456789ABCDEF"
-
-func MarshalString(s string) Marshaler {
- return WriterFunc(func(w io.Writer) {
- writeQuotedString(w, s)
- })
-}
-
-func writeQuotedString(w io.Writer, s string) {
- start := 0
- io.WriteString(w, `"`)
-
- for i, c := range s {
- if c < 0x20 || c == '\\' || c == '"' {
- io.WriteString(w, s[start:i])
-
- switch c {
- case '\t':
- io.WriteString(w, `\t`)
- case '\r':
- io.WriteString(w, `\r`)
- case '\n':
- io.WriteString(w, `\n`)
- case '\\':
- io.WriteString(w, `\\`)
- case '"':
- io.WriteString(w, `\"`)
- default:
- io.WriteString(w, `\u00`)
- w.Write([]byte{encodeHex[c>>4], encodeHex[c&0xf]})
- }
-
- start = i + 1
- }
- }
-
- io.WriteString(w, s[start:])
- io.WriteString(w, `"`)
-}
-
-func UnmarshalString(v interface{}) (string, error) {
- switch v := v.(type) {
- case string:
- return v, nil
- case int:
- return strconv.Itoa(v), nil
- case int64:
- return strconv.FormatInt(v, 10), nil
- case float64:
- return fmt.Sprintf("%f", v), nil
- case bool:
- if v {
- return "true", nil
- } else {
- return "false", nil
- }
- case nil:
- return "null", nil
- default:
- return "", fmt.Errorf("%T is not a string", v)
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/time.go b/vendor/github.com/99designs/gqlgen/graphql/time.go
deleted file mode 100644
index ef3d17da32..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/time.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package graphql
-
-import (
- "errors"
- "io"
- "strconv"
- "time"
-)
-
-func MarshalTime(t time.Time) Marshaler {
- if t.IsZero() {
- return Null
- }
-
- return WriterFunc(func(w io.Writer) {
- io.WriteString(w, strconv.Quote(t.Format(time.RFC3339Nano)))
- })
-}
-
-func UnmarshalTime(v interface{}) (time.Time, error) {
- if tmpStr, ok := v.(string); ok {
- return time.Parse(time.RFC3339Nano, tmpStr)
- }
- return time.Time{}, errors.New("time should be RFC3339Nano formatted string")
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/uint.go b/vendor/github.com/99designs/gqlgen/graphql/uint.go
deleted file mode 100644
index 9349c2f4d2..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/uint.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package graphql
-
-import (
- "encoding/json"
- "fmt"
- "io"
- "strconv"
-)
-
-func MarshalUint(i uint) Marshaler {
- return WriterFunc(func(w io.Writer) {
- _, _ = io.WriteString(w, strconv.FormatUint(uint64(i), 10))
- })
-}
-
-func UnmarshalUint(v interface{}) (uint, error) {
- switch v := v.(type) {
- case string:
- u64, err := strconv.ParseUint(v, 10, 64)
- return uint(u64), err
- case int:
- return uint(v), nil
- case int64:
- return uint(v), nil
- case json.Number:
- u64, err := strconv.ParseUint(string(v), 10, 64)
- return uint(u64), err
- default:
- return 0, fmt.Errorf("%T is not an uint", v)
- }
-}
-
-func MarshalUint64(i uint64) Marshaler {
- return WriterFunc(func(w io.Writer) {
- _, _ = io.WriteString(w, strconv.FormatUint(i, 10))
- })
-}
-
-func UnmarshalUint64(v interface{}) (uint64, error) {
- switch v := v.(type) {
- case string:
- return strconv.ParseUint(v, 10, 64)
- case int:
- return uint64(v), nil
- case int64:
- return uint64(v), nil
- case json.Number:
- return strconv.ParseUint(string(v), 10, 64)
- default:
- return 0, fmt.Errorf("%T is not an uint", v)
- }
-}
-
-func MarshalUint32(i uint32) Marshaler {
- return WriterFunc(func(w io.Writer) {
- _, _ = io.WriteString(w, strconv.FormatUint(uint64(i), 10))
- })
-}
-
-func UnmarshalUint32(v interface{}) (uint32, error) {
- switch v := v.(type) {
- case string:
- iv, err := strconv.ParseInt(v, 10, 32)
- if err != nil {
- return 0, err
- }
- return uint32(iv), nil
- case int:
- return uint32(v), nil
- case int64:
- return uint32(v), nil
- case json.Number:
- iv, err := strconv.ParseUint(string(v), 10, 32)
- if err != nil {
- return 0, err
- }
- return uint32(iv), nil
- default:
- return 0, fmt.Errorf("%T is not an uint", v)
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/upload.go b/vendor/github.com/99designs/gqlgen/graphql/upload.go
deleted file mode 100644
index dafbde6508..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/upload.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package graphql
-
-import (
- "fmt"
- "io"
-)
-
-type Upload struct {
- File io.ReadSeeker
- Filename string
- Size int64
- ContentType string
-}
-
-func MarshalUpload(f Upload) Marshaler {
- return WriterFunc(func(w io.Writer) {
- io.Copy(w, f.File)
- })
-}
-
-func UnmarshalUpload(v interface{}) (Upload, error) {
- upload, ok := v.(Upload)
- if !ok {
- return Upload{}, fmt.Errorf("%T is not an Upload", v)
- }
- return upload, nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/version.go b/vendor/github.com/99designs/gqlgen/graphql/version.go
deleted file mode 100644
index c0c06f6599..0000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/version.go
+++ /dev/null
@@ -1,3 +0,0 @@
-package graphql
-
-const Version = "v0.17.20"
diff --git a/vendor/github.com/99designs/gqlgen/internal/code/compare.go b/vendor/github.com/99designs/gqlgen/internal/code/compare.go
deleted file mode 100644
index 1150a24e48..0000000000
--- a/vendor/github.com/99designs/gqlgen/internal/code/compare.go
+++ /dev/null
@@ -1,161 +0,0 @@
-package code
-
-import (
- "fmt"
- "go/types"
-)
-
-// CompatibleTypes isnt a strict comparison, it allows for pointer differences
-func CompatibleTypes(expected types.Type, actual types.Type) error {
- // Special case to deal with pointer mismatches
- {
- expectedPtr, expectedIsPtr := expected.(*types.Pointer)
- actualPtr, actualIsPtr := actual.(*types.Pointer)
-
- if expectedIsPtr && actualIsPtr {
- return CompatibleTypes(expectedPtr.Elem(), actualPtr.Elem())
- }
- if expectedIsPtr && !actualIsPtr {
- return CompatibleTypes(expectedPtr.Elem(), actual)
- }
- if !expectedIsPtr && actualIsPtr {
- return CompatibleTypes(expected, actualPtr.Elem())
- }
- }
-
- switch expected := expected.(type) {
- case *types.Slice:
- if actual, ok := actual.(*types.Slice); ok {
- return CompatibleTypes(expected.Elem(), actual.Elem())
- }
-
- case *types.Array:
- if actual, ok := actual.(*types.Array); ok {
- if expected.Len() != actual.Len() {
- return fmt.Errorf("array length differs")
- }
-
- return CompatibleTypes(expected.Elem(), actual.Elem())
- }
-
- case *types.Basic:
- if actual, ok := actual.(*types.Basic); ok {
- if actual.Kind() != expected.Kind() {
- return fmt.Errorf("basic kind differs, %s != %s", expected.Name(), actual.Name())
- }
-
- return nil
- }
-
- case *types.Struct:
- if actual, ok := actual.(*types.Struct); ok {
- if expected.NumFields() != actual.NumFields() {
- return fmt.Errorf("number of struct fields differ")
- }
-
- for i := 0; i < expected.NumFields(); i++ {
- if expected.Field(i).Name() != actual.Field(i).Name() {
- return fmt.Errorf("struct field %d name differs, %s != %s", i, expected.Field(i).Name(), actual.Field(i).Name())
- }
- if err := CompatibleTypes(expected.Field(i).Type(), actual.Field(i).Type()); err != nil {
- return err
- }
- }
- return nil
- }
-
- case *types.Tuple:
- if actual, ok := actual.(*types.Tuple); ok {
- if expected.Len() != actual.Len() {
- return fmt.Errorf("tuple length differs, %d != %d", expected.Len(), actual.Len())
- }
-
- for i := 0; i < expected.Len(); i++ {
- if err := CompatibleTypes(expected.At(i).Type(), actual.At(i).Type()); err != nil {
- return err
- }
- }
-
- return nil
- }
-
- case *types.Signature:
- if actual, ok := actual.(*types.Signature); ok {
- if err := CompatibleTypes(expected.Params(), actual.Params()); err != nil {
- return err
- }
- if err := CompatibleTypes(expected.Results(), actual.Results()); err != nil {
- return err
- }
-
- return nil
- }
- case *types.Interface:
- if actual, ok := actual.(*types.Interface); ok {
- if expected.NumMethods() != actual.NumMethods() {
- return fmt.Errorf("interface method count differs, %d != %d", expected.NumMethods(), actual.NumMethods())
- }
-
- for i := 0; i < expected.NumMethods(); i++ {
- if expected.Method(i).Name() != actual.Method(i).Name() {
- return fmt.Errorf("interface method %d name differs, %s != %s", i, expected.Method(i).Name(), actual.Method(i).Name())
- }
- if err := CompatibleTypes(expected.Method(i).Type(), actual.Method(i).Type()); err != nil {
- return err
- }
- }
-
- return nil
- }
-
- case *types.Map:
- if actual, ok := actual.(*types.Map); ok {
- if err := CompatibleTypes(expected.Key(), actual.Key()); err != nil {
- return err
- }
-
- if err := CompatibleTypes(expected.Elem(), actual.Elem()); err != nil {
- return err
- }
-
- return nil
- }
-
- case *types.Chan:
- if actual, ok := actual.(*types.Chan); ok {
- return CompatibleTypes(expected.Elem(), actual.Elem())
- }
-
- case *types.Named:
- if actual, ok := actual.(*types.Named); ok {
- if NormalizeVendor(expected.Obj().Pkg().Path()) != NormalizeVendor(actual.Obj().Pkg().Path()) {
- return fmt.Errorf(
- "package name of named type differs, %s != %s",
- NormalizeVendor(expected.Obj().Pkg().Path()),
- NormalizeVendor(actual.Obj().Pkg().Path()),
- )
- }
-
- if expected.Obj().Name() != actual.Obj().Name() {
- return fmt.Errorf(
- "named type name differs, %s != %s",
- NormalizeVendor(expected.Obj().Name()),
- NormalizeVendor(actual.Obj().Name()),
- )
- }
-
- return nil
- }
-
- // Before models are generated all missing references will be Invalid Basic references.
- // lets assume these are valid too.
- if actual, ok := actual.(*types.Basic); ok && actual.Kind() == types.Invalid {
- return nil
- }
-
- default:
- return fmt.Errorf("missing support for %T", expected)
- }
-
- return fmt.Errorf("type mismatch %T != %T", expected, actual)
-}
diff --git a/vendor/github.com/99designs/gqlgen/internal/code/imports.go b/vendor/github.com/99designs/gqlgen/internal/code/imports.go
deleted file mode 100644
index 0e499a171f..0000000000
--- a/vendor/github.com/99designs/gqlgen/internal/code/imports.go
+++ /dev/null
@@ -1,174 +0,0 @@
-package code
-
-import (
- "bufio"
- "fmt"
- "go/build"
- "go/parser"
- "go/token"
- "os"
- "path/filepath"
- "regexp"
- "strings"
-)
-
-var gopaths []string
-
-func init() {
- gopaths = filepath.SplitList(build.Default.GOPATH)
- for i, p := range gopaths {
- gopaths[i] = filepath.ToSlash(filepath.Join(p, "src"))
- }
-}
-
-// NameForDir manually looks for package stanzas in files located in the given directory. This can be
-// much faster than having to consult go list, because we already know exactly where to look.
-func NameForDir(dir string) string {
- dir, err := filepath.Abs(dir)
- if err != nil {
- return SanitizePackageName(filepath.Base(dir))
- }
- files, err := os.ReadDir(dir)
- if err != nil {
- return SanitizePackageName(filepath.Base(dir))
- }
- fset := token.NewFileSet()
- for _, file := range files {
- if !strings.HasSuffix(strings.ToLower(file.Name()), ".go") {
- continue
- }
-
- filename := filepath.Join(dir, file.Name())
- if src, err := parser.ParseFile(fset, filename, nil, parser.PackageClauseOnly); err == nil {
- return src.Name.Name
- }
- }
-
- return SanitizePackageName(filepath.Base(dir))
-}
-
-type goModuleSearchResult struct {
- path string
- goModPath string
- moduleName string
-}
-
-var goModuleRootCache = map[string]goModuleSearchResult{}
-
-// goModuleRoot returns the root of the current go module if there is a go.mod file in the directory tree
-// If not, it returns false
-func goModuleRoot(dir string) (string, bool) {
- dir, err := filepath.Abs(dir)
- if err != nil {
- panic(err)
- }
- dir = filepath.ToSlash(dir)
-
- dirs := []string{dir}
- result := goModuleSearchResult{}
-
- for {
- modDir := dirs[len(dirs)-1]
-
- if val, ok := goModuleRootCache[dir]; ok {
- result = val
- break
- }
-
- if content, err := os.ReadFile(filepath.Join(modDir, "go.mod")); err == nil {
- moduleName := extractModuleName(content)
- result = goModuleSearchResult{
- path: moduleName,
- goModPath: modDir,
- moduleName: moduleName,
- }
- goModuleRootCache[modDir] = result
- break
- }
-
- if modDir == "" || modDir == "." || modDir == "/" || strings.HasSuffix(modDir, "\\") {
- // Reached the top of the file tree which means go.mod file is not found
- // Set root folder with a sentinel cache value
- goModuleRootCache[modDir] = result
- break
- }
-
- dirs = append(dirs, filepath.Dir(modDir))
- }
-
- // create a cache for each path in a tree traversed, except the top one as it is already cached
- for _, d := range dirs[:len(dirs)-1] {
- if result.moduleName == "" {
- // go.mod is not found in the tree, so the same sentinel value fits all the directories in a tree
- goModuleRootCache[d] = result
- } else {
- if relPath, err := filepath.Rel(result.goModPath, d); err != nil {
- panic(err)
- } else {
- path := result.moduleName
- relPath := filepath.ToSlash(relPath)
- if !strings.HasSuffix(relPath, "/") {
- path += "/"
- }
- path += relPath
-
- goModuleRootCache[d] = goModuleSearchResult{
- path: path,
- goModPath: result.goModPath,
- moduleName: result.moduleName,
- }
- }
- }
- }
-
- res := goModuleRootCache[dir]
- if res.moduleName == "" {
- return "", false
- }
- return res.path, true
-}
-
-func extractModuleName(content []byte) string {
- for {
- advance, tkn, err := bufio.ScanLines(content, false)
- if err != nil {
- panic(fmt.Errorf("error parsing mod file: %w", err))
- }
- if advance == 0 {
- break
- }
- s := strings.Trim(string(tkn), " \t")
- if len(s) != 0 && !strings.HasPrefix(s, "//") {
- break
- }
- if advance <= len(content) {
- content = content[advance:]
- }
- }
- moduleName := string(modregex.FindSubmatch(content)[1])
- return moduleName
-}
-
-// ImportPathForDir takes a path and returns a golang import path for the package
-func ImportPathForDir(dir string) (res string) {
- dir, err := filepath.Abs(dir)
- if err != nil {
- panic(err)
- }
- dir = filepath.ToSlash(dir)
-
- modDir, ok := goModuleRoot(dir)
- if ok {
- return modDir
- }
-
- for _, gopath := range gopaths {
- if len(gopath) < len(dir) && strings.EqualFold(gopath, dir[0:len(gopath)]) {
- return dir[len(gopath)+1:]
- }
- }
-
- return ""
-}
-
-var modregex = regexp.MustCompile(`module ([^\s]*)`)
diff --git a/vendor/github.com/99designs/gqlgen/internal/code/packages.go b/vendor/github.com/99designs/gqlgen/internal/code/packages.go
deleted file mode 100644
index c800d3d84f..0000000000
--- a/vendor/github.com/99designs/gqlgen/internal/code/packages.go
+++ /dev/null
@@ -1,223 +0,0 @@
-package code
-
-import (
- "bytes"
- "errors"
- "fmt"
- "os"
- "os/exec"
- "path/filepath"
-
- "golang.org/x/tools/go/packages"
-)
-
-var mode = packages.NeedName |
- packages.NeedFiles |
- packages.NeedImports |
- packages.NeedTypes |
- packages.NeedSyntax |
- packages.NeedTypesInfo |
- packages.NeedModule |
- packages.NeedDeps
-
-// Packages is a wrapper around x/tools/go/packages that maintains a (hopefully prewarmed) cache of packages
-// that can be invalidated as writes are made and packages are known to change.
-type Packages struct {
- packages map[string]*packages.Package
- importToName map[string]string
- loadErrors []error
-
- numLoadCalls int // stupid test steam. ignore.
- numNameCalls int // stupid test steam. ignore.
-}
-
-// ReloadAll will call LoadAll after clearing the package cache, so we can reload
-// packages in the case that the packages have changed
-func (p *Packages) ReloadAll(importPaths ...string) []*packages.Package {
- p.packages = nil
- return p.LoadAll(importPaths...)
-}
-
-func (p *Packages) checkModuleLoaded(pkgs []*packages.Package) bool {
- for i := range pkgs {
- if pkgs[i] == nil || pkgs[i].Module == nil {
- return false
- }
- }
- return true
-}
-
-// LoadAll will call packages.Load and return the package data for the given packages,
-// but if the package already have been loaded it will return cached values instead.
-func (p *Packages) LoadAll(importPaths ...string) []*packages.Package {
- if p.packages == nil {
- p.packages = map[string]*packages.Package{}
- }
-
- missing := make([]string, 0, len(importPaths))
- for _, path := range importPaths {
- if _, ok := p.packages[path]; ok {
- continue
- }
- missing = append(missing, path)
- }
-
- if len(missing) > 0 {
- p.numLoadCalls++
- pkgs, err := packages.Load(&packages.Config{Mode: mode}, missing...)
-
- // Sometimes packages.Load not loaded the module info. Call it again to reload it.
- if !p.checkModuleLoaded(pkgs) {
- fmt.Println("reloading module info")
- pkgs, err = packages.Load(&packages.Config{Mode: mode}, missing...)
- }
-
- if err != nil {
- p.loadErrors = append(p.loadErrors, err)
- }
-
- for _, pkg := range pkgs {
- p.addToCache(pkg)
- }
- }
-
- res := make([]*packages.Package, 0, len(importPaths))
- for _, path := range importPaths {
- res = append(res, p.packages[NormalizeVendor(path)])
- }
- return res
-}
-
-func (p *Packages) addToCache(pkg *packages.Package) {
- imp := NormalizeVendor(pkg.PkgPath)
- p.packages[imp] = pkg
- for _, imp := range pkg.Imports {
- if _, found := p.packages[NormalizeVendor(imp.PkgPath)]; !found {
- p.addToCache(imp)
- }
- }
-}
-
-// Load works the same as LoadAll, except a single package at a time.
-func (p *Packages) Load(importPath string) *packages.Package {
- // Quick cache check first to avoid expensive allocations of LoadAll()
- if p.packages != nil {
- if pkg, ok := p.packages[importPath]; ok {
- return pkg
- }
- }
-
- pkgs := p.LoadAll(importPath)
- if len(pkgs) == 0 {
- return nil
- }
- return pkgs[0]
-}
-
-// LoadWithTypes tries a standard load, which may not have enough type info (TypesInfo== nil) available if the imported package is a
-// second order dependency. Fortunately this doesnt happen very often, so we can just issue a load when we detect it.
-func (p *Packages) LoadWithTypes(importPath string) *packages.Package {
- pkg := p.Load(importPath)
- if pkg == nil || pkg.TypesInfo == nil {
- p.numLoadCalls++
- pkgs, err := packages.Load(&packages.Config{Mode: mode}, importPath)
- if err != nil {
- p.loadErrors = append(p.loadErrors, err)
- return nil
- }
- p.addToCache(pkgs[0])
- pkg = pkgs[0]
- }
- return pkg
-}
-
-// NameForPackage looks up the package name from the package stanza in the go files at the given import path.
-func (p *Packages) NameForPackage(importPath string) string {
- if importPath == "" {
- panic(errors.New("import path can not be empty"))
- }
- if p.importToName == nil {
- p.importToName = map[string]string{}
- }
-
- importPath = NormalizeVendor(importPath)
-
- // if its in the name cache use it
- if name := p.importToName[importPath]; name != "" {
- return name
- }
-
- // otherwise we might have already loaded the full package data for it cached
- pkg := p.packages[importPath]
-
- if pkg == nil {
- // otherwise do a name only lookup for it but dont put it in the package cache.
- p.numNameCalls++
- pkgs, err := packages.Load(&packages.Config{Mode: packages.NeedName}, importPath)
- if err != nil {
- p.loadErrors = append(p.loadErrors, err)
- } else {
- pkg = pkgs[0]
- }
- }
-
- if pkg == nil || pkg.Name == "" {
- return SanitizePackageName(filepath.Base(importPath))
- }
-
- p.importToName[importPath] = pkg.Name
-
- return pkg.Name
-}
-
-// Evict removes a given package import path from the cache, along with any packages that depend on it. Further calls
-// to Load will fetch it from disk.
-func (p *Packages) Evict(importPath string) {
- delete(p.packages, importPath)
-
- for _, pkg := range p.packages {
- for _, imported := range pkg.Imports {
- if imported.PkgPath == importPath {
- p.Evict(pkg.PkgPath)
- }
- }
- }
-}
-
-func (p *Packages) ModTidy() error {
- p.packages = nil
- tidyCmd := exec.Command("go", "mod", "tidy")
- tidyCmd.Stdout = os.Stdout
- tidyCmd.Stderr = os.Stdout
- if err := tidyCmd.Run(); err != nil {
- return fmt.Errorf("go mod tidy failed: %w", err)
- }
- return nil
-}
-
-// Errors returns any errors that were returned by Load, either from the call itself or any of the loaded packages.
-func (p *Packages) Errors() PkgErrors {
- var res []error //nolint:prealloc
- res = append(res, p.loadErrors...)
- for _, pkg := range p.packages {
- for _, err := range pkg.Errors {
- res = append(res, err)
- }
- }
- return res
-}
-
-func (p *Packages) Count() int {
- return len(p.packages)
-}
-
-type PkgErrors []error
-
-func (p PkgErrors) Error() string {
- var b bytes.Buffer
- b.WriteString("packages.Load: ")
- for _, e := range p {
- b.WriteString(e.Error() + "\n")
- }
- return b.String()
-}
diff --git a/vendor/github.com/99designs/gqlgen/internal/code/util.go b/vendor/github.com/99designs/gqlgen/internal/code/util.go
deleted file mode 100644
index cbe40858e2..0000000000
--- a/vendor/github.com/99designs/gqlgen/internal/code/util.go
+++ /dev/null
@@ -1,61 +0,0 @@
-package code
-
-import (
- "go/build"
- "os"
- "path/filepath"
- "regexp"
- "strings"
-)
-
-// take a string in the form github.com/package/blah.Type and split it into package and type
-func PkgAndType(name string) (string, string) {
- parts := strings.Split(name, ".")
- if len(parts) == 1 {
- return "", name
- }
-
- return strings.Join(parts[:len(parts)-1], "."), parts[len(parts)-1]
-}
-
-var modsRegex = regexp.MustCompile(`^(\*|\[\])*`)
-
-// NormalizeVendor takes a qualified package path and turns it into normal one.
-// eg .
-// github.com/foo/vendor/github.com/99designs/gqlgen/graphql becomes
-// github.com/99designs/gqlgen/graphql
-func NormalizeVendor(pkg string) string {
- modifiers := modsRegex.FindAllString(pkg, 1)[0]
- pkg = strings.TrimPrefix(pkg, modifiers)
- parts := strings.Split(pkg, "/vendor/")
- return modifiers + parts[len(parts)-1]
-}
-
-// QualifyPackagePath takes an import and fully qualifies it with a vendor dir, if one is required.
-// eg .
-// github.com/99designs/gqlgen/graphql becomes
-// github.com/foo/vendor/github.com/99designs/gqlgen/graphql
-//
-// x/tools/packages only supports 'qualified package paths' so this will need to be done prior to calling it
-// See https://github.com/golang/go/issues/30289
-func QualifyPackagePath(importPath string) string {
- wd, _ := os.Getwd()
-
- // in go module mode, the import path doesn't need fixing
- if _, ok := goModuleRoot(wd); ok {
- return importPath
- }
-
- pkg, err := build.Import(importPath, wd, 0)
- if err != nil {
- return importPath
- }
-
- return pkg.ImportPath
-}
-
-var invalidPackageNameChar = regexp.MustCompile(`[^\w]`)
-
-func SanitizePackageName(pkg string) string {
- return invalidPackageNameChar.ReplaceAllLiteralString(filepath.Base(pkg), "_")
-}
diff --git a/vendor/github.com/99designs/gqlgen/internal/imports/prune.go b/vendor/github.com/99designs/gqlgen/internal/imports/prune.go
deleted file mode 100644
index d42a415791..0000000000
--- a/vendor/github.com/99designs/gqlgen/internal/imports/prune.go
+++ /dev/null
@@ -1,100 +0,0 @@
-// Wrapper around x/tools/imports that only removes imports, never adds new ones.
-
-package imports
-
-import (
- "bytes"
- "go/ast"
- "go/parser"
- "go/printer"
- "go/token"
- "strings"
-
- "github.com/99designs/gqlgen/internal/code"
-
- "golang.org/x/tools/go/ast/astutil"
- "golang.org/x/tools/imports"
-)
-
-type visitFn func(node ast.Node)
-
-func (fn visitFn) Visit(node ast.Node) ast.Visitor {
- fn(node)
- return fn
-}
-
-// Prune removes any unused imports
-func Prune(filename string, src []byte, packages *code.Packages) ([]byte, error) {
- fset := token.NewFileSet()
-
- file, err := parser.ParseFile(fset, filename, src, parser.ParseComments|parser.AllErrors)
- if err != nil {
- return nil, err
- }
-
- unused := getUnusedImports(file, packages)
- for ipath, name := range unused {
- astutil.DeleteNamedImport(fset, file, name, ipath)
- }
- printConfig := &printer.Config{Mode: printer.TabIndent, Tabwidth: 8}
-
- var buf bytes.Buffer
- if err := printConfig.Fprint(&buf, fset, file); err != nil {
- return nil, err
- }
-
- return imports.Process(filename, buf.Bytes(), &imports.Options{FormatOnly: true, Comments: true, TabIndent: true, TabWidth: 8})
-}
-
-func getUnusedImports(file ast.Node, packages *code.Packages) map[string]string {
- imported := map[string]*ast.ImportSpec{}
- used := map[string]bool{}
-
- ast.Walk(visitFn(func(node ast.Node) {
- if node == nil {
- return
- }
- switch v := node.(type) {
- case *ast.ImportSpec:
- if v.Name != nil {
- imported[v.Name.Name] = v
- break
- }
- ipath := strings.Trim(v.Path.Value, `"`)
- if ipath == "C" {
- break
- }
-
- local := packages.NameForPackage(ipath)
-
- imported[local] = v
- case *ast.SelectorExpr:
- xident, ok := v.X.(*ast.Ident)
- if !ok {
- break
- }
- if xident.Obj != nil {
- // if the parser can resolve it, it's not a package ref
- break
- }
- used[xident.Name] = true
- }
- }), file)
-
- for pkg := range used {
- delete(imported, pkg)
- }
-
- unusedImport := map[string]string{}
- for pkg, is := range imported {
- if !used[pkg] && pkg != "_" && pkg != "." {
- name := ""
- if is.Name != nil {
- name = is.Name.Name
- }
- unusedImport[strings.Trim(is.Path.Value, `"`)] = name
- }
- }
-
- return unusedImport
-}
diff --git a/vendor/github.com/99designs/gqlgen/internal/rewrite/rewriter.go b/vendor/github.com/99designs/gqlgen/internal/rewrite/rewriter.go
deleted file mode 100644
index a8a6485cff..0000000000
--- a/vendor/github.com/99designs/gqlgen/internal/rewrite/rewriter.go
+++ /dev/null
@@ -1,226 +0,0 @@
-package rewrite
-
-import (
- "bytes"
- "fmt"
- "go/ast"
- "go/token"
- "os"
- "path/filepath"
- "strconv"
- "strings"
-
- "github.com/99designs/gqlgen/internal/code"
- "golang.org/x/tools/go/packages"
-)
-
-type Rewriter struct {
- pkg *packages.Package
- files map[string]string
- copied map[ast.Decl]bool
-}
-
-func New(dir string) (*Rewriter, error) {
- importPath := code.ImportPathForDir(dir)
- if importPath == "" {
- return nil, fmt.Errorf("import path not found for directory: %q", dir)
- }
- pkgs, err := packages.Load(&packages.Config{
- Mode: packages.NeedSyntax | packages.NeedTypes,
- }, importPath)
- if err != nil {
- return nil, err
- }
- if len(pkgs) == 0 {
- return nil, fmt.Errorf("package not found for importPath: %s", importPath)
- }
-
- return &Rewriter{
- pkg: pkgs[0],
- files: map[string]string{},
- copied: map[ast.Decl]bool{},
- }, nil
-}
-
-func (r *Rewriter) getSource(start, end token.Pos) string {
- startPos := r.pkg.Fset.Position(start)
- endPos := r.pkg.Fset.Position(end)
-
- if startPos.Filename != endPos.Filename {
- panic("cant get source spanning multiple files")
- }
-
- file := r.getFile(startPos.Filename)
- return file[startPos.Offset:endPos.Offset]
-}
-
-func (r *Rewriter) getFile(filename string) string {
- if _, ok := r.files[filename]; !ok {
- b, err := os.ReadFile(filename)
- if err != nil {
- panic(fmt.Errorf("unable to load file, already exists: %w", err))
- }
-
- r.files[filename] = string(b)
-
- }
-
- return r.files[filename]
-}
-
-func (r *Rewriter) GetMethodComment(structname string, methodname string) string {
- for _, f := range r.pkg.Syntax {
- for _, d := range f.Decls {
- d, isFunc := d.(*ast.FuncDecl)
- if !isFunc {
- continue
- }
- if d.Name.Name != methodname {
- continue
- }
- if d.Recv == nil || len(d.Recv.List) == 0 {
- continue
- }
- recv := d.Recv.List[0].Type
- if star, isStar := recv.(*ast.StarExpr); isStar {
- recv = star.X
- }
- ident, ok := recv.(*ast.Ident)
- if !ok {
- continue
- }
-
- if ident.Name != structname {
- continue
- }
- return d.Doc.Text()
- }
- }
-
- return ""
-}
-func (r *Rewriter) GetMethodBody(structname string, methodname string) string {
- for _, f := range r.pkg.Syntax {
- for _, d := range f.Decls {
- d, isFunc := d.(*ast.FuncDecl)
- if !isFunc {
- continue
- }
- if d.Name.Name != methodname {
- continue
- }
- if d.Recv == nil || len(d.Recv.List) == 0 {
- continue
- }
- recv := d.Recv.List[0].Type
- if star, isStar := recv.(*ast.StarExpr); isStar {
- recv = star.X
- }
- ident, ok := recv.(*ast.Ident)
- if !ok {
- continue
- }
-
- if ident.Name != structname {
- continue
- }
-
- r.copied[d] = true
-
- return r.getSource(d.Body.Pos()+1, d.Body.End()-1)
- }
- }
-
- return ""
-}
-
-func (r *Rewriter) MarkStructCopied(name string) {
- for _, f := range r.pkg.Syntax {
- for _, d := range f.Decls {
- d, isGen := d.(*ast.GenDecl)
- if !isGen {
- continue
- }
- if d.Tok != token.TYPE || len(d.Specs) == 0 {
- continue
- }
-
- spec, isTypeSpec := d.Specs[0].(*ast.TypeSpec)
- if !isTypeSpec {
- continue
- }
-
- if spec.Name.Name != name {
- continue
- }
-
- r.copied[d] = true
- }
- }
-}
-
-func (r *Rewriter) ExistingImports(filename string) []Import {
- filename, err := filepath.Abs(filename)
- if err != nil {
- panic(err)
- }
- for _, f := range r.pkg.Syntax {
- pos := r.pkg.Fset.Position(f.Pos())
-
- if filename != pos.Filename {
- continue
- }
-
- var imps []Import
- for _, i := range f.Imports {
- name := ""
- if i.Name != nil {
- name = i.Name.Name
- }
- path, err := strconv.Unquote(i.Path.Value)
- if err != nil {
- panic(err)
- }
- imps = append(imps, Import{name, path})
- }
- return imps
- }
- return nil
-}
-
-func (r *Rewriter) RemainingSource(filename string) string {
- filename, err := filepath.Abs(filename)
- if err != nil {
- panic(err)
- }
- for _, f := range r.pkg.Syntax {
- pos := r.pkg.Fset.Position(f.Pos())
-
- if filename != pos.Filename {
- continue
- }
-
- var buf bytes.Buffer
-
- for _, d := range f.Decls {
- if r.copied[d] {
- continue
- }
-
- if d, isGen := d.(*ast.GenDecl); isGen && d.Tok == token.IMPORT {
- continue
- }
-
- buf.WriteString(r.getSource(d.Pos(), d.End()))
- buf.WriteString("\n")
- }
-
- return strings.TrimSpace(buf.String())
- }
- return ""
-}
-
-type Import struct {
- Alias string
- ImportPath string
-}
diff --git a/vendor/github.com/99designs/gqlgen/plugin/federation/federation.go b/vendor/github.com/99designs/gqlgen/plugin/federation/federation.go
deleted file mode 100644
index cd60acee25..0000000000
--- a/vendor/github.com/99designs/gqlgen/plugin/federation/federation.go
+++ /dev/null
@@ -1,424 +0,0 @@
-package federation
-
-import (
- _ "embed"
- "fmt"
- "sort"
- "strings"
-
- "github.com/vektah/gqlparser/v2/ast"
-
- "github.com/99designs/gqlgen/codegen"
- "github.com/99designs/gqlgen/codegen/config"
- "github.com/99designs/gqlgen/codegen/templates"
- "github.com/99designs/gqlgen/plugin"
- "github.com/99designs/gqlgen/plugin/federation/fieldset"
-)
-
-//go:embed federation.gotpl
-var federationTemplate string
-
-type federation struct {
- Entities []*Entity
- Version int
-}
-
-// New returns a federation plugin that injects
-// federated directives and types into the schema
-func New(version int) plugin.Plugin {
- if version == 0 {
- version = 1
- }
-
- return &federation{Version: version}
-}
-
-// Name returns the plugin name
-func (f *federation) Name() string {
- return "federation"
-}
-
-// MutateConfig mutates the configuration
-func (f *federation) MutateConfig(cfg *config.Config) error {
- builtins := config.TypeMap{
- "_Service": {
- Model: config.StringList{
- "github.com/99designs/gqlgen/plugin/federation/fedruntime.Service",
- },
- },
- "_Entity": {
- Model: config.StringList{
- "github.com/99designs/gqlgen/plugin/federation/fedruntime.Entity",
- },
- },
- "Entity": {
- Model: config.StringList{
- "github.com/99designs/gqlgen/plugin/federation/fedruntime.Entity",
- },
- },
- "_Any": {
- Model: config.StringList{"github.com/99designs/gqlgen/graphql.Map"},
- },
- }
-
- for typeName, entry := range builtins {
- if cfg.Models.Exists(typeName) {
- return fmt.Errorf("%v already exists which must be reserved when Federation is enabled", typeName)
- }
- cfg.Models[typeName] = entry
- }
- cfg.Directives["external"] = config.DirectiveConfig{SkipRuntime: true}
- cfg.Directives["requires"] = config.DirectiveConfig{SkipRuntime: true}
- cfg.Directives["provides"] = config.DirectiveConfig{SkipRuntime: true}
- cfg.Directives["key"] = config.DirectiveConfig{SkipRuntime: true}
- cfg.Directives["extends"] = config.DirectiveConfig{SkipRuntime: true}
-
- // Federation 2 specific directives
- if f.Version == 2 {
- cfg.Directives["shareable"] = config.DirectiveConfig{SkipRuntime: true}
- cfg.Directives["link"] = config.DirectiveConfig{SkipRuntime: true}
- cfg.Directives["tag"] = config.DirectiveConfig{SkipRuntime: true}
- cfg.Directives["override"] = config.DirectiveConfig{SkipRuntime: true}
- cfg.Directives["inaccessible"] = config.DirectiveConfig{SkipRuntime: true}
- }
-
- return nil
-}
-
-func (f *federation) InjectSourceEarly() *ast.Source {
- input := `
- scalar _Any
- scalar _FieldSet
-
- directive @external on FIELD_DEFINITION
- directive @requires(fields: _FieldSet!) on FIELD_DEFINITION
- directive @provides(fields: _FieldSet!) on FIELD_DEFINITION
- directive @extends on OBJECT | INTERFACE
-`
- // add version-specific changes on key directive, as well as adding the new directives for federation 2
- if f.Version == 1 {
- input += `
- directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE
-`
- } else if f.Version == 2 {
- input += `
- directive @key(fields: _FieldSet!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE
- directive @link(import: [String!], url: String!) repeatable on SCHEMA
- directive @shareable on OBJECT | FIELD_DEFINITION
- directive @tag(name: String!) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
- directive @override(from: String!) on FIELD_DEFINITION
- directive @inaccessible on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
-`
- }
- return &ast.Source{
- Name: "federation/directives.graphql",
- Input: input,
- BuiltIn: true,
- }
-}
-
-// InjectSources creates a GraphQL Entity type with all
-// the fields that had the @key directive
-func (f *federation) InjectSourceLate(schema *ast.Schema) *ast.Source {
- f.setEntities(schema)
-
- var entities, resolvers, entityResolverInputDefinitions string
- for i, e := range f.Entities {
- if i != 0 {
- entities += " | "
- }
- entities += e.Name
-
- for _, r := range e.Resolvers {
- if e.Multi {
- if entityResolverInputDefinitions != "" {
- entityResolverInputDefinitions += "\n\n"
- }
- entityResolverInputDefinitions += "input " + r.InputType + " {\n"
- for _, keyField := range r.KeyFields {
- entityResolverInputDefinitions += fmt.Sprintf("\t%s: %s\n", keyField.Field.ToGo(), keyField.Definition.Type.String())
- }
- entityResolverInputDefinitions += "}"
- resolvers += fmt.Sprintf("\t%s(reps: [%s!]!): [%s]\n", r.ResolverName, r.InputType, e.Name)
- } else {
- resolverArgs := ""
- for _, keyField := range r.KeyFields {
- resolverArgs += fmt.Sprintf("%s: %s,", keyField.Field.ToGoPrivate(), keyField.Definition.Type.String())
- }
- resolvers += fmt.Sprintf("\t%s(%s): %s!\n", r.ResolverName, resolverArgs, e.Name)
- }
- }
- }
-
- var blocks []string
- if entities != "" {
- entities = `# a union of all types that use the @key directive
-union _Entity = ` + entities
- blocks = append(blocks, entities)
- }
-
- // resolvers can be empty if a service defines only "empty
- // extend" types. This should be rare.
- if resolvers != "" {
- if entityResolverInputDefinitions != "" {
- blocks = append(blocks, entityResolverInputDefinitions)
- }
- resolvers = `# fake type to build resolver interfaces for users to implement
-type Entity {
- ` + resolvers + `
-}`
- blocks = append(blocks, resolvers)
- }
-
- _serviceTypeDef := `type _Service {
- sdl: String
-}`
- blocks = append(blocks, _serviceTypeDef)
-
- var additionalQueryFields string
- // Quote from the Apollo Federation subgraph specification:
- // If no types are annotated with the key directive, then the
- // _Entity union and _entities field should be removed from the schema
- if len(f.Entities) > 0 {
- additionalQueryFields += ` _entities(representations: [_Any!]!): [_Entity]!
-`
- }
- // _service field is required in any case
- additionalQueryFields += ` _service: _Service!`
-
- extendTypeQueryDef := `extend type ` + schema.Query.Name + ` {
-` + additionalQueryFields + `
-}`
- blocks = append(blocks, extendTypeQueryDef)
-
- return &ast.Source{
- Name: "federation/entity.graphql",
- BuiltIn: true,
- Input: "\n" + strings.Join(blocks, "\n\n") + "\n",
- }
-}
-
-// Entity represents a federated type
-// that was declared in the GQL schema.
-type Entity struct {
- Name string // The same name as the type declaration
- Def *ast.Definition
- Resolvers []*EntityResolver
- Requires []*Requires
- Multi bool
-}
-
-type EntityResolver struct {
- ResolverName string // The resolver name, such as FindUserByID
- KeyFields []*KeyField // The fields declared in @key.
- InputType string // The Go generated input type for multi entity resolvers
-}
-
-type KeyField struct {
- Definition *ast.FieldDefinition
- Field fieldset.Field // len > 1 for nested fields
- Type *config.TypeReference // The Go representation of that field type
-}
-
-// Requires represents an @requires clause
-type Requires struct {
- Name string // the name of the field
- Field fieldset.Field // source Field, len > 1 for nested fields
- Type *config.TypeReference // The Go representation of that field type
-}
-
-func (e *Entity) allFieldsAreExternal() bool {
- for _, field := range e.Def.Fields {
- if field.Directives.ForName("external") == nil {
- return false
- }
- }
- return true
-}
-
-func (f *federation) GenerateCode(data *codegen.Data) error {
- if len(f.Entities) > 0 {
- if data.Objects.ByName("Entity") != nil {
- data.Objects.ByName("Entity").Root = true
- }
- for _, e := range f.Entities {
- obj := data.Objects.ByName(e.Def.Name)
-
- for _, r := range e.Resolvers {
- // fill in types for key fields
- //
- for _, keyField := range r.KeyFields {
- if len(keyField.Field) == 0 {
- fmt.Println(
- "skipping @key field " + keyField.Definition.Name + " in " + r.ResolverName + " in " + e.Def.Name,
- )
- continue
- }
- cgField := keyField.Field.TypeReference(obj, data.Objects)
- keyField.Type = cgField.TypeReference
- }
- }
-
- // fill in types for requires fields
- //
- for _, reqField := range e.Requires {
- if len(reqField.Field) == 0 {
- fmt.Println("skipping @requires field " + reqField.Name + " in " + e.Def.Name)
- continue
- }
- cgField := reqField.Field.TypeReference(obj, data.Objects)
- reqField.Type = cgField.TypeReference
- }
- }
- }
-
- return templates.Render(templates.Options{
- PackageName: data.Config.Federation.Package,
- Filename: data.Config.Federation.Filename,
- Data: f,
- GeneratedHeader: true,
- Packages: data.Config.Packages,
- Template: federationTemplate,
- })
-}
-
-func (f *federation) setEntities(schema *ast.Schema) {
- for _, schemaType := range schema.Types {
- keys, ok := isFederatedEntity(schemaType)
- if !ok {
- continue
- }
- e := &Entity{
- Name: schemaType.Name,
- Def: schemaType,
- Resolvers: nil,
- Requires: nil,
- }
-
- // Let's process custom entity resolver settings.
- dir := schemaType.Directives.ForName("entityResolver")
- if dir != nil {
- if dirArg := dir.Arguments.ForName("multi"); dirArg != nil {
- if dirVal, err := dirArg.Value.Value(nil); err == nil {
- e.Multi = dirVal.(bool)
- }
- }
- }
-
- // If our schema has a field with a type defined in
- // another service, then we need to define an "empty
- // extend" of that type in this service, so this service
- // knows what the type is like. But the graphql-server
- // will never ask us to actually resolve this "empty
- // extend", so we don't require a resolver function for
- // it. (Well, it will never ask in practice; it's
- // unclear whether the spec guarantees this. See
- // https://github.com/apollographql/apollo-server/issues/3852
- // ). Example:
- // type MyType {
- // myvar: TypeDefinedInOtherService
- // }
- // // Federation needs this type, but
- // // it doesn't need a resolver for it!
- // extend TypeDefinedInOtherService @key(fields: "id") {
- // id: ID @external
- // }
- if !e.allFieldsAreExternal() {
- for _, dir := range keys {
- if len(dir.Arguments) > 2 {
- panic("More than two arguments provided for @key declaration.")
- }
- var arg *ast.Argument
-
- // since keys are able to now have multiple arguments, we need to check both possible for a possible @key(fields="" fields="")
- for _, a := range dir.Arguments {
- if a.Name == "fields" {
- if arg != nil {
- panic("More than one `fields` provided for @key declaration.")
- }
- arg = a
- }
- }
-
- keyFieldSet := fieldset.New(arg.Value.Raw, nil)
-
- keyFields := make([]*KeyField, len(keyFieldSet))
- resolverFields := []string{}
- for i, field := range keyFieldSet {
- def := field.FieldDefinition(schemaType, schema)
-
- if def == nil {
- panic(fmt.Sprintf("no field for %v", field))
- }
-
- keyFields[i] = &KeyField{Definition: def, Field: field}
- resolverFields = append(resolverFields, keyFields[i].Field.ToGo())
- }
-
- resolverFieldsToGo := schemaType.Name + "By" + strings.Join(resolverFields, "And")
- var resolverName string
- if e.Multi {
- resolverFieldsToGo += "s" // Pluralize for better API readability
- resolverName = fmt.Sprintf("findMany%s", resolverFieldsToGo)
- } else {
- resolverName = fmt.Sprintf("find%s", resolverFieldsToGo)
- }
-
- e.Resolvers = append(e.Resolvers, &EntityResolver{
- ResolverName: resolverName,
- KeyFields: keyFields,
- InputType: resolverFieldsToGo + "Input",
- })
- }
-
- e.Requires = []*Requires{}
- for _, f := range schemaType.Fields {
- dir := f.Directives.ForName("requires")
- if dir == nil {
- continue
- }
- if len(dir.Arguments) != 1 || dir.Arguments[0].Name != "fields" {
- panic("Exactly one `fields` argument needed for @requires declaration.")
- }
- requiresFieldSet := fieldset.New(dir.Arguments[0].Value.Raw, nil)
- for _, field := range requiresFieldSet {
- e.Requires = append(e.Requires, &Requires{
- Name: field.ToGoPrivate(),
- Field: field,
- })
- }
- }
- }
- f.Entities = append(f.Entities, e)
- }
-
- // make sure order remains stable across multiple builds
- sort.Slice(f.Entities, func(i, j int) bool {
- return f.Entities[i].Name < f.Entities[j].Name
- })
-}
-
-func isFederatedEntity(schemaType *ast.Definition) ([]*ast.Directive, bool) {
- switch schemaType.Kind {
- case ast.Object:
- keys := schemaType.Directives.ForNames("key")
- if len(keys) > 0 {
- return keys, true
- }
- case ast.Interface:
- // TODO: support @key and @extends for interfaces
- if dir := schemaType.Directives.ForName("key"); dir != nil {
- fmt.Printf("@key directive found on \"interface %s\". Will be ignored.\n", schemaType.Name)
- }
- if dir := schemaType.Directives.ForName("extends"); dir != nil {
- panic(
- fmt.Sprintf(
- "@extends directive is not currently supported for interfaces, use \"extend interface %s\" instead.",
- schemaType.Name,
- ))
- }
- default:
- // ignore
- }
- return nil, false
-}
diff --git a/vendor/github.com/99designs/gqlgen/plugin/federation/federation.gotpl b/vendor/github.com/99designs/gqlgen/plugin/federation/federation.gotpl
deleted file mode 100644
index 4a30b6c978..0000000000
--- a/vendor/github.com/99designs/gqlgen/plugin/federation/federation.gotpl
+++ /dev/null
@@ -1,259 +0,0 @@
-{{ reserveImport "context" }}
-{{ reserveImport "errors" }}
-{{ reserveImport "fmt" }}
-{{ reserveImport "strings" }}
-{{ reserveImport "sync" }}
-
-{{ reserveImport "github.com/99designs/gqlgen/plugin/federation/fedruntime" }}
-
-var (
- ErrUnknownType = errors.New("unknown type")
- ErrTypeNotFound = errors.New("type not found")
-)
-
-func (ec *executionContext) __resolve__service(ctx context.Context) (fedruntime.Service, error) {
- if ec.DisableIntrospection {
- return fedruntime.Service{}, errors.New("federated introspection disabled")
- }
-
- var sdl []string
-
- for _, src := range sources {
- if src.BuiltIn {
- continue
- }
- sdl = append(sdl, src.Input)
- }
-
- return fedruntime.Service{
- SDL: strings.Join(sdl, "\n"),
- }, nil
-}
-
-{{if .Entities}}
-func (ec *executionContext) __resolve_entities(ctx context.Context, representations []map[string]interface{}) []fedruntime.Entity {
- list := make([]fedruntime.Entity, len(representations))
-
- repsMap := map[string]struct {
- i []int
- r []map[string]interface{}
- }{}
-
- // We group entities by typename so that we can parallelize their resolution.
- // This is particularly helpful when there are entity groups in multi mode.
- buildRepresentationGroups := func(reps []map[string]interface{}) {
- for i, rep := range reps {
- typeName, ok := rep["__typename"].(string)
- if !ok {
- // If there is no __typename, we just skip the representation;
- // we just won't be resolving these unknown types.
- ec.Error(ctx, errors.New("__typename must be an existing string"))
- continue
- }
-
- _r := repsMap[typeName]
- _r.i = append(_r.i, i)
- _r.r = append(_r.r, rep)
- repsMap[typeName] = _r
- }
- }
-
- isMulti := func(typeName string) bool {
- switch typeName {
- {{- range .Entities -}}
- {{- if .Resolvers -}}
- {{- if .Multi -}}
- case "{{.Def.Name}}":
- return true
- {{ end }}
- {{- end -}}
- {{- end -}}
- default:
- return false
- }
- }
-
- resolveEntity := func(ctx context.Context, typeName string, rep map[string]interface{}, idx []int, i int) (err error) {
- // we need to do our own panic handling, because we may be called in a
- // goroutine, where the usual panic handling can't catch us
- defer func () {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- }
- }()
-
- switch typeName {
- {{ range $_, $entity := .Entities }}
- {{- if and .Resolvers (not .Multi) -}}
- case "{{.Def.Name}}":
- resolverName, err := entityResolverNameFor{{.Def.Name}}(ctx, rep)
- if err != nil {
- return fmt.Errorf(`finding resolver for Entity "{{.Def.Name}}": %w`, err)
- }
- switch resolverName {
- {{ range $i, $resolver := .Resolvers }}
- case "{{.ResolverName}}":
- {{- range $j, $keyField := .KeyFields }}
- id{{$j}}, err := ec.{{.Type.UnmarshalFunc}}(ctx, rep["{{.Field.Join `"].(map[string]interface{})["`}}"])
- if err != nil {
- return fmt.Errorf(`unmarshalling param {{$j}} for {{$resolver.ResolverName}}(): %w`, err)
- }
- {{- end}}
- entity, err := ec.resolvers.Entity().{{.ResolverName | go}}(ctx, {{- range $j, $_ := .KeyFields -}} id{{$j}}, {{end}})
- if err != nil {
- return fmt.Errorf(`resolving Entity "{{$entity.Def.Name}}": %w`, err)
- }
- {{ range $entity.Requires }}
- entity.{{.Field.JoinGo `.`}}, err = ec.{{.Type.UnmarshalFunc}}(ctx, rep["{{.Field.Join `"].(map[string]interface{})["`}}"])
- if err != nil {
- return err
- }
- {{- end }}
- list[idx[i]] = entity
- return nil
- {{- end }}
- }
- {{ end }}
- {{- end }}
- }
- return fmt.Errorf("%w: %s", ErrUnknownType, typeName)
- }
-
- resolveManyEntities := func(ctx context.Context, typeName string, reps []map[string]interface{}, idx []int) (err error) {
- // we need to do our own panic handling, because we may be called in a
- // goroutine, where the usual panic handling can't catch us
- defer func () {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- }
- }()
-
- switch typeName {
- {{ range $_, $entity := .Entities }}
- {{ if and .Resolvers .Multi -}}
- case "{{.Def.Name}}":
- {{range $i, $_ := .Resolvers -}}
- _reps := make([]*{{.InputType}}, len(reps))
-
- for i, rep := range reps {
- {{ range $i, $keyField := .KeyFields -}}
- id{{$i}}, err := ec.{{.Type.UnmarshalFunc}}(ctx, rep["{{.Field.Join `"].(map[string]interface{})["`}}"])
- if err != nil {
- return errors.New(fmt.Sprintf("Field %s undefined in schema.", "{{.Definition.Name}}"))
- }
- {{end}}
-
- _reps[i] = &{{.InputType}} {
- {{ range $i, $keyField := .KeyFields -}}
- {{$keyField.Field.ToGo}}: id{{$i}},
- {{end}}
- }
- }
-
- entities, err := ec.resolvers.Entity().{{.ResolverName | go}}(ctx, _reps)
- if err != nil {
- return err
- }
-
- for i, entity := range entities {
- {{- range $entity.Requires }}
- entity.{{.Field.JoinGo `.`}}, err = ec.{{.Type.UnmarshalFunc}}(ctx, reps[i]["{{.Field.Join `"].(map[string]interface{})["`}}"])
- if err != nil {
- return err
- }
- {{- end}}
- list[idx[i]] = entity
- }
- return nil
- {{ end }}
- {{ end }}
- {{- end }}
- default:
- return errors.New("unknown type: "+typeName)
- }
- }
-
- resolveEntityGroup := func(typeName string, reps []map[string]interface{}, idx []int) {
- if isMulti(typeName) {
- err := resolveManyEntities(ctx, typeName, reps, idx)
- if err != nil {
- ec.Error(ctx, err)
- }
- } else {
- // if there are multiple entities to resolve, parallelize (similar to
- // graphql.FieldSet.Dispatch)
- var e sync.WaitGroup
- e.Add(len(reps))
- for i, rep := range reps {
- i, rep := i, rep
- go func(i int, rep map[string]interface{}) {
- err := resolveEntity(ctx, typeName, rep, idx, i)
- if err != nil {
- ec.Error(ctx, err)
- }
- e.Done()
- }(i, rep)
- }
- e.Wait()
- }
- }
- buildRepresentationGroups(representations)
-
- switch len(repsMap) {
- case 0:
- return list
- case 1:
- for typeName, reps := range repsMap {
- resolveEntityGroup(typeName, reps.r, reps.i)
- }
- return list
- default:
- var g sync.WaitGroup
- g.Add(len(repsMap))
- for typeName, reps := range repsMap {
- go func(typeName string, reps []map[string]interface{}, idx []int) {
- resolveEntityGroup(typeName, reps, idx)
- g.Done()
- }(typeName, reps.r, reps.i)
- }
- g.Wait()
- return list
- }
-}
-
-{{- /* Make sure the required fields are in the given entity representation and return the name of the proper resolver. */ -}}
-
-{{ range $_, $entity := .Entities }}
- {{- if .Resolvers }}
-
- func entityResolverNameFor{{$entity.Name}}(ctx context.Context, rep map[string]interface{}) (string, error) {
- {{- range .Resolvers }}
- for {
- var (
- m map[string]interface{}
- val interface{}
- ok bool
- )
- _ = val
- {{- range $_, $keyField := .KeyFields }}
- m = rep
- {{- range $i, $field := .Field }}
- if {{ if (ne $i $keyField.Field.LastIndex ) -}}val{{- else -}}_{{- end -}}, ok = m["{{.}}"]; !ok {
- break
- }
- {{- if (ne $i $keyField.Field.LastIndex ) }}
- if m, ok = val.(map[string]interface{}); !ok {
- break
- }
- {{- end}}
- {{- end}}
- {{- end }}
- return "{{.ResolverName}}", nil
- }
- {{- end }}
- return "", fmt.Errorf("%w for {{$entity.Name}}", ErrTypeNotFound)
- }
- {{- end }}
-{{- end }}
-
-{{end}}
diff --git a/vendor/github.com/99designs/gqlgen/plugin/federation/fieldset/fieldset.go b/vendor/github.com/99designs/gqlgen/plugin/federation/fieldset/fieldset.go
deleted file mode 100644
index 059a3c8325..0000000000
--- a/vendor/github.com/99designs/gqlgen/plugin/federation/fieldset/fieldset.go
+++ /dev/null
@@ -1,181 +0,0 @@
-package fieldset
-
-import (
- "fmt"
- "strings"
-
- "github.com/99designs/gqlgen/codegen"
- "github.com/99designs/gqlgen/codegen/templates"
- "github.com/vektah/gqlparser/v2/ast"
-)
-
-// Set represents a FieldSet that is used in federation directives @key and @requires.
-// Would be happier to reuse FieldSet parsing from gqlparser, but this suits for now.
-type Set []Field
-
-// Field represents a single field in a FieldSet
-type Field []string
-
-// New parses a FieldSet string into a TinyFieldSet.
-func New(raw string, prefix []string) Set {
- if !strings.Contains(raw, "{") {
- return parseUnnestedKeyFieldSet(raw, prefix)
- }
-
- var (
- ret = Set{}
- subPrefix = prefix
- )
- before, during, after := extractSubs(raw)
-
- if before != "" {
- befores := New(before, prefix)
- if len(befores) > 0 {
- subPrefix = befores[len(befores)-1]
- ret = append(ret, befores[:len(befores)-1]...)
- }
- }
- if during != "" {
- ret = append(ret, New(during, subPrefix)...)
- }
- if after != "" {
- ret = append(ret, New(after, prefix)...)
- }
- return ret
-}
-
-// FieldDefinition looks up a field in the type.
-func (f Field) FieldDefinition(schemaType *ast.Definition, schema *ast.Schema) *ast.FieldDefinition {
- objType := schemaType
- def := objType.Fields.ForName(f[0])
-
- for _, part := range f[1:] {
- if objType.Kind != ast.Object {
- panic(fmt.Sprintf(`invalid sub-field reference "%s" in %v: `, objType.Name, f))
- }
- x := def.Type.Name()
- objType = schema.Types[x]
- if objType == nil {
- panic("invalid schema type: " + x)
- }
- def = objType.Fields.ForName(part)
- }
- if def == nil {
- return nil
- }
- ret := *def // shallow copy
- ret.Name = f.ToGoPrivate()
-
- return &ret
-}
-
-// TypeReference looks up the type of a field.
-func (f Field) TypeReference(obj *codegen.Object, objects codegen.Objects) *codegen.Field {
- var def *codegen.Field
-
- for _, part := range f {
- def = fieldByName(obj, part)
- if def == nil {
- panic("unable to find field " + f[0])
- }
- obj = objects.ByName(def.TypeReference.Definition.Name)
- }
- return def
-}
-
-// ToGo converts a (possibly nested) field into a proper public Go name.
-func (f Field) ToGo() string {
- var ret string
-
- for _, field := range f {
- ret += templates.ToGo(field)
- }
- return ret
-}
-
-// ToGoPrivate converts a (possibly nested) field into a proper private Go name.
-func (f Field) ToGoPrivate() string {
- var ret string
-
- for i, field := range f {
- if i == 0 {
- ret += templates.ToGoPrivate(field)
- continue
- }
- ret += templates.ToGo(field)
- }
- return ret
-}
-
-// Join concatenates the field parts with a string separator between. Useful in templates.
-func (f Field) Join(str string) string {
- return strings.Join(f, str)
-}
-
-// JoinGo concatenates the Go name of field parts with a string separator between. Useful in templates.
-func (f Field) JoinGo(str string) string {
- strs := []string{}
-
- for _, s := range f {
- strs = append(strs, templates.ToGo(s))
- }
- return strings.Join(strs, str)
-}
-
-func (f Field) LastIndex() int {
- return len(f) - 1
-}
-
-// local functions
-
-// parseUnnestedKeyFieldSet // handles simple case where none of the fields are nested.
-func parseUnnestedKeyFieldSet(raw string, prefix []string) Set {
- ret := Set{}
-
- for _, s := range strings.Fields(raw) {
- next := append(prefix[:], s) //nolint:gocritic // slicing out on purpose
- ret = append(ret, next)
- }
- return ret
-}
-
-// extractSubs splits out and trims sub-expressions from before, inside, and after "{}".
-func extractSubs(str string) (string, string, string) {
- start := strings.Index(str, "{")
- end := matchingBracketIndex(str, start)
-
- if start < 0 || end < 0 {
- panic("invalid key fieldSet: " + str)
- }
- return strings.TrimSpace(str[:start]), strings.TrimSpace(str[start+1 : end]), strings.TrimSpace(str[end+1:])
-}
-
-// matchingBracketIndex returns the index of the closing bracket, assuming an open bracket at start.
-func matchingBracketIndex(str string, start int) int {
- if start < 0 || len(str) <= start+1 {
- return -1
- }
- var depth int
-
- for i, c := range str[start+1:] {
- switch c {
- case '{':
- depth++
- case '}':
- if depth == 0 {
- return start + 1 + i
- }
- depth--
- }
- }
- return -1
-}
-
-func fieldByName(obj *codegen.Object, name string) *codegen.Field {
- for _, field := range obj.Fields {
- if field.Name == name {
- return field
- }
- }
- return nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/plugin/federation/readme.md b/vendor/github.com/99designs/gqlgen/plugin/federation/readme.md
deleted file mode 100644
index 4333ed4797..0000000000
--- a/vendor/github.com/99designs/gqlgen/plugin/federation/readme.md
+++ /dev/null
@@ -1,39 +0,0 @@
-# Federation plugin
-
-Add support for graphql federation in your graphql Go server!
-
-TODO(miguel): add details.
-
-# Tests
-There are several different tests. Some will process the configuration file directly. You can see those in the `federation_test.go`. There are also tests for entity resolvers, which will simulate requests from a federation server like Apollo Federation.
-
-Running entity resolver tests.
-1. Go to `plugin/federation`
-2. Run the command `go generate`
-3. Run the tests with `go test ./...`.
-
-# Architecture
-
-TODO(miguel): add details.
-
-# Entity resolvers - GetMany entities
-
-The federation plugin implements `GetMany` semantics in which entity resolvers get the entire list of representations that need to be resolved. This functionality is currently optin tho, and to enable it you need to specify the directive `@entityResolver` in the federated entity you want this feature for. E.g.
-
-```
-directive @entityResolver(multi: Boolean) on OBJECT
-
-type MultiHello @key(fields: "name") @entityResolver(multi: true) {
- name: String!
-}
-```
-
-That allows the federation plugin to generate `GetMany` resolver function that can take a list of representations to be resolved.
-
-From that entity type, the resolver function would be
-
-```
-func (r *entityResolver) FindManyMultiHellosByName(ctx context.Context, reps []*generated.ManyMultiHellosByNameInput) ([]*generated.MultiHello, error) {
- ///
-}
-```
diff --git a/vendor/github.com/99designs/gqlgen/plugin/modelgen/models.go b/vendor/github.com/99designs/gqlgen/plugin/modelgen/models.go
deleted file mode 100644
index 45c32715c6..0000000000
--- a/vendor/github.com/99designs/gqlgen/plugin/modelgen/models.go
+++ /dev/null
@@ -1,470 +0,0 @@
-package modelgen
-
-import (
- _ "embed"
- "fmt"
- "go/types"
- "sort"
- "strings"
- "text/template"
-
- "github.com/99designs/gqlgen/codegen/config"
- "github.com/99designs/gqlgen/codegen/templates"
- "github.com/99designs/gqlgen/plugin"
- "github.com/vektah/gqlparser/v2/ast"
-)
-
-//go:embed models.gotpl
-var modelTemplate string
-
-type BuildMutateHook = func(b *ModelBuild) *ModelBuild
-
-type FieldMutateHook = func(td *ast.Definition, fd *ast.FieldDefinition, f *Field) (*Field, error)
-
-// defaultFieldMutateHook is the default hook for the Plugin which applies the GoTagFieldHook.
-func defaultFieldMutateHook(td *ast.Definition, fd *ast.FieldDefinition, f *Field) (*Field, error) {
- return GoTagFieldHook(td, fd, f)
-}
-
-func defaultBuildMutateHook(b *ModelBuild) *ModelBuild {
- return b
-}
-
-type ModelBuild struct {
- PackageName string
- Interfaces []*Interface
- Models []*Object
- Enums []*Enum
- Scalars []string
-}
-
-type Interface struct {
- Description string
- Name string
- Fields []*Field
- Implements []string
-}
-
-type Object struct {
- Description string
- Name string
- Fields []*Field
- Implements []string
-}
-
-type Field struct {
- Description string
- // Name is the field's name as it appears in the schema
- Name string
- // GoName is the field's name as it appears in the generated Go code
- GoName string
- Type types.Type
- Tag string
-}
-
-type Enum struct {
- Description string
- Name string
- Values []*EnumValue
-}
-
-type EnumValue struct {
- Description string
- Name string
-}
-
-func New() plugin.Plugin {
- return &Plugin{
- MutateHook: defaultBuildMutateHook,
- FieldHook: defaultFieldMutateHook,
- }
-}
-
-type Plugin struct {
- MutateHook BuildMutateHook
- FieldHook FieldMutateHook
-}
-
-var _ plugin.ConfigMutator = &Plugin{}
-
-func (m *Plugin) Name() string {
- return "modelgen"
-}
-
-func (m *Plugin) MutateConfig(cfg *config.Config) error {
-
- b := &ModelBuild{
- PackageName: cfg.Model.Package,
- }
-
- for _, schemaType := range cfg.Schema.Types {
- if cfg.Models.UserDefined(schemaType.Name) {
- continue
- }
- switch schemaType.Kind {
- case ast.Interface, ast.Union:
- var fields []*Field
- var err error
- if !cfg.OmitGetters {
- fields, err = m.generateFields(cfg, schemaType)
- if err != nil {
- return err
- }
- }
-
- it := &Interface{
- Description: schemaType.Description,
- Name: schemaType.Name,
- Implements: schemaType.Interfaces,
- Fields: fields,
- }
-
- b.Interfaces = append(b.Interfaces, it)
- case ast.Object, ast.InputObject:
- if schemaType == cfg.Schema.Query || schemaType == cfg.Schema.Mutation || schemaType == cfg.Schema.Subscription {
- continue
- }
-
- fields, err := m.generateFields(cfg, schemaType)
- if err != nil {
- return err
- }
-
- it := &Object{
- Description: schemaType.Description,
- Name: schemaType.Name,
- Fields: fields,
- }
-
- // If Interface A implements interface B, and Interface C also implements interface B
- // then both A and C have methods of B.
- // The reason for checking unique is to prevent the same method B from being generated twice.
- uniqueMap := map[string]bool{}
- for _, implementor := range cfg.Schema.GetImplements(schemaType) {
- if !uniqueMap[implementor.Name] {
- it.Implements = append(it.Implements, implementor.Name)
- uniqueMap[implementor.Name] = true
- }
- // for interface implements
- for _, iface := range implementor.Interfaces {
- if !uniqueMap[iface] {
- it.Implements = append(it.Implements, iface)
- uniqueMap[iface] = true
- }
- }
- }
-
- b.Models = append(b.Models, it)
- case ast.Enum:
- it := &Enum{
- Name: schemaType.Name,
- Description: schemaType.Description,
- }
-
- for _, v := range schemaType.EnumValues {
- it.Values = append(it.Values, &EnumValue{
- Name: v.Name,
- Description: v.Description,
- })
- }
-
- b.Enums = append(b.Enums, it)
- case ast.Scalar:
- b.Scalars = append(b.Scalars, schemaType.Name)
- }
- }
- sort.Slice(b.Enums, func(i, j int) bool { return b.Enums[i].Name < b.Enums[j].Name })
- sort.Slice(b.Models, func(i, j int) bool { return b.Models[i].Name < b.Models[j].Name })
- sort.Slice(b.Interfaces, func(i, j int) bool { return b.Interfaces[i].Name < b.Interfaces[j].Name })
-
- // if we are not just turning all struct-type fields in generated structs into pointers, we need to at least
- // check for cyclical relationships and recursive structs
- if !cfg.StructFieldsAlwaysPointers {
- findAndHandleCyclicalRelationships(b)
- }
-
- for _, it := range b.Enums {
- cfg.Models.Add(it.Name, cfg.Model.ImportPath()+"."+templates.ToGo(it.Name))
- }
- for _, it := range b.Models {
- cfg.Models.Add(it.Name, cfg.Model.ImportPath()+"."+templates.ToGo(it.Name))
- }
- for _, it := range b.Interfaces {
- cfg.Models.Add(it.Name, cfg.Model.ImportPath()+"."+templates.ToGo(it.Name))
- }
- for _, it := range b.Scalars {
- cfg.Models.Add(it, "github.com/99designs/gqlgen/graphql.String")
- }
-
- if len(b.Models) == 0 && len(b.Enums) == 0 && len(b.Interfaces) == 0 && len(b.Scalars) == 0 {
- return nil
- }
-
- if m.MutateHook != nil {
- b = m.MutateHook(b)
- }
-
- getInterfaceByName := func(name string) *Interface {
- // Allow looking up interfaces, so template can generate getters for each field
- for _, i := range b.Interfaces {
- if i.Name == name {
- return i
- }
- }
-
- return nil
- }
- gettersGenerated := make(map[string]map[string]struct{})
- generateGetter := func(model *Object, field *Field) string {
- if model == nil || field == nil {
- return ""
- }
-
- // Let templates check if a given getter has been generated already
- typeGetters, exists := gettersGenerated[model.Name]
- if !exists {
- typeGetters = make(map[string]struct{})
- gettersGenerated[model.Name] = typeGetters
- }
-
- _, exists = typeGetters[field.GoName]
- typeGetters[field.GoName] = struct{}{}
- if exists {
- return ""
- }
-
- _, interfaceFieldTypeIsPointer := field.Type.(*types.Pointer)
- var structFieldTypeIsPointer bool
- for _, f := range model.Fields {
- if f.GoName == field.GoName {
- _, structFieldTypeIsPointer = f.Type.(*types.Pointer)
- break
- }
- }
- goType := templates.CurrentImports.LookupType(field.Type)
- if strings.HasPrefix(goType, "[]") {
- getter := fmt.Sprintf("func (this %s) Get%s() %s {\n", templates.ToGo(model.Name), field.GoName, goType)
- getter += fmt.Sprintf("\tif this.%s == nil { return nil }\n", field.GoName)
- getter += fmt.Sprintf("\tinterfaceSlice := make(%s, 0, len(this.%s))\n", goType, field.GoName)
- getter += fmt.Sprintf("\tfor _, concrete := range this.%s { interfaceSlice = append(interfaceSlice, ", field.GoName)
- if interfaceFieldTypeIsPointer && !structFieldTypeIsPointer {
- getter += "&"
- } else if !interfaceFieldTypeIsPointer && structFieldTypeIsPointer {
- getter += "*"
- }
- getter += "concrete) }\n"
- getter += "\treturn interfaceSlice\n"
- getter += "}"
- return getter
- } else {
- getter := fmt.Sprintf("func (this %s) Get%s() %s { return ", templates.ToGo(model.Name), field.GoName, goType)
-
- if interfaceFieldTypeIsPointer && !structFieldTypeIsPointer {
- getter += "&"
- } else if !interfaceFieldTypeIsPointer && structFieldTypeIsPointer {
- getter += "*"
- }
-
- getter += fmt.Sprintf("this.%s }", field.GoName)
- return getter
- }
- }
- funcMap := template.FuncMap{
- "getInterfaceByName": getInterfaceByName,
- "generateGetter": generateGetter,
- }
-
- err := templates.Render(templates.Options{
- PackageName: cfg.Model.Package,
- Filename: cfg.Model.Filename,
- Data: b,
- GeneratedHeader: true,
- Packages: cfg.Packages,
- Template: modelTemplate,
- Funcs: funcMap,
- })
- if err != nil {
- return err
- }
-
- // We may have generated code in a package we already loaded, so we reload all packages
- // to allow packages to be compared correctly
- cfg.ReloadAllPackages()
-
- return nil
-}
-
-func (m *Plugin) generateFields(cfg *config.Config, schemaType *ast.Definition) ([]*Field, error) {
- binder := cfg.NewBinder()
- fields := make([]*Field, 0)
-
- for _, field := range schemaType.Fields {
- var typ types.Type
- fieldDef := cfg.Schema.Types[field.Type.Name()]
-
- if cfg.Models.UserDefined(field.Type.Name()) {
- var err error
- typ, err = binder.FindTypeFromName(cfg.Models[field.Type.Name()].Model[0])
- if err != nil {
- return nil, err
- }
- } else {
- switch fieldDef.Kind {
- case ast.Scalar:
- // no user defined model, referencing a default scalar
- typ = types.NewNamed(
- types.NewTypeName(0, cfg.Model.Pkg(), "string", nil),
- nil,
- nil,
- )
-
- case ast.Interface, ast.Union:
- // no user defined model, referencing a generated interface type
- typ = types.NewNamed(
- types.NewTypeName(0, cfg.Model.Pkg(), templates.ToGo(field.Type.Name()), nil),
- types.NewInterfaceType([]*types.Func{}, []types.Type{}),
- nil,
- )
-
- case ast.Enum:
- // no user defined model, must reference a generated enum
- typ = types.NewNamed(
- types.NewTypeName(0, cfg.Model.Pkg(), templates.ToGo(field.Type.Name()), nil),
- nil,
- nil,
- )
-
- case ast.Object, ast.InputObject:
- // no user defined model, must reference a generated struct
- typ = types.NewNamed(
- types.NewTypeName(0, cfg.Model.Pkg(), templates.ToGo(field.Type.Name()), nil),
- types.NewStruct(nil, nil),
- nil,
- )
-
- default:
- panic(fmt.Errorf("unknown ast type %s", fieldDef.Kind))
- }
- }
-
- name := templates.ToGo(field.Name)
- if nameOveride := cfg.Models[schemaType.Name].Fields[field.Name].FieldName; nameOveride != "" {
- name = nameOveride
- }
-
- typ = binder.CopyModifiersFromAst(field.Type, typ)
-
- if cfg.StructFieldsAlwaysPointers {
- if isStruct(typ) && (fieldDef.Kind == ast.Object || fieldDef.Kind == ast.InputObject) {
- typ = types.NewPointer(typ)
- }
- }
-
- f := &Field{
- Name: field.Name,
- GoName: name,
- Type: typ,
- Description: field.Description,
- Tag: `json:"` + field.Name + `"`,
- }
-
- if m.FieldHook != nil {
- mf, err := m.FieldHook(schemaType, field, f)
- if err != nil {
- return nil, fmt.Errorf("generror: field %v.%v: %w", schemaType.Name, field.Name, err)
- }
- f = mf
- }
-
- fields = append(fields, f)
- }
-
- return fields, nil
-}
-
-// GoTagFieldHook applies the goTag directive to the generated Field f. When applying the Tag to the field, the field
-// name is used when no value argument is present.
-func GoTagFieldHook(td *ast.Definition, fd *ast.FieldDefinition, f *Field) (*Field, error) {
- args := make([]string, 0)
- for _, goTag := range fd.Directives.ForNames("goTag") {
- key := ""
- value := fd.Name
-
- if arg := goTag.Arguments.ForName("key"); arg != nil {
- if k, err := arg.Value.Value(nil); err == nil {
- key = k.(string)
- }
- }
-
- if arg := goTag.Arguments.ForName("value"); arg != nil {
- if v, err := arg.Value.Value(nil); err == nil {
- value = v.(string)
- }
- }
-
- args = append(args, key+":\""+value+"\"")
- }
-
- if len(args) > 0 {
- f.Tag = f.Tag + " " + strings.Join(args, " ")
- }
-
- return f, nil
-}
-
-func isStruct(t types.Type) bool {
- _, is := t.Underlying().(*types.Struct)
- return is
-}
-
-// findAndHandleCyclicalRelationships checks for cyclical relationships between generated structs and replaces them
-// with pointers. These relationships will produce compilation errors if they are not pointers.
-// Also handles recursive structs.
-func findAndHandleCyclicalRelationships(b *ModelBuild) {
- for ii, structA := range b.Models {
- for _, fieldA := range structA.Fields {
- if strings.Contains(fieldA.Type.String(), "NotCyclicalA") {
- fmt.Print()
- }
- if !isStruct(fieldA.Type) {
- continue
- }
-
- // the field Type string will be in the form "github.com/99designs/gqlgen/codegen/testserver/followschema.LoopA"
- // we only want the part after the last dot: "LoopA"
- // this could lead to false positives, as we are only checking the name of the struct type, but these
- // should be extremely rare, if it is even possible at all.
- fieldAStructNameParts := strings.Split(fieldA.Type.String(), ".")
- fieldAStructName := fieldAStructNameParts[len(fieldAStructNameParts)-1]
-
- // find this struct type amongst the generated structs
- for jj, structB := range b.Models {
- if structB.Name != fieldAStructName {
- continue
- }
-
- // check if structB contains a cyclical reference back to structA
- var cyclicalReferenceFound bool
- for _, fieldB := range structB.Fields {
- if !isStruct(fieldB.Type) {
- continue
- }
-
- fieldBStructNameParts := strings.Split(fieldB.Type.String(), ".")
- fieldBStructName := fieldBStructNameParts[len(fieldBStructNameParts)-1]
- if fieldBStructName == structA.Name {
- cyclicalReferenceFound = true
- fieldB.Type = types.NewPointer(fieldB.Type)
- // keep looping in case this struct has additional fields of this type
- }
- }
-
- // if this is a recursive struct (i.e. structA == structB), ensure that we only change this field to a pointer once
- if cyclicalReferenceFound && ii != jj {
- fieldA.Type = types.NewPointer(fieldA.Type)
- break
- }
- }
- }
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/plugin/modelgen/models.gotpl b/vendor/github.com/99designs/gqlgen/plugin/modelgen/models.gotpl
deleted file mode 100644
index 7ad43bef1b..0000000000
--- a/vendor/github.com/99designs/gqlgen/plugin/modelgen/models.gotpl
+++ /dev/null
@@ -1,102 +0,0 @@
-{{ reserveImport "context" }}
-{{ reserveImport "fmt" }}
-{{ reserveImport "io" }}
-{{ reserveImport "strconv" }}
-{{ reserveImport "time" }}
-{{ reserveImport "sync" }}
-{{ reserveImport "errors" }}
-{{ reserveImport "bytes" }}
-
-{{ reserveImport "github.com/vektah/gqlparser/v2" }}
-{{ reserveImport "github.com/vektah/gqlparser/v2/ast" }}
-{{ reserveImport "github.com/99designs/gqlgen/graphql" }}
-{{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }}
-
-{{- range $model := .Interfaces }}
- {{ with .Description }} {{.|prefixLines "// "}} {{ end }}
- type {{ goModelName .Name }} interface {
- {{- range $impl := .Implements }}
- Is{{ goModelName $impl }}()
- {{- end }}
- Is{{ goModelName .Name }}()
- {{- range $field := .Fields }}
- {{- with .Description }}
- {{.|prefixLines "// "}}
- {{- end}}
- Get{{ $field.GoName }}() {{ $field.Type | ref }}
- {{- end }}
- }
-{{- end }}
-
-{{ range $model := .Models }}
- {{with .Description }} {{.|prefixLines "// "}} {{end}}
- type {{ goModelName .Name }} struct {
- {{- range $field := .Fields }}
- {{- with .Description }}
- {{.|prefixLines "// "}}
- {{- end}}
- {{ $field.GoName }} {{$field.Type | ref}} `{{$field.Tag}}`
- {{- end }}
- }
-
- {{ range .Implements }}
- func ({{ goModelName $model.Name }}) Is{{ goModelName . }}() {}
- {{- with getInterfaceByName . }}
- {{- range .Fields }}
- {{- with .Description }}
- {{.|prefixLines "// "}}
- {{- end}}
- {{ generateGetter $model . }}
- {{- end }}
- {{- end }}
- {{ end }}
-{{- end}}
-
-{{ range $enum := .Enums }}
- {{ with .Description }} {{.|prefixLines "// "}} {{end}}
- type {{ goModelName .Name }} string
- const (
- {{- range $value := .Values}}
- {{- with .Description}}
- {{.|prefixLines "// "}}
- {{- end}}
- {{ goModelName $enum.Name .Name }} {{ goModelName $enum.Name }} = {{ .Name|quote }}
- {{- end }}
- )
-
- var All{{ goModelName .Name }} = []{{ goModelName .Name }}{
- {{- range $value := .Values}}
- {{ goModelName $enum.Name .Name }},
- {{- end }}
- }
-
- func (e {{ goModelName .Name }}) IsValid() bool {
- switch e {
- case {{ range $index, $element := .Values}}{{if $index}},{{end}}{{ goModelName $enum.Name $element.Name }}{{end}}:
- return true
- }
- return false
- }
-
- func (e {{ goModelName .Name }}) String() string {
- return string(e)
- }
-
- func (e *{{ goModelName .Name }}) UnmarshalGQL(v interface{}) error {
- str, ok := v.(string)
- if !ok {
- return fmt.Errorf("enums must be strings")
- }
-
- *e = {{ goModelName .Name }}(str)
- if !e.IsValid() {
- return fmt.Errorf("%s is not a valid {{ .Name }}", str)
- }
- return nil
- }
-
- func (e {{ goModelName .Name }}) MarshalGQL(w io.Writer) {
- fmt.Fprint(w, strconv.Quote(e.String()))
- }
-
-{{- end }}
diff --git a/vendor/github.com/99designs/gqlgen/plugin/plugin.go b/vendor/github.com/99designs/gqlgen/plugin/plugin.go
deleted file mode 100644
index 7de36bd8cd..0000000000
--- a/vendor/github.com/99designs/gqlgen/plugin/plugin.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// plugin package interfaces are EXPERIMENTAL.
-
-package plugin
-
-import (
- "github.com/99designs/gqlgen/codegen"
- "github.com/99designs/gqlgen/codegen/config"
- "github.com/vektah/gqlparser/v2/ast"
-)
-
-type Plugin interface {
- Name() string
-}
-
-type ConfigMutator interface {
- MutateConfig(cfg *config.Config) error
-}
-
-type CodeGenerator interface {
- GenerateCode(cfg *codegen.Data) error
-}
-
-// EarlySourceInjector is used to inject things that are required for user schema files to compile.
-type EarlySourceInjector interface {
- InjectSourceEarly() *ast.Source
-}
-
-// LateSourceInjector is used to inject more sources, after we have loaded the users schema.
-type LateSourceInjector interface {
- InjectSourceLate(schema *ast.Schema) *ast.Source
-}
diff --git a/vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.go b/vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.go
deleted file mode 100644
index aa3be72739..0000000000
--- a/vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.go
+++ /dev/null
@@ -1,227 +0,0 @@
-package resolvergen
-
-import (
- _ "embed"
- "errors"
- "fmt"
- "io/fs"
- "os"
- "path/filepath"
- "strings"
-
- "github.com/99designs/gqlgen/codegen"
- "github.com/99designs/gqlgen/codegen/config"
- "github.com/99designs/gqlgen/codegen/templates"
- "github.com/99designs/gqlgen/internal/rewrite"
- "github.com/99designs/gqlgen/plugin"
- "golang.org/x/text/cases"
- "golang.org/x/text/language"
-)
-
-//go:embed resolver.gotpl
-var resolverTemplate string
-
-func New() plugin.Plugin {
- return &Plugin{}
-}
-
-type Plugin struct{}
-
-var _ plugin.CodeGenerator = &Plugin{}
-
-func (m *Plugin) Name() string {
- return "resolvergen"
-}
-
-func (m *Plugin) GenerateCode(data *codegen.Data) error {
- if !data.Config.Resolver.IsDefined() {
- return nil
- }
-
- switch data.Config.Resolver.Layout {
- case config.LayoutSingleFile:
- return m.generateSingleFile(data)
- case config.LayoutFollowSchema:
- return m.generatePerSchema(data)
- }
-
- return nil
-}
-
-func (m *Plugin) generateSingleFile(data *codegen.Data) error {
- file := File{}
-
- if _, err := os.Stat(data.Config.Resolver.Filename); err == nil {
- // file already exists and we dont support updating resolvers with layout = single so just return
- return nil
- }
-
- for _, o := range data.Objects {
- if o.HasResolvers() {
- file.Objects = append(file.Objects, o)
- }
- for _, f := range o.Fields {
- if !f.IsResolver {
- continue
- }
-
- resolver := Resolver{o, f, "// foo", `panic("not implemented")`}
- file.Resolvers = append(file.Resolvers, &resolver)
- }
- }
-
- resolverBuild := &ResolverBuild{
- File: &file,
- PackageName: data.Config.Resolver.Package,
- ResolverType: data.Config.Resolver.Type,
- HasRoot: true,
- }
-
- return templates.Render(templates.Options{
- PackageName: data.Config.Resolver.Package,
- FileNotice: `// THIS CODE IS A STARTING POINT ONLY. IT WILL NOT BE UPDATED WITH SCHEMA CHANGES.`,
- Filename: data.Config.Resolver.Filename,
- Data: resolverBuild,
- Packages: data.Config.Packages,
- Template: resolverTemplate,
- })
-}
-
-func (m *Plugin) generatePerSchema(data *codegen.Data) error {
- rewriter, err := rewrite.New(data.Config.Resolver.Dir())
- if err != nil {
- return err
- }
-
- files := map[string]*File{}
-
- objects := make(codegen.Objects, len(data.Objects)+len(data.Inputs))
- copy(objects, data.Objects)
- copy(objects[len(data.Objects):], data.Inputs)
-
- for _, o := range objects {
- if o.HasResolvers() {
- fn := gqlToResolverName(data.Config.Resolver.Dir(), o.Position.Src.Name, data.Config.Resolver.FilenameTemplate)
- if files[fn] == nil {
- files[fn] = &File{}
- }
-
- caser := cases.Title(language.English, cases.NoLower)
- rewriter.MarkStructCopied(templates.LcFirst(o.Name) + templates.UcFirst(data.Config.Resolver.Type))
- rewriter.GetMethodBody(data.Config.Resolver.Type, caser.String(o.Name))
- files[fn].Objects = append(files[fn].Objects, o)
- }
- for _, f := range o.Fields {
- if !f.IsResolver {
- continue
- }
-
- structName := templates.LcFirst(o.Name) + templates.UcFirst(data.Config.Resolver.Type)
- implementation := strings.TrimSpace(rewriter.GetMethodBody(structName, f.GoFieldName))
- comment := strings.TrimSpace(strings.TrimLeft(rewriter.GetMethodComment(structName, f.GoFieldName), `\`))
- if implementation == "" {
- implementation = fmt.Sprintf("panic(fmt.Errorf(\"not implemented: %v - %v\"))", f.GoFieldName, f.Name)
- }
- if comment == "" {
- comment = fmt.Sprintf("%v is the resolver for the %v field.", f.GoFieldName, f.Name)
- }
-
- resolver := Resolver{o, f, comment, implementation}
- fn := gqlToResolverName(data.Config.Resolver.Dir(), f.Position.Src.Name, data.Config.Resolver.FilenameTemplate)
- if files[fn] == nil {
- files[fn] = &File{}
- }
-
- files[fn].Resolvers = append(files[fn].Resolvers, &resolver)
- }
- }
-
- for filename, file := range files {
- file.imports = rewriter.ExistingImports(filename)
- file.RemainingSource = rewriter.RemainingSource(filename)
- }
-
- for filename, file := range files {
- resolverBuild := &ResolverBuild{
- File: file,
- PackageName: data.Config.Resolver.Package,
- ResolverType: data.Config.Resolver.Type,
- }
-
- err := templates.Render(templates.Options{
- PackageName: data.Config.Resolver.Package,
- FileNotice: `
- // This file will be automatically regenerated based on the schema, any resolver implementations
- // will be copied through when generating and any unknown code will be moved to the end.`,
- Filename: filename,
- Data: resolverBuild,
- Packages: data.Config.Packages,
- Template: resolverTemplate,
- })
- if err != nil {
- return err
- }
- }
-
- if _, err := os.Stat(data.Config.Resolver.Filename); errors.Is(err, fs.ErrNotExist) {
- err := templates.Render(templates.Options{
- PackageName: data.Config.Resolver.Package,
- FileNotice: `
- // This file will not be regenerated automatically.
- //
- // It serves as dependency injection for your app, add any dependencies you require here.`,
- Template: `type {{.}} struct {}`,
- Filename: data.Config.Resolver.Filename,
- Data: data.Config.Resolver.Type,
- Packages: data.Config.Packages,
- })
- if err != nil {
- return err
- }
- }
- return nil
-}
-
-type ResolverBuild struct {
- *File
- HasRoot bool
- PackageName string
- ResolverType string
-}
-
-type File struct {
- // These are separated because the type definition of the resolver object may live in a different file from the
- // resolver method implementations, for example when extending a type in a different graphql schema file
- Objects []*codegen.Object
- Resolvers []*Resolver
- imports []rewrite.Import
- RemainingSource string
-}
-
-func (f *File) Imports() string {
- for _, imp := range f.imports {
- if imp.Alias == "" {
- _, _ = templates.CurrentImports.Reserve(imp.ImportPath)
- } else {
- _, _ = templates.CurrentImports.Reserve(imp.ImportPath, imp.Alias)
- }
- }
- return ""
-}
-
-type Resolver struct {
- Object *codegen.Object
- Field *codegen.Field
- Comment string
- Implementation string
-}
-
-func gqlToResolverName(base string, gqlname, filenameTmpl string) string {
- gqlname = filepath.Base(gqlname)
- ext := filepath.Ext(gqlname)
- if filenameTmpl == "" {
- filenameTmpl = "{name}.resolvers.go"
- }
- filename := strings.ReplaceAll(filenameTmpl, "{name}", strings.TrimSuffix(gqlname, ext))
- return filepath.Join(base, filename)
-}
diff --git a/vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.gotpl b/vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.gotpl
deleted file mode 100644
index c5d716ff7b..0000000000
--- a/vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.gotpl
+++ /dev/null
@@ -1,46 +0,0 @@
-{{ reserveImport "context" }}
-{{ reserveImport "fmt" }}
-{{ reserveImport "io" }}
-{{ reserveImport "strconv" }}
-{{ reserveImport "time" }}
-{{ reserveImport "sync" }}
-{{ reserveImport "errors" }}
-{{ reserveImport "bytes" }}
-
-{{ reserveImport "github.com/vektah/gqlparser/v2" }}
-{{ reserveImport "github.com/vektah/gqlparser/v2/ast" }}
-{{ reserveImport "github.com/99designs/gqlgen/graphql" }}
-{{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }}
-
-{{ .Imports }}
-
-{{ if .HasRoot }}
- type {{.ResolverType}} struct {}
-{{ end }}
-
-{{ range $resolver := .Resolvers -}}
- // {{ $resolver.Comment }}
- func (r *{{lcFirst $resolver.Object.Name}}{{ucFirst $.ResolverType}}) {{$resolver.Field.GoFieldName}}{{ $resolver.Field.ShortResolverDeclaration }} {
- {{ $resolver.Implementation }}
- }
-
-{{ end }}
-
-{{ range $object := .Objects -}}
- // {{ucFirst $object.Name}} returns {{ $object.ResolverInterface | ref }} implementation.
- func (r *{{$.ResolverType}}) {{ucFirst $object.Name}}() {{ $object.ResolverInterface | ref }} { return &{{lcFirst $object.Name}}{{ucFirst $.ResolverType}}{r} }
-{{ end }}
-
-{{ range $object := .Objects -}}
- type {{lcFirst $object.Name}}{{ucFirst $.ResolverType}} struct { *{{$.ResolverType}} }
-{{ end }}
-
-{{ if (ne .RemainingSource "") }}
- // !!! WARNING !!!
- // The code below was going to be deleted when updating resolvers. It has been copied here so you have
- // one last chance to move it out of harms way if you want. There are two reasons this happens:
- // - When renaming or deleting a resolver the old code will be put in here. You can safely delete
- // it when you're done.
- // - You have helper methods in this file. Move them out to keep these resolver files clean.
- {{ .RemainingSource }}
-{{ end }}
diff --git a/vendor/github.com/Azure/go-ntlmssp/.travis.yml b/vendor/github.com/Azure/go-ntlmssp/.travis.yml
deleted file mode 100644
index 23c95fe951..0000000000
--- a/vendor/github.com/Azure/go-ntlmssp/.travis.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-sudo: false
-
-language: go
-
-before_script:
- - go get -u golang.org/x/lint/golint
-
-go:
- - 1.10.x
- - master
-
-script:
- - test -z "$(gofmt -s -l . | tee /dev/stderr)"
- - test -z "$(golint ./... | tee /dev/stderr)"
- - go vet ./...
- - go build -v ./...
- - go test -v ./...
diff --git a/vendor/github.com/Azure/go-ntlmssp/LICENSE b/vendor/github.com/Azure/go-ntlmssp/LICENSE
deleted file mode 100644
index dc1cf39d13..0000000000
--- a/vendor/github.com/Azure/go-ntlmssp/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2016 Microsoft
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/Azure/go-ntlmssp/README.md b/vendor/github.com/Azure/go-ntlmssp/README.md
deleted file mode 100644
index 55cdcefab7..0000000000
--- a/vendor/github.com/Azure/go-ntlmssp/README.md
+++ /dev/null
@@ -1,29 +0,0 @@
-# go-ntlmssp
-Golang package that provides NTLM/Negotiate authentication over HTTP
-
-[](https://godoc.org/github.com/Azure/go-ntlmssp) [](https://travis-ci.org/Azure/go-ntlmssp)
-
-Protocol details from https://msdn.microsoft.com/en-us/library/cc236621.aspx
-Implementation hints from http://davenport.sourceforge.net/ntlm.html
-
-This package only implements authentication, no key exchange or encryption. It
-only supports Unicode (UTF16LE) encoding of protocol strings, no OEM encoding.
-This package implements NTLMv2.
-
-# Usage
-
-```
-url, user, password := "http://www.example.com/secrets", "robpike", "pw123"
-client := &http.Client{
- Transport: ntlmssp.Negotiator{
- RoundTripper:&http.Transport{},
- },
-}
-
-req, _ := http.NewRequest("GET", url, nil)
-req.SetBasicAuth(user, password)
-res, _ := client.Do(req)
-```
-
------
-This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
diff --git a/vendor/github.com/Azure/go-ntlmssp/authenticate_message.go b/vendor/github.com/Azure/go-ntlmssp/authenticate_message.go
deleted file mode 100644
index c8930680c5..0000000000
--- a/vendor/github.com/Azure/go-ntlmssp/authenticate_message.go
+++ /dev/null
@@ -1,183 +0,0 @@
-package ntlmssp
-
-import (
- "bytes"
- "crypto/rand"
- "encoding/binary"
- "encoding/hex"
- "errors"
- "strings"
- "time"
-)
-
-type authenicateMessage struct {
- LmChallengeResponse []byte
- NtChallengeResponse []byte
-
- TargetName string
- UserName string
-
- // only set if negotiateFlag_NTLMSSP_NEGOTIATE_KEY_EXCH
- EncryptedRandomSessionKey []byte
-
- NegotiateFlags negotiateFlags
-
- MIC []byte
-}
-
-type authenticateMessageFields struct {
- messageHeader
- LmChallengeResponse varField
- NtChallengeResponse varField
- TargetName varField
- UserName varField
- Workstation varField
- _ [8]byte
- NegotiateFlags negotiateFlags
-}
-
-func (m authenicateMessage) MarshalBinary() ([]byte, error) {
- if !m.NegotiateFlags.Has(negotiateFlagNTLMSSPNEGOTIATEUNICODE) {
- return nil, errors.New("Only unicode is supported")
- }
-
- target, user := toUnicode(m.TargetName), toUnicode(m.UserName)
- workstation := toUnicode("go-ntlmssp")
-
- ptr := binary.Size(&authenticateMessageFields{})
- f := authenticateMessageFields{
- messageHeader: newMessageHeader(3),
- NegotiateFlags: m.NegotiateFlags,
- LmChallengeResponse: newVarField(&ptr, len(m.LmChallengeResponse)),
- NtChallengeResponse: newVarField(&ptr, len(m.NtChallengeResponse)),
- TargetName: newVarField(&ptr, len(target)),
- UserName: newVarField(&ptr, len(user)),
- Workstation: newVarField(&ptr, len(workstation)),
- }
-
- f.NegotiateFlags.Unset(negotiateFlagNTLMSSPNEGOTIATEVERSION)
-
- b := bytes.Buffer{}
- if err := binary.Write(&b, binary.LittleEndian, &f); err != nil {
- return nil, err
- }
- if err := binary.Write(&b, binary.LittleEndian, &m.LmChallengeResponse); err != nil {
- return nil, err
- }
- if err := binary.Write(&b, binary.LittleEndian, &m.NtChallengeResponse); err != nil {
- return nil, err
- }
- if err := binary.Write(&b, binary.LittleEndian, &target); err != nil {
- return nil, err
- }
- if err := binary.Write(&b, binary.LittleEndian, &user); err != nil {
- return nil, err
- }
- if err := binary.Write(&b, binary.LittleEndian, &workstation); err != nil {
- return nil, err
- }
-
- return b.Bytes(), nil
-}
-
-//ProcessChallenge crafts an AUTHENTICATE message in response to the CHALLENGE message
-//that was received from the server
-func ProcessChallenge(challengeMessageData []byte, user, password string) ([]byte, error) {
- if user == "" && password == "" {
- return nil, errors.New("Anonymous authentication not supported")
- }
-
- var cm challengeMessage
- if err := cm.UnmarshalBinary(challengeMessageData); err != nil {
- return nil, err
- }
-
- if cm.NegotiateFlags.Has(negotiateFlagNTLMSSPNEGOTIATELMKEY) {
- return nil, errors.New("Only NTLM v2 is supported, but server requested v1 (NTLMSSP_NEGOTIATE_LM_KEY)")
- }
- if cm.NegotiateFlags.Has(negotiateFlagNTLMSSPNEGOTIATEKEYEXCH) {
- return nil, errors.New("Key exchange requested but not supported (NTLMSSP_NEGOTIATE_KEY_EXCH)")
- }
-
- am := authenicateMessage{
- UserName: user,
- TargetName: cm.TargetName,
- NegotiateFlags: cm.NegotiateFlags,
- }
-
- timestamp := cm.TargetInfo[avIDMsvAvTimestamp]
- if timestamp == nil { // no time sent, take current time
- ft := uint64(time.Now().UnixNano()) / 100
- ft += 116444736000000000 // add time between unix & windows offset
- timestamp = make([]byte, 8)
- binary.LittleEndian.PutUint64(timestamp, ft)
- }
-
- clientChallenge := make([]byte, 8)
- rand.Reader.Read(clientChallenge)
-
- ntlmV2Hash := getNtlmV2Hash(password, user, cm.TargetName)
-
- am.NtChallengeResponse = computeNtlmV2Response(ntlmV2Hash,
- cm.ServerChallenge[:], clientChallenge, timestamp, cm.TargetInfoRaw)
-
- if cm.TargetInfoRaw == nil {
- am.LmChallengeResponse = computeLmV2Response(ntlmV2Hash,
- cm.ServerChallenge[:], clientChallenge)
- }
- return am.MarshalBinary()
-}
-
-func ProcessChallengeWithHash(challengeMessageData []byte, user, hash string) ([]byte, error) {
- if user == "" && hash == "" {
- return nil, errors.New("Anonymous authentication not supported")
- }
-
- var cm challengeMessage
- if err := cm.UnmarshalBinary(challengeMessageData); err != nil {
- return nil, err
- }
-
- if cm.NegotiateFlags.Has(negotiateFlagNTLMSSPNEGOTIATELMKEY) {
- return nil, errors.New("Only NTLM v2 is supported, but server requested v1 (NTLMSSP_NEGOTIATE_LM_KEY)")
- }
- if cm.NegotiateFlags.Has(negotiateFlagNTLMSSPNEGOTIATEKEYEXCH) {
- return nil, errors.New("Key exchange requested but not supported (NTLMSSP_NEGOTIATE_KEY_EXCH)")
- }
-
- am := authenicateMessage{
- UserName: user,
- TargetName: cm.TargetName,
- NegotiateFlags: cm.NegotiateFlags,
- }
-
- timestamp := cm.TargetInfo[avIDMsvAvTimestamp]
- if timestamp == nil { // no time sent, take current time
- ft := uint64(time.Now().UnixNano()) / 100
- ft += 116444736000000000 // add time between unix & windows offset
- timestamp = make([]byte, 8)
- binary.LittleEndian.PutUint64(timestamp, ft)
- }
-
- clientChallenge := make([]byte, 8)
- rand.Reader.Read(clientChallenge)
-
- hashParts := strings.Split(hash, ":")
- if len(hashParts) > 1 {
- hash = hashParts[1]
- }
- hashBytes, err := hex.DecodeString(hash)
- if err != nil {
- return nil, err
- }
- ntlmV2Hash := hmacMd5(hashBytes, toUnicode(strings.ToUpper(user)+cm.TargetName))
-
- am.NtChallengeResponse = computeNtlmV2Response(ntlmV2Hash,
- cm.ServerChallenge[:], clientChallenge, timestamp, cm.TargetInfoRaw)
-
- if cm.TargetInfoRaw == nil {
- am.LmChallengeResponse = computeLmV2Response(ntlmV2Hash,
- cm.ServerChallenge[:], clientChallenge)
- }
- return am.MarshalBinary()
-}
diff --git a/vendor/github.com/Azure/go-ntlmssp/authheader.go b/vendor/github.com/Azure/go-ntlmssp/authheader.go
deleted file mode 100644
index aac3f77d10..0000000000
--- a/vendor/github.com/Azure/go-ntlmssp/authheader.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package ntlmssp
-
-import (
- "encoding/base64"
- "strings"
-)
-
-type authheader string
-
-func (h authheader) IsBasic() bool {
- return strings.HasPrefix(string(h), "Basic ")
-}
-
-func (h authheader) IsNegotiate() bool {
- return strings.HasPrefix(string(h), "Negotiate")
-}
-
-func (h authheader) IsNTLM() bool {
- return strings.HasPrefix(string(h), "NTLM")
-}
-
-func (h authheader) GetData() ([]byte, error) {
- p := strings.Split(string(h), " ")
- if len(p) < 2 {
- return nil, nil
- }
- return base64.StdEncoding.DecodeString(string(p[1]))
-}
-
-func (h authheader) GetBasicCreds() (username, password string, err error) {
- d, err := h.GetData()
- if err != nil {
- return "", "", err
- }
- parts := strings.SplitN(string(d), ":", 2)
- return parts[0], parts[1], nil
-}
diff --git a/vendor/github.com/Azure/go-ntlmssp/avids.go b/vendor/github.com/Azure/go-ntlmssp/avids.go
deleted file mode 100644
index 196b5f1316..0000000000
--- a/vendor/github.com/Azure/go-ntlmssp/avids.go
+++ /dev/null
@@ -1,17 +0,0 @@
-package ntlmssp
-
-type avID uint16
-
-const (
- avIDMsvAvEOL avID = iota
- avIDMsvAvNbComputerName
- avIDMsvAvNbDomainName
- avIDMsvAvDNSComputerName
- avIDMsvAvDNSDomainName
- avIDMsvAvDNSTreeName
- avIDMsvAvFlags
- avIDMsvAvTimestamp
- avIDMsvAvSingleHost
- avIDMsvAvTargetName
- avIDMsvChannelBindings
-)
diff --git a/vendor/github.com/Azure/go-ntlmssp/challenge_message.go b/vendor/github.com/Azure/go-ntlmssp/challenge_message.go
deleted file mode 100644
index 053b55e4ad..0000000000
--- a/vendor/github.com/Azure/go-ntlmssp/challenge_message.go
+++ /dev/null
@@ -1,82 +0,0 @@
-package ntlmssp
-
-import (
- "bytes"
- "encoding/binary"
- "fmt"
-)
-
-type challengeMessageFields struct {
- messageHeader
- TargetName varField
- NegotiateFlags negotiateFlags
- ServerChallenge [8]byte
- _ [8]byte
- TargetInfo varField
-}
-
-func (m challengeMessageFields) IsValid() bool {
- return m.messageHeader.IsValid() && m.MessageType == 2
-}
-
-type challengeMessage struct {
- challengeMessageFields
- TargetName string
- TargetInfo map[avID][]byte
- TargetInfoRaw []byte
-}
-
-func (m *challengeMessage) UnmarshalBinary(data []byte) error {
- r := bytes.NewReader(data)
- err := binary.Read(r, binary.LittleEndian, &m.challengeMessageFields)
- if err != nil {
- return err
- }
- if !m.challengeMessageFields.IsValid() {
- return fmt.Errorf("Message is not a valid challenge message: %+v", m.challengeMessageFields.messageHeader)
- }
-
- if m.challengeMessageFields.TargetName.Len > 0 {
- m.TargetName, err = m.challengeMessageFields.TargetName.ReadStringFrom(data, m.NegotiateFlags.Has(negotiateFlagNTLMSSPNEGOTIATEUNICODE))
- if err != nil {
- return err
- }
- }
-
- if m.challengeMessageFields.TargetInfo.Len > 0 {
- d, err := m.challengeMessageFields.TargetInfo.ReadFrom(data)
- m.TargetInfoRaw = d
- if err != nil {
- return err
- }
- m.TargetInfo = make(map[avID][]byte)
- r := bytes.NewReader(d)
- for {
- var id avID
- var l uint16
- err = binary.Read(r, binary.LittleEndian, &id)
- if err != nil {
- return err
- }
- if id == avIDMsvAvEOL {
- break
- }
-
- err = binary.Read(r, binary.LittleEndian, &l)
- if err != nil {
- return err
- }
- value := make([]byte, l)
- n, err := r.Read(value)
- if err != nil {
- return err
- }
- if n != int(l) {
- return fmt.Errorf("Expected to read %d bytes, got only %d", l, n)
- }
- m.TargetInfo[id] = value
- }
- }
-
- return nil
-}
diff --git a/vendor/github.com/Azure/go-ntlmssp/messageheader.go b/vendor/github.com/Azure/go-ntlmssp/messageheader.go
deleted file mode 100644
index 247e284652..0000000000
--- a/vendor/github.com/Azure/go-ntlmssp/messageheader.go
+++ /dev/null
@@ -1,21 +0,0 @@
-package ntlmssp
-
-import (
- "bytes"
-)
-
-var signature = [8]byte{'N', 'T', 'L', 'M', 'S', 'S', 'P', 0}
-
-type messageHeader struct {
- Signature [8]byte
- MessageType uint32
-}
-
-func (h messageHeader) IsValid() bool {
- return bytes.Equal(h.Signature[:], signature[:]) &&
- h.MessageType > 0 && h.MessageType < 4
-}
-
-func newMessageHeader(messageType uint32) messageHeader {
- return messageHeader{signature, messageType}
-}
diff --git a/vendor/github.com/Azure/go-ntlmssp/negotiate_flags.go b/vendor/github.com/Azure/go-ntlmssp/negotiate_flags.go
deleted file mode 100644
index 5905c023d6..0000000000
--- a/vendor/github.com/Azure/go-ntlmssp/negotiate_flags.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package ntlmssp
-
-type negotiateFlags uint32
-
-const (
- /*A*/ negotiateFlagNTLMSSPNEGOTIATEUNICODE negotiateFlags = 1 << 0
- /*B*/ negotiateFlagNTLMNEGOTIATEOEM = 1 << 1
- /*C*/ negotiateFlagNTLMSSPREQUESTTARGET = 1 << 2
-
- /*D*/
- negotiateFlagNTLMSSPNEGOTIATESIGN = 1 << 4
- /*E*/ negotiateFlagNTLMSSPNEGOTIATESEAL = 1 << 5
- /*F*/ negotiateFlagNTLMSSPNEGOTIATEDATAGRAM = 1 << 6
- /*G*/ negotiateFlagNTLMSSPNEGOTIATELMKEY = 1 << 7
-
- /*H*/
- negotiateFlagNTLMSSPNEGOTIATENTLM = 1 << 9
-
- /*J*/
- negotiateFlagANONYMOUS = 1 << 11
- /*K*/ negotiateFlagNTLMSSPNEGOTIATEOEMDOMAINSUPPLIED = 1 << 12
- /*L*/ negotiateFlagNTLMSSPNEGOTIATEOEMWORKSTATIONSUPPLIED = 1 << 13
-
- /*M*/
- negotiateFlagNTLMSSPNEGOTIATEALWAYSSIGN = 1 << 15
- /*N*/ negotiateFlagNTLMSSPTARGETTYPEDOMAIN = 1 << 16
- /*O*/ negotiateFlagNTLMSSPTARGETTYPESERVER = 1 << 17
-
- /*P*/
- negotiateFlagNTLMSSPNEGOTIATEEXTENDEDSESSIONSECURITY = 1 << 19
- /*Q*/ negotiateFlagNTLMSSPNEGOTIATEIDENTIFY = 1 << 20
-
- /*R*/
- negotiateFlagNTLMSSPREQUESTNONNTSESSIONKEY = 1 << 22
- /*S*/ negotiateFlagNTLMSSPNEGOTIATETARGETINFO = 1 << 23
-
- /*T*/
- negotiateFlagNTLMSSPNEGOTIATEVERSION = 1 << 25
-
- /*U*/
- negotiateFlagNTLMSSPNEGOTIATE128 = 1 << 29
- /*V*/ negotiateFlagNTLMSSPNEGOTIATEKEYEXCH = 1 << 30
- /*W*/ negotiateFlagNTLMSSPNEGOTIATE56 = 1 << 31
-)
-
-func (field negotiateFlags) Has(flags negotiateFlags) bool {
- return field&flags == flags
-}
-
-func (field *negotiateFlags) Unset(flags negotiateFlags) {
- *field = *field ^ (*field & flags)
-}
diff --git a/vendor/github.com/Azure/go-ntlmssp/negotiate_message.go b/vendor/github.com/Azure/go-ntlmssp/negotiate_message.go
deleted file mode 100644
index e466a9861d..0000000000
--- a/vendor/github.com/Azure/go-ntlmssp/negotiate_message.go
+++ /dev/null
@@ -1,64 +0,0 @@
-package ntlmssp
-
-import (
- "bytes"
- "encoding/binary"
- "errors"
- "strings"
-)
-
-const expMsgBodyLen = 40
-
-type negotiateMessageFields struct {
- messageHeader
- NegotiateFlags negotiateFlags
-
- Domain varField
- Workstation varField
-
- Version
-}
-
-var defaultFlags = negotiateFlagNTLMSSPNEGOTIATETARGETINFO |
- negotiateFlagNTLMSSPNEGOTIATE56 |
- negotiateFlagNTLMSSPNEGOTIATE128 |
- negotiateFlagNTLMSSPNEGOTIATEUNICODE |
- negotiateFlagNTLMSSPNEGOTIATEEXTENDEDSESSIONSECURITY
-
-//NewNegotiateMessage creates a new NEGOTIATE message with the
-//flags that this package supports.
-func NewNegotiateMessage(domainName, workstationName string) ([]byte, error) {
- payloadOffset := expMsgBodyLen
- flags := defaultFlags
-
- if domainName != "" {
- flags |= negotiateFlagNTLMSSPNEGOTIATEOEMDOMAINSUPPLIED
- }
-
- if workstationName != "" {
- flags |= negotiateFlagNTLMSSPNEGOTIATEOEMWORKSTATIONSUPPLIED
- }
-
- msg := negotiateMessageFields{
- messageHeader: newMessageHeader(1),
- NegotiateFlags: flags,
- Domain: newVarField(&payloadOffset, len(domainName)),
- Workstation: newVarField(&payloadOffset, len(workstationName)),
- Version: DefaultVersion(),
- }
-
- b := bytes.Buffer{}
- if err := binary.Write(&b, binary.LittleEndian, &msg); err != nil {
- return nil, err
- }
- if b.Len() != expMsgBodyLen {
- return nil, errors.New("incorrect body length")
- }
-
- payload := strings.ToUpper(domainName + workstationName)
- if _, err := b.WriteString(payload); err != nil {
- return nil, err
- }
-
- return b.Bytes(), nil
-}
diff --git a/vendor/github.com/Azure/go-ntlmssp/negotiator.go b/vendor/github.com/Azure/go-ntlmssp/negotiator.go
deleted file mode 100644
index 7705eae4f8..0000000000
--- a/vendor/github.com/Azure/go-ntlmssp/negotiator.go
+++ /dev/null
@@ -1,144 +0,0 @@
-package ntlmssp
-
-import (
- "bytes"
- "encoding/base64"
- "io"
- "io/ioutil"
- "net/http"
- "strings"
-)
-
-// GetDomain : parse domain name from based on slashes in the input
-func GetDomain(user string) (string, string) {
- domain := ""
-
- if strings.Contains(user, "\\") {
- ucomponents := strings.SplitN(user, "\\", 2)
- domain = ucomponents[0]
- user = ucomponents[1]
- }
- return user, domain
-}
-
-//Negotiator is a http.Roundtripper decorator that automatically
-//converts basic authentication to NTLM/Negotiate authentication when appropriate.
-type Negotiator struct{ http.RoundTripper }
-
-//RoundTrip sends the request to the server, handling any authentication
-//re-sends as needed.
-func (l Negotiator) RoundTrip(req *http.Request) (res *http.Response, err error) {
- // Use default round tripper if not provided
- rt := l.RoundTripper
- if rt == nil {
- rt = http.DefaultTransport
- }
- // If it is not basic auth, just round trip the request as usual
- reqauth := authheader(req.Header.Get("Authorization"))
- if !reqauth.IsBasic() {
- return rt.RoundTrip(req)
- }
- // Save request body
- body := bytes.Buffer{}
- if req.Body != nil {
- _, err = body.ReadFrom(req.Body)
- if err != nil {
- return nil, err
- }
-
- req.Body.Close()
- req.Body = ioutil.NopCloser(bytes.NewReader(body.Bytes()))
- }
- // first try anonymous, in case the server still finds us
- // authenticated from previous traffic
- req.Header.Del("Authorization")
- res, err = rt.RoundTrip(req)
- if err != nil {
- return nil, err
- }
- if res.StatusCode != http.StatusUnauthorized {
- return res, err
- }
-
- resauth := authheader(res.Header.Get("Www-Authenticate"))
- if !resauth.IsNegotiate() && !resauth.IsNTLM() {
- // Unauthorized, Negotiate not requested, let's try with basic auth
- req.Header.Set("Authorization", string(reqauth))
- io.Copy(ioutil.Discard, res.Body)
- res.Body.Close()
- req.Body = ioutil.NopCloser(bytes.NewReader(body.Bytes()))
-
- res, err = rt.RoundTrip(req)
- if err != nil {
- return nil, err
- }
- if res.StatusCode != http.StatusUnauthorized {
- return res, err
- }
- resauth = authheader(res.Header.Get("Www-Authenticate"))
- }
-
- if resauth.IsNegotiate() || resauth.IsNTLM() {
- // 401 with request:Basic and response:Negotiate
- io.Copy(ioutil.Discard, res.Body)
- res.Body.Close()
-
- // recycle credentials
- u, p, err := reqauth.GetBasicCreds()
- if err != nil {
- return nil, err
- }
-
- // get domain from username
- domain := ""
- u, domain = GetDomain(u)
-
- // send negotiate
- negotiateMessage, err := NewNegotiateMessage(domain, "")
- if err != nil {
- return nil, err
- }
- if resauth.IsNTLM() {
- req.Header.Set("Authorization", "NTLM "+base64.StdEncoding.EncodeToString(negotiateMessage))
- } else {
- req.Header.Set("Authorization", "Negotiate "+base64.StdEncoding.EncodeToString(negotiateMessage))
- }
-
- req.Body = ioutil.NopCloser(bytes.NewReader(body.Bytes()))
-
- res, err = rt.RoundTrip(req)
- if err != nil {
- return nil, err
- }
-
- // receive challenge?
- resauth = authheader(res.Header.Get("Www-Authenticate"))
- challengeMessage, err := resauth.GetData()
- if err != nil {
- return nil, err
- }
- if !(resauth.IsNegotiate() || resauth.IsNTLM()) || len(challengeMessage) == 0 {
- // Negotiation failed, let client deal with response
- return res, nil
- }
- io.Copy(ioutil.Discard, res.Body)
- res.Body.Close()
-
- // send authenticate
- authenticateMessage, err := ProcessChallenge(challengeMessage, u, p)
- if err != nil {
- return nil, err
- }
- if resauth.IsNTLM() {
- req.Header.Set("Authorization", "NTLM "+base64.StdEncoding.EncodeToString(authenticateMessage))
- } else {
- req.Header.Set("Authorization", "Negotiate "+base64.StdEncoding.EncodeToString(authenticateMessage))
- }
-
- req.Body = ioutil.NopCloser(bytes.NewReader(body.Bytes()))
-
- return rt.RoundTrip(req)
- }
-
- return res, err
-}
diff --git a/vendor/github.com/Azure/go-ntlmssp/nlmp.go b/vendor/github.com/Azure/go-ntlmssp/nlmp.go
deleted file mode 100644
index 1e65abe8b5..0000000000
--- a/vendor/github.com/Azure/go-ntlmssp/nlmp.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// Package ntlmssp provides NTLM/Negotiate authentication over HTTP
-//
-// Protocol details from https://msdn.microsoft.com/en-us/library/cc236621.aspx,
-// implementation hints from http://davenport.sourceforge.net/ntlm.html .
-// This package only implements authentication, no key exchange or encryption. It
-// only supports Unicode (UTF16LE) encoding of protocol strings, no OEM encoding.
-// This package implements NTLMv2.
-package ntlmssp
-
-import (
- "crypto/hmac"
- "crypto/md5"
- "golang.org/x/crypto/md4"
- "strings"
-)
-
-func getNtlmV2Hash(password, username, target string) []byte {
- return hmacMd5(getNtlmHash(password), toUnicode(strings.ToUpper(username)+target))
-}
-
-func getNtlmHash(password string) []byte {
- hash := md4.New()
- hash.Write(toUnicode(password))
- return hash.Sum(nil)
-}
-
-func computeNtlmV2Response(ntlmV2Hash, serverChallenge, clientChallenge,
- timestamp, targetInfo []byte) []byte {
-
- temp := []byte{1, 1, 0, 0, 0, 0, 0, 0}
- temp = append(temp, timestamp...)
- temp = append(temp, clientChallenge...)
- temp = append(temp, 0, 0, 0, 0)
- temp = append(temp, targetInfo...)
- temp = append(temp, 0, 0, 0, 0)
-
- NTProofStr := hmacMd5(ntlmV2Hash, serverChallenge, temp)
- return append(NTProofStr, temp...)
-}
-
-func computeLmV2Response(ntlmV2Hash, serverChallenge, clientChallenge []byte) []byte {
- return append(hmacMd5(ntlmV2Hash, serverChallenge, clientChallenge), clientChallenge...)
-}
-
-func hmacMd5(key []byte, data ...[]byte) []byte {
- mac := hmac.New(md5.New, key)
- for _, d := range data {
- mac.Write(d)
- }
- return mac.Sum(nil)
-}
diff --git a/vendor/github.com/Azure/go-ntlmssp/unicode.go b/vendor/github.com/Azure/go-ntlmssp/unicode.go
deleted file mode 100644
index 7b4f47163d..0000000000
--- a/vendor/github.com/Azure/go-ntlmssp/unicode.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package ntlmssp
-
-import (
- "bytes"
- "encoding/binary"
- "errors"
- "unicode/utf16"
-)
-
-// helper func's for dealing with Windows Unicode (UTF16LE)
-
-func fromUnicode(d []byte) (string, error) {
- if len(d)%2 > 0 {
- return "", errors.New("Unicode (UTF 16 LE) specified, but uneven data length")
- }
- s := make([]uint16, len(d)/2)
- err := binary.Read(bytes.NewReader(d), binary.LittleEndian, &s)
- if err != nil {
- return "", err
- }
- return string(utf16.Decode(s)), nil
-}
-
-func toUnicode(s string) []byte {
- uints := utf16.Encode([]rune(s))
- b := bytes.Buffer{}
- binary.Write(&b, binary.LittleEndian, &uints)
- return b.Bytes()
-}
diff --git a/vendor/github.com/Azure/go-ntlmssp/varfield.go b/vendor/github.com/Azure/go-ntlmssp/varfield.go
deleted file mode 100644
index 15f9aa113d..0000000000
--- a/vendor/github.com/Azure/go-ntlmssp/varfield.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package ntlmssp
-
-import (
- "errors"
-)
-
-type varField struct {
- Len uint16
- MaxLen uint16
- BufferOffset uint32
-}
-
-func (f varField) ReadFrom(buffer []byte) ([]byte, error) {
- if len(buffer) < int(f.BufferOffset+uint32(f.Len)) {
- return nil, errors.New("Error reading data, varField extends beyond buffer")
- }
- return buffer[f.BufferOffset : f.BufferOffset+uint32(f.Len)], nil
-}
-
-func (f varField) ReadStringFrom(buffer []byte, unicode bool) (string, error) {
- d, err := f.ReadFrom(buffer)
- if err != nil {
- return "", err
- }
- if unicode { // UTF-16LE encoding scheme
- return fromUnicode(d)
- }
- // OEM encoding, close enough to ASCII, since no code page is specified
- return string(d), err
-}
-
-func newVarField(ptr *int, fieldsize int) varField {
- f := varField{
- Len: uint16(fieldsize),
- MaxLen: uint16(fieldsize),
- BufferOffset: uint32(*ptr),
- }
- *ptr += fieldsize
- return f
-}
diff --git a/vendor/github.com/Azure/go-ntlmssp/version.go b/vendor/github.com/Azure/go-ntlmssp/version.go
deleted file mode 100644
index 6d84892124..0000000000
--- a/vendor/github.com/Azure/go-ntlmssp/version.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package ntlmssp
-
-// Version is a struct representing https://msdn.microsoft.com/en-us/library/cc236654.aspx
-type Version struct {
- ProductMajorVersion uint8
- ProductMinorVersion uint8
- ProductBuild uint16
- _ [3]byte
- NTLMRevisionCurrent uint8
-}
-
-// DefaultVersion returns a Version with "sensible" defaults (Windows 7)
-func DefaultVersion() Version {
- return Version{
- ProductMajorVersion: 6,
- ProductMinorVersion: 1,
- ProductBuild: 7601,
- NTLMRevisionCurrent: 15,
- }
-}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/api/base/v1/base.go b/vendor/github.com/actiontech/dms/pkg/dms-common/api/base/v1/base.go
new file mode 100644
index 0000000000..5ac09000f1
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/api/base/v1/base.go
@@ -0,0 +1,23 @@
+package v1
+
+// GenericResp defines the return code and msg
+// swagger:response GenericResp
+type GenericResp struct {
+ // code
+ Code int `json:"code"`
+ // message
+ Message string `json:"message"`
+}
+
+func (r *GenericResp) SetCode(code int) {
+ r.Code = code
+}
+
+func (r *GenericResp) SetMsg(msg string) {
+ r.Message = msg
+}
+
+type GenericResper interface {
+ SetCode(code int)
+ SetMsg(msg string)
+}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/db_service.go b/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/db_service.go
new file mode 100644
index 0000000000..743feaf9bd
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/db_service.go
@@ -0,0 +1,161 @@
+package v1
+
+import (
+ base "github.com/actiontech/dms/pkg/dms-common/api/base/v1"
+)
+
+type CheckDbConnectable struct {
+ // DB Service type
+ // Required: true
+ // example: MySQL
+ DBType string `json:"db_type" example:"mysql" validate:"required"`
+ // DB Service admin user
+ // Required: true
+ // example: root
+ User string `json:"user" example:"root" valid:"required"`
+ // DB Service host
+ // Required: true
+ // example: 127.0.0.1
+ Host string `json:"host" example:"10.10.10.10" valid:"required,ip_addr|uri|hostname|hostname_rfc1123"`
+ // DB Service port
+ // Required: true
+ // example: 3306
+ Port string `json:"port" example:"3306" valid:"required,port"`
+ // DB Service admin password
+ // Required: true
+ // example: 123456
+ Password string `json:"password" example:"123456"`
+ // DB Service Custom connection parameters
+ // Required: false
+ AdditionalParams []*AdditionalParam `json:"additional_params" from:"additional_params"`
+}
+
+type AdditionalParam struct {
+ Name string `json:"name"`
+ Value string `json:"value"`
+ Description string `json:"description" example:"参数项中文名" form:"description"`
+ Type string `json:"type" example:"int" form:"type"`
+}
+
+// swagger:parameters ListDBServices
+type ListDBServiceReq struct {
+ // the maximum count of db service to be returned
+ // in:query
+ // Required: true
+ PageSize uint32 `query:"page_size" json:"page_size" validate:"required"`
+ // the offset of users to be returned, default is 0
+ // in:query
+ PageIndex uint32 `query:"page_index" json:"page_index"`
+ // Multiple of ["name"], default is ["name"]
+ // in:query
+ OrderBy DBServiceOrderByField `query:"order_by" json:"order_by"`
+ // the db service business name
+ // in:query
+ FilterByBusiness string `query:"filter_by_business" json:"filter_by_business"`
+ // the db service host
+ // in:query
+ FilterByHost string `query:"filter_by_host" json:"filter_by_host"`
+ // the db service uid
+ // in:query
+ FilterByUID string `query:"filter_by_uid" json:"filter_by_uid"`
+ // the db service name
+ // in:query
+ FilterByName string `query:"filter_by_name" json:"filter_by_name"`
+ // the db service port
+ // in:query
+ FilterByPort string `query:"filter_by_port" json:"filter_by_port"`
+ // the db service db type
+ // in:query
+ FilterByDBType string `query:"filter_by_db_type" json:"filter_by_db_type"`
+ // project id
+ // in:path
+ ProjectUid string `param:"project_uid" json:"project_uid"`
+ // the db service fuzzy keyword,include host/port
+ // in:query
+ FuzzyKeyword string `query:"fuzzy_keyword" json:"fuzzy_keyword"`
+}
+
+// swagger:enum DBServiceOrderByField
+type DBServiceOrderByField string
+
+const (
+ DBServiceOrderByName DBServiceOrderByField = "name"
+)
+
+type MaintenanceTime struct {
+ MaintenanceStartTime *Time `json:"maintenance_start_time"`
+ MaintenanceStopTime *Time `json:"maintenance_stop_time"`
+}
+
+type Time struct {
+ Hour int `json:"hour"`
+ Minute int `json:"minute"`
+}
+
+// A dms db Service
+type ListDBService struct {
+ // db service uid
+ DBServiceUid string `json:"uid"`
+ // db service name
+ Name string `json:"name"`
+ // db service DB type
+ DBType string `json:"db_type"`
+ // db service host
+ Host string `json:"host"`
+ // db service port
+ Port string `json:"port"`
+ // db service admin user
+ User string `json:"user"`
+ // db service admin encrypted password
+ Password string `json:"password"`
+ // the db service business name
+ Business string `json:"business"`
+ // DB Service maintenance time
+ MaintenanceTimes []*MaintenanceTime `json:"maintenance_times"`
+ // DB desc
+ Desc string `json:"desc"`
+ // DB source
+ Source string `json:"source"`
+ // DB project uid
+ ProjectUID string `json:"project_uid"`
+ // sqle config
+ SQLEConfig *SQLEConfig `json:"sqle_config"`
+ // DB Service Custom connection parameters
+ AdditionalParams []*AdditionalParam `json:"additional_params"`
+}
+
+type SQLEConfig struct {
+ // DB Service rule template name
+ RuleTemplateName string `json:"rule_template_name"`
+ // DB Service rule template id
+ RuleTemplateID string `json:"rule_template_id"`
+ // DB Service SQL query config
+ SQLQueryConfig *SQLQueryConfig `json:"sql_query_config"`
+}
+
+// swagger:enum SQLAllowQueryAuditLevel
+type SQLAllowQueryAuditLevel string
+
+const (
+ AuditLevelNormal SQLAllowQueryAuditLevel = "normal"
+ AuditLevelNotice SQLAllowQueryAuditLevel = "notice"
+ AuditLevelWarn SQLAllowQueryAuditLevel = "warn"
+ AuditLevelError SQLAllowQueryAuditLevel = "error"
+)
+
+type SQLQueryConfig struct {
+ MaxPreQueryRows int `json:"max_pre_query_rows" example:"100"`
+ QueryTimeoutSecond int `json:"query_timeout_second" example:"10"`
+ AuditEnabled bool `json:"audit_enabled" example:"false"`
+ AllowQueryWhenLessThanAuditLevel SQLAllowQueryAuditLevel `json:"allow_query_when_less_than_audit_level" enums:"normal,notice,warn,error" valid:"omitempty,oneof=normal notice warn error " example:"error"`
+}
+
+// swagger:model ListDBServiceReply
+type ListDBServiceReply struct {
+ // List db service reply
+ Data []*ListDBService `json:"data"`
+ Total int64 `json:"total_nums"`
+
+ // Generic reply
+ base.GenericResp
+}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/member.go b/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/member.go
new file mode 100644
index 0000000000..82bd382d9c
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/member.go
@@ -0,0 +1,45 @@
+package v1
+
+import base "github.com/actiontech/dms/pkg/dms-common/api/base/v1"
+
+// swagger:parameters ListMembersForInternal
+type ListMembersForInternalReq struct {
+ // the maximum count of member to be returned
+ // in:query
+ // Required: true
+ PageSize uint32 `query:"page_size" json:"page_size" validate:"required"`
+ // the offset of members to be returned, default is 0
+ // in:query
+ PageIndex uint32 `query:"page_index" json:"page_index"`
+ // project id
+ // Required: true
+ // in:path
+ ProjectUid string `param:"project_uid" json:"project_uid" validate:"required"`
+}
+
+// swagger:enum MemberForInternalOrderByField
+type MemberForInternalOrderByField string
+
+const (
+ MemberForInternalOrderByUserUid MemberForInternalOrderByField = "user_uid"
+)
+
+// A dms member for internal
+type ListMembersForInternalItem struct {
+ // member user
+ User UidWithName `json:"user"`
+ // is member project admin, admin has all permissions
+ IsAdmin bool `json:"is_admin"`
+ // member op permissions
+ MemberOpPermissionList []OpPermissionItem `json:"member_op_permission_list"`
+}
+
+// swagger:model ListMembersForInternalReply
+type ListMembersForInternalReply struct {
+ // List member reply
+ Data []*ListMembersForInternalItem `json:"data"`
+ Total int64 `json:"total_nums"`
+
+ // Generic reply
+ base.GenericResp
+}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/notify.go b/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/notify.go
new file mode 100644
index 0000000000..3b3e6cd98a
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/notify.go
@@ -0,0 +1,22 @@
+package v1
+
+import base "github.com/actiontech/dms/pkg/dms-common/api/base/v1"
+
+// swagger:parameters Notification
+type NotificationReq struct {
+ // notification
+ // in:body
+ Notification *Notification `json:"notification" validate:"required"`
+}
+
+type Notification struct {
+ NotificationSubject string `json:"notification_subject"`
+ NotificationBody string `json:"notification_body"`
+ UserUids []string `json:"user_uids"`
+}
+
+// swagger:model NotificationReply
+type NotificationReply struct {
+ // Generic reply
+ base.GenericResp
+}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/plugin.go b/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/plugin.go
new file mode 100644
index 0000000000..0863638b31
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/plugin.go
@@ -0,0 +1,195 @@
+package v1
+
+import (
+ "fmt"
+
+ base "github.com/actiontech/dms/pkg/dms-common/api/base/v1"
+)
+
+// swagger:enum IPluginDBType
+type IPluginDBType string
+
+const (
+ IPluginDBTypeDBTypeMySQL IPluginDBType = "MySQL"
+ IPluginDBTypeDBTypeOceanBaseMySQL IPluginDBType = "OceanBaseMySQL"
+)
+
+func ParseIPluginDBType(s string) (IPluginDBType, error) {
+ switch s {
+ case string(IPluginDBTypeDBTypeMySQL):
+ return IPluginDBTypeDBTypeMySQL, nil
+ case string(IPluginDBTypeDBTypeOceanBaseMySQL):
+ return IPluginDBTypeDBTypeOceanBaseMySQL, nil
+ default:
+ return "", fmt.Errorf("invalid db type: %s", s)
+ }
+}
+
+type IPluginDBService struct {
+ Name string
+ DBType string
+ Host string
+ Port string
+ User string
+ Business string
+ SQLERuleTemplateName string
+ SQLERuleTemplateId string
+ // TODO: more
+}
+
+type Plugin struct {
+ // 插件名称
+ Name string `json:"name" validate:"required"`
+ // 添加数据源预检查接口地址, 如果为空表示没有检查, eg: http://127.0.0.1:7602/v1/auth/services/precheck/add
+ AddDBServicePreCheckUrl string `json:"add_db_service_pre_check_url"`
+ // 删除数据源预检查接口地址, 如果为空表示没有检查, eg: http://127.0.0.1:7602/v1/auth/services/precheck/del
+ DelDBServicePreCheckUrl string `json:"del_db_service_pre_check_url"`
+ // 删除用户预检查接口地址,如果为空表示没有检查, eg: http://127.0.0.1:7602/v1/auth/users/precheck/del
+ DelUserPreCheckUrl string `json:"del_user_pre_check_url"`
+ // 删除用户组预检查接口地址,如果为空表示没有检查, eg: http://127.0.0.1:7602/v1/auth/usergroups/precheck/del
+ DelUserGroupPreCheckUrl string `json:"del_user_group_pre_check_url"`
+ // 操作资源处理接口地址,如果为空表示没有检查, eg: http://127.0.0.1:7602/v1/auth/data_resource_operate/handle
+ OperateDataResourceHandleUrl string `json:"operate_data_resource_handle_url"`
+}
+
+// swagger:parameters RegisterDMSPlugin
+type RegisterDMSPluginReq struct {
+ // Register dms plugin
+ // in:body
+ Plugin *Plugin `json:"plugin" validate:"required"`
+}
+
+func (u *RegisterDMSPluginReq) String() string {
+ if u == nil {
+ return "RegisterDMSPluginReq{nil}"
+ }
+ return fmt.Sprintf("RegisterDMSPluginReq{Name:%s}", u.Plugin.Name)
+}
+
+// swagger:model RegisterDMSPluginReply
+type RegisterDMSPluginReply struct {
+ // Generic reply
+ base.GenericResp
+}
+
+// swagger:parameters AddDBServicePreCheck
+type AddDBServicePreCheckReq struct {
+ // Check if dms can add db service
+ // in:body
+ DBService *IPluginDBService `json:"db_service" validate:"required"`
+}
+
+func (u *AddDBServicePreCheckReq) String() string {
+ if u == nil {
+ return "AddDBServicePreCheckReq{nil}"
+ }
+ return fmt.Sprintf("AddDBServicePreCheckReq{Name:%s,DBType:%s Host:%s}", u.DBService.Name, u.DBService.DBType, u.DBService.Host)
+}
+
+// swagger:model AddDBServicePreCheckReply
+type AddDBServicePreCheckReply struct {
+ // Generic reply
+ base.GenericResp
+}
+
+// swagger:parameters DelDBServicePreCheck
+type DelDBServicePreCheckReq struct {
+ // Check if dms can del db service
+ // in:body
+ DBServiceUid string `json:"db_service_uid" validate:"required"`
+}
+
+func (u *DelDBServicePreCheckReq) String() string {
+ if u == nil {
+ return "DelDBServicePreCheckReq{nil}"
+ }
+ return fmt.Sprintf("DelDBServicePreCheckReq{Uid:%s}", u.DBServiceUid)
+}
+
+// swagger:model DelDBServicePreCheckReply
+type DelDBServicePreCheckReply struct {
+ // Generic reply
+ base.GenericResp
+}
+
+// swagger:parameters DelUserPreCheck
+type DelUserPreCheckReq struct {
+ // Check if dms can del db service
+ // in:body
+ UserUid string `json:"user_uid" validate:"required"`
+}
+
+func (u *DelUserPreCheckReq) String() string {
+ if u == nil {
+ return "DelUserPreCheckReq{nil}"
+ }
+ return fmt.Sprintf("DelUserPreCheckReq{Uid:%s}", u.UserUid)
+}
+
+// swagger:model DelUserPreCheckReply
+type DelUserPreCheckReply struct {
+ // Generic reply
+ base.GenericResp
+}
+
+// swagger:parameters DelUserGroupPreCheck
+type DelUserGroupPreCheckReq struct {
+ // Check if dms can del db service
+ // in:body
+ UserGroupUid string `json:"user_group_uid" validate:"required"`
+}
+
+func (u *DelUserGroupPreCheckReq) String() string {
+ if u == nil {
+ return "DelUserGroupPreCheckReq{nil}"
+ }
+ return fmt.Sprintf("DelUserGroupPreCheckReq{Uid:%s}", u.UserGroupUid)
+}
+
+// swagger:model DelUserGroupPreCheckReply
+type DelUserGroupPreCheckReply struct {
+ // Generic reply
+ base.GenericResp
+}
+
+// swagger:enum DataResourceType
+type DataResourceType string
+
+const (
+ DataResourceTypeDBService DataResourceType = "db_service"
+ DataResourceTypeProject DataResourceType = "project"
+ DataResourceTypeUser DataResourceType = "user"
+ DataResourceTypeUserGroup DataResourceType = "user_group"
+)
+
+// swagger:enum OperationType
+type OperationType string
+
+const (
+ OperationTypeCreate OperationType = "create"
+ OperationTypeUpdate OperationType = "update"
+ OperationTypeDelete OperationType = "delete"
+)
+
+// swagger:enum OperationTimingType
+type OperationTimingType string
+
+const (
+ OperationTimingTypeBefore OperationTimingType = "before"
+ OperationTimingAfter OperationTimingType = "after"
+)
+
+// swagger:parameters OperateDataResourceHandle
+type OperateDataResourceHandleReq struct {
+ DataResourceUid string `json:"data_resource_uid"`
+ DataResourceType DataResourceType `json:"data_resource_type"`
+ OperationType OperationType `json:"operation_type"`
+ OperationTiming OperationTimingType `json:"operation_timing"`
+ // TODO ExtraParams need extra params for pre check?
+}
+
+// swagger:model OperateDataResourceHandleReply
+type OperateDataResourceHandleReply struct {
+ // Generic reply
+ base.GenericResp
+}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/project.go b/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/project.go
new file mode 100644
index 0000000000..50bc89baf2
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/project.go
@@ -0,0 +1,58 @@
+package v1
+
+import (
+ base "github.com/actiontech/dms/pkg/dms-common/api/base/v1"
+
+ "github.com/go-openapi/strfmt"
+)
+
+// swagger:parameters ListProjects
+type ListProjectReq struct {
+ // the maximum count of Project to be returned
+ // in:query
+ // Required: true
+ PageSize uint32 `query:"page_size" json:"page_size" validate:"required"`
+ // the offset of Projects to be returned, default is 0
+ // in:query
+ PageIndex uint32 `query:"page_index" json:"page_index"`
+ // Multiple of ["name"], default is ["name"]
+ // in:query
+ OrderBy ProjectOrderByField `query:"order_by" json:"order_by"`
+ // filter the Project name
+ FilterByName string `query:"filter_by_name" json:"filter_by_name"`
+ // filter the Project UID
+ FilterByUID string `query:"filter_by_uid" json:"filter_by_uid"`
+}
+
+// swagger:enum ProjectOrderByField
+type ProjectOrderByField string
+
+const (
+ ProjectOrderByName ProjectOrderByField = "name"
+)
+
+// A dms Project
+type ListProject struct {
+ // Project uid
+ ProjectUid string `json:"uid"`
+ // Project name
+ Name string `json:"name"`
+ // Project is archived
+ Archived bool `json:"archived"`
+ // Project desc
+ Desc string `json:"desc"`
+ // create user
+ CreateUser UidWithName `json:"create_user"`
+ // create time
+ CreateTime strfmt.DateTime `json:"create_time"`
+}
+
+// swagger:model ListProjectReply
+type ListProjectReply struct {
+ // List project reply
+ Data []*ListProject `json:"data"`
+ Total int64 `json:"total_nums"`
+
+ // Generic reply
+ base.GenericResp
+}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/proxy.go b/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/proxy.go
new file mode 100644
index 0000000000..c43eac183c
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/proxy.go
@@ -0,0 +1,32 @@
+package v1
+
+import base "github.com/actiontech/dms/pkg/dms-common/api/base/v1"
+
+// swagger:parameters RegisterDMSProxyTarget
+type RegisterDMSProxyTargetReq struct {
+ // register dms proxy
+ // in:body
+ DMSProxyTarget *DMSProxyTarget `json:"dms_proxy_target" validate:"required"`
+}
+
+// A dms proxy target
+type DMSProxyTarget struct {
+ // target name
+ // Required: true
+ Name string `json:"name" validate:"required"`
+ // target addr, eg: http://10.1.2.1:5432
+ // Required: true
+ Addr string `json:"addr" validate:"required,url"`
+ // version number
+ // Required: true
+ Version string `json:"version" validate:"required"`
+ // url prefix that need to be proxy, eg: /v1/user
+ // Required: true
+ ProxyUrlPrefixs []string `json:"proxy_url_prefixs" validate:"required"`
+}
+
+// swagger:model RegisterDMSProxyTargetReply
+type RegisterDMSProxyTargetReply struct {
+ // Generic reply
+ base.GenericResp
+}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/router.go b/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/router.go
new file mode 100644
index 0000000000..4dcfa8fe17
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/router.go
@@ -0,0 +1,87 @@
+package v1
+
+import (
+ "fmt"
+ "strings"
+)
+
+// login config
+var (
+ JwtSigningKey = []byte("secret")
+)
+
+// router
+var (
+ SessionRouterGroup = "/dms/sessions"
+ UserRouterGroup = "/dms/users"
+ DBServiceRouterGroup = "/dms/projects/:project_uid/db_services"
+ ProxyRouterGroup = "/dms/proxys"
+ PluginRouterGroup = "/dms/plugins"
+ MemberRouterGroup = "/dms/projects/:project_uid/members"
+ ProjectRouterGroup = "/dms/projects"
+ NotificationRouterGroup = "/dms/notifications"
+ WebHookRouterGroup = "/dms/webhooks"
+ MemberForInternalRouterSuffix = "/internal"
+ InternalDBServiceRouterGroup = "/internal/db_services"
+)
+
+// api group
+var (
+ GroupV1 = "/v1"
+ CurrentGroupVersion = GroupV1
+)
+
+func ResetJWTSigningKey(val string) {
+ if val != "" {
+ JwtSigningKey = []byte(val)
+ }
+}
+
+func GetUserOpPermissionRouter(userUid string) string {
+ return fmt.Sprintf("%s%s/%s/op_permission", CurrentGroupVersion, UserRouterGroup, userUid)
+}
+
+func GetUserOpPermissionRouterWithoutPrefix(userUid string) string {
+ router := GetUserOpPermissionRouter(userUid)
+ return strings.TrimPrefix(strings.TrimPrefix(router, CurrentGroupVersion), UserRouterGroup)
+}
+
+func GetDBServiceRouter(projectUid string) string {
+ return fmt.Sprintf("%s%s", CurrentGroupVersion, strings.Replace(DBServiceRouterGroup, ":project_uid", projectUid, 1))
+}
+
+func GetUserRouter(userUid string) string {
+ return fmt.Sprintf("%s%s/%s", CurrentGroupVersion, UserRouterGroup, userUid)
+}
+
+func GetUsersRouter() string {
+ return fmt.Sprintf("%s%s", CurrentGroupVersion, UserRouterGroup)
+}
+
+func GetListMembersForInternalRouter(projectUid string) string {
+ return fmt.Sprintf("%s%s%s", CurrentGroupVersion, strings.Replace(MemberRouterGroup, ":project_uid", projectUid, 1), MemberForInternalRouterSuffix)
+}
+
+func GetProxyRouter() string {
+ return fmt.Sprintf("%s%s", CurrentGroupVersion, ProxyRouterGroup)
+}
+
+func GetPluginRouter() string {
+ return fmt.Sprintf("%s%s", CurrentGroupVersion, PluginRouterGroup)
+}
+
+func GetProjectsRouter() string {
+ return fmt.Sprintf("%s%s", CurrentGroupVersion, ProjectRouterGroup)
+}
+
+func GetNotificationRouter() string {
+ return fmt.Sprintf("%s%s", CurrentGroupVersion, NotificationRouterGroup)
+}
+
+func GetWebHooksRouter() string {
+ return fmt.Sprintf("%s%s", CurrentGroupVersion, WebHookRouterGroup)
+}
+
+func GetDBConnectionAbleRouter() string {
+ return fmt.Sprintf("%s%s/connection", CurrentGroupVersion, InternalDBServiceRouterGroup)
+}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/user.go b/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/user.go
new file mode 100644
index 0000000000..4ce3ac378c
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/user.go
@@ -0,0 +1,289 @@
+package v1
+
+import (
+ "fmt"
+
+ base "github.com/actiontech/dms/pkg/dms-common/api/base/v1"
+)
+
+// swagger:parameters GetUser
+type GetUserReq struct {
+ // user uid
+ // in:path
+ UserUid string `param:"user_uid" json:"user_uid" validate:"required"`
+}
+
+// A dms user
+type GetUser struct {
+ // user uid
+ UserUid string `json:"uid"`
+ // user name
+ Name string `json:"name"`
+ // user email
+ Email string `json:"email"`
+ // user phone
+ Phone string `json:"phone"`
+ // user wxid
+ WxID string `json:"wxid"`
+ // user stat
+ Stat Stat `json:"stat"`
+ // user authentication type
+ AuthenticationType UserAuthenticationType `json:"authentication_type"`
+ // user groups
+ UserGroups []UidWithName `json:"user_groups"`
+ // user operation permissions
+ OpPermissions []UidWithName `json:"op_permissions"`
+ // is admin
+ IsAdmin bool `json:"is_admin"`
+ // user bind name space
+ UserBindProjects []UserBindProject `json:"user_bind_projects"`
+}
+
+type UserBindProject struct {
+ ProjectID string `json:"project_id"`
+ ProjectName string `json:"project_name"`
+ IsManager bool `json:"is_manager"`
+}
+
+// swagger:enum Stat
+type Stat string
+
+const (
+ StatOK Stat = "正常"
+ StatDisable Stat = "被禁用"
+ StatUnknown Stat = "未知"
+)
+
+type UidWithName struct {
+ Uid string `json:"uid"`
+ Name string `json:"name"`
+}
+
+// swagger:enum UserAuthenticationType
+type UserAuthenticationType string
+
+const (
+ UserAuthenticationTypeLDAP UserAuthenticationType = "ldap" // user verify through ldap
+ UserAuthenticationTypeDMS UserAuthenticationType = "dms" // user verify through dms
+ UserAuthenticationTypeOAUTH2 UserAuthenticationType = "oauth2" // user verify through oauth2
+ UserAuthenticationTypeUnknown UserAuthenticationType = "unknown"
+)
+
+// swagger:model GetUserReply
+type GetUserReply struct {
+ // Get user reply
+ Data *GetUser `json:"data"`
+
+ // Generic reply
+ base.GenericResp
+}
+
+// swagger:parameters GetUserOpPermission
+type GetUserOpPermissionReq struct {
+ // user uid
+ // in:path
+ UserUid string `param:"user_uid" json:"user_uid" validate:"required"`
+ // user op permission info
+ // in:body
+ UserOpPermission *UserOpPermission `json:"user_op_permission" validate:"required"`
+}
+
+type UserOpPermission struct {
+ // uesr project uid
+ ProjectUid string `json:"project_uid" validate:"required"`
+}
+
+// swagger:model GetUserOpPermissionReply
+type GetUserOpPermissionReply struct {
+ // user op permission reply
+ // is user admin, admin has all permissions
+ Data struct {
+ IsAdmin bool `json:"is_admin"`
+ // user op permissions
+ OpPermissionList []OpPermissionItem `json:"op_permission_list"`
+ } `json:"data"`
+ // Generic reply
+ base.GenericResp
+}
+
+type OpPermissionItem struct {
+ // object uids, object type is defined by RangeType
+ RangeUids []string `json:"range_uids"`
+ // object type of RangeUids
+ RangeType OpRangeType `json:"range_type"`
+ // op permission type
+ OpPermissionType OpPermissionType `json:"op_permission_type"`
+}
+
+// swagger:enum OpRangeType
+type OpRangeType string
+
+const (
+ OpRangeTypeUnknown OpRangeType = "unknown"
+ // 全局权限: 该权限只能被用户使用
+ OpRangeTypeGlobal OpRangeType = "global"
+ // 项目权限: 该权限只能被成员使用
+ OpRangeTypeProject OpRangeType = "project"
+ // 项目内的数据源权限: 该权限只能被成员使用
+ OpRangeTypeDBService OpRangeType = "db_service"
+)
+
+func ParseOpRangeType(typ string) (OpRangeType, error) {
+ switch typ {
+ case string(OpRangeTypeDBService):
+ return OpRangeTypeDBService, nil
+ case string(OpRangeTypeProject):
+ return OpRangeTypeProject, nil
+ case string(OpRangeTypeGlobal):
+ return OpRangeTypeGlobal, nil
+ default:
+ return "", fmt.Errorf("invalid op range type: %s", typ)
+ }
+}
+
+// swagger:enum OpPermissionType
+type OpPermissionType string
+
+const (
+ OpPermissionTypeUnknown OpPermissionType = "unknown"
+ // 创建项目;创建项目的用户自动拥有该项目管理权限
+ OpPermissionTypeCreateProject OpPermissionType = "create_project"
+ // 项目管理;拥有该权限的用户可以管理项目下的所有资源
+ OpPermissionTypeProjectAdmin OpPermissionType = "project_admin"
+ // 创建/编辑工单;拥有该权限的用户可以创建/编辑工单
+ OpPermissionTypeCreateWorkflow OpPermissionType = "create_workflow"
+ // 审核/驳回工单;拥有该权限的用户可以审核/驳回工单
+ OpPermissionTypeAuditWorkflow OpPermissionType = "audit_workflow"
+ // 授权数据源数据权限;拥有该权限的用户可以授权数据源数据权限
+ OpPermissionTypeAuthDBServiceData OpPermissionType = "auth_db_service_data"
+ // 查看其他工单权限
+ OpPermissionTypeViewOthersWorkflow OpPermissionType = "view_others_workflow"
+ // 上线工单;拥有该权限的用户可以上线工单
+ OpPermissionTypeExecuteWorkflow OpPermissionType = "execute_workflow"
+ // 查看其他扫描任务权限
+ OpPermissionTypeViewOtherAuditPlan OpPermissionType = "view_other_audit_plan"
+ // 创建扫描任务权限;拥有该权限的用户可以创建/更新扫描任务
+ OpPermissionTypeSaveAuditPlan OpPermissionType = "save_audit_plan"
+ //SQL查询;SQL查询权限
+ OpPermissionTypeSQLQuery OpPermissionType = "sql_query"
+)
+
+func ParseOpPermissionType(typ string) (OpPermissionType, error) {
+ switch typ {
+ case string(OpPermissionTypeCreateProject):
+ return OpPermissionTypeCreateProject, nil
+ case string(OpPermissionTypeProjectAdmin):
+ return OpPermissionTypeProjectAdmin, nil
+ case string(OpPermissionTypeCreateWorkflow):
+ return OpPermissionTypeCreateWorkflow, nil
+ case string(OpPermissionTypeAuditWorkflow):
+ return OpPermissionTypeAuditWorkflow, nil
+ case string(OpPermissionTypeAuthDBServiceData):
+ return OpPermissionTypeAuthDBServiceData, nil
+ case string(OpPermissionTypeViewOthersWorkflow):
+ return OpPermissionTypeViewOthersWorkflow, nil
+ case string(OpPermissionTypeExecuteWorkflow):
+ return OpPermissionTypeExecuteWorkflow, nil
+ case string(OpPermissionTypeViewOtherAuditPlan):
+ return OpPermissionTypeViewOtherAuditPlan, nil
+ case string(OpPermissionTypeSaveAuditPlan):
+ return OpPermissionTypeSaveAuditPlan, nil
+ case string(OpPermissionTypeSQLQuery):
+ return OpPermissionTypeSQLQuery, nil
+ default:
+ return "", fmt.Errorf("invalid op permission type: %s", typ)
+ }
+}
+
+func GetOperationTypeDesc(opType OpPermissionType) string {
+ switch opType {
+ case OpPermissionTypeUnknown:
+ return "未知操作类型"
+ case OpPermissionTypeCreateProject:
+ return "创建项目"
+ case OpPermissionTypeProjectAdmin:
+ return "项目管理"
+ case OpPermissionTypeCreateWorkflow:
+ return "创建/编辑工单"
+ case OpPermissionTypeAuditWorkflow:
+ return "审核/驳回工单;拥有该权限的用户可以审核/驳回工单"
+ case OpPermissionTypeAuthDBServiceData:
+ return "授权数据源数据权限"
+ case OpPermissionTypeViewOthersWorkflow:
+ return "查看其他工单权限"
+ case OpPermissionTypeExecuteWorkflow:
+ return "上线工单"
+ case OpPermissionTypeViewOtherAuditPlan:
+ return "查看其他扫描任务权限"
+ case OpPermissionTypeSaveAuditPlan:
+ return "创建扫描任务权限"
+ case OpPermissionTypeSQLQuery:
+ return "SQL查询"
+ default:
+ return "不支持的操作类型"
+ }
+}
+
+// swagger:parameters ListUsers
+type ListUserReq struct {
+ // the maximum count of user to be returned
+ // in:query
+ // Required: true
+ PageSize uint32 `query:"page_size" json:"page_size" validate:"required"`
+ // the offset of users to be returned, default is 0
+ // in:query
+ PageIndex uint32 `query:"page_index" json:"page_index"`
+ // Multiple of ["name"], default is ["name"]
+ // in:query
+ OrderBy UserOrderByField `query:"order_by" json:"order_by"`
+ // filter the user name
+ // in:query
+ FilterByName string `query:"filter_by_name" json:"filter_by_name"`
+ // filter the user uids
+ // in:query
+ FilterByUids string `query:"filter_by_uids" json:"filter_by_uids"`
+ // filter deleted user to be return ,default is false
+ // in:query
+ FilterDeletedUser bool `query:"filter_del_user" json:"filter_del_user"`
+}
+
+// swagger:enum UserOrderByField
+type UserOrderByField string
+
+const (
+ UserOrderByName UserOrderByField = "name"
+)
+
+// A dms user
+type ListUser struct {
+ // user uid
+ UserUid string `json:"uid"`
+ // user name
+ Name string `json:"name"`
+ // user email
+ Email string `json:"email"`
+ // user phone
+ Phone string `json:"phone"`
+ // user wxid
+ WxID string `json:"wxid"`
+ // user stat
+ Stat Stat `json:"stat"`
+ // user authentication type
+ AuthenticationType UserAuthenticationType `json:"authentication_type"`
+ // user groups
+ UserGroups []UidWithName `json:"user_groups"`
+ // user operation permissions
+ OpPermissions []UidWithName `json:"op_permissions"`
+ // user is deleted
+ IsDeleted bool `json:"is_deleted"`
+}
+
+// swagger:model ListUserReply
+type ListUserReply struct {
+ // List user reply
+ Data []*ListUser `json:"data"`
+ Total int64 `json:"total_nums"`
+
+ // Generic reply
+ base.GenericResp
+}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/webhooks.go b/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/webhooks.go
new file mode 100644
index 0000000000..ae8ccc2d5b
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/api/dms/v1/webhooks.go
@@ -0,0 +1,27 @@
+package v1
+
+import base "github.com/actiontech/dms/pkg/dms-common/api/base/v1"
+
+type TriggerEventType string
+
+const (
+ TriggerEventTypeWorkflow TriggerEventType = "workflow"
+)
+
+// swagger:parameters WebHookSendMessage
+type WebHookSendMessageReq struct {
+ // webhooks
+ // in:body
+ WebHookMessage *WebHooksMessage `json:"webhook_message" validate:"required"`
+}
+
+type WebHooksMessage struct {
+ Message string `json:"message"`
+ TriggerEventType TriggerEventType `json:"trigger_event_type"`
+}
+
+// swagger:model WebHookSendMessageReply
+type WebHooksSendMessageReply struct {
+ // Generic reply
+ base.GenericResp
+}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/api/jwt/jwt.go b/vendor/github.com/actiontech/dms/pkg/dms-common/api/jwt/jwt.go
new file mode 100644
index 0000000000..a05836d47b
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/api/jwt/jwt.go
@@ -0,0 +1,199 @@
+package jwt
+
+import (
+ "fmt"
+ "strconv"
+ "time"
+
+ dmsCommonV1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+
+ jwtOld "github.com/golang-jwt/jwt"
+ "github.com/golang-jwt/jwt/v4"
+)
+
+type EchoContextGetter interface {
+ // Get retrieves data from the context.
+ Get(key string) interface{}
+}
+
+type CustomClaimFunc func(claims jwt.MapClaims)
+
+const (
+ JWTUserId = "uid"
+ JWTUsername = "name"
+ JWTExpiredTime = "exp"
+ JWTAuditPlanName = "apn"
+)
+
+func GenJwtToken(customClaims ...CustomClaimFunc) (tokenStr string, err error) {
+ var mapClaims = jwt.MapClaims{
+ "iss": "actiontech dms",
+ JWTExpiredTime: jwt.NewNumericDate(time.Now().Add(24 * time.Hour)),
+ }
+
+ for _, claimFunc := range customClaims {
+ claimFunc(mapClaims)
+ }
+ // Create token with claims
+ token := jwt.NewWithClaims(jwt.SigningMethodHS256, mapClaims)
+
+ // Generate encoded token and send it as response.
+ tokenStr, err = token.SignedString(dmsCommonV1.JwtSigningKey)
+ if err != nil {
+ return "", fmt.Errorf("failed to sign the token: %v", err)
+ }
+ return tokenStr, nil
+}
+
+func WithUserId(userId string) CustomClaimFunc {
+ return func(claims jwt.MapClaims) {
+ claims[JWTUserId] = userId
+ }
+}
+
+func WithUserName(name string) CustomClaimFunc {
+ return func(claims jwt.MapClaims) {
+ claims[JWTUsername] = name
+ }
+}
+
+func WithAuditPlanName(name string) CustomClaimFunc {
+ return func(claims jwt.MapClaims) {
+ claims[JWTAuditPlanName] = name
+ }
+}
+
+func WithExpiredTime(duration time.Duration) CustomClaimFunc {
+ return func(claims jwt.MapClaims) {
+ claims[JWTExpiredTime] = jwt.NewNumericDate(time.Now().Add(duration))
+ }
+}
+
+func ParseUidFromJwtTokenStr(tokenStr string) (uid string, err error) {
+ token, err := parseJwtTokenStr(tokenStr)
+ if err != nil {
+ return "", err
+ }
+
+ userId, err := ParseUserUidStrFromToken(token)
+ if err != nil {
+ return "", fmt.Errorf("get user id from token failed, err: %v", err)
+ }
+
+ return userId, nil
+}
+
+func parseJwtTokenStr(tokenStr string) (*jwt.Token, error) {
+ token, err := jwt.Parse(tokenStr, func(token *jwt.Token) (interface{}, error) {
+ if signMethod256, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {
+ return nil, jwt.ErrSignatureInvalid
+ } else if signMethod256 != jwt.SigningMethodHS256 {
+ return nil, jwt.ErrSignatureInvalid
+ }
+
+ return dmsCommonV1.JwtSigningKey, nil
+ })
+
+ if err != nil {
+ return nil, fmt.Errorf("parse token failed: %v", err)
+ }
+
+ return token, nil
+}
+
+// ParseAuditPlanName used by echo middleware which only verify api request to audit plan related.
+func ParseAuditPlanName(tokenStr string) (string, error) {
+ token, err := parseJwtTokenStr(tokenStr)
+ if err != nil {
+ return "", err
+ }
+
+ claims, ok := token.Claims.(jwt.MapClaims)
+ if !ok {
+ return "", fmt.Errorf("failed to convert token claims to jwt")
+ }
+
+ auditPlanName, ok := claims[JWTAuditPlanName]
+ if !ok {
+ return "", jwt.NewValidationError("unknown token", jwt.ValidationErrorClaimsInvalid)
+ }
+
+ return fmt.Sprintf("%v", auditPlanName), nil
+}
+
+func GetUserFromContext(c EchoContextGetter) (uid int64, err error) {
+ if c.Get("user") == nil {
+ return 0, fmt.Errorf("user not found in context")
+ }
+
+ // Gets user token from the context.
+ u, ok := c.Get("user").(*jwt.Token)
+ if !ok {
+ return 0, fmt.Errorf("failed to convert user from jwt token")
+ }
+ return ParseUserFromToken(u)
+}
+
+func GetUserUidStrFromContext(c EchoContextGetter) (uid string, err error) {
+ if c.Get("user") == nil {
+ return "", fmt.Errorf("user not found in context")
+ }
+
+ // Gets user token from the context.
+ u, ok := c.Get("user").(*jwt.Token)
+ if !ok {
+ return "", fmt.Errorf("failed to convert user from jwt token")
+ }
+ return ParseUserUidStrFromToken(u)
+}
+
+// 由于sqle的go版本为1.16,无法使用github.com/golang-jwt/jwt/v4,本方法为sqle兼容
+func GetUserUidStrFromContextWithOldJwt(c EchoContextGetter) (uid string, err error) {
+ if c.Get("user") == nil {
+ return "", fmt.Errorf("user not found in context")
+ }
+
+ // Gets user token from the context.
+ u, ok := c.Get("user").(*jwtOld.Token)
+ if !ok {
+ return "", fmt.Errorf("failed to convert user from jwt token")
+ }
+ return ParseUserUidStrFromTokenWithOldJwt(u)
+}
+
+func ParseUserFromToken(token *jwt.Token) (uid int64, err error) {
+ uidStr, err := ParseUserUidStrFromToken(token)
+ if err != nil {
+ return 0, err
+ }
+ uid, err = strconv.ParseInt(uidStr, 10, 64)
+ if err != nil {
+ return 0, fmt.Errorf("failed to parse user id: %v", err)
+ }
+ return uid, nil
+}
+
+func ParseUserUidStrFromToken(token *jwt.Token) (uid string, err error) {
+ claims, ok := token.Claims.(jwt.MapClaims)
+ if !ok {
+ return "", fmt.Errorf("failed to convert token claims to jwt")
+ }
+
+ uidStr := fmt.Sprintf("%v", claims[JWTUserId])
+ if uidStr == "" {
+ return "", fmt.Errorf("failed to parse user id: empty uid")
+ }
+ return uidStr, nil
+}
+
+func ParseUserUidStrFromTokenWithOldJwt(token *jwtOld.Token) (uid string, err error) {
+ claims, ok := token.Claims.(jwtOld.MapClaims)
+ if !ok {
+ return "", fmt.Errorf("failed to convert token claims to jwt")
+ }
+ uidStr := fmt.Sprintf("%v", claims[JWTUserId])
+ if uidStr == "" {
+ return "", fmt.Errorf("failed to parse user id: empty uid")
+ }
+ return uidStr, nil
+}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/conf/options.go b/vendor/github.com/actiontech/dms/pkg/dms-common/conf/options.go
new file mode 100644
index 0000000000..998f3adc54
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/conf/options.go
@@ -0,0 +1,25 @@
+package conf
+
+import "fmt"
+
+type BaseOptions struct {
+ ID int64 `yaml:"id" validate:"required"`
+ APIServiceOpts *APIServerOpts `yaml:"api"`
+ SecretKey string `yaml:"secret_key"`
+}
+
+type APIServerOpts struct {
+ Addr string `yaml:"addr" validate:"required"`
+ Port int `yaml:"port" validate:"required"`
+ EnableHttps bool `yaml:"enable_https"`
+ CertFilePath string `yaml:"cert_file_path"`
+ KeyFilePath string `yaml:"key_file_path"`
+}
+
+func (o *BaseOptions) GetAPIServer() *APIServerOpts {
+ return o.APIServiceOpts
+}
+
+func (api *APIServerOpts) GetHTTPAddr() string {
+ return fmt.Sprintf("%v:%v", api.Addr, api.Port)
+}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/dmsobject/db_service.go b/vendor/github.com/actiontech/dms/pkg/dms-common/dmsobject/db_service.go
new file mode 100644
index 0000000000..e28207a76e
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/dmsobject/db_service.go
@@ -0,0 +1,29 @@
+package dmsobject
+
+import (
+ "context"
+ "fmt"
+
+ dmsV1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+ pkgHttp "github.com/actiontech/dms/pkg/dms-common/pkg/http"
+)
+
+func ListDbServices(ctx context.Context, dmsAddr string, req dmsV1.ListDBServiceReq) ([]*dmsV1.ListDBService, int64, error) {
+ header := map[string]string{
+ "Authorization": pkgHttp.DefaultDMSToken,
+ }
+
+ placeholder := "%s%s?page_size=%d&page_index=%d&order_by=%v&filter_by_business=%s&filter_by_host=%s&filter_by_uid=%s&filter_by_port=%s&filter_by_db_type=%s&filter_by_name=%s"
+ url := fmt.Sprintf(placeholder, dmsAddr, dmsV1.GetDBServiceRouter(req.ProjectUid), req.PageSize, req.PageIndex, req.OrderBy, req.FilterByBusiness, req.FilterByHost, req.FilterByUID, req.FilterByPort, req.FilterByDBType, req.FilterByName)
+
+ reply := &dmsV1.ListDBServiceReply{}
+
+ if err := pkgHttp.Get(ctx, url, header, nil, reply); err != nil {
+ return nil, 0, err
+ }
+ if reply.Code != 0 {
+ return nil, 0, fmt.Errorf("http reply code(%v) error: %v", reply.Code, reply.Message)
+ }
+
+ return reply.Data, reply.Total, nil
+}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/dmsobject/notify.go b/vendor/github.com/actiontech/dms/pkg/dms-common/dmsobject/notify.go
new file mode 100644
index 0000000000..9dbe2e9b3c
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/dmsobject/notify.go
@@ -0,0 +1,27 @@
+package dmsobject
+
+import (
+ "context"
+ "fmt"
+
+ dmsV1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+ pkgHttp "github.com/actiontech/dms/pkg/dms-common/pkg/http"
+)
+
+func Notify(ctx context.Context, dmsAddr string, req dmsV1.NotificationReq) (err error) {
+ header := map[string]string{
+ "Authorization": pkgHttp.DefaultDMSToken,
+ }
+
+ reply := &dmsV1.NotificationReply{}
+ url := fmt.Sprintf("%v%v", dmsAddr, dmsV1.GetNotificationRouter())
+
+ if err := pkgHttp.POST(ctx, url, header, req, reply); err != nil {
+ return fmt.Errorf("failed to notify by %v: %v", url, err)
+ }
+ if reply.Code != 0 {
+ return fmt.Errorf("http reply code(%v) error: %v", reply.Code, reply.Message)
+ }
+
+ return nil
+}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/dmsobject/plugin.go b/vendor/github.com/actiontech/dms/pkg/dms-common/dmsobject/plugin.go
new file mode 100644
index 0000000000..e1a179ee29
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/dmsobject/plugin.go
@@ -0,0 +1,39 @@
+package dmsobject
+
+import (
+ "context"
+ "reflect"
+
+ "github.com/iancoleman/strcase"
+)
+
+var operateHandlers map[string]OperationHandler = make(map[string]OperationHandler)
+
+// OperationHandler NOTE:
+// The implemented structure must be named[CamelCase] by the combination of DataResourceType, OperationType, and OperationTimingType
+type OperationHandler interface {
+ Handle(ctx context.Context, currentUserId string, objId string) error
+}
+
+type DefaultOperateHandle struct {
+}
+
+func (f DefaultOperateHandle) Handle(ctx context.Context, currentUserId string, objId string) error {
+ return nil
+}
+
+func InitOperateHandlers(operationHandlers []OperationHandler) {
+ for _, v := range operationHandlers {
+ structName := strcase.ToSnake(reflect.TypeOf(v).Name())
+ operateHandlers[structName] = v
+ }
+}
+
+func GetOperateHandle(name string) OperationHandler {
+ handle, ok := operateHandlers[name]
+ if ok {
+ return handle
+ }
+
+ return DefaultOperateHandle{}
+}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/dmsobject/project.go b/vendor/github.com/actiontech/dms/pkg/dms-common/dmsobject/project.go
new file mode 100644
index 0000000000..2e7d4e8b11
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/dmsobject/project.go
@@ -0,0 +1,28 @@
+package dmsobject
+
+import (
+ "context"
+ "fmt"
+
+ dmsV1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+ pkgHttp "github.com/actiontech/dms/pkg/dms-common/pkg/http"
+)
+
+func ListProjects(ctx context.Context, dmsAddr string, req dmsV1.ListProjectReq) (ret []*dmsV1.ListProject, total int64, err error) {
+ header := map[string]string{
+ "Authorization": pkgHttp.DefaultDMSToken,
+ }
+
+ reply := &dmsV1.ListProjectReply{}
+
+ url := fmt.Sprintf("%v%v?page_size=%v&page_index=%v&filter_by_name=%v&filter_by_uid=%v", dmsAddr, dmsV1.GetProjectsRouter(), req.PageSize, req.PageIndex, req.FilterByName, req.FilterByUID)
+
+ if err := pkgHttp.Get(ctx, url, header, nil, reply); err != nil {
+ return nil, 0, fmt.Errorf("failed to list project from %v: %v", url, err)
+ }
+ if reply.Code != 0 {
+ return nil, 0, fmt.Errorf("http reply code(%v) error: %v", reply.Code, reply.Message)
+ }
+
+ return reply.Data, reply.Total, nil
+}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/dmsobject/user.go b/vendor/github.com/actiontech/dms/pkg/dms-common/dmsobject/user.go
new file mode 100644
index 0000000000..8325ac1370
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/dmsobject/user.go
@@ -0,0 +1,93 @@
+package dmsobject
+
+import (
+ "context"
+ "fmt"
+
+ dmsV1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+ pkgHttp "github.com/actiontech/dms/pkg/dms-common/pkg/http"
+)
+
+func GetUser(ctx context.Context, userUid string, dmsAddr string) (*dmsV1.GetUser, error) {
+ header := map[string]string{
+ "Authorization": pkgHttp.DefaultDMSToken,
+ }
+
+ reply := &dmsV1.GetUserReply{}
+
+ url := fmt.Sprintf("%v%v", dmsAddr, dmsV1.GetUserRouter(userUid))
+
+ if err := pkgHttp.Get(ctx, url, header, nil, reply); err != nil {
+ return nil, fmt.Errorf("failed to get user from %v: %v", url, err)
+ }
+ if reply.Code != 0 {
+ return nil, fmt.Errorf("http reply code(%v) error: %v", reply.Code, reply.Message)
+ }
+
+ return reply.Data, nil
+}
+
+func GetUserOpPermission(ctx context.Context, projectUid, userUid, dmsAddr string) (ret []dmsV1.OpPermissionItem, isAdmin bool, err error) {
+ header := map[string]string{
+ "Authorization": pkgHttp.DefaultDMSToken,
+ }
+
+ reqBody := struct {
+ UserOpPermission *dmsV1.UserOpPermission `json:"user_op_permission"`
+ }{
+ UserOpPermission: &dmsV1.UserOpPermission{ProjectUid: projectUid},
+ }
+
+ reply := &dmsV1.GetUserOpPermissionReply{}
+
+ url := fmt.Sprintf("%v%v", dmsAddr, dmsV1.GetUserOpPermissionRouter(userUid))
+
+ if err := pkgHttp.Get(ctx, url, header, reqBody, reply); err != nil {
+ return nil, false, fmt.Errorf("failed to get user op permission from %v: %v", url, err)
+ }
+ if reply.Code != 0 {
+ return nil, false, fmt.Errorf("http reply code(%v) error: %v", reply.Code, reply.Message)
+ }
+
+ return reply.Data.OpPermissionList, reply.Data.IsAdmin, nil
+
+}
+
+func ListMembersInProject(ctx context.Context, dmsAddr string, req dmsV1.ListMembersForInternalReq) ([]*dmsV1.ListMembersForInternalItem, int64, error) {
+ header := map[string]string{
+ "Authorization": pkgHttp.DefaultDMSToken,
+ }
+
+ reply := &dmsV1.ListMembersForInternalReply{}
+
+ url := fmt.Sprintf("%v%v?page_size=%v&page_index=%v", dmsAddr, dmsV1.GetListMembersForInternalRouter(req.ProjectUid), req.PageSize, req.PageIndex)
+
+ if err := pkgHttp.Get(ctx, url, header, nil, reply); err != nil {
+ return nil, 0, fmt.Errorf("failed to get member from %v: %v", url, err)
+ }
+ if reply.Code != 0 {
+ return nil, 0, fmt.Errorf("http reply code(%v) error: %v", reply.Code, reply.Message)
+ }
+
+ return reply.Data, reply.Total, nil
+}
+
+func ListUsers(ctx context.Context, dmsAddr string, req dmsV1.ListUserReq) (ret []*dmsV1.ListUser, total int64, err error) {
+ header := map[string]string{
+ "Authorization": pkgHttp.DefaultDMSToken,
+ }
+
+ reply := &dmsV1.ListUserReply{}
+
+ url := fmt.Sprintf("%v%v?page_size=%v&page_index=%v&filter_del_user=%v&filter_by_uids=%v", dmsAddr, dmsV1.GetUsersRouter(), req.PageSize, req.PageIndex, req.FilterDeletedUser, req.FilterByUids)
+
+ if err := pkgHttp.Get(ctx, url, header, nil, reply); err != nil {
+ return nil, 0, fmt.Errorf("failed to list users from %v: %v", url, err)
+ }
+ if reply.Code != 0 {
+ return nil, 0, fmt.Errorf("http reply code(%v) error: %v", reply.Code, reply.Message)
+ }
+
+ return reply.Data, reply.Total, nil
+
+}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/dmsobject/webhooks.go b/vendor/github.com/actiontech/dms/pkg/dms-common/dmsobject/webhooks.go
new file mode 100644
index 0000000000..e8631b2bb4
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/dmsobject/webhooks.go
@@ -0,0 +1,27 @@
+package dmsobject
+
+import (
+ "context"
+ "fmt"
+
+ dmsV1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+ pkgHttp "github.com/actiontech/dms/pkg/dms-common/pkg/http"
+)
+
+func WebHookSendMessage(ctx context.Context, dmsAddr string, req *dmsV1.WebHookSendMessageReq) (err error) {
+ header := map[string]string{
+ "Authorization": pkgHttp.DefaultDMSToken,
+ }
+
+ reply := &dmsV1.NotificationReply{}
+ url := fmt.Sprintf("%v%v", dmsAddr, dmsV1.GetWebHooksRouter())
+
+ if err := pkgHttp.POST(ctx, url, header, req, reply); err != nil {
+ return fmt.Errorf("failed to notify by %v: %v", url, err)
+ }
+ if reply.Code != 0 {
+ return fmt.Errorf("http reply code(%v) error: %v", reply.Code, reply.Message)
+ }
+
+ return nil
+}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/pkg/aes/aes.go b/vendor/github.com/actiontech/dms/pkg/dms-common/pkg/aes/aes.go
new file mode 100644
index 0000000000..34ad7e36e7
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/pkg/aes/aes.go
@@ -0,0 +1,154 @@
+package aes
+
+import (
+ "bytes"
+ "crypto/aes"
+ "crypto/cipher"
+ "crypto/md5"
+ "encoding/base64"
+ "encoding/hex"
+ "encoding/json"
+ "fmt"
+ "sync"
+)
+
+var SecretKey = []byte("471F77D078C5994BD06B65B8B5B1935B")
+
+type encryptor struct {
+ SecretKey []byte
+ mutex *sync.RWMutex
+}
+
+var std = &encryptor{
+ SecretKey: SecretKey,
+ mutex: &sync.RWMutex{},
+}
+
+func NewEncryptor(key []byte) *encryptor {
+ return &encryptor{
+ SecretKey: key,
+ mutex: &sync.RWMutex{},
+ }
+}
+
+func ResetAesSecretKey(secret string) error {
+ if secret == "" {
+ return nil
+ }
+
+ return std.SetAesSecretKey([]byte(secret))
+}
+
+func (e *encryptor) SetAesSecretKey(key []byte) (err error) {
+ origKey := e.SecretKey
+ e.SecretKey = key
+ origData := "test"
+ var secretData string
+ defer func() {
+ if err != nil {
+ e.SecretKey = origKey
+ }
+ }()
+ if secretData, err = e.AesEncrypt(origData); err != nil {
+ return
+ }
+ if _, err = e.AesDecrypt(secretData); err != nil {
+ return
+ }
+ return
+}
+
+func (e *encryptor) aesEncrypt(origData []byte) ([]byte, error) {
+ e.mutex.RLock()
+ key := e.SecretKey
+ e.mutex.RUnlock()
+
+ block, err := aes.NewCipher(key)
+ if err != nil {
+ return nil, err
+ }
+ blockSize := block.BlockSize()
+ origData = pKCS7Padding(origData, blockSize)
+ blockMode := cipher.NewCBCEncrypter(block, key[:blockSize])
+ crypted := make([]byte, len(origData))
+ blockMode.CryptBlocks(crypted, origData)
+ return crypted, nil
+}
+
+func (e *encryptor) aesDecrypt(crypted []byte) ([]byte, error) {
+ e.mutex.RLock()
+ key := e.SecretKey
+ e.mutex.RUnlock()
+
+ block, err := aes.NewCipher(key)
+ if err != nil {
+ return nil, err
+ }
+ blockSize := block.BlockSize()
+ blockMode := cipher.NewCBCDecrypter(block, key[:blockSize])
+ origData := make([]byte, len(crypted))
+ blockMode.CryptBlocks(origData, crypted)
+ origData = pKCS7UnPadding(origData)
+ return origData, nil
+}
+
+func (e *encryptor) AesEncrypt(origData string) (string, error) {
+ crypted, err := e.aesEncrypt([]byte(origData))
+ if err != nil {
+ return "", err
+ }
+ return base64.StdEncoding.EncodeToString(crypted), nil
+}
+
+func (e *encryptor) AesDecrypt(encrypted string) (string, error) {
+ encryptedByte, err := base64.StdEncoding.DecodeString(encrypted)
+ if err != nil {
+ return "", err
+ }
+ origByte, err := e.aesDecrypt(encryptedByte)
+ return string(origByte), err
+}
+
+func pKCS7Padding(cipherText []byte, blockSize int) []byte {
+ padding := blockSize - len(cipherText)%blockSize
+ padText := bytes.Repeat([]byte{byte(padding)}, padding)
+ return append(cipherText, padText...)
+}
+
+func pKCS7UnPadding(origData []byte) []byte {
+ length := len(origData)
+ // if origData is empty, get byte by index length -1 will panic before go 11
+ if length <= 0 {
+ return origData
+ }
+ unpadding := int(origData[length-1])
+ return origData[:(length - unpadding)]
+}
+
+func AesEncrypt(origData string) (string, error) {
+ return std.AesEncrypt(origData)
+}
+
+func AesDecrypt(encrypted string) (string, error) {
+ return std.AesDecrypt(encrypted)
+}
+
+type Password string
+
+func (p *Password) MarshalJSON() ([]byte, error) {
+ if *p == "" {
+ return json.Marshal([]byte(*p))
+ }
+ value, err := AesEncrypt(string(*p))
+ if nil != err {
+ return nil, fmt.Errorf("encrypt error: %v", err)
+ }
+ return json.Marshal(value)
+}
+
+func Md5(src string) string {
+ m := md5.New()
+ m.Write([]byte(src))
+ res := hex.EncodeToString(m.Sum(nil))
+ return res
+}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/pkg/http/http.go b/vendor/github.com/actiontech/dms/pkg/dms-common/pkg/http/http.go
new file mode 100644
index 0000000000..380399efdd
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/pkg/http/http.go
@@ -0,0 +1,102 @@
+package http
+
+import (
+ "bytes"
+ "context"
+ "encoding/json"
+ "fmt"
+ "io"
+ "net/http"
+ "time"
+
+ v1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+ "github.com/actiontech/dms/pkg/dms-common/api/jwt"
+)
+
+// sys用户长有效期token,有限期至2073年
+
+var defaultDMSToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjMyNzI0MjEzNTMsImlzcyI6ImFjdGlvbnRlY2ggZG1zIiwidWlkIjoiNzAwMjAxIn0.45o27vHjHWslarkbovAim6oir3QlrvSDDuzfpGTn6Dk"
+var DefaultDMSToken = fmt.Sprintf("Bearer %s", defaultDMSToken)
+
+func ResetJWTSigningKeyAndDefaultToken(val string) error {
+ if val == "" {
+ return nil
+ }
+
+ uid, err := jwt.ParseUidFromJwtTokenStr(defaultDMSToken)
+ if err != nil {
+ return err
+ }
+
+ // reset jwt singing key
+ v1.ResetJWTSigningKey(val)
+
+ // expire time: 50 years later
+ token, err := jwt.GenJwtToken(jwt.WithUserId(uid), jwt.WithExpiredTime(time.Hour*24*365*50))
+ if err != nil {
+ return err
+ }
+
+ // reset default dms token
+ resetDefaultDMSToken(token)
+
+ return nil
+}
+
+func resetDefaultDMSToken(token string) {
+ if token != "" {
+ DefaultDMSToken = fmt.Sprintf("Bearer %s", token)
+ }
+}
+
+func Get(ctx context.Context, url string, headers map[string]string, body, out interface{}) error {
+ return Call(ctx, http.MethodGet, url, headers, body, out)
+}
+
+func POST(ctx context.Context, url string, headers map[string]string, body, out interface{}) error {
+ return Call(ctx, http.MethodPost, url, headers, body, out)
+}
+
+func Call(ctx context.Context, method, url string, headers map[string]string, body, out interface{}) error {
+ var bodyReader io.Reader
+ if body != nil {
+ bodyJson, err := json.Marshal(body)
+ if err != nil {
+ return fmt.Errorf("marshal error: %v", err)
+ }
+ bodyReader = bytes.NewReader(bodyJson)
+ }
+
+ req, err := http.NewRequestWithContext(ctx, method, url, bodyReader)
+ if err != nil {
+ return fmt.Errorf("new request error: %v", err)
+ }
+ for k, v := range headers {
+ req.Header.Add(k, v)
+ }
+ req.Header.Set("Content-Type", "application/json")
+
+ client := http.Client{
+ Timeout: time.Second * 15,
+ }
+ resp, err := client.Do(req)
+ if err != nil {
+ return fmt.Errorf("query data error: %v", err)
+ }
+ defer resp.Body.Close()
+
+ result, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return fmt.Errorf("read data error: %v", err)
+ }
+
+ if resp.StatusCode != 200 {
+ return fmt.Errorf("query data error: %v;%v", resp.Status, string(result))
+ }
+
+ err = json.Unmarshal(result, &out)
+ if err != nil {
+ return fmt.Errorf("unmarshal error: %v", err)
+ }
+ return nil
+}
diff --git a/vendor/github.com/actiontech/dms/pkg/dms-common/register/register.go b/vendor/github.com/actiontech/dms/pkg/dms-common/register/register.go
new file mode 100644
index 0000000000..c84889b0b2
--- /dev/null
+++ b/vendor/github.com/actiontech/dms/pkg/dms-common/register/register.go
@@ -0,0 +1,65 @@
+package register
+
+import (
+ "context"
+ "fmt"
+
+ dmsV1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
+ pkgHttp "github.com/actiontech/dms/pkg/dms-common/pkg/http"
+)
+
+// RegisterDMSProxyTarget 向DMS注册反向代理,将proxyPrefix开头的请求转发到自身服务
+// eg: name = sqle; url = http://10.1.2.1:5432; proxyPrefix = /v1/sqle 表示要求DMS将/v1/sqle开头的请求转发到sqle服务所在地址 http://10.1.2.1:5432
+func RegisterDMSProxyTarget(ctx context.Context, dmsAddr, targetName, targetAddr, version string, proxyUrlPrefixs []string) error {
+ header := map[string]string{
+ "Authorization": pkgHttp.DefaultDMSToken,
+ }
+ reqBody := struct {
+ DMSProxyTarget *dmsV1.DMSProxyTarget `json:"dms_proxy_target"`
+ }{
+ DMSProxyTarget: &dmsV1.DMSProxyTarget{
+ Name: targetName,
+ Addr: targetAddr,
+ Version: version,
+ ProxyUrlPrefixs: proxyUrlPrefixs,
+ },
+ }
+
+ reply := &dmsV1.RegisterDMSProxyTargetReply{}
+
+ dmsUrl := fmt.Sprintf("%s%s", dmsAddr, dmsV1.GetProxyRouter())
+
+ if err := pkgHttp.POST(ctx, dmsUrl, header, reqBody, reply); err != nil {
+ return fmt.Errorf("failed to register dms proxy target %v: %v", dmsUrl, err)
+ }
+ if reply.Code != 0 {
+ return fmt.Errorf("http reply code(%v) error: %v", reply.Code, reply.Message)
+ }
+
+ return nil
+}
+
+// RegisterDMSPlugin 向DMS注册校验插件,DMS会在对应操作时调用插件进行校验。注意:注册的插件接口需要服务自己实现
+func RegisterDMSPlugin(ctx context.Context, dmsAddr string, plugin *dmsV1.Plugin) error {
+ header := map[string]string{
+ "Authorization": pkgHttp.DefaultDMSToken,
+ }
+ reqBody := struct {
+ Plugin *dmsV1.Plugin `json:"plugin"`
+ }{
+ Plugin: plugin,
+ }
+
+ reply := &dmsV1.RegisterDMSPluginReply{}
+
+ dmsUrl := fmt.Sprintf("%s%s", dmsAddr, dmsV1.GetPluginRouter())
+
+ if err := pkgHttp.POST(ctx, dmsUrl, header, reqBody, reply); err != nil {
+ return fmt.Errorf("failed to register dms plugin %v: %v", dmsUrl, err)
+ }
+ if reply.Code != 0 {
+ return fmt.Errorf("http reply code(%v) error: %v", reply.Code, reply.Message)
+ }
+
+ return nil
+}
diff --git a/vendor/github.com/agnivade/levenshtein/.gitignore b/vendor/github.com/agnivade/levenshtein/.gitignore
deleted file mode 100644
index 345780a444..0000000000
--- a/vendor/github.com/agnivade/levenshtein/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-coverage.txt
-fuzz/fuzz-fuzz.zip
-fuzz/corpus/corpus/*
-fuzz/corpus/suppressions/*
-fuzz/corpus/crashes/*
diff --git a/vendor/github.com/agnivade/levenshtein/.travis.yml b/vendor/github.com/agnivade/levenshtein/.travis.yml
deleted file mode 100644
index 0873fa983f..0000000000
--- a/vendor/github.com/agnivade/levenshtein/.travis.yml
+++ /dev/null
@@ -1,23 +0,0 @@
-language: go
-
-# See https://travis-ci.community/t/goos-js-goarch-wasm-go-run-fails-panic-newosproc-not-implemented/1651
-#addons:
-# chrome: stable
-
-before_install:
-- export GO111MODULE=on
-
-#install:
-#- go get github.com/agnivade/wasmbrowsertest
-#- mv $GOPATH/bin/wasmbrowsertest $GOPATH/bin/go_js_wasm_exec
-#- export PATH=$GOPATH/bin:$PATH
-
-go:
-- 1.13.x
-- 1.14.x
-- 1.15.x
-- tip
-
-script:
-#- GOOS=js GOARCH=wasm go test -v
-- go test -v
diff --git a/vendor/github.com/agnivade/levenshtein/License.txt b/vendor/github.com/agnivade/levenshtein/License.txt
deleted file mode 100644
index 54b51f4993..0000000000
--- a/vendor/github.com/agnivade/levenshtein/License.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2015 Agniva De Sarker
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/agnivade/levenshtein/Makefile b/vendor/github.com/agnivade/levenshtein/Makefile
deleted file mode 100644
index 5f6890d613..0000000000
--- a/vendor/github.com/agnivade/levenshtein/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-all: test install
-
-install:
- go install
-
-lint:
- gofmt -l -s -w . && go vet . && golint -set_exit_status=1 .
-
-test: # The first 2 go gets are to support older Go versions
- go get github.com/arbovm/levenshtein
- go get github.com/dgryski/trifles/leven
- GO111MODULE=on go test -race -v -coverprofile=coverage.txt -covermode=atomic
-
-bench:
- go test -run=XXX -bench=. -benchmem -count=5
diff --git a/vendor/github.com/agnivade/levenshtein/README.md b/vendor/github.com/agnivade/levenshtein/README.md
deleted file mode 100644
index 13c52a2101..0000000000
--- a/vendor/github.com/agnivade/levenshtein/README.md
+++ /dev/null
@@ -1,80 +0,0 @@
-levenshtein [](https://travis-ci.org/agnivade/levenshtein) [](https://goreportcard.com/report/github.com/agnivade/levenshtein) [](https://pkg.go.dev/github.com/agnivade/levenshtein)
-===========
-
-[Go](http://golang.org) package to calculate the [Levenshtein Distance](http://en.wikipedia.org/wiki/Levenshtein_distance)
-
-The library is fully capable of working with non-ascii strings. But the strings are not normalized. That is left as a user-dependant use case. Please normalize the strings before passing it to the library if you have such a requirement.
-- https://blog.golang.org/normalization
-
-#### Limitation
-
-As a performance optimization, the library can handle strings only up to 65536 characters (runes). If you need to handle strings larger than that, please pin to version 1.0.3.
-
-Install
--------
-
- go get github.com/agnivade/levenshtein
-
-Example
--------
-
-```go
-package main
-
-import (
- "fmt"
- "github.com/agnivade/levenshtein"
-)
-
-func main() {
- s1 := "kitten"
- s2 := "sitting"
- distance := levenshtein.ComputeDistance(s1, s2)
- fmt.Printf("The distance between %s and %s is %d.\n", s1, s2, distance)
- // Output:
- // The distance between kitten and sitting is 3.
-}
-
-```
-
-Benchmarks
-----------
-
-```
-name time/op
-Simple/ASCII-4 330ns ± 2%
-Simple/French-4 617ns ± 2%
-Simple/Nordic-4 1.16µs ± 4%
-Simple/Tibetan-4 1.05µs ± 1%
-
-name alloc/op
-Simple/ASCII-4 96.0B ± 0%
-Simple/French-4 128B ± 0%
-Simple/Nordic-4 192B ± 0%
-Simple/Tibetan-4 144B ± 0%
-
-name allocs/op
-Simple/ASCII-4 1.00 ± 0%
-Simple/French-4 1.00 ± 0%
-Simple/Nordic-4 1.00 ± 0%
-Simple/Tibetan-4 1.00 ± 0%
-```
-
-Comparisons with other libraries
---------------------------------
-
-```
-name time/op
-Leven/ASCII/agniva-4 353ns ± 1%
-Leven/ASCII/arbovm-4 485ns ± 1%
-Leven/ASCII/dgryski-4 395ns ± 0%
-Leven/French/agniva-4 648ns ± 1%
-Leven/French/arbovm-4 791ns ± 0%
-Leven/French/dgryski-4 682ns ± 0%
-Leven/Nordic/agniva-4 1.28µs ± 1%
-Leven/Nordic/arbovm-4 1.52µs ± 1%
-Leven/Nordic/dgryski-4 1.32µs ± 1%
-Leven/Tibetan/agniva-4 1.12µs ± 1%
-Leven/Tibetan/arbovm-4 1.31µs ± 0%
-Leven/Tibetan/dgryski-4 1.16µs ± 0%
-```
diff --git a/vendor/github.com/agnivade/levenshtein/levenshtein.go b/vendor/github.com/agnivade/levenshtein/levenshtein.go
deleted file mode 100644
index f727a66fe7..0000000000
--- a/vendor/github.com/agnivade/levenshtein/levenshtein.go
+++ /dev/null
@@ -1,89 +0,0 @@
-// Package levenshtein is a Go implementation to calculate Levenshtein Distance.
-//
-// Implementation taken from
-// https://gist.github.com/andrei-m/982927#gistcomment-1931258
-package levenshtein
-
-import "unicode/utf8"
-
-// minLengthThreshold is the length of the string beyond which
-// an allocation will be made. Strings smaller than this will be
-// zero alloc.
-const minLengthThreshold = 32
-
-// ComputeDistance computes the levenshtein distance between the two
-// strings passed as an argument. The return value is the levenshtein distance
-//
-// Works on runes (Unicode code points) but does not normalize
-// the input strings. See https://blog.golang.org/normalization
-// and the golang.org/x/text/unicode/norm package.
-func ComputeDistance(a, b string) int {
- if len(a) == 0 {
- return utf8.RuneCountInString(b)
- }
-
- if len(b) == 0 {
- return utf8.RuneCountInString(a)
- }
-
- if a == b {
- return 0
- }
-
- // We need to convert to []rune if the strings are non-ASCII.
- // This could be avoided by using utf8.RuneCountInString
- // and then doing some juggling with rune indices,
- // but leads to far more bounds checks. It is a reasonable trade-off.
- s1 := []rune(a)
- s2 := []rune(b)
-
- // swap to save some memory O(min(a,b)) instead of O(a)
- if len(s1) > len(s2) {
- s1, s2 = s2, s1
- }
- lenS1 := len(s1)
- lenS2 := len(s2)
-
- // Init the row.
- var x []uint16
- if lenS1+1 > minLengthThreshold {
- x = make([]uint16, lenS1+1)
- } else {
- // We make a small optimization here for small strings.
- // Because a slice of constant length is effectively an array,
- // it does not allocate. So we can re-slice it to the right length
- // as long as it is below a desired threshold.
- x = make([]uint16, minLengthThreshold)
- x = x[:lenS1+1]
- }
-
- // we start from 1 because index 0 is already 0.
- for i := 1; i < len(x); i++ {
- x[i] = uint16(i)
- }
-
- // make a dummy bounds check to prevent the 2 bounds check down below.
- // The one inside the loop is particularly costly.
- _ = x[lenS1]
- // fill in the rest
- for i := 1; i <= lenS2; i++ {
- prev := uint16(i)
- for j := 1; j <= lenS1; j++ {
- current := x[j-1] // match
- if s2[i-1] != s1[j-1] {
- current = min(min(x[j-1]+1, prev+1), x[j]+1)
- }
- x[j-1] = prev
- prev = current
- }
- x[lenS1] = prev
- }
- return int(x[lenS1])
-}
-
-func min(a, b uint16) uint16 {
- if a < b {
- return a
- }
- return b
-}
diff --git a/vendor/github.com/asaskevich/govalidator/.gitignore b/vendor/github.com/asaskevich/govalidator/.gitignore
new file mode 100644
index 0000000000..8d69a9418a
--- /dev/null
+++ b/vendor/github.com/asaskevich/govalidator/.gitignore
@@ -0,0 +1,15 @@
+bin/
+.idea/
+# Binaries for programs and plugins
+*.exe
+*.exe~
+*.dll
+*.so
+*.dylib
+
+# Test binary, built with `go test -c`
+*.test
+
+# Output of the go coverage tool, specifically when used with LiteIDE
+*.out
+
diff --git a/vendor/github.com/asaskevich/govalidator/.travis.yml b/vendor/github.com/asaskevich/govalidator/.travis.yml
new file mode 100644
index 0000000000..bb83c6670d
--- /dev/null
+++ b/vendor/github.com/asaskevich/govalidator/.travis.yml
@@ -0,0 +1,12 @@
+language: go
+dist: xenial
+go:
+ - '1.10'
+ - '1.11'
+ - '1.12'
+ - '1.13'
+ - 'tip'
+
+script:
+ - go test -coverpkg=./... -coverprofile=coverage.info -timeout=5s
+ - bash <(curl -s https://codecov.io/bash)
diff --git a/vendor/github.com/asaskevich/govalidator/CODE_OF_CONDUCT.md b/vendor/github.com/asaskevich/govalidator/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000000..4b462b0d81
--- /dev/null
+++ b/vendor/github.com/asaskevich/govalidator/CODE_OF_CONDUCT.md
@@ -0,0 +1,43 @@
+# Contributor Code of Conduct
+
+This project adheres to [The Code Manifesto](http://codemanifesto.com)
+as its guidelines for contributor interactions.
+
+## The Code Manifesto
+
+We want to work in an ecosystem that empowers developers to reach their
+potential — one that encourages growth and effective collaboration. A space
+that is safe for all.
+
+A space such as this benefits everyone that participates in it. It encourages
+new developers to enter our field. It is through discussion and collaboration
+that we grow, and through growth that we improve.
+
+In the effort to create such a place, we hold to these values:
+
+1. **Discrimination limits us.** This includes discrimination on the basis of
+ race, gender, sexual orientation, gender identity, age, nationality,
+ technology and any other arbitrary exclusion of a group of people.
+2. **Boundaries honor us.** Your comfort levels are not everyone’s comfort
+ levels. Remember that, and if brought to your attention, heed it.
+3. **We are our biggest assets.** None of us were born masters of our trade.
+ Each of us has been helped along the way. Return that favor, when and where
+ you can.
+4. **We are resources for the future.** As an extension of #3, share what you
+ know. Make yourself a resource to help those that come after you.
+5. **Respect defines us.** Treat others as you wish to be treated. Make your
+ discussions, criticisms and debates from a position of respectfulness. Ask
+ yourself, is it true? Is it necessary? Is it constructive? Anything less is
+ unacceptable.
+6. **Reactions require grace.** Angry responses are valid, but abusive language
+ and vindictive actions are toxic. When something happens that offends you,
+ handle it assertively, but be respectful. Escalate reasonably, and try to
+ allow the offender an opportunity to explain themselves, and possibly
+ correct the issue.
+7. **Opinions are just that: opinions.** Each and every one of us, due to our
+ background and upbringing, have varying opinions. That is perfectly
+ acceptable. Remember this: if you respect your own opinions, you should
+ respect the opinions of others.
+8. **To err is human.** You might not intend it, but mistakes do happen and
+ contribute to build experience. Tolerate honest mistakes, and don't
+ hesitate to apologize if you make one yourself.
diff --git a/vendor/github.com/asaskevich/govalidator/CONTRIBUTING.md b/vendor/github.com/asaskevich/govalidator/CONTRIBUTING.md
new file mode 100644
index 0000000000..7ed268a1ed
--- /dev/null
+++ b/vendor/github.com/asaskevich/govalidator/CONTRIBUTING.md
@@ -0,0 +1,63 @@
+#### Support
+If you do have a contribution to the package, feel free to create a Pull Request or an Issue.
+
+#### What to contribute
+If you don't know what to do, there are some features and functions that need to be done
+
+- [ ] Refactor code
+- [ ] Edit docs and [README](https://github.com/asaskevich/govalidator/README.md): spellcheck, grammar and typo check
+- [ ] Create actual list of contributors and projects that currently using this package
+- [ ] Resolve [issues and bugs](https://github.com/asaskevich/govalidator/issues)
+- [ ] Update actual [list of functions](https://github.com/asaskevich/govalidator#list-of-functions)
+- [ ] Update [list of validators](https://github.com/asaskevich/govalidator#validatestruct-2) that available for `ValidateStruct` and add new
+- [ ] Implement new validators: `IsFQDN`, `IsIMEI`, `IsPostalCode`, `IsISIN`, `IsISRC` etc
+- [x] Implement [validation by maps](https://github.com/asaskevich/govalidator/issues/224)
+- [ ] Implement fuzzing testing
+- [ ] Implement some struct/map/array utilities
+- [ ] Implement map/array validation
+- [ ] Implement benchmarking
+- [ ] Implement batch of examples
+- [ ] Look at forks for new features and fixes
+
+#### Advice
+Feel free to create what you want, but keep in mind when you implement new features:
+- Code must be clear and readable, names of variables/constants clearly describes what they are doing
+- Public functions must be documented and described in source file and added to README.md to the list of available functions
+- There are must be unit-tests for any new functions and improvements
+
+## Financial contributions
+
+We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/govalidator).
+Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed.
+
+
+## Credits
+
+
+### Contributors
+
+Thank you to all the people who have already contributed to govalidator!
+
+
+
+### Backers
+
+Thank you to all our backers! [[Become a backer](https://opencollective.com/govalidator#backer)]
+
+
+
+
+### Sponsors
+
+Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor](https://opencollective.com/govalidator#sponsor))
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/vendor/github.com/asaskevich/govalidator/LICENSE b/vendor/github.com/asaskevich/govalidator/LICENSE
new file mode 100644
index 0000000000..cacba91024
--- /dev/null
+++ b/vendor/github.com/asaskevich/govalidator/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014-2020 Alex Saskevich
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/vendor/github.com/asaskevich/govalidator/README.md b/vendor/github.com/asaskevich/govalidator/README.md
new file mode 100644
index 0000000000..2c3fc35eb6
--- /dev/null
+++ b/vendor/github.com/asaskevich/govalidator/README.md
@@ -0,0 +1,622 @@
+govalidator
+===========
+[](https://gitter.im/asaskevich/govalidator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [](https://godoc.org/github.com/asaskevich/govalidator)
+[](https://travis-ci.org/asaskevich/govalidator)
+[](https://codecov.io/gh/asaskevich/govalidator) [](https://goreportcard.com/report/github.com/asaskevich/govalidator) [](http://go-search.org/view?id=github.com%2Fasaskevich%2Fgovalidator) [](#backers) [](#sponsors) [](https://app.fossa.io/projects/git%2Bgithub.com%2Fasaskevich%2Fgovalidator?ref=badge_shield)
+
+A package of validators and sanitizers for strings, structs and collections. Based on [validator.js](https://github.com/chriso/validator.js).
+
+#### Installation
+Make sure that Go is installed on your computer.
+Type the following command in your terminal:
+
+ go get github.com/asaskevich/govalidator
+
+or you can get specified release of the package with `gopkg.in`:
+
+ go get gopkg.in/asaskevich/govalidator.v10
+
+After it the package is ready to use.
+
+
+#### Import package in your project
+Add following line in your `*.go` file:
+```go
+import "github.com/asaskevich/govalidator"
+```
+If you are unhappy to use long `govalidator`, you can do something like this:
+```go
+import (
+ valid "github.com/asaskevich/govalidator"
+)
+```
+
+#### Activate behavior to require all fields have a validation tag by default
+`SetFieldsRequiredByDefault` causes validation to fail when struct fields do not include validations or are not explicitly marked as exempt (using `valid:"-"` or `valid:"email,optional"`). A good place to activate this is a package init function or the main() function.
+
+`SetNilPtrAllowedByRequired` causes validation to pass when struct fields marked by `required` are set to nil. This is disabled by default for consistency, but some packages that need to be able to determine between `nil` and `zero value` state can use this. If disabled, both `nil` and `zero` values cause validation errors.
+
+```go
+import "github.com/asaskevich/govalidator"
+
+func init() {
+ govalidator.SetFieldsRequiredByDefault(true)
+}
+```
+
+Here's some code to explain it:
+```go
+// this struct definition will fail govalidator.ValidateStruct() (and the field values do not matter):
+type exampleStruct struct {
+ Name string ``
+ Email string `valid:"email"`
+}
+
+// this, however, will only fail when Email is empty or an invalid email address:
+type exampleStruct2 struct {
+ Name string `valid:"-"`
+ Email string `valid:"email"`
+}
+
+// lastly, this will only fail when Email is an invalid email address but not when it's empty:
+type exampleStruct2 struct {
+ Name string `valid:"-"`
+ Email string `valid:"email,optional"`
+}
+```
+
+#### Recent breaking changes (see [#123](https://github.com/asaskevich/govalidator/pull/123))
+##### Custom validator function signature
+A context was added as the second parameter, for structs this is the object being validated – this makes dependent validation possible.
+```go
+import "github.com/asaskevich/govalidator"
+
+// old signature
+func(i interface{}) bool
+
+// new signature
+func(i interface{}, o interface{}) bool
+```
+
+##### Adding a custom validator
+This was changed to prevent data races when accessing custom validators.
+```go
+import "github.com/asaskevich/govalidator"
+
+// before
+govalidator.CustomTypeTagMap["customByteArrayValidator"] = func(i interface{}, o interface{}) bool {
+ // ...
+}
+
+// after
+govalidator.CustomTypeTagMap.Set("customByteArrayValidator", func(i interface{}, o interface{}) bool {
+ // ...
+})
+```
+
+#### List of functions:
+```go
+func Abs(value float64) float64
+func BlackList(str, chars string) string
+func ByteLength(str string, params ...string) bool
+func CamelCaseToUnderscore(str string) string
+func Contains(str, substring string) bool
+func Count(array []interface{}, iterator ConditionIterator) int
+func Each(array []interface{}, iterator Iterator)
+func ErrorByField(e error, field string) string
+func ErrorsByField(e error) map[string]string
+func Filter(array []interface{}, iterator ConditionIterator) []interface{}
+func Find(array []interface{}, iterator ConditionIterator) interface{}
+func GetLine(s string, index int) (string, error)
+func GetLines(s string) []string
+func HasLowerCase(str string) bool
+func HasUpperCase(str string) bool
+func HasWhitespace(str string) bool
+func HasWhitespaceOnly(str string) bool
+func InRange(value interface{}, left interface{}, right interface{}) bool
+func InRangeFloat32(value, left, right float32) bool
+func InRangeFloat64(value, left, right float64) bool
+func InRangeInt(value, left, right interface{}) bool
+func IsASCII(str string) bool
+func IsAlpha(str string) bool
+func IsAlphanumeric(str string) bool
+func IsBase64(str string) bool
+func IsByteLength(str string, min, max int) bool
+func IsCIDR(str string) bool
+func IsCRC32(str string) bool
+func IsCRC32b(str string) bool
+func IsCreditCard(str string) bool
+func IsDNSName(str string) bool
+func IsDataURI(str string) bool
+func IsDialString(str string) bool
+func IsDivisibleBy(str, num string) bool
+func IsEmail(str string) bool
+func IsExistingEmail(email string) bool
+func IsFilePath(str string) (bool, int)
+func IsFloat(str string) bool
+func IsFullWidth(str string) bool
+func IsHalfWidth(str string) bool
+func IsHash(str string, algorithm string) bool
+func IsHexadecimal(str string) bool
+func IsHexcolor(str string) bool
+func IsHost(str string) bool
+func IsIP(str string) bool
+func IsIPv4(str string) bool
+func IsIPv6(str string) bool
+func IsISBN(str string, version int) bool
+func IsISBN10(str string) bool
+func IsISBN13(str string) bool
+func IsISO3166Alpha2(str string) bool
+func IsISO3166Alpha3(str string) bool
+func IsISO4217(str string) bool
+func IsISO693Alpha2(str string) bool
+func IsISO693Alpha3b(str string) bool
+func IsIn(str string, params ...string) bool
+func IsInRaw(str string, params ...string) bool
+func IsInt(str string) bool
+func IsJSON(str string) bool
+func IsLatitude(str string) bool
+func IsLongitude(str string) bool
+func IsLowerCase(str string) bool
+func IsMAC(str string) bool
+func IsMD4(str string) bool
+func IsMD5(str string) bool
+func IsMagnetURI(str string) bool
+func IsMongoID(str string) bool
+func IsMultibyte(str string) bool
+func IsNatural(value float64) bool
+func IsNegative(value float64) bool
+func IsNonNegative(value float64) bool
+func IsNonPositive(value float64) bool
+func IsNotNull(str string) bool
+func IsNull(str string) bool
+func IsNumeric(str string) bool
+func IsPort(str string) bool
+func IsPositive(value float64) bool
+func IsPrintableASCII(str string) bool
+func IsRFC3339(str string) bool
+func IsRFC3339WithoutZone(str string) bool
+func IsRGBcolor(str string) bool
+func IsRegex(str string) bool
+func IsRequestURI(rawurl string) bool
+func IsRequestURL(rawurl string) bool
+func IsRipeMD128(str string) bool
+func IsRipeMD160(str string) bool
+func IsRsaPub(str string, params ...string) bool
+func IsRsaPublicKey(str string, keylen int) bool
+func IsSHA1(str string) bool
+func IsSHA256(str string) bool
+func IsSHA384(str string) bool
+func IsSHA512(str string) bool
+func IsSSN(str string) bool
+func IsSemver(str string) bool
+func IsTiger128(str string) bool
+func IsTiger160(str string) bool
+func IsTiger192(str string) bool
+func IsTime(str string, format string) bool
+func IsType(v interface{}, params ...string) bool
+func IsURL(str string) bool
+func IsUTFDigit(str string) bool
+func IsUTFLetter(str string) bool
+func IsUTFLetterNumeric(str string) bool
+func IsUTFNumeric(str string) bool
+func IsUUID(str string) bool
+func IsUUIDv3(str string) bool
+func IsUUIDv4(str string) bool
+func IsUUIDv5(str string) bool
+func IsULID(str string) bool
+func IsUnixTime(str string) bool
+func IsUpperCase(str string) bool
+func IsVariableWidth(str string) bool
+func IsWhole(value float64) bool
+func LeftTrim(str, chars string) string
+func Map(array []interface{}, iterator ResultIterator) []interface{}
+func Matches(str, pattern string) bool
+func MaxStringLength(str string, params ...string) bool
+func MinStringLength(str string, params ...string) bool
+func NormalizeEmail(str string) (string, error)
+func PadBoth(str string, padStr string, padLen int) string
+func PadLeft(str string, padStr string, padLen int) string
+func PadRight(str string, padStr string, padLen int) string
+func PrependPathToErrors(err error, path string) error
+func Range(str string, params ...string) bool
+func RemoveTags(s string) string
+func ReplacePattern(str, pattern, replace string) string
+func Reverse(s string) string
+func RightTrim(str, chars string) string
+func RuneLength(str string, params ...string) bool
+func SafeFileName(str string) string
+func SetFieldsRequiredByDefault(value bool)
+func SetNilPtrAllowedByRequired(value bool)
+func Sign(value float64) float64
+func StringLength(str string, params ...string) bool
+func StringMatches(s string, params ...string) bool
+func StripLow(str string, keepNewLines bool) string
+func ToBoolean(str string) (bool, error)
+func ToFloat(str string) (float64, error)
+func ToInt(value interface{}) (res int64, err error)
+func ToJSON(obj interface{}) (string, error)
+func ToString(obj interface{}) string
+func Trim(str, chars string) string
+func Truncate(str string, length int, ending string) string
+func TruncatingErrorf(str string, args ...interface{}) error
+func UnderscoreToCamelCase(s string) string
+func ValidateMap(inputMap map[string]interface{}, validationMap map[string]interface{}) (bool, error)
+func ValidateStruct(s interface{}) (bool, error)
+func WhiteList(str, chars string) string
+type ConditionIterator
+type CustomTypeValidator
+type Error
+func (e Error) Error() string
+type Errors
+func (es Errors) Error() string
+func (es Errors) Errors() []error
+type ISO3166Entry
+type ISO693Entry
+type InterfaceParamValidator
+type Iterator
+type ParamValidator
+type ResultIterator
+type UnsupportedTypeError
+func (e *UnsupportedTypeError) Error() string
+type Validator
+```
+
+#### Examples
+###### IsURL
+```go
+println(govalidator.IsURL(`http://user@pass:domain.com/path/page`))
+```
+###### IsType
+```go
+println(govalidator.IsType("Bob", "string"))
+println(govalidator.IsType(1, "int"))
+i := 1
+println(govalidator.IsType(&i, "*int"))
+```
+
+IsType can be used through the tag `type` which is essential for map validation:
+```go
+type User struct {
+ Name string `valid:"type(string)"`
+ Age int `valid:"type(int)"`
+ Meta interface{} `valid:"type(string)"`
+}
+result, err := govalidator.ValidateStruct(User{"Bob", 20, "meta"})
+if err != nil {
+ println("error: " + err.Error())
+}
+println(result)
+```
+###### ToString
+```go
+type User struct {
+ FirstName string
+ LastName string
+}
+
+str := govalidator.ToString(&User{"John", "Juan"})
+println(str)
+```
+###### Each, Map, Filter, Count for slices
+Each iterates over the slice/array and calls Iterator for every item
+```go
+data := []interface{}{1, 2, 3, 4, 5}
+var fn govalidator.Iterator = func(value interface{}, index int) {
+ println(value.(int))
+}
+govalidator.Each(data, fn)
+```
+```go
+data := []interface{}{1, 2, 3, 4, 5}
+var fn govalidator.ResultIterator = func(value interface{}, index int) interface{} {
+ return value.(int) * 3
+}
+_ = govalidator.Map(data, fn) // result = []interface{}{1, 6, 9, 12, 15}
+```
+```go
+data := []interface{}{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
+var fn govalidator.ConditionIterator = func(value interface{}, index int) bool {
+ return value.(int)%2 == 0
+}
+_ = govalidator.Filter(data, fn) // result = []interface{}{2, 4, 6, 8, 10}
+_ = govalidator.Count(data, fn) // result = 5
+```
+###### ValidateStruct [#2](https://github.com/asaskevich/govalidator/pull/2)
+If you want to validate structs, you can use tag `valid` for any field in your structure. All validators used with this field in one tag are separated by comma. If you want to skip validation, place `-` in your tag. If you need a validator that is not on the list below, you can add it like this:
+```go
+govalidator.TagMap["duck"] = govalidator.Validator(func(str string) bool {
+ return str == "duck"
+})
+```
+For completely custom validators (interface-based), see below.
+
+Here is a list of available validators for struct fields (validator - used function):
+```go
+"email": IsEmail,
+"url": IsURL,
+"dialstring": IsDialString,
+"requrl": IsRequestURL,
+"requri": IsRequestURI,
+"alpha": IsAlpha,
+"utfletter": IsUTFLetter,
+"alphanum": IsAlphanumeric,
+"utfletternum": IsUTFLetterNumeric,
+"numeric": IsNumeric,
+"utfnumeric": IsUTFNumeric,
+"utfdigit": IsUTFDigit,
+"hexadecimal": IsHexadecimal,
+"hexcolor": IsHexcolor,
+"rgbcolor": IsRGBcolor,
+"lowercase": IsLowerCase,
+"uppercase": IsUpperCase,
+"int": IsInt,
+"float": IsFloat,
+"null": IsNull,
+"uuid": IsUUID,
+"uuidv3": IsUUIDv3,
+"uuidv4": IsUUIDv4,
+"uuidv5": IsUUIDv5,
+"creditcard": IsCreditCard,
+"isbn10": IsISBN10,
+"isbn13": IsISBN13,
+"json": IsJSON,
+"multibyte": IsMultibyte,
+"ascii": IsASCII,
+"printableascii": IsPrintableASCII,
+"fullwidth": IsFullWidth,
+"halfwidth": IsHalfWidth,
+"variablewidth": IsVariableWidth,
+"base64": IsBase64,
+"datauri": IsDataURI,
+"ip": IsIP,
+"port": IsPort,
+"ipv4": IsIPv4,
+"ipv6": IsIPv6,
+"dns": IsDNSName,
+"host": IsHost,
+"mac": IsMAC,
+"latitude": IsLatitude,
+"longitude": IsLongitude,
+"ssn": IsSSN,
+"semver": IsSemver,
+"rfc3339": IsRFC3339,
+"rfc3339WithoutZone": IsRFC3339WithoutZone,
+"ISO3166Alpha2": IsISO3166Alpha2,
+"ISO3166Alpha3": IsISO3166Alpha3,
+"ulid": IsULID,
+```
+Validators with parameters
+
+```go
+"range(min|max)": Range,
+"length(min|max)": ByteLength,
+"runelength(min|max)": RuneLength,
+"stringlength(min|max)": StringLength,
+"matches(pattern)": StringMatches,
+"in(string1|string2|...|stringN)": IsIn,
+"rsapub(keylength)" : IsRsaPub,
+"minstringlength(int): MinStringLength,
+"maxstringlength(int): MaxStringLength,
+```
+Validators with parameters for any type
+
+```go
+"type(type)": IsType,
+```
+
+And here is small example of usage:
+```go
+type Post struct {
+ Title string `valid:"alphanum,required"`
+ Message string `valid:"duck,ascii"`
+ Message2 string `valid:"animal(dog)"`
+ AuthorIP string `valid:"ipv4"`
+ Date string `valid:"-"`
+}
+post := &Post{
+ Title: "My Example Post",
+ Message: "duck",
+ Message2: "dog",
+ AuthorIP: "123.234.54.3",
+}
+
+// Add your own struct validation tags
+govalidator.TagMap["duck"] = govalidator.Validator(func(str string) bool {
+ return str == "duck"
+})
+
+// Add your own struct validation tags with parameter
+govalidator.ParamTagMap["animal"] = govalidator.ParamValidator(func(str string, params ...string) bool {
+ species := params[0]
+ return str == species
+})
+govalidator.ParamTagRegexMap["animal"] = regexp.MustCompile("^animal\\((\\w+)\\)$")
+
+result, err := govalidator.ValidateStruct(post)
+if err != nil {
+ println("error: " + err.Error())
+}
+println(result)
+```
+###### ValidateMap [#2](https://github.com/asaskevich/govalidator/pull/338)
+If you want to validate maps, you can use the map to be validated and a validation map that contain the same tags used in ValidateStruct, both maps have to be in the form `map[string]interface{}`
+
+So here is small example of usage:
+```go
+var mapTemplate = map[string]interface{}{
+ "name":"required,alpha",
+ "family":"required,alpha",
+ "email":"required,email",
+ "cell-phone":"numeric",
+ "address":map[string]interface{}{
+ "line1":"required,alphanum",
+ "line2":"alphanum",
+ "postal-code":"numeric",
+ },
+}
+
+var inputMap = map[string]interface{}{
+ "name":"Bob",
+ "family":"Smith",
+ "email":"foo@bar.baz",
+ "address":map[string]interface{}{
+ "line1":"",
+ "line2":"",
+ "postal-code":"",
+ },
+}
+
+result, err := govalidator.ValidateMap(inputMap, mapTemplate)
+if err != nil {
+ println("error: " + err.Error())
+}
+println(result)
+```
+
+###### WhiteList
+```go
+// Remove all characters from string ignoring characters between "a" and "z"
+println(govalidator.WhiteList("a3a43a5a4a3a2a23a4a5a4a3a4", "a-z") == "aaaaaaaaaaaa")
+```
+
+###### Custom validation functions
+Custom validation using your own domain specific validators is also available - here's an example of how to use it:
+```go
+import "github.com/asaskevich/govalidator"
+
+type CustomByteArray [6]byte // custom types are supported and can be validated
+
+type StructWithCustomByteArray struct {
+ ID CustomByteArray `valid:"customByteArrayValidator,customMinLengthValidator"` // multiple custom validators are possible as well and will be evaluated in sequence
+ Email string `valid:"email"`
+ CustomMinLength int `valid:"-"`
+}
+
+govalidator.CustomTypeTagMap.Set("customByteArrayValidator", func(i interface{}, context interface{}) bool {
+ switch v := context.(type) { // you can type switch on the context interface being validated
+ case StructWithCustomByteArray:
+ // you can check and validate against some other field in the context,
+ // return early or not validate against the context at all – your choice
+ case SomeOtherType:
+ // ...
+ default:
+ // expecting some other type? Throw/panic here or continue
+ }
+
+ switch v := i.(type) { // type switch on the struct field being validated
+ case CustomByteArray:
+ for _, e := range v { // this validator checks that the byte array is not empty, i.e. not all zeroes
+ if e != 0 {
+ return true
+ }
+ }
+ }
+ return false
+})
+govalidator.CustomTypeTagMap.Set("customMinLengthValidator", func(i interface{}, context interface{}) bool {
+ switch v := context.(type) { // this validates a field against the value in another field, i.e. dependent validation
+ case StructWithCustomByteArray:
+ return len(v.ID) >= v.CustomMinLength
+ }
+ return false
+})
+```
+
+###### Loop over Error()
+By default .Error() returns all errors in a single String. To access each error you can do this:
+```go
+ if err != nil {
+ errs := err.(govalidator.Errors).Errors()
+ for _, e := range errs {
+ fmt.Println(e.Error())
+ }
+ }
+```
+
+###### Custom error messages
+Custom error messages are supported via annotations by adding the `~` separator - here's an example of how to use it:
+```go
+type Ticket struct {
+ Id int64 `json:"id"`
+ FirstName string `json:"firstname" valid:"required~First name is blank"`
+}
+```
+
+#### Notes
+Documentation is available here: [godoc.org](https://godoc.org/github.com/asaskevich/govalidator).
+Full information about code coverage is also available here: [govalidator on gocover.io](http://gocover.io/github.com/asaskevich/govalidator).
+
+#### Support
+If you do have a contribution to the package, feel free to create a Pull Request or an Issue.
+
+#### What to contribute
+If you don't know what to do, there are some features and functions that need to be done
+
+- [ ] Refactor code
+- [ ] Edit docs and [README](https://github.com/asaskevich/govalidator/README.md): spellcheck, grammar and typo check
+- [ ] Create actual list of contributors and projects that currently using this package
+- [ ] Resolve [issues and bugs](https://github.com/asaskevich/govalidator/issues)
+- [ ] Update actual [list of functions](https://github.com/asaskevich/govalidator#list-of-functions)
+- [ ] Update [list of validators](https://github.com/asaskevich/govalidator#validatestruct-2) that available for `ValidateStruct` and add new
+- [ ] Implement new validators: `IsFQDN`, `IsIMEI`, `IsPostalCode`, `IsISIN`, `IsISRC` etc
+- [x] Implement [validation by maps](https://github.com/asaskevich/govalidator/issues/224)
+- [ ] Implement fuzzing testing
+- [ ] Implement some struct/map/array utilities
+- [ ] Implement map/array validation
+- [ ] Implement benchmarking
+- [ ] Implement batch of examples
+- [ ] Look at forks for new features and fixes
+
+#### Advice
+Feel free to create what you want, but keep in mind when you implement new features:
+- Code must be clear and readable, names of variables/constants clearly describes what they are doing
+- Public functions must be documented and described in source file and added to README.md to the list of available functions
+- There are must be unit-tests for any new functions and improvements
+
+## Credits
+### Contributors
+
+This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
+
+#### Special thanks to [contributors](https://github.com/asaskevich/govalidator/graphs/contributors)
+* [Daniel Lohse](https://github.com/annismckenzie)
+* [Attila Oláh](https://github.com/attilaolah)
+* [Daniel Korner](https://github.com/Dadie)
+* [Steven Wilkin](https://github.com/stevenwilkin)
+* [Deiwin Sarjas](https://github.com/deiwin)
+* [Noah Shibley](https://github.com/slugmobile)
+* [Nathan Davies](https://github.com/nathj07)
+* [Matt Sanford](https://github.com/mzsanford)
+* [Simon ccl1115](https://github.com/ccl1115)
+
+
+
+
+### Backers
+
+Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/govalidator#backer)]
+
+
+
+
+### Sponsors
+
+Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/govalidator#sponsor)]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## License
+[](https://app.fossa.io/projects/git%2Bgithub.com%2Fasaskevich%2Fgovalidator?ref=badge_large)
diff --git a/vendor/github.com/asaskevich/govalidator/arrays.go b/vendor/github.com/asaskevich/govalidator/arrays.go
new file mode 100644
index 0000000000..3e1da7cb48
--- /dev/null
+++ b/vendor/github.com/asaskevich/govalidator/arrays.go
@@ -0,0 +1,87 @@
+package govalidator
+
+// Iterator is the function that accepts element of slice/array and its index
+type Iterator func(interface{}, int)
+
+// ResultIterator is the function that accepts element of slice/array and its index and returns any result
+type ResultIterator func(interface{}, int) interface{}
+
+// ConditionIterator is the function that accepts element of slice/array and its index and returns boolean
+type ConditionIterator func(interface{}, int) bool
+
+// ReduceIterator is the function that accepts two element of slice/array and returns result of merging those values
+type ReduceIterator func(interface{}, interface{}) interface{}
+
+// Some validates that any item of array corresponds to ConditionIterator. Returns boolean.
+func Some(array []interface{}, iterator ConditionIterator) bool {
+ res := false
+ for index, data := range array {
+ res = res || iterator(data, index)
+ }
+ return res
+}
+
+// Every validates that every item of array corresponds to ConditionIterator. Returns boolean.
+func Every(array []interface{}, iterator ConditionIterator) bool {
+ res := true
+ for index, data := range array {
+ res = res && iterator(data, index)
+ }
+ return res
+}
+
+// Reduce boils down a list of values into a single value by ReduceIterator
+func Reduce(array []interface{}, iterator ReduceIterator, initialValue interface{}) interface{} {
+ for _, data := range array {
+ initialValue = iterator(initialValue, data)
+ }
+ return initialValue
+}
+
+// Each iterates over the slice and apply Iterator to every item
+func Each(array []interface{}, iterator Iterator) {
+ for index, data := range array {
+ iterator(data, index)
+ }
+}
+
+// Map iterates over the slice and apply ResultIterator to every item. Returns new slice as a result.
+func Map(array []interface{}, iterator ResultIterator) []interface{} {
+ var result = make([]interface{}, len(array))
+ for index, data := range array {
+ result[index] = iterator(data, index)
+ }
+ return result
+}
+
+// Find iterates over the slice and apply ConditionIterator to every item. Returns first item that meet ConditionIterator or nil otherwise.
+func Find(array []interface{}, iterator ConditionIterator) interface{} {
+ for index, data := range array {
+ if iterator(data, index) {
+ return data
+ }
+ }
+ return nil
+}
+
+// Filter iterates over the slice and apply ConditionIterator to every item. Returns new slice.
+func Filter(array []interface{}, iterator ConditionIterator) []interface{} {
+ var result = make([]interface{}, 0)
+ for index, data := range array {
+ if iterator(data, index) {
+ result = append(result, data)
+ }
+ }
+ return result
+}
+
+// Count iterates over the slice and apply ConditionIterator to every item. Returns count of items that meets ConditionIterator.
+func Count(array []interface{}, iterator ConditionIterator) int {
+ count := 0
+ for index, data := range array {
+ if iterator(data, index) {
+ count = count + 1
+ }
+ }
+ return count
+}
diff --git a/vendor/github.com/asaskevich/govalidator/converter.go b/vendor/github.com/asaskevich/govalidator/converter.go
new file mode 100644
index 0000000000..d68e990fc2
--- /dev/null
+++ b/vendor/github.com/asaskevich/govalidator/converter.go
@@ -0,0 +1,81 @@
+package govalidator
+
+import (
+ "encoding/json"
+ "fmt"
+ "reflect"
+ "strconv"
+)
+
+// ToString convert the input to a string.
+func ToString(obj interface{}) string {
+ res := fmt.Sprintf("%v", obj)
+ return res
+}
+
+// ToJSON convert the input to a valid JSON string
+func ToJSON(obj interface{}) (string, error) {
+ res, err := json.Marshal(obj)
+ if err != nil {
+ res = []byte("")
+ }
+ return string(res), err
+}
+
+// ToFloat convert the input string to a float, or 0.0 if the input is not a float.
+func ToFloat(value interface{}) (res float64, err error) {
+ val := reflect.ValueOf(value)
+
+ switch value.(type) {
+ case int, int8, int16, int32, int64:
+ res = float64(val.Int())
+ case uint, uint8, uint16, uint32, uint64:
+ res = float64(val.Uint())
+ case float32, float64:
+ res = val.Float()
+ case string:
+ res, err = strconv.ParseFloat(val.String(), 64)
+ if err != nil {
+ res = 0
+ }
+ default:
+ err = fmt.Errorf("ToInt: unknown interface type %T", value)
+ res = 0
+ }
+
+ return
+}
+
+// ToInt convert the input string or any int type to an integer type 64, or 0 if the input is not an integer.
+func ToInt(value interface{}) (res int64, err error) {
+ val := reflect.ValueOf(value)
+
+ switch value.(type) {
+ case int, int8, int16, int32, int64:
+ res = val.Int()
+ case uint, uint8, uint16, uint32, uint64:
+ res = int64(val.Uint())
+ case float32, float64:
+ res = int64(val.Float())
+ case string:
+ if IsInt(val.String()) {
+ res, err = strconv.ParseInt(val.String(), 0, 64)
+ if err != nil {
+ res = 0
+ }
+ } else {
+ err = fmt.Errorf("ToInt: invalid numeric format %g", value)
+ res = 0
+ }
+ default:
+ err = fmt.Errorf("ToInt: unknown interface type %T", value)
+ res = 0
+ }
+
+ return
+}
+
+// ToBoolean convert the input string to a boolean.
+func ToBoolean(str string) (bool, error) {
+ return strconv.ParseBool(str)
+}
diff --git a/vendor/github.com/asaskevich/govalidator/doc.go b/vendor/github.com/asaskevich/govalidator/doc.go
new file mode 100644
index 0000000000..55dce62dc8
--- /dev/null
+++ b/vendor/github.com/asaskevich/govalidator/doc.go
@@ -0,0 +1,3 @@
+package govalidator
+
+// A package of validators and sanitizers for strings, structures and collections.
diff --git a/vendor/github.com/asaskevich/govalidator/error.go b/vendor/github.com/asaskevich/govalidator/error.go
new file mode 100644
index 0000000000..1da2336f47
--- /dev/null
+++ b/vendor/github.com/asaskevich/govalidator/error.go
@@ -0,0 +1,47 @@
+package govalidator
+
+import (
+ "sort"
+ "strings"
+)
+
+// Errors is an array of multiple errors and conforms to the error interface.
+type Errors []error
+
+// Errors returns itself.
+func (es Errors) Errors() []error {
+ return es
+}
+
+func (es Errors) Error() string {
+ var errs []string
+ for _, e := range es {
+ errs = append(errs, e.Error())
+ }
+ sort.Strings(errs)
+ return strings.Join(errs, ";")
+}
+
+// Error encapsulates a name, an error and whether there's a custom error message or not.
+type Error struct {
+ Name string
+ Err error
+ CustomErrorMessageExists bool
+
+ // Validator indicates the name of the validator that failed
+ Validator string
+ Path []string
+}
+
+func (e Error) Error() string {
+ if e.CustomErrorMessageExists {
+ return e.Err.Error()
+ }
+
+ errName := e.Name
+ if len(e.Path) > 0 {
+ errName = strings.Join(append(e.Path, e.Name), ".")
+ }
+
+ return errName + ": " + e.Err.Error()
+}
diff --git a/vendor/github.com/asaskevich/govalidator/numerics.go b/vendor/github.com/asaskevich/govalidator/numerics.go
new file mode 100644
index 0000000000..5041d9e868
--- /dev/null
+++ b/vendor/github.com/asaskevich/govalidator/numerics.go
@@ -0,0 +1,100 @@
+package govalidator
+
+import (
+ "math"
+)
+
+// Abs returns absolute value of number
+func Abs(value float64) float64 {
+ return math.Abs(value)
+}
+
+// Sign returns signum of number: 1 in case of value > 0, -1 in case of value < 0, 0 otherwise
+func Sign(value float64) float64 {
+ if value > 0 {
+ return 1
+ } else if value < 0 {
+ return -1
+ } else {
+ return 0
+ }
+}
+
+// IsNegative returns true if value < 0
+func IsNegative(value float64) bool {
+ return value < 0
+}
+
+// IsPositive returns true if value > 0
+func IsPositive(value float64) bool {
+ return value > 0
+}
+
+// IsNonNegative returns true if value >= 0
+func IsNonNegative(value float64) bool {
+ return value >= 0
+}
+
+// IsNonPositive returns true if value <= 0
+func IsNonPositive(value float64) bool {
+ return value <= 0
+}
+
+// InRangeInt returns true if value lies between left and right border
+func InRangeInt(value, left, right interface{}) bool {
+ value64, _ := ToInt(value)
+ left64, _ := ToInt(left)
+ right64, _ := ToInt(right)
+ if left64 > right64 {
+ left64, right64 = right64, left64
+ }
+ return value64 >= left64 && value64 <= right64
+}
+
+// InRangeFloat32 returns true if value lies between left and right border
+func InRangeFloat32(value, left, right float32) bool {
+ if left > right {
+ left, right = right, left
+ }
+ return value >= left && value <= right
+}
+
+// InRangeFloat64 returns true if value lies between left and right border
+func InRangeFloat64(value, left, right float64) bool {
+ if left > right {
+ left, right = right, left
+ }
+ return value >= left && value <= right
+}
+
+// InRange returns true if value lies between left and right border, generic type to handle int, float32, float64 and string.
+// All types must the same type.
+// False if value doesn't lie in range or if it incompatible or not comparable
+func InRange(value interface{}, left interface{}, right interface{}) bool {
+ switch value.(type) {
+ case int:
+ intValue, _ := ToInt(value)
+ intLeft, _ := ToInt(left)
+ intRight, _ := ToInt(right)
+ return InRangeInt(intValue, intLeft, intRight)
+ case float32, float64:
+ intValue, _ := ToFloat(value)
+ intLeft, _ := ToFloat(left)
+ intRight, _ := ToFloat(right)
+ return InRangeFloat64(intValue, intLeft, intRight)
+ case string:
+ return value.(string) >= left.(string) && value.(string) <= right.(string)
+ default:
+ return false
+ }
+}
+
+// IsWhole returns true if value is whole number
+func IsWhole(value float64) bool {
+ return math.Remainder(value, 1) == 0
+}
+
+// IsNatural returns true if value is natural number (positive and whole)
+func IsNatural(value float64) bool {
+ return IsWhole(value) && IsPositive(value)
+}
diff --git a/vendor/github.com/asaskevich/govalidator/patterns.go b/vendor/github.com/asaskevich/govalidator/patterns.go
new file mode 100644
index 0000000000..bafc3765ea
--- /dev/null
+++ b/vendor/github.com/asaskevich/govalidator/patterns.go
@@ -0,0 +1,113 @@
+package govalidator
+
+import "regexp"
+
+// Basic regular expressions for validating strings
+const (
+ Email string = "^(((([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+(\\.([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])([a-zA-Z]|\\d|-|\\.|_|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.)+(([a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(([a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])([a-zA-Z]|\\d|-|_|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*([a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.?$"
+ CreditCard string = "^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11}|6[27][0-9]{14})$"
+ ISBN10 string = "^(?:[0-9]{9}X|[0-9]{10})$"
+ ISBN13 string = "^(?:[0-9]{13})$"
+ UUID3 string = "^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$"
+ UUID4 string = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
+ UUID5 string = "^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
+ UUID string = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
+ Alpha string = "^[a-zA-Z]+$"
+ Alphanumeric string = "^[a-zA-Z0-9]+$"
+ Numeric string = "^[0-9]+$"
+ Int string = "^(?:[-+]?(?:0|[1-9][0-9]*))$"
+ Float string = "^(?:[-+]?(?:[0-9]+))?(?:\\.[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$"
+ Hexadecimal string = "^[0-9a-fA-F]+$"
+ Hexcolor string = "^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
+ RGBcolor string = "^rgb\\(\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*\\)$"
+ ASCII string = "^[\x00-\x7F]+$"
+ Multibyte string = "[^\x00-\x7F]"
+ FullWidth string = "[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]"
+ HalfWidth string = "[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]"
+ Base64 string = "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=|[A-Za-z0-9+\\/]{4})$"
+ PrintableASCII string = "^[\x20-\x7E]+$"
+ DataURI string = "^data:.+\\/(.+);base64$"
+ MagnetURI string = "^magnet:\\?xt=urn:[a-zA-Z0-9]+:[a-zA-Z0-9]{32,40}&dn=.+&tr=.+$"
+ Latitude string = "^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?)$"
+ Longitude string = "^[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$"
+ DNSName string = `^([a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62}){1}(\.[a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62})*[\._]?$`
+ IP string = `(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))`
+ URLSchema string = `((ftp|tcp|udp|wss?|https?):\/\/)`
+ URLUsername string = `(\S+(:\S*)?@)`
+ URLPath string = `((\/|\?|#)[^\s]*)`
+ URLPort string = `(:(\d{1,5}))`
+ URLIP string = `([1-9]\d?|1\d\d|2[01]\d|22[0-3]|24\d|25[0-5])(\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])){2}(?:\.([0-9]\d?|1\d\d|2[0-4]\d|25[0-5]))`
+ URLSubdomain string = `((www\.)|([a-zA-Z0-9]+([-_\.]?[a-zA-Z0-9])*[a-zA-Z0-9]\.[a-zA-Z0-9]+))`
+ URL = `^` + URLSchema + `?` + URLUsername + `?` + `((` + URLIP + `|(\[` + IP + `\])|(([a-zA-Z0-9]([a-zA-Z0-9-_]+)?[a-zA-Z0-9]([-\.][a-zA-Z0-9]+)*)|(` + URLSubdomain + `?))?(([a-zA-Z\x{00a1}-\x{ffff}0-9]+-?-?)*[a-zA-Z\x{00a1}-\x{ffff}0-9]+)(?:\.([a-zA-Z\x{00a1}-\x{ffff}]{1,}))?))\.?` + URLPort + `?` + URLPath + `?$`
+ SSN string = `^\d{3}[- ]?\d{2}[- ]?\d{4}$`
+ WinPath string = `^[a-zA-Z]:\\(?:[^\\/:*?"<>|\r\n]+\\)*[^\\/:*?"<>|\r\n]*$`
+ UnixPath string = `^(/[^/\x00]*)+/?$`
+ WinARPath string = `^(?:(?:[a-zA-Z]:|\\\\[a-z0-9_.$●-]+\\[a-z0-9_.$●-]+)\\|\\?[^\\/:*?"<>|\r\n]+\\?)(?:[^\\/:*?"<>|\r\n]+\\)*[^\\/:*?"<>|\r\n]*$`
+ UnixARPath string = `^((\.{0,2}/)?([^/\x00]*))+/?$`
+ Semver string = "^v?(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"
+ tagName string = "valid"
+ hasLowerCase string = ".*[[:lower:]]"
+ hasUpperCase string = ".*[[:upper:]]"
+ hasWhitespace string = ".*[[:space:]]"
+ hasWhitespaceOnly string = "^[[:space:]]+$"
+ IMEI string = "^[0-9a-f]{14}$|^\\d{15}$|^\\d{18}$"
+ IMSI string = "^\\d{14,15}$"
+ E164 string = `^\+?[1-9]\d{1,14}$`
+)
+
+// Used by IsFilePath func
+const (
+ // Unknown is unresolved OS type
+ Unknown = iota
+ // Win is Windows type
+ Win
+ // Unix is *nix OS types
+ Unix
+)
+
+var (
+ userRegexp = regexp.MustCompile("^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~.-]+$")
+ hostRegexp = regexp.MustCompile("^[^\\s]+\\.[^\\s]+$")
+ userDotRegexp = regexp.MustCompile("(^[.]{1})|([.]{1}$)|([.]{2,})")
+ rxEmail = regexp.MustCompile(Email)
+ rxCreditCard = regexp.MustCompile(CreditCard)
+ rxISBN10 = regexp.MustCompile(ISBN10)
+ rxISBN13 = regexp.MustCompile(ISBN13)
+ rxUUID3 = regexp.MustCompile(UUID3)
+ rxUUID4 = regexp.MustCompile(UUID4)
+ rxUUID5 = regexp.MustCompile(UUID5)
+ rxUUID = regexp.MustCompile(UUID)
+ rxAlpha = regexp.MustCompile(Alpha)
+ rxAlphanumeric = regexp.MustCompile(Alphanumeric)
+ rxNumeric = regexp.MustCompile(Numeric)
+ rxInt = regexp.MustCompile(Int)
+ rxFloat = regexp.MustCompile(Float)
+ rxHexadecimal = regexp.MustCompile(Hexadecimal)
+ rxHexcolor = regexp.MustCompile(Hexcolor)
+ rxRGBcolor = regexp.MustCompile(RGBcolor)
+ rxASCII = regexp.MustCompile(ASCII)
+ rxPrintableASCII = regexp.MustCompile(PrintableASCII)
+ rxMultibyte = regexp.MustCompile(Multibyte)
+ rxFullWidth = regexp.MustCompile(FullWidth)
+ rxHalfWidth = regexp.MustCompile(HalfWidth)
+ rxBase64 = regexp.MustCompile(Base64)
+ rxDataURI = regexp.MustCompile(DataURI)
+ rxMagnetURI = regexp.MustCompile(MagnetURI)
+ rxLatitude = regexp.MustCompile(Latitude)
+ rxLongitude = regexp.MustCompile(Longitude)
+ rxDNSName = regexp.MustCompile(DNSName)
+ rxURL = regexp.MustCompile(URL)
+ rxSSN = regexp.MustCompile(SSN)
+ rxWinPath = regexp.MustCompile(WinPath)
+ rxUnixPath = regexp.MustCompile(UnixPath)
+ rxARWinPath = regexp.MustCompile(WinARPath)
+ rxARUnixPath = regexp.MustCompile(UnixARPath)
+ rxSemver = regexp.MustCompile(Semver)
+ rxHasLowerCase = regexp.MustCompile(hasLowerCase)
+ rxHasUpperCase = regexp.MustCompile(hasUpperCase)
+ rxHasWhitespace = regexp.MustCompile(hasWhitespace)
+ rxHasWhitespaceOnly = regexp.MustCompile(hasWhitespaceOnly)
+ rxIMEI = regexp.MustCompile(IMEI)
+ rxIMSI = regexp.MustCompile(IMSI)
+ rxE164 = regexp.MustCompile(E164)
+)
diff --git a/vendor/github.com/asaskevich/govalidator/types.go b/vendor/github.com/asaskevich/govalidator/types.go
new file mode 100644
index 0000000000..c573abb51a
--- /dev/null
+++ b/vendor/github.com/asaskevich/govalidator/types.go
@@ -0,0 +1,656 @@
+package govalidator
+
+import (
+ "reflect"
+ "regexp"
+ "sort"
+ "sync"
+)
+
+// Validator is a wrapper for a validator function that returns bool and accepts string.
+type Validator func(str string) bool
+
+// CustomTypeValidator is a wrapper for validator functions that returns bool and accepts any type.
+// The second parameter should be the context (in the case of validating a struct: the whole object being validated).
+type CustomTypeValidator func(i interface{}, o interface{}) bool
+
+// ParamValidator is a wrapper for validator functions that accept additional parameters.
+type ParamValidator func(str string, params ...string) bool
+
+// InterfaceParamValidator is a wrapper for functions that accept variants parameters for an interface value
+type InterfaceParamValidator func(in interface{}, params ...string) bool
+type tagOptionsMap map[string]tagOption
+
+func (t tagOptionsMap) orderedKeys() []string {
+ var keys []string
+ for k := range t {
+ keys = append(keys, k)
+ }
+
+ sort.Slice(keys, func(a, b int) bool {
+ return t[keys[a]].order < t[keys[b]].order
+ })
+
+ return keys
+}
+
+type tagOption struct {
+ name string
+ customErrorMessage string
+ order int
+}
+
+// UnsupportedTypeError is a wrapper for reflect.Type
+type UnsupportedTypeError struct {
+ Type reflect.Type
+}
+
+// stringValues is a slice of reflect.Value holding *reflect.StringValue.
+// It implements the methods to sort by string.
+type stringValues []reflect.Value
+
+// InterfaceParamTagMap is a map of functions accept variants parameters for an interface value
+var InterfaceParamTagMap = map[string]InterfaceParamValidator{
+ "type": IsType,
+}
+
+// InterfaceParamTagRegexMap maps interface param tags to their respective regexes.
+var InterfaceParamTagRegexMap = map[string]*regexp.Regexp{
+ "type": regexp.MustCompile(`^type\((.*)\)$`),
+}
+
+// ParamTagMap is a map of functions accept variants parameters
+var ParamTagMap = map[string]ParamValidator{
+ "length": ByteLength,
+ "range": Range,
+ "runelength": RuneLength,
+ "stringlength": StringLength,
+ "matches": StringMatches,
+ "in": IsInRaw,
+ "rsapub": IsRsaPub,
+ "minstringlength": MinStringLength,
+ "maxstringlength": MaxStringLength,
+}
+
+// ParamTagRegexMap maps param tags to their respective regexes.
+var ParamTagRegexMap = map[string]*regexp.Regexp{
+ "range": regexp.MustCompile("^range\\((\\d+)\\|(\\d+)\\)$"),
+ "length": regexp.MustCompile("^length\\((\\d+)\\|(\\d+)\\)$"),
+ "runelength": regexp.MustCompile("^runelength\\((\\d+)\\|(\\d+)\\)$"),
+ "stringlength": regexp.MustCompile("^stringlength\\((\\d+)\\|(\\d+)\\)$"),
+ "in": regexp.MustCompile(`^in\((.*)\)`),
+ "matches": regexp.MustCompile(`^matches\((.+)\)$`),
+ "rsapub": regexp.MustCompile("^rsapub\\((\\d+)\\)$"),
+ "minstringlength": regexp.MustCompile("^minstringlength\\((\\d+)\\)$"),
+ "maxstringlength": regexp.MustCompile("^maxstringlength\\((\\d+)\\)$"),
+}
+
+type customTypeTagMap struct {
+ validators map[string]CustomTypeValidator
+
+ sync.RWMutex
+}
+
+func (tm *customTypeTagMap) Get(name string) (CustomTypeValidator, bool) {
+ tm.RLock()
+ defer tm.RUnlock()
+ v, ok := tm.validators[name]
+ return v, ok
+}
+
+func (tm *customTypeTagMap) Set(name string, ctv CustomTypeValidator) {
+ tm.Lock()
+ defer tm.Unlock()
+ tm.validators[name] = ctv
+}
+
+// CustomTypeTagMap is a map of functions that can be used as tags for ValidateStruct function.
+// Use this to validate compound or custom types that need to be handled as a whole, e.g.
+// `type UUID [16]byte` (this would be handled as an array of bytes).
+var CustomTypeTagMap = &customTypeTagMap{validators: make(map[string]CustomTypeValidator)}
+
+// TagMap is a map of functions, that can be used as tags for ValidateStruct function.
+var TagMap = map[string]Validator{
+ "email": IsEmail,
+ "url": IsURL,
+ "dialstring": IsDialString,
+ "requrl": IsRequestURL,
+ "requri": IsRequestURI,
+ "alpha": IsAlpha,
+ "utfletter": IsUTFLetter,
+ "alphanum": IsAlphanumeric,
+ "utfletternum": IsUTFLetterNumeric,
+ "numeric": IsNumeric,
+ "utfnumeric": IsUTFNumeric,
+ "utfdigit": IsUTFDigit,
+ "hexadecimal": IsHexadecimal,
+ "hexcolor": IsHexcolor,
+ "rgbcolor": IsRGBcolor,
+ "lowercase": IsLowerCase,
+ "uppercase": IsUpperCase,
+ "int": IsInt,
+ "float": IsFloat,
+ "null": IsNull,
+ "notnull": IsNotNull,
+ "uuid": IsUUID,
+ "uuidv3": IsUUIDv3,
+ "uuidv4": IsUUIDv4,
+ "uuidv5": IsUUIDv5,
+ "creditcard": IsCreditCard,
+ "isbn10": IsISBN10,
+ "isbn13": IsISBN13,
+ "json": IsJSON,
+ "multibyte": IsMultibyte,
+ "ascii": IsASCII,
+ "printableascii": IsPrintableASCII,
+ "fullwidth": IsFullWidth,
+ "halfwidth": IsHalfWidth,
+ "variablewidth": IsVariableWidth,
+ "base64": IsBase64,
+ "datauri": IsDataURI,
+ "ip": IsIP,
+ "port": IsPort,
+ "ipv4": IsIPv4,
+ "ipv6": IsIPv6,
+ "dns": IsDNSName,
+ "host": IsHost,
+ "mac": IsMAC,
+ "latitude": IsLatitude,
+ "longitude": IsLongitude,
+ "ssn": IsSSN,
+ "semver": IsSemver,
+ "rfc3339": IsRFC3339,
+ "rfc3339WithoutZone": IsRFC3339WithoutZone,
+ "ISO3166Alpha2": IsISO3166Alpha2,
+ "ISO3166Alpha3": IsISO3166Alpha3,
+ "ISO4217": IsISO4217,
+ "IMEI": IsIMEI,
+ "ulid": IsULID,
+}
+
+// ISO3166Entry stores country codes
+type ISO3166Entry struct {
+ EnglishShortName string
+ FrenchShortName string
+ Alpha2Code string
+ Alpha3Code string
+ Numeric string
+}
+
+//ISO3166List based on https://www.iso.org/obp/ui/#search/code/ Code Type "Officially Assigned Codes"
+var ISO3166List = []ISO3166Entry{
+ {"Afghanistan", "Afghanistan (l')", "AF", "AFG", "004"},
+ {"Albania", "Albanie (l')", "AL", "ALB", "008"},
+ {"Antarctica", "Antarctique (l')", "AQ", "ATA", "010"},
+ {"Algeria", "Algérie (l')", "DZ", "DZA", "012"},
+ {"American Samoa", "Samoa américaines (les)", "AS", "ASM", "016"},
+ {"Andorra", "Andorre (l')", "AD", "AND", "020"},
+ {"Angola", "Angola (l')", "AO", "AGO", "024"},
+ {"Antigua and Barbuda", "Antigua-et-Barbuda", "AG", "ATG", "028"},
+ {"Azerbaijan", "Azerbaïdjan (l')", "AZ", "AZE", "031"},
+ {"Argentina", "Argentine (l')", "AR", "ARG", "032"},
+ {"Australia", "Australie (l')", "AU", "AUS", "036"},
+ {"Austria", "Autriche (l')", "AT", "AUT", "040"},
+ {"Bahamas (the)", "Bahamas (les)", "BS", "BHS", "044"},
+ {"Bahrain", "Bahreïn", "BH", "BHR", "048"},
+ {"Bangladesh", "Bangladesh (le)", "BD", "BGD", "050"},
+ {"Armenia", "Arménie (l')", "AM", "ARM", "051"},
+ {"Barbados", "Barbade (la)", "BB", "BRB", "052"},
+ {"Belgium", "Belgique (la)", "BE", "BEL", "056"},
+ {"Bermuda", "Bermudes (les)", "BM", "BMU", "060"},
+ {"Bhutan", "Bhoutan (le)", "BT", "BTN", "064"},
+ {"Bolivia (Plurinational State of)", "Bolivie (État plurinational de)", "BO", "BOL", "068"},
+ {"Bosnia and Herzegovina", "Bosnie-Herzégovine (la)", "BA", "BIH", "070"},
+ {"Botswana", "Botswana (le)", "BW", "BWA", "072"},
+ {"Bouvet Island", "Bouvet (l'Île)", "BV", "BVT", "074"},
+ {"Brazil", "Brésil (le)", "BR", "BRA", "076"},
+ {"Belize", "Belize (le)", "BZ", "BLZ", "084"},
+ {"British Indian Ocean Territory (the)", "Indien (le Territoire britannique de l'océan)", "IO", "IOT", "086"},
+ {"Solomon Islands", "Salomon (Îles)", "SB", "SLB", "090"},
+ {"Virgin Islands (British)", "Vierges britanniques (les Îles)", "VG", "VGB", "092"},
+ {"Brunei Darussalam", "Brunéi Darussalam (le)", "BN", "BRN", "096"},
+ {"Bulgaria", "Bulgarie (la)", "BG", "BGR", "100"},
+ {"Myanmar", "Myanmar (le)", "MM", "MMR", "104"},
+ {"Burundi", "Burundi (le)", "BI", "BDI", "108"},
+ {"Belarus", "Bélarus (le)", "BY", "BLR", "112"},
+ {"Cambodia", "Cambodge (le)", "KH", "KHM", "116"},
+ {"Cameroon", "Cameroun (le)", "CM", "CMR", "120"},
+ {"Canada", "Canada (le)", "CA", "CAN", "124"},
+ {"Cabo Verde", "Cabo Verde", "CV", "CPV", "132"},
+ {"Cayman Islands (the)", "Caïmans (les Îles)", "KY", "CYM", "136"},
+ {"Central African Republic (the)", "République centrafricaine (la)", "CF", "CAF", "140"},
+ {"Sri Lanka", "Sri Lanka", "LK", "LKA", "144"},
+ {"Chad", "Tchad (le)", "TD", "TCD", "148"},
+ {"Chile", "Chili (le)", "CL", "CHL", "152"},
+ {"China", "Chine (la)", "CN", "CHN", "156"},
+ {"Taiwan (Province of China)", "Taïwan (Province de Chine)", "TW", "TWN", "158"},
+ {"Christmas Island", "Christmas (l'Île)", "CX", "CXR", "162"},
+ {"Cocos (Keeling) Islands (the)", "Cocos (les Îles)/ Keeling (les Îles)", "CC", "CCK", "166"},
+ {"Colombia", "Colombie (la)", "CO", "COL", "170"},
+ {"Comoros (the)", "Comores (les)", "KM", "COM", "174"},
+ {"Mayotte", "Mayotte", "YT", "MYT", "175"},
+ {"Congo (the)", "Congo (le)", "CG", "COG", "178"},
+ {"Congo (the Democratic Republic of the)", "Congo (la République démocratique du)", "CD", "COD", "180"},
+ {"Cook Islands (the)", "Cook (les Îles)", "CK", "COK", "184"},
+ {"Costa Rica", "Costa Rica (le)", "CR", "CRI", "188"},
+ {"Croatia", "Croatie (la)", "HR", "HRV", "191"},
+ {"Cuba", "Cuba", "CU", "CUB", "192"},
+ {"Cyprus", "Chypre", "CY", "CYP", "196"},
+ {"Czech Republic (the)", "tchèque (la République)", "CZ", "CZE", "203"},
+ {"Benin", "Bénin (le)", "BJ", "BEN", "204"},
+ {"Denmark", "Danemark (le)", "DK", "DNK", "208"},
+ {"Dominica", "Dominique (la)", "DM", "DMA", "212"},
+ {"Dominican Republic (the)", "dominicaine (la République)", "DO", "DOM", "214"},
+ {"Ecuador", "Équateur (l')", "EC", "ECU", "218"},
+ {"El Salvador", "El Salvador", "SV", "SLV", "222"},
+ {"Equatorial Guinea", "Guinée équatoriale (la)", "GQ", "GNQ", "226"},
+ {"Ethiopia", "Éthiopie (l')", "ET", "ETH", "231"},
+ {"Eritrea", "Érythrée (l')", "ER", "ERI", "232"},
+ {"Estonia", "Estonie (l')", "EE", "EST", "233"},
+ {"Faroe Islands (the)", "Féroé (les Îles)", "FO", "FRO", "234"},
+ {"Falkland Islands (the) [Malvinas]", "Falkland (les Îles)/Malouines (les Îles)", "FK", "FLK", "238"},
+ {"South Georgia and the South Sandwich Islands", "Géorgie du Sud-et-les Îles Sandwich du Sud (la)", "GS", "SGS", "239"},
+ {"Fiji", "Fidji (les)", "FJ", "FJI", "242"},
+ {"Finland", "Finlande (la)", "FI", "FIN", "246"},
+ {"Åland Islands", "Åland(les Îles)", "AX", "ALA", "248"},
+ {"France", "France (la)", "FR", "FRA", "250"},
+ {"French Guiana", "Guyane française (la )", "GF", "GUF", "254"},
+ {"French Polynesia", "Polynésie française (la)", "PF", "PYF", "258"},
+ {"French Southern Territories (the)", "Terres australes françaises (les)", "TF", "ATF", "260"},
+ {"Djibouti", "Djibouti", "DJ", "DJI", "262"},
+ {"Gabon", "Gabon (le)", "GA", "GAB", "266"},
+ {"Georgia", "Géorgie (la)", "GE", "GEO", "268"},
+ {"Gambia (the)", "Gambie (la)", "GM", "GMB", "270"},
+ {"Palestine, State of", "Palestine, État de", "PS", "PSE", "275"},
+ {"Germany", "Allemagne (l')", "DE", "DEU", "276"},
+ {"Ghana", "Ghana (le)", "GH", "GHA", "288"},
+ {"Gibraltar", "Gibraltar", "GI", "GIB", "292"},
+ {"Kiribati", "Kiribati", "KI", "KIR", "296"},
+ {"Greece", "Grèce (la)", "GR", "GRC", "300"},
+ {"Greenland", "Groenland (le)", "GL", "GRL", "304"},
+ {"Grenada", "Grenade (la)", "GD", "GRD", "308"},
+ {"Guadeloupe", "Guadeloupe (la)", "GP", "GLP", "312"},
+ {"Guam", "Guam", "GU", "GUM", "316"},
+ {"Guatemala", "Guatemala (le)", "GT", "GTM", "320"},
+ {"Guinea", "Guinée (la)", "GN", "GIN", "324"},
+ {"Guyana", "Guyana (le)", "GY", "GUY", "328"},
+ {"Haiti", "Haïti", "HT", "HTI", "332"},
+ {"Heard Island and McDonald Islands", "Heard-et-Îles MacDonald (l'Île)", "HM", "HMD", "334"},
+ {"Holy See (the)", "Saint-Siège (le)", "VA", "VAT", "336"},
+ {"Honduras", "Honduras (le)", "HN", "HND", "340"},
+ {"Hong Kong", "Hong Kong", "HK", "HKG", "344"},
+ {"Hungary", "Hongrie (la)", "HU", "HUN", "348"},
+ {"Iceland", "Islande (l')", "IS", "ISL", "352"},
+ {"India", "Inde (l')", "IN", "IND", "356"},
+ {"Indonesia", "Indonésie (l')", "ID", "IDN", "360"},
+ {"Iran (Islamic Republic of)", "Iran (République Islamique d')", "IR", "IRN", "364"},
+ {"Iraq", "Iraq (l')", "IQ", "IRQ", "368"},
+ {"Ireland", "Irlande (l')", "IE", "IRL", "372"},
+ {"Israel", "Israël", "IL", "ISR", "376"},
+ {"Italy", "Italie (l')", "IT", "ITA", "380"},
+ {"Côte d'Ivoire", "Côte d'Ivoire (la)", "CI", "CIV", "384"},
+ {"Jamaica", "Jamaïque (la)", "JM", "JAM", "388"},
+ {"Japan", "Japon (le)", "JP", "JPN", "392"},
+ {"Kazakhstan", "Kazakhstan (le)", "KZ", "KAZ", "398"},
+ {"Jordan", "Jordanie (la)", "JO", "JOR", "400"},
+ {"Kenya", "Kenya (le)", "KE", "KEN", "404"},
+ {"Korea (the Democratic People's Republic of)", "Corée (la République populaire démocratique de)", "KP", "PRK", "408"},
+ {"Korea (the Republic of)", "Corée (la République de)", "KR", "KOR", "410"},
+ {"Kuwait", "Koweït (le)", "KW", "KWT", "414"},
+ {"Kyrgyzstan", "Kirghizistan (le)", "KG", "KGZ", "417"},
+ {"Lao People's Democratic Republic (the)", "Lao, République démocratique populaire", "LA", "LAO", "418"},
+ {"Lebanon", "Liban (le)", "LB", "LBN", "422"},
+ {"Lesotho", "Lesotho (le)", "LS", "LSO", "426"},
+ {"Latvia", "Lettonie (la)", "LV", "LVA", "428"},
+ {"Liberia", "Libéria (le)", "LR", "LBR", "430"},
+ {"Libya", "Libye (la)", "LY", "LBY", "434"},
+ {"Liechtenstein", "Liechtenstein (le)", "LI", "LIE", "438"},
+ {"Lithuania", "Lituanie (la)", "LT", "LTU", "440"},
+ {"Luxembourg", "Luxembourg (le)", "LU", "LUX", "442"},
+ {"Macao", "Macao", "MO", "MAC", "446"},
+ {"Madagascar", "Madagascar", "MG", "MDG", "450"},
+ {"Malawi", "Malawi (le)", "MW", "MWI", "454"},
+ {"Malaysia", "Malaisie (la)", "MY", "MYS", "458"},
+ {"Maldives", "Maldives (les)", "MV", "MDV", "462"},
+ {"Mali", "Mali (le)", "ML", "MLI", "466"},
+ {"Malta", "Malte", "MT", "MLT", "470"},
+ {"Martinique", "Martinique (la)", "MQ", "MTQ", "474"},
+ {"Mauritania", "Mauritanie (la)", "MR", "MRT", "478"},
+ {"Mauritius", "Maurice", "MU", "MUS", "480"},
+ {"Mexico", "Mexique (le)", "MX", "MEX", "484"},
+ {"Monaco", "Monaco", "MC", "MCO", "492"},
+ {"Mongolia", "Mongolie (la)", "MN", "MNG", "496"},
+ {"Moldova (the Republic of)", "Moldova , République de", "MD", "MDA", "498"},
+ {"Montenegro", "Monténégro (le)", "ME", "MNE", "499"},
+ {"Montserrat", "Montserrat", "MS", "MSR", "500"},
+ {"Morocco", "Maroc (le)", "MA", "MAR", "504"},
+ {"Mozambique", "Mozambique (le)", "MZ", "MOZ", "508"},
+ {"Oman", "Oman", "OM", "OMN", "512"},
+ {"Namibia", "Namibie (la)", "NA", "NAM", "516"},
+ {"Nauru", "Nauru", "NR", "NRU", "520"},
+ {"Nepal", "Népal (le)", "NP", "NPL", "524"},
+ {"Netherlands (the)", "Pays-Bas (les)", "NL", "NLD", "528"},
+ {"Curaçao", "Curaçao", "CW", "CUW", "531"},
+ {"Aruba", "Aruba", "AW", "ABW", "533"},
+ {"Sint Maarten (Dutch part)", "Saint-Martin (partie néerlandaise)", "SX", "SXM", "534"},
+ {"Bonaire, Sint Eustatius and Saba", "Bonaire, Saint-Eustache et Saba", "BQ", "BES", "535"},
+ {"New Caledonia", "Nouvelle-Calédonie (la)", "NC", "NCL", "540"},
+ {"Vanuatu", "Vanuatu (le)", "VU", "VUT", "548"},
+ {"New Zealand", "Nouvelle-Zélande (la)", "NZ", "NZL", "554"},
+ {"Nicaragua", "Nicaragua (le)", "NI", "NIC", "558"},
+ {"Niger (the)", "Niger (le)", "NE", "NER", "562"},
+ {"Nigeria", "Nigéria (le)", "NG", "NGA", "566"},
+ {"Niue", "Niue", "NU", "NIU", "570"},
+ {"Norfolk Island", "Norfolk (l'Île)", "NF", "NFK", "574"},
+ {"Norway", "Norvège (la)", "NO", "NOR", "578"},
+ {"Northern Mariana Islands (the)", "Mariannes du Nord (les Îles)", "MP", "MNP", "580"},
+ {"United States Minor Outlying Islands (the)", "Îles mineures éloignées des États-Unis (les)", "UM", "UMI", "581"},
+ {"Micronesia (Federated States of)", "Micronésie (États fédérés de)", "FM", "FSM", "583"},
+ {"Marshall Islands (the)", "Marshall (Îles)", "MH", "MHL", "584"},
+ {"Palau", "Palaos (les)", "PW", "PLW", "585"},
+ {"Pakistan", "Pakistan (le)", "PK", "PAK", "586"},
+ {"Panama", "Panama (le)", "PA", "PAN", "591"},
+ {"Papua New Guinea", "Papouasie-Nouvelle-Guinée (la)", "PG", "PNG", "598"},
+ {"Paraguay", "Paraguay (le)", "PY", "PRY", "600"},
+ {"Peru", "Pérou (le)", "PE", "PER", "604"},
+ {"Philippines (the)", "Philippines (les)", "PH", "PHL", "608"},
+ {"Pitcairn", "Pitcairn", "PN", "PCN", "612"},
+ {"Poland", "Pologne (la)", "PL", "POL", "616"},
+ {"Portugal", "Portugal (le)", "PT", "PRT", "620"},
+ {"Guinea-Bissau", "Guinée-Bissau (la)", "GW", "GNB", "624"},
+ {"Timor-Leste", "Timor-Leste (le)", "TL", "TLS", "626"},
+ {"Puerto Rico", "Porto Rico", "PR", "PRI", "630"},
+ {"Qatar", "Qatar (le)", "QA", "QAT", "634"},
+ {"Réunion", "Réunion (La)", "RE", "REU", "638"},
+ {"Romania", "Roumanie (la)", "RO", "ROU", "642"},
+ {"Russian Federation (the)", "Russie (la Fédération de)", "RU", "RUS", "643"},
+ {"Rwanda", "Rwanda (le)", "RW", "RWA", "646"},
+ {"Saint Barthélemy", "Saint-Barthélemy", "BL", "BLM", "652"},
+ {"Saint Helena, Ascension and Tristan da Cunha", "Sainte-Hélène, Ascension et Tristan da Cunha", "SH", "SHN", "654"},
+ {"Saint Kitts and Nevis", "Saint-Kitts-et-Nevis", "KN", "KNA", "659"},
+ {"Anguilla", "Anguilla", "AI", "AIA", "660"},
+ {"Saint Lucia", "Sainte-Lucie", "LC", "LCA", "662"},
+ {"Saint Martin (French part)", "Saint-Martin (partie française)", "MF", "MAF", "663"},
+ {"Saint Pierre and Miquelon", "Saint-Pierre-et-Miquelon", "PM", "SPM", "666"},
+ {"Saint Vincent and the Grenadines", "Saint-Vincent-et-les Grenadines", "VC", "VCT", "670"},
+ {"San Marino", "Saint-Marin", "SM", "SMR", "674"},
+ {"Sao Tome and Principe", "Sao Tomé-et-Principe", "ST", "STP", "678"},
+ {"Saudi Arabia", "Arabie saoudite (l')", "SA", "SAU", "682"},
+ {"Senegal", "Sénégal (le)", "SN", "SEN", "686"},
+ {"Serbia", "Serbie (la)", "RS", "SRB", "688"},
+ {"Seychelles", "Seychelles (les)", "SC", "SYC", "690"},
+ {"Sierra Leone", "Sierra Leone (la)", "SL", "SLE", "694"},
+ {"Singapore", "Singapour", "SG", "SGP", "702"},
+ {"Slovakia", "Slovaquie (la)", "SK", "SVK", "703"},
+ {"Viet Nam", "Viet Nam (le)", "VN", "VNM", "704"},
+ {"Slovenia", "Slovénie (la)", "SI", "SVN", "705"},
+ {"Somalia", "Somalie (la)", "SO", "SOM", "706"},
+ {"South Africa", "Afrique du Sud (l')", "ZA", "ZAF", "710"},
+ {"Zimbabwe", "Zimbabwe (le)", "ZW", "ZWE", "716"},
+ {"Spain", "Espagne (l')", "ES", "ESP", "724"},
+ {"South Sudan", "Soudan du Sud (le)", "SS", "SSD", "728"},
+ {"Sudan (the)", "Soudan (le)", "SD", "SDN", "729"},
+ {"Western Sahara*", "Sahara occidental (le)*", "EH", "ESH", "732"},
+ {"Suriname", "Suriname (le)", "SR", "SUR", "740"},
+ {"Svalbard and Jan Mayen", "Svalbard et l'Île Jan Mayen (le)", "SJ", "SJM", "744"},
+ {"Swaziland", "Swaziland (le)", "SZ", "SWZ", "748"},
+ {"Sweden", "Suède (la)", "SE", "SWE", "752"},
+ {"Switzerland", "Suisse (la)", "CH", "CHE", "756"},
+ {"Syrian Arab Republic", "République arabe syrienne (la)", "SY", "SYR", "760"},
+ {"Tajikistan", "Tadjikistan (le)", "TJ", "TJK", "762"},
+ {"Thailand", "Thaïlande (la)", "TH", "THA", "764"},
+ {"Togo", "Togo (le)", "TG", "TGO", "768"},
+ {"Tokelau", "Tokelau (les)", "TK", "TKL", "772"},
+ {"Tonga", "Tonga (les)", "TO", "TON", "776"},
+ {"Trinidad and Tobago", "Trinité-et-Tobago (la)", "TT", "TTO", "780"},
+ {"United Arab Emirates (the)", "Émirats arabes unis (les)", "AE", "ARE", "784"},
+ {"Tunisia", "Tunisie (la)", "TN", "TUN", "788"},
+ {"Turkey", "Turquie (la)", "TR", "TUR", "792"},
+ {"Turkmenistan", "Turkménistan (le)", "TM", "TKM", "795"},
+ {"Turks and Caicos Islands (the)", "Turks-et-Caïcos (les Îles)", "TC", "TCA", "796"},
+ {"Tuvalu", "Tuvalu (les)", "TV", "TUV", "798"},
+ {"Uganda", "Ouganda (l')", "UG", "UGA", "800"},
+ {"Ukraine", "Ukraine (l')", "UA", "UKR", "804"},
+ {"Macedonia (the former Yugoslav Republic of)", "Macédoine (l'ex‑République yougoslave de)", "MK", "MKD", "807"},
+ {"Egypt", "Égypte (l')", "EG", "EGY", "818"},
+ {"United Kingdom of Great Britain and Northern Ireland (the)", "Royaume-Uni de Grande-Bretagne et d'Irlande du Nord (le)", "GB", "GBR", "826"},
+ {"Guernsey", "Guernesey", "GG", "GGY", "831"},
+ {"Jersey", "Jersey", "JE", "JEY", "832"},
+ {"Isle of Man", "Île de Man", "IM", "IMN", "833"},
+ {"Tanzania, United Republic of", "Tanzanie, République-Unie de", "TZ", "TZA", "834"},
+ {"United States of America (the)", "États-Unis d'Amérique (les)", "US", "USA", "840"},
+ {"Virgin Islands (U.S.)", "Vierges des États-Unis (les Îles)", "VI", "VIR", "850"},
+ {"Burkina Faso", "Burkina Faso (le)", "BF", "BFA", "854"},
+ {"Uruguay", "Uruguay (l')", "UY", "URY", "858"},
+ {"Uzbekistan", "Ouzbékistan (l')", "UZ", "UZB", "860"},
+ {"Venezuela (Bolivarian Republic of)", "Venezuela (République bolivarienne du)", "VE", "VEN", "862"},
+ {"Wallis and Futuna", "Wallis-et-Futuna", "WF", "WLF", "876"},
+ {"Samoa", "Samoa (le)", "WS", "WSM", "882"},
+ {"Yemen", "Yémen (le)", "YE", "YEM", "887"},
+ {"Zambia", "Zambie (la)", "ZM", "ZMB", "894"},
+}
+
+// ISO4217List is the list of ISO currency codes
+var ISO4217List = []string{
+ "AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN",
+ "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BOV", "BRL", "BSD", "BTN", "BWP", "BYN", "BZD",
+ "CAD", "CDF", "CHE", "CHF", "CHW", "CLF", "CLP", "CNY", "COP", "COU", "CRC", "CUC", "CUP", "CVE", "CZK",
+ "DJF", "DKK", "DOP", "DZD",
+ "EGP", "ERN", "ETB", "EUR",
+ "FJD", "FKP",
+ "GBP", "GEL", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD",
+ "HKD", "HNL", "HRK", "HTG", "HUF",
+ "IDR", "ILS", "INR", "IQD", "IRR", "ISK",
+ "JMD", "JOD", "JPY",
+ "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT",
+ "LAK", "LBP", "LKR", "LRD", "LSL", "LYD",
+ "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MXV", "MYR", "MZN",
+ "NAD", "NGN", "NIO", "NOK", "NPR", "NZD",
+ "OMR",
+ "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG",
+ "QAR",
+ "RON", "RSD", "RUB", "RWF",
+ "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLL", "SOS", "SRD", "SSP", "STD", "STN", "SVC", "SYP", "SZL",
+ "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TWD", "TZS",
+ "UAH", "UGX", "USD", "USN", "UYI", "UYU", "UYW", "UZS",
+ "VEF", "VES", "VND", "VUV",
+ "WST",
+ "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XOF", "XPD", "XPF", "XPT", "XSU", "XTS", "XUA", "XXX",
+ "YER",
+ "ZAR", "ZMW", "ZWL",
+}
+
+// ISO693Entry stores ISO language codes
+type ISO693Entry struct {
+ Alpha3bCode string
+ Alpha2Code string
+ English string
+}
+
+//ISO693List based on http://data.okfn.org/data/core/language-codes/r/language-codes-3b2.json
+var ISO693List = []ISO693Entry{
+ {Alpha3bCode: "aar", Alpha2Code: "aa", English: "Afar"},
+ {Alpha3bCode: "abk", Alpha2Code: "ab", English: "Abkhazian"},
+ {Alpha3bCode: "afr", Alpha2Code: "af", English: "Afrikaans"},
+ {Alpha3bCode: "aka", Alpha2Code: "ak", English: "Akan"},
+ {Alpha3bCode: "alb", Alpha2Code: "sq", English: "Albanian"},
+ {Alpha3bCode: "amh", Alpha2Code: "am", English: "Amharic"},
+ {Alpha3bCode: "ara", Alpha2Code: "ar", English: "Arabic"},
+ {Alpha3bCode: "arg", Alpha2Code: "an", English: "Aragonese"},
+ {Alpha3bCode: "arm", Alpha2Code: "hy", English: "Armenian"},
+ {Alpha3bCode: "asm", Alpha2Code: "as", English: "Assamese"},
+ {Alpha3bCode: "ava", Alpha2Code: "av", English: "Avaric"},
+ {Alpha3bCode: "ave", Alpha2Code: "ae", English: "Avestan"},
+ {Alpha3bCode: "aym", Alpha2Code: "ay", English: "Aymara"},
+ {Alpha3bCode: "aze", Alpha2Code: "az", English: "Azerbaijani"},
+ {Alpha3bCode: "bak", Alpha2Code: "ba", English: "Bashkir"},
+ {Alpha3bCode: "bam", Alpha2Code: "bm", English: "Bambara"},
+ {Alpha3bCode: "baq", Alpha2Code: "eu", English: "Basque"},
+ {Alpha3bCode: "bel", Alpha2Code: "be", English: "Belarusian"},
+ {Alpha3bCode: "ben", Alpha2Code: "bn", English: "Bengali"},
+ {Alpha3bCode: "bih", Alpha2Code: "bh", English: "Bihari languages"},
+ {Alpha3bCode: "bis", Alpha2Code: "bi", English: "Bislama"},
+ {Alpha3bCode: "bos", Alpha2Code: "bs", English: "Bosnian"},
+ {Alpha3bCode: "bre", Alpha2Code: "br", English: "Breton"},
+ {Alpha3bCode: "bul", Alpha2Code: "bg", English: "Bulgarian"},
+ {Alpha3bCode: "bur", Alpha2Code: "my", English: "Burmese"},
+ {Alpha3bCode: "cat", Alpha2Code: "ca", English: "Catalan; Valencian"},
+ {Alpha3bCode: "cha", Alpha2Code: "ch", English: "Chamorro"},
+ {Alpha3bCode: "che", Alpha2Code: "ce", English: "Chechen"},
+ {Alpha3bCode: "chi", Alpha2Code: "zh", English: "Chinese"},
+ {Alpha3bCode: "chu", Alpha2Code: "cu", English: "Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic"},
+ {Alpha3bCode: "chv", Alpha2Code: "cv", English: "Chuvash"},
+ {Alpha3bCode: "cor", Alpha2Code: "kw", English: "Cornish"},
+ {Alpha3bCode: "cos", Alpha2Code: "co", English: "Corsican"},
+ {Alpha3bCode: "cre", Alpha2Code: "cr", English: "Cree"},
+ {Alpha3bCode: "cze", Alpha2Code: "cs", English: "Czech"},
+ {Alpha3bCode: "dan", Alpha2Code: "da", English: "Danish"},
+ {Alpha3bCode: "div", Alpha2Code: "dv", English: "Divehi; Dhivehi; Maldivian"},
+ {Alpha3bCode: "dut", Alpha2Code: "nl", English: "Dutch; Flemish"},
+ {Alpha3bCode: "dzo", Alpha2Code: "dz", English: "Dzongkha"},
+ {Alpha3bCode: "eng", Alpha2Code: "en", English: "English"},
+ {Alpha3bCode: "epo", Alpha2Code: "eo", English: "Esperanto"},
+ {Alpha3bCode: "est", Alpha2Code: "et", English: "Estonian"},
+ {Alpha3bCode: "ewe", Alpha2Code: "ee", English: "Ewe"},
+ {Alpha3bCode: "fao", Alpha2Code: "fo", English: "Faroese"},
+ {Alpha3bCode: "fij", Alpha2Code: "fj", English: "Fijian"},
+ {Alpha3bCode: "fin", Alpha2Code: "fi", English: "Finnish"},
+ {Alpha3bCode: "fre", Alpha2Code: "fr", English: "French"},
+ {Alpha3bCode: "fry", Alpha2Code: "fy", English: "Western Frisian"},
+ {Alpha3bCode: "ful", Alpha2Code: "ff", English: "Fulah"},
+ {Alpha3bCode: "geo", Alpha2Code: "ka", English: "Georgian"},
+ {Alpha3bCode: "ger", Alpha2Code: "de", English: "German"},
+ {Alpha3bCode: "gla", Alpha2Code: "gd", English: "Gaelic; Scottish Gaelic"},
+ {Alpha3bCode: "gle", Alpha2Code: "ga", English: "Irish"},
+ {Alpha3bCode: "glg", Alpha2Code: "gl", English: "Galician"},
+ {Alpha3bCode: "glv", Alpha2Code: "gv", English: "Manx"},
+ {Alpha3bCode: "gre", Alpha2Code: "el", English: "Greek, Modern (1453-)"},
+ {Alpha3bCode: "grn", Alpha2Code: "gn", English: "Guarani"},
+ {Alpha3bCode: "guj", Alpha2Code: "gu", English: "Gujarati"},
+ {Alpha3bCode: "hat", Alpha2Code: "ht", English: "Haitian; Haitian Creole"},
+ {Alpha3bCode: "hau", Alpha2Code: "ha", English: "Hausa"},
+ {Alpha3bCode: "heb", Alpha2Code: "he", English: "Hebrew"},
+ {Alpha3bCode: "her", Alpha2Code: "hz", English: "Herero"},
+ {Alpha3bCode: "hin", Alpha2Code: "hi", English: "Hindi"},
+ {Alpha3bCode: "hmo", Alpha2Code: "ho", English: "Hiri Motu"},
+ {Alpha3bCode: "hrv", Alpha2Code: "hr", English: "Croatian"},
+ {Alpha3bCode: "hun", Alpha2Code: "hu", English: "Hungarian"},
+ {Alpha3bCode: "ibo", Alpha2Code: "ig", English: "Igbo"},
+ {Alpha3bCode: "ice", Alpha2Code: "is", English: "Icelandic"},
+ {Alpha3bCode: "ido", Alpha2Code: "io", English: "Ido"},
+ {Alpha3bCode: "iii", Alpha2Code: "ii", English: "Sichuan Yi; Nuosu"},
+ {Alpha3bCode: "iku", Alpha2Code: "iu", English: "Inuktitut"},
+ {Alpha3bCode: "ile", Alpha2Code: "ie", English: "Interlingue; Occidental"},
+ {Alpha3bCode: "ina", Alpha2Code: "ia", English: "Interlingua (International Auxiliary Language Association)"},
+ {Alpha3bCode: "ind", Alpha2Code: "id", English: "Indonesian"},
+ {Alpha3bCode: "ipk", Alpha2Code: "ik", English: "Inupiaq"},
+ {Alpha3bCode: "ita", Alpha2Code: "it", English: "Italian"},
+ {Alpha3bCode: "jav", Alpha2Code: "jv", English: "Javanese"},
+ {Alpha3bCode: "jpn", Alpha2Code: "ja", English: "Japanese"},
+ {Alpha3bCode: "kal", Alpha2Code: "kl", English: "Kalaallisut; Greenlandic"},
+ {Alpha3bCode: "kan", Alpha2Code: "kn", English: "Kannada"},
+ {Alpha3bCode: "kas", Alpha2Code: "ks", English: "Kashmiri"},
+ {Alpha3bCode: "kau", Alpha2Code: "kr", English: "Kanuri"},
+ {Alpha3bCode: "kaz", Alpha2Code: "kk", English: "Kazakh"},
+ {Alpha3bCode: "khm", Alpha2Code: "km", English: "Central Khmer"},
+ {Alpha3bCode: "kik", Alpha2Code: "ki", English: "Kikuyu; Gikuyu"},
+ {Alpha3bCode: "kin", Alpha2Code: "rw", English: "Kinyarwanda"},
+ {Alpha3bCode: "kir", Alpha2Code: "ky", English: "Kirghiz; Kyrgyz"},
+ {Alpha3bCode: "kom", Alpha2Code: "kv", English: "Komi"},
+ {Alpha3bCode: "kon", Alpha2Code: "kg", English: "Kongo"},
+ {Alpha3bCode: "kor", Alpha2Code: "ko", English: "Korean"},
+ {Alpha3bCode: "kua", Alpha2Code: "kj", English: "Kuanyama; Kwanyama"},
+ {Alpha3bCode: "kur", Alpha2Code: "ku", English: "Kurdish"},
+ {Alpha3bCode: "lao", Alpha2Code: "lo", English: "Lao"},
+ {Alpha3bCode: "lat", Alpha2Code: "la", English: "Latin"},
+ {Alpha3bCode: "lav", Alpha2Code: "lv", English: "Latvian"},
+ {Alpha3bCode: "lim", Alpha2Code: "li", English: "Limburgan; Limburger; Limburgish"},
+ {Alpha3bCode: "lin", Alpha2Code: "ln", English: "Lingala"},
+ {Alpha3bCode: "lit", Alpha2Code: "lt", English: "Lithuanian"},
+ {Alpha3bCode: "ltz", Alpha2Code: "lb", English: "Luxembourgish; Letzeburgesch"},
+ {Alpha3bCode: "lub", Alpha2Code: "lu", English: "Luba-Katanga"},
+ {Alpha3bCode: "lug", Alpha2Code: "lg", English: "Ganda"},
+ {Alpha3bCode: "mac", Alpha2Code: "mk", English: "Macedonian"},
+ {Alpha3bCode: "mah", Alpha2Code: "mh", English: "Marshallese"},
+ {Alpha3bCode: "mal", Alpha2Code: "ml", English: "Malayalam"},
+ {Alpha3bCode: "mao", Alpha2Code: "mi", English: "Maori"},
+ {Alpha3bCode: "mar", Alpha2Code: "mr", English: "Marathi"},
+ {Alpha3bCode: "may", Alpha2Code: "ms", English: "Malay"},
+ {Alpha3bCode: "mlg", Alpha2Code: "mg", English: "Malagasy"},
+ {Alpha3bCode: "mlt", Alpha2Code: "mt", English: "Maltese"},
+ {Alpha3bCode: "mon", Alpha2Code: "mn", English: "Mongolian"},
+ {Alpha3bCode: "nau", Alpha2Code: "na", English: "Nauru"},
+ {Alpha3bCode: "nav", Alpha2Code: "nv", English: "Navajo; Navaho"},
+ {Alpha3bCode: "nbl", Alpha2Code: "nr", English: "Ndebele, South; South Ndebele"},
+ {Alpha3bCode: "nde", Alpha2Code: "nd", English: "Ndebele, North; North Ndebele"},
+ {Alpha3bCode: "ndo", Alpha2Code: "ng", English: "Ndonga"},
+ {Alpha3bCode: "nep", Alpha2Code: "ne", English: "Nepali"},
+ {Alpha3bCode: "nno", Alpha2Code: "nn", English: "Norwegian Nynorsk; Nynorsk, Norwegian"},
+ {Alpha3bCode: "nob", Alpha2Code: "nb", English: "Bokmål, Norwegian; Norwegian Bokmål"},
+ {Alpha3bCode: "nor", Alpha2Code: "no", English: "Norwegian"},
+ {Alpha3bCode: "nya", Alpha2Code: "ny", English: "Chichewa; Chewa; Nyanja"},
+ {Alpha3bCode: "oci", Alpha2Code: "oc", English: "Occitan (post 1500); Provençal"},
+ {Alpha3bCode: "oji", Alpha2Code: "oj", English: "Ojibwa"},
+ {Alpha3bCode: "ori", Alpha2Code: "or", English: "Oriya"},
+ {Alpha3bCode: "orm", Alpha2Code: "om", English: "Oromo"},
+ {Alpha3bCode: "oss", Alpha2Code: "os", English: "Ossetian; Ossetic"},
+ {Alpha3bCode: "pan", Alpha2Code: "pa", English: "Panjabi; Punjabi"},
+ {Alpha3bCode: "per", Alpha2Code: "fa", English: "Persian"},
+ {Alpha3bCode: "pli", Alpha2Code: "pi", English: "Pali"},
+ {Alpha3bCode: "pol", Alpha2Code: "pl", English: "Polish"},
+ {Alpha3bCode: "por", Alpha2Code: "pt", English: "Portuguese"},
+ {Alpha3bCode: "pus", Alpha2Code: "ps", English: "Pushto; Pashto"},
+ {Alpha3bCode: "que", Alpha2Code: "qu", English: "Quechua"},
+ {Alpha3bCode: "roh", Alpha2Code: "rm", English: "Romansh"},
+ {Alpha3bCode: "rum", Alpha2Code: "ro", English: "Romanian; Moldavian; Moldovan"},
+ {Alpha3bCode: "run", Alpha2Code: "rn", English: "Rundi"},
+ {Alpha3bCode: "rus", Alpha2Code: "ru", English: "Russian"},
+ {Alpha3bCode: "sag", Alpha2Code: "sg", English: "Sango"},
+ {Alpha3bCode: "san", Alpha2Code: "sa", English: "Sanskrit"},
+ {Alpha3bCode: "sin", Alpha2Code: "si", English: "Sinhala; Sinhalese"},
+ {Alpha3bCode: "slo", Alpha2Code: "sk", English: "Slovak"},
+ {Alpha3bCode: "slv", Alpha2Code: "sl", English: "Slovenian"},
+ {Alpha3bCode: "sme", Alpha2Code: "se", English: "Northern Sami"},
+ {Alpha3bCode: "smo", Alpha2Code: "sm", English: "Samoan"},
+ {Alpha3bCode: "sna", Alpha2Code: "sn", English: "Shona"},
+ {Alpha3bCode: "snd", Alpha2Code: "sd", English: "Sindhi"},
+ {Alpha3bCode: "som", Alpha2Code: "so", English: "Somali"},
+ {Alpha3bCode: "sot", Alpha2Code: "st", English: "Sotho, Southern"},
+ {Alpha3bCode: "spa", Alpha2Code: "es", English: "Spanish; Castilian"},
+ {Alpha3bCode: "srd", Alpha2Code: "sc", English: "Sardinian"},
+ {Alpha3bCode: "srp", Alpha2Code: "sr", English: "Serbian"},
+ {Alpha3bCode: "ssw", Alpha2Code: "ss", English: "Swati"},
+ {Alpha3bCode: "sun", Alpha2Code: "su", English: "Sundanese"},
+ {Alpha3bCode: "swa", Alpha2Code: "sw", English: "Swahili"},
+ {Alpha3bCode: "swe", Alpha2Code: "sv", English: "Swedish"},
+ {Alpha3bCode: "tah", Alpha2Code: "ty", English: "Tahitian"},
+ {Alpha3bCode: "tam", Alpha2Code: "ta", English: "Tamil"},
+ {Alpha3bCode: "tat", Alpha2Code: "tt", English: "Tatar"},
+ {Alpha3bCode: "tel", Alpha2Code: "te", English: "Telugu"},
+ {Alpha3bCode: "tgk", Alpha2Code: "tg", English: "Tajik"},
+ {Alpha3bCode: "tgl", Alpha2Code: "tl", English: "Tagalog"},
+ {Alpha3bCode: "tha", Alpha2Code: "th", English: "Thai"},
+ {Alpha3bCode: "tib", Alpha2Code: "bo", English: "Tibetan"},
+ {Alpha3bCode: "tir", Alpha2Code: "ti", English: "Tigrinya"},
+ {Alpha3bCode: "ton", Alpha2Code: "to", English: "Tonga (Tonga Islands)"},
+ {Alpha3bCode: "tsn", Alpha2Code: "tn", English: "Tswana"},
+ {Alpha3bCode: "tso", Alpha2Code: "ts", English: "Tsonga"},
+ {Alpha3bCode: "tuk", Alpha2Code: "tk", English: "Turkmen"},
+ {Alpha3bCode: "tur", Alpha2Code: "tr", English: "Turkish"},
+ {Alpha3bCode: "twi", Alpha2Code: "tw", English: "Twi"},
+ {Alpha3bCode: "uig", Alpha2Code: "ug", English: "Uighur; Uyghur"},
+ {Alpha3bCode: "ukr", Alpha2Code: "uk", English: "Ukrainian"},
+ {Alpha3bCode: "urd", Alpha2Code: "ur", English: "Urdu"},
+ {Alpha3bCode: "uzb", Alpha2Code: "uz", English: "Uzbek"},
+ {Alpha3bCode: "ven", Alpha2Code: "ve", English: "Venda"},
+ {Alpha3bCode: "vie", Alpha2Code: "vi", English: "Vietnamese"},
+ {Alpha3bCode: "vol", Alpha2Code: "vo", English: "Volapük"},
+ {Alpha3bCode: "wel", Alpha2Code: "cy", English: "Welsh"},
+ {Alpha3bCode: "wln", Alpha2Code: "wa", English: "Walloon"},
+ {Alpha3bCode: "wol", Alpha2Code: "wo", English: "Wolof"},
+ {Alpha3bCode: "xho", Alpha2Code: "xh", English: "Xhosa"},
+ {Alpha3bCode: "yid", Alpha2Code: "yi", English: "Yiddish"},
+ {Alpha3bCode: "yor", Alpha2Code: "yo", English: "Yoruba"},
+ {Alpha3bCode: "zha", Alpha2Code: "za", English: "Zhuang; Chuang"},
+ {Alpha3bCode: "zul", Alpha2Code: "zu", English: "Zulu"},
+}
diff --git a/vendor/github.com/asaskevich/govalidator/utils.go b/vendor/github.com/asaskevich/govalidator/utils.go
new file mode 100644
index 0000000000..f4c30f824a
--- /dev/null
+++ b/vendor/github.com/asaskevich/govalidator/utils.go
@@ -0,0 +1,270 @@
+package govalidator
+
+import (
+ "errors"
+ "fmt"
+ "html"
+ "math"
+ "path"
+ "regexp"
+ "strings"
+ "unicode"
+ "unicode/utf8"
+)
+
+// Contains checks if the string contains the substring.
+func Contains(str, substring string) bool {
+ return strings.Contains(str, substring)
+}
+
+// Matches checks if string matches the pattern (pattern is regular expression)
+// In case of error return false
+func Matches(str, pattern string) bool {
+ match, _ := regexp.MatchString(pattern, str)
+ return match
+}
+
+// LeftTrim trims characters from the left side of the input.
+// If second argument is empty, it will remove leading spaces.
+func LeftTrim(str, chars string) string {
+ if chars == "" {
+ return strings.TrimLeftFunc(str, unicode.IsSpace)
+ }
+ r, _ := regexp.Compile("^[" + chars + "]+")
+ return r.ReplaceAllString(str, "")
+}
+
+// RightTrim trims characters from the right side of the input.
+// If second argument is empty, it will remove trailing spaces.
+func RightTrim(str, chars string) string {
+ if chars == "" {
+ return strings.TrimRightFunc(str, unicode.IsSpace)
+ }
+ r, _ := regexp.Compile("[" + chars + "]+$")
+ return r.ReplaceAllString(str, "")
+}
+
+// Trim trims characters from both sides of the input.
+// If second argument is empty, it will remove spaces.
+func Trim(str, chars string) string {
+ return LeftTrim(RightTrim(str, chars), chars)
+}
+
+// WhiteList removes characters that do not appear in the whitelist.
+func WhiteList(str, chars string) string {
+ pattern := "[^" + chars + "]+"
+ r, _ := regexp.Compile(pattern)
+ return r.ReplaceAllString(str, "")
+}
+
+// BlackList removes characters that appear in the blacklist.
+func BlackList(str, chars string) string {
+ pattern := "[" + chars + "]+"
+ r, _ := regexp.Compile(pattern)
+ return r.ReplaceAllString(str, "")
+}
+
+// StripLow removes characters with a numerical value < 32 and 127, mostly control characters.
+// If keep_new_lines is true, newline characters are preserved (\n and \r, hex 0xA and 0xD).
+func StripLow(str string, keepNewLines bool) string {
+ chars := ""
+ if keepNewLines {
+ chars = "\x00-\x09\x0B\x0C\x0E-\x1F\x7F"
+ } else {
+ chars = "\x00-\x1F\x7F"
+ }
+ return BlackList(str, chars)
+}
+
+// ReplacePattern replaces regular expression pattern in string
+func ReplacePattern(str, pattern, replace string) string {
+ r, _ := regexp.Compile(pattern)
+ return r.ReplaceAllString(str, replace)
+}
+
+// Escape replaces <, >, & and " with HTML entities.
+var Escape = html.EscapeString
+
+func addSegment(inrune, segment []rune) []rune {
+ if len(segment) == 0 {
+ return inrune
+ }
+ if len(inrune) != 0 {
+ inrune = append(inrune, '_')
+ }
+ inrune = append(inrune, segment...)
+ return inrune
+}
+
+// UnderscoreToCamelCase converts from underscore separated form to camel case form.
+// Ex.: my_func => MyFunc
+func UnderscoreToCamelCase(s string) string {
+ return strings.Replace(strings.Title(strings.Replace(strings.ToLower(s), "_", " ", -1)), " ", "", -1)
+}
+
+// CamelCaseToUnderscore converts from camel case form to underscore separated form.
+// Ex.: MyFunc => my_func
+func CamelCaseToUnderscore(str string) string {
+ var output []rune
+ var segment []rune
+ for _, r := range str {
+
+ // not treat number as separate segment
+ if !unicode.IsLower(r) && string(r) != "_" && !unicode.IsNumber(r) {
+ output = addSegment(output, segment)
+ segment = nil
+ }
+ segment = append(segment, unicode.ToLower(r))
+ }
+ output = addSegment(output, segment)
+ return string(output)
+}
+
+// Reverse returns reversed string
+func Reverse(s string) string {
+ r := []rune(s)
+ for i, j := 0, len(r)-1; i < j; i, j = i+1, j-1 {
+ r[i], r[j] = r[j], r[i]
+ }
+ return string(r)
+}
+
+// GetLines splits string by "\n" and return array of lines
+func GetLines(s string) []string {
+ return strings.Split(s, "\n")
+}
+
+// GetLine returns specified line of multiline string
+func GetLine(s string, index int) (string, error) {
+ lines := GetLines(s)
+ if index < 0 || index >= len(lines) {
+ return "", errors.New("line index out of bounds")
+ }
+ return lines[index], nil
+}
+
+// RemoveTags removes all tags from HTML string
+func RemoveTags(s string) string {
+ return ReplacePattern(s, "<[^>]*>", "")
+}
+
+// SafeFileName returns safe string that can be used in file names
+func SafeFileName(str string) string {
+ name := strings.ToLower(str)
+ name = path.Clean(path.Base(name))
+ name = strings.Trim(name, " ")
+ separators, err := regexp.Compile(`[ &_=+:]`)
+ if err == nil {
+ name = separators.ReplaceAllString(name, "-")
+ }
+ legal, err := regexp.Compile(`[^[:alnum:]-.]`)
+ if err == nil {
+ name = legal.ReplaceAllString(name, "")
+ }
+ for strings.Contains(name, "--") {
+ name = strings.Replace(name, "--", "-", -1)
+ }
+ return name
+}
+
+// NormalizeEmail canonicalize an email address.
+// The local part of the email address is lowercased for all domains; the hostname is always lowercased and
+// the local part of the email address is always lowercased for hosts that are known to be case-insensitive (currently only GMail).
+// Normalization follows special rules for known providers: currently, GMail addresses have dots removed in the local part and
+// are stripped of tags (e.g. some.one+tag@gmail.com becomes someone@gmail.com) and all @googlemail.com addresses are
+// normalized to @gmail.com.
+func NormalizeEmail(str string) (string, error) {
+ if !IsEmail(str) {
+ return "", fmt.Errorf("%s is not an email", str)
+ }
+ parts := strings.Split(str, "@")
+ parts[0] = strings.ToLower(parts[0])
+ parts[1] = strings.ToLower(parts[1])
+ if parts[1] == "gmail.com" || parts[1] == "googlemail.com" {
+ parts[1] = "gmail.com"
+ parts[0] = strings.Split(ReplacePattern(parts[0], `\.`, ""), "+")[0]
+ }
+ return strings.Join(parts, "@"), nil
+}
+
+// Truncate a string to the closest length without breaking words.
+func Truncate(str string, length int, ending string) string {
+ var aftstr, befstr string
+ if len(str) > length {
+ words := strings.Fields(str)
+ before, present := 0, 0
+ for i := range words {
+ befstr = aftstr
+ before = present
+ aftstr = aftstr + words[i] + " "
+ present = len(aftstr)
+ if present > length && i != 0 {
+ if (length - before) < (present - length) {
+ return Trim(befstr, " /\\.,\"'#!?&@+-") + ending
+ }
+ return Trim(aftstr, " /\\.,\"'#!?&@+-") + ending
+ }
+ }
+ }
+
+ return str
+}
+
+// PadLeft pads left side of a string if size of string is less then indicated pad length
+func PadLeft(str string, padStr string, padLen int) string {
+ return buildPadStr(str, padStr, padLen, true, false)
+}
+
+// PadRight pads right side of a string if size of string is less then indicated pad length
+func PadRight(str string, padStr string, padLen int) string {
+ return buildPadStr(str, padStr, padLen, false, true)
+}
+
+// PadBoth pads both sides of a string if size of string is less then indicated pad length
+func PadBoth(str string, padStr string, padLen int) string {
+ return buildPadStr(str, padStr, padLen, true, true)
+}
+
+// PadString either left, right or both sides.
+// Note that padding string can be unicode and more then one character
+func buildPadStr(str string, padStr string, padLen int, padLeft bool, padRight bool) string {
+
+ // When padded length is less then the current string size
+ if padLen < utf8.RuneCountInString(str) {
+ return str
+ }
+
+ padLen -= utf8.RuneCountInString(str)
+
+ targetLen := padLen
+
+ targetLenLeft := targetLen
+ targetLenRight := targetLen
+ if padLeft && padRight {
+ targetLenLeft = padLen / 2
+ targetLenRight = padLen - targetLenLeft
+ }
+
+ strToRepeatLen := utf8.RuneCountInString(padStr)
+
+ repeatTimes := int(math.Ceil(float64(targetLen) / float64(strToRepeatLen)))
+ repeatedString := strings.Repeat(padStr, repeatTimes)
+
+ leftSide := ""
+ if padLeft {
+ leftSide = repeatedString[0:targetLenLeft]
+ }
+
+ rightSide := ""
+ if padRight {
+ rightSide = repeatedString[0:targetLenRight]
+ }
+
+ return leftSide + str + rightSide
+}
+
+// TruncatingErrorf removes extra args from fmt.Errorf if not formatted in the str object
+func TruncatingErrorf(str string, args ...interface{}) error {
+ n := strings.Count(str, "%s")
+ return fmt.Errorf(str, args[:n]...)
+}
diff --git a/vendor/github.com/asaskevich/govalidator/validator.go b/vendor/github.com/asaskevich/govalidator/validator.go
new file mode 100644
index 0000000000..c9c4fac065
--- /dev/null
+++ b/vendor/github.com/asaskevich/govalidator/validator.go
@@ -0,0 +1,1768 @@
+// Package govalidator is package of validators and sanitizers for strings, structs and collections.
+package govalidator
+
+import (
+ "bytes"
+ "crypto/rsa"
+ "crypto/x509"
+ "encoding/base64"
+ "encoding/json"
+ "encoding/pem"
+ "fmt"
+ "io/ioutil"
+ "net"
+ "net/url"
+ "reflect"
+ "regexp"
+ "sort"
+ "strconv"
+ "strings"
+ "time"
+ "unicode"
+ "unicode/utf8"
+)
+
+var (
+ fieldsRequiredByDefault bool
+ nilPtrAllowedByRequired = false
+ notNumberRegexp = regexp.MustCompile("[^0-9]+")
+ whiteSpacesAndMinus = regexp.MustCompile(`[\s-]+`)
+ paramsRegexp = regexp.MustCompile(`\(.*\)$`)
+)
+
+const maxURLRuneCount = 2083
+const minURLRuneCount = 3
+const rfc3339WithoutZone = "2006-01-02T15:04:05"
+
+// SetFieldsRequiredByDefault causes validation to fail when struct fields
+// do not include validations or are not explicitly marked as exempt (using `valid:"-"` or `valid:"email,optional"`).
+// This struct definition will fail govalidator.ValidateStruct() (and the field values do not matter):
+// type exampleStruct struct {
+// Name string ``
+// Email string `valid:"email"`
+// This, however, will only fail when Email is empty or an invalid email address:
+// type exampleStruct2 struct {
+// Name string `valid:"-"`
+// Email string `valid:"email"`
+// Lastly, this will only fail when Email is an invalid email address but not when it's empty:
+// type exampleStruct2 struct {
+// Name string `valid:"-"`
+// Email string `valid:"email,optional"`
+func SetFieldsRequiredByDefault(value bool) {
+ fieldsRequiredByDefault = value
+}
+
+// SetNilPtrAllowedByRequired causes validation to pass for nil ptrs when a field is set to required.
+// The validation will still reject ptr fields in their zero value state. Example with this enabled:
+// type exampleStruct struct {
+// Name *string `valid:"required"`
+// With `Name` set to "", this will be considered invalid input and will cause a validation error.
+// With `Name` set to nil, this will be considered valid by validation.
+// By default this is disabled.
+func SetNilPtrAllowedByRequired(value bool) {
+ nilPtrAllowedByRequired = value
+}
+
+// IsEmail checks if the string is an email.
+func IsEmail(str string) bool {
+ // TODO uppercase letters are not supported
+ return rxEmail.MatchString(str)
+}
+
+// IsExistingEmail checks if the string is an email of existing domain
+func IsExistingEmail(email string) bool {
+
+ if len(email) < 6 || len(email) > 254 {
+ return false
+ }
+ at := strings.LastIndex(email, "@")
+ if at <= 0 || at > len(email)-3 {
+ return false
+ }
+ user := email[:at]
+ host := email[at+1:]
+ if len(user) > 64 {
+ return false
+ }
+ switch host {
+ case "localhost", "example.com":
+ return true
+ }
+ if userDotRegexp.MatchString(user) || !userRegexp.MatchString(user) || !hostRegexp.MatchString(host) {
+ return false
+ }
+ if _, err := net.LookupMX(host); err != nil {
+ if _, err := net.LookupIP(host); err != nil {
+ return false
+ }
+ }
+
+ return true
+}
+
+// IsURL checks if the string is an URL.
+func IsURL(str string) bool {
+ if str == "" || utf8.RuneCountInString(str) >= maxURLRuneCount || len(str) <= minURLRuneCount || strings.HasPrefix(str, ".") {
+ return false
+ }
+ strTemp := str
+ if strings.Contains(str, ":") && !strings.Contains(str, "://") {
+ // support no indicated urlscheme but with colon for port number
+ // http:// is appended so url.Parse will succeed, strTemp used so it does not impact rxURL.MatchString
+ strTemp = "http://" + str
+ }
+ u, err := url.Parse(strTemp)
+ if err != nil {
+ return false
+ }
+ if strings.HasPrefix(u.Host, ".") {
+ return false
+ }
+ if u.Host == "" && (u.Path != "" && !strings.Contains(u.Path, ".")) {
+ return false
+ }
+ return rxURL.MatchString(str)
+}
+
+// IsRequestURL checks if the string rawurl, assuming
+// it was received in an HTTP request, is a valid
+// URL confirm to RFC 3986
+func IsRequestURL(rawurl string) bool {
+ url, err := url.ParseRequestURI(rawurl)
+ if err != nil {
+ return false //Couldn't even parse the rawurl
+ }
+ if len(url.Scheme) == 0 {
+ return false //No Scheme found
+ }
+ return true
+}
+
+// IsRequestURI checks if the string rawurl, assuming
+// it was received in an HTTP request, is an
+// absolute URI or an absolute path.
+func IsRequestURI(rawurl string) bool {
+ _, err := url.ParseRequestURI(rawurl)
+ return err == nil
+}
+
+// IsAlpha checks if the string contains only letters (a-zA-Z). Empty string is valid.
+func IsAlpha(str string) bool {
+ if IsNull(str) {
+ return true
+ }
+ return rxAlpha.MatchString(str)
+}
+
+//IsUTFLetter checks if the string contains only unicode letter characters.
+//Similar to IsAlpha but for all languages. Empty string is valid.
+func IsUTFLetter(str string) bool {
+ if IsNull(str) {
+ return true
+ }
+
+ for _, c := range str {
+ if !unicode.IsLetter(c) {
+ return false
+ }
+ }
+ return true
+
+}
+
+// IsAlphanumeric checks if the string contains only letters and numbers. Empty string is valid.
+func IsAlphanumeric(str string) bool {
+ if IsNull(str) {
+ return true
+ }
+ return rxAlphanumeric.MatchString(str)
+}
+
+// IsUTFLetterNumeric checks if the string contains only unicode letters and numbers. Empty string is valid.
+func IsUTFLetterNumeric(str string) bool {
+ if IsNull(str) {
+ return true
+ }
+ for _, c := range str {
+ if !unicode.IsLetter(c) && !unicode.IsNumber(c) { //letters && numbers are ok
+ return false
+ }
+ }
+ return true
+
+}
+
+// IsNumeric checks if the string contains only numbers. Empty string is valid.
+func IsNumeric(str string) bool {
+ if IsNull(str) {
+ return true
+ }
+ return rxNumeric.MatchString(str)
+}
+
+// IsUTFNumeric checks if the string contains only unicode numbers of any kind.
+// Numbers can be 0-9 but also Fractions ¾,Roman Ⅸ and Hangzhou 〩. Empty string is valid.
+func IsUTFNumeric(str string) bool {
+ if IsNull(str) {
+ return true
+ }
+ if strings.IndexAny(str, "+-") > 0 {
+ return false
+ }
+ if len(str) > 1 {
+ str = strings.TrimPrefix(str, "-")
+ str = strings.TrimPrefix(str, "+")
+ }
+ for _, c := range str {
+ if !unicode.IsNumber(c) { //numbers && minus sign are ok
+ return false
+ }
+ }
+ return true
+
+}
+
+// IsUTFDigit checks if the string contains only unicode radix-10 decimal digits. Empty string is valid.
+func IsUTFDigit(str string) bool {
+ if IsNull(str) {
+ return true
+ }
+ if strings.IndexAny(str, "+-") > 0 {
+ return false
+ }
+ if len(str) > 1 {
+ str = strings.TrimPrefix(str, "-")
+ str = strings.TrimPrefix(str, "+")
+ }
+ for _, c := range str {
+ if !unicode.IsDigit(c) { //digits && minus sign are ok
+ return false
+ }
+ }
+ return true
+
+}
+
+// IsHexadecimal checks if the string is a hexadecimal number.
+func IsHexadecimal(str string) bool {
+ return rxHexadecimal.MatchString(str)
+}
+
+// IsHexcolor checks if the string is a hexadecimal color.
+func IsHexcolor(str string) bool {
+ return rxHexcolor.MatchString(str)
+}
+
+// IsRGBcolor checks if the string is a valid RGB color in form rgb(RRR, GGG, BBB).
+func IsRGBcolor(str string) bool {
+ return rxRGBcolor.MatchString(str)
+}
+
+// IsLowerCase checks if the string is lowercase. Empty string is valid.
+func IsLowerCase(str string) bool {
+ if IsNull(str) {
+ return true
+ }
+ return str == strings.ToLower(str)
+}
+
+// IsUpperCase checks if the string is uppercase. Empty string is valid.
+func IsUpperCase(str string) bool {
+ if IsNull(str) {
+ return true
+ }
+ return str == strings.ToUpper(str)
+}
+
+// HasLowerCase checks if the string contains at least 1 lowercase. Empty string is valid.
+func HasLowerCase(str string) bool {
+ if IsNull(str) {
+ return true
+ }
+ return rxHasLowerCase.MatchString(str)
+}
+
+// HasUpperCase checks if the string contains as least 1 uppercase. Empty string is valid.
+func HasUpperCase(str string) bool {
+ if IsNull(str) {
+ return true
+ }
+ return rxHasUpperCase.MatchString(str)
+}
+
+// IsInt checks if the string is an integer. Empty string is valid.
+func IsInt(str string) bool {
+ if IsNull(str) {
+ return true
+ }
+ return rxInt.MatchString(str)
+}
+
+// IsFloat checks if the string is a float.
+func IsFloat(str string) bool {
+ return str != "" && rxFloat.MatchString(str)
+}
+
+// IsDivisibleBy checks if the string is a number that's divisible by another.
+// If second argument is not valid integer or zero, it's return false.
+// Otherwise, if first argument is not valid integer or zero, it's return true (Invalid string converts to zero).
+func IsDivisibleBy(str, num string) bool {
+ f, _ := ToFloat(str)
+ p := int64(f)
+ q, _ := ToInt(num)
+ if q == 0 {
+ return false
+ }
+ return (p == 0) || (p%q == 0)
+}
+
+// IsNull checks if the string is null.
+func IsNull(str string) bool {
+ return len(str) == 0
+}
+
+// IsNotNull checks if the string is not null.
+func IsNotNull(str string) bool {
+ return !IsNull(str)
+}
+
+// HasWhitespaceOnly checks the string only contains whitespace
+func HasWhitespaceOnly(str string) bool {
+ return len(str) > 0 && rxHasWhitespaceOnly.MatchString(str)
+}
+
+// HasWhitespace checks if the string contains any whitespace
+func HasWhitespace(str string) bool {
+ return len(str) > 0 && rxHasWhitespace.MatchString(str)
+}
+
+// IsByteLength checks if the string's length (in bytes) falls in a range.
+func IsByteLength(str string, min, max int) bool {
+ return len(str) >= min && len(str) <= max
+}
+
+// IsUUIDv3 checks if the string is a UUID version 3.
+func IsUUIDv3(str string) bool {
+ return rxUUID3.MatchString(str)
+}
+
+// IsUUIDv4 checks if the string is a UUID version 4.
+func IsUUIDv4(str string) bool {
+ return rxUUID4.MatchString(str)
+}
+
+// IsUUIDv5 checks if the string is a UUID version 5.
+func IsUUIDv5(str string) bool {
+ return rxUUID5.MatchString(str)
+}
+
+// IsUUID checks if the string is a UUID (version 3, 4 or 5).
+func IsUUID(str string) bool {
+ return rxUUID.MatchString(str)
+}
+
+// Byte to index table for O(1) lookups when unmarshaling.
+// We use 0xFF as sentinel value for invalid indexes.
+var ulidDec = [...]byte{
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x01,
+ 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
+ 0x0F, 0x10, 0x11, 0xFF, 0x12, 0x13, 0xFF, 0x14, 0x15, 0xFF,
+ 0x16, 0x17, 0x18, 0x19, 0x1A, 0xFF, 0x1B, 0x1C, 0x1D, 0x1E,
+ 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0x0B, 0x0C,
+ 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0xFF, 0x12, 0x13, 0xFF, 0x14,
+ 0x15, 0xFF, 0x16, 0x17, 0x18, 0x19, 0x1A, 0xFF, 0x1B, 0x1C,
+ 0x1D, 0x1E, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+}
+
+// EncodedSize is the length of a text encoded ULID.
+const ulidEncodedSize = 26
+
+// IsULID checks if the string is a ULID.
+//
+// Implementation got from:
+// https://github.com/oklog/ulid (Apache-2.0 License)
+//
+func IsULID(str string) bool {
+ // Check if a base32 encoded ULID is the right length.
+ if len(str) != ulidEncodedSize {
+ return false
+ }
+
+ // Check if all the characters in a base32 encoded ULID are part of the
+ // expected base32 character set.
+ if ulidDec[str[0]] == 0xFF ||
+ ulidDec[str[1]] == 0xFF ||
+ ulidDec[str[2]] == 0xFF ||
+ ulidDec[str[3]] == 0xFF ||
+ ulidDec[str[4]] == 0xFF ||
+ ulidDec[str[5]] == 0xFF ||
+ ulidDec[str[6]] == 0xFF ||
+ ulidDec[str[7]] == 0xFF ||
+ ulidDec[str[8]] == 0xFF ||
+ ulidDec[str[9]] == 0xFF ||
+ ulidDec[str[10]] == 0xFF ||
+ ulidDec[str[11]] == 0xFF ||
+ ulidDec[str[12]] == 0xFF ||
+ ulidDec[str[13]] == 0xFF ||
+ ulidDec[str[14]] == 0xFF ||
+ ulidDec[str[15]] == 0xFF ||
+ ulidDec[str[16]] == 0xFF ||
+ ulidDec[str[17]] == 0xFF ||
+ ulidDec[str[18]] == 0xFF ||
+ ulidDec[str[19]] == 0xFF ||
+ ulidDec[str[20]] == 0xFF ||
+ ulidDec[str[21]] == 0xFF ||
+ ulidDec[str[22]] == 0xFF ||
+ ulidDec[str[23]] == 0xFF ||
+ ulidDec[str[24]] == 0xFF ||
+ ulidDec[str[25]] == 0xFF {
+ return false
+ }
+
+ // Check if the first character in a base32 encoded ULID will overflow. This
+ // happens because the base32 representation encodes 130 bits, while the
+ // ULID is only 128 bits.
+ //
+ // See https://github.com/oklog/ulid/issues/9 for details.
+ if str[0] > '7' {
+ return false
+ }
+ return true
+}
+
+// IsCreditCard checks if the string is a credit card.
+func IsCreditCard(str string) bool {
+ sanitized := whiteSpacesAndMinus.ReplaceAllString(str, "")
+ if !rxCreditCard.MatchString(sanitized) {
+ return false
+ }
+
+ number, _ := ToInt(sanitized)
+ number, lastDigit := number / 10, number % 10
+
+ var sum int64
+ for i:=0; number > 0; i++ {
+ digit := number % 10
+
+ if i % 2 == 0 {
+ digit *= 2
+ if digit > 9 {
+ digit -= 9
+ }
+ }
+
+ sum += digit
+ number = number / 10
+ }
+
+ return (sum + lastDigit) % 10 == 0
+}
+
+// IsISBN10 checks if the string is an ISBN version 10.
+func IsISBN10(str string) bool {
+ return IsISBN(str, 10)
+}
+
+// IsISBN13 checks if the string is an ISBN version 13.
+func IsISBN13(str string) bool {
+ return IsISBN(str, 13)
+}
+
+// IsISBN checks if the string is an ISBN (version 10 or 13).
+// If version value is not equal to 10 or 13, it will be checks both variants.
+func IsISBN(str string, version int) bool {
+ sanitized := whiteSpacesAndMinus.ReplaceAllString(str, "")
+ var checksum int32
+ var i int32
+ if version == 10 {
+ if !rxISBN10.MatchString(sanitized) {
+ return false
+ }
+ for i = 0; i < 9; i++ {
+ checksum += (i + 1) * int32(sanitized[i]-'0')
+ }
+ if sanitized[9] == 'X' {
+ checksum += 10 * 10
+ } else {
+ checksum += 10 * int32(sanitized[9]-'0')
+ }
+ if checksum%11 == 0 {
+ return true
+ }
+ return false
+ } else if version == 13 {
+ if !rxISBN13.MatchString(sanitized) {
+ return false
+ }
+ factor := []int32{1, 3}
+ for i = 0; i < 12; i++ {
+ checksum += factor[i%2] * int32(sanitized[i]-'0')
+ }
+ return (int32(sanitized[12]-'0'))-((10-(checksum%10))%10) == 0
+ }
+ return IsISBN(str, 10) || IsISBN(str, 13)
+}
+
+// IsJSON checks if the string is valid JSON (note: uses json.Unmarshal).
+func IsJSON(str string) bool {
+ var js json.RawMessage
+ return json.Unmarshal([]byte(str), &js) == nil
+}
+
+// IsMultibyte checks if the string contains one or more multibyte chars. Empty string is valid.
+func IsMultibyte(str string) bool {
+ if IsNull(str) {
+ return true
+ }
+ return rxMultibyte.MatchString(str)
+}
+
+// IsASCII checks if the string contains ASCII chars only. Empty string is valid.
+func IsASCII(str string) bool {
+ if IsNull(str) {
+ return true
+ }
+ return rxASCII.MatchString(str)
+}
+
+// IsPrintableASCII checks if the string contains printable ASCII chars only. Empty string is valid.
+func IsPrintableASCII(str string) bool {
+ if IsNull(str) {
+ return true
+ }
+ return rxPrintableASCII.MatchString(str)
+}
+
+// IsFullWidth checks if the string contains any full-width chars. Empty string is valid.
+func IsFullWidth(str string) bool {
+ if IsNull(str) {
+ return true
+ }
+ return rxFullWidth.MatchString(str)
+}
+
+// IsHalfWidth checks if the string contains any half-width chars. Empty string is valid.
+func IsHalfWidth(str string) bool {
+ if IsNull(str) {
+ return true
+ }
+ return rxHalfWidth.MatchString(str)
+}
+
+// IsVariableWidth checks if the string contains a mixture of full and half-width chars. Empty string is valid.
+func IsVariableWidth(str string) bool {
+ if IsNull(str) {
+ return true
+ }
+ return rxHalfWidth.MatchString(str) && rxFullWidth.MatchString(str)
+}
+
+// IsBase64 checks if a string is base64 encoded.
+func IsBase64(str string) bool {
+ return rxBase64.MatchString(str)
+}
+
+// IsFilePath checks is a string is Win or Unix file path and returns it's type.
+func IsFilePath(str string) (bool, int) {
+ if rxWinPath.MatchString(str) {
+ //check windows path limit see:
+ // http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx#maxpath
+ if len(str[3:]) > 32767 {
+ return false, Win
+ }
+ return true, Win
+ } else if rxUnixPath.MatchString(str) {
+ return true, Unix
+ }
+ return false, Unknown
+}
+
+//IsWinFilePath checks both relative & absolute paths in Windows
+func IsWinFilePath(str string) bool {
+ if rxARWinPath.MatchString(str) {
+ //check windows path limit see:
+ // http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx#maxpath
+ if len(str[3:]) > 32767 {
+ return false
+ }
+ return true
+ }
+ return false
+}
+
+//IsUnixFilePath checks both relative & absolute paths in Unix
+func IsUnixFilePath(str string) bool {
+ if rxARUnixPath.MatchString(str) {
+ return true
+ }
+ return false
+}
+
+// IsDataURI checks if a string is base64 encoded data URI such as an image
+func IsDataURI(str string) bool {
+ dataURI := strings.Split(str, ",")
+ if !rxDataURI.MatchString(dataURI[0]) {
+ return false
+ }
+ return IsBase64(dataURI[1])
+}
+
+// IsMagnetURI checks if a string is valid magnet URI
+func IsMagnetURI(str string) bool {
+ return rxMagnetURI.MatchString(str)
+}
+
+// IsISO3166Alpha2 checks if a string is valid two-letter country code
+func IsISO3166Alpha2(str string) bool {
+ for _, entry := range ISO3166List {
+ if str == entry.Alpha2Code {
+ return true
+ }
+ }
+ return false
+}
+
+// IsISO3166Alpha3 checks if a string is valid three-letter country code
+func IsISO3166Alpha3(str string) bool {
+ for _, entry := range ISO3166List {
+ if str == entry.Alpha3Code {
+ return true
+ }
+ }
+ return false
+}
+
+// IsISO693Alpha2 checks if a string is valid two-letter language code
+func IsISO693Alpha2(str string) bool {
+ for _, entry := range ISO693List {
+ if str == entry.Alpha2Code {
+ return true
+ }
+ }
+ return false
+}
+
+// IsISO693Alpha3b checks if a string is valid three-letter language code
+func IsISO693Alpha3b(str string) bool {
+ for _, entry := range ISO693List {
+ if str == entry.Alpha3bCode {
+ return true
+ }
+ }
+ return false
+}
+
+// IsDNSName will validate the given string as a DNS name
+func IsDNSName(str string) bool {
+ if str == "" || len(strings.Replace(str, ".", "", -1)) > 255 {
+ // constraints already violated
+ return false
+ }
+ return !IsIP(str) && rxDNSName.MatchString(str)
+}
+
+// IsHash checks if a string is a hash of type algorithm.
+// Algorithm is one of ['md4', 'md5', 'sha1', 'sha256', 'sha384', 'sha512', 'ripemd128', 'ripemd160', 'tiger128', 'tiger160', 'tiger192', 'crc32', 'crc32b']
+func IsHash(str string, algorithm string) bool {
+ var len string
+ algo := strings.ToLower(algorithm)
+
+ if algo == "crc32" || algo == "crc32b" {
+ len = "8"
+ } else if algo == "md5" || algo == "md4" || algo == "ripemd128" || algo == "tiger128" {
+ len = "32"
+ } else if algo == "sha1" || algo == "ripemd160" || algo == "tiger160" {
+ len = "40"
+ } else if algo == "tiger192" {
+ len = "48"
+ } else if algo == "sha3-224" {
+ len = "56"
+ } else if algo == "sha256" || algo == "sha3-256" {
+ len = "64"
+ } else if algo == "sha384" || algo == "sha3-384" {
+ len = "96"
+ } else if algo == "sha512" || algo == "sha3-512" {
+ len = "128"
+ } else {
+ return false
+ }
+
+ return Matches(str, "^[a-f0-9]{"+len+"}$")
+}
+
+// IsSHA3224 checks is a string is a SHA3-224 hash. Alias for `IsHash(str, "sha3-224")`
+func IsSHA3224(str string) bool {
+ return IsHash(str, "sha3-224")
+}
+
+// IsSHA3256 checks is a string is a SHA3-256 hash. Alias for `IsHash(str, "sha3-256")`
+func IsSHA3256(str string) bool {
+ return IsHash(str, "sha3-256")
+}
+
+// IsSHA3384 checks is a string is a SHA3-384 hash. Alias for `IsHash(str, "sha3-384")`
+func IsSHA3384(str string) bool {
+ return IsHash(str, "sha3-384")
+}
+
+// IsSHA3512 checks is a string is a SHA3-512 hash. Alias for `IsHash(str, "sha3-512")`
+func IsSHA3512(str string) bool {
+ return IsHash(str, "sha3-512")
+}
+
+// IsSHA512 checks is a string is a SHA512 hash. Alias for `IsHash(str, "sha512")`
+func IsSHA512(str string) bool {
+ return IsHash(str, "sha512")
+}
+
+// IsSHA384 checks is a string is a SHA384 hash. Alias for `IsHash(str, "sha384")`
+func IsSHA384(str string) bool {
+ return IsHash(str, "sha384")
+}
+
+// IsSHA256 checks is a string is a SHA256 hash. Alias for `IsHash(str, "sha256")`
+func IsSHA256(str string) bool {
+ return IsHash(str, "sha256")
+}
+
+// IsTiger192 checks is a string is a Tiger192 hash. Alias for `IsHash(str, "tiger192")`
+func IsTiger192(str string) bool {
+ return IsHash(str, "tiger192")
+}
+
+// IsTiger160 checks is a string is a Tiger160 hash. Alias for `IsHash(str, "tiger160")`
+func IsTiger160(str string) bool {
+ return IsHash(str, "tiger160")
+}
+
+// IsRipeMD160 checks is a string is a RipeMD160 hash. Alias for `IsHash(str, "ripemd160")`
+func IsRipeMD160(str string) bool {
+ return IsHash(str, "ripemd160")
+}
+
+// IsSHA1 checks is a string is a SHA-1 hash. Alias for `IsHash(str, "sha1")`
+func IsSHA1(str string) bool {
+ return IsHash(str, "sha1")
+}
+
+// IsTiger128 checks is a string is a Tiger128 hash. Alias for `IsHash(str, "tiger128")`
+func IsTiger128(str string) bool {
+ return IsHash(str, "tiger128")
+}
+
+// IsRipeMD128 checks is a string is a RipeMD128 hash. Alias for `IsHash(str, "ripemd128")`
+func IsRipeMD128(str string) bool {
+ return IsHash(str, "ripemd128")
+}
+
+// IsCRC32 checks is a string is a CRC32 hash. Alias for `IsHash(str, "crc32")`
+func IsCRC32(str string) bool {
+ return IsHash(str, "crc32")
+}
+
+// IsCRC32b checks is a string is a CRC32b hash. Alias for `IsHash(str, "crc32b")`
+func IsCRC32b(str string) bool {
+ return IsHash(str, "crc32b")
+}
+
+// IsMD5 checks is a string is a MD5 hash. Alias for `IsHash(str, "md5")`
+func IsMD5(str string) bool {
+ return IsHash(str, "md5")
+}
+
+// IsMD4 checks is a string is a MD4 hash. Alias for `IsHash(str, "md4")`
+func IsMD4(str string) bool {
+ return IsHash(str, "md4")
+}
+
+// IsDialString validates the given string for usage with the various Dial() functions
+func IsDialString(str string) bool {
+ if h, p, err := net.SplitHostPort(str); err == nil && h != "" && p != "" && (IsDNSName(h) || IsIP(h)) && IsPort(p) {
+ return true
+ }
+
+ return false
+}
+
+// IsIP checks if a string is either IP version 4 or 6. Alias for `net.ParseIP`
+func IsIP(str string) bool {
+ return net.ParseIP(str) != nil
+}
+
+// IsPort checks if a string represents a valid port
+func IsPort(str string) bool {
+ if i, err := strconv.Atoi(str); err == nil && i > 0 && i < 65536 {
+ return true
+ }
+ return false
+}
+
+// IsIPv4 checks if the string is an IP version 4.
+func IsIPv4(str string) bool {
+ ip := net.ParseIP(str)
+ return ip != nil && strings.Contains(str, ".")
+}
+
+// IsIPv6 checks if the string is an IP version 6.
+func IsIPv6(str string) bool {
+ ip := net.ParseIP(str)
+ return ip != nil && strings.Contains(str, ":")
+}
+
+// IsCIDR checks if the string is an valid CIDR notiation (IPV4 & IPV6)
+func IsCIDR(str string) bool {
+ _, _, err := net.ParseCIDR(str)
+ return err == nil
+}
+
+// IsMAC checks if a string is valid MAC address.
+// Possible MAC formats:
+// 01:23:45:67:89:ab
+// 01:23:45:67:89:ab:cd:ef
+// 01-23-45-67-89-ab
+// 01-23-45-67-89-ab-cd-ef
+// 0123.4567.89ab
+// 0123.4567.89ab.cdef
+func IsMAC(str string) bool {
+ _, err := net.ParseMAC(str)
+ return err == nil
+}
+
+// IsHost checks if the string is a valid IP (both v4 and v6) or a valid DNS name
+func IsHost(str string) bool {
+ return IsIP(str) || IsDNSName(str)
+}
+
+// IsMongoID checks if the string is a valid hex-encoded representation of a MongoDB ObjectId.
+func IsMongoID(str string) bool {
+ return rxHexadecimal.MatchString(str) && (len(str) == 24)
+}
+
+// IsLatitude checks if a string is valid latitude.
+func IsLatitude(str string) bool {
+ return rxLatitude.MatchString(str)
+}
+
+// IsLongitude checks if a string is valid longitude.
+func IsLongitude(str string) bool {
+ return rxLongitude.MatchString(str)
+}
+
+// IsIMEI checks if a string is valid IMEI
+func IsIMEI(str string) bool {
+ return rxIMEI.MatchString(str)
+}
+
+// IsIMSI checks if a string is valid IMSI
+func IsIMSI(str string) bool {
+ if !rxIMSI.MatchString(str) {
+ return false
+ }
+
+ mcc, err := strconv.ParseInt(str[0:3], 10, 32)
+ if err != nil {
+ return false
+ }
+
+ switch mcc {
+ case 202, 204, 206, 208, 212, 213, 214, 216, 218, 219:
+ case 220, 221, 222, 226, 228, 230, 231, 232, 234, 235:
+ case 238, 240, 242, 244, 246, 247, 248, 250, 255, 257:
+ case 259, 260, 262, 266, 268, 270, 272, 274, 276, 278:
+ case 280, 282, 283, 284, 286, 288, 289, 290, 292, 293:
+ case 294, 295, 297, 302, 308, 310, 311, 312, 313, 314:
+ case 315, 316, 330, 332, 334, 338, 340, 342, 344, 346:
+ case 348, 350, 352, 354, 356, 358, 360, 362, 363, 364:
+ case 365, 366, 368, 370, 372, 374, 376, 400, 401, 402:
+ case 404, 405, 406, 410, 412, 413, 414, 415, 416, 417:
+ case 418, 419, 420, 421, 422, 424, 425, 426, 427, 428:
+ case 429, 430, 431, 432, 434, 436, 437, 438, 440, 441:
+ case 450, 452, 454, 455, 456, 457, 460, 461, 466, 467:
+ case 470, 472, 502, 505, 510, 514, 515, 520, 525, 528:
+ case 530, 536, 537, 539, 540, 541, 542, 543, 544, 545:
+ case 546, 547, 548, 549, 550, 551, 552, 553, 554, 555:
+ case 602, 603, 604, 605, 606, 607, 608, 609, 610, 611:
+ case 612, 613, 614, 615, 616, 617, 618, 619, 620, 621:
+ case 622, 623, 624, 625, 626, 627, 628, 629, 630, 631:
+ case 632, 633, 634, 635, 636, 637, 638, 639, 640, 641:
+ case 642, 643, 645, 646, 647, 648, 649, 650, 651, 652:
+ case 653, 654, 655, 657, 658, 659, 702, 704, 706, 708:
+ case 710, 712, 714, 716, 722, 724, 730, 732, 734, 736:
+ case 738, 740, 742, 744, 746, 748, 750, 995:
+ return true
+ default:
+ return false
+ }
+ return true
+}
+
+// IsRsaPublicKey checks if a string is valid public key with provided length
+func IsRsaPublicKey(str string, keylen int) bool {
+ bb := bytes.NewBufferString(str)
+ pemBytes, err := ioutil.ReadAll(bb)
+ if err != nil {
+ return false
+ }
+ block, _ := pem.Decode(pemBytes)
+ if block != nil && block.Type != "PUBLIC KEY" {
+ return false
+ }
+ var der []byte
+
+ if block != nil {
+ der = block.Bytes
+ } else {
+ der, err = base64.StdEncoding.DecodeString(str)
+ if err != nil {
+ return false
+ }
+ }
+
+ key, err := x509.ParsePKIXPublicKey(der)
+ if err != nil {
+ return false
+ }
+ pubkey, ok := key.(*rsa.PublicKey)
+ if !ok {
+ return false
+ }
+ bitlen := len(pubkey.N.Bytes()) * 8
+ return bitlen == int(keylen)
+}
+
+// IsRegex checks if a give string is a valid regex with RE2 syntax or not
+func IsRegex(str string) bool {
+ if _, err := regexp.Compile(str); err == nil {
+ return true
+ }
+ return false
+}
+
+func toJSONName(tag string) string {
+ if tag == "" {
+ return ""
+ }
+
+ // JSON name always comes first. If there's no options then split[0] is
+ // JSON name, if JSON name is not set, then split[0] is an empty string.
+ split := strings.SplitN(tag, ",", 2)
+
+ name := split[0]
+
+ // However it is possible that the field is skipped when
+ // (de-)serializing from/to JSON, in which case assume that there is no
+ // tag name to use
+ if name == "-" {
+ return ""
+ }
+ return name
+}
+
+func prependPathToErrors(err error, path string) error {
+ switch err2 := err.(type) {
+ case Error:
+ err2.Path = append([]string{path}, err2.Path...)
+ return err2
+ case Errors:
+ errors := err2.Errors()
+ for i, err3 := range errors {
+ errors[i] = prependPathToErrors(err3, path)
+ }
+ return err2
+ }
+ return err
+}
+
+// ValidateArray performs validation according to condition iterator that validates every element of the array
+func ValidateArray(array []interface{}, iterator ConditionIterator) bool {
+ return Every(array, iterator)
+}
+
+// ValidateMap use validation map for fields.
+// result will be equal to `false` if there are any errors.
+// s is the map containing the data to be validated.
+// m is the validation map in the form:
+// map[string]interface{}{"name":"required,alpha","address":map[string]interface{}{"line1":"required,alphanum"}}
+func ValidateMap(s map[string]interface{}, m map[string]interface{}) (bool, error) {
+ if s == nil {
+ return true, nil
+ }
+ result := true
+ var err error
+ var errs Errors
+ var index int
+ val := reflect.ValueOf(s)
+ for key, value := range s {
+ presentResult := true
+ validator, ok := m[key]
+ if !ok {
+ presentResult = false
+ var err error
+ err = fmt.Errorf("all map keys has to be present in the validation map; got %s", key)
+ err = prependPathToErrors(err, key)
+ errs = append(errs, err)
+ }
+ valueField := reflect.ValueOf(value)
+ mapResult := true
+ typeResult := true
+ structResult := true
+ resultField := true
+ switch subValidator := validator.(type) {
+ case map[string]interface{}:
+ var err error
+ if v, ok := value.(map[string]interface{}); !ok {
+ mapResult = false
+ err = fmt.Errorf("map validator has to be for the map type only; got %s", valueField.Type().String())
+ err = prependPathToErrors(err, key)
+ errs = append(errs, err)
+ } else {
+ mapResult, err = ValidateMap(v, subValidator)
+ if err != nil {
+ mapResult = false
+ err = prependPathToErrors(err, key)
+ errs = append(errs, err)
+ }
+ }
+ case string:
+ if (valueField.Kind() == reflect.Struct ||
+ (valueField.Kind() == reflect.Ptr && valueField.Elem().Kind() == reflect.Struct)) &&
+ subValidator != "-" {
+ var err error
+ structResult, err = ValidateStruct(valueField.Interface())
+ if err != nil {
+ err = prependPathToErrors(err, key)
+ errs = append(errs, err)
+ }
+ }
+ resultField, err = typeCheck(valueField, reflect.StructField{
+ Name: key,
+ PkgPath: "",
+ Type: val.Type(),
+ Tag: reflect.StructTag(fmt.Sprintf("%s:%q", tagName, subValidator)),
+ Offset: 0,
+ Index: []int{index},
+ Anonymous: false,
+ }, val, nil)
+ if err != nil {
+ errs = append(errs, err)
+ }
+ case nil:
+ // already handlerd when checked before
+ default:
+ typeResult = false
+ err = fmt.Errorf("map validator has to be either map[string]interface{} or string; got %s", valueField.Type().String())
+ err = prependPathToErrors(err, key)
+ errs = append(errs, err)
+ }
+ result = result && presentResult && typeResult && resultField && structResult && mapResult
+ index++
+ }
+ // checks required keys
+ requiredResult := true
+ for key, value := range m {
+ if schema, ok := value.(string); ok {
+ tags := parseTagIntoMap(schema)
+ if required, ok := tags["required"]; ok {
+ if _, ok := s[key]; !ok {
+ requiredResult = false
+ if required.customErrorMessage != "" {
+ err = Error{key, fmt.Errorf(required.customErrorMessage), true, "required", []string{}}
+ } else {
+ err = Error{key, fmt.Errorf("required field missing"), false, "required", []string{}}
+ }
+ errs = append(errs, err)
+ }
+ }
+ }
+ }
+
+ if len(errs) > 0 {
+ err = errs
+ }
+ return result && requiredResult, err
+}
+
+// ValidateStruct use tags for fields.
+// result will be equal to `false` if there are any errors.
+// todo currently there is no guarantee that errors will be returned in predictable order (tests may to fail)
+func ValidateStruct(s interface{}) (bool, error) {
+ if s == nil {
+ return true, nil
+ }
+ result := true
+ var err error
+ val := reflect.ValueOf(s)
+ if val.Kind() == reflect.Interface || val.Kind() == reflect.Ptr {
+ val = val.Elem()
+ }
+ // we only accept structs
+ if val.Kind() != reflect.Struct {
+ return false, fmt.Errorf("function only accepts structs; got %s", val.Kind())
+ }
+ var errs Errors
+ for i := 0; i < val.NumField(); i++ {
+ valueField := val.Field(i)
+ typeField := val.Type().Field(i)
+ if typeField.PkgPath != "" {
+ continue // Private field
+ }
+ structResult := true
+ if valueField.Kind() == reflect.Interface {
+ valueField = valueField.Elem()
+ }
+ if (valueField.Kind() == reflect.Struct ||
+ (valueField.Kind() == reflect.Ptr && valueField.Elem().Kind() == reflect.Struct)) &&
+ typeField.Tag.Get(tagName) != "-" {
+ var err error
+ structResult, err = ValidateStruct(valueField.Interface())
+ if err != nil {
+ err = prependPathToErrors(err, typeField.Name)
+ errs = append(errs, err)
+ }
+ }
+ resultField, err2 := typeCheck(valueField, typeField, val, nil)
+ if err2 != nil {
+
+ // Replace structure name with JSON name if there is a tag on the variable
+ jsonTag := toJSONName(typeField.Tag.Get("json"))
+ if jsonTag != "" {
+ switch jsonError := err2.(type) {
+ case Error:
+ jsonError.Name = jsonTag
+ err2 = jsonError
+ case Errors:
+ for i2, err3 := range jsonError {
+ switch customErr := err3.(type) {
+ case Error:
+ customErr.Name = jsonTag
+ jsonError[i2] = customErr
+ }
+ }
+
+ err2 = jsonError
+ }
+ }
+
+ errs = append(errs, err2)
+ }
+ result = result && resultField && structResult
+ }
+ if len(errs) > 0 {
+ err = errs
+ }
+ return result, err
+}
+
+// ValidateStructAsync performs async validation of the struct and returns results through the channels
+func ValidateStructAsync(s interface{}) (<-chan bool, <-chan error) {
+ res := make(chan bool)
+ errors := make(chan error)
+
+ go func() {
+ defer close(res)
+ defer close(errors)
+
+ isValid, isFailed := ValidateStruct(s)
+
+ res <- isValid
+ errors <- isFailed
+ }()
+
+ return res, errors
+}
+
+// ValidateMapAsync performs async validation of the map and returns results through the channels
+func ValidateMapAsync(s map[string]interface{}, m map[string]interface{}) (<-chan bool, <-chan error) {
+ res := make(chan bool)
+ errors := make(chan error)
+
+ go func() {
+ defer close(res)
+ defer close(errors)
+
+ isValid, isFailed := ValidateMap(s, m)
+
+ res <- isValid
+ errors <- isFailed
+ }()
+
+ return res, errors
+}
+
+// parseTagIntoMap parses a struct tag `valid:required~Some error message,length(2|3)` into map[string]string{"required": "Some error message", "length(2|3)": ""}
+func parseTagIntoMap(tag string) tagOptionsMap {
+ optionsMap := make(tagOptionsMap)
+ options := strings.Split(tag, ",")
+
+ for i, option := range options {
+ option = strings.TrimSpace(option)
+
+ validationOptions := strings.Split(option, "~")
+ if !isValidTag(validationOptions[0]) {
+ continue
+ }
+ if len(validationOptions) == 2 {
+ optionsMap[validationOptions[0]] = tagOption{validationOptions[0], validationOptions[1], i}
+ } else {
+ optionsMap[validationOptions[0]] = tagOption{validationOptions[0], "", i}
+ }
+ }
+ return optionsMap
+}
+
+func isValidTag(s string) bool {
+ if s == "" {
+ return false
+ }
+ for _, c := range s {
+ switch {
+ case strings.ContainsRune("\\'\"!#$%&()*+-./:<=>?@[]^_{|}~ ", c):
+ // Backslash and quote chars are reserved, but
+ // otherwise any punctuation chars are allowed
+ // in a tag name.
+ default:
+ if !unicode.IsLetter(c) && !unicode.IsDigit(c) {
+ return false
+ }
+ }
+ }
+ return true
+}
+
+// IsSSN will validate the given string as a U.S. Social Security Number
+func IsSSN(str string) bool {
+ if str == "" || len(str) != 11 {
+ return false
+ }
+ return rxSSN.MatchString(str)
+}
+
+// IsSemver checks if string is valid semantic version
+func IsSemver(str string) bool {
+ return rxSemver.MatchString(str)
+}
+
+// IsType checks if interface is of some type
+func IsType(v interface{}, params ...string) bool {
+ if len(params) == 1 {
+ typ := params[0]
+ return strings.Replace(reflect.TypeOf(v).String(), " ", "", -1) == strings.Replace(typ, " ", "", -1)
+ }
+ return false
+}
+
+// IsTime checks if string is valid according to given format
+func IsTime(str string, format string) bool {
+ _, err := time.Parse(format, str)
+ return err == nil
+}
+
+// IsUnixTime checks if string is valid unix timestamp value
+func IsUnixTime(str string) bool {
+ if _, err := strconv.Atoi(str); err == nil {
+ return true
+ }
+ return false
+}
+
+// IsRFC3339 checks if string is valid timestamp value according to RFC3339
+func IsRFC3339(str string) bool {
+ return IsTime(str, time.RFC3339)
+}
+
+// IsRFC3339WithoutZone checks if string is valid timestamp value according to RFC3339 which excludes the timezone.
+func IsRFC3339WithoutZone(str string) bool {
+ return IsTime(str, rfc3339WithoutZone)
+}
+
+// IsISO4217 checks if string is valid ISO currency code
+func IsISO4217(str string) bool {
+ for _, currency := range ISO4217List {
+ if str == currency {
+ return true
+ }
+ }
+
+ return false
+}
+
+// ByteLength checks string's length
+func ByteLength(str string, params ...string) bool {
+ if len(params) == 2 {
+ min, _ := ToInt(params[0])
+ max, _ := ToInt(params[1])
+ return len(str) >= int(min) && len(str) <= int(max)
+ }
+
+ return false
+}
+
+// RuneLength checks string's length
+// Alias for StringLength
+func RuneLength(str string, params ...string) bool {
+ return StringLength(str, params...)
+}
+
+// IsRsaPub checks whether string is valid RSA key
+// Alias for IsRsaPublicKey
+func IsRsaPub(str string, params ...string) bool {
+ if len(params) == 1 {
+ len, _ := ToInt(params[0])
+ return IsRsaPublicKey(str, int(len))
+ }
+
+ return false
+}
+
+// StringMatches checks if a string matches a given pattern.
+func StringMatches(s string, params ...string) bool {
+ if len(params) == 1 {
+ pattern := params[0]
+ return Matches(s, pattern)
+ }
+ return false
+}
+
+// StringLength checks string's length (including multi byte strings)
+func StringLength(str string, params ...string) bool {
+
+ if len(params) == 2 {
+ strLength := utf8.RuneCountInString(str)
+ min, _ := ToInt(params[0])
+ max, _ := ToInt(params[1])
+ return strLength >= int(min) && strLength <= int(max)
+ }
+
+ return false
+}
+
+// MinStringLength checks string's minimum length (including multi byte strings)
+func MinStringLength(str string, params ...string) bool {
+
+ if len(params) == 1 {
+ strLength := utf8.RuneCountInString(str)
+ min, _ := ToInt(params[0])
+ return strLength >= int(min)
+ }
+
+ return false
+}
+
+// MaxStringLength checks string's maximum length (including multi byte strings)
+func MaxStringLength(str string, params ...string) bool {
+
+ if len(params) == 1 {
+ strLength := utf8.RuneCountInString(str)
+ max, _ := ToInt(params[0])
+ return strLength <= int(max)
+ }
+
+ return false
+}
+
+// Range checks string's length
+func Range(str string, params ...string) bool {
+ if len(params) == 2 {
+ value, _ := ToFloat(str)
+ min, _ := ToFloat(params[0])
+ max, _ := ToFloat(params[1])
+ return InRange(value, min, max)
+ }
+
+ return false
+}
+
+// IsInRaw checks if string is in list of allowed values
+func IsInRaw(str string, params ...string) bool {
+ if len(params) == 1 {
+ rawParams := params[0]
+
+ parsedParams := strings.Split(rawParams, "|")
+
+ return IsIn(str, parsedParams...)
+ }
+
+ return false
+}
+
+// IsIn checks if string str is a member of the set of strings params
+func IsIn(str string, params ...string) bool {
+ for _, param := range params {
+ if str == param {
+ return true
+ }
+ }
+
+ return false
+}
+
+func checkRequired(v reflect.Value, t reflect.StructField, options tagOptionsMap) (bool, error) {
+ if nilPtrAllowedByRequired {
+ k := v.Kind()
+ if (k == reflect.Ptr || k == reflect.Interface) && v.IsNil() {
+ return true, nil
+ }
+ }
+
+ if requiredOption, isRequired := options["required"]; isRequired {
+ if len(requiredOption.customErrorMessage) > 0 {
+ return false, Error{t.Name, fmt.Errorf(requiredOption.customErrorMessage), true, "required", []string{}}
+ }
+ return false, Error{t.Name, fmt.Errorf("non zero value required"), false, "required", []string{}}
+ } else if _, isOptional := options["optional"]; fieldsRequiredByDefault && !isOptional {
+ return false, Error{t.Name, fmt.Errorf("Missing required field"), false, "required", []string{}}
+ }
+ // not required and empty is valid
+ return true, nil
+}
+
+func typeCheck(v reflect.Value, t reflect.StructField, o reflect.Value, options tagOptionsMap) (isValid bool, resultErr error) {
+ if !v.IsValid() {
+ return false, nil
+ }
+
+ tag := t.Tag.Get(tagName)
+
+ // checks if the field should be ignored
+ switch tag {
+ case "":
+ if v.Kind() != reflect.Slice && v.Kind() != reflect.Map {
+ if !fieldsRequiredByDefault {
+ return true, nil
+ }
+ return false, Error{t.Name, fmt.Errorf("All fields are required to at least have one validation defined"), false, "required", []string{}}
+ }
+ case "-":
+ return true, nil
+ }
+
+ isRootType := false
+ if options == nil {
+ isRootType = true
+ options = parseTagIntoMap(tag)
+ }
+
+ if isEmptyValue(v) {
+ // an empty value is not validated, checks only required
+ isValid, resultErr = checkRequired(v, t, options)
+ for key := range options {
+ delete(options, key)
+ }
+ return isValid, resultErr
+ }
+
+ var customTypeErrors Errors
+ optionsOrder := options.orderedKeys()
+ for _, validatorName := range optionsOrder {
+ validatorStruct := options[validatorName]
+ if validatefunc, ok := CustomTypeTagMap.Get(validatorName); ok {
+ delete(options, validatorName)
+
+ if result := validatefunc(v.Interface(), o.Interface()); !result {
+ if len(validatorStruct.customErrorMessage) > 0 {
+ customTypeErrors = append(customTypeErrors, Error{Name: t.Name, Err: TruncatingErrorf(validatorStruct.customErrorMessage, fmt.Sprint(v), validatorName), CustomErrorMessageExists: true, Validator: stripParams(validatorName)})
+ continue
+ }
+ customTypeErrors = append(customTypeErrors, Error{Name: t.Name, Err: fmt.Errorf("%s does not validate as %s", fmt.Sprint(v), validatorName), CustomErrorMessageExists: false, Validator: stripParams(validatorName)})
+ }
+ }
+ }
+
+ if len(customTypeErrors.Errors()) > 0 {
+ return false, customTypeErrors
+ }
+
+ if isRootType {
+ // Ensure that we've checked the value by all specified validators before report that the value is valid
+ defer func() {
+ delete(options, "optional")
+ delete(options, "required")
+
+ if isValid && resultErr == nil && len(options) != 0 {
+ optionsOrder := options.orderedKeys()
+ for _, validator := range optionsOrder {
+ isValid = false
+ resultErr = Error{t.Name, fmt.Errorf(
+ "The following validator is invalid or can't be applied to the field: %q", validator), false, stripParams(validator), []string{}}
+ return
+ }
+ }
+ }()
+ }
+
+ for _, validatorSpec := range optionsOrder {
+ validatorStruct := options[validatorSpec]
+ var negate bool
+ validator := validatorSpec
+ customMsgExists := len(validatorStruct.customErrorMessage) > 0
+
+ // checks whether the tag looks like '!something' or 'something'
+ if validator[0] == '!' {
+ validator = validator[1:]
+ negate = true
+ }
+
+ // checks for interface param validators
+ for key, value := range InterfaceParamTagRegexMap {
+ ps := value.FindStringSubmatch(validator)
+ if len(ps) == 0 {
+ continue
+ }
+
+ validatefunc, ok := InterfaceParamTagMap[key]
+ if !ok {
+ continue
+ }
+
+ delete(options, validatorSpec)
+
+ field := fmt.Sprint(v)
+ if result := validatefunc(v.Interface(), ps[1:]...); (!result && !negate) || (result && negate) {
+ if customMsgExists {
+ return false, Error{t.Name, TruncatingErrorf(validatorStruct.customErrorMessage, field, validator), customMsgExists, stripParams(validatorSpec), []string{}}
+ }
+ if negate {
+ return false, Error{t.Name, fmt.Errorf("%s does validate as %s", field, validator), customMsgExists, stripParams(validatorSpec), []string{}}
+ }
+ return false, Error{t.Name, fmt.Errorf("%s does not validate as %s", field, validator), customMsgExists, stripParams(validatorSpec), []string{}}
+ }
+ }
+ }
+
+ switch v.Kind() {
+ case reflect.Bool,
+ reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
+ reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr,
+ reflect.Float32, reflect.Float64,
+ reflect.String:
+ // for each tag option checks the map of validator functions
+ for _, validatorSpec := range optionsOrder {
+ validatorStruct := options[validatorSpec]
+ var negate bool
+ validator := validatorSpec
+ customMsgExists := len(validatorStruct.customErrorMessage) > 0
+
+ // checks whether the tag looks like '!something' or 'something'
+ if validator[0] == '!' {
+ validator = validator[1:]
+ negate = true
+ }
+
+ // checks for param validators
+ for key, value := range ParamTagRegexMap {
+ ps := value.FindStringSubmatch(validator)
+ if len(ps) == 0 {
+ continue
+ }
+
+ validatefunc, ok := ParamTagMap[key]
+ if !ok {
+ continue
+ }
+
+ delete(options, validatorSpec)
+
+ switch v.Kind() {
+ case reflect.String,
+ reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
+ reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,
+ reflect.Float32, reflect.Float64:
+
+ field := fmt.Sprint(v) // make value into string, then validate with regex
+ if result := validatefunc(field, ps[1:]...); (!result && !negate) || (result && negate) {
+ if customMsgExists {
+ return false, Error{t.Name, TruncatingErrorf(validatorStruct.customErrorMessage, field, validator), customMsgExists, stripParams(validatorSpec), []string{}}
+ }
+ if negate {
+ return false, Error{t.Name, fmt.Errorf("%s does validate as %s", field, validator), customMsgExists, stripParams(validatorSpec), []string{}}
+ }
+ return false, Error{t.Name, fmt.Errorf("%s does not validate as %s", field, validator), customMsgExists, stripParams(validatorSpec), []string{}}
+ }
+ default:
+ // type not yet supported, fail
+ return false, Error{t.Name, fmt.Errorf("Validator %s doesn't support kind %s", validator, v.Kind()), false, stripParams(validatorSpec), []string{}}
+ }
+ }
+
+ if validatefunc, ok := TagMap[validator]; ok {
+ delete(options, validatorSpec)
+
+ switch v.Kind() {
+ case reflect.String,
+ reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
+ reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,
+ reflect.Float32, reflect.Float64:
+ field := fmt.Sprint(v) // make value into string, then validate with regex
+ if result := validatefunc(field); !result && !negate || result && negate {
+ if customMsgExists {
+ return false, Error{t.Name, TruncatingErrorf(validatorStruct.customErrorMessage, field, validator), customMsgExists, stripParams(validatorSpec), []string{}}
+ }
+ if negate {
+ return false, Error{t.Name, fmt.Errorf("%s does validate as %s", field, validator), customMsgExists, stripParams(validatorSpec), []string{}}
+ }
+ return false, Error{t.Name, fmt.Errorf("%s does not validate as %s", field, validator), customMsgExists, stripParams(validatorSpec), []string{}}
+ }
+ default:
+ //Not Yet Supported Types (Fail here!)
+ err := fmt.Errorf("Validator %s doesn't support kind %s for value %v", validator, v.Kind(), v)
+ return false, Error{t.Name, err, false, stripParams(validatorSpec), []string{}}
+ }
+ }
+ }
+ return true, nil
+ case reflect.Map:
+ if v.Type().Key().Kind() != reflect.String {
+ return false, &UnsupportedTypeError{v.Type()}
+ }
+ var sv stringValues
+ sv = v.MapKeys()
+ sort.Sort(sv)
+ result := true
+ for i, k := range sv {
+ var resultItem bool
+ var err error
+ if v.MapIndex(k).Kind() != reflect.Struct {
+ resultItem, err = typeCheck(v.MapIndex(k), t, o, options)
+ if err != nil {
+ return false, err
+ }
+ } else {
+ resultItem, err = ValidateStruct(v.MapIndex(k).Interface())
+ if err != nil {
+ err = prependPathToErrors(err, t.Name+"."+sv[i].Interface().(string))
+ return false, err
+ }
+ }
+ result = result && resultItem
+ }
+ return result, nil
+ case reflect.Slice, reflect.Array:
+ result := true
+ for i := 0; i < v.Len(); i++ {
+ var resultItem bool
+ var err error
+ if v.Index(i).Kind() != reflect.Struct {
+ resultItem, err = typeCheck(v.Index(i), t, o, options)
+ if err != nil {
+ return false, err
+ }
+ } else {
+ resultItem, err = ValidateStruct(v.Index(i).Interface())
+ if err != nil {
+ err = prependPathToErrors(err, t.Name+"."+strconv.Itoa(i))
+ return false, err
+ }
+ }
+ result = result && resultItem
+ }
+ return result, nil
+ case reflect.Interface:
+ // If the value is an interface then encode its element
+ if v.IsNil() {
+ return true, nil
+ }
+ return ValidateStruct(v.Interface())
+ case reflect.Ptr:
+ // If the value is a pointer then checks its element
+ if v.IsNil() {
+ return true, nil
+ }
+ return typeCheck(v.Elem(), t, o, options)
+ case reflect.Struct:
+ return true, nil
+ default:
+ return false, &UnsupportedTypeError{v.Type()}
+ }
+}
+
+func stripParams(validatorString string) string {
+ return paramsRegexp.ReplaceAllString(validatorString, "")
+}
+
+// isEmptyValue checks whether value empty or not
+func isEmptyValue(v reflect.Value) bool {
+ switch v.Kind() {
+ case reflect.String, reflect.Array:
+ return v.Len() == 0
+ case reflect.Map, reflect.Slice:
+ return v.Len() == 0 || v.IsNil()
+ case reflect.Bool:
+ return !v.Bool()
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ return v.Int() == 0
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
+ return v.Uint() == 0
+ case reflect.Float32, reflect.Float64:
+ return v.Float() == 0
+ case reflect.Interface, reflect.Ptr:
+ return v.IsNil()
+ }
+
+ return reflect.DeepEqual(v.Interface(), reflect.Zero(v.Type()).Interface())
+}
+
+// ErrorByField returns error for specified field of the struct
+// validated by ValidateStruct or empty string if there are no errors
+// or this field doesn't exists or doesn't have any errors.
+func ErrorByField(e error, field string) string {
+ if e == nil {
+ return ""
+ }
+ return ErrorsByField(e)[field]
+}
+
+// ErrorsByField returns map of errors of the struct validated
+// by ValidateStruct or empty map if there are no errors.
+func ErrorsByField(e error) map[string]string {
+ m := make(map[string]string)
+ if e == nil {
+ return m
+ }
+ // prototype for ValidateStruct
+
+ switch e := e.(type) {
+ case Error:
+ m[e.Name] = e.Err.Error()
+ case Errors:
+ for _, item := range e.Errors() {
+ n := ErrorsByField(item)
+ for k, v := range n {
+ m[k] = v
+ }
+ }
+ }
+
+ return m
+}
+
+// Error returns string equivalent for reflect.Type
+func (e *UnsupportedTypeError) Error() string {
+ return "validator: unsupported type: " + e.Type.String()
+}
+
+func (sv stringValues) Len() int { return len(sv) }
+func (sv stringValues) Swap(i, j int) { sv[i], sv[j] = sv[j], sv[i] }
+func (sv stringValues) Less(i, j int) bool { return sv.get(i) < sv.get(j) }
+func (sv stringValues) get(i int) string { return sv[i].String() }
+
+func IsE164(str string) bool {
+ return rxE164.MatchString(str)
+}
diff --git a/vendor/github.com/asaskevich/govalidator/wercker.yml b/vendor/github.com/asaskevich/govalidator/wercker.yml
new file mode 100644
index 0000000000..bc5f7b0864
--- /dev/null
+++ b/vendor/github.com/asaskevich/govalidator/wercker.yml
@@ -0,0 +1,15 @@
+box: golang
+build:
+ steps:
+ - setup-go-workspace
+
+ - script:
+ name: go get
+ code: |
+ go version
+ go get -t ./...
+
+ - script:
+ name: go test
+ code: |
+ go test -race -v ./...
diff --git a/vendor/github.com/chanxuehong/util/security/compare.go b/vendor/github.com/chanxuehong/util/security/compare.go
deleted file mode 100644
index f24ee451c3..0000000000
--- a/vendor/github.com/chanxuehong/util/security/compare.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package security
-
-import (
- "crypto/subtle"
-)
-
-func SecureCompare(given, actual []byte) bool {
- if subtle.ConstantTimeEq(int32(len(given)), int32(len(actual))) == 1 {
- if subtle.ConstantTimeCompare(given, actual) == 1 {
- return true
- }
- return false
- }
- // Securely compare actual to itself to keep constant time, but always return false
- if subtle.ConstantTimeCompare(actual, actual) == 1 {
- return false
- }
- return false
-}
-
-func SecureCompareString(given, actual string) bool {
- // The following code is incorrect:
- // return SecureCompare([]byte(given), []byte(actual))
-
- if subtle.ConstantTimeEq(int32(len(given)), int32(len(actual))) == 1 {
- if subtle.ConstantTimeCompare([]byte(given), []byte(actual)) == 1 {
- return true
- }
- return false
- }
- // Securely compare actual to itself to keep constant time, but always return false
- if subtle.ConstantTimeCompare([]byte(actual), []byte(actual)) == 1 {
- return false
- }
- return false
-}
diff --git a/vendor/github.com/fatih/color/README.md b/vendor/github.com/fatih/color/README.md
index 42d9abc07e..5152bf59bf 100644
--- a/vendor/github.com/fatih/color/README.md
+++ b/vendor/github.com/fatih/color/README.md
@@ -1,20 +1,11 @@
-# Archived project. No maintenance.
-
-This project is not maintained anymore and is archived. Feel free to fork and
-make your own changes if needed. For more detail read my blog post: [Taking an indefinite sabbatical from my projects](https://arslan.io/2018/10/09/taking-an-indefinite-sabbatical-from-my-projects/)
-
-Thanks to everyone for their valuable feedback and contributions.
-
-
-# Color [](https://godoc.org/github.com/fatih/color)
+# color [](https://github.com/fatih/color/actions) [](https://pkg.go.dev/github.com/fatih/color)
Color lets you use colorized outputs in terms of [ANSI Escape
Codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors) in Go (Golang). It
has support for Windows too! The API can be used in several ways, pick one that
suits you.
-
-
+
## Install
@@ -87,7 +78,7 @@ notice("Don't forget this...")
### Custom fprint functions (FprintFunc)
```go
-blue := color.New(FgBlue).FprintfFunc()
+blue := color.New(color.FgBlue).FprintfFunc()
blue(myWriter, "important notice: %s", stars)
// Mix up with multiple attributes
@@ -136,14 +127,16 @@ fmt.Println("All text will now be bold magenta.")
There might be a case where you want to explicitly disable/enable color output. the
`go-isatty` package will automatically disable color output for non-tty output streams
-(for example if the output were piped directly to `less`)
+(for example if the output were piped directly to `less`).
-`Color` has support to disable/enable colors both globally and for single color
-definitions. For example suppose you have a CLI app and a `--no-color` bool flag. You
-can easily disable the color output with:
+The `color` package also disables color output if the [`NO_COLOR`](https://no-color.org) environment
+variable is set (regardless of its value).
-```go
+`Color` has support to disable/enable colors programatically both globally and
+for single color definitions. For example suppose you have a CLI app and a
+`--no-color` bool flag. You can easily disable the color output with:
+```go
var flagNoColor = flag.Bool("no-color", false, "Disable color output")
if *flagNoColor {
@@ -165,6 +158,10 @@ c.EnableColor()
c.Println("This prints again cyan...")
```
+## GitHub Actions
+
+To output color in GitHub Actions (or other CI systems that support ANSI colors), make sure to set `color.NoColor = false` so that it bypasses the check for non-tty output streams.
+
## Todo
* Save/Return previous values
@@ -179,4 +176,3 @@ c.Println("This prints again cyan...")
## License
The MIT License (MIT) - see [`LICENSE.md`](https://github.com/fatih/color/blob/master/LICENSE.md) for more details
-
diff --git a/vendor/github.com/fatih/color/color.go b/vendor/github.com/fatih/color/color.go
index 91c8e9f062..98a60f3c88 100644
--- a/vendor/github.com/fatih/color/color.go
+++ b/vendor/github.com/fatih/color/color.go
@@ -15,9 +15,11 @@ import (
var (
// NoColor defines if the output is colorized or not. It's dynamically set to
// false or true based on the stdout's file descriptor referring to a terminal
- // or not. This is a global option and affects all colors. For more control
- // over each color block use the methods DisableColor() individually.
- NoColor = os.Getenv("TERM") == "dumb" ||
+ // or not. It's also set to true if the NO_COLOR environment variable is
+ // set (regardless of its value). This is a global option and affects all
+ // colors. For more control over each color block use the methods
+ // DisableColor() individually.
+ NoColor = noColorExists() || os.Getenv("TERM") == "dumb" ||
(!isatty.IsTerminal(os.Stdout.Fd()) && !isatty.IsCygwinTerminal(os.Stdout.Fd()))
// Output defines the standard output of the print functions. By default
@@ -33,6 +35,12 @@ var (
colorsCacheMu sync.Mutex // protects colorsCache
)
+// noColorExists returns true if the environment variable NO_COLOR exists.
+func noColorExists() bool {
+ _, exists := os.LookupEnv("NO_COLOR")
+ return exists
+}
+
// Color defines a custom color object which is defined by SGR parameters.
type Color struct {
params []Attribute
@@ -108,7 +116,14 @@ const (
// New returns a newly created color object.
func New(value ...Attribute) *Color {
- c := &Color{params: make([]Attribute, 0)}
+ c := &Color{
+ params: make([]Attribute, 0),
+ }
+
+ if noColorExists() {
+ c.noColor = boolPtr(true)
+ }
+
c.Add(value...)
return c
}
@@ -387,7 +402,7 @@ func (c *Color) EnableColor() {
}
func (c *Color) isNoColorSet() bool {
- // check first if we have user setted action
+ // check first if we have user set action
if c.noColor != nil {
return *c.noColor
}
diff --git a/vendor/github.com/fatih/color/doc.go b/vendor/github.com/fatih/color/doc.go
index cf1e96500f..04541de786 100644
--- a/vendor/github.com/fatih/color/doc.go
+++ b/vendor/github.com/fatih/color/doc.go
@@ -118,6 +118,8 @@ the color output with:
color.NoColor = true // disables colorized output
}
+You can also disable the color by setting the NO_COLOR environment variable to any value.
+
It also has support for single color definitions (local). You can
disable/enable color output on the fly:
diff --git a/vendor/github.com/gabriel-vasile/mimetype/.gitattributes b/vendor/github.com/gabriel-vasile/mimetype/.gitattributes
new file mode 100644
index 0000000000..0cc26ec01c
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/.gitattributes
@@ -0,0 +1 @@
+testdata/* linguist-vendored
diff --git a/vendor/github.com/gabriel-vasile/mimetype/CODE_OF_CONDUCT.md b/vendor/github.com/gabriel-vasile/mimetype/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000000..8479cd87d6
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/CODE_OF_CONDUCT.md
@@ -0,0 +1,76 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, sex characteristics, gender identity and expression,
+level of experience, education, socio-economic status, nationality, personal
+appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+ advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at vasile.gabriel@email.com. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
+
+[homepage]: https://www.contributor-covenant.org
+
+For answers to common questions about this code of conduct, see
+https://www.contributor-covenant.org/faq
diff --git a/vendor/github.com/gabriel-vasile/mimetype/CONTRIBUTING.md b/vendor/github.com/gabriel-vasile/mimetype/CONTRIBUTING.md
new file mode 100644
index 0000000000..56ae4e57c6
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/CONTRIBUTING.md
@@ -0,0 +1,12 @@
+## Contribute
+Contributions to **mimetype** are welcome. If you find an issue and you consider
+contributing, you can use the [Github issues tracker](https://github.com/gabriel-vasile/mimetype/issues)
+in order to report it, or better yet, open a pull request.
+
+Code contributions must respect these rules:
+ - code must be test covered
+ - code must be formatted using gofmt tool
+ - exported names must be documented
+
+**Important**: By submitting a pull request, you agree to allow the project
+owner to license your work under the same license as that used by the project.
diff --git a/vendor/github.com/gabriel-vasile/mimetype/LICENSE b/vendor/github.com/gabriel-vasile/mimetype/LICENSE
new file mode 100644
index 0000000000..6aac070c78
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018-2020 Gabriel Vasile
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/vendor/github.com/gabriel-vasile/mimetype/README.md b/vendor/github.com/gabriel-vasile/mimetype/README.md
new file mode 100644
index 0000000000..d310928dea
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/README.md
@@ -0,0 +1,108 @@
+
+ mimetype
+
+
+
+ A package for detecting MIME types and extensions based on magic numbers
+
+
+ Goroutine safe, extensible, no C bindings
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## Features
+- fast and precise MIME type and file extension detection
+- long list of [supported MIME types](supported_mimes.md)
+- possibility to [extend](https://pkg.go.dev/github.com/gabriel-vasile/mimetype#example-package-Extend) with other file formats
+- common file formats are prioritized
+- [text vs. binary files differentiation](https://pkg.go.dev/github.com/gabriel-vasile/mimetype#example-package-TextVsBinary)
+- safe for concurrent usage
+
+## Install
+```bash
+go get github.com/gabriel-vasile/mimetype
+```
+
+## Usage
+```go
+mtype := mimetype.Detect([]byte)
+// OR
+mtype, err := mimetype.DetectReader(io.Reader)
+// OR
+mtype, err := mimetype.DetectFile("/path/to/file")
+fmt.Println(mtype.String(), mtype.Extension())
+```
+See the [runnable Go Playground examples](https://pkg.go.dev/github.com/gabriel-vasile/mimetype#pkg-overview).
+
+## Usage'
+Only use libraries like **mimetype** as a last resort. Content type detection
+using magic numbers is slow, inaccurate, and non-standard. Most of the times
+protocols have methods for specifying such metadata; e.g., `Content-Type` header
+in HTTP and SMTP.
+
+## FAQ
+Q: My file is in the list of [supported MIME types](supported_mimes.md) but
+it is not correctly detected. What should I do?
+
+A: Some file formats (often Microsoft Office documents) keep their signatures
+towards the end of the file. Try increasing the number of bytes used for detection
+with:
+```go
+mimetype.SetLimit(1024*1024) // Set limit to 1MB.
+// or
+mimetype.SetLimit(0) // No limit, whole file content used.
+mimetype.DetectFile("file.doc")
+```
+If increasing the limit does not help, please
+[open an issue](https://github.com/gabriel-vasile/mimetype/issues/new?assignees=&labels=&template=mismatched-mime-type-detected.md&title=).
+
+## Structure
+**mimetype** uses a hierarchical structure to keep the MIME type detection logic.
+This reduces the number of calls needed for detecting the file type. The reason
+behind this choice is that there are file formats used as containers for other
+file formats. For example, Microsoft Office files are just zip archives,
+containing specific metadata files. Once a file has been identified as a
+zip, there is no need to check if it is a text file, but it is worth checking if
+it is an Microsoft Office file.
+
+To prevent loading entire files into memory, when detecting from a
+[reader](https://pkg.go.dev/github.com/gabriel-vasile/mimetype#DetectReader)
+or from a [file](https://pkg.go.dev/github.com/gabriel-vasile/mimetype#DetectFile)
+**mimetype** limits itself to reading only the header of the input.
+
+
+
+
+## Performance
+Thanks to the hierarchical structure, searching for common formats first,
+and limiting itself to file headers, **mimetype** matches the performance of
+stdlib `http.DetectContentType` while outperforming the alternative package.
+
+```bash
+ mimetype http.DetectContentType filetype
+BenchmarkMatchTar-24 250 ns/op 400 ns/op 3778 ns/op
+BenchmarkMatchZip-24 524 ns/op 351 ns/op 4884 ns/op
+BenchmarkMatchJpeg-24 103 ns/op 228 ns/op 839 ns/op
+BenchmarkMatchGif-24 139 ns/op 202 ns/op 751 ns/op
+BenchmarkMatchPng-24 165 ns/op 221 ns/op 1176 ns/op
+```
+
+## Contributing
+See [CONTRIBUTING.md](CONTRIBUTING.md).
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/charset/charset.go b/vendor/github.com/gabriel-vasile/mimetype/internal/charset/charset.go
new file mode 100644
index 0000000000..0647f730e5
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/charset/charset.go
@@ -0,0 +1,309 @@
+package charset
+
+import (
+ "bytes"
+ "encoding/xml"
+ "strings"
+ "unicode/utf8"
+
+ "golang.org/x/net/html"
+)
+
+const (
+ F = 0 /* character never appears in text */
+ T = 1 /* character appears in plain ASCII text */
+ I = 2 /* character appears in ISO-8859 text */
+ X = 3 /* character appears in non-ISO extended ASCII (Mac, IBM PC) */
+)
+
+var (
+ boms = []struct {
+ bom []byte
+ enc string
+ }{
+ {[]byte{0xEF, 0xBB, 0xBF}, "utf-8"},
+ {[]byte{0x00, 0x00, 0xFE, 0xFF}, "utf-32be"},
+ {[]byte{0xFF, 0xFE, 0x00, 0x00}, "utf-32le"},
+ {[]byte{0xFE, 0xFF}, "utf-16be"},
+ {[]byte{0xFF, 0xFE}, "utf-16le"},
+ }
+
+ // https://github.com/file/file/blob/fa93fb9f7d21935f1c7644c47d2975d31f12b812/src/encoding.c#L241
+ textChars = [256]byte{
+ /* BEL BS HT LF VT FF CR */
+ F, F, F, F, F, F, F, T, T, T, T, T, T, T, F, F, /* 0x0X */
+ /* ESC */
+ F, F, F, F, F, F, F, F, F, F, F, T, F, F, F, F, /* 0x1X */
+ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x2X */
+ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x3X */
+ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x4X */
+ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x5X */
+ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x6X */
+ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, F, /* 0x7X */
+ /* NEL */
+ X, X, X, X, X, T, X, X, X, X, X, X, X, X, X, X, /* 0x8X */
+ X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, /* 0x9X */
+ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xaX */
+ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xbX */
+ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xcX */
+ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xdX */
+ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xeX */
+ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xfX */
+ }
+)
+
+// FromBOM returns the charset declared in the BOM of content.
+func FromBOM(content []byte) string {
+ for _, b := range boms {
+ if bytes.HasPrefix(content, b.bom) {
+ return b.enc
+ }
+ }
+ return ""
+}
+
+// FromPlain returns the charset of a plain text. It relies on BOM presence
+// and it falls back on checking each byte in content.
+func FromPlain(content []byte) string {
+ if len(content) == 0 {
+ return ""
+ }
+ if cset := FromBOM(content); cset != "" {
+ return cset
+ }
+ origContent := content
+ // Try to detect UTF-8.
+ // First eliminate any partial rune at the end.
+ for i := len(content) - 1; i >= 0 && i > len(content)-4; i-- {
+ b := content[i]
+ if b < 0x80 {
+ break
+ }
+ if utf8.RuneStart(b) {
+ content = content[:i]
+ break
+ }
+ }
+ hasHighBit := false
+ for _, c := range content {
+ if c >= 0x80 {
+ hasHighBit = true
+ break
+ }
+ }
+ if hasHighBit && utf8.Valid(content) {
+ return "utf-8"
+ }
+
+ // ASCII is a subset of UTF8. Follow W3C recommendation and replace with UTF8.
+ if ascii(origContent) {
+ return "utf-8"
+ }
+
+ return latin(origContent)
+}
+
+func latin(content []byte) string {
+ hasControlBytes := false
+ for _, b := range content {
+ t := textChars[b]
+ if t != T && t != I {
+ return ""
+ }
+ if b >= 0x80 && b <= 0x9F {
+ hasControlBytes = true
+ }
+ }
+ // Code range 0x80 to 0x9F is reserved for control characters in ISO-8859-1
+ // (so-called C1 Controls). Windows 1252, however, has printable punctuation
+ // characters in this range.
+ if hasControlBytes {
+ return "windows-1252"
+ }
+ return "iso-8859-1"
+}
+
+func ascii(content []byte) bool {
+ for _, b := range content {
+ if textChars[b] != T {
+ return false
+ }
+ }
+ return true
+}
+
+// FromXML returns the charset of an XML document. It relies on the XML
+// header and falls back on the plain
+// text content.
+func FromXML(content []byte) string {
+ if cset := fromXML(content); cset != "" {
+ return cset
+ }
+ return FromPlain(content)
+}
+func fromXML(content []byte) string {
+ content = trimLWS(content)
+ dec := xml.NewDecoder(bytes.NewReader(content))
+ rawT, err := dec.RawToken()
+ if err != nil {
+ return ""
+ }
+
+ t, ok := rawT.(xml.ProcInst)
+ if !ok {
+ return ""
+ }
+
+ return strings.ToLower(xmlEncoding(string(t.Inst)))
+}
+
+// FromHTML returns the charset of an HTML document. It first looks if a BOM is
+// present and if so uses it to determine the charset. If no BOM is present,
+// it relies on the meta tag and falls back on the
+// plain text content.
+func FromHTML(content []byte) string {
+ if cset := FromBOM(content); cset != "" {
+ return cset
+ }
+ if cset := fromHTML(content); cset != "" {
+ return cset
+ }
+ return FromPlain(content)
+}
+
+func fromHTML(content []byte) string {
+ z := html.NewTokenizer(bytes.NewReader(content))
+ for {
+ switch z.Next() {
+ case html.ErrorToken:
+ return ""
+
+ case html.StartTagToken, html.SelfClosingTagToken:
+ tagName, hasAttr := z.TagName()
+ if !bytes.Equal(tagName, []byte("meta")) {
+ continue
+ }
+ attrList := make(map[string]bool)
+ gotPragma := false
+
+ const (
+ dontKnow = iota
+ doNeedPragma
+ doNotNeedPragma
+ )
+ needPragma := dontKnow
+
+ name := ""
+ for hasAttr {
+ var key, val []byte
+ key, val, hasAttr = z.TagAttr()
+ ks := string(key)
+ if attrList[ks] {
+ continue
+ }
+ attrList[ks] = true
+ for i, c := range val {
+ if 'A' <= c && c <= 'Z' {
+ val[i] = c + 0x20
+ }
+ }
+
+ switch ks {
+ case "http-equiv":
+ if bytes.Equal(val, []byte("content-type")) {
+ gotPragma = true
+ }
+
+ case "content":
+ name = fromMetaElement(string(val))
+ if name != "" {
+ needPragma = doNeedPragma
+ }
+
+ case "charset":
+ name = string(val)
+ needPragma = doNotNeedPragma
+ }
+ }
+
+ if needPragma == dontKnow || needPragma == doNeedPragma && !gotPragma {
+ continue
+ }
+
+ if strings.HasPrefix(name, "utf-16") {
+ name = "utf-8"
+ }
+
+ return name
+ }
+ }
+}
+
+func fromMetaElement(s string) string {
+ for s != "" {
+ csLoc := strings.Index(s, "charset")
+ if csLoc == -1 {
+ return ""
+ }
+ s = s[csLoc+len("charset"):]
+ s = strings.TrimLeft(s, " \t\n\f\r")
+ if !strings.HasPrefix(s, "=") {
+ continue
+ }
+ s = s[1:]
+ s = strings.TrimLeft(s, " \t\n\f\r")
+ if s == "" {
+ return ""
+ }
+ if q := s[0]; q == '"' || q == '\'' {
+ s = s[1:]
+ closeQuote := strings.IndexRune(s, rune(q))
+ if closeQuote == -1 {
+ return ""
+ }
+ return s[:closeQuote]
+ }
+
+ end := strings.IndexAny(s, "; \t\n\f\r")
+ if end == -1 {
+ end = len(s)
+ }
+ return s[:end]
+ }
+ return ""
+}
+
+func xmlEncoding(s string) string {
+ param := "encoding="
+ idx := strings.Index(s, param)
+ if idx == -1 {
+ return ""
+ }
+ v := s[idx+len(param):]
+ if v == "" {
+ return ""
+ }
+ if v[0] != '\'' && v[0] != '"' {
+ return ""
+ }
+ idx = strings.IndexRune(v[1:], rune(v[0]))
+ if idx == -1 {
+ return ""
+ }
+ return v[1 : idx+1]
+}
+
+// trimLWS trims whitespace from beginning of the input.
+// TODO: find a way to call trimLWS once per detection instead of once in each
+// detector which needs the trimmed input.
+func trimLWS(in []byte) []byte {
+ firstNonWS := 0
+ for ; firstNonWS < len(in) && isWS(in[firstNonWS]); firstNonWS++ {
+ }
+
+ return in[firstNonWS:]
+}
+
+func isWS(b byte) bool {
+ return b == '\t' || b == '\n' || b == '\x0c' || b == '\r' || b == ' '
+}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/json/json.go b/vendor/github.com/gabriel-vasile/mimetype/internal/json/json.go
new file mode 100644
index 0000000000..ee39349aef
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/json/json.go
@@ -0,0 +1,544 @@
+// Copyright (c) 2009 The Go Authors. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Package json provides a JSON value parser state machine.
+// This package is almost entirely copied from the Go stdlib.
+// Changes made to it permit users of the package to tell
+// if some slice of bytes is a valid beginning of a json string.
+package json
+
+import (
+ "fmt"
+)
+
+type (
+ scanStatus int
+)
+
+const (
+ parseObjectKey = iota // parsing object key (before colon)
+ parseObjectValue // parsing object value (after colon)
+ parseArrayValue // parsing array value
+
+ scanContinue scanStatus = iota // uninteresting byte
+ scanBeginLiteral // end implied by next result != scanContinue
+ scanBeginObject // begin object
+ scanObjectKey // just finished object key (string)
+ scanObjectValue // just finished non-last object value
+ scanEndObject // end object (implies scanObjectValue if possible)
+ scanBeginArray // begin array
+ scanArrayValue // just finished array value
+ scanEndArray // end array (implies scanArrayValue if possible)
+ scanSkipSpace // space byte; can skip; known to be last "continue" result
+ scanEnd // top-level value ended *before* this byte; known to be first "stop" result
+ scanError // hit an error, scanner.err.
+
+ // This limits the max nesting depth to prevent stack overflow.
+ // This is permitted by https://tools.ietf.org/html/rfc7159#section-9
+ maxNestingDepth = 10000
+)
+
+type (
+ scanner struct {
+ step func(*scanner, byte) scanStatus
+ parseState []int
+ endTop bool
+ err error
+ index int
+ }
+)
+
+// Scan returns the number of bytes scanned and if there was any error
+// in trying to reach the end of data.
+func Scan(data []byte) (int, error) {
+ s := &scanner{}
+ _ = checkValid(data, s)
+ return s.index, s.err
+}
+
+// checkValid verifies that data is valid JSON-encoded data.
+// scan is passed in for use by checkValid to avoid an allocation.
+func checkValid(data []byte, scan *scanner) error {
+ scan.reset()
+ for _, c := range data {
+ scan.index++
+ if scan.step(scan, c) == scanError {
+ return scan.err
+ }
+ }
+ if scan.eof() == scanError {
+ return scan.err
+ }
+ return nil
+}
+
+func isSpace(c byte) bool {
+ return c == ' ' || c == '\t' || c == '\r' || c == '\n'
+}
+
+func (s *scanner) reset() {
+ s.step = stateBeginValue
+ s.parseState = s.parseState[0:0]
+ s.err = nil
+}
+
+// eof tells the scanner that the end of input has been reached.
+// It returns a scan status just as s.step does.
+func (s *scanner) eof() scanStatus {
+ if s.err != nil {
+ return scanError
+ }
+ if s.endTop {
+ return scanEnd
+ }
+ s.step(s, ' ')
+ if s.endTop {
+ return scanEnd
+ }
+ if s.err == nil {
+ s.err = fmt.Errorf("unexpected end of JSON input")
+ }
+ return scanError
+}
+
+// pushParseState pushes a new parse state p onto the parse stack.
+// an error state is returned if maxNestingDepth was exceeded, otherwise successState is returned.
+func (s *scanner) pushParseState(c byte, newParseState int, successState scanStatus) scanStatus {
+ s.parseState = append(s.parseState, newParseState)
+ if len(s.parseState) <= maxNestingDepth {
+ return successState
+ }
+ return s.error(c, "exceeded max depth")
+}
+
+// popParseState pops a parse state (already obtained) off the stack
+// and updates s.step accordingly.
+func (s *scanner) popParseState() {
+ n := len(s.parseState) - 1
+ s.parseState = s.parseState[0:n]
+ if n == 0 {
+ s.step = stateEndTop
+ s.endTop = true
+ } else {
+ s.step = stateEndValue
+ }
+}
+
+// stateBeginValueOrEmpty is the state after reading `[`.
+func stateBeginValueOrEmpty(s *scanner, c byte) scanStatus {
+ if c <= ' ' && isSpace(c) {
+ return scanSkipSpace
+ }
+ if c == ']' {
+ return stateEndValue(s, c)
+ }
+ return stateBeginValue(s, c)
+}
+
+// stateBeginValue is the state at the beginning of the input.
+func stateBeginValue(s *scanner, c byte) scanStatus {
+ if c <= ' ' && isSpace(c) {
+ return scanSkipSpace
+ }
+ switch c {
+ case '{':
+ s.step = stateBeginStringOrEmpty
+ return s.pushParseState(c, parseObjectKey, scanBeginObject)
+ case '[':
+ s.step = stateBeginValueOrEmpty
+ return s.pushParseState(c, parseArrayValue, scanBeginArray)
+ case '"':
+ s.step = stateInString
+ return scanBeginLiteral
+ case '-':
+ s.step = stateNeg
+ return scanBeginLiteral
+ case '0': // beginning of 0.123
+ s.step = state0
+ return scanBeginLiteral
+ case 't': // beginning of true
+ s.step = stateT
+ return scanBeginLiteral
+ case 'f': // beginning of false
+ s.step = stateF
+ return scanBeginLiteral
+ case 'n': // beginning of null
+ s.step = stateN
+ return scanBeginLiteral
+ }
+ if '1' <= c && c <= '9' { // beginning of 1234.5
+ s.step = state1
+ return scanBeginLiteral
+ }
+ return s.error(c, "looking for beginning of value")
+}
+
+// stateBeginStringOrEmpty is the state after reading `{`.
+func stateBeginStringOrEmpty(s *scanner, c byte) scanStatus {
+ if c <= ' ' && isSpace(c) {
+ return scanSkipSpace
+ }
+ if c == '}' {
+ n := len(s.parseState)
+ s.parseState[n-1] = parseObjectValue
+ return stateEndValue(s, c)
+ }
+ return stateBeginString(s, c)
+}
+
+// stateBeginString is the state after reading `{"key": value,`.
+func stateBeginString(s *scanner, c byte) scanStatus {
+ if c <= ' ' && isSpace(c) {
+ return scanSkipSpace
+ }
+ if c == '"' {
+ s.step = stateInString
+ return scanBeginLiteral
+ }
+ return s.error(c, "looking for beginning of object key string")
+}
+
+// stateEndValue is the state after completing a value,
+// such as after reading `{}` or `true` or `["x"`.
+func stateEndValue(s *scanner, c byte) scanStatus {
+ n := len(s.parseState)
+ if n == 0 {
+ // Completed top-level before the current byte.
+ s.step = stateEndTop
+ s.endTop = true
+ return stateEndTop(s, c)
+ }
+ if c <= ' ' && isSpace(c) {
+ s.step = stateEndValue
+ return scanSkipSpace
+ }
+ ps := s.parseState[n-1]
+ switch ps {
+ case parseObjectKey:
+ if c == ':' {
+ s.parseState[n-1] = parseObjectValue
+ s.step = stateBeginValue
+ return scanObjectKey
+ }
+ return s.error(c, "after object key")
+ case parseObjectValue:
+ if c == ',' {
+ s.parseState[n-1] = parseObjectKey
+ s.step = stateBeginString
+ return scanObjectValue
+ }
+ if c == '}' {
+ s.popParseState()
+ return scanEndObject
+ }
+ return s.error(c, "after object key:value pair")
+ case parseArrayValue:
+ if c == ',' {
+ s.step = stateBeginValue
+ return scanArrayValue
+ }
+ if c == ']' {
+ s.popParseState()
+ return scanEndArray
+ }
+ return s.error(c, "after array element")
+ }
+ return s.error(c, "")
+}
+
+// stateEndTop is the state after finishing the top-level value,
+// such as after reading `{}` or `[1,2,3]`.
+// Only space characters should be seen now.
+func stateEndTop(s *scanner, c byte) scanStatus {
+ if c != ' ' && c != '\t' && c != '\r' && c != '\n' {
+ // Complain about non-space byte on next call.
+ s.error(c, "after top-level value")
+ }
+ return scanEnd
+}
+
+// stateInString is the state after reading `"`.
+func stateInString(s *scanner, c byte) scanStatus {
+ if c == '"' {
+ s.step = stateEndValue
+ return scanContinue
+ }
+ if c == '\\' {
+ s.step = stateInStringEsc
+ return scanContinue
+ }
+ if c < 0x20 {
+ return s.error(c, "in string literal")
+ }
+ return scanContinue
+}
+
+// stateInStringEsc is the state after reading `"\` during a quoted string.
+func stateInStringEsc(s *scanner, c byte) scanStatus {
+ switch c {
+ case 'b', 'f', 'n', 'r', 't', '\\', '/', '"':
+ s.step = stateInString
+ return scanContinue
+ case 'u':
+ s.step = stateInStringEscU
+ return scanContinue
+ }
+ return s.error(c, "in string escape code")
+}
+
+// stateInStringEscU is the state after reading `"\u` during a quoted string.
+func stateInStringEscU(s *scanner, c byte) scanStatus {
+ if '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F' {
+ s.step = stateInStringEscU1
+ return scanContinue
+ }
+ // numbers
+ return s.error(c, "in \\u hexadecimal character escape")
+}
+
+// stateInStringEscU1 is the state after reading `"\u1` during a quoted string.
+func stateInStringEscU1(s *scanner, c byte) scanStatus {
+ if '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F' {
+ s.step = stateInStringEscU12
+ return scanContinue
+ }
+ // numbers
+ return s.error(c, "in \\u hexadecimal character escape")
+}
+
+// stateInStringEscU12 is the state after reading `"\u12` during a quoted string.
+func stateInStringEscU12(s *scanner, c byte) scanStatus {
+ if '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F' {
+ s.step = stateInStringEscU123
+ return scanContinue
+ }
+ // numbers
+ return s.error(c, "in \\u hexadecimal character escape")
+}
+
+// stateInStringEscU123 is the state after reading `"\u123` during a quoted string.
+func stateInStringEscU123(s *scanner, c byte) scanStatus {
+ if '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F' {
+ s.step = stateInString
+ return scanContinue
+ }
+ // numbers
+ return s.error(c, "in \\u hexadecimal character escape")
+}
+
+// stateNeg is the state after reading `-` during a number.
+func stateNeg(s *scanner, c byte) scanStatus {
+ if c == '0' {
+ s.step = state0
+ return scanContinue
+ }
+ if '1' <= c && c <= '9' {
+ s.step = state1
+ return scanContinue
+ }
+ return s.error(c, "in numeric literal")
+}
+
+// state1 is the state after reading a non-zero integer during a number,
+// such as after reading `1` or `100` but not `0`.
+func state1(s *scanner, c byte) scanStatus {
+ if '0' <= c && c <= '9' {
+ s.step = state1
+ return scanContinue
+ }
+ return state0(s, c)
+}
+
+// state0 is the state after reading `0` during a number.
+func state0(s *scanner, c byte) scanStatus {
+ if c == '.' {
+ s.step = stateDot
+ return scanContinue
+ }
+ if c == 'e' || c == 'E' {
+ s.step = stateE
+ return scanContinue
+ }
+ return stateEndValue(s, c)
+}
+
+// stateDot is the state after reading the integer and decimal point in a number,
+// such as after reading `1.`.
+func stateDot(s *scanner, c byte) scanStatus {
+ if '0' <= c && c <= '9' {
+ s.step = stateDot0
+ return scanContinue
+ }
+ return s.error(c, "after decimal point in numeric literal")
+}
+
+// stateDot0 is the state after reading the integer, decimal point, and subsequent
+// digits of a number, such as after reading `3.14`.
+func stateDot0(s *scanner, c byte) scanStatus {
+ if '0' <= c && c <= '9' {
+ return scanContinue
+ }
+ if c == 'e' || c == 'E' {
+ s.step = stateE
+ return scanContinue
+ }
+ return stateEndValue(s, c)
+}
+
+// stateE is the state after reading the mantissa and e in a number,
+// such as after reading `314e` or `0.314e`.
+func stateE(s *scanner, c byte) scanStatus {
+ if c == '+' || c == '-' {
+ s.step = stateESign
+ return scanContinue
+ }
+ return stateESign(s, c)
+}
+
+// stateESign is the state after reading the mantissa, e, and sign in a number,
+// such as after reading `314e-` or `0.314e+`.
+func stateESign(s *scanner, c byte) scanStatus {
+ if '0' <= c && c <= '9' {
+ s.step = stateE0
+ return scanContinue
+ }
+ return s.error(c, "in exponent of numeric literal")
+}
+
+// stateE0 is the state after reading the mantissa, e, optional sign,
+// and at least one digit of the exponent in a number,
+// such as after reading `314e-2` or `0.314e+1` or `3.14e0`.
+func stateE0(s *scanner, c byte) scanStatus {
+ if '0' <= c && c <= '9' {
+ return scanContinue
+ }
+ return stateEndValue(s, c)
+}
+
+// stateT is the state after reading `t`.
+func stateT(s *scanner, c byte) scanStatus {
+ if c == 'r' {
+ s.step = stateTr
+ return scanContinue
+ }
+ return s.error(c, "in literal true (expecting 'r')")
+}
+
+// stateTr is the state after reading `tr`.
+func stateTr(s *scanner, c byte) scanStatus {
+ if c == 'u' {
+ s.step = stateTru
+ return scanContinue
+ }
+ return s.error(c, "in literal true (expecting 'u')")
+}
+
+// stateTru is the state after reading `tru`.
+func stateTru(s *scanner, c byte) scanStatus {
+ if c == 'e' {
+ s.step = stateEndValue
+ return scanContinue
+ }
+ return s.error(c, "in literal true (expecting 'e')")
+}
+
+// stateF is the state after reading `f`.
+func stateF(s *scanner, c byte) scanStatus {
+ if c == 'a' {
+ s.step = stateFa
+ return scanContinue
+ }
+ return s.error(c, "in literal false (expecting 'a')")
+}
+
+// stateFa is the state after reading `fa`.
+func stateFa(s *scanner, c byte) scanStatus {
+ if c == 'l' {
+ s.step = stateFal
+ return scanContinue
+ }
+ return s.error(c, "in literal false (expecting 'l')")
+}
+
+// stateFal is the state after reading `fal`.
+func stateFal(s *scanner, c byte) scanStatus {
+ if c == 's' {
+ s.step = stateFals
+ return scanContinue
+ }
+ return s.error(c, "in literal false (expecting 's')")
+}
+
+// stateFals is the state after reading `fals`.
+func stateFals(s *scanner, c byte) scanStatus {
+ if c == 'e' {
+ s.step = stateEndValue
+ return scanContinue
+ }
+ return s.error(c, "in literal false (expecting 'e')")
+}
+
+// stateN is the state after reading `n`.
+func stateN(s *scanner, c byte) scanStatus {
+ if c == 'u' {
+ s.step = stateNu
+ return scanContinue
+ }
+ return s.error(c, "in literal null (expecting 'u')")
+}
+
+// stateNu is the state after reading `nu`.
+func stateNu(s *scanner, c byte) scanStatus {
+ if c == 'l' {
+ s.step = stateNul
+ return scanContinue
+ }
+ return s.error(c, "in literal null (expecting 'l')")
+}
+
+// stateNul is the state after reading `nul`.
+func stateNul(s *scanner, c byte) scanStatus {
+ if c == 'l' {
+ s.step = stateEndValue
+ return scanContinue
+ }
+ return s.error(c, "in literal null (expecting 'l')")
+}
+
+// stateError is the state after reaching a syntax error,
+// such as after reading `[1}` or `5.1.2`.
+func stateError(s *scanner, c byte) scanStatus {
+ return scanError
+}
+
+// error records an error and switches to the error state.
+func (s *scanner) error(c byte, context string) scanStatus {
+ s.step = stateError
+ s.err = fmt.Errorf("invalid character <<%c>> %s", c, context)
+ return scanError
+}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/archive.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/archive.go
new file mode 100644
index 0000000000..fec11f080a
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/archive.go
@@ -0,0 +1,124 @@
+package magic
+
+import (
+ "bytes"
+ "encoding/binary"
+)
+
+var (
+ // SevenZ matches a 7z archive.
+ SevenZ = prefix([]byte{0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C})
+ // Gzip matches gzip files based on http://www.zlib.org/rfc-gzip.html#header-trailer.
+ Gzip = prefix([]byte{0x1f, 0x8b})
+ // Fits matches an Flexible Image Transport System file.
+ Fits = prefix([]byte{
+ 0x53, 0x49, 0x4D, 0x50, 0x4C, 0x45, 0x20, 0x20, 0x3D, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x54,
+ })
+ // Xar matches an eXtensible ARchive format file.
+ Xar = prefix([]byte{0x78, 0x61, 0x72, 0x21})
+ // Bz2 matches a bzip2 file.
+ Bz2 = prefix([]byte{0x42, 0x5A, 0x68})
+ // Ar matches an ar (Unix) archive file.
+ Ar = prefix([]byte{0x21, 0x3C, 0x61, 0x72, 0x63, 0x68, 0x3E})
+ // Deb matches a Debian package file.
+ Deb = offset([]byte{
+ 0x64, 0x65, 0x62, 0x69, 0x61, 0x6E, 0x2D,
+ 0x62, 0x69, 0x6E, 0x61, 0x72, 0x79,
+ }, 8)
+ // Warc matches a Web ARChive file.
+ Warc = prefix([]byte("WARC/1.0"), []byte("WARC/1.1"))
+ // Cab matches a Microsoft Cabinet archive file.
+ Cab = prefix([]byte("MSCF\x00\x00\x00\x00"))
+ // Xz matches an xz compressed stream based on https://tukaani.org/xz/xz-file-format.txt.
+ Xz = prefix([]byte{0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00})
+ // Lzip matches an Lzip compressed file.
+ Lzip = prefix([]byte{0x4c, 0x5a, 0x49, 0x50})
+ // RPM matches an RPM or Delta RPM package file.
+ RPM = prefix([]byte{0xed, 0xab, 0xee, 0xdb}, []byte("drpm"))
+ // Cpio matches a cpio archive file.
+ Cpio = prefix([]byte("070707"), []byte("070701"), []byte("070702"))
+ // RAR matches a RAR archive file.
+ RAR = prefix([]byte("Rar!\x1A\x07\x00"), []byte("Rar!\x1A\x07\x01\x00"))
+)
+
+// InstallShieldCab matches an InstallShield Cabinet archive file.
+func InstallShieldCab(raw []byte, _ uint32) bool {
+ return len(raw) > 7 &&
+ bytes.Equal(raw[0:4], []byte("ISc(")) &&
+ raw[6] == 0 &&
+ (raw[7] == 1 || raw[7] == 2 || raw[7] == 4)
+}
+
+// Zstd matches a Zstandard archive file.
+func Zstd(raw []byte, limit uint32) bool {
+ return len(raw) >= 4 &&
+ (0x22 <= raw[0] && raw[0] <= 0x28 || raw[0] == 0x1E) && // Different Zstandard versions.
+ bytes.HasPrefix(raw[1:], []byte{0xB5, 0x2F, 0xFD})
+}
+
+// CRX matches a Chrome extension file: a zip archive prepended by a package header.
+func CRX(raw []byte, limit uint32) bool {
+ const minHeaderLen = 16
+ if len(raw) < minHeaderLen || !bytes.HasPrefix(raw, []byte("Cr24")) {
+ return false
+ }
+ pubkeyLen := binary.LittleEndian.Uint32(raw[8:12])
+ sigLen := binary.LittleEndian.Uint32(raw[12:16])
+ zipOffset := minHeaderLen + pubkeyLen + sigLen
+ if uint32(len(raw)) < zipOffset {
+ return false
+ }
+ return Zip(raw[zipOffset:], limit)
+}
+
+// Tar matches a (t)ape (ar)chive file.
+func Tar(raw []byte, _ uint32) bool {
+ // The "magic" header field for files in in UStar (POSIX IEEE P1003.1) archives
+ // has the prefix "ustar". The values of the remaining bytes in this field vary
+ // by archiver implementation.
+ if len(raw) >= 512 && bytes.HasPrefix(raw[257:], []byte{0x75, 0x73, 0x74, 0x61, 0x72}) {
+ return true
+ }
+
+ if len(raw) < 256 {
+ return false
+ }
+
+ // The older v7 format has no "magic" field, and therefore must be identified
+ // with heuristics based on legal ranges of values for other header fields:
+ // https://www.nationalarchives.gov.uk/PRONOM/Format/proFormatSearch.aspx?status=detailReport&id=385&strPageToDisplay=signatures
+ rules := []struct {
+ min, max uint8
+ i int
+ }{
+ {0x21, 0xEF, 0},
+ {0x30, 0x37, 105},
+ {0x20, 0x37, 106},
+ {0x00, 0x00, 107},
+ {0x30, 0x37, 113},
+ {0x20, 0x37, 114},
+ {0x00, 0x00, 115},
+ {0x30, 0x37, 121},
+ {0x20, 0x37, 122},
+ {0x00, 0x00, 123},
+ {0x30, 0x37, 134},
+ {0x30, 0x37, 146},
+ {0x30, 0x37, 153},
+ {0x00, 0x37, 154},
+ }
+ for _, r := range rules {
+ if raw[r.i] < r.min || raw[r.i] > r.max {
+ return false
+ }
+ }
+
+ for _, i := range []uint8{135, 147, 155} {
+ if raw[i] != 0x00 && raw[i] != 0x20 {
+ return false
+ }
+ }
+
+ return true
+}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/audio.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/audio.go
new file mode 100644
index 0000000000..d17e32482c
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/audio.go
@@ -0,0 +1,76 @@
+package magic
+
+import (
+ "bytes"
+ "encoding/binary"
+)
+
+var (
+ // Flac matches a Free Lossless Audio Codec file.
+ Flac = prefix([]byte("\x66\x4C\x61\x43\x00\x00\x00\x22"))
+ // Midi matches a Musical Instrument Digital Interface file.
+ Midi = prefix([]byte("\x4D\x54\x68\x64"))
+ // Ape matches a Monkey's Audio file.
+ Ape = prefix([]byte("\x4D\x41\x43\x20\x96\x0F\x00\x00\x34\x00\x00\x00\x18\x00\x00\x00\x90\xE3"))
+ // MusePack matches a Musepack file.
+ MusePack = prefix([]byte("MPCK"))
+ // Au matches a Sun Microsystems au file.
+ Au = prefix([]byte("\x2E\x73\x6E\x64"))
+ // Amr matches an Adaptive Multi-Rate file.
+ Amr = prefix([]byte("\x23\x21\x41\x4D\x52"))
+ // Voc matches a Creative Voice file.
+ Voc = prefix([]byte("Creative Voice File"))
+ // M3u matches a Playlist file.
+ M3u = prefix([]byte("#EXTM3U"))
+ // AAC matches an Advanced Audio Coding file.
+ AAC = prefix([]byte{0xFF, 0xF1}, []byte{0xFF, 0xF9})
+)
+
+// Mp3 matches an mp3 file.
+func Mp3(raw []byte, limit uint32) bool {
+ if len(raw) < 3 {
+ return false
+ }
+
+ if bytes.HasPrefix(raw, []byte("ID3")) {
+ // MP3s with an ID3v2 tag will start with "ID3"
+ // ID3v1 tags, however appear at the end of the file.
+ return true
+ }
+
+ // Match MP3 files without tags
+ switch binary.BigEndian.Uint16(raw[:2]) & 0xFFFE {
+ case 0xFFFA:
+ // MPEG ADTS, layer III, v1
+ return true
+ case 0xFFF2:
+ // MPEG ADTS, layer III, v2
+ return true
+ case 0xFFE2:
+ // MPEG ADTS, layer III, v2.5
+ return true
+ }
+
+ return false
+}
+
+// Wav matches a Waveform Audio File Format file.
+func Wav(raw []byte, limit uint32) bool {
+ return len(raw) > 12 &&
+ bytes.Equal(raw[:4], []byte("RIFF")) &&
+ bytes.Equal(raw[8:12], []byte{0x57, 0x41, 0x56, 0x45})
+}
+
+// Aiff matches Audio Interchange File Format file.
+func Aiff(raw []byte, limit uint32) bool {
+ return len(raw) > 12 &&
+ bytes.Equal(raw[:4], []byte{0x46, 0x4F, 0x52, 0x4D}) &&
+ bytes.Equal(raw[8:12], []byte{0x41, 0x49, 0x46, 0x46})
+}
+
+// Qcp matches a Qualcomm Pure Voice file.
+func Qcp(raw []byte, limit uint32) bool {
+ return len(raw) > 12 &&
+ bytes.Equal(raw[:4], []byte("RIFF")) &&
+ bytes.Equal(raw[8:12], []byte("QLCM"))
+}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/binary.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/binary.go
new file mode 100644
index 0000000000..29bdded3e8
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/binary.go
@@ -0,0 +1,196 @@
+package magic
+
+import (
+ "bytes"
+ "debug/macho"
+ "encoding/binary"
+)
+
+var (
+ // Lnk matches Microsoft lnk binary format.
+ Lnk = prefix([]byte{0x4C, 0x00, 0x00, 0x00, 0x01, 0x14, 0x02, 0x00})
+ // Wasm matches a web assembly File Format file.
+ Wasm = prefix([]byte{0x00, 0x61, 0x73, 0x6D})
+ // Exe matches a Windows/DOS executable file.
+ Exe = prefix([]byte{0x4D, 0x5A})
+ // Elf matches an Executable and Linkable Format file.
+ Elf = prefix([]byte{0x7F, 0x45, 0x4C, 0x46})
+ // Nes matches a Nintendo Entertainment system ROM file.
+ Nes = prefix([]byte{0x4E, 0x45, 0x53, 0x1A})
+ // SWF matches an Adobe Flash swf file.
+ SWF = prefix([]byte("CWS"), []byte("FWS"), []byte("ZWS"))
+ // Torrent has bencoded text in the beginning.
+ Torrent = prefix([]byte("d8:announce"))
+)
+
+// Java bytecode and Mach-O binaries share the same magic number.
+// More info here https://github.com/threatstack/libmagic/blob/master/magic/Magdir/cafebabe
+func classOrMachOFat(in []byte) bool {
+ // There should be at least 8 bytes for both of them because the only way to
+ // quickly distinguish them is by comparing byte at position 7
+ if len(in) < 8 {
+ return false
+ }
+
+ return bytes.HasPrefix(in, []byte{0xCA, 0xFE, 0xBA, 0xBE})
+}
+
+// Class matches a java class file.
+func Class(raw []byte, limit uint32) bool {
+ return classOrMachOFat(raw) && raw[7] > 30
+}
+
+// MachO matches Mach-O binaries format.
+func MachO(raw []byte, limit uint32) bool {
+ if classOrMachOFat(raw) && raw[7] < 20 {
+ return true
+ }
+
+ if len(raw) < 4 {
+ return false
+ }
+
+ be := binary.BigEndian.Uint32(raw)
+ le := binary.LittleEndian.Uint32(raw)
+
+ return be == macho.Magic32 ||
+ le == macho.Magic32 ||
+ be == macho.Magic64 ||
+ le == macho.Magic64
+}
+
+// Dbf matches a dBase file.
+// https://www.dbase.com/Knowledgebase/INT/db7_file_fmt.htm
+func Dbf(raw []byte, limit uint32) bool {
+ if len(raw) < 68 {
+ return false
+ }
+
+ // 3rd and 4th bytes contain the last update month and day of month.
+ if !(0 < raw[2] && raw[2] < 13 && 0 < raw[3] && raw[3] < 32) {
+ return false
+ }
+
+ // 12, 13, 30, 31 are reserved bytes and always filled with 0x00.
+ if raw[12] != 0x00 || raw[13] != 0x00 || raw[30] != 0x00 || raw[31] != 0x00 {
+ return false
+ }
+ // Production MDX flag;
+ // 0x01 if a production .MDX file exists for this table;
+ // 0x00 if no .MDX file exists.
+ if raw[28] > 0x01 {
+ return false
+ }
+
+ // dbf type is dictated by the first byte.
+ dbfTypes := []byte{
+ 0x02, 0x03, 0x04, 0x05, 0x30, 0x31, 0x32, 0x42, 0x62, 0x7B, 0x82,
+ 0x83, 0x87, 0x8A, 0x8B, 0x8E, 0xB3, 0xCB, 0xE5, 0xF5, 0xF4, 0xFB,
+ }
+ for _, b := range dbfTypes {
+ if raw[0] == b {
+ return true
+ }
+ }
+
+ return false
+}
+
+// ElfObj matches an object file.
+func ElfObj(raw []byte, limit uint32) bool {
+ return len(raw) > 17 && ((raw[16] == 0x01 && raw[17] == 0x00) ||
+ (raw[16] == 0x00 && raw[17] == 0x01))
+}
+
+// ElfExe matches an executable file.
+func ElfExe(raw []byte, limit uint32) bool {
+ return len(raw) > 17 && ((raw[16] == 0x02 && raw[17] == 0x00) ||
+ (raw[16] == 0x00 && raw[17] == 0x02))
+}
+
+// ElfLib matches a shared library file.
+func ElfLib(raw []byte, limit uint32) bool {
+ return len(raw) > 17 && ((raw[16] == 0x03 && raw[17] == 0x00) ||
+ (raw[16] == 0x00 && raw[17] == 0x03))
+}
+
+// ElfDump matches a core dump file.
+func ElfDump(raw []byte, limit uint32) bool {
+ return len(raw) > 17 && ((raw[16] == 0x04 && raw[17] == 0x00) ||
+ (raw[16] == 0x00 && raw[17] == 0x04))
+}
+
+// Dcm matches a DICOM medical format file.
+func Dcm(raw []byte, limit uint32) bool {
+ return len(raw) > 131 &&
+ bytes.Equal(raw[128:132], []byte{0x44, 0x49, 0x43, 0x4D})
+}
+
+// Marc matches a MARC21 (MAchine-Readable Cataloging) file.
+func Marc(raw []byte, limit uint32) bool {
+ // File is at least 24 bytes ("leader" field size).
+ if len(raw) < 24 {
+ return false
+ }
+
+ // Fixed bytes at offset 20.
+ if !bytes.Equal(raw[20:24], []byte("4500")) {
+ return false
+ }
+
+ // First 5 bytes are ASCII digits.
+ for i := 0; i < 5; i++ {
+ if raw[i] < '0' || raw[i] > '9' {
+ return false
+ }
+ }
+
+ // Field terminator is present in first 2048 bytes.
+ return bytes.Contains(raw[:min(2048, len(raw))], []byte{0x1E})
+}
+
+// Glb matches a glTF model format file.
+// GLB is the binary file format representation of 3D models save in
+// the GL transmission Format (glTF).
+// see more: https://docs.fileformat.com/3d/glb/
+// https://www.iana.org/assignments/media-types/model/gltf-binary
+// GLB file format is based on little endian and its header structure
+// show below:
+//
+// <-- 12-byte header -->
+// | magic | version | length |
+// | (uint32) | (uint32) | (uint32) |
+// | \x67\x6C\x54\x46 | \x01\x00\x00\x00 | ... |
+// | g l T F | 1 | ... |
+var Glb = prefix([]byte("\x67\x6C\x54\x46\x02\x00\x00\x00"),
+ []byte("\x67\x6C\x54\x46\x01\x00\x00\x00"))
+
+// TzIf matches a Time Zone Information Format (TZif) file.
+// See more: https://tools.ietf.org/id/draft-murchison-tzdist-tzif-00.html#rfc.section.3
+// Its header structure is shown below:
+// +---------------+---+
+// | magic (4) | <-+-- version (1)
+// +---------------+---+---------------------------------------+
+// | [unused - reserved for future use] (15) |
+// +---------------+---------------+---------------+-----------+
+// | isutccnt (4) | isstdcnt (4) | leapcnt (4) |
+// +---------------+---------------+---------------+
+// | timecnt (4) | typecnt (4) | charcnt (4) |
+func TzIf(raw []byte, limit uint32) bool {
+ // File is at least 44 bytes (header size).
+ if len(raw) < 44 {
+ return false
+ }
+
+ if !bytes.HasPrefix(raw, []byte("TZif")) {
+ return false
+ }
+
+ // Field "typecnt" MUST not be zero.
+ if binary.BigEndian.Uint32(raw[36:40]) == 0 {
+ return false
+ }
+
+ // Version has to be NUL (0x00), '2' (0x32) or '3' (0x33).
+ return raw[4] == 0x00 || raw[4] == 0x32 || raw[4] == 0x33
+}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/database.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/database.go
new file mode 100644
index 0000000000..cb1fed12f7
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/database.go
@@ -0,0 +1,13 @@
+package magic
+
+var (
+ // Sqlite matches an SQLite database file.
+ Sqlite = prefix([]byte{
+ 0x53, 0x51, 0x4c, 0x69, 0x74, 0x65, 0x20, 0x66,
+ 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x20, 0x33, 0x00,
+ })
+ // MsAccessAce matches Microsoft Access dababase file.
+ MsAccessAce = offset([]byte("Standard ACE DB"), 4)
+ // MsAccessMdb matches legacy Microsoft Access database file (JET, 2003 and earlier).
+ MsAccessMdb = offset([]byte("Standard Jet DB"), 4)
+)
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/document.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/document.go
new file mode 100644
index 0000000000..b3b26d5a12
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/document.go
@@ -0,0 +1,62 @@
+package magic
+
+import "bytes"
+
+var (
+ // Pdf matches a Portable Document Format file.
+ // https://github.com/file/file/blob/11010cc805546a3e35597e67e1129a481aed40e8/magic/Magdir/pdf
+ Pdf = prefix(
+ // usual pdf signature
+ []byte("%PDF-"),
+ // new-line prefixed signature
+ []byte("\012%PDF-"),
+ // UTF-8 BOM prefixed signature
+ []byte("\xef\xbb\xbf%PDF-"),
+ )
+ // Fdf matches a Forms Data Format file.
+ Fdf = prefix([]byte("%FDF"))
+ // Mobi matches a Mobi file.
+ Mobi = offset([]byte("BOOKMOBI"), 60)
+ // Lit matches a Microsoft Lit file.
+ Lit = prefix([]byte("ITOLITLS"))
+)
+
+// DjVu matches a DjVu file.
+func DjVu(raw []byte, limit uint32) bool {
+ if len(raw) < 12 {
+ return false
+ }
+ if !bytes.HasPrefix(raw, []byte{0x41, 0x54, 0x26, 0x54, 0x46, 0x4F, 0x52, 0x4D}) {
+ return false
+ }
+ return bytes.HasPrefix(raw[12:], []byte("DJVM")) ||
+ bytes.HasPrefix(raw[12:], []byte("DJVU")) ||
+ bytes.HasPrefix(raw[12:], []byte("DJVI")) ||
+ bytes.HasPrefix(raw[12:], []byte("THUM"))
+}
+
+// P7s matches an .p7s signature File (PEM, Base64).
+func P7s(raw []byte, limit uint32) bool {
+ // Check for PEM Encoding.
+ if bytes.HasPrefix(raw, []byte("-----BEGIN PKCS7")) {
+ return true
+ }
+ // Check if DER Encoding is long enough.
+ if len(raw) < 20 {
+ return false
+ }
+ // Magic Bytes for the signedData ASN.1 encoding.
+ startHeader := [][]byte{{0x30, 0x80}, {0x30, 0x81}, {0x30, 0x82}, {0x30, 0x83}, {0x30, 0x84}}
+ signedDataMatch := []byte{0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07}
+ // Check if Header is correct. There are multiple valid headers.
+ for i, match := range startHeader {
+ // If first bytes match, then check for ASN.1 Object Type.
+ if bytes.HasPrefix(raw, match) {
+ if bytes.HasPrefix(raw[i+2:], signedDataMatch) {
+ return true
+ }
+ }
+ }
+
+ return false
+}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go
new file mode 100644
index 0000000000..43af28212e
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go
@@ -0,0 +1,39 @@
+package magic
+
+import (
+ "bytes"
+)
+
+var (
+ // Woff matches a Web Open Font Format file.
+ Woff = prefix([]byte("wOFF"))
+ // Woff2 matches a Web Open Font Format version 2 file.
+ Woff2 = prefix([]byte("wOF2"))
+ // Otf matches an OpenType font file.
+ Otf = prefix([]byte{0x4F, 0x54, 0x54, 0x4F, 0x00})
+)
+
+// Ttf matches a TrueType font file.
+func Ttf(raw []byte, limit uint32) bool {
+ if !bytes.HasPrefix(raw, []byte{0x00, 0x01, 0x00, 0x00}) {
+ return false
+ }
+ return !MsAccessAce(raw, limit) && !MsAccessMdb(raw, limit)
+}
+
+// Eot matches an Embedded OpenType font file.
+func Eot(raw []byte, limit uint32) bool {
+ return len(raw) > 35 &&
+ bytes.Equal(raw[34:36], []byte{0x4C, 0x50}) &&
+ (bytes.Equal(raw[8:11], []byte{0x02, 0x00, 0x01}) ||
+ bytes.Equal(raw[8:11], []byte{0x01, 0x00, 0x00}) ||
+ bytes.Equal(raw[8:11], []byte{0x02, 0x00, 0x02}))
+}
+
+// Ttc matches a TrueType Collection font file.
+func Ttc(raw []byte, limit uint32) bool {
+ return len(raw) > 7 &&
+ bytes.HasPrefix(raw, []byte("ttcf")) &&
+ (bytes.Equal(raw[4:8], []byte{0x00, 0x01, 0x00, 0x00}) ||
+ bytes.Equal(raw[4:8], []byte{0x00, 0x02, 0x00, 0x00}))
+}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/ftyp.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/ftyp.go
new file mode 100644
index 0000000000..6575b4aecd
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/ftyp.go
@@ -0,0 +1,88 @@
+package magic
+
+import "bytes"
+
+var (
+ // AVIF matches an AV1 Image File Format still or animated.
+ // Wikipedia page seems outdated listing image/avif-sequence for animations.
+ // https://github.com/AOMediaCodec/av1-avif/issues/59
+ AVIF = ftyp([]byte("avif"), []byte("avis"))
+ // Mp4 matches an MP4 file.
+ Mp4 = ftyp(
+ []byte("avc1"), []byte("dash"), []byte("iso2"), []byte("iso3"),
+ []byte("iso4"), []byte("iso5"), []byte("iso6"), []byte("isom"),
+ []byte("mmp4"), []byte("mp41"), []byte("mp42"), []byte("mp4v"),
+ []byte("mp71"), []byte("MSNV"), []byte("NDAS"), []byte("NDSC"),
+ []byte("NSDC"), []byte("NSDH"), []byte("NDSM"), []byte("NDSP"),
+ []byte("NDSS"), []byte("NDXC"), []byte("NDXH"), []byte("NDXM"),
+ []byte("NDXP"), []byte("NDXS"), []byte("F4V "), []byte("F4P "),
+ )
+ // ThreeGP matches a 3GPP file.
+ ThreeGP = ftyp(
+ []byte("3gp1"), []byte("3gp2"), []byte("3gp3"), []byte("3gp4"),
+ []byte("3gp5"), []byte("3gp6"), []byte("3gp7"), []byte("3gs7"),
+ []byte("3ge6"), []byte("3ge7"), []byte("3gg6"),
+ )
+ // ThreeG2 matches a 3GPP2 file.
+ ThreeG2 = ftyp(
+ []byte("3g24"), []byte("3g25"), []byte("3g26"), []byte("3g2a"),
+ []byte("3g2b"), []byte("3g2c"), []byte("KDDI"),
+ )
+ // AMp4 matches an audio MP4 file.
+ AMp4 = ftyp(
+ // audio for Adobe Flash Player 9+
+ []byte("F4A "), []byte("F4B "),
+ // Apple iTunes AAC-LC (.M4A) Audio
+ []byte("M4B "), []byte("M4P "),
+ // MPEG-4 (.MP4) for SonyPSP
+ []byte("MSNV"),
+ // Nero Digital AAC Audio
+ []byte("NDAS"),
+ )
+ // Mqv matches a Sony / Mobile QuickTime file.
+ Mqv = ftyp([]byte("mqt "))
+ // M4a matches an audio M4A file.
+ M4a = ftyp([]byte("M4A "))
+ // M4v matches an Appl4 M4V video file.
+ M4v = ftyp([]byte("M4V "), []byte("M4VH"), []byte("M4VP"))
+ // Heic matches a High Efficiency Image Coding (HEIC) file.
+ Heic = ftyp([]byte("heic"), []byte("heix"))
+ // HeicSequence matches a High Efficiency Image Coding (HEIC) file sequence.
+ HeicSequence = ftyp([]byte("hevc"), []byte("hevx"))
+ // Heif matches a High Efficiency Image File Format (HEIF) file.
+ Heif = ftyp([]byte("mif1"), []byte("heim"), []byte("heis"), []byte("avic"))
+ // HeifSequence matches a High Efficiency Image File Format (HEIF) file sequence.
+ HeifSequence = ftyp([]byte("msf1"), []byte("hevm"), []byte("hevs"), []byte("avcs"))
+ // TODO: add support for remaining video formats at ftyps.com.
+)
+
+// QuickTime matches a QuickTime File Format file.
+// https://www.loc.gov/preservation/digital/formats/fdd/fdd000052.shtml
+// https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap1/qtff1.html#//apple_ref/doc/uid/TP40000939-CH203-38190
+// https://github.com/apache/tika/blob/0f5570691133c75ac4472c3340354a6c4080b104/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml#L7758-L7777
+func QuickTime(raw []byte, _ uint32) bool {
+ if len(raw) < 12 {
+ return false
+ }
+ // First 4 bytes represent the size of the atom as unsigned int.
+ // Next 4 bytes are the type of the atom.
+ // For `ftyp` atoms check if first byte in size is 0, otherwise, a text file
+ // which happens to contain 'ftypqt ' at index 4 will trigger a false positive.
+ if bytes.Equal(raw[4:12], []byte("ftypqt ")) ||
+ bytes.Equal(raw[4:12], []byte("ftypmoov")) {
+ return raw[0] == 0x00
+ }
+ basicAtomTypes := [][]byte{
+ []byte("moov\x00"),
+ []byte("mdat\x00"),
+ []byte("free\x00"),
+ []byte("skip\x00"),
+ []byte("pnot\x00"),
+ }
+ for _, a := range basicAtomTypes {
+ if bytes.Equal(raw[4:9], a) {
+ return true
+ }
+ }
+ return bytes.Equal(raw[:8], []byte("\x00\x00\x00\x08wide"))
+}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/geo.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/geo.go
new file mode 100644
index 0000000000..f077e16724
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/geo.go
@@ -0,0 +1,55 @@
+package magic
+
+import (
+ "bytes"
+ "encoding/binary"
+)
+
+// Shp matches a shape format file.
+// https://www.esri.com/library/whitepapers/pdfs/shapefile.pdf
+func Shp(raw []byte, limit uint32) bool {
+ if len(raw) < 112 {
+ return false
+ }
+
+ if !(binary.BigEndian.Uint32(raw[0:4]) == 9994 &&
+ binary.BigEndian.Uint32(raw[4:8]) == 0 &&
+ binary.BigEndian.Uint32(raw[8:12]) == 0 &&
+ binary.BigEndian.Uint32(raw[12:16]) == 0 &&
+ binary.BigEndian.Uint32(raw[16:20]) == 0 &&
+ binary.BigEndian.Uint32(raw[20:24]) == 0 &&
+ binary.LittleEndian.Uint32(raw[28:32]) == 1000) {
+ return false
+ }
+
+ shapeTypes := []int{
+ 0, // Null shape
+ 1, // Point
+ 3, // Polyline
+ 5, // Polygon
+ 8, // MultiPoint
+ 11, // PointZ
+ 13, // PolylineZ
+ 15, // PolygonZ
+ 18, // MultiPointZ
+ 21, // PointM
+ 23, // PolylineM
+ 25, // PolygonM
+ 28, // MultiPointM
+ 31, // MultiPatch
+ }
+
+ for _, st := range shapeTypes {
+ if st == int(binary.LittleEndian.Uint32(raw[108:112])) {
+ return true
+ }
+ }
+
+ return false
+}
+
+// Shx matches a shape index format file.
+// https://www.esri.com/library/whitepapers/pdfs/shapefile.pdf
+func Shx(raw []byte, limit uint32) bool {
+ return bytes.HasPrefix(raw, []byte{0x00, 0x00, 0x27, 0x0A})
+}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/image.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/image.go
new file mode 100644
index 0000000000..0eb7e95f37
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/image.go
@@ -0,0 +1,110 @@
+package magic
+
+import "bytes"
+
+var (
+ // Png matches a Portable Network Graphics file.
+ // https://www.w3.org/TR/PNG/
+ Png = prefix([]byte{0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A})
+ // Apng matches an Animated Portable Network Graphics file.
+ // https://wiki.mozilla.org/APNG_Specification
+ Apng = offset([]byte("acTL"), 37)
+ // Jpg matches a Joint Photographic Experts Group file.
+ Jpg = prefix([]byte{0xFF, 0xD8, 0xFF})
+ // Jp2 matches a JPEG 2000 Image file (ISO 15444-1).
+ Jp2 = jpeg2k([]byte{0x6a, 0x70, 0x32, 0x20})
+ // Jpx matches a JPEG 2000 Image file (ISO 15444-2).
+ Jpx = jpeg2k([]byte{0x6a, 0x70, 0x78, 0x20})
+ // Jpm matches a JPEG 2000 Image file (ISO 15444-6).
+ Jpm = jpeg2k([]byte{0x6a, 0x70, 0x6D, 0x20})
+ // Gif matches a Graphics Interchange Format file.
+ Gif = prefix([]byte("GIF87a"), []byte("GIF89a"))
+ // Bmp matches a bitmap image file.
+ Bmp = prefix([]byte{0x42, 0x4D})
+ // Ps matches a PostScript file.
+ Ps = prefix([]byte("%!PS-Adobe-"))
+ // Psd matches a Photoshop Document file.
+ Psd = prefix([]byte("8BPS"))
+ // Ico matches an ICO file.
+ Ico = prefix([]byte{0x00, 0x00, 0x01, 0x00}, []byte{0x00, 0x00, 0x02, 0x00})
+ // Icns matches an ICNS (Apple Icon Image format) file.
+ Icns = prefix([]byte("icns"))
+ // Tiff matches a Tagged Image File Format file.
+ Tiff = prefix([]byte{0x49, 0x49, 0x2A, 0x00}, []byte{0x4D, 0x4D, 0x00, 0x2A})
+ // Bpg matches a Better Portable Graphics file.
+ Bpg = prefix([]byte{0x42, 0x50, 0x47, 0xFB})
+ // Xcf matches GIMP image data.
+ Xcf = prefix([]byte("gimp xcf"))
+ // Pat matches GIMP pattern data.
+ Pat = offset([]byte("GPAT"), 20)
+ // Gbr matches GIMP brush data.
+ Gbr = offset([]byte("GIMP"), 20)
+ // Hdr matches Radiance HDR image.
+ // https://web.archive.org/web/20060913152809/http://local.wasp.uwa.edu.au/~pbourke/dataformats/pic/
+ Hdr = prefix([]byte("#?RADIANCE\n"))
+ // Xpm matches X PixMap image data.
+ Xpm = prefix([]byte{0x2F, 0x2A, 0x20, 0x58, 0x50, 0x4D, 0x20, 0x2A, 0x2F})
+ // Jxs matches a JPEG XS coded image file (ISO/IEC 21122-3).
+ Jxs = prefix([]byte{0x00, 0x00, 0x00, 0x0C, 0x4A, 0x58, 0x53, 0x20, 0x0D, 0x0A, 0x87, 0x0A})
+ // Jxr matches Microsoft HD JXR photo file.
+ Jxr = prefix([]byte{0x49, 0x49, 0xBC, 0x01})
+)
+
+func jpeg2k(sig []byte) Detector {
+ return func(raw []byte, _ uint32) bool {
+ if len(raw) < 24 {
+ return false
+ }
+
+ if !bytes.Equal(raw[4:8], []byte{0x6A, 0x50, 0x20, 0x20}) &&
+ !bytes.Equal(raw[4:8], []byte{0x6A, 0x50, 0x32, 0x20}) {
+ return false
+ }
+ return bytes.Equal(raw[20:24], sig)
+ }
+}
+
+// Webp matches a WebP file.
+func Webp(raw []byte, _ uint32) bool {
+ return len(raw) > 12 &&
+ bytes.Equal(raw[0:4], []byte("RIFF")) &&
+ bytes.Equal(raw[8:12], []byte{0x57, 0x45, 0x42, 0x50})
+}
+
+// Dwg matches a CAD drawing file.
+func Dwg(raw []byte, _ uint32) bool {
+ if len(raw) < 6 || raw[0] != 0x41 || raw[1] != 0x43 {
+ return false
+ }
+ dwgVersions := [][]byte{
+ {0x31, 0x2E, 0x34, 0x30},
+ {0x31, 0x2E, 0x35, 0x30},
+ {0x32, 0x2E, 0x31, 0x30},
+ {0x31, 0x30, 0x30, 0x32},
+ {0x31, 0x30, 0x30, 0x33},
+ {0x31, 0x30, 0x30, 0x34},
+ {0x31, 0x30, 0x30, 0x36},
+ {0x31, 0x30, 0x30, 0x39},
+ {0x31, 0x30, 0x31, 0x32},
+ {0x31, 0x30, 0x31, 0x34},
+ {0x31, 0x30, 0x31, 0x35},
+ {0x31, 0x30, 0x31, 0x38},
+ {0x31, 0x30, 0x32, 0x31},
+ {0x31, 0x30, 0x32, 0x34},
+ {0x31, 0x30, 0x33, 0x32},
+ }
+
+ for _, d := range dwgVersions {
+ if bytes.Equal(raw[2:6], d) {
+ return true
+ }
+ }
+
+ return false
+}
+
+// Jxl matches JPEG XL image file.
+func Jxl(raw []byte, _ uint32) bool {
+ return bytes.HasPrefix(raw, []byte{0xFF, 0x0A}) ||
+ bytes.HasPrefix(raw, []byte("\x00\x00\x00\x0cJXL\x20\x0d\x0a\x87\x0a"))
+}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/magic.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/magic.go
new file mode 100644
index 0000000000..466058fbe2
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/magic.go
@@ -0,0 +1,239 @@
+// Package magic holds the matching functions used to find MIME types.
+package magic
+
+import (
+ "bytes"
+ "fmt"
+)
+
+type (
+ // Detector receiveѕ the raw data of a file and returns whether the data
+ // meets any conditions. The limit parameter is an upper limit to the number
+ // of bytes received and is used to tell if the byte slice represents the
+ // whole file or is just the header of a file: len(raw) < limit or len(raw)>limit.
+ Detector func(raw []byte, limit uint32) bool
+ xmlSig struct {
+ // the local name of the root tag
+ localName []byte
+ // the namespace of the XML document
+ xmlns []byte
+ }
+)
+
+// prefix creates a Detector which returns true if any of the provided signatures
+// is the prefix of the raw input.
+func prefix(sigs ...[]byte) Detector {
+ return func(raw []byte, limit uint32) bool {
+ for _, s := range sigs {
+ if bytes.HasPrefix(raw, s) {
+ return true
+ }
+ }
+ return false
+ }
+}
+
+// offset creates a Detector which returns true if the provided signature can be
+// found at offset in the raw input.
+func offset(sig []byte, offset int) Detector {
+ return func(raw []byte, limit uint32) bool {
+ return len(raw) > offset && bytes.HasPrefix(raw[offset:], sig)
+ }
+}
+
+// ciPrefix is like prefix but the check is case insensitive.
+func ciPrefix(sigs ...[]byte) Detector {
+ return func(raw []byte, limit uint32) bool {
+ for _, s := range sigs {
+ if ciCheck(s, raw) {
+ return true
+ }
+ }
+ return false
+ }
+}
+func ciCheck(sig, raw []byte) bool {
+ if len(raw) < len(sig)+1 {
+ return false
+ }
+ // perform case insensitive check
+ for i, b := range sig {
+ db := raw[i]
+ if 'A' <= b && b <= 'Z' {
+ db &= 0xDF
+ }
+ if b != db {
+ return false
+ }
+ }
+
+ return true
+}
+
+// xml creates a Detector which returns true if any of the provided XML signatures
+// matches the raw input.
+func xml(sigs ...xmlSig) Detector {
+ return func(raw []byte, limit uint32) bool {
+ raw = trimLWS(raw)
+ if len(raw) == 0 {
+ return false
+ }
+ for _, s := range sigs {
+ if xmlCheck(s, raw) {
+ return true
+ }
+ }
+ return false
+ }
+}
+func xmlCheck(sig xmlSig, raw []byte) bool {
+ raw = raw[:min(len(raw), 512)]
+
+ if len(sig.localName) == 0 {
+ return bytes.Index(raw, sig.xmlns) > 0
+ }
+ if len(sig.xmlns) == 0 {
+ return bytes.Index(raw, sig.localName) > 0
+ }
+
+ localNameIndex := bytes.Index(raw, sig.localName)
+ return localNameIndex != -1 && localNameIndex < bytes.Index(raw, sig.xmlns)
+}
+
+// markup creates a Detector which returns true is any of the HTML signatures
+// matches the raw input.
+func markup(sigs ...[]byte) Detector {
+ return func(raw []byte, limit uint32) bool {
+ if bytes.HasPrefix(raw, []byte{0xEF, 0xBB, 0xBF}) {
+ // We skip the UTF-8 BOM if present to ensure we correctly
+ // process any leading whitespace. The presence of the BOM
+ // is taken into account during charset detection in charset.go.
+ raw = trimLWS(raw[3:])
+ } else {
+ raw = trimLWS(raw)
+ }
+ if len(raw) == 0 {
+ return false
+ }
+ for _, s := range sigs {
+ if markupCheck(s, raw) {
+ return true
+ }
+ }
+ return false
+ }
+}
+func markupCheck(sig, raw []byte) bool {
+ if len(raw) < len(sig)+1 {
+ return false
+ }
+
+ // perform case insensitive check
+ for i, b := range sig {
+ db := raw[i]
+ if 'A' <= b && b <= 'Z' {
+ db &= 0xDF
+ }
+ if b != db {
+ return false
+ }
+ }
+ // Next byte must be space or right angle bracket.
+ if db := raw[len(sig)]; db != ' ' && db != '>' {
+ return false
+ }
+
+ return true
+}
+
+// ftyp creates a Detector which returns true if any of the FTYP signatures
+// matches the raw input.
+func ftyp(sigs ...[]byte) Detector {
+ return func(raw []byte, limit uint32) bool {
+ if len(raw) < 12 {
+ return false
+ }
+ for _, s := range sigs {
+ if bytes.Equal(raw[4:12], append([]byte("ftyp"), s...)) {
+ return true
+ }
+ }
+ return false
+ }
+}
+
+func newXMLSig(localName, xmlns string) xmlSig {
+ ret := xmlSig{xmlns: []byte(xmlns)}
+ if localName != "" {
+ ret.localName = []byte(fmt.Sprintf("<%s", localName))
+ }
+
+ return ret
+}
+
+// A valid shebang starts with the "#!" characters,
+// followed by any number of spaces,
+// followed by the path to the interpreter,
+// and, optionally, followed by the arguments for the interpreter.
+//
+// Ex:
+// #! /usr/bin/env php
+// /usr/bin/env is the interpreter, php is the first and only argument.
+func shebang(sigs ...[]byte) Detector {
+ return func(raw []byte, limit uint32) bool {
+ for _, s := range sigs {
+ if shebangCheck(s, firstLine(raw)) {
+ return true
+ }
+ }
+ return false
+ }
+}
+
+func shebangCheck(sig, raw []byte) bool {
+ if len(raw) < len(sig)+2 {
+ return false
+ }
+ if raw[0] != '#' || raw[1] != '!' {
+ return false
+ }
+
+ return bytes.Equal(trimLWS(trimRWS(raw[2:])), sig)
+}
+
+// trimLWS trims whitespace from beginning of the input.
+func trimLWS(in []byte) []byte {
+ firstNonWS := 0
+ for ; firstNonWS < len(in) && isWS(in[firstNonWS]); firstNonWS++ {
+ }
+
+ return in[firstNonWS:]
+}
+
+// trimRWS trims whitespace from the end of the input.
+func trimRWS(in []byte) []byte {
+ lastNonWS := len(in) - 1
+ for ; lastNonWS > 0 && isWS(in[lastNonWS]); lastNonWS-- {
+ }
+
+ return in[:lastNonWS+1]
+}
+
+func firstLine(in []byte) []byte {
+ lineEnd := 0
+ for ; lineEnd < len(in) && in[lineEnd] != '\n'; lineEnd++ {
+ }
+
+ return in[:lineEnd]
+}
+
+func isWS(b byte) bool {
+ return b == '\t' || b == '\n' || b == '\x0c' || b == '\r' || b == ' '
+}
+
+func min(a, b int) int {
+ if a < b {
+ return a
+ }
+ return b
+}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/ms_office.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/ms_office.go
new file mode 100644
index 0000000000..5964ce596c
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/ms_office.go
@@ -0,0 +1,225 @@
+package magic
+
+import (
+ "bytes"
+ "encoding/binary"
+)
+
+var (
+ xlsxSigFiles = []string{
+ "xl/worksheets/",
+ "xl/drawings/",
+ "xl/theme/",
+ "xl/_rels/",
+ "xl/styles.xml",
+ "xl/workbook.xml",
+ "xl/sharedStrings.xml",
+ }
+ docxSigFiles = []string{
+ "word/media/",
+ "word/_rels/document.xml.rels",
+ "word/document.xml",
+ "word/styles.xml",
+ "word/fontTable.xml",
+ "word/settings.xml",
+ "word/numbering.xml",
+ "word/header",
+ "word/footer",
+ }
+ pptxSigFiles = []string{
+ "ppt/slides/",
+ "ppt/media/",
+ "ppt/slideLayouts/",
+ "ppt/theme/",
+ "ppt/slideMasters/",
+ "ppt/tags/",
+ "ppt/notesMasters/",
+ "ppt/_rels/",
+ "ppt/handoutMasters/",
+ "ppt/notesSlides/",
+ "ppt/presentation.xml",
+ "ppt/tableStyles.xml",
+ "ppt/presProps.xml",
+ "ppt/viewProps.xml",
+ }
+)
+
+// Xlsx matches a Microsoft Excel 2007 file.
+func Xlsx(raw []byte, limit uint32) bool {
+ return zipContains(raw, xlsxSigFiles...)
+}
+
+// Docx matches a Microsoft Word 2007 file.
+func Docx(raw []byte, limit uint32) bool {
+ return zipContains(raw, docxSigFiles...)
+}
+
+// Pptx matches a Microsoft PowerPoint 2007 file.
+func Pptx(raw []byte, limit uint32) bool {
+ return zipContains(raw, pptxSigFiles...)
+}
+
+// Ole matches an Open Linking and Embedding file.
+//
+// https://en.wikipedia.org/wiki/Object_Linking_and_Embedding
+func Ole(raw []byte, limit uint32) bool {
+ return bytes.HasPrefix(raw, []byte{0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1})
+}
+
+// Aaf matches an Advanced Authoring Format file.
+// See: https://pyaaf.readthedocs.io/en/latest/about.html
+// See: https://en.wikipedia.org/wiki/Advanced_Authoring_Format
+func Aaf(raw []byte, limit uint32) bool {
+ if len(raw) < 31 {
+ return false
+ }
+ return bytes.HasPrefix(raw[8:], []byte{0x41, 0x41, 0x46, 0x42, 0x0D, 0x00, 0x4F, 0x4D}) &&
+ (raw[30] == 0x09 || raw[30] == 0x0C)
+}
+
+// Doc matches a Microsoft Word 97-2003 file.
+// See: https://github.com/decalage2/oletools/blob/412ee36ae45e70f42123e835871bac956d958461/oletools/common/clsid.py
+func Doc(raw []byte, _ uint32) bool {
+ clsids := [][]byte{
+ // Microsoft Word 97-2003 Document (Word.Document.8)
+ {0x06, 0x09, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46},
+ // Microsoft Word 6.0-7.0 Document (Word.Document.6)
+ {0x00, 0x09, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46},
+ // Microsoft Word Picture (Word.Picture.8)
+ {0x07, 0x09, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46},
+ }
+
+ for _, clsid := range clsids {
+ if matchOleClsid(raw, clsid) {
+ return true
+ }
+ }
+
+ return false
+}
+
+// Ppt matches a Microsoft PowerPoint 97-2003 file or a PowerPoint 95 presentation.
+func Ppt(raw []byte, limit uint32) bool {
+ // Root CLSID test is the safest way to detect identify OLE, however, the format
+ // often places the root CLSID at the end of the file.
+ if matchOleClsid(raw, []byte{
+ 0x10, 0x8d, 0x81, 0x64, 0x9b, 0x4f, 0xcf, 0x11,
+ 0x86, 0xea, 0x00, 0xaa, 0x00, 0xb9, 0x29, 0xe8,
+ }) || matchOleClsid(raw, []byte{
+ 0x70, 0xae, 0x7b, 0xea, 0x3b, 0xfb, 0xcd, 0x11,
+ 0xa9, 0x03, 0x00, 0xaa, 0x00, 0x51, 0x0e, 0xa3,
+ }) {
+ return true
+ }
+
+ lin := len(raw)
+ if lin < 520 {
+ return false
+ }
+ pptSubHeaders := [][]byte{
+ {0xA0, 0x46, 0x1D, 0xF0},
+ {0x00, 0x6E, 0x1E, 0xF0},
+ {0x0F, 0x00, 0xE8, 0x03},
+ }
+ for _, h := range pptSubHeaders {
+ if bytes.HasPrefix(raw[512:], h) {
+ return true
+ }
+ }
+
+ if bytes.HasPrefix(raw[512:], []byte{0xFD, 0xFF, 0xFF, 0xFF}) &&
+ raw[518] == 0x00 && raw[519] == 0x00 {
+ return true
+ }
+
+ return lin > 1152 && bytes.Contains(raw[1152:min(4096, lin)],
+ []byte("P\x00o\x00w\x00e\x00r\x00P\x00o\x00i\x00n\x00t\x00 D\x00o\x00c\x00u\x00m\x00e\x00n\x00t"))
+}
+
+// Xls matches a Microsoft Excel 97-2003 file.
+func Xls(raw []byte, limit uint32) bool {
+ // Root CLSID test is the safest way to detect identify OLE, however, the format
+ // often places the root CLSID at the end of the file.
+ if matchOleClsid(raw, []byte{
+ 0x10, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+ }) || matchOleClsid(raw, []byte{
+ 0x20, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+ }) {
+ return true
+ }
+
+ lin := len(raw)
+ if lin < 520 {
+ return false
+ }
+ xlsSubHeaders := [][]byte{
+ {0x09, 0x08, 0x10, 0x00, 0x00, 0x06, 0x05, 0x00},
+ {0xFD, 0xFF, 0xFF, 0xFF, 0x10},
+ {0xFD, 0xFF, 0xFF, 0xFF, 0x1F},
+ {0xFD, 0xFF, 0xFF, 0xFF, 0x22},
+ {0xFD, 0xFF, 0xFF, 0xFF, 0x23},
+ {0xFD, 0xFF, 0xFF, 0xFF, 0x28},
+ {0xFD, 0xFF, 0xFF, 0xFF, 0x29},
+ }
+ for _, h := range xlsSubHeaders {
+ if bytes.HasPrefix(raw[512:], h) {
+ return true
+ }
+ }
+
+ return lin > 1152 && bytes.Contains(raw[1152:min(4096, lin)],
+ []byte("W\x00k\x00s\x00S\x00S\x00W\x00o\x00r\x00k\x00B\x00o\x00o\x00k"))
+}
+
+// Pub matches a Microsoft Publisher file.
+func Pub(raw []byte, limit uint32) bool {
+ return matchOleClsid(raw, []byte{
+ 0x01, 0x12, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46,
+ })
+}
+
+// Msg matches a Microsoft Outlook email file.
+func Msg(raw []byte, limit uint32) bool {
+ return matchOleClsid(raw, []byte{
+ 0x0B, 0x0D, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46,
+ })
+}
+
+// Msi matches a Microsoft Windows Installer file.
+// http://fileformats.archiveteam.org/wiki/Microsoft_Compound_File
+func Msi(raw []byte, limit uint32) bool {
+ return matchOleClsid(raw, []byte{
+ 0x84, 0x10, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46,
+ })
+}
+
+// Helper to match by a specific CLSID of a compound file.
+//
+// http://fileformats.archiveteam.org/wiki/Microsoft_Compound_File
+func matchOleClsid(in []byte, clsid []byte) bool {
+ // Microsoft Compound files v3 have a sector length of 512, while v4 has 4096.
+ // Change sector offset depending on file version.
+ // https://www.loc.gov/preservation/digital/formats/fdd/fdd000392.shtml
+ sectorLength := 512
+ if len(in) < sectorLength {
+ return false
+ }
+ if in[26] == 0x04 && in[27] == 0x00 {
+ sectorLength = 4096
+ }
+
+ // SecID of first sector of the directory stream.
+ firstSecID := int(binary.LittleEndian.Uint32(in[48:52]))
+
+ // Expected offset of CLSID for root storage object.
+ clsidOffset := sectorLength*(1+firstSecID) + 80
+
+ if len(in) <= clsidOffset+16 {
+ return false
+ }
+
+ return bytes.HasPrefix(in[clsidOffset:], clsid)
+}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/ogg.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/ogg.go
new file mode 100644
index 0000000000..bb4cd781b6
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/ogg.go
@@ -0,0 +1,42 @@
+package magic
+
+import (
+ "bytes"
+)
+
+/*
+ NOTE:
+
+ In May 2003, two Internet RFCs were published relating to the format.
+ The Ogg bitstream was defined in RFC 3533 (which is classified as
+ 'informative') and its Internet content type (application/ogg) in RFC
+ 3534 (which is, as of 2006, a proposed standard protocol). In
+ September 2008, RFC 3534 was obsoleted by RFC 5334, which added
+ content types video/ogg, audio/ogg and filename extensions .ogx, .ogv,
+ .oga, .spx.
+
+ See:
+ https://tools.ietf.org/html/rfc3533
+ https://developer.mozilla.org/en-US/docs/Web/HTTP/Configuring_servers_for_Ogg_media#Serve_media_with_the_correct_MIME_type
+ https://github.com/file/file/blob/master/magic/Magdir/vorbis
+*/
+
+// Ogg matches an Ogg file.
+func Ogg(raw []byte, limit uint32) bool {
+ return bytes.HasPrefix(raw, []byte("\x4F\x67\x67\x53\x00"))
+}
+
+// OggAudio matches an audio ogg file.
+func OggAudio(raw []byte, limit uint32) bool {
+ return len(raw) >= 37 && (bytes.HasPrefix(raw[28:], []byte("\x7fFLAC")) ||
+ bytes.HasPrefix(raw[28:], []byte("\x01vorbis")) ||
+ bytes.HasPrefix(raw[28:], []byte("OpusHead")) ||
+ bytes.HasPrefix(raw[28:], []byte("Speex\x20\x20\x20")))
+}
+
+// OggVideo matches a video ogg file.
+func OggVideo(raw []byte, limit uint32) bool {
+ return len(raw) >= 37 && (bytes.HasPrefix(raw[28:], []byte("\x80theora")) ||
+ bytes.HasPrefix(raw[28:], []byte("fishead\x00")) ||
+ bytes.HasPrefix(raw[28:], []byte("\x01video\x00\x00\x00"))) // OGM video
+}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/text.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/text.go
new file mode 100644
index 0000000000..e2a03caf50
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/text.go
@@ -0,0 +1,375 @@
+package magic
+
+import (
+ "bufio"
+ "bytes"
+ "strings"
+ "time"
+
+ "github.com/gabriel-vasile/mimetype/internal/charset"
+ "github.com/gabriel-vasile/mimetype/internal/json"
+)
+
+var (
+ // HTML matches a Hypertext Markup Language file.
+ HTML = markup(
+ []byte(" 0
+}
+
+// GeoJSON matches a RFC 7946 GeoJSON file.
+//
+// GeoJSON detection implies searching for key:value pairs like: `"type": "Feature"`
+// in the input.
+// BUG(gabriel-vasile): The "type" key should be searched for in the root object.
+func GeoJSON(raw []byte, limit uint32) bool {
+ raw = trimLWS(raw)
+ if len(raw) == 0 {
+ return false
+ }
+ // GeoJSON is always a JSON object, not a JSON array or any other JSON value.
+ if raw[0] != '{' {
+ return false
+ }
+
+ s := []byte(`"type"`)
+ si, sl := bytes.Index(raw, s), len(s)
+
+ if si == -1 {
+ return false
+ }
+
+ // If the "type" string is the suffix of the input,
+ // there is no need to search for the value of the key.
+ if si+sl == len(raw) {
+ return false
+ }
+ // Skip the "type" part.
+ raw = raw[si+sl:]
+ // Skip any whitespace before the colon.
+ raw = trimLWS(raw)
+ // Check for colon.
+ if len(raw) == 0 || raw[0] != ':' {
+ return false
+ }
+ // Skip any whitespace after the colon.
+ raw = trimLWS(raw[1:])
+
+ geoJSONTypes := [][]byte{
+ []byte(`"Feature"`),
+ []byte(`"FeatureCollection"`),
+ []byte(`"Point"`),
+ []byte(`"LineString"`),
+ []byte(`"Polygon"`),
+ []byte(`"MultiPoint"`),
+ []byte(`"MultiLineString"`),
+ []byte(`"MultiPolygon"`),
+ []byte(`"GeometryCollection"`),
+ }
+ for _, t := range geoJSONTypes {
+ if bytes.HasPrefix(raw, t) {
+ return true
+ }
+ }
+
+ return false
+}
+
+// NdJSON matches a Newline delimited JSON file. All complete lines from raw
+// must be valid JSON documents meaning they contain one of the valid JSON data
+// types.
+func NdJSON(raw []byte, limit uint32) bool {
+ lCount, hasObjOrArr := 0, false
+ sc := bufio.NewScanner(dropLastLine(raw, limit))
+ for sc.Scan() {
+ l := sc.Bytes()
+ // Empty lines are allowed in NDJSON.
+ if l = trimRWS(trimLWS(l)); len(l) == 0 {
+ continue
+ }
+ _, err := json.Scan(l)
+ if err != nil {
+ return false
+ }
+ if l[0] == '[' || l[0] == '{' {
+ hasObjOrArr = true
+ }
+ lCount++
+ }
+
+ return lCount > 1 && hasObjOrArr
+}
+
+// HAR matches a HAR Spec file.
+// Spec: http://www.softwareishard.com/blog/har-12-spec/
+func HAR(raw []byte, limit uint32) bool {
+ s := []byte(`"log"`)
+ si, sl := bytes.Index(raw, s), len(s)
+
+ if si == -1 {
+ return false
+ }
+
+ // If the "log" string is the suffix of the input,
+ // there is no need to search for the value of the key.
+ if si+sl == len(raw) {
+ return false
+ }
+ // Skip the "log" part.
+ raw = raw[si+sl:]
+ // Skip any whitespace before the colon.
+ raw = trimLWS(raw)
+ // Check for colon.
+ if len(raw) == 0 || raw[0] != ':' {
+ return false
+ }
+ // Skip any whitespace after the colon.
+ raw = trimLWS(raw[1:])
+
+ harJSONTypes := [][]byte{
+ []byte(`"version"`),
+ []byte(`"creator"`),
+ []byte(`"entries"`),
+ }
+ for _, t := range harJSONTypes {
+ si := bytes.Index(raw, t)
+ if si > -1 {
+ return true
+ }
+ }
+
+ return false
+}
+
+// Svg matches a SVG file.
+func Svg(raw []byte, limit uint32) bool {
+ return bytes.Contains(raw, []byte(" 00:02:19,376) limits secondLine
+ // length to exactly 29 characters.
+ if len(secondLine) != 29 {
+ return false
+ }
+ // Decimal separator of fractional seconds in the timestamps must be a
+ // comma, not a period.
+ if strings.Contains(secondLine, ".") {
+ return false
+ }
+ // For Go <1.17, comma is not recognised as a decimal separator by `time.Parse`.
+ secondLine = strings.ReplaceAll(secondLine, ",", ".")
+ // Second line must be a time range.
+ ts := strings.Split(secondLine, " --> ")
+ if len(ts) != 2 {
+ return false
+ }
+ const layout = "15:04:05.000"
+ t0, err := time.Parse(layout, ts[0])
+ if err != nil {
+ return false
+ }
+ t1, err := time.Parse(layout, ts[1])
+ if err != nil {
+ return false
+ }
+ if t0.After(t1) {
+ return false
+ }
+
+ // A third line must exist and not be empty. This is the actual subtitle text.
+ return s.Scan() && len(s.Bytes()) != 0
+}
+
+// Vtt matches a Web Video Text Tracks (WebVTT) file. See
+// https://www.iana.org/assignments/media-types/text/vtt.
+func Vtt(raw []byte, limit uint32) bool {
+ // Prefix match.
+ prefixes := [][]byte{
+ {0xEF, 0xBB, 0xBF, 0x57, 0x45, 0x42, 0x56, 0x54, 0x54, 0x0A}, // UTF-8 BOM, "WEBVTT" and a line feed
+ {0xEF, 0xBB, 0xBF, 0x57, 0x45, 0x42, 0x56, 0x54, 0x54, 0x0D}, // UTF-8 BOM, "WEBVTT" and a carriage return
+ {0xEF, 0xBB, 0xBF, 0x57, 0x45, 0x42, 0x56, 0x54, 0x54, 0x20}, // UTF-8 BOM, "WEBVTT" and a space
+ {0xEF, 0xBB, 0xBF, 0x57, 0x45, 0x42, 0x56, 0x54, 0x54, 0x09}, // UTF-8 BOM, "WEBVTT" and a horizontal tab
+ {0x57, 0x45, 0x42, 0x56, 0x54, 0x54, 0x0A}, // "WEBVTT" and a line feed
+ {0x57, 0x45, 0x42, 0x56, 0x54, 0x54, 0x0D}, // "WEBVTT" and a carriage return
+ {0x57, 0x45, 0x42, 0x56, 0x54, 0x54, 0x20}, // "WEBVTT" and a space
+ {0x57, 0x45, 0x42, 0x56, 0x54, 0x54, 0x09}, // "WEBVTT" and a horizontal tab
+ }
+ for _, p := range prefixes {
+ if bytes.HasPrefix(raw, p) {
+ return true
+ }
+ }
+
+ // Exact match.
+ return bytes.Equal(raw, []byte{0xEF, 0xBB, 0xBF, 0x57, 0x45, 0x42, 0x56, 0x54, 0x54}) || // UTF-8 BOM and "WEBVTT"
+ bytes.Equal(raw, []byte{0x57, 0x45, 0x42, 0x56, 0x54, 0x54}) // "WEBVTT"
+}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/text_csv.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/text_csv.go
new file mode 100644
index 0000000000..6a1561923c
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/text_csv.go
@@ -0,0 +1,51 @@
+package magic
+
+import (
+ "bytes"
+ "encoding/csv"
+ "io"
+)
+
+// Csv matches a comma-separated values file.
+func Csv(raw []byte, limit uint32) bool {
+ return sv(raw, ',', limit)
+}
+
+// Tsv matches a tab-separated values file.
+func Tsv(raw []byte, limit uint32) bool {
+ return sv(raw, '\t', limit)
+}
+
+func sv(in []byte, comma rune, limit uint32) bool {
+ r := csv.NewReader(dropLastLine(in, limit))
+ r.Comma = comma
+ r.TrimLeadingSpace = true
+ r.LazyQuotes = true
+ r.Comment = '#'
+
+ lines, err := r.ReadAll()
+ return err == nil && r.FieldsPerRecord > 1 && len(lines) > 1
+}
+
+// dropLastLine drops the last incomplete line from b.
+//
+// mimetype limits itself to ReadLimit bytes when performing a detection.
+// This means, for file formats like CSV for NDJSON, the last line of the input
+// can be an incomplete line.
+func dropLastLine(b []byte, cutAt uint32) io.Reader {
+ if cutAt == 0 {
+ return bytes.NewReader(b)
+ }
+ if uint32(len(b)) >= cutAt {
+ for i := cutAt - 1; i > 0; i-- {
+ if b[i] == '\n' {
+ return bytes.NewReader(b[:i])
+ }
+ }
+
+ // No newline was found between the 0 index and cutAt.
+ return bytes.NewReader(b[:cutAt])
+ }
+
+ return bytes.NewReader(b)
+}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/video.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/video.go
new file mode 100644
index 0000000000..9caf55538a
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/video.go
@@ -0,0 +1,85 @@
+package magic
+
+import (
+ "bytes"
+)
+
+var (
+ // Flv matches a Flash video file.
+ Flv = prefix([]byte("\x46\x4C\x56\x01"))
+ // Asf matches an Advanced Systems Format file.
+ Asf = prefix([]byte{
+ 0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11,
+ 0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C,
+ })
+ // Rmvb matches a RealMedia Variable Bitrate file.
+ Rmvb = prefix([]byte{0x2E, 0x52, 0x4D, 0x46})
+)
+
+// WebM matches a WebM file.
+func WebM(raw []byte, limit uint32) bool {
+ return isMatroskaFileTypeMatched(raw, "webm")
+}
+
+// Mkv matches a mkv file.
+func Mkv(raw []byte, limit uint32) bool {
+ return isMatroskaFileTypeMatched(raw, "matroska")
+}
+
+// isMatroskaFileTypeMatched is used for webm and mkv file matching.
+// It checks for .Eߣ sequence. If the sequence is found,
+// then it means it is Matroska media container, including WebM.
+// Then it verifies which of the file type it is representing by matching the
+// file specific string.
+func isMatroskaFileTypeMatched(in []byte, flType string) bool {
+ if bytes.HasPrefix(in, []byte("\x1A\x45\xDF\xA3")) {
+ return isFileTypeNamePresent(in, flType)
+ }
+ return false
+}
+
+// isFileTypeNamePresent accepts the matroska input data stream and searches
+// for the given file type in the stream. Return whether a match is found.
+// The logic of search is: find first instance of \x42\x82 and then
+// search for given string after n bytes of above instance.
+func isFileTypeNamePresent(in []byte, flType string) bool {
+ ind, maxInd, lenIn := 0, 4096, len(in)
+ if lenIn < maxInd { // restricting length to 4096
+ maxInd = lenIn
+ }
+ ind = bytes.Index(in[:maxInd], []byte("\x42\x82"))
+ if ind > 0 && lenIn > ind+2 {
+ ind += 2
+
+ // filetype name will be present exactly
+ // n bytes after the match of the two bytes "\x42\x82"
+ n := vintWidth(int(in[ind]))
+ if lenIn > ind+n {
+ return bytes.HasPrefix(in[ind+n:], []byte(flType))
+ }
+ }
+ return false
+}
+
+// vintWidth parses the variable-integer width in matroska containers
+func vintWidth(v int) int {
+ mask, max, num := 128, 8, 1
+ for num < max && v&mask == 0 {
+ mask = mask >> 1
+ num++
+ }
+ return num
+}
+
+// Mpeg matches a Moving Picture Experts Group file.
+func Mpeg(raw []byte, limit uint32) bool {
+ return len(raw) > 3 && bytes.HasPrefix(raw, []byte{0x00, 0x00, 0x01}) &&
+ raw[3] >= 0xB0 && raw[3] <= 0xBF
+}
+
+// Avi matches an Audio Video Interleaved file.
+func Avi(raw []byte, limit uint32) bool {
+ return len(raw) > 16 &&
+ bytes.Equal(raw[:4], []byte("RIFF")) &&
+ bytes.Equal(raw[8:16], []byte("AVI LIST"))
+}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/zip.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/zip.go
new file mode 100644
index 0000000000..dabee947b9
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/zip.go
@@ -0,0 +1,92 @@
+package magic
+
+import (
+ "bytes"
+ "encoding/binary"
+ "strings"
+)
+
+var (
+ // Odt matches an OpenDocument Text file.
+ Odt = offset([]byte("mimetypeapplication/vnd.oasis.opendocument.text"), 30)
+ // Ott matches an OpenDocument Text Template file.
+ Ott = offset([]byte("mimetypeapplication/vnd.oasis.opendocument.text-template"), 30)
+ // Ods matches an OpenDocument Spreadsheet file.
+ Ods = offset([]byte("mimetypeapplication/vnd.oasis.opendocument.spreadsheet"), 30)
+ // Ots matches an OpenDocument Spreadsheet Template file.
+ Ots = offset([]byte("mimetypeapplication/vnd.oasis.opendocument.spreadsheet-template"), 30)
+ // Odp matches an OpenDocument Presentation file.
+ Odp = offset([]byte("mimetypeapplication/vnd.oasis.opendocument.presentation"), 30)
+ // Otp matches an OpenDocument Presentation Template file.
+ Otp = offset([]byte("mimetypeapplication/vnd.oasis.opendocument.presentation-template"), 30)
+ // Odg matches an OpenDocument Drawing file.
+ Odg = offset([]byte("mimetypeapplication/vnd.oasis.opendocument.graphics"), 30)
+ // Otg matches an OpenDocument Drawing Template file.
+ Otg = offset([]byte("mimetypeapplication/vnd.oasis.opendocument.graphics-template"), 30)
+ // Odf matches an OpenDocument Formula file.
+ Odf = offset([]byte("mimetypeapplication/vnd.oasis.opendocument.formula"), 30)
+ // Odc matches an OpenDocument Chart file.
+ Odc = offset([]byte("mimetypeapplication/vnd.oasis.opendocument.chart"), 30)
+ // Epub matches an EPUB file.
+ Epub = offset([]byte("mimetypeapplication/epub+zip"), 30)
+ // Sxc matches an OpenOffice Spreadsheet file.
+ Sxc = offset([]byte("mimetypeapplication/vnd.sun.xml.calc"), 30)
+)
+
+// Zip matches a zip archive.
+func Zip(raw []byte, limit uint32) bool {
+ return len(raw) > 3 &&
+ raw[0] == 0x50 && raw[1] == 0x4B &&
+ (raw[2] == 0x3 || raw[2] == 0x5 || raw[2] == 0x7) &&
+ (raw[3] == 0x4 || raw[3] == 0x6 || raw[3] == 0x8)
+}
+
+// Jar matches a Java archive file.
+func Jar(raw []byte, limit uint32) bool {
+ return zipContains(raw, "META-INF/MANIFEST.MF")
+}
+
+// zipTokenizer holds the source zip file and scanned index.
+type zipTokenizer struct {
+ in []byte
+ i int // current index
+}
+
+// next returns the next file name from the zip headers.
+// https://web.archive.org/web/20191129114319/https://users.cs.jmu.edu/buchhofp/forensics/formats/pkzip.html
+func (t *zipTokenizer) next() (fileName string) {
+ if t.i > len(t.in) {
+ return
+ }
+ in := t.in[t.i:]
+ // pkSig is the signature of the zip local file header.
+ pkSig := []byte("PK\003\004")
+ pkIndex := bytes.Index(in, pkSig)
+ // 30 is the offset of the file name in the header.
+ fNameOffset := pkIndex + 30
+ // end if signature not found or file name offset outside of file.
+ if pkIndex == -1 || fNameOffset > len(in) {
+ return
+ }
+
+ fNameLen := int(binary.LittleEndian.Uint16(in[pkIndex+26 : pkIndex+28]))
+ if fNameLen <= 0 || fNameOffset+fNameLen > len(in) {
+ return
+ }
+ t.i += fNameOffset + fNameLen
+ return string(in[fNameOffset : fNameOffset+fNameLen])
+}
+
+// zipContains returns true if the zip file headers from in contain any of the paths.
+func zipContains(in []byte, paths ...string) bool {
+ t := zipTokenizer{in: in}
+ for i, tok := 0, t.next(); tok != ""; i, tok = i+1, t.next() {
+ for p := range paths {
+ if strings.HasPrefix(tok, paths[p]) {
+ return true
+ }
+ }
+ }
+
+ return false
+}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/mime.go b/vendor/github.com/gabriel-vasile/mimetype/mime.go
new file mode 100644
index 0000000000..62cb15f593
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/mime.go
@@ -0,0 +1,186 @@
+package mimetype
+
+import (
+ "mime"
+
+ "github.com/gabriel-vasile/mimetype/internal/charset"
+ "github.com/gabriel-vasile/mimetype/internal/magic"
+)
+
+// MIME struct holds information about a file format: the string representation
+// of the MIME type, the extension and the parent file format.
+type MIME struct {
+ mime string
+ aliases []string
+ extension string
+ // detector receives the raw input and a limit for the number of bytes it is
+ // allowed to check. It returns whether the input matches a signature or not.
+ detector magic.Detector
+ children []*MIME
+ parent *MIME
+}
+
+// String returns the string representation of the MIME type, e.g., "application/zip".
+func (m *MIME) String() string {
+ return m.mime
+}
+
+// Extension returns the file extension associated with the MIME type.
+// It includes the leading dot, as in ".html". When the file format does not
+// have an extension, the empty string is returned.
+func (m *MIME) Extension() string {
+ return m.extension
+}
+
+// Parent returns the parent MIME type from the hierarchy.
+// Each MIME type has a non-nil parent, except for the root MIME type.
+//
+// For example, the application/json and text/html MIME types have text/plain as
+// their parent because they are text files who happen to contain JSON or HTML.
+// Another example is the ZIP format, which is used as container
+// for Microsoft Office files, EPUB files, JAR files, and others.
+func (m *MIME) Parent() *MIME {
+ return m.parent
+}
+
+// Is checks whether this MIME type, or any of its aliases, is equal to the
+// expected MIME type. MIME type equality test is done on the "type/subtype"
+// section, ignores any optional MIME parameters, ignores any leading and
+// trailing whitespace, and is case insensitive.
+func (m *MIME) Is(expectedMIME string) bool {
+ // Parsing is needed because some detected MIME types contain parameters
+ // that need to be stripped for the comparison.
+ expectedMIME, _, _ = mime.ParseMediaType(expectedMIME)
+ found, _, _ := mime.ParseMediaType(m.mime)
+
+ if expectedMIME == found {
+ return true
+ }
+
+ for _, alias := range m.aliases {
+ if alias == expectedMIME {
+ return true
+ }
+ }
+
+ return false
+}
+
+func newMIME(
+ mime, extension string,
+ detector magic.Detector,
+ children ...*MIME) *MIME {
+ m := &MIME{
+ mime: mime,
+ extension: extension,
+ detector: detector,
+ children: children,
+ }
+
+ for _, c := range children {
+ c.parent = m
+ }
+
+ return m
+}
+
+func (m *MIME) alias(aliases ...string) *MIME {
+ m.aliases = aliases
+ return m
+}
+
+// match does a depth-first search on the signature tree. It returns the deepest
+// successful node for which all the children detection functions fail.
+func (m *MIME) match(in []byte, readLimit uint32) *MIME {
+ for _, c := range m.children {
+ if c.detector(in, readLimit) {
+ return c.match(in, readLimit)
+ }
+ }
+
+ needsCharset := map[string]func([]byte) string{
+ "text/plain": charset.FromPlain,
+ "text/html": charset.FromHTML,
+ "text/xml": charset.FromXML,
+ }
+ // ps holds optional MIME parameters.
+ ps := map[string]string{}
+ if f, ok := needsCharset[m.mime]; ok {
+ if cset := f(in); cset != "" {
+ ps["charset"] = cset
+ }
+ }
+
+ return m.cloneHierarchy(ps)
+}
+
+// flatten transforms an hierarchy of MIMEs into a slice of MIMEs.
+func (m *MIME) flatten() []*MIME {
+ out := []*MIME{m}
+ for _, c := range m.children {
+ out = append(out, c.flatten()...)
+ }
+
+ return out
+}
+
+// clone creates a new MIME with the provided optional MIME parameters.
+func (m *MIME) clone(ps map[string]string) *MIME {
+ clonedMIME := m.mime
+ if len(ps) > 0 {
+ clonedMIME = mime.FormatMediaType(m.mime, ps)
+ }
+
+ return &MIME{
+ mime: clonedMIME,
+ aliases: m.aliases,
+ extension: m.extension,
+ }
+}
+
+// cloneHierarchy creates a clone of m and all its ancestors. The optional MIME
+// parameters are set on the last child of the hierarchy.
+func (m *MIME) cloneHierarchy(ps map[string]string) *MIME {
+ ret := m.clone(ps)
+ lastChild := ret
+ for p := m.Parent(); p != nil; p = p.Parent() {
+ pClone := p.clone(nil)
+ lastChild.parent = pClone
+ lastChild = pClone
+ }
+
+ return ret
+}
+
+func (m *MIME) lookup(mime string) *MIME {
+ for _, n := range append(m.aliases, m.mime) {
+ if n == mime {
+ return m
+ }
+ }
+
+ for _, c := range m.children {
+ if m := c.lookup(mime); m != nil {
+ return m
+ }
+ }
+ return nil
+}
+
+// Extend adds detection for a sub-format. The detector is a function
+// returning true when the raw input file satisfies a signature.
+// The sub-format will be detected if all the detectors in the parent chain return true.
+// The extension should include the leading dot, as in ".html".
+func (m *MIME) Extend(detector func(raw []byte, limit uint32) bool, mime, extension string, aliases ...string) {
+ c := &MIME{
+ mime: mime,
+ extension: extension,
+ detector: detector,
+ parent: m,
+ aliases: aliases,
+ }
+
+ mu.Lock()
+ m.children = append([]*MIME{c}, m.children...)
+ mu.Unlock()
+}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/mimetype.gif b/vendor/github.com/gabriel-vasile/mimetype/mimetype.gif
new file mode 100644
index 0000000000..c3e8087673
Binary files /dev/null and b/vendor/github.com/gabriel-vasile/mimetype/mimetype.gif differ
diff --git a/vendor/github.com/gabriel-vasile/mimetype/mimetype.go b/vendor/github.com/gabriel-vasile/mimetype/mimetype.go
new file mode 100644
index 0000000000..08e68e334a
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/mimetype.go
@@ -0,0 +1,123 @@
+// Package mimetype uses magic number signatures to detect the MIME type of a file.
+//
+// File formats are stored in a hierarchy with application/octet-stream at its root.
+// For example, the hierarchy for HTML format is application/octet-stream ->
+// text/plain -> text/html.
+package mimetype
+
+import (
+ "io"
+ "io/ioutil"
+ "mime"
+ "os"
+ "sync/atomic"
+)
+
+// readLimit is the maximum number of bytes from the input used when detecting.
+var readLimit uint32 = 3072
+
+// Detect returns the MIME type found from the provided byte slice.
+//
+// The result is always a valid MIME type, with application/octet-stream
+// returned when identification failed.
+func Detect(in []byte) *MIME {
+ // Using atomic because readLimit can be written at the same time in other goroutine.
+ l := atomic.LoadUint32(&readLimit)
+ if l > 0 && len(in) > int(l) {
+ in = in[:l]
+ }
+ mu.RLock()
+ defer mu.RUnlock()
+ return root.match(in, l)
+}
+
+// DetectReader returns the MIME type of the provided reader.
+//
+// The result is always a valid MIME type, with application/octet-stream
+// returned when identification failed with or without an error.
+// Any error returned is related to the reading from the input reader.
+//
+// DetectReader assumes the reader offset is at the start. If the input is an
+// io.ReadSeeker you previously read from, it should be rewinded before detection:
+// reader.Seek(0, io.SeekStart)
+func DetectReader(r io.Reader) (*MIME, error) {
+ var in []byte
+ var err error
+
+ // Using atomic because readLimit can be written at the same time in other goroutine.
+ l := atomic.LoadUint32(&readLimit)
+ if l == 0 {
+ in, err = ioutil.ReadAll(r)
+ if err != nil {
+ return errMIME, err
+ }
+ } else {
+ var n int
+ in = make([]byte, l)
+ // io.UnexpectedEOF means len(r) < len(in). It is not an error in this case,
+ // it just means the input file is smaller than the allocated bytes slice.
+ n, err = io.ReadFull(r, in)
+ if err != nil && err != io.EOF && err != io.ErrUnexpectedEOF {
+ return errMIME, err
+ }
+ in = in[:n]
+ }
+
+ mu.RLock()
+ defer mu.RUnlock()
+ return root.match(in, l), nil
+}
+
+// DetectFile returns the MIME type of the provided file.
+//
+// The result is always a valid MIME type, with application/octet-stream
+// returned when identification failed with or without an error.
+// Any error returned is related to the opening and reading from the input file.
+func DetectFile(path string) (*MIME, error) {
+ f, err := os.Open(path)
+ if err != nil {
+ return errMIME, err
+ }
+ defer f.Close()
+
+ return DetectReader(f)
+}
+
+// EqualsAny reports whether s MIME type is equal to any MIME type in mimes.
+// MIME type equality test is done on the "type/subtype" section, ignores
+// any optional MIME parameters, ignores any leading and trailing whitespace,
+// and is case insensitive.
+func EqualsAny(s string, mimes ...string) bool {
+ s, _, _ = mime.ParseMediaType(s)
+ for _, m := range mimes {
+ m, _, _ = mime.ParseMediaType(m)
+ if s == m {
+ return true
+ }
+ }
+
+ return false
+}
+
+// SetLimit sets the maximum number of bytes read from input when detecting the MIME type.
+// Increasing the limit provides better detection for file formats which store
+// their magical numbers towards the end of the file: docx, pptx, xlsx, etc.
+// A limit of 0 means the whole input file will be used.
+func SetLimit(limit uint32) {
+ // Using atomic because readLimit can be read at the same time in other goroutine.
+ atomic.StoreUint32(&readLimit, limit)
+}
+
+// Extend adds detection for other file formats.
+// It is equivalent to calling Extend() on the root mime type "application/octet-stream".
+func Extend(detector func(raw []byte, limit uint32) bool, mime, extension string, aliases ...string) {
+ root.Extend(detector, mime, extension, aliases...)
+}
+
+// Lookup finds a MIME object by its string representation.
+// The representation can be the main mime type, or any of its aliases.
+func Lookup(mime string) *MIME {
+ mu.RLock()
+ defer mu.RUnlock()
+ return root.lookup(mime)
+}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/supported_mimes.md b/vendor/github.com/gabriel-vasile/mimetype/supported_mimes.md
new file mode 100644
index 0000000000..cdec4e674e
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/supported_mimes.md
@@ -0,0 +1,178 @@
+## 172 Supported MIME types
+This file is automatically generated when running tests. Do not edit manually.
+
+Extension | MIME type | Aliases
+--------- | --------- | -------
+**n/a** | application/octet-stream | -
+**.xpm** | image/x-xpixmap | -
+**.7z** | application/x-7z-compressed | -
+**.zip** | application/zip | application/x-zip, application/x-zip-compressed
+**.xlsx** | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | -
+**.docx** | application/vnd.openxmlformats-officedocument.wordprocessingml.document | -
+**.pptx** | application/vnd.openxmlformats-officedocument.presentationml.presentation | -
+**.epub** | application/epub+zip | -
+**.jar** | application/jar | -
+**.odt** | application/vnd.oasis.opendocument.text | application/x-vnd.oasis.opendocument.text
+**.ott** | application/vnd.oasis.opendocument.text-template | application/x-vnd.oasis.opendocument.text-template
+**.ods** | application/vnd.oasis.opendocument.spreadsheet | application/x-vnd.oasis.opendocument.spreadsheet
+**.ots** | application/vnd.oasis.opendocument.spreadsheet-template | application/x-vnd.oasis.opendocument.spreadsheet-template
+**.odp** | application/vnd.oasis.opendocument.presentation | application/x-vnd.oasis.opendocument.presentation
+**.otp** | application/vnd.oasis.opendocument.presentation-template | application/x-vnd.oasis.opendocument.presentation-template
+**.odg** | application/vnd.oasis.opendocument.graphics | application/x-vnd.oasis.opendocument.graphics
+**.otg** | application/vnd.oasis.opendocument.graphics-template | application/x-vnd.oasis.opendocument.graphics-template
+**.odf** | application/vnd.oasis.opendocument.formula | application/x-vnd.oasis.opendocument.formula
+**.odc** | application/vnd.oasis.opendocument.chart | application/x-vnd.oasis.opendocument.chart
+**.sxc** | application/vnd.sun.xml.calc | -
+**.pdf** | application/pdf | application/x-pdf
+**.fdf** | application/vnd.fdf | -
+**n/a** | application/x-ole-storage | -
+**.msi** | application/x-ms-installer | application/x-windows-installer, application/x-msi
+**.aaf** | application/octet-stream | -
+**.msg** | application/vnd.ms-outlook | -
+**.xls** | application/vnd.ms-excel | application/msexcel
+**.pub** | application/vnd.ms-publisher | -
+**.ppt** | application/vnd.ms-powerpoint | application/mspowerpoint
+**.doc** | application/msword | application/vnd.ms-word
+**.ps** | application/postscript | -
+**.psd** | image/vnd.adobe.photoshop | image/x-psd, application/photoshop
+**.p7s** | application/pkcs7-signature | -
+**.ogg** | application/ogg | application/x-ogg
+**.oga** | audio/ogg | -
+**.ogv** | video/ogg | -
+**.png** | image/png | -
+**.png** | image/vnd.mozilla.apng | -
+**.jpg** | image/jpeg | -
+**.jxl** | image/jxl | -
+**.jp2** | image/jp2 | -
+**.jpf** | image/jpx | -
+**.jpm** | image/jpm | video/jpm
+**.jxs** | image/jxs | -
+**.gif** | image/gif | -
+**.webp** | image/webp | -
+**.exe** | application/vnd.microsoft.portable-executable | -
+**n/a** | application/x-elf | -
+**n/a** | application/x-object | -
+**n/a** | application/x-executable | -
+**.so** | application/x-sharedlib | -
+**n/a** | application/x-coredump | -
+**.a** | application/x-archive | application/x-unix-archive
+**.deb** | application/vnd.debian.binary-package | -
+**.tar** | application/x-tar | -
+**.xar** | application/x-xar | -
+**.bz2** | application/x-bzip2 | -
+**.fits** | application/fits | -
+**.tiff** | image/tiff | -
+**.bmp** | image/bmp | image/x-bmp, image/x-ms-bmp
+**.ico** | image/x-icon | -
+**.mp3** | audio/mpeg | audio/x-mpeg, audio/mp3
+**.flac** | audio/flac | -
+**.midi** | audio/midi | audio/mid, audio/sp-midi, audio/x-mid, audio/x-midi
+**.ape** | audio/ape | -
+**.mpc** | audio/musepack | -
+**.amr** | audio/amr | audio/amr-nb
+**.wav** | audio/wav | audio/x-wav, audio/vnd.wave, audio/wave
+**.aiff** | audio/aiff | audio/x-aiff
+**.au** | audio/basic | -
+**.mpeg** | video/mpeg | -
+**.mov** | video/quicktime | -
+**.mqv** | video/quicktime | -
+**.mp4** | video/mp4 | -
+**.webm** | video/webm | audio/webm
+**.3gp** | video/3gpp | video/3gp, audio/3gpp
+**.3g2** | video/3gpp2 | video/3g2, audio/3gpp2
+**.avi** | video/x-msvideo | video/avi, video/msvideo
+**.flv** | video/x-flv | -
+**.mkv** | video/x-matroska | -
+**.asf** | video/x-ms-asf | video/asf, video/x-ms-wmv
+**.aac** | audio/aac | -
+**.voc** | audio/x-unknown | -
+**.mp4** | audio/mp4 | audio/x-m4a, audio/x-mp4a
+**.m4a** | audio/x-m4a | -
+**.m3u** | application/vnd.apple.mpegurl | audio/mpegurl
+**.m4v** | video/x-m4v | -
+**.rmvb** | application/vnd.rn-realmedia-vbr | -
+**.gz** | application/gzip | application/x-gzip, application/x-gunzip, application/gzipped, application/gzip-compressed, application/x-gzip-compressed, gzip/document
+**.class** | application/x-java-applet | -
+**.swf** | application/x-shockwave-flash | -
+**.crx** | application/x-chrome-extension | -
+**.ttf** | font/ttf | font/sfnt, application/x-font-ttf, application/font-sfnt
+**.woff** | font/woff | -
+**.woff2** | font/woff2 | -
+**.otf** | font/otf | -
+**.ttc** | font/collection | -
+**.eot** | application/vnd.ms-fontobject | -
+**.wasm** | application/wasm | -
+**.shx** | application/vnd.shx | -
+**.shp** | application/vnd.shp | -
+**.dbf** | application/x-dbf | -
+**.dcm** | application/dicom | -
+**.rar** | application/x-rar-compressed | application/x-rar
+**.djvu** | image/vnd.djvu | -
+**.mobi** | application/x-mobipocket-ebook | -
+**.lit** | application/x-ms-reader | -
+**.bpg** | image/bpg | -
+**.sqlite** | application/vnd.sqlite3 | application/x-sqlite3
+**.dwg** | image/vnd.dwg | image/x-dwg, application/acad, application/x-acad, application/autocad_dwg, application/dwg, application/x-dwg, application/x-autocad, drawing/dwg
+**.nes** | application/vnd.nintendo.snes.rom | -
+**.lnk** | application/x-ms-shortcut | -
+**.macho** | application/x-mach-binary | -
+**.qcp** | audio/qcelp | -
+**.icns** | image/x-icns | -
+**.heic** | image/heic | -
+**.heic** | image/heic-sequence | -
+**.heif** | image/heif | -
+**.heif** | image/heif-sequence | -
+**.hdr** | image/vnd.radiance | -
+**.mrc** | application/marc | -
+**.mdb** | application/x-msaccess | -
+**.accdb** | application/x-msaccess | -
+**.zst** | application/zstd | -
+**.cab** | application/vnd.ms-cab-compressed | -
+**.rpm** | application/x-rpm | -
+**.xz** | application/x-xz | -
+**.lz** | application/lzip | application/x-lzip
+**.torrent** | application/x-bittorrent | -
+**.cpio** | application/x-cpio | -
+**n/a** | application/tzif | -
+**.xcf** | image/x-xcf | -
+**.pat** | image/x-gimp-pat | -
+**.gbr** | image/x-gimp-gbr | -
+**.glb** | model/gltf-binary | -
+**.avif** | image/avif | -
+**.cab** | application/x-installshield | -
+**.jxr** | image/jxr | image/vnd.ms-photo
+**.txt** | text/plain | -
+**.html** | text/html | -
+**.svg** | image/svg+xml | -
+**.xml** | text/xml | -
+**.rss** | application/rss+xml | text/rss
+**.atom** | application/atom+xml | -
+**.x3d** | model/x3d+xml | -
+**.kml** | application/vnd.google-earth.kml+xml | -
+**.xlf** | application/x-xliff+xml | -
+**.dae** | model/vnd.collada+xml | -
+**.gml** | application/gml+xml | -
+**.gpx** | application/gpx+xml | -
+**.tcx** | application/vnd.garmin.tcx+xml | -
+**.amf** | application/x-amf | -
+**.3mf** | application/vnd.ms-package.3dmanufacturing-3dmodel+xml | -
+**.xfdf** | application/vnd.adobe.xfdf | -
+**.owl** | application/owl+xml | -
+**.php** | text/x-php | -
+**.js** | application/javascript | application/x-javascript, text/javascript
+**.lua** | text/x-lua | -
+**.pl** | text/x-perl | -
+**.py** | text/x-python | text/x-script.python, application/x-python
+**.json** | application/json | -
+**.geojson** | application/geo+json | -
+**.har** | application/json | -
+**.ndjson** | application/x-ndjson | -
+**.rtf** | text/rtf | -
+**.srt** | application/x-subrip | application/x-srt, text/x-srt
+**.tcl** | text/x-tcl | application/x-tcl
+**.csv** | text/csv | -
+**.tsv** | text/tab-separated-values | -
+**.vcf** | text/vcard | -
+**.ics** | text/calendar | -
+**.warc** | application/warc | -
+**.vtt** | text/vtt | -
diff --git a/vendor/github.com/gabriel-vasile/mimetype/tree.go b/vendor/github.com/gabriel-vasile/mimetype/tree.go
new file mode 100644
index 0000000000..253bd00649
--- /dev/null
+++ b/vendor/github.com/gabriel-vasile/mimetype/tree.go
@@ -0,0 +1,260 @@
+package mimetype
+
+import (
+ "sync"
+
+ "github.com/gabriel-vasile/mimetype/internal/magic"
+)
+
+// mimetype stores the list of MIME types in a tree structure with
+// "application/octet-stream" at the root of the hierarchy. The hierarchy
+// approach minimizes the number of checks that need to be done on the input
+// and allows for more precise results once the base type of file has been
+// identified.
+//
+// root is a detector which passes for any slice of bytes.
+// When a detector passes the check, the children detectors
+// are tried in order to find a more accurate MIME type.
+var root = newMIME("application/octet-stream", "",
+ func([]byte, uint32) bool { return true },
+ xpm, sevenZ, zip, pdf, fdf, ole, ps, psd, p7s, ogg, png, jpg, jxl, jp2, jpx,
+ jpm, jxs, gif, webp, exe, elf, ar, tar, xar, bz2, fits, tiff, bmp, ico, mp3, flac,
+ midi, ape, musePack, amr, wav, aiff, au, mpeg, quickTime, mqv, mp4, webM,
+ threeGP, threeG2, avi, flv, mkv, asf, aac, voc, aMp4, m4a, m3u, m4v, rmvb,
+ gzip, class, swf, crx, ttf, woff, woff2, otf, ttc, eot, wasm, shx, dbf, dcm, rar,
+ djvu, mobi, lit, bpg, sqlite3, dwg, nes, lnk, macho, qcp, icns, heic,
+ heicSeq, heif, heifSeq, hdr, mrc, mdb, accdb, zstd, cab, rpm, xz, lzip,
+ torrent, cpio, tzif, xcf, pat, gbr, glb, avif, cabIS, jxr,
+ // Keep text last because it is the slowest check
+ text,
+)
+
+// errMIME is returned from Detect functions when err is not nil.
+// Detect could return root for erroneous cases, but it needs to lock mu in order to do so.
+// errMIME is same as root but it does not require locking.
+var errMIME = newMIME("application/octet-stream", "", func([]byte, uint32) bool { return false })
+
+// mu guards access to the root MIME tree. Access to root must be synchronized with this lock.
+var mu = &sync.RWMutex{}
+
+// The list of nodes appended to the root node.
+var (
+ xz = newMIME("application/x-xz", ".xz", magic.Xz)
+ gzip = newMIME("application/gzip", ".gz", magic.Gzip).alias(
+ "application/x-gzip", "application/x-gunzip", "application/gzipped",
+ "application/gzip-compressed", "application/x-gzip-compressed",
+ "gzip/document")
+ sevenZ = newMIME("application/x-7z-compressed", ".7z", magic.SevenZ)
+ zip = newMIME("application/zip", ".zip", magic.Zip, xlsx, docx, pptx, epub, jar, odt, ods, odp, odg, odf, odc, sxc).
+ alias("application/x-zip", "application/x-zip-compressed")
+ tar = newMIME("application/x-tar", ".tar", magic.Tar)
+ xar = newMIME("application/x-xar", ".xar", magic.Xar)
+ bz2 = newMIME("application/x-bzip2", ".bz2", magic.Bz2)
+ pdf = newMIME("application/pdf", ".pdf", magic.Pdf).
+ alias("application/x-pdf")
+ fdf = newMIME("application/vnd.fdf", ".fdf", magic.Fdf)
+ xlsx = newMIME("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", ".xlsx", magic.Xlsx)
+ docx = newMIME("application/vnd.openxmlformats-officedocument.wordprocessingml.document", ".docx", magic.Docx)
+ pptx = newMIME("application/vnd.openxmlformats-officedocument.presentationml.presentation", ".pptx", magic.Pptx)
+ epub = newMIME("application/epub+zip", ".epub", magic.Epub)
+ jar = newMIME("application/jar", ".jar", magic.Jar)
+ ole = newMIME("application/x-ole-storage", "", magic.Ole, msi, aaf, msg, xls, pub, ppt, doc)
+ msi = newMIME("application/x-ms-installer", ".msi", magic.Msi).
+ alias("application/x-windows-installer", "application/x-msi")
+ aaf = newMIME("application/octet-stream", ".aaf", magic.Aaf)
+ doc = newMIME("application/msword", ".doc", magic.Doc).
+ alias("application/vnd.ms-word")
+ ppt = newMIME("application/vnd.ms-powerpoint", ".ppt", magic.Ppt).
+ alias("application/mspowerpoint")
+ pub = newMIME("application/vnd.ms-publisher", ".pub", magic.Pub)
+ xls = newMIME("application/vnd.ms-excel", ".xls", magic.Xls).
+ alias("application/msexcel")
+ msg = newMIME("application/vnd.ms-outlook", ".msg", magic.Msg)
+ ps = newMIME("application/postscript", ".ps", magic.Ps)
+ fits = newMIME("application/fits", ".fits", magic.Fits)
+ ogg = newMIME("application/ogg", ".ogg", magic.Ogg, oggAudio, oggVideo).
+ alias("application/x-ogg")
+ oggAudio = newMIME("audio/ogg", ".oga", magic.OggAudio)
+ oggVideo = newMIME("video/ogg", ".ogv", magic.OggVideo)
+ text = newMIME("text/plain", ".txt", magic.Text, html, svg, xml, php, js, lua, perl, python, json, ndJSON, rtf, srt, tcl, csv, tsv, vCard, iCalendar, warc, vtt)
+ xml = newMIME("text/xml", ".xml", magic.XML, rss, atom, x3d, kml, xliff, collada, gml, gpx, tcx, amf, threemf, xfdf, owl2)
+ json = newMIME("application/json", ".json", magic.JSON, geoJSON, har)
+ har = newMIME("application/json", ".har", magic.HAR)
+ csv = newMIME("text/csv", ".csv", magic.Csv)
+ tsv = newMIME("text/tab-separated-values", ".tsv", magic.Tsv)
+ geoJSON = newMIME("application/geo+json", ".geojson", magic.GeoJSON)
+ ndJSON = newMIME("application/x-ndjson", ".ndjson", magic.NdJSON)
+ html = newMIME("text/html", ".html", magic.HTML)
+ php = newMIME("text/x-php", ".php", magic.Php)
+ rtf = newMIME("text/rtf", ".rtf", magic.Rtf)
+ js = newMIME("application/javascript", ".js", magic.Js).
+ alias("application/x-javascript", "text/javascript")
+ srt = newMIME("application/x-subrip", ".srt", magic.Srt).
+ alias("application/x-srt", "text/x-srt")
+ vtt = newMIME("text/vtt", ".vtt", magic.Vtt)
+ lua = newMIME("text/x-lua", ".lua", magic.Lua)
+ perl = newMIME("text/x-perl", ".pl", magic.Perl)
+ python = newMIME("text/x-python", ".py", magic.Python).
+ alias("text/x-script.python", "application/x-python")
+ tcl = newMIME("text/x-tcl", ".tcl", magic.Tcl).
+ alias("application/x-tcl")
+ vCard = newMIME("text/vcard", ".vcf", magic.VCard)
+ iCalendar = newMIME("text/calendar", ".ics", magic.ICalendar)
+ svg = newMIME("image/svg+xml", ".svg", magic.Svg)
+ rss = newMIME("application/rss+xml", ".rss", magic.Rss).
+ alias("text/rss")
+ owl2 = newMIME("application/owl+xml", ".owl", magic.Owl2)
+ atom = newMIME("application/atom+xml", ".atom", magic.Atom)
+ x3d = newMIME("model/x3d+xml", ".x3d", magic.X3d)
+ kml = newMIME("application/vnd.google-earth.kml+xml", ".kml", magic.Kml)
+ xliff = newMIME("application/x-xliff+xml", ".xlf", magic.Xliff)
+ collada = newMIME("model/vnd.collada+xml", ".dae", magic.Collada)
+ gml = newMIME("application/gml+xml", ".gml", magic.Gml)
+ gpx = newMIME("application/gpx+xml", ".gpx", magic.Gpx)
+ tcx = newMIME("application/vnd.garmin.tcx+xml", ".tcx", magic.Tcx)
+ amf = newMIME("application/x-amf", ".amf", magic.Amf)
+ threemf = newMIME("application/vnd.ms-package.3dmanufacturing-3dmodel+xml", ".3mf", magic.Threemf)
+ png = newMIME("image/png", ".png", magic.Png, apng)
+ apng = newMIME("image/vnd.mozilla.apng", ".png", magic.Apng)
+ jpg = newMIME("image/jpeg", ".jpg", magic.Jpg)
+ jxl = newMIME("image/jxl", ".jxl", magic.Jxl)
+ jp2 = newMIME("image/jp2", ".jp2", magic.Jp2)
+ jpx = newMIME("image/jpx", ".jpf", magic.Jpx)
+ jpm = newMIME("image/jpm", ".jpm", magic.Jpm).
+ alias("video/jpm")
+ jxs = newMIME("image/jxs", ".jxs", magic.Jxs)
+ xpm = newMIME("image/x-xpixmap", ".xpm", magic.Xpm)
+ bpg = newMIME("image/bpg", ".bpg", magic.Bpg)
+ gif = newMIME("image/gif", ".gif", magic.Gif)
+ webp = newMIME("image/webp", ".webp", magic.Webp)
+ tiff = newMIME("image/tiff", ".tiff", magic.Tiff)
+ bmp = newMIME("image/bmp", ".bmp", magic.Bmp).
+ alias("image/x-bmp", "image/x-ms-bmp")
+ ico = newMIME("image/x-icon", ".ico", magic.Ico)
+ icns = newMIME("image/x-icns", ".icns", magic.Icns)
+ psd = newMIME("image/vnd.adobe.photoshop", ".psd", magic.Psd).
+ alias("image/x-psd", "application/photoshop")
+ heic = newMIME("image/heic", ".heic", magic.Heic)
+ heicSeq = newMIME("image/heic-sequence", ".heic", magic.HeicSequence)
+ heif = newMIME("image/heif", ".heif", magic.Heif)
+ heifSeq = newMIME("image/heif-sequence", ".heif", magic.HeifSequence)
+ hdr = newMIME("image/vnd.radiance", ".hdr", magic.Hdr)
+ avif = newMIME("image/avif", ".avif", magic.AVIF)
+ mp3 = newMIME("audio/mpeg", ".mp3", magic.Mp3).
+ alias("audio/x-mpeg", "audio/mp3")
+ flac = newMIME("audio/flac", ".flac", magic.Flac)
+ midi = newMIME("audio/midi", ".midi", magic.Midi).
+ alias("audio/mid", "audio/sp-midi", "audio/x-mid", "audio/x-midi")
+ ape = newMIME("audio/ape", ".ape", magic.Ape)
+ musePack = newMIME("audio/musepack", ".mpc", magic.MusePack)
+ wav = newMIME("audio/wav", ".wav", magic.Wav).
+ alias("audio/x-wav", "audio/vnd.wave", "audio/wave")
+ aiff = newMIME("audio/aiff", ".aiff", magic.Aiff).alias("audio/x-aiff")
+ au = newMIME("audio/basic", ".au", magic.Au)
+ amr = newMIME("audio/amr", ".amr", magic.Amr).
+ alias("audio/amr-nb")
+ aac = newMIME("audio/aac", ".aac", magic.AAC)
+ voc = newMIME("audio/x-unknown", ".voc", magic.Voc)
+ aMp4 = newMIME("audio/mp4", ".mp4", magic.AMp4).
+ alias("audio/x-m4a", "audio/x-mp4a")
+ m4a = newMIME("audio/x-m4a", ".m4a", magic.M4a)
+ m3u = newMIME("application/vnd.apple.mpegurl", ".m3u", magic.M3u).
+ alias("audio/mpegurl")
+ m4v = newMIME("video/x-m4v", ".m4v", magic.M4v)
+ mp4 = newMIME("video/mp4", ".mp4", magic.Mp4)
+ webM = newMIME("video/webm", ".webm", magic.WebM).
+ alias("audio/webm")
+ mpeg = newMIME("video/mpeg", ".mpeg", magic.Mpeg)
+ quickTime = newMIME("video/quicktime", ".mov", magic.QuickTime)
+ mqv = newMIME("video/quicktime", ".mqv", magic.Mqv)
+ threeGP = newMIME("video/3gpp", ".3gp", magic.ThreeGP).
+ alias("video/3gp", "audio/3gpp")
+ threeG2 = newMIME("video/3gpp2", ".3g2", magic.ThreeG2).
+ alias("video/3g2", "audio/3gpp2")
+ avi = newMIME("video/x-msvideo", ".avi", magic.Avi).
+ alias("video/avi", "video/msvideo")
+ flv = newMIME("video/x-flv", ".flv", magic.Flv)
+ mkv = newMIME("video/x-matroska", ".mkv", magic.Mkv)
+ asf = newMIME("video/x-ms-asf", ".asf", magic.Asf).
+ alias("video/asf", "video/x-ms-wmv")
+ rmvb = newMIME("application/vnd.rn-realmedia-vbr", ".rmvb", magic.Rmvb)
+ class = newMIME("application/x-java-applet", ".class", magic.Class)
+ swf = newMIME("application/x-shockwave-flash", ".swf", magic.SWF)
+ crx = newMIME("application/x-chrome-extension", ".crx", magic.CRX)
+ ttf = newMIME("font/ttf", ".ttf", magic.Ttf).
+ alias("font/sfnt", "application/x-font-ttf", "application/font-sfnt")
+ woff = newMIME("font/woff", ".woff", magic.Woff)
+ woff2 = newMIME("font/woff2", ".woff2", magic.Woff2)
+ otf = newMIME("font/otf", ".otf", magic.Otf)
+ ttc = newMIME("font/collection", ".ttc", magic.Ttc)
+ eot = newMIME("application/vnd.ms-fontobject", ".eot", magic.Eot)
+ wasm = newMIME("application/wasm", ".wasm", magic.Wasm)
+ shp = newMIME("application/vnd.shp", ".shp", magic.Shp)
+ shx = newMIME("application/vnd.shx", ".shx", magic.Shx, shp)
+ dbf = newMIME("application/x-dbf", ".dbf", magic.Dbf)
+ exe = newMIME("application/vnd.microsoft.portable-executable", ".exe", magic.Exe)
+ elf = newMIME("application/x-elf", "", magic.Elf, elfObj, elfExe, elfLib, elfDump)
+ elfObj = newMIME("application/x-object", "", magic.ElfObj)
+ elfExe = newMIME("application/x-executable", "", magic.ElfExe)
+ elfLib = newMIME("application/x-sharedlib", ".so", magic.ElfLib)
+ elfDump = newMIME("application/x-coredump", "", magic.ElfDump)
+ ar = newMIME("application/x-archive", ".a", magic.Ar, deb).
+ alias("application/x-unix-archive")
+ deb = newMIME("application/vnd.debian.binary-package", ".deb", magic.Deb)
+ rpm = newMIME("application/x-rpm", ".rpm", magic.RPM)
+ dcm = newMIME("application/dicom", ".dcm", magic.Dcm)
+ odt = newMIME("application/vnd.oasis.opendocument.text", ".odt", magic.Odt, ott).
+ alias("application/x-vnd.oasis.opendocument.text")
+ ott = newMIME("application/vnd.oasis.opendocument.text-template", ".ott", magic.Ott).
+ alias("application/x-vnd.oasis.opendocument.text-template")
+ ods = newMIME("application/vnd.oasis.opendocument.spreadsheet", ".ods", magic.Ods, ots).
+ alias("application/x-vnd.oasis.opendocument.spreadsheet")
+ ots = newMIME("application/vnd.oasis.opendocument.spreadsheet-template", ".ots", magic.Ots).
+ alias("application/x-vnd.oasis.opendocument.spreadsheet-template")
+ odp = newMIME("application/vnd.oasis.opendocument.presentation", ".odp", magic.Odp, otp).
+ alias("application/x-vnd.oasis.opendocument.presentation")
+ otp = newMIME("application/vnd.oasis.opendocument.presentation-template", ".otp", magic.Otp).
+ alias("application/x-vnd.oasis.opendocument.presentation-template")
+ odg = newMIME("application/vnd.oasis.opendocument.graphics", ".odg", magic.Odg, otg).
+ alias("application/x-vnd.oasis.opendocument.graphics")
+ otg = newMIME("application/vnd.oasis.opendocument.graphics-template", ".otg", magic.Otg).
+ alias("application/x-vnd.oasis.opendocument.graphics-template")
+ odf = newMIME("application/vnd.oasis.opendocument.formula", ".odf", magic.Odf).
+ alias("application/x-vnd.oasis.opendocument.formula")
+ odc = newMIME("application/vnd.oasis.opendocument.chart", ".odc", magic.Odc).
+ alias("application/x-vnd.oasis.opendocument.chart")
+ sxc = newMIME("application/vnd.sun.xml.calc", ".sxc", magic.Sxc)
+ rar = newMIME("application/x-rar-compressed", ".rar", magic.RAR).
+ alias("application/x-rar")
+ djvu = newMIME("image/vnd.djvu", ".djvu", magic.DjVu)
+ mobi = newMIME("application/x-mobipocket-ebook", ".mobi", magic.Mobi)
+ lit = newMIME("application/x-ms-reader", ".lit", magic.Lit)
+ sqlite3 = newMIME("application/vnd.sqlite3", ".sqlite", magic.Sqlite).
+ alias("application/x-sqlite3")
+ dwg = newMIME("image/vnd.dwg", ".dwg", magic.Dwg).
+ alias("image/x-dwg", "application/acad", "application/x-acad",
+ "application/autocad_dwg", "application/dwg", "application/x-dwg",
+ "application/x-autocad", "drawing/dwg")
+ warc = newMIME("application/warc", ".warc", magic.Warc)
+ nes = newMIME("application/vnd.nintendo.snes.rom", ".nes", magic.Nes)
+ lnk = newMIME("application/x-ms-shortcut", ".lnk", magic.Lnk)
+ macho = newMIME("application/x-mach-binary", ".macho", magic.MachO)
+ qcp = newMIME("audio/qcelp", ".qcp", magic.Qcp)
+ mrc = newMIME("application/marc", ".mrc", magic.Marc)
+ mdb = newMIME("application/x-msaccess", ".mdb", magic.MsAccessMdb)
+ accdb = newMIME("application/x-msaccess", ".accdb", magic.MsAccessAce)
+ zstd = newMIME("application/zstd", ".zst", magic.Zstd)
+ cab = newMIME("application/vnd.ms-cab-compressed", ".cab", magic.Cab)
+ cabIS = newMIME("application/x-installshield", ".cab", magic.InstallShieldCab)
+ lzip = newMIME("application/lzip", ".lz", magic.Lzip).alias("application/x-lzip")
+ torrent = newMIME("application/x-bittorrent", ".torrent", magic.Torrent)
+ cpio = newMIME("application/x-cpio", ".cpio", magic.Cpio)
+ tzif = newMIME("application/tzif", "", magic.TzIf)
+ p7s = newMIME("application/pkcs7-signature", ".p7s", magic.P7s)
+ xcf = newMIME("image/x-xcf", ".xcf", magic.Xcf)
+ pat = newMIME("image/x-gimp-pat", ".pat", magic.Pat)
+ gbr = newMIME("image/x-gimp-gbr", ".gbr", magic.Gbr)
+ xfdf = newMIME("application/vnd.adobe.xfdf", ".xfdf", magic.Xfdf)
+ glb = newMIME("model/gltf-binary", ".glb", magic.Glb)
+ jxr = newMIME("image/jxr", ".jxr", magic.Jxr).alias("image/vnd.ms-photo")
+)
diff --git a/vendor/github.com/go-asn1-ber/asn1-ber/.travis.yml b/vendor/github.com/go-asn1-ber/asn1-ber/.travis.yml
deleted file mode 100644
index 8bffb90170..0000000000
--- a/vendor/github.com/go-asn1-ber/asn1-ber/.travis.yml
+++ /dev/null
@@ -1,39 +0,0 @@
-language: go
-
-go:
- - 1.2.x
- - 1.6.x
- - 1.9.x
- - 1.10.x
- - 1.11.x
- - 1.12.x
- - 1.14.x
- - tip
-
-os:
- - linux
-
-arch:
- - amd64
-
-dist: xenial
-
-env:
- - GOARCH=amd64
-
-jobs:
- include:
- - os: windows
- go: 1.14.x
- - os: osx
- go: 1.14.x
- - os: linux
- go: 1.14.x
- arch: arm64
- - os: linux
- go: 1.14.x
- env:
- - GOARCH=386
-
-script:
- - go test -v -cover ./... || go test -v ./...
diff --git a/vendor/github.com/go-asn1-ber/asn1-ber/LICENSE b/vendor/github.com/go-asn1-ber/asn1-ber/LICENSE
deleted file mode 100644
index 23f9425345..0000000000
--- a/vendor/github.com/go-asn1-ber/asn1-ber/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2011-2015 Michael Mitton (mmitton@gmail.com)
-Portions copyright (c) 2015-2016 go-asn1-ber Authors
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/go-asn1-ber/asn1-ber/README.md b/vendor/github.com/go-asn1-ber/asn1-ber/README.md
deleted file mode 100644
index e3a9560d68..0000000000
--- a/vendor/github.com/go-asn1-ber/asn1-ber/README.md
+++ /dev/null
@@ -1,24 +0,0 @@
-[](https://godoc.org/gopkg.in/asn1-ber.v1) [](https://travis-ci.org/go-asn1-ber/asn1-ber)
-
-
-ASN1 BER Encoding / Decoding Library for the GO programming language.
----------------------------------------------------------------------
-
-Required libraries:
- None
-
-Working:
- Very basic encoding / decoding needed for LDAP protocol
-
-Tests Implemented:
- A few
-
-TODO:
- Fix all encoding / decoding to conform to ASN1 BER spec
- Implement Tests / Benchmarks
-
----
-
-The Go gopher was designed by Renee French. (http://reneefrench.blogspot.com/)
-The design is licensed under the Creative Commons 3.0 Attributions license.
-Read this article for more details: http://blog.golang.org/gopher
diff --git a/vendor/github.com/go-asn1-ber/asn1-ber/ber.go b/vendor/github.com/go-asn1-ber/asn1-ber/ber.go
deleted file mode 100644
index 4fd7a66e18..0000000000
--- a/vendor/github.com/go-asn1-ber/asn1-ber/ber.go
+++ /dev/null
@@ -1,620 +0,0 @@
-package ber
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
- "math"
- "os"
- "reflect"
- "time"
- "unicode/utf8"
-)
-
-// MaxPacketLengthBytes specifies the maximum allowed packet size when calling ReadPacket or DecodePacket. Set to 0 for
-// no limit.
-var MaxPacketLengthBytes int64 = math.MaxInt32
-
-type Packet struct {
- Identifier
- Value interface{}
- ByteValue []byte
- Data *bytes.Buffer
- Children []*Packet
- Description string
-}
-
-type Identifier struct {
- ClassType Class
- TagType Type
- Tag Tag
-}
-
-type Tag uint64
-
-const (
- TagEOC Tag = 0x00
- TagBoolean Tag = 0x01
- TagInteger Tag = 0x02
- TagBitString Tag = 0x03
- TagOctetString Tag = 0x04
- TagNULL Tag = 0x05
- TagObjectIdentifier Tag = 0x06
- TagObjectDescriptor Tag = 0x07
- TagExternal Tag = 0x08
- TagRealFloat Tag = 0x09
- TagEnumerated Tag = 0x0a
- TagEmbeddedPDV Tag = 0x0b
- TagUTF8String Tag = 0x0c
- TagRelativeOID Tag = 0x0d
- TagSequence Tag = 0x10
- TagSet Tag = 0x11
- TagNumericString Tag = 0x12
- TagPrintableString Tag = 0x13
- TagT61String Tag = 0x14
- TagVideotexString Tag = 0x15
- TagIA5String Tag = 0x16
- TagUTCTime Tag = 0x17
- TagGeneralizedTime Tag = 0x18
- TagGraphicString Tag = 0x19
- TagVisibleString Tag = 0x1a
- TagGeneralString Tag = 0x1b
- TagUniversalString Tag = 0x1c
- TagCharacterString Tag = 0x1d
- TagBMPString Tag = 0x1e
- TagBitmask Tag = 0x1f // xxx11111b
-
- // HighTag indicates the start of a high-tag byte sequence
- HighTag Tag = 0x1f // xxx11111b
- // HighTagContinueBitmask indicates the high-tag byte sequence should continue
- HighTagContinueBitmask Tag = 0x80 // 10000000b
- // HighTagValueBitmask obtains the tag value from a high-tag byte sequence byte
- HighTagValueBitmask Tag = 0x7f // 01111111b
-)
-
-const (
- // LengthLongFormBitmask is the mask to apply to the length byte to see if a long-form byte sequence is used
- LengthLongFormBitmask = 0x80
- // LengthValueBitmask is the mask to apply to the length byte to get the number of bytes in the long-form byte sequence
- LengthValueBitmask = 0x7f
-
- // LengthIndefinite is returned from readLength to indicate an indefinite length
- LengthIndefinite = -1
-)
-
-var tagMap = map[Tag]string{
- TagEOC: "EOC (End-of-Content)",
- TagBoolean: "Boolean",
- TagInteger: "Integer",
- TagBitString: "Bit String",
- TagOctetString: "Octet String",
- TagNULL: "NULL",
- TagObjectIdentifier: "Object Identifier",
- TagObjectDescriptor: "Object Descriptor",
- TagExternal: "External",
- TagRealFloat: "Real (float)",
- TagEnumerated: "Enumerated",
- TagEmbeddedPDV: "Embedded PDV",
- TagUTF8String: "UTF8 String",
- TagRelativeOID: "Relative-OID",
- TagSequence: "Sequence and Sequence of",
- TagSet: "Set and Set OF",
- TagNumericString: "Numeric String",
- TagPrintableString: "Printable String",
- TagT61String: "T61 String",
- TagVideotexString: "Videotex String",
- TagIA5String: "IA5 String",
- TagUTCTime: "UTC Time",
- TagGeneralizedTime: "Generalized Time",
- TagGraphicString: "Graphic String",
- TagVisibleString: "Visible String",
- TagGeneralString: "General String",
- TagUniversalString: "Universal String",
- TagCharacterString: "Character String",
- TagBMPString: "BMP String",
-}
-
-type Class uint8
-
-const (
- ClassUniversal Class = 0 // 00xxxxxxb
- ClassApplication Class = 64 // 01xxxxxxb
- ClassContext Class = 128 // 10xxxxxxb
- ClassPrivate Class = 192 // 11xxxxxxb
- ClassBitmask Class = 192 // 11xxxxxxb
-)
-
-var ClassMap = map[Class]string{
- ClassUniversal: "Universal",
- ClassApplication: "Application",
- ClassContext: "Context",
- ClassPrivate: "Private",
-}
-
-type Type uint8
-
-const (
- TypePrimitive Type = 0 // xx0xxxxxb
- TypeConstructed Type = 32 // xx1xxxxxb
- TypeBitmask Type = 32 // xx1xxxxxb
-)
-
-var TypeMap = map[Type]string{
- TypePrimitive: "Primitive",
- TypeConstructed: "Constructed",
-}
-
-var Debug = false
-
-func PrintBytes(out io.Writer, buf []byte, indent string) {
- dataLines := make([]string, (len(buf)/30)+1)
- numLines := make([]string, (len(buf)/30)+1)
-
- for i, b := range buf {
- dataLines[i/30] += fmt.Sprintf("%02x ", b)
- numLines[i/30] += fmt.Sprintf("%02d ", (i+1)%100)
- }
-
- for i := 0; i < len(dataLines); i++ {
- _, _ = out.Write([]byte(indent + dataLines[i] + "\n"))
- _, _ = out.Write([]byte(indent + numLines[i] + "\n\n"))
- }
-}
-
-func WritePacket(out io.Writer, p *Packet) {
- printPacket(out, p, 0, false)
-}
-
-func PrintPacket(p *Packet) {
- printPacket(os.Stdout, p, 0, false)
-}
-
-func printPacket(out io.Writer, p *Packet, indent int, printBytes bool) {
- indentStr := ""
-
- for len(indentStr) != indent {
- indentStr += " "
- }
-
- classStr := ClassMap[p.ClassType]
-
- tagTypeStr := TypeMap[p.TagType]
-
- tagStr := fmt.Sprintf("0x%02X", p.Tag)
-
- if p.ClassType == ClassUniversal {
- tagStr = tagMap[p.Tag]
- }
-
- value := fmt.Sprint(p.Value)
- description := ""
-
- if p.Description != "" {
- description = p.Description + ": "
- }
-
- _, _ = fmt.Fprintf(out, "%s%s(%s, %s, %s) Len=%d %q\n", indentStr, description, classStr, tagTypeStr, tagStr, p.Data.Len(), value)
-
- if printBytes {
- PrintBytes(out, p.Bytes(), indentStr)
- }
-
- for _, child := range p.Children {
- printPacket(out, child, indent+1, printBytes)
- }
-}
-
-// ReadPacket reads a single Packet from the reader.
-func ReadPacket(reader io.Reader) (*Packet, error) {
- p, _, err := readPacket(reader)
- if err != nil {
- return nil, err
- }
- return p, nil
-}
-
-func DecodeString(data []byte) string {
- return string(data)
-}
-
-func ParseInt64(bytes []byte) (ret int64, err error) {
- if len(bytes) > 8 {
- // We'll overflow an int64 in this case.
- err = fmt.Errorf("integer too large")
- return
- }
- for bytesRead := 0; bytesRead < len(bytes); bytesRead++ {
- ret <<= 8
- ret |= int64(bytes[bytesRead])
- }
-
- // Shift up and down in order to sign extend the result.
- ret <<= 64 - uint8(len(bytes))*8
- ret >>= 64 - uint8(len(bytes))*8
- return
-}
-
-func encodeInteger(i int64) []byte {
- n := int64Length(i)
- out := make([]byte, n)
-
- var j int
- for ; n > 0; n-- {
- out[j] = byte(i >> uint((n-1)*8))
- j++
- }
-
- return out
-}
-
-func int64Length(i int64) (numBytes int) {
- numBytes = 1
-
- for i > 127 {
- numBytes++
- i >>= 8
- }
-
- for i < -128 {
- numBytes++
- i >>= 8
- }
-
- return
-}
-
-// DecodePacket decodes the given bytes into a single Packet
-// If a decode error is encountered, nil is returned.
-func DecodePacket(data []byte) *Packet {
- p, _, _ := readPacket(bytes.NewBuffer(data))
-
- return p
-}
-
-// DecodePacketErr decodes the given bytes into a single Packet
-// If a decode error is encountered, nil is returned.
-func DecodePacketErr(data []byte) (*Packet, error) {
- p, _, err := readPacket(bytes.NewBuffer(data))
- if err != nil {
- return nil, err
- }
- return p, nil
-}
-
-// readPacket reads a single Packet from the reader, returning the number of bytes read.
-func readPacket(reader io.Reader) (*Packet, int, error) {
- identifier, length, read, err := readHeader(reader)
- if err != nil {
- return nil, read, err
- }
-
- p := &Packet{
- Identifier: identifier,
- }
-
- p.Data = new(bytes.Buffer)
- p.Children = make([]*Packet, 0, 2)
- p.Value = nil
-
- if p.TagType == TypeConstructed {
- // TODO: if universal, ensure tag type is allowed to be constructed
-
- // Track how much content we've read
- contentRead := 0
- for {
- if length != LengthIndefinite {
- // End if we've read what we've been told to
- if contentRead == length {
- break
- }
- // Detect if a packet boundary didn't fall on the expected length
- if contentRead > length {
- return nil, read, fmt.Errorf("expected to read %d bytes, read %d", length, contentRead)
- }
- }
-
- // Read the next packet
- child, r, err := readPacket(reader)
- if err != nil {
- return nil, read, err
- }
- contentRead += r
- read += r
-
- // Test is this is the EOC marker for our packet
- if isEOCPacket(child) {
- if length == LengthIndefinite {
- break
- }
- return nil, read, errors.New("eoc child not allowed with definite length")
- }
-
- // Append and continue
- p.AppendChild(child)
- }
- return p, read, nil
- }
-
- if length == LengthIndefinite {
- return nil, read, errors.New("indefinite length used with primitive type")
- }
-
- // Read definite-length content
- if MaxPacketLengthBytes > 0 && int64(length) > MaxPacketLengthBytes {
- return nil, read, fmt.Errorf("length %d greater than maximum %d", length, MaxPacketLengthBytes)
- }
- content := make([]byte, length)
- if length > 0 {
- _, err := io.ReadFull(reader, content)
- if err != nil {
- if err == io.EOF {
- return nil, read, io.ErrUnexpectedEOF
- }
- return nil, read, err
- }
- read += length
- }
-
- if p.ClassType == ClassUniversal {
- p.Data.Write(content)
- p.ByteValue = content
-
- switch p.Tag {
- case TagEOC:
- case TagBoolean:
- val, _ := ParseInt64(content)
-
- p.Value = val != 0
- case TagInteger:
- p.Value, _ = ParseInt64(content)
- case TagBitString:
- case TagOctetString:
- // the actual string encoding is not known here
- // (e.g. for LDAP content is already an UTF8-encoded
- // string). Return the data without further processing
- p.Value = DecodeString(content)
- case TagNULL:
- case TagObjectIdentifier:
- case TagObjectDescriptor:
- case TagExternal:
- case TagRealFloat:
- p.Value, err = ParseReal(content)
- case TagEnumerated:
- p.Value, _ = ParseInt64(content)
- case TagEmbeddedPDV:
- case TagUTF8String:
- val := DecodeString(content)
- if !utf8.Valid([]byte(val)) {
- err = errors.New("invalid UTF-8 string")
- } else {
- p.Value = val
- }
- case TagRelativeOID:
- case TagSequence:
- case TagSet:
- case TagNumericString:
- case TagPrintableString:
- val := DecodeString(content)
- if err = isPrintableString(val); err == nil {
- p.Value = val
- }
- case TagT61String:
- case TagVideotexString:
- case TagIA5String:
- val := DecodeString(content)
- for i, c := range val {
- if c >= 0x7F {
- err = fmt.Errorf("invalid character for IA5String at pos %d: %c", i, c)
- break
- }
- }
- if err == nil {
- p.Value = val
- }
- case TagUTCTime:
- case TagGeneralizedTime:
- p.Value, err = ParseGeneralizedTime(content)
- case TagGraphicString:
- case TagVisibleString:
- case TagGeneralString:
- case TagUniversalString:
- case TagCharacterString:
- case TagBMPString:
- }
- } else {
- p.Data.Write(content)
- }
-
- return p, read, err
-}
-
-func isPrintableString(val string) error {
- for i, c := range val {
- switch {
- case c >= 'a' && c <= 'z':
- case c >= 'A' && c <= 'Z':
- case c >= '0' && c <= '9':
- default:
- switch c {
- case '\'', '(', ')', '+', ',', '-', '.', '=', '/', ':', '?', ' ':
- default:
- return fmt.Errorf("invalid character in position %d", i)
- }
- }
- }
- return nil
-}
-
-func (p *Packet) Bytes() []byte {
- var out bytes.Buffer
-
- out.Write(encodeIdentifier(p.Identifier))
- out.Write(encodeLength(p.Data.Len()))
- out.Write(p.Data.Bytes())
-
- return out.Bytes()
-}
-
-func (p *Packet) AppendChild(child *Packet) {
- p.Data.Write(child.Bytes())
- p.Children = append(p.Children, child)
-}
-
-func Encode(classType Class, tagType Type, tag Tag, value interface{}, description string) *Packet {
- p := new(Packet)
-
- p.ClassType = classType
- p.TagType = tagType
- p.Tag = tag
- p.Data = new(bytes.Buffer)
-
- p.Children = make([]*Packet, 0, 2)
-
- p.Value = value
- p.Description = description
-
- if value != nil {
- v := reflect.ValueOf(value)
-
- if classType == ClassUniversal {
- switch tag {
- case TagOctetString:
- sv, ok := v.Interface().(string)
-
- if ok {
- p.Data.Write([]byte(sv))
- }
- case TagEnumerated:
- bv, ok := v.Interface().([]byte)
- if ok {
- p.Data.Write(bv)
- }
- case TagEmbeddedPDV:
- bv, ok := v.Interface().([]byte)
- if ok {
- p.Data.Write(bv)
- }
- }
- } else if classType == ClassContext {
- switch tag {
- case TagEnumerated:
- bv, ok := v.Interface().([]byte)
- if ok {
- p.Data.Write(bv)
- }
- case TagEmbeddedPDV:
- bv, ok := v.Interface().([]byte)
- if ok {
- p.Data.Write(bv)
- }
- }
- }
- }
- return p
-}
-
-func NewSequence(description string) *Packet {
- return Encode(ClassUniversal, TypeConstructed, TagSequence, nil, description)
-}
-
-func NewBoolean(classType Class, tagType Type, tag Tag, value bool, description string) *Packet {
- intValue := int64(0)
-
- if value {
- intValue = 1
- }
-
- p := Encode(classType, tagType, tag, nil, description)
-
- p.Value = value
- p.Data.Write(encodeInteger(intValue))
-
- return p
-}
-
-// NewLDAPBoolean returns a RFC 4511-compliant Boolean packet.
-func NewLDAPBoolean(classType Class, tagType Type, tag Tag, value bool, description string) *Packet {
- intValue := int64(0)
-
- if value {
- intValue = 255
- }
-
- p := Encode(classType, tagType, tag, nil, description)
-
- p.Value = value
- p.Data.Write(encodeInteger(intValue))
-
- return p
-}
-
-func NewInteger(classType Class, tagType Type, tag Tag, value interface{}, description string) *Packet {
- p := Encode(classType, tagType, tag, nil, description)
-
- p.Value = value
- switch v := value.(type) {
- case int:
- p.Data.Write(encodeInteger(int64(v)))
- case uint:
- p.Data.Write(encodeInteger(int64(v)))
- case int64:
- p.Data.Write(encodeInteger(v))
- case uint64:
- // TODO : check range or add encodeUInt...
- p.Data.Write(encodeInteger(int64(v)))
- case int32:
- p.Data.Write(encodeInteger(int64(v)))
- case uint32:
- p.Data.Write(encodeInteger(int64(v)))
- case int16:
- p.Data.Write(encodeInteger(int64(v)))
- case uint16:
- p.Data.Write(encodeInteger(int64(v)))
- case int8:
- p.Data.Write(encodeInteger(int64(v)))
- case uint8:
- p.Data.Write(encodeInteger(int64(v)))
- default:
- // TODO : add support for big.Int ?
- panic(fmt.Sprintf("Invalid type %T, expected {u|}int{64|32|16|8}", v))
- }
-
- return p
-}
-
-func NewString(classType Class, tagType Type, tag Tag, value, description string) *Packet {
- p := Encode(classType, tagType, tag, nil, description)
-
- p.Value = value
- p.Data.Write([]byte(value))
-
- return p
-}
-
-func NewGeneralizedTime(classType Class, tagType Type, tag Tag, value time.Time, description string) *Packet {
- p := Encode(classType, tagType, tag, nil, description)
- var s string
- if value.Nanosecond() != 0 {
- s = value.Format(`20060102150405.000000000Z`)
- } else {
- s = value.Format(`20060102150405Z`)
- }
- p.Value = s
- p.Data.Write([]byte(s))
- return p
-}
-
-func NewReal(classType Class, tagType Type, tag Tag, value interface{}, description string) *Packet {
- p := Encode(classType, tagType, tag, nil, description)
-
- switch v := value.(type) {
- case float64:
- p.Data.Write(encodeFloat(v))
- case float32:
- p.Data.Write(encodeFloat(float64(v)))
- default:
- panic(fmt.Sprintf("Invalid type %T, expected float{64|32}", v))
- }
- return p
-}
diff --git a/vendor/github.com/go-asn1-ber/asn1-ber/content_int.go b/vendor/github.com/go-asn1-ber/asn1-ber/content_int.go
deleted file mode 100644
index 20b500f553..0000000000
--- a/vendor/github.com/go-asn1-ber/asn1-ber/content_int.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package ber
-
-func encodeUnsignedInteger(i uint64) []byte {
- n := uint64Length(i)
- out := make([]byte, n)
-
- var j int
- for ; n > 0; n-- {
- out[j] = byte(i >> uint((n-1)*8))
- j++
- }
-
- return out
-}
-
-func uint64Length(i uint64) (numBytes int) {
- numBytes = 1
-
- for i > 255 {
- numBytes++
- i >>= 8
- }
-
- return
-}
diff --git a/vendor/github.com/go-asn1-ber/asn1-ber/generalizedTime.go b/vendor/github.com/go-asn1-ber/asn1-ber/generalizedTime.go
deleted file mode 100644
index 51215f0619..0000000000
--- a/vendor/github.com/go-asn1-ber/asn1-ber/generalizedTime.go
+++ /dev/null
@@ -1,105 +0,0 @@
-package ber
-
-import (
- "bytes"
- "errors"
- "fmt"
- "strconv"
- "time"
-)
-
-// ErrInvalidTimeFormat is returned when the generalizedTime string was not correct.
-var ErrInvalidTimeFormat = errors.New("invalid time format")
-
-var zeroTime = time.Time{}
-
-// ParseGeneralizedTime parses a string value and if it conforms to
-// GeneralizedTime[^0] format, will return a time.Time for that value.
-//
-// [^0]: https://www.itu.int/rec/T-REC-X.690-201508-I/en Section 11.7
-func ParseGeneralizedTime(v []byte) (time.Time, error) {
- var format string
- var fract time.Duration
-
- str := []byte(DecodeString(v))
- tzIndex := bytes.IndexAny(str, "Z+-")
- if tzIndex < 0 {
- return zeroTime, ErrInvalidTimeFormat
- }
-
- dot := bytes.IndexAny(str, ".,")
- switch dot {
- case -1:
- switch tzIndex {
- case 10:
- format = `2006010215Z`
- case 12:
- format = `200601021504Z`
- case 14:
- format = `20060102150405Z`
- default:
- return zeroTime, ErrInvalidTimeFormat
- }
-
- case 10, 12:
- if tzIndex < dot {
- return zeroTime, ErrInvalidTimeFormat
- }
- // a "," is also allowed, but would not be parsed by time.Parse():
- str[dot] = '.'
-
- // If is omitted, then represents a fraction of an
- // hour; otherwise, if and are omitted, then
- // represents a fraction of a minute; otherwise,
- // represents a fraction of a second.
-
- // parse as float from dot to timezone
- f, err := strconv.ParseFloat(string(str[dot:tzIndex]), 64)
- if err != nil {
- return zeroTime, fmt.Errorf("failed to parse float: %s", err)
- }
- // ...and strip that part
- str = append(str[:dot], str[tzIndex:]...)
- tzIndex = dot
-
- if dot == 10 {
- fract = time.Duration(int64(f * float64(time.Hour)))
- format = `2006010215Z`
- } else {
- fract = time.Duration(int64(f * float64(time.Minute)))
- format = `200601021504Z`
- }
-
- case 14:
- if tzIndex < dot {
- return zeroTime, ErrInvalidTimeFormat
- }
- str[dot] = '.'
- // no need for fractional seconds, time.Parse() handles that
- format = `20060102150405Z`
-
- default:
- return zeroTime, ErrInvalidTimeFormat
- }
-
- l := len(str)
- switch l - tzIndex {
- case 1:
- if str[l-1] != 'Z' {
- return zeroTime, ErrInvalidTimeFormat
- }
- case 3:
- format += `0700`
- str = append(str, []byte("00")...)
- case 5:
- format += `0700`
- default:
- return zeroTime, ErrInvalidTimeFormat
- }
-
- t, err := time.Parse(format, string(str))
- if err != nil {
- return zeroTime, fmt.Errorf("%s: %s", ErrInvalidTimeFormat, err)
- }
- return t.Add(fract), nil
-}
diff --git a/vendor/github.com/go-asn1-ber/asn1-ber/header.go b/vendor/github.com/go-asn1-ber/asn1-ber/header.go
deleted file mode 100644
index 7dfa6b9a7d..0000000000
--- a/vendor/github.com/go-asn1-ber/asn1-ber/header.go
+++ /dev/null
@@ -1,38 +0,0 @@
-package ber
-
-import (
- "errors"
- "fmt"
- "io"
-)
-
-func readHeader(reader io.Reader) (identifier Identifier, length int, read int, err error) {
- var (
- c, l int
- i Identifier
- )
-
- if i, c, err = readIdentifier(reader); err != nil {
- return Identifier{}, 0, read, err
- }
- identifier = i
- read += c
-
- if l, c, err = readLength(reader); err != nil {
- return Identifier{}, 0, read, err
- }
- length = l
- read += c
-
- // Validate length type with identifier (x.600, 8.1.3.2.a)
- if length == LengthIndefinite && identifier.TagType == TypePrimitive {
- return Identifier{}, 0, read, errors.New("indefinite length used with primitive type")
- }
-
- if length < LengthIndefinite {
- err = fmt.Errorf("length cannot be less than %d", LengthIndefinite)
- return
- }
-
- return identifier, length, read, nil
-}
diff --git a/vendor/github.com/go-asn1-ber/asn1-ber/identifier.go b/vendor/github.com/go-asn1-ber/asn1-ber/identifier.go
deleted file mode 100644
index e8c435749a..0000000000
--- a/vendor/github.com/go-asn1-ber/asn1-ber/identifier.go
+++ /dev/null
@@ -1,112 +0,0 @@
-package ber
-
-import (
- "errors"
- "fmt"
- "io"
-)
-
-func readIdentifier(reader io.Reader) (Identifier, int, error) {
- identifier := Identifier{}
- read := 0
-
- // identifier byte
- b, err := readByte(reader)
- if err != nil {
- if Debug {
- fmt.Printf("error reading identifier byte: %v\n", err)
- }
- return Identifier{}, read, err
- }
- read++
-
- identifier.ClassType = Class(b) & ClassBitmask
- identifier.TagType = Type(b) & TypeBitmask
-
- if tag := Tag(b) & TagBitmask; tag != HighTag {
- // short-form tag
- identifier.Tag = tag
- return identifier, read, nil
- }
-
- // high-tag-number tag
- tagBytes := 0
- for {
- b, err := readByte(reader)
- if err != nil {
- if Debug {
- fmt.Printf("error reading high-tag-number tag byte %d: %v\n", tagBytes, err)
- }
- return Identifier{}, read, err
- }
- tagBytes++
- read++
-
- // Lowest 7 bits get appended to the tag value (x.690, 8.1.2.4.2.b)
- identifier.Tag <<= 7
- identifier.Tag |= Tag(b) & HighTagValueBitmask
-
- // First byte may not be all zeros (x.690, 8.1.2.4.2.c)
- if tagBytes == 1 && identifier.Tag == 0 {
- return Identifier{}, read, errors.New("invalid first high-tag-number tag byte")
- }
- // Overflow of int64
- // TODO: support big int tags?
- if tagBytes > 9 {
- return Identifier{}, read, errors.New("high-tag-number tag overflow")
- }
-
- // Top bit of 0 means this is the last byte in the high-tag-number tag (x.690, 8.1.2.4.2.a)
- if Tag(b)&HighTagContinueBitmask == 0 {
- break
- }
- }
-
- return identifier, read, nil
-}
-
-func encodeIdentifier(identifier Identifier) []byte {
- b := []byte{0x0}
- b[0] |= byte(identifier.ClassType)
- b[0] |= byte(identifier.TagType)
-
- if identifier.Tag < HighTag {
- // Short-form
- b[0] |= byte(identifier.Tag)
- } else {
- // high-tag-number
- b[0] |= byte(HighTag)
-
- tag := identifier.Tag
-
- b = append(b, encodeHighTag(tag)...)
- }
- return b
-}
-
-func encodeHighTag(tag Tag) []byte {
- // set cap=4 to hopefully avoid additional allocations
- b := make([]byte, 0, 4)
- for tag != 0 {
- // t := last 7 bits of tag (HighTagValueBitmask = 0x7F)
- t := tag & HighTagValueBitmask
-
- // right shift tag 7 to remove what was just pulled off
- tag >>= 7
-
- // if b already has entries this entry needs a continuation bit (0x80)
- if len(b) != 0 {
- t |= HighTagContinueBitmask
- }
-
- b = append(b, byte(t))
- }
- // reverse
- // since bits were pulled off 'tag' small to high the byte slice is in reverse order.
- // example: tag = 0xFF results in {0x7F, 0x01 + 0x80 (continuation bit)}
- // this needs to be reversed into 0x81 0x7F
- for i, j := 0, len(b)-1; i < len(b)/2; i++ {
- b[i], b[j-i] = b[j-i], b[i]
- }
- return b
-}
diff --git a/vendor/github.com/go-asn1-ber/asn1-ber/length.go b/vendor/github.com/go-asn1-ber/asn1-ber/length.go
deleted file mode 100644
index 9cc195d0bd..0000000000
--- a/vendor/github.com/go-asn1-ber/asn1-ber/length.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package ber
-
-import (
- "errors"
- "fmt"
- "io"
-)
-
-func readLength(reader io.Reader) (length int, read int, err error) {
- // length byte
- b, err := readByte(reader)
- if err != nil {
- if Debug {
- fmt.Printf("error reading length byte: %v\n", err)
- }
- return 0, 0, err
- }
- read++
-
- switch {
- case b == 0xFF:
- // Invalid 0xFF (x.600, 8.1.3.5.c)
- return 0, read, errors.New("invalid length byte 0xff")
-
- case b == LengthLongFormBitmask:
- // Indefinite form, we have to decode packets until we encounter an EOC packet (x.600, 8.1.3.6)
- length = LengthIndefinite
-
- case b&LengthLongFormBitmask == 0:
- // Short definite form, extract the length from the bottom 7 bits (x.600, 8.1.3.4)
- length = int(b) & LengthValueBitmask
-
- case b&LengthLongFormBitmask != 0:
- // Long definite form, extract the number of length bytes to follow from the bottom 7 bits (x.600, 8.1.3.5.b)
- lengthBytes := int(b) & LengthValueBitmask
- // Protect against overflow
- // TODO: support big int length?
- if lengthBytes > 8 {
- return 0, read, errors.New("long-form length overflow")
- }
-
- // Accumulate into a 64-bit variable
- var length64 int64
- for i := 0; i < lengthBytes; i++ {
- b, err = readByte(reader)
- if err != nil {
- if Debug {
- fmt.Printf("error reading long-form length byte %d: %v\n", i, err)
- }
- return 0, read, err
- }
- read++
-
- // x.600, 8.1.3.5
- length64 <<= 8
- length64 |= int64(b)
- }
-
- // Cast to a platform-specific integer
- length = int(length64)
- // Ensure we didn't overflow
- if int64(length) != length64 {
- return 0, read, errors.New("long-form length overflow")
- }
-
- default:
- return 0, read, errors.New("invalid length byte")
- }
-
- return length, read, nil
-}
-
-func encodeLength(length int) []byte {
- lengthBytes := encodeUnsignedInteger(uint64(length))
- if length > 127 || len(lengthBytes) > 1 {
- longFormBytes := []byte{LengthLongFormBitmask | byte(len(lengthBytes))}
- longFormBytes = append(longFormBytes, lengthBytes...)
- lengthBytes = longFormBytes
- }
- return lengthBytes
-}
diff --git a/vendor/github.com/go-asn1-ber/asn1-ber/real.go b/vendor/github.com/go-asn1-ber/asn1-ber/real.go
deleted file mode 100644
index 610a003a73..0000000000
--- a/vendor/github.com/go-asn1-ber/asn1-ber/real.go
+++ /dev/null
@@ -1,157 +0,0 @@
-package ber
-
-import (
- "bytes"
- "errors"
- "fmt"
- "math"
- "strconv"
- "strings"
-)
-
-func encodeFloat(v float64) []byte {
- switch {
- case math.IsInf(v, 1):
- return []byte{0x40}
- case math.IsInf(v, -1):
- return []byte{0x41}
- case math.IsNaN(v):
- return []byte{0x42}
- case v == 0.0:
- if math.Signbit(v) {
- return []byte{0x43}
- }
- return []byte{}
- default:
- // we take the easy part ;-)
- value := []byte(strconv.FormatFloat(v, 'G', -1, 64))
- var ret []byte
- if bytes.Contains(value, []byte{'E'}) {
- ret = []byte{0x03}
- } else {
- ret = []byte{0x02}
- }
- ret = append(ret, value...)
- return ret
- }
-}
-
-func ParseReal(v []byte) (val float64, err error) {
- if len(v) == 0 {
- return 0.0, nil
- }
- switch {
- case v[0]&0x80 == 0x80:
- val, err = parseBinaryFloat(v)
- case v[0]&0xC0 == 0x40:
- val, err = parseSpecialFloat(v)
- case v[0]&0xC0 == 0x0:
- val, err = parseDecimalFloat(v)
- default:
- return 0.0, fmt.Errorf("invalid info block")
- }
- if err != nil {
- return 0.0, err
- }
-
- if val == 0.0 && !math.Signbit(val) {
- return 0.0, errors.New("REAL value +0 must be encoded with zero-length value block")
- }
- return val, nil
-}
-
-func parseBinaryFloat(v []byte) (float64, error) {
- var info byte
- var buf []byte
-
- info, v = v[0], v[1:]
-
- var base int
- switch info & 0x30 {
- case 0x00:
- base = 2
- case 0x10:
- base = 8
- case 0x20:
- base = 16
- case 0x30:
- return 0.0, errors.New("bits 6 and 5 of information octet for REAL are equal to 11")
- }
-
- scale := uint((info & 0x0c) >> 2)
-
- var expLen int
- switch info & 0x03 {
- case 0x00:
- expLen = 1
- case 0x01:
- expLen = 2
- case 0x02:
- expLen = 3
- case 0x03:
- expLen = int(v[0])
- if expLen > 8 {
- return 0.0, errors.New("too big value of exponent")
- }
- v = v[1:]
- }
- buf, v = v[:expLen], v[expLen:]
- exponent, err := ParseInt64(buf)
- if err != nil {
- return 0.0, err
- }
-
- if len(v) > 8 {
- return 0.0, errors.New("too big value of mantissa")
- }
-
- mant, err := ParseInt64(v)
- if err != nil {
- return 0.0, err
- }
- mantissa := mant << scale
-
- if info&0x40 == 0x40 {
- mantissa = -mantissa
- }
-
- return float64(mantissa) * math.Pow(float64(base), float64(exponent)), nil
-}
-
-func parseDecimalFloat(v []byte) (val float64, err error) {
- switch v[0] & 0x3F {
- case 0x01: // NR form 1
- var iVal int64
- iVal, err = strconv.ParseInt(strings.TrimLeft(string(v[1:]), " "), 10, 64)
- val = float64(iVal)
- case 0x02, 0x03: // NR form 2, 3
- val, err = strconv.ParseFloat(strings.Replace(strings.TrimLeft(string(v[1:]), " "), ",", ".", -1), 64)
- default:
- err = errors.New("incorrect NR form")
- }
- if err != nil {
- return 0.0, err
- }
-
- if val == 0.0 && math.Signbit(val) {
- return 0.0, errors.New("REAL value -0 must be encoded as a special value")
- }
- return val, nil
-}
-
-func parseSpecialFloat(v []byte) (float64, error) {
- if len(v) != 1 {
- return 0.0, errors.New(`encoding of "special value" must not contain exponent and mantissa`)
- }
- switch v[0] {
- case 0x40:
- return math.Inf(1), nil
- case 0x41:
- return math.Inf(-1), nil
- case 0x42:
- return math.NaN(), nil
- case 0x43:
- return math.Copysign(0, -1), nil
- }
- return 0.0, errors.New(`encoding of "special value" not from ASN.1 standard`)
-}
diff --git a/vendor/github.com/go-asn1-ber/asn1-ber/util.go b/vendor/github.com/go-asn1-ber/asn1-ber/util.go
deleted file mode 100644
index 14dc87d7c9..0000000000
--- a/vendor/github.com/go-asn1-ber/asn1-ber/util.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package ber
-
-import "io"
-
-func readByte(reader io.Reader) (byte, error) {
- bytes := make([]byte, 1)
- _, err := io.ReadFull(reader, bytes)
- if err != nil {
- if err == io.EOF {
- return 0, io.ErrUnexpectedEOF
- }
- return 0, err
- }
- return bytes[0], nil
-}
-
-func isEOCPacket(p *Packet) bool {
- return p != nil &&
- p.Tag == TagEOC &&
- p.ClassType == ClassUniversal &&
- p.TagType == TypePrimitive &&
- len(p.ByteValue) == 0 &&
- len(p.Children) == 0
-}
diff --git a/vendor/github.com/go-ldap/ldap/v3/LICENSE b/vendor/github.com/go-ldap/ldap/v3/LICENSE
deleted file mode 100644
index 6c0ed4b387..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2011-2015 Michael Mitton (mmitton@gmail.com)
-Portions copyright (c) 2015-2016 go-ldap Authors
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/go-ldap/ldap/v3/add.go b/vendor/github.com/go-ldap/ldap/v3/add.go
deleted file mode 100644
index baecd787d2..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/add.go
+++ /dev/null
@@ -1,91 +0,0 @@
-package ldap
-
-import (
- "log"
-
- ber "github.com/go-asn1-ber/asn1-ber"
-)
-
-// Attribute represents an LDAP attribute
-type Attribute struct {
- // Type is the name of the LDAP attribute
- Type string
- // Vals are the LDAP attribute values
- Vals []string
-}
-
-func (a *Attribute) encode() *ber.Packet {
- seq := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Attribute")
- seq.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, a.Type, "Type"))
- set := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSet, nil, "AttributeValue")
- for _, value := range a.Vals {
- set.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, value, "Vals"))
- }
- seq.AppendChild(set)
- return seq
-}
-
-// AddRequest represents an LDAP AddRequest operation
-type AddRequest struct {
- // DN identifies the entry being added
- DN string
- // Attributes list the attributes of the new entry
- Attributes []Attribute
- // Controls hold optional controls to send with the request
- Controls []Control
-}
-
-func (req *AddRequest) appendTo(envelope *ber.Packet) error {
- pkt := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationAddRequest, nil, "Add Request")
- pkt.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, req.DN, "DN"))
- attributes := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Attributes")
- for _, attribute := range req.Attributes {
- attributes.AppendChild(attribute.encode())
- }
- pkt.AppendChild(attributes)
-
- envelope.AppendChild(pkt)
- if len(req.Controls) > 0 {
- envelope.AppendChild(encodeControls(req.Controls))
- }
-
- return nil
-}
-
-// Attribute adds an attribute with the given type and values
-func (req *AddRequest) Attribute(attrType string, attrVals []string) {
- req.Attributes = append(req.Attributes, Attribute{Type: attrType, Vals: attrVals})
-}
-
-// NewAddRequest returns an AddRequest for the given DN, with no attributes
-func NewAddRequest(dn string, controls []Control) *AddRequest {
- return &AddRequest{
- DN: dn,
- Controls: controls,
- }
-
-}
-
-// Add performs the given AddRequest
-func (l *Conn) Add(addRequest *AddRequest) error {
- msgCtx, err := l.doRequest(addRequest)
- if err != nil {
- return err
- }
- defer l.finishMessage(msgCtx)
-
- packet, err := l.readPacket(msgCtx)
- if err != nil {
- return err
- }
-
- if packet.Children[1].Tag == ApplicationAddResponse {
- err := GetLDAPError(packet)
- if err != nil {
- return err
- }
- } else {
- log.Printf("Unexpected Response: %d", packet.Children[1].Tag)
- }
- return nil
-}
diff --git a/vendor/github.com/go-ldap/ldap/v3/bind.go b/vendor/github.com/go-ldap/ldap/v3/bind.go
deleted file mode 100644
index 9bc5748283..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/bind.go
+++ /dev/null
@@ -1,540 +0,0 @@
-package ldap
-
-import (
- "bytes"
- "crypto/md5"
- enchex "encoding/hex"
- "errors"
- "fmt"
- "io/ioutil"
- "math/rand"
- "strings"
-
- "github.com/Azure/go-ntlmssp"
- ber "github.com/go-asn1-ber/asn1-ber"
-)
-
-// SimpleBindRequest represents a username/password bind operation
-type SimpleBindRequest struct {
- // Username is the name of the Directory object that the client wishes to bind as
- Username string
- // Password is the credentials to bind with
- Password string
- // Controls are optional controls to send with the bind request
- Controls []Control
- // AllowEmptyPassword sets whether the client allows binding with an empty password
- // (normally used for unauthenticated bind).
- AllowEmptyPassword bool
-}
-
-// SimpleBindResult contains the response from the server
-type SimpleBindResult struct {
- Controls []Control
-}
-
-// NewSimpleBindRequest returns a bind request
-func NewSimpleBindRequest(username string, password string, controls []Control) *SimpleBindRequest {
- return &SimpleBindRequest{
- Username: username,
- Password: password,
- Controls: controls,
- AllowEmptyPassword: false,
- }
-}
-
-func (req *SimpleBindRequest) appendTo(envelope *ber.Packet) error {
- pkt := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationBindRequest, nil, "Bind Request")
- pkt.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, 3, "Version"))
- pkt.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, req.Username, "User Name"))
- pkt.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 0, req.Password, "Password"))
-
- envelope.AppendChild(pkt)
- if len(req.Controls) > 0 {
- envelope.AppendChild(encodeControls(req.Controls))
- }
-
- return nil
-}
-
-// SimpleBind performs the simple bind operation defined in the given request
-func (l *Conn) SimpleBind(simpleBindRequest *SimpleBindRequest) (*SimpleBindResult, error) {
- if simpleBindRequest.Password == "" && !simpleBindRequest.AllowEmptyPassword {
- return nil, NewError(ErrorEmptyPassword, errors.New("ldap: empty password not allowed by the client"))
- }
-
- msgCtx, err := l.doRequest(simpleBindRequest)
- if err != nil {
- return nil, err
- }
- defer l.finishMessage(msgCtx)
-
- packet, err := l.readPacket(msgCtx)
- if err != nil {
- return nil, err
- }
-
- result := &SimpleBindResult{
- Controls: make([]Control, 0),
- }
-
- if len(packet.Children) == 3 {
- for _, child := range packet.Children[2].Children {
- decodedChild, decodeErr := DecodeControl(child)
- if decodeErr != nil {
- return nil, fmt.Errorf("failed to decode child control: %s", decodeErr)
- }
- result.Controls = append(result.Controls, decodedChild)
- }
- }
-
- err = GetLDAPError(packet)
- return result, err
-}
-
-// Bind performs a bind with the given username and password.
-//
-// It does not allow unauthenticated bind (i.e. empty password). Use the UnauthenticatedBind method
-// for that.
-func (l *Conn) Bind(username, password string) error {
- req := &SimpleBindRequest{
- Username: username,
- Password: password,
- AllowEmptyPassword: false,
- }
- _, err := l.SimpleBind(req)
- return err
-}
-
-// UnauthenticatedBind performs an unauthenticated bind.
-//
-// A username may be provided for trace (e.g. logging) purpose only, but it is normally not
-// authenticated or otherwise validated by the LDAP server.
-//
-// See https://tools.ietf.org/html/rfc4513#section-5.1.2 .
-// See https://tools.ietf.org/html/rfc4513#section-6.3.1 .
-func (l *Conn) UnauthenticatedBind(username string) error {
- req := &SimpleBindRequest{
- Username: username,
- Password: "",
- AllowEmptyPassword: true,
- }
- _, err := l.SimpleBind(req)
- return err
-}
-
-// DigestMD5BindRequest represents a digest-md5 bind operation
-type DigestMD5BindRequest struct {
- Host string
- // Username is the name of the Directory object that the client wishes to bind as
- Username string
- // Password is the credentials to bind with
- Password string
- // Controls are optional controls to send with the bind request
- Controls []Control
-}
-
-func (req *DigestMD5BindRequest) appendTo(envelope *ber.Packet) error {
- request := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationBindRequest, nil, "Bind Request")
- request.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, 3, "Version"))
- request.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, "", "User Name"))
-
- auth := ber.Encode(ber.ClassContext, ber.TypeConstructed, 3, "", "authentication")
- auth.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, "DIGEST-MD5", "SASL Mech"))
- request.AppendChild(auth)
- envelope.AppendChild(request)
- if len(req.Controls) > 0 {
- envelope.AppendChild(encodeControls(req.Controls))
- }
- return nil
-}
-
-// DigestMD5BindResult contains the response from the server
-type DigestMD5BindResult struct {
- Controls []Control
-}
-
-// MD5Bind performs a digest-md5 bind with the given host, username and password.
-func (l *Conn) MD5Bind(host, username, password string) error {
- req := &DigestMD5BindRequest{
- Host: host,
- Username: username,
- Password: password,
- }
- _, err := l.DigestMD5Bind(req)
- return err
-}
-
-// DigestMD5Bind performs the digest-md5 bind operation defined in the given request
-func (l *Conn) DigestMD5Bind(digestMD5BindRequest *DigestMD5BindRequest) (*DigestMD5BindResult, error) {
- if digestMD5BindRequest.Password == "" {
- return nil, NewError(ErrorEmptyPassword, errors.New("ldap: empty password not allowed by the client"))
- }
-
- msgCtx, err := l.doRequest(digestMD5BindRequest)
- if err != nil {
- return nil, err
- }
- defer l.finishMessage(msgCtx)
-
- packet, err := l.readPacket(msgCtx)
- if err != nil {
- return nil, err
- }
- l.Debug.Printf("%d: got response %p", msgCtx.id, packet)
- if l.Debug {
- if err = addLDAPDescriptions(packet); err != nil {
- return nil, err
- }
- ber.PrintPacket(packet)
- }
-
- result := &DigestMD5BindResult{
- Controls: make([]Control, 0),
- }
- var params map[string]string
- if len(packet.Children) == 2 {
- if len(packet.Children[1].Children) == 4 {
- child := packet.Children[1].Children[0]
- if child.Tag != ber.TagEnumerated {
- return result, GetLDAPError(packet)
- }
- if child.Value.(int64) != 14 {
- return result, GetLDAPError(packet)
- }
- child = packet.Children[1].Children[3]
- if child.Tag != ber.TagObjectDescriptor {
- return result, GetLDAPError(packet)
- }
- if child.Data == nil {
- return result, GetLDAPError(packet)
- }
- data, _ := ioutil.ReadAll(child.Data)
- params, err = parseParams(string(data))
- if err != nil {
- return result, fmt.Errorf("parsing digest-challenge: %s", err)
- }
- }
- }
-
- if params != nil {
- resp := computeResponse(
- params,
- "ldap/"+strings.ToLower(digestMD5BindRequest.Host),
- digestMD5BindRequest.Username,
- digestMD5BindRequest.Password,
- )
- packet = ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "LDAP Request")
- packet.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, l.nextMessageID(), "MessageID"))
-
- request := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationBindRequest, nil, "Bind Request")
- request.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, 3, "Version"))
- request.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, "", "User Name"))
-
- auth := ber.Encode(ber.ClassContext, ber.TypeConstructed, 3, "", "authentication")
- auth.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, "DIGEST-MD5", "SASL Mech"))
- auth.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, resp, "Credentials"))
- request.AppendChild(auth)
- packet.AppendChild(request)
- msgCtx, err = l.sendMessage(packet)
- if err != nil {
- return nil, fmt.Errorf("send message: %s", err)
- }
- defer l.finishMessage(msgCtx)
- packetResponse, ok := <-msgCtx.responses
- if !ok {
- return nil, NewError(ErrorNetwork, errors.New("ldap: response channel closed"))
- }
- packet, err = packetResponse.ReadPacket()
- l.Debug.Printf("%d: got response %p", msgCtx.id, packet)
- if err != nil {
- return nil, fmt.Errorf("read packet: %s", err)
- }
- }
-
- err = GetLDAPError(packet)
- return result, err
-}
-
-func parseParams(str string) (map[string]string, error) {
- m := make(map[string]string)
- var key, value string
- var state int
- for i := 0; i <= len(str); i++ {
- switch state {
- case 0: //reading key
- if i == len(str) {
- return nil, fmt.Errorf("syntax error on %d", i)
- }
- if str[i] != '=' {
- key += string(str[i])
- continue
- }
- state = 1
- case 1: //reading value
- if i == len(str) {
- m[key] = value
- break
- }
- switch str[i] {
- case ',':
- m[key] = value
- state = 0
- key = ""
- value = ""
- case '"':
- if value != "" {
- return nil, fmt.Errorf("syntax error on %d", i)
- }
- state = 2
- default:
- value += string(str[i])
- }
- case 2: //inside quotes
- if i == len(str) {
- return nil, fmt.Errorf("syntax error on %d", i)
- }
- if str[i] != '"' {
- value += string(str[i])
- } else {
- state = 1
- }
- }
- }
- return m, nil
-}
-
-func computeResponse(params map[string]string, uri, username, password string) string {
- nc := "00000001"
- qop := "auth"
- cnonce := enchex.EncodeToString(randomBytes(16))
- x := username + ":" + params["realm"] + ":" + password
- y := md5Hash([]byte(x))
-
- a1 := bytes.NewBuffer(y)
- a1.WriteString(":" + params["nonce"] + ":" + cnonce)
- if len(params["authzid"]) > 0 {
- a1.WriteString(":" + params["authzid"])
- }
- a2 := bytes.NewBuffer([]byte("AUTHENTICATE"))
- a2.WriteString(":" + uri)
- ha1 := enchex.EncodeToString(md5Hash(a1.Bytes()))
- ha2 := enchex.EncodeToString(md5Hash(a2.Bytes()))
-
- kd := ha1
- kd += ":" + params["nonce"]
- kd += ":" + nc
- kd += ":" + cnonce
- kd += ":" + qop
- kd += ":" + ha2
- resp := enchex.EncodeToString(md5Hash([]byte(kd)))
- return fmt.Sprintf(
- `username="%s",realm="%s",nonce="%s",cnonce="%s",nc=00000001,qop=%s,digest-uri="%s",response=%s`,
- username,
- params["realm"],
- params["nonce"],
- cnonce,
- qop,
- uri,
- resp,
- )
-}
-
-func md5Hash(b []byte) []byte {
- hasher := md5.New()
- hasher.Write(b)
- return hasher.Sum(nil)
-}
-
-func randomBytes(len int) []byte {
- b := make([]byte, len)
- for i := 0; i < len; i++ {
- b[i] = byte(rand.Intn(256))
- }
- return b
-}
-
-var externalBindRequest = requestFunc(func(envelope *ber.Packet) error {
- pkt := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationBindRequest, nil, "Bind Request")
- pkt.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, 3, "Version"))
- pkt.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, "", "User Name"))
-
- saslAuth := ber.Encode(ber.ClassContext, ber.TypeConstructed, 3, "", "authentication")
- saslAuth.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, "EXTERNAL", "SASL Mech"))
- saslAuth.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, "", "SASL Cred"))
-
- pkt.AppendChild(saslAuth)
-
- envelope.AppendChild(pkt)
-
- return nil
-})
-
-// ExternalBind performs SASL/EXTERNAL authentication.
-//
-// Use ldap.DialURL("ldapi://") to connect to the Unix socket before ExternalBind.
-//
-// See https://tools.ietf.org/html/rfc4422#appendix-A
-func (l *Conn) ExternalBind() error {
- msgCtx, err := l.doRequest(externalBindRequest)
- if err != nil {
- return err
- }
- defer l.finishMessage(msgCtx)
-
- packet, err := l.readPacket(msgCtx)
- if err != nil {
- return err
- }
-
- return GetLDAPError(packet)
-}
-
-// NTLMBind performs an NTLMSSP bind leveraging https://github.com/Azure/go-ntlmssp
-
-// NTLMBindRequest represents an NTLMSSP bind operation
-type NTLMBindRequest struct {
- // Domain is the AD Domain to authenticate too. If not specified, it will be grabbed from the NTLMSSP Challenge
- Domain string
- // Username is the name of the Directory object that the client wishes to bind as
- Username string
- // Password is the credentials to bind with
- Password string
- // Hash is the hex NTLM hash to bind with. Password or hash must be provided
- Hash string
- // Controls are optional controls to send with the bind request
- Controls []Control
-}
-
-func (req *NTLMBindRequest) appendTo(envelope *ber.Packet) error {
- request := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationBindRequest, nil, "Bind Request")
- request.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, 3, "Version"))
- request.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, "", "User Name"))
-
- // generate an NTLMSSP Negotiation message for the specified domain (it can be blank)
- negMessage, err := ntlmssp.NewNegotiateMessage(req.Domain, "")
- if err != nil {
- return fmt.Errorf("err creating negmessage: %s", err)
- }
-
- // append the generated NTLMSSP message as a TagEnumerated BER value
- auth := ber.Encode(ber.ClassContext, ber.TypePrimitive, ber.TagEnumerated, negMessage, "authentication")
- request.AppendChild(auth)
- envelope.AppendChild(request)
- if len(req.Controls) > 0 {
- envelope.AppendChild(encodeControls(req.Controls))
- }
- return nil
-}
-
-// NTLMBindResult contains the response from the server
-type NTLMBindResult struct {
- Controls []Control
-}
-
-// NTLMBind performs an NTLMSSP Bind with the given domain, username and password
-func (l *Conn) NTLMBind(domain, username, password string) error {
- req := &NTLMBindRequest{
- Domain: domain,
- Username: username,
- Password: password,
- }
- _, err := l.NTLMChallengeBind(req)
- return err
-}
-
-// NTLMBindWithHash performs an NTLM Bind with an NTLM hash instead of plaintext password (pass-the-hash)
-func (l *Conn) NTLMBindWithHash(domain, username, hash string) error {
- req := &NTLMBindRequest{
- Domain: domain,
- Username: username,
- Hash: hash,
- }
- _, err := l.NTLMChallengeBind(req)
- return err
-}
-
-// NTLMChallengeBind performs the NTLMSSP bind operation defined in the given request
-func (l *Conn) NTLMChallengeBind(ntlmBindRequest *NTLMBindRequest) (*NTLMBindResult, error) {
- if ntlmBindRequest.Password == "" && ntlmBindRequest.Hash == "" {
- return nil, NewError(ErrorEmptyPassword, errors.New("ldap: empty password not allowed by the client"))
- }
-
- msgCtx, err := l.doRequest(ntlmBindRequest)
- if err != nil {
- return nil, err
- }
- defer l.finishMessage(msgCtx)
- packet, err := l.readPacket(msgCtx)
- if err != nil {
- return nil, err
- }
- l.Debug.Printf("%d: got response %p", msgCtx.id, packet)
- if l.Debug {
- if err = addLDAPDescriptions(packet); err != nil {
- return nil, err
- }
- ber.PrintPacket(packet)
- }
- result := &NTLMBindResult{
- Controls: make([]Control, 0),
- }
- var ntlmsspChallenge []byte
-
- // now find the NTLM Response Message
- if len(packet.Children) == 2 {
- if len(packet.Children[1].Children) == 3 {
- child := packet.Children[1].Children[1]
- ntlmsspChallenge = child.ByteValue
- // Check to make sure we got the right message. It will always start with NTLMSSP
- if len(ntlmsspChallenge) < 7 || !bytes.Equal(ntlmsspChallenge[:7], []byte("NTLMSSP")) {
- return result, GetLDAPError(packet)
- }
- l.Debug.Printf("%d: found ntlmssp challenge", msgCtx.id)
- }
- }
- if ntlmsspChallenge != nil {
- var err error
- var responseMessage []byte
- // generate a response message to the challenge with the given Username/Password if password is provided
- if ntlmBindRequest.Password != "" {
- responseMessage, err = ntlmssp.ProcessChallenge(ntlmsspChallenge, ntlmBindRequest.Username, ntlmBindRequest.Password)
- } else if ntlmBindRequest.Hash != "" {
- responseMessage, err = ntlmssp.ProcessChallengeWithHash(ntlmsspChallenge, ntlmBindRequest.Username, ntlmBindRequest.Hash)
- } else {
- err = fmt.Errorf("need a password or hash to generate reply")
- }
- if err != nil {
- return result, fmt.Errorf("parsing ntlm-challenge: %s", err)
- }
- packet = ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "LDAP Request")
- packet.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, l.nextMessageID(), "MessageID"))
-
- request := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationBindRequest, nil, "Bind Request")
- request.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, 3, "Version"))
- request.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, "", "User Name"))
-
- // append the challenge response message as a TagEmbeddedPDV BER value
- auth := ber.Encode(ber.ClassContext, ber.TypePrimitive, ber.TagEmbeddedPDV, responseMessage, "authentication")
-
- request.AppendChild(auth)
- packet.AppendChild(request)
- msgCtx, err = l.sendMessage(packet)
- if err != nil {
- return nil, fmt.Errorf("send message: %s", err)
- }
- defer l.finishMessage(msgCtx)
- packetResponse, ok := <-msgCtx.responses
- if !ok {
- return nil, NewError(ErrorNetwork, errors.New("ldap: response channel closed"))
- }
- packet, err = packetResponse.ReadPacket()
- l.Debug.Printf("%d: got response %p", msgCtx.id, packet)
- if err != nil {
- return nil, fmt.Errorf("read packet: %s", err)
- }
-
- }
-
- err = GetLDAPError(packet)
- return result, err
-}
diff --git a/vendor/github.com/go-ldap/ldap/v3/client.go b/vendor/github.com/go-ldap/ldap/v3/client.go
deleted file mode 100644
index 1fa4ad5aa6..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/client.go
+++ /dev/null
@@ -1,32 +0,0 @@
-package ldap
-
-import (
- "crypto/tls"
- "time"
-)
-
-// Client knows how to interact with an LDAP server
-type Client interface {
- Start()
- StartTLS(*tls.Config) error
- Close()
- IsClosing() bool
- SetTimeout(time.Duration)
-
- Bind(username, password string) error
- UnauthenticatedBind(username string) error
- SimpleBind(*SimpleBindRequest) (*SimpleBindResult, error)
- ExternalBind() error
-
- Add(*AddRequest) error
- Del(*DelRequest) error
- Modify(*ModifyRequest) error
- ModifyDN(*ModifyDNRequest) error
- ModifyWithResult(*ModifyRequest) (*ModifyResult, error)
-
- Compare(dn, attribute, value string) (bool, error)
- PasswordModify(*PasswordModifyRequest) (*PasswordModifyResult, error)
-
- Search(*SearchRequest) (*SearchResult, error)
- SearchWithPaging(searchRequest *SearchRequest, pagingSize uint32) (*SearchResult, error)
-}
diff --git a/vendor/github.com/go-ldap/ldap/v3/compare.go b/vendor/github.com/go-ldap/ldap/v3/compare.go
deleted file mode 100644
index cd43e4c53d..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/compare.go
+++ /dev/null
@@ -1,61 +0,0 @@
-package ldap
-
-import (
- "fmt"
-
- ber "github.com/go-asn1-ber/asn1-ber"
-)
-
-// CompareRequest represents an LDAP CompareRequest operation.
-type CompareRequest struct {
- DN string
- Attribute string
- Value string
-}
-
-func (req *CompareRequest) appendTo(envelope *ber.Packet) error {
- pkt := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationCompareRequest, nil, "Compare Request")
- pkt.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, req.DN, "DN"))
-
- ava := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "AttributeValueAssertion")
- ava.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, req.Attribute, "AttributeDesc"))
- ava.AppendChild(ber.Encode(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, req.Value, "AssertionValue"))
-
- pkt.AppendChild(ava)
-
- envelope.AppendChild(pkt)
-
- return nil
-}
-
-// Compare checks to see if the attribute of the dn matches value. Returns true if it does otherwise
-// false with any error that occurs if any.
-func (l *Conn) Compare(dn, attribute, value string) (bool, error) {
- msgCtx, err := l.doRequest(&CompareRequest{
- DN: dn,
- Attribute: attribute,
- Value: value})
- if err != nil {
- return false, err
- }
- defer l.finishMessage(msgCtx)
-
- packet, err := l.readPacket(msgCtx)
- if err != nil {
- return false, err
- }
-
- if packet.Children[1].Tag == ApplicationCompareResponse {
- err := GetLDAPError(packet)
-
- switch {
- case IsErrorWithCode(err, LDAPResultCompareTrue):
- return true, nil
- case IsErrorWithCode(err, LDAPResultCompareFalse):
- return false, nil
- default:
- return false, err
- }
- }
- return false, fmt.Errorf("unexpected Response: %d", packet.Children[1].Tag)
-}
diff --git a/vendor/github.com/go-ldap/ldap/v3/conn.go b/vendor/github.com/go-ldap/ldap/v3/conn.go
deleted file mode 100644
index ae5e19af88..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/conn.go
+++ /dev/null
@@ -1,581 +0,0 @@
-package ldap
-
-import (
- "bufio"
- "crypto/tls"
- "errors"
- "fmt"
- "log"
- "net"
- "net/url"
- "sync"
- "sync/atomic"
- "time"
-
- ber "github.com/go-asn1-ber/asn1-ber"
-)
-
-const (
- // MessageQuit causes the processMessages loop to exit
- MessageQuit = 0
- // MessageRequest sends a request to the server
- MessageRequest = 1
- // MessageResponse receives a response from the server
- MessageResponse = 2
- // MessageFinish indicates the client considers a particular message ID to be finished
- MessageFinish = 3
- // MessageTimeout indicates the client-specified timeout for a particular message ID has been reached
- MessageTimeout = 4
-)
-
-const (
- // DefaultLdapPort default ldap port for pure TCP connection
- DefaultLdapPort = "389"
- // DefaultLdapsPort default ldap port for SSL connection
- DefaultLdapsPort = "636"
-)
-
-// PacketResponse contains the packet or error encountered reading a response
-type PacketResponse struct {
- // Packet is the packet read from the server
- Packet *ber.Packet
- // Error is an error encountered while reading
- Error error
-}
-
-// ReadPacket returns the packet or an error
-func (pr *PacketResponse) ReadPacket() (*ber.Packet, error) {
- if (pr == nil) || (pr.Packet == nil && pr.Error == nil) {
- return nil, NewError(ErrorNetwork, errors.New("ldap: could not retrieve response"))
- }
- return pr.Packet, pr.Error
-}
-
-type messageContext struct {
- id int64
- // close(done) should only be called from finishMessage()
- done chan struct{}
- // close(responses) should only be called from processMessages(), and only sent to from sendResponse()
- responses chan *PacketResponse
-}
-
-// sendResponse should only be called within the processMessages() loop which
-// is also responsible for closing the responses channel.
-func (msgCtx *messageContext) sendResponse(packet *PacketResponse) {
- select {
- case msgCtx.responses <- packet:
- // Successfully sent packet to message handler.
- case <-msgCtx.done:
- // The request handler is done and will not receive more
- // packets.
- }
-}
-
-type messagePacket struct {
- Op int
- MessageID int64
- Packet *ber.Packet
- Context *messageContext
-}
-
-type sendMessageFlags uint
-
-const (
- startTLS sendMessageFlags = 1 << iota
-)
-
-// Conn represents an LDAP Connection
-type Conn struct {
- // requestTimeout is loaded atomically
- // so we need to ensure 64-bit alignment on 32-bit platforms.
- requestTimeout int64
- conn net.Conn
- isTLS bool
- closing uint32
- closeErr atomic.Value
- isStartingTLS bool
- Debug debugging
- chanConfirm chan struct{}
- messageContexts map[int64]*messageContext
- chanMessage chan *messagePacket
- chanMessageID chan int64
- wgClose sync.WaitGroup
- outstandingRequests uint
- messageMutex sync.Mutex
-}
-
-var _ Client = &Conn{}
-
-// DefaultTimeout is a package-level variable that sets the timeout value
-// used for the Dial and DialTLS methods.
-//
-// WARNING: since this is a package-level variable, setting this value from
-// multiple places will probably result in undesired behaviour.
-var DefaultTimeout = 60 * time.Second
-
-// DialOpt configures DialContext.
-type DialOpt func(*DialContext)
-
-// DialWithDialer updates net.Dialer in DialContext.
-func DialWithDialer(d *net.Dialer) DialOpt {
- return func(dc *DialContext) {
- dc.d = d
- }
-}
-
-// DialWithTLSConfig updates tls.Config in DialContext.
-func DialWithTLSConfig(tc *tls.Config) DialOpt {
- return func(dc *DialContext) {
- dc.tc = tc
- }
-}
-
-// DialWithTLSDialer is a wrapper for DialWithTLSConfig with the option to
-// specify a net.Dialer to for example define a timeout or a custom resolver.
-func DialWithTLSDialer(tlsConfig *tls.Config, dialer *net.Dialer) DialOpt {
- return func(dc *DialContext) {
- dc.tc = tlsConfig
- dc.d = dialer
- }
-}
-
-// DialContext contains necessary parameters to dial the given ldap URL.
-type DialContext struct {
- d *net.Dialer
- tc *tls.Config
-}
-
-func (dc *DialContext) dial(u *url.URL) (net.Conn, error) {
- if u.Scheme == "ldapi" {
- if u.Path == "" || u.Path == "/" {
- u.Path = "/var/run/slapd/ldapi"
- }
- return dc.d.Dial("unix", u.Path)
- }
-
- host, port, err := net.SplitHostPort(u.Host)
- if err != nil {
- // we assume that error is due to missing port
- host = u.Host
- port = ""
- }
-
- switch u.Scheme {
- case "ldap":
- if port == "" {
- port = DefaultLdapPort
- }
- return dc.d.Dial("tcp", net.JoinHostPort(host, port))
- case "ldaps":
- if port == "" {
- port = DefaultLdapsPort
- }
- return tls.DialWithDialer(dc.d, "tcp", net.JoinHostPort(host, port), dc.tc)
- }
-
- return nil, fmt.Errorf("Unknown scheme '%s'", u.Scheme)
-}
-
-// Dial connects to the given address on the given network using net.Dial
-// and then returns a new Conn for the connection.
-// @deprecated Use DialURL instead.
-func Dial(network, addr string) (*Conn, error) {
- c, err := net.DialTimeout(network, addr, DefaultTimeout)
- if err != nil {
- return nil, NewError(ErrorNetwork, err)
- }
- conn := NewConn(c, false)
- conn.Start()
- return conn, nil
-}
-
-// DialTLS connects to the given address on the given network using tls.Dial
-// and then returns a new Conn for the connection.
-// @deprecated Use DialURL instead.
-func DialTLS(network, addr string, config *tls.Config) (*Conn, error) {
- c, err := tls.DialWithDialer(&net.Dialer{Timeout: DefaultTimeout}, network, addr, config)
- if err != nil {
- return nil, NewError(ErrorNetwork, err)
- }
- conn := NewConn(c, true)
- conn.Start()
- return conn, nil
-}
-
-// DialURL connects to the given ldap URL.
-// The following schemas are supported: ldap://, ldaps://, ldapi://.
-// On success a new Conn for the connection is returned.
-func DialURL(addr string, opts ...DialOpt) (*Conn, error) {
- u, err := url.Parse(addr)
- if err != nil {
- return nil, NewError(ErrorNetwork, err)
- }
-
- var dc DialContext
- for _, opt := range opts {
- opt(&dc)
- }
- if dc.d == nil {
- dc.d = &net.Dialer{Timeout: DefaultTimeout}
- }
-
- c, err := dc.dial(u)
- if err != nil {
- return nil, NewError(ErrorNetwork, err)
- }
-
- conn := NewConn(c, u.Scheme == "ldaps")
- conn.Start()
- return conn, nil
-}
-
-// NewConn returns a new Conn using conn for network I/O.
-func NewConn(conn net.Conn, isTLS bool) *Conn {
- return &Conn{
- conn: conn,
- chanConfirm: make(chan struct{}),
- chanMessageID: make(chan int64),
- chanMessage: make(chan *messagePacket, 10),
- messageContexts: map[int64]*messageContext{},
- requestTimeout: 0,
- isTLS: isTLS,
- }
-}
-
-// Start initializes goroutines to read responses and process messages
-func (l *Conn) Start() {
- l.wgClose.Add(1)
- go l.reader()
- go l.processMessages()
-}
-
-// IsClosing returns whether or not we're currently closing.
-func (l *Conn) IsClosing() bool {
- return atomic.LoadUint32(&l.closing) == 1
-}
-
-// setClosing sets the closing value to true
-func (l *Conn) setClosing() bool {
- return atomic.CompareAndSwapUint32(&l.closing, 0, 1)
-}
-
-// Close closes the connection.
-func (l *Conn) Close() {
- l.messageMutex.Lock()
- defer l.messageMutex.Unlock()
-
- if l.setClosing() {
- l.Debug.Printf("Sending quit message and waiting for confirmation")
- l.chanMessage <- &messagePacket{Op: MessageQuit}
- <-l.chanConfirm
- close(l.chanMessage)
-
- l.Debug.Printf("Closing network connection")
- if err := l.conn.Close(); err != nil {
- log.Println(err)
- }
-
- l.wgClose.Done()
- }
- l.wgClose.Wait()
-}
-
-// SetTimeout sets the time after a request is sent that a MessageTimeout triggers
-func (l *Conn) SetTimeout(timeout time.Duration) {
- if timeout > 0 {
- atomic.StoreInt64(&l.requestTimeout, int64(timeout))
- }
-}
-
-// Returns the next available messageID
-func (l *Conn) nextMessageID() int64 {
- if messageID, ok := <-l.chanMessageID; ok {
- return messageID
- }
- return 0
-}
-
-// StartTLS sends the command to start a TLS session and then creates a new TLS Client
-func (l *Conn) StartTLS(config *tls.Config) error {
- if l.isTLS {
- return NewError(ErrorNetwork, errors.New("ldap: already encrypted"))
- }
-
- packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "LDAP Request")
- packet.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, l.nextMessageID(), "MessageID"))
- request := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationExtendedRequest, nil, "Start TLS")
- request.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 0, "1.3.6.1.4.1.1466.20037", "TLS Extended Command"))
- packet.AppendChild(request)
- l.Debug.PrintPacket(packet)
-
- msgCtx, err := l.sendMessageWithFlags(packet, startTLS)
- if err != nil {
- return err
- }
- defer l.finishMessage(msgCtx)
-
- l.Debug.Printf("%d: waiting for response", msgCtx.id)
-
- packetResponse, ok := <-msgCtx.responses
- if !ok {
- return NewError(ErrorNetwork, errors.New("ldap: response channel closed"))
- }
- packet, err = packetResponse.ReadPacket()
- l.Debug.Printf("%d: got response %p", msgCtx.id, packet)
- if err != nil {
- return err
- }
-
- if l.Debug {
- if err := addLDAPDescriptions(packet); err != nil {
- l.Close()
- return err
- }
- l.Debug.PrintPacket(packet)
- }
-
- if err := GetLDAPError(packet); err == nil {
- conn := tls.Client(l.conn, config)
-
- if connErr := conn.Handshake(); connErr != nil {
- l.Close()
- return NewError(ErrorNetwork, fmt.Errorf("TLS handshake failed (%v)", connErr))
- }
-
- l.isTLS = true
- l.conn = conn
- } else {
- return err
- }
- go l.reader()
-
- return nil
-}
-
-// TLSConnectionState returns the client's TLS connection state.
-// The return values are their zero values if StartTLS did
-// not succeed.
-func (l *Conn) TLSConnectionState() (state tls.ConnectionState, ok bool) {
- tc, ok := l.conn.(*tls.Conn)
- if !ok {
- return
- }
- return tc.ConnectionState(), true
-}
-
-func (l *Conn) sendMessage(packet *ber.Packet) (*messageContext, error) {
- return l.sendMessageWithFlags(packet, 0)
-}
-
-func (l *Conn) sendMessageWithFlags(packet *ber.Packet, flags sendMessageFlags) (*messageContext, error) {
- if l.IsClosing() {
- return nil, NewError(ErrorNetwork, errors.New("ldap: connection closed"))
- }
- l.messageMutex.Lock()
- l.Debug.Printf("flags&startTLS = %d", flags&startTLS)
- if l.isStartingTLS {
- l.messageMutex.Unlock()
- return nil, NewError(ErrorNetwork, errors.New("ldap: connection is in startls phase"))
- }
- if flags&startTLS != 0 {
- if l.outstandingRequests != 0 {
- l.messageMutex.Unlock()
- return nil, NewError(ErrorNetwork, errors.New("ldap: cannot StartTLS with outstanding requests"))
- }
- l.isStartingTLS = true
- }
- l.outstandingRequests++
-
- l.messageMutex.Unlock()
-
- responses := make(chan *PacketResponse)
- messageID := packet.Children[0].Value.(int64)
- message := &messagePacket{
- Op: MessageRequest,
- MessageID: messageID,
- Packet: packet,
- Context: &messageContext{
- id: messageID,
- done: make(chan struct{}),
- responses: responses,
- },
- }
- if !l.sendProcessMessage(message) {
- if l.IsClosing() {
- return nil, NewError(ErrorNetwork, errors.New("ldap: connection closed"))
- }
- return nil, NewError(ErrorNetwork, errors.New("ldap: could not send message for unknown reason"))
- }
- return message.Context, nil
-}
-
-func (l *Conn) finishMessage(msgCtx *messageContext) {
- close(msgCtx.done)
-
- if l.IsClosing() {
- return
- }
-
- l.messageMutex.Lock()
- l.outstandingRequests--
- if l.isStartingTLS {
- l.isStartingTLS = false
- }
- l.messageMutex.Unlock()
-
- message := &messagePacket{
- Op: MessageFinish,
- MessageID: msgCtx.id,
- }
- l.sendProcessMessage(message)
-}
-
-func (l *Conn) sendProcessMessage(message *messagePacket) bool {
- l.messageMutex.Lock()
- defer l.messageMutex.Unlock()
- if l.IsClosing() {
- return false
- }
- l.chanMessage <- message
- return true
-}
-
-func (l *Conn) processMessages() {
- defer func() {
- if err := recover(); err != nil {
- log.Printf("ldap: recovered panic in processMessages: %v", err)
- }
- for messageID, msgCtx := range l.messageContexts {
- // If we are closing due to an error, inform anyone who
- // is waiting about the error.
- if l.IsClosing() && l.closeErr.Load() != nil {
- msgCtx.sendResponse(&PacketResponse{Error: l.closeErr.Load().(error)})
- }
- l.Debug.Printf("Closing channel for MessageID %d", messageID)
- close(msgCtx.responses)
- delete(l.messageContexts, messageID)
- }
- close(l.chanMessageID)
- close(l.chanConfirm)
- }()
-
- var messageID int64 = 1
- for {
- select {
- case l.chanMessageID <- messageID:
- messageID++
- case message := <-l.chanMessage:
- switch message.Op {
- case MessageQuit:
- l.Debug.Printf("Shutting down - quit message received")
- return
- case MessageRequest:
- // Add to message list and write to network
- l.Debug.Printf("Sending message %d", message.MessageID)
-
- buf := message.Packet.Bytes()
- _, err := l.conn.Write(buf)
- if err != nil {
- l.Debug.Printf("Error Sending Message: %s", err.Error())
- message.Context.sendResponse(&PacketResponse{Error: fmt.Errorf("unable to send request: %s", err)})
- close(message.Context.responses)
- break
- }
-
- // Only add to messageContexts if we were able to
- // successfully write the message.
- l.messageContexts[message.MessageID] = message.Context
-
- // Add timeout if defined
- requestTimeout := time.Duration(atomic.LoadInt64(&l.requestTimeout))
- if requestTimeout > 0 {
- go func() {
- defer func() {
- if err := recover(); err != nil {
- log.Printf("ldap: recovered panic in RequestTimeout: %v", err)
- }
- }()
- time.Sleep(requestTimeout)
- timeoutMessage := &messagePacket{
- Op: MessageTimeout,
- MessageID: message.MessageID,
- }
- l.sendProcessMessage(timeoutMessage)
- }()
- }
- case MessageResponse:
- l.Debug.Printf("Receiving message %d", message.MessageID)
- if msgCtx, ok := l.messageContexts[message.MessageID]; ok {
- msgCtx.sendResponse(&PacketResponse{message.Packet, nil})
- } else {
- log.Printf("Received unexpected message %d, %v", message.MessageID, l.IsClosing())
- l.Debug.PrintPacket(message.Packet)
- }
- case MessageTimeout:
- // Handle the timeout by closing the channel
- // All reads will return immediately
- if msgCtx, ok := l.messageContexts[message.MessageID]; ok {
- l.Debug.Printf("Receiving message timeout for %d", message.MessageID)
- msgCtx.sendResponse(&PacketResponse{message.Packet, NewError(ErrorNetwork, errors.New("ldap: connection timed out"))})
- delete(l.messageContexts, message.MessageID)
- close(msgCtx.responses)
- }
- case MessageFinish:
- l.Debug.Printf("Finished message %d", message.MessageID)
- if msgCtx, ok := l.messageContexts[message.MessageID]; ok {
- delete(l.messageContexts, message.MessageID)
- close(msgCtx.responses)
- }
- }
- }
- }
-}
-
-func (l *Conn) reader() {
- cleanstop := false
- defer func() {
- if err := recover(); err != nil {
- log.Printf("ldap: recovered panic in reader: %v", err)
- }
- if !cleanstop {
- l.Close()
- }
- }()
-
- bufConn := bufio.NewReader(l.conn)
- for {
- if cleanstop {
- l.Debug.Printf("reader clean stopping (without closing the connection)")
- return
- }
- packet, err := ber.ReadPacket(bufConn)
- if err != nil {
- // A read error is expected here if we are closing the connection...
- if !l.IsClosing() {
- l.closeErr.Store(fmt.Errorf("unable to read LDAP response packet: %s", err))
- l.Debug.Printf("reader error: %s", err)
- }
- return
- }
- if err := addLDAPDescriptions(packet); err != nil {
- l.Debug.Printf("descriptions error: %s", err)
- }
- if len(packet.Children) == 0 {
- l.Debug.Printf("Received bad ldap packet")
- continue
- }
- l.messageMutex.Lock()
- if l.isStartingTLS {
- cleanstop = true
- }
- l.messageMutex.Unlock()
- message := &messagePacket{
- Op: MessageResponse,
- MessageID: packet.Children[0].Value.(int64),
- Packet: packet,
- }
- if !l.sendProcessMessage(message) {
- return
- }
- }
-}
diff --git a/vendor/github.com/go-ldap/ldap/v3/control.go b/vendor/github.com/go-ldap/ldap/v3/control.go
deleted file mode 100644
index 64fb002ad9..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/control.go
+++ /dev/null
@@ -1,528 +0,0 @@
-package ldap
-
-import (
- "fmt"
- "strconv"
-
- ber "github.com/go-asn1-ber/asn1-ber"
-)
-
-const (
- // ControlTypePaging - https://www.ietf.org/rfc/rfc2696.txt
- ControlTypePaging = "1.2.840.113556.1.4.319"
- // ControlTypeBeheraPasswordPolicy - https://tools.ietf.org/html/draft-behera-ldap-password-policy-10
- ControlTypeBeheraPasswordPolicy = "1.3.6.1.4.1.42.2.27.8.5.1"
- // ControlTypeVChuPasswordMustChange - https://tools.ietf.org/html/draft-vchu-ldap-pwd-policy-00
- ControlTypeVChuPasswordMustChange = "2.16.840.1.113730.3.4.4"
- // ControlTypeVChuPasswordWarning - https://tools.ietf.org/html/draft-vchu-ldap-pwd-policy-00
- ControlTypeVChuPasswordWarning = "2.16.840.1.113730.3.4.5"
- // ControlTypeManageDsaIT - https://tools.ietf.org/html/rfc3296
- ControlTypeManageDsaIT = "2.16.840.1.113730.3.4.2"
- // ControlTypeWhoAmI - https://tools.ietf.org/html/rfc4532
- ControlTypeWhoAmI = "1.3.6.1.4.1.4203.1.11.3"
-
- // ControlTypeMicrosoftNotification - https://msdn.microsoft.com/en-us/library/aa366983(v=vs.85).aspx
- ControlTypeMicrosoftNotification = "1.2.840.113556.1.4.528"
- // ControlTypeMicrosoftShowDeleted - https://msdn.microsoft.com/en-us/library/aa366989(v=vs.85).aspx
- ControlTypeMicrosoftShowDeleted = "1.2.840.113556.1.4.417"
- // ControlTypeMicrosoftServerLinkTTL - https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-adts/f4f523a8-abc0-4b3a-a471-6b2fef135481?redirectedfrom=MSDN
- ControlTypeMicrosoftServerLinkTTL = "1.2.840.113556.1.4.2309"
-)
-
-// ControlTypeMap maps controls to text descriptions
-var ControlTypeMap = map[string]string{
- ControlTypePaging: "Paging",
- ControlTypeBeheraPasswordPolicy: "Password Policy - Behera Draft",
- ControlTypeManageDsaIT: "Manage DSA IT",
- ControlTypeMicrosoftNotification: "Change Notification - Microsoft",
- ControlTypeMicrosoftShowDeleted: "Show Deleted Objects - Microsoft",
- ControlTypeMicrosoftServerLinkTTL: "Return TTL-DNs for link values with associated expiry times - Microsoft",
-}
-
-// Control defines an interface controls provide to encode and describe themselves
-type Control interface {
- // GetControlType returns the OID
- GetControlType() string
- // Encode returns the ber packet representation
- Encode() *ber.Packet
- // String returns a human-readable description
- String() string
-}
-
-// ControlString implements the Control interface for simple controls
-type ControlString struct {
- ControlType string
- Criticality bool
- ControlValue string
-}
-
-// GetControlType returns the OID
-func (c *ControlString) GetControlType() string {
- return c.ControlType
-}
-
-// Encode returns the ber packet representation
-func (c *ControlString) Encode() *ber.Packet {
- packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Control")
- packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, c.ControlType, "Control Type ("+ControlTypeMap[c.ControlType]+")"))
- if c.Criticality {
- packet.AppendChild(ber.NewBoolean(ber.ClassUniversal, ber.TypePrimitive, ber.TagBoolean, c.Criticality, "Criticality"))
- }
- if c.ControlValue != "" {
- packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, string(c.ControlValue), "Control Value"))
- }
- return packet
-}
-
-// String returns a human-readable description
-func (c *ControlString) String() string {
- return fmt.Sprintf("Control Type: %s (%q) Criticality: %t Control Value: %s", ControlTypeMap[c.ControlType], c.ControlType, c.Criticality, c.ControlValue)
-}
-
-// ControlPaging implements the paging control described in https://www.ietf.org/rfc/rfc2696.txt
-type ControlPaging struct {
- // PagingSize indicates the page size
- PagingSize uint32
- // Cookie is an opaque value returned by the server to track a paging cursor
- Cookie []byte
-}
-
-// GetControlType returns the OID
-func (c *ControlPaging) GetControlType() string {
- return ControlTypePaging
-}
-
-// Encode returns the ber packet representation
-func (c *ControlPaging) Encode() *ber.Packet {
- packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Control")
- packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, ControlTypePaging, "Control Type ("+ControlTypeMap[ControlTypePaging]+")"))
-
- p2 := ber.Encode(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, nil, "Control Value (Paging)")
- seq := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Search Control Value")
- seq.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, int64(c.PagingSize), "Paging Size"))
- cookie := ber.Encode(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, nil, "Cookie")
- cookie.Value = c.Cookie
- cookie.Data.Write(c.Cookie)
- seq.AppendChild(cookie)
- p2.AppendChild(seq)
-
- packet.AppendChild(p2)
- return packet
-}
-
-// String returns a human-readable description
-func (c *ControlPaging) String() string {
- return fmt.Sprintf(
- "Control Type: %s (%q) Criticality: %t PagingSize: %d Cookie: %q",
- ControlTypeMap[ControlTypePaging],
- ControlTypePaging,
- false,
- c.PagingSize,
- c.Cookie)
-}
-
-// SetCookie stores the given cookie in the paging control
-func (c *ControlPaging) SetCookie(cookie []byte) {
- c.Cookie = cookie
-}
-
-// ControlBeheraPasswordPolicy implements the control described in https://tools.ietf.org/html/draft-behera-ldap-password-policy-10
-type ControlBeheraPasswordPolicy struct {
- // Expire contains the number of seconds before a password will expire
- Expire int64
- // Grace indicates the remaining number of times a user will be allowed to authenticate with an expired password
- Grace int64
- // Error indicates the error code
- Error int8
- // ErrorString is a human readable error
- ErrorString string
-}
-
-// GetControlType returns the OID
-func (c *ControlBeheraPasswordPolicy) GetControlType() string {
- return ControlTypeBeheraPasswordPolicy
-}
-
-// Encode returns the ber packet representation
-func (c *ControlBeheraPasswordPolicy) Encode() *ber.Packet {
- packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Control")
- packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, ControlTypeBeheraPasswordPolicy, "Control Type ("+ControlTypeMap[ControlTypeBeheraPasswordPolicy]+")"))
-
- return packet
-}
-
-// String returns a human-readable description
-func (c *ControlBeheraPasswordPolicy) String() string {
- return fmt.Sprintf(
- "Control Type: %s (%q) Criticality: %t Expire: %d Grace: %d Error: %d, ErrorString: %s",
- ControlTypeMap[ControlTypeBeheraPasswordPolicy],
- ControlTypeBeheraPasswordPolicy,
- false,
- c.Expire,
- c.Grace,
- c.Error,
- c.ErrorString)
-}
-
-// ControlVChuPasswordMustChange implements the control described in https://tools.ietf.org/html/draft-vchu-ldap-pwd-policy-00
-type ControlVChuPasswordMustChange struct {
- // MustChange indicates if the password is required to be changed
- MustChange bool
-}
-
-// GetControlType returns the OID
-func (c *ControlVChuPasswordMustChange) GetControlType() string {
- return ControlTypeVChuPasswordMustChange
-}
-
-// Encode returns the ber packet representation
-func (c *ControlVChuPasswordMustChange) Encode() *ber.Packet {
- return nil
-}
-
-// String returns a human-readable description
-func (c *ControlVChuPasswordMustChange) String() string {
- return fmt.Sprintf(
- "Control Type: %s (%q) Criticality: %t MustChange: %v",
- ControlTypeMap[ControlTypeVChuPasswordMustChange],
- ControlTypeVChuPasswordMustChange,
- false,
- c.MustChange)
-}
-
-// ControlVChuPasswordWarning implements the control described in https://tools.ietf.org/html/draft-vchu-ldap-pwd-policy-00
-type ControlVChuPasswordWarning struct {
- // Expire indicates the time in seconds until the password expires
- Expire int64
-}
-
-// GetControlType returns the OID
-func (c *ControlVChuPasswordWarning) GetControlType() string {
- return ControlTypeVChuPasswordWarning
-}
-
-// Encode returns the ber packet representation
-func (c *ControlVChuPasswordWarning) Encode() *ber.Packet {
- return nil
-}
-
-// String returns a human-readable description
-func (c *ControlVChuPasswordWarning) String() string {
- return fmt.Sprintf(
- "Control Type: %s (%q) Criticality: %t Expire: %b",
- ControlTypeMap[ControlTypeVChuPasswordWarning],
- ControlTypeVChuPasswordWarning,
- false,
- c.Expire)
-}
-
-// ControlManageDsaIT implements the control described in https://tools.ietf.org/html/rfc3296
-type ControlManageDsaIT struct {
- // Criticality indicates if this control is required
- Criticality bool
-}
-
-// GetControlType returns the OID
-func (c *ControlManageDsaIT) GetControlType() string {
- return ControlTypeManageDsaIT
-}
-
-// Encode returns the ber packet representation
-func (c *ControlManageDsaIT) Encode() *ber.Packet {
- //FIXME
- packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Control")
- packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, ControlTypeManageDsaIT, "Control Type ("+ControlTypeMap[ControlTypeManageDsaIT]+")"))
- if c.Criticality {
- packet.AppendChild(ber.NewBoolean(ber.ClassUniversal, ber.TypePrimitive, ber.TagBoolean, c.Criticality, "Criticality"))
- }
- return packet
-}
-
-// String returns a human-readable description
-func (c *ControlManageDsaIT) String() string {
- return fmt.Sprintf(
- "Control Type: %s (%q) Criticality: %t",
- ControlTypeMap[ControlTypeManageDsaIT],
- ControlTypeManageDsaIT,
- c.Criticality)
-}
-
-// NewControlManageDsaIT returns a ControlManageDsaIT control
-func NewControlManageDsaIT(Criticality bool) *ControlManageDsaIT {
- return &ControlManageDsaIT{Criticality: Criticality}
-}
-
-// ControlMicrosoftNotification implements the control described in https://msdn.microsoft.com/en-us/library/aa366983(v=vs.85).aspx
-type ControlMicrosoftNotification struct{}
-
-// GetControlType returns the OID
-func (c *ControlMicrosoftNotification) GetControlType() string {
- return ControlTypeMicrosoftNotification
-}
-
-// Encode returns the ber packet representation
-func (c *ControlMicrosoftNotification) Encode() *ber.Packet {
- packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Control")
- packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, ControlTypeMicrosoftNotification, "Control Type ("+ControlTypeMap[ControlTypeMicrosoftNotification]+")"))
-
- return packet
-}
-
-// String returns a human-readable description
-func (c *ControlMicrosoftNotification) String() string {
- return fmt.Sprintf(
- "Control Type: %s (%q)",
- ControlTypeMap[ControlTypeMicrosoftNotification],
- ControlTypeMicrosoftNotification)
-}
-
-// NewControlMicrosoftNotification returns a ControlMicrosoftNotification control
-func NewControlMicrosoftNotification() *ControlMicrosoftNotification {
- return &ControlMicrosoftNotification{}
-}
-
-// ControlMicrosoftShowDeleted implements the control described in https://msdn.microsoft.com/en-us/library/aa366989(v=vs.85).aspx
-type ControlMicrosoftShowDeleted struct{}
-
-// GetControlType returns the OID
-func (c *ControlMicrosoftShowDeleted) GetControlType() string {
- return ControlTypeMicrosoftShowDeleted
-}
-
-// Encode returns the ber packet representation
-func (c *ControlMicrosoftShowDeleted) Encode() *ber.Packet {
- packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Control")
- packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, ControlTypeMicrosoftShowDeleted, "Control Type ("+ControlTypeMap[ControlTypeMicrosoftShowDeleted]+")"))
-
- return packet
-}
-
-// String returns a human-readable description
-func (c *ControlMicrosoftShowDeleted) String() string {
- return fmt.Sprintf(
- "Control Type: %s (%q)",
- ControlTypeMap[ControlTypeMicrosoftShowDeleted],
- ControlTypeMicrosoftShowDeleted)
-}
-
-// NewControlMicrosoftShowDeleted returns a ControlMicrosoftShowDeleted control
-func NewControlMicrosoftShowDeleted() *ControlMicrosoftShowDeleted {
- return &ControlMicrosoftShowDeleted{}
-}
-
-// ControlMicrosoftServerLinkTTL implements the control described in https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-adts/f4f523a8-abc0-4b3a-a471-6b2fef135481?redirectedfrom=MSDN
-type ControlMicrosoftServerLinkTTL struct{}
-
-// GetControlType returns the OID
-func (c *ControlMicrosoftServerLinkTTL) GetControlType() string {
- return ControlTypeMicrosoftServerLinkTTL
-}
-
-// Encode returns the ber packet representation
-func (c *ControlMicrosoftServerLinkTTL) Encode() *ber.Packet {
- packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Control")
- packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, ControlTypeMicrosoftServerLinkTTL, "Control Type ("+ControlTypeMap[ControlTypeMicrosoftServerLinkTTL]+")"))
-
- return packet
-}
-
-// String returns a human-readable description
-func (c *ControlMicrosoftServerLinkTTL) String() string {
- return fmt.Sprintf(
- "Control Type: %s (%q)",
- ControlTypeMap[ControlTypeMicrosoftServerLinkTTL],
- ControlTypeMicrosoftServerLinkTTL)
-}
-
-// NewControlMicrosoftServerLinkTTL returns a ControlMicrosoftServerLinkTTL control
-func NewControlMicrosoftServerLinkTTL() *ControlMicrosoftServerLinkTTL {
- return &ControlMicrosoftServerLinkTTL{}
-}
-
-// FindControl returns the first control of the given type in the list, or nil
-func FindControl(controls []Control, controlType string) Control {
- for _, c := range controls {
- if c.GetControlType() == controlType {
- return c
- }
- }
- return nil
-}
-
-// DecodeControl returns a control read from the given packet, or nil if no recognized control can be made
-func DecodeControl(packet *ber.Packet) (Control, error) {
- var (
- ControlType = ""
- Criticality = false
- value *ber.Packet
- )
-
- switch len(packet.Children) {
- case 0:
- // at least one child is required for control type
- return nil, fmt.Errorf("at least one child is required for control type")
-
- case 1:
- // just type, no criticality or value
- packet.Children[0].Description = "Control Type (" + ControlTypeMap[ControlType] + ")"
- ControlType = packet.Children[0].Value.(string)
-
- case 2:
- packet.Children[0].Description = "Control Type (" + ControlTypeMap[ControlType] + ")"
- ControlType = packet.Children[0].Value.(string)
-
- // Children[1] could be criticality or value (both are optional)
- // duck-type on whether this is a boolean
- if _, ok := packet.Children[1].Value.(bool); ok {
- packet.Children[1].Description = "Criticality"
- Criticality = packet.Children[1].Value.(bool)
- } else {
- packet.Children[1].Description = "Control Value"
- value = packet.Children[1]
- }
-
- case 3:
- packet.Children[0].Description = "Control Type (" + ControlTypeMap[ControlType] + ")"
- ControlType = packet.Children[0].Value.(string)
-
- packet.Children[1].Description = "Criticality"
- Criticality = packet.Children[1].Value.(bool)
-
- packet.Children[2].Description = "Control Value"
- value = packet.Children[2]
-
- default:
- // more than 3 children is invalid
- return nil, fmt.Errorf("more than 3 children is invalid for controls")
- }
-
- switch ControlType {
- case ControlTypeManageDsaIT:
- return NewControlManageDsaIT(Criticality), nil
- case ControlTypePaging:
- value.Description += " (Paging)"
- c := new(ControlPaging)
- if value.Value != nil {
- valueChildren, err := ber.DecodePacketErr(value.Data.Bytes())
- if err != nil {
- return nil, fmt.Errorf("failed to decode data bytes: %s", err)
- }
- value.Data.Truncate(0)
- value.Value = nil
- value.AppendChild(valueChildren)
- }
- value = value.Children[0]
- value.Description = "Search Control Value"
- value.Children[0].Description = "Paging Size"
- value.Children[1].Description = "Cookie"
- c.PagingSize = uint32(value.Children[0].Value.(int64))
- c.Cookie = value.Children[1].Data.Bytes()
- value.Children[1].Value = c.Cookie
- return c, nil
- case ControlTypeBeheraPasswordPolicy:
- value.Description += " (Password Policy - Behera)"
- c := NewControlBeheraPasswordPolicy()
- if value.Value != nil {
- valueChildren, err := ber.DecodePacketErr(value.Data.Bytes())
- if err != nil {
- return nil, fmt.Errorf("failed to decode data bytes: %s", err)
- }
- value.Data.Truncate(0)
- value.Value = nil
- value.AppendChild(valueChildren)
- }
-
- sequence := value.Children[0]
-
- for _, child := range sequence.Children {
- if child.Tag == 0 {
- //Warning
- warningPacket := child.Children[0]
- val, err := ber.ParseInt64(warningPacket.Data.Bytes())
- if err != nil {
- return nil, fmt.Errorf("failed to decode data bytes: %s", err)
- }
- if warningPacket.Tag == 0 {
- //timeBeforeExpiration
- c.Expire = val
- warningPacket.Value = c.Expire
- } else if warningPacket.Tag == 1 {
- //graceAuthNsRemaining
- c.Grace = val
- warningPacket.Value = c.Grace
- }
- } else if child.Tag == 1 {
- // Error
- bs := child.Data.Bytes()
- if len(bs) != 1 || bs[0] > 8 {
- return nil, fmt.Errorf("failed to decode data bytes: %s", "invalid PasswordPolicyResponse enum value")
- }
- val := int8(bs[0])
- c.Error = val
- child.Value = c.Error
- c.ErrorString = BeheraPasswordPolicyErrorMap[c.Error]
- }
- }
- return c, nil
- case ControlTypeVChuPasswordMustChange:
- c := &ControlVChuPasswordMustChange{MustChange: true}
- return c, nil
- case ControlTypeVChuPasswordWarning:
- c := &ControlVChuPasswordWarning{Expire: -1}
- expireStr := ber.DecodeString(value.Data.Bytes())
-
- expire, err := strconv.ParseInt(expireStr, 10, 64)
- if err != nil {
- return nil, fmt.Errorf("failed to parse value as int: %s", err)
- }
- c.Expire = expire
- value.Value = c.Expire
-
- return c, nil
- case ControlTypeMicrosoftNotification:
- return NewControlMicrosoftNotification(), nil
- case ControlTypeMicrosoftShowDeleted:
- return NewControlMicrosoftShowDeleted(), nil
- case ControlTypeMicrosoftServerLinkTTL:
- return NewControlMicrosoftServerLinkTTL(), nil
- default:
- c := new(ControlString)
- c.ControlType = ControlType
- c.Criticality = Criticality
- if value != nil {
- c.ControlValue = value.Value.(string)
- }
- return c, nil
- }
-}
-
-// NewControlString returns a generic control
-func NewControlString(controlType string, criticality bool, controlValue string) *ControlString {
- return &ControlString{
- ControlType: controlType,
- Criticality: criticality,
- ControlValue: controlValue,
- }
-}
-
-// NewControlPaging returns a paging control
-func NewControlPaging(pagingSize uint32) *ControlPaging {
- return &ControlPaging{PagingSize: pagingSize}
-}
-
-// NewControlBeheraPasswordPolicy returns a ControlBeheraPasswordPolicy
-func NewControlBeheraPasswordPolicy() *ControlBeheraPasswordPolicy {
- return &ControlBeheraPasswordPolicy{
- Expire: -1,
- Grace: -1,
- Error: -1,
- }
-}
-
-func encodeControls(controls []Control) *ber.Packet {
- packet := ber.Encode(ber.ClassContext, ber.TypeConstructed, 0, nil, "Controls")
- for _, control := range controls {
- packet.AppendChild(control.Encode())
- }
- return packet
-}
diff --git a/vendor/github.com/go-ldap/ldap/v3/debug.go b/vendor/github.com/go-ldap/ldap/v3/debug.go
deleted file mode 100644
index d0a8fc150b..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/debug.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package ldap
-
-import (
- "log"
-
- ber "github.com/go-asn1-ber/asn1-ber"
-)
-
-// debugging type
-// - has a Printf method to write the debug output
-type debugging bool
-
-// Enable controls debugging mode.
-func (debug *debugging) Enable(b bool) {
- *debug = debugging(b)
-}
-
-// Printf writes debug output.
-func (debug debugging) Printf(format string, args ...interface{}) {
- if debug {
- log.Printf(format, args...)
- }
-}
-
-// PrintPacket dumps a packet.
-func (debug debugging) PrintPacket(packet *ber.Packet) {
- if debug {
- ber.WritePacket(log.Writer(), packet)
- }
-}
diff --git a/vendor/github.com/go-ldap/ldap/v3/del.go b/vendor/github.com/go-ldap/ldap/v3/del.go
deleted file mode 100644
index 6e98726775..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/del.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package ldap
-
-import (
- "log"
-
- ber "github.com/go-asn1-ber/asn1-ber"
-)
-
-// DelRequest implements an LDAP deletion request
-type DelRequest struct {
- // DN is the name of the directory entry to delete
- DN string
- // Controls hold optional controls to send with the request
- Controls []Control
-}
-
-func (req *DelRequest) appendTo(envelope *ber.Packet) error {
- pkt := ber.Encode(ber.ClassApplication, ber.TypePrimitive, ApplicationDelRequest, req.DN, "Del Request")
- pkt.Data.Write([]byte(req.DN))
-
- envelope.AppendChild(pkt)
- if len(req.Controls) > 0 {
- envelope.AppendChild(encodeControls(req.Controls))
- }
-
- return nil
-}
-
-// NewDelRequest creates a delete request for the given DN and controls
-func NewDelRequest(DN string, Controls []Control) *DelRequest {
- return &DelRequest{
- DN: DN,
- Controls: Controls,
- }
-}
-
-// Del executes the given delete request
-func (l *Conn) Del(delRequest *DelRequest) error {
- msgCtx, err := l.doRequest(delRequest)
- if err != nil {
- return err
- }
- defer l.finishMessage(msgCtx)
-
- packet, err := l.readPacket(msgCtx)
- if err != nil {
- return err
- }
-
- if packet.Children[1].Tag == ApplicationDelResponse {
- err := GetLDAPError(packet)
- if err != nil {
- return err
- }
- } else {
- log.Printf("Unexpected Response: %d", packet.Children[1].Tag)
- }
- return nil
-}
diff --git a/vendor/github.com/go-ldap/ldap/v3/dn.go b/vendor/github.com/go-ldap/ldap/v3/dn.go
deleted file mode 100644
index 2b4cede977..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/dn.go
+++ /dev/null
@@ -1,270 +0,0 @@
-package ldap
-
-import (
- "bytes"
- enchex "encoding/hex"
- "errors"
- "fmt"
- "strings"
-
- ber "github.com/go-asn1-ber/asn1-ber"
-)
-
-// AttributeTypeAndValue represents an attributeTypeAndValue from https://tools.ietf.org/html/rfc4514
-type AttributeTypeAndValue struct {
- // Type is the attribute type
- Type string
- // Value is the attribute value
- Value string
-}
-
-// RelativeDN represents a relativeDistinguishedName from https://tools.ietf.org/html/rfc4514
-type RelativeDN struct {
- Attributes []*AttributeTypeAndValue
-}
-
-// DN represents a distinguishedName from https://tools.ietf.org/html/rfc4514
-type DN struct {
- RDNs []*RelativeDN
-}
-
-// ParseDN returns a distinguishedName or an error.
-// The function respects https://tools.ietf.org/html/rfc4514
-func ParseDN(str string) (*DN, error) {
- dn := new(DN)
- dn.RDNs = make([]*RelativeDN, 0)
- rdn := new(RelativeDN)
- rdn.Attributes = make([]*AttributeTypeAndValue, 0)
- buffer := bytes.Buffer{}
- attribute := new(AttributeTypeAndValue)
- escaping := false
-
- unescapedTrailingSpaces := 0
- stringFromBuffer := func() string {
- s := buffer.String()
- s = s[0 : len(s)-unescapedTrailingSpaces]
- buffer.Reset()
- unescapedTrailingSpaces = 0
- return s
- }
-
- for i := 0; i < len(str); i++ {
- char := str[i]
- switch {
- case escaping:
- unescapedTrailingSpaces = 0
- escaping = false
- switch char {
- case ' ', '"', '#', '+', ',', ';', '<', '=', '>', '\\':
- buffer.WriteByte(char)
- continue
- }
- // Not a special character, assume hex encoded octet
- if len(str) == i+1 {
- return nil, errors.New("got corrupted escaped character")
- }
-
- dst := []byte{0}
- n, err := enchex.Decode([]byte(dst), []byte(str[i:i+2]))
- if err != nil {
- return nil, fmt.Errorf("failed to decode escaped character: %s", err)
- } else if n != 1 {
- return nil, fmt.Errorf("expected 1 byte when un-escaping, got %d", n)
- }
- buffer.WriteByte(dst[0])
- i++
- case char == '\\':
- unescapedTrailingSpaces = 0
- escaping = true
- case char == '=':
- attribute.Type = stringFromBuffer()
- // Special case: If the first character in the value is # the
- // following data is BER encoded so we can just fast forward
- // and decode.
- if len(str) > i+1 && str[i+1] == '#' {
- i += 2
- index := strings.IndexAny(str[i:], ",+")
- data := str
- if index > 0 {
- data = str[i : i+index]
- } else {
- data = str[i:]
- }
- rawBER, err := enchex.DecodeString(data)
- if err != nil {
- return nil, fmt.Errorf("failed to decode BER encoding: %s", err)
- }
- packet, err := ber.DecodePacketErr(rawBER)
- if err != nil {
- return nil, fmt.Errorf("failed to decode BER packet: %s", err)
- }
- buffer.WriteString(packet.Data.String())
- i += len(data) - 1
- }
- case char == ',' || char == '+':
- // We're done with this RDN or value, push it
- if len(attribute.Type) == 0 {
- return nil, errors.New("incomplete type, value pair")
- }
- attribute.Value = stringFromBuffer()
- rdn.Attributes = append(rdn.Attributes, attribute)
- attribute = new(AttributeTypeAndValue)
- if char == ',' {
- dn.RDNs = append(dn.RDNs, rdn)
- rdn = new(RelativeDN)
- rdn.Attributes = make([]*AttributeTypeAndValue, 0)
- }
- case char == ' ' && buffer.Len() == 0:
- // ignore unescaped leading spaces
- continue
- default:
- if char == ' ' {
- // Track unescaped spaces in case they are trailing and we need to remove them
- unescapedTrailingSpaces++
- } else {
- // Reset if we see a non-space char
- unescapedTrailingSpaces = 0
- }
- buffer.WriteByte(char)
- }
- }
- if buffer.Len() > 0 {
- if len(attribute.Type) == 0 {
- return nil, errors.New("DN ended with incomplete type, value pair")
- }
- attribute.Value = stringFromBuffer()
- rdn.Attributes = append(rdn.Attributes, attribute)
- dn.RDNs = append(dn.RDNs, rdn)
- }
- return dn, nil
-}
-
-// Equal returns true if the DNs are equal as defined by rfc4517 4.2.15 (distinguishedNameMatch).
-// Returns true if they have the same number of relative distinguished names
-// and corresponding relative distinguished names (by position) are the same.
-func (d *DN) Equal(other *DN) bool {
- if len(d.RDNs) != len(other.RDNs) {
- return false
- }
- for i := range d.RDNs {
- if !d.RDNs[i].Equal(other.RDNs[i]) {
- return false
- }
- }
- return true
-}
-
-// AncestorOf returns true if the other DN consists of at least one RDN followed by all the RDNs of the current DN.
-// "ou=widgets,o=acme.com" is an ancestor of "ou=sprockets,ou=widgets,o=acme.com"
-// "ou=widgets,o=acme.com" is not an ancestor of "ou=sprockets,ou=widgets,o=foo.com"
-// "ou=widgets,o=acme.com" is not an ancestor of "ou=widgets,o=acme.com"
-func (d *DN) AncestorOf(other *DN) bool {
- if len(d.RDNs) >= len(other.RDNs) {
- return false
- }
- // Take the last `len(d.RDNs)` RDNs from the other DN to compare against
- otherRDNs := other.RDNs[len(other.RDNs)-len(d.RDNs):]
- for i := range d.RDNs {
- if !d.RDNs[i].Equal(otherRDNs[i]) {
- return false
- }
- }
- return true
-}
-
-// Equal returns true if the RelativeDNs are equal as defined by rfc4517 4.2.15 (distinguishedNameMatch).
-// Relative distinguished names are the same if and only if they have the same number of AttributeTypeAndValues
-// and each attribute of the first RDN is the same as the attribute of the second RDN with the same attribute type.
-// The order of attributes is not significant.
-// Case of attribute types is not significant.
-func (r *RelativeDN) Equal(other *RelativeDN) bool {
- if len(r.Attributes) != len(other.Attributes) {
- return false
- }
- return r.hasAllAttributes(other.Attributes) && other.hasAllAttributes(r.Attributes)
-}
-
-func (r *RelativeDN) hasAllAttributes(attrs []*AttributeTypeAndValue) bool {
- for _, attr := range attrs {
- found := false
- for _, myattr := range r.Attributes {
- if myattr.Equal(attr) {
- found = true
- break
- }
- }
- if !found {
- return false
- }
- }
- return true
-}
-
-// Equal returns true if the AttributeTypeAndValue is equivalent to the specified AttributeTypeAndValue
-// Case of the attribute type is not significant
-func (a *AttributeTypeAndValue) Equal(other *AttributeTypeAndValue) bool {
- return strings.EqualFold(a.Type, other.Type) && a.Value == other.Value
-}
-
-// Equal returns true if the DNs are equal as defined by rfc4517 4.2.15 (distinguishedNameMatch).
-// Returns true if they have the same number of relative distinguished names
-// and corresponding relative distinguished names (by position) are the same.
-// Case of the attribute type and value is not significant
-func (d *DN) EqualFold(other *DN) bool {
- if len(d.RDNs) != len(other.RDNs) {
- return false
- }
- for i := range d.RDNs {
- if !d.RDNs[i].EqualFold(other.RDNs[i]) {
- return false
- }
- }
- return true
-}
-
-// AncestorOfFold returns true if the other DN consists of at least one RDN followed by all the RDNs of the current DN.
-// Case of the attribute type and value is not significant
-func (d *DN) AncestorOfFold(other *DN) bool {
- if len(d.RDNs) >= len(other.RDNs) {
- return false
- }
- // Take the last `len(d.RDNs)` RDNs from the other DN to compare against
- otherRDNs := other.RDNs[len(other.RDNs)-len(d.RDNs):]
- for i := range d.RDNs {
- if !d.RDNs[i].EqualFold(otherRDNs[i]) {
- return false
- }
- }
- return true
-}
-
-// Equal returns true if the RelativeDNs are equal as defined by rfc4517 4.2.15 (distinguishedNameMatch).
-// Case of the attribute type is not significant
-func (r *RelativeDN) EqualFold(other *RelativeDN) bool {
- if len(r.Attributes) != len(other.Attributes) {
- return false
- }
- return r.hasAllAttributesFold(other.Attributes) && other.hasAllAttributesFold(r.Attributes)
-}
-
-func (r *RelativeDN) hasAllAttributesFold(attrs []*AttributeTypeAndValue) bool {
- for _, attr := range attrs {
- found := false
- for _, myattr := range r.Attributes {
- if myattr.EqualFold(attr) {
- found = true
- break
- }
- }
- if !found {
- return false
- }
- }
- return true
-}
-
-// EqualFold returns true if the AttributeTypeAndValue is equivalent to the specified AttributeTypeAndValue
-// Case of the attribute type and value is not significant
-func (a *AttributeTypeAndValue) EqualFold(other *AttributeTypeAndValue) bool {
- return strings.EqualFold(a.Type, other.Type) && strings.EqualFold(a.Value, other.Value)
-}
diff --git a/vendor/github.com/go-ldap/ldap/v3/doc.go b/vendor/github.com/go-ldap/ldap/v3/doc.go
deleted file mode 100644
index f20d39bc99..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/doc.go
+++ /dev/null
@@ -1,4 +0,0 @@
-/*
-Package ldap provides basic LDAP v3 functionality.
-*/
-package ldap
diff --git a/vendor/github.com/go-ldap/ldap/v3/error.go b/vendor/github.com/go-ldap/ldap/v3/error.go
deleted file mode 100644
index 3cdb7b318c..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/error.go
+++ /dev/null
@@ -1,253 +0,0 @@
-package ldap
-
-import (
- "fmt"
-
- ber "github.com/go-asn1-ber/asn1-ber"
-)
-
-// LDAP Result Codes
-const (
- LDAPResultSuccess = 0
- LDAPResultOperationsError = 1
- LDAPResultProtocolError = 2
- LDAPResultTimeLimitExceeded = 3
- LDAPResultSizeLimitExceeded = 4
- LDAPResultCompareFalse = 5
- LDAPResultCompareTrue = 6
- LDAPResultAuthMethodNotSupported = 7
- LDAPResultStrongAuthRequired = 8
- LDAPResultReferral = 10
- LDAPResultAdminLimitExceeded = 11
- LDAPResultUnavailableCriticalExtension = 12
- LDAPResultConfidentialityRequired = 13
- LDAPResultSaslBindInProgress = 14
- LDAPResultNoSuchAttribute = 16
- LDAPResultUndefinedAttributeType = 17
- LDAPResultInappropriateMatching = 18
- LDAPResultConstraintViolation = 19
- LDAPResultAttributeOrValueExists = 20
- LDAPResultInvalidAttributeSyntax = 21
- LDAPResultNoSuchObject = 32
- LDAPResultAliasProblem = 33
- LDAPResultInvalidDNSyntax = 34
- LDAPResultIsLeaf = 35
- LDAPResultAliasDereferencingProblem = 36
- LDAPResultInappropriateAuthentication = 48
- LDAPResultInvalidCredentials = 49
- LDAPResultInsufficientAccessRights = 50
- LDAPResultBusy = 51
- LDAPResultUnavailable = 52
- LDAPResultUnwillingToPerform = 53
- LDAPResultLoopDetect = 54
- LDAPResultSortControlMissing = 60
- LDAPResultOffsetRangeError = 61
- LDAPResultNamingViolation = 64
- LDAPResultObjectClassViolation = 65
- LDAPResultNotAllowedOnNonLeaf = 66
- LDAPResultNotAllowedOnRDN = 67
- LDAPResultEntryAlreadyExists = 68
- LDAPResultObjectClassModsProhibited = 69
- LDAPResultResultsTooLarge = 70
- LDAPResultAffectsMultipleDSAs = 71
- LDAPResultVirtualListViewErrorOrControlError = 76
- LDAPResultOther = 80
- LDAPResultServerDown = 81
- LDAPResultLocalError = 82
- LDAPResultEncodingError = 83
- LDAPResultDecodingError = 84
- LDAPResultTimeout = 85
- LDAPResultAuthUnknown = 86
- LDAPResultFilterError = 87
- LDAPResultUserCanceled = 88
- LDAPResultParamError = 89
- LDAPResultNoMemory = 90
- LDAPResultConnectError = 91
- LDAPResultNotSupported = 92
- LDAPResultControlNotFound = 93
- LDAPResultNoResultsReturned = 94
- LDAPResultMoreResultsToReturn = 95
- LDAPResultClientLoop = 96
- LDAPResultReferralLimitExceeded = 97
- LDAPResultInvalidResponse = 100
- LDAPResultAmbiguousResponse = 101
- LDAPResultTLSNotSupported = 112
- LDAPResultIntermediateResponse = 113
- LDAPResultUnknownType = 114
- LDAPResultCanceled = 118
- LDAPResultNoSuchOperation = 119
- LDAPResultTooLate = 120
- LDAPResultCannotCancel = 121
- LDAPResultAssertionFailed = 122
- LDAPResultAuthorizationDenied = 123
- LDAPResultSyncRefreshRequired = 4096
-
- ErrorNetwork = 200
- ErrorFilterCompile = 201
- ErrorFilterDecompile = 202
- ErrorDebugging = 203
- ErrorUnexpectedMessage = 204
- ErrorUnexpectedResponse = 205
- ErrorEmptyPassword = 206
-)
-
-// LDAPResultCodeMap contains string descriptions for LDAP error codes
-var LDAPResultCodeMap = map[uint16]string{
- LDAPResultSuccess: "Success",
- LDAPResultOperationsError: "Operations Error",
- LDAPResultProtocolError: "Protocol Error",
- LDAPResultTimeLimitExceeded: "Time Limit Exceeded",
- LDAPResultSizeLimitExceeded: "Size Limit Exceeded",
- LDAPResultCompareFalse: "Compare False",
- LDAPResultCompareTrue: "Compare True",
- LDAPResultAuthMethodNotSupported: "Auth Method Not Supported",
- LDAPResultStrongAuthRequired: "Strong Auth Required",
- LDAPResultReferral: "Referral",
- LDAPResultAdminLimitExceeded: "Admin Limit Exceeded",
- LDAPResultUnavailableCriticalExtension: "Unavailable Critical Extension",
- LDAPResultConfidentialityRequired: "Confidentiality Required",
- LDAPResultSaslBindInProgress: "Sasl Bind In Progress",
- LDAPResultNoSuchAttribute: "No Such Attribute",
- LDAPResultUndefinedAttributeType: "Undefined Attribute Type",
- LDAPResultInappropriateMatching: "Inappropriate Matching",
- LDAPResultConstraintViolation: "Constraint Violation",
- LDAPResultAttributeOrValueExists: "Attribute Or Value Exists",
- LDAPResultInvalidAttributeSyntax: "Invalid Attribute Syntax",
- LDAPResultNoSuchObject: "No Such Object",
- LDAPResultAliasProblem: "Alias Problem",
- LDAPResultInvalidDNSyntax: "Invalid DN Syntax",
- LDAPResultIsLeaf: "Is Leaf",
- LDAPResultAliasDereferencingProblem: "Alias Dereferencing Problem",
- LDAPResultInappropriateAuthentication: "Inappropriate Authentication",
- LDAPResultInvalidCredentials: "Invalid Credentials",
- LDAPResultInsufficientAccessRights: "Insufficient Access Rights",
- LDAPResultBusy: "Busy",
- LDAPResultUnavailable: "Unavailable",
- LDAPResultUnwillingToPerform: "Unwilling To Perform",
- LDAPResultLoopDetect: "Loop Detect",
- LDAPResultSortControlMissing: "Sort Control Missing",
- LDAPResultOffsetRangeError: "Result Offset Range Error",
- LDAPResultNamingViolation: "Naming Violation",
- LDAPResultObjectClassViolation: "Object Class Violation",
- LDAPResultResultsTooLarge: "Results Too Large",
- LDAPResultNotAllowedOnNonLeaf: "Not Allowed On Non Leaf",
- LDAPResultNotAllowedOnRDN: "Not Allowed On RDN",
- LDAPResultEntryAlreadyExists: "Entry Already Exists",
- LDAPResultObjectClassModsProhibited: "Object Class Mods Prohibited",
- LDAPResultAffectsMultipleDSAs: "Affects Multiple DSAs",
- LDAPResultVirtualListViewErrorOrControlError: "Failed because of a problem related to the virtual list view",
- LDAPResultOther: "Other",
- LDAPResultServerDown: "Cannot establish a connection",
- LDAPResultLocalError: "An error occurred",
- LDAPResultEncodingError: "LDAP encountered an error while encoding",
- LDAPResultDecodingError: "LDAP encountered an error while decoding",
- LDAPResultTimeout: "LDAP timeout while waiting for a response from the server",
- LDAPResultAuthUnknown: "The auth method requested in a bind request is unknown",
- LDAPResultFilterError: "An error occurred while encoding the given search filter",
- LDAPResultUserCanceled: "The user canceled the operation",
- LDAPResultParamError: "An invalid parameter was specified",
- LDAPResultNoMemory: "Out of memory error",
- LDAPResultConnectError: "A connection to the server could not be established",
- LDAPResultNotSupported: "An attempt has been made to use a feature not supported LDAP",
- LDAPResultControlNotFound: "The controls required to perform the requested operation were not found",
- LDAPResultNoResultsReturned: "No results were returned from the server",
- LDAPResultMoreResultsToReturn: "There are more results in the chain of results",
- LDAPResultClientLoop: "A loop has been detected. For example when following referrals",
- LDAPResultReferralLimitExceeded: "The referral hop limit has been exceeded",
- LDAPResultCanceled: "Operation was canceled",
- LDAPResultNoSuchOperation: "Server has no knowledge of the operation requested for cancellation",
- LDAPResultTooLate: "Too late to cancel the outstanding operation",
- LDAPResultCannotCancel: "The identified operation does not support cancellation or the cancel operation cannot be performed",
- LDAPResultAssertionFailed: "An assertion control given in the LDAP operation evaluated to false causing the operation to not be performed",
- LDAPResultSyncRefreshRequired: "Refresh Required",
- LDAPResultInvalidResponse: "Invalid Response",
- LDAPResultAmbiguousResponse: "Ambiguous Response",
- LDAPResultTLSNotSupported: "Tls Not Supported",
- LDAPResultIntermediateResponse: "Intermediate Response",
- LDAPResultUnknownType: "Unknown Type",
- LDAPResultAuthorizationDenied: "Authorization Denied",
-
- ErrorNetwork: "Network Error",
- ErrorFilterCompile: "Filter Compile Error",
- ErrorFilterDecompile: "Filter Decompile Error",
- ErrorDebugging: "Debugging Error",
- ErrorUnexpectedMessage: "Unexpected Message",
- ErrorUnexpectedResponse: "Unexpected Response",
- ErrorEmptyPassword: "Empty password not allowed by the client",
-}
-
-// Error holds LDAP error information
-type Error struct {
- // Err is the underlying error
- Err error
- // ResultCode is the LDAP error code
- ResultCode uint16
- // MatchedDN is the matchedDN returned if any
- MatchedDN string
- // Packet is the returned packet if any
- Packet *ber.Packet
-}
-
-func (e *Error) Error() string {
- return fmt.Sprintf("LDAP Result Code %d %q: %s", e.ResultCode, LDAPResultCodeMap[e.ResultCode], e.Err.Error())
-}
-
-// GetLDAPError creates an Error out of a BER packet representing a LDAPResult
-// The return is an error object. It can be casted to a Error structure.
-// This function returns nil if resultCode in the LDAPResult sequence is success(0).
-func GetLDAPError(packet *ber.Packet) error {
- if packet == nil {
- return &Error{ResultCode: ErrorUnexpectedResponse, Err: fmt.Errorf("Empty packet")}
- }
-
- if len(packet.Children) >= 2 {
- response := packet.Children[1]
- if response == nil {
- return &Error{ResultCode: ErrorUnexpectedResponse, Err: fmt.Errorf("Empty response in packet"), Packet: packet}
- }
- if response.ClassType == ber.ClassApplication && response.TagType == ber.TypeConstructed && len(response.Children) >= 3 {
- resultCode := uint16(response.Children[0].Value.(int64))
- if resultCode == 0 { // No error
- return nil
- }
- return &Error{
- ResultCode: resultCode,
- MatchedDN: response.Children[1].Value.(string),
- Err: fmt.Errorf("%s", response.Children[2].Value.(string)),
- Packet: packet,
- }
- }
- }
-
- return &Error{ResultCode: ErrorNetwork, Err: fmt.Errorf("Invalid packet format"), Packet: packet}
-}
-
-// NewError creates an LDAP error with the given code and underlying error
-func NewError(resultCode uint16, err error) error {
- return &Error{ResultCode: resultCode, Err: err}
-}
-
-// IsErrorAnyOf returns true if the given error is an LDAP error with any one of the given result codes
-func IsErrorAnyOf(err error, codes ...uint16) bool {
- if err == nil {
- return false
- }
-
- serverError, ok := err.(*Error)
- if !ok {
- return false
- }
-
- for _, code := range codes {
- if serverError.ResultCode == code {
- return true
- }
- }
-
- return false
-}
-
-// IsErrorWithCode returns true if the given error is an LDAP error with the given result code
-func IsErrorWithCode(err error, desiredResultCode uint16) bool {
- return IsErrorAnyOf(err, desiredResultCode)
-}
diff --git a/vendor/github.com/go-ldap/ldap/v3/filter.go b/vendor/github.com/go-ldap/ldap/v3/filter.go
deleted file mode 100644
index 73505e79b6..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/filter.go
+++ /dev/null
@@ -1,487 +0,0 @@
-package ldap
-
-import (
- "bytes"
- hexpac "encoding/hex"
- "errors"
- "fmt"
- "io"
- "strings"
- "unicode"
- "unicode/utf8"
-
- ber "github.com/go-asn1-ber/asn1-ber"
-)
-
-// Filter choices
-const (
- FilterAnd = 0
- FilterOr = 1
- FilterNot = 2
- FilterEqualityMatch = 3
- FilterSubstrings = 4
- FilterGreaterOrEqual = 5
- FilterLessOrEqual = 6
- FilterPresent = 7
- FilterApproxMatch = 8
- FilterExtensibleMatch = 9
-)
-
-// FilterMap contains human readable descriptions of Filter choices
-var FilterMap = map[uint64]string{
- FilterAnd: "And",
- FilterOr: "Or",
- FilterNot: "Not",
- FilterEqualityMatch: "Equality Match",
- FilterSubstrings: "Substrings",
- FilterGreaterOrEqual: "Greater Or Equal",
- FilterLessOrEqual: "Less Or Equal",
- FilterPresent: "Present",
- FilterApproxMatch: "Approx Match",
- FilterExtensibleMatch: "Extensible Match",
-}
-
-// SubstringFilter options
-const (
- FilterSubstringsInitial = 0
- FilterSubstringsAny = 1
- FilterSubstringsFinal = 2
-)
-
-// FilterSubstringsMap contains human readable descriptions of SubstringFilter choices
-var FilterSubstringsMap = map[uint64]string{
- FilterSubstringsInitial: "Substrings Initial",
- FilterSubstringsAny: "Substrings Any",
- FilterSubstringsFinal: "Substrings Final",
-}
-
-// MatchingRuleAssertion choices
-const (
- MatchingRuleAssertionMatchingRule = 1
- MatchingRuleAssertionType = 2
- MatchingRuleAssertionMatchValue = 3
- MatchingRuleAssertionDNAttributes = 4
-)
-
-// MatchingRuleAssertionMap contains human readable descriptions of MatchingRuleAssertion choices
-var MatchingRuleAssertionMap = map[uint64]string{
- MatchingRuleAssertionMatchingRule: "Matching Rule Assertion Matching Rule",
- MatchingRuleAssertionType: "Matching Rule Assertion Type",
- MatchingRuleAssertionMatchValue: "Matching Rule Assertion Match Value",
- MatchingRuleAssertionDNAttributes: "Matching Rule Assertion DN Attributes",
-}
-
-var _SymbolAny = []byte{'*'}
-
-// CompileFilter converts a string representation of a filter into a BER-encoded packet
-func CompileFilter(filter string) (*ber.Packet, error) {
- if len(filter) == 0 || filter[0] != '(' {
- return nil, NewError(ErrorFilterCompile, errors.New("ldap: filter does not start with an '('"))
- }
- packet, pos, err := compileFilter(filter, 1)
- if err != nil {
- return nil, err
- }
- switch {
- case pos > len(filter):
- return nil, NewError(ErrorFilterCompile, errors.New("ldap: unexpected end of filter"))
- case pos < len(filter):
- return nil, NewError(ErrorFilterCompile, errors.New("ldap: finished compiling filter with extra at end: "+fmt.Sprint(filter[pos:])))
- }
- return packet, nil
-}
-
-// DecompileFilter converts a packet representation of a filter into a string representation
-func DecompileFilter(packet *ber.Packet) (_ string, err error) {
- defer func() {
- if r := recover(); r != nil {
- err = NewError(ErrorFilterDecompile, errors.New("ldap: error decompiling filter"))
- }
- }()
-
- buf := bytes.NewBuffer(nil)
- buf.WriteByte('(')
- childStr := ""
-
- switch packet.Tag {
- case FilterAnd:
- buf.WriteByte('&')
- for _, child := range packet.Children {
- childStr, err = DecompileFilter(child)
- if err != nil {
- return
- }
- buf.WriteString(childStr)
- }
- case FilterOr:
- buf.WriteByte('|')
- for _, child := range packet.Children {
- childStr, err = DecompileFilter(child)
- if err != nil {
- return
- }
- buf.WriteString(childStr)
- }
- case FilterNot:
- buf.WriteByte('!')
- childStr, err = DecompileFilter(packet.Children[0])
- if err != nil {
- return
- }
- buf.WriteString(childStr)
-
- case FilterSubstrings:
- buf.WriteString(ber.DecodeString(packet.Children[0].Data.Bytes()))
- buf.WriteByte('=')
- for i, child := range packet.Children[1].Children {
- if i == 0 && child.Tag != FilterSubstringsInitial {
- buf.Write(_SymbolAny)
- }
- buf.WriteString(EscapeFilter(ber.DecodeString(child.Data.Bytes())))
- if child.Tag != FilterSubstringsFinal {
- buf.Write(_SymbolAny)
- }
- }
- case FilterEqualityMatch:
- buf.WriteString(ber.DecodeString(packet.Children[0].Data.Bytes()))
- buf.WriteByte('=')
- buf.WriteString(EscapeFilter(ber.DecodeString(packet.Children[1].Data.Bytes())))
- case FilterGreaterOrEqual:
- buf.WriteString(ber.DecodeString(packet.Children[0].Data.Bytes()))
- buf.WriteString(">=")
- buf.WriteString(EscapeFilter(ber.DecodeString(packet.Children[1].Data.Bytes())))
- case FilterLessOrEqual:
- buf.WriteString(ber.DecodeString(packet.Children[0].Data.Bytes()))
- buf.WriteString("<=")
- buf.WriteString(EscapeFilter(ber.DecodeString(packet.Children[1].Data.Bytes())))
- case FilterPresent:
- buf.WriteString(ber.DecodeString(packet.Data.Bytes()))
- buf.WriteString("=*")
- case FilterApproxMatch:
- buf.WriteString(ber.DecodeString(packet.Children[0].Data.Bytes()))
- buf.WriteString("~=")
- buf.WriteString(EscapeFilter(ber.DecodeString(packet.Children[1].Data.Bytes())))
- case FilterExtensibleMatch:
- attr := ""
- dnAttributes := false
- matchingRule := ""
- value := ""
-
- for _, child := range packet.Children {
- switch child.Tag {
- case MatchingRuleAssertionMatchingRule:
- matchingRule = ber.DecodeString(child.Data.Bytes())
- case MatchingRuleAssertionType:
- attr = ber.DecodeString(child.Data.Bytes())
- case MatchingRuleAssertionMatchValue:
- value = ber.DecodeString(child.Data.Bytes())
- case MatchingRuleAssertionDNAttributes:
- dnAttributes = child.Value.(bool)
- }
- }
-
- if len(attr) > 0 {
- buf.WriteString(attr)
- }
- if dnAttributes {
- buf.WriteString(":dn")
- }
- if len(matchingRule) > 0 {
- buf.WriteString(":")
- buf.WriteString(matchingRule)
- }
- buf.WriteString(":=")
- buf.WriteString(EscapeFilter(value))
- }
-
- buf.WriteByte(')')
-
- return buf.String(), nil
-}
-
-func compileFilterSet(filter string, pos int, parent *ber.Packet) (int, error) {
- for pos < len(filter) && filter[pos] == '(' {
- child, newPos, err := compileFilter(filter, pos+1)
- if err != nil {
- return pos, err
- }
- pos = newPos
- parent.AppendChild(child)
- }
- if pos == len(filter) {
- return pos, NewError(ErrorFilterCompile, errors.New("ldap: unexpected end of filter"))
- }
-
- return pos + 1, nil
-}
-
-func compileFilter(filter string, pos int) (*ber.Packet, int, error) {
- var (
- packet *ber.Packet
- err error
- )
-
- defer func() {
- if r := recover(); r != nil {
- err = NewError(ErrorFilterCompile, errors.New("ldap: error compiling filter"))
- }
- }()
- newPos := pos
-
- currentRune, currentWidth := utf8.DecodeRuneInString(filter[newPos:])
-
- switch currentRune {
- case utf8.RuneError:
- return nil, 0, NewError(ErrorFilterCompile, fmt.Errorf("ldap: error reading rune at position %d", newPos))
- case '(':
- packet, newPos, err = compileFilter(filter, pos+currentWidth)
- newPos++
- return packet, newPos, err
- case '&':
- packet = ber.Encode(ber.ClassContext, ber.TypeConstructed, FilterAnd, nil, FilterMap[FilterAnd])
- newPos, err = compileFilterSet(filter, pos+currentWidth, packet)
- return packet, newPos, err
- case '|':
- packet = ber.Encode(ber.ClassContext, ber.TypeConstructed, FilterOr, nil, FilterMap[FilterOr])
- newPos, err = compileFilterSet(filter, pos+currentWidth, packet)
- return packet, newPos, err
- case '!':
- packet = ber.Encode(ber.ClassContext, ber.TypeConstructed, FilterNot, nil, FilterMap[FilterNot])
- var child *ber.Packet
- child, newPos, err = compileFilter(filter, pos+currentWidth)
- packet.AppendChild(child)
- return packet, newPos, err
- default:
- const (
- stateReadingAttr = 0
- stateReadingExtensibleMatchingRule = 1
- stateReadingCondition = 2
- )
-
- state := stateReadingAttr
- attribute := bytes.NewBuffer(nil)
- extensibleDNAttributes := false
- extensibleMatchingRule := bytes.NewBuffer(nil)
- condition := bytes.NewBuffer(nil)
-
- for newPos < len(filter) {
- remainingFilter := filter[newPos:]
- currentRune, currentWidth = utf8.DecodeRuneInString(remainingFilter)
- if currentRune == ')' {
- break
- }
- if currentRune == utf8.RuneError {
- return packet, newPos, NewError(ErrorFilterCompile, fmt.Errorf("ldap: error reading rune at position %d", newPos))
- }
-
- switch state {
- case stateReadingAttr:
- switch {
- // Extensible rule, with only DN-matching
- case currentRune == ':' && strings.HasPrefix(remainingFilter, ":dn:="):
- packet = ber.Encode(ber.ClassContext, ber.TypeConstructed, FilterExtensibleMatch, nil, FilterMap[FilterExtensibleMatch])
- extensibleDNAttributes = true
- state = stateReadingCondition
- newPos += 5
-
- // Extensible rule, with DN-matching and a matching OID
- case currentRune == ':' && strings.HasPrefix(remainingFilter, ":dn:"):
- packet = ber.Encode(ber.ClassContext, ber.TypeConstructed, FilterExtensibleMatch, nil, FilterMap[FilterExtensibleMatch])
- extensibleDNAttributes = true
- state = stateReadingExtensibleMatchingRule
- newPos += 4
-
- // Extensible rule, with attr only
- case currentRune == ':' && strings.HasPrefix(remainingFilter, ":="):
- packet = ber.Encode(ber.ClassContext, ber.TypeConstructed, FilterExtensibleMatch, nil, FilterMap[FilterExtensibleMatch])
- state = stateReadingCondition
- newPos += 2
-
- // Extensible rule, with no DN attribute matching
- case currentRune == ':':
- packet = ber.Encode(ber.ClassContext, ber.TypeConstructed, FilterExtensibleMatch, nil, FilterMap[FilterExtensibleMatch])
- state = stateReadingExtensibleMatchingRule
- newPos++
-
- // Equality condition
- case currentRune == '=':
- packet = ber.Encode(ber.ClassContext, ber.TypeConstructed, FilterEqualityMatch, nil, FilterMap[FilterEqualityMatch])
- state = stateReadingCondition
- newPos++
-
- // Greater-than or equal
- case currentRune == '>' && strings.HasPrefix(remainingFilter, ">="):
- packet = ber.Encode(ber.ClassContext, ber.TypeConstructed, FilterGreaterOrEqual, nil, FilterMap[FilterGreaterOrEqual])
- state = stateReadingCondition
- newPos += 2
-
- // Less-than or equal
- case currentRune == '<' && strings.HasPrefix(remainingFilter, "<="):
- packet = ber.Encode(ber.ClassContext, ber.TypeConstructed, FilterLessOrEqual, nil, FilterMap[FilterLessOrEqual])
- state = stateReadingCondition
- newPos += 2
-
- // Approx
- case currentRune == '~' && strings.HasPrefix(remainingFilter, "~="):
- packet = ber.Encode(ber.ClassContext, ber.TypeConstructed, FilterApproxMatch, nil, FilterMap[FilterApproxMatch])
- state = stateReadingCondition
- newPos += 2
-
- // Still reading the attribute name
- default:
- attribute.WriteRune(currentRune)
- newPos += currentWidth
- }
-
- case stateReadingExtensibleMatchingRule:
- switch {
-
- // Matching rule OID is done
- case currentRune == ':' && strings.HasPrefix(remainingFilter, ":="):
- state = stateReadingCondition
- newPos += 2
-
- // Still reading the matching rule oid
- default:
- extensibleMatchingRule.WriteRune(currentRune)
- newPos += currentWidth
- }
-
- case stateReadingCondition:
- // append to the condition
- condition.WriteRune(currentRune)
- newPos += currentWidth
- }
- }
-
- if newPos == len(filter) {
- err = NewError(ErrorFilterCompile, errors.New("ldap: unexpected end of filter"))
- return packet, newPos, err
- }
- if packet == nil {
- err = NewError(ErrorFilterCompile, errors.New("ldap: error parsing filter"))
- return packet, newPos, err
- }
-
- switch {
- case packet.Tag == FilterExtensibleMatch:
- // MatchingRuleAssertion ::= SEQUENCE {
- // matchingRule [1] MatchingRuleID OPTIONAL,
- // type [2] AttributeDescription OPTIONAL,
- // matchValue [3] AssertionValue,
- // dnAttributes [4] BOOLEAN DEFAULT FALSE
- // }
-
- // Include the matching rule oid, if specified
- if extensibleMatchingRule.Len() > 0 {
- packet.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, MatchingRuleAssertionMatchingRule, extensibleMatchingRule.String(), MatchingRuleAssertionMap[MatchingRuleAssertionMatchingRule]))
- }
-
- // Include the attribute, if specified
- if attribute.Len() > 0 {
- packet.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, MatchingRuleAssertionType, attribute.String(), MatchingRuleAssertionMap[MatchingRuleAssertionType]))
- }
-
- // Add the value (only required child)
- encodedString, encodeErr := decodeEscapedSymbols(condition.Bytes())
- if encodeErr != nil {
- return packet, newPos, encodeErr
- }
- packet.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, MatchingRuleAssertionMatchValue, encodedString, MatchingRuleAssertionMap[MatchingRuleAssertionMatchValue]))
-
- // Defaults to false, so only include in the sequence if true
- if extensibleDNAttributes {
- packet.AppendChild(ber.NewBoolean(ber.ClassContext, ber.TypePrimitive, MatchingRuleAssertionDNAttributes, extensibleDNAttributes, MatchingRuleAssertionMap[MatchingRuleAssertionDNAttributes]))
- }
-
- case packet.Tag == FilterEqualityMatch && bytes.Equal(condition.Bytes(), _SymbolAny):
- packet = ber.NewString(ber.ClassContext, ber.TypePrimitive, FilterPresent, attribute.String(), FilterMap[FilterPresent])
- case packet.Tag == FilterEqualityMatch && bytes.Index(condition.Bytes(), _SymbolAny) > -1:
- packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, attribute.String(), "Attribute"))
- packet.Tag = FilterSubstrings
- packet.Description = FilterMap[uint64(packet.Tag)]
- seq := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Substrings")
- parts := bytes.Split(condition.Bytes(), _SymbolAny)
- for i, part := range parts {
- if len(part) == 0 {
- continue
- }
- var tag ber.Tag
- switch i {
- case 0:
- tag = FilterSubstringsInitial
- case len(parts) - 1:
- tag = FilterSubstringsFinal
- default:
- tag = FilterSubstringsAny
- }
- encodedString, encodeErr := decodeEscapedSymbols(part)
- if encodeErr != nil {
- return packet, newPos, encodeErr
- }
- seq.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, tag, encodedString, FilterSubstringsMap[uint64(tag)]))
- }
- packet.AppendChild(seq)
- default:
- encodedString, encodeErr := decodeEscapedSymbols(condition.Bytes())
- if encodeErr != nil {
- return packet, newPos, encodeErr
- }
- packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, attribute.String(), "Attribute"))
- packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, encodedString, "Condition"))
- }
-
- newPos += currentWidth
- return packet, newPos, err
- }
-}
-
-// Convert from "ABC\xx\xx\xx" form to literal bytes for transport
-func decodeEscapedSymbols(src []byte) (string, error) {
-
- var (
- buffer bytes.Buffer
- offset int
- reader = bytes.NewReader(src)
- byteHex []byte
- byteVal []byte
- )
-
- for {
- runeVal, runeSize, err := reader.ReadRune()
- if err == io.EOF {
- return buffer.String(), nil
- } else if err != nil {
- return "", NewError(ErrorFilterCompile, fmt.Errorf("ldap: failed to read filter: %v", err))
- } else if runeVal == unicode.ReplacementChar {
- return "", NewError(ErrorFilterCompile, fmt.Errorf("ldap: error reading rune at position %d", offset))
- }
-
- if runeVal == '\\' {
- // http://tools.ietf.org/search/rfc4515
- // \ (%x5C) is not a valid character unless it is followed by two HEX characters due to not
- // being a member of UTF1SUBSET.
- if byteHex == nil {
- byteHex = make([]byte, 2)
- byteVal = make([]byte, 1)
- }
-
- if _, err := io.ReadFull(reader, byteHex); err != nil {
- if err == io.ErrUnexpectedEOF {
- return "", NewError(ErrorFilterCompile, errors.New("ldap: missing characters for escape in filter"))
- }
- return "", NewError(ErrorFilterCompile, fmt.Errorf("ldap: invalid characters for escape in filter: %v", err))
- }
-
- if _, err := hexpac.Decode(byteVal, byteHex); err != nil {
- return "", NewError(ErrorFilterCompile, fmt.Errorf("ldap: invalid characters for escape in filter: %v", err))
- }
-
- buffer.Write(byteVal)
- } else {
- buffer.WriteRune(runeVal)
- }
-
- offset += runeSize
- }
-}
diff --git a/vendor/github.com/go-ldap/ldap/v3/ldap.go b/vendor/github.com/go-ldap/ldap/v3/ldap.go
deleted file mode 100644
index 7ae6dfe2cc..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/ldap.go
+++ /dev/null
@@ -1,339 +0,0 @@
-package ldap
-
-import (
- "fmt"
- "io/ioutil"
- "os"
-
- ber "github.com/go-asn1-ber/asn1-ber"
-)
-
-// LDAP Application Codes
-const (
- ApplicationBindRequest = 0
- ApplicationBindResponse = 1
- ApplicationUnbindRequest = 2
- ApplicationSearchRequest = 3
- ApplicationSearchResultEntry = 4
- ApplicationSearchResultDone = 5
- ApplicationModifyRequest = 6
- ApplicationModifyResponse = 7
- ApplicationAddRequest = 8
- ApplicationAddResponse = 9
- ApplicationDelRequest = 10
- ApplicationDelResponse = 11
- ApplicationModifyDNRequest = 12
- ApplicationModifyDNResponse = 13
- ApplicationCompareRequest = 14
- ApplicationCompareResponse = 15
- ApplicationAbandonRequest = 16
- ApplicationSearchResultReference = 19
- ApplicationExtendedRequest = 23
- ApplicationExtendedResponse = 24
-)
-
-// ApplicationMap contains human readable descriptions of LDAP Application Codes
-var ApplicationMap = map[uint8]string{
- ApplicationBindRequest: "Bind Request",
- ApplicationBindResponse: "Bind Response",
- ApplicationUnbindRequest: "Unbind Request",
- ApplicationSearchRequest: "Search Request",
- ApplicationSearchResultEntry: "Search Result Entry",
- ApplicationSearchResultDone: "Search Result Done",
- ApplicationModifyRequest: "Modify Request",
- ApplicationModifyResponse: "Modify Response",
- ApplicationAddRequest: "Add Request",
- ApplicationAddResponse: "Add Response",
- ApplicationDelRequest: "Del Request",
- ApplicationDelResponse: "Del Response",
- ApplicationModifyDNRequest: "Modify DN Request",
- ApplicationModifyDNResponse: "Modify DN Response",
- ApplicationCompareRequest: "Compare Request",
- ApplicationCompareResponse: "Compare Response",
- ApplicationAbandonRequest: "Abandon Request",
- ApplicationSearchResultReference: "Search Result Reference",
- ApplicationExtendedRequest: "Extended Request",
- ApplicationExtendedResponse: "Extended Response",
-}
-
-// Ldap Behera Password Policy Draft 10 (https://tools.ietf.org/html/draft-behera-ldap-password-policy-10)
-const (
- BeheraPasswordExpired = 0
- BeheraAccountLocked = 1
- BeheraChangeAfterReset = 2
- BeheraPasswordModNotAllowed = 3
- BeheraMustSupplyOldPassword = 4
- BeheraInsufficientPasswordQuality = 5
- BeheraPasswordTooShort = 6
- BeheraPasswordTooYoung = 7
- BeheraPasswordInHistory = 8
-)
-
-// BeheraPasswordPolicyErrorMap contains human readable descriptions of Behera Password Policy error codes
-var BeheraPasswordPolicyErrorMap = map[int8]string{
- BeheraPasswordExpired: "Password expired",
- BeheraAccountLocked: "Account locked",
- BeheraChangeAfterReset: "Password must be changed",
- BeheraPasswordModNotAllowed: "Policy prevents password modification",
- BeheraMustSupplyOldPassword: "Policy requires old password in order to change password",
- BeheraInsufficientPasswordQuality: "Password fails quality checks",
- BeheraPasswordTooShort: "Password is too short for policy",
- BeheraPasswordTooYoung: "Password has been changed too recently",
- BeheraPasswordInHistory: "New password is in list of old passwords",
-}
-
-// Adds descriptions to an LDAP Response packet for debugging
-func addLDAPDescriptions(packet *ber.Packet) (err error) {
- defer func() {
- if r := recover(); r != nil {
- err = NewError(ErrorDebugging, fmt.Errorf("ldap: cannot process packet to add descriptions: %s", r))
- }
- }()
- packet.Description = "LDAP Response"
- packet.Children[0].Description = "Message ID"
-
- application := uint8(packet.Children[1].Tag)
- packet.Children[1].Description = ApplicationMap[application]
-
- switch application {
- case ApplicationBindRequest:
- err = addRequestDescriptions(packet)
- case ApplicationBindResponse:
- err = addDefaultLDAPResponseDescriptions(packet)
- case ApplicationUnbindRequest:
- err = addRequestDescriptions(packet)
- case ApplicationSearchRequest:
- err = addRequestDescriptions(packet)
- case ApplicationSearchResultEntry:
- packet.Children[1].Children[0].Description = "Object Name"
- packet.Children[1].Children[1].Description = "Attributes"
- for _, child := range packet.Children[1].Children[1].Children {
- child.Description = "Attribute"
- child.Children[0].Description = "Attribute Name"
- child.Children[1].Description = "Attribute Values"
- for _, grandchild := range child.Children[1].Children {
- grandchild.Description = "Attribute Value"
- }
- }
- if len(packet.Children) == 3 {
- err = addControlDescriptions(packet.Children[2])
- }
- case ApplicationSearchResultDone:
- err = addDefaultLDAPResponseDescriptions(packet)
- case ApplicationModifyRequest:
- err = addRequestDescriptions(packet)
- case ApplicationModifyResponse:
- case ApplicationAddRequest:
- err = addRequestDescriptions(packet)
- case ApplicationAddResponse:
- case ApplicationDelRequest:
- err = addRequestDescriptions(packet)
- case ApplicationDelResponse:
- case ApplicationModifyDNRequest:
- err = addRequestDescriptions(packet)
- case ApplicationModifyDNResponse:
- case ApplicationCompareRequest:
- err = addRequestDescriptions(packet)
- case ApplicationCompareResponse:
- case ApplicationAbandonRequest:
- err = addRequestDescriptions(packet)
- case ApplicationSearchResultReference:
- case ApplicationExtendedRequest:
- err = addRequestDescriptions(packet)
- case ApplicationExtendedResponse:
- }
-
- return err
-}
-
-func addControlDescriptions(packet *ber.Packet) error {
- packet.Description = "Controls"
- for _, child := range packet.Children {
- var value *ber.Packet
- controlType := ""
- child.Description = "Control"
- switch len(child.Children) {
- case 0:
- // at least one child is required for control type
- return fmt.Errorf("at least one child is required for control type")
-
- case 1:
- // just type, no criticality or value
- controlType = child.Children[0].Value.(string)
- child.Children[0].Description = "Control Type (" + ControlTypeMap[controlType] + ")"
-
- case 2:
- controlType = child.Children[0].Value.(string)
- child.Children[0].Description = "Control Type (" + ControlTypeMap[controlType] + ")"
- // Children[1] could be criticality or value (both are optional)
- // duck-type on whether this is a boolean
- if _, ok := child.Children[1].Value.(bool); ok {
- child.Children[1].Description = "Criticality"
- } else {
- child.Children[1].Description = "Control Value"
- value = child.Children[1]
- }
-
- case 3:
- // criticality and value present
- controlType = child.Children[0].Value.(string)
- child.Children[0].Description = "Control Type (" + ControlTypeMap[controlType] + ")"
- child.Children[1].Description = "Criticality"
- child.Children[2].Description = "Control Value"
- value = child.Children[2]
-
- default:
- // more than 3 children is invalid
- return fmt.Errorf("more than 3 children for control packet found")
- }
-
- if value == nil {
- continue
- }
- switch controlType {
- case ControlTypePaging:
- value.Description += " (Paging)"
- if value.Value != nil {
- valueChildren, err := ber.DecodePacketErr(value.Data.Bytes())
- if err != nil {
- return fmt.Errorf("failed to decode data bytes: %s", err)
- }
- value.Data.Truncate(0)
- value.Value = nil
- valueChildren.Children[1].Value = valueChildren.Children[1].Data.Bytes()
- value.AppendChild(valueChildren)
- }
- value.Children[0].Description = "Real Search Control Value"
- value.Children[0].Children[0].Description = "Paging Size"
- value.Children[0].Children[1].Description = "Cookie"
-
- case ControlTypeBeheraPasswordPolicy:
- value.Description += " (Password Policy - Behera Draft)"
- if value.Value != nil {
- valueChildren, err := ber.DecodePacketErr(value.Data.Bytes())
- if err != nil {
- return fmt.Errorf("failed to decode data bytes: %s", err)
- }
- value.Data.Truncate(0)
- value.Value = nil
- value.AppendChild(valueChildren)
- }
- sequence := value.Children[0]
- for _, child := range sequence.Children {
- if child.Tag == 0 {
- //Warning
- warningPacket := child.Children[0]
- val, err := ber.ParseInt64(warningPacket.Data.Bytes())
- if err != nil {
- return fmt.Errorf("failed to decode data bytes: %s", err)
- }
- if warningPacket.Tag == 0 {
- //timeBeforeExpiration
- value.Description += " (TimeBeforeExpiration)"
- warningPacket.Value = val
- } else if warningPacket.Tag == 1 {
- //graceAuthNsRemaining
- value.Description += " (GraceAuthNsRemaining)"
- warningPacket.Value = val
- }
- } else if child.Tag == 1 {
- // Error
- bs := child.Data.Bytes()
- if len(bs) != 1 || bs[0] > 8 {
- return fmt.Errorf("failed to decode data bytes: %s", "invalid PasswordPolicyResponse enum value")
- }
- val := int8(bs[0])
- child.Description = "Error"
- child.Value = val
- }
- }
- }
- }
- return nil
-}
-
-func addRequestDescriptions(packet *ber.Packet) error {
- packet.Description = "LDAP Request"
- packet.Children[0].Description = "Message ID"
- packet.Children[1].Description = ApplicationMap[uint8(packet.Children[1].Tag)]
- if len(packet.Children) == 3 {
- return addControlDescriptions(packet.Children[2])
- }
- return nil
-}
-
-func addDefaultLDAPResponseDescriptions(packet *ber.Packet) error {
- resultCode := uint16(LDAPResultSuccess)
- matchedDN := ""
- description := "Success"
- if err := GetLDAPError(packet); err != nil {
- resultCode = err.(*Error).ResultCode
- matchedDN = err.(*Error).MatchedDN
- description = "Error Message"
- }
-
- packet.Children[1].Children[0].Description = "Result Code (" + LDAPResultCodeMap[resultCode] + ")"
- packet.Children[1].Children[1].Description = "Matched DN (" + matchedDN + ")"
- packet.Children[1].Children[2].Description = description
- if len(packet.Children[1].Children) > 3 {
- packet.Children[1].Children[3].Description = "Referral"
- }
- if len(packet.Children) == 3 {
- return addControlDescriptions(packet.Children[2])
- }
- return nil
-}
-
-// DebugBinaryFile reads and prints packets from the given filename
-func DebugBinaryFile(fileName string) error {
- file, err := ioutil.ReadFile(fileName)
- if err != nil {
- return NewError(ErrorDebugging, err)
- }
- ber.PrintBytes(os.Stdout, file, "")
- packet, err := ber.DecodePacketErr(file)
- if err != nil {
- return fmt.Errorf("failed to decode packet: %s", err)
- }
- if err := addLDAPDescriptions(packet); err != nil {
- return err
- }
- ber.PrintPacket(packet)
-
- return nil
-}
-
-var hex = "0123456789abcdef"
-
-func mustEscape(c byte) bool {
- return c > 0x7f || c == '(' || c == ')' || c == '\\' || c == '*' || c == 0
-}
-
-// EscapeFilter escapes from the provided LDAP filter string the special
-// characters in the set `()*\` and those out of the range 0 < c < 0x80,
-// as defined in RFC4515.
-func EscapeFilter(filter string) string {
- escape := 0
- for i := 0; i < len(filter); i++ {
- if mustEscape(filter[i]) {
- escape++
- }
- }
- if escape == 0 {
- return filter
- }
- buf := make([]byte, len(filter)+escape*2)
- for i, j := 0, 0; i < len(filter); i++ {
- c := filter[i]
- if mustEscape(c) {
- buf[j+0] = '\\'
- buf[j+1] = hex[c>>4]
- buf[j+2] = hex[c&0xf]
- j += 3
- } else {
- buf[j] = c
- j++
- }
- }
- return string(buf)
-}
diff --git a/vendor/github.com/go-ldap/ldap/v3/moddn.go b/vendor/github.com/go-ldap/ldap/v3/moddn.go
deleted file mode 100644
index 71cdcd0ba8..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/moddn.go
+++ /dev/null
@@ -1,100 +0,0 @@
-package ldap
-
-import (
- "log"
-
- ber "github.com/go-asn1-ber/asn1-ber"
-)
-
-// ModifyDNRequest holds the request to modify a DN
-type ModifyDNRequest struct {
- DN string
- NewRDN string
- DeleteOldRDN bool
- NewSuperior string
- // Controls hold optional controls to send with the request
- Controls []Control
-}
-
-// NewModifyDNRequest creates a new request which can be passed to ModifyDN().
-//
-// To move an object in the tree, set the "newSup" to the new parent entry DN. Use an
-// empty string for just changing the object's RDN.
-//
-// For moving the object without renaming, the "rdn" must be the first
-// RDN of the given DN.
-//
-// A call like
-// mdnReq := NewModifyDNRequest("uid=someone,dc=example,dc=org", "uid=newname", true, "")
-// will setup the request to just rename uid=someone,dc=example,dc=org to
-// uid=newname,dc=example,dc=org.
-func NewModifyDNRequest(dn string, rdn string, delOld bool, newSup string) *ModifyDNRequest {
- return &ModifyDNRequest{
- DN: dn,
- NewRDN: rdn,
- DeleteOldRDN: delOld,
- NewSuperior: newSup,
- }
-}
-
-// NewModifyDNWithControlsRequest creates a new request which can be passed to ModifyDN()
-// and also allows setting LDAP request controls.
-//
-// Refer NewModifyDNRequest for other parameters
-func NewModifyDNWithControlsRequest(dn string, rdn string, delOld bool,
- newSup string, controls []Control) *ModifyDNRequest {
- return &ModifyDNRequest{
- DN: dn,
- NewRDN: rdn,
- DeleteOldRDN: delOld,
- NewSuperior: newSup,
- Controls: controls,
- }
-}
-
-func (req *ModifyDNRequest) appendTo(envelope *ber.Packet) error {
- pkt := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationModifyDNRequest, nil, "Modify DN Request")
- pkt.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, req.DN, "DN"))
- pkt.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, req.NewRDN, "New RDN"))
- if req.DeleteOldRDN {
- buf := []byte{0xff}
- pkt.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagBoolean, string(buf), "Delete old RDN"))
- } else {
- pkt.AppendChild(ber.NewBoolean(ber.ClassUniversal, ber.TypePrimitive, ber.TagBoolean, req.DeleteOldRDN, "Delete old RDN"))
- }
- if req.NewSuperior != "" {
- pkt.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 0, req.NewSuperior, "New Superior"))
- }
-
- envelope.AppendChild(pkt)
- if len(req.Controls) > 0 {
- envelope.AppendChild(encodeControls(req.Controls))
- }
-
- return nil
-}
-
-// ModifyDN renames the given DN and optionally move to another base (when the "newSup" argument
-// to NewModifyDNRequest() is not "").
-func (l *Conn) ModifyDN(m *ModifyDNRequest) error {
- msgCtx, err := l.doRequest(m)
- if err != nil {
- return err
- }
- defer l.finishMessage(msgCtx)
-
- packet, err := l.readPacket(msgCtx)
- if err != nil {
- return err
- }
-
- if packet.Children[1].Tag == ApplicationModifyDNResponse {
- err := GetLDAPError(packet)
- if err != nil {
- return err
- }
- } else {
- log.Printf("Unexpected Response: %d", packet.Children[1].Tag)
- }
- return nil
-}
diff --git a/vendor/github.com/go-ldap/ldap/v3/modify.go b/vendor/github.com/go-ldap/ldap/v3/modify.go
deleted file mode 100644
index 1821413de9..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/modify.go
+++ /dev/null
@@ -1,177 +0,0 @@
-package ldap
-
-import (
- "errors"
- "log"
-
- ber "github.com/go-asn1-ber/asn1-ber"
-)
-
-// Change operation choices
-const (
- AddAttribute = 0
- DeleteAttribute = 1
- ReplaceAttribute = 2
- IncrementAttribute = 3 // (https://tools.ietf.org/html/rfc4525)
-)
-
-// PartialAttribute for a ModifyRequest as defined in https://tools.ietf.org/html/rfc4511
-type PartialAttribute struct {
- // Type is the type of the partial attribute
- Type string
- // Vals are the values of the partial attribute
- Vals []string
-}
-
-func (p *PartialAttribute) encode() *ber.Packet {
- seq := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "PartialAttribute")
- seq.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, p.Type, "Type"))
- set := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSet, nil, "AttributeValue")
- for _, value := range p.Vals {
- set.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, value, "Vals"))
- }
- seq.AppendChild(set)
- return seq
-}
-
-// Change for a ModifyRequest as defined in https://tools.ietf.org/html/rfc4511
-type Change struct {
- // Operation is the type of change to be made
- Operation uint
- // Modification is the attribute to be modified
- Modification PartialAttribute
-}
-
-func (c *Change) encode() *ber.Packet {
- change := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Change")
- change.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagEnumerated, uint64(c.Operation), "Operation"))
- change.AppendChild(c.Modification.encode())
- return change
-}
-
-// ModifyRequest as defined in https://tools.ietf.org/html/rfc4511
-type ModifyRequest struct {
- // DN is the distinguishedName of the directory entry to modify
- DN string
- // Changes contain the attributes to modify
- Changes []Change
- // Controls hold optional controls to send with the request
- Controls []Control
-}
-
-// Add appends the given attribute to the list of changes to be made
-func (req *ModifyRequest) Add(attrType string, attrVals []string) {
- req.appendChange(AddAttribute, attrType, attrVals)
-}
-
-// Delete appends the given attribute to the list of changes to be made
-func (req *ModifyRequest) Delete(attrType string, attrVals []string) {
- req.appendChange(DeleteAttribute, attrType, attrVals)
-}
-
-// Replace appends the given attribute to the list of changes to be made
-func (req *ModifyRequest) Replace(attrType string, attrVals []string) {
- req.appendChange(ReplaceAttribute, attrType, attrVals)
-}
-
-// Increment appends the given attribute to the list of changes to be made
-func (req *ModifyRequest) Increment(attrType string, attrVal string) {
- req.appendChange(IncrementAttribute, attrType, []string{attrVal})
-}
-
-func (req *ModifyRequest) appendChange(operation uint, attrType string, attrVals []string) {
- req.Changes = append(req.Changes, Change{operation, PartialAttribute{Type: attrType, Vals: attrVals}})
-}
-
-func (req *ModifyRequest) appendTo(envelope *ber.Packet) error {
- pkt := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationModifyRequest, nil, "Modify Request")
- pkt.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, req.DN, "DN"))
- changes := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Changes")
- for _, change := range req.Changes {
- changes.AppendChild(change.encode())
- }
- pkt.AppendChild(changes)
-
- envelope.AppendChild(pkt)
- if len(req.Controls) > 0 {
- envelope.AppendChild(encodeControls(req.Controls))
- }
-
- return nil
-}
-
-// NewModifyRequest creates a modify request for the given DN
-func NewModifyRequest(dn string, controls []Control) *ModifyRequest {
- return &ModifyRequest{
- DN: dn,
- Controls: controls,
- }
-}
-
-// Modify performs the ModifyRequest
-func (l *Conn) Modify(modifyRequest *ModifyRequest) error {
- msgCtx, err := l.doRequest(modifyRequest)
- if err != nil {
- return err
- }
- defer l.finishMessage(msgCtx)
-
- packet, err := l.readPacket(msgCtx)
- if err != nil {
- return err
- }
-
- if packet.Children[1].Tag == ApplicationModifyResponse {
- err := GetLDAPError(packet)
- if err != nil {
- return err
- }
- } else {
- log.Printf("Unexpected Response: %d", packet.Children[1].Tag)
- }
- return nil
-}
-
-// ModifyResult holds the server's response to a modify request
-type ModifyResult struct {
- // Controls are the returned controls
- Controls []Control
-}
-
-// ModifyWithResult performs the ModifyRequest and returns the result
-func (l *Conn) ModifyWithResult(modifyRequest *ModifyRequest) (*ModifyResult, error) {
- msgCtx, err := l.doRequest(modifyRequest)
- if err != nil {
- return nil, err
- }
- defer l.finishMessage(msgCtx)
-
- result := &ModifyResult{
- Controls: make([]Control, 0),
- }
-
- l.Debug.Printf("%d: waiting for response", msgCtx.id)
- packet, err := l.readPacket(msgCtx)
- if err != nil {
- return nil, err
- }
-
- switch packet.Children[1].Tag {
- case ApplicationModifyResponse:
- err := GetLDAPError(packet)
- if err != nil {
- return nil, err
- }
- if len(packet.Children) == 3 {
- for _, child := range packet.Children[2].Children {
- decodedChild, err := DecodeControl(child)
- if err != nil {
- return nil, errors.New("failed to decode child control: " + err.Error())
- }
- result.Controls = append(result.Controls, decodedChild)
- }
- }
- }
- l.Debug.Printf("%d: returning", msgCtx.id)
- return result, nil
-}
diff --git a/vendor/github.com/go-ldap/ldap/v3/passwdmodify.go b/vendor/github.com/go-ldap/ldap/v3/passwdmodify.go
deleted file mode 100644
index 62a110843d..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/passwdmodify.go
+++ /dev/null
@@ -1,126 +0,0 @@
-package ldap
-
-import (
- "fmt"
-
- ber "github.com/go-asn1-ber/asn1-ber"
-)
-
-const (
- passwordModifyOID = "1.3.6.1.4.1.4203.1.11.1"
-)
-
-// PasswordModifyRequest implements the Password Modify Extended Operation as defined in https://www.ietf.org/rfc/rfc3062.txt
-type PasswordModifyRequest struct {
- // UserIdentity is an optional string representation of the user associated with the request.
- // This string may or may not be an LDAPDN [RFC2253].
- // If no UserIdentity field is present, the request acts up upon the password of the user currently associated with the LDAP session
- UserIdentity string
- // OldPassword, if present, contains the user's current password
- OldPassword string
- // NewPassword, if present, contains the desired password for this user
- NewPassword string
-}
-
-// PasswordModifyResult holds the server response to a PasswordModifyRequest
-type PasswordModifyResult struct {
- // GeneratedPassword holds a password generated by the server, if present
- GeneratedPassword string
- // Referral are the returned referral
- Referral string
-}
-
-func (req *PasswordModifyRequest) appendTo(envelope *ber.Packet) error {
- pkt := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationExtendedRequest, nil, "Password Modify Extended Operation")
- pkt.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 0, passwordModifyOID, "Extended Request Name: Password Modify OID"))
-
- extendedRequestValue := ber.Encode(ber.ClassContext, ber.TypePrimitive, 1, nil, "Extended Request Value: Password Modify Request")
- passwordModifyRequestValue := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Password Modify Request")
- if req.UserIdentity != "" {
- passwordModifyRequestValue.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 0, req.UserIdentity, "User Identity"))
- }
- if req.OldPassword != "" {
- passwordModifyRequestValue.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 1, req.OldPassword, "Old Password"))
- }
- if req.NewPassword != "" {
- passwordModifyRequestValue.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 2, req.NewPassword, "New Password"))
- }
- extendedRequestValue.AppendChild(passwordModifyRequestValue)
-
- pkt.AppendChild(extendedRequestValue)
-
- envelope.AppendChild(pkt)
-
- return nil
-}
-
-// NewPasswordModifyRequest creates a new PasswordModifyRequest
-//
-// According to the RFC 3602 (https://tools.ietf.org/html/rfc3062):
-// userIdentity is a string representing the user associated with the request.
-// This string may or may not be an LDAPDN (RFC 2253).
-// If userIdentity is empty then the operation will act on the user associated
-// with the session.
-//
-// oldPassword is the current user's password, it can be empty or it can be
-// needed depending on the session user access rights (usually an administrator
-// can change a user's password without knowing the current one) and the
-// password policy (see pwdSafeModify password policy's attribute)
-//
-// newPassword is the desired user's password. If empty the server can return
-// an error or generate a new password that will be available in the
-// PasswordModifyResult.GeneratedPassword
-//
-func NewPasswordModifyRequest(userIdentity string, oldPassword string, newPassword string) *PasswordModifyRequest {
- return &PasswordModifyRequest{
- UserIdentity: userIdentity,
- OldPassword: oldPassword,
- NewPassword: newPassword,
- }
-}
-
-// PasswordModify performs the modification request
-func (l *Conn) PasswordModify(passwordModifyRequest *PasswordModifyRequest) (*PasswordModifyResult, error) {
- msgCtx, err := l.doRequest(passwordModifyRequest)
- if err != nil {
- return nil, err
- }
- defer l.finishMessage(msgCtx)
-
- packet, err := l.readPacket(msgCtx)
- if err != nil {
- return nil, err
- }
-
- result := &PasswordModifyResult{}
-
- if packet.Children[1].Tag == ApplicationExtendedResponse {
- err := GetLDAPError(packet)
- if err != nil {
- if IsErrorWithCode(err, LDAPResultReferral) {
- for _, child := range packet.Children[1].Children {
- if child.Tag == 3 {
- result.Referral = child.Children[0].Value.(string)
- }
- }
- }
- return result, err
- }
- } else {
- return nil, NewError(ErrorUnexpectedResponse, fmt.Errorf("unexpected Response: %d", packet.Children[1].Tag))
- }
-
- extendedResponse := packet.Children[1]
- for _, child := range extendedResponse.Children {
- if child.Tag == 11 {
- passwordModifyResponseValue := ber.DecodePacket(child.Data.Bytes())
- if len(passwordModifyResponseValue.Children) == 1 {
- if passwordModifyResponseValue.Children[0].Tag == 0 {
- result.GeneratedPassword = ber.DecodeString(passwordModifyResponseValue.Children[0].Data.Bytes())
- }
- }
- }
- }
-
- return result, nil
-}
diff --git a/vendor/github.com/go-ldap/ldap/v3/request.go b/vendor/github.com/go-ldap/ldap/v3/request.go
deleted file mode 100644
index 4ea31e9040..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/request.go
+++ /dev/null
@@ -1,71 +0,0 @@
-package ldap
-
-import (
- "errors"
-
- ber "github.com/go-asn1-ber/asn1-ber"
-)
-
-var (
- errRespChanClosed = errors.New("ldap: response channel closed")
- errCouldNotRetMsg = errors.New("ldap: could not retrieve message")
- ErrNilConnection = errors.New("ldap: conn is nil, expected net.Conn")
-)
-
-type request interface {
- appendTo(*ber.Packet) error
-}
-
-type requestFunc func(*ber.Packet) error
-
-func (f requestFunc) appendTo(p *ber.Packet) error {
- return f(p)
-}
-
-func (l *Conn) doRequest(req request) (*messageContext, error) {
- if l == nil || l.conn == nil {
- return nil, ErrNilConnection
- }
-
- packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "LDAP Request")
- packet.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, l.nextMessageID(), "MessageID"))
- if err := req.appendTo(packet); err != nil {
- return nil, err
- }
-
- if l.Debug {
- l.Debug.PrintPacket(packet)
- }
-
- msgCtx, err := l.sendMessage(packet)
- if err != nil {
- return nil, err
- }
- l.Debug.Printf("%d: returning", msgCtx.id)
- return msgCtx, nil
-}
-
-func (l *Conn) readPacket(msgCtx *messageContext) (*ber.Packet, error) {
- l.Debug.Printf("%d: waiting for response", msgCtx.id)
- packetResponse, ok := <-msgCtx.responses
- if !ok {
- return nil, NewError(ErrorNetwork, errRespChanClosed)
- }
- packet, err := packetResponse.ReadPacket()
- l.Debug.Printf("%d: got response %p", msgCtx.id, packet)
- if err != nil {
- return nil, err
- }
-
- if packet == nil {
- return nil, NewError(ErrorNetwork, errCouldNotRetMsg)
- }
-
- if l.Debug {
- if err = addLDAPDescriptions(packet); err != nil {
- return nil, err
- }
- l.Debug.PrintPacket(packet)
- }
- return packet, nil
-}
diff --git a/vendor/github.com/go-ldap/ldap/v3/search.go b/vendor/github.com/go-ldap/ldap/v3/search.go
deleted file mode 100644
index 915e420384..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/search.go
+++ /dev/null
@@ -1,427 +0,0 @@
-package ldap
-
-import (
- "errors"
- "fmt"
- "sort"
- "strings"
-
- ber "github.com/go-asn1-ber/asn1-ber"
-)
-
-// scope choices
-const (
- ScopeBaseObject = 0
- ScopeSingleLevel = 1
- ScopeWholeSubtree = 2
-)
-
-// ScopeMap contains human readable descriptions of scope choices
-var ScopeMap = map[int]string{
- ScopeBaseObject: "Base Object",
- ScopeSingleLevel: "Single Level",
- ScopeWholeSubtree: "Whole Subtree",
-}
-
-// derefAliases
-const (
- NeverDerefAliases = 0
- DerefInSearching = 1
- DerefFindingBaseObj = 2
- DerefAlways = 3
-)
-
-// DerefMap contains human readable descriptions of derefAliases choices
-var DerefMap = map[int]string{
- NeverDerefAliases: "NeverDerefAliases",
- DerefInSearching: "DerefInSearching",
- DerefFindingBaseObj: "DerefFindingBaseObj",
- DerefAlways: "DerefAlways",
-}
-
-// NewEntry returns an Entry object with the specified distinguished name and attribute key-value pairs.
-// The map of attributes is accessed in alphabetical order of the keys in order to ensure that, for the
-// same input map of attributes, the output entry will contain the same order of attributes
-func NewEntry(dn string, attributes map[string][]string) *Entry {
- var attributeNames []string
- for attributeName := range attributes {
- attributeNames = append(attributeNames, attributeName)
- }
- sort.Strings(attributeNames)
-
- var encodedAttributes []*EntryAttribute
- for _, attributeName := range attributeNames {
- encodedAttributes = append(encodedAttributes, NewEntryAttribute(attributeName, attributes[attributeName]))
- }
- return &Entry{
- DN: dn,
- Attributes: encodedAttributes,
- }
-}
-
-// Entry represents a single search result entry
-type Entry struct {
- // DN is the distinguished name of the entry
- DN string
- // Attributes are the returned attributes for the entry
- Attributes []*EntryAttribute
-}
-
-// GetAttributeValues returns the values for the named attribute, or an empty list
-func (e *Entry) GetAttributeValues(attribute string) []string {
- for _, attr := range e.Attributes {
- if attr.Name == attribute {
- return attr.Values
- }
- }
- return []string{}
-}
-
-// GetEqualFoldAttributeValues returns the values for the named attribute, or an
-// empty list. Attribute matching is done with strings.EqualFold.
-func (e *Entry) GetEqualFoldAttributeValues(attribute string) []string {
- for _, attr := range e.Attributes {
- if strings.EqualFold(attribute, attr.Name) {
- return attr.Values
- }
- }
- return []string{}
-}
-
-// GetRawAttributeValues returns the byte values for the named attribute, or an empty list
-func (e *Entry) GetRawAttributeValues(attribute string) [][]byte {
- for _, attr := range e.Attributes {
- if attr.Name == attribute {
- return attr.ByteValues
- }
- }
- return [][]byte{}
-}
-
-// GetEqualFoldRawAttributeValues returns the byte values for the named attribute, or an empty list
-func (e *Entry) GetEqualFoldRawAttributeValues(attribute string) [][]byte {
- for _, attr := range e.Attributes {
- if strings.EqualFold(attr.Name, attribute) {
- return attr.ByteValues
- }
- }
- return [][]byte{}
-}
-
-// GetAttributeValue returns the first value for the named attribute, or ""
-func (e *Entry) GetAttributeValue(attribute string) string {
- values := e.GetAttributeValues(attribute)
- if len(values) == 0 {
- return ""
- }
- return values[0]
-}
-
-// GetEqualFoldAttributeValue returns the first value for the named attribute, or "".
-// Attribute comparison is done with strings.EqualFold.
-func (e *Entry) GetEqualFoldAttributeValue(attribute string) string {
- values := e.GetEqualFoldAttributeValues(attribute)
- if len(values) == 0 {
- return ""
- }
- return values[0]
-}
-
-// GetRawAttributeValue returns the first value for the named attribute, or an empty slice
-func (e *Entry) GetRawAttributeValue(attribute string) []byte {
- values := e.GetRawAttributeValues(attribute)
- if len(values) == 0 {
- return []byte{}
- }
- return values[0]
-}
-
-// GetEqualFoldRawAttributeValue returns the first value for the named attribute, or an empty slice
-func (e *Entry) GetEqualFoldRawAttributeValue(attribute string) []byte {
- values := e.GetEqualFoldRawAttributeValues(attribute)
- if len(values) == 0 {
- return []byte{}
- }
- return values[0]
-}
-
-// Print outputs a human-readable description
-func (e *Entry) Print() {
- fmt.Printf("DN: %s\n", e.DN)
- for _, attr := range e.Attributes {
- attr.Print()
- }
-}
-
-// PrettyPrint outputs a human-readable description indenting
-func (e *Entry) PrettyPrint(indent int) {
- fmt.Printf("%sDN: %s\n", strings.Repeat(" ", indent), e.DN)
- for _, attr := range e.Attributes {
- attr.PrettyPrint(indent + 2)
- }
-}
-
-// NewEntryAttribute returns a new EntryAttribute with the desired key-value pair
-func NewEntryAttribute(name string, values []string) *EntryAttribute {
- var bytes [][]byte
- for _, value := range values {
- bytes = append(bytes, []byte(value))
- }
- return &EntryAttribute{
- Name: name,
- Values: values,
- ByteValues: bytes,
- }
-}
-
-// EntryAttribute holds a single attribute
-type EntryAttribute struct {
- // Name is the name of the attribute
- Name string
- // Values contain the string values of the attribute
- Values []string
- // ByteValues contain the raw values of the attribute
- ByteValues [][]byte
-}
-
-// Print outputs a human-readable description
-func (e *EntryAttribute) Print() {
- fmt.Printf("%s: %s\n", e.Name, e.Values)
-}
-
-// PrettyPrint outputs a human-readable description with indenting
-func (e *EntryAttribute) PrettyPrint(indent int) {
- fmt.Printf("%s%s: %s\n", strings.Repeat(" ", indent), e.Name, e.Values)
-}
-
-// SearchResult holds the server's response to a search request
-type SearchResult struct {
- // Entries are the returned entries
- Entries []*Entry
- // Referrals are the returned referrals
- Referrals []string
- // Controls are the returned controls
- Controls []Control
-}
-
-// Print outputs a human-readable description
-func (s *SearchResult) Print() {
- for _, entry := range s.Entries {
- entry.Print()
- }
-}
-
-// PrettyPrint outputs a human-readable description with indenting
-func (s *SearchResult) PrettyPrint(indent int) {
- for _, entry := range s.Entries {
- entry.PrettyPrint(indent)
- }
-}
-
-// SearchRequest represents a search request to send to the server
-type SearchRequest struct {
- BaseDN string
- Scope int
- DerefAliases int
- SizeLimit int
- TimeLimit int
- TypesOnly bool
- Filter string
- Attributes []string
- Controls []Control
-}
-
-func (req *SearchRequest) appendTo(envelope *ber.Packet) error {
- pkt := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationSearchRequest, nil, "Search Request")
- pkt.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, req.BaseDN, "Base DN"))
- pkt.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagEnumerated, uint64(req.Scope), "Scope"))
- pkt.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagEnumerated, uint64(req.DerefAliases), "Deref Aliases"))
- pkt.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, uint64(req.SizeLimit), "Size Limit"))
- pkt.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, uint64(req.TimeLimit), "Time Limit"))
- pkt.AppendChild(ber.NewBoolean(ber.ClassUniversal, ber.TypePrimitive, ber.TagBoolean, req.TypesOnly, "Types Only"))
- // compile and encode filter
- filterPacket, err := CompileFilter(req.Filter)
- if err != nil {
- return err
- }
- pkt.AppendChild(filterPacket)
- // encode attributes
- attributesPacket := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Attributes")
- for _, attribute := range req.Attributes {
- attributesPacket.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, attribute, "Attribute"))
- }
- pkt.AppendChild(attributesPacket)
-
- envelope.AppendChild(pkt)
- if len(req.Controls) > 0 {
- envelope.AppendChild(encodeControls(req.Controls))
- }
-
- return nil
-}
-
-// NewSearchRequest creates a new search request
-func NewSearchRequest(
- BaseDN string,
- Scope, DerefAliases, SizeLimit, TimeLimit int,
- TypesOnly bool,
- Filter string,
- Attributes []string,
- Controls []Control,
-) *SearchRequest {
- return &SearchRequest{
- BaseDN: BaseDN,
- Scope: Scope,
- DerefAliases: DerefAliases,
- SizeLimit: SizeLimit,
- TimeLimit: TimeLimit,
- TypesOnly: TypesOnly,
- Filter: Filter,
- Attributes: Attributes,
- Controls: Controls,
- }
-}
-
-// SearchWithPaging accepts a search request and desired page size in order to execute LDAP queries to fulfill the
-// search request. All paged LDAP query responses will be buffered and the final result will be returned atomically.
-// The following four cases are possible given the arguments:
-// - given SearchRequest missing a control of type ControlTypePaging: we will add one with the desired paging size
-// - given SearchRequest contains a control of type ControlTypePaging that isn't actually a ControlPaging: fail without issuing any queries
-// - given SearchRequest contains a control of type ControlTypePaging with pagingSize equal to the size requested: no change to the search request
-// - given SearchRequest contains a control of type ControlTypePaging with pagingSize not equal to the size requested: fail without issuing any queries
-// A requested pagingSize of 0 is interpreted as no limit by LDAP servers.
-func (l *Conn) SearchWithPaging(searchRequest *SearchRequest, pagingSize uint32) (*SearchResult, error) {
- var pagingControl *ControlPaging
-
- control := FindControl(searchRequest.Controls, ControlTypePaging)
- if control == nil {
- pagingControl = NewControlPaging(pagingSize)
- searchRequest.Controls = append(searchRequest.Controls, pagingControl)
- } else {
- castControl, ok := control.(*ControlPaging)
- if !ok {
- return nil, fmt.Errorf("expected paging control to be of type *ControlPaging, got %v", control)
- }
- if castControl.PagingSize != pagingSize {
- return nil, fmt.Errorf("paging size given in search request (%d) conflicts with size given in search call (%d)", castControl.PagingSize, pagingSize)
- }
- pagingControl = castControl
- }
-
- searchResult := new(SearchResult)
- for {
- result, err := l.Search(searchRequest)
- l.Debug.Printf("Looking for Paging Control...")
- if err != nil {
- return searchResult, err
- }
- if result == nil {
- return searchResult, NewError(ErrorNetwork, errors.New("ldap: packet not received"))
- }
-
- for _, entry := range result.Entries {
- searchResult.Entries = append(searchResult.Entries, entry)
- }
- for _, referral := range result.Referrals {
- searchResult.Referrals = append(searchResult.Referrals, referral)
- }
- for _, control := range result.Controls {
- searchResult.Controls = append(searchResult.Controls, control)
- }
-
- l.Debug.Printf("Looking for Paging Control...")
- pagingResult := FindControl(result.Controls, ControlTypePaging)
- if pagingResult == nil {
- pagingControl = nil
- l.Debug.Printf("Could not find paging control. Breaking...")
- break
- }
-
- cookie := pagingResult.(*ControlPaging).Cookie
- if len(cookie) == 0 {
- pagingControl = nil
- l.Debug.Printf("Could not find cookie. Breaking...")
- break
- }
- pagingControl.SetCookie(cookie)
- }
-
- if pagingControl != nil {
- l.Debug.Printf("Abandoning Paging...")
- pagingControl.PagingSize = 0
- l.Search(searchRequest)
- }
-
- return searchResult, nil
-}
-
-// Search performs the given search request
-func (l *Conn) Search(searchRequest *SearchRequest) (*SearchResult, error) {
- msgCtx, err := l.doRequest(searchRequest)
- if err != nil {
- return nil, err
- }
- defer l.finishMessage(msgCtx)
-
- result := &SearchResult{
- Entries: make([]*Entry, 0),
- Referrals: make([]string, 0),
- Controls: make([]Control, 0)}
-
- for {
- packet, err := l.readPacket(msgCtx)
- if err != nil {
- return result, err
- }
-
- switch packet.Children[1].Tag {
- case 4:
- entry := &Entry{
- DN: packet.Children[1].Children[0].Value.(string),
- Attributes: unpackAttributes(packet.Children[1].Children[1].Children),
- }
- result.Entries = append(result.Entries, entry)
- case 5:
- err := GetLDAPError(packet)
- if err != nil {
- return result, err
- }
- if len(packet.Children) == 3 {
- for _, child := range packet.Children[2].Children {
- decodedChild, err := DecodeControl(child)
- if err != nil {
- return result, fmt.Errorf("failed to decode child control: %s", err)
- }
- result.Controls = append(result.Controls, decodedChild)
- }
- }
- return result, nil
- case 19:
- result.Referrals = append(result.Referrals, packet.Children[1].Children[0].Value.(string))
- }
- }
-}
-
-// unpackAttributes will extract all given LDAP attributes and it's values
-// from the ber.Packet
-func unpackAttributes(children []*ber.Packet) []*EntryAttribute {
- entries := make([]*EntryAttribute, len(children))
- for i, child := range children {
- length := len(child.Children[1].Children)
- entry := &EntryAttribute{
- Name: child.Children[0].Value.(string),
- // pre-allocate the slice since we can determine
- // the number of attributes at this point
- Values: make([]string, length),
- ByteValues: make([][]byte, length),
- }
-
- for i, value := range child.Children[1].Children {
- entry.ByteValues[i] = value.ByteValue
- entry.Values[i] = value.Value.(string)
- }
- entries[i] = entry
- }
-
- return entries
-}
diff --git a/vendor/github.com/go-ldap/ldap/v3/unbind.go b/vendor/github.com/go-ldap/ldap/v3/unbind.go
deleted file mode 100644
index 6c411cd1d3..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/unbind.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package ldap
-
-import (
- "errors"
-
- ber "github.com/go-asn1-ber/asn1-ber"
-)
-
-var ErrConnUnbound = NewError(ErrorNetwork, errors.New("ldap: connection is closed"))
-
-type unbindRequest struct{}
-
-func (unbindRequest) appendTo(envelope *ber.Packet) error {
- envelope.AppendChild(ber.Encode(ber.ClassApplication, ber.TypePrimitive, ApplicationUnbindRequest, nil, ApplicationMap[ApplicationUnbindRequest]))
- return nil
-}
-
-// Unbind will perform an unbind request. The Unbind operation
-// should be thought of as the "quit" operation.
-// See https://datatracker.ietf.org/doc/html/rfc4511#section-4.3
-func (l *Conn) Unbind() error {
- if l.IsClosing() {
- return ErrConnUnbound
- }
-
- _, err := l.doRequest(unbindRequest{})
- if err != nil {
- return err
- }
-
- // Sending an unbindRequest will make the connection unusable.
- // Pending requests will fail with:
- // LDAP Result Code 200 "Network Error": ldap: response channel closed
- l.Close()
-
- return nil
-}
diff --git a/vendor/github.com/go-ldap/ldap/v3/whoami.go b/vendor/github.com/go-ldap/ldap/v3/whoami.go
deleted file mode 100644
index 10c523d082..0000000000
--- a/vendor/github.com/go-ldap/ldap/v3/whoami.go
+++ /dev/null
@@ -1,91 +0,0 @@
-package ldap
-
-// This file contains the "Who Am I?" extended operation as specified in rfc 4532
-//
-// https://tools.ietf.org/html/rfc4532
-
-import (
- "errors"
- "fmt"
-
- ber "github.com/go-asn1-ber/asn1-ber"
-)
-
-type whoAmIRequest bool
-
-// WhoAmIResult is returned by the WhoAmI() call
-type WhoAmIResult struct {
- AuthzID string
-}
-
-func (r whoAmIRequest) encode() (*ber.Packet, error) {
- request := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationExtendedRequest, nil, "Who Am I? Extended Operation")
- request.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 0, ControlTypeWhoAmI, "Extended Request Name: Who Am I? OID"))
- return request, nil
-}
-
-// WhoAmI returns the authzId the server thinks we are, you may pass controls
-// like a Proxied Authorization control
-func (l *Conn) WhoAmI(controls []Control) (*WhoAmIResult, error) {
- packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "LDAP Request")
- packet.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, l.nextMessageID(), "MessageID"))
- req := whoAmIRequest(true)
- encodedWhoAmIRequest, err := req.encode()
- if err != nil {
- return nil, err
- }
- packet.AppendChild(encodedWhoAmIRequest)
-
- if len(controls) != 0 {
- packet.AppendChild(encodeControls(controls))
- }
-
- l.Debug.PrintPacket(packet)
-
- msgCtx, err := l.sendMessage(packet)
- if err != nil {
- return nil, err
- }
- defer l.finishMessage(msgCtx)
-
- result := &WhoAmIResult{}
-
- l.Debug.Printf("%d: waiting for response", msgCtx.id)
- packetResponse, ok := <-msgCtx.responses
- if !ok {
- return nil, NewError(ErrorNetwork, errors.New("ldap: response channel closed"))
- }
- packet, err = packetResponse.ReadPacket()
- l.Debug.Printf("%d: got response %p", msgCtx.id, packet)
- if err != nil {
- return nil, err
- }
-
- if packet == nil {
- return nil, NewError(ErrorNetwork, errors.New("ldap: could not retrieve message"))
- }
-
- if l.Debug {
- if err := addLDAPDescriptions(packet); err != nil {
- return nil, err
- }
- ber.PrintPacket(packet)
- }
-
- if packet.Children[1].Tag == ApplicationExtendedResponse {
- if err := GetLDAPError(packet); err != nil {
- return nil, err
- }
- } else {
- return nil, NewError(ErrorUnexpectedResponse, fmt.Errorf("Unexpected Response: %d", packet.Children[1].Tag))
- }
-
- extendedResponse := packet.Children[1]
- for _, child := range extendedResponse.Children {
- if child.Tag == 11 {
- result.AuthzID = ber.DecodeString(child.Data.Bytes())
- }
- }
-
- return result, nil
-}
diff --git a/vendor/github.com/go-openapi/errors/.gitattributes b/vendor/github.com/go-openapi/errors/.gitattributes
new file mode 100644
index 0000000000..a0717e4b3b
--- /dev/null
+++ b/vendor/github.com/go-openapi/errors/.gitattributes
@@ -0,0 +1 @@
+*.go text eol=lf
\ No newline at end of file
diff --git a/vendor/github.com/go-openapi/errors/.gitignore b/vendor/github.com/go-openapi/errors/.gitignore
new file mode 100644
index 0000000000..dd91ed6a04
--- /dev/null
+++ b/vendor/github.com/go-openapi/errors/.gitignore
@@ -0,0 +1,2 @@
+secrets.yml
+coverage.out
diff --git a/vendor/github.com/go-openapi/errors/.golangci.yml b/vendor/github.com/go-openapi/errors/.golangci.yml
new file mode 100644
index 0000000000..4e1fc0c7d4
--- /dev/null
+++ b/vendor/github.com/go-openapi/errors/.golangci.yml
@@ -0,0 +1,48 @@
+linters-settings:
+ govet:
+ check-shadowing: true
+ golint:
+ min-confidence: 0
+ gocyclo:
+ min-complexity: 30
+ maligned:
+ suggest-new: true
+ dupl:
+ threshold: 100
+ goconst:
+ min-len: 2
+ min-occurrences: 4
+linters:
+ enable-all: true
+ disable:
+ - maligned
+ - lll
+ - gochecknoglobals
+ - godox
+ - gocognit
+ - whitespace
+ - wsl
+ - funlen
+ - gochecknoglobals
+ - gochecknoinits
+ - scopelint
+ - wrapcheck
+ - exhaustivestruct
+ - exhaustive
+ - nlreturn
+ - testpackage
+ - gci
+ - gofumpt
+ - goerr113
+ - gomnd
+ - tparallel
+ - nestif
+ - godot
+ - errorlint
+ - paralleltest
+ - tparallel
+ - cyclop
+ - errname
+ - varnamelen
+ - exhaustruct
+ - maintidx
diff --git a/vendor/github.com/go-openapi/errors/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/errors/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000000..9322b065e3
--- /dev/null
+++ b/vendor/github.com/go-openapi/errors/CODE_OF_CONDUCT.md
@@ -0,0 +1,74 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, gender identity and expression, level of experience,
+nationality, personal appearance, race, religion, or sexual identity and
+orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at ivan+abuse@flanders.co.nz. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff --git a/vendor/github.com/go-openapi/errors/LICENSE b/vendor/github.com/go-openapi/errors/LICENSE
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/vendor/github.com/go-openapi/errors/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/vendor/github.com/go-openapi/errors/README.md b/vendor/github.com/go-openapi/errors/README.md
new file mode 100644
index 0000000000..4aac049e60
--- /dev/null
+++ b/vendor/github.com/go-openapi/errors/README.md
@@ -0,0 +1,11 @@
+# OpenAPI errors
+
+[](https://travis-ci.org/go-openapi/errors)
+[](https://codecov.io/gh/go-openapi/errors)
+[](https://slackin.goswagger.io)
+[](https://raw.githubusercontent.com/go-openapi/errors/master/LICENSE)
+[](https://pkg.go.dev/github.com/go-openapi/errors)
+[](https://golangci.com)
+[](https://goreportcard.com/report/github.com/go-openapi/errors)
+
+Shared errors and error interface used throughout the various libraries found in the go-openapi toolkit.
diff --git a/vendor/github.com/go-openapi/errors/api.go b/vendor/github.com/go-openapi/errors/api.go
new file mode 100644
index 0000000000..77f1f92c5e
--- /dev/null
+++ b/vendor/github.com/go-openapi/errors/api.go
@@ -0,0 +1,182 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package errors
+
+import (
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "reflect"
+ "strings"
+)
+
+// DefaultHTTPCode is used when the error Code cannot be used as an HTTP code.
+var DefaultHTTPCode = http.StatusUnprocessableEntity
+
+// Error represents a error interface all swagger framework errors implement
+type Error interface {
+ error
+ Code() int32
+}
+
+type apiError struct {
+ code int32
+ message string
+}
+
+func (a *apiError) Error() string {
+ return a.message
+}
+
+func (a *apiError) Code() int32 {
+ return a.code
+}
+
+// MarshalJSON implements the JSON encoding interface
+func (a apiError) MarshalJSON() ([]byte, error) {
+ return json.Marshal(map[string]interface{}{
+ "code": a.code,
+ "message": a.message,
+ })
+}
+
+// New creates a new API error with a code and a message
+func New(code int32, message string, args ...interface{}) Error {
+ if len(args) > 0 {
+ return &apiError{code, fmt.Sprintf(message, args...)}
+ }
+ return &apiError{code, message}
+}
+
+// NotFound creates a new not found error
+func NotFound(message string, args ...interface{}) Error {
+ if message == "" {
+ message = "Not found"
+ }
+ return New(http.StatusNotFound, fmt.Sprintf(message, args...))
+}
+
+// NotImplemented creates a new not implemented error
+func NotImplemented(message string) Error {
+ return New(http.StatusNotImplemented, message)
+}
+
+// MethodNotAllowedError represents an error for when the path matches but the method doesn't
+type MethodNotAllowedError struct {
+ code int32
+ Allowed []string
+ message string
+}
+
+func (m *MethodNotAllowedError) Error() string {
+ return m.message
+}
+
+// Code the error code
+func (m *MethodNotAllowedError) Code() int32 {
+ return m.code
+}
+
+// MarshalJSON implements the JSON encoding interface
+func (m MethodNotAllowedError) MarshalJSON() ([]byte, error) {
+ return json.Marshal(map[string]interface{}{
+ "code": m.code,
+ "message": m.message,
+ "allowed": m.Allowed,
+ })
+}
+
+func errorAsJSON(err Error) []byte {
+ //nolint:errchkjson
+ b, _ := json.Marshal(struct {
+ Code int32 `json:"code"`
+ Message string `json:"message"`
+ }{err.Code(), err.Error()})
+ return b
+}
+
+func flattenComposite(errs *CompositeError) *CompositeError {
+ var res []error
+ for _, er := range errs.Errors {
+ switch e := er.(type) {
+ case *CompositeError:
+ if len(e.Errors) > 0 {
+ flat := flattenComposite(e)
+ if len(flat.Errors) > 0 {
+ res = append(res, flat.Errors...)
+ }
+ }
+ default:
+ if e != nil {
+ res = append(res, e)
+ }
+ }
+ }
+ return CompositeValidationError(res...)
+}
+
+// MethodNotAllowed creates a new method not allowed error
+func MethodNotAllowed(requested string, allow []string) Error {
+ msg := fmt.Sprintf("method %s is not allowed, but [%s] are", requested, strings.Join(allow, ","))
+ return &MethodNotAllowedError{code: http.StatusMethodNotAllowed, Allowed: allow, message: msg}
+}
+
+// ServeError the error handler interface implementation
+func ServeError(rw http.ResponseWriter, r *http.Request, err error) {
+ rw.Header().Set("Content-Type", "application/json")
+ switch e := err.(type) {
+ case *CompositeError:
+ er := flattenComposite(e)
+ // strips composite errors to first element only
+ if len(er.Errors) > 0 {
+ ServeError(rw, r, er.Errors[0])
+ } else {
+ // guard against empty CompositeError (invalid construct)
+ ServeError(rw, r, nil)
+ }
+ case *MethodNotAllowedError:
+ rw.Header().Add("Allow", strings.Join(e.Allowed, ","))
+ rw.WriteHeader(asHTTPCode(int(e.Code())))
+ if r == nil || r.Method != http.MethodHead {
+ _, _ = rw.Write(errorAsJSON(e))
+ }
+ case Error:
+ value := reflect.ValueOf(e)
+ if value.Kind() == reflect.Ptr && value.IsNil() {
+ rw.WriteHeader(http.StatusInternalServerError)
+ _, _ = rw.Write(errorAsJSON(New(http.StatusInternalServerError, "Unknown error")))
+ return
+ }
+ rw.WriteHeader(asHTTPCode(int(e.Code())))
+ if r == nil || r.Method != http.MethodHead {
+ _, _ = rw.Write(errorAsJSON(e))
+ }
+ case nil:
+ rw.WriteHeader(http.StatusInternalServerError)
+ _, _ = rw.Write(errorAsJSON(New(http.StatusInternalServerError, "Unknown error")))
+ default:
+ rw.WriteHeader(http.StatusInternalServerError)
+ if r == nil || r.Method != http.MethodHead {
+ _, _ = rw.Write(errorAsJSON(New(http.StatusInternalServerError, err.Error())))
+ }
+ }
+}
+
+func asHTTPCode(input int) int {
+ if input >= 600 {
+ return DefaultHTTPCode
+ }
+ return input
+}
diff --git a/vendor/github.com/go-openapi/errors/auth.go b/vendor/github.com/go-openapi/errors/auth.go
new file mode 100644
index 0000000000..0545b501bd
--- /dev/null
+++ b/vendor/github.com/go-openapi/errors/auth.go
@@ -0,0 +1,22 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package errors
+
+import "net/http"
+
+// Unauthenticated returns an unauthenticated error
+func Unauthenticated(scheme string) Error {
+ return New(http.StatusUnauthorized, "unauthenticated for %s", scheme)
+}
diff --git a/vendor/github.com/go-openapi/errors/doc.go b/vendor/github.com/go-openapi/errors/doc.go
new file mode 100644
index 0000000000..af01190ce6
--- /dev/null
+++ b/vendor/github.com/go-openapi/errors/doc.go
@@ -0,0 +1,26 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+/*
+Package errors provides an Error interface and several concrete types
+implementing this interface to manage API errors and JSON-schema validation
+errors.
+
+A middleware handler ServeError() is provided to serve the errors types
+it defines.
+
+It is used throughout the various go-openapi toolkit libraries
+(https://github.com/go-openapi).
+*/
+package errors
diff --git a/vendor/github.com/go-openapi/errors/headers.go b/vendor/github.com/go-openapi/errors/headers.go
new file mode 100644
index 0000000000..dfebe8f95f
--- /dev/null
+++ b/vendor/github.com/go-openapi/errors/headers.go
@@ -0,0 +1,103 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package errors
+
+import (
+ "encoding/json"
+ "fmt"
+ "net/http"
+)
+
+// Validation represents a failure of a precondition
+type Validation struct {
+ code int32
+ Name string
+ In string
+ Value interface{}
+ message string
+ Values []interface{}
+}
+
+func (e *Validation) Error() string {
+ return e.message
+}
+
+// Code the error code
+func (e *Validation) Code() int32 {
+ return e.code
+}
+
+// MarshalJSON implements the JSON encoding interface
+func (e Validation) MarshalJSON() ([]byte, error) {
+ return json.Marshal(map[string]interface{}{
+ "code": e.code,
+ "message": e.message,
+ "in": e.In,
+ "name": e.Name,
+ "value": e.Value,
+ "values": e.Values,
+ })
+}
+
+// ValidateName sets the name for a validation or updates it for a nested property
+func (e *Validation) ValidateName(name string) *Validation {
+ if name != "" {
+ if e.Name == "" {
+ e.Name = name
+ e.message = name + e.message
+ } else {
+ e.Name = name + "." + e.Name
+ e.message = name + "." + e.message
+ }
+ }
+ return e
+}
+
+const (
+ contentTypeFail = `unsupported media type %q, only %v are allowed`
+ responseFormatFail = `unsupported media type requested, only %v are available`
+)
+
+// InvalidContentType error for an invalid content type
+func InvalidContentType(value string, allowed []string) *Validation {
+ values := make([]interface{}, 0, len(allowed))
+ for _, v := range allowed {
+ values = append(values, v)
+ }
+ return &Validation{
+ code: http.StatusUnsupportedMediaType,
+ Name: "Content-Type",
+ In: "header",
+ Value: value,
+ Values: values,
+ message: fmt.Sprintf(contentTypeFail, value, allowed),
+ }
+}
+
+// InvalidResponseFormat error for an unacceptable response format request
+func InvalidResponseFormat(value string, allowed []string) *Validation {
+ values := make([]interface{}, 0, len(allowed))
+ for _, v := range allowed {
+ values = append(values, v)
+ }
+ return &Validation{
+ code: http.StatusNotAcceptable,
+ Name: "Accept",
+ In: "header",
+ Value: value,
+ Values: values,
+ message: fmt.Sprintf(responseFormatFail, allowed),
+ }
+}
diff --git a/vendor/github.com/go-openapi/errors/middleware.go b/vendor/github.com/go-openapi/errors/middleware.go
new file mode 100644
index 0000000000..963472d1f3
--- /dev/null
+++ b/vendor/github.com/go-openapi/errors/middleware.go
@@ -0,0 +1,50 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package errors
+
+import (
+ "bytes"
+ "fmt"
+ "strings"
+)
+
+// APIVerificationFailed is an error that contains all the missing info for a mismatched section
+// between the api registrations and the api spec
+type APIVerificationFailed struct {
+ Section string `json:"section,omitempty"`
+ MissingSpecification []string `json:"missingSpecification,omitempty"`
+ MissingRegistration []string `json:"missingRegistration,omitempty"`
+}
+
+func (v *APIVerificationFailed) Error() string {
+ buf := bytes.NewBuffer(nil)
+
+ hasRegMissing := len(v.MissingRegistration) > 0
+ hasSpecMissing := len(v.MissingSpecification) > 0
+
+ if hasRegMissing {
+ buf.WriteString(fmt.Sprintf("missing [%s] %s registrations", strings.Join(v.MissingRegistration, ", "), v.Section))
+ }
+
+ if hasRegMissing && hasSpecMissing {
+ buf.WriteString("\n")
+ }
+
+ if hasSpecMissing {
+ buf.WriteString(fmt.Sprintf("missing from spec file [%s] %s", strings.Join(v.MissingSpecification, ", "), v.Section))
+ }
+
+ return buf.String()
+}
diff --git a/vendor/github.com/go-openapi/errors/parsing.go b/vendor/github.com/go-openapi/errors/parsing.go
new file mode 100644
index 0000000000..5096e1ea7b
--- /dev/null
+++ b/vendor/github.com/go-openapi/errors/parsing.go
@@ -0,0 +1,78 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package errors
+
+import (
+ "encoding/json"
+ "fmt"
+)
+
+// ParseError represents a parsing error
+type ParseError struct {
+ code int32
+ Name string
+ In string
+ Value string
+ Reason error
+ message string
+}
+
+func (e *ParseError) Error() string {
+ return e.message
+}
+
+// Code returns the http status code for this error
+func (e *ParseError) Code() int32 {
+ return e.code
+}
+
+// MarshalJSON implements the JSON encoding interface
+func (e ParseError) MarshalJSON() ([]byte, error) {
+ var reason string
+ if e.Reason != nil {
+ reason = e.Reason.Error()
+ }
+ return json.Marshal(map[string]interface{}{
+ "code": e.code,
+ "message": e.message,
+ "in": e.In,
+ "name": e.Name,
+ "value": e.Value,
+ "reason": reason,
+ })
+}
+
+const (
+ parseErrorTemplContent = `parsing %s %s from %q failed, because %s`
+ parseErrorTemplContentNoIn = `parsing %s from %q failed, because %s`
+)
+
+// NewParseError creates a new parse error
+func NewParseError(name, in, value string, reason error) *ParseError {
+ var msg string
+ if in == "" {
+ msg = fmt.Sprintf(parseErrorTemplContentNoIn, name, value, reason)
+ } else {
+ msg = fmt.Sprintf(parseErrorTemplContent, name, in, value, reason)
+ }
+ return &ParseError{
+ code: 400,
+ Name: name,
+ In: in,
+ Value: value,
+ Reason: reason,
+ message: msg,
+ }
+}
diff --git a/vendor/github.com/go-openapi/errors/schema.go b/vendor/github.com/go-openapi/errors/schema.go
new file mode 100644
index 0000000000..da5f6c78cb
--- /dev/null
+++ b/vendor/github.com/go-openapi/errors/schema.go
@@ -0,0 +1,611 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package errors
+
+import (
+ "encoding/json"
+ "fmt"
+ "strings"
+)
+
+const (
+ invalidType = "%s is an invalid type name"
+ typeFail = "%s in %s must be of type %s"
+ typeFailWithData = "%s in %s must be of type %s: %q"
+ typeFailWithError = "%s in %s must be of type %s, because: %s"
+ requiredFail = "%s in %s is required"
+ readOnlyFail = "%s in %s is readOnly"
+ tooLongMessage = "%s in %s should be at most %d chars long"
+ tooShortMessage = "%s in %s should be at least %d chars long"
+ patternFail = "%s in %s should match '%s'"
+ enumFail = "%s in %s should be one of %v"
+ multipleOfFail = "%s in %s should be a multiple of %v"
+ maxIncFail = "%s in %s should be less than or equal to %v"
+ maxExcFail = "%s in %s should be less than %v"
+ minIncFail = "%s in %s should be greater than or equal to %v"
+ minExcFail = "%s in %s should be greater than %v"
+ uniqueFail = "%s in %s shouldn't contain duplicates"
+ maxItemsFail = "%s in %s should have at most %d items"
+ minItemsFail = "%s in %s should have at least %d items"
+ typeFailNoIn = "%s must be of type %s"
+ typeFailWithDataNoIn = "%s must be of type %s: %q"
+ typeFailWithErrorNoIn = "%s must be of type %s, because: %s"
+ requiredFailNoIn = "%s is required"
+ readOnlyFailNoIn = "%s is readOnly"
+ tooLongMessageNoIn = "%s should be at most %d chars long"
+ tooShortMessageNoIn = "%s should be at least %d chars long"
+ patternFailNoIn = "%s should match '%s'"
+ enumFailNoIn = "%s should be one of %v"
+ multipleOfFailNoIn = "%s should be a multiple of %v"
+ maxIncFailNoIn = "%s should be less than or equal to %v"
+ maxExcFailNoIn = "%s should be less than %v"
+ minIncFailNoIn = "%s should be greater than or equal to %v"
+ minExcFailNoIn = "%s should be greater than %v"
+ uniqueFailNoIn = "%s shouldn't contain duplicates"
+ maxItemsFailNoIn = "%s should have at most %d items"
+ minItemsFailNoIn = "%s should have at least %d items"
+ noAdditionalItems = "%s in %s can't have additional items"
+ noAdditionalItemsNoIn = "%s can't have additional items"
+ tooFewProperties = "%s in %s should have at least %d properties"
+ tooFewPropertiesNoIn = "%s should have at least %d properties"
+ tooManyProperties = "%s in %s should have at most %d properties"
+ tooManyPropertiesNoIn = "%s should have at most %d properties"
+ unallowedProperty = "%s.%s in %s is a forbidden property"
+ unallowedPropertyNoIn = "%s.%s is a forbidden property"
+ failedAllPatternProps = "%s.%s in %s failed all pattern properties"
+ failedAllPatternPropsNoIn = "%s.%s failed all pattern properties"
+ multipleOfMustBePositive = "factor MultipleOf declared for %s must be positive: %v"
+)
+
+// All code responses can be used to differentiate errors for different handling
+// by the consuming program
+const (
+ // CompositeErrorCode remains 422 for backwards-compatibility
+ // and to separate it from validation errors with cause
+ CompositeErrorCode = 422
+ // InvalidTypeCode is used for any subclass of invalid types
+ InvalidTypeCode = 600 + iota
+ RequiredFailCode
+ TooLongFailCode
+ TooShortFailCode
+ PatternFailCode
+ EnumFailCode
+ MultipleOfFailCode
+ MaxFailCode
+ MinFailCode
+ UniqueFailCode
+ MaxItemsFailCode
+ MinItemsFailCode
+ NoAdditionalItemsCode
+ TooFewPropertiesCode
+ TooManyPropertiesCode
+ UnallowedPropertyCode
+ FailedAllPatternPropsCode
+ MultipleOfMustBePositiveCode
+ ReadOnlyFailCode
+)
+
+// CompositeError is an error that groups several errors together
+type CompositeError struct {
+ Errors []error
+ code int32
+ message string
+}
+
+// Code for this error
+func (c *CompositeError) Code() int32 {
+ return c.code
+}
+
+func (c *CompositeError) Error() string {
+ if len(c.Errors) > 0 {
+ msgs := []string{c.message + ":"}
+ for _, e := range c.Errors {
+ msgs = append(msgs, e.Error())
+ }
+ return strings.Join(msgs, "\n")
+ }
+ return c.message
+}
+
+// MarshalJSON implements the JSON encoding interface
+func (c CompositeError) MarshalJSON() ([]byte, error) {
+ return json.Marshal(map[string]interface{}{
+ "code": c.code,
+ "message": c.message,
+ "errors": c.Errors,
+ })
+}
+
+// CompositeValidationError an error to wrap a bunch of other errors
+func CompositeValidationError(errors ...error) *CompositeError {
+ return &CompositeError{
+ code: CompositeErrorCode,
+ Errors: append([]error{}, errors...),
+ message: "validation failure list",
+ }
+}
+
+// ValidateName recursively sets the name for all validations or updates them for nested properties
+func (c *CompositeError) ValidateName(name string) *CompositeError {
+ for i, e := range c.Errors {
+ if ve, ok := e.(*Validation); ok {
+ c.Errors[i] = ve.ValidateName(name)
+ } else if ce, ok := e.(*CompositeError); ok {
+ c.Errors[i] = ce.ValidateName(name)
+ }
+ }
+
+ return c
+}
+
+// FailedAllPatternProperties an error for when the property doesn't match a pattern
+func FailedAllPatternProperties(name, in, key string) *Validation {
+ msg := fmt.Sprintf(failedAllPatternProps, name, key, in)
+ if in == "" {
+ msg = fmt.Sprintf(failedAllPatternPropsNoIn, name, key)
+ }
+ return &Validation{
+ code: FailedAllPatternPropsCode,
+ Name: name,
+ In: in,
+ Value: key,
+ message: msg,
+ }
+}
+
+// PropertyNotAllowed an error for when the property doesn't match a pattern
+func PropertyNotAllowed(name, in, key string) *Validation {
+ msg := fmt.Sprintf(unallowedProperty, name, key, in)
+ if in == "" {
+ msg = fmt.Sprintf(unallowedPropertyNoIn, name, key)
+ }
+ return &Validation{
+ code: UnallowedPropertyCode,
+ Name: name,
+ In: in,
+ Value: key,
+ message: msg,
+ }
+}
+
+// TooFewProperties an error for an object with too few properties
+func TooFewProperties(name, in string, n int64) *Validation {
+ msg := fmt.Sprintf(tooFewProperties, name, in, n)
+ if in == "" {
+ msg = fmt.Sprintf(tooFewPropertiesNoIn, name, n)
+ }
+ return &Validation{
+ code: TooFewPropertiesCode,
+ Name: name,
+ In: in,
+ Value: n,
+ message: msg,
+ }
+}
+
+// TooManyProperties an error for an object with too many properties
+func TooManyProperties(name, in string, n int64) *Validation {
+ msg := fmt.Sprintf(tooManyProperties, name, in, n)
+ if in == "" {
+ msg = fmt.Sprintf(tooManyPropertiesNoIn, name, n)
+ }
+ return &Validation{
+ code: TooManyPropertiesCode,
+ Name: name,
+ In: in,
+ Value: n,
+ message: msg,
+ }
+}
+
+// AdditionalItemsNotAllowed an error for invalid additional items
+func AdditionalItemsNotAllowed(name, in string) *Validation {
+ msg := fmt.Sprintf(noAdditionalItems, name, in)
+ if in == "" {
+ msg = fmt.Sprintf(noAdditionalItemsNoIn, name)
+ }
+ return &Validation{
+ code: NoAdditionalItemsCode,
+ Name: name,
+ In: in,
+ message: msg,
+ }
+}
+
+// InvalidCollectionFormat another flavor of invalid type error
+func InvalidCollectionFormat(name, in, format string) *Validation {
+ return &Validation{
+ code: InvalidTypeCode,
+ Name: name,
+ In: in,
+ Value: format,
+ message: fmt.Sprintf("the collection format %q is not supported for the %s param %q", format, in, name),
+ }
+}
+
+// InvalidTypeName an error for when the type is invalid
+func InvalidTypeName(typeName string) *Validation {
+ return &Validation{
+ code: InvalidTypeCode,
+ Value: typeName,
+ message: fmt.Sprintf(invalidType, typeName),
+ }
+}
+
+// InvalidType creates an error for when the type is invalid
+func InvalidType(name, in, typeName string, value interface{}) *Validation {
+ var message string
+
+ if in != "" {
+ switch value.(type) {
+ case string:
+ message = fmt.Sprintf(typeFailWithData, name, in, typeName, value)
+ case error:
+ message = fmt.Sprintf(typeFailWithError, name, in, typeName, value)
+ default:
+ message = fmt.Sprintf(typeFail, name, in, typeName)
+ }
+ } else {
+ switch value.(type) {
+ case string:
+ message = fmt.Sprintf(typeFailWithDataNoIn, name, typeName, value)
+ case error:
+ message = fmt.Sprintf(typeFailWithErrorNoIn, name, typeName, value)
+ default:
+ message = fmt.Sprintf(typeFailNoIn, name, typeName)
+ }
+ }
+
+ return &Validation{
+ code: InvalidTypeCode,
+ Name: name,
+ In: in,
+ Value: value,
+ message: message,
+ }
+
+}
+
+// DuplicateItems error for when an array contains duplicates
+func DuplicateItems(name, in string) *Validation {
+ msg := fmt.Sprintf(uniqueFail, name, in)
+ if in == "" {
+ msg = fmt.Sprintf(uniqueFailNoIn, name)
+ }
+ return &Validation{
+ code: UniqueFailCode,
+ Name: name,
+ In: in,
+ message: msg,
+ }
+}
+
+// TooManyItems error for when an array contains too many items
+func TooManyItems(name, in string, max int64, value interface{}) *Validation {
+ msg := fmt.Sprintf(maxItemsFail, name, in, max)
+ if in == "" {
+ msg = fmt.Sprintf(maxItemsFailNoIn, name, max)
+ }
+
+ return &Validation{
+ code: MaxItemsFailCode,
+ Name: name,
+ In: in,
+ Value: value,
+ message: msg,
+ }
+}
+
+// TooFewItems error for when an array contains too few items
+func TooFewItems(name, in string, min int64, value interface{}) *Validation {
+ msg := fmt.Sprintf(minItemsFail, name, in, min)
+ if in == "" {
+ msg = fmt.Sprintf(minItemsFailNoIn, name, min)
+ }
+ return &Validation{
+ code: MinItemsFailCode,
+ Name: name,
+ In: in,
+ Value: value,
+ message: msg,
+ }
+}
+
+// ExceedsMaximumInt error for when maximum validation fails
+func ExceedsMaximumInt(name, in string, max int64, exclusive bool, value interface{}) *Validation {
+ var message string
+ if in == "" {
+ m := maxIncFailNoIn
+ if exclusive {
+ m = maxExcFailNoIn
+ }
+ message = fmt.Sprintf(m, name, max)
+ } else {
+ m := maxIncFail
+ if exclusive {
+ m = maxExcFail
+ }
+ message = fmt.Sprintf(m, name, in, max)
+ }
+ return &Validation{
+ code: MaxFailCode,
+ Name: name,
+ In: in,
+ Value: value,
+ message: message,
+ }
+}
+
+// ExceedsMaximumUint error for when maximum validation fails
+func ExceedsMaximumUint(name, in string, max uint64, exclusive bool, value interface{}) *Validation {
+ var message string
+ if in == "" {
+ m := maxIncFailNoIn
+ if exclusive {
+ m = maxExcFailNoIn
+ }
+ message = fmt.Sprintf(m, name, max)
+ } else {
+ m := maxIncFail
+ if exclusive {
+ m = maxExcFail
+ }
+ message = fmt.Sprintf(m, name, in, max)
+ }
+ return &Validation{
+ code: MaxFailCode,
+ Name: name,
+ In: in,
+ Value: value,
+ message: message,
+ }
+}
+
+// ExceedsMaximum error for when maximum validation fails
+func ExceedsMaximum(name, in string, max float64, exclusive bool, value interface{}) *Validation {
+ var message string
+ if in == "" {
+ m := maxIncFailNoIn
+ if exclusive {
+ m = maxExcFailNoIn
+ }
+ message = fmt.Sprintf(m, name, max)
+ } else {
+ m := maxIncFail
+ if exclusive {
+ m = maxExcFail
+ }
+ message = fmt.Sprintf(m, name, in, max)
+ }
+ return &Validation{
+ code: MaxFailCode,
+ Name: name,
+ In: in,
+ Value: value,
+ message: message,
+ }
+}
+
+// ExceedsMinimumInt error for when minimum validation fails
+func ExceedsMinimumInt(name, in string, min int64, exclusive bool, value interface{}) *Validation {
+ var message string
+ if in == "" {
+ m := minIncFailNoIn
+ if exclusive {
+ m = minExcFailNoIn
+ }
+ message = fmt.Sprintf(m, name, min)
+ } else {
+ m := minIncFail
+ if exclusive {
+ m = minExcFail
+ }
+ message = fmt.Sprintf(m, name, in, min)
+ }
+ return &Validation{
+ code: MinFailCode,
+ Name: name,
+ In: in,
+ Value: value,
+ message: message,
+ }
+}
+
+// ExceedsMinimumUint error for when minimum validation fails
+func ExceedsMinimumUint(name, in string, min uint64, exclusive bool, value interface{}) *Validation {
+ var message string
+ if in == "" {
+ m := minIncFailNoIn
+ if exclusive {
+ m = minExcFailNoIn
+ }
+ message = fmt.Sprintf(m, name, min)
+ } else {
+ m := minIncFail
+ if exclusive {
+ m = minExcFail
+ }
+ message = fmt.Sprintf(m, name, in, min)
+ }
+ return &Validation{
+ code: MinFailCode,
+ Name: name,
+ In: in,
+ Value: value,
+ message: message,
+ }
+}
+
+// ExceedsMinimum error for when minimum validation fails
+func ExceedsMinimum(name, in string, min float64, exclusive bool, value interface{}) *Validation {
+ var message string
+ if in == "" {
+ m := minIncFailNoIn
+ if exclusive {
+ m = minExcFailNoIn
+ }
+ message = fmt.Sprintf(m, name, min)
+ } else {
+ m := minIncFail
+ if exclusive {
+ m = minExcFail
+ }
+ message = fmt.Sprintf(m, name, in, min)
+ }
+ return &Validation{
+ code: MinFailCode,
+ Name: name,
+ In: in,
+ Value: value,
+ message: message,
+ }
+}
+
+// NotMultipleOf error for when multiple of validation fails
+func NotMultipleOf(name, in string, multiple, value interface{}) *Validation {
+ var msg string
+ if in == "" {
+ msg = fmt.Sprintf(multipleOfFailNoIn, name, multiple)
+ } else {
+ msg = fmt.Sprintf(multipleOfFail, name, in, multiple)
+ }
+ return &Validation{
+ code: MultipleOfFailCode,
+ Name: name,
+ In: in,
+ Value: value,
+ message: msg,
+ }
+}
+
+// EnumFail error for when an enum validation fails
+func EnumFail(name, in string, value interface{}, values []interface{}) *Validation {
+ var msg string
+ if in == "" {
+ msg = fmt.Sprintf(enumFailNoIn, name, values)
+ } else {
+ msg = fmt.Sprintf(enumFail, name, in, values)
+ }
+
+ return &Validation{
+ code: EnumFailCode,
+ Name: name,
+ In: in,
+ Value: value,
+ Values: values,
+ message: msg,
+ }
+}
+
+// Required error for when a value is missing
+func Required(name, in string, value interface{}) *Validation {
+ var msg string
+ if in == "" {
+ msg = fmt.Sprintf(requiredFailNoIn, name)
+ } else {
+ msg = fmt.Sprintf(requiredFail, name, in)
+ }
+ return &Validation{
+ code: RequiredFailCode,
+ Name: name,
+ In: in,
+ Value: value,
+ message: msg,
+ }
+}
+
+// ReadOnly error for when a value is present in request
+func ReadOnly(name, in string, value interface{}) *Validation {
+ var msg string
+ if in == "" {
+ msg = fmt.Sprintf(readOnlyFailNoIn, name)
+ } else {
+ msg = fmt.Sprintf(readOnlyFail, name, in)
+ }
+ return &Validation{
+ code: ReadOnlyFailCode,
+ Name: name,
+ In: in,
+ Value: value,
+ message: msg,
+ }
+}
+
+// TooLong error for when a string is too long
+func TooLong(name, in string, max int64, value interface{}) *Validation {
+ var msg string
+ if in == "" {
+ msg = fmt.Sprintf(tooLongMessageNoIn, name, max)
+ } else {
+ msg = fmt.Sprintf(tooLongMessage, name, in, max)
+ }
+ return &Validation{
+ code: TooLongFailCode,
+ Name: name,
+ In: in,
+ Value: value,
+ message: msg,
+ }
+}
+
+// TooShort error for when a string is too short
+func TooShort(name, in string, min int64, value interface{}) *Validation {
+ var msg string
+ if in == "" {
+ msg = fmt.Sprintf(tooShortMessageNoIn, name, min)
+ } else {
+ msg = fmt.Sprintf(tooShortMessage, name, in, min)
+ }
+
+ return &Validation{
+ code: TooShortFailCode,
+ Name: name,
+ In: in,
+ Value: value,
+ message: msg,
+ }
+}
+
+// FailedPattern error for when a string fails a regex pattern match
+// the pattern that is returned is the ECMA syntax version of the pattern not the golang version.
+func FailedPattern(name, in, pattern string, value interface{}) *Validation {
+ var msg string
+ if in == "" {
+ msg = fmt.Sprintf(patternFailNoIn, name, pattern)
+ } else {
+ msg = fmt.Sprintf(patternFail, name, in, pattern)
+ }
+
+ return &Validation{
+ code: PatternFailCode,
+ Name: name,
+ In: in,
+ Value: value,
+ message: msg,
+ }
+}
+
+// MultipleOfMustBePositive error for when a
+// multipleOf factor is negative
+func MultipleOfMustBePositive(name, in string, factor interface{}) *Validation {
+ return &Validation{
+ code: MultipleOfMustBePositiveCode,
+ Name: name,
+ In: in,
+ Value: factor,
+ message: fmt.Sprintf(multipleOfMustBePositive, name, factor),
+ }
+}
diff --git a/vendor/github.com/go-openapi/strfmt/.editorconfig b/vendor/github.com/go-openapi/strfmt/.editorconfig
new file mode 100644
index 0000000000..3152da69a5
--- /dev/null
+++ b/vendor/github.com/go-openapi/strfmt/.editorconfig
@@ -0,0 +1,26 @@
+# top-most EditorConfig file
+root = true
+
+# Unix-style newlines with a newline ending every file
+[*]
+end_of_line = lf
+insert_final_newline = true
+indent_style = space
+indent_size = 2
+trim_trailing_whitespace = true
+
+# Set default charset
+[*.{js,py,go,scala,rb,java,html,css,less,sass,md}]
+charset = utf-8
+
+# Tab indentation (no size specified)
+[*.go]
+indent_style = tab
+
+[*.md]
+trim_trailing_whitespace = false
+
+# Matches the exact files either package.json or .travis.yml
+[{package.json,.travis.yml}]
+indent_style = space
+indent_size = 2
diff --git a/vendor/github.com/go-openapi/strfmt/.gitattributes b/vendor/github.com/go-openapi/strfmt/.gitattributes
new file mode 100644
index 0000000000..d020be8ea4
--- /dev/null
+++ b/vendor/github.com/go-openapi/strfmt/.gitattributes
@@ -0,0 +1,2 @@
+*.go text eol=lf
+
diff --git a/vendor/github.com/go-openapi/strfmt/.gitignore b/vendor/github.com/go-openapi/strfmt/.gitignore
new file mode 100644
index 0000000000..dd91ed6a04
--- /dev/null
+++ b/vendor/github.com/go-openapi/strfmt/.gitignore
@@ -0,0 +1,2 @@
+secrets.yml
+coverage.out
diff --git a/vendor/github.com/go-openapi/strfmt/.golangci.yml b/vendor/github.com/go-openapi/strfmt/.golangci.yml
new file mode 100644
index 0000000000..be4899cb12
--- /dev/null
+++ b/vendor/github.com/go-openapi/strfmt/.golangci.yml
@@ -0,0 +1,59 @@
+linters-settings:
+ govet:
+ check-shadowing: true
+ golint:
+ min-confidence: 0
+ gocyclo:
+ min-complexity: 31
+ maligned:
+ suggest-new: true
+ dupl:
+ threshold: 100
+ goconst:
+ min-len: 2
+ min-occurrences: 4
+
+linters:
+ enable:
+ - revive
+ - goimports
+ - gosec
+ - unparam
+ - unconvert
+ - predeclared
+ - prealloc
+ - misspell
+
+ # disable:
+ # - maligned
+ # - lll
+ # - gochecknoinits
+ # - gochecknoglobals
+ # - godox
+ # - gocognit
+ # - whitespace
+ # - wsl
+ # - funlen
+ # - wrapcheck
+ # - testpackage
+ # - nlreturn
+ # - gofumpt
+ # - goerr113
+ # - gci
+ # - gomnd
+ # - godot
+ # - exhaustivestruct
+ # - paralleltest
+ # - varnamelen
+ # - ireturn
+ # - exhaustruct
+ # #- thelper
+
+issues:
+ exclude-rules:
+ - path: bson.go
+ text: "should be .*ObjectID"
+ linters:
+ - golint
+ - stylecheck
+
diff --git a/vendor/github.com/go-openapi/strfmt/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/strfmt/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000000..9322b065e3
--- /dev/null
+++ b/vendor/github.com/go-openapi/strfmt/CODE_OF_CONDUCT.md
@@ -0,0 +1,74 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, gender identity and expression, level of experience,
+nationality, personal appearance, race, religion, or sexual identity and
+orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at ivan+abuse@flanders.co.nz. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff --git a/vendor/github.com/go-openapi/strfmt/LICENSE b/vendor/github.com/go-openapi/strfmt/LICENSE
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/vendor/github.com/go-openapi/strfmt/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/vendor/github.com/go-openapi/strfmt/README.md b/vendor/github.com/go-openapi/strfmt/README.md
new file mode 100644
index 0000000000..0cf89d7766
--- /dev/null
+++ b/vendor/github.com/go-openapi/strfmt/README.md
@@ -0,0 +1,88 @@
+# Strfmt [](https://travis-ci.org/go-openapi/strfmt) [](https://codecov.io/gh/go-openapi/strfmt) [](https://slackin.goswagger.io)
+
+[](https://raw.githubusercontent.com/go-openapi/strfmt/master/LICENSE)
+[](http://godoc.org/github.com/go-openapi/strfmt)
+[](https://golangci.com)
+[](https://goreportcard.com/report/github.com/go-openapi/strfmt)
+
+This package exposes a registry of data types to support string formats in the go-openapi toolkit.
+
+strfmt represents a well known string format such as credit card or email. The go toolkit for OpenAPI specifications knows how to deal with those.
+
+## Supported data formats
+go-openapi/strfmt follows the swagger 2.0 specification with the following formats
+defined [here](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types).
+
+It also provides convenient extensions to go-openapi users.
+
+- [x] JSON-schema draft 4 formats
+ - date-time
+ - email
+ - hostname
+ - ipv4
+ - ipv6
+ - uri
+- [x] swagger 2.0 format extensions
+ - binary
+ - byte (e.g. base64 encoded string)
+ - date (e.g. "1970-01-01")
+ - password
+- [x] go-openapi custom format extensions
+ - bsonobjectid (BSON objectID)
+ - creditcard
+ - duration (e.g. "3 weeks", "1ms")
+ - hexcolor (e.g. "#FFFFFF")
+ - isbn, isbn10, isbn13
+ - mac (e.g "01:02:03:04:05:06")
+ - rgbcolor (e.g. "rgb(100,100,100)")
+ - ssn
+ - uuid, uuid3, uuid4, uuid5
+ - cidr (e.g. "192.0.2.1/24", "2001:db8:a0b:12f0::1/32")
+ - ulid (e.g. "00000PP9HGSBSSDZ1JTEXBJ0PW", [spec](https://github.com/ulid/spec))
+
+> NOTE: as the name stands for, this package is intended to support string formatting only.
+> It does not provide validation for numerical values with swagger format extension for JSON types "number" or
+> "integer" (e.g. float, double, int32...).
+
+## Type conversion
+
+All types defined here are stringers and may be converted to strings with `.String()`.
+Note that most types defined by this package may be converted directly to string like `string(Email{})`.
+
+`Date` and `DateTime` may be converted directly to `time.Time` like `time.Time(Time{})`.
+Similarly, you can convert `Duration` to `time.Duration` as in `time.Duration(Duration{})`
+
+## Using pointers
+
+The `conv` subpackage provides helpers to convert the types to and from pointers, just like `go-openapi/swag` does
+with primitive types.
+
+## Format types
+Types defined in strfmt expose marshaling and validation capabilities.
+
+List of defined types:
+- Base64
+- CreditCard
+- Date
+- DateTime
+- Duration
+- Email
+- HexColor
+- Hostname
+- IPv4
+- IPv6
+- CIDR
+- ISBN
+- ISBN10
+- ISBN13
+- MAC
+- ObjectId
+- Password
+- RGBColor
+- SSN
+- URI
+- UUID
+- UUID3
+- UUID4
+- UUID5
+- [ULID](https://github.com/ulid/spec)
diff --git a/vendor/github.com/go-openapi/strfmt/bson.go b/vendor/github.com/go-openapi/strfmt/bson.go
new file mode 100644
index 0000000000..a8a3604a2c
--- /dev/null
+++ b/vendor/github.com/go-openapi/strfmt/bson.go
@@ -0,0 +1,165 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package strfmt
+
+import (
+ "database/sql/driver"
+ "fmt"
+
+ "go.mongodb.org/mongo-driver/bson"
+
+ "go.mongodb.org/mongo-driver/bson/bsontype"
+ bsonprim "go.mongodb.org/mongo-driver/bson/primitive"
+)
+
+func init() {
+ var id ObjectId
+ // register this format in the default registry
+ Default.Add("bsonobjectid", &id, IsBSONObjectID)
+}
+
+// IsBSONObjectID returns true when the string is a valid BSON.ObjectId
+func IsBSONObjectID(str string) bool {
+ _, err := bsonprim.ObjectIDFromHex(str)
+ return err == nil
+}
+
+// ObjectId represents a BSON object ID (alias to go.mongodb.org/mongo-driver/bson/primitive.ObjectID)
+//
+// swagger:strfmt bsonobjectid
+type ObjectId bsonprim.ObjectID //nolint:revive
+
+// NewObjectId creates a ObjectId from a Hex String
+func NewObjectId(hex string) ObjectId { //nolint:revive
+ oid, err := bsonprim.ObjectIDFromHex(hex)
+ if err != nil {
+ panic(err)
+ }
+ return ObjectId(oid)
+}
+
+// MarshalText turns this instance into text
+func (id ObjectId) MarshalText() ([]byte, error) {
+ oid := bsonprim.ObjectID(id)
+ if oid == bsonprim.NilObjectID {
+ return nil, nil
+ }
+ return []byte(oid.Hex()), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (id *ObjectId) UnmarshalText(data []byte) error { // validation is performed later on
+ if len(data) == 0 {
+ *id = ObjectId(bsonprim.NilObjectID)
+ return nil
+ }
+ oidstr := string(data)
+ oid, err := bsonprim.ObjectIDFromHex(oidstr)
+ if err != nil {
+ return err
+ }
+ *id = ObjectId(oid)
+ return nil
+}
+
+// Scan read a value from a database driver
+func (id *ObjectId) Scan(raw interface{}) error {
+ var data []byte
+ switch v := raw.(type) {
+ case []byte:
+ data = v
+ case string:
+ data = []byte(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.URI from: %#v", v)
+ }
+
+ return id.UnmarshalText(data)
+}
+
+// Value converts a value to a database driver value
+func (id ObjectId) Value() (driver.Value, error) {
+ return driver.Value(bsonprim.ObjectID(id).Hex()), nil
+}
+
+func (id ObjectId) String() string {
+ return bsonprim.ObjectID(id).Hex()
+}
+
+// MarshalJSON returns the ObjectId as JSON
+func (id ObjectId) MarshalJSON() ([]byte, error) {
+ return bsonprim.ObjectID(id).MarshalJSON()
+}
+
+// UnmarshalJSON sets the ObjectId from JSON
+func (id *ObjectId) UnmarshalJSON(data []byte) error {
+ var obj bsonprim.ObjectID
+ if err := obj.UnmarshalJSON(data); err != nil {
+ return err
+ }
+ *id = ObjectId(obj)
+ return nil
+}
+
+// MarshalBSON renders the object id as a BSON document
+func (id ObjectId) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": bsonprim.ObjectID(id)})
+}
+
+// UnmarshalBSON reads the objectId from a BSON document
+func (id *ObjectId) UnmarshalBSON(data []byte) error {
+ var obj struct {
+ Data bsonprim.ObjectID
+ }
+ if err := bson.Unmarshal(data, &obj); err != nil {
+ return err
+ }
+ *id = ObjectId(obj.Data)
+ return nil
+}
+
+// MarshalBSONValue is an interface implemented by types that can marshal themselves
+// into a BSON document represented as bytes. The bytes returned must be a valid
+// BSON document if the error is nil.
+func (id ObjectId) MarshalBSONValue() (bsontype.Type, []byte, error) {
+ oid := bsonprim.ObjectID(id)
+ return bsontype.ObjectID, oid[:], nil
+}
+
+// UnmarshalBSONValue is an interface implemented by types that can unmarshal a
+// BSON value representation of themselves. The BSON bytes and type can be
+// assumed to be valid. UnmarshalBSONValue must copy the BSON value bytes if it
+// wishes to retain the data after returning.
+func (id *ObjectId) UnmarshalBSONValue(_ bsontype.Type, data []byte) error {
+ var oid bsonprim.ObjectID
+ copy(oid[:], data)
+ *id = ObjectId(oid)
+ return nil
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (id *ObjectId) DeepCopyInto(out *ObjectId) {
+ *out = *id
+}
+
+// DeepCopy copies the receiver into a new ObjectId.
+func (id *ObjectId) DeepCopy() *ObjectId {
+ if id == nil {
+ return nil
+ }
+ out := new(ObjectId)
+ id.DeepCopyInto(out)
+ return out
+}
diff --git a/vendor/github.com/go-openapi/strfmt/date.go b/vendor/github.com/go-openapi/strfmt/date.go
new file mode 100644
index 0000000000..3c93381c7c
--- /dev/null
+++ b/vendor/github.com/go-openapi/strfmt/date.go
@@ -0,0 +1,187 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package strfmt
+
+import (
+ "database/sql/driver"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "time"
+
+ "go.mongodb.org/mongo-driver/bson"
+)
+
+func init() {
+ d := Date{}
+ // register this format in the default registry
+ Default.Add("date", &d, IsDate)
+}
+
+// IsDate returns true when the string is a valid date
+func IsDate(str string) bool {
+ _, err := time.Parse(RFC3339FullDate, str)
+ return err == nil
+}
+
+const (
+ // RFC3339FullDate represents a full-date as specified by RFC3339
+ // See: http://goo.gl/xXOvVd
+ RFC3339FullDate = "2006-01-02"
+)
+
+// Date represents a date from the API
+//
+// swagger:strfmt date
+type Date time.Time
+
+// String converts this date into a string
+func (d Date) String() string {
+ return time.Time(d).Format(RFC3339FullDate)
+}
+
+// UnmarshalText parses a text representation into a date type
+func (d *Date) UnmarshalText(text []byte) error {
+ if len(text) == 0 {
+ return nil
+ }
+ dd, err := time.ParseInLocation(RFC3339FullDate, string(text), DefaultTimeLocation)
+ if err != nil {
+ return err
+ }
+ *d = Date(dd)
+ return nil
+}
+
+// MarshalText serializes this date type to string
+func (d Date) MarshalText() ([]byte, error) {
+ return []byte(d.String()), nil
+}
+
+// Scan scans a Date value from database driver type.
+func (d *Date) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ return d.UnmarshalText(v)
+ case string:
+ return d.UnmarshalText([]byte(v))
+ case time.Time:
+ *d = Date(v)
+ return nil
+ case nil:
+ *d = Date{}
+ return nil
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.Date from: %#v", v)
+ }
+}
+
+// Value converts Date to a primitive value ready to written to a database.
+func (d Date) Value() (driver.Value, error) {
+ return driver.Value(d.String()), nil
+}
+
+// MarshalJSON returns the Date as JSON
+func (d Date) MarshalJSON() ([]byte, error) {
+ return json.Marshal(time.Time(d).Format(RFC3339FullDate))
+}
+
+// UnmarshalJSON sets the Date from JSON
+func (d *Date) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
+ return nil
+ }
+ var strdate string
+ if err := json.Unmarshal(data, &strdate); err != nil {
+ return err
+ }
+ tt, err := time.ParseInLocation(RFC3339FullDate, strdate, DefaultTimeLocation)
+ if err != nil {
+ return err
+ }
+ *d = Date(tt)
+ return nil
+}
+
+func (d Date) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": d.String()})
+}
+
+func (d *Date) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if data, ok := m["data"].(string); ok {
+ rd, err := time.ParseInLocation(RFC3339FullDate, data, DefaultTimeLocation)
+ if err != nil {
+ return err
+ }
+ *d = Date(rd)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson bytes value as Date")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (d *Date) DeepCopyInto(out *Date) {
+ *out = *d
+}
+
+// DeepCopy copies the receiver into a new Date.
+func (d *Date) DeepCopy() *Date {
+ if d == nil {
+ return nil
+ }
+ out := new(Date)
+ d.DeepCopyInto(out)
+ return out
+}
+
+// GobEncode implements the gob.GobEncoder interface.
+func (d Date) GobEncode() ([]byte, error) {
+ return d.MarshalBinary()
+}
+
+// GobDecode implements the gob.GobDecoder interface.
+func (d *Date) GobDecode(data []byte) error {
+ return d.UnmarshalBinary(data)
+}
+
+// MarshalBinary implements the encoding.BinaryMarshaler interface.
+func (d Date) MarshalBinary() ([]byte, error) {
+ return time.Time(d).MarshalBinary()
+}
+
+// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
+func (d *Date) UnmarshalBinary(data []byte) error {
+ var original time.Time
+
+ err := original.UnmarshalBinary(data)
+ if err != nil {
+ return err
+ }
+
+ *d = Date(original)
+
+ return nil
+}
+
+// Equal checks if two Date instances are equal
+func (d Date) Equal(d2 Date) bool {
+ return time.Time(d).Equal(time.Time(d2))
+}
diff --git a/vendor/github.com/go-openapi/strfmt/default.go b/vendor/github.com/go-openapi/strfmt/default.go
new file mode 100644
index 0000000000..a89a4de3f3
--- /dev/null
+++ b/vendor/github.com/go-openapi/strfmt/default.go
@@ -0,0 +1,2035 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package strfmt
+
+import (
+ "database/sql/driver"
+ "encoding/base64"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "net/mail"
+ "regexp"
+ "strings"
+
+ "github.com/asaskevich/govalidator"
+ "go.mongodb.org/mongo-driver/bson"
+)
+
+const (
+ // HostnamePattern http://json-schema.org/latest/json-schema-validation.html#anchor114
+ // A string instance is valid against this attribute if it is a valid
+ // representation for an Internet host name, as defined by RFC 1034, section 3.1 [RFC1034].
+ // http://tools.ietf.org/html/rfc1034#section-3.5
+ // ::= any one of the ten digits 0 through 9
+ // var digit = /[0-9]/;
+ // ::= any one of the 52 alphabetic characters A through Z in upper case and a through z in lower case
+ // var letter = /[a-zA-Z]/;
+ // ::= |
+ // var letDig = /[0-9a-zA-Z]/;
+ // ::= | "-"
+ // var letDigHyp = /[-0-9a-zA-Z]/;
+ // ::= |
+ // var ldhStr = /[-0-9a-zA-Z]+/;
+ // ::= [ [ ] ]
+ // var label = /[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?/;
+ // ::= | "."
+ // var subdomain = /^[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?(\.[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?)*$/;
+ // ::= | " "
+ //
+ // Additional validations:
+ // - for FDQNs, top-level domain (e.g. ".com"), is at least to letters long (no special characters here)
+ // - hostnames may start with a digit [RFC1123]
+ // - special registered names with an underscore ('_') are not allowed in this context
+ // - dashes are permitted, but not at the start or the end of a segment
+ // - long top-level domain names (e.g. example.london) are permitted
+ // - symbol unicode points are permitted (e.g. emoji) (not for top-level domain)
+ HostnamePattern = `^([a-zA-Z0-9\p{S}\p{L}]((-?[a-zA-Z0-9\p{S}\p{L}]{0,62})?)|([a-zA-Z0-9\p{S}\p{L}](([a-zA-Z0-9-\p{S}\p{L}]{0,61}[a-zA-Z0-9\p{S}\p{L}])?)(\.)){1,}([a-zA-Z\p{L}]){2,63})$`
+ // UUIDPattern Regex for UUID that allows uppercase
+ UUIDPattern = `(?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$`
+ // UUID3Pattern Regex for UUID3 that allows uppercase
+ UUID3Pattern = `(?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?3[0-9a-f]{3}-?[0-9a-f]{4}-?[0-9a-f]{12}$`
+ // UUID4Pattern Regex for UUID4 that allows uppercase
+ UUID4Pattern = `(?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$`
+ // UUID5Pattern Regex for UUID5 that allows uppercase
+ UUID5Pattern = `(?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?5[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$`
+ // json null type
+ jsonNull = "null"
+)
+
+var (
+ rxHostname = regexp.MustCompile(HostnamePattern)
+ rxUUID = regexp.MustCompile(UUIDPattern)
+ rxUUID3 = regexp.MustCompile(UUID3Pattern)
+ rxUUID4 = regexp.MustCompile(UUID4Pattern)
+ rxUUID5 = regexp.MustCompile(UUID5Pattern)
+)
+
+// IsHostname returns true when the string is a valid hostname
+func IsHostname(str string) bool {
+ if !rxHostname.MatchString(str) {
+ return false
+ }
+
+ // the sum of all label octets and label lengths is limited to 255.
+ if len(str) > 255 {
+ return false
+ }
+
+ // Each node has a label, which is zero to 63 octets in length
+ parts := strings.Split(str, ".")
+ valid := true
+ for _, p := range parts {
+ if len(p) > 63 {
+ valid = false
+ }
+ }
+ return valid
+}
+
+// IsUUID returns true is the string matches a UUID, upper case is allowed
+func IsUUID(str string) bool {
+ return rxUUID.MatchString(str)
+}
+
+// IsUUID3 returns true is the string matches a UUID, upper case is allowed
+func IsUUID3(str string) bool {
+ return rxUUID3.MatchString(str)
+}
+
+// IsUUID4 returns true is the string matches a UUID, upper case is allowed
+func IsUUID4(str string) bool {
+ return rxUUID4.MatchString(str)
+}
+
+// IsUUID5 returns true is the string matches a UUID, upper case is allowed
+func IsUUID5(str string) bool {
+ return rxUUID5.MatchString(str)
+}
+
+// IsEmail validates an email address.
+func IsEmail(str string) bool {
+ addr, e := mail.ParseAddress(str)
+ return e == nil && addr.Address != ""
+}
+
+func init() {
+ // register formats in the default registry:
+ // - byte
+ // - creditcard
+ // - email
+ // - hexcolor
+ // - hostname
+ // - ipv4
+ // - ipv6
+ // - cidr
+ // - isbn
+ // - isbn10
+ // - isbn13
+ // - mac
+ // - password
+ // - rgbcolor
+ // - ssn
+ // - uri
+ // - uuid
+ // - uuid3
+ // - uuid4
+ // - uuid5
+ u := URI("")
+ Default.Add("uri", &u, govalidator.IsRequestURI)
+
+ eml := Email("")
+ Default.Add("email", &eml, IsEmail)
+
+ hn := Hostname("")
+ Default.Add("hostname", &hn, IsHostname)
+
+ ip4 := IPv4("")
+ Default.Add("ipv4", &ip4, govalidator.IsIPv4)
+
+ ip6 := IPv6("")
+ Default.Add("ipv6", &ip6, govalidator.IsIPv6)
+
+ cidr := CIDR("")
+ Default.Add("cidr", &cidr, govalidator.IsCIDR)
+
+ mac := MAC("")
+ Default.Add("mac", &mac, govalidator.IsMAC)
+
+ uid := UUID("")
+ Default.Add("uuid", &uid, IsUUID)
+
+ uid3 := UUID3("")
+ Default.Add("uuid3", &uid3, IsUUID3)
+
+ uid4 := UUID4("")
+ Default.Add("uuid4", &uid4, IsUUID4)
+
+ uid5 := UUID5("")
+ Default.Add("uuid5", &uid5, IsUUID5)
+
+ isbn := ISBN("")
+ Default.Add("isbn", &isbn, func(str string) bool { return govalidator.IsISBN10(str) || govalidator.IsISBN13(str) })
+
+ isbn10 := ISBN10("")
+ Default.Add("isbn10", &isbn10, govalidator.IsISBN10)
+
+ isbn13 := ISBN13("")
+ Default.Add("isbn13", &isbn13, govalidator.IsISBN13)
+
+ cc := CreditCard("")
+ Default.Add("creditcard", &cc, govalidator.IsCreditCard)
+
+ ssn := SSN("")
+ Default.Add("ssn", &ssn, govalidator.IsSSN)
+
+ hc := HexColor("")
+ Default.Add("hexcolor", &hc, govalidator.IsHexcolor)
+
+ rc := RGBColor("")
+ Default.Add("rgbcolor", &rc, govalidator.IsRGBcolor)
+
+ b64 := Base64([]byte(nil))
+ Default.Add("byte", &b64, govalidator.IsBase64)
+
+ pw := Password("")
+ Default.Add("password", &pw, func(_ string) bool { return true })
+}
+
+// Base64 represents a base64 encoded string, using URLEncoding alphabet
+//
+// swagger:strfmt byte
+type Base64 []byte
+
+// MarshalText turns this instance into text
+func (b Base64) MarshalText() ([]byte, error) {
+ enc := base64.URLEncoding
+ src := []byte(b)
+ buf := make([]byte, enc.EncodedLen(len(src)))
+ enc.Encode(buf, src)
+ return buf, nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (b *Base64) UnmarshalText(data []byte) error { // validation is performed later on
+ enc := base64.URLEncoding
+ dbuf := make([]byte, enc.DecodedLen(len(data)))
+
+ n, err := enc.Decode(dbuf, data)
+ if err != nil {
+ return err
+ }
+
+ *b = dbuf[:n]
+ return nil
+}
+
+// Scan read a value from a database driver
+func (b *Base64) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ dbuf := make([]byte, base64.StdEncoding.DecodedLen(len(v)))
+ n, err := base64.StdEncoding.Decode(dbuf, v)
+ if err != nil {
+ return err
+ }
+ *b = dbuf[:n]
+ case string:
+ vv, err := base64.StdEncoding.DecodeString(v)
+ if err != nil {
+ return err
+ }
+ *b = Base64(vv)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.Base64 from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (b Base64) Value() (driver.Value, error) {
+ return driver.Value(b.String()), nil
+}
+
+func (b Base64) String() string {
+ return base64.StdEncoding.EncodeToString([]byte(b))
+}
+
+// MarshalJSON returns the Base64 as JSON
+func (b Base64) MarshalJSON() ([]byte, error) {
+ return json.Marshal(b.String())
+}
+
+// UnmarshalJSON sets the Base64 from JSON
+func (b *Base64) UnmarshalJSON(data []byte) error {
+ var b64str string
+ if err := json.Unmarshal(data, &b64str); err != nil {
+ return err
+ }
+ vb, err := base64.StdEncoding.DecodeString(b64str)
+ if err != nil {
+ return err
+ }
+ *b = Base64(vb)
+ return nil
+}
+
+// MarshalBSON document from this value
+func (b Base64) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": b.String()})
+}
+
+// UnmarshalBSON document into this value
+func (b *Base64) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if bd, ok := m["data"].(string); ok {
+ vb, err := base64.StdEncoding.DecodeString(bd)
+ if err != nil {
+ return err
+ }
+ *b = Base64(vb)
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as base64")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (b *Base64) DeepCopyInto(out *Base64) {
+ *out = *b
+}
+
+// DeepCopy copies the receiver into a new Base64.
+func (b *Base64) DeepCopy() *Base64 {
+ if b == nil {
+ return nil
+ }
+ out := new(Base64)
+ b.DeepCopyInto(out)
+ return out
+}
+
+// URI represents the uri string format as specified by the json schema spec
+//
+// swagger:strfmt uri
+type URI string
+
+// MarshalText turns this instance into text
+func (u URI) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *URI) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = URI(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *URI) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = URI(string(v))
+ case string:
+ *u = URI(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.URI from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u URI) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u URI) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the URI as JSON
+func (u URI) MarshalJSON() ([]byte, error) {
+ return json.Marshal(string(u))
+}
+
+// UnmarshalJSON sets the URI from JSON
+func (u *URI) UnmarshalJSON(data []byte) error {
+ var uristr string
+ if err := json.Unmarshal(data, &uristr); err != nil {
+ return err
+ }
+ *u = URI(uristr)
+ return nil
+}
+
+// MarshalBSON document from this value
+func (u URI) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *URI) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = URI(ud)
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as uri")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (u *URI) DeepCopyInto(out *URI) {
+ *out = *u
+}
+
+// DeepCopy copies the receiver into a new URI.
+func (u *URI) DeepCopy() *URI {
+ if u == nil {
+ return nil
+ }
+ out := new(URI)
+ u.DeepCopyInto(out)
+ return out
+}
+
+// Email represents the email string format as specified by the json schema spec
+//
+// swagger:strfmt email
+type Email string
+
+// MarshalText turns this instance into text
+func (e Email) MarshalText() ([]byte, error) {
+ return []byte(string(e)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (e *Email) UnmarshalText(data []byte) error { // validation is performed later on
+ *e = Email(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (e *Email) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *e = Email(string(v))
+ case string:
+ *e = Email(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.Email from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (e Email) Value() (driver.Value, error) {
+ return driver.Value(string(e)), nil
+}
+
+func (e Email) String() string {
+ return string(e)
+}
+
+// MarshalJSON returns the Email as JSON
+func (e Email) MarshalJSON() ([]byte, error) {
+ return json.Marshal(string(e))
+}
+
+// UnmarshalJSON sets the Email from JSON
+func (e *Email) UnmarshalJSON(data []byte) error {
+ var estr string
+ if err := json.Unmarshal(data, &estr); err != nil {
+ return err
+ }
+ *e = Email(estr)
+ return nil
+}
+
+// MarshalBSON document from this value
+func (e Email) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": e.String()})
+}
+
+// UnmarshalBSON document into this value
+func (e *Email) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *e = Email(ud)
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as email")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (e *Email) DeepCopyInto(out *Email) {
+ *out = *e
+}
+
+// DeepCopy copies the receiver into a new Email.
+func (e *Email) DeepCopy() *Email {
+ if e == nil {
+ return nil
+ }
+ out := new(Email)
+ e.DeepCopyInto(out)
+ return out
+}
+
+// Hostname represents the hostname string format as specified by the json schema spec
+//
+// swagger:strfmt hostname
+type Hostname string
+
+// MarshalText turns this instance into text
+func (h Hostname) MarshalText() ([]byte, error) {
+ return []byte(string(h)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (h *Hostname) UnmarshalText(data []byte) error { // validation is performed later on
+ *h = Hostname(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (h *Hostname) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *h = Hostname(string(v))
+ case string:
+ *h = Hostname(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.Hostname from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (h Hostname) Value() (driver.Value, error) {
+ return driver.Value(string(h)), nil
+}
+
+func (h Hostname) String() string {
+ return string(h)
+}
+
+// MarshalJSON returns the Hostname as JSON
+func (h Hostname) MarshalJSON() ([]byte, error) {
+ return json.Marshal(string(h))
+}
+
+// UnmarshalJSON sets the Hostname from JSON
+func (h *Hostname) UnmarshalJSON(data []byte) error {
+ var hstr string
+ if err := json.Unmarshal(data, &hstr); err != nil {
+ return err
+ }
+ *h = Hostname(hstr)
+ return nil
+}
+
+// MarshalBSON document from this value
+func (h Hostname) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": h.String()})
+}
+
+// UnmarshalBSON document into this value
+func (h *Hostname) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *h = Hostname(ud)
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as hostname")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (h *Hostname) DeepCopyInto(out *Hostname) {
+ *out = *h
+}
+
+// DeepCopy copies the receiver into a new Hostname.
+func (h *Hostname) DeepCopy() *Hostname {
+ if h == nil {
+ return nil
+ }
+ out := new(Hostname)
+ h.DeepCopyInto(out)
+ return out
+}
+
+// IPv4 represents an IP v4 address
+//
+// swagger:strfmt ipv4
+type IPv4 string
+
+// MarshalText turns this instance into text
+func (u IPv4) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *IPv4) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = IPv4(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *IPv4) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = IPv4(string(v))
+ case string:
+ *u = IPv4(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.IPv4 from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u IPv4) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u IPv4) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the IPv4 as JSON
+func (u IPv4) MarshalJSON() ([]byte, error) {
+ return json.Marshal(string(u))
+}
+
+// UnmarshalJSON sets the IPv4 from JSON
+func (u *IPv4) UnmarshalJSON(data []byte) error {
+ var ustr string
+ if err := json.Unmarshal(data, &ustr); err != nil {
+ return err
+ }
+ *u = IPv4(ustr)
+ return nil
+}
+
+// MarshalBSON document from this value
+func (u IPv4) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *IPv4) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = IPv4(ud)
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as ipv4")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (u *IPv4) DeepCopyInto(out *IPv4) {
+ *out = *u
+}
+
+// DeepCopy copies the receiver into a new IPv4.
+func (u *IPv4) DeepCopy() *IPv4 {
+ if u == nil {
+ return nil
+ }
+ out := new(IPv4)
+ u.DeepCopyInto(out)
+ return out
+}
+
+// IPv6 represents an IP v6 address
+//
+// swagger:strfmt ipv6
+type IPv6 string
+
+// MarshalText turns this instance into text
+func (u IPv6) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *IPv6) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = IPv6(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *IPv6) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = IPv6(string(v))
+ case string:
+ *u = IPv6(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.IPv6 from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u IPv6) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u IPv6) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the IPv6 as JSON
+func (u IPv6) MarshalJSON() ([]byte, error) {
+ return json.Marshal(string(u))
+}
+
+// UnmarshalJSON sets the IPv6 from JSON
+func (u *IPv6) UnmarshalJSON(data []byte) error {
+ var ustr string
+ if err := json.Unmarshal(data, &ustr); err != nil {
+ return err
+ }
+ *u = IPv6(ustr)
+ return nil
+}
+
+// MarshalBSON document from this value
+func (u IPv6) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *IPv6) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = IPv6(ud)
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as ipv6")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (u *IPv6) DeepCopyInto(out *IPv6) {
+ *out = *u
+}
+
+// DeepCopy copies the receiver into a new IPv6.
+func (u *IPv6) DeepCopy() *IPv6 {
+ if u == nil {
+ return nil
+ }
+ out := new(IPv6)
+ u.DeepCopyInto(out)
+ return out
+}
+
+// CIDR represents a Classless Inter-Domain Routing notation
+//
+// swagger:strfmt cidr
+type CIDR string
+
+// MarshalText turns this instance into text
+func (u CIDR) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *CIDR) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = CIDR(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *CIDR) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = CIDR(string(v))
+ case string:
+ *u = CIDR(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.CIDR from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u CIDR) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u CIDR) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the CIDR as JSON
+func (u CIDR) MarshalJSON() ([]byte, error) {
+ return json.Marshal(string(u))
+}
+
+// UnmarshalJSON sets the CIDR from JSON
+func (u *CIDR) UnmarshalJSON(data []byte) error {
+ var ustr string
+ if err := json.Unmarshal(data, &ustr); err != nil {
+ return err
+ }
+ *u = CIDR(ustr)
+ return nil
+}
+
+// MarshalBSON document from this value
+func (u CIDR) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *CIDR) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = CIDR(ud)
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as CIDR")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (u *CIDR) DeepCopyInto(out *CIDR) {
+ *out = *u
+}
+
+// DeepCopy copies the receiver into a new CIDR.
+func (u *CIDR) DeepCopy() *CIDR {
+ if u == nil {
+ return nil
+ }
+ out := new(CIDR)
+ u.DeepCopyInto(out)
+ return out
+}
+
+// MAC represents a 48 bit MAC address
+//
+// swagger:strfmt mac
+type MAC string
+
+// MarshalText turns this instance into text
+func (u MAC) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *MAC) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = MAC(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *MAC) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = MAC(string(v))
+ case string:
+ *u = MAC(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.IPv4 from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u MAC) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u MAC) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the MAC as JSON
+func (u MAC) MarshalJSON() ([]byte, error) {
+ return json.Marshal(string(u))
+}
+
+// UnmarshalJSON sets the MAC from JSON
+func (u *MAC) UnmarshalJSON(data []byte) error {
+ var ustr string
+ if err := json.Unmarshal(data, &ustr); err != nil {
+ return err
+ }
+ *u = MAC(ustr)
+ return nil
+}
+
+// MarshalBSON document from this value
+func (u MAC) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *MAC) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = MAC(ud)
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as MAC")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (u *MAC) DeepCopyInto(out *MAC) {
+ *out = *u
+}
+
+// DeepCopy copies the receiver into a new MAC.
+func (u *MAC) DeepCopy() *MAC {
+ if u == nil {
+ return nil
+ }
+ out := new(MAC)
+ u.DeepCopyInto(out)
+ return out
+}
+
+// UUID represents a uuid string format
+//
+// swagger:strfmt uuid
+type UUID string
+
+// MarshalText turns this instance into text
+func (u UUID) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *UUID) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = UUID(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *UUID) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = UUID(string(v))
+ case string:
+ *u = UUID(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.UUID from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u UUID) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u UUID) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the UUID as JSON
+func (u UUID) MarshalJSON() ([]byte, error) {
+ return json.Marshal(string(u))
+}
+
+// UnmarshalJSON sets the UUID from JSON
+func (u *UUID) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
+ return nil
+ }
+ var ustr string
+ if err := json.Unmarshal(data, &ustr); err != nil {
+ return err
+ }
+ *u = UUID(ustr)
+ return nil
+}
+
+// MarshalBSON document from this value
+func (u UUID) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *UUID) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = UUID(ud)
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as UUID")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (u *UUID) DeepCopyInto(out *UUID) {
+ *out = *u
+}
+
+// DeepCopy copies the receiver into a new UUID.
+func (u *UUID) DeepCopy() *UUID {
+ if u == nil {
+ return nil
+ }
+ out := new(UUID)
+ u.DeepCopyInto(out)
+ return out
+}
+
+// UUID3 represents a uuid3 string format
+//
+// swagger:strfmt uuid3
+type UUID3 string
+
+// MarshalText turns this instance into text
+func (u UUID3) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *UUID3) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = UUID3(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *UUID3) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = UUID3(string(v))
+ case string:
+ *u = UUID3(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.UUID3 from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u UUID3) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u UUID3) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the UUID as JSON
+func (u UUID3) MarshalJSON() ([]byte, error) {
+ return json.Marshal(string(u))
+}
+
+// UnmarshalJSON sets the UUID from JSON
+func (u *UUID3) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
+ return nil
+ }
+ var ustr string
+ if err := json.Unmarshal(data, &ustr); err != nil {
+ return err
+ }
+ *u = UUID3(ustr)
+ return nil
+}
+
+// MarshalBSON document from this value
+func (u UUID3) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *UUID3) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = UUID3(ud)
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as UUID3")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (u *UUID3) DeepCopyInto(out *UUID3) {
+ *out = *u
+}
+
+// DeepCopy copies the receiver into a new UUID3.
+func (u *UUID3) DeepCopy() *UUID3 {
+ if u == nil {
+ return nil
+ }
+ out := new(UUID3)
+ u.DeepCopyInto(out)
+ return out
+}
+
+// UUID4 represents a uuid4 string format
+//
+// swagger:strfmt uuid4
+type UUID4 string
+
+// MarshalText turns this instance into text
+func (u UUID4) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *UUID4) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = UUID4(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *UUID4) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = UUID4(string(v))
+ case string:
+ *u = UUID4(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.UUID4 from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u UUID4) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u UUID4) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the UUID as JSON
+func (u UUID4) MarshalJSON() ([]byte, error) {
+ return json.Marshal(string(u))
+}
+
+// UnmarshalJSON sets the UUID from JSON
+func (u *UUID4) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
+ return nil
+ }
+ var ustr string
+ if err := json.Unmarshal(data, &ustr); err != nil {
+ return err
+ }
+ *u = UUID4(ustr)
+ return nil
+}
+
+// MarshalBSON document from this value
+func (u UUID4) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *UUID4) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = UUID4(ud)
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as UUID4")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (u *UUID4) DeepCopyInto(out *UUID4) {
+ *out = *u
+}
+
+// DeepCopy copies the receiver into a new UUID4.
+func (u *UUID4) DeepCopy() *UUID4 {
+ if u == nil {
+ return nil
+ }
+ out := new(UUID4)
+ u.DeepCopyInto(out)
+ return out
+}
+
+// UUID5 represents a uuid5 string format
+//
+// swagger:strfmt uuid5
+type UUID5 string
+
+// MarshalText turns this instance into text
+func (u UUID5) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *UUID5) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = UUID5(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *UUID5) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = UUID5(string(v))
+ case string:
+ *u = UUID5(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.UUID5 from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u UUID5) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u UUID5) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the UUID as JSON
+func (u UUID5) MarshalJSON() ([]byte, error) {
+ return json.Marshal(string(u))
+}
+
+// UnmarshalJSON sets the UUID from JSON
+func (u *UUID5) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
+ return nil
+ }
+ var ustr string
+ if err := json.Unmarshal(data, &ustr); err != nil {
+ return err
+ }
+ *u = UUID5(ustr)
+ return nil
+}
+
+// MarshalBSON document from this value
+func (u UUID5) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *UUID5) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = UUID5(ud)
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as UUID5")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (u *UUID5) DeepCopyInto(out *UUID5) {
+ *out = *u
+}
+
+// DeepCopy copies the receiver into a new UUID5.
+func (u *UUID5) DeepCopy() *UUID5 {
+ if u == nil {
+ return nil
+ }
+ out := new(UUID5)
+ u.DeepCopyInto(out)
+ return out
+}
+
+// ISBN represents an isbn string format
+//
+// swagger:strfmt isbn
+type ISBN string
+
+// MarshalText turns this instance into text
+func (u ISBN) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *ISBN) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = ISBN(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *ISBN) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = ISBN(string(v))
+ case string:
+ *u = ISBN(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.ISBN from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u ISBN) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u ISBN) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the ISBN as JSON
+func (u ISBN) MarshalJSON() ([]byte, error) {
+ return json.Marshal(string(u))
+}
+
+// UnmarshalJSON sets the ISBN from JSON
+func (u *ISBN) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
+ return nil
+ }
+ var ustr string
+ if err := json.Unmarshal(data, &ustr); err != nil {
+ return err
+ }
+ *u = ISBN(ustr)
+ return nil
+}
+
+// MarshalBSON document from this value
+func (u ISBN) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *ISBN) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = ISBN(ud)
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as ISBN")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (u *ISBN) DeepCopyInto(out *ISBN) {
+ *out = *u
+}
+
+// DeepCopy copies the receiver into a new ISBN.
+func (u *ISBN) DeepCopy() *ISBN {
+ if u == nil {
+ return nil
+ }
+ out := new(ISBN)
+ u.DeepCopyInto(out)
+ return out
+}
+
+// ISBN10 represents an isbn 10 string format
+//
+// swagger:strfmt isbn10
+type ISBN10 string
+
+// MarshalText turns this instance into text
+func (u ISBN10) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *ISBN10) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = ISBN10(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *ISBN10) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = ISBN10(string(v))
+ case string:
+ *u = ISBN10(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.ISBN10 from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u ISBN10) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u ISBN10) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the ISBN10 as JSON
+func (u ISBN10) MarshalJSON() ([]byte, error) {
+ return json.Marshal(string(u))
+}
+
+// UnmarshalJSON sets the ISBN10 from JSON
+func (u *ISBN10) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
+ return nil
+ }
+ var ustr string
+ if err := json.Unmarshal(data, &ustr); err != nil {
+ return err
+ }
+ *u = ISBN10(ustr)
+ return nil
+}
+
+// MarshalBSON document from this value
+func (u ISBN10) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *ISBN10) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = ISBN10(ud)
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as ISBN10")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (u *ISBN10) DeepCopyInto(out *ISBN10) {
+ *out = *u
+}
+
+// DeepCopy copies the receiver into a new ISBN10.
+func (u *ISBN10) DeepCopy() *ISBN10 {
+ if u == nil {
+ return nil
+ }
+ out := new(ISBN10)
+ u.DeepCopyInto(out)
+ return out
+}
+
+// ISBN13 represents an isbn 13 string format
+//
+// swagger:strfmt isbn13
+type ISBN13 string
+
+// MarshalText turns this instance into text
+func (u ISBN13) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *ISBN13) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = ISBN13(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *ISBN13) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = ISBN13(string(v))
+ case string:
+ *u = ISBN13(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.ISBN13 from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u ISBN13) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u ISBN13) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the ISBN13 as JSON
+func (u ISBN13) MarshalJSON() ([]byte, error) {
+ return json.Marshal(string(u))
+}
+
+// UnmarshalJSON sets the ISBN13 from JSON
+func (u *ISBN13) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
+ return nil
+ }
+ var ustr string
+ if err := json.Unmarshal(data, &ustr); err != nil {
+ return err
+ }
+ *u = ISBN13(ustr)
+ return nil
+}
+
+// MarshalBSON document from this value
+func (u ISBN13) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *ISBN13) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = ISBN13(ud)
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as ISBN13")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (u *ISBN13) DeepCopyInto(out *ISBN13) {
+ *out = *u
+}
+
+// DeepCopy copies the receiver into a new ISBN13.
+func (u *ISBN13) DeepCopy() *ISBN13 {
+ if u == nil {
+ return nil
+ }
+ out := new(ISBN13)
+ u.DeepCopyInto(out)
+ return out
+}
+
+// CreditCard represents a credit card string format
+//
+// swagger:strfmt creditcard
+type CreditCard string
+
+// MarshalText turns this instance into text
+func (u CreditCard) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *CreditCard) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = CreditCard(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *CreditCard) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = CreditCard(string(v))
+ case string:
+ *u = CreditCard(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.CreditCard from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u CreditCard) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u CreditCard) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the CreditCard as JSON
+func (u CreditCard) MarshalJSON() ([]byte, error) {
+ return json.Marshal(string(u))
+}
+
+// UnmarshalJSON sets the CreditCard from JSON
+func (u *CreditCard) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
+ return nil
+ }
+ var ustr string
+ if err := json.Unmarshal(data, &ustr); err != nil {
+ return err
+ }
+ *u = CreditCard(ustr)
+ return nil
+}
+
+// MarshalBSON document from this value
+func (u CreditCard) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *CreditCard) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = CreditCard(ud)
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as CreditCard")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (u *CreditCard) DeepCopyInto(out *CreditCard) {
+ *out = *u
+}
+
+// DeepCopy copies the receiver into a new CreditCard.
+func (u *CreditCard) DeepCopy() *CreditCard {
+ if u == nil {
+ return nil
+ }
+ out := new(CreditCard)
+ u.DeepCopyInto(out)
+ return out
+}
+
+// SSN represents a social security string format
+//
+// swagger:strfmt ssn
+type SSN string
+
+// MarshalText turns this instance into text
+func (u SSN) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *SSN) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = SSN(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *SSN) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = SSN(string(v))
+ case string:
+ *u = SSN(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.SSN from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u SSN) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u SSN) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the SSN as JSON
+func (u SSN) MarshalJSON() ([]byte, error) {
+ return json.Marshal(string(u))
+}
+
+// UnmarshalJSON sets the SSN from JSON
+func (u *SSN) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
+ return nil
+ }
+ var ustr string
+ if err := json.Unmarshal(data, &ustr); err != nil {
+ return err
+ }
+ *u = SSN(ustr)
+ return nil
+}
+
+// MarshalBSON document from this value
+func (u SSN) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *SSN) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = SSN(ud)
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as SSN")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (u *SSN) DeepCopyInto(out *SSN) {
+ *out = *u
+}
+
+// DeepCopy copies the receiver into a new SSN.
+func (u *SSN) DeepCopy() *SSN {
+ if u == nil {
+ return nil
+ }
+ out := new(SSN)
+ u.DeepCopyInto(out)
+ return out
+}
+
+// HexColor represents a hex color string format
+//
+// swagger:strfmt hexcolor
+type HexColor string
+
+// MarshalText turns this instance into text
+func (h HexColor) MarshalText() ([]byte, error) {
+ return []byte(string(h)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (h *HexColor) UnmarshalText(data []byte) error { // validation is performed later on
+ *h = HexColor(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (h *HexColor) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *h = HexColor(string(v))
+ case string:
+ *h = HexColor(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.HexColor from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (h HexColor) Value() (driver.Value, error) {
+ return driver.Value(string(h)), nil
+}
+
+func (h HexColor) String() string {
+ return string(h)
+}
+
+// MarshalJSON returns the HexColor as JSON
+func (h HexColor) MarshalJSON() ([]byte, error) {
+ return json.Marshal(string(h))
+}
+
+// UnmarshalJSON sets the HexColor from JSON
+func (h *HexColor) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
+ return nil
+ }
+ var ustr string
+ if err := json.Unmarshal(data, &ustr); err != nil {
+ return err
+ }
+ *h = HexColor(ustr)
+ return nil
+}
+
+// MarshalBSON document from this value
+func (h HexColor) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": h.String()})
+}
+
+// UnmarshalBSON document into this value
+func (h *HexColor) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *h = HexColor(ud)
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as HexColor")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (h *HexColor) DeepCopyInto(out *HexColor) {
+ *out = *h
+}
+
+// DeepCopy copies the receiver into a new HexColor.
+func (h *HexColor) DeepCopy() *HexColor {
+ if h == nil {
+ return nil
+ }
+ out := new(HexColor)
+ h.DeepCopyInto(out)
+ return out
+}
+
+// RGBColor represents a RGB color string format
+//
+// swagger:strfmt rgbcolor
+type RGBColor string
+
+// MarshalText turns this instance into text
+func (r RGBColor) MarshalText() ([]byte, error) {
+ return []byte(string(r)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (r *RGBColor) UnmarshalText(data []byte) error { // validation is performed later on
+ *r = RGBColor(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (r *RGBColor) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *r = RGBColor(string(v))
+ case string:
+ *r = RGBColor(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.RGBColor from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (r RGBColor) Value() (driver.Value, error) {
+ return driver.Value(string(r)), nil
+}
+
+func (r RGBColor) String() string {
+ return string(r)
+}
+
+// MarshalJSON returns the RGBColor as JSON
+func (r RGBColor) MarshalJSON() ([]byte, error) {
+ return json.Marshal(string(r))
+}
+
+// UnmarshalJSON sets the RGBColor from JSON
+func (r *RGBColor) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
+ return nil
+ }
+ var ustr string
+ if err := json.Unmarshal(data, &ustr); err != nil {
+ return err
+ }
+ *r = RGBColor(ustr)
+ return nil
+}
+
+// MarshalBSON document from this value
+func (r RGBColor) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": r.String()})
+}
+
+// UnmarshalBSON document into this value
+func (r *RGBColor) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *r = RGBColor(ud)
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as RGBColor")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (r *RGBColor) DeepCopyInto(out *RGBColor) {
+ *out = *r
+}
+
+// DeepCopy copies the receiver into a new RGBColor.
+func (r *RGBColor) DeepCopy() *RGBColor {
+ if r == nil {
+ return nil
+ }
+ out := new(RGBColor)
+ r.DeepCopyInto(out)
+ return out
+}
+
+// Password represents a password.
+// This has no validations and is mainly used as a marker for UI components.
+//
+// swagger:strfmt password
+type Password string
+
+// MarshalText turns this instance into text
+func (r Password) MarshalText() ([]byte, error) {
+ return []byte(string(r)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (r *Password) UnmarshalText(data []byte) error { // validation is performed later on
+ *r = Password(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (r *Password) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *r = Password(string(v))
+ case string:
+ *r = Password(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.Password from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (r Password) Value() (driver.Value, error) {
+ return driver.Value(string(r)), nil
+}
+
+func (r Password) String() string {
+ return string(r)
+}
+
+// MarshalJSON returns the Password as JSON
+func (r Password) MarshalJSON() ([]byte, error) {
+ return json.Marshal(string(r))
+}
+
+// UnmarshalJSON sets the Password from JSON
+func (r *Password) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
+ return nil
+ }
+ var ustr string
+ if err := json.Unmarshal(data, &ustr); err != nil {
+ return err
+ }
+ *r = Password(ustr)
+ return nil
+}
+
+// MarshalBSON document from this value
+func (r Password) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": r.String()})
+}
+
+// UnmarshalBSON document into this value
+func (r *Password) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *r = Password(ud)
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as Password")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (r *Password) DeepCopyInto(out *Password) {
+ *out = *r
+}
+
+// DeepCopy copies the receiver into a new Password.
+func (r *Password) DeepCopy() *Password {
+ if r == nil {
+ return nil
+ }
+ out := new(Password)
+ r.DeepCopyInto(out)
+ return out
+}
diff --git a/vendor/github.com/go-openapi/strfmt/doc.go b/vendor/github.com/go-openapi/strfmt/doc.go
new file mode 100644
index 0000000000..41aebe6d51
--- /dev/null
+++ b/vendor/github.com/go-openapi/strfmt/doc.go
@@ -0,0 +1,18 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package strfmt contains custom string formats
+//
+// TODO: add info on how to define and register a custom format
+package strfmt
diff --git a/vendor/github.com/go-openapi/strfmt/duration.go b/vendor/github.com/go-openapi/strfmt/duration.go
new file mode 100644
index 0000000000..6284b821fc
--- /dev/null
+++ b/vendor/github.com/go-openapi/strfmt/duration.go
@@ -0,0 +1,211 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package strfmt
+
+import (
+ "database/sql/driver"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "regexp"
+ "strconv"
+ "strings"
+ "time"
+
+ "go.mongodb.org/mongo-driver/bson"
+)
+
+func init() {
+ d := Duration(0)
+ // register this format in the default registry
+ Default.Add("duration", &d, IsDuration)
+}
+
+var (
+ timeUnits = [][]string{
+ {"ns", "nano"},
+ {"us", "µs", "micro"},
+ {"ms", "milli"},
+ {"s", "sec"},
+ {"m", "min"},
+ {"h", "hr", "hour"},
+ {"d", "day"},
+ {"w", "wk", "week"},
+ }
+
+ timeMultiplier = map[string]time.Duration{
+ "ns": time.Nanosecond,
+ "us": time.Microsecond,
+ "ms": time.Millisecond,
+ "s": time.Second,
+ "m": time.Minute,
+ "h": time.Hour,
+ "d": 24 * time.Hour,
+ "w": 7 * 24 * time.Hour,
+ }
+
+ durationMatcher = regexp.MustCompile(`((\d+)\s*([A-Za-zµ]+))`)
+)
+
+// IsDuration returns true if the provided string is a valid duration
+func IsDuration(str string) bool {
+ _, err := ParseDuration(str)
+ return err == nil
+}
+
+// Duration represents a duration
+//
+// Duration stores a period of time as a nanosecond count, with the largest
+// repesentable duration being approximately 290 years.
+//
+// swagger:strfmt duration
+type Duration time.Duration
+
+// MarshalText turns this instance into text
+func (d Duration) MarshalText() ([]byte, error) {
+ return []byte(time.Duration(d).String()), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (d *Duration) UnmarshalText(data []byte) error { // validation is performed later on
+ dd, err := ParseDuration(string(data))
+ if err != nil {
+ return err
+ }
+ *d = Duration(dd)
+ return nil
+}
+
+// ParseDuration parses a duration from a string, compatible with scala duration syntax
+func ParseDuration(cand string) (time.Duration, error) {
+ if dur, err := time.ParseDuration(cand); err == nil {
+ return dur, nil
+ }
+
+ var dur time.Duration
+ ok := false
+ for _, match := range durationMatcher.FindAllStringSubmatch(cand, -1) {
+
+ factor, err := strconv.Atoi(match[2]) // converts string to int
+ if err != nil {
+ return 0, err
+ }
+ unit := strings.ToLower(strings.TrimSpace(match[3]))
+
+ for _, variants := range timeUnits {
+ last := len(variants) - 1
+ multiplier := timeMultiplier[variants[0]]
+
+ for i, variant := range variants {
+ if (last == i && strings.HasPrefix(unit, variant)) || strings.EqualFold(variant, unit) {
+ ok = true
+ dur += (time.Duration(factor) * multiplier)
+ }
+ }
+ }
+ }
+
+ if ok {
+ return dur, nil
+ }
+ return 0, fmt.Errorf("unable to parse %s as duration", cand)
+}
+
+// Scan reads a Duration value from database driver type.
+func (d *Duration) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ // TODO: case []byte: // ?
+ case int64:
+ *d = Duration(v)
+ case float64:
+ *d = Duration(int64(v))
+ case nil:
+ *d = Duration(0)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.Duration from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts Duration to a primitive value ready to be written to a database.
+func (d Duration) Value() (driver.Value, error) {
+ return driver.Value(int64(d)), nil
+}
+
+// String converts this duration to a string
+func (d Duration) String() string {
+ return time.Duration(d).String()
+}
+
+// MarshalJSON returns the Duration as JSON
+func (d Duration) MarshalJSON() ([]byte, error) {
+ return json.Marshal(time.Duration(d).String())
+}
+
+// UnmarshalJSON sets the Duration from JSON
+func (d *Duration) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
+ return nil
+ }
+
+ var dstr string
+ if err := json.Unmarshal(data, &dstr); err != nil {
+ return err
+ }
+ tt, err := ParseDuration(dstr)
+ if err != nil {
+ return err
+ }
+ *d = Duration(tt)
+ return nil
+}
+
+func (d Duration) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": d.String()})
+}
+
+func (d *Duration) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if data, ok := m["data"].(string); ok {
+ rd, err := ParseDuration(data)
+ if err != nil {
+ return err
+ }
+ *d = Duration(rd)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson bytes value as Date")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (d *Duration) DeepCopyInto(out *Duration) {
+ *out = *d
+}
+
+// DeepCopy copies the receiver into a new Duration.
+func (d *Duration) DeepCopy() *Duration {
+ if d == nil {
+ return nil
+ }
+ out := new(Duration)
+ d.DeepCopyInto(out)
+ return out
+}
diff --git a/vendor/github.com/go-openapi/strfmt/format.go b/vendor/github.com/go-openapi/strfmt/format.go
new file mode 100644
index 0000000000..ad3b3c355b
--- /dev/null
+++ b/vendor/github.com/go-openapi/strfmt/format.go
@@ -0,0 +1,326 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package strfmt
+
+import (
+ "encoding"
+ "fmt"
+ "reflect"
+ "strings"
+ "sync"
+ "time"
+
+ "github.com/go-openapi/errors"
+ "github.com/mitchellh/mapstructure"
+)
+
+// Default is the default formats registry
+var Default = NewSeededFormats(nil, nil)
+
+// Validator represents a validator for a string format.
+type Validator func(string) bool
+
+// Format represents a string format.
+//
+// All implementations of Format provide a string representation and text
+// marshaling/unmarshaling interface to be used by encoders (e.g. encoding/json).
+type Format interface {
+ String() string
+ encoding.TextMarshaler
+ encoding.TextUnmarshaler
+}
+
+// Registry is a registry of string formats, with a validation method.
+type Registry interface {
+ Add(string, Format, Validator) bool
+ DelByName(string) bool
+ GetType(string) (reflect.Type, bool)
+ ContainsName(string) bool
+ Validates(string, string) bool
+ Parse(string, string) (interface{}, error)
+ MapStructureHookFunc() mapstructure.DecodeHookFunc
+}
+
+type knownFormat struct {
+ Name string
+ OrigName string
+ Type reflect.Type
+ Validator Validator
+}
+
+// NameNormalizer is a function that normalizes a format name.
+type NameNormalizer func(string) string
+
+// DefaultNameNormalizer removes all dashes
+func DefaultNameNormalizer(name string) string {
+ return strings.ReplaceAll(name, "-", "")
+}
+
+type defaultFormats struct {
+ sync.Mutex
+ data []knownFormat
+ normalizeName NameNormalizer
+}
+
+// NewFormats creates a new formats registry seeded with the values from the default
+func NewFormats() Registry {
+ //nolint:forcetypeassert
+ return NewSeededFormats(Default.(*defaultFormats).data, nil)
+}
+
+// NewSeededFormats creates a new formats registry
+func NewSeededFormats(seeds []knownFormat, normalizer NameNormalizer) Registry {
+ if normalizer == nil {
+ normalizer = DefaultNameNormalizer
+ }
+ // copy here, don't modify original
+ d := append([]knownFormat(nil), seeds...)
+ return &defaultFormats{
+ data: d,
+ normalizeName: normalizer,
+ }
+}
+
+// MapStructureHookFunc is a decode hook function for mapstructure
+func (f *defaultFormats) MapStructureHookFunc() mapstructure.DecodeHookFunc { //nolint:gocyclo,cyclop
+ return func(from reflect.Type, to reflect.Type, obj interface{}) (interface{}, error) {
+ if from.Kind() != reflect.String {
+ return obj, nil
+ }
+ data, ok := obj.(string)
+ if !ok {
+ return nil, fmt.Errorf("failed to cast %+v to string", obj)
+ }
+
+ for _, v := range f.data {
+ tpe, _ := f.GetType(v.Name)
+ if to == tpe {
+ switch v.Name {
+ case "date":
+ d, err := time.ParseInLocation(RFC3339FullDate, data, DefaultTimeLocation)
+ if err != nil {
+ return nil, err
+ }
+ return Date(d), nil
+ case "datetime":
+ input := data
+ if len(input) == 0 {
+ return nil, fmt.Errorf("empty string is an invalid datetime format")
+ }
+ return ParseDateTime(input)
+ case "duration":
+ dur, err := ParseDuration(data)
+ if err != nil {
+ return nil, err
+ }
+ return Duration(dur), nil
+ case "uri":
+ return URI(data), nil
+ case "email":
+ return Email(data), nil
+ case "uuid":
+ return UUID(data), nil
+ case "uuid3":
+ return UUID3(data), nil
+ case "uuid4":
+ return UUID4(data), nil
+ case "uuid5":
+ return UUID5(data), nil
+ case "hostname":
+ return Hostname(data), nil
+ case "ipv4":
+ return IPv4(data), nil
+ case "ipv6":
+ return IPv6(data), nil
+ case "cidr":
+ return CIDR(data), nil
+ case "mac":
+ return MAC(data), nil
+ case "isbn":
+ return ISBN(data), nil
+ case "isbn10":
+ return ISBN10(data), nil
+ case "isbn13":
+ return ISBN13(data), nil
+ case "creditcard":
+ return CreditCard(data), nil
+ case "ssn":
+ return SSN(data), nil
+ case "hexcolor":
+ return HexColor(data), nil
+ case "rgbcolor":
+ return RGBColor(data), nil
+ case "byte":
+ return Base64(data), nil
+ case "password":
+ return Password(data), nil
+ case "ulid":
+ ulid, err := ParseULID(data)
+ if err != nil {
+ return nil, err
+ }
+ return ulid, nil
+ default:
+ return nil, errors.InvalidTypeName(v.Name)
+ }
+ }
+ }
+ return data, nil
+ }
+}
+
+// Add adds a new format, return true if this was a new item instead of a replacement
+func (f *defaultFormats) Add(name string, strfmt Format, validator Validator) bool {
+ f.Lock()
+ defer f.Unlock()
+
+ nme := f.normalizeName(name)
+
+ tpe := reflect.TypeOf(strfmt)
+ if tpe.Kind() == reflect.Ptr {
+ tpe = tpe.Elem()
+ }
+
+ for i := range f.data {
+ v := &f.data[i]
+ if v.Name == nme {
+ v.Type = tpe
+ v.Validator = validator
+ return false
+ }
+ }
+
+ // turns out it's new after all
+ f.data = append(f.data, knownFormat{Name: nme, OrigName: name, Type: tpe, Validator: validator})
+ return true
+}
+
+// GetType gets the type for the specified name
+func (f *defaultFormats) GetType(name string) (reflect.Type, bool) {
+ f.Lock()
+ defer f.Unlock()
+ nme := f.normalizeName(name)
+ for _, v := range f.data {
+ if v.Name == nme {
+ return v.Type, true
+ }
+ }
+ return nil, false
+}
+
+// DelByName removes the format by the specified name, returns true when an item was actually removed
+func (f *defaultFormats) DelByName(name string) bool {
+ f.Lock()
+ defer f.Unlock()
+
+ nme := f.normalizeName(name)
+
+ for i, v := range f.data {
+ if v.Name == nme {
+ f.data[i] = knownFormat{} // release
+ f.data = append(f.data[:i], f.data[i+1:]...)
+ return true
+ }
+ }
+ return false
+}
+
+// DelByFormat removes the specified format, returns true when an item was actually removed
+func (f *defaultFormats) DelByFormat(strfmt Format) bool {
+ f.Lock()
+ defer f.Unlock()
+
+ tpe := reflect.TypeOf(strfmt)
+ if tpe.Kind() == reflect.Ptr {
+ tpe = tpe.Elem()
+ }
+
+ for i, v := range f.data {
+ if v.Type == tpe {
+ f.data[i] = knownFormat{} // release
+ f.data = append(f.data[:i], f.data[i+1:]...)
+ return true
+ }
+ }
+ return false
+}
+
+// ContainsName returns true if this registry contains the specified name
+func (f *defaultFormats) ContainsName(name string) bool {
+ f.Lock()
+ defer f.Unlock()
+ nme := f.normalizeName(name)
+ for _, v := range f.data {
+ if v.Name == nme {
+ return true
+ }
+ }
+ return false
+}
+
+// ContainsFormat returns true if this registry contains the specified format
+func (f *defaultFormats) ContainsFormat(strfmt Format) bool {
+ f.Lock()
+ defer f.Unlock()
+ tpe := reflect.TypeOf(strfmt)
+ if tpe.Kind() == reflect.Ptr {
+ tpe = tpe.Elem()
+ }
+
+ for _, v := range f.data {
+ if v.Type == tpe {
+ return true
+ }
+ }
+ return false
+}
+
+// Validates passed data against format.
+//
+// Note that the format name is automatically normalized, e.g. one may
+// use "date-time" to use the "datetime" format validator.
+func (f *defaultFormats) Validates(name, data string) bool {
+ f.Lock()
+ defer f.Unlock()
+ nme := f.normalizeName(name)
+ for _, v := range f.data {
+ if v.Name == nme {
+ return v.Validator(data)
+ }
+ }
+ return false
+}
+
+// Parse a string into the appropriate format representation type.
+//
+// E.g. parsing a string a "date" will return a Date type.
+func (f *defaultFormats) Parse(name, data string) (interface{}, error) {
+ f.Lock()
+ defer f.Unlock()
+ nme := f.normalizeName(name)
+ for _, v := range f.data {
+ if v.Name == nme {
+ nw := reflect.New(v.Type).Interface()
+ if dec, ok := nw.(encoding.TextUnmarshaler); ok {
+ if err := dec.UnmarshalText([]byte(data)); err != nil {
+ return nil, err
+ }
+ return nw, nil
+ }
+ return nil, errors.InvalidTypeName(name)
+ }
+ }
+ return nil, errors.InvalidTypeName(name)
+}
diff --git a/vendor/github.com/go-openapi/strfmt/time.go b/vendor/github.com/go-openapi/strfmt/time.go
new file mode 100644
index 0000000000..9bef4c3b33
--- /dev/null
+++ b/vendor/github.com/go-openapi/strfmt/time.go
@@ -0,0 +1,319 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package strfmt
+
+import (
+ "database/sql/driver"
+ "encoding/binary"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "regexp"
+ "strings"
+ "time"
+
+ "go.mongodb.org/mongo-driver/bson"
+
+ "go.mongodb.org/mongo-driver/bson/bsontype"
+)
+
+var (
+ // UnixZero sets the zero unix timestamp we want to compare against.
+ // Unix 0 for an EST timezone is not equivalent to a UTC timezone.
+ UnixZero = time.Unix(0, 0).UTC()
+)
+
+func init() {
+ dt := DateTime{}
+ Default.Add("datetime", &dt, IsDateTime)
+}
+
+// IsDateTime returns true when the string is a valid date-time
+func IsDateTime(str string) bool {
+ if len(str) < 4 {
+ return false
+ }
+ s := strings.Split(strings.ToLower(str), "t")
+ if len(s) < 2 || !IsDate(s[0]) {
+ return false
+ }
+
+ matches := rxDateTime.FindAllStringSubmatch(s[1], -1)
+ if len(matches) == 0 || len(matches[0]) == 0 {
+ return false
+ }
+ m := matches[0]
+ res := m[1] <= "23" && m[2] <= "59" && m[3] <= "59"
+ return res
+}
+
+const (
+ // RFC3339Millis represents a ISO8601 format to millis instead of to nanos
+ RFC3339Millis = "2006-01-02T15:04:05.000Z07:00"
+ // RFC3339MillisNoColon represents a ISO8601 format to millis instead of to nanos
+ RFC3339MillisNoColon = "2006-01-02T15:04:05.000Z0700"
+ // RFC3339Micro represents a ISO8601 format to micro instead of to nano
+ RFC3339Micro = "2006-01-02T15:04:05.000000Z07:00"
+ // RFC3339MicroNoColon represents a ISO8601 format to micro instead of to nano
+ RFC3339MicroNoColon = "2006-01-02T15:04:05.000000Z0700"
+ // ISO8601LocalTime represents a ISO8601 format to ISO8601 in local time (no timezone)
+ ISO8601LocalTime = "2006-01-02T15:04:05"
+ // ISO8601TimeWithReducedPrecision represents a ISO8601 format with reduced precision (dropped secs)
+ ISO8601TimeWithReducedPrecision = "2006-01-02T15:04Z"
+ // ISO8601TimeWithReducedPrecisionLocaltime represents a ISO8601 format with reduced precision and no timezone (dropped seconds + no timezone)
+ ISO8601TimeWithReducedPrecisionLocaltime = "2006-01-02T15:04"
+ // ISO8601TimeUniversalSortableDateTimePattern represents a ISO8601 universal sortable date time pattern.
+ ISO8601TimeUniversalSortableDateTimePattern = "2006-01-02 15:04:05"
+ // DateTimePattern pattern to match for the date-time format from http://tools.ietf.org/html/rfc3339#section-5.6
+ DateTimePattern = `^([0-9]{2}):([0-9]{2}):([0-9]{2})(.[0-9]+)?(z|([+-][0-9]{2}:[0-9]{2}))$`
+)
+
+var (
+ rxDateTime = regexp.MustCompile(DateTimePattern)
+
+ // DateTimeFormats is the collection of formats used by ParseDateTime()
+ DateTimeFormats = []string{RFC3339Micro, RFC3339MicroNoColon, RFC3339Millis, RFC3339MillisNoColon, time.RFC3339, time.RFC3339Nano, ISO8601LocalTime, ISO8601TimeWithReducedPrecision, ISO8601TimeWithReducedPrecisionLocaltime, ISO8601TimeUniversalSortableDateTimePattern}
+
+ // MarshalFormat sets the time resolution format used for marshaling time (set to milliseconds)
+ MarshalFormat = RFC3339Millis
+
+ // NormalizeTimeForMarshal provides a normalization function on time befeore marshalling (e.g. time.UTC).
+ // By default, the time value is not changed.
+ NormalizeTimeForMarshal = func(t time.Time) time.Time { return t }
+
+ // DefaultTimeLocation provides a location for a time when the time zone is not encoded in the string (ex: ISO8601 Local variants).
+ DefaultTimeLocation = time.UTC
+)
+
+// ParseDateTime parses a string that represents an ISO8601 time or a unix epoch
+func ParseDateTime(data string) (DateTime, error) {
+ if data == "" {
+ return NewDateTime(), nil
+ }
+ var lastError error
+ for _, layout := range DateTimeFormats {
+ dd, err := time.ParseInLocation(layout, data, DefaultTimeLocation)
+ if err != nil {
+ lastError = err
+ continue
+ }
+ return DateTime(dd), nil
+ }
+ return DateTime{}, lastError
+}
+
+// DateTime is a time but it serializes to ISO8601 format with millis
+// It knows how to read 3 different variations of a RFC3339 date time.
+// Most APIs we encounter want either millisecond or second precision times.
+// This just tries to make it worry-free.
+//
+// swagger:strfmt date-time
+type DateTime time.Time
+
+// NewDateTime is a representation of zero value for DateTime type
+func NewDateTime() DateTime {
+ return DateTime(time.Unix(0, 0).UTC())
+}
+
+// String converts this time to a string
+func (t DateTime) String() string {
+ return NormalizeTimeForMarshal(time.Time(t)).Format(MarshalFormat)
+}
+
+// IsZero returns whether the date time is a zero value
+func (t *DateTime) IsZero() bool {
+ if t == nil {
+ return true
+ }
+ return time.Time(*t).IsZero()
+}
+
+// IsUnixZerom returns whether the date time is equivalent to time.Unix(0, 0).UTC().
+func (t *DateTime) IsUnixZero() bool {
+ if t == nil {
+ return true
+ }
+ return time.Time(*t).Equal(UnixZero)
+}
+
+// MarshalText implements the text marshaller interface
+func (t DateTime) MarshalText() ([]byte, error) {
+ return []byte(t.String()), nil
+}
+
+// UnmarshalText implements the text unmarshaller interface
+func (t *DateTime) UnmarshalText(text []byte) error {
+ tt, err := ParseDateTime(string(text))
+ if err != nil {
+ return err
+ }
+ *t = tt
+ return nil
+}
+
+// Scan scans a DateTime value from database driver type.
+func (t *DateTime) Scan(raw interface{}) error {
+ // TODO: case int64: and case float64: ?
+ switch v := raw.(type) {
+ case []byte:
+ return t.UnmarshalText(v)
+ case string:
+ return t.UnmarshalText([]byte(v))
+ case time.Time:
+ *t = DateTime(v)
+ case nil:
+ *t = DateTime{}
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.DateTime from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts DateTime to a primitive value ready to written to a database.
+func (t DateTime) Value() (driver.Value, error) {
+ return driver.Value(t.String()), nil
+}
+
+// MarshalJSON returns the DateTime as JSON
+func (t DateTime) MarshalJSON() ([]byte, error) {
+ return json.Marshal(NormalizeTimeForMarshal(time.Time(t)).Format(MarshalFormat))
+}
+
+// UnmarshalJSON sets the DateTime from JSON
+func (t *DateTime) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
+ return nil
+ }
+
+ var tstr string
+ if err := json.Unmarshal(data, &tstr); err != nil {
+ return err
+ }
+ tt, err := ParseDateTime(tstr)
+ if err != nil {
+ return err
+ }
+ *t = tt
+ return nil
+}
+
+// MarshalBSON renders the DateTime as a BSON document
+func (t DateTime) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": t})
+}
+
+// UnmarshalBSON reads the DateTime from a BSON document
+func (t *DateTime) UnmarshalBSON(data []byte) error {
+ var obj struct {
+ Data DateTime
+ }
+
+ if err := bson.Unmarshal(data, &obj); err != nil {
+ return err
+ }
+
+ *t = obj.Data
+
+ return nil
+}
+
+// MarshalBSONValue is an interface implemented by types that can marshal themselves
+// into a BSON document represented as bytes. The bytes returned must be a valid
+// BSON document if the error is nil.
+// Marshals a DateTime as a bsontype.DateTime, an int64 representing
+// milliseconds since epoch.
+func (t DateTime) MarshalBSONValue() (bsontype.Type, []byte, error) {
+ // UnixNano cannot be used directly, the result of calling UnixNano on the zero
+ // Time is undefined. Thats why we use time.Nanosecond() instead.
+
+ tNorm := NormalizeTimeForMarshal(time.Time(t))
+ i64 := tNorm.Unix()*1000 + int64(tNorm.Nanosecond())/1e6
+
+ buf := make([]byte, 8)
+ binary.LittleEndian.PutUint64(buf, uint64(i64))
+
+ return bsontype.DateTime, buf, nil
+}
+
+// UnmarshalBSONValue is an interface implemented by types that can unmarshal a
+// BSON value representation of themselves. The BSON bytes and type can be
+// assumed to be valid. UnmarshalBSONValue must copy the BSON value bytes if it
+// wishes to retain the data after returning.
+func (t *DateTime) UnmarshalBSONValue(tpe bsontype.Type, data []byte) error {
+ if tpe == bsontype.Null {
+ *t = DateTime{}
+ return nil
+ }
+
+ if len(data) != 8 {
+ return errors.New("bson date field length not exactly 8 bytes")
+ }
+
+ i64 := int64(binary.LittleEndian.Uint64(data))
+ // TODO: Use bsonprim.DateTime.Time() method
+ *t = DateTime(time.Unix(i64/1000, i64%1000*1000000))
+
+ return nil
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (t *DateTime) DeepCopyInto(out *DateTime) {
+ *out = *t
+}
+
+// DeepCopy copies the receiver into a new DateTime.
+func (t *DateTime) DeepCopy() *DateTime {
+ if t == nil {
+ return nil
+ }
+ out := new(DateTime)
+ t.DeepCopyInto(out)
+ return out
+}
+
+// GobEncode implements the gob.GobEncoder interface.
+func (t DateTime) GobEncode() ([]byte, error) {
+ return t.MarshalBinary()
+}
+
+// GobDecode implements the gob.GobDecoder interface.
+func (t *DateTime) GobDecode(data []byte) error {
+ return t.UnmarshalBinary(data)
+}
+
+// MarshalBinary implements the encoding.BinaryMarshaler interface.
+func (t DateTime) MarshalBinary() ([]byte, error) {
+ return NormalizeTimeForMarshal(time.Time(t)).MarshalBinary()
+}
+
+// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
+func (t *DateTime) UnmarshalBinary(data []byte) error {
+ var original time.Time
+
+ err := original.UnmarshalBinary(data)
+ if err != nil {
+ return err
+ }
+
+ *t = DateTime(original)
+
+ return nil
+}
+
+// Equal checks if two DateTime instances are equal using time.Time's Equal method
+func (t DateTime) Equal(t2 DateTime) bool {
+ return time.Time(t).Equal(time.Time(t2))
+}
diff --git a/vendor/github.com/go-openapi/strfmt/ulid.go b/vendor/github.com/go-openapi/strfmt/ulid.go
new file mode 100644
index 0000000000..e71aff7c36
--- /dev/null
+++ b/vendor/github.com/go-openapi/strfmt/ulid.go
@@ -0,0 +1,230 @@
+package strfmt
+
+import (
+ cryptorand "crypto/rand"
+ "database/sql/driver"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "io"
+ "sync"
+
+ "github.com/oklog/ulid"
+ "go.mongodb.org/mongo-driver/bson"
+)
+
+// ULID represents a ulid string format
+// ref:
+//
+// https://github.com/ulid/spec
+//
+// impl:
+//
+// https://github.com/oklog/ulid
+//
+// swagger:strfmt ulid
+type ULID struct {
+ ulid.ULID
+}
+
+var (
+ ulidEntropyPool = sync.Pool{
+ New: func() interface{} {
+ return cryptorand.Reader
+ },
+ }
+
+ ULIDScanDefaultFunc = func(raw interface{}) (ULID, error) {
+ u := NewULIDZero()
+ switch x := raw.(type) {
+ case nil:
+ // zerp ulid
+ return u, nil
+ case string:
+ if x == "" {
+ // zero ulid
+ return u, nil
+ }
+ return u, u.UnmarshalText([]byte(x))
+ case []byte:
+ return u, u.UnmarshalText(x)
+ }
+
+ return u, fmt.Errorf("cannot sql.Scan() strfmt.ULID from: %#v: %w", raw, ulid.ErrScanValue)
+ }
+
+ // ULIDScanOverrideFunc allows you to override the Scan method of the ULID type
+ ULIDScanOverrideFunc = ULIDScanDefaultFunc
+
+ ULIDValueDefaultFunc = func(u ULID) (driver.Value, error) {
+ return driver.Value(u.String()), nil
+ }
+
+ // ULIDValueOverrideFunc allows you to override the Value method of the ULID type
+ ULIDValueOverrideFunc = ULIDValueDefaultFunc
+)
+
+func init() {
+ // register formats in the default registry:
+ // - ulid
+ ulid := ULID{}
+ Default.Add("ulid", &ulid, IsULID)
+}
+
+// IsULID checks if provided string is ULID format
+// Be noticed that this function considers overflowed ULID as non-ulid.
+// For more details see https://github.com/ulid/spec
+func IsULID(str string) bool {
+ _, err := ulid.ParseStrict(str)
+ return err == nil
+}
+
+// ParseULID parses a string that represents an valid ULID
+func ParseULID(str string) (ULID, error) {
+ var u ULID
+
+ return u, u.UnmarshalText([]byte(str))
+}
+
+// NewULIDZero returns a zero valued ULID type
+func NewULIDZero() ULID {
+ return ULID{}
+}
+
+// NewULID generates new unique ULID value and a error if any
+func NewULID() (ULID, error) {
+ var u ULID
+
+ obj := ulidEntropyPool.Get()
+ entropy, ok := obj.(io.Reader)
+ if !ok {
+ return u, fmt.Errorf("failed to cast %+v to io.Reader", obj)
+ }
+
+ id, err := ulid.New(ulid.Now(), entropy)
+ if err != nil {
+ return u, err
+ }
+ ulidEntropyPool.Put(entropy)
+
+ u.ULID = id
+ return u, nil
+}
+
+// GetULID returns underlying instance of ULID
+func (u *ULID) GetULID() interface{} {
+ return u.ULID
+}
+
+// MarshalText returns this instance into text
+func (u ULID) MarshalText() ([]byte, error) {
+ return u.ULID.MarshalText()
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *ULID) UnmarshalText(data []byte) error { // validation is performed later on
+ return u.ULID.UnmarshalText(data)
+}
+
+// Scan reads a value from a database driver
+func (u *ULID) Scan(raw interface{}) error {
+ ul, err := ULIDScanOverrideFunc(raw)
+ if err == nil {
+ *u = ul
+ }
+ return err
+}
+
+// Value converts a value to a database driver value
+func (u ULID) Value() (driver.Value, error) {
+ return ULIDValueOverrideFunc(u)
+}
+
+func (u ULID) String() string {
+ return u.ULID.String()
+}
+
+// MarshalJSON returns the ULID as JSON
+func (u ULID) MarshalJSON() ([]byte, error) {
+ return json.Marshal(u.String())
+}
+
+// UnmarshalJSON sets the ULID from JSON
+func (u *ULID) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
+ return nil
+ }
+ var ustr string
+ if err := json.Unmarshal(data, &ustr); err != nil {
+ return err
+ }
+ id, err := ulid.ParseStrict(ustr)
+ if err != nil {
+ return fmt.Errorf("couldn't parse JSON value as ULID: %w", err)
+ }
+ u.ULID = id
+ return nil
+}
+
+// MarshalBSON document from this value
+func (u ULID) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *ULID) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ id, err := ulid.ParseStrict(ud)
+ if err != nil {
+ return fmt.Errorf("couldn't parse bson bytes as ULID: %w", err)
+ }
+ u.ULID = id
+ return nil
+ }
+ return errors.New("couldn't unmarshal bson bytes as ULID")
+}
+
+// DeepCopyInto copies the receiver and writes its value into out.
+func (u *ULID) DeepCopyInto(out *ULID) {
+ *out = *u
+}
+
+// DeepCopy copies the receiver into a new ULID.
+func (u *ULID) DeepCopy() *ULID {
+ if u == nil {
+ return nil
+ }
+ out := new(ULID)
+ u.DeepCopyInto(out)
+ return out
+}
+
+// GobEncode implements the gob.GobEncoder interface.
+func (u ULID) GobEncode() ([]byte, error) {
+ return u.ULID.MarshalBinary()
+}
+
+// GobDecode implements the gob.GobDecoder interface.
+func (u *ULID) GobDecode(data []byte) error {
+ return u.ULID.UnmarshalBinary(data)
+}
+
+// MarshalBinary implements the encoding.BinaryMarshaler interface.
+func (u ULID) MarshalBinary() ([]byte, error) {
+ return u.ULID.MarshalBinary()
+}
+
+// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
+func (u *ULID) UnmarshalBinary(data []byte) error {
+ return u.ULID.UnmarshalBinary(data)
+}
+
+// Equal checks if two ULID instances are equal by their underlying type
+func (u ULID) Equal(other ULID) bool {
+ return u.ULID == other.ULID
+}
diff --git a/vendor/github.com/go-playground/locales/README.md b/vendor/github.com/go-playground/locales/README.md
index 5b0694fd19..7b6be2c647 100644
--- a/vendor/github.com/go-playground/locales/README.md
+++ b/vendor/github.com/go-playground/locales/README.md
@@ -1,10 +1,8 @@
## locales
- 
+ 
[](https://travis-ci.org/go-playground/locales)
-[](https://goreportcard.com/report/github.com/go-playground/locales)
[](https://godoc.org/github.com/go-playground/locales)

-[](https://gitter.im/go-playground/locales?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
Locales is a set of locales generated from the [Unicode CLDR Project](http://cldr.unicode.org/) which can be used independently or within
an i18n package; these were built for use with, but not exclusive to, [Universal Translator](https://github.com/go-playground/universal-translator).
diff --git a/vendor/github.com/go-playground/universal-translator/README.md b/vendor/github.com/go-playground/universal-translator/README.md
index 46dec6d2b2..d9b6654741 100644
--- a/vendor/github.com/go-playground/universal-translator/README.md
+++ b/vendor/github.com/go-playground/universal-translator/README.md
@@ -1,11 +1,9 @@
## universal-translator
- 
-[](https://travis-ci.org/go-playground/universal-translator)
+ 
[](https://coveralls.io/github/go-playground/universal-translator)
[](https://goreportcard.com/report/github.com/go-playground/universal-translator)
[](https://godoc.org/github.com/go-playground/universal-translator)

-[](https://gitter.im/go-playground/universal-translator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
Universal Translator is an i18n Translator for Go/Golang using CLDR data + pluralization rules
diff --git a/vendor/github.com/go-playground/universal-translator/import_export.go b/vendor/github.com/go-playground/universal-translator/import_export.go
index 1216f19237..87a1b465cb 100644
--- a/vendor/github.com/go-playground/universal-translator/import_export.go
+++ b/vendor/github.com/go-playground/universal-translator/import_export.go
@@ -3,7 +3,6 @@ package ut
import (
"encoding/json"
"fmt"
- "io/ioutil"
"os"
"path/filepath"
@@ -41,7 +40,6 @@ const (
func (t *UniversalTranslator) Export(format ImportExportFormat, dirname string) error {
_, err := os.Stat(dirname)
- fmt.Println(dirname, err, os.IsNotExist(err))
if err != nil {
if !os.IsNotExist(err) {
@@ -138,7 +136,7 @@ func (t *UniversalTranslator) Export(format ImportExportFormat, dirname string)
return err
}
- err = ioutil.WriteFile(filepath.Join(dirname, fmt.Sprintf("%s%s", locale.Locale(), ext)), b, 0644)
+ err = os.WriteFile(filepath.Join(dirname, fmt.Sprintf("%s%s", locale.Locale(), ext)), b, 0644)
if err != nil {
return err
}
@@ -200,7 +198,7 @@ func (t *UniversalTranslator) Import(format ImportExportFormat, dirnameOrFilenam
// NOTE: generally used when assets have been embedded into the binary and are already in memory.
func (t *UniversalTranslator) ImportByReader(format ImportExportFormat, reader io.Reader) error {
- b, err := ioutil.ReadAll(reader)
+ b, err := io.ReadAll(reader)
if err != nil {
return err
}
diff --git a/vendor/github.com/go-playground/validator/v10/.gitignore b/vendor/github.com/go-playground/validator/v10/.gitignore
index 6e43fac0d5..6305e52900 100644
--- a/vendor/github.com/go-playground/validator/v10/.gitignore
+++ b/vendor/github.com/go-playground/validator/v10/.gitignore
@@ -26,5 +26,7 @@ _testmain.go
*.test
*.out
*.txt
+/**/*.DS_Store
cover.html
README.html
+.idea
diff --git a/vendor/github.com/go-playground/validator/v10/README.md b/vendor/github.com/go-playground/validator/v10/README.md
index f56cff15d9..520661db62 100644
--- a/vendor/github.com/go-playground/validator/v10/README.md
+++ b/vendor/github.com/go-playground/validator/v10/README.md
@@ -1,7 +1,7 @@
Package validator
=================
- [](https://gitter.im/go-playground/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-
+ [](https://gitter.im/go-playground/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+
[](https://travis-ci.org/go-playground/validator)
[](https://coveralls.io/github/go-playground/validator?branch=master)
[](https://goreportcard.com/report/github.com/go-playground/validator)
@@ -73,8 +73,8 @@ Baked-in Validations
| - | - |
| eqcsfield | Field Equals Another Field (relative)|
| eqfield | Field Equals Another Field |
-| fieldcontains | NOT DOCUMENTED IN doc.go |
-| fieldexcludes | NOT DOCUMENTED IN doc.go |
+| fieldcontains | Check the indicated characters are present in the Field |
+| fieldexcludes | Check the indicated characters are not present in the field |
| gtcsfield | Field Greater Than Another Relative Field |
| gtecsfield | Field Greater Than or Equal To Another Relative Field |
| gtefield | Field Greater Than or Equal To Another Field |
@@ -114,6 +114,7 @@ Baked-in Validations
| unix_addr | Unix domain socket end point Address |
| uri | URI String |
| url | URL String |
+| http_url | HTTP URL String |
| url_encoded | URL Encoded |
| urn_rfc2141 | Urn RFC 2141 String |
@@ -130,14 +131,14 @@ Baked-in Validations
| contains | Contains |
| containsany | Contains Any |
| containsrune | Contains Rune |
-| endsnotwith | Ends With |
+| endsnotwith | Ends Not With |
| endswith | Ends With |
| excludes | Excludes |
| excludesall | Excludes All |
| excludesrune | Excludes Rune |
| lowercase | Lowercase |
| multibyte | Multi-Byte Characters |
-| number | NOT DOCUMENTED IN doc.go |
+| number | Number |
| numeric | Numeric |
| printascii | Printable ASCII |
| startsnotwith | Starts Not With |
@@ -149,10 +150,14 @@ Baked-in Validations
| - | - |
| base64 | Base64 String |
| base64url | Base64URL String |
+| base64rawurl | Base64RawURL String |
| bic | Business Identifier Code (ISO 9362) |
| bcp47_language_tag | Language tag (BCP 47) |
| btc_addr | Bitcoin Address |
| btc_addr_bech32 | Bitcoin Bech32 Address (segwit) |
+| credit_card | Credit Card Number |
+| mongodb | MongoDB ObjectID |
+| cron | Cron |
| datetime | Datetime |
| e164 | e164 formatted phone number |
| email | E-mail String
@@ -175,6 +180,7 @@ Baked-in Validations
| jwt | JSON Web Token (JWT) |
| latitude | Latitude |
| longitude | Longitude |
+| luhn_checksum | Luhn Algorithm Checksum (for strings and (u)int) |
| postcode_iso3166_alpha2 | Postcode |
| postcode_iso3166_alpha2_field | Postcode |
| rgb | RGB String |
@@ -189,22 +195,40 @@ Baked-in Validations
| uuid5 | Universally Unique Identifier UUID v5 |
| uuid5_rfc4122 | Universally Unique Identifier UUID v5 RFC4122 |
| uuid_rfc4122 | Universally Unique Identifier UUID RFC4122 |
+| md4 | MD4 hash |
+| md5 | MD5 hash |
+| sha256 | SHA256 hash |
+| sha384 | SHA384 hash |
+| sha512 | SHA512 hash |
+| ripemd128 | RIPEMD-128 hash |
+| ripemd128 | RIPEMD-160 hash |
+| tiger128 | TIGER128 hash |
+| tiger160 | TIGER160 hash |
+| tiger192 | TIGER192 hash |
+| semver | Semantic Versioning 2.0.0 |
+| ulid | Universally Unique Lexicographically Sortable Identifier ULID |
+| cve | Common Vulnerabilities and Exposures Identifier (CVE id) |
### Comparisons:
| Tag | Description |
| - | - |
| eq | Equals |
+| eq_ignore_case | Equals ignoring case |
| gt | Greater than|
| gte | Greater than or equal |
| lt | Less Than |
| lte | Less Than or Equal |
| ne | Not Equal |
+| ne_ignore_case | Not Equal ignoring case |
### Other:
| Tag | Description |
| - | - |
-| dir | Directory |
-| file | File path |
+| dir | Existing Directory |
+| dirpath | Directory Path |
+| file | Existing File |
+| filepath | File Path |
+| image | Image |
| isdefault | Is Default |
| len | Length |
| max | Maximum |
@@ -217,6 +241,8 @@ Baked-in Validations
| required_with_all | Required With All |
| required_without | Required Without |
| required_without_all | Required Without All |
+| excluded_if | Excluded If |
+| excluded_unless | Excluded Unless |
| excluded_with | Excluded With |
| excluded_with_all | Excluded With All |
| excluded_without | Excluded Without |
diff --git a/vendor/github.com/go-playground/validator/v10/baked_in.go b/vendor/github.com/go-playground/validator/v10/baked_in.go
index f5fd2391d2..e676f1d164 100644
--- a/vendor/github.com/go-playground/validator/v10/baked_in.go
+++ b/vendor/github.com/go-playground/validator/v10/baked_in.go
@@ -7,6 +7,7 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
+ "io/fs"
"net"
"net/url"
"os"
@@ -14,13 +15,15 @@ import (
"strconv"
"strings"
"sync"
+ "syscall"
"time"
"unicode/utf8"
"golang.org/x/crypto/sha3"
"golang.org/x/text/language"
- urn "github.com/leodido/go-urn"
+ "github.com/gabriel-vasile/mimetype"
+ "github.com/leodido/go-urn"
)
// Func accepts a FieldLevel interface for all validation needs. The return
@@ -31,7 +34,7 @@ type Func func(fl FieldLevel) bool
// validation needs. The return value should be true when validation succeeds.
type FuncCtx func(ctx context.Context, fl FieldLevel) bool
-// wrapFunc wraps noramal Func makes it compatible with FuncCtx
+// wrapFunc wraps normal Func makes it compatible with FuncCtx
func wrapFunc(fn Func) FuncCtx {
if fn == nil {
return nil // be sure not to wrap a bad function.
@@ -71,10 +74,13 @@ var (
"required": hasValue,
"required_if": requiredIf,
"required_unless": requiredUnless,
+ "skip_unless": skipUnless,
"required_with": requiredWith,
"required_with_all": requiredWithAll,
"required_without": requiredWithout,
"required_without_all": requiredWithoutAll,
+ "excluded_if": excludedIf,
+ "excluded_unless": excludedUnless,
"excluded_with": excludedWith,
"excluded_with_all": excludedWithAll,
"excluded_without": excludedWithout,
@@ -84,7 +90,9 @@ var (
"min": hasMinOf,
"max": hasMaxOf,
"eq": isEq,
+ "eq_ignore_case": isEqIgnoreCase,
"ne": isNe,
+ "ne_ignore_case": isNeIgnoreCase,
"lt": isLt,
"lte": isLte,
"gt": isGt,
@@ -119,11 +127,14 @@ var (
"e164": isE164,
"email": isEmail,
"url": isURL,
+ "http_url": isHttpURL,
"uri": isURI,
"urn_rfc2141": isUrnRFC2141, // RFC 2141
"file": isFile,
+ "filepath": isFilePath,
"base64": isBase64,
"base64url": isBase64URL,
+ "base64rawurl": isBase64RawURL,
"contains": contains,
"containsany": containsAny,
"containsrune": containsRune,
@@ -134,10 +145,12 @@ var (
"endswith": endsWith,
"startsnotwith": startsNotWith,
"endsnotwith": endsNotWith,
+ "image": isImage,
"isbn": isISBN,
"isbn10": isISBN10,
"isbn13": isISBN13,
"eth_addr": isEthereumAddress,
+ "eth_addr_checksum": isEthereumAddressChecksum,
"btc_addr": isBitcoinAddress,
"btc_addr_bech32": isBitcoinBech32Address,
"uuid": isUUID,
@@ -148,6 +161,17 @@ var (
"uuid3_rfc4122": isUUID3RFC4122,
"uuid4_rfc4122": isUUID4RFC4122,
"uuid5_rfc4122": isUUID5RFC4122,
+ "ulid": isULID,
+ "md4": isMD4,
+ "md5": isMD5,
+ "sha256": isSHA256,
+ "sha384": isSHA384,
+ "sha512": isSHA512,
+ "ripemd128": isRIPEMD128,
+ "ripemd160": isRIPEMD160,
+ "tiger128": isTIGER128,
+ "tiger160": isTIGER160,
+ "tiger192": isTIGER192,
"ascii": isASCII,
"printascii": isPrintableASCII,
"multibyte": hasMultiByteCharacter,
@@ -181,6 +205,7 @@ var (
"html_encoded": isHTMLEncoded,
"url_encoded": isURLEncoded,
"dir": isDir,
+ "dirpath": isDirPath,
"json": isJSON,
"jwt": isJWT,
"hostname_port": isHostnamePort,
@@ -198,11 +223,20 @@ var (
"postcode_iso3166_alpha2": isPostcodeByIso3166Alpha2,
"postcode_iso3166_alpha2_field": isPostcodeByIso3166Alpha2Field,
"bic": isIsoBicFormat,
+ "semver": isSemverFormat,
+ "dns_rfc1035_label": isDnsRFC1035LabelFormat,
+ "credit_card": isCreditCard,
+ "cve": isCveFormat,
+ "luhn_checksum": hasLuhnChecksum,
+ "mongodb": isMongoDB,
+ "cron": isCron,
}
)
-var oneofValsCache = map[string][]string{}
-var oneofValsCacheRWLock = sync.RWMutex{}
+var (
+ oneofValsCache = map[string][]string{}
+ oneofValsCacheRWLock = sync.RWMutex{}
+)
func parseOneOfParam2(s string) []string {
oneofValsCacheRWLock.RLock()
@@ -258,7 +292,6 @@ func isOneOf(fl FieldLevel) bool {
// isUnique is the validation function for validating if each array|slice|map value is unique
func isUnique(fl FieldLevel) bool {
-
field := fl.Field()
param := fl.Param()
v := reflect.ValueOf(struct{}{})
@@ -290,25 +323,48 @@ func isUnique(fl FieldLevel) bool {
}
m := reflect.MakeMap(reflect.MapOf(sfTyp, v.Type()))
+ var fieldlen int
for i := 0; i < field.Len(); i++ {
- m.SetMapIndex(reflect.Indirect(reflect.Indirect(field.Index(i)).FieldByName(param)), v)
+ key := reflect.Indirect(reflect.Indirect(field.Index(i)).FieldByName(param))
+ if key.IsValid() {
+ fieldlen++
+ m.SetMapIndex(key, v)
+ }
}
- return field.Len() == m.Len()
+ return fieldlen == m.Len()
case reflect.Map:
- m := reflect.MakeMap(reflect.MapOf(field.Type().Elem(), v.Type()))
+ var m reflect.Value
+ if field.Type().Elem().Kind() == reflect.Ptr {
+ m = reflect.MakeMap(reflect.MapOf(field.Type().Elem().Elem(), v.Type()))
+ } else {
+ m = reflect.MakeMap(reflect.MapOf(field.Type().Elem(), v.Type()))
+ }
for _, k := range field.MapKeys() {
- m.SetMapIndex(field.MapIndex(k), v)
+ m.SetMapIndex(reflect.Indirect(field.MapIndex(k)), v)
}
+
return field.Len() == m.Len()
default:
+ if parent := fl.Parent(); parent.Kind() == reflect.Struct {
+ uniqueField := parent.FieldByName(param)
+ if uniqueField == reflect.ValueOf(nil) {
+ panic(fmt.Sprintf("Bad field name provided %s", param))
+ }
+
+ if uniqueField.Kind() != field.Kind() {
+ panic(fmt.Sprintf("Bad field type %T:%T", field.Interface(), uniqueField.Interface()))
+ }
+
+ return field.Interface() != uniqueField.Interface()
+ }
+
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
}
}
// isMAC is the validation function for validating if the field's value is a valid MAC address.
func isMAC(fl FieldLevel) bool {
-
_, err := net.ParseMAC(fl.Field().String())
return err == nil
@@ -316,7 +372,6 @@ func isMAC(fl FieldLevel) bool {
// isCIDRv4 is the validation function for validating if the field's value is a valid v4 CIDR address.
func isCIDRv4(fl FieldLevel) bool {
-
ip, _, err := net.ParseCIDR(fl.Field().String())
return err == nil && ip.To4() != nil
@@ -324,7 +379,6 @@ func isCIDRv4(fl FieldLevel) bool {
// isCIDRv6 is the validation function for validating if the field's value is a valid v6 CIDR address.
func isCIDRv6(fl FieldLevel) bool {
-
ip, _, err := net.ParseCIDR(fl.Field().String())
return err == nil && ip.To4() == nil
@@ -332,7 +386,6 @@ func isCIDRv6(fl FieldLevel) bool {
// isCIDR is the validation function for validating if the field's value is a valid v4 or v6 CIDR address.
func isCIDR(fl FieldLevel) bool {
-
_, _, err := net.ParseCIDR(fl.Field().String())
return err == nil
@@ -340,7 +393,6 @@ func isCIDR(fl FieldLevel) bool {
// isIPv4 is the validation function for validating if a value is a valid v4 IP address.
func isIPv4(fl FieldLevel) bool {
-
ip := net.ParseIP(fl.Field().String())
return ip != nil && ip.To4() != nil
@@ -348,7 +400,6 @@ func isIPv4(fl FieldLevel) bool {
// isIPv6 is the validation function for validating if the field's value is a valid v6 IP address.
func isIPv6(fl FieldLevel) bool {
-
ip := net.ParseIP(fl.Field().String())
return ip != nil && ip.To4() == nil
@@ -356,7 +407,6 @@ func isIPv6(fl FieldLevel) bool {
// isIP is the validation function for validating if the field's value is a valid v4 or v6 IP address.
func isIP(fl FieldLevel) bool {
-
ip := net.ParseIP(fl.Field().String())
return ip != nil
@@ -364,7 +414,6 @@ func isIP(fl FieldLevel) bool {
// isSSN is the validation function for validating if the field's value is a valid SSN.
func isSSN(fl FieldLevel) bool {
-
field := fl.Field()
if field.Len() != 11 {
@@ -422,7 +471,6 @@ func isLatitude(fl FieldLevel) bool {
// isDataURI is the validation function for validating if the field's value is a valid data URI.
func isDataURI(fl FieldLevel) bool {
-
uri := strings.SplitN(fl.Field().String(), ",", 2)
if len(uri) != 2 {
@@ -438,7 +486,6 @@ func isDataURI(fl FieldLevel) bool {
// hasMultiByteCharacter is the validation function for validating if the field's value has a multi byte character.
func hasMultiByteCharacter(fl FieldLevel) bool {
-
field := fl.Field()
if field.Len() == 0 {
@@ -498,6 +545,61 @@ func isUUIDRFC4122(fl FieldLevel) bool {
return uUIDRFC4122Regex.MatchString(fl.Field().String())
}
+// isULID is the validation function for validating if the field's value is a valid ULID.
+func isULID(fl FieldLevel) bool {
+ return uLIDRegex.MatchString(fl.Field().String())
+}
+
+// isMD4 is the validation function for validating if the field's value is a valid MD4.
+func isMD4(fl FieldLevel) bool {
+ return md4Regex.MatchString(fl.Field().String())
+}
+
+// isMD5 is the validation function for validating if the field's value is a valid MD5.
+func isMD5(fl FieldLevel) bool {
+ return md5Regex.MatchString(fl.Field().String())
+}
+
+// isSHA256 is the validation function for validating if the field's value is a valid SHA256.
+func isSHA256(fl FieldLevel) bool {
+ return sha256Regex.MatchString(fl.Field().String())
+}
+
+// isSHA384 is the validation function for validating if the field's value is a valid SHA384.
+func isSHA384(fl FieldLevel) bool {
+ return sha384Regex.MatchString(fl.Field().String())
+}
+
+// isSHA512 is the validation function for validating if the field's value is a valid SHA512.
+func isSHA512(fl FieldLevel) bool {
+ return sha512Regex.MatchString(fl.Field().String())
+}
+
+// isRIPEMD128 is the validation function for validating if the field's value is a valid PIPEMD128.
+func isRIPEMD128(fl FieldLevel) bool {
+ return ripemd128Regex.MatchString(fl.Field().String())
+}
+
+// isRIPEMD160 is the validation function for validating if the field's value is a valid PIPEMD160.
+func isRIPEMD160(fl FieldLevel) bool {
+ return ripemd160Regex.MatchString(fl.Field().String())
+}
+
+// isTIGER128 is the validation function for validating if the field's value is a valid TIGER128.
+func isTIGER128(fl FieldLevel) bool {
+ return tiger128Regex.MatchString(fl.Field().String())
+}
+
+// isTIGER160 is the validation function for validating if the field's value is a valid TIGER160.
+func isTIGER160(fl FieldLevel) bool {
+ return tiger160Regex.MatchString(fl.Field().String())
+}
+
+// isTIGER192 is the validation function for validating if the field's value is a valid isTIGER192.
+func isTIGER192(fl FieldLevel) bool {
+ return tiger192Regex.MatchString(fl.Field().String())
+}
+
// isISBN is the validation function for validating if the field's value is a valid v10 or v13 ISBN.
func isISBN(fl FieldLevel) bool {
return isISBN10(fl) || isISBN13(fl)
@@ -505,7 +607,6 @@ func isISBN(fl FieldLevel) bool {
// isISBN13 is the validation function for validating if the field's value is a valid v13 ISBN.
func isISBN13(fl FieldLevel) bool {
-
s := strings.Replace(strings.Replace(fl.Field().String(), "-", "", 4), " ", "", 4)
if !iSBN13Regex.MatchString(s) {
@@ -526,7 +627,6 @@ func isISBN13(fl FieldLevel) bool {
// isISBN10 is the validation function for validating if the field's value is a valid v10 ISBN.
func isISBN10(fl FieldLevel) bool {
-
s := strings.Replace(strings.Replace(fl.Field().String(), "-", "", 3), " ", "", 3)
if !iSBN10Regex.MatchString(s) {
@@ -553,14 +653,16 @@ func isISBN10(fl FieldLevel) bool {
func isEthereumAddress(fl FieldLevel) bool {
address := fl.Field().String()
+ return ethAddressRegex.MatchString(address)
+}
+
+// isEthereumAddressChecksum is the validation function for validating if the field's value is a valid checksumed Ethereum address.
+func isEthereumAddressChecksum(fl FieldLevel) bool {
+ address := fl.Field().String()
+
if !ethAddressRegex.MatchString(address) {
return false
}
-
- if ethAddressRegexUpper.MatchString(address) || ethAddressRegexLower.MatchString(address) {
- return true
- }
-
// Checksum validation. Reference: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md
address = address[2:] // Skip "0x" prefix.
h := sha3.NewLegacyKeccak256()
@@ -714,7 +816,6 @@ func excludes(fl FieldLevel) bool {
// containsRune is the validation function for validating that the field's value contains the rune specified within the param.
func containsRune(fl FieldLevel) bool {
-
r, _ := utf8.DecodeRuneInString(fl.Param())
return strings.ContainsRune(fl.Field().String(), r)
@@ -777,7 +878,6 @@ func fieldExcludes(fl FieldLevel) bool {
// isNeField is the validation function for validating if the current field's value is not equal to the field specified by the param's value.
func isNeField(fl FieldLevel) bool {
-
field := fl.Field()
kind := field.Kind()
@@ -808,12 +908,7 @@ func isNeField(fl FieldLevel) bool {
fieldType := field.Type()
- // Not Same underlying type i.e. struct and time
- if fieldType != currentField.Type() {
- return true
- }
-
- if fieldType == timeType {
+ if fieldType.ConvertibleTo(timeType) && currentField.Type().ConvertibleTo(timeType) {
t := currentField.Interface().(time.Time)
fieldTime := field.Interface().(time.Time)
@@ -821,6 +916,10 @@ func isNeField(fl FieldLevel) bool {
return !fieldTime.Equal(t)
}
+ // Not Same underlying type i.e. struct and time
+ if fieldType != currentField.Type() {
+ return true
+ }
}
// default reflect.String:
@@ -832,9 +931,14 @@ func isNe(fl FieldLevel) bool {
return !isEq(fl)
}
+// isNeIgnoreCase is the validation function for validating that the field's string value does not equal the
+// provided param value. The comparison is case-insensitive
+func isNeIgnoreCase(fl FieldLevel) bool {
+ return !isEqIgnoreCase(fl)
+}
+
// isLteCrossStructField is the validation function for validating if the current field's value is less than or equal to the field, within a separate struct, specified by the param's value.
func isLteCrossStructField(fl FieldLevel) bool {
-
field := fl.Field()
kind := field.Kind()
@@ -861,18 +965,18 @@ func isLteCrossStructField(fl FieldLevel) bool {
fieldType := field.Type()
- // Not Same underlying type i.e. struct and time
- if fieldType != topField.Type() {
- return false
- }
-
- if fieldType == timeType {
+ if fieldType.ConvertibleTo(timeType) && topField.Type().ConvertibleTo(timeType) {
- fieldTime := field.Interface().(time.Time)
- topTime := topField.Interface().(time.Time)
+ fieldTime := field.Convert(timeType).Interface().(time.Time)
+ topTime := topField.Convert(timeType).Interface().(time.Time)
return fieldTime.Before(topTime) || fieldTime.Equal(topTime)
}
+
+ // Not Same underlying type i.e. struct and time
+ if fieldType != topField.Type() {
+ return false
+ }
}
// default reflect.String:
@@ -882,7 +986,6 @@ func isLteCrossStructField(fl FieldLevel) bool {
// isLtCrossStructField is the validation function for validating if the current field's value is less than the field, within a separate struct, specified by the param's value.
// NOTE: This is exposed for use within your own custom functions and not intended to be called directly.
func isLtCrossStructField(fl FieldLevel) bool {
-
field := fl.Field()
kind := field.Kind()
@@ -909,18 +1012,18 @@ func isLtCrossStructField(fl FieldLevel) bool {
fieldType := field.Type()
- // Not Same underlying type i.e. struct and time
- if fieldType != topField.Type() {
- return false
- }
+ if fieldType.ConvertibleTo(timeType) && topField.Type().ConvertibleTo(timeType) {
- if fieldType == timeType {
-
- fieldTime := field.Interface().(time.Time)
- topTime := topField.Interface().(time.Time)
+ fieldTime := field.Convert(timeType).Interface().(time.Time)
+ topTime := topField.Convert(timeType).Interface().(time.Time)
return fieldTime.Before(topTime)
}
+
+ // Not Same underlying type i.e. struct and time
+ if fieldType != topField.Type() {
+ return false
+ }
}
// default reflect.String:
@@ -929,7 +1032,6 @@ func isLtCrossStructField(fl FieldLevel) bool {
// isGteCrossStructField is the validation function for validating if the current field's value is greater than or equal to the field, within a separate struct, specified by the param's value.
func isGteCrossStructField(fl FieldLevel) bool {
-
field := fl.Field()
kind := field.Kind()
@@ -956,18 +1058,18 @@ func isGteCrossStructField(fl FieldLevel) bool {
fieldType := field.Type()
- // Not Same underlying type i.e. struct and time
- if fieldType != topField.Type() {
- return false
- }
-
- if fieldType == timeType {
+ if fieldType.ConvertibleTo(timeType) && topField.Type().ConvertibleTo(timeType) {
- fieldTime := field.Interface().(time.Time)
- topTime := topField.Interface().(time.Time)
+ fieldTime := field.Convert(timeType).Interface().(time.Time)
+ topTime := topField.Convert(timeType).Interface().(time.Time)
return fieldTime.After(topTime) || fieldTime.Equal(topTime)
}
+
+ // Not Same underlying type i.e. struct and time
+ if fieldType != topField.Type() {
+ return false
+ }
}
// default reflect.String:
@@ -976,7 +1078,6 @@ func isGteCrossStructField(fl FieldLevel) bool {
// isGtCrossStructField is the validation function for validating if the current field's value is greater than the field, within a separate struct, specified by the param's value.
func isGtCrossStructField(fl FieldLevel) bool {
-
field := fl.Field()
kind := field.Kind()
@@ -1003,18 +1104,18 @@ func isGtCrossStructField(fl FieldLevel) bool {
fieldType := field.Type()
- // Not Same underlying type i.e. struct and time
- if fieldType != topField.Type() {
- return false
- }
-
- if fieldType == timeType {
+ if fieldType.ConvertibleTo(timeType) && topField.Type().ConvertibleTo(timeType) {
- fieldTime := field.Interface().(time.Time)
- topTime := topField.Interface().(time.Time)
+ fieldTime := field.Convert(timeType).Interface().(time.Time)
+ topTime := topField.Convert(timeType).Interface().(time.Time)
return fieldTime.After(topTime)
}
+
+ // Not Same underlying type i.e. struct and time
+ if fieldType != topField.Type() {
+ return false
+ }
}
// default reflect.String:
@@ -1023,7 +1124,6 @@ func isGtCrossStructField(fl FieldLevel) bool {
// isNeCrossStructField is the validation function for validating that the current field's value is not equal to the field, within a separate struct, specified by the param's value.
func isNeCrossStructField(fl FieldLevel) bool {
-
field := fl.Field()
kind := field.Kind()
@@ -1053,18 +1153,18 @@ func isNeCrossStructField(fl FieldLevel) bool {
fieldType := field.Type()
- // Not Same underlying type i.e. struct and time
- if fieldType != topField.Type() {
- return true
- }
+ if fieldType.ConvertibleTo(timeType) && topField.Type().ConvertibleTo(timeType) {
- if fieldType == timeType {
-
- t := field.Interface().(time.Time)
- fieldTime := topField.Interface().(time.Time)
+ t := field.Convert(timeType).Interface().(time.Time)
+ fieldTime := topField.Convert(timeType).Interface().(time.Time)
return !fieldTime.Equal(t)
}
+
+ // Not Same underlying type i.e. struct and time
+ if fieldType != topField.Type() {
+ return true
+ }
}
// default reflect.String:
@@ -1073,7 +1173,6 @@ func isNeCrossStructField(fl FieldLevel) bool {
// isEqCrossStructField is the validation function for validating that the current field's value is equal to the field, within a separate struct, specified by the param's value.
func isEqCrossStructField(fl FieldLevel) bool {
-
field := fl.Field()
kind := field.Kind()
@@ -1103,18 +1202,18 @@ func isEqCrossStructField(fl FieldLevel) bool {
fieldType := field.Type()
- // Not Same underlying type i.e. struct and time
- if fieldType != topField.Type() {
- return false
- }
-
- if fieldType == timeType {
+ if fieldType.ConvertibleTo(timeType) && topField.Type().ConvertibleTo(timeType) {
- t := field.Interface().(time.Time)
- fieldTime := topField.Interface().(time.Time)
+ t := field.Convert(timeType).Interface().(time.Time)
+ fieldTime := topField.Convert(timeType).Interface().(time.Time)
return fieldTime.Equal(t)
}
+
+ // Not Same underlying type i.e. struct and time
+ if fieldType != topField.Type() {
+ return false
+ }
}
// default reflect.String:
@@ -1123,7 +1222,6 @@ func isEqCrossStructField(fl FieldLevel) bool {
// isEqField is the validation function for validating if the current field's value is equal to the field specified by the param's value.
func isEqField(fl FieldLevel) bool {
-
field := fl.Field()
kind := field.Kind()
@@ -1153,19 +1251,18 @@ func isEqField(fl FieldLevel) bool {
fieldType := field.Type()
- // Not Same underlying type i.e. struct and time
- if fieldType != currentField.Type() {
- return false
- }
-
- if fieldType == timeType {
+ if fieldType.ConvertibleTo(timeType) && currentField.Type().ConvertibleTo(timeType) {
- t := currentField.Interface().(time.Time)
- fieldTime := field.Interface().(time.Time)
+ t := currentField.Convert(timeType).Interface().(time.Time)
+ fieldTime := field.Convert(timeType).Interface().(time.Time)
return fieldTime.Equal(t)
}
+ // Not Same underlying type i.e. struct and time
+ if fieldType != currentField.Type() {
+ return false
+ }
}
// default reflect.String:
@@ -1174,7 +1271,6 @@ func isEqField(fl FieldLevel) bool {
// isEq is the validation function for validating if the current field's value is equal to the param's value.
func isEq(fl FieldLevel) bool {
-
field := fl.Field()
param := fl.Param()
@@ -1212,6 +1308,22 @@ func isEq(fl FieldLevel) bool {
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
}
+// isEqIgnoreCase is the validation function for validating if the current field's string value is
+// equal to the param's value.
+// The comparison is case-insensitive.
+func isEqIgnoreCase(fl FieldLevel) bool {
+ field := fl.Field()
+ param := fl.Param()
+
+ switch field.Kind() {
+
+ case reflect.String:
+ return strings.EqualFold(field.String(), param)
+ }
+
+ panic(fmt.Sprintf("Bad field type %T", field.Interface()))
+}
+
// isPostcodeByIso3166Alpha2 validates by value which is country code in iso 3166 alpha 2
// example: `postcode_iso3166_alpha2=US`
func isPostcodeByIso3166Alpha2(fl FieldLevel) bool {
@@ -1226,7 +1338,7 @@ func isPostcodeByIso3166Alpha2(fl FieldLevel) bool {
return reg.MatchString(field.String())
}
-// isPostcodeByIso3166Alpha2 validates by field which represents for a value of country code in iso 3166 alpha 2
+// isPostcodeByIso3166Alpha2Field validates by field which represents for a value of country code in iso 3166 alpha 2
// example: `postcode_iso3166_alpha2_field=CountryCode`
func isPostcodeByIso3166Alpha2Field(fl FieldLevel) bool {
field := fl.Field()
@@ -1263,13 +1375,16 @@ func isBase64URL(fl FieldLevel) bool {
return base64URLRegex.MatchString(fl.Field().String())
}
+// isBase64RawURL is the validation function for validating if the current field's value is a valid base64 URL safe string without '=' padding.
+func isBase64RawURL(fl FieldLevel) bool {
+ return base64RawURLRegex.MatchString(fl.Field().String())
+}
+
// isURI is the validation function for validating if the current field's value is a valid URI.
func isURI(fl FieldLevel) bool {
-
field := fl.Field()
switch field.Kind() {
-
case reflect.String:
s := field.String()
@@ -1294,44 +1409,60 @@ func isURI(fl FieldLevel) bool {
// isURL is the validation function for validating if the current field's value is a valid URL.
func isURL(fl FieldLevel) bool {
-
field := fl.Field()
switch field.Kind() {
-
case reflect.String:
- var i int
s := field.String()
- // checks needed as of Go 1.6 because of change https://github.com/golang/go/commit/617c93ce740c3c3cc28cdd1a0d712be183d0b328#diff-6c2d018290e298803c0c9419d8739885L195
- // emulate browser and strip the '#' suffix prior to validation. see issue-#237
- if i = strings.Index(s, "#"); i > -1 {
- s = s[:i]
- }
-
if len(s) == 0 {
return false
}
- url, err := url.ParseRequestURI(s)
-
+ url, err := url.Parse(s)
if err != nil || url.Scheme == "" {
return false
}
+ if url.Host == "" && url.Fragment == "" && url.Opaque == "" {
+ return false
+ }
+
return true
}
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
}
+// isHttpURL is the validation function for validating if the current field's value is a valid HTTP(s) URL.
+func isHttpURL(fl FieldLevel) bool {
+ if !isURL(fl) {
+ return false
+ }
+
+ field := fl.Field()
+ switch field.Kind() {
+ case reflect.String:
+
+ s := strings.ToLower(field.String())
+
+ url, err := url.Parse(s)
+ if err != nil || url.Host == "" {
+ return false
+ }
+
+ return url.Scheme == "http" || url.Scheme == "https"
+ }
+
+ panic(fmt.Sprintf("Bad field type %T", field.Interface()))
+}
+
// isUrnRFC2141 is the validation function for validating if the current field's value is a valid URN as per RFC 2141.
func isUrnRFC2141(fl FieldLevel) bool {
field := fl.Field()
switch field.Kind() {
-
case reflect.String:
str := field.String()
@@ -1344,7 +1475,7 @@ func isUrnRFC2141(fl FieldLevel) bool {
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
}
-// isFile is the validation function for validating if the current field's value is a valid file path.
+// isFile is the validation function for validating if the current field's value is a valid existing file path.
func isFile(fl FieldLevel) bool {
field := fl.Field()
@@ -1361,6 +1492,118 @@ func isFile(fl FieldLevel) bool {
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
}
+// isImage is the validation function for validating if the current field's value contains the path to a valid image file
+func isImage(fl FieldLevel) bool {
+ mimetypes := map[string]bool{
+ "image/bmp": true,
+ "image/cis-cod": true,
+ "image/gif": true,
+ "image/ief": true,
+ "image/jpeg": true,
+ "image/jp2": true,
+ "image/jpx": true,
+ "image/jpm": true,
+ "image/pipeg": true,
+ "image/png": true,
+ "image/svg+xml": true,
+ "image/tiff": true,
+ "image/webp": true,
+ "image/x-cmu-raster": true,
+ "image/x-cmx": true,
+ "image/x-icon": true,
+ "image/x-portable-anymap": true,
+ "image/x-portable-bitmap": true,
+ "image/x-portable-graymap": true,
+ "image/x-portable-pixmap": true,
+ "image/x-rgb": true,
+ "image/x-xbitmap": true,
+ "image/x-xpixmap": true,
+ "image/x-xwindowdump": true,
+ }
+ field := fl.Field()
+
+ switch field.Kind() {
+ case reflect.String:
+ filePath := field.String()
+ fileInfo, err := os.Stat(filePath)
+
+ if err != nil {
+ return false
+ }
+
+ if fileInfo.IsDir() {
+ return false
+ }
+
+ file, err := os.Open(filePath)
+ if err != nil {
+ return false
+ }
+ defer file.Close()
+
+ mime, err := mimetype.DetectReader(file)
+ if err != nil {
+ return false
+ }
+
+ if _, ok := mimetypes[mime.String()]; ok {
+ return true
+ }
+ }
+ return false
+}
+
+// isFilePath is the validation function for validating if the current field's value is a valid file path.
+func isFilePath(fl FieldLevel) bool {
+
+ var exists bool
+ var err error
+
+ field := fl.Field()
+
+ // If it exists, it obviously is valid.
+ // This is done first to avoid code duplication and unnecessary additional logic.
+ if exists = isFile(fl); exists {
+ return true
+ }
+
+ // It does not exist but may still be a valid filepath.
+ switch field.Kind() {
+ case reflect.String:
+ // Every OS allows for whitespace, but none
+ // let you use a file with no filename (to my knowledge).
+ // Unless you're dealing with raw inodes, but I digress.
+ if strings.TrimSpace(field.String()) == "" {
+ return false
+ }
+ // We make sure it isn't a directory.
+ if strings.HasSuffix(field.String(), string(os.PathSeparator)) {
+ return false
+ }
+ if _, err = os.Stat(field.String()); err != nil {
+ switch t := err.(type) {
+ case *fs.PathError:
+ if t.Err == syscall.EINVAL {
+ // It's definitely an invalid character in the filepath.
+ return false
+ }
+ // It could be a permission error, a does-not-exist error, etc.
+ // Out-of-scope for this validation, though.
+ return true
+ default:
+ // Something went *seriously* wrong.
+ /*
+ Per https://pkg.go.dev/os#Stat:
+ "If there is an error, it will be of type *PathError."
+ */
+ panic(err)
+ }
+ }
+ }
+
+ panic(fmt.Sprintf("Bad field type %T", field.Interface()))
+}
+
// isE164 is the validation function for validating if the current field's value is a valid e.164 formatted phone number.
func isE164(fl FieldLevel) bool {
return e164Regex.MatchString(fl.Field().String())
@@ -1441,10 +1684,15 @@ func isAlphaUnicode(fl FieldLevel) bool {
return alphaUnicodeRegex.MatchString(fl.Field().String())
}
-// isBoolean is the validation function for validating if the current field's value can be safely converted to a boolean.
+// isBoolean is the validation function for validating if the current field's value is a valid boolean value or can be safely converted to a boolean value.
func isBoolean(fl FieldLevel) bool {
- _, err := strconv.ParseBool(fl.Field().String())
- return err == nil
+ switch fl.Field().Kind() {
+ case reflect.Bool:
+ return true
+ default:
+ _, err := strconv.ParseBool(fl.Field().String())
+ return err == nil
+ }
}
// isDefault is the opposite of required aka hasValue
@@ -1466,7 +1714,7 @@ func hasValue(fl FieldLevel) bool {
}
}
-// requireCheckField is a func for check field kind
+// requireCheckFieldKind is a func for check field kind
func requireCheckFieldKind(fl FieldLevel, param string, defaultNotFoundValue bool) bool {
field := fl.Field()
kind := field.Kind()
@@ -1491,7 +1739,9 @@ func requireCheckFieldKind(fl FieldLevel, param string, defaultNotFoundValue boo
}
// requireCheckFieldValue is a func for check field value
-func requireCheckFieldValue(fl FieldLevel, param string, value string, defaultNotFoundValue bool) bool {
+func requireCheckFieldValue(
+ fl FieldLevel, param string, value string, defaultNotFoundValue bool,
+) bool {
field, kind, _, found := fl.GetStructFieldOKAdvanced2(fl.Parent(), param)
if !found {
return defaultNotFoundValue
@@ -1534,6 +1784,22 @@ func requiredIf(fl FieldLevel) bool {
return hasValue(fl)
}
+// excludedIf is the validation function
+// The field under validation must not be present or is empty only if all the other specified fields are equal to the value following with the specified field.
+func excludedIf(fl FieldLevel) bool {
+ params := parseOneOfParam2(fl.Param())
+ if len(params)%2 != 0 {
+ panic(fmt.Sprintf("Bad param number for excluded_if %s", fl.FieldName()))
+ }
+
+ for i := 0; i < len(params); i += 2 {
+ if !requireCheckFieldValue(fl, params[i], params[i+1], false) {
+ return true
+ }
+ }
+ return !hasValue(fl)
+}
+
// requiredUnless is the validation function
// The field under validation must be present and not empty only unless all the other specified fields are equal to the value following with the specified field.
func requiredUnless(fl FieldLevel) bool {
@@ -1550,6 +1816,36 @@ func requiredUnless(fl FieldLevel) bool {
return hasValue(fl)
}
+// skipUnless is the validation function
+// The field under validation must be present and not empty only unless all the other specified fields are equal to the value following with the specified field.
+func skipUnless(fl FieldLevel) bool {
+ params := parseOneOfParam2(fl.Param())
+ if len(params)%2 != 0 {
+ panic(fmt.Sprintf("Bad param number for skip_unless %s", fl.FieldName()))
+ }
+ for i := 0; i < len(params); i += 2 {
+ if !requireCheckFieldValue(fl, params[i], params[i+1], false) {
+ return true
+ }
+ }
+ return hasValue(fl)
+}
+
+// excludedUnless is the validation function
+// The field under validation must not be present or is empty unless all the other specified fields are equal to the value following with the specified field.
+func excludedUnless(fl FieldLevel) bool {
+ params := parseOneOfParam2(fl.Param())
+ if len(params)%2 != 0 {
+ panic(fmt.Sprintf("Bad param number for excluded_unless %s", fl.FieldName()))
+ }
+ for i := 0; i < len(params); i += 2 {
+ if !requireCheckFieldValue(fl, params[i], params[i+1], false) {
+ return !hasValue(fl)
+ }
+ }
+ return true
+}
+
// excludedWith is the validation function
// The field under validation must not be present or is empty if any of the other specified fields are present.
func excludedWith(fl FieldLevel) bool {
@@ -1642,7 +1938,6 @@ func requiredWithoutAll(fl FieldLevel) bool {
// isGteField is the validation function for validating if the current field's value is greater than or equal to the field specified by the param's value.
func isGteField(fl FieldLevel) bool {
-
field := fl.Field()
kind := field.Kind()
@@ -1669,18 +1964,18 @@ func isGteField(fl FieldLevel) bool {
fieldType := field.Type()
- // Not Same underlying type i.e. struct and time
- if fieldType != currentField.Type() {
- return false
- }
+ if fieldType.ConvertibleTo(timeType) && currentField.Type().ConvertibleTo(timeType) {
- if fieldType == timeType {
-
- t := currentField.Interface().(time.Time)
- fieldTime := field.Interface().(time.Time)
+ t := currentField.Convert(timeType).Interface().(time.Time)
+ fieldTime := field.Convert(timeType).Interface().(time.Time)
return fieldTime.After(t) || fieldTime.Equal(t)
}
+
+ // Not Same underlying type i.e. struct and time
+ if fieldType != currentField.Type() {
+ return false
+ }
}
// default reflect.String
@@ -1689,7 +1984,6 @@ func isGteField(fl FieldLevel) bool {
// isGtField is the validation function for validating if the current field's value is greater than the field specified by the param's value.
func isGtField(fl FieldLevel) bool {
-
field := fl.Field()
kind := field.Kind()
@@ -1716,18 +2010,18 @@ func isGtField(fl FieldLevel) bool {
fieldType := field.Type()
- // Not Same underlying type i.e. struct and time
- if fieldType != currentField.Type() {
- return false
- }
+ if fieldType.ConvertibleTo(timeType) && currentField.Type().ConvertibleTo(timeType) {
- if fieldType == timeType {
-
- t := currentField.Interface().(time.Time)
- fieldTime := field.Interface().(time.Time)
+ t := currentField.Convert(timeType).Interface().(time.Time)
+ fieldTime := field.Convert(timeType).Interface().(time.Time)
return fieldTime.After(t)
}
+
+ // Not Same underlying type i.e. struct and time
+ if fieldType != currentField.Type() {
+ return false
+ }
}
// default reflect.String
@@ -1736,7 +2030,6 @@ func isGtField(fl FieldLevel) bool {
// isGte is the validation function for validating if the current field's value is greater than or equal to the param's value.
func isGte(fl FieldLevel) bool {
-
field := fl.Field()
param := fl.Param()
@@ -1769,10 +2062,10 @@ func isGte(fl FieldLevel) bool {
case reflect.Struct:
- if field.Type() == timeType {
+ if field.Type().ConvertibleTo(timeType) {
now := time.Now().UTC()
- t := field.Interface().(time.Time)
+ t := field.Convert(timeType).Interface().(time.Time)
return t.After(now) || t.Equal(now)
}
@@ -1783,7 +2076,6 @@ func isGte(fl FieldLevel) bool {
// isGt is the validation function for validating if the current field's value is greater than the param's value.
func isGt(fl FieldLevel) bool {
-
field := fl.Field()
param := fl.Param()
@@ -1815,9 +2107,9 @@ func isGt(fl FieldLevel) bool {
return field.Float() > p
case reflect.Struct:
- if field.Type() == timeType {
+ if field.Type().ConvertibleTo(timeType) {
- return field.Interface().(time.Time).After(time.Now().UTC())
+ return field.Convert(timeType).Interface().(time.Time).After(time.Now().UTC())
}
}
@@ -1826,7 +2118,6 @@ func isGt(fl FieldLevel) bool {
// hasLengthOf is the validation function for validating if the current field's value is equal to the param's value.
func hasLengthOf(fl FieldLevel) bool {
-
field := fl.Field()
param := fl.Param()
@@ -1868,7 +2159,6 @@ func hasMinOf(fl FieldLevel) bool {
// isLteField is the validation function for validating if the current field's value is less than or equal to the field specified by the param's value.
func isLteField(fl FieldLevel) bool {
-
field := fl.Field()
kind := field.Kind()
@@ -1895,18 +2185,18 @@ func isLteField(fl FieldLevel) bool {
fieldType := field.Type()
- // Not Same underlying type i.e. struct and time
- if fieldType != currentField.Type() {
- return false
- }
-
- if fieldType == timeType {
+ if fieldType.ConvertibleTo(timeType) && currentField.Type().ConvertibleTo(timeType) {
- t := currentField.Interface().(time.Time)
- fieldTime := field.Interface().(time.Time)
+ t := currentField.Convert(timeType).Interface().(time.Time)
+ fieldTime := field.Convert(timeType).Interface().(time.Time)
return fieldTime.Before(t) || fieldTime.Equal(t)
}
+
+ // Not Same underlying type i.e. struct and time
+ if fieldType != currentField.Type() {
+ return false
+ }
}
// default reflect.String
@@ -1915,7 +2205,6 @@ func isLteField(fl FieldLevel) bool {
// isLtField is the validation function for validating if the current field's value is less than the field specified by the param's value.
func isLtField(fl FieldLevel) bool {
-
field := fl.Field()
kind := field.Kind()
@@ -1942,18 +2231,18 @@ func isLtField(fl FieldLevel) bool {
fieldType := field.Type()
- // Not Same underlying type i.e. struct and time
- if fieldType != currentField.Type() {
- return false
- }
-
- if fieldType == timeType {
+ if fieldType.ConvertibleTo(timeType) && currentField.Type().ConvertibleTo(timeType) {
- t := currentField.Interface().(time.Time)
- fieldTime := field.Interface().(time.Time)
+ t := currentField.Convert(timeType).Interface().(time.Time)
+ fieldTime := field.Convert(timeType).Interface().(time.Time)
return fieldTime.Before(t)
}
+
+ // Not Same underlying type i.e. struct and time
+ if fieldType != currentField.Type() {
+ return false
+ }
}
// default reflect.String
@@ -1962,7 +2251,6 @@ func isLtField(fl FieldLevel) bool {
// isLte is the validation function for validating if the current field's value is less than or equal to the param's value.
func isLte(fl FieldLevel) bool {
-
field := fl.Field()
param := fl.Param()
@@ -1995,10 +2283,10 @@ func isLte(fl FieldLevel) bool {
case reflect.Struct:
- if field.Type() == timeType {
+ if field.Type().ConvertibleTo(timeType) {
now := time.Now().UTC()
- t := field.Interface().(time.Time)
+ t := field.Convert(timeType).Interface().(time.Time)
return t.Before(now) || t.Equal(now)
}
@@ -2009,7 +2297,6 @@ func isLte(fl FieldLevel) bool {
// isLt is the validation function for validating if the current field's value is less than the param's value.
func isLt(fl FieldLevel) bool {
-
field := fl.Field()
param := fl.Param()
@@ -2042,9 +2329,9 @@ func isLt(fl FieldLevel) bool {
case reflect.Struct:
- if field.Type() == timeType {
+ if field.Type().ConvertibleTo(timeType) {
- return field.Interface().(time.Time).Before(time.Now().UTC())
+ return field.Convert(timeType).Interface().(time.Time).Before(time.Now().UTC())
}
}
@@ -2058,7 +2345,6 @@ func hasMaxOf(fl FieldLevel) bool {
// isTCP4AddrResolvable is the validation function for validating if the field's value is a resolvable tcp4 address.
func isTCP4AddrResolvable(fl FieldLevel) bool {
-
if !isIP4Addr(fl) {
return false
}
@@ -2069,7 +2355,6 @@ func isTCP4AddrResolvable(fl FieldLevel) bool {
// isTCP6AddrResolvable is the validation function for validating if the field's value is a resolvable tcp6 address.
func isTCP6AddrResolvable(fl FieldLevel) bool {
-
if !isIP6Addr(fl) {
return false
}
@@ -2081,7 +2366,6 @@ func isTCP6AddrResolvable(fl FieldLevel) bool {
// isTCPAddrResolvable is the validation function for validating if the field's value is a resolvable tcp address.
func isTCPAddrResolvable(fl FieldLevel) bool {
-
if !isIP4Addr(fl) && !isIP6Addr(fl) {
return false
}
@@ -2093,7 +2377,6 @@ func isTCPAddrResolvable(fl FieldLevel) bool {
// isUDP4AddrResolvable is the validation function for validating if the field's value is a resolvable udp4 address.
func isUDP4AddrResolvable(fl FieldLevel) bool {
-
if !isIP4Addr(fl) {
return false
}
@@ -2105,7 +2388,6 @@ func isUDP4AddrResolvable(fl FieldLevel) bool {
// isUDP6AddrResolvable is the validation function for validating if the field's value is a resolvable udp6 address.
func isUDP6AddrResolvable(fl FieldLevel) bool {
-
if !isIP6Addr(fl) {
return false
}
@@ -2117,7 +2399,6 @@ func isUDP6AddrResolvable(fl FieldLevel) bool {
// isUDPAddrResolvable is the validation function for validating if the field's value is a resolvable udp address.
func isUDPAddrResolvable(fl FieldLevel) bool {
-
if !isIP4Addr(fl) && !isIP6Addr(fl) {
return false
}
@@ -2129,7 +2410,6 @@ func isUDPAddrResolvable(fl FieldLevel) bool {
// isIP4AddrResolvable is the validation function for validating if the field's value is a resolvable ip4 address.
func isIP4AddrResolvable(fl FieldLevel) bool {
-
if !isIPv4(fl) {
return false
}
@@ -2141,7 +2421,6 @@ func isIP4AddrResolvable(fl FieldLevel) bool {
// isIP6AddrResolvable is the validation function for validating if the field's value is a resolvable ip6 address.
func isIP6AddrResolvable(fl FieldLevel) bool {
-
if !isIPv6(fl) {
return false
}
@@ -2153,7 +2432,6 @@ func isIP6AddrResolvable(fl FieldLevel) bool {
// isIPAddrResolvable is the validation function for validating if the field's value is a resolvable ip address.
func isIPAddrResolvable(fl FieldLevel) bool {
-
if !isIP(fl) {
return false
}
@@ -2165,14 +2443,12 @@ func isIPAddrResolvable(fl FieldLevel) bool {
// isUnixAddrResolvable is the validation function for validating if the field's value is a resolvable unix address.
func isUnixAddrResolvable(fl FieldLevel) bool {
-
_, err := net.ResolveUnixAddr("unix", fl.Field().String())
return err == nil
}
func isIP4Addr(fl FieldLevel) bool {
-
val := fl.Field().String()
if idx := strings.LastIndex(val, ":"); idx != -1 {
@@ -2185,7 +2461,6 @@ func isIP4Addr(fl FieldLevel) bool {
}
func isIP6Addr(fl FieldLevel) bool {
-
val := fl.Field().String()
if idx := strings.LastIndex(val, ":"); idx != -1 {
@@ -2217,7 +2492,7 @@ func isFQDN(fl FieldLevel) bool {
return fqdnRegexRFC1123.MatchString(val)
}
-// isDir is the validation function for validating if the current field's value is a valid directory.
+// isDir is the validation function for validating if the current field's value is a valid existing directory.
func isDir(fl FieldLevel) bool {
field := fl.Field()
@@ -2233,13 +2508,79 @@ func isDir(fl FieldLevel) bool {
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
}
+// isDirPath is the validation function for validating if the current field's value is a valid directory.
+func isDirPath(fl FieldLevel) bool {
+
+ var exists bool
+ var err error
+
+ field := fl.Field()
+
+ // If it exists, it obviously is valid.
+ // This is done first to avoid code duplication and unnecessary additional logic.
+ if exists = isDir(fl); exists {
+ return true
+ }
+
+ // It does not exist but may still be a valid path.
+ switch field.Kind() {
+ case reflect.String:
+ // Every OS allows for whitespace, but none
+ // let you use a dir with no name (to my knowledge).
+ // Unless you're dealing with raw inodes, but I digress.
+ if strings.TrimSpace(field.String()) == "" {
+ return false
+ }
+ if _, err = os.Stat(field.String()); err != nil {
+ switch t := err.(type) {
+ case *fs.PathError:
+ if t.Err == syscall.EINVAL {
+ // It's definitely an invalid character in the path.
+ return false
+ }
+ // It could be a permission error, a does-not-exist error, etc.
+ // Out-of-scope for this validation, though.
+ // Lastly, we make sure it is a directory.
+ if strings.HasSuffix(field.String(), string(os.PathSeparator)) {
+ return true
+ } else {
+ return false
+ }
+ default:
+ // Something went *seriously* wrong.
+ /*
+ Per https://pkg.go.dev/os#Stat:
+ "If there is an error, it will be of type *PathError."
+ */
+ panic(err)
+ }
+ }
+ // We repeat the check here to make sure it is an explicit directory in case the above os.Stat didn't trigger an error.
+ if strings.HasSuffix(field.String(), string(os.PathSeparator)) {
+ return true
+ } else {
+ return false
+ }
+ }
+
+ panic(fmt.Sprintf("Bad field type %T", field.Interface()))
+}
+
// isJSON is the validation function for validating if the current field's value is a valid json string.
func isJSON(fl FieldLevel) bool {
field := fl.Field()
- if field.Kind() == reflect.String {
+ switch field.Kind() {
+ case reflect.String:
val := field.String()
return json.Valid([]byte(val))
+ case reflect.Slice:
+ fieldType := field.Type()
+
+ if fieldType.ConvertibleTo(byteSliceType) {
+ b := field.Convert(byteSliceType).Interface().([]byte)
+ return json.Valid(b)
+ }
}
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
@@ -2258,7 +2599,9 @@ func isHostnamePort(fl FieldLevel) bool {
return false
}
// Port must be a iny <= 65535.
- if portNum, err := strconv.ParseInt(port, 10, 32); err != nil || portNum > 65535 || portNum < 1 {
+ if portNum, err := strconv.ParseInt(
+ port, 10, 32,
+ ); err != nil || portNum > 65535 || portNum < 1 {
return false
}
@@ -2339,18 +2682,24 @@ func isIso3166Alpha2(fl FieldLevel) bool {
return iso3166_1_alpha2[val]
}
-// isIso3166Alpha2 is the validation function for validating if the current field's value is a valid iso3166-1 alpha-3 country code.
+// isIso3166Alpha3 is the validation function for validating if the current field's value is a valid iso3166-1 alpha-3 country code.
func isIso3166Alpha3(fl FieldLevel) bool {
val := fl.Field().String()
return iso3166_1_alpha3[val]
}
-// isIso3166Alpha2 is the validation function for validating if the current field's value is a valid iso3166-1 alpha-numeric country code.
+// isIso3166AlphaNumeric is the validation function for validating if the current field's value is a valid iso3166-1 alpha-numeric country code.
func isIso3166AlphaNumeric(fl FieldLevel) bool {
field := fl.Field()
var code int
switch field.Kind() {
+ case reflect.String:
+ i, err := strconv.Atoi(field.String())
+ if err != nil {
+ return false
+ }
+ code = i % 1000
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
code = int(field.Int() % 1000)
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
@@ -2407,3 +2756,103 @@ func isIsoBicFormat(fl FieldLevel) bool {
return bicRegex.MatchString(bicString)
}
+
+// isSemverFormat is the validation function for validating if the current field's value is a valid semver version, defined in Semantic Versioning 2.0.0
+func isSemverFormat(fl FieldLevel) bool {
+ semverString := fl.Field().String()
+
+ return semverRegex.MatchString(semverString)
+}
+
+// isCveFormat is the validation function for validating if the current field's value is a valid cve id, defined in CVE mitre org
+func isCveFormat(fl FieldLevel) bool {
+ cveString := fl.Field().String()
+
+ return cveRegex.MatchString(cveString)
+}
+
+// isDnsRFC1035LabelFormat is the validation function
+// for validating if the current field's value is
+// a valid dns RFC 1035 label, defined in RFC 1035.
+func isDnsRFC1035LabelFormat(fl FieldLevel) bool {
+ val := fl.Field().String()
+ return dnsRegexRFC1035Label.MatchString(val)
+}
+
+// digitsHaveLuhnChecksum returns true if and only if the last element of the given digits slice is the Luhn checksum of the previous elements
+func digitsHaveLuhnChecksum(digits []string) bool {
+ size := len(digits)
+ sum := 0
+ for i, digit := range digits {
+ value, err := strconv.Atoi(digit)
+ if err != nil {
+ return false
+ }
+ if size%2 == 0 && i%2 == 0 || size%2 == 1 && i%2 == 1 {
+ v := value * 2
+ if v >= 10 {
+ sum += 1 + (v % 10)
+ } else {
+ sum += v
+ }
+ } else {
+ sum += value
+ }
+ }
+ return (sum % 10) == 0
+}
+
+// isMongoDB is the validation function for validating if the current field's value is valid mongoDB objectID
+func isMongoDB(fl FieldLevel) bool {
+ val := fl.Field().String()
+ return mongodbRegex.MatchString(val)
+}
+
+// isCreditCard is the validation function for validating if the current field's value is a valid credit card number
+func isCreditCard(fl FieldLevel) bool {
+ val := fl.Field().String()
+ var creditCard bytes.Buffer
+ segments := strings.Split(val, " ")
+ for _, segment := range segments {
+ if len(segment) < 3 {
+ return false
+ }
+ creditCard.WriteString(segment)
+ }
+
+ ccDigits := strings.Split(creditCard.String(), "")
+ size := len(ccDigits)
+ if size < 12 || size > 19 {
+ return false
+ }
+
+ return digitsHaveLuhnChecksum(ccDigits)
+}
+
+// hasLuhnChecksum is the validation for validating if the current field's value has a valid Luhn checksum
+func hasLuhnChecksum(fl FieldLevel) bool {
+ field := fl.Field()
+ var str string // convert to a string which will then be split into single digits; easier and more readable than shifting/extracting single digits from a number
+ switch field.Kind() {
+ case reflect.String:
+ str = field.String()
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ str = strconv.FormatInt(field.Int(), 10)
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
+ str = strconv.FormatUint(field.Uint(), 10)
+ default:
+ panic(fmt.Sprintf("Bad field type %T", field.Interface()))
+ }
+ size := len(str)
+ if size < 2 { // there has to be at least one digit that carries a meaning + the checksum
+ return false
+ }
+ digits := strings.Split(str, "")
+ return digitsHaveLuhnChecksum(digits)
+}
+
+// isCron is the validation function for validating if the current field's value is a valid cron expression
+func isCron(fl FieldLevel) bool {
+ cronString := fl.Field().String()
+ return cronRegex.MatchString(cronString)
+}
diff --git a/vendor/github.com/go-playground/validator/v10/cache.go b/vendor/github.com/go-playground/validator/v10/cache.go
index 0d18d6ec49..bbfd2a4af1 100644
--- a/vendor/github.com/go-playground/validator/v10/cache.go
+++ b/vendor/github.com/go-playground/validator/v10/cache.go
@@ -114,6 +114,7 @@ func (v *Validate) extractStructCache(current reflect.Value, sName string) *cStr
cs = &cStruct{name: sName, fields: make([]*cField, 0), fn: v.structLevelFuncs[typ]}
numFields := current.NumField()
+ rules := v.rules[typ]
var ctag *cTag
var fld reflect.StructField
@@ -128,7 +129,11 @@ func (v *Validate) extractStructCache(current reflect.Value, sName string) *cStr
continue
}
- tag = fld.Tag.Get(v.tagName)
+ if rtag, ok := rules[fld.Name]; ok {
+ tag = rtag
+ } else {
+ tag = fld.Tag.Get(v.tagName)
+ }
if tag == skipValidationTag {
continue
diff --git a/vendor/github.com/go-playground/validator/v10/country_codes.go b/vendor/github.com/go-playground/validator/v10/country_codes.go
index 0d9eda0338..0119f0574d 100644
--- a/vendor/github.com/go-playground/validator/v10/country_codes.go
+++ b/vendor/github.com/go-playground/validator/v10/country_codes.go
@@ -51,7 +51,7 @@ var iso3166_1_alpha2 = map[string]bool{
"TV": true, "UG": true, "UA": true, "AE": true, "GB": true,
"US": true, "UM": true, "UY": true, "UZ": true, "VU": true,
"VE": true, "VN": true, "VG": true, "VI": true, "WF": true,
- "EH": true, "YE": true, "ZM": true, "ZW": true,
+ "EH": true, "YE": true, "ZM": true, "ZW": true, "XK": true,
}
var iso3166_1_alpha3 = map[string]bool{
@@ -105,7 +105,7 @@ var iso3166_1_alpha3 = map[string]bool{
"UGA": true, "UKR": true, "ARE": true, "GBR": true, "UMI": true,
"USA": true, "URY": true, "UZB": true, "VUT": true, "VEN": true,
"VNM": true, "VGB": true, "VIR": true, "WLF": true, "ESH": true,
- "YEM": true, "ZMB": true, "ZWE": true, "ALA": true,
+ "YEM": true, "ZMB": true, "ZWE": true, "ALA": true, "UNK": true,
}
var iso3166_1_alpha_numeric = map[int]bool{
// see: https://www.iso.org/iso-3166-country-codes.html
@@ -158,975 +158,993 @@ var iso3166_1_alpha_numeric = map[int]bool{
800: true, 804: true, 784: true, 826: true, 581: true,
840: true, 858: true, 860: true, 548: true, 862: true,
704: true, 92: true, 850: true, 876: true, 732: true,
- 887: true, 894: true, 716: true, 248: true,
+ 887: true, 894: true, 716: true, 248: true, 153: true,
}
var iso3166_2 = map[string]bool{
- "AD-02" : true, "AD-03" : true, "AD-04" : true, "AD-05" : true, "AD-06" : true,
- "AD-07" : true, "AD-08" : true, "AE-AJ" : true, "AE-AZ" : true, "AE-DU" : true,
- "AE-FU" : true, "AE-RK" : true, "AE-SH" : true, "AE-UQ" : true, "AF-BAL" : true,
- "AF-BAM" : true, "AF-BDG" : true, "AF-BDS" : true, "AF-BGL" : true, "AF-DAY" : true,
- "AF-FRA" : true, "AF-FYB" : true, "AF-GHA" : true, "AF-GHO" : true, "AF-HEL" : true,
- "AF-HER" : true, "AF-JOW" : true, "AF-KAB" : true, "AF-KAN" : true, "AF-KAP" : true,
- "AF-KDZ" : true, "AF-KHO" : true, "AF-KNR" : true, "AF-LAG" : true, "AF-LOG" : true,
- "AF-NAN" : true, "AF-NIM" : true, "AF-NUR" : true, "AF-PAN" : true, "AF-PAR" : true,
- "AF-PIA" : true, "AF-PKA" : true, "AF-SAM" : true, "AF-SAR" : true, "AF-TAK" : true,
- "AF-URU" : true, "AF-WAR" : true, "AF-ZAB" : true, "AG-03" : true, "AG-04" : true,
- "AG-05" : true, "AG-06" : true, "AG-07" : true, "AG-08" : true, "AG-10" : true,
- "AG-11" : true, "AL-01" : true, "AL-02" : true, "AL-03" : true, "AL-04" : true,
- "AL-05" : true, "AL-06" : true, "AL-07" : true, "AL-08" : true, "AL-09" : true,
- "AL-10" : true, "AL-11" : true, "AL-12" : true, "AL-BR" : true, "AL-BU" : true,
- "AL-DI" : true, "AL-DL" : true, "AL-DR" : true, "AL-DV" : true, "AL-EL" : true,
- "AL-ER" : true, "AL-FR" : true, "AL-GJ" : true, "AL-GR" : true, "AL-HA" : true,
- "AL-KA" : true, "AL-KB" : true, "AL-KC" : true, "AL-KO" : true, "AL-KR" : true,
- "AL-KU" : true, "AL-LB" : true, "AL-LE" : true, "AL-LU" : true, "AL-MK" : true,
- "AL-MM" : true, "AL-MR" : true, "AL-MT" : true, "AL-PG" : true, "AL-PQ" : true,
- "AL-PR" : true, "AL-PU" : true, "AL-SH" : true, "AL-SK" : true, "AL-SR" : true,
- "AL-TE" : true, "AL-TP" : true, "AL-TR" : true, "AL-VL" : true, "AM-AG" : true,
- "AM-AR" : true, "AM-AV" : true, "AM-ER" : true, "AM-GR" : true, "AM-KT" : true,
- "AM-LO" : true, "AM-SH" : true, "AM-SU" : true, "AM-TV" : true, "AM-VD" : true,
- "AO-BGO" : true, "AO-BGU" : true, "AO-BIE" : true, "AO-CAB" : true, "AO-CCU" : true,
- "AO-CNN" : true, "AO-CNO" : true, "AO-CUS" : true, "AO-HUA" : true, "AO-HUI" : true,
- "AO-LNO" : true, "AO-LSU" : true, "AO-LUA" : true, "AO-MAL" : true, "AO-MOX" : true,
- "AO-NAM" : true, "AO-UIG" : true, "AO-ZAI" : true, "AR-A" : true, "AR-B" : true,
- "AR-C" : true, "AR-D" : true, "AR-E" : true, "AR-G" : true, "AR-H" : true,
- "AR-J" : true, "AR-K" : true, "AR-L" : true, "AR-M" : true, "AR-N" : true,
- "AR-P" : true, "AR-Q" : true, "AR-R" : true, "AR-S" : true, "AR-T" : true,
- "AR-U" : true, "AR-V" : true, "AR-W" : true, "AR-X" : true, "AR-Y" : true,
- "AR-Z" : true, "AT-1" : true, "AT-2" : true, "AT-3" : true, "AT-4" : true,
- "AT-5" : true, "AT-6" : true, "AT-7" : true, "AT-8" : true, "AT-9" : true,
- "AU-ACT" : true, "AU-NSW" : true, "AU-NT" : true, "AU-QLD" : true, "AU-SA" : true,
- "AU-TAS" : true, "AU-VIC" : true, "AU-WA" : true, "AZ-ABS" : true, "AZ-AGA" : true,
- "AZ-AGC" : true, "AZ-AGM" : true, "AZ-AGS" : true, "AZ-AGU" : true, "AZ-AST" : true,
- "AZ-BA" : true, "AZ-BAB" : true, "AZ-BAL" : true, "AZ-BAR" : true, "AZ-BEY" : true,
- "AZ-BIL" : true, "AZ-CAB" : true, "AZ-CAL" : true, "AZ-CUL" : true, "AZ-DAS" : true,
- "AZ-FUZ" : true, "AZ-GA" : true, "AZ-GAD" : true, "AZ-GOR" : true, "AZ-GOY" : true,
- "AZ-GYG" : true, "AZ-HAC" : true, "AZ-IMI" : true, "AZ-ISM" : true, "AZ-KAL" : true,
- "AZ-KAN" : true, "AZ-KUR" : true, "AZ-LA" : true, "AZ-LAC" : true, "AZ-LAN" : true,
- "AZ-LER" : true, "AZ-MAS" : true, "AZ-MI" : true, "AZ-NA" : true, "AZ-NEF" : true,
- "AZ-NV" : true, "AZ-NX" : true, "AZ-OGU" : true, "AZ-ORD" : true, "AZ-QAB" : true,
- "AZ-QAX" : true, "AZ-QAZ" : true, "AZ-QBA" : true, "AZ-QBI" : true, "AZ-QOB" : true,
- "AZ-QUS" : true, "AZ-SA" : true, "AZ-SAB" : true, "AZ-SAD" : true, "AZ-SAH" : true,
- "AZ-SAK" : true, "AZ-SAL" : true, "AZ-SAR" : true, "AZ-SAT" : true, "AZ-SBN" : true,
- "AZ-SIY" : true, "AZ-SKR" : true, "AZ-SM" : true, "AZ-SMI" : true, "AZ-SMX" : true,
- "AZ-SR" : true, "AZ-SUS" : true, "AZ-TAR" : true, "AZ-TOV" : true, "AZ-UCA" : true,
- "AZ-XA" : true, "AZ-XAC" : true, "AZ-XCI" : true, "AZ-XIZ" : true, "AZ-XVD" : true,
- "AZ-YAR" : true, "AZ-YE" : true, "AZ-YEV" : true, "AZ-ZAN" : true, "AZ-ZAQ" : true,
- "AZ-ZAR" : true, "BA-01" : true, "BA-02" : true, "BA-03" : true, "BA-04" : true,
- "BA-05" : true, "BA-06" : true, "BA-07" : true, "BA-08" : true, "BA-09" : true,
- "BA-10" : true, "BA-BIH" : true, "BA-BRC" : true, "BA-SRP" : true, "BB-01" : true,
- "BB-02" : true, "BB-03" : true, "BB-04" : true, "BB-05" : true, "BB-06" : true,
- "BB-07" : true, "BB-08" : true, "BB-09" : true, "BB-10" : true, "BB-11" : true,
- "BD-01" : true, "BD-02" : true, "BD-03" : true, "BD-04" : true, "BD-05" : true,
- "BD-06" : true, "BD-07" : true, "BD-08" : true, "BD-09" : true, "BD-10" : true,
- "BD-11" : true, "BD-12" : true, "BD-13" : true, "BD-14" : true, "BD-15" : true,
- "BD-16" : true, "BD-17" : true, "BD-18" : true, "BD-19" : true, "BD-20" : true,
- "BD-21" : true, "BD-22" : true, "BD-23" : true, "BD-24" : true, "BD-25" : true,
- "BD-26" : true, "BD-27" : true, "BD-28" : true, "BD-29" : true, "BD-30" : true,
- "BD-31" : true, "BD-32" : true, "BD-33" : true, "BD-34" : true, "BD-35" : true,
- "BD-36" : true, "BD-37" : true, "BD-38" : true, "BD-39" : true, "BD-40" : true,
- "BD-41" : true, "BD-42" : true, "BD-43" : true, "BD-44" : true, "BD-45" : true,
- "BD-46" : true, "BD-47" : true, "BD-48" : true, "BD-49" : true, "BD-50" : true,
- "BD-51" : true, "BD-52" : true, "BD-53" : true, "BD-54" : true, "BD-55" : true,
- "BD-56" : true, "BD-57" : true, "BD-58" : true, "BD-59" : true, "BD-60" : true,
- "BD-61" : true, "BD-62" : true, "BD-63" : true, "BD-64" : true, "BD-A" : true,
- "BD-B" : true, "BD-C" : true, "BD-D" : true, "BD-E" : true, "BD-F" : true,
- "BD-G" : true, "BE-BRU" : true, "BE-VAN" : true, "BE-VBR" : true, "BE-VLG" : true,
- "BE-VLI" : true, "BE-VOV" : true, "BE-VWV" : true, "BE-WAL" : true, "BE-WBR" : true,
- "BE-WHT" : true, "BE-WLG" : true, "BE-WLX" : true, "BE-WNA" : true, "BF-01" : true,
- "BF-02" : true, "BF-03" : true, "BF-04" : true, "BF-05" : true, "BF-06" : true,
- "BF-07" : true, "BF-08" : true, "BF-09" : true, "BF-10" : true, "BF-11" : true,
- "BF-12" : true, "BF-13" : true, "BF-BAL" : true, "BF-BAM" : true, "BF-BAN" : true,
- "BF-BAZ" : true, "BF-BGR" : true, "BF-BLG" : true, "BF-BLK" : true, "BF-COM" : true,
- "BF-GAN" : true, "BF-GNA" : true, "BF-GOU" : true, "BF-HOU" : true, "BF-IOB" : true,
- "BF-KAD" : true, "BF-KEN" : true, "BF-KMD" : true, "BF-KMP" : true, "BF-KOP" : true,
- "BF-KOS" : true, "BF-KOT" : true, "BF-KOW" : true, "BF-LER" : true, "BF-LOR" : true,
- "BF-MOU" : true, "BF-NAM" : true, "BF-NAO" : true, "BF-NAY" : true, "BF-NOU" : true,
- "BF-OUB" : true, "BF-OUD" : true, "BF-PAS" : true, "BF-PON" : true, "BF-SEN" : true,
- "BF-SIS" : true, "BF-SMT" : true, "BF-SNG" : true, "BF-SOM" : true, "BF-SOR" : true,
- "BF-TAP" : true, "BF-TUI" : true, "BF-YAG" : true, "BF-YAT" : true, "BF-ZIR" : true,
- "BF-ZON" : true, "BF-ZOU" : true, "BG-01" : true, "BG-02" : true, "BG-03" : true,
- "BG-04" : true, "BG-05" : true, "BG-06" : true, "BG-07" : true, "BG-08" : true,
- "BG-09" : true, "BG-10" : true, "BG-11" : true, "BG-12" : true, "BG-13" : true,
- "BG-14" : true, "BG-15" : true, "BG-16" : true, "BG-17" : true, "BG-18" : true,
- "BG-19" : true, "BG-20" : true, "BG-21" : true, "BG-22" : true, "BG-23" : true,
- "BG-24" : true, "BG-25" : true, "BG-26" : true, "BG-27" : true, "BG-28" : true,
- "BH-13" : true, "BH-14" : true, "BH-15" : true, "BH-16" : true, "BH-17" : true,
- "BI-BB" : true, "BI-BL" : true, "BI-BM" : true, "BI-BR" : true, "BI-CA" : true,
- "BI-CI" : true, "BI-GI" : true, "BI-KI" : true, "BI-KR" : true, "BI-KY" : true,
- "BI-MA" : true, "BI-MU" : true, "BI-MW" : true, "BI-NG" : true, "BI-RT" : true,
- "BI-RY" : true, "BJ-AK" : true, "BJ-AL" : true, "BJ-AQ" : true, "BJ-BO" : true,
- "BJ-CO" : true, "BJ-DO" : true, "BJ-KO" : true, "BJ-LI" : true, "BJ-MO" : true,
- "BJ-OU" : true, "BJ-PL" : true, "BJ-ZO" : true, "BN-BE" : true, "BN-BM" : true,
- "BN-TE" : true, "BN-TU" : true, "BO-B" : true, "BO-C" : true, "BO-H" : true,
- "BO-L" : true, "BO-N" : true, "BO-O" : true, "BO-P" : true, "BO-S" : true,
- "BO-T" : true, "BQ-BO" : true, "BQ-SA" : true, "BQ-SE" : true, "BR-AC" : true,
- "BR-AL" : true, "BR-AM" : true, "BR-AP" : true, "BR-BA" : true, "BR-CE" : true,
- "BR-DF" : true, "BR-ES" : true, "BR-FN" : true, "BR-GO" : true, "BR-MA" : true,
- "BR-MG" : true, "BR-MS" : true, "BR-MT" : true, "BR-PA" : true, "BR-PB" : true,
- "BR-PE" : true, "BR-PI" : true, "BR-PR" : true, "BR-RJ" : true, "BR-RN" : true,
- "BR-RO" : true, "BR-RR" : true, "BR-RS" : true, "BR-SC" : true, "BR-SE" : true,
- "BR-SP" : true, "BR-TO" : true, "BS-AK" : true, "BS-BI" : true, "BS-BP" : true,
- "BS-BY" : true, "BS-CE" : true, "BS-CI" : true, "BS-CK" : true, "BS-CO" : true,
- "BS-CS" : true, "BS-EG" : true, "BS-EX" : true, "BS-FP" : true, "BS-GC" : true,
- "BS-HI" : true, "BS-HT" : true, "BS-IN" : true, "BS-LI" : true, "BS-MC" : true,
- "BS-MG" : true, "BS-MI" : true, "BS-NE" : true, "BS-NO" : true, "BS-NS" : true,
- "BS-RC" : true, "BS-RI" : true, "BS-SA" : true, "BS-SE" : true, "BS-SO" : true,
- "BS-SS" : true, "BS-SW" : true, "BS-WG" : true, "BT-11" : true, "BT-12" : true,
- "BT-13" : true, "BT-14" : true, "BT-15" : true, "BT-21" : true, "BT-22" : true,
- "BT-23" : true, "BT-24" : true, "BT-31" : true, "BT-32" : true, "BT-33" : true,
- "BT-34" : true, "BT-41" : true, "BT-42" : true, "BT-43" : true, "BT-44" : true,
- "BT-45" : true, "BT-GA" : true, "BT-TY" : true, "BW-CE" : true, "BW-GH" : true,
- "BW-KG" : true, "BW-KL" : true, "BW-KW" : true, "BW-NE" : true, "BW-NW" : true,
- "BW-SE" : true, "BW-SO" : true, "BY-BR" : true, "BY-HM" : true, "BY-HO" : true,
- "BY-HR" : true, "BY-MA" : true, "BY-MI" : true, "BY-VI" : true, "BZ-BZ" : true,
- "BZ-CY" : true, "BZ-CZL" : true, "BZ-OW" : true, "BZ-SC" : true, "BZ-TOL" : true,
- "CA-AB" : true, "CA-BC" : true, "CA-MB" : true, "CA-NB" : true, "CA-NL" : true,
- "CA-NS" : true, "CA-NT" : true, "CA-NU" : true, "CA-ON" : true, "CA-PE" : true,
- "CA-QC" : true, "CA-SK" : true, "CA-YT" : true, "CD-BC" : true, "CD-BN" : true,
- "CD-EQ" : true, "CD-KA" : true, "CD-KE" : true, "CD-KN" : true, "CD-KW" : true,
- "CD-MA" : true, "CD-NK" : true, "CD-OR" : true, "CD-SK" : true, "CF-AC" : true,
- "CF-BB" : true, "CF-BGF" : true, "CF-BK" : true, "CF-HK" : true, "CF-HM" : true,
- "CF-HS" : true, "CF-KB" : true, "CF-KG" : true, "CF-LB" : true, "CF-MB" : true,
- "CF-MP" : true, "CF-NM" : true, "CF-OP" : true, "CF-SE" : true, "CF-UK" : true,
- "CF-VK" : true, "CG-11" : true, "CG-12" : true, "CG-13" : true, "CG-14" : true,
- "CG-15" : true, "CG-2" : true, "CG-5" : true, "CG-7" : true, "CG-8" : true,
- "CG-9" : true, "CG-BZV" : true, "CH-AG" : true, "CH-AI" : true, "CH-AR" : true,
- "CH-BE" : true, "CH-BL" : true, "CH-BS" : true, "CH-FR" : true, "CH-GE" : true,
- "CH-GL" : true, "CH-GR" : true, "CH-JU" : true, "CH-LU" : true, "CH-NE" : true,
- "CH-NW" : true, "CH-OW" : true, "CH-SG" : true, "CH-SH" : true, "CH-SO" : true,
- "CH-SZ" : true, "CH-TG" : true, "CH-TI" : true, "CH-UR" : true, "CH-VD" : true,
- "CH-VS" : true, "CH-ZG" : true, "CH-ZH" : true, "CI-01" : true, "CI-02" : true,
- "CI-03" : true, "CI-04" : true, "CI-05" : true, "CI-06" : true, "CI-07" : true,
- "CI-08" : true, "CI-09" : true, "CI-10" : true, "CI-11" : true, "CI-12" : true,
- "CI-13" : true, "CI-14" : true, "CI-15" : true, "CI-16" : true, "CI-17" : true,
- "CI-18" : true, "CI-19" : true, "CL-AI" : true, "CL-AN" : true, "CL-AP" : true,
- "CL-AR" : true, "CL-AT" : true, "CL-BI" : true, "CL-CO" : true, "CL-LI" : true,
- "CL-LL" : true, "CL-LR" : true, "CL-MA" : true, "CL-ML" : true, "CL-RM" : true,
- "CL-TA" : true, "CL-VS" : true, "CM-AD" : true, "CM-CE" : true, "CM-EN" : true,
- "CM-ES" : true, "CM-LT" : true, "CM-NO" : true, "CM-NW" : true, "CM-OU" : true,
- "CM-SU" : true, "CM-SW" : true, "CN-11" : true, "CN-12" : true, "CN-13" : true,
- "CN-14" : true, "CN-15" : true, "CN-21" : true, "CN-22" : true, "CN-23" : true,
- "CN-31" : true, "CN-32" : true, "CN-33" : true, "CN-34" : true, "CN-35" : true,
- "CN-36" : true, "CN-37" : true, "CN-41" : true, "CN-42" : true, "CN-43" : true,
- "CN-44" : true, "CN-45" : true, "CN-46" : true, "CN-50" : true, "CN-51" : true,
- "CN-52" : true, "CN-53" : true, "CN-54" : true, "CN-61" : true, "CN-62" : true,
- "CN-63" : true, "CN-64" : true, "CN-65" : true, "CN-71" : true, "CN-91" : true,
- "CN-92" : true, "CO-AMA" : true, "CO-ANT" : true, "CO-ARA" : true, "CO-ATL" : true,
- "CO-BOL" : true, "CO-BOY" : true, "CO-CAL" : true, "CO-CAQ" : true, "CO-CAS" : true,
- "CO-CAU" : true, "CO-CES" : true, "CO-CHO" : true, "CO-COR" : true, "CO-CUN" : true,
- "CO-DC" : true, "CO-GUA" : true, "CO-GUV" : true, "CO-HUI" : true, "CO-LAG" : true,
- "CO-MAG" : true, "CO-MET" : true, "CO-NAR" : true, "CO-NSA" : true, "CO-PUT" : true,
- "CO-QUI" : true, "CO-RIS" : true, "CO-SAN" : true, "CO-SAP" : true, "CO-SUC" : true,
- "CO-TOL" : true, "CO-VAC" : true, "CO-VAU" : true, "CO-VID" : true, "CR-A" : true,
- "CR-C" : true, "CR-G" : true, "CR-H" : true, "CR-L" : true, "CR-P" : true,
- "CR-SJ" : true, "CU-01" : true, "CU-02" : true, "CU-03" : true, "CU-04" : true,
- "CU-05" : true, "CU-06" : true, "CU-07" : true, "CU-08" : true, "CU-09" : true,
- "CU-10" : true, "CU-11" : true, "CU-12" : true, "CU-13" : true, "CU-14" : true,
- "CU-99" : true, "CV-B" : true, "CV-BR" : true, "CV-BV" : true, "CV-CA" : true,
- "CV-CF" : true, "CV-CR" : true, "CV-MA" : true, "CV-MO" : true, "CV-PA" : true,
- "CV-PN" : true, "CV-PR" : true, "CV-RB" : true, "CV-RG" : true, "CV-RS" : true,
- "CV-S" : true, "CV-SD" : true, "CV-SF" : true, "CV-SL" : true, "CV-SM" : true,
- "CV-SO" : true, "CV-SS" : true, "CV-SV" : true, "CV-TA" : true, "CV-TS" : true,
- "CY-01" : true, "CY-02" : true, "CY-03" : true, "CY-04" : true, "CY-05" : true,
- "CY-06" : true, "CZ-10" : true, "CZ-101" : true, "CZ-102" : true, "CZ-103" : true,
- "CZ-104" : true, "CZ-105" : true, "CZ-106" : true, "CZ-107" : true, "CZ-108" : true,
- "CZ-109" : true, "CZ-110" : true, "CZ-111" : true, "CZ-112" : true, "CZ-113" : true,
- "CZ-114" : true, "CZ-115" : true, "CZ-116" : true, "CZ-117" : true, "CZ-118" : true,
- "CZ-119" : true, "CZ-120" : true, "CZ-121" : true, "CZ-122" : true, "CZ-20" : true,
- "CZ-201" : true, "CZ-202" : true, "CZ-203" : true, "CZ-204" : true, "CZ-205" : true,
- "CZ-206" : true, "CZ-207" : true, "CZ-208" : true, "CZ-209" : true, "CZ-20A" : true,
- "CZ-20B" : true, "CZ-20C" : true, "CZ-31" : true, "CZ-311" : true, "CZ-312" : true,
- "CZ-313" : true, "CZ-314" : true, "CZ-315" : true, "CZ-316" : true, "CZ-317" : true,
- "CZ-32" : true, "CZ-321" : true, "CZ-322" : true, "CZ-323" : true, "CZ-324" : true,
- "CZ-325" : true, "CZ-326" : true, "CZ-327" : true, "CZ-41" : true, "CZ-411" : true,
- "CZ-412" : true, "CZ-413" : true, "CZ-42" : true, "CZ-421" : true, "CZ-422" : true,
- "CZ-423" : true, "CZ-424" : true, "CZ-425" : true, "CZ-426" : true, "CZ-427" : true,
- "CZ-51" : true, "CZ-511" : true, "CZ-512" : true, "CZ-513" : true, "CZ-514" : true,
- "CZ-52" : true, "CZ-521" : true, "CZ-522" : true, "CZ-523" : true, "CZ-524" : true,
- "CZ-525" : true, "CZ-53" : true, "CZ-531" : true, "CZ-532" : true, "CZ-533" : true,
- "CZ-534" : true, "CZ-63" : true, "CZ-631" : true, "CZ-632" : true, "CZ-633" : true,
- "CZ-634" : true, "CZ-635" : true, "CZ-64" : true, "CZ-641" : true, "CZ-642" : true,
- "CZ-643" : true, "CZ-644" : true, "CZ-645" : true, "CZ-646" : true, "CZ-647" : true,
- "CZ-71" : true, "CZ-711" : true, "CZ-712" : true, "CZ-713" : true, "CZ-714" : true,
- "CZ-715" : true, "CZ-72" : true, "CZ-721" : true, "CZ-722" : true, "CZ-723" : true,
- "CZ-724" : true, "CZ-80" : true, "CZ-801" : true, "CZ-802" : true, "CZ-803" : true,
- "CZ-804" : true, "CZ-805" : true, "CZ-806" : true, "DE-BB" : true, "DE-BE" : true,
- "DE-BW" : true, "DE-BY" : true, "DE-HB" : true, "DE-HE" : true, "DE-HH" : true,
- "DE-MV" : true, "DE-NI" : true, "DE-NW" : true, "DE-RP" : true, "DE-SH" : true,
- "DE-SL" : true, "DE-SN" : true, "DE-ST" : true, "DE-TH" : true, "DJ-AR" : true,
- "DJ-AS" : true, "DJ-DI" : true, "DJ-DJ" : true, "DJ-OB" : true, "DJ-TA" : true,
- "DK-81" : true, "DK-82" : true, "DK-83" : true, "DK-84" : true, "DK-85" : true,
- "DM-01" : true, "DM-02" : true, "DM-03" : true, "DM-04" : true, "DM-05" : true,
- "DM-06" : true, "DM-07" : true, "DM-08" : true, "DM-09" : true, "DM-10" : true,
- "DO-01" : true, "DO-02" : true, "DO-03" : true, "DO-04" : true, "DO-05" : true,
- "DO-06" : true, "DO-07" : true, "DO-08" : true, "DO-09" : true, "DO-10" : true,
- "DO-11" : true, "DO-12" : true, "DO-13" : true, "DO-14" : true, "DO-15" : true,
- "DO-16" : true, "DO-17" : true, "DO-18" : true, "DO-19" : true, "DO-20" : true,
- "DO-21" : true, "DO-22" : true, "DO-23" : true, "DO-24" : true, "DO-25" : true,
- "DO-26" : true, "DO-27" : true, "DO-28" : true, "DO-29" : true, "DO-30" : true,
- "DZ-01" : true, "DZ-02" : true, "DZ-03" : true, "DZ-04" : true, "DZ-05" : true,
- "DZ-06" : true, "DZ-07" : true, "DZ-08" : true, "DZ-09" : true, "DZ-10" : true,
- "DZ-11" : true, "DZ-12" : true, "DZ-13" : true, "DZ-14" : true, "DZ-15" : true,
- "DZ-16" : true, "DZ-17" : true, "DZ-18" : true, "DZ-19" : true, "DZ-20" : true,
- "DZ-21" : true, "DZ-22" : true, "DZ-23" : true, "DZ-24" : true, "DZ-25" : true,
- "DZ-26" : true, "DZ-27" : true, "DZ-28" : true, "DZ-29" : true, "DZ-30" : true,
- "DZ-31" : true, "DZ-32" : true, "DZ-33" : true, "DZ-34" : true, "DZ-35" : true,
- "DZ-36" : true, "DZ-37" : true, "DZ-38" : true, "DZ-39" : true, "DZ-40" : true,
- "DZ-41" : true, "DZ-42" : true, "DZ-43" : true, "DZ-44" : true, "DZ-45" : true,
- "DZ-46" : true, "DZ-47" : true, "DZ-48" : true, "EC-A" : true, "EC-B" : true,
- "EC-C" : true, "EC-D" : true, "EC-E" : true, "EC-F" : true, "EC-G" : true,
- "EC-H" : true, "EC-I" : true, "EC-L" : true, "EC-M" : true, "EC-N" : true,
- "EC-O" : true, "EC-P" : true, "EC-R" : true, "EC-S" : true, "EC-SD" : true,
- "EC-SE" : true, "EC-T" : true, "EC-U" : true, "EC-W" : true, "EC-X" : true,
- "EC-Y" : true, "EC-Z" : true, "EE-37" : true, "EE-39" : true, "EE-44" : true,
- "EE-49" : true, "EE-51" : true, "EE-57" : true, "EE-59" : true, "EE-65" : true,
- "EE-67" : true, "EE-70" : true, "EE-74" : true, "EE-78" : true, "EE-82" : true,
- "EE-84" : true, "EE-86" : true, "EG-ALX" : true, "EG-ASN" : true, "EG-AST" : true,
- "EG-BA" : true, "EG-BH" : true, "EG-BNS" : true, "EG-C" : true, "EG-DK" : true,
- "EG-DT" : true, "EG-FYM" : true, "EG-GH" : true, "EG-GZ" : true, "EG-HU" : true,
- "EG-IS" : true, "EG-JS" : true, "EG-KB" : true, "EG-KFS" : true, "EG-KN" : true,
- "EG-MN" : true, "EG-MNF" : true, "EG-MT" : true, "EG-PTS" : true, "EG-SHG" : true,
- "EG-SHR" : true, "EG-SIN" : true, "EG-SU" : true, "EG-SUZ" : true, "EG-WAD" : true,
- "ER-AN" : true, "ER-DK" : true, "ER-DU" : true, "ER-GB" : true, "ER-MA" : true,
- "ER-SK" : true, "ES-A" : true, "ES-AB" : true, "ES-AL" : true, "ES-AN" : true,
- "ES-AR" : true, "ES-AS" : true, "ES-AV" : true, "ES-B" : true, "ES-BA" : true,
- "ES-BI" : true, "ES-BU" : true, "ES-C" : true, "ES-CA" : true, "ES-CB" : true,
- "ES-CC" : true, "ES-CE" : true, "ES-CL" : true, "ES-CM" : true, "ES-CN" : true,
- "ES-CO" : true, "ES-CR" : true, "ES-CS" : true, "ES-CT" : true, "ES-CU" : true,
- "ES-EX" : true, "ES-GA" : true, "ES-GC" : true, "ES-GI" : true, "ES-GR" : true,
- "ES-GU" : true, "ES-H" : true, "ES-HU" : true, "ES-IB" : true, "ES-J" : true,
- "ES-L" : true, "ES-LE" : true, "ES-LO" : true, "ES-LU" : true, "ES-M" : true,
- "ES-MA" : true, "ES-MC" : true, "ES-MD" : true, "ES-ML" : true, "ES-MU" : true,
- "ES-NA" : true, "ES-NC" : true, "ES-O" : true, "ES-OR" : true, "ES-P" : true,
- "ES-PM" : true, "ES-PO" : true, "ES-PV" : true, "ES-RI" : true, "ES-S" : true,
- "ES-SA" : true, "ES-SE" : true, "ES-SG" : true, "ES-SO" : true, "ES-SS" : true,
- "ES-T" : true, "ES-TE" : true, "ES-TF" : true, "ES-TO" : true, "ES-V" : true,
- "ES-VA" : true, "ES-VC" : true, "ES-VI" : true, "ES-Z" : true, "ES-ZA" : true,
- "ET-AA" : true, "ET-AF" : true, "ET-AM" : true, "ET-BE" : true, "ET-DD" : true,
- "ET-GA" : true, "ET-HA" : true, "ET-OR" : true, "ET-SN" : true, "ET-SO" : true,
- "ET-TI" : true, "FI-01" : true, "FI-02" : true, "FI-03" : true, "FI-04" : true,
- "FI-05" : true, "FI-06" : true, "FI-07" : true, "FI-08" : true, "FI-09" : true,
- "FI-10" : true, "FI-11" : true, "FI-12" : true, "FI-13" : true, "FI-14" : true,
- "FI-15" : true, "FI-16" : true, "FI-17" : true, "FI-18" : true, "FI-19" : true,
- "FJ-C" : true, "FJ-E" : true, "FJ-N" : true, "FJ-R" : true, "FJ-W" : true,
- "FM-KSA" : true, "FM-PNI" : true, "FM-TRK" : true, "FM-YAP" : true, "FR-01" : true,
- "FR-02" : true, "FR-03" : true, "FR-04" : true, "FR-05" : true, "FR-06" : true,
- "FR-07" : true, "FR-08" : true, "FR-09" : true, "FR-10" : true, "FR-11" : true,
- "FR-12" : true, "FR-13" : true, "FR-14" : true, "FR-15" : true, "FR-16" : true,
- "FR-17" : true, "FR-18" : true, "FR-19" : true, "FR-21" : true, "FR-22" : true,
- "FR-23" : true, "FR-24" : true, "FR-25" : true, "FR-26" : true, "FR-27" : true,
- "FR-28" : true, "FR-29" : true, "FR-2A" : true, "FR-2B" : true, "FR-30" : true,
- "FR-31" : true, "FR-32" : true, "FR-33" : true, "FR-34" : true, "FR-35" : true,
- "FR-36" : true, "FR-37" : true, "FR-38" : true, "FR-39" : true, "FR-40" : true,
- "FR-41" : true, "FR-42" : true, "FR-43" : true, "FR-44" : true, "FR-45" : true,
- "FR-46" : true, "FR-47" : true, "FR-48" : true, "FR-49" : true, "FR-50" : true,
- "FR-51" : true, "FR-52" : true, "FR-53" : true, "FR-54" : true, "FR-55" : true,
- "FR-56" : true, "FR-57" : true, "FR-58" : true, "FR-59" : true, "FR-60" : true,
- "FR-61" : true, "FR-62" : true, "FR-63" : true, "FR-64" : true, "FR-65" : true,
- "FR-66" : true, "FR-67" : true, "FR-68" : true, "FR-69" : true, "FR-70" : true,
- "FR-71" : true, "FR-72" : true, "FR-73" : true, "FR-74" : true, "FR-75" : true,
- "FR-76" : true, "FR-77" : true, "FR-78" : true, "FR-79" : true, "FR-80" : true,
- "FR-81" : true, "FR-82" : true, "FR-83" : true, "FR-84" : true, "FR-85" : true,
- "FR-86" : true, "FR-87" : true, "FR-88" : true, "FR-89" : true, "FR-90" : true,
- "FR-91" : true, "FR-92" : true, "FR-93" : true, "FR-94" : true, "FR-95" : true,
- "FR-ARA" : true, "FR-BFC" : true, "FR-BL" : true, "FR-BRE" : true, "FR-COR" : true,
- "FR-CP" : true, "FR-CVL" : true, "FR-GES" : true, "FR-GF" : true, "FR-GP" : true,
- "FR-GUA" : true, "FR-HDF" : true, "FR-IDF" : true, "FR-LRE" : true, "FR-MAY" : true,
- "FR-MF" : true, "FR-MQ" : true, "FR-NAQ" : true, "FR-NC" : true, "FR-NOR" : true,
- "FR-OCC" : true, "FR-PAC" : true, "FR-PDL" : true, "FR-PF" : true, "FR-PM" : true,
- "FR-RE" : true, "FR-TF" : true, "FR-WF" : true, "FR-YT" : true, "GA-1" : true,
- "GA-2" : true, "GA-3" : true, "GA-4" : true, "GA-5" : true, "GA-6" : true,
- "GA-7" : true, "GA-8" : true, "GA-9" : true, "GB-ABC" : true, "GB-ABD" : true,
- "GB-ABE" : true, "GB-AGB" : true, "GB-AGY" : true, "GB-AND" : true, "GB-ANN" : true,
- "GB-ANS" : true, "GB-BAS" : true, "GB-BBD" : true, "GB-BDF" : true, "GB-BDG" : true,
- "GB-BEN" : true, "GB-BEX" : true, "GB-BFS" : true, "GB-BGE" : true, "GB-BGW" : true,
- "GB-BIR" : true, "GB-BKM" : true, "GB-BMH" : true, "GB-BNE" : true, "GB-BNH" : true,
- "GB-BNS" : true, "GB-BOL" : true, "GB-BPL" : true, "GB-BRC" : true, "GB-BRD" : true,
- "GB-BRY" : true, "GB-BST" : true, "GB-BUR" : true, "GB-CAM" : true, "GB-CAY" : true,
- "GB-CBF" : true, "GB-CCG" : true, "GB-CGN" : true, "GB-CHE" : true, "GB-CHW" : true,
- "GB-CLD" : true, "GB-CLK" : true, "GB-CMA" : true, "GB-CMD" : true, "GB-CMN" : true,
- "GB-CON" : true, "GB-COV" : true, "GB-CRF" : true, "GB-CRY" : true, "GB-CWY" : true,
- "GB-DAL" : true, "GB-DBY" : true, "GB-DEN" : true, "GB-DER" : true, "GB-DEV" : true,
- "GB-DGY" : true, "GB-DNC" : true, "GB-DND" : true, "GB-DOR" : true, "GB-DRS" : true,
- "GB-DUD" : true, "GB-DUR" : true, "GB-EAL" : true, "GB-EAW" : true, "GB-EAY" : true,
- "GB-EDH" : true, "GB-EDU" : true, "GB-ELN" : true, "GB-ELS" : true, "GB-ENF" : true,
- "GB-ENG" : true, "GB-ERW" : true, "GB-ERY" : true, "GB-ESS" : true, "GB-ESX" : true,
- "GB-FAL" : true, "GB-FIF" : true, "GB-FLN" : true, "GB-FMO" : true, "GB-GAT" : true,
- "GB-GBN" : true, "GB-GLG" : true, "GB-GLS" : true, "GB-GRE" : true, "GB-GWN" : true,
- "GB-HAL" : true, "GB-HAM" : true, "GB-HAV" : true, "GB-HCK" : true, "GB-HEF" : true,
- "GB-HIL" : true, "GB-HLD" : true, "GB-HMF" : true, "GB-HNS" : true, "GB-HPL" : true,
- "GB-HRT" : true, "GB-HRW" : true, "GB-HRY" : true, "GB-IOS" : true, "GB-IOW" : true,
- "GB-ISL" : true, "GB-IVC" : true, "GB-KEC" : true, "GB-KEN" : true, "GB-KHL" : true,
- "GB-KIR" : true, "GB-KTT" : true, "GB-KWL" : true, "GB-LAN" : true, "GB-LBC" : true,
- "GB-LBH" : true, "GB-LCE" : true, "GB-LDS" : true, "GB-LEC" : true, "GB-LEW" : true,
- "GB-LIN" : true, "GB-LIV" : true, "GB-LND" : true, "GB-LUT" : true, "GB-MAN" : true,
- "GB-MDB" : true, "GB-MDW" : true, "GB-MEA" : true, "GB-MIK" : true, "GD-01" : true,
- "GB-MLN" : true, "GB-MON" : true, "GB-MRT" : true, "GB-MRY" : true, "GB-MTY" : true,
- "GB-MUL" : true, "GB-NAY" : true, "GB-NBL" : true, "GB-NEL" : true, "GB-NET" : true,
- "GB-NFK" : true, "GB-NGM" : true, "GB-NIR" : true, "GB-NLK" : true, "GB-NLN" : true,
- "GB-NMD" : true, "GB-NSM" : true, "GB-NTH" : true, "GB-NTL" : true, "GB-NTT" : true,
- "GB-NTY" : true, "GB-NWM" : true, "GB-NWP" : true, "GB-NYK" : true, "GB-OLD" : true,
- "GB-ORK" : true, "GB-OXF" : true, "GB-PEM" : true, "GB-PKN" : true, "GB-PLY" : true,
- "GB-POL" : true, "GB-POR" : true, "GB-POW" : true, "GB-PTE" : true, "GB-RCC" : true,
- "GB-RCH" : true, "GB-RCT" : true, "GB-RDB" : true, "GB-RDG" : true, "GB-RFW" : true,
- "GB-RIC" : true, "GB-ROT" : true, "GB-RUT" : true, "GB-SAW" : true, "GB-SAY" : true,
- "GB-SCB" : true, "GB-SCT" : true, "GB-SFK" : true, "GB-SFT" : true, "GB-SGC" : true,
- "GB-SHF" : true, "GB-SHN" : true, "GB-SHR" : true, "GB-SKP" : true, "GB-SLF" : true,
- "GB-SLG" : true, "GB-SLK" : true, "GB-SND" : true, "GB-SOL" : true, "GB-SOM" : true,
- "GB-SOS" : true, "GB-SRY" : true, "GB-STE" : true, "GB-STG" : true, "GB-STH" : true,
- "GB-STN" : true, "GB-STS" : true, "GB-STT" : true, "GB-STY" : true, "GB-SWA" : true,
- "GB-SWD" : true, "GB-SWK" : true, "GB-TAM" : true, "GB-TFW" : true, "GB-THR" : true,
- "GB-TOB" : true, "GB-TOF" : true, "GB-TRF" : true, "GB-TWH" : true, "GB-UKM" : true,
- "GB-VGL" : true, "GB-WAR" : true, "GB-WBK" : true, "GB-WDU" : true, "GB-WFT" : true,
- "GB-WGN" : true, "GB-WIL" : true, "GB-WKF" : true, "GB-WLL" : true, "GB-WLN" : true,
- "GB-WLS" : true, "GB-WLV" : true, "GB-WND" : true, "GB-WNM" : true, "GB-WOK" : true,
- "GB-WOR" : true, "GB-WRL" : true, "GB-WRT" : true, "GB-WRX" : true, "GB-WSM" : true,
- "GB-WSX" : true, "GB-YOR" : true, "GB-ZET" : true, "GD-02" : true, "GD-03" : true,
- "GD-04" : true, "GD-05" : true, "GD-06" : true, "GD-10" : true, "GE-AB" : true,
- "GE-AJ" : true, "GE-GU" : true, "GE-IM" : true, "GE-KA" : true, "GE-KK" : true,
- "GE-MM" : true, "GE-RL" : true, "GE-SJ" : true, "GE-SK" : true, "GE-SZ" : true,
- "GE-TB" : true, "GH-AA" : true, "GH-AH" : true, "GH-BA" : true, "GH-CP" : true,
- "GH-EP" : true, "GH-NP" : true, "GH-TV" : true, "GH-UE" : true, "GH-UW" : true,
- "GH-WP" : true, "GL-KU" : true, "GL-QA" : true, "GL-QE" : true, "GL-SM" : true,
- "GM-B" : true, "GM-L" : true, "GM-M" : true, "GM-N" : true, "GM-U" : true,
- "GM-W" : true, "GN-B" : true, "GN-BE" : true, "GN-BF" : true, "GN-BK" : true,
- "GN-C" : true, "GN-CO" : true, "GN-D" : true, "GN-DB" : true, "GN-DI" : true,
- "GN-DL" : true, "GN-DU" : true, "GN-F" : true, "GN-FA" : true, "GN-FO" : true,
- "GN-FR" : true, "GN-GA" : true, "GN-GU" : true, "GN-K" : true, "GN-KA" : true,
- "GN-KB" : true, "GN-KD" : true, "GN-KE" : true, "GN-KN" : true, "GN-KO" : true,
- "GN-KS" : true, "GN-L" : true, "GN-LA" : true, "GN-LE" : true, "GN-LO" : true,
- "GN-M" : true, "GN-MC" : true, "GN-MD" : true, "GN-ML" : true, "GN-MM" : true,
- "GN-N" : true, "GN-NZ" : true, "GN-PI" : true, "GN-SI" : true, "GN-TE" : true,
- "GN-TO" : true, "GN-YO" : true, "GQ-AN" : true, "GQ-BN" : true, "GQ-BS" : true,
- "GQ-C" : true, "GQ-CS" : true, "GQ-I" : true, "GQ-KN" : true, "GQ-LI" : true,
- "GQ-WN" : true, "GR-01" : true, "GR-03" : true, "GR-04" : true, "GR-05" : true,
- "GR-06" : true, "GR-07" : true, "GR-11" : true, "GR-12" : true, "GR-13" : true,
- "GR-14" : true, "GR-15" : true, "GR-16" : true, "GR-17" : true, "GR-21" : true,
- "GR-22" : true, "GR-23" : true, "GR-24" : true, "GR-31" : true, "GR-32" : true,
- "GR-33" : true, "GR-34" : true, "GR-41" : true, "GR-42" : true, "GR-43" : true,
- "GR-44" : true, "GR-51" : true, "GR-52" : true, "GR-53" : true, "GR-54" : true,
- "GR-55" : true, "GR-56" : true, "GR-57" : true, "GR-58" : true, "GR-59" : true,
- "GR-61" : true, "GR-62" : true, "GR-63" : true, "GR-64" : true, "GR-69" : true,
- "GR-71" : true, "GR-72" : true, "GR-73" : true, "GR-81" : true, "GR-82" : true,
- "GR-83" : true, "GR-84" : true, "GR-85" : true, "GR-91" : true, "GR-92" : true,
- "GR-93" : true, "GR-94" : true, "GR-A" : true, "GR-A1" : true, "GR-B" : true,
- "GR-C" : true, "GR-D" : true, "GR-E" : true, "GR-F" : true, "GR-G" : true,
- "GR-H" : true, "GR-I" : true, "GR-J" : true, "GR-K" : true, "GR-L" : true,
- "GR-M" : true, "GT-AV" : true, "GT-BV" : true, "GT-CM" : true, "GT-CQ" : true,
- "GT-ES" : true, "GT-GU" : true, "GT-HU" : true, "GT-IZ" : true, "GT-JA" : true,
- "GT-JU" : true, "GT-PE" : true, "GT-PR" : true, "GT-QC" : true, "GT-QZ" : true,
- "GT-RE" : true, "GT-SA" : true, "GT-SM" : true, "GT-SO" : true, "GT-SR" : true,
- "GT-SU" : true, "GT-TO" : true, "GT-ZA" : true, "GW-BA" : true, "GW-BL" : true,
- "GW-BM" : true, "GW-BS" : true, "GW-CA" : true, "GW-GA" : true, "GW-L" : true,
- "GW-N" : true, "GW-OI" : true, "GW-QU" : true, "GW-S" : true, "GW-TO" : true,
- "GY-BA" : true, "GY-CU" : true, "GY-DE" : true, "GY-EB" : true, "GY-ES" : true,
- "GY-MA" : true, "GY-PM" : true, "GY-PT" : true, "GY-UD" : true, "GY-UT" : true,
- "HN-AT" : true, "HN-CH" : true, "HN-CL" : true, "HN-CM" : true, "HN-CP" : true,
- "HN-CR" : true, "HN-EP" : true, "HN-FM" : true, "HN-GD" : true, "HN-IB" : true,
- "HN-IN" : true, "HN-LE" : true, "HN-LP" : true, "HN-OC" : true, "HN-OL" : true,
- "HN-SB" : true, "HN-VA" : true, "HN-YO" : true, "HR-01" : true, "HR-02" : true,
- "HR-03" : true, "HR-04" : true, "HR-05" : true, "HR-06" : true, "HR-07" : true,
- "HR-08" : true, "HR-09" : true, "HR-10" : true, "HR-11" : true, "HR-12" : true,
- "HR-13" : true, "HR-14" : true, "HR-15" : true, "HR-16" : true, "HR-17" : true,
- "HR-18" : true, "HR-19" : true, "HR-20" : true, "HR-21" : true, "HT-AR" : true,
- "HT-CE" : true, "HT-GA" : true, "HT-ND" : true, "HT-NE" : true, "HT-NO" : true,
- "HT-OU" : true, "HT-SD" : true, "HT-SE" : true, "HU-BA" : true, "HU-BC" : true,
- "HU-BE" : true, "HU-BK" : true, "HU-BU" : true, "HU-BZ" : true, "HU-CS" : true,
- "HU-DE" : true, "HU-DU" : true, "HU-EG" : true, "HU-ER" : true, "HU-FE" : true,
- "HU-GS" : true, "HU-GY" : true, "HU-HB" : true, "HU-HE" : true, "HU-HV" : true,
- "HU-JN" : true, "HU-KE" : true, "HU-KM" : true, "HU-KV" : true, "HU-MI" : true,
- "HU-NK" : true, "HU-NO" : true, "HU-NY" : true, "HU-PE" : true, "HU-PS" : true,
- "HU-SD" : true, "HU-SF" : true, "HU-SH" : true, "HU-SK" : true, "HU-SN" : true,
- "HU-SO" : true, "HU-SS" : true, "HU-ST" : true, "HU-SZ" : true, "HU-TB" : true,
- "HU-TO" : true, "HU-VA" : true, "HU-VE" : true, "HU-VM" : true, "HU-ZA" : true,
- "HU-ZE" : true, "ID-AC" : true, "ID-BA" : true, "ID-BB" : true, "ID-BE" : true,
- "ID-BT" : true, "ID-GO" : true, "ID-IJ" : true, "ID-JA" : true, "ID-JB" : true,
- "ID-JI" : true, "ID-JK" : true, "ID-JT" : true, "ID-JW" : true, "ID-KA" : true,
- "ID-KB" : true, "ID-KI" : true, "ID-KR" : true, "ID-KS" : true, "ID-KT" : true,
- "ID-LA" : true, "ID-MA" : true, "ID-ML" : true, "ID-MU" : true, "ID-NB" : true,
- "ID-NT" : true, "ID-NU" : true, "ID-PA" : true, "ID-PB" : true, "ID-RI" : true,
- "ID-SA" : true, "ID-SB" : true, "ID-SG" : true, "ID-SL" : true, "ID-SM" : true,
- "ID-SN" : true, "ID-SR" : true, "ID-SS" : true, "ID-ST" : true, "ID-SU" : true,
- "ID-YO" : true, "IE-C" : true, "IE-CE" : true, "IE-CN" : true, "IE-CO" : true,
- "IE-CW" : true, "IE-D" : true, "IE-DL" : true, "IE-G" : true, "IE-KE" : true,
- "IE-KK" : true, "IE-KY" : true, "IE-L" : true, "IE-LD" : true, "IE-LH" : true,
- "IE-LK" : true, "IE-LM" : true, "IE-LS" : true, "IE-M" : true, "IE-MH" : true,
- "IE-MN" : true, "IE-MO" : true, "IE-OY" : true, "IE-RN" : true, "IE-SO" : true,
- "IE-TA" : true, "IE-U" : true, "IE-WD" : true, "IE-WH" : true, "IE-WW" : true,
- "IE-WX" : true, "IL-D" : true, "IL-HA" : true, "IL-JM" : true, "IL-M" : true,
- "IL-TA" : true, "IL-Z" : true, "IN-AN" : true, "IN-AP" : true, "IN-AR" : true,
- "IN-AS" : true, "IN-BR" : true, "IN-CH" : true, "IN-CT" : true, "IN-DD" : true,
- "IN-DL" : true, "IN-DN" : true, "IN-GA" : true, "IN-GJ" : true, "IN-HP" : true,
- "IN-HR" : true, "IN-JH" : true, "IN-JK" : true, "IN-KA" : true, "IN-KL" : true,
- "IN-LD" : true, "IN-MH" : true, "IN-ML" : true, "IN-MN" : true, "IN-MP" : true,
- "IN-MZ" : true, "IN-NL" : true, "IN-OR" : true, "IN-PB" : true, "IN-PY" : true,
- "IN-RJ" : true, "IN-SK" : true, "IN-TN" : true, "IN-TR" : true, "IN-UP" : true,
- "IN-UT" : true, "IN-WB" : true, "IQ-AN" : true, "IQ-AR" : true, "IQ-BA" : true,
- "IQ-BB" : true, "IQ-BG" : true, "IQ-DA" : true, "IQ-DI" : true, "IQ-DQ" : true,
- "IQ-KA" : true, "IQ-MA" : true, "IQ-MU" : true, "IQ-NA" : true, "IQ-NI" : true,
- "IQ-QA" : true, "IQ-SD" : true, "IQ-SW" : true, "IQ-TS" : true, "IQ-WA" : true,
- "IR-01" : true, "IR-02" : true, "IR-03" : true, "IR-04" : true, "IR-05" : true,
- "IR-06" : true, "IR-07" : true, "IR-08" : true, "IR-10" : true, "IR-11" : true,
- "IR-12" : true, "IR-13" : true, "IR-14" : true, "IR-15" : true, "IR-16" : true,
- "IR-17" : true, "IR-18" : true, "IR-19" : true, "IR-20" : true, "IR-21" : true,
- "IR-22" : true, "IR-23" : true, "IR-24" : true, "IR-25" : true, "IR-26" : true,
- "IR-27" : true, "IR-28" : true, "IR-29" : true, "IR-30" : true, "IR-31" : true,
- "IS-0" : true, "IS-1" : true, "IS-2" : true, "IS-3" : true, "IS-4" : true,
- "IS-5" : true, "IS-6" : true, "IS-7" : true, "IS-8" : true, "IT-21" : true,
- "IT-23" : true, "IT-25" : true, "IT-32" : true, "IT-34" : true, "IT-36" : true,
- "IT-42" : true, "IT-45" : true, "IT-52" : true, "IT-55" : true, "IT-57" : true,
- "IT-62" : true, "IT-65" : true, "IT-67" : true, "IT-72" : true, "IT-75" : true,
- "IT-77" : true, "IT-78" : true, "IT-82" : true, "IT-88" : true, "IT-AG" : true,
- "IT-AL" : true, "IT-AN" : true, "IT-AO" : true, "IT-AP" : true, "IT-AQ" : true,
- "IT-AR" : true, "IT-AT" : true, "IT-AV" : true, "IT-BA" : true, "IT-BG" : true,
- "IT-BI" : true, "IT-BL" : true, "IT-BN" : true, "IT-BO" : true, "IT-BR" : true,
- "IT-BS" : true, "IT-BT" : true, "IT-BZ" : true, "IT-CA" : true, "IT-CB" : true,
- "IT-CE" : true, "IT-CH" : true, "IT-CI" : true, "IT-CL" : true, "IT-CN" : true,
- "IT-CO" : true, "IT-CR" : true, "IT-CS" : true, "IT-CT" : true, "IT-CZ" : true,
- "IT-EN" : true, "IT-FC" : true, "IT-FE" : true, "IT-FG" : true, "IT-FI" : true,
- "IT-FM" : true, "IT-FR" : true, "IT-GE" : true, "IT-GO" : true, "IT-GR" : true,
- "IT-IM" : true, "IT-IS" : true, "IT-KR" : true, "IT-LC" : true, "IT-LE" : true,
- "IT-LI" : true, "IT-LO" : true, "IT-LT" : true, "IT-LU" : true, "IT-MB" : true,
- "IT-MC" : true, "IT-ME" : true, "IT-MI" : true, "IT-MN" : true, "IT-MO" : true,
- "IT-MS" : true, "IT-MT" : true, "IT-NA" : true, "IT-NO" : true, "IT-NU" : true,
- "IT-OG" : true, "IT-OR" : true, "IT-OT" : true, "IT-PA" : true, "IT-PC" : true,
- "IT-PD" : true, "IT-PE" : true, "IT-PG" : true, "IT-PI" : true, "IT-PN" : true,
- "IT-PO" : true, "IT-PR" : true, "IT-PT" : true, "IT-PU" : true, "IT-PV" : true,
- "IT-PZ" : true, "IT-RA" : true, "IT-RC" : true, "IT-RE" : true, "IT-RG" : true,
- "IT-RI" : true, "IT-RM" : true, "IT-RN" : true, "IT-RO" : true, "IT-SA" : true,
- "IT-SI" : true, "IT-SO" : true, "IT-SP" : true, "IT-SR" : true, "IT-SS" : true,
- "IT-SV" : true, "IT-TA" : true, "IT-TE" : true, "IT-TN" : true, "IT-TO" : true,
- "IT-TP" : true, "IT-TR" : true, "IT-TS" : true, "IT-TV" : true, "IT-UD" : true,
- "IT-VA" : true, "IT-VB" : true, "IT-VC" : true, "IT-VE" : true, "IT-VI" : true,
- "IT-VR" : true, "IT-VS" : true, "IT-VT" : true, "IT-VV" : true, "JM-01" : true,
- "JM-02" : true, "JM-03" : true, "JM-04" : true, "JM-05" : true, "JM-06" : true,
- "JM-07" : true, "JM-08" : true, "JM-09" : true, "JM-10" : true, "JM-11" : true,
- "JM-12" : true, "JM-13" : true, "JM-14" : true, "JO-AJ" : true, "JO-AM" : true,
- "JO-AQ" : true, "JO-AT" : true, "JO-AZ" : true, "JO-BA" : true, "JO-IR" : true,
- "JO-JA" : true, "JO-KA" : true, "JO-MA" : true, "JO-MD" : true, "JO-MN" : true,
- "JP-01" : true, "JP-02" : true, "JP-03" : true, "JP-04" : true, "JP-05" : true,
- "JP-06" : true, "JP-07" : true, "JP-08" : true, "JP-09" : true, "JP-10" : true,
- "JP-11" : true, "JP-12" : true, "JP-13" : true, "JP-14" : true, "JP-15" : true,
- "JP-16" : true, "JP-17" : true, "JP-18" : true, "JP-19" : true, "JP-20" : true,
- "JP-21" : true, "JP-22" : true, "JP-23" : true, "JP-24" : true, "JP-25" : true,
- "JP-26" : true, "JP-27" : true, "JP-28" : true, "JP-29" : true, "JP-30" : true,
- "JP-31" : true, "JP-32" : true, "JP-33" : true, "JP-34" : true, "JP-35" : true,
- "JP-36" : true, "JP-37" : true, "JP-38" : true, "JP-39" : true, "JP-40" : true,
- "JP-41" : true, "JP-42" : true, "JP-43" : true, "JP-44" : true, "JP-45" : true,
- "JP-46" : true, "JP-47" : true, "KE-110" : true, "KE-200" : true, "KE-300" : true,
- "KE-400" : true, "KE-500" : true, "KE-700" : true, "KE-800" : true, "KG-B" : true,
- "KG-C" : true, "KG-GB" : true, "KG-J" : true, "KG-N" : true, "KG-O" : true,
- "KG-T" : true, "KG-Y" : true, "KH-1" : true, "KH-10" : true, "KH-11" : true,
- "KH-12" : true, "KH-13" : true, "KH-14" : true, "KH-15" : true, "KH-16" : true,
- "KH-17" : true, "KH-18" : true, "KH-19" : true, "KH-2" : true, "KH-20" : true,
- "KH-21" : true, "KH-22" : true, "KH-23" : true, "KH-24" : true, "KH-3" : true,
- "KH-4" : true, "KH-5" : true, "KH-6" : true, "KH-7" : true, "KH-8" : true,
- "KH-9" : true, "KI-G" : true, "KI-L" : true, "KI-P" : true, "KM-A" : true,
- "KM-G" : true, "KM-M" : true, "KN-01" : true, "KN-02" : true, "KN-03" : true,
- "KN-04" : true, "KN-05" : true, "KN-06" : true, "KN-07" : true, "KN-08" : true,
- "KN-09" : true, "KN-10" : true, "KN-11" : true, "KN-12" : true, "KN-13" : true,
- "KN-15" : true, "KN-K" : true, "KN-N" : true, "KP-01" : true, "KP-02" : true,
- "KP-03" : true, "KP-04" : true, "KP-05" : true, "KP-06" : true, "KP-07" : true,
- "KP-08" : true, "KP-09" : true, "KP-10" : true, "KP-13" : true, "KR-11" : true,
- "KR-26" : true, "KR-27" : true, "KR-28" : true, "KR-29" : true, "KR-30" : true,
- "KR-31" : true, "KR-41" : true, "KR-42" : true, "KR-43" : true, "KR-44" : true,
- "KR-45" : true, "KR-46" : true, "KR-47" : true, "KR-48" : true, "KR-49" : true,
- "KW-AH" : true, "KW-FA" : true, "KW-HA" : true, "KW-JA" : true, "KW-KU" : true,
- "KW-MU" : true, "KZ-AKM" : true, "KZ-AKT" : true, "KZ-ALA" : true, "KZ-ALM" : true,
- "KZ-AST" : true, "KZ-ATY" : true, "KZ-KAR" : true, "KZ-KUS" : true, "KZ-KZY" : true,
- "KZ-MAN" : true, "KZ-PAV" : true, "KZ-SEV" : true, "KZ-VOS" : true, "KZ-YUZ" : true,
- "KZ-ZAP" : true, "KZ-ZHA" : true, "LA-AT" : true, "LA-BK" : true, "LA-BL" : true,
- "LA-CH" : true, "LA-HO" : true, "LA-KH" : true, "LA-LM" : true, "LA-LP" : true,
- "LA-OU" : true, "LA-PH" : true, "LA-SL" : true, "LA-SV" : true, "LA-VI" : true,
- "LA-VT" : true, "LA-XA" : true, "LA-XE" : true, "LA-XI" : true, "LA-XS" : true,
- "LB-AK" : true, "LB-AS" : true, "LB-BA" : true, "LB-BH" : true, "LB-BI" : true,
- "LB-JA" : true, "LB-JL" : true, "LB-NA" : true, "LI-01" : true, "LI-02" : true,
- "LI-03" : true, "LI-04" : true, "LI-05" : true, "LI-06" : true, "LI-07" : true,
- "LI-08" : true, "LI-09" : true, "LI-10" : true, "LI-11" : true, "LK-1" : true,
- "LK-11" : true, "LK-12" : true, "LK-13" : true, "LK-2" : true, "LK-21" : true,
- "LK-22" : true, "LK-23" : true, "LK-3" : true, "LK-31" : true, "LK-32" : true,
- "LK-33" : true, "LK-4" : true, "LK-41" : true, "LK-42" : true, "LK-43" : true,
- "LK-44" : true, "LK-45" : true, "LK-5" : true, "LK-51" : true, "LK-52" : true,
- "LK-53" : true, "LK-6" : true, "LK-61" : true, "LK-62" : true, "LK-7" : true,
- "LK-71" : true, "LK-72" : true, "LK-8" : true, "LK-81" : true, "LK-82" : true,
- "LK-9" : true, "LK-91" : true, "LK-92" : true, "LR-BG" : true, "LR-BM" : true,
- "LR-CM" : true, "LR-GB" : true, "LR-GG" : true, "LR-GK" : true, "LR-LO" : true,
- "LR-MG" : true, "LR-MO" : true, "LR-MY" : true, "LR-NI" : true, "LR-RI" : true,
- "LR-SI" : true, "LS-A" : true, "LS-B" : true, "LS-C" : true, "LS-D" : true,
- "LS-E" : true, "LS-F" : true, "LS-G" : true, "LS-H" : true, "LS-J" : true,
- "LS-K" : true, "LT-AL" : true, "LT-KL" : true, "LT-KU" : true, "LT-MR" : true,
- "LT-PN" : true, "LT-SA" : true, "LT-TA" : true, "LT-TE" : true, "LT-UT" : true,
- "LT-VL" : true, "LU-D" : true, "LU-G" : true, "LU-L" : true, "LV-001" : true,
- "LV-002" : true, "LV-003" : true, "LV-004" : true, "LV-005" : true, "LV-006" : true,
- "LV-007" : true, "LV-008" : true, "LV-009" : true, "LV-010" : true, "LV-011" : true,
- "LV-012" : true, "LV-013" : true, "LV-014" : true, "LV-015" : true, "LV-016" : true,
- "LV-017" : true, "LV-018" : true, "LV-019" : true, "LV-020" : true, "LV-021" : true,
- "LV-022" : true, "LV-023" : true, "LV-024" : true, "LV-025" : true, "LV-026" : true,
- "LV-027" : true, "LV-028" : true, "LV-029" : true, "LV-030" : true, "LV-031" : true,
- "LV-032" : true, "LV-033" : true, "LV-034" : true, "LV-035" : true, "LV-036" : true,
- "LV-037" : true, "LV-038" : true, "LV-039" : true, "LV-040" : true, "LV-041" : true,
- "LV-042" : true, "LV-043" : true, "LV-044" : true, "LV-045" : true, "LV-046" : true,
- "LV-047" : true, "LV-048" : true, "LV-049" : true, "LV-050" : true, "LV-051" : true,
- "LV-052" : true, "LV-053" : true, "LV-054" : true, "LV-055" : true, "LV-056" : true,
- "LV-057" : true, "LV-058" : true, "LV-059" : true, "LV-060" : true, "LV-061" : true,
- "LV-062" : true, "LV-063" : true, "LV-064" : true, "LV-065" : true, "LV-066" : true,
- "LV-067" : true, "LV-068" : true, "LV-069" : true, "LV-070" : true, "LV-071" : true,
- "LV-072" : true, "LV-073" : true, "LV-074" : true, "LV-075" : true, "LV-076" : true,
- "LV-077" : true, "LV-078" : true, "LV-079" : true, "LV-080" : true, "LV-081" : true,
- "LV-082" : true, "LV-083" : true, "LV-084" : true, "LV-085" : true, "LV-086" : true,
- "LV-087" : true, "LV-088" : true, "LV-089" : true, "LV-090" : true, "LV-091" : true,
- "LV-092" : true, "LV-093" : true, "LV-094" : true, "LV-095" : true, "LV-096" : true,
- "LV-097" : true, "LV-098" : true, "LV-099" : true, "LV-100" : true, "LV-101" : true,
- "LV-102" : true, "LV-103" : true, "LV-104" : true, "LV-105" : true, "LV-106" : true,
- "LV-107" : true, "LV-108" : true, "LV-109" : true, "LV-110" : true, "LV-DGV" : true,
- "LV-JEL" : true, "LV-JKB" : true, "LV-JUR" : true, "LV-LPX" : true, "LV-REZ" : true,
- "LV-RIX" : true, "LV-VEN" : true, "LV-VMR" : true, "LY-BA" : true, "LY-BU" : true,
- "LY-DR" : true, "LY-GT" : true, "LY-JA" : true, "LY-JB" : true, "LY-JG" : true,
- "LY-JI" : true, "LY-JU" : true, "LY-KF" : true, "LY-MB" : true, "LY-MI" : true,
- "LY-MJ" : true, "LY-MQ" : true, "LY-NL" : true, "LY-NQ" : true, "LY-SB" : true,
- "LY-SR" : true, "LY-TB" : true, "LY-WA" : true, "LY-WD" : true, "LY-WS" : true,
- "LY-ZA" : true, "MA-01" : true, "MA-02" : true, "MA-03" : true, "MA-04" : true,
- "MA-05" : true, "MA-06" : true, "MA-07" : true, "MA-08" : true, "MA-09" : true,
- "MA-10" : true, "MA-11" : true, "MA-12" : true, "MA-13" : true, "MA-14" : true,
- "MA-15" : true, "MA-16" : true, "MA-AGD" : true, "MA-AOU" : true, "MA-ASZ" : true,
- "MA-AZI" : true, "MA-BEM" : true, "MA-BER" : true, "MA-BES" : true, "MA-BOD" : true,
- "MA-BOM" : true, "MA-CAS" : true, "MA-CHE" : true, "MA-CHI" : true, "MA-CHT" : true,
- "MA-ERR" : true, "MA-ESI" : true, "MA-ESM" : true, "MA-FAH" : true, "MA-FES" : true,
- "MA-FIG" : true, "MA-GUE" : true, "MA-HAJ" : true, "MA-HAO" : true, "MA-HOC" : true,
- "MA-IFR" : true, "MA-INE" : true, "MA-JDI" : true, "MA-JRA" : true, "MA-KEN" : true,
- "MA-KES" : true, "MA-KHE" : true, "MA-KHN" : true, "MA-KHO" : true, "MA-LAA" : true,
- "MA-LAR" : true, "MA-MED" : true, "MA-MEK" : true, "MA-MMD" : true, "MA-MMN" : true,
- "MA-MOH" : true, "MA-MOU" : true, "MA-NAD" : true, "MA-NOU" : true, "MA-OUA" : true,
- "MA-OUD" : true, "MA-OUJ" : true, "MA-RAB" : true, "MA-SAF" : true, "MA-SAL" : true,
- "MA-SEF" : true, "MA-SET" : true, "MA-SIK" : true, "MA-SKH" : true, "MA-SYB" : true,
- "MA-TAI" : true, "MA-TAO" : true, "MA-TAR" : true, "MA-TAT" : true, "MA-TAZ" : true,
- "MA-TET" : true, "MA-TIZ" : true, "MA-TNG" : true, "MA-TNT" : true, "MA-ZAG" : true,
- "MC-CL" : true, "MC-CO" : true, "MC-FO" : true, "MC-GA" : true, "MC-JE" : true,
- "MC-LA" : true, "MC-MA" : true, "MC-MC" : true, "MC-MG" : true, "MC-MO" : true,
- "MC-MU" : true, "MC-PH" : true, "MC-SD" : true, "MC-SO" : true, "MC-SP" : true,
- "MC-SR" : true, "MC-VR" : true, "MD-AN" : true, "MD-BA" : true, "MD-BD" : true,
- "MD-BR" : true, "MD-BS" : true, "MD-CA" : true, "MD-CL" : true, "MD-CM" : true,
- "MD-CR" : true, "MD-CS" : true, "MD-CT" : true, "MD-CU" : true, "MD-DO" : true,
- "MD-DR" : true, "MD-DU" : true, "MD-ED" : true, "MD-FA" : true, "MD-FL" : true,
- "MD-GA" : true, "MD-GL" : true, "MD-HI" : true, "MD-IA" : true, "MD-LE" : true,
- "MD-NI" : true, "MD-OC" : true, "MD-OR" : true, "MD-RE" : true, "MD-RI" : true,
- "MD-SD" : true, "MD-SI" : true, "MD-SN" : true, "MD-SO" : true, "MD-ST" : true,
- "MD-SV" : true, "MD-TA" : true, "MD-TE" : true, "MD-UN" : true, "ME-01" : true,
- "ME-02" : true, "ME-03" : true, "ME-04" : true, "ME-05" : true, "ME-06" : true,
- "ME-07" : true, "ME-08" : true, "ME-09" : true, "ME-10" : true, "ME-11" : true,
- "ME-12" : true, "ME-13" : true, "ME-14" : true, "ME-15" : true, "ME-16" : true,
- "ME-17" : true, "ME-18" : true, "ME-19" : true, "ME-20" : true, "ME-21" : true,
- "MG-A" : true, "MG-D" : true, "MG-F" : true, "MG-M" : true, "MG-T" : true,
- "MG-U" : true, "MH-ALK" : true, "MH-ALL" : true, "MH-ARN" : true, "MH-AUR" : true,
- "MH-EBO" : true, "MH-ENI" : true, "MH-JAB" : true, "MH-JAL" : true, "MH-KIL" : true,
- "MH-KWA" : true, "MH-L" : true, "MH-LAE" : true, "MH-LIB" : true, "MH-LIK" : true,
- "MH-MAJ" : true, "MH-MAL" : true, "MH-MEJ" : true, "MH-MIL" : true, "MH-NMK" : true,
- "MH-NMU" : true, "MH-RON" : true, "MH-T" : true, "MH-UJA" : true, "MH-UTI" : true,
- "MH-WTJ" : true, "MH-WTN" : true, "MK-01" : true, "MK-02" : true, "MK-03" : true,
- "MK-04" : true, "MK-05" : true, "MK-06" : true, "MK-07" : true, "MK-08" : true,
- "MK-09" : true, "MK-10" : true, "MK-11" : true, "MK-12" : true, "MK-13" : true,
- "MK-14" : true, "MK-15" : true, "MK-16" : true, "MK-17" : true, "MK-18" : true,
- "MK-19" : true, "MK-20" : true, "MK-21" : true, "MK-22" : true, "MK-23" : true,
- "MK-24" : true, "MK-25" : true, "MK-26" : true, "MK-27" : true, "MK-28" : true,
- "MK-29" : true, "MK-30" : true, "MK-31" : true, "MK-32" : true, "MK-33" : true,
- "MK-34" : true, "MK-35" : true, "MK-36" : true, "MK-37" : true, "MK-38" : true,
- "MK-39" : true, "MK-40" : true, "MK-41" : true, "MK-42" : true, "MK-43" : true,
- "MK-44" : true, "MK-45" : true, "MK-46" : true, "MK-47" : true, "MK-48" : true,
- "MK-49" : true, "MK-50" : true, "MK-51" : true, "MK-52" : true, "MK-53" : true,
- "MK-54" : true, "MK-55" : true, "MK-56" : true, "MK-57" : true, "MK-58" : true,
- "MK-59" : true, "MK-60" : true, "MK-61" : true, "MK-62" : true, "MK-63" : true,
- "MK-64" : true, "MK-65" : true, "MK-66" : true, "MK-67" : true, "MK-68" : true,
- "MK-69" : true, "MK-70" : true, "MK-71" : true, "MK-72" : true, "MK-73" : true,
- "MK-74" : true, "MK-75" : true, "MK-76" : true, "MK-77" : true, "MK-78" : true,
- "MK-79" : true, "MK-80" : true, "MK-81" : true, "MK-82" : true, "MK-83" : true,
- "MK-84" : true, "ML-1" : true, "ML-2" : true, "ML-3" : true, "ML-4" : true,
- "ML-5" : true, "ML-6" : true, "ML-7" : true, "ML-8" : true, "ML-BK0" : true,
- "MM-01" : true, "MM-02" : true, "MM-03" : true, "MM-04" : true, "MM-05" : true,
- "MM-06" : true, "MM-07" : true, "MM-11" : true, "MM-12" : true, "MM-13" : true,
- "MM-14" : true, "MM-15" : true, "MM-16" : true, "MM-17" : true, "MN-035" : true,
- "MN-037" : true, "MN-039" : true, "MN-041" : true, "MN-043" : true, "MN-046" : true,
- "MN-047" : true, "MN-049" : true, "MN-051" : true, "MN-053" : true, "MN-055" : true,
- "MN-057" : true, "MN-059" : true, "MN-061" : true, "MN-063" : true, "MN-064" : true,
- "MN-065" : true, "MN-067" : true, "MN-069" : true, "MN-071" : true, "MN-073" : true,
- "MN-1" : true, "MR-01" : true, "MR-02" : true, "MR-03" : true, "MR-04" : true,
- "MR-05" : true, "MR-06" : true, "MR-07" : true, "MR-08" : true, "MR-09" : true,
- "MR-10" : true, "MR-11" : true, "MR-12" : true, "MR-NKC" : true, "MT-01" : true,
- "MT-02" : true, "MT-03" : true, "MT-04" : true, "MT-05" : true, "MT-06" : true,
- "MT-07" : true, "MT-08" : true, "MT-09" : true, "MT-10" : true, "MT-11" : true,
- "MT-12" : true, "MT-13" : true, "MT-14" : true, "MT-15" : true, "MT-16" : true,
- "MT-17" : true, "MT-18" : true, "MT-19" : true, "MT-20" : true, "MT-21" : true,
- "MT-22" : true, "MT-23" : true, "MT-24" : true, "MT-25" : true, "MT-26" : true,
- "MT-27" : true, "MT-28" : true, "MT-29" : true, "MT-30" : true, "MT-31" : true,
- "MT-32" : true, "MT-33" : true, "MT-34" : true, "MT-35" : true, "MT-36" : true,
- "MT-37" : true, "MT-38" : true, "MT-39" : true, "MT-40" : true, "MT-41" : true,
- "MT-42" : true, "MT-43" : true, "MT-44" : true, "MT-45" : true, "MT-46" : true,
- "MT-47" : true, "MT-48" : true, "MT-49" : true, "MT-50" : true, "MT-51" : true,
- "MT-52" : true, "MT-53" : true, "MT-54" : true, "MT-55" : true, "MT-56" : true,
- "MT-57" : true, "MT-58" : true, "MT-59" : true, "MT-60" : true, "MT-61" : true,
- "MT-62" : true, "MT-63" : true, "MT-64" : true, "MT-65" : true, "MT-66" : true,
- "MT-67" : true, "MT-68" : true, "MU-AG" : true, "MU-BL" : true, "MU-BR" : true,
- "MU-CC" : true, "MU-CU" : true, "MU-FL" : true, "MU-GP" : true, "MU-MO" : true,
- "MU-PA" : true, "MU-PL" : true, "MU-PU" : true, "MU-PW" : true, "MU-QB" : true,
- "MU-RO" : true, "MU-RP" : true, "MU-SA" : true, "MU-VP" : true, "MV-00" : true,
- "MV-01" : true, "MV-02" : true, "MV-03" : true, "MV-04" : true, "MV-05" : true,
- "MV-07" : true, "MV-08" : true, "MV-12" : true, "MV-13" : true, "MV-14" : true,
- "MV-17" : true, "MV-20" : true, "MV-23" : true, "MV-24" : true, "MV-25" : true,
- "MV-26" : true, "MV-27" : true, "MV-28" : true, "MV-29" : true, "MV-CE" : true,
- "MV-MLE" : true, "MV-NC" : true, "MV-NO" : true, "MV-SC" : true, "MV-SU" : true,
- "MV-UN" : true, "MV-US" : true, "MW-BA" : true, "MW-BL" : true, "MW-C" : true,
- "MW-CK" : true, "MW-CR" : true, "MW-CT" : true, "MW-DE" : true, "MW-DO" : true,
- "MW-KR" : true, "MW-KS" : true, "MW-LI" : true, "MW-LK" : true, "MW-MC" : true,
- "MW-MG" : true, "MW-MH" : true, "MW-MU" : true, "MW-MW" : true, "MW-MZ" : true,
- "MW-N" : true, "MW-NB" : true, "MW-NE" : true, "MW-NI" : true, "MW-NK" : true,
- "MW-NS" : true, "MW-NU" : true, "MW-PH" : true, "MW-RU" : true, "MW-S" : true,
- "MW-SA" : true, "MW-TH" : true, "MW-ZO" : true, "MX-AGU" : true, "MX-BCN" : true,
- "MX-BCS" : true, "MX-CAM" : true, "MX-CHH" : true, "MX-CHP" : true, "MX-COA" : true,
- "MX-COL" : true, "MX-DIF" : true, "MX-DUR" : true, "MX-GRO" : true, "MX-GUA" : true,
- "MX-HID" : true, "MX-JAL" : true, "MX-MEX" : true, "MX-MIC" : true, "MX-MOR" : true,
- "MX-NAY" : true, "MX-NLE" : true, "MX-OAX" : true, "MX-PUE" : true, "MX-QUE" : true,
- "MX-ROO" : true, "MX-SIN" : true, "MX-SLP" : true, "MX-SON" : true, "MX-TAB" : true,
- "MX-TAM" : true, "MX-TLA" : true, "MX-VER" : true, "MX-YUC" : true, "MX-ZAC" : true,
- "MY-01" : true, "MY-02" : true, "MY-03" : true, "MY-04" : true, "MY-05" : true,
- "MY-06" : true, "MY-07" : true, "MY-08" : true, "MY-09" : true, "MY-10" : true,
- "MY-11" : true, "MY-12" : true, "MY-13" : true, "MY-14" : true, "MY-15" : true,
- "MY-16" : true, "MZ-A" : true, "MZ-B" : true, "MZ-G" : true, "MZ-I" : true,
- "MZ-L" : true, "MZ-MPM" : true, "MZ-N" : true, "MZ-P" : true, "MZ-Q" : true,
- "MZ-S" : true, "MZ-T" : true, "NA-CA" : true, "NA-ER" : true, "NA-HA" : true,
- "NA-KA" : true, "NA-KH" : true, "NA-KU" : true, "NA-OD" : true, "NA-OH" : true,
- "NA-OK" : true, "NA-ON" : true, "NA-OS" : true, "NA-OT" : true, "NA-OW" : true,
- "NE-1" : true, "NE-2" : true, "NE-3" : true, "NE-4" : true, "NE-5" : true,
- "NE-6" : true, "NE-7" : true, "NE-8" : true, "NG-AB" : true, "NG-AD" : true,
- "NG-AK" : true, "NG-AN" : true, "NG-BA" : true, "NG-BE" : true, "NG-BO" : true,
- "NG-BY" : true, "NG-CR" : true, "NG-DE" : true, "NG-EB" : true, "NG-ED" : true,
- "NG-EK" : true, "NG-EN" : true, "NG-FC" : true, "NG-GO" : true, "NG-IM" : true,
- "NG-JI" : true, "NG-KD" : true, "NG-KE" : true, "NG-KN" : true, "NG-KO" : true,
- "NG-KT" : true, "NG-KW" : true, "NG-LA" : true, "NG-NA" : true, "NG-NI" : true,
- "NG-OG" : true, "NG-ON" : true, "NG-OS" : true, "NG-OY" : true, "NG-PL" : true,
- "NG-RI" : true, "NG-SO" : true, "NG-TA" : true, "NG-YO" : true, "NG-ZA" : true,
- "NI-AN" : true, "NI-AS" : true, "NI-BO" : true, "NI-CA" : true, "NI-CI" : true,
- "NI-CO" : true, "NI-ES" : true, "NI-GR" : true, "NI-JI" : true, "NI-LE" : true,
- "NI-MD" : true, "NI-MN" : true, "NI-MS" : true, "NI-MT" : true, "NI-NS" : true,
- "NI-RI" : true, "NI-SJ" : true, "NL-AW" : true, "NL-BQ1" : true, "NL-BQ2" : true,
- "NL-BQ3" : true, "NL-CW" : true, "NL-DR" : true, "NL-FL" : true, "NL-FR" : true,
- "NL-GE" : true, "NL-GR" : true, "NL-LI" : true, "NL-NB" : true, "NL-NH" : true,
- "NL-OV" : true, "NL-SX" : true, "NL-UT" : true, "NL-ZE" : true, "NL-ZH" : true,
- "NO-01" : true, "NO-02" : true, "NO-03" : true, "NO-04" : true, "NO-05" : true,
- "NO-06" : true, "NO-07" : true, "NO-08" : true, "NO-09" : true, "NO-10" : true,
- "NO-11" : true, "NO-12" : true, "NO-14" : true, "NO-15" : true, "NO-16" : true,
- "NO-17" : true, "NO-18" : true, "NO-19" : true, "NO-20" : true, "NO-21" : true,
- "NO-22" : true, "NP-1" : true, "NP-2" : true, "NP-3" : true, "NP-4" : true,
- "NP-5" : true, "NP-BA" : true, "NP-BH" : true, "NP-DH" : true, "NP-GA" : true,
- "NP-JA" : true, "NP-KA" : true, "NP-KO" : true, "NP-LU" : true, "NP-MA" : true,
- "NP-ME" : true, "NP-NA" : true, "NP-RA" : true, "NP-SA" : true, "NP-SE" : true,
- "NR-01" : true, "NR-02" : true, "NR-03" : true, "NR-04" : true, "NR-05" : true,
- "NR-06" : true, "NR-07" : true, "NR-08" : true, "NR-09" : true, "NR-10" : true,
- "NR-11" : true, "NR-12" : true, "NR-13" : true, "NR-14" : true, "NZ-AUK" : true,
- "NZ-BOP" : true, "NZ-CAN" : true, "NZ-CIT" : true, "NZ-GIS" : true, "NZ-HKB" : true,
- "NZ-MBH" : true, "NZ-MWT" : true, "NZ-N" : true, "NZ-NSN" : true, "NZ-NTL" : true,
- "NZ-OTA" : true, "NZ-S" : true, "NZ-STL" : true, "NZ-TAS" : true, "NZ-TKI" : true,
- "NZ-WGN" : true, "NZ-WKO" : true, "NZ-WTC" : true, "OM-BA" : true, "OM-BU" : true,
- "OM-DA" : true, "OM-MA" : true, "OM-MU" : true, "OM-SH" : true, "OM-WU" : true,
- "OM-ZA" : true, "OM-ZU" : true, "PA-1" : true, "PA-2" : true, "PA-3" : true,
- "PA-4" : true, "PA-5" : true, "PA-6" : true, "PA-7" : true, "PA-8" : true,
- "PA-9" : true, "PA-EM" : true, "PA-KY" : true, "PA-NB" : true, "PE-AMA" : true,
- "PE-ANC" : true, "PE-APU" : true, "PE-ARE" : true, "PE-AYA" : true, "PE-CAJ" : true,
- "PE-CAL" : true, "PE-CUS" : true, "PE-HUC" : true, "PE-HUV" : true, "PE-ICA" : true,
- "PE-JUN" : true, "PE-LAL" : true, "PE-LAM" : true, "PE-LIM" : true, "PE-LMA" : true,
- "PE-LOR" : true, "PE-MDD" : true, "PE-MOQ" : true, "PE-PAS" : true, "PE-PIU" : true,
- "PE-PUN" : true, "PE-SAM" : true, "PE-TAC" : true, "PE-TUM" : true, "PE-UCA" : true,
- "PG-CPK" : true, "PG-CPM" : true, "PG-EBR" : true, "PG-EHG" : true, "PG-EPW" : true,
- "PG-ESW" : true, "PG-GPK" : true, "PG-MBA" : true, "PG-MPL" : true, "PG-MPM" : true,
- "PG-MRL" : true, "PG-NCD" : true, "PG-NIK" : true, "PG-NPP" : true, "PG-NSB" : true,
- "PG-SAN" : true, "PG-SHM" : true, "PG-WBK" : true, "PG-WHM" : true, "PG-WPD" : true,
- "PH-00" : true, "PH-01" : true, "PH-02" : true, "PH-03" : true, "PH-05" : true,
- "PH-06" : true, "PH-07" : true, "PH-08" : true, "PH-09" : true, "PH-10" : true,
- "PH-11" : true, "PH-12" : true, "PH-13" : true, "PH-14" : true, "PH-15" : true,
- "PH-40" : true, "PH-41" : true, "PH-ABR" : true, "PH-AGN" : true, "PH-AGS" : true,
- "PH-AKL" : true, "PH-ALB" : true, "PH-ANT" : true, "PH-APA" : true, "PH-AUR" : true,
- "PH-BAN" : true, "PH-BAS" : true, "PH-BEN" : true, "PH-BIL" : true, "PH-BOH" : true,
- "PH-BTG" : true, "PH-BTN" : true, "PH-BUK" : true, "PH-BUL" : true, "PH-CAG" : true,
- "PH-CAM" : true, "PH-CAN" : true, "PH-CAP" : true, "PH-CAS" : true, "PH-CAT" : true,
- "PH-CAV" : true, "PH-CEB" : true, "PH-COM" : true, "PH-DAO" : true, "PH-DAS" : true,
- "PH-DAV" : true, "PH-DIN" : true, "PH-EAS" : true, "PH-GUI" : true, "PH-IFU" : true,
- "PH-ILI" : true, "PH-ILN" : true, "PH-ILS" : true, "PH-ISA" : true, "PH-KAL" : true,
- "PH-LAG" : true, "PH-LAN" : true, "PH-LAS" : true, "PH-LEY" : true, "PH-LUN" : true,
- "PH-MAD" : true, "PH-MAG" : true, "PH-MAS" : true, "PH-MDC" : true, "PH-MDR" : true,
- "PH-MOU" : true, "PH-MSC" : true, "PH-MSR" : true, "PH-NCO" : true, "PH-NEC" : true,
- "PH-NER" : true, "PH-NSA" : true, "PH-NUE" : true, "PH-NUV" : true, "PH-PAM" : true,
- "PH-PAN" : true, "PH-PLW" : true, "PH-QUE" : true, "PH-QUI" : true, "PH-RIZ" : true,
- "PH-ROM" : true, "PH-SAR" : true, "PH-SCO" : true, "PH-SIG" : true, "PH-SLE" : true,
- "PH-SLU" : true, "PH-SOR" : true, "PH-SUK" : true, "PH-SUN" : true, "PH-SUR" : true,
- "PH-TAR" : true, "PH-TAW" : true, "PH-WSA" : true, "PH-ZAN" : true, "PH-ZAS" : true,
- "PH-ZMB" : true, "PH-ZSI" : true, "PK-BA" : true, "PK-GB" : true, "PK-IS" : true,
- "PK-JK" : true, "PK-KP" : true, "PK-PB" : true, "PK-SD" : true, "PK-TA" : true,
- "PL-DS" : true, "PL-KP" : true, "PL-LB" : true, "PL-LD" : true, "PL-LU" : true,
- "PL-MA" : true, "PL-MZ" : true, "PL-OP" : true, "PL-PD" : true, "PL-PK" : true,
- "PL-PM" : true, "PL-SK" : true, "PL-SL" : true, "PL-WN" : true, "PL-WP" : true,
- "PL-ZP" : true, "PS-BTH" : true, "PS-DEB" : true, "PS-GZA" : true, "PS-HBN" : true,
- "PS-JEM" : true, "PS-JEN" : true, "PS-JRH" : true, "PS-KYS" : true, "PS-NBS" : true,
- "PS-NGZ" : true, "PS-QQA" : true, "PS-RBH" : true, "PS-RFH" : true, "PS-SLT" : true,
- "PS-TBS" : true, "PS-TKM" : true, "PT-01" : true, "PT-02" : true, "PT-03" : true,
- "PT-04" : true, "PT-05" : true, "PT-06" : true, "PT-07" : true, "PT-08" : true,
- "PT-09" : true, "PT-10" : true, "PT-11" : true, "PT-12" : true, "PT-13" : true,
- "PT-14" : true, "PT-15" : true, "PT-16" : true, "PT-17" : true, "PT-18" : true,
- "PT-20" : true, "PT-30" : true, "PW-002" : true, "PW-004" : true, "PW-010" : true,
- "PW-050" : true, "PW-100" : true, "PW-150" : true, "PW-212" : true, "PW-214" : true,
- "PW-218" : true, "PW-222" : true, "PW-224" : true, "PW-226" : true, "PW-227" : true,
- "PW-228" : true, "PW-350" : true, "PW-370" : true, "PY-1" : true, "PY-10" : true,
- "PY-11" : true, "PY-12" : true, "PY-13" : true, "PY-14" : true, "PY-15" : true,
- "PY-16" : true, "PY-19" : true, "PY-2" : true, "PY-3" : true, "PY-4" : true,
- "PY-5" : true, "PY-6" : true, "PY-7" : true, "PY-8" : true, "PY-9" : true,
- "PY-ASU" : true, "QA-DA" : true, "QA-KH" : true, "QA-MS" : true, "QA-RA" : true,
- "QA-US" : true, "QA-WA" : true, "QA-ZA" : true, "RO-AB" : true, "RO-AG" : true,
- "RO-AR" : true, "RO-B" : true, "RO-BC" : true, "RO-BH" : true, "RO-BN" : true,
- "RO-BR" : true, "RO-BT" : true, "RO-BV" : true, "RO-BZ" : true, "RO-CJ" : true,
- "RO-CL" : true, "RO-CS" : true, "RO-CT" : true, "RO-CV" : true, "RO-DB" : true,
- "RO-DJ" : true, "RO-GJ" : true, "RO-GL" : true, "RO-GR" : true, "RO-HD" : true,
- "RO-HR" : true, "RO-IF" : true, "RO-IL" : true, "RO-IS" : true, "RO-MH" : true,
- "RO-MM" : true, "RO-MS" : true, "RO-NT" : true, "RO-OT" : true, "RO-PH" : true,
- "RO-SB" : true, "RO-SJ" : true, "RO-SM" : true, "RO-SV" : true, "RO-TL" : true,
- "RO-TM" : true, "RO-TR" : true, "RO-VL" : true, "RO-VN" : true, "RO-VS" : true,
- "RS-00" : true, "RS-01" : true, "RS-02" : true, "RS-03" : true, "RS-04" : true,
- "RS-05" : true, "RS-06" : true, "RS-07" : true, "RS-08" : true, "RS-09" : true,
- "RS-10" : true, "RS-11" : true, "RS-12" : true, "RS-13" : true, "RS-14" : true,
- "RS-15" : true, "RS-16" : true, "RS-17" : true, "RS-18" : true, "RS-19" : true,
- "RS-20" : true, "RS-21" : true, "RS-22" : true, "RS-23" : true, "RS-24" : true,
- "RS-25" : true, "RS-26" : true, "RS-27" : true, "RS-28" : true, "RS-29" : true,
- "RS-KM" : true, "RS-VO" : true, "RU-AD" : true, "RU-AL" : true, "RU-ALT" : true,
- "RU-AMU" : true, "RU-ARK" : true, "RU-AST" : true, "RU-BA" : true, "RU-BEL" : true,
- "RU-BRY" : true, "RU-BU" : true, "RU-CE" : true, "RU-CHE" : true, "RU-CHU" : true,
- "RU-CU" : true, "RU-DA" : true, "RU-IN" : true, "RU-IRK" : true, "RU-IVA" : true,
- "RU-KAM" : true, "RU-KB" : true, "RU-KC" : true, "RU-KDA" : true, "RU-KEM" : true,
- "RU-KGD" : true, "RU-KGN" : true, "RU-KHA" : true, "RU-KHM" : true, "RU-KIR" : true,
- "RU-KK" : true, "RU-KL" : true, "RU-KLU" : true, "RU-KO" : true, "RU-KOS" : true,
- "RU-KR" : true, "RU-KRS" : true, "RU-KYA" : true, "RU-LEN" : true, "RU-LIP" : true,
- "RU-MAG" : true, "RU-ME" : true, "RU-MO" : true, "RU-MOS" : true, "RU-MOW" : true,
- "RU-MUR" : true, "RU-NEN" : true, "RU-NGR" : true, "RU-NIZ" : true, "RU-NVS" : true,
- "RU-OMS" : true, "RU-ORE" : true, "RU-ORL" : true, "RU-PER" : true, "RU-PNZ" : true,
- "RU-PRI" : true, "RU-PSK" : true, "RU-ROS" : true, "RU-RYA" : true, "RU-SA" : true,
- "RU-SAK" : true, "RU-SAM" : true, "RU-SAR" : true, "RU-SE" : true, "RU-SMO" : true,
- "RU-SPE" : true, "RU-STA" : true, "RU-SVE" : true, "RU-TA" : true, "RU-TAM" : true,
- "RU-TOM" : true, "RU-TUL" : true, "RU-TVE" : true, "RU-TY" : true, "RU-TYU" : true,
- "RU-UD" : true, "RU-ULY" : true, "RU-VGG" : true, "RU-VLA" : true, "RU-VLG" : true,
- "RU-VOR" : true, "RU-YAN" : true, "RU-YAR" : true, "RU-YEV" : true, "RU-ZAB" : true,
- "RW-01" : true, "RW-02" : true, "RW-03" : true, "RW-04" : true, "RW-05" : true,
- "SA-01" : true, "SA-02" : true, "SA-03" : true, "SA-04" : true, "SA-05" : true,
- "SA-06" : true, "SA-07" : true, "SA-08" : true, "SA-09" : true, "SA-10" : true,
- "SA-11" : true, "SA-12" : true, "SA-14" : true, "SB-CE" : true, "SB-CH" : true,
- "SB-CT" : true, "SB-GU" : true, "SB-IS" : true, "SB-MK" : true, "SB-ML" : true,
- "SB-RB" : true, "SB-TE" : true, "SB-WE" : true, "SC-01" : true, "SC-02" : true,
- "SC-03" : true, "SC-04" : true, "SC-05" : true, "SC-06" : true, "SC-07" : true,
- "SC-08" : true, "SC-09" : true, "SC-10" : true, "SC-11" : true, "SC-12" : true,
- "SC-13" : true, "SC-14" : true, "SC-15" : true, "SC-16" : true, "SC-17" : true,
- "SC-18" : true, "SC-19" : true, "SC-20" : true, "SC-21" : true, "SC-22" : true,
- "SC-23" : true, "SC-24" : true, "SC-25" : true, "SD-DC" : true, "SD-DE" : true,
- "SD-DN" : true, "SD-DS" : true, "SD-DW" : true, "SD-GD" : true, "SD-GZ" : true,
- "SD-KA" : true, "SD-KH" : true, "SD-KN" : true, "SD-KS" : true, "SD-NB" : true,
- "SD-NO" : true, "SD-NR" : true, "SD-NW" : true, "SD-RS" : true, "SD-SI" : true,
- "SE-AB" : true, "SE-AC" : true, "SE-BD" : true, "SE-C" : true, "SE-D" : true,
- "SE-E" : true, "SE-F" : true, "SE-G" : true, "SE-H" : true, "SE-I" : true,
- "SE-K" : true, "SE-M" : true, "SE-N" : true, "SE-O" : true, "SE-S" : true,
- "SE-T" : true, "SE-U" : true, "SE-W" : true, "SE-X" : true, "SE-Y" : true,
- "SE-Z" : true, "SG-01" : true, "SG-02" : true, "SG-03" : true, "SG-04" : true,
- "SG-05" : true, "SH-AC" : true, "SH-HL" : true, "SH-TA" : true, "SI-001" : true,
- "SI-002" : true, "SI-003" : true, "SI-004" : true, "SI-005" : true, "SI-006" : true,
- "SI-007" : true, "SI-008" : true, "SI-009" : true, "SI-010" : true, "SI-011" : true,
- "SI-012" : true, "SI-013" : true, "SI-014" : true, "SI-015" : true, "SI-016" : true,
- "SI-017" : true, "SI-018" : true, "SI-019" : true, "SI-020" : true, "SI-021" : true,
- "SI-022" : true, "SI-023" : true, "SI-024" : true, "SI-025" : true, "SI-026" : true,
- "SI-027" : true, "SI-028" : true, "SI-029" : true, "SI-030" : true, "SI-031" : true,
- "SI-032" : true, "SI-033" : true, "SI-034" : true, "SI-035" : true, "SI-036" : true,
- "SI-037" : true, "SI-038" : true, "SI-039" : true, "SI-040" : true, "SI-041" : true,
- "SI-042" : true, "SI-043" : true, "SI-044" : true, "SI-045" : true, "SI-046" : true,
- "SI-047" : true, "SI-048" : true, "SI-049" : true, "SI-050" : true, "SI-051" : true,
- "SI-052" : true, "SI-053" : true, "SI-054" : true, "SI-055" : true, "SI-056" : true,
- "SI-057" : true, "SI-058" : true, "SI-059" : true, "SI-060" : true, "SI-061" : true,
- "SI-062" : true, "SI-063" : true, "SI-064" : true, "SI-065" : true, "SI-066" : true,
- "SI-067" : true, "SI-068" : true, "SI-069" : true, "SI-070" : true, "SI-071" : true,
- "SI-072" : true, "SI-073" : true, "SI-074" : true, "SI-075" : true, "SI-076" : true,
- "SI-077" : true, "SI-078" : true, "SI-079" : true, "SI-080" : true, "SI-081" : true,
- "SI-082" : true, "SI-083" : true, "SI-084" : true, "SI-085" : true, "SI-086" : true,
- "SI-087" : true, "SI-088" : true, "SI-089" : true, "SI-090" : true, "SI-091" : true,
- "SI-092" : true, "SI-093" : true, "SI-094" : true, "SI-095" : true, "SI-096" : true,
- "SI-097" : true, "SI-098" : true, "SI-099" : true, "SI-100" : true, "SI-101" : true,
- "SI-102" : true, "SI-103" : true, "SI-104" : true, "SI-105" : true, "SI-106" : true,
- "SI-107" : true, "SI-108" : true, "SI-109" : true, "SI-110" : true, "SI-111" : true,
- "SI-112" : true, "SI-113" : true, "SI-114" : true, "SI-115" : true, "SI-116" : true,
- "SI-117" : true, "SI-118" : true, "SI-119" : true, "SI-120" : true, "SI-121" : true,
- "SI-122" : true, "SI-123" : true, "SI-124" : true, "SI-125" : true, "SI-126" : true,
- "SI-127" : true, "SI-128" : true, "SI-129" : true, "SI-130" : true, "SI-131" : true,
- "SI-132" : true, "SI-133" : true, "SI-134" : true, "SI-135" : true, "SI-136" : true,
- "SI-137" : true, "SI-138" : true, "SI-139" : true, "SI-140" : true, "SI-141" : true,
- "SI-142" : true, "SI-143" : true, "SI-144" : true, "SI-146" : true, "SI-147" : true,
- "SI-148" : true, "SI-149" : true, "SI-150" : true, "SI-151" : true, "SI-152" : true,
- "SI-153" : true, "SI-154" : true, "SI-155" : true, "SI-156" : true, "SI-157" : true,
- "SI-158" : true, "SI-159" : true, "SI-160" : true, "SI-161" : true, "SI-162" : true,
- "SI-163" : true, "SI-164" : true, "SI-165" : true, "SI-166" : true, "SI-167" : true,
- "SI-168" : true, "SI-169" : true, "SI-170" : true, "SI-171" : true, "SI-172" : true,
- "SI-173" : true, "SI-174" : true, "SI-175" : true, "SI-176" : true, "SI-177" : true,
- "SI-178" : true, "SI-179" : true, "SI-180" : true, "SI-181" : true, "SI-182" : true,
- "SI-183" : true, "SI-184" : true, "SI-185" : true, "SI-186" : true, "SI-187" : true,
- "SI-188" : true, "SI-189" : true, "SI-190" : true, "SI-191" : true, "SI-192" : true,
- "SI-193" : true, "SI-194" : true, "SI-195" : true, "SI-196" : true, "SI-197" : true,
- "SI-198" : true, "SI-199" : true, "SI-200" : true, "SI-201" : true, "SI-202" : true,
- "SI-203" : true, "SI-204" : true, "SI-205" : true, "SI-206" : true, "SI-207" : true,
- "SI-208" : true, "SI-209" : true, "SI-210" : true, "SI-211" : true, "SK-BC" : true,
- "SK-BL" : true, "SK-KI" : true, "SK-NI" : true, "SK-PV" : true, "SK-TA" : true,
- "SK-TC" : true, "SK-ZI" : true, "SL-E" : true, "SL-N" : true, "SL-S" : true,
- "SL-W" : true, "SM-01" : true, "SM-02" : true, "SM-03" : true, "SM-04" : true,
- "SM-05" : true, "SM-06" : true, "SM-07" : true, "SM-08" : true, "SM-09" : true,
- "SN-DB" : true, "SN-DK" : true, "SN-FK" : true, "SN-KA" : true, "SN-KD" : true,
- "SN-KE" : true, "SN-KL" : true, "SN-LG" : true, "SN-MT" : true, "SN-SE" : true,
- "SN-SL" : true, "SN-TC" : true, "SN-TH" : true, "SN-ZG" : true, "SO-AW" : true,
- "SO-BK" : true, "SO-BN" : true, "SO-BR" : true, "SO-BY" : true, "SO-GA" : true,
- "SO-GE" : true, "SO-HI" : true, "SO-JD" : true, "SO-JH" : true, "SO-MU" : true,
- "SO-NU" : true, "SO-SA" : true, "SO-SD" : true, "SO-SH" : true, "SO-SO" : true,
- "SO-TO" : true, "SO-WO" : true, "SR-BR" : true, "SR-CM" : true, "SR-CR" : true,
- "SR-MA" : true, "SR-NI" : true, "SR-PM" : true, "SR-PR" : true, "SR-SA" : true,
- "SR-SI" : true, "SR-WA" : true, "SS-BN" : true, "SS-BW" : true, "SS-EC" : true,
- "SS-EE8" : true, "SS-EW" : true, "SS-JG" : true, "SS-LK" : true, "SS-NU" : true,
- "SS-UY" : true, "SS-WR" : true, "ST-P" : true, "ST-S" : true, "SV-AH" : true,
- "SV-CA" : true, "SV-CH" : true, "SV-CU" : true, "SV-LI" : true, "SV-MO" : true,
- "SV-PA" : true, "SV-SA" : true, "SV-SM" : true, "SV-SO" : true, "SV-SS" : true,
- "SV-SV" : true, "SV-UN" : true, "SV-US" : true, "SY-DI" : true, "SY-DR" : true,
- "SY-DY" : true, "SY-HA" : true, "SY-HI" : true, "SY-HL" : true, "SY-HM" : true,
- "SY-ID" : true, "SY-LA" : true, "SY-QU" : true, "SY-RA" : true, "SY-RD" : true,
- "SY-SU" : true, "SY-TA" : true, "SZ-HH" : true, "SZ-LU" : true, "SZ-MA" : true,
- "SZ-SH" : true, "TD-BA" : true, "TD-BG" : true, "TD-BO" : true, "TD-CB" : true,
- "TD-EN" : true, "TD-GR" : true, "TD-HL" : true, "TD-KA" : true, "TD-LC" : true,
- "TD-LO" : true, "TD-LR" : true, "TD-MA" : true, "TD-MC" : true, "TD-ME" : true,
- "TD-MO" : true, "TD-ND" : true, "TD-OD" : true, "TD-SA" : true, "TD-SI" : true,
- "TD-TA" : true, "TD-TI" : true, "TD-WF" : true, "TG-C" : true, "TG-K" : true,
- "TG-M" : true, "TG-P" : true, "TG-S" : true, "TH-10" : true, "TH-11" : true,
- "TH-12" : true, "TH-13" : true, "TH-14" : true, "TH-15" : true, "TH-16" : true,
- "TH-17" : true, "TH-18" : true, "TH-19" : true, "TH-20" : true, "TH-21" : true,
- "TH-22" : true, "TH-23" : true, "TH-24" : true, "TH-25" : true, "TH-26" : true,
- "TH-27" : true, "TH-30" : true, "TH-31" : true, "TH-32" : true, "TH-33" : true,
- "TH-34" : true, "TH-35" : true, "TH-36" : true, "TH-37" : true, "TH-39" : true,
- "TH-40" : true, "TH-41" : true, "TH-42" : true, "TH-43" : true, "TH-44" : true,
- "TH-45" : true, "TH-46" : true, "TH-47" : true, "TH-48" : true, "TH-49" : true,
- "TH-50" : true, "TH-51" : true, "TH-52" : true, "TH-53" : true, "TH-54" : true,
- "TH-55" : true, "TH-56" : true, "TH-57" : true, "TH-58" : true, "TH-60" : true,
- "TH-61" : true, "TH-62" : true, "TH-63" : true, "TH-64" : true, "TH-65" : true,
- "TH-66" : true, "TH-67" : true, "TH-70" : true, "TH-71" : true, "TH-72" : true,
- "TH-73" : true, "TH-74" : true, "TH-75" : true, "TH-76" : true, "TH-77" : true,
- "TH-80" : true, "TH-81" : true, "TH-82" : true, "TH-83" : true, "TH-84" : true,
- "TH-85" : true, "TH-86" : true, "TH-90" : true, "TH-91" : true, "TH-92" : true,
- "TH-93" : true, "TH-94" : true, "TH-95" : true, "TH-96" : true, "TH-S" : true,
- "TJ-GB" : true, "TJ-KT" : true, "TJ-SU" : true, "TL-AL" : true, "TL-AN" : true,
- "TL-BA" : true, "TL-BO" : true, "TL-CO" : true, "TL-DI" : true, "TL-ER" : true,
- "TL-LA" : true, "TL-LI" : true, "TL-MF" : true, "TL-MT" : true, "TL-OE" : true,
- "TL-VI" : true, "TM-A" : true, "TM-B" : true, "TM-D" : true, "TM-L" : true,
- "TM-M" : true, "TM-S" : true, "TN-11" : true, "TN-12" : true, "TN-13" : true,
- "TN-14" : true, "TN-21" : true, "TN-22" : true, "TN-23" : true, "TN-31" : true,
- "TN-32" : true, "TN-33" : true, "TN-34" : true, "TN-41" : true, "TN-42" : true,
- "TN-43" : true, "TN-51" : true, "TN-52" : true, "TN-53" : true, "TN-61" : true,
- "TN-71" : true, "TN-72" : true, "TN-73" : true, "TN-81" : true, "TN-82" : true,
- "TN-83" : true, "TO-01" : true, "TO-02" : true, "TO-03" : true, "TO-04" : true,
- "TO-05" : true, "TR-01" : true, "TR-02" : true, "TR-03" : true, "TR-04" : true,
- "TR-05" : true, "TR-06" : true, "TR-07" : true, "TR-08" : true, "TR-09" : true,
- "TR-10" : true, "TR-11" : true, "TR-12" : true, "TR-13" : true, "TR-14" : true,
- "TR-15" : true, "TR-16" : true, "TR-17" : true, "TR-18" : true, "TR-19" : true,
- "TR-20" : true, "TR-21" : true, "TR-22" : true, "TR-23" : true, "TR-24" : true,
- "TR-25" : true, "TR-26" : true, "TR-27" : true, "TR-28" : true, "TR-29" : true,
- "TR-30" : true, "TR-31" : true, "TR-32" : true, "TR-33" : true, "TR-34" : true,
- "TR-35" : true, "TR-36" : true, "TR-37" : true, "TR-38" : true, "TR-39" : true,
- "TR-40" : true, "TR-41" : true, "TR-42" : true, "TR-43" : true, "TR-44" : true,
- "TR-45" : true, "TR-46" : true, "TR-47" : true, "TR-48" : true, "TR-49" : true,
- "TR-50" : true, "TR-51" : true, "TR-52" : true, "TR-53" : true, "TR-54" : true,
- "TR-55" : true, "TR-56" : true, "TR-57" : true, "TR-58" : true, "TR-59" : true,
- "TR-60" : true, "TR-61" : true, "TR-62" : true, "TR-63" : true, "TR-64" : true,
- "TR-65" : true, "TR-66" : true, "TR-67" : true, "TR-68" : true, "TR-69" : true,
- "TR-70" : true, "TR-71" : true, "TR-72" : true, "TR-73" : true, "TR-74" : true,
- "TR-75" : true, "TR-76" : true, "TR-77" : true, "TR-78" : true, "TR-79" : true,
- "TR-80" : true, "TR-81" : true, "TT-ARI" : true, "TT-CHA" : true, "TT-CTT" : true,
- "TT-DMN" : true, "TT-ETO" : true, "TT-PED" : true, "TT-POS" : true, "TT-PRT" : true,
- "TT-PTF" : true, "TT-RCM" : true, "TT-SFO" : true, "TT-SGE" : true, "TT-SIP" : true,
- "TT-SJL" : true, "TT-TUP" : true, "TT-WTO" : true, "TV-FUN" : true, "TV-NIT" : true,
- "TV-NKF" : true, "TV-NKL" : true, "TV-NMA" : true, "TV-NMG" : true, "TV-NUI" : true,
- "TV-VAI" : true, "TW-CHA" : true, "TW-CYI" : true, "TW-CYQ" : true, "TW-HSQ" : true,
- "TW-HSZ" : true, "TW-HUA" : true, "TW-ILA" : true, "TW-KEE" : true, "TW-KHH" : true,
- "TW-KHQ" : true, "TW-MIA" : true, "TW-NAN" : true, "TW-PEN" : true, "TW-PIF" : true,
- "TW-TAO" : true, "TW-TNN" : true, "TW-TNQ" : true, "TW-TPE" : true, "TW-TPQ" : true,
- "TW-TTT" : true, "TW-TXG" : true, "TW-TXQ" : true, "TW-YUN" : true, "TZ-01" : true,
- "TZ-02" : true, "TZ-03" : true, "TZ-04" : true, "TZ-05" : true, "TZ-06" : true,
- "TZ-07" : true, "TZ-08" : true, "TZ-09" : true, "TZ-10" : true, "TZ-11" : true,
- "TZ-12" : true, "TZ-13" : true, "TZ-14" : true, "TZ-15" : true, "TZ-16" : true,
- "TZ-17" : true, "TZ-18" : true, "TZ-19" : true, "TZ-20" : true, "TZ-21" : true,
- "TZ-22" : true, "TZ-23" : true, "TZ-24" : true, "TZ-25" : true, "TZ-26" : true,
- "UA-05" : true, "UA-07" : true, "UA-09" : true, "UA-12" : true, "UA-14" : true,
- "UA-18" : true, "UA-21" : true, "UA-23" : true, "UA-26" : true, "UA-30" : true,
- "UA-32" : true, "UA-35" : true, "UA-40" : true, "UA-43" : true, "UA-46" : true,
- "UA-48" : true, "UA-51" : true, "UA-53" : true, "UA-56" : true, "UA-59" : true,
- "UA-61" : true, "UA-63" : true, "UA-65" : true, "UA-68" : true, "UA-71" : true,
- "UA-74" : true, "UA-77" : true, "UG-101" : true, "UG-102" : true, "UG-103" : true,
- "UG-104" : true, "UG-105" : true, "UG-106" : true, "UG-107" : true, "UG-108" : true,
- "UG-109" : true, "UG-110" : true, "UG-111" : true, "UG-112" : true, "UG-113" : true,
- "UG-114" : true, "UG-115" : true, "UG-116" : true, "UG-201" : true, "UG-202" : true,
- "UG-203" : true, "UG-204" : true, "UG-205" : true, "UG-206" : true, "UG-207" : true,
- "UG-208" : true, "UG-209" : true, "UG-210" : true, "UG-211" : true, "UG-212" : true,
- "UG-213" : true, "UG-214" : true, "UG-215" : true, "UG-216" : true, "UG-217" : true,
- "UG-218" : true, "UG-219" : true, "UG-220" : true, "UG-221" : true, "UG-222" : true,
- "UG-223" : true, "UG-224" : true, "UG-301" : true, "UG-302" : true, "UG-303" : true,
- "UG-304" : true, "UG-305" : true, "UG-306" : true, "UG-307" : true, "UG-308" : true,
- "UG-309" : true, "UG-310" : true, "UG-311" : true, "UG-312" : true, "UG-313" : true,
- "UG-314" : true, "UG-315" : true, "UG-316" : true, "UG-317" : true, "UG-318" : true,
- "UG-319" : true, "UG-320" : true, "UG-321" : true, "UG-401" : true, "UG-402" : true,
- "UG-403" : true, "UG-404" : true, "UG-405" : true, "UG-406" : true, "UG-407" : true,
- "UG-408" : true, "UG-409" : true, "UG-410" : true, "UG-411" : true, "UG-412" : true,
- "UG-413" : true, "UG-414" : true, "UG-415" : true, "UG-416" : true, "UG-417" : true,
- "UG-418" : true, "UG-419" : true, "UG-C" : true, "UG-E" : true, "UG-N" : true,
- "UG-W" : true, "UM-67" : true, "UM-71" : true, "UM-76" : true, "UM-79" : true,
- "UM-81" : true, "UM-84" : true, "UM-86" : true, "UM-89" : true, "UM-95" : true,
- "US-AK" : true, "US-AL" : true, "US-AR" : true, "US-AS" : true, "US-AZ" : true,
- "US-CA" : true, "US-CO" : true, "US-CT" : true, "US-DC" : true, "US-DE" : true,
- "US-FL" : true, "US-GA" : true, "US-GU" : true, "US-HI" : true, "US-IA" : true,
- "US-ID" : true, "US-IL" : true, "US-IN" : true, "US-KS" : true, "US-KY" : true,
- "US-LA" : true, "US-MA" : true, "US-MD" : true, "US-ME" : true, "US-MI" : true,
- "US-MN" : true, "US-MO" : true, "US-MP" : true, "US-MS" : true, "US-MT" : true,
- "US-NC" : true, "US-ND" : true, "US-NE" : true, "US-NH" : true, "US-NJ" : true,
- "US-NM" : true, "US-NV" : true, "US-NY" : true, "US-OH" : true, "US-OK" : true,
- "US-OR" : true, "US-PA" : true, "US-PR" : true, "US-RI" : true, "US-SC" : true,
- "US-SD" : true, "US-TN" : true, "US-TX" : true, "US-UM" : true, "US-UT" : true,
- "US-VA" : true, "US-VI" : true, "US-VT" : true, "US-WA" : true, "US-WI" : true,
- "US-WV" : true, "US-WY" : true, "UY-AR" : true, "UY-CA" : true, "UY-CL" : true,
- "UY-CO" : true, "UY-DU" : true, "UY-FD" : true, "UY-FS" : true, "UY-LA" : true,
- "UY-MA" : true, "UY-MO" : true, "UY-PA" : true, "UY-RN" : true, "UY-RO" : true,
- "UY-RV" : true, "UY-SA" : true, "UY-SJ" : true, "UY-SO" : true, "UY-TA" : true,
- "UY-TT" : true, "UZ-AN" : true, "UZ-BU" : true, "UZ-FA" : true, "UZ-JI" : true,
- "UZ-NG" : true, "UZ-NW" : true, "UZ-QA" : true, "UZ-QR" : true, "UZ-SA" : true,
- "UZ-SI" : true, "UZ-SU" : true, "UZ-TK" : true, "UZ-TO" : true, "UZ-XO" : true,
- "VC-01" : true, "VC-02" : true, "VC-03" : true, "VC-04" : true, "VC-05" : true,
- "VC-06" : true, "VE-A" : true, "VE-B" : true, "VE-C" : true, "VE-D" : true,
- "VE-E" : true, "VE-F" : true, "VE-G" : true, "VE-H" : true, "VE-I" : true,
- "VE-J" : true, "VE-K" : true, "VE-L" : true, "VE-M" : true, "VE-N" : true,
- "VE-O" : true, "VE-P" : true, "VE-R" : true, "VE-S" : true, "VE-T" : true,
- "VE-U" : true, "VE-V" : true, "VE-W" : true, "VE-X" : true, "VE-Y" : true,
- "VE-Z" : true, "VN-01" : true, "VN-02" : true, "VN-03" : true, "VN-04" : true,
- "VN-05" : true, "VN-06" : true, "VN-07" : true, "VN-09" : true, "VN-13" : true,
- "VN-14" : true, "VN-15" : true, "VN-18" : true, "VN-20" : true, "VN-21" : true,
- "VN-22" : true, "VN-23" : true, "VN-24" : true, "VN-25" : true, "VN-26" : true,
- "VN-27" : true, "VN-28" : true, "VN-29" : true, "VN-30" : true, "VN-31" : true,
- "VN-32" : true, "VN-33" : true, "VN-34" : true, "VN-35" : true, "VN-36" : true,
- "VN-37" : true, "VN-39" : true, "VN-40" : true, "VN-41" : true, "VN-43" : true,
- "VN-44" : true, "VN-45" : true, "VN-46" : true, "VN-47" : true, "VN-49" : true,
- "VN-50" : true, "VN-51" : true, "VN-52" : true, "VN-53" : true, "VN-54" : true,
- "VN-55" : true, "VN-56" : true, "VN-57" : true, "VN-58" : true, "VN-59" : true,
- "VN-61" : true, "VN-63" : true, "VN-66" : true, "VN-67" : true, "VN-68" : true,
- "VN-69" : true, "VN-70" : true, "VN-71" : true, "VN-72" : true, "VN-73" : true,
- "VN-CT" : true, "VN-DN" : true, "VN-HN" : true, "VN-HP" : true, "VN-SG" : true,
- "VU-MAP" : true, "VU-PAM" : true, "VU-SAM" : true, "VU-SEE" : true, "VU-TAE" : true,
- "VU-TOB" : true, "WS-AA" : true, "WS-AL" : true, "WS-AT" : true, "WS-FA" : true,
- "WS-GE" : true, "WS-GI" : true, "WS-PA" : true, "WS-SA" : true, "WS-TU" : true,
- "WS-VF" : true, "WS-VS" : true, "YE-AB" : true, "YE-AD" : true, "YE-AM" : true,
- "YE-BA" : true, "YE-DA" : true, "YE-DH" : true, "YE-HD" : true, "YE-HJ" : true,
- "YE-IB" : true, "YE-JA" : true, "YE-LA" : true, "YE-MA" : true, "YE-MR" : true,
- "YE-MU" : true, "YE-MW" : true, "YE-RA" : true, "YE-SD" : true, "YE-SH" : true,
- "YE-SN" : true, "YE-TA" : true, "ZA-EC" : true, "ZA-FS" : true, "ZA-GP" : true,
- "ZA-LP" : true, "ZA-MP" : true, "ZA-NC" : true, "ZA-NW" : true, "ZA-WC" : true,
- "ZA-ZN" : true, "ZM-01" : true, "ZM-02" : true, "ZM-03" : true, "ZM-04" : true,
- "ZM-05" : true, "ZM-06" : true, "ZM-07" : true, "ZM-08" : true, "ZM-09" : true,
- "ZW-BU" : true, "ZW-HA" : true, "ZW-MA" : true, "ZW-MC" : true, "ZW-ME" : true,
- "ZW-MI" : true, "ZW-MN" : true, "ZW-MS" : true, "ZW-MV" : true, "ZW-MW" : true,
+ "AD-02": true, "AD-03": true, "AD-04": true, "AD-05": true, "AD-06": true,
+ "AD-07": true, "AD-08": true, "AE-AJ": true, "AE-AZ": true, "AE-DU": true,
+ "AE-FU": true, "AE-RK": true, "AE-SH": true, "AE-UQ": true, "AF-BAL": true,
+ "AF-BAM": true, "AF-BDG": true, "AF-BDS": true, "AF-BGL": true, "AF-DAY": true,
+ "AF-FRA": true, "AF-FYB": true, "AF-GHA": true, "AF-GHO": true, "AF-HEL": true,
+ "AF-HER": true, "AF-JOW": true, "AF-KAB": true, "AF-KAN": true, "AF-KAP": true,
+ "AF-KDZ": true, "AF-KHO": true, "AF-KNR": true, "AF-LAG": true, "AF-LOG": true,
+ "AF-NAN": true, "AF-NIM": true, "AF-NUR": true, "AF-PAN": true, "AF-PAR": true,
+ "AF-PIA": true, "AF-PKA": true, "AF-SAM": true, "AF-SAR": true, "AF-TAK": true,
+ "AF-URU": true, "AF-WAR": true, "AF-ZAB": true, "AG-03": true, "AG-04": true,
+ "AG-05": true, "AG-06": true, "AG-07": true, "AG-08": true, "AG-10": true,
+ "AG-11": true, "AL-01": true, "AL-02": true, "AL-03": true, "AL-04": true,
+ "AL-05": true, "AL-06": true, "AL-07": true, "AL-08": true, "AL-09": true,
+ "AL-10": true, "AL-11": true, "AL-12": true, "AL-BR": true, "AL-BU": true,
+ "AL-DI": true, "AL-DL": true, "AL-DR": true, "AL-DV": true, "AL-EL": true,
+ "AL-ER": true, "AL-FR": true, "AL-GJ": true, "AL-GR": true, "AL-HA": true,
+ "AL-KA": true, "AL-KB": true, "AL-KC": true, "AL-KO": true, "AL-KR": true,
+ "AL-KU": true, "AL-LB": true, "AL-LE": true, "AL-LU": true, "AL-MK": true,
+ "AL-MM": true, "AL-MR": true, "AL-MT": true, "AL-PG": true, "AL-PQ": true,
+ "AL-PR": true, "AL-PU": true, "AL-SH": true, "AL-SK": true, "AL-SR": true,
+ "AL-TE": true, "AL-TP": true, "AL-TR": true, "AL-VL": true, "AM-AG": true,
+ "AM-AR": true, "AM-AV": true, "AM-ER": true, "AM-GR": true, "AM-KT": true,
+ "AM-LO": true, "AM-SH": true, "AM-SU": true, "AM-TV": true, "AM-VD": true,
+ "AO-BGO": true, "AO-BGU": true, "AO-BIE": true, "AO-CAB": true, "AO-CCU": true,
+ "AO-CNN": true, "AO-CNO": true, "AO-CUS": true, "AO-HUA": true, "AO-HUI": true,
+ "AO-LNO": true, "AO-LSU": true, "AO-LUA": true, "AO-MAL": true, "AO-MOX": true,
+ "AO-NAM": true, "AO-UIG": true, "AO-ZAI": true, "AR-A": true, "AR-B": true,
+ "AR-C": true, "AR-D": true, "AR-E": true, "AR-F": true, "AR-G": true, "AR-H": true,
+ "AR-J": true, "AR-K": true, "AR-L": true, "AR-M": true, "AR-N": true,
+ "AR-P": true, "AR-Q": true, "AR-R": true, "AR-S": true, "AR-T": true,
+ "AR-U": true, "AR-V": true, "AR-W": true, "AR-X": true, "AR-Y": true,
+ "AR-Z": true, "AT-1": true, "AT-2": true, "AT-3": true, "AT-4": true,
+ "AT-5": true, "AT-6": true, "AT-7": true, "AT-8": true, "AT-9": true,
+ "AU-ACT": true, "AU-NSW": true, "AU-NT": true, "AU-QLD": true, "AU-SA": true,
+ "AU-TAS": true, "AU-VIC": true, "AU-WA": true, "AZ-ABS": true, "AZ-AGA": true,
+ "AZ-AGC": true, "AZ-AGM": true, "AZ-AGS": true, "AZ-AGU": true, "AZ-AST": true,
+ "AZ-BA": true, "AZ-BAB": true, "AZ-BAL": true, "AZ-BAR": true, "AZ-BEY": true,
+ "AZ-BIL": true, "AZ-CAB": true, "AZ-CAL": true, "AZ-CUL": true, "AZ-DAS": true,
+ "AZ-FUZ": true, "AZ-GA": true, "AZ-GAD": true, "AZ-GOR": true, "AZ-GOY": true,
+ "AZ-GYG": true, "AZ-HAC": true, "AZ-IMI": true, "AZ-ISM": true, "AZ-KAL": true,
+ "AZ-KAN": true, "AZ-KUR": true, "AZ-LA": true, "AZ-LAC": true, "AZ-LAN": true,
+ "AZ-LER": true, "AZ-MAS": true, "AZ-MI": true, "AZ-NA": true, "AZ-NEF": true,
+ "AZ-NV": true, "AZ-NX": true, "AZ-OGU": true, "AZ-ORD": true, "AZ-QAB": true,
+ "AZ-QAX": true, "AZ-QAZ": true, "AZ-QBA": true, "AZ-QBI": true, "AZ-QOB": true,
+ "AZ-QUS": true, "AZ-SA": true, "AZ-SAB": true, "AZ-SAD": true, "AZ-SAH": true,
+ "AZ-SAK": true, "AZ-SAL": true, "AZ-SAR": true, "AZ-SAT": true, "AZ-SBN": true,
+ "AZ-SIY": true, "AZ-SKR": true, "AZ-SM": true, "AZ-SMI": true, "AZ-SMX": true,
+ "AZ-SR": true, "AZ-SUS": true, "AZ-TAR": true, "AZ-TOV": true, "AZ-UCA": true,
+ "AZ-XA": true, "AZ-XAC": true, "AZ-XCI": true, "AZ-XIZ": true, "AZ-XVD": true,
+ "AZ-YAR": true, "AZ-YE": true, "AZ-YEV": true, "AZ-ZAN": true, "AZ-ZAQ": true,
+ "AZ-ZAR": true, "BA-01": true, "BA-02": true, "BA-03": true, "BA-04": true,
+ "BA-05": true, "BA-06": true, "BA-07": true, "BA-08": true, "BA-09": true,
+ "BA-10": true, "BA-BIH": true, "BA-BRC": true, "BA-SRP": true, "BB-01": true,
+ "BB-02": true, "BB-03": true, "BB-04": true, "BB-05": true, "BB-06": true,
+ "BB-07": true, "BB-08": true, "BB-09": true, "BB-10": true, "BB-11": true,
+ "BD-01": true, "BD-02": true, "BD-03": true, "BD-04": true, "BD-05": true,
+ "BD-06": true, "BD-07": true, "BD-08": true, "BD-09": true, "BD-10": true,
+ "BD-11": true, "BD-12": true, "BD-13": true, "BD-14": true, "BD-15": true,
+ "BD-16": true, "BD-17": true, "BD-18": true, "BD-19": true, "BD-20": true,
+ "BD-21": true, "BD-22": true, "BD-23": true, "BD-24": true, "BD-25": true,
+ "BD-26": true, "BD-27": true, "BD-28": true, "BD-29": true, "BD-30": true,
+ "BD-31": true, "BD-32": true, "BD-33": true, "BD-34": true, "BD-35": true,
+ "BD-36": true, "BD-37": true, "BD-38": true, "BD-39": true, "BD-40": true,
+ "BD-41": true, "BD-42": true, "BD-43": true, "BD-44": true, "BD-45": true,
+ "BD-46": true, "BD-47": true, "BD-48": true, "BD-49": true, "BD-50": true,
+ "BD-51": true, "BD-52": true, "BD-53": true, "BD-54": true, "BD-55": true,
+ "BD-56": true, "BD-57": true, "BD-58": true, "BD-59": true, "BD-60": true,
+ "BD-61": true, "BD-62": true, "BD-63": true, "BD-64": true, "BD-A": true,
+ "BD-B": true, "BD-C": true, "BD-D": true, "BD-E": true, "BD-F": true,
+ "BD-G": true, "BE-BRU": true, "BE-VAN": true, "BE-VBR": true, "BE-VLG": true,
+ "BE-VLI": true, "BE-VOV": true, "BE-VWV": true, "BE-WAL": true, "BE-WBR": true,
+ "BE-WHT": true, "BE-WLG": true, "BE-WLX": true, "BE-WNA": true, "BF-01": true,
+ "BF-02": true, "BF-03": true, "BF-04": true, "BF-05": true, "BF-06": true,
+ "BF-07": true, "BF-08": true, "BF-09": true, "BF-10": true, "BF-11": true,
+ "BF-12": true, "BF-13": true, "BF-BAL": true, "BF-BAM": true, "BF-BAN": true,
+ "BF-BAZ": true, "BF-BGR": true, "BF-BLG": true, "BF-BLK": true, "BF-COM": true,
+ "BF-GAN": true, "BF-GNA": true, "BF-GOU": true, "BF-HOU": true, "BF-IOB": true,
+ "BF-KAD": true, "BF-KEN": true, "BF-KMD": true, "BF-KMP": true, "BF-KOP": true,
+ "BF-KOS": true, "BF-KOT": true, "BF-KOW": true, "BF-LER": true, "BF-LOR": true,
+ "BF-MOU": true, "BF-NAM": true, "BF-NAO": true, "BF-NAY": true, "BF-NOU": true,
+ "BF-OUB": true, "BF-OUD": true, "BF-PAS": true, "BF-PON": true, "BF-SEN": true,
+ "BF-SIS": true, "BF-SMT": true, "BF-SNG": true, "BF-SOM": true, "BF-SOR": true,
+ "BF-TAP": true, "BF-TUI": true, "BF-YAG": true, "BF-YAT": true, "BF-ZIR": true,
+ "BF-ZON": true, "BF-ZOU": true, "BG-01": true, "BG-02": true, "BG-03": true,
+ "BG-04": true, "BG-05": true, "BG-06": true, "BG-07": true, "BG-08": true,
+ "BG-09": true, "BG-10": true, "BG-11": true, "BG-12": true, "BG-13": true,
+ "BG-14": true, "BG-15": true, "BG-16": true, "BG-17": true, "BG-18": true,
+ "BG-19": true, "BG-20": true, "BG-21": true, "BG-22": true, "BG-23": true,
+ "BG-24": true, "BG-25": true, "BG-26": true, "BG-27": true, "BG-28": true,
+ "BH-13": true, "BH-14": true, "BH-15": true, "BH-16": true, "BH-17": true,
+ "BI-BB": true, "BI-BL": true, "BI-BM": true, "BI-BR": true, "BI-CA": true,
+ "BI-CI": true, "BI-GI": true, "BI-KI": true, "BI-KR": true, "BI-KY": true,
+ "BI-MA": true, "BI-MU": true, "BI-MW": true, "BI-NG": true, "BI-RM": true, "BI-RT": true,
+ "BI-RY": true, "BJ-AK": true, "BJ-AL": true, "BJ-AQ": true, "BJ-BO": true,
+ "BJ-CO": true, "BJ-DO": true, "BJ-KO": true, "BJ-LI": true, "BJ-MO": true,
+ "BJ-OU": true, "BJ-PL": true, "BJ-ZO": true, "BN-BE": true, "BN-BM": true,
+ "BN-TE": true, "BN-TU": true, "BO-B": true, "BO-C": true, "BO-H": true,
+ "BO-L": true, "BO-N": true, "BO-O": true, "BO-P": true, "BO-S": true,
+ "BO-T": true, "BQ-BO": true, "BQ-SA": true, "BQ-SE": true, "BR-AC": true,
+ "BR-AL": true, "BR-AM": true, "BR-AP": true, "BR-BA": true, "BR-CE": true,
+ "BR-DF": true, "BR-ES": true, "BR-FN": true, "BR-GO": true, "BR-MA": true,
+ "BR-MG": true, "BR-MS": true, "BR-MT": true, "BR-PA": true, "BR-PB": true,
+ "BR-PE": true, "BR-PI": true, "BR-PR": true, "BR-RJ": true, "BR-RN": true,
+ "BR-RO": true, "BR-RR": true, "BR-RS": true, "BR-SC": true, "BR-SE": true,
+ "BR-SP": true, "BR-TO": true, "BS-AK": true, "BS-BI": true, "BS-BP": true,
+ "BS-BY": true, "BS-CE": true, "BS-CI": true, "BS-CK": true, "BS-CO": true,
+ "BS-CS": true, "BS-EG": true, "BS-EX": true, "BS-FP": true, "BS-GC": true,
+ "BS-HI": true, "BS-HT": true, "BS-IN": true, "BS-LI": true, "BS-MC": true,
+ "BS-MG": true, "BS-MI": true, "BS-NE": true, "BS-NO": true, "BS-NP": true, "BS-NS": true,
+ "BS-RC": true, "BS-RI": true, "BS-SA": true, "BS-SE": true, "BS-SO": true,
+ "BS-SS": true, "BS-SW": true, "BS-WG": true, "BT-11": true, "BT-12": true,
+ "BT-13": true, "BT-14": true, "BT-15": true, "BT-21": true, "BT-22": true,
+ "BT-23": true, "BT-24": true, "BT-31": true, "BT-32": true, "BT-33": true,
+ "BT-34": true, "BT-41": true, "BT-42": true, "BT-43": true, "BT-44": true,
+ "BT-45": true, "BT-GA": true, "BT-TY": true, "BW-CE": true, "BW-CH": true, "BW-GH": true,
+ "BW-KG": true, "BW-KL": true, "BW-KW": true, "BW-NE": true, "BW-NW": true,
+ "BW-SE": true, "BW-SO": true, "BY-BR": true, "BY-HM": true, "BY-HO": true,
+ "BY-HR": true, "BY-MA": true, "BY-MI": true, "BY-VI": true, "BZ-BZ": true,
+ "BZ-CY": true, "BZ-CZL": true, "BZ-OW": true, "BZ-SC": true, "BZ-TOL": true,
+ "CA-AB": true, "CA-BC": true, "CA-MB": true, "CA-NB": true, "CA-NL": true,
+ "CA-NS": true, "CA-NT": true, "CA-NU": true, "CA-ON": true, "CA-PE": true,
+ "CA-QC": true, "CA-SK": true, "CA-YT": true, "CD-BC": true, "CD-BN": true,
+ "CD-EQ": true, "CD-HK": true, "CD-IT": true, "CD-KA": true, "CD-KC": true, "CD-KE": true, "CD-KG": true, "CD-KN": true,
+ "CD-KW": true, "CD-KS": true, "CD-LU": true, "CD-MA": true, "CD-NK": true, "CD-OR": true, "CD-SA": true, "CD-SK": true,
+ "CD-TA": true, "CD-TO": true, "CF-AC": true, "CF-BB": true, "CF-BGF": true, "CF-BK": true, "CF-HK": true, "CF-HM": true,
+ "CF-HS": true, "CF-KB": true, "CF-KG": true, "CF-LB": true, "CF-MB": true,
+ "CF-MP": true, "CF-NM": true, "CF-OP": true, "CF-SE": true, "CF-UK": true,
+ "CF-VK": true, "CG-11": true, "CG-12": true, "CG-13": true, "CG-14": true,
+ "CG-15": true, "CG-16": true, "CG-2": true, "CG-5": true, "CG-7": true, "CG-8": true,
+ "CG-9": true, "CG-BZV": true, "CH-AG": true, "CH-AI": true, "CH-AR": true,
+ "CH-BE": true, "CH-BL": true, "CH-BS": true, "CH-FR": true, "CH-GE": true,
+ "CH-GL": true, "CH-GR": true, "CH-JU": true, "CH-LU": true, "CH-NE": true,
+ "CH-NW": true, "CH-OW": true, "CH-SG": true, "CH-SH": true, "CH-SO": true,
+ "CH-SZ": true, "CH-TG": true, "CH-TI": true, "CH-UR": true, "CH-VD": true,
+ "CH-VS": true, "CH-ZG": true, "CH-ZH": true, "CI-AB": true, "CI-BS": true,
+ "CI-CM": true, "CI-DN": true, "CI-GD": true, "CI-LC": true, "CI-LG": true,
+ "CI-MG": true, "CI-SM": true, "CI-SV": true, "CI-VB": true, "CI-WR": true,
+ "CI-YM": true, "CI-ZZ": true, "CL-AI": true, "CL-AN": true, "CL-AP": true,
+ "CL-AR": true, "CL-AT": true, "CL-BI": true, "CL-CO": true, "CL-LI": true,
+ "CL-LL": true, "CL-LR": true, "CL-MA": true, "CL-ML": true, "CL-NB": true, "CL-RM": true,
+ "CL-TA": true, "CL-VS": true, "CM-AD": true, "CM-CE": true, "CM-EN": true,
+ "CM-ES": true, "CM-LT": true, "CM-NO": true, "CM-NW": true, "CM-OU": true,
+ "CM-SU": true, "CM-SW": true, "CN-AH": true, "CN-BJ": true, "CN-CQ": true,
+ "CN-FJ": true, "CN-GS": true, "CN-GD": true, "CN-GX": true, "CN-GZ": true,
+ "CN-HI": true, "CN-HE": true, "CN-HL": true, "CN-HA": true, "CN-HB": true,
+ "CN-HN": true, "CN-JS": true, "CN-JX": true, "CN-JL": true, "CN-LN": true,
+ "CN-NM": true, "CN-NX": true, "CN-QH": true, "CN-SN": true, "CN-SD": true, "CN-SH": true,
+ "CN-SX": true, "CN-SC": true, "CN-TJ": true, "CN-XJ": true, "CN-XZ": true, "CN-YN": true,
+ "CN-ZJ": true, "CO-AMA": true, "CO-ANT": true, "CO-ARA": true, "CO-ATL": true,
+ "CO-BOL": true, "CO-BOY": true, "CO-CAL": true, "CO-CAQ": true, "CO-CAS": true,
+ "CO-CAU": true, "CO-CES": true, "CO-CHO": true, "CO-COR": true, "CO-CUN": true,
+ "CO-DC": true, "CO-GUA": true, "CO-GUV": true, "CO-HUI": true, "CO-LAG": true,
+ "CO-MAG": true, "CO-MET": true, "CO-NAR": true, "CO-NSA": true, "CO-PUT": true,
+ "CO-QUI": true, "CO-RIS": true, "CO-SAN": true, "CO-SAP": true, "CO-SUC": true,
+ "CO-TOL": true, "CO-VAC": true, "CO-VAU": true, "CO-VID": true, "CR-A": true,
+ "CR-C": true, "CR-G": true, "CR-H": true, "CR-L": true, "CR-P": true,
+ "CR-SJ": true, "CU-01": true, "CU-02": true, "CU-03": true, "CU-04": true,
+ "CU-05": true, "CU-06": true, "CU-07": true, "CU-08": true, "CU-09": true,
+ "CU-10": true, "CU-11": true, "CU-12": true, "CU-13": true, "CU-14": true, "CU-15": true,
+ "CU-16": true, "CU-99": true, "CV-B": true, "CV-BR": true, "CV-BV": true, "CV-CA": true,
+ "CV-CF": true, "CV-CR": true, "CV-MA": true, "CV-MO": true, "CV-PA": true,
+ "CV-PN": true, "CV-PR": true, "CV-RB": true, "CV-RG": true, "CV-RS": true,
+ "CV-S": true, "CV-SD": true, "CV-SF": true, "CV-SL": true, "CV-SM": true,
+ "CV-SO": true, "CV-SS": true, "CV-SV": true, "CV-TA": true, "CV-TS": true,
+ "CY-01": true, "CY-02": true, "CY-03": true, "CY-04": true, "CY-05": true,
+ "CY-06": true, "CZ-10": true, "CZ-101": true, "CZ-102": true, "CZ-103": true,
+ "CZ-104": true, "CZ-105": true, "CZ-106": true, "CZ-107": true, "CZ-108": true,
+ "CZ-109": true, "CZ-110": true, "CZ-111": true, "CZ-112": true, "CZ-113": true,
+ "CZ-114": true, "CZ-115": true, "CZ-116": true, "CZ-117": true, "CZ-118": true,
+ "CZ-119": true, "CZ-120": true, "CZ-121": true, "CZ-122": true, "CZ-20": true,
+ "CZ-201": true, "CZ-202": true, "CZ-203": true, "CZ-204": true, "CZ-205": true,
+ "CZ-206": true, "CZ-207": true, "CZ-208": true, "CZ-209": true, "CZ-20A": true,
+ "CZ-20B": true, "CZ-20C": true, "CZ-31": true, "CZ-311": true, "CZ-312": true,
+ "CZ-313": true, "CZ-314": true, "CZ-315": true, "CZ-316": true, "CZ-317": true,
+ "CZ-32": true, "CZ-321": true, "CZ-322": true, "CZ-323": true, "CZ-324": true,
+ "CZ-325": true, "CZ-326": true, "CZ-327": true, "CZ-41": true, "CZ-411": true,
+ "CZ-412": true, "CZ-413": true, "CZ-42": true, "CZ-421": true, "CZ-422": true,
+ "CZ-423": true, "CZ-424": true, "CZ-425": true, "CZ-426": true, "CZ-427": true,
+ "CZ-51": true, "CZ-511": true, "CZ-512": true, "CZ-513": true, "CZ-514": true,
+ "CZ-52": true, "CZ-521": true, "CZ-522": true, "CZ-523": true, "CZ-524": true,
+ "CZ-525": true, "CZ-53": true, "CZ-531": true, "CZ-532": true, "CZ-533": true,
+ "CZ-534": true, "CZ-63": true, "CZ-631": true, "CZ-632": true, "CZ-633": true,
+ "CZ-634": true, "CZ-635": true, "CZ-64": true, "CZ-641": true, "CZ-642": true,
+ "CZ-643": true, "CZ-644": true, "CZ-645": true, "CZ-646": true, "CZ-647": true,
+ "CZ-71": true, "CZ-711": true, "CZ-712": true, "CZ-713": true, "CZ-714": true,
+ "CZ-715": true, "CZ-72": true, "CZ-721": true, "CZ-722": true, "CZ-723": true,
+ "CZ-724": true, "CZ-80": true, "CZ-801": true, "CZ-802": true, "CZ-803": true,
+ "CZ-804": true, "CZ-805": true, "CZ-806": true, "DE-BB": true, "DE-BE": true,
+ "DE-BW": true, "DE-BY": true, "DE-HB": true, "DE-HE": true, "DE-HH": true,
+ "DE-MV": true, "DE-NI": true, "DE-NW": true, "DE-RP": true, "DE-SH": true,
+ "DE-SL": true, "DE-SN": true, "DE-ST": true, "DE-TH": true, "DJ-AR": true,
+ "DJ-AS": true, "DJ-DI": true, "DJ-DJ": true, "DJ-OB": true, "DJ-TA": true,
+ "DK-81": true, "DK-82": true, "DK-83": true, "DK-84": true, "DK-85": true,
+ "DM-01": true, "DM-02": true, "DM-03": true, "DM-04": true, "DM-05": true,
+ "DM-06": true, "DM-07": true, "DM-08": true, "DM-09": true, "DM-10": true,
+ "DO-01": true, "DO-02": true, "DO-03": true, "DO-04": true, "DO-05": true,
+ "DO-06": true, "DO-07": true, "DO-08": true, "DO-09": true, "DO-10": true,
+ "DO-11": true, "DO-12": true, "DO-13": true, "DO-14": true, "DO-15": true,
+ "DO-16": true, "DO-17": true, "DO-18": true, "DO-19": true, "DO-20": true,
+ "DO-21": true, "DO-22": true, "DO-23": true, "DO-24": true, "DO-25": true,
+ "DO-26": true, "DO-27": true, "DO-28": true, "DO-29": true, "DO-30": true, "DO-31": true,
+ "DZ-01": true, "DZ-02": true, "DZ-03": true, "DZ-04": true, "DZ-05": true,
+ "DZ-06": true, "DZ-07": true, "DZ-08": true, "DZ-09": true, "DZ-10": true,
+ "DZ-11": true, "DZ-12": true, "DZ-13": true, "DZ-14": true, "DZ-15": true,
+ "DZ-16": true, "DZ-17": true, "DZ-18": true, "DZ-19": true, "DZ-20": true,
+ "DZ-21": true, "DZ-22": true, "DZ-23": true, "DZ-24": true, "DZ-25": true,
+ "DZ-26": true, "DZ-27": true, "DZ-28": true, "DZ-29": true, "DZ-30": true,
+ "DZ-31": true, "DZ-32": true, "DZ-33": true, "DZ-34": true, "DZ-35": true,
+ "DZ-36": true, "DZ-37": true, "DZ-38": true, "DZ-39": true, "DZ-40": true,
+ "DZ-41": true, "DZ-42": true, "DZ-43": true, "DZ-44": true, "DZ-45": true,
+ "DZ-46": true, "DZ-47": true, "DZ-48": true, "DZ-49": true, "DZ-51": true,
+ "DZ-53": true, "DZ-55": true, "DZ-56": true, "DZ-57": true, "EC-A": true, "EC-B": true,
+ "EC-C": true, "EC-D": true, "EC-E": true, "EC-F": true, "EC-G": true,
+ "EC-H": true, "EC-I": true, "EC-L": true, "EC-M": true, "EC-N": true,
+ "EC-O": true, "EC-P": true, "EC-R": true, "EC-S": true, "EC-SD": true,
+ "EC-SE": true, "EC-T": true, "EC-U": true, "EC-W": true, "EC-X": true,
+ "EC-Y": true, "EC-Z": true, "EE-37": true, "EE-39": true, "EE-44": true, "EE-45": true,
+ "EE-49": true, "EE-50": true, "EE-51": true, "EE-52": true, "EE-56": true, "EE-57": true,
+ "EE-59": true, "EE-60": true, "EE-64": true, "EE-65": true, "EE-67": true, "EE-68": true,
+ "EE-70": true, "EE-71": true, "EE-74": true, "EE-78": true, "EE-79": true, "EE-81": true, "EE-82": true,
+ "EE-84": true, "EE-86": true, "EE-87": true, "EG-ALX": true, "EG-ASN": true, "EG-AST": true,
+ "EG-BA": true, "EG-BH": true, "EG-BNS": true, "EG-C": true, "EG-DK": true,
+ "EG-DT": true, "EG-FYM": true, "EG-GH": true, "EG-GZ": true, "EG-HU": true,
+ "EG-IS": true, "EG-JS": true, "EG-KB": true, "EG-KFS": true, "EG-KN": true,
+ "EG-LX": true, "EG-MN": true, "EG-MNF": true, "EG-MT": true, "EG-PTS": true, "EG-SHG": true,
+ "EG-SHR": true, "EG-SIN": true, "EG-SU": true, "EG-SUZ": true, "EG-WAD": true,
+ "ER-AN": true, "ER-DK": true, "ER-DU": true, "ER-GB": true, "ER-MA": true,
+ "ER-SK": true, "ES-A": true, "ES-AB": true, "ES-AL": true, "ES-AN": true,
+ "ES-AR": true, "ES-AS": true, "ES-AV": true, "ES-B": true, "ES-BA": true,
+ "ES-BI": true, "ES-BU": true, "ES-C": true, "ES-CA": true, "ES-CB": true,
+ "ES-CC": true, "ES-CE": true, "ES-CL": true, "ES-CM": true, "ES-CN": true,
+ "ES-CO": true, "ES-CR": true, "ES-CS": true, "ES-CT": true, "ES-CU": true,
+ "ES-EX": true, "ES-GA": true, "ES-GC": true, "ES-GI": true, "ES-GR": true,
+ "ES-GU": true, "ES-H": true, "ES-HU": true, "ES-IB": true, "ES-J": true,
+ "ES-L": true, "ES-LE": true, "ES-LO": true, "ES-LU": true, "ES-M": true,
+ "ES-MA": true, "ES-MC": true, "ES-MD": true, "ES-ML": true, "ES-MU": true,
+ "ES-NA": true, "ES-NC": true, "ES-O": true, "ES-OR": true, "ES-P": true,
+ "ES-PM": true, "ES-PO": true, "ES-PV": true, "ES-RI": true, "ES-S": true,
+ "ES-SA": true, "ES-SE": true, "ES-SG": true, "ES-SO": true, "ES-SS": true,
+ "ES-T": true, "ES-TE": true, "ES-TF": true, "ES-TO": true, "ES-V": true,
+ "ES-VA": true, "ES-VC": true, "ES-VI": true, "ES-Z": true, "ES-ZA": true,
+ "ET-AA": true, "ET-AF": true, "ET-AM": true, "ET-BE": true, "ET-DD": true,
+ "ET-GA": true, "ET-HA": true, "ET-OR": true, "ET-SN": true, "ET-SO": true,
+ "ET-TI": true, "FI-01": true, "FI-02": true, "FI-03": true, "FI-04": true,
+ "FI-05": true, "FI-06": true, "FI-07": true, "FI-08": true, "FI-09": true,
+ "FI-10": true, "FI-11": true, "FI-12": true, "FI-13": true, "FI-14": true,
+ "FI-15": true, "FI-16": true, "FI-17": true, "FI-18": true, "FI-19": true,
+ "FJ-C": true, "FJ-E": true, "FJ-N": true, "FJ-R": true, "FJ-W": true,
+ "FM-KSA": true, "FM-PNI": true, "FM-TRK": true, "FM-YAP": true, "FR-01": true,
+ "FR-02": true, "FR-03": true, "FR-04": true, "FR-05": true, "FR-06": true,
+ "FR-07": true, "FR-08": true, "FR-09": true, "FR-10": true, "FR-11": true,
+ "FR-12": true, "FR-13": true, "FR-14": true, "FR-15": true, "FR-16": true,
+ "FR-17": true, "FR-18": true, "FR-19": true, "FR-20R": true, "FR-21": true, "FR-22": true,
+ "FR-23": true, "FR-24": true, "FR-25": true, "FR-26": true, "FR-27": true,
+ "FR-28": true, "FR-29": true, "FR-2A": true, "FR-2B": true, "FR-30": true,
+ "FR-31": true, "FR-32": true, "FR-33": true, "FR-34": true, "FR-35": true,
+ "FR-36": true, "FR-37": true, "FR-38": true, "FR-39": true, "FR-40": true,
+ "FR-41": true, "FR-42": true, "FR-43": true, "FR-44": true, "FR-45": true,
+ "FR-46": true, "FR-47": true, "FR-48": true, "FR-49": true, "FR-50": true,
+ "FR-51": true, "FR-52": true, "FR-53": true, "FR-54": true, "FR-55": true,
+ "FR-56": true, "FR-57": true, "FR-58": true, "FR-59": true, "FR-60": true,
+ "FR-61": true, "FR-62": true, "FR-63": true, "FR-64": true, "FR-65": true,
+ "FR-66": true, "FR-67": true, "FR-68": true, "FR-69": true, "FR-70": true,
+ "FR-71": true, "FR-72": true, "FR-73": true, "FR-74": true, "FR-75": true,
+ "FR-76": true, "FR-77": true, "FR-78": true, "FR-79": true, "FR-80": true,
+ "FR-81": true, "FR-82": true, "FR-83": true, "FR-84": true, "FR-85": true,
+ "FR-86": true, "FR-87": true, "FR-88": true, "FR-89": true, "FR-90": true,
+ "FR-91": true, "FR-92": true, "FR-93": true, "FR-94": true, "FR-95": true,
+ "FR-ARA": true, "FR-BFC": true, "FR-BL": true, "FR-BRE": true, "FR-COR": true,
+ "FR-CP": true, "FR-CVL": true, "FR-GES": true, "FR-GF": true, "FR-GP": true,
+ "FR-GUA": true, "FR-HDF": true, "FR-IDF": true, "FR-LRE": true, "FR-MAY": true,
+ "FR-MF": true, "FR-MQ": true, "FR-NAQ": true, "FR-NC": true, "FR-NOR": true,
+ "FR-OCC": true, "FR-PAC": true, "FR-PDL": true, "FR-PF": true, "FR-PM": true,
+ "FR-RE": true, "FR-TF": true, "FR-WF": true, "FR-YT": true, "GA-1": true,
+ "GA-2": true, "GA-3": true, "GA-4": true, "GA-5": true, "GA-6": true,
+ "GA-7": true, "GA-8": true, "GA-9": true, "GB-ABC": true, "GB-ABD": true,
+ "GB-ABE": true, "GB-AGB": true, "GB-AGY": true, "GB-AND": true, "GB-ANN": true,
+ "GB-ANS": true, "GB-BAS": true, "GB-BBD": true, "GB-BDF": true, "GB-BDG": true,
+ "GB-BEN": true, "GB-BEX": true, "GB-BFS": true, "GB-BGE": true, "GB-BGW": true,
+ "GB-BIR": true, "GB-BKM": true, "GB-BMH": true, "GB-BNE": true, "GB-BNH": true,
+ "GB-BNS": true, "GB-BOL": true, "GB-BPL": true, "GB-BRC": true, "GB-BRD": true,
+ "GB-BRY": true, "GB-BST": true, "GB-BUR": true, "GB-CAM": true, "GB-CAY": true,
+ "GB-CBF": true, "GB-CCG": true, "GB-CGN": true, "GB-CHE": true, "GB-CHW": true,
+ "GB-CLD": true, "GB-CLK": true, "GB-CMA": true, "GB-CMD": true, "GB-CMN": true,
+ "GB-CON": true, "GB-COV": true, "GB-CRF": true, "GB-CRY": true, "GB-CWY": true,
+ "GB-DAL": true, "GB-DBY": true, "GB-DEN": true, "GB-DER": true, "GB-DEV": true,
+ "GB-DGY": true, "GB-DNC": true, "GB-DND": true, "GB-DOR": true, "GB-DRS": true,
+ "GB-DUD": true, "GB-DUR": true, "GB-EAL": true, "GB-EAW": true, "GB-EAY": true,
+ "GB-EDH": true, "GB-EDU": true, "GB-ELN": true, "GB-ELS": true, "GB-ENF": true,
+ "GB-ENG": true, "GB-ERW": true, "GB-ERY": true, "GB-ESS": true, "GB-ESX": true,
+ "GB-FAL": true, "GB-FIF": true, "GB-FLN": true, "GB-FMO": true, "GB-GAT": true,
+ "GB-GBN": true, "GB-GLG": true, "GB-GLS": true, "GB-GRE": true, "GB-GWN": true,
+ "GB-HAL": true, "GB-HAM": true, "GB-HAV": true, "GB-HCK": true, "GB-HEF": true,
+ "GB-HIL": true, "GB-HLD": true, "GB-HMF": true, "GB-HNS": true, "GB-HPL": true,
+ "GB-HRT": true, "GB-HRW": true, "GB-HRY": true, "GB-IOS": true, "GB-IOW": true,
+ "GB-ISL": true, "GB-IVC": true, "GB-KEC": true, "GB-KEN": true, "GB-KHL": true,
+ "GB-KIR": true, "GB-KTT": true, "GB-KWL": true, "GB-LAN": true, "GB-LBC": true,
+ "GB-LBH": true, "GB-LCE": true, "GB-LDS": true, "GB-LEC": true, "GB-LEW": true,
+ "GB-LIN": true, "GB-LIV": true, "GB-LND": true, "GB-LUT": true, "GB-MAN": true,
+ "GB-MDB": true, "GB-MDW": true, "GB-MEA": true, "GB-MIK": true, "GD-01": true,
+ "GB-MLN": true, "GB-MON": true, "GB-MRT": true, "GB-MRY": true, "GB-MTY": true,
+ "GB-MUL": true, "GB-NAY": true, "GB-NBL": true, "GB-NEL": true, "GB-NET": true,
+ "GB-NFK": true, "GB-NGM": true, "GB-NIR": true, "GB-NLK": true, "GB-NLN": true,
+ "GB-NMD": true, "GB-NSM": true, "GB-NTH": true, "GB-NTL": true, "GB-NTT": true,
+ "GB-NTY": true, "GB-NWM": true, "GB-NWP": true, "GB-NYK": true, "GB-OLD": true,
+ "GB-ORK": true, "GB-OXF": true, "GB-PEM": true, "GB-PKN": true, "GB-PLY": true,
+ "GB-POL": true, "GB-POR": true, "GB-POW": true, "GB-PTE": true, "GB-RCC": true,
+ "GB-RCH": true, "GB-RCT": true, "GB-RDB": true, "GB-RDG": true, "GB-RFW": true,
+ "GB-RIC": true, "GB-ROT": true, "GB-RUT": true, "GB-SAW": true, "GB-SAY": true,
+ "GB-SCB": true, "GB-SCT": true, "GB-SFK": true, "GB-SFT": true, "GB-SGC": true,
+ "GB-SHF": true, "GB-SHN": true, "GB-SHR": true, "GB-SKP": true, "GB-SLF": true,
+ "GB-SLG": true, "GB-SLK": true, "GB-SND": true, "GB-SOL": true, "GB-SOM": true,
+ "GB-SOS": true, "GB-SRY": true, "GB-STE": true, "GB-STG": true, "GB-STH": true,
+ "GB-STN": true, "GB-STS": true, "GB-STT": true, "GB-STY": true, "GB-SWA": true,
+ "GB-SWD": true, "GB-SWK": true, "GB-TAM": true, "GB-TFW": true, "GB-THR": true,
+ "GB-TOB": true, "GB-TOF": true, "GB-TRF": true, "GB-TWH": true, "GB-UKM": true,
+ "GB-VGL": true, "GB-WAR": true, "GB-WBK": true, "GB-WDU": true, "GB-WFT": true,
+ "GB-WGN": true, "GB-WIL": true, "GB-WKF": true, "GB-WLL": true, "GB-WLN": true,
+ "GB-WLS": true, "GB-WLV": true, "GB-WND": true, "GB-WNM": true, "GB-WOK": true,
+ "GB-WOR": true, "GB-WRL": true, "GB-WRT": true, "GB-WRX": true, "GB-WSM": true,
+ "GB-WSX": true, "GB-YOR": true, "GB-ZET": true, "GD-02": true, "GD-03": true,
+ "GD-04": true, "GD-05": true, "GD-06": true, "GD-10": true, "GE-AB": true,
+ "GE-AJ": true, "GE-GU": true, "GE-IM": true, "GE-KA": true, "GE-KK": true,
+ "GE-MM": true, "GE-RL": true, "GE-SJ": true, "GE-SK": true, "GE-SZ": true,
+ "GE-TB": true, "GH-AA": true, "GH-AH": true, "GH-AF": true, "GH-BA": true, "GH-BO": true, "GH-BE": true, "GH-CP": true,
+ "GH-EP": true, "GH-NP": true, "GH-TV": true, "GH-UE": true, "GH-UW": true,
+ "GH-WP": true, "GL-AV": true, "GL-KU": true, "GL-QA": true, "GL-QT": true, "GL-QE": true, "GL-SM": true,
+ "GM-B": true, "GM-L": true, "GM-M": true, "GM-N": true, "GM-U": true,
+ "GM-W": true, "GN-B": true, "GN-BE": true, "GN-BF": true, "GN-BK": true,
+ "GN-C": true, "GN-CO": true, "GN-D": true, "GN-DB": true, "GN-DI": true,
+ "GN-DL": true, "GN-DU": true, "GN-F": true, "GN-FA": true, "GN-FO": true,
+ "GN-FR": true, "GN-GA": true, "GN-GU": true, "GN-K": true, "GN-KA": true,
+ "GN-KB": true, "GN-KD": true, "GN-KE": true, "GN-KN": true, "GN-KO": true,
+ "GN-KS": true, "GN-L": true, "GN-LA": true, "GN-LE": true, "GN-LO": true,
+ "GN-M": true, "GN-MC": true, "GN-MD": true, "GN-ML": true, "GN-MM": true,
+ "GN-N": true, "GN-NZ": true, "GN-PI": true, "GN-SI": true, "GN-TE": true,
+ "GN-TO": true, "GN-YO": true, "GQ-AN": true, "GQ-BN": true, "GQ-BS": true,
+ "GQ-C": true, "GQ-CS": true, "GQ-I": true, "GQ-KN": true, "GQ-LI": true,
+ "GQ-WN": true, "GR-01": true, "GR-03": true, "GR-04": true, "GR-05": true,
+ "GR-06": true, "GR-07": true, "GR-11": true, "GR-12": true, "GR-13": true,
+ "GR-14": true, "GR-15": true, "GR-16": true, "GR-17": true, "GR-21": true,
+ "GR-22": true, "GR-23": true, "GR-24": true, "GR-31": true, "GR-32": true,
+ "GR-33": true, "GR-34": true, "GR-41": true, "GR-42": true, "GR-43": true,
+ "GR-44": true, "GR-51": true, "GR-52": true, "GR-53": true, "GR-54": true,
+ "GR-55": true, "GR-56": true, "GR-57": true, "GR-58": true, "GR-59": true,
+ "GR-61": true, "GR-62": true, "GR-63": true, "GR-64": true, "GR-69": true,
+ "GR-71": true, "GR-72": true, "GR-73": true, "GR-81": true, "GR-82": true,
+ "GR-83": true, "GR-84": true, "GR-85": true, "GR-91": true, "GR-92": true,
+ "GR-93": true, "GR-94": true, "GR-A": true, "GR-A1": true, "GR-B": true,
+ "GR-C": true, "GR-D": true, "GR-E": true, "GR-F": true, "GR-G": true,
+ "GR-H": true, "GR-I": true, "GR-J": true, "GR-K": true, "GR-L": true,
+ "GR-M": true, "GT-01": true, "GT-02": true, "GT-03": true, "GT-04": true,
+ "GT-05": true, "GT-06": true, "GT-07": true, "GT-08": true, "GT-09": true,
+ "GT-10": true, "GT-11": true, "GT-12": true, "GT-13": true, "GT-14": true,
+ "GT-15": true, "GT-16": true, "GT-17": true, "GT-18": true, "GT-19": true,
+ "GT-20": true, "GT-21": true, "GT-22": true, "GW-BA": true, "GW-BL": true,
+ "GW-BM": true, "GW-BS": true, "GW-CA": true, "GW-GA": true, "GW-L": true,
+ "GW-N": true, "GW-OI": true, "GW-QU": true, "GW-S": true, "GW-TO": true,
+ "GY-BA": true, "GY-CU": true, "GY-DE": true, "GY-EB": true, "GY-ES": true,
+ "GY-MA": true, "GY-PM": true, "GY-PT": true, "GY-UD": true, "GY-UT": true,
+ "HN-AT": true, "HN-CH": true, "HN-CL": true, "HN-CM": true, "HN-CP": true,
+ "HN-CR": true, "HN-EP": true, "HN-FM": true, "HN-GD": true, "HN-IB": true,
+ "HN-IN": true, "HN-LE": true, "HN-LP": true, "HN-OC": true, "HN-OL": true,
+ "HN-SB": true, "HN-VA": true, "HN-YO": true, "HR-01": true, "HR-02": true,
+ "HR-03": true, "HR-04": true, "HR-05": true, "HR-06": true, "HR-07": true,
+ "HR-08": true, "HR-09": true, "HR-10": true, "HR-11": true, "HR-12": true,
+ "HR-13": true, "HR-14": true, "HR-15": true, "HR-16": true, "HR-17": true,
+ "HR-18": true, "HR-19": true, "HR-20": true, "HR-21": true, "HT-AR": true,
+ "HT-CE": true, "HT-GA": true, "HT-ND": true, "HT-NE": true, "HT-NO": true, "HT-NI": true,
+ "HT-OU": true, "HT-SD": true, "HT-SE": true, "HU-BA": true, "HU-BC": true,
+ "HU-BE": true, "HU-BK": true, "HU-BU": true, "HU-BZ": true, "HU-CS": true,
+ "HU-DE": true, "HU-DU": true, "HU-EG": true, "HU-ER": true, "HU-FE": true,
+ "HU-GS": true, "HU-GY": true, "HU-HB": true, "HU-HE": true, "HU-HV": true,
+ "HU-JN": true, "HU-KE": true, "HU-KM": true, "HU-KV": true, "HU-MI": true,
+ "HU-NK": true, "HU-NO": true, "HU-NY": true, "HU-PE": true, "HU-PS": true,
+ "HU-SD": true, "HU-SF": true, "HU-SH": true, "HU-SK": true, "HU-SN": true,
+ "HU-SO": true, "HU-SS": true, "HU-ST": true, "HU-SZ": true, "HU-TB": true,
+ "HU-TO": true, "HU-VA": true, "HU-VE": true, "HU-VM": true, "HU-ZA": true,
+ "HU-ZE": true, "ID-AC": true, "ID-BA": true, "ID-BB": true, "ID-BE": true,
+ "ID-BT": true, "ID-GO": true, "ID-IJ": true, "ID-JA": true, "ID-JB": true,
+ "ID-JI": true, "ID-JK": true, "ID-JT": true, "ID-JW": true, "ID-KA": true,
+ "ID-KB": true, "ID-KI": true, "ID-KU": true, "ID-KR": true, "ID-KS": true,
+ "ID-KT": true, "ID-LA": true, "ID-MA": true, "ID-ML": true, "ID-MU": true,
+ "ID-NB": true, "ID-NT": true, "ID-NU": true, "ID-PA": true, "ID-PB": true,
+ "ID-PE": true, "ID-PP": true, "ID-PS": true, "ID-PT": true, "ID-RI": true,
+ "ID-SA": true, "ID-SB": true, "ID-SG": true, "ID-SL": true, "ID-SM": true,
+ "ID-SN": true, "ID-SR": true, "ID-SS": true, "ID-ST": true, "ID-SU": true,
+ "ID-YO": true, "IE-C": true, "IE-CE": true, "IE-CN": true, "IE-CO": true,
+ "IE-CW": true, "IE-D": true, "IE-DL": true, "IE-G": true, "IE-KE": true,
+ "IE-KK": true, "IE-KY": true, "IE-L": true, "IE-LD": true, "IE-LH": true,
+ "IE-LK": true, "IE-LM": true, "IE-LS": true, "IE-M": true, "IE-MH": true,
+ "IE-MN": true, "IE-MO": true, "IE-OY": true, "IE-RN": true, "IE-SO": true,
+ "IE-TA": true, "IE-U": true, "IE-WD": true, "IE-WH": true, "IE-WW": true,
+ "IE-WX": true, "IL-D": true, "IL-HA": true, "IL-JM": true, "IL-M": true,
+ "IL-TA": true, "IL-Z": true, "IN-AN": true, "IN-AP": true, "IN-AR": true,
+ "IN-AS": true, "IN-BR": true, "IN-CH": true, "IN-CT": true, "IN-DH": true,
+ "IN-DL": true, "IN-DN": true, "IN-GA": true, "IN-GJ": true, "IN-HP": true,
+ "IN-HR": true, "IN-JH": true, "IN-JK": true, "IN-KA": true, "IN-KL": true,
+ "IN-LD": true, "IN-MH": true, "IN-ML": true, "IN-MN": true, "IN-MP": true,
+ "IN-MZ": true, "IN-NL": true, "IN-TG": true, "IN-OR": true, "IN-PB": true, "IN-PY": true,
+ "IN-RJ": true, "IN-SK": true, "IN-TN": true, "IN-TR": true, "IN-UP": true,
+ "IN-UT": true, "IN-WB": true, "IQ-AN": true, "IQ-AR": true, "IQ-BA": true,
+ "IQ-BB": true, "IQ-BG": true, "IQ-DA": true, "IQ-DI": true, "IQ-DQ": true,
+ "IQ-KA": true, "IQ-KI": true, "IQ-MA": true, "IQ-MU": true, "IQ-NA": true, "IQ-NI": true,
+ "IQ-QA": true, "IQ-SD": true, "IQ-SW": true, "IQ-SU": true, "IQ-TS": true, "IQ-WA": true,
+ "IR-00": true, "IR-01": true, "IR-02": true, "IR-03": true, "IR-04": true, "IR-05": true,
+ "IR-06": true, "IR-07": true, "IR-08": true, "IR-09": true, "IR-10": true, "IR-11": true,
+ "IR-12": true, "IR-13": true, "IR-14": true, "IR-15": true, "IR-16": true,
+ "IR-17": true, "IR-18": true, "IR-19": true, "IR-20": true, "IR-21": true,
+ "IR-22": true, "IR-23": true, "IR-24": true, "IR-25": true, "IR-26": true,
+ "IR-27": true, "IR-28": true, "IR-29": true, "IR-30": true, "IR-31": true,
+ "IS-0": true, "IS-1": true, "IS-2": true, "IS-3": true, "IS-4": true,
+ "IS-5": true, "IS-6": true, "IS-7": true, "IS-8": true, "IT-21": true,
+ "IT-23": true, "IT-25": true, "IT-32": true, "IT-34": true, "IT-36": true,
+ "IT-42": true, "IT-45": true, "IT-52": true, "IT-55": true, "IT-57": true,
+ "IT-62": true, "IT-65": true, "IT-67": true, "IT-72": true, "IT-75": true,
+ "IT-77": true, "IT-78": true, "IT-82": true, "IT-88": true, "IT-AG": true,
+ "IT-AL": true, "IT-AN": true, "IT-AO": true, "IT-AP": true, "IT-AQ": true,
+ "IT-AR": true, "IT-AT": true, "IT-AV": true, "IT-BA": true, "IT-BG": true,
+ "IT-BI": true, "IT-BL": true, "IT-BN": true, "IT-BO": true, "IT-BR": true,
+ "IT-BS": true, "IT-BT": true, "IT-BZ": true, "IT-CA": true, "IT-CB": true,
+ "IT-CE": true, "IT-CH": true, "IT-CI": true, "IT-CL": true, "IT-CN": true,
+ "IT-CO": true, "IT-CR": true, "IT-CS": true, "IT-CT": true, "IT-CZ": true,
+ "IT-EN": true, "IT-FC": true, "IT-FE": true, "IT-FG": true, "IT-FI": true,
+ "IT-FM": true, "IT-FR": true, "IT-GE": true, "IT-GO": true, "IT-GR": true,
+ "IT-IM": true, "IT-IS": true, "IT-KR": true, "IT-LC": true, "IT-LE": true,
+ "IT-LI": true, "IT-LO": true, "IT-LT": true, "IT-LU": true, "IT-MB": true,
+ "IT-MC": true, "IT-ME": true, "IT-MI": true, "IT-MN": true, "IT-MO": true,
+ "IT-MS": true, "IT-MT": true, "IT-NA": true, "IT-NO": true, "IT-NU": true,
+ "IT-OG": true, "IT-OR": true, "IT-OT": true, "IT-PA": true, "IT-PC": true,
+ "IT-PD": true, "IT-PE": true, "IT-PG": true, "IT-PI": true, "IT-PN": true,
+ "IT-PO": true, "IT-PR": true, "IT-PT": true, "IT-PU": true, "IT-PV": true,
+ "IT-PZ": true, "IT-RA": true, "IT-RC": true, "IT-RE": true, "IT-RG": true,
+ "IT-RI": true, "IT-RM": true, "IT-RN": true, "IT-RO": true, "IT-SA": true,
+ "IT-SI": true, "IT-SO": true, "IT-SP": true, "IT-SR": true, "IT-SS": true,
+ "IT-SV": true, "IT-TA": true, "IT-TE": true, "IT-TN": true, "IT-TO": true,
+ "IT-TP": true, "IT-TR": true, "IT-TS": true, "IT-TV": true, "IT-UD": true,
+ "IT-VA": true, "IT-VB": true, "IT-VC": true, "IT-VE": true, "IT-VI": true,
+ "IT-VR": true, "IT-VS": true, "IT-VT": true, "IT-VV": true, "JM-01": true,
+ "JM-02": true, "JM-03": true, "JM-04": true, "JM-05": true, "JM-06": true,
+ "JM-07": true, "JM-08": true, "JM-09": true, "JM-10": true, "JM-11": true,
+ "JM-12": true, "JM-13": true, "JM-14": true, "JO-AJ": true, "JO-AM": true,
+ "JO-AQ": true, "JO-AT": true, "JO-AZ": true, "JO-BA": true, "JO-IR": true,
+ "JO-JA": true, "JO-KA": true, "JO-MA": true, "JO-MD": true, "JO-MN": true,
+ "JP-01": true, "JP-02": true, "JP-03": true, "JP-04": true, "JP-05": true,
+ "JP-06": true, "JP-07": true, "JP-08": true, "JP-09": true, "JP-10": true,
+ "JP-11": true, "JP-12": true, "JP-13": true, "JP-14": true, "JP-15": true,
+ "JP-16": true, "JP-17": true, "JP-18": true, "JP-19": true, "JP-20": true,
+ "JP-21": true, "JP-22": true, "JP-23": true, "JP-24": true, "JP-25": true,
+ "JP-26": true, "JP-27": true, "JP-28": true, "JP-29": true, "JP-30": true,
+ "JP-31": true, "JP-32": true, "JP-33": true, "JP-34": true, "JP-35": true,
+ "JP-36": true, "JP-37": true, "JP-38": true, "JP-39": true, "JP-40": true,
+ "JP-41": true, "JP-42": true, "JP-43": true, "JP-44": true, "JP-45": true,
+ "JP-46": true, "JP-47": true, "KE-01": true, "KE-02": true, "KE-03": true,
+ "KE-04": true, "KE-05": true, "KE-06": true, "KE-07": true, "KE-08": true,
+ "KE-09": true, "KE-10": true, "KE-11": true, "KE-12": true, "KE-13": true,
+ "KE-14": true, "KE-15": true, "KE-16": true, "KE-17": true, "KE-18": true,
+ "KE-19": true, "KE-20": true, "KE-21": true, "KE-22": true, "KE-23": true,
+ "KE-24": true, "KE-25": true, "KE-26": true, "KE-27": true, "KE-28": true,
+ "KE-29": true, "KE-30": true, "KE-31": true, "KE-32": true, "KE-33": true,
+ "KE-34": true, "KE-35": true, "KE-36": true, "KE-37": true, "KE-38": true,
+ "KE-39": true, "KE-40": true, "KE-41": true, "KE-42": true, "KE-43": true,
+ "KE-44": true, "KE-45": true, "KE-46": true, "KE-47": true, "KG-B": true,
+ "KG-C": true, "KG-GB": true, "KG-GO": true, "KG-J": true, "KG-N": true, "KG-O": true,
+ "KG-T": true, "KG-Y": true, "KH-1": true, "KH-10": true, "KH-11": true,
+ "KH-12": true, "KH-13": true, "KH-14": true, "KH-15": true, "KH-16": true,
+ "KH-17": true, "KH-18": true, "KH-19": true, "KH-2": true, "KH-20": true,
+ "KH-21": true, "KH-22": true, "KH-23": true, "KH-24": true, "KH-3": true,
+ "KH-4": true, "KH-5": true, "KH-6": true, "KH-7": true, "KH-8": true,
+ "KH-9": true, "KI-G": true, "KI-L": true, "KI-P": true, "KM-A": true,
+ "KM-G": true, "KM-M": true, "KN-01": true, "KN-02": true, "KN-03": true,
+ "KN-04": true, "KN-05": true, "KN-06": true, "KN-07": true, "KN-08": true,
+ "KN-09": true, "KN-10": true, "KN-11": true, "KN-12": true, "KN-13": true,
+ "KN-15": true, "KN-K": true, "KN-N": true, "KP-01": true, "KP-02": true,
+ "KP-03": true, "KP-04": true, "KP-05": true, "KP-06": true, "KP-07": true,
+ "KP-08": true, "KP-09": true, "KP-10": true, "KP-13": true, "KR-11": true,
+ "KR-26": true, "KR-27": true, "KR-28": true, "KR-29": true, "KR-30": true,
+ "KR-31": true, "KR-41": true, "KR-42": true, "KR-43": true, "KR-44": true,
+ "KR-45": true, "KR-46": true, "KR-47": true, "KR-48": true, "KR-49": true,
+ "KW-AH": true, "KW-FA": true, "KW-HA": true, "KW-JA": true, "KW-KU": true,
+ "KW-MU": true, "KZ-10": true, "KZ-75": true, "KZ-19": true, "KZ-11": true,
+ "KZ-15": true, "KZ-71": true, "KZ-23": true, "KZ-27": true, "KZ-47": true,
+ "KZ-55": true, "KZ-35": true, "KZ-39": true, "KZ-43": true, "KZ-63": true,
+ "KZ-79": true, "KZ-59": true, "KZ-61": true, "KZ-62": true, "KZ-31": true,
+ "KZ-33": true, "LA-AT": true, "LA-BK": true, "LA-BL": true,
+ "LA-CH": true, "LA-HO": true, "LA-KH": true, "LA-LM": true, "LA-LP": true,
+ "LA-OU": true, "LA-PH": true, "LA-SL": true, "LA-SV": true, "LA-VI": true,
+ "LA-VT": true, "LA-XA": true, "LA-XE": true, "LA-XI": true, "LA-XS": true,
+ "LB-AK": true, "LB-AS": true, "LB-BA": true, "LB-BH": true, "LB-BI": true,
+ "LB-JA": true, "LB-JL": true, "LB-NA": true, "LC-01": true, "LC-02": true,
+ "LC-03": true, "LC-05": true, "LC-06": true, "LC-07": true, "LC-08": true,
+ "LC-10": true, "LC-11": true, "LI-01": true, "LI-02": true,
+ "LI-03": true, "LI-04": true, "LI-05": true, "LI-06": true, "LI-07": true,
+ "LI-08": true, "LI-09": true, "LI-10": true, "LI-11": true, "LK-1": true,
+ "LK-11": true, "LK-12": true, "LK-13": true, "LK-2": true, "LK-21": true,
+ "LK-22": true, "LK-23": true, "LK-3": true, "LK-31": true, "LK-32": true,
+ "LK-33": true, "LK-4": true, "LK-41": true, "LK-42": true, "LK-43": true,
+ "LK-44": true, "LK-45": true, "LK-5": true, "LK-51": true, "LK-52": true,
+ "LK-53": true, "LK-6": true, "LK-61": true, "LK-62": true, "LK-7": true,
+ "LK-71": true, "LK-72": true, "LK-8": true, "LK-81": true, "LK-82": true,
+ "LK-9": true, "LK-91": true, "LK-92": true, "LR-BG": true, "LR-BM": true,
+ "LR-CM": true, "LR-GB": true, "LR-GG": true, "LR-GK": true, "LR-LO": true,
+ "LR-MG": true, "LR-MO": true, "LR-MY": true, "LR-NI": true, "LR-RI": true,
+ "LR-SI": true, "LS-A": true, "LS-B": true, "LS-C": true, "LS-D": true,
+ "LS-E": true, "LS-F": true, "LS-G": true, "LS-H": true, "LS-J": true,
+ "LS-K": true, "LT-AL": true, "LT-KL": true, "LT-KU": true, "LT-MR": true,
+ "LT-PN": true, "LT-SA": true, "LT-TA": true, "LT-TE": true, "LT-UT": true,
+ "LT-VL": true, "LU-CA": true, "LU-CL": true, "LU-DI": true, "LU-EC": true,
+ "LU-ES": true, "LU-GR": true, "LU-LU": true, "LU-ME": true, "LU-RD": true,
+ "LU-RM": true, "LU-VD": true, "LU-WI": true, "LU-D": true, "LU-G": true, "LU-L": true,
+ "LV-001": true, "LV-111": true, "LV-112": true, "LV-113": true,
+ "LV-002": true, "LV-003": true, "LV-004": true, "LV-005": true, "LV-006": true,
+ "LV-007": true, "LV-008": true, "LV-009": true, "LV-010": true, "LV-011": true,
+ "LV-012": true, "LV-013": true, "LV-014": true, "LV-015": true, "LV-016": true,
+ "LV-017": true, "LV-018": true, "LV-019": true, "LV-020": true, "LV-021": true,
+ "LV-022": true, "LV-023": true, "LV-024": true, "LV-025": true, "LV-026": true,
+ "LV-027": true, "LV-028": true, "LV-029": true, "LV-030": true, "LV-031": true,
+ "LV-032": true, "LV-033": true, "LV-034": true, "LV-035": true, "LV-036": true,
+ "LV-037": true, "LV-038": true, "LV-039": true, "LV-040": true, "LV-041": true,
+ "LV-042": true, "LV-043": true, "LV-044": true, "LV-045": true, "LV-046": true,
+ "LV-047": true, "LV-048": true, "LV-049": true, "LV-050": true, "LV-051": true,
+ "LV-052": true, "LV-053": true, "LV-054": true, "LV-055": true, "LV-056": true,
+ "LV-057": true, "LV-058": true, "LV-059": true, "LV-060": true, "LV-061": true,
+ "LV-062": true, "LV-063": true, "LV-064": true, "LV-065": true, "LV-066": true,
+ "LV-067": true, "LV-068": true, "LV-069": true, "LV-070": true, "LV-071": true,
+ "LV-072": true, "LV-073": true, "LV-074": true, "LV-075": true, "LV-076": true,
+ "LV-077": true, "LV-078": true, "LV-079": true, "LV-080": true, "LV-081": true,
+ "LV-082": true, "LV-083": true, "LV-084": true, "LV-085": true, "LV-086": true,
+ "LV-087": true, "LV-088": true, "LV-089": true, "LV-090": true, "LV-091": true,
+ "LV-092": true, "LV-093": true, "LV-094": true, "LV-095": true, "LV-096": true,
+ "LV-097": true, "LV-098": true, "LV-099": true, "LV-100": true, "LV-101": true,
+ "LV-102": true, "LV-103": true, "LV-104": true, "LV-105": true, "LV-106": true,
+ "LV-107": true, "LV-108": true, "LV-109": true, "LV-110": true, "LV-DGV": true,
+ "LV-JEL": true, "LV-JKB": true, "LV-JUR": true, "LV-LPX": true, "LV-REZ": true,
+ "LV-RIX": true, "LV-VEN": true, "LV-VMR": true, "LY-BA": true, "LY-BU": true,
+ "LY-DR": true, "LY-GT": true, "LY-JA": true, "LY-JB": true, "LY-JG": true,
+ "LY-JI": true, "LY-JU": true, "LY-KF": true, "LY-MB": true, "LY-MI": true,
+ "LY-MJ": true, "LY-MQ": true, "LY-NL": true, "LY-NQ": true, "LY-SB": true,
+ "LY-SR": true, "LY-TB": true, "LY-WA": true, "LY-WD": true, "LY-WS": true,
+ "LY-ZA": true, "MA-01": true, "MA-02": true, "MA-03": true, "MA-04": true,
+ "MA-05": true, "MA-06": true, "MA-07": true, "MA-08": true, "MA-09": true,
+ "MA-10": true, "MA-11": true, "MA-12": true, "MA-13": true, "MA-14": true,
+ "MA-15": true, "MA-16": true, "MA-AGD": true, "MA-AOU": true, "MA-ASZ": true,
+ "MA-AZI": true, "MA-BEM": true, "MA-BER": true, "MA-BES": true, "MA-BOD": true,
+ "MA-BOM": true, "MA-CAS": true, "MA-CHE": true, "MA-CHI": true, "MA-CHT": true,
+ "MA-ERR": true, "MA-ESI": true, "MA-ESM": true, "MA-FAH": true, "MA-FES": true,
+ "MA-FIG": true, "MA-GUE": true, "MA-HAJ": true, "MA-HAO": true, "MA-HOC": true,
+ "MA-IFR": true, "MA-INE": true, "MA-JDI": true, "MA-JRA": true, "MA-KEN": true,
+ "MA-KES": true, "MA-KHE": true, "MA-KHN": true, "MA-KHO": true, "MA-LAA": true,
+ "MA-LAR": true, "MA-MED": true, "MA-MEK": true, "MA-MMD": true, "MA-MMN": true,
+ "MA-MOH": true, "MA-MOU": true, "MA-NAD": true, "MA-NOU": true, "MA-OUA": true,
+ "MA-OUD": true, "MA-OUJ": true, "MA-RAB": true, "MA-SAF": true, "MA-SAL": true,
+ "MA-SEF": true, "MA-SET": true, "MA-SIK": true, "MA-SKH": true, "MA-SYB": true,
+ "MA-TAI": true, "MA-TAO": true, "MA-TAR": true, "MA-TAT": true, "MA-TAZ": true,
+ "MA-TET": true, "MA-TIZ": true, "MA-TNG": true, "MA-TNT": true, "MA-ZAG": true,
+ "MC-CL": true, "MC-CO": true, "MC-FO": true, "MC-GA": true, "MC-JE": true,
+ "MC-LA": true, "MC-MA": true, "MC-MC": true, "MC-MG": true, "MC-MO": true,
+ "MC-MU": true, "MC-PH": true, "MC-SD": true, "MC-SO": true, "MC-SP": true,
+ "MC-SR": true, "MC-VR": true, "MD-AN": true, "MD-BA": true, "MD-BD": true,
+ "MD-BR": true, "MD-BS": true, "MD-CA": true, "MD-CL": true, "MD-CM": true,
+ "MD-CR": true, "MD-CS": true, "MD-CT": true, "MD-CU": true, "MD-DO": true,
+ "MD-DR": true, "MD-DU": true, "MD-ED": true, "MD-FA": true, "MD-FL": true,
+ "MD-GA": true, "MD-GL": true, "MD-HI": true, "MD-IA": true, "MD-LE": true,
+ "MD-NI": true, "MD-OC": true, "MD-OR": true, "MD-RE": true, "MD-RI": true,
+ "MD-SD": true, "MD-SI": true, "MD-SN": true, "MD-SO": true, "MD-ST": true,
+ "MD-SV": true, "MD-TA": true, "MD-TE": true, "MD-UN": true, "ME-01": true,
+ "ME-02": true, "ME-03": true, "ME-04": true, "ME-05": true, "ME-06": true,
+ "ME-07": true, "ME-08": true, "ME-09": true, "ME-10": true, "ME-11": true,
+ "ME-12": true, "ME-13": true, "ME-14": true, "ME-15": true, "ME-16": true,
+ "ME-17": true, "ME-18": true, "ME-19": true, "ME-20": true, "ME-21": true, "ME-24": true,
+ "MG-A": true, "MG-D": true, "MG-F": true, "MG-M": true, "MG-T": true,
+ "MG-U": true, "MH-ALK": true, "MH-ALL": true, "MH-ARN": true, "MH-AUR": true,
+ "MH-EBO": true, "MH-ENI": true, "MH-JAB": true, "MH-JAL": true, "MH-KIL": true,
+ "MH-KWA": true, "MH-L": true, "MH-LAE": true, "MH-LIB": true, "MH-LIK": true,
+ "MH-MAJ": true, "MH-MAL": true, "MH-MEJ": true, "MH-MIL": true, "MH-NMK": true,
+ "MH-NMU": true, "MH-RON": true, "MH-T": true, "MH-UJA": true, "MH-UTI": true,
+ "MH-WTJ": true, "MH-WTN": true, "MK-101": true, "MK-102": true, "MK-103": true,
+ "MK-104": true, "MK-105": true,
+ "MK-106": true, "MK-107": true, "MK-108": true, "MK-109": true, "MK-201": true,
+ "MK-202": true, "MK-205": true, "MK-206": true, "MK-207": true, "MK-208": true,
+ "MK-209": true, "MK-210": true, "MK-211": true, "MK-301": true, "MK-303": true,
+ "MK-307": true, "MK-308": true, "MK-310": true, "MK-311": true, "MK-312": true,
+ "MK-401": true, "MK-402": true, "MK-403": true, "MK-404": true, "MK-405": true,
+ "MK-406": true, "MK-408": true, "MK-409": true, "MK-410": true, "MK-501": true,
+ "MK-502": true, "MK-503": true, "MK-505": true, "MK-506": true, "MK-507": true,
+ "MK-508": true, "MK-509": true, "MK-601": true, "MK-602": true, "MK-604": true,
+ "MK-605": true, "MK-606": true, "MK-607": true, "MK-608": true, "MK-609": true,
+ "MK-701": true, "MK-702": true, "MK-703": true, "MK-704": true, "MK-705": true,
+ "MK-803": true, "MK-804": true, "MK-806": true, "MK-807": true, "MK-809": true,
+ "MK-810": true, "MK-811": true, "MK-812": true, "MK-813": true, "MK-814": true,
+ "MK-816": true, "ML-1": true, "ML-2": true, "ML-3": true, "ML-4": true,
+ "ML-5": true, "ML-6": true, "ML-7": true, "ML-8": true, "ML-BKO": true,
+ "MM-01": true, "MM-02": true, "MM-03": true, "MM-04": true, "MM-05": true,
+ "MM-06": true, "MM-07": true, "MM-11": true, "MM-12": true, "MM-13": true,
+ "MM-14": true, "MM-15": true, "MM-16": true, "MM-17": true, "MM-18": true, "MN-035": true,
+ "MN-037": true, "MN-039": true, "MN-041": true, "MN-043": true, "MN-046": true,
+ "MN-047": true, "MN-049": true, "MN-051": true, "MN-053": true, "MN-055": true,
+ "MN-057": true, "MN-059": true, "MN-061": true, "MN-063": true, "MN-064": true,
+ "MN-065": true, "MN-067": true, "MN-069": true, "MN-071": true, "MN-073": true,
+ "MN-1": true, "MR-01": true, "MR-02": true, "MR-03": true, "MR-04": true,
+ "MR-05": true, "MR-06": true, "MR-07": true, "MR-08": true, "MR-09": true,
+ "MR-10": true, "MR-11": true, "MR-12": true, "MR-13": true, "MR-NKC": true, "MT-01": true,
+ "MT-02": true, "MT-03": true, "MT-04": true, "MT-05": true, "MT-06": true,
+ "MT-07": true, "MT-08": true, "MT-09": true, "MT-10": true, "MT-11": true,
+ "MT-12": true, "MT-13": true, "MT-14": true, "MT-15": true, "MT-16": true,
+ "MT-17": true, "MT-18": true, "MT-19": true, "MT-20": true, "MT-21": true,
+ "MT-22": true, "MT-23": true, "MT-24": true, "MT-25": true, "MT-26": true,
+ "MT-27": true, "MT-28": true, "MT-29": true, "MT-30": true, "MT-31": true,
+ "MT-32": true, "MT-33": true, "MT-34": true, "MT-35": true, "MT-36": true,
+ "MT-37": true, "MT-38": true, "MT-39": true, "MT-40": true, "MT-41": true,
+ "MT-42": true, "MT-43": true, "MT-44": true, "MT-45": true, "MT-46": true,
+ "MT-47": true, "MT-48": true, "MT-49": true, "MT-50": true, "MT-51": true,
+ "MT-52": true, "MT-53": true, "MT-54": true, "MT-55": true, "MT-56": true,
+ "MT-57": true, "MT-58": true, "MT-59": true, "MT-60": true, "MT-61": true,
+ "MT-62": true, "MT-63": true, "MT-64": true, "MT-65": true, "MT-66": true,
+ "MT-67": true, "MT-68": true, "MU-AG": true, "MU-BL": true, "MU-BR": true,
+ "MU-CC": true, "MU-CU": true, "MU-FL": true, "MU-GP": true, "MU-MO": true,
+ "MU-PA": true, "MU-PL": true, "MU-PU": true, "MU-PW": true, "MU-QB": true,
+ "MU-RO": true, "MU-RP": true, "MU-RR": true, "MU-SA": true, "MU-VP": true, "MV-00": true,
+ "MV-01": true, "MV-02": true, "MV-03": true, "MV-04": true, "MV-05": true,
+ "MV-07": true, "MV-08": true, "MV-12": true, "MV-13": true, "MV-14": true,
+ "MV-17": true, "MV-20": true, "MV-23": true, "MV-24": true, "MV-25": true,
+ "MV-26": true, "MV-27": true, "MV-28": true, "MV-29": true, "MV-CE": true,
+ "MV-MLE": true, "MV-NC": true, "MV-NO": true, "MV-SC": true, "MV-SU": true,
+ "MV-UN": true, "MV-US": true, "MW-BA": true, "MW-BL": true, "MW-C": true,
+ "MW-CK": true, "MW-CR": true, "MW-CT": true, "MW-DE": true, "MW-DO": true,
+ "MW-KR": true, "MW-KS": true, "MW-LI": true, "MW-LK": true, "MW-MC": true,
+ "MW-MG": true, "MW-MH": true, "MW-MU": true, "MW-MW": true, "MW-MZ": true,
+ "MW-N": true, "MW-NB": true, "MW-NE": true, "MW-NI": true, "MW-NK": true,
+ "MW-NS": true, "MW-NU": true, "MW-PH": true, "MW-RU": true, "MW-S": true,
+ "MW-SA": true, "MW-TH": true, "MW-ZO": true, "MX-AGU": true, "MX-BCN": true,
+ "MX-BCS": true, "MX-CAM": true, "MX-CHH": true, "MX-CHP": true, "MX-COA": true,
+ "MX-COL": true, "MX-CMX": true, "MX-DIF": true, "MX-DUR": true, "MX-GRO": true, "MX-GUA": true,
+ "MX-HID": true, "MX-JAL": true, "MX-MEX": true, "MX-MIC": true, "MX-MOR": true,
+ "MX-NAY": true, "MX-NLE": true, "MX-OAX": true, "MX-PUE": true, "MX-QUE": true,
+ "MX-ROO": true, "MX-SIN": true, "MX-SLP": true, "MX-SON": true, "MX-TAB": true,
+ "MX-TAM": true, "MX-TLA": true, "MX-VER": true, "MX-YUC": true, "MX-ZAC": true,
+ "MY-01": true, "MY-02": true, "MY-03": true, "MY-04": true, "MY-05": true,
+ "MY-06": true, "MY-07": true, "MY-08": true, "MY-09": true, "MY-10": true,
+ "MY-11": true, "MY-12": true, "MY-13": true, "MY-14": true, "MY-15": true,
+ "MY-16": true, "MZ-A": true, "MZ-B": true, "MZ-G": true, "MZ-I": true,
+ "MZ-L": true, "MZ-MPM": true, "MZ-N": true, "MZ-P": true, "MZ-Q": true,
+ "MZ-S": true, "MZ-T": true, "NA-CA": true, "NA-ER": true, "NA-HA": true,
+ "NA-KA": true, "NA-KE": true, "NA-KH": true, "NA-KU": true, "NA-KW": true, "NA-OD": true, "NA-OH": true,
+ "NA-OK": true, "NA-ON": true, "NA-OS": true, "NA-OT": true, "NA-OW": true,
+ "NE-1": true, "NE-2": true, "NE-3": true, "NE-4": true, "NE-5": true,
+ "NE-6": true, "NE-7": true, "NE-8": true, "NG-AB": true, "NG-AD": true,
+ "NG-AK": true, "NG-AN": true, "NG-BA": true, "NG-BE": true, "NG-BO": true,
+ "NG-BY": true, "NG-CR": true, "NG-DE": true, "NG-EB": true, "NG-ED": true,
+ "NG-EK": true, "NG-EN": true, "NG-FC": true, "NG-GO": true, "NG-IM": true,
+ "NG-JI": true, "NG-KD": true, "NG-KE": true, "NG-KN": true, "NG-KO": true,
+ "NG-KT": true, "NG-KW": true, "NG-LA": true, "NG-NA": true, "NG-NI": true,
+ "NG-OG": true, "NG-ON": true, "NG-OS": true, "NG-OY": true, "NG-PL": true,
+ "NG-RI": true, "NG-SO": true, "NG-TA": true, "NG-YO": true, "NG-ZA": true,
+ "NI-AN": true, "NI-AS": true, "NI-BO": true, "NI-CA": true, "NI-CI": true,
+ "NI-CO": true, "NI-ES": true, "NI-GR": true, "NI-JI": true, "NI-LE": true,
+ "NI-MD": true, "NI-MN": true, "NI-MS": true, "NI-MT": true, "NI-NS": true,
+ "NI-RI": true, "NI-SJ": true, "NL-AW": true, "NL-BQ1": true, "NL-BQ2": true,
+ "NL-BQ3": true, "NL-CW": true, "NL-DR": true, "NL-FL": true, "NL-FR": true,
+ "NL-GE": true, "NL-GR": true, "NL-LI": true, "NL-NB": true, "NL-NH": true,
+ "NL-OV": true, "NL-SX": true, "NL-UT": true, "NL-ZE": true, "NL-ZH": true,
+ "NO-03": true, "NO-11": true, "NO-15": true, "NO-16": true, "NO-17": true,
+ "NO-18": true, "NO-21": true, "NO-30": true, "NO-34": true, "NO-38": true,
+ "NO-42": true, "NO-46": true, "NO-50": true, "NO-54": true,
+ "NO-22": true, "NP-1": true, "NP-2": true, "NP-3": true, "NP-4": true,
+ "NP-5": true, "NP-BA": true, "NP-BH": true, "NP-DH": true, "NP-GA": true,
+ "NP-JA": true, "NP-KA": true, "NP-KO": true, "NP-LU": true, "NP-MA": true,
+ "NP-ME": true, "NP-NA": true, "NP-RA": true, "NP-SA": true, "NP-SE": true,
+ "NR-01": true, "NR-02": true, "NR-03": true, "NR-04": true, "NR-05": true,
+ "NR-06": true, "NR-07": true, "NR-08": true, "NR-09": true, "NR-10": true,
+ "NR-11": true, "NR-12": true, "NR-13": true, "NR-14": true, "NZ-AUK": true,
+ "NZ-BOP": true, "NZ-CAN": true, "NZ-CIT": true, "NZ-GIS": true, "NZ-HKB": true,
+ "NZ-MBH": true, "NZ-MWT": true, "NZ-N": true, "NZ-NSN": true, "NZ-NTL": true,
+ "NZ-OTA": true, "NZ-S": true, "NZ-STL": true, "NZ-TAS": true, "NZ-TKI": true,
+ "NZ-WGN": true, "NZ-WKO": true, "NZ-WTC": true, "OM-BA": true, "OM-BS": true, "OM-BU": true, "OM-BJ": true,
+ "OM-DA": true, "OM-MA": true, "OM-MU": true, "OM-SH": true, "OM-SJ": true, "OM-SS": true, "OM-WU": true,
+ "OM-ZA": true, "OM-ZU": true, "PA-1": true, "PA-2": true, "PA-3": true,
+ "PA-4": true, "PA-5": true, "PA-6": true, "PA-7": true, "PA-8": true,
+ "PA-9": true, "PA-EM": true, "PA-KY": true, "PA-NB": true, "PE-AMA": true,
+ "PE-ANC": true, "PE-APU": true, "PE-ARE": true, "PE-AYA": true, "PE-CAJ": true,
+ "PE-CAL": true, "PE-CUS": true, "PE-HUC": true, "PE-HUV": true, "PE-ICA": true,
+ "PE-JUN": true, "PE-LAL": true, "PE-LAM": true, "PE-LIM": true, "PE-LMA": true,
+ "PE-LOR": true, "PE-MDD": true, "PE-MOQ": true, "PE-PAS": true, "PE-PIU": true,
+ "PE-PUN": true, "PE-SAM": true, "PE-TAC": true, "PE-TUM": true, "PE-UCA": true,
+ "PG-CPK": true, "PG-CPM": true, "PG-EBR": true, "PG-EHG": true, "PG-EPW": true,
+ "PG-ESW": true, "PG-GPK": true, "PG-MBA": true, "PG-MPL": true, "PG-MPM": true,
+ "PG-MRL": true, "PG-NCD": true, "PG-NIK": true, "PG-NPP": true, "PG-NSB": true,
+ "PG-SAN": true, "PG-SHM": true, "PG-WBK": true, "PG-WHM": true, "PG-WPD": true,
+ "PH-00": true, "PH-01": true, "PH-02": true, "PH-03": true, "PH-05": true,
+ "PH-06": true, "PH-07": true, "PH-08": true, "PH-09": true, "PH-10": true,
+ "PH-11": true, "PH-12": true, "PH-13": true, "PH-14": true, "PH-15": true,
+ "PH-40": true, "PH-41": true, "PH-ABR": true, "PH-AGN": true, "PH-AGS": true,
+ "PH-AKL": true, "PH-ALB": true, "PH-ANT": true, "PH-APA": true, "PH-AUR": true,
+ "PH-BAN": true, "PH-BAS": true, "PH-BEN": true, "PH-BIL": true, "PH-BOH": true,
+ "PH-BTG": true, "PH-BTN": true, "PH-BUK": true, "PH-BUL": true, "PH-CAG": true,
+ "PH-CAM": true, "PH-CAN": true, "PH-CAP": true, "PH-CAS": true, "PH-CAT": true,
+ "PH-CAV": true, "PH-CEB": true, "PH-COM": true, "PH-DAO": true, "PH-DAS": true,
+ "PH-DAV": true, "PH-DIN": true, "PH-EAS": true, "PH-GUI": true, "PH-IFU": true,
+ "PH-ILI": true, "PH-ILN": true, "PH-ILS": true, "PH-ISA": true, "PH-KAL": true,
+ "PH-LAG": true, "PH-LAN": true, "PH-LAS": true, "PH-LEY": true, "PH-LUN": true,
+ "PH-MAD": true, "PH-MAG": true, "PH-MAS": true, "PH-MDC": true, "PH-MDR": true,
+ "PH-MOU": true, "PH-MSC": true, "PH-MSR": true, "PH-NCO": true, "PH-NEC": true,
+ "PH-NER": true, "PH-NSA": true, "PH-NUE": true, "PH-NUV": true, "PH-PAM": true,
+ "PH-PAN": true, "PH-PLW": true, "PH-QUE": true, "PH-QUI": true, "PH-RIZ": true,
+ "PH-ROM": true, "PH-SAR": true, "PH-SCO": true, "PH-SIG": true, "PH-SLE": true,
+ "PH-SLU": true, "PH-SOR": true, "PH-SUK": true, "PH-SUN": true, "PH-SUR": true,
+ "PH-TAR": true, "PH-TAW": true, "PH-WSA": true, "PH-ZAN": true, "PH-ZAS": true,
+ "PH-ZMB": true, "PH-ZSI": true, "PK-BA": true, "PK-GB": true, "PK-IS": true,
+ "PK-JK": true, "PK-KP": true, "PK-PB": true, "PK-SD": true, "PK-TA": true,
+ "PL-02": true, "PL-04": true, "PL-06": true, "PL-08": true, "PL-10": true,
+ "PL-12": true, "PL-14": true, "PL-16": true, "PL-18": true, "PL-20": true,
+ "PL-22": true, "PL-24": true, "PL-26": true, "PL-28": true, "PL-30": true, "PL-32": true,
+ "PS-BTH": true, "PS-DEB": true, "PS-GZA": true, "PS-HBN": true,
+ "PS-JEM": true, "PS-JEN": true, "PS-JRH": true, "PS-KYS": true, "PS-NBS": true,
+ "PS-NGZ": true, "PS-QQA": true, "PS-RBH": true, "PS-RFH": true, "PS-SLT": true,
+ "PS-TBS": true, "PS-TKM": true, "PT-01": true, "PT-02": true, "PT-03": true,
+ "PT-04": true, "PT-05": true, "PT-06": true, "PT-07": true, "PT-08": true,
+ "PT-09": true, "PT-10": true, "PT-11": true, "PT-12": true, "PT-13": true,
+ "PT-14": true, "PT-15": true, "PT-16": true, "PT-17": true, "PT-18": true,
+ "PT-20": true, "PT-30": true, "PW-002": true, "PW-004": true, "PW-010": true,
+ "PW-050": true, "PW-100": true, "PW-150": true, "PW-212": true, "PW-214": true,
+ "PW-218": true, "PW-222": true, "PW-224": true, "PW-226": true, "PW-227": true,
+ "PW-228": true, "PW-350": true, "PW-370": true, "PY-1": true, "PY-10": true,
+ "PY-11": true, "PY-12": true, "PY-13": true, "PY-14": true, "PY-15": true,
+ "PY-16": true, "PY-19": true, "PY-2": true, "PY-3": true, "PY-4": true,
+ "PY-5": true, "PY-6": true, "PY-7": true, "PY-8": true, "PY-9": true,
+ "PY-ASU": true, "QA-DA": true, "QA-KH": true, "QA-MS": true, "QA-RA": true,
+ "QA-US": true, "QA-WA": true, "QA-ZA": true, "RO-AB": true, "RO-AG": true,
+ "RO-AR": true, "RO-B": true, "RO-BC": true, "RO-BH": true, "RO-BN": true,
+ "RO-BR": true, "RO-BT": true, "RO-BV": true, "RO-BZ": true, "RO-CJ": true,
+ "RO-CL": true, "RO-CS": true, "RO-CT": true, "RO-CV": true, "RO-DB": true,
+ "RO-DJ": true, "RO-GJ": true, "RO-GL": true, "RO-GR": true, "RO-HD": true,
+ "RO-HR": true, "RO-IF": true, "RO-IL": true, "RO-IS": true, "RO-MH": true,
+ "RO-MM": true, "RO-MS": true, "RO-NT": true, "RO-OT": true, "RO-PH": true,
+ "RO-SB": true, "RO-SJ": true, "RO-SM": true, "RO-SV": true, "RO-TL": true,
+ "RO-TM": true, "RO-TR": true, "RO-VL": true, "RO-VN": true, "RO-VS": true,
+ "RS-00": true, "RS-01": true, "RS-02": true, "RS-03": true, "RS-04": true,
+ "RS-05": true, "RS-06": true, "RS-07": true, "RS-08": true, "RS-09": true,
+ "RS-10": true, "RS-11": true, "RS-12": true, "RS-13": true, "RS-14": true,
+ "RS-15": true, "RS-16": true, "RS-17": true, "RS-18": true, "RS-19": true,
+ "RS-20": true, "RS-21": true, "RS-22": true, "RS-23": true, "RS-24": true,
+ "RS-25": true, "RS-26": true, "RS-27": true, "RS-28": true, "RS-29": true,
+ "RS-KM": true, "RS-VO": true, "RU-AD": true, "RU-AL": true, "RU-ALT": true,
+ "RU-AMU": true, "RU-ARK": true, "RU-AST": true, "RU-BA": true, "RU-BEL": true,
+ "RU-BRY": true, "RU-BU": true, "RU-CE": true, "RU-CHE": true, "RU-CHU": true,
+ "RU-CU": true, "RU-DA": true, "RU-IN": true, "RU-IRK": true, "RU-IVA": true,
+ "RU-KAM": true, "RU-KB": true, "RU-KC": true, "RU-KDA": true, "RU-KEM": true,
+ "RU-KGD": true, "RU-KGN": true, "RU-KHA": true, "RU-KHM": true, "RU-KIR": true,
+ "RU-KK": true, "RU-KL": true, "RU-KLU": true, "RU-KO": true, "RU-KOS": true,
+ "RU-KR": true, "RU-KRS": true, "RU-KYA": true, "RU-LEN": true, "RU-LIP": true,
+ "RU-MAG": true, "RU-ME": true, "RU-MO": true, "RU-MOS": true, "RU-MOW": true,
+ "RU-MUR": true, "RU-NEN": true, "RU-NGR": true, "RU-NIZ": true, "RU-NVS": true,
+ "RU-OMS": true, "RU-ORE": true, "RU-ORL": true, "RU-PER": true, "RU-PNZ": true,
+ "RU-PRI": true, "RU-PSK": true, "RU-ROS": true, "RU-RYA": true, "RU-SA": true,
+ "RU-SAK": true, "RU-SAM": true, "RU-SAR": true, "RU-SE": true, "RU-SMO": true,
+ "RU-SPE": true, "RU-STA": true, "RU-SVE": true, "RU-TA": true, "RU-TAM": true,
+ "RU-TOM": true, "RU-TUL": true, "RU-TVE": true, "RU-TY": true, "RU-TYU": true,
+ "RU-UD": true, "RU-ULY": true, "RU-VGG": true, "RU-VLA": true, "RU-VLG": true,
+ "RU-VOR": true, "RU-YAN": true, "RU-YAR": true, "RU-YEV": true, "RU-ZAB": true,
+ "RW-01": true, "RW-02": true, "RW-03": true, "RW-04": true, "RW-05": true,
+ "SA-01": true, "SA-02": true, "SA-03": true, "SA-04": true, "SA-05": true,
+ "SA-06": true, "SA-07": true, "SA-08": true, "SA-09": true, "SA-10": true,
+ "SA-11": true, "SA-12": true, "SA-14": true, "SB-CE": true, "SB-CH": true,
+ "SB-CT": true, "SB-GU": true, "SB-IS": true, "SB-MK": true, "SB-ML": true,
+ "SB-RB": true, "SB-TE": true, "SB-WE": true, "SC-01": true, "SC-02": true,
+ "SC-03": true, "SC-04": true, "SC-05": true, "SC-06": true, "SC-07": true,
+ "SC-08": true, "SC-09": true, "SC-10": true, "SC-11": true, "SC-12": true,
+ "SC-13": true, "SC-14": true, "SC-15": true, "SC-16": true, "SC-17": true,
+ "SC-18": true, "SC-19": true, "SC-20": true, "SC-21": true, "SC-22": true,
+ "SC-23": true, "SC-24": true, "SC-25": true, "SD-DC": true, "SD-DE": true,
+ "SD-DN": true, "SD-DS": true, "SD-DW": true, "SD-GD": true, "SD-GK": true, "SD-GZ": true,
+ "SD-KA": true, "SD-KH": true, "SD-KN": true, "SD-KS": true, "SD-NB": true,
+ "SD-NO": true, "SD-NR": true, "SD-NW": true, "SD-RS": true, "SD-SI": true,
+ "SE-AB": true, "SE-AC": true, "SE-BD": true, "SE-C": true, "SE-D": true,
+ "SE-E": true, "SE-F": true, "SE-G": true, "SE-H": true, "SE-I": true,
+ "SE-K": true, "SE-M": true, "SE-N": true, "SE-O": true, "SE-S": true,
+ "SE-T": true, "SE-U": true, "SE-W": true, "SE-X": true, "SE-Y": true,
+ "SE-Z": true, "SG-01": true, "SG-02": true, "SG-03": true, "SG-04": true,
+ "SG-05": true, "SH-AC": true, "SH-HL": true, "SH-TA": true, "SI-001": true,
+ "SI-002": true, "SI-003": true, "SI-004": true, "SI-005": true, "SI-006": true,
+ "SI-007": true, "SI-008": true, "SI-009": true, "SI-010": true, "SI-011": true,
+ "SI-012": true, "SI-013": true, "SI-014": true, "SI-015": true, "SI-016": true,
+ "SI-017": true, "SI-018": true, "SI-019": true, "SI-020": true, "SI-021": true,
+ "SI-022": true, "SI-023": true, "SI-024": true, "SI-025": true, "SI-026": true,
+ "SI-027": true, "SI-028": true, "SI-029": true, "SI-030": true, "SI-031": true,
+ "SI-032": true, "SI-033": true, "SI-034": true, "SI-035": true, "SI-036": true,
+ "SI-037": true, "SI-038": true, "SI-039": true, "SI-040": true, "SI-041": true,
+ "SI-042": true, "SI-043": true, "SI-044": true, "SI-045": true, "SI-046": true,
+ "SI-047": true, "SI-048": true, "SI-049": true, "SI-050": true, "SI-051": true,
+ "SI-052": true, "SI-053": true, "SI-054": true, "SI-055": true, "SI-056": true,
+ "SI-057": true, "SI-058": true, "SI-059": true, "SI-060": true, "SI-061": true,
+ "SI-062": true, "SI-063": true, "SI-064": true, "SI-065": true, "SI-066": true,
+ "SI-067": true, "SI-068": true, "SI-069": true, "SI-070": true, "SI-071": true,
+ "SI-072": true, "SI-073": true, "SI-074": true, "SI-075": true, "SI-076": true,
+ "SI-077": true, "SI-078": true, "SI-079": true, "SI-080": true, "SI-081": true,
+ "SI-082": true, "SI-083": true, "SI-084": true, "SI-085": true, "SI-086": true,
+ "SI-087": true, "SI-088": true, "SI-089": true, "SI-090": true, "SI-091": true,
+ "SI-092": true, "SI-093": true, "SI-094": true, "SI-095": true, "SI-096": true,
+ "SI-097": true, "SI-098": true, "SI-099": true, "SI-100": true, "SI-101": true,
+ "SI-102": true, "SI-103": true, "SI-104": true, "SI-105": true, "SI-106": true,
+ "SI-107": true, "SI-108": true, "SI-109": true, "SI-110": true, "SI-111": true,
+ "SI-112": true, "SI-113": true, "SI-114": true, "SI-115": true, "SI-116": true,
+ "SI-117": true, "SI-118": true, "SI-119": true, "SI-120": true, "SI-121": true,
+ "SI-122": true, "SI-123": true, "SI-124": true, "SI-125": true, "SI-126": true,
+ "SI-127": true, "SI-128": true, "SI-129": true, "SI-130": true, "SI-131": true,
+ "SI-132": true, "SI-133": true, "SI-134": true, "SI-135": true, "SI-136": true,
+ "SI-137": true, "SI-138": true, "SI-139": true, "SI-140": true, "SI-141": true,
+ "SI-142": true, "SI-143": true, "SI-144": true, "SI-146": true, "SI-147": true,
+ "SI-148": true, "SI-149": true, "SI-150": true, "SI-151": true, "SI-152": true,
+ "SI-153": true, "SI-154": true, "SI-155": true, "SI-156": true, "SI-157": true,
+ "SI-158": true, "SI-159": true, "SI-160": true, "SI-161": true, "SI-162": true,
+ "SI-163": true, "SI-164": true, "SI-165": true, "SI-166": true, "SI-167": true,
+ "SI-168": true, "SI-169": true, "SI-170": true, "SI-171": true, "SI-172": true,
+ "SI-173": true, "SI-174": true, "SI-175": true, "SI-176": true, "SI-177": true,
+ "SI-178": true, "SI-179": true, "SI-180": true, "SI-181": true, "SI-182": true,
+ "SI-183": true, "SI-184": true, "SI-185": true, "SI-186": true, "SI-187": true,
+ "SI-188": true, "SI-189": true, "SI-190": true, "SI-191": true, "SI-192": true,
+ "SI-193": true, "SI-194": true, "SI-195": true, "SI-196": true, "SI-197": true,
+ "SI-198": true, "SI-199": true, "SI-200": true, "SI-201": true, "SI-202": true,
+ "SI-203": true, "SI-204": true, "SI-205": true, "SI-206": true, "SI-207": true,
+ "SI-208": true, "SI-209": true, "SI-210": true, "SI-211": true, "SI-212": true, "SI-213": true, "SK-BC": true,
+ "SK-BL": true, "SK-KI": true, "SK-NI": true, "SK-PV": true, "SK-TA": true,
+ "SK-TC": true, "SK-ZI": true, "SL-E": true, "SL-N": true, "SL-S": true,
+ "SL-W": true, "SM-01": true, "SM-02": true, "SM-03": true, "SM-04": true,
+ "SM-05": true, "SM-06": true, "SM-07": true, "SM-08": true, "SM-09": true,
+ "SN-DB": true, "SN-DK": true, "SN-FK": true, "SN-KA": true, "SN-KD": true,
+ "SN-KE": true, "SN-KL": true, "SN-LG": true, "SN-MT": true, "SN-SE": true,
+ "SN-SL": true, "SN-TC": true, "SN-TH": true, "SN-ZG": true, "SO-AW": true,
+ "SO-BK": true, "SO-BN": true, "SO-BR": true, "SO-BY": true, "SO-GA": true,
+ "SO-GE": true, "SO-HI": true, "SO-JD": true, "SO-JH": true, "SO-MU": true,
+ "SO-NU": true, "SO-SA": true, "SO-SD": true, "SO-SH": true, "SO-SO": true,
+ "SO-TO": true, "SO-WO": true, "SR-BR": true, "SR-CM": true, "SR-CR": true,
+ "SR-MA": true, "SR-NI": true, "SR-PM": true, "SR-PR": true, "SR-SA": true,
+ "SR-SI": true, "SR-WA": true, "SS-BN": true, "SS-BW": true, "SS-EC": true,
+ "SS-EE8": true, "SS-EE": true, "SS-EW": true, "SS-JG": true, "SS-LK": true, "SS-NU": true,
+ "SS-UY": true, "SS-WR": true, "ST-01": true, "ST-P": true, "ST-S": true, "SV-AH": true,
+ "SV-CA": true, "SV-CH": true, "SV-CU": true, "SV-LI": true, "SV-MO": true,
+ "SV-PA": true, "SV-SA": true, "SV-SM": true, "SV-SO": true, "SV-SS": true,
+ "SV-SV": true, "SV-UN": true, "SV-US": true, "SY-DI": true, "SY-DR": true,
+ "SY-DY": true, "SY-HA": true, "SY-HI": true, "SY-HL": true, "SY-HM": true,
+ "SY-ID": true, "SY-LA": true, "SY-QU": true, "SY-RA": true, "SY-RD": true,
+ "SY-SU": true, "SY-TA": true, "SZ-HH": true, "SZ-LU": true, "SZ-MA": true,
+ "SZ-SH": true, "TD-BA": true, "TD-BG": true, "TD-BO": true, "TD-CB": true,
+ "TD-EN": true, "TD-GR": true, "TD-HL": true, "TD-KA": true, "TD-LC": true,
+ "TD-LO": true, "TD-LR": true, "TD-MA": true, "TD-MC": true, "TD-ME": true,
+ "TD-MO": true, "TD-ND": true, "TD-OD": true, "TD-SA": true, "TD-SI": true,
+ "TD-TA": true, "TD-TI": true, "TD-WF": true, "TG-C": true, "TG-K": true,
+ "TG-M": true, "TG-P": true, "TG-S": true, "TH-10": true, "TH-11": true,
+ "TH-12": true, "TH-13": true, "TH-14": true, "TH-15": true, "TH-16": true,
+ "TH-17": true, "TH-18": true, "TH-19": true, "TH-20": true, "TH-21": true,
+ "TH-22": true, "TH-23": true, "TH-24": true, "TH-25": true, "TH-26": true,
+ "TH-27": true, "TH-30": true, "TH-31": true, "TH-32": true, "TH-33": true,
+ "TH-34": true, "TH-35": true, "TH-36": true, "TH-37": true, "TH-38": true, "TH-39": true,
+ "TH-40": true, "TH-41": true, "TH-42": true, "TH-43": true, "TH-44": true,
+ "TH-45": true, "TH-46": true, "TH-47": true, "TH-48": true, "TH-49": true,
+ "TH-50": true, "TH-51": true, "TH-52": true, "TH-53": true, "TH-54": true,
+ "TH-55": true, "TH-56": true, "TH-57": true, "TH-58": true, "TH-60": true,
+ "TH-61": true, "TH-62": true, "TH-63": true, "TH-64": true, "TH-65": true,
+ "TH-66": true, "TH-67": true, "TH-70": true, "TH-71": true, "TH-72": true,
+ "TH-73": true, "TH-74": true, "TH-75": true, "TH-76": true, "TH-77": true,
+ "TH-80": true, "TH-81": true, "TH-82": true, "TH-83": true, "TH-84": true,
+ "TH-85": true, "TH-86": true, "TH-90": true, "TH-91": true, "TH-92": true,
+ "TH-93": true, "TH-94": true, "TH-95": true, "TH-96": true, "TH-S": true,
+ "TJ-GB": true, "TJ-KT": true, "TJ-SU": true, "TJ-DU": true, "TJ-RA": true, "TL-AL": true, "TL-AN": true,
+ "TL-BA": true, "TL-BO": true, "TL-CO": true, "TL-DI": true, "TL-ER": true,
+ "TL-LA": true, "TL-LI": true, "TL-MF": true, "TL-MT": true, "TL-OE": true,
+ "TL-VI": true, "TM-A": true, "TM-B": true, "TM-D": true, "TM-L": true,
+ "TM-M": true, "TM-S": true, "TN-11": true, "TN-12": true, "TN-13": true,
+ "TN-14": true, "TN-21": true, "TN-22": true, "TN-23": true, "TN-31": true,
+ "TN-32": true, "TN-33": true, "TN-34": true, "TN-41": true, "TN-42": true,
+ "TN-43": true, "TN-51": true, "TN-52": true, "TN-53": true, "TN-61": true,
+ "TN-71": true, "TN-72": true, "TN-73": true, "TN-81": true, "TN-82": true,
+ "TN-83": true, "TO-01": true, "TO-02": true, "TO-03": true, "TO-04": true,
+ "TO-05": true, "TR-01": true, "TR-02": true, "TR-03": true, "TR-04": true,
+ "TR-05": true, "TR-06": true, "TR-07": true, "TR-08": true, "TR-09": true,
+ "TR-10": true, "TR-11": true, "TR-12": true, "TR-13": true, "TR-14": true,
+ "TR-15": true, "TR-16": true, "TR-17": true, "TR-18": true, "TR-19": true,
+ "TR-20": true, "TR-21": true, "TR-22": true, "TR-23": true, "TR-24": true,
+ "TR-25": true, "TR-26": true, "TR-27": true, "TR-28": true, "TR-29": true,
+ "TR-30": true, "TR-31": true, "TR-32": true, "TR-33": true, "TR-34": true,
+ "TR-35": true, "TR-36": true, "TR-37": true, "TR-38": true, "TR-39": true,
+ "TR-40": true, "TR-41": true, "TR-42": true, "TR-43": true, "TR-44": true,
+ "TR-45": true, "TR-46": true, "TR-47": true, "TR-48": true, "TR-49": true,
+ "TR-50": true, "TR-51": true, "TR-52": true, "TR-53": true, "TR-54": true,
+ "TR-55": true, "TR-56": true, "TR-57": true, "TR-58": true, "TR-59": true,
+ "TR-60": true, "TR-61": true, "TR-62": true, "TR-63": true, "TR-64": true,
+ "TR-65": true, "TR-66": true, "TR-67": true, "TR-68": true, "TR-69": true,
+ "TR-70": true, "TR-71": true, "TR-72": true, "TR-73": true, "TR-74": true,
+ "TR-75": true, "TR-76": true, "TR-77": true, "TR-78": true, "TR-79": true,
+ "TR-80": true, "TR-81": true, "TT-ARI": true, "TT-CHA": true, "TT-CTT": true,
+ "TT-DMN": true, "TT-ETO": true, "TT-MRC": true, "TT-TOB": true, "TT-PED": true, "TT-POS": true, "TT-PRT": true,
+ "TT-PTF": true, "TT-RCM": true, "TT-SFO": true, "TT-SGE": true, "TT-SIP": true,
+ "TT-SJL": true, "TT-TUP": true, "TT-WTO": true, "TV-FUN": true, "TV-NIT": true,
+ "TV-NKF": true, "TV-NKL": true, "TV-NMA": true, "TV-NMG": true, "TV-NUI": true,
+ "TV-VAI": true, "TW-CHA": true, "TW-CYI": true, "TW-CYQ": true, "TW-KIN": true, "TW-HSQ": true,
+ "TW-HSZ": true, "TW-HUA": true, "TW-LIE": true, "TW-ILA": true, "TW-KEE": true, "TW-KHH": true,
+ "TW-KHQ": true, "TW-MIA": true, "TW-NAN": true, "TW-NWT": true, "TW-PEN": true, "TW-PIF": true,
+ "TW-TAO": true, "TW-TNN": true, "TW-TNQ": true, "TW-TPE": true, "TW-TPQ": true,
+ "TW-TTT": true, "TW-TXG": true, "TW-TXQ": true, "TW-YUN": true, "TZ-01": true,
+ "TZ-02": true, "TZ-03": true, "TZ-04": true, "TZ-05": true, "TZ-06": true,
+ "TZ-07": true, "TZ-08": true, "TZ-09": true, "TZ-10": true, "TZ-11": true,
+ "TZ-12": true, "TZ-13": true, "TZ-14": true, "TZ-15": true, "TZ-16": true,
+ "TZ-17": true, "TZ-18": true, "TZ-19": true, "TZ-20": true, "TZ-21": true,
+ "TZ-22": true, "TZ-23": true, "TZ-24": true, "TZ-25": true, "TZ-26": true, "TZ-27": true, "TZ-28": true, "TZ-29": true, "TZ-30": true, "TZ-31": true,
+ "UA-05": true, "UA-07": true, "UA-09": true, "UA-12": true, "UA-14": true,
+ "UA-18": true, "UA-21": true, "UA-23": true, "UA-26": true, "UA-30": true,
+ "UA-32": true, "UA-35": true, "UA-40": true, "UA-43": true, "UA-46": true,
+ "UA-48": true, "UA-51": true, "UA-53": true, "UA-56": true, "UA-59": true,
+ "UA-61": true, "UA-63": true, "UA-65": true, "UA-68": true, "UA-71": true,
+ "UA-74": true, "UA-77": true, "UG-101": true, "UG-102": true, "UG-103": true,
+ "UG-104": true, "UG-105": true, "UG-106": true, "UG-107": true, "UG-108": true,
+ "UG-109": true, "UG-110": true, "UG-111": true, "UG-112": true, "UG-113": true,
+ "UG-114": true, "UG-115": true, "UG-116": true, "UG-201": true, "UG-202": true,
+ "UG-203": true, "UG-204": true, "UG-205": true, "UG-206": true, "UG-207": true,
+ "UG-208": true, "UG-209": true, "UG-210": true, "UG-211": true, "UG-212": true,
+ "UG-213": true, "UG-214": true, "UG-215": true, "UG-216": true, "UG-217": true,
+ "UG-218": true, "UG-219": true, "UG-220": true, "UG-221": true, "UG-222": true,
+ "UG-223": true, "UG-224": true, "UG-301": true, "UG-302": true, "UG-303": true,
+ "UG-304": true, "UG-305": true, "UG-306": true, "UG-307": true, "UG-308": true,
+ "UG-309": true, "UG-310": true, "UG-311": true, "UG-312": true, "UG-313": true,
+ "UG-314": true, "UG-315": true, "UG-316": true, "UG-317": true, "UG-318": true,
+ "UG-319": true, "UG-320": true, "UG-321": true, "UG-401": true, "UG-402": true,
+ "UG-403": true, "UG-404": true, "UG-405": true, "UG-406": true, "UG-407": true,
+ "UG-408": true, "UG-409": true, "UG-410": true, "UG-411": true, "UG-412": true,
+ "UG-413": true, "UG-414": true, "UG-415": true, "UG-416": true, "UG-417": true,
+ "UG-418": true, "UG-419": true, "UG-C": true, "UG-E": true, "UG-N": true,
+ "UG-W": true, "UG-322": true, "UG-323": true, "UG-420": true, "UG-117": true,
+ "UG-118": true, "UG-225": true, "UG-120": true, "UG-226": true,
+ "UG-121": true, "UG-122": true, "UG-227": true, "UG-421": true,
+ "UG-325": true, "UG-228": true, "UG-123": true, "UG-422": true,
+ "UG-326": true, "UG-229": true, "UG-124": true, "UG-423": true,
+ "UG-230": true, "UG-327": true, "UG-424": true, "UG-328": true,
+ "UG-425": true, "UG-426": true, "UG-330": true,
+ "UM-67": true, "UM-71": true, "UM-76": true, "UM-79": true,
+ "UM-81": true, "UM-84": true, "UM-86": true, "UM-89": true, "UM-95": true,
+ "US-AK": true, "US-AL": true, "US-AR": true, "US-AS": true, "US-AZ": true,
+ "US-CA": true, "US-CO": true, "US-CT": true, "US-DC": true, "US-DE": true,
+ "US-FL": true, "US-GA": true, "US-GU": true, "US-HI": true, "US-IA": true,
+ "US-ID": true, "US-IL": true, "US-IN": true, "US-KS": true, "US-KY": true,
+ "US-LA": true, "US-MA": true, "US-MD": true, "US-ME": true, "US-MI": true,
+ "US-MN": true, "US-MO": true, "US-MP": true, "US-MS": true, "US-MT": true,
+ "US-NC": true, "US-ND": true, "US-NE": true, "US-NH": true, "US-NJ": true,
+ "US-NM": true, "US-NV": true, "US-NY": true, "US-OH": true, "US-OK": true,
+ "US-OR": true, "US-PA": true, "US-PR": true, "US-RI": true, "US-SC": true,
+ "US-SD": true, "US-TN": true, "US-TX": true, "US-UM": true, "US-UT": true,
+ "US-VA": true, "US-VI": true, "US-VT": true, "US-WA": true, "US-WI": true,
+ "US-WV": true, "US-WY": true, "UY-AR": true, "UY-CA": true, "UY-CL": true,
+ "UY-CO": true, "UY-DU": true, "UY-FD": true, "UY-FS": true, "UY-LA": true,
+ "UY-MA": true, "UY-MO": true, "UY-PA": true, "UY-RN": true, "UY-RO": true,
+ "UY-RV": true, "UY-SA": true, "UY-SJ": true, "UY-SO": true, "UY-TA": true,
+ "UY-TT": true, "UZ-AN": true, "UZ-BU": true, "UZ-FA": true, "UZ-JI": true,
+ "UZ-NG": true, "UZ-NW": true, "UZ-QA": true, "UZ-QR": true, "UZ-SA": true,
+ "UZ-SI": true, "UZ-SU": true, "UZ-TK": true, "UZ-TO": true, "UZ-XO": true,
+ "VC-01": true, "VC-02": true, "VC-03": true, "VC-04": true, "VC-05": true,
+ "VC-06": true, "VE-A": true, "VE-B": true, "VE-C": true, "VE-D": true,
+ "VE-E": true, "VE-F": true, "VE-G": true, "VE-H": true, "VE-I": true,
+ "VE-J": true, "VE-K": true, "VE-L": true, "VE-M": true, "VE-N": true,
+ "VE-O": true, "VE-P": true, "VE-R": true, "VE-S": true, "VE-T": true,
+ "VE-U": true, "VE-V": true, "VE-W": true, "VE-X": true, "VE-Y": true,
+ "VE-Z": true, "VN-01": true, "VN-02": true, "VN-03": true, "VN-04": true,
+ "VN-05": true, "VN-06": true, "VN-07": true, "VN-09": true, "VN-13": true,
+ "VN-14": true, "VN-15": true, "VN-18": true, "VN-20": true, "VN-21": true,
+ "VN-22": true, "VN-23": true, "VN-24": true, "VN-25": true, "VN-26": true,
+ "VN-27": true, "VN-28": true, "VN-29": true, "VN-30": true, "VN-31": true,
+ "VN-32": true, "VN-33": true, "VN-34": true, "VN-35": true, "VN-36": true,
+ "VN-37": true, "VN-39": true, "VN-40": true, "VN-41": true, "VN-43": true,
+ "VN-44": true, "VN-45": true, "VN-46": true, "VN-47": true, "VN-49": true,
+ "VN-50": true, "VN-51": true, "VN-52": true, "VN-53": true, "VN-54": true,
+ "VN-55": true, "VN-56": true, "VN-57": true, "VN-58": true, "VN-59": true,
+ "VN-61": true, "VN-63": true, "VN-66": true, "VN-67": true, "VN-68": true,
+ "VN-69": true, "VN-70": true, "VN-71": true, "VN-72": true, "VN-73": true,
+ "VN-CT": true, "VN-DN": true, "VN-HN": true, "VN-HP": true, "VN-SG": true,
+ "VU-MAP": true, "VU-PAM": true, "VU-SAM": true, "VU-SEE": true, "VU-TAE": true,
+ "VU-TOB": true, "WF-SG": true, "WF-UV": true, "WS-AA": true, "WS-AL": true, "WS-AT": true, "WS-FA": true,
+ "WS-GE": true, "WS-GI": true, "WS-PA": true, "WS-SA": true, "WS-TU": true,
+ "WS-VF": true, "WS-VS": true, "YE-AB": true, "YE-AD": true, "YE-AM": true,
+ "YE-BA": true, "YE-DA": true, "YE-DH": true, "YE-HD": true, "YE-HJ": true, "YE-HU": true,
+ "YE-IB": true, "YE-JA": true, "YE-LA": true, "YE-MA": true, "YE-MR": true,
+ "YE-MU": true, "YE-MW": true, "YE-RA": true, "YE-SA": true, "YE-SD": true, "YE-SH": true,
+ "YE-SN": true, "YE-TA": true, "ZA-EC": true, "ZA-FS": true, "ZA-GP": true,
+ "ZA-LP": true, "ZA-MP": true, "ZA-NC": true, "ZA-NW": true, "ZA-WC": true,
+ "ZA-ZN": true, "ZA-KZN": true, "ZM-01": true, "ZM-02": true, "ZM-03": true, "ZM-04": true,
+ "ZM-05": true, "ZM-06": true, "ZM-07": true, "ZM-08": true, "ZM-09": true, "ZM-10": true,
+ "ZW-BU": true, "ZW-HA": true, "ZW-MA": true, "ZW-MC": true, "ZW-ME": true,
+ "ZW-MI": true, "ZW-MN": true, "ZW-MS": true, "ZW-MV": true, "ZW-MW": true,
}
diff --git a/vendor/github.com/go-playground/validator/v10/doc.go b/vendor/github.com/go-playground/validator/v10/doc.go
index 8c2584792e..f5aa9e5230 100644
--- a/vendor/github.com/go-playground/validator/v10/doc.go
+++ b/vendor/github.com/go-playground/validator/v10/doc.go
@@ -7,7 +7,7 @@ and has the ability to dive into arrays and maps of any type.
see more examples https://github.com/go-playground/validator/tree/master/_examples
-Singleton
+# Singleton
Validator is designed to be thread-safe and used as a singleton instance.
It caches information about your struct and validations,
@@ -15,7 +15,7 @@ in essence only parsing your validation tags once per struct type.
Using multiple instances neglects the benefit of caching.
The not thread-safe functions are explicitly marked as such in the documentation.
-Validation Functions Return Type error
+# Validation Functions Return Type error
Doing things this way is actually the way the standard library does, see the
file.Open method here:
@@ -34,7 +34,7 @@ if the error returned is not nil, and if it's not check if error is
InvalidValidationError ( if necessary, most of the time it isn't ) type cast
it to type ValidationErrors like so err.(validator.ValidationErrors).
-Custom Validation Functions
+# Custom Validation Functions
Custom Validation functions can be added. Example:
@@ -52,21 +52,21 @@ Custom Validation functions can be added. Example:
// NOTES: using the same tag name as an existing function
// will overwrite the existing one
-Cross-Field Validation
+# Cross-Field Validation
Cross-Field Validation can be done via the following tags:
- - eqfield
- - nefield
- - gtfield
- - gtefield
- - ltfield
- - ltefield
- - eqcsfield
- - necsfield
- - gtcsfield
- - gtecsfield
- - ltcsfield
- - ltecsfield
+ - eqfield
+ - nefield
+ - gtfield
+ - gtefield
+ - ltfield
+ - ltefield
+ - eqcsfield
+ - necsfield
+ - gtcsfield
+ - gtecsfield
+ - ltcsfield
+ - ltecsfield
If, however, some custom cross-field validation is required, it can be done
using a custom validation.
@@ -106,7 +106,7 @@ used "eqcsfield" it could be multiple levels down. Example:
// whatever you pass, struct, field...
// when calling validate.Field(field, tag) val will be nil
-Multiple Validators
+# Multiple Validators
Multiple validators on a field will process in the order defined. Example:
@@ -124,7 +124,7 @@ Bad Validator definitions are not handled by the library. Example:
// this definition of min max will never succeed
-Using Validator Tags
+# Using Validator Tags
Baked In Cross-Field validation only compares fields on the same struct.
If Cross-Field + Cross-Struct validation is needed you should implement your
@@ -146,24 +146,22 @@ use the UTF-8 hex representation 0x7C, which is replaced in the code as a pipe,
so the above will become excludesall=0x7C
type Test struct {
- Field `validate:"excludesall=|"` // BAD! Do not include a a pipe!
+ Field `validate:"excludesall=|"` // BAD! Do not include a pipe!
Field `validate:"excludesall=0x7C"` // GOOD! Use the UTF-8 hex representation.
}
-
-Baked In Validators and Tags
+# Baked In Validators and Tags
Here is a list of the current built in validators:
-
-Skip Field
+# Skip Field
Tells the validation to skip this struct field; this is particularly
handy in ignoring embedded structs from being validated. (Usage: -)
- Usage: -
+ Usage: -
-Or Operator
+# Or Operator
This is the 'or' operator allowing multiple validators to be used and
accepted. (Usage: rgb|rgba) <-- this would allow either rgb or rgba
@@ -172,7 +170,7 @@ colors to be accepted. This can also be combined with 'and' for example
Usage: |
-StructOnly
+# StructOnly
When a field that is a nested struct is encountered, and contains this flag
any validation on the nested struct will be run, but none of the nested
@@ -182,13 +180,13 @@ NOTE: only "required" and "omitempty" can be used on a struct itself.
Usage: structonly
-NoStructLevel
+# NoStructLevel
Same as structonly tag except that any struct level validations will not run.
Usage: nostructlevel
-Omit Empty
+# Omit Empty
Allows conditional validation, for example if a field is not set with
a value (Determined by the "required" validator) then other validation
@@ -196,7 +194,7 @@ such as min or max won't run, but if a value is set validation will run.
Usage: omitempty
-Dive
+# Dive
This tells the validator to dive into a slice, array or map and validate that
level of the slice, array or map with the validation tags that follow.
@@ -232,19 +230,19 @@ require another 'keys' and 'endkeys' tag. These tags are only valid for maps.
Example #1
- map[string]string with validation tag "gt=0,dive,keys,eg=1|eq=2,endkeys,required"
+ map[string]string with validation tag "gt=0,dive,keys,eq=1|eq=2,endkeys,required"
// gt=0 will be applied to the map itself
- // eg=1|eq=2 will be applied to the map keys
+ // eq=1|eq=2 will be applied to the map keys
// required will be applied to map values
Example #2
map[[2]string]string with validation tag "gt=0,dive,keys,dive,eq=1|eq=2,endkeys,required"
// gt=0 will be applied to the map itself
- // eg=1|eq=2 will be applied to each array element in the the map keys
+ // eq=1|eq=2 will be applied to each array element in the map keys
// required will be applied to map values
-Required
+# Required
This validates that the value is not the data types default zero value.
For numbers ensures value is not zero. For strings ensures value is
@@ -253,7 +251,7 @@ ensures the value is not nil.
Usage: required
-Required If
+# Required If
The field under validation must be present and not empty only if all
the other specified fields are equal to the value following the specified
@@ -270,7 +268,7 @@ Examples:
// require the field if the Field1 and Field2 is equal to the value respectively:
Usage: required_if=Field1 foo Field2 bar
-Required Unless
+# Required Unless
The field under validation must be present and not empty unless all
the other specified fields are equal to the value following the specified
@@ -287,7 +285,7 @@ Examples:
// require the field unless the Field1 and Field2 is equal to the value respectively:
Usage: required_unless=Field1 foo Field2 bar
-Required With
+# Required With
The field under validation must be present and not empty only if any
of the other specified fields are present. For strings ensures value is
@@ -304,7 +302,7 @@ Examples:
// require the field if the Field1 or Field2 is present:
Usage: required_with=Field1 Field2
-Required With All
+# Required With All
The field under validation must be present and not empty only if all
of the other specified fields are present. For strings ensures value is
@@ -318,7 +316,7 @@ Example:
// require the field if the Field1 and Field2 is present:
Usage: required_with_all=Field1 Field2
-Required Without
+# Required Without
The field under validation must be present and not empty only when any
of the other specified fields are not present. For strings ensures value is
@@ -335,7 +333,7 @@ Examples:
// require the field if the Field1 or Field2 is not present:
Usage: required_without=Field1 Field2
-Required Without All
+# Required Without All
The field under validation must be present and not empty only when all
of the other specified fields are not present. For strings ensures value is
@@ -349,14 +347,48 @@ Example:
// require the field if the Field1 and Field2 is not present:
Usage: required_without_all=Field1 Field2
-Is Default
+# Excluded If
+
+The field under validation must not be present or not empty only if all
+the other specified fields are equal to the value following the specified
+field. For strings ensures value is not "". For slices, maps, pointers,
+interfaces, channels and functions ensures the value is not nil.
+
+ Usage: excluded_if
+
+Examples:
+
+ // exclude the field if the Field1 is equal to the parameter given:
+ Usage: excluded_if=Field1 foobar
+
+ // exclude the field if the Field1 and Field2 is equal to the value respectively:
+ Usage: excluded_if=Field1 foo Field2 bar
+
+# Excluded Unless
+
+The field under validation must not be present or empty unless all
+the other specified fields are equal to the value following the specified
+field. For strings ensures value is not "". For slices, maps, pointers,
+interfaces, channels and functions ensures the value is not nil.
+
+ Usage: excluded_unless
+
+Examples:
+
+ // exclude the field unless the Field1 is equal to the parameter given:
+ Usage: excluded_unless=Field1 foobar
+
+ // exclude the field unless the Field1 and Field2 is equal to the value respectively:
+ Usage: excluded_unless=Field1 foo Field2 bar
+
+# Is Default
This validates that the value is the default value and is almost the
opposite of required.
Usage: isdefault
-Length
+# Length
For numbers, length will ensure that the value is
equal to the parameter given. For strings, it checks that
@@ -374,7 +406,7 @@ in the parameter.
Usage: len=1h30m
-Maximum
+# Maximum
For numbers, max will ensure that the value is
less than or equal to the parameter given. For strings, it checks
@@ -392,7 +424,7 @@ duration given in the parameter.
Usage: max=1h30m
-Minimum
+# Minimum
For numbers, min will ensure that the value is
greater or equal to the parameter given. For strings, it checks that
@@ -410,7 +442,7 @@ the duration given in the parameter.
Usage: min=1h30m
-Equals
+# Equals
For strings & numbers, eq will ensure that the value is
equal to the parameter given. For slices, arrays, and maps,
@@ -427,7 +459,7 @@ in the parameter.
Usage: eq=1h30m
-Not Equal
+# Not Equal
For strings & numbers, ne will ensure that the value is not
equal to the parameter given. For slices, arrays, and maps,
@@ -444,7 +476,7 @@ given in the parameter.
Usage: ne=1h30m
-One Of
+# One Of
For strings, ints, and uints, oneof will ensure that the value
is one of the values in the parameter. The parameter should be
@@ -452,11 +484,11 @@ a list of values separated by whitespace. Values may be
strings or numbers. To match strings with spaces in them, include
the target string between single quotes.
- Usage: oneof=red green
- oneof='red green' 'blue yellow'
- oneof=5 7 9
+ Usage: oneof=red green
+ oneof='red green' 'blue yellow'
+ oneof=5 7 9
-Greater Than
+# Greater Than
For numbers, this will ensure that the value is greater than the
parameter given. For strings, it checks that the string length
@@ -480,7 +512,7 @@ given in the parameter.
Usage: gt=1h30m
-Greater Than or Equal
+# Greater Than or Equal
Same as 'min' above. Kept both to make terminology with 'len' easier.
@@ -501,7 +533,7 @@ the duration given in the parameter.
Usage: gte=1h30m
-Less Than
+# Less Than
For numbers, this will ensure that the value is less than the parameter given.
For strings, it checks that the string length is less than that number of
@@ -524,7 +556,7 @@ in the parameter.
Usage: lt=1h30m
-Less Than or Equal
+# Less Than or Equal
Same as 'max' above. Kept both to make terminology with 'len' easier.
@@ -545,7 +577,7 @@ duration given in the parameter.
Usage: lte=1h30m
-Field Equals Another Field
+# Field Equals Another Field
This will validate the field value against another fields value either within
a struct or passed in field.
@@ -567,7 +599,7 @@ to the top level struct.
Usage: eqcsfield=InnerStructField.Field)
-Field Does Not Equal Another Field
+# Field Does Not Equal Another Field
This will validate the field value against another fields value either within
a struct or passed in field.
@@ -589,7 +621,7 @@ relative to the top level struct.
Usage: necsfield=InnerStructField.Field
-Field Greater Than Another Field
+# Field Greater Than Another Field
Only valid for Numbers, time.Duration and time.Time types, this will validate
the field value against another fields value either within a struct or passed in
@@ -605,14 +637,14 @@ Example #2:
// Validating by field:
validate.VarWithValue(start, end, "gtfield")
-Field Greater Than Another Relative Field
+# Field Greater Than Another Relative Field
This does the same as gtfield except that it validates the field provided
relative to the top level struct.
Usage: gtcsfield=InnerStructField.Field
-Field Greater Than or Equal To Another Field
+# Field Greater Than or Equal To Another Field
Only valid for Numbers, time.Duration and time.Time types, this will validate
the field value against another fields value either within a struct or passed in
@@ -628,14 +660,14 @@ Example #2:
// Validating by field:
validate.VarWithValue(start, end, "gtefield")
-Field Greater Than or Equal To Another Relative Field
+# Field Greater Than or Equal To Another Relative Field
This does the same as gtefield except that it validates the field provided relative
to the top level struct.
Usage: gtecsfield=InnerStructField.Field
-Less Than Another Field
+# Less Than Another Field
Only valid for Numbers, time.Duration and time.Time types, this will validate
the field value against another fields value either within a struct or passed in
@@ -651,14 +683,14 @@ Example #2:
// Validating by field:
validate.VarWithValue(start, end, "ltfield")
-Less Than Another Relative Field
+# Less Than Another Relative Field
This does the same as ltfield except that it validates the field provided relative
to the top level struct.
Usage: ltcsfield=InnerStructField.Field
-Less Than or Equal To Another Field
+# Less Than or Equal To Another Field
Only valid for Numbers, time.Duration and time.Time types, this will validate
the field value against another fields value either within a struct or passed in
@@ -674,14 +706,14 @@ Example #2:
// Validating by field:
validate.VarWithValue(start, end, "ltefield")
-Less Than or Equal To Another Relative Field
+# Less Than or Equal To Another Relative Field
This does the same as ltefield except that it validates the field provided relative
to the top level struct.
Usage: ltecsfield=InnerStructField.Field
-Field Contains Another Field
+# Field Contains Another Field
This does the same as contains except for struct fields. It should only be used
with string types. See the behavior of reflect.Value.String() for behavior on
@@ -689,7 +721,7 @@ other types.
Usage: containsfield=InnerStructField.Field
-Field Excludes Another Field
+# Field Excludes Another Field
This does the same as excludes except for struct fields. It should only be used
with string types. See the behavior of reflect.Value.String() for behavior on
@@ -697,7 +729,7 @@ other types.
Usage: excludesfield=InnerStructField.Field
-Unique
+# Unique
For arrays & slices, unique will ensure that there are no duplicates.
For maps, unique will ensure that there are no duplicate values.
@@ -710,44 +742,44 @@ in a field of the struct specified via a parameter.
// For slices of struct:
Usage: unique=field
-Alpha Only
+# Alpha Only
This validates that a string value contains ASCII alpha characters only
Usage: alpha
-Alphanumeric
+# Alphanumeric
This validates that a string value contains ASCII alphanumeric characters only
Usage: alphanum
-Alpha Unicode
+# Alpha Unicode
This validates that a string value contains unicode alpha characters only
Usage: alphaunicode
-Alphanumeric Unicode
+# Alphanumeric Unicode
This validates that a string value contains unicode alphanumeric characters only
Usage: alphanumunicode
-Boolean
+# Boolean
This validates that a string value can successfully be parsed into a boolean with strconv.ParseBool
Usage: boolean
-Number
+# Number
This validates that a string value contains number values only.
For integers or float it returns true.
Usage: number
-Numeric
+# Numeric
This validates that a string value contains a basic numeric value.
basic excludes exponents etc...
@@ -755,63 +787,63 @@ for integers or float it returns true.
Usage: numeric
-Hexadecimal String
+# Hexadecimal String
This validates that a string value contains a valid hexadecimal.
Usage: hexadecimal
-Hexcolor String
+# Hexcolor String
This validates that a string value contains a valid hex color including
hashtag (#)
- Usage: hexcolor
+ Usage: hexcolor
-Lowercase String
+# Lowercase String
This validates that a string value contains only lowercase characters. An empty string is not a valid lowercase string.
Usage: lowercase
-Uppercase String
+# Uppercase String
This validates that a string value contains only uppercase characters. An empty string is not a valid uppercase string.
Usage: uppercase
-RGB String
+# RGB String
This validates that a string value contains a valid rgb color
Usage: rgb
-RGBA String
+# RGBA String
This validates that a string value contains a valid rgba color
Usage: rgba
-HSL String
+# HSL String
This validates that a string value contains a valid hsl color
Usage: hsl
-HSLA String
+# HSLA String
This validates that a string value contains a valid hsla color
Usage: hsla
-E.164 Phone Number String
+# E.164 Phone Number String
This validates that a string value contains a valid E.164 Phone number
https://en.wikipedia.org/wiki/E.164 (ex. +1123456789)
Usage: e164
-E-mail String
+# E-mail String
This validates that a string value contains a valid email
This may not conform to all possibilities of any rfc standard, but neither
@@ -819,19 +851,19 @@ does any email provider accept all possibilities.
Usage: email
-JSON String
+# JSON String
This validates that a string value is valid JSON
Usage: json
-JWT String
+# JWT String
This validates that a string value is a valid JWT
Usage: jwt
-File path
+# File
This validates that a string value contains a valid file path and that
the file exists on the machine.
@@ -839,7 +871,25 @@ This is done using os.Stat, which is a platform independent function.
Usage: file
-URL String
+# Image path
+
+This validates that a string value contains a valid file path and that
+the file exists on the machine and is an image.
+This is done using os.Stat and github.com/gabriel-vasile/mimetype
+
+ Usage: image
+
+# URL String
+
+# File Path
+
+This validates that a string value contains a valid file path but does not
+validate the existence of that file.
+This is done using os.Stat, which is a platform independent function.
+
+ Usage: filepath
+
+# URL String
This validates that a string value contains a valid url
This will accept any url the golang request uri accepts but must contain
@@ -847,21 +897,21 @@ a schema for example http:// or rtmp://
Usage: url
-URI String
+# URI String
This validates that a string value contains a valid uri
This will accept any uri the golang request uri accepts
Usage: uri
-Urn RFC 2141 String
+# Urn RFC 2141 String
This validataes that a string value contains a valid URN
according to the RFC 2141 spec.
Usage: urn_rfc2141
-Base64 String
+# Base64 String
This validates that a string value contains a valid base64 value.
Although an empty string is valid base64 this will report an empty string
@@ -870,17 +920,27 @@ this with the omitempty tag.
Usage: base64
-Base64URL String
+# Base64URL String
This validates that a string value contains a valid base64 URL safe value
-according the the RFC4648 spec.
+according the RFC4648 spec.
Although an empty string is a valid base64 URL safe value, this will report
an empty string as an error, if you wish to accept an empty string as valid
you can use this with the omitempty tag.
Usage: base64url
-Bitcoin Address
+# Base64RawURL String
+
+This validates that a string value contains a valid base64 URL safe value,
+but without = padding, according the RFC4648 spec, section 3.2.
+Although an empty string is a valid base64 URL safe value, this will report
+an empty string as an error, if you wish to accept an empty string as valid
+you can use this with the omitempty tag.
+
+ Usage: base64url
+
+# Bitcoin Address
This validates that a string value contains a valid bitcoin address.
The format of the string is checked to ensure it matches one of the three formats
@@ -896,260 +956,266 @@ Special thanks to Pieter Wuille for providng reference implementations.
Usage: btc_addr_bech32
-Ethereum Address
+# Ethereum Address
This validates that a string value contains a valid ethereum address.
The format of the string is checked to ensure it matches the standard Ethereum address format.
Usage: eth_addr
-Contains
+# Contains
This validates that a string value contains the substring value.
Usage: contains=@
-Contains Any
+# Contains Any
This validates that a string value contains any Unicode code points
in the substring value.
Usage: containsany=!@#?
-Contains Rune
+# Contains Rune
This validates that a string value contains the supplied rune value.
Usage: containsrune=@
-Excludes
+# Excludes
This validates that a string value does not contain the substring value.
Usage: excludes=@
-Excludes All
+# Excludes All
This validates that a string value does not contain any Unicode code
points in the substring value.
Usage: excludesall=!@#?
-Excludes Rune
+# Excludes Rune
This validates that a string value does not contain the supplied rune value.
Usage: excludesrune=@
-Starts With
+# Starts With
This validates that a string value starts with the supplied string value
Usage: startswith=hello
-Ends With
+# Ends With
This validates that a string value ends with the supplied string value
Usage: endswith=goodbye
-Does Not Start With
+# Does Not Start With
This validates that a string value does not start with the supplied string value
Usage: startsnotwith=hello
-Does Not End With
+# Does Not End With
This validates that a string value does not end with the supplied string value
Usage: endsnotwith=goodbye
-International Standard Book Number
+# International Standard Book Number
This validates that a string value contains a valid isbn10 or isbn13 value.
Usage: isbn
-International Standard Book Number 10
+# International Standard Book Number 10
This validates that a string value contains a valid isbn10 value.
Usage: isbn10
-International Standard Book Number 13
+# International Standard Book Number 13
This validates that a string value contains a valid isbn13 value.
Usage: isbn13
-Universally Unique Identifier UUID
+# Universally Unique Identifier UUID
This validates that a string value contains a valid UUID. Uppercase UUID values will not pass - use `uuid_rfc4122` instead.
Usage: uuid
-Universally Unique Identifier UUID v3
+# Universally Unique Identifier UUID v3
This validates that a string value contains a valid version 3 UUID. Uppercase UUID values will not pass - use `uuid3_rfc4122` instead.
Usage: uuid3
-Universally Unique Identifier UUID v4
+# Universally Unique Identifier UUID v4
This validates that a string value contains a valid version 4 UUID. Uppercase UUID values will not pass - use `uuid4_rfc4122` instead.
Usage: uuid4
-Universally Unique Identifier UUID v5
+# Universally Unique Identifier UUID v5
This validates that a string value contains a valid version 5 UUID. Uppercase UUID values will not pass - use `uuid5_rfc4122` instead.
Usage: uuid5
-ASCII
+# Universally Unique Lexicographically Sortable Identifier ULID
+
+This validates that a string value contains a valid ULID value.
+
+ Usage: ulid
+
+# ASCII
This validates that a string value contains only ASCII characters.
NOTE: if the string is blank, this validates as true.
Usage: ascii
-Printable ASCII
+# Printable ASCII
This validates that a string value contains only printable ASCII characters.
NOTE: if the string is blank, this validates as true.
Usage: printascii
-Multi-Byte Characters
+# Multi-Byte Characters
This validates that a string value contains one or more multibyte characters.
NOTE: if the string is blank, this validates as true.
Usage: multibyte
-Data URL
+# Data URL
This validates that a string value contains a valid DataURI.
NOTE: this will also validate that the data portion is valid base64
Usage: datauri
-Latitude
+# Latitude
This validates that a string value contains a valid latitude.
Usage: latitude
-Longitude
+# Longitude
This validates that a string value contains a valid longitude.
Usage: longitude
-Social Security Number SSN
+# Social Security Number SSN
This validates that a string value contains a valid U.S. Social Security Number.
Usage: ssn
-Internet Protocol Address IP
+# Internet Protocol Address IP
This validates that a string value contains a valid IP Address.
Usage: ip
-Internet Protocol Address IPv4
+# Internet Protocol Address IPv4
This validates that a string value contains a valid v4 IP Address.
Usage: ipv4
-Internet Protocol Address IPv6
+# Internet Protocol Address IPv6
This validates that a string value contains a valid v6 IP Address.
Usage: ipv6
-Classless Inter-Domain Routing CIDR
+# Classless Inter-Domain Routing CIDR
This validates that a string value contains a valid CIDR Address.
Usage: cidr
-Classless Inter-Domain Routing CIDRv4
+# Classless Inter-Domain Routing CIDRv4
This validates that a string value contains a valid v4 CIDR Address.
Usage: cidrv4
-Classless Inter-Domain Routing CIDRv6
+# Classless Inter-Domain Routing CIDRv6
This validates that a string value contains a valid v6 CIDR Address.
Usage: cidrv6
-Transmission Control Protocol Address TCP
+# Transmission Control Protocol Address TCP
This validates that a string value contains a valid resolvable TCP Address.
Usage: tcp_addr
-Transmission Control Protocol Address TCPv4
+# Transmission Control Protocol Address TCPv4
This validates that a string value contains a valid resolvable v4 TCP Address.
Usage: tcp4_addr
-Transmission Control Protocol Address TCPv6
+# Transmission Control Protocol Address TCPv6
This validates that a string value contains a valid resolvable v6 TCP Address.
Usage: tcp6_addr
-User Datagram Protocol Address UDP
+# User Datagram Protocol Address UDP
This validates that a string value contains a valid resolvable UDP Address.
Usage: udp_addr
-User Datagram Protocol Address UDPv4
+# User Datagram Protocol Address UDPv4
This validates that a string value contains a valid resolvable v4 UDP Address.
Usage: udp4_addr
-User Datagram Protocol Address UDPv6
+# User Datagram Protocol Address UDPv6
This validates that a string value contains a valid resolvable v6 UDP Address.
Usage: udp6_addr
-Internet Protocol Address IP
+# Internet Protocol Address IP
This validates that a string value contains a valid resolvable IP Address.
Usage: ip_addr
-Internet Protocol Address IPv4
+# Internet Protocol Address IPv4
This validates that a string value contains a valid resolvable v4 IP Address.
Usage: ip4_addr
-Internet Protocol Address IPv6
+# Internet Protocol Address IPv6
This validates that a string value contains a valid resolvable v6 IP Address.
Usage: ip6_addr
-Unix domain socket end point Address
+# Unix domain socket end point Address
This validates that a string value contains a valid Unix Address.
Usage: unix_addr
-Media Access Control Address MAC
+# Media Access Control Address MAC
This validates that a string value contains a valid MAC Address.
@@ -1159,13 +1225,13 @@ Note: See Go's ParseMAC for accepted formats and types:
http://golang.org/src/net/mac.go?s=866:918#L29
-Hostname RFC 952
+# Hostname RFC 952
This validates that a string value is a valid Hostname according to RFC 952 https://tools.ietf.org/html/rfc952
Usage: hostname
-Hostname RFC 1123
+# Hostname RFC 1123
This validates that a string value is a valid Hostname according to RFC 1123 https://tools.ietf.org/html/rfc1123
@@ -1177,28 +1243,28 @@ This validates that a string value contains a valid FQDN.
Usage: fqdn
-HTML Tags
+# HTML Tags
This validates that a string value appears to be an HTML element tag
including those described at https://developer.mozilla.org/en-US/docs/Web/HTML/Element
Usage: html
-HTML Encoded
+# HTML Encoded
This validates that a string value is a proper character reference in decimal
or hexadecimal format
Usage: html_encoded
-URL Encoded
+# URL Encoded
This validates that a string value is percent-encoded (URL encoded) according
to https://tools.ietf.org/html/rfc3986#section-2.1
Usage: url_encoded
-Directory
+# Directory
This validates that a string value contains a valid directory and that
it exists on the machine.
@@ -1206,42 +1272,52 @@ This is done using os.Stat, which is a platform independent function.
Usage: dir
-HostPort
+# Directory Path
+
+This validates that a string value contains a valid directory but does
+not validate the existence of that directory.
+This is done using os.Stat, which is a platform independent function.
+It is safest to suffix the string with os.PathSeparator if the directory
+may not exist at the time of validation.
+
+ Usage: dirpath
+
+# HostPort
This validates that a string value contains a valid DNS hostname and port that
can be used to valiate fields typically passed to sockets and connections.
Usage: hostname_port
-Datetime
+# Datetime
This validates that a string value is a valid datetime based on the supplied datetime format.
Supplied format must match the official Go time format layout as documented in https://golang.org/pkg/time/
Usage: datetime=2006-01-02
-Iso3166-1 alpha-2
+# Iso3166-1 alpha-2
This validates that a string value is a valid country code based on iso3166-1 alpha-2 standard.
see: https://www.iso.org/iso-3166-country-codes.html
Usage: iso3166_1_alpha2
-Iso3166-1 alpha-3
+# Iso3166-1 alpha-3
This validates that a string value is a valid country code based on iso3166-1 alpha-3 standard.
see: https://www.iso.org/iso-3166-country-codes.html
Usage: iso3166_1_alpha3
-Iso3166-1 alpha-numeric
+# Iso3166-1 alpha-numeric
This validates that a string value is a valid country code based on iso3166-1 alpha-numeric standard.
see: https://www.iso.org/iso-3166-country-codes.html
Usage: iso3166_1_alpha3
-BCP 47 Language Tag
+# BCP 47 Language Tag
This validates that a string value is a valid BCP 47 language tag, as parsed by language.Parse.
More information on https://pkg.go.dev/golang.org/x/text/language
@@ -1255,7 +1331,14 @@ More information on https://www.iso.org/standard/60390.html
Usage: bic
-TimeZone
+# RFC 1035 label
+
+This validates that a string value is a valid dns RFC 1035 label, defined in RFC 1035.
+More information on https://datatracker.ietf.org/doc/html/rfc1035
+
+ Usage: dns_rfc1035_label
+
+# TimeZone
This validates that a string value is a valid time zone based on the time zone database present on the system.
Although empty value and Local value are allowed by time.LoadLocation golang function, they are not allowed by this validator.
@@ -1263,9 +1346,47 @@ More information on https://golang.org/pkg/time/#LoadLocation
Usage: timezone
+# Semantic Version
-Alias Validators and Tags
+This validates that a string value is a valid semver version, defined in Semantic Versioning 2.0.0.
+More information on https://semver.org/
+
+ Usage: semver
+# CVE Identifier
+
+This validates that a string value is a valid cve id, defined in cve mitre.
+More information on https://cve.mitre.org/
+
+ Usage: cve
+
+# Credit Card
+
+This validates that a string value contains a valid credit card number using Luhn algorithm.
+
+ Usage: credit_card
+
+# Luhn Checksum
+
+ Usage: luhn_checksum
+
+This validates that a string or (u)int value contains a valid checksum using the Luhn algorithm.
+
+# MongoDb ObjectID
+
+This validates that a string is a valid 24 character hexadecimal string.
+
+ Usage: mongodb
+
+# Cron
+
+This validates that a string value contains a valid cron expression.
+
+ Usage: cron
+
+# Alias Validators and Tags
+
+Alias Validators and Tags
NOTE: When returning an error, the tag returned in "FieldError" will be
the alias tag unless the dive tag is part of the alias. Everything after the
dive tag is not reported as the alias tag. Also, the "ActualTag" in the before
@@ -1295,7 +1416,7 @@ Validator notes:
And the best reason, you can submit a pull request and we can keep on
adding to the validation library of this package!
-Non standard validators
+# Non standard validators
A collection of validation rules that are frequently needed but are more
complex than the ones found in the baked in validators.
@@ -1324,7 +1445,7 @@ Here is a list of the current non standard validators:
Usage: notblank
-Panics
+# Panics
This package panics when bad input is provided, this is by design, bad code like
that should not make it to production.
diff --git a/vendor/github.com/go-playground/validator/v10/errors.go b/vendor/github.com/go-playground/validator/v10/errors.go
index 9a1b1abe93..5856d57c8c 100644
--- a/vendor/github.com/go-playground/validator/v10/errors.go
+++ b/vendor/github.com/go-playground/validator/v10/errors.go
@@ -44,12 +44,9 @@ func (ve ValidationErrors) Error() string {
buff := bytes.NewBufferString("")
- var fe *fieldError
-
for i := 0; i < len(ve); i++ {
- fe = ve[i].(*fieldError)
- buff.WriteString(fe.Error())
+ buff.WriteString(ve[i].Error())
buff.WriteString("\n")
}
diff --git a/vendor/github.com/go-playground/validator/v10/regexes.go b/vendor/github.com/go-playground/validator/v10/regexes.go
index df00c4ebc1..ba450b3d05 100644
--- a/vendor/github.com/go-playground/validator/v10/regexes.go
+++ b/vendor/github.com/go-playground/validator/v10/regexes.go
@@ -10,7 +10,7 @@ const (
numericRegexString = "^[-+]?[0-9]+(?:\\.[0-9]+)?$"
numberRegexString = "^[0-9]+$"
hexadecimalRegexString = "^(0[xX])?[0-9a-fA-F]+$"
- hexColorRegexString = "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
+ hexColorRegexString = "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$"
rgbRegexString = "^rgb\\(\\s*(?:(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])|(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%)\\s*\\)$"
rgbaRegexString = "^rgba\\(\\s*(?:(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])|(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%)\\s*,\\s*(?:(?:0.[1-9]*)|[01])\\s*\\)$"
hslRegexString = "^hsl\\(\\s*(?:0|[1-9]\\d?|[12]\\d\\d|3[0-5]\\d|360)\\s*,\\s*(?:(?:0|[1-9]\\d?|100)%)\\s*,\\s*(?:(?:0|[1-9]\\d?|100)%)\\s*\\)$"
@@ -19,6 +19,7 @@ const (
e164RegexString = "^\\+[1-9]?[0-9]{7,14}$"
base64RegexString = "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=|[A-Za-z0-9+\\/]{4})$"
base64URLRegexString = "^(?:[A-Za-z0-9-_]{4})*(?:[A-Za-z0-9-_]{2}==|[A-Za-z0-9-_]{3}=|[A-Za-z0-9-_]{4})$"
+ base64RawURLRegexString = "^(?:[A-Za-z0-9-_]{4})*(?:[A-Za-z0-9-_]{2,4})$"
iSBN10RegexString = "^(?:[0-9]{9}X|[0-9]{10})$"
iSBN13RegexString = "^(?:(?:97(?:8|9))[0-9]{10})$"
uUID3RegexString = "^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$"
@@ -29,6 +30,17 @@ const (
uUID4RFC4122RegexString = "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
uUID5RFC4122RegexString = "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-5[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
uUIDRFC4122RegexString = "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
+ uLIDRegexString = "^[A-HJKMNP-TV-Z0-9]{26}$"
+ md4RegexString = "^[0-9a-f]{32}$"
+ md5RegexString = "^[0-9a-f]{32}$"
+ sha256RegexString = "^[0-9a-f]{64}$"
+ sha384RegexString = "^[0-9a-f]{96}$"
+ sha512RegexString = "^[0-9a-f]{128}$"
+ ripemd128RegexString = "^[0-9a-f]{32}$"
+ ripemd160RegexString = "^[0-9a-f]{40}$"
+ tiger128RegexString = "^[0-9a-f]{32}$"
+ tiger160RegexString = "^[0-9a-f]{40}$"
+ tiger192RegexString = "^[0-9a-f]{48}$"
aSCIIRegexString = "^[\x00-\x7F]*$"
printableASCIIRegexString = "^[\x20-\x7E]*$"
multibyteRegexString = "[^\x00-\x7F]"
@@ -36,12 +48,12 @@ const (
latitudeRegexString = "^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?)$"
longitudeRegexString = "^[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$"
sSNRegexString = `^[0-9]{3}[ -]?(0[1-9]|[1-9][0-9])[ -]?([1-9][0-9]{3}|[0-9][1-9][0-9]{2}|[0-9]{2}[1-9][0-9]|[0-9]{3}[1-9])$`
- hostnameRegexStringRFC952 = `^[a-zA-Z]([a-zA-Z0-9\-]+[\.]?)*[a-zA-Z0-9]$` // https://tools.ietf.org/html/rfc952
- hostnameRegexStringRFC1123 = `^([a-zA-Z0-9]{1}[a-zA-Z0-9_-]{0,62}){1}(\.[a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62})*?$` // accepts hostname starting with a digit https://tools.ietf.org/html/rfc1123
- fqdnRegexStringRFC1123 = `^([a-zA-Z0-9]{1}[a-zA-Z0-9_-]{0,62})(\.[a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62})*?(\.[a-zA-Z]{1}[a-zA-Z0-9]{0,62})\.?$` // same as hostnameRegexStringRFC1123 but must contain a non numerical TLD (possibly ending with '.')
- btcAddressRegexString = `^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$` // bitcoin address
- btcAddressUpperRegexStringBech32 = `^BC1[02-9AC-HJ-NP-Z]{7,76}$` // bitcoin bech32 address https://en.bitcoin.it/wiki/Bech32
- btcAddressLowerRegexStringBech32 = `^bc1[02-9ac-hj-np-z]{7,76}$` // bitcoin bech32 address https://en.bitcoin.it/wiki/Bech32
+ hostnameRegexStringRFC952 = `^[a-zA-Z]([a-zA-Z0-9\-]+[\.]?)*[a-zA-Z0-9]$` // https://tools.ietf.org/html/rfc952
+ hostnameRegexStringRFC1123 = `^([a-zA-Z0-9]{1}[a-zA-Z0-9-]{0,62}){1}(\.[a-zA-Z0-9]{1}[a-zA-Z0-9-]{0,62})*?$` // accepts hostname starting with a digit https://tools.ietf.org/html/rfc1123
+ fqdnRegexStringRFC1123 = `^([a-zA-Z0-9]{1}[a-zA-Z0-9-]{0,62})(\.[a-zA-Z0-9]{1}[a-zA-Z0-9-]{0,62})*?(\.[a-zA-Z]{1}[a-zA-Z0-9]{0,62})\.?$` // same as hostnameRegexStringRFC1123 but must contain a non numerical TLD (possibly ending with '.')
+ btcAddressRegexString = `^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$` // bitcoin address
+ btcAddressUpperRegexStringBech32 = `^BC1[02-9AC-HJ-NP-Z]{7,76}$` // bitcoin bech32 address https://en.bitcoin.it/wiki/Bech32
+ btcAddressLowerRegexStringBech32 = `^bc1[02-9ac-hj-np-z]{7,76}$` // bitcoin bech32 address https://en.bitcoin.it/wiki/Bech32
ethAddressRegexString = `^0x[0-9a-fA-F]{40}$`
ethAddressUpperRegexString = `^0x[0-9A-F]{40}$`
ethAddressLowerRegexString = `^0x[0-9a-f]{40}$`
@@ -51,6 +63,11 @@ const (
jWTRegexString = "^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$"
splitParamsRegexString = `'[^']*'|\S+`
bicRegexString = `^[A-Za-z]{6}[A-Za-z0-9]{2}([A-Za-z0-9]{3})?$`
+ semverRegexString = `^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$` // numbered capture groups https://semver.org/
+ dnsRegexStringRFC1035Label = "^[a-z]([-a-z0-9]*[a-z0-9]){0,62}$"
+ cveRegexString = `^CVE-(1999|2\d{3})-(0[^0]\d{2}|0\d[^0]\d{1}|0\d{2}[^0]|[1-9]{1}\d{3,})$` // CVE Format Id https://cve.mitre.org/cve/identifiers/syntaxchange.html
+ mongodbRegexString = "^[a-f\\d]{24}$"
+ cronRegexString = `(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\d+(ns|us|µs|ms|s|m|h))+)|((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})`
)
var (
@@ -70,6 +87,7 @@ var (
emailRegex = regexp.MustCompile(emailRegexString)
base64Regex = regexp.MustCompile(base64RegexString)
base64URLRegex = regexp.MustCompile(base64URLRegexString)
+ base64RawURLRegex = regexp.MustCompile(base64RawURLRegexString)
iSBN10Regex = regexp.MustCompile(iSBN10RegexString)
iSBN13Regex = regexp.MustCompile(iSBN13RegexString)
uUID3Regex = regexp.MustCompile(uUID3RegexString)
@@ -80,6 +98,17 @@ var (
uUID4RFC4122Regex = regexp.MustCompile(uUID4RFC4122RegexString)
uUID5RFC4122Regex = regexp.MustCompile(uUID5RFC4122RegexString)
uUIDRFC4122Regex = regexp.MustCompile(uUIDRFC4122RegexString)
+ uLIDRegex = regexp.MustCompile(uLIDRegexString)
+ md4Regex = regexp.MustCompile(md4RegexString)
+ md5Regex = regexp.MustCompile(md5RegexString)
+ sha256Regex = regexp.MustCompile(sha256RegexString)
+ sha384Regex = regexp.MustCompile(sha384RegexString)
+ sha512Regex = regexp.MustCompile(sha512RegexString)
+ ripemd128Regex = regexp.MustCompile(ripemd128RegexString)
+ ripemd160Regex = regexp.MustCompile(ripemd160RegexString)
+ tiger128Regex = regexp.MustCompile(tiger128RegexString)
+ tiger160Regex = regexp.MustCompile(tiger160RegexString)
+ tiger192Regex = regexp.MustCompile(tiger192RegexString)
aSCIIRegex = regexp.MustCompile(aSCIIRegexString)
printableASCIIRegex = regexp.MustCompile(printableASCIIRegexString)
multibyteRegex = regexp.MustCompile(multibyteRegexString)
@@ -94,12 +123,15 @@ var (
btcUpperAddressRegexBech32 = regexp.MustCompile(btcAddressUpperRegexStringBech32)
btcLowerAddressRegexBech32 = regexp.MustCompile(btcAddressLowerRegexStringBech32)
ethAddressRegex = regexp.MustCompile(ethAddressRegexString)
- ethAddressRegexUpper = regexp.MustCompile(ethAddressUpperRegexString)
- ethAddressRegexLower = regexp.MustCompile(ethAddressLowerRegexString)
uRLEncodedRegex = regexp.MustCompile(uRLEncodedRegexString)
hTMLEncodedRegex = regexp.MustCompile(hTMLEncodedRegexString)
hTMLRegex = regexp.MustCompile(hTMLRegexString)
jWTRegex = regexp.MustCompile(jWTRegexString)
splitParamsRegex = regexp.MustCompile(splitParamsRegexString)
bicRegex = regexp.MustCompile(bicRegexString)
+ semverRegex = regexp.MustCompile(semverRegexString)
+ dnsRegexRFC1035Label = regexp.MustCompile(dnsRegexStringRFC1035Label)
+ cveRegex = regexp.MustCompile(cveRegexString)
+ mongodbRegex = regexp.MustCompile(mongodbRegexString)
+ cronRegex = regexp.MustCompile(cronRegexString)
)
diff --git a/vendor/github.com/go-playground/validator/v10/struct_level.go b/vendor/github.com/go-playground/validator/v10/struct_level.go
index c0d89cfbed..271328f710 100644
--- a/vendor/github.com/go-playground/validator/v10/struct_level.go
+++ b/vendor/github.com/go-playground/validator/v10/struct_level.go
@@ -62,7 +62,7 @@ type StructLevel interface {
// existing namespace that validator is on.
// e.g. pass 'User.FirstName' or 'Users[0].FirstName' depending
// on the nesting. most of the time they will be blank, unless you validate
- // at a level lower the the current field depth
+ // at a level lower the current field depth
ReportValidationErrors(relativeNamespace, relativeActualNamespace string, errs ValidationErrors)
}
@@ -74,7 +74,7 @@ var _ StructLevel = new(validate)
// if not is a nested struct.
//
// this is only called when within Struct and Field Level validation and
-// should not be relied upon for an acurate value otherwise.
+// should not be relied upon for an accurate value otherwise.
func (v *validate) Top() reflect.Value {
return v.top
}
@@ -85,7 +85,7 @@ func (v *validate) Top() reflect.Value {
// if not is a nested struct.
//
// this is only called when within Struct and Field Level validation and
-// should not be relied upon for an acurate value otherwise.
+// should not be relied upon for an accurate value otherwise.
func (v *validate) Parent() reflect.Value {
return v.slflParent
}
diff --git a/vendor/github.com/go-playground/validator/v10/util.go b/vendor/github.com/go-playground/validator/v10/util.go
index 56420f4301..3925cfe1cd 100644
--- a/vendor/github.com/go-playground/validator/v10/util.go
+++ b/vendor/github.com/go-playground/validator/v10/util.go
@@ -82,7 +82,7 @@ BEGIN:
fld := namespace
var ns string
- if typ != timeType {
+ if !typ.ConvertibleTo(timeType) {
idx := strings.Index(namespace, namespaceSeparator)
@@ -234,7 +234,7 @@ func asInt(param string) int64 {
func asIntFromTimeDuration(param string) int64 {
d, err := time.ParseDuration(param)
if err != nil {
- // attempt parsing as an an integer assuming nanosecond precision
+ // attempt parsing as an integer assuming nanosecond precision
return asInt(param)
}
return int64(d)
diff --git a/vendor/github.com/go-playground/validator/v10/validator.go b/vendor/github.com/go-playground/validator/v10/validator.go
index 2a4fad022d..6f6d53ada7 100644
--- a/vendor/github.com/go-playground/validator/v10/validator.go
+++ b/vendor/github.com/go-playground/validator/v10/validator.go
@@ -164,7 +164,7 @@ func (v *validate) traverseField(ctx context.Context, parent reflect.Value, curr
typ = current.Type()
- if typ != timeType {
+ if !typ.ConvertibleTo(timeType) {
if ct != nil {
@@ -355,6 +355,10 @@ OUTER:
v.ct = ct
if ct.fn(ctx, v) {
+ if ct.isBlockEnd {
+ ct = ct.next
+ continue OUTER
+ }
// drain rest of the 'or' values, then continue or leave
for {
@@ -368,6 +372,11 @@ OUTER:
if ct.typeof != typeOr {
continue OUTER
}
+
+ if ct.isBlockEnd {
+ ct = ct.next
+ continue OUTER
+ }
}
}
@@ -443,7 +452,6 @@ OUTER:
v.ct = ct
if !ct.fn(ctx, v) {
-
v.str1 = string(append(ns, cf.altName...))
if v.v.hasTagNameFunc {
diff --git a/vendor/github.com/go-playground/validator/v10/validator_instance.go b/vendor/github.com/go-playground/validator/v10/validator_instance.go
index 973964fc20..d9dbf0ce8b 100644
--- a/vendor/github.com/go-playground/validator/v10/validator_instance.go
+++ b/vendor/github.com/go-playground/validator/v10/validator_instance.go
@@ -29,10 +29,13 @@ const (
requiredWithAllTag = "required_with_all"
requiredIfTag = "required_if"
requiredUnlessTag = "required_unless"
+ skipUnlessTag = "skip_unless"
excludedWithoutAllTag = "excluded_without_all"
excludedWithoutTag = "excluded_without"
excludedWithTag = "excluded_with"
excludedWithAllTag = "excluded_with_all"
+ excludedIfTag = "excluded_if"
+ excludedUnlessTag = "excluded_unless"
skipValidationTag = "-"
diveTag = "dive"
keysTag = "keys"
@@ -50,12 +53,14 @@ var (
timeDurationType = reflect.TypeOf(time.Duration(0))
timeType = reflect.TypeOf(time.Time{})
+ byteSliceType = reflect.TypeOf([]byte{})
+
defaultCField = &cField{namesEqual: true}
)
// FilterFunc is the type used to filter fields using
// StructFiltered(...) function.
-// returning true results in the field being filtered/skiped from
+// returning true results in the field being filtered/skipped from
// validation
type FilterFunc func(ns []byte) bool
@@ -84,6 +89,7 @@ type Validate struct {
aliases map[string]string
validations map[string]internalValidationFuncWrapper
transTagFunc map[ut.Translator]map[string]TranslationFunc // map[]map[]TranslationFunc
+ rules map[reflect.Type]map[string]string
tagCache *tagCache
structCache *structCache
}
@@ -120,7 +126,8 @@ func New() *Validate {
switch k {
// these require that even if the value is nil that the validation should run, omitempty still overrides this behaviour
case requiredIfTag, requiredUnlessTag, requiredWithTag, requiredWithAllTag, requiredWithoutTag, requiredWithoutAllTag,
- excludedWithTag, excludedWithAllTag, excludedWithoutTag, excludedWithoutAllTag:
+ excludedIfTag, excludedUnlessTag, excludedWithTag, excludedWithAllTag, excludedWithoutTag, excludedWithoutAllTag,
+ skipUnlessTag:
_ = v.registerValidation(k, wrapFunc(val), true, true)
default:
// no need to error check here, baked in will always be valid
@@ -148,19 +155,28 @@ func (v *Validate) SetTagName(name string) {
}
// ValidateMapCtx validates a map using a map of validation rules and allows passing of contextual
-// validation validation information via context.Context.
+// validation information via context.Context.
func (v Validate) ValidateMapCtx(ctx context.Context, data map[string]interface{}, rules map[string]interface{}) map[string]interface{} {
errs := make(map[string]interface{})
for field, rule := range rules {
- if reflect.ValueOf(rule).Kind() == reflect.Map && reflect.ValueOf(data[field]).Kind() == reflect.Map {
- err := v.ValidateMapCtx(ctx, data[field].(map[string]interface{}), rule.(map[string]interface{}))
- if len(err) > 0 {
- errs[field] = err
+ if ruleObj, ok := rule.(map[string]interface{}); ok {
+ if dataObj, ok := data[field].(map[string]interface{}); ok {
+ err := v.ValidateMapCtx(ctx, dataObj, ruleObj)
+ if len(err) > 0 {
+ errs[field] = err
+ }
+ } else if dataObjs, ok := data[field].([]map[string]interface{}); ok {
+ for _, obj := range dataObjs {
+ err := v.ValidateMapCtx(ctx, obj, ruleObj)
+ if len(err) > 0 {
+ errs[field] = err
+ }
+ }
+ } else {
+ errs[field] = errors.New("The field: '" + field + "' is not a map to dive")
}
- } else if reflect.ValueOf(rule).Kind() == reflect.Map {
- errs[field] = errors.New("The field: '" + field + "' is not a map to dive")
- } else {
- err := v.VarCtx(ctx, data[field], rule.(string))
+ } else if ruleStr, ok := rule.(string); ok {
+ err := v.VarCtx(ctx, data[field], ruleStr)
if err != nil {
errs[field] = err
}
@@ -169,7 +185,7 @@ func (v Validate) ValidateMapCtx(ctx context.Context, data map[string]interface{
return errs
}
-// ValidateMap validates map data form a map of tags
+// ValidateMap validates map data from a map of tags
func (v *Validate) ValidateMap(data map[string]interface{}, rules map[string]interface{}) map[string]interface{} {
return v.ValidateMapCtx(context.Background(), data, rules)
}
@@ -178,13 +194,14 @@ func (v *Validate) ValidateMap(data map[string]interface{}, rules map[string]int
//
// eg. to use the names which have been specified for JSON representations of structs, rather than normal Go field names:
//
-// validate.RegisterTagNameFunc(func(fld reflect.StructField) string {
-// name := strings.SplitN(fld.Tag.Get("json"), ",", 2)[0]
-// if name == "-" {
-// return ""
-// }
-// return name
-// })
+// validate.RegisterTagNameFunc(func(fld reflect.StructField) string {
+// name := strings.SplitN(fld.Tag.Get("json"), ",", 2)[0]
+// // skip if tag key says it should be ignored
+// if name == "-" {
+// return ""
+// }
+// return name
+// })
func (v *Validate) RegisterTagNameFunc(fn TagNameFunc) {
v.tagNameFunc = fn
v.hasTagNameFunc = true
@@ -271,6 +288,34 @@ func (v *Validate) RegisterStructValidationCtx(fn StructLevelFuncCtx, types ...i
}
}
+// RegisterStructValidationMapRules registers validate map rules.
+// Be aware that map validation rules supersede those defined on a/the struct if present.
+//
+// NOTE: this method is not thread-safe it is intended that these all be registered prior to any validation
+func (v *Validate) RegisterStructValidationMapRules(rules map[string]string, types ...interface{}) {
+ if v.rules == nil {
+ v.rules = make(map[reflect.Type]map[string]string)
+ }
+
+ deepCopyRules := make(map[string]string)
+ for i, rule := range rules {
+ deepCopyRules[i] = rule
+ }
+
+ for _, t := range types {
+ typ := reflect.TypeOf(t)
+
+ if typ.Kind() == reflect.Ptr {
+ typ = typ.Elem()
+ }
+
+ if typ.Kind() != reflect.Struct {
+ continue
+ }
+ v.rules[typ] = deepCopyRules
+ }
+}
+
// RegisterCustomTypeFunc registers a CustomTypeFunc against a number of types
//
// NOTE: this method is not thread-safe it is intended that these all be registered prior to any validation
@@ -331,7 +376,7 @@ func (v *Validate) StructCtx(ctx context.Context, s interface{}) (err error) {
val = val.Elem()
}
- if val.Kind() != reflect.Struct || val.Type() == timeType {
+ if val.Kind() != reflect.Struct || val.Type().ConvertibleTo(timeType) {
return &InvalidValidationError{Type: reflect.TypeOf(s)}
}
@@ -376,7 +421,7 @@ func (v *Validate) StructFilteredCtx(ctx context.Context, s interface{}, fn Filt
val = val.Elem()
}
- if val.Kind() != reflect.Struct || val.Type() == timeType {
+ if val.Kind() != reflect.Struct || val.Type().ConvertibleTo(timeType) {
return &InvalidValidationError{Type: reflect.TypeOf(s)}
}
@@ -410,7 +455,7 @@ func (v *Validate) StructPartial(s interface{}, fields ...string) error {
}
// StructPartialCtx validates the fields passed in only, ignoring all others and allows passing of contextual
-// validation validation information via context.Context
+// validation information via context.Context
// Fields may be provided in a namespaced fashion relative to the struct provided
// eg. NestedStruct.Field or NestedArrayField[0].Struct.Name
//
@@ -424,7 +469,7 @@ func (v *Validate) StructPartialCtx(ctx context.Context, s interface{}, fields .
val = val.Elem()
}
- if val.Kind() != reflect.Struct || val.Type() == timeType {
+ if val.Kind() != reflect.Struct || val.Type().ConvertibleTo(timeType) {
return &InvalidValidationError{Type: reflect.TypeOf(s)}
}
@@ -500,7 +545,7 @@ func (v *Validate) StructExcept(s interface{}, fields ...string) error {
}
// StructExceptCtx validates all fields except the ones passed in and allows passing of contextual
-// validation validation information via context.Context
+// validation information via context.Context
// Fields may be provided in a namespaced fashion relative to the struct provided
// i.e. NestedStruct.Field or NestedArrayField[0].Struct.Name
//
@@ -514,7 +559,7 @@ func (v *Validate) StructExceptCtx(ctx context.Context, s interface{}, fields ..
val = val.Elem()
}
- if val.Kind() != reflect.Struct || val.Type() == timeType {
+ if val.Kind() != reflect.Struct || val.Type().ConvertibleTo(timeType) {
return &InvalidValidationError{Type: reflect.TypeOf(s)}
}
@@ -572,7 +617,7 @@ func (v *Validate) Var(field interface{}, tag string) error {
}
// VarCtx validates a single variable using tag style validation and allows passing of contextual
-// validation validation information via context.Context.
+// validation information via context.Context.
// eg.
// var i int
// validate.Var(i, "gt=1,lt=10")
@@ -591,6 +636,7 @@ func (v *Validate) VarCtx(ctx context.Context, field interface{}, tag string) (e
}
ctag := v.fetchCacheTag(tag)
+
val := reflect.ValueOf(field)
vd := v.pool.Get().(*validate)
vd.top = val
diff --git a/vendor/github.com/go-sql-driver/mysql/AUTHORS b/vendor/github.com/go-sql-driver/mysql/AUTHORS
index 50afa2c859..0513275195 100644
--- a/vendor/github.com/go-sql-driver/mysql/AUTHORS
+++ b/vendor/github.com/go-sql-driver/mysql/AUTHORS
@@ -23,6 +23,7 @@ Asta Xie
Bulat Gaifullin
Caine Jette
Carlos Nieto
+Chris Kirkland
Chris Moos
Craig Wilson
Daniel Montoya
@@ -45,6 +46,7 @@ Ilia Cimpoes
INADA Naoki
Jacek Szwec
James Harr
+Janek Vedock
Jeff Hodges
Jeffrey Charles
Jerome Meyer
@@ -59,12 +61,14 @@ Kamil Dziedzic
Kei Kamikawa
Kevin Malachowski
Kieron Woodhouse
+Lance Tian
Lennart Rudolph
Leonardo YongUk Kim
Linh Tran Tuan
Lion Yang
Luca Looz
Lucas Liu
+Lunny Xiao
Luke Scott
Maciej Zimnoch
Michael Woolnough
@@ -79,6 +83,7 @@ Reed Allman
Richard Wilkes
Robert Russell
Runrioter Wung
+Santhosh Kumar Tekuri
Sho Iizuka
Sho Ikeda
Shuode Li
@@ -99,12 +104,14 @@ Xiuming Chen
Xuehong Chan
Zhenye Xie
Zhixin Wen
+Ziheng Lyu
# Organizations
Barracuda Networks, Inc.
Counting Ltd.
DigitalOcean Inc.
+dyves labs AG
Facebook Inc.
GitHub Inc.
Google Inc.
diff --git a/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md b/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md
index 72a738ed50..77024a8201 100644
--- a/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md
+++ b/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md
@@ -1,3 +1,24 @@
+## Version 1.7 (2022-11-29)
+
+Changes:
+
+ - Drop support of Go 1.12 (#1211)
+ - Refactoring `(*textRows).readRow` in a more clear way (#1230)
+ - util: Reduce boundary check in escape functions. (#1316)
+ - enhancement for mysqlConn handleAuthResult (#1250)
+
+New Features:
+
+ - support Is comparison on MySQLError (#1210)
+ - return unsigned in database type name when necessary (#1238)
+ - Add API to express like a --ssl-mode=PREFERRED MySQL client (#1370)
+ - Add SQLState to MySQLError (#1321)
+
+Bugfixes:
+
+ - Fix parsing 0 year. (#1257)
+
+
## Version 1.6 (2021-04-01)
Changes:
diff --git a/vendor/github.com/go-sql-driver/mysql/README.md b/vendor/github.com/go-sql-driver/mysql/README.md
index 0b13154fcc..25de2e5aa6 100644
--- a/vendor/github.com/go-sql-driver/mysql/README.md
+++ b/vendor/github.com/go-sql-driver/mysql/README.md
@@ -40,7 +40,7 @@ A MySQL-Driver for Go's [database/sql](https://golang.org/pkg/database/sql/) pac
* Optional placeholder interpolation
## Requirements
- * Go 1.10 or higher. We aim to support the 3 latest versions of Go.
+ * Go 1.13 or higher. We aim to support the 3 latest versions of Go.
* MySQL (4.1+), MariaDB, Percona Server, Google CloudSQL or Sphinx (2.2.3+)
---------------------------------------
@@ -85,7 +85,7 @@ db.SetMaxIdleConns(10)
`db.SetMaxOpenConns()` is highly recommended to limit the number of connection used by the application. There is no recommended limit number because it depends on application and MySQL server.
-`db.SetMaxIdleConns()` is recommended to be set same to (or greater than) `db.SetMaxOpenConns()`. When it is smaller than `SetMaxOpenConns()`, connections can be opened and closed very frequently than you expect. Idle connections can be closed by the `db.SetConnMaxLifetime()`. If you want to close idle connections more rapidly, you can use `db.SetConnMaxIdleTime()` since Go 1.15.
+`db.SetMaxIdleConns()` is recommended to be set same to `db.SetMaxOpenConns()`. When it is smaller than `SetMaxOpenConns()`, connections can be opened and closed much more frequently than you expect. Idle connections can be closed by the `db.SetConnMaxLifetime()`. If you want to close idle connections more rapidly, you can use `db.SetConnMaxIdleTime()` since Go 1.15.
### DSN (Data Source Name)
@@ -157,6 +157,17 @@ Default: false
`allowCleartextPasswords=true` allows using the [cleartext client side plugin](https://dev.mysql.com/doc/en/cleartext-pluggable-authentication.html) if required by an account, such as one defined with the [PAM authentication plugin](http://dev.mysql.com/doc/en/pam-authentication-plugin.html). Sending passwords in clear text may be a security problem in some configurations. To avoid problems if there is any possibility that the password would be intercepted, clients should connect to MySQL Server using a method that protects the password. Possibilities include [TLS / SSL](#tls), IPsec, or a private network.
+
+##### `allowFallbackToPlaintext`
+
+```
+Type: bool
+Valid Values: true, false
+Default: false
+```
+
+`allowFallbackToPlaintext=true` acts like a `--ssl-mode=PREFERRED` MySQL client as described in [Command Options for Connecting to the Server](https://dev.mysql.com/doc/refman/5.7/en/connection-options.html#option_general_ssl-mode)
+
##### `allowNativePasswords`
```
@@ -454,7 +465,7 @@ user:password@/
The connection pool is managed by Go's database/sql package. For details on how to configure the size of the pool and how long connections stay in the pool see `*DB.SetMaxOpenConns`, `*DB.SetMaxIdleConns`, and `*DB.SetConnMaxLifetime` in the [database/sql documentation](https://golang.org/pkg/database/sql/). The read, write, and dial timeouts for each individual connection are configured with the DSN parameters [`readTimeout`](#readtimeout), [`writeTimeout`](#writetimeout), and [`timeout`](#timeout), respectively.
## `ColumnType` Support
-This driver supports the [`ColumnType` interface](https://golang.org/pkg/database/sql/#ColumnType) introduced in Go 1.8, with the exception of [`ColumnType.Length()`](https://golang.org/pkg/database/sql/#ColumnType.Length), which is currently not supported.
+This driver supports the [`ColumnType` interface](https://golang.org/pkg/database/sql/#ColumnType) introduced in Go 1.8, with the exception of [`ColumnType.Length()`](https://golang.org/pkg/database/sql/#ColumnType.Length), which is currently not supported. All Unsigned database type names will be returned `UNSIGNED ` with `INT`, `TINYINT`, `SMALLINT`, `BIGINT`.
## `context.Context` Support
Go 1.8 added `database/sql` support for `context.Context`. This driver supports query timeouts and cancellation via contexts.
diff --git a/vendor/github.com/go-sql-driver/mysql/atomic_bool.go b/vendor/github.com/go-sql-driver/mysql/atomic_bool.go
new file mode 100644
index 0000000000..1b7e19f3e3
--- /dev/null
+++ b/vendor/github.com/go-sql-driver/mysql/atomic_bool.go
@@ -0,0 +1,19 @@
+// Go MySQL Driver - A MySQL-Driver for Go's database/sql package.
+//
+// Copyright 2022 The Go-MySQL-Driver Authors. All rights reserved.
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this file,
+// You can obtain one at http://mozilla.org/MPL/2.0/.
+//go:build go1.19
+// +build go1.19
+
+package mysql
+
+import "sync/atomic"
+
+/******************************************************************************
+* Sync utils *
+******************************************************************************/
+
+type atomicBool = atomic.Bool
diff --git a/vendor/github.com/go-sql-driver/mysql/atomic_bool_go118.go b/vendor/github.com/go-sql-driver/mysql/atomic_bool_go118.go
new file mode 100644
index 0000000000..2e9a7f0b61
--- /dev/null
+++ b/vendor/github.com/go-sql-driver/mysql/atomic_bool_go118.go
@@ -0,0 +1,47 @@
+// Go MySQL Driver - A MySQL-Driver for Go's database/sql package.
+//
+// Copyright 2022 The Go-MySQL-Driver Authors. All rights reserved.
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this file,
+// You can obtain one at http://mozilla.org/MPL/2.0/.
+//go:build !go1.19
+// +build !go1.19
+
+package mysql
+
+import "sync/atomic"
+
+/******************************************************************************
+* Sync utils *
+******************************************************************************/
+
+// atomicBool is an implementation of atomic.Bool for older version of Go.
+// it is a wrapper around uint32 for usage as a boolean value with
+// atomic access.
+type atomicBool struct {
+ _ noCopy
+ value uint32
+}
+
+// Load returns whether the current boolean value is true
+func (ab *atomicBool) Load() bool {
+ return atomic.LoadUint32(&ab.value) > 0
+}
+
+// Store sets the value of the bool regardless of the previous value
+func (ab *atomicBool) Store(value bool) {
+ if value {
+ atomic.StoreUint32(&ab.value, 1)
+ } else {
+ atomic.StoreUint32(&ab.value, 0)
+ }
+}
+
+// Swap sets the value of the bool and returns the old value.
+func (ab *atomicBool) Swap(value bool) bool {
+ if value {
+ return atomic.SwapUint32(&ab.value, 1) > 0
+ }
+ return atomic.SwapUint32(&ab.value, 0) > 0
+}
diff --git a/vendor/github.com/go-sql-driver/mysql/auth.go b/vendor/github.com/go-sql-driver/mysql/auth.go
index b2f19e8f0b..1ff203e57b 100644
--- a/vendor/github.com/go-sql-driver/mysql/auth.go
+++ b/vendor/github.com/go-sql-driver/mysql/auth.go
@@ -33,27 +33,26 @@ var (
// Note: The provided rsa.PublicKey instance is exclusively owned by the driver
// after registering it and may not be modified.
//
-// data, err := ioutil.ReadFile("mykey.pem")
-// if err != nil {
-// log.Fatal(err)
-// }
+// data, err := ioutil.ReadFile("mykey.pem")
+// if err != nil {
+// log.Fatal(err)
+// }
//
-// block, _ := pem.Decode(data)
-// if block == nil || block.Type != "PUBLIC KEY" {
-// log.Fatal("failed to decode PEM block containing public key")
-// }
+// block, _ := pem.Decode(data)
+// if block == nil || block.Type != "PUBLIC KEY" {
+// log.Fatal("failed to decode PEM block containing public key")
+// }
//
-// pub, err := x509.ParsePKIXPublicKey(block.Bytes)
-// if err != nil {
-// log.Fatal(err)
-// }
-//
-// if rsaPubKey, ok := pub.(*rsa.PublicKey); ok {
-// mysql.RegisterServerPubKey("mykey", rsaPubKey)
-// } else {
-// log.Fatal("not a RSA public key")
-// }
+// pub, err := x509.ParsePKIXPublicKey(block.Bytes)
+// if err != nil {
+// log.Fatal(err)
+// }
//
+// if rsaPubKey, ok := pub.(*rsa.PublicKey); ok {
+// mysql.RegisterServerPubKey("mykey", rsaPubKey)
+// } else {
+// log.Fatal("not a RSA public key")
+// }
func RegisterServerPubKey(name string, pubKey *rsa.PublicKey) {
serverPubKeyLock.Lock()
if serverPubKeyRegistry == nil {
@@ -274,7 +273,9 @@ func (mc *mysqlConn) auth(authData []byte, plugin string) ([]byte, error) {
if len(mc.cfg.Passwd) == 0 {
return []byte{0}, nil
}
- if mc.cfg.tls != nil || mc.cfg.Net == "unix" {
+ // unlike caching_sha2_password, sha256_password does not accept
+ // cleartext password on unix transport.
+ if mc.cfg.TLS != nil {
// write cleartext auth packet
return append([]byte(mc.cfg.Passwd), 0), nil
}
@@ -350,7 +351,7 @@ func (mc *mysqlConn) handleAuthResult(oldAuthData []byte, plugin string) error {
}
case cachingSha2PasswordPerformFullAuthentication:
- if mc.cfg.tls != nil || mc.cfg.Net == "unix" {
+ if mc.cfg.TLS != nil || mc.cfg.Net == "unix" {
// write cleartext auth packet
err = mc.writeAuthSwitchPacket(append([]byte(mc.cfg.Passwd), 0))
if err != nil {
@@ -365,13 +366,20 @@ func (mc *mysqlConn) handleAuthResult(oldAuthData []byte, plugin string) error {
return err
}
data[4] = cachingSha2PasswordRequestPublicKey
- mc.writePacket(data)
+ err = mc.writePacket(data)
+ if err != nil {
+ return err
+ }
- // parse public key
if data, err = mc.readPacket(); err != nil {
return err
}
+ if data[0] != iAuthMoreData {
+ return fmt.Errorf("unexpect resp from server for caching_sha2_password perform full authentication")
+ }
+
+ // parse public key
block, rest := pem.Decode(data[1:])
if block == nil {
return fmt.Errorf("No Pem data found, data: %s", rest)
@@ -404,6 +412,10 @@ func (mc *mysqlConn) handleAuthResult(oldAuthData []byte, plugin string) error {
return nil // auth successful
default:
block, _ := pem.Decode(authData)
+ if block == nil {
+ return fmt.Errorf("no Pem data found, data: %s", authData)
+ }
+
pub, err := x509.ParsePKIXPublicKey(block.Bytes)
if err != nil {
return err
diff --git a/vendor/github.com/go-sql-driver/mysql/collations.go b/vendor/github.com/go-sql-driver/mysql/collations.go
index 326a9f7fa8..295bfbe52a 100644
--- a/vendor/github.com/go-sql-driver/mysql/collations.go
+++ b/vendor/github.com/go-sql-driver/mysql/collations.go
@@ -13,7 +13,8 @@ const binaryCollation = "binary"
// A list of available collations mapped to the internal ID.
// To update this map use the following MySQL query:
-// SELECT COLLATION_NAME, ID FROM information_schema.COLLATIONS WHERE ID<256 ORDER BY ID
+//
+// SELECT COLLATION_NAME, ID FROM information_schema.COLLATIONS WHERE ID<256 ORDER BY ID
//
// Handshake packet have only 1 byte for collation_id. So we can't use collations with ID > 255.
//
diff --git a/vendor/github.com/go-sql-driver/mysql/conncheck.go b/vendor/github.com/go-sql-driver/mysql/conncheck.go
index 024eb28589..0ea721720c 100644
--- a/vendor/github.com/go-sql-driver/mysql/conncheck.go
+++ b/vendor/github.com/go-sql-driver/mysql/conncheck.go
@@ -6,6 +6,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at http://mozilla.org/MPL/2.0/.
+//go:build linux || darwin || dragonfly || freebsd || netbsd || openbsd || solaris || illumos
// +build linux darwin dragonfly freebsd netbsd openbsd solaris illumos
package mysql
diff --git a/vendor/github.com/go-sql-driver/mysql/conncheck_dummy.go b/vendor/github.com/go-sql-driver/mysql/conncheck_dummy.go
index ea7fb607ac..a56c138f2d 100644
--- a/vendor/github.com/go-sql-driver/mysql/conncheck_dummy.go
+++ b/vendor/github.com/go-sql-driver/mysql/conncheck_dummy.go
@@ -6,6 +6,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at http://mozilla.org/MPL/2.0/.
+//go:build !linux && !darwin && !dragonfly && !freebsd && !netbsd && !openbsd && !solaris && !illumos
// +build !linux,!darwin,!dragonfly,!freebsd,!netbsd,!openbsd,!solaris,!illumos
package mysql
diff --git a/vendor/github.com/go-sql-driver/mysql/connection.go b/vendor/github.com/go-sql-driver/mysql/connection.go
index 835f89729a..9539077cb1 100644
--- a/vendor/github.com/go-sql-driver/mysql/connection.go
+++ b/vendor/github.com/go-sql-driver/mysql/connection.go
@@ -104,7 +104,7 @@ func (mc *mysqlConn) Begin() (driver.Tx, error) {
}
func (mc *mysqlConn) begin(readOnly bool) (driver.Tx, error) {
- if mc.closed.IsSet() {
+ if mc.closed.Load() {
errLog.Print(ErrInvalidConn)
return nil, driver.ErrBadConn
}
@@ -123,7 +123,7 @@ func (mc *mysqlConn) begin(readOnly bool) (driver.Tx, error) {
func (mc *mysqlConn) Close() (err error) {
// Makes Close idempotent
- if !mc.closed.IsSet() {
+ if !mc.closed.Load() {
err = mc.writeCommandPacket(comQuit)
}
@@ -137,7 +137,7 @@ func (mc *mysqlConn) Close() (err error) {
// is called before auth or on auth failure because MySQL will have already
// closed the network connection.
func (mc *mysqlConn) cleanup() {
- if !mc.closed.TrySet(true) {
+ if mc.closed.Swap(true) {
return
}
@@ -152,7 +152,7 @@ func (mc *mysqlConn) cleanup() {
}
func (mc *mysqlConn) error() error {
- if mc.closed.IsSet() {
+ if mc.closed.Load() {
if err := mc.canceled.Value(); err != nil {
return err
}
@@ -162,7 +162,7 @@ func (mc *mysqlConn) error() error {
}
func (mc *mysqlConn) Prepare(query string) (driver.Stmt, error) {
- if mc.closed.IsSet() {
+ if mc.closed.Load() {
errLog.Print(ErrInvalidConn)
return nil, driver.ErrBadConn
}
@@ -295,7 +295,7 @@ func (mc *mysqlConn) interpolateParams(query string, args []driver.Value) (strin
}
func (mc *mysqlConn) Exec(query string, args []driver.Value) (driver.Result, error) {
- if mc.closed.IsSet() {
+ if mc.closed.Load() {
errLog.Print(ErrInvalidConn)
return nil, driver.ErrBadConn
}
@@ -356,7 +356,7 @@ func (mc *mysqlConn) Query(query string, args []driver.Value) (driver.Rows, erro
}
func (mc *mysqlConn) query(query string, args []driver.Value) (*textRows, error) {
- if mc.closed.IsSet() {
+ if mc.closed.Load() {
errLog.Print(ErrInvalidConn)
return nil, driver.ErrBadConn
}
@@ -450,7 +450,7 @@ func (mc *mysqlConn) finish() {
// Ping implements driver.Pinger interface
func (mc *mysqlConn) Ping(ctx context.Context) (err error) {
- if mc.closed.IsSet() {
+ if mc.closed.Load() {
errLog.Print(ErrInvalidConn)
return driver.ErrBadConn
}
@@ -469,7 +469,7 @@ func (mc *mysqlConn) Ping(ctx context.Context) (err error) {
// BeginTx implements driver.ConnBeginTx interface
func (mc *mysqlConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {
- if mc.closed.IsSet() {
+ if mc.closed.Load() {
return nil, driver.ErrBadConn
}
@@ -636,7 +636,7 @@ func (mc *mysqlConn) CheckNamedValue(nv *driver.NamedValue) (err error) {
// ResetSession implements driver.SessionResetter.
// (From Go 1.10)
func (mc *mysqlConn) ResetSession(ctx context.Context) error {
- if mc.closed.IsSet() {
+ if mc.closed.Load() {
return driver.ErrBadConn
}
mc.reset = true
@@ -646,5 +646,5 @@ func (mc *mysqlConn) ResetSession(ctx context.Context) error {
// IsValid implements driver.Validator interface
// (From Go 1.15)
func (mc *mysqlConn) IsValid() bool {
- return !mc.closed.IsSet()
+ return !mc.closed.Load()
}
diff --git a/vendor/github.com/go-sql-driver/mysql/driver.go b/vendor/github.com/go-sql-driver/mysql/driver.go
index c1bdf1199b..ad7aec215c 100644
--- a/vendor/github.com/go-sql-driver/mysql/driver.go
+++ b/vendor/github.com/go-sql-driver/mysql/driver.go
@@ -8,10 +8,10 @@
//
// The driver should be used via the database/sql package:
//
-// import "database/sql"
-// import _ "github.com/go-sql-driver/mysql"
+// import "database/sql"
+// import _ "github.com/go-sql-driver/mysql"
//
-// db, err := sql.Open("mysql", "user:password@/dbname")
+// db, err := sql.Open("mysql", "user:password@/dbname")
//
// See https://github.com/go-sql-driver/mysql#usage for details
package mysql
diff --git a/vendor/github.com/go-sql-driver/mysql/dsn.go b/vendor/github.com/go-sql-driver/mysql/dsn.go
index 93f3548cb8..4b71aaab0b 100644
--- a/vendor/github.com/go-sql-driver/mysql/dsn.go
+++ b/vendor/github.com/go-sql-driver/mysql/dsn.go
@@ -46,22 +46,23 @@ type Config struct {
ServerPubKey string // Server public key name
pubKey *rsa.PublicKey // Server public key
TLSConfig string // TLS configuration name
- tls *tls.Config // TLS configuration
+ TLS *tls.Config // TLS configuration, its priority is higher than TLSConfig
Timeout time.Duration // Dial timeout
ReadTimeout time.Duration // I/O read timeout
WriteTimeout time.Duration // I/O write timeout
- AllowAllFiles bool // Allow all files to be used with LOAD DATA LOCAL INFILE
- AllowCleartextPasswords bool // Allows the cleartext client side plugin
- AllowNativePasswords bool // Allows the native password authentication method
- AllowOldPasswords bool // Allows the old insecure password method
- CheckConnLiveness bool // Check connections for liveness before using them
- ClientFoundRows bool // Return number of matching rows instead of rows changed
- ColumnsWithAlias bool // Prepend table alias to column names
- InterpolateParams bool // Interpolate placeholders into query string
- MultiStatements bool // Allow multiple statements in one query
- ParseTime bool // Parse time values to time.Time
- RejectReadOnly bool // Reject read-only connections
+ AllowAllFiles bool // Allow all files to be used with LOAD DATA LOCAL INFILE
+ AllowCleartextPasswords bool // Allows the cleartext client side plugin
+ AllowFallbackToPlaintext bool // Allows fallback to unencrypted connection if server does not support TLS
+ AllowNativePasswords bool // Allows the native password authentication method
+ AllowOldPasswords bool // Allows the old insecure password method
+ CheckConnLiveness bool // Check connections for liveness before using them
+ ClientFoundRows bool // Return number of matching rows instead of rows changed
+ ColumnsWithAlias bool // Prepend table alias to column names
+ InterpolateParams bool // Interpolate placeholders into query string
+ MultiStatements bool // Allow multiple statements in one query
+ ParseTime bool // Parse time values to time.Time
+ RejectReadOnly bool // Reject read-only connections
}
// NewConfig creates a new Config and sets default values.
@@ -77,8 +78,8 @@ func NewConfig() *Config {
func (cfg *Config) Clone() *Config {
cp := *cfg
- if cp.tls != nil {
- cp.tls = cfg.tls.Clone()
+ if cp.TLS != nil {
+ cp.TLS = cfg.TLS.Clone()
}
if len(cp.Params) > 0 {
cp.Params = make(map[string]string, len(cfg.Params))
@@ -119,24 +120,29 @@ func (cfg *Config) normalize() error {
cfg.Addr = ensureHavePort(cfg.Addr)
}
- switch cfg.TLSConfig {
- case "false", "":
- // don't set anything
- case "true":
- cfg.tls = &tls.Config{}
- case "skip-verify", "preferred":
- cfg.tls = &tls.Config{InsecureSkipVerify: true}
- default:
- cfg.tls = getTLSConfigClone(cfg.TLSConfig)
- if cfg.tls == nil {
- return errors.New("invalid value / unknown config name: " + cfg.TLSConfig)
+ if cfg.TLS == nil {
+ switch cfg.TLSConfig {
+ case "false", "":
+ // don't set anything
+ case "true":
+ cfg.TLS = &tls.Config{}
+ case "skip-verify":
+ cfg.TLS = &tls.Config{InsecureSkipVerify: true}
+ case "preferred":
+ cfg.TLS = &tls.Config{InsecureSkipVerify: true}
+ cfg.AllowFallbackToPlaintext = true
+ default:
+ cfg.TLS = getTLSConfigClone(cfg.TLSConfig)
+ if cfg.TLS == nil {
+ return errors.New("invalid value / unknown config name: " + cfg.TLSConfig)
+ }
}
}
- if cfg.tls != nil && cfg.tls.ServerName == "" && !cfg.tls.InsecureSkipVerify {
+ if cfg.TLS != nil && cfg.TLS.ServerName == "" && !cfg.TLS.InsecureSkipVerify {
host, _, err := net.SplitHostPort(cfg.Addr)
if err == nil {
- cfg.tls.ServerName = host
+ cfg.TLS.ServerName = host
}
}
@@ -204,6 +210,10 @@ func (cfg *Config) FormatDSN() string {
writeDSNParam(&buf, &hasParam, "allowCleartextPasswords", "true")
}
+ if cfg.AllowFallbackToPlaintext {
+ writeDSNParam(&buf, &hasParam, "allowFallbackToPlaintext", "true")
+ }
+
if !cfg.AllowNativePasswords {
writeDSNParam(&buf, &hasParam, "allowNativePasswords", "false")
}
@@ -391,6 +401,14 @@ func parseDSNParams(cfg *Config, params string) (err error) {
return errors.New("invalid bool value: " + value)
}
+ // Allow fallback to unencrypted connection if server does not support TLS
+ case "allowFallbackToPlaintext":
+ var isBool bool
+ cfg.AllowFallbackToPlaintext, isBool = readBool(value)
+ if !isBool {
+ return errors.New("invalid bool value: " + value)
+ }
+
// Use native password authentication
case "allowNativePasswords":
var isBool bool
@@ -426,7 +444,6 @@ func parseDSNParams(cfg *Config, params string) (err error) {
// Collation
case "collation":
cfg.Collation = value
- break
case "columnsWithAlias":
var isBool bool
diff --git a/vendor/github.com/go-sql-driver/mysql/errors.go b/vendor/github.com/go-sql-driver/mysql/errors.go
index 760782ff2f..7c037e7d60 100644
--- a/vendor/github.com/go-sql-driver/mysql/errors.go
+++ b/vendor/github.com/go-sql-driver/mysql/errors.go
@@ -56,10 +56,22 @@ func SetLogger(logger Logger) error {
// MySQLError is an error type which represents a single MySQL error
type MySQLError struct {
- Number uint16
- Message string
+ Number uint16
+ SQLState [5]byte
+ Message string
}
func (me *MySQLError) Error() string {
+ if me.SQLState != [5]byte{} {
+ return fmt.Sprintf("Error %d (%s): %s", me.Number, me.SQLState, me.Message)
+ }
+
return fmt.Sprintf("Error %d: %s", me.Number, me.Message)
}
+
+func (me *MySQLError) Is(err error) bool {
+ if merr, ok := err.(*MySQLError); ok {
+ return merr.Number == me.Number
+ }
+ return false
+}
diff --git a/vendor/github.com/go-sql-driver/mysql/fields.go b/vendor/github.com/go-sql-driver/mysql/fields.go
index ed6c7a37d8..e0654a83d9 100644
--- a/vendor/github.com/go-sql-driver/mysql/fields.go
+++ b/vendor/github.com/go-sql-driver/mysql/fields.go
@@ -41,6 +41,9 @@ func (mf *mysqlField) typeDatabaseName() string {
case fieldTypeJSON:
return "JSON"
case fieldTypeLong:
+ if mf.flags&flagUnsigned != 0 {
+ return "UNSIGNED INT"
+ }
return "INT"
case fieldTypeLongBLOB:
if mf.charSet != collations[binaryCollation] {
@@ -48,6 +51,9 @@ func (mf *mysqlField) typeDatabaseName() string {
}
return "LONGBLOB"
case fieldTypeLongLong:
+ if mf.flags&flagUnsigned != 0 {
+ return "UNSIGNED BIGINT"
+ }
return "BIGINT"
case fieldTypeMediumBLOB:
if mf.charSet != collations[binaryCollation] {
@@ -63,6 +69,9 @@ func (mf *mysqlField) typeDatabaseName() string {
case fieldTypeSet:
return "SET"
case fieldTypeShort:
+ if mf.flags&flagUnsigned != 0 {
+ return "UNSIGNED SMALLINT"
+ }
return "SMALLINT"
case fieldTypeString:
if mf.charSet == collations[binaryCollation] {
@@ -74,6 +83,9 @@ func (mf *mysqlField) typeDatabaseName() string {
case fieldTypeTimestamp:
return "TIMESTAMP"
case fieldTypeTiny:
+ if mf.flags&flagUnsigned != 0 {
+ return "UNSIGNED TINYINT"
+ }
return "TINYINT"
case fieldTypeTinyBLOB:
if mf.charSet != collations[binaryCollation] {
@@ -106,7 +118,7 @@ var (
scanTypeInt64 = reflect.TypeOf(int64(0))
scanTypeNullFloat = reflect.TypeOf(sql.NullFloat64{})
scanTypeNullInt = reflect.TypeOf(sql.NullInt64{})
- scanTypeNullTime = reflect.TypeOf(nullTime{})
+ scanTypeNullTime = reflect.TypeOf(sql.NullTime{})
scanTypeUint8 = reflect.TypeOf(uint8(0))
scanTypeUint16 = reflect.TypeOf(uint16(0))
scanTypeUint32 = reflect.TypeOf(uint32(0))
diff --git a/vendor/github.com/go-sql-driver/mysql/fuzz.go b/vendor/github.com/go-sql-driver/mysql/fuzz.go
index fa75adf6a0..3a4ec25a9e 100644
--- a/vendor/github.com/go-sql-driver/mysql/fuzz.go
+++ b/vendor/github.com/go-sql-driver/mysql/fuzz.go
@@ -6,6 +6,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at http://mozilla.org/MPL/2.0/.
+//go:build gofuzz
// +build gofuzz
package mysql
diff --git a/vendor/github.com/go-sql-driver/mysql/infile.go b/vendor/github.com/go-sql-driver/mysql/infile.go
index 60effdfc22..3279dcffd7 100644
--- a/vendor/github.com/go-sql-driver/mysql/infile.go
+++ b/vendor/github.com/go-sql-driver/mysql/infile.go
@@ -28,12 +28,11 @@ var (
// Alternatively you can allow the use of all local files with
// the DSN parameter 'allowAllFiles=true'
//
-// filePath := "/home/gopher/data.csv"
-// mysql.RegisterLocalFile(filePath)
-// err := db.Exec("LOAD DATA LOCAL INFILE '" + filePath + "' INTO TABLE foo")
-// if err != nil {
-// ...
-//
+// filePath := "/home/gopher/data.csv"
+// mysql.RegisterLocalFile(filePath)
+// err := db.Exec("LOAD DATA LOCAL INFILE '" + filePath + "' INTO TABLE foo")
+// if err != nil {
+// ...
func RegisterLocalFile(filePath string) {
fileRegisterLock.Lock()
// lazy map init
@@ -58,15 +57,14 @@ func DeregisterLocalFile(filePath string) {
// If the handler returns a io.ReadCloser Close() is called when the
// request is finished.
//
-// mysql.RegisterReaderHandler("data", func() io.Reader {
-// var csvReader io.Reader // Some Reader that returns CSV data
-// ... // Open Reader here
-// return csvReader
-// })
-// err := db.Exec("LOAD DATA LOCAL INFILE 'Reader::data' INTO TABLE foo")
-// if err != nil {
-// ...
-//
+// mysql.RegisterReaderHandler("data", func() io.Reader {
+// var csvReader io.Reader // Some Reader that returns CSV data
+// ... // Open Reader here
+// return csvReader
+// })
+// err := db.Exec("LOAD DATA LOCAL INFILE 'Reader::data' INTO TABLE foo")
+// if err != nil {
+// ...
func RegisterReaderHandler(name string, handler func() io.Reader) {
readerRegisterLock.Lock()
// lazy map init
@@ -93,10 +91,12 @@ func deferredClose(err *error, closer io.Closer) {
}
}
+const defaultPacketSize = 16 * 1024 // 16KB is small enough for disk readahead and large enough for TCP
+
func (mc *mysqlConn) handleInFileRequest(name string) (err error) {
var rdr io.Reader
var data []byte
- packetSize := 16 * 1024 // 16KB is small enough for disk readahead and large enough for TCP
+ packetSize := defaultPacketSize
if mc.maxWriteSize < packetSize {
packetSize = mc.maxWriteSize
}
diff --git a/vendor/github.com/go-sql-driver/mysql/nulltime.go b/vendor/github.com/go-sql-driver/mysql/nulltime.go
index 651723a961..36c8a42c57 100644
--- a/vendor/github.com/go-sql-driver/mysql/nulltime.go
+++ b/vendor/github.com/go-sql-driver/mysql/nulltime.go
@@ -9,11 +9,32 @@
package mysql
import (
+ "database/sql"
"database/sql/driver"
"fmt"
"time"
)
+// NullTime represents a time.Time that may be NULL.
+// NullTime implements the Scanner interface so
+// it can be used as a scan destination:
+//
+// var nt NullTime
+// err := db.QueryRow("SELECT time FROM foo WHERE id=?", id).Scan(&nt)
+// ...
+// if nt.Valid {
+// // use nt.Time
+// } else {
+// // NULL value
+// }
+//
+// # This NullTime implementation is not driver-specific
+//
+// Deprecated: NullTime doesn't honor the loc DSN parameter.
+// NullTime.Scan interprets a time as UTC, not the loc DSN parameter.
+// Use sql.NullTime instead.
+type NullTime sql.NullTime
+
// Scan implements the Scanner interface.
// The value type must be time.Time or string / []byte (formatted time-string),
// otherwise Scan fails.
diff --git a/vendor/github.com/go-sql-driver/mysql/nulltime_go113.go b/vendor/github.com/go-sql-driver/mysql/nulltime_go113.go
deleted file mode 100644
index 453b4b3944..0000000000
--- a/vendor/github.com/go-sql-driver/mysql/nulltime_go113.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-//
-// Copyright 2013 The Go-MySQL-Driver Authors. All rights reserved.
-//
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-// +build go1.13
-
-package mysql
-
-import (
- "database/sql"
-)
-
-// NullTime represents a time.Time that may be NULL.
-// NullTime implements the Scanner interface so
-// it can be used as a scan destination:
-//
-// var nt NullTime
-// err := db.QueryRow("SELECT time FROM foo WHERE id=?", id).Scan(&nt)
-// ...
-// if nt.Valid {
-// // use nt.Time
-// } else {
-// // NULL value
-// }
-//
-// This NullTime implementation is not driver-specific
-//
-// Deprecated: NullTime doesn't honor the loc DSN parameter.
-// NullTime.Scan interprets a time as UTC, not the loc DSN parameter.
-// Use sql.NullTime instead.
-type NullTime sql.NullTime
-
-// for internal use.
-// the mysql package uses sql.NullTime if it is available.
-// if not, the package uses mysql.NullTime.
-type nullTime = sql.NullTime // sql.NullTime is available
diff --git a/vendor/github.com/go-sql-driver/mysql/nulltime_legacy.go b/vendor/github.com/go-sql-driver/mysql/nulltime_legacy.go
deleted file mode 100644
index 9f7ae27a8e..0000000000
--- a/vendor/github.com/go-sql-driver/mysql/nulltime_legacy.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-//
-// Copyright 2013 The Go-MySQL-Driver Authors. All rights reserved.
-//
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-// +build !go1.13
-
-package mysql
-
-import (
- "time"
-)
-
-// NullTime represents a time.Time that may be NULL.
-// NullTime implements the Scanner interface so
-// it can be used as a scan destination:
-//
-// var nt NullTime
-// err := db.QueryRow("SELECT time FROM foo WHERE id=?", id).Scan(&nt)
-// ...
-// if nt.Valid {
-// // use nt.Time
-// } else {
-// // NULL value
-// }
-//
-// This NullTime implementation is not driver-specific
-type NullTime struct {
- Time time.Time
- Valid bool // Valid is true if Time is not NULL
-}
-
-// for internal use.
-// the mysql package uses sql.NullTime if it is available.
-// if not, the package uses mysql.NullTime.
-type nullTime = NullTime // sql.NullTime is not available
diff --git a/vendor/github.com/go-sql-driver/mysql/packets.go b/vendor/github.com/go-sql-driver/mysql/packets.go
index 6664e5ae5d..ee05c95a87 100644
--- a/vendor/github.com/go-sql-driver/mysql/packets.go
+++ b/vendor/github.com/go-sql-driver/mysql/packets.go
@@ -110,14 +110,13 @@ func (mc *mysqlConn) writePacket(data []byte) error {
conn = mc.rawConn
}
var err error
- // If this connection has a ReadTimeout which we've been setting on
- // reads, reset it to its default value before we attempt a non-blocking
- // read, otherwise the scheduler will just time us out before we can read
- if mc.cfg.ReadTimeout != 0 {
- err = conn.SetReadDeadline(time.Time{})
- }
- if err == nil && mc.cfg.CheckConnLiveness {
- err = connCheck(conn)
+ if mc.cfg.CheckConnLiveness {
+ if mc.cfg.ReadTimeout != 0 {
+ err = conn.SetReadDeadline(time.Now().Add(mc.cfg.ReadTimeout))
+ }
+ if err == nil {
+ err = connCheck(conn)
+ }
}
if err != nil {
errLog.Print("closing bad idle connection: ", err)
@@ -223,9 +222,9 @@ func (mc *mysqlConn) readHandshakePacket() (data []byte, plugin string, err erro
if mc.flags&clientProtocol41 == 0 {
return nil, "", ErrOldProtocol
}
- if mc.flags&clientSSL == 0 && mc.cfg.tls != nil {
- if mc.cfg.TLSConfig == "preferred" {
- mc.cfg.tls = nil
+ if mc.flags&clientSSL == 0 && mc.cfg.TLS != nil {
+ if mc.cfg.AllowFallbackToPlaintext {
+ mc.cfg.TLS = nil
} else {
return nil, "", ErrNoTLS
}
@@ -293,7 +292,7 @@ func (mc *mysqlConn) writeHandshakeResponsePacket(authResp []byte, plugin string
}
// To enable TLS / SSL
- if mc.cfg.tls != nil {
+ if mc.cfg.TLS != nil {
clientFlags |= clientSSL
}
@@ -357,14 +356,14 @@ func (mc *mysqlConn) writeHandshakeResponsePacket(authResp []byte, plugin string
// SSL Connection Request Packet
// http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::SSLRequest
- if mc.cfg.tls != nil {
+ if mc.cfg.TLS != nil {
// Send TLS / SSL request packet
if err := mc.writePacket(data[:(4+4+1+23)+4]); err != nil {
return err
}
// Switch to TLS
- tlsConn := tls.Client(mc.netConn, mc.cfg.tls)
+ tlsConn := tls.Client(mc.netConn, mc.cfg.TLS)
if err := tlsConn.Handshake(); err != nil {
return err
}
@@ -588,19 +587,20 @@ func (mc *mysqlConn) handleErrorPacket(data []byte) error {
return driver.ErrBadConn
}
+ me := &MySQLError{Number: errno}
+
pos := 3
// SQL State [optional: # + 5bytes string]
if data[3] == 0x23 {
- //sqlstate := string(data[4 : 4+5])
+ copy(me.SQLState[:], data[4:4+5])
pos = 9
}
// Error Message [string]
- return &MySQLError{
- Number: errno,
- Message: string(data[pos:]),
- }
+ me.Message = string(data[pos:])
+
+ return me
}
func readStatus(b []byte) statusFlag {
@@ -761,40 +761,40 @@ func (rows *textRows) readRow(dest []driver.Value) error {
}
// RowSet Packet
- var n int
- var isNull bool
- pos := 0
+ var (
+ n int
+ isNull bool
+ pos int = 0
+ )
for i := range dest {
// Read bytes and convert to string
dest[i], isNull, n, err = readLengthEncodedString(data[pos:])
pos += n
- if err == nil {
- if !isNull {
- if !mc.parseTime {
- continue
- } else {
- switch rows.rs.columns[i].fieldType {
- case fieldTypeTimestamp, fieldTypeDateTime,
- fieldTypeDate, fieldTypeNewDate:
- dest[i], err = parseDateTime(
- dest[i].([]byte),
- mc.cfg.Loc,
- )
- if err == nil {
- continue
- }
- default:
- continue
- }
- }
- } else {
- dest[i] = nil
- continue
+ if err != nil {
+ return err
+ }
+
+ if isNull {
+ dest[i] = nil
+ continue
+ }
+
+ if !mc.parseTime {
+ continue
+ }
+
+ // Parse time field
+ switch rows.rs.columns[i].fieldType {
+ case fieldTypeTimestamp,
+ fieldTypeDateTime,
+ fieldTypeDate,
+ fieldTypeNewDate:
+ if dest[i], err = parseDateTime(dest[i].([]byte), mc.cfg.Loc); err != nil {
+ return err
}
}
- return err // err != nil
}
return nil
diff --git a/vendor/github.com/go-sql-driver/mysql/statement.go b/vendor/github.com/go-sql-driver/mysql/statement.go
index 18a3ae4989..10ece8bd6a 100644
--- a/vendor/github.com/go-sql-driver/mysql/statement.go
+++ b/vendor/github.com/go-sql-driver/mysql/statement.go
@@ -23,7 +23,7 @@ type mysqlStmt struct {
}
func (stmt *mysqlStmt) Close() error {
- if stmt.mc == nil || stmt.mc.closed.IsSet() {
+ if stmt.mc == nil || stmt.mc.closed.Load() {
// driver.Stmt.Close can be called more than once, thus this function
// has to be idempotent.
// See also Issue #450 and golang/go#16019.
@@ -50,7 +50,7 @@ func (stmt *mysqlStmt) CheckNamedValue(nv *driver.NamedValue) (err error) {
}
func (stmt *mysqlStmt) Exec(args []driver.Value) (driver.Result, error) {
- if stmt.mc.closed.IsSet() {
+ if stmt.mc.closed.Load() {
errLog.Print(ErrInvalidConn)
return nil, driver.ErrBadConn
}
@@ -98,7 +98,7 @@ func (stmt *mysqlStmt) Query(args []driver.Value) (driver.Rows, error) {
}
func (stmt *mysqlStmt) query(args []driver.Value) (*binaryRows, error) {
- if stmt.mc.closed.IsSet() {
+ if stmt.mc.closed.Load() {
errLog.Print(ErrInvalidConn)
return nil, driver.ErrBadConn
}
@@ -157,7 +157,7 @@ func (c converter) ConvertValue(v interface{}) (driver.Value, error) {
if driver.IsValue(sv) {
return sv, nil
}
- // A value returend from the Valuer interface can be "a type handled by
+ // A value returned from the Valuer interface can be "a type handled by
// a database driver's NamedValueChecker interface" so we should accept
// uint64 here as well.
if u, ok := sv.(uint64); ok {
diff --git a/vendor/github.com/go-sql-driver/mysql/transaction.go b/vendor/github.com/go-sql-driver/mysql/transaction.go
index 417d72793b..4a4b610010 100644
--- a/vendor/github.com/go-sql-driver/mysql/transaction.go
+++ b/vendor/github.com/go-sql-driver/mysql/transaction.go
@@ -13,7 +13,7 @@ type mysqlTx struct {
}
func (tx *mysqlTx) Commit() (err error) {
- if tx.mc == nil || tx.mc.closed.IsSet() {
+ if tx.mc == nil || tx.mc.closed.Load() {
return ErrInvalidConn
}
err = tx.mc.exec("COMMIT")
@@ -22,7 +22,7 @@ func (tx *mysqlTx) Commit() (err error) {
}
func (tx *mysqlTx) Rollback() (err error) {
- if tx.mc == nil || tx.mc.closed.IsSet() {
+ if tx.mc == nil || tx.mc.closed.Load() {
return ErrInvalidConn
}
err = tx.mc.exec("ROLLBACK")
diff --git a/vendor/github.com/go-sql-driver/mysql/utils.go b/vendor/github.com/go-sql-driver/mysql/utils.go
index d6545f5be8..15dbd8d16a 100644
--- a/vendor/github.com/go-sql-driver/mysql/utils.go
+++ b/vendor/github.com/go-sql-driver/mysql/utils.go
@@ -35,26 +35,25 @@ var (
// Note: The provided tls.Config is exclusively owned by the driver after
// registering it.
//
-// rootCertPool := x509.NewCertPool()
-// pem, err := ioutil.ReadFile("/path/ca-cert.pem")
-// if err != nil {
-// log.Fatal(err)
-// }
-// if ok := rootCertPool.AppendCertsFromPEM(pem); !ok {
-// log.Fatal("Failed to append PEM.")
-// }
-// clientCert := make([]tls.Certificate, 0, 1)
-// certs, err := tls.LoadX509KeyPair("/path/client-cert.pem", "/path/client-key.pem")
-// if err != nil {
-// log.Fatal(err)
-// }
-// clientCert = append(clientCert, certs)
-// mysql.RegisterTLSConfig("custom", &tls.Config{
-// RootCAs: rootCertPool,
-// Certificates: clientCert,
-// })
-// db, err := sql.Open("mysql", "user@tcp(localhost:3306)/test?tls=custom")
-//
+// rootCertPool := x509.NewCertPool()
+// pem, err := ioutil.ReadFile("/path/ca-cert.pem")
+// if err != nil {
+// log.Fatal(err)
+// }
+// if ok := rootCertPool.AppendCertsFromPEM(pem); !ok {
+// log.Fatal("Failed to append PEM.")
+// }
+// clientCert := make([]tls.Certificate, 0, 1)
+// certs, err := tls.LoadX509KeyPair("/path/client-cert.pem", "/path/client-key.pem")
+// if err != nil {
+// log.Fatal(err)
+// }
+// clientCert = append(clientCert, certs)
+// mysql.RegisterTLSConfig("custom", &tls.Config{
+// RootCAs: rootCertPool,
+// Certificates: clientCert,
+// })
+// db, err := sql.Open("mysql", "user@tcp(localhost:3306)/test?tls=custom")
func RegisterTLSConfig(key string, config *tls.Config) error {
if _, isBool := readBool(key); isBool || strings.ToLower(key) == "skip-verify" || strings.ToLower(key) == "preferred" {
return fmt.Errorf("key '%s' is reserved", key)
@@ -118,10 +117,6 @@ func parseDateTime(b []byte, loc *time.Location) (time.Time, error) {
if err != nil {
return time.Time{}, err
}
- if year <= 0 {
- year = 1
- }
-
if b[4] != '-' {
return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[4])
}
@@ -130,9 +125,6 @@ func parseDateTime(b []byte, loc *time.Location) (time.Time, error) {
if err != nil {
return time.Time{}, err
}
- if m <= 0 {
- m = 1
- }
month := time.Month(m)
if b[7] != '-' {
@@ -143,9 +135,6 @@ func parseDateTime(b []byte, loc *time.Location) (time.Time, error) {
if err != nil {
return time.Time{}, err
}
- if day <= 0 {
- day = 1
- }
if len(b) == 10 {
return time.Date(year, month, day, 0, 0, 0, 0, loc), nil
}
@@ -199,7 +188,7 @@ func parseByteYear(b []byte) (int, error) {
return 0, err
}
year += v * n
- n = n / 10
+ n /= 10
}
return year, nil
}
@@ -542,7 +531,7 @@ func stringToInt(b []byte) int {
return val
}
-// returns the string read as a bytes slice, wheter the value is NULL,
+// returns the string read as a bytes slice, whether the value is NULL,
// the number of bytes read and an error, in case the string is longer than
// the input slice
func readLengthEncodedString(b []byte) ([]byte, bool, int, error) {
@@ -652,32 +641,32 @@ func escapeBytesBackslash(buf, v []byte) []byte {
for _, c := range v {
switch c {
case '\x00':
- buf[pos] = '\\'
buf[pos+1] = '0'
+ buf[pos] = '\\'
pos += 2
case '\n':
- buf[pos] = '\\'
buf[pos+1] = 'n'
+ buf[pos] = '\\'
pos += 2
case '\r':
- buf[pos] = '\\'
buf[pos+1] = 'r'
+ buf[pos] = '\\'
pos += 2
case '\x1a':
- buf[pos] = '\\'
buf[pos+1] = 'Z'
+ buf[pos] = '\\'
pos += 2
case '\'':
- buf[pos] = '\\'
buf[pos+1] = '\''
+ buf[pos] = '\\'
pos += 2
case '"':
- buf[pos] = '\\'
buf[pos+1] = '"'
+ buf[pos] = '\\'
pos += 2
case '\\':
- buf[pos] = '\\'
buf[pos+1] = '\\'
+ buf[pos] = '\\'
pos += 2
default:
buf[pos] = c
@@ -697,32 +686,32 @@ func escapeStringBackslash(buf []byte, v string) []byte {
c := v[i]
switch c {
case '\x00':
- buf[pos] = '\\'
buf[pos+1] = '0'
+ buf[pos] = '\\'
pos += 2
case '\n':
- buf[pos] = '\\'
buf[pos+1] = 'n'
+ buf[pos] = '\\'
pos += 2
case '\r':
- buf[pos] = '\\'
buf[pos+1] = 'r'
+ buf[pos] = '\\'
pos += 2
case '\x1a':
- buf[pos] = '\\'
buf[pos+1] = 'Z'
+ buf[pos] = '\\'
pos += 2
case '\'':
- buf[pos] = '\\'
buf[pos+1] = '\''
+ buf[pos] = '\\'
pos += 2
case '"':
- buf[pos] = '\\'
buf[pos+1] = '"'
+ buf[pos] = '\\'
pos += 2
case '\\':
- buf[pos] = '\\'
buf[pos+1] = '\\'
+ buf[pos] = '\\'
pos += 2
default:
buf[pos] = c
@@ -744,8 +733,8 @@ func escapeBytesQuotes(buf, v []byte) []byte {
for _, c := range v {
if c == '\'' {
- buf[pos] = '\''
buf[pos+1] = '\''
+ buf[pos] = '\''
pos += 2
} else {
buf[pos] = c
@@ -764,8 +753,8 @@ func escapeStringQuotes(buf []byte, v string) []byte {
for i := 0; i < len(v); i++ {
c := v[i]
if c == '\'' {
- buf[pos] = '\''
buf[pos+1] = '\''
+ buf[pos] = '\''
pos += 2
} else {
buf[pos] = c
@@ -790,39 +779,16 @@ type noCopy struct{}
// Lock is a no-op used by -copylocks checker from `go vet`.
func (*noCopy) Lock() {}
-// atomicBool is a wrapper around uint32 for usage as a boolean value with
-// atomic access.
-type atomicBool struct {
- _noCopy noCopy
- value uint32
-}
-
-// IsSet returns whether the current boolean value is true
-func (ab *atomicBool) IsSet() bool {
- return atomic.LoadUint32(&ab.value) > 0
-}
-
-// Set sets the value of the bool regardless of the previous value
-func (ab *atomicBool) Set(value bool) {
- if value {
- atomic.StoreUint32(&ab.value, 1)
- } else {
- atomic.StoreUint32(&ab.value, 0)
- }
-}
-
-// TrySet sets the value of the bool and returns whether the value changed
-func (ab *atomicBool) TrySet(value bool) bool {
- if value {
- return atomic.SwapUint32(&ab.value, 1) == 0
- }
- return atomic.SwapUint32(&ab.value, 0) > 0
-}
+// Unlock is a no-op used by -copylocks checker from `go vet`.
+// noCopy should implement sync.Locker from Go 1.11
+// https://github.com/golang/go/commit/c2eba53e7f80df21d51285879d51ab81bcfbf6bc
+// https://github.com/golang/go/issues/26165
+func (*noCopy) Unlock() {}
// atomicError is a wrapper for atomically accessed error values
type atomicError struct {
- _noCopy noCopy
- value atomic.Value
+ _ noCopy
+ value atomic.Value
}
// Set sets the error value regardless of the previous value.
diff --git a/vendor/github.com/golang-jwt/jwt/v4/.gitignore b/vendor/github.com/golang-jwt/jwt/v4/.gitignore
new file mode 100644
index 0000000000..09573e0169
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/.gitignore
@@ -0,0 +1,4 @@
+.DS_Store
+bin
+.idea/
+
diff --git a/vendor/github.com/golang-jwt/jwt/v4/LICENSE b/vendor/github.com/golang-jwt/jwt/v4/LICENSE
new file mode 100644
index 0000000000..35dbc25204
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/LICENSE
@@ -0,0 +1,9 @@
+Copyright (c) 2012 Dave Grijalva
+Copyright (c) 2021 golang-jwt maintainers
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
diff --git a/vendor/github.com/golang-jwt/jwt/v4/MIGRATION_GUIDE.md b/vendor/github.com/golang-jwt/jwt/v4/MIGRATION_GUIDE.md
new file mode 100644
index 0000000000..32966f5981
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/MIGRATION_GUIDE.md
@@ -0,0 +1,22 @@
+## Migration Guide (v4.0.0)
+
+Starting from [v4.0.0](https://github.com/golang-jwt/jwt/releases/tag/v4.0.0), the import path will be:
+
+ "github.com/golang-jwt/jwt/v4"
+
+The `/v4` version will be backwards compatible with existing `v3.x.y` tags in this repo, as well as
+`github.com/dgrijalva/jwt-go`. For most users this should be a drop-in replacement, if you're having
+troubles migrating, please open an issue.
+
+You can replace all occurrences of `github.com/dgrijalva/jwt-go` or `github.com/golang-jwt/jwt` with `github.com/golang-jwt/jwt/v4`, either manually or by using tools such as `sed` or `gofmt`.
+
+And then you'd typically run:
+
+```
+go get github.com/golang-jwt/jwt/v4
+go mod tidy
+```
+
+## Older releases (before v3.2.0)
+
+The original migration guide for older releases can be found at https://github.com/dgrijalva/jwt-go/blob/master/MIGRATION_GUIDE.md.
diff --git a/vendor/github.com/golang-jwt/jwt/v4/README.md b/vendor/github.com/golang-jwt/jwt/v4/README.md
new file mode 100644
index 0000000000..30f2f2a6f7
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/README.md
@@ -0,0 +1,138 @@
+# jwt-go
+
+[](https://github.com/golang-jwt/jwt/actions/workflows/build.yml)
+[](https://pkg.go.dev/github.com/golang-jwt/jwt/v4)
+
+A [go](http://www.golang.org) (or 'golang' for search engine friendliness) implementation of [JSON Web Tokens](https://datatracker.ietf.org/doc/html/rfc7519).
+
+Starting with [v4.0.0](https://github.com/golang-jwt/jwt/releases/tag/v4.0.0) this project adds Go module support, but maintains backwards compatibility with older `v3.x.y` tags and upstream `github.com/dgrijalva/jwt-go`.
+See the [`MIGRATION_GUIDE.md`](./MIGRATION_GUIDE.md) for more information.
+
+> After the original author of the library suggested migrating the maintenance of `jwt-go`, a dedicated team of open source maintainers decided to clone the existing library into this repository. See [dgrijalva/jwt-go#462](https://github.com/dgrijalva/jwt-go/issues/462) for a detailed discussion on this topic.
+
+
+**SECURITY NOTICE:** Some older versions of Go have a security issue in the crypto/elliptic. Recommendation is to upgrade to at least 1.15 See issue [dgrijalva/jwt-go#216](https://github.com/dgrijalva/jwt-go/issues/216) for more detail.
+
+**SECURITY NOTICE:** It's important that you [validate the `alg` presented is what you expect](https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/). This library attempts to make it easy to do the right thing by requiring key types match the expected alg, but you should take the extra step to verify it in your usage. See the examples provided.
+
+### Supported Go versions
+
+Our support of Go versions is aligned with Go's [version release policy](https://golang.org/doc/devel/release#policy).
+So we will support a major version of Go until there are two newer major releases.
+We no longer support building jwt-go with unsupported Go versions, as these contain security vulnerabilities
+which will not be fixed.
+
+## What the heck is a JWT?
+
+JWT.io has [a great introduction](https://jwt.io/introduction) to JSON Web Tokens.
+
+In short, it's a signed JSON object that does something useful (for example, authentication). It's commonly used for `Bearer` tokens in Oauth 2. A token is made of three parts, separated by `.`'s. The first two parts are JSON objects, that have been [base64url](https://datatracker.ietf.org/doc/html/rfc4648) encoded. The last part is the signature, encoded the same way.
+
+The first part is called the header. It contains the necessary information for verifying the last part, the signature. For example, which encryption method was used for signing and what key was used.
+
+The part in the middle is the interesting bit. It's called the Claims and contains the actual stuff you care about. Refer to [RFC 7519](https://datatracker.ietf.org/doc/html/rfc7519) for information about reserved keys and the proper way to add your own.
+
+## What's in the box?
+
+This library supports the parsing and verification as well as the generation and signing of JWTs. Current supported signing algorithms are HMAC SHA, RSA, RSA-PSS, and ECDSA, though hooks are present for adding your own.
+
+## Installation Guidelines
+
+1. To install the jwt package, you first need to have [Go](https://go.dev/doc/install) installed, then you can use the command below to add `jwt-go` as a dependency in your Go program.
+
+```sh
+go get -u github.com/golang-jwt/jwt/v4
+```
+
+2. Import it in your code:
+
+```go
+import "github.com/golang-jwt/jwt/v4"
+```
+
+## Examples
+
+See [the project documentation](https://pkg.go.dev/github.com/golang-jwt/jwt/v4) for examples of usage:
+
+* [Simple example of parsing and validating a token](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#example-Parse-Hmac)
+* [Simple example of building and signing a token](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#example-New-Hmac)
+* [Directory of Examples](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#pkg-examples)
+
+## Extensions
+
+This library publishes all the necessary components for adding your own signing methods or key functions. Simply implement the `SigningMethod` interface and register a factory method using `RegisterSigningMethod` or provide a `jwt.Keyfunc`.
+
+A common use case would be integrating with different 3rd party signature providers, like key management services from various cloud providers or Hardware Security Modules (HSMs) or to implement additional standards.
+
+| Extension | Purpose | Repo |
+| --------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
+| GCP | Integrates with multiple Google Cloud Platform signing tools (AppEngine, IAM API, Cloud KMS) | https://github.com/someone1/gcp-jwt-go |
+| AWS | Integrates with AWS Key Management Service, KMS | https://github.com/matelang/jwt-go-aws-kms |
+| JWKS | Provides support for JWKS ([RFC 7517](https://datatracker.ietf.org/doc/html/rfc7517)) as a `jwt.Keyfunc` | https://github.com/MicahParks/keyfunc |
+
+*Disclaimer*: Unless otherwise specified, these integrations are maintained by third parties and should not be considered as a primary offer by any of the mentioned cloud providers
+
+## Compliance
+
+This library was last reviewed to comply with [RFC 7519](https://datatracker.ietf.org/doc/html/rfc7519) dated May 2015 with a few notable differences:
+
+* In order to protect against accidental use of [Unsecured JWTs](https://datatracker.ietf.org/doc/html/rfc7519#section-6), tokens using `alg=none` will only be accepted if the constant `jwt.UnsafeAllowNoneSignatureType` is provided as the key.
+
+## Project Status & Versioning
+
+This library is considered production ready. Feedback and feature requests are appreciated. The API should be considered stable. There should be very few backwards-incompatible changes outside of major version updates (and only with good reason).
+
+This project uses [Semantic Versioning 2.0.0](http://semver.org). Accepted pull requests will land on `main`. Periodically, versions will be tagged from `main`. You can find all the releases on [the project releases page](https://github.com/golang-jwt/jwt/releases).
+
+**BREAKING CHANGES:***
+A full list of breaking changes is available in `VERSION_HISTORY.md`. See `MIGRATION_GUIDE.md` for more information on updating your code.
+
+## Usage Tips
+
+### Signing vs Encryption
+
+A token is simply a JSON object that is signed by its author. this tells you exactly two things about the data:
+
+* The author of the token was in the possession of the signing secret
+* The data has not been modified since it was signed
+
+It's important to know that JWT does not provide encryption, which means anyone who has access to the token can read its contents. If you need to protect (encrypt) the data, there is a companion spec, `JWE`, that provides this functionality. The companion project https://github.com/golang-jwt/jwe aims at a (very) experimental implementation of the JWE standard.
+
+### Choosing a Signing Method
+
+There are several signing methods available, and you should probably take the time to learn about the various options before choosing one. The principal design decision is most likely going to be symmetric vs asymmetric.
+
+Symmetric signing methods, such as HSA, use only a single secret. This is probably the simplest signing method to use since any `[]byte` can be used as a valid secret. They are also slightly computationally faster to use, though this rarely is enough to matter. Symmetric signing methods work the best when both producers and consumers of tokens are trusted, or even the same system. Since the same secret is used to both sign and validate tokens, you can't easily distribute the key for validation.
+
+Asymmetric signing methods, such as RSA, use different keys for signing and verifying tokens. This makes it possible to produce tokens with a private key, and allow any consumer to access the public key for verification.
+
+### Signing Methods and Key Types
+
+Each signing method expects a different object type for its signing keys. See the package documentation for details. Here are the most common ones:
+
+* The [HMAC signing method](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#SigningMethodHMAC) (`HS256`,`HS384`,`HS512`) expect `[]byte` values for signing and validation
+* The [RSA signing method](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#SigningMethodRSA) (`RS256`,`RS384`,`RS512`) expect `*rsa.PrivateKey` for signing and `*rsa.PublicKey` for validation
+* The [ECDSA signing method](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#SigningMethodECDSA) (`ES256`,`ES384`,`ES512`) expect `*ecdsa.PrivateKey` for signing and `*ecdsa.PublicKey` for validation
+* The [EdDSA signing method](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#SigningMethodEd25519) (`Ed25519`) expect `ed25519.PrivateKey` for signing and `ed25519.PublicKey` for validation
+
+### JWT and OAuth
+
+It's worth mentioning that OAuth and JWT are not the same thing. A JWT token is simply a signed JSON object. It can be used anywhere such a thing is useful. There is some confusion, though, as JWT is the most common type of bearer token used in OAuth2 authentication.
+
+Without going too far down the rabbit hole, here's a description of the interaction of these technologies:
+
+* OAuth is a protocol for allowing an identity provider to be separate from the service a user is logging in to. For example, whenever you use Facebook to log into a different service (Yelp, Spotify, etc), you are using OAuth.
+* OAuth defines several options for passing around authentication data. One popular method is called a "bearer token". A bearer token is simply a string that _should_ only be held by an authenticated user. Thus, simply presenting this token proves your identity. You can probably derive from here why a JWT might make a good bearer token.
+* Because bearer tokens are used for authentication, it's important they're kept secret. This is why transactions that use bearer tokens typically happen over SSL.
+
+### Troubleshooting
+
+This library uses descriptive error messages whenever possible. If you are not getting the expected result, have a look at the errors. The most common place people get stuck is providing the correct type of key to the parser. See the above section on signing methods and key types.
+
+## More
+
+Documentation can be found [on pkg.go.dev](https://pkg.go.dev/github.com/golang-jwt/jwt/v4).
+
+The command line utility included in this project (cmd/jwt) provides a straightforward example of token creation and parsing as well as a useful tool for debugging your own integration. You'll also find several implementation examples in the documentation.
+
+[golang-jwt](https://github.com/orgs/golang-jwt) incorporates a modified version of the JWT logo, which is distributed under the terms of the [MIT License](https://github.com/jsonwebtoken/jsonwebtoken.github.io/blob/master/LICENSE.txt).
diff --git a/vendor/github.com/golang-jwt/jwt/v4/SECURITY.md b/vendor/github.com/golang-jwt/jwt/v4/SECURITY.md
new file mode 100644
index 0000000000..b08402c342
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/SECURITY.md
@@ -0,0 +1,19 @@
+# Security Policy
+
+## Supported Versions
+
+As of February 2022 (and until this document is updated), the latest version `v4` is supported.
+
+## Reporting a Vulnerability
+
+If you think you found a vulnerability, and even if you are not sure, please report it to jwt-go-security@googlegroups.com or one of the other [golang-jwt maintainers](https://github.com/orgs/golang-jwt/people). Please try be explicit, describe steps to reproduce the security issue with code example(s).
+
+You will receive a response within a timely manner. If the issue is confirmed, we will do our best to release a patch as soon as possible given the complexity of the problem.
+
+## Public Discussions
+
+Please avoid publicly discussing a potential security vulnerability.
+
+Let's take this offline and find a solution first, this limits the potential impact as much as possible.
+
+We appreciate your help!
diff --git a/vendor/github.com/golang-jwt/jwt/v4/VERSION_HISTORY.md b/vendor/github.com/golang-jwt/jwt/v4/VERSION_HISTORY.md
new file mode 100644
index 0000000000..afbfc4e408
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/VERSION_HISTORY.md
@@ -0,0 +1,135 @@
+## `jwt-go` Version History
+
+#### 4.0.0
+
+* Introduces support for Go modules. The `v4` version will be backwards compatible with `v3.x.y`.
+
+#### 3.2.2
+
+* Starting from this release, we are adopting the policy to support the most 2 recent versions of Go currently available. By the time of this release, this is Go 1.15 and 1.16 ([#28](https://github.com/golang-jwt/jwt/pull/28)).
+* Fixed a potential issue that could occur when the verification of `exp`, `iat` or `nbf` was not required and contained invalid contents, i.e. non-numeric/date. Thanks for @thaJeztah for making us aware of that and @giorgos-f3 for originally reporting it to the formtech fork ([#40](https://github.com/golang-jwt/jwt/pull/40)).
+* Added support for EdDSA / ED25519 ([#36](https://github.com/golang-jwt/jwt/pull/36)).
+* Optimized allocations ([#33](https://github.com/golang-jwt/jwt/pull/33)).
+
+#### 3.2.1
+
+* **Import Path Change**: See MIGRATION_GUIDE.md for tips on updating your code
+ * Changed the import path from `github.com/dgrijalva/jwt-go` to `github.com/golang-jwt/jwt`
+* Fixed type confusing issue between `string` and `[]string` in `VerifyAudience` ([#12](https://github.com/golang-jwt/jwt/pull/12)). This fixes CVE-2020-26160
+
+#### 3.2.0
+
+* Added method `ParseUnverified` to allow users to split up the tasks of parsing and validation
+* HMAC signing method returns `ErrInvalidKeyType` instead of `ErrInvalidKey` where appropriate
+* Added options to `request.ParseFromRequest`, which allows for an arbitrary list of modifiers to parsing behavior. Initial set include `WithClaims` and `WithParser`. Existing usage of this function will continue to work as before.
+* Deprecated `ParseFromRequestWithClaims` to simplify API in the future.
+
+#### 3.1.0
+
+* Improvements to `jwt` command line tool
+* Added `SkipClaimsValidation` option to `Parser`
+* Documentation updates
+
+#### 3.0.0
+
+* **Compatibility Breaking Changes**: See MIGRATION_GUIDE.md for tips on updating your code
+ * Dropped support for `[]byte` keys when using RSA signing methods. This convenience feature could contribute to security vulnerabilities involving mismatched key types with signing methods.
+ * `ParseFromRequest` has been moved to `request` subpackage and usage has changed
+ * The `Claims` property on `Token` is now type `Claims` instead of `map[string]interface{}`. The default value is type `MapClaims`, which is an alias to `map[string]interface{}`. This makes it possible to use a custom type when decoding claims.
+* Other Additions and Changes
+ * Added `Claims` interface type to allow users to decode the claims into a custom type
+ * Added `ParseWithClaims`, which takes a third argument of type `Claims`. Use this function instead of `Parse` if you have a custom type you'd like to decode into.
+ * Dramatically improved the functionality and flexibility of `ParseFromRequest`, which is now in the `request` subpackage
+ * Added `ParseFromRequestWithClaims` which is the `FromRequest` equivalent of `ParseWithClaims`
+ * Added new interface type `Extractor`, which is used for extracting JWT strings from http requests. Used with `ParseFromRequest` and `ParseFromRequestWithClaims`.
+ * Added several new, more specific, validation errors to error type bitmask
+ * Moved examples from README to executable example files
+ * Signing method registry is now thread safe
+ * Added new property to `ValidationError`, which contains the raw error returned by calls made by parse/verify (such as those returned by keyfunc or json parser)
+
+#### 2.7.0
+
+This will likely be the last backwards compatible release before 3.0.0, excluding essential bug fixes.
+
+* Added new option `-show` to the `jwt` command that will just output the decoded token without verifying
+* Error text for expired tokens includes how long it's been expired
+* Fixed incorrect error returned from `ParseRSAPublicKeyFromPEM`
+* Documentation updates
+
+#### 2.6.0
+
+* Exposed inner error within ValidationError
+* Fixed validation errors when using UseJSONNumber flag
+* Added several unit tests
+
+#### 2.5.0
+
+* Added support for signing method none. You shouldn't use this. The API tries to make this clear.
+* Updated/fixed some documentation
+* Added more helpful error message when trying to parse tokens that begin with `BEARER `
+
+#### 2.4.0
+
+* Added new type, Parser, to allow for configuration of various parsing parameters
+ * You can now specify a list of valid signing methods. Anything outside this set will be rejected.
+ * You can now opt to use the `json.Number` type instead of `float64` when parsing token JSON
+* Added support for [Travis CI](https://travis-ci.org/dgrijalva/jwt-go)
+* Fixed some bugs with ECDSA parsing
+
+#### 2.3.0
+
+* Added support for ECDSA signing methods
+* Added support for RSA PSS signing methods (requires go v1.4)
+
+#### 2.2.0
+
+* Gracefully handle a `nil` `Keyfunc` being passed to `Parse`. Result will now be the parsed token and an error, instead of a panic.
+
+#### 2.1.0
+
+Backwards compatible API change that was missed in 2.0.0.
+
+* The `SignedString` method on `Token` now takes `interface{}` instead of `[]byte`
+
+#### 2.0.0
+
+There were two major reasons for breaking backwards compatibility with this update. The first was a refactor required to expand the width of the RSA and HMAC-SHA signing implementations. There will likely be no required code changes to support this change.
+
+The second update, while unfortunately requiring a small change in integration, is required to open up this library to other signing methods. Not all keys used for all signing methods have a single standard on-disk representation. Requiring `[]byte` as the type for all keys proved too limiting. Additionally, this implementation allows for pre-parsed tokens to be reused, which might matter in an application that parses a high volume of tokens with a small set of keys. Backwards compatibilty has been maintained for passing `[]byte` to the RSA signing methods, but they will also accept `*rsa.PublicKey` and `*rsa.PrivateKey`.
+
+It is likely the only integration change required here will be to change `func(t *jwt.Token) ([]byte, error)` to `func(t *jwt.Token) (interface{}, error)` when calling `Parse`.
+
+* **Compatibility Breaking Changes**
+ * `SigningMethodHS256` is now `*SigningMethodHMAC` instead of `type struct`
+ * `SigningMethodRS256` is now `*SigningMethodRSA` instead of `type struct`
+ * `KeyFunc` now returns `interface{}` instead of `[]byte`
+ * `SigningMethod.Sign` now takes `interface{}` instead of `[]byte` for the key
+ * `SigningMethod.Verify` now takes `interface{}` instead of `[]byte` for the key
+* Renamed type `SigningMethodHS256` to `SigningMethodHMAC`. Specific sizes are now just instances of this type.
+ * Added public package global `SigningMethodHS256`
+ * Added public package global `SigningMethodHS384`
+ * Added public package global `SigningMethodHS512`
+* Renamed type `SigningMethodRS256` to `SigningMethodRSA`. Specific sizes are now just instances of this type.
+ * Added public package global `SigningMethodRS256`
+ * Added public package global `SigningMethodRS384`
+ * Added public package global `SigningMethodRS512`
+* Moved sample private key for HMAC tests from an inline value to a file on disk. Value is unchanged.
+* Refactored the RSA implementation to be easier to read
+* Exposed helper methods `ParseRSAPrivateKeyFromPEM` and `ParseRSAPublicKeyFromPEM`
+
+#### 1.0.2
+
+* Fixed bug in parsing public keys from certificates
+* Added more tests around the parsing of keys for RS256
+* Code refactoring in RS256 implementation. No functional changes
+
+#### 1.0.1
+
+* Fixed panic if RS256 signing method was passed an invalid key
+
+#### 1.0.0
+
+* First versioned release
+* API stabilized
+* Supports creating, signing, parsing, and validating JWT tokens
+* Supports RS256 and HS256 signing methods
diff --git a/vendor/github.com/golang-jwt/jwt/v4/claims.go b/vendor/github.com/golang-jwt/jwt/v4/claims.go
new file mode 100644
index 0000000000..364cec8773
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/claims.go
@@ -0,0 +1,269 @@
+package jwt
+
+import (
+ "crypto/subtle"
+ "fmt"
+ "time"
+)
+
+// Claims must just have a Valid method that determines
+// if the token is invalid for any supported reason
+type Claims interface {
+ Valid() error
+}
+
+// RegisteredClaims are a structured version of the JWT Claims Set,
+// restricted to Registered Claim Names, as referenced at
+// https://datatracker.ietf.org/doc/html/rfc7519#section-4.1
+//
+// This type can be used on its own, but then additional private and
+// public claims embedded in the JWT will not be parsed. The typical usecase
+// therefore is to embedded this in a user-defined claim type.
+//
+// See examples for how to use this with your own claim types.
+type RegisteredClaims struct {
+ // the `iss` (Issuer) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.1
+ Issuer string `json:"iss,omitempty"`
+
+ // the `sub` (Subject) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.2
+ Subject string `json:"sub,omitempty"`
+
+ // the `aud` (Audience) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3
+ Audience ClaimStrings `json:"aud,omitempty"`
+
+ // the `exp` (Expiration Time) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.4
+ ExpiresAt *NumericDate `json:"exp,omitempty"`
+
+ // the `nbf` (Not Before) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.5
+ NotBefore *NumericDate `json:"nbf,omitempty"`
+
+ // the `iat` (Issued At) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.6
+ IssuedAt *NumericDate `json:"iat,omitempty"`
+
+ // the `jti` (JWT ID) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.7
+ ID string `json:"jti,omitempty"`
+}
+
+// Valid validates time based claims "exp, iat, nbf".
+// There is no accounting for clock skew.
+// As well, if any of the above claims are not in the token, it will still
+// be considered a valid claim.
+func (c RegisteredClaims) Valid() error {
+ vErr := new(ValidationError)
+ now := TimeFunc()
+
+ // The claims below are optional, by default, so if they are set to the
+ // default value in Go, let's not fail the verification for them.
+ if !c.VerifyExpiresAt(now, false) {
+ delta := now.Sub(c.ExpiresAt.Time)
+ vErr.Inner = fmt.Errorf("%s by %s", ErrTokenExpired, delta)
+ vErr.Errors |= ValidationErrorExpired
+ }
+
+ if !c.VerifyIssuedAt(now, false) {
+ vErr.Inner = ErrTokenUsedBeforeIssued
+ vErr.Errors |= ValidationErrorIssuedAt
+ }
+
+ if !c.VerifyNotBefore(now, false) {
+ vErr.Inner = ErrTokenNotValidYet
+ vErr.Errors |= ValidationErrorNotValidYet
+ }
+
+ if vErr.valid() {
+ return nil
+ }
+
+ return vErr
+}
+
+// VerifyAudience compares the aud claim against cmp.
+// If required is false, this method will return true if the value matches or is unset
+func (c *RegisteredClaims) VerifyAudience(cmp string, req bool) bool {
+ return verifyAud(c.Audience, cmp, req)
+}
+
+// VerifyExpiresAt compares the exp claim against cmp (cmp < exp).
+// If req is false, it will return true, if exp is unset.
+func (c *RegisteredClaims) VerifyExpiresAt(cmp time.Time, req bool) bool {
+ if c.ExpiresAt == nil {
+ return verifyExp(nil, cmp, req)
+ }
+
+ return verifyExp(&c.ExpiresAt.Time, cmp, req)
+}
+
+// VerifyIssuedAt compares the iat claim against cmp (cmp >= iat).
+// If req is false, it will return true, if iat is unset.
+func (c *RegisteredClaims) VerifyIssuedAt(cmp time.Time, req bool) bool {
+ if c.IssuedAt == nil {
+ return verifyIat(nil, cmp, req)
+ }
+
+ return verifyIat(&c.IssuedAt.Time, cmp, req)
+}
+
+// VerifyNotBefore compares the nbf claim against cmp (cmp >= nbf).
+// If req is false, it will return true, if nbf is unset.
+func (c *RegisteredClaims) VerifyNotBefore(cmp time.Time, req bool) bool {
+ if c.NotBefore == nil {
+ return verifyNbf(nil, cmp, req)
+ }
+
+ return verifyNbf(&c.NotBefore.Time, cmp, req)
+}
+
+// VerifyIssuer compares the iss claim against cmp.
+// If required is false, this method will return true if the value matches or is unset
+func (c *RegisteredClaims) VerifyIssuer(cmp string, req bool) bool {
+ return verifyIss(c.Issuer, cmp, req)
+}
+
+// StandardClaims are a structured version of the JWT Claims Set, as referenced at
+// https://datatracker.ietf.org/doc/html/rfc7519#section-4. They do not follow the
+// specification exactly, since they were based on an earlier draft of the
+// specification and not updated. The main difference is that they only
+// support integer-based date fields and singular audiences. This might lead to
+// incompatibilities with other JWT implementations. The use of this is discouraged, instead
+// the newer RegisteredClaims struct should be used.
+//
+// Deprecated: Use RegisteredClaims instead for a forward-compatible way to access registered claims in a struct.
+type StandardClaims struct {
+ Audience string `json:"aud,omitempty"`
+ ExpiresAt int64 `json:"exp,omitempty"`
+ Id string `json:"jti,omitempty"`
+ IssuedAt int64 `json:"iat,omitempty"`
+ Issuer string `json:"iss,omitempty"`
+ NotBefore int64 `json:"nbf,omitempty"`
+ Subject string `json:"sub,omitempty"`
+}
+
+// Valid validates time based claims "exp, iat, nbf". There is no accounting for clock skew.
+// As well, if any of the above claims are not in the token, it will still
+// be considered a valid claim.
+func (c StandardClaims) Valid() error {
+ vErr := new(ValidationError)
+ now := TimeFunc().Unix()
+
+ // The claims below are optional, by default, so if they are set to the
+ // default value in Go, let's not fail the verification for them.
+ if !c.VerifyExpiresAt(now, false) {
+ delta := time.Unix(now, 0).Sub(time.Unix(c.ExpiresAt, 0))
+ vErr.Inner = fmt.Errorf("%s by %s", ErrTokenExpired, delta)
+ vErr.Errors |= ValidationErrorExpired
+ }
+
+ if !c.VerifyIssuedAt(now, false) {
+ vErr.Inner = ErrTokenUsedBeforeIssued
+ vErr.Errors |= ValidationErrorIssuedAt
+ }
+
+ if !c.VerifyNotBefore(now, false) {
+ vErr.Inner = ErrTokenNotValidYet
+ vErr.Errors |= ValidationErrorNotValidYet
+ }
+
+ if vErr.valid() {
+ return nil
+ }
+
+ return vErr
+}
+
+// VerifyAudience compares the aud claim against cmp.
+// If required is false, this method will return true if the value matches or is unset
+func (c *StandardClaims) VerifyAudience(cmp string, req bool) bool {
+ return verifyAud([]string{c.Audience}, cmp, req)
+}
+
+// VerifyExpiresAt compares the exp claim against cmp (cmp < exp).
+// If req is false, it will return true, if exp is unset.
+func (c *StandardClaims) VerifyExpiresAt(cmp int64, req bool) bool {
+ if c.ExpiresAt == 0 {
+ return verifyExp(nil, time.Unix(cmp, 0), req)
+ }
+
+ t := time.Unix(c.ExpiresAt, 0)
+ return verifyExp(&t, time.Unix(cmp, 0), req)
+}
+
+// VerifyIssuedAt compares the iat claim against cmp (cmp >= iat).
+// If req is false, it will return true, if iat is unset.
+func (c *StandardClaims) VerifyIssuedAt(cmp int64, req bool) bool {
+ if c.IssuedAt == 0 {
+ return verifyIat(nil, time.Unix(cmp, 0), req)
+ }
+
+ t := time.Unix(c.IssuedAt, 0)
+ return verifyIat(&t, time.Unix(cmp, 0), req)
+}
+
+// VerifyNotBefore compares the nbf claim against cmp (cmp >= nbf).
+// If req is false, it will return true, if nbf is unset.
+func (c *StandardClaims) VerifyNotBefore(cmp int64, req bool) bool {
+ if c.NotBefore == 0 {
+ return verifyNbf(nil, time.Unix(cmp, 0), req)
+ }
+
+ t := time.Unix(c.NotBefore, 0)
+ return verifyNbf(&t, time.Unix(cmp, 0), req)
+}
+
+// VerifyIssuer compares the iss claim against cmp.
+// If required is false, this method will return true if the value matches or is unset
+func (c *StandardClaims) VerifyIssuer(cmp string, req bool) bool {
+ return verifyIss(c.Issuer, cmp, req)
+}
+
+// ----- helpers
+
+func verifyAud(aud []string, cmp string, required bool) bool {
+ if len(aud) == 0 {
+ return !required
+ }
+ // use a var here to keep constant time compare when looping over a number of claims
+ result := false
+
+ var stringClaims string
+ for _, a := range aud {
+ if subtle.ConstantTimeCompare([]byte(a), []byte(cmp)) != 0 {
+ result = true
+ }
+ stringClaims = stringClaims + a
+ }
+
+ // case where "" is sent in one or many aud claims
+ if len(stringClaims) == 0 {
+ return !required
+ }
+
+ return result
+}
+
+func verifyExp(exp *time.Time, now time.Time, required bool) bool {
+ if exp == nil {
+ return !required
+ }
+ return now.Before(*exp)
+}
+
+func verifyIat(iat *time.Time, now time.Time, required bool) bool {
+ if iat == nil {
+ return !required
+ }
+ return now.After(*iat) || now.Equal(*iat)
+}
+
+func verifyNbf(nbf *time.Time, now time.Time, required bool) bool {
+ if nbf == nil {
+ return !required
+ }
+ return now.After(*nbf) || now.Equal(*nbf)
+}
+
+func verifyIss(iss string, cmp string, required bool) bool {
+ if iss == "" {
+ return !required
+ }
+ return subtle.ConstantTimeCompare([]byte(iss), []byte(cmp)) != 0
+}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/doc.go b/vendor/github.com/golang-jwt/jwt/v4/doc.go
new file mode 100644
index 0000000000..a86dc1a3b3
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/doc.go
@@ -0,0 +1,4 @@
+// Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html
+//
+// See README.md for more info.
+package jwt
diff --git a/vendor/github.com/golang-jwt/jwt/v4/ecdsa.go b/vendor/github.com/golang-jwt/jwt/v4/ecdsa.go
new file mode 100644
index 0000000000..eac023fc6c
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/ecdsa.go
@@ -0,0 +1,142 @@
+package jwt
+
+import (
+ "crypto"
+ "crypto/ecdsa"
+ "crypto/rand"
+ "errors"
+ "math/big"
+)
+
+var (
+ // Sadly this is missing from crypto/ecdsa compared to crypto/rsa
+ ErrECDSAVerification = errors.New("crypto/ecdsa: verification error")
+)
+
+// SigningMethodECDSA implements the ECDSA family of signing methods.
+// Expects *ecdsa.PrivateKey for signing and *ecdsa.PublicKey for verification
+type SigningMethodECDSA struct {
+ Name string
+ Hash crypto.Hash
+ KeySize int
+ CurveBits int
+}
+
+// Specific instances for EC256 and company
+var (
+ SigningMethodES256 *SigningMethodECDSA
+ SigningMethodES384 *SigningMethodECDSA
+ SigningMethodES512 *SigningMethodECDSA
+)
+
+func init() {
+ // ES256
+ SigningMethodES256 = &SigningMethodECDSA{"ES256", crypto.SHA256, 32, 256}
+ RegisterSigningMethod(SigningMethodES256.Alg(), func() SigningMethod {
+ return SigningMethodES256
+ })
+
+ // ES384
+ SigningMethodES384 = &SigningMethodECDSA{"ES384", crypto.SHA384, 48, 384}
+ RegisterSigningMethod(SigningMethodES384.Alg(), func() SigningMethod {
+ return SigningMethodES384
+ })
+
+ // ES512
+ SigningMethodES512 = &SigningMethodECDSA{"ES512", crypto.SHA512, 66, 521}
+ RegisterSigningMethod(SigningMethodES512.Alg(), func() SigningMethod {
+ return SigningMethodES512
+ })
+}
+
+func (m *SigningMethodECDSA) Alg() string {
+ return m.Name
+}
+
+// Verify implements token verification for the SigningMethod.
+// For this verify method, key must be an ecdsa.PublicKey struct
+func (m *SigningMethodECDSA) Verify(signingString, signature string, key interface{}) error {
+ var err error
+
+ // Decode the signature
+ var sig []byte
+ if sig, err = DecodeSegment(signature); err != nil {
+ return err
+ }
+
+ // Get the key
+ var ecdsaKey *ecdsa.PublicKey
+ switch k := key.(type) {
+ case *ecdsa.PublicKey:
+ ecdsaKey = k
+ default:
+ return ErrInvalidKeyType
+ }
+
+ if len(sig) != 2*m.KeySize {
+ return ErrECDSAVerification
+ }
+
+ r := big.NewInt(0).SetBytes(sig[:m.KeySize])
+ s := big.NewInt(0).SetBytes(sig[m.KeySize:])
+
+ // Create hasher
+ if !m.Hash.Available() {
+ return ErrHashUnavailable
+ }
+ hasher := m.Hash.New()
+ hasher.Write([]byte(signingString))
+
+ // Verify the signature
+ if verifystatus := ecdsa.Verify(ecdsaKey, hasher.Sum(nil), r, s); verifystatus {
+ return nil
+ }
+
+ return ErrECDSAVerification
+}
+
+// Sign implements token signing for the SigningMethod.
+// For this signing method, key must be an ecdsa.PrivateKey struct
+func (m *SigningMethodECDSA) Sign(signingString string, key interface{}) (string, error) {
+ // Get the key
+ var ecdsaKey *ecdsa.PrivateKey
+ switch k := key.(type) {
+ case *ecdsa.PrivateKey:
+ ecdsaKey = k
+ default:
+ return "", ErrInvalidKeyType
+ }
+
+ // Create the hasher
+ if !m.Hash.Available() {
+ return "", ErrHashUnavailable
+ }
+
+ hasher := m.Hash.New()
+ hasher.Write([]byte(signingString))
+
+ // Sign the string and return r, s
+ if r, s, err := ecdsa.Sign(rand.Reader, ecdsaKey, hasher.Sum(nil)); err == nil {
+ curveBits := ecdsaKey.Curve.Params().BitSize
+
+ if m.CurveBits != curveBits {
+ return "", ErrInvalidKey
+ }
+
+ keyBytes := curveBits / 8
+ if curveBits%8 > 0 {
+ keyBytes += 1
+ }
+
+ // We serialize the outputs (r and s) into big-endian byte arrays
+ // padded with zeros on the left to make sure the sizes work out.
+ // Output must be 2*keyBytes long.
+ out := make([]byte, 2*keyBytes)
+ r.FillBytes(out[0:keyBytes]) // r is assigned to the first half of output.
+ s.FillBytes(out[keyBytes:]) // s is assigned to the second half of output.
+
+ return EncodeSegment(out), nil
+ } else {
+ return "", err
+ }
+}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/ecdsa_utils.go b/vendor/github.com/golang-jwt/jwt/v4/ecdsa_utils.go
new file mode 100644
index 0000000000..5700636d35
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/ecdsa_utils.go
@@ -0,0 +1,69 @@
+package jwt
+
+import (
+ "crypto/ecdsa"
+ "crypto/x509"
+ "encoding/pem"
+ "errors"
+)
+
+var (
+ ErrNotECPublicKey = errors.New("key is not a valid ECDSA public key")
+ ErrNotECPrivateKey = errors.New("key is not a valid ECDSA private key")
+)
+
+// ParseECPrivateKeyFromPEM parses a PEM encoded Elliptic Curve Private Key Structure
+func ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error) {
+ var err error
+
+ // Parse PEM block
+ var block *pem.Block
+ if block, _ = pem.Decode(key); block == nil {
+ return nil, ErrKeyMustBePEMEncoded
+ }
+
+ // Parse the key
+ var parsedKey interface{}
+ if parsedKey, err = x509.ParseECPrivateKey(block.Bytes); err != nil {
+ if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil {
+ return nil, err
+ }
+ }
+
+ var pkey *ecdsa.PrivateKey
+ var ok bool
+ if pkey, ok = parsedKey.(*ecdsa.PrivateKey); !ok {
+ return nil, ErrNotECPrivateKey
+ }
+
+ return pkey, nil
+}
+
+// ParseECPublicKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 public key
+func ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error) {
+ var err error
+
+ // Parse PEM block
+ var block *pem.Block
+ if block, _ = pem.Decode(key); block == nil {
+ return nil, ErrKeyMustBePEMEncoded
+ }
+
+ // Parse the key
+ var parsedKey interface{}
+ if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil {
+ if cert, err := x509.ParseCertificate(block.Bytes); err == nil {
+ parsedKey = cert.PublicKey
+ } else {
+ return nil, err
+ }
+ }
+
+ var pkey *ecdsa.PublicKey
+ var ok bool
+ if pkey, ok = parsedKey.(*ecdsa.PublicKey); !ok {
+ return nil, ErrNotECPublicKey
+ }
+
+ return pkey, nil
+}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/ed25519.go b/vendor/github.com/golang-jwt/jwt/v4/ed25519.go
new file mode 100644
index 0000000000..07d3aacd63
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/ed25519.go
@@ -0,0 +1,85 @@
+package jwt
+
+import (
+ "errors"
+
+ "crypto"
+ "crypto/ed25519"
+ "crypto/rand"
+)
+
+var (
+ ErrEd25519Verification = errors.New("ed25519: verification error")
+)
+
+// SigningMethodEd25519 implements the EdDSA family.
+// Expects ed25519.PrivateKey for signing and ed25519.PublicKey for verification
+type SigningMethodEd25519 struct{}
+
+// Specific instance for EdDSA
+var (
+ SigningMethodEdDSA *SigningMethodEd25519
+)
+
+func init() {
+ SigningMethodEdDSA = &SigningMethodEd25519{}
+ RegisterSigningMethod(SigningMethodEdDSA.Alg(), func() SigningMethod {
+ return SigningMethodEdDSA
+ })
+}
+
+func (m *SigningMethodEd25519) Alg() string {
+ return "EdDSA"
+}
+
+// Verify implements token verification for the SigningMethod.
+// For this verify method, key must be an ed25519.PublicKey
+func (m *SigningMethodEd25519) Verify(signingString, signature string, key interface{}) error {
+ var err error
+ var ed25519Key ed25519.PublicKey
+ var ok bool
+
+ if ed25519Key, ok = key.(ed25519.PublicKey); !ok {
+ return ErrInvalidKeyType
+ }
+
+ if len(ed25519Key) != ed25519.PublicKeySize {
+ return ErrInvalidKey
+ }
+
+ // Decode the signature
+ var sig []byte
+ if sig, err = DecodeSegment(signature); err != nil {
+ return err
+ }
+
+ // Verify the signature
+ if !ed25519.Verify(ed25519Key, []byte(signingString), sig) {
+ return ErrEd25519Verification
+ }
+
+ return nil
+}
+
+// Sign implements token signing for the SigningMethod.
+// For this signing method, key must be an ed25519.PrivateKey
+func (m *SigningMethodEd25519) Sign(signingString string, key interface{}) (string, error) {
+ var ed25519Key crypto.Signer
+ var ok bool
+
+ if ed25519Key, ok = key.(crypto.Signer); !ok {
+ return "", ErrInvalidKeyType
+ }
+
+ if _, ok := ed25519Key.Public().(ed25519.PublicKey); !ok {
+ return "", ErrInvalidKey
+ }
+
+ // Sign the string and return the encoded result
+ // ed25519 performs a two-pass hash as part of its algorithm. Therefore, we need to pass a non-prehashed message into the Sign function, as indicated by crypto.Hash(0)
+ sig, err := ed25519Key.Sign(rand.Reader, []byte(signingString), crypto.Hash(0))
+ if err != nil {
+ return "", err
+ }
+ return EncodeSegment(sig), nil
+}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/ed25519_utils.go b/vendor/github.com/golang-jwt/jwt/v4/ed25519_utils.go
new file mode 100644
index 0000000000..cdb5e68e87
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/ed25519_utils.go
@@ -0,0 +1,64 @@
+package jwt
+
+import (
+ "crypto"
+ "crypto/ed25519"
+ "crypto/x509"
+ "encoding/pem"
+ "errors"
+)
+
+var (
+ ErrNotEdPrivateKey = errors.New("key is not a valid Ed25519 private key")
+ ErrNotEdPublicKey = errors.New("key is not a valid Ed25519 public key")
+)
+
+// ParseEdPrivateKeyFromPEM parses a PEM-encoded Edwards curve private key
+func ParseEdPrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error) {
+ var err error
+
+ // Parse PEM block
+ var block *pem.Block
+ if block, _ = pem.Decode(key); block == nil {
+ return nil, ErrKeyMustBePEMEncoded
+ }
+
+ // Parse the key
+ var parsedKey interface{}
+ if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil {
+ return nil, err
+ }
+
+ var pkey ed25519.PrivateKey
+ var ok bool
+ if pkey, ok = parsedKey.(ed25519.PrivateKey); !ok {
+ return nil, ErrNotEdPrivateKey
+ }
+
+ return pkey, nil
+}
+
+// ParseEdPublicKeyFromPEM parses a PEM-encoded Edwards curve public key
+func ParseEdPublicKeyFromPEM(key []byte) (crypto.PublicKey, error) {
+ var err error
+
+ // Parse PEM block
+ var block *pem.Block
+ if block, _ = pem.Decode(key); block == nil {
+ return nil, ErrKeyMustBePEMEncoded
+ }
+
+ // Parse the key
+ var parsedKey interface{}
+ if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil {
+ return nil, err
+ }
+
+ var pkey ed25519.PublicKey
+ var ok bool
+ if pkey, ok = parsedKey.(ed25519.PublicKey); !ok {
+ return nil, ErrNotEdPublicKey
+ }
+
+ return pkey, nil
+}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/errors.go b/vendor/github.com/golang-jwt/jwt/v4/errors.go
new file mode 100644
index 0000000000..10ac8835cc
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/errors.go
@@ -0,0 +1,112 @@
+package jwt
+
+import (
+ "errors"
+)
+
+// Error constants
+var (
+ ErrInvalidKey = errors.New("key is invalid")
+ ErrInvalidKeyType = errors.New("key is of invalid type")
+ ErrHashUnavailable = errors.New("the requested hash function is unavailable")
+
+ ErrTokenMalformed = errors.New("token is malformed")
+ ErrTokenUnverifiable = errors.New("token is unverifiable")
+ ErrTokenSignatureInvalid = errors.New("token signature is invalid")
+
+ ErrTokenInvalidAudience = errors.New("token has invalid audience")
+ ErrTokenExpired = errors.New("token is expired")
+ ErrTokenUsedBeforeIssued = errors.New("token used before issued")
+ ErrTokenInvalidIssuer = errors.New("token has invalid issuer")
+ ErrTokenNotValidYet = errors.New("token is not valid yet")
+ ErrTokenInvalidId = errors.New("token has invalid id")
+ ErrTokenInvalidClaims = errors.New("token has invalid claims")
+)
+
+// The errors that might occur when parsing and validating a token
+const (
+ ValidationErrorMalformed uint32 = 1 << iota // Token is malformed
+ ValidationErrorUnverifiable // Token could not be verified because of signing problems
+ ValidationErrorSignatureInvalid // Signature validation failed
+
+ // Standard Claim validation errors
+ ValidationErrorAudience // AUD validation failed
+ ValidationErrorExpired // EXP validation failed
+ ValidationErrorIssuedAt // IAT validation failed
+ ValidationErrorIssuer // ISS validation failed
+ ValidationErrorNotValidYet // NBF validation failed
+ ValidationErrorId // JTI validation failed
+ ValidationErrorClaimsInvalid // Generic claims validation error
+)
+
+// NewValidationError is a helper for constructing a ValidationError with a string error message
+func NewValidationError(errorText string, errorFlags uint32) *ValidationError {
+ return &ValidationError{
+ text: errorText,
+ Errors: errorFlags,
+ }
+}
+
+// ValidationError represents an error from Parse if token is not valid
+type ValidationError struct {
+ Inner error // stores the error returned by external dependencies, i.e.: KeyFunc
+ Errors uint32 // bitfield. see ValidationError... constants
+ text string // errors that do not have a valid error just have text
+}
+
+// Error is the implementation of the err interface.
+func (e ValidationError) Error() string {
+ if e.Inner != nil {
+ return e.Inner.Error()
+ } else if e.text != "" {
+ return e.text
+ } else {
+ return "token is invalid"
+ }
+}
+
+// Unwrap gives errors.Is and errors.As access to the inner error.
+func (e *ValidationError) Unwrap() error {
+ return e.Inner
+}
+
+// No errors
+func (e *ValidationError) valid() bool {
+ return e.Errors == 0
+}
+
+// Is checks if this ValidationError is of the supplied error. We are first checking for the exact error message
+// by comparing the inner error message. If that fails, we compare using the error flags. This way we can use
+// custom error messages (mainly for backwards compatability) and still leverage errors.Is using the global error variables.
+func (e *ValidationError) Is(err error) bool {
+ // Check, if our inner error is a direct match
+ if errors.Is(errors.Unwrap(e), err) {
+ return true
+ }
+
+ // Otherwise, we need to match using our error flags
+ switch err {
+ case ErrTokenMalformed:
+ return e.Errors&ValidationErrorMalformed != 0
+ case ErrTokenUnverifiable:
+ return e.Errors&ValidationErrorUnverifiable != 0
+ case ErrTokenSignatureInvalid:
+ return e.Errors&ValidationErrorSignatureInvalid != 0
+ case ErrTokenInvalidAudience:
+ return e.Errors&ValidationErrorAudience != 0
+ case ErrTokenExpired:
+ return e.Errors&ValidationErrorExpired != 0
+ case ErrTokenUsedBeforeIssued:
+ return e.Errors&ValidationErrorIssuedAt != 0
+ case ErrTokenInvalidIssuer:
+ return e.Errors&ValidationErrorIssuer != 0
+ case ErrTokenNotValidYet:
+ return e.Errors&ValidationErrorNotValidYet != 0
+ case ErrTokenInvalidId:
+ return e.Errors&ValidationErrorId != 0
+ case ErrTokenInvalidClaims:
+ return e.Errors&ValidationErrorClaimsInvalid != 0
+ }
+
+ return false
+}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/hmac.go b/vendor/github.com/golang-jwt/jwt/v4/hmac.go
new file mode 100644
index 0000000000..011f68a274
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/hmac.go
@@ -0,0 +1,95 @@
+package jwt
+
+import (
+ "crypto"
+ "crypto/hmac"
+ "errors"
+)
+
+// SigningMethodHMAC implements the HMAC-SHA family of signing methods.
+// Expects key type of []byte for both signing and validation
+type SigningMethodHMAC struct {
+ Name string
+ Hash crypto.Hash
+}
+
+// Specific instances for HS256 and company
+var (
+ SigningMethodHS256 *SigningMethodHMAC
+ SigningMethodHS384 *SigningMethodHMAC
+ SigningMethodHS512 *SigningMethodHMAC
+ ErrSignatureInvalid = errors.New("signature is invalid")
+)
+
+func init() {
+ // HS256
+ SigningMethodHS256 = &SigningMethodHMAC{"HS256", crypto.SHA256}
+ RegisterSigningMethod(SigningMethodHS256.Alg(), func() SigningMethod {
+ return SigningMethodHS256
+ })
+
+ // HS384
+ SigningMethodHS384 = &SigningMethodHMAC{"HS384", crypto.SHA384}
+ RegisterSigningMethod(SigningMethodHS384.Alg(), func() SigningMethod {
+ return SigningMethodHS384
+ })
+
+ // HS512
+ SigningMethodHS512 = &SigningMethodHMAC{"HS512", crypto.SHA512}
+ RegisterSigningMethod(SigningMethodHS512.Alg(), func() SigningMethod {
+ return SigningMethodHS512
+ })
+}
+
+func (m *SigningMethodHMAC) Alg() string {
+ return m.Name
+}
+
+// Verify implements token verification for the SigningMethod. Returns nil if the signature is valid.
+func (m *SigningMethodHMAC) Verify(signingString, signature string, key interface{}) error {
+ // Verify the key is the right type
+ keyBytes, ok := key.([]byte)
+ if !ok {
+ return ErrInvalidKeyType
+ }
+
+ // Decode signature, for comparison
+ sig, err := DecodeSegment(signature)
+ if err != nil {
+ return err
+ }
+
+ // Can we use the specified hashing method?
+ if !m.Hash.Available() {
+ return ErrHashUnavailable
+ }
+
+ // This signing method is symmetric, so we validate the signature
+ // by reproducing the signature from the signing string and key, then
+ // comparing that against the provided signature.
+ hasher := hmac.New(m.Hash.New, keyBytes)
+ hasher.Write([]byte(signingString))
+ if !hmac.Equal(sig, hasher.Sum(nil)) {
+ return ErrSignatureInvalid
+ }
+
+ // No validation errors. Signature is good.
+ return nil
+}
+
+// Sign implements token signing for the SigningMethod.
+// Key must be []byte
+func (m *SigningMethodHMAC) Sign(signingString string, key interface{}) (string, error) {
+ if keyBytes, ok := key.([]byte); ok {
+ if !m.Hash.Available() {
+ return "", ErrHashUnavailable
+ }
+
+ hasher := hmac.New(m.Hash.New, keyBytes)
+ hasher.Write([]byte(signingString))
+
+ return EncodeSegment(hasher.Sum(nil)), nil
+ }
+
+ return "", ErrInvalidKeyType
+}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/map_claims.go b/vendor/github.com/golang-jwt/jwt/v4/map_claims.go
new file mode 100644
index 0000000000..2700d64a0d
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/map_claims.go
@@ -0,0 +1,151 @@
+package jwt
+
+import (
+ "encoding/json"
+ "errors"
+ "time"
+ // "fmt"
+)
+
+// MapClaims is a claims type that uses the map[string]interface{} for JSON decoding.
+// This is the default claims type if you don't supply one
+type MapClaims map[string]interface{}
+
+// VerifyAudience Compares the aud claim against cmp.
+// If required is false, this method will return true if the value matches or is unset
+func (m MapClaims) VerifyAudience(cmp string, req bool) bool {
+ var aud []string
+ switch v := m["aud"].(type) {
+ case string:
+ aud = append(aud, v)
+ case []string:
+ aud = v
+ case []interface{}:
+ for _, a := range v {
+ vs, ok := a.(string)
+ if !ok {
+ return false
+ }
+ aud = append(aud, vs)
+ }
+ }
+ return verifyAud(aud, cmp, req)
+}
+
+// VerifyExpiresAt compares the exp claim against cmp (cmp <= exp).
+// If req is false, it will return true, if exp is unset.
+func (m MapClaims) VerifyExpiresAt(cmp int64, req bool) bool {
+ cmpTime := time.Unix(cmp, 0)
+
+ v, ok := m["exp"]
+ if !ok {
+ return !req
+ }
+
+ switch exp := v.(type) {
+ case float64:
+ if exp == 0 {
+ return verifyExp(nil, cmpTime, req)
+ }
+
+ return verifyExp(&newNumericDateFromSeconds(exp).Time, cmpTime, req)
+ case json.Number:
+ v, _ := exp.Float64()
+
+ return verifyExp(&newNumericDateFromSeconds(v).Time, cmpTime, req)
+ }
+
+ return false
+}
+
+// VerifyIssuedAt compares the exp claim against cmp (cmp >= iat).
+// If req is false, it will return true, if iat is unset.
+func (m MapClaims) VerifyIssuedAt(cmp int64, req bool) bool {
+ cmpTime := time.Unix(cmp, 0)
+
+ v, ok := m["iat"]
+ if !ok {
+ return !req
+ }
+
+ switch iat := v.(type) {
+ case float64:
+ if iat == 0 {
+ return verifyIat(nil, cmpTime, req)
+ }
+
+ return verifyIat(&newNumericDateFromSeconds(iat).Time, cmpTime, req)
+ case json.Number:
+ v, _ := iat.Float64()
+
+ return verifyIat(&newNumericDateFromSeconds(v).Time, cmpTime, req)
+ }
+
+ return false
+}
+
+// VerifyNotBefore compares the nbf claim against cmp (cmp >= nbf).
+// If req is false, it will return true, if nbf is unset.
+func (m MapClaims) VerifyNotBefore(cmp int64, req bool) bool {
+ cmpTime := time.Unix(cmp, 0)
+
+ v, ok := m["nbf"]
+ if !ok {
+ return !req
+ }
+
+ switch nbf := v.(type) {
+ case float64:
+ if nbf == 0 {
+ return verifyNbf(nil, cmpTime, req)
+ }
+
+ return verifyNbf(&newNumericDateFromSeconds(nbf).Time, cmpTime, req)
+ case json.Number:
+ v, _ := nbf.Float64()
+
+ return verifyNbf(&newNumericDateFromSeconds(v).Time, cmpTime, req)
+ }
+
+ return false
+}
+
+// VerifyIssuer compares the iss claim against cmp.
+// If required is false, this method will return true if the value matches or is unset
+func (m MapClaims) VerifyIssuer(cmp string, req bool) bool {
+ iss, _ := m["iss"].(string)
+ return verifyIss(iss, cmp, req)
+}
+
+// Valid validates time based claims "exp, iat, nbf".
+// There is no accounting for clock skew.
+// As well, if any of the above claims are not in the token, it will still
+// be considered a valid claim.
+func (m MapClaims) Valid() error {
+ vErr := new(ValidationError)
+ now := TimeFunc().Unix()
+
+ if !m.VerifyExpiresAt(now, false) {
+ // TODO(oxisto): this should be replaced with ErrTokenExpired
+ vErr.Inner = errors.New("Token is expired")
+ vErr.Errors |= ValidationErrorExpired
+ }
+
+ if !m.VerifyIssuedAt(now, false) {
+ // TODO(oxisto): this should be replaced with ErrTokenUsedBeforeIssued
+ vErr.Inner = errors.New("Token used before issued")
+ vErr.Errors |= ValidationErrorIssuedAt
+ }
+
+ if !m.VerifyNotBefore(now, false) {
+ // TODO(oxisto): this should be replaced with ErrTokenNotValidYet
+ vErr.Inner = errors.New("Token is not valid yet")
+ vErr.Errors |= ValidationErrorNotValidYet
+ }
+
+ if vErr.valid() {
+ return nil
+ }
+
+ return vErr
+}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/none.go b/vendor/github.com/golang-jwt/jwt/v4/none.go
new file mode 100644
index 0000000000..f19835d207
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/none.go
@@ -0,0 +1,52 @@
+package jwt
+
+// SigningMethodNone implements the none signing method. This is required by the spec
+// but you probably should never use it.
+var SigningMethodNone *signingMethodNone
+
+const UnsafeAllowNoneSignatureType unsafeNoneMagicConstant = "none signing method allowed"
+
+var NoneSignatureTypeDisallowedError error
+
+type signingMethodNone struct{}
+type unsafeNoneMagicConstant string
+
+func init() {
+ SigningMethodNone = &signingMethodNone{}
+ NoneSignatureTypeDisallowedError = NewValidationError("'none' signature type is not allowed", ValidationErrorSignatureInvalid)
+
+ RegisterSigningMethod(SigningMethodNone.Alg(), func() SigningMethod {
+ return SigningMethodNone
+ })
+}
+
+func (m *signingMethodNone) Alg() string {
+ return "none"
+}
+
+// Only allow 'none' alg type if UnsafeAllowNoneSignatureType is specified as the key
+func (m *signingMethodNone) Verify(signingString, signature string, key interface{}) (err error) {
+ // Key must be UnsafeAllowNoneSignatureType to prevent accidentally
+ // accepting 'none' signing method
+ if _, ok := key.(unsafeNoneMagicConstant); !ok {
+ return NoneSignatureTypeDisallowedError
+ }
+ // If signing method is none, signature must be an empty string
+ if signature != "" {
+ return NewValidationError(
+ "'none' signing method with non-empty signature",
+ ValidationErrorSignatureInvalid,
+ )
+ }
+
+ // Accept 'none' signing method.
+ return nil
+}
+
+// Only allow 'none' signing if UnsafeAllowNoneSignatureType is specified as the key
+func (m *signingMethodNone) Sign(signingString string, key interface{}) (string, error) {
+ if _, ok := key.(unsafeNoneMagicConstant); ok {
+ return "", nil
+ }
+ return "", NoneSignatureTypeDisallowedError
+}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/parser.go b/vendor/github.com/golang-jwt/jwt/v4/parser.go
new file mode 100644
index 0000000000..c0a6f69279
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/parser.go
@@ -0,0 +1,177 @@
+package jwt
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "strings"
+)
+
+type Parser struct {
+ // If populated, only these methods will be considered valid.
+ //
+ // Deprecated: In future releases, this field will not be exported anymore and should be set with an option to NewParser instead.
+ ValidMethods []string
+
+ // Use JSON Number format in JSON decoder.
+ //
+ // Deprecated: In future releases, this field will not be exported anymore and should be set with an option to NewParser instead.
+ UseJSONNumber bool
+
+ // Skip claims validation during token parsing.
+ //
+ // Deprecated: In future releases, this field will not be exported anymore and should be set with an option to NewParser instead.
+ SkipClaimsValidation bool
+}
+
+// NewParser creates a new Parser with the specified options
+func NewParser(options ...ParserOption) *Parser {
+ p := &Parser{}
+
+ // loop through our parsing options and apply them
+ for _, option := range options {
+ option(p)
+ }
+
+ return p
+}
+
+// Parse parses, validates, verifies the signature and returns the parsed token.
+// keyFunc will receive the parsed token and should return the key for validating.
+func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) {
+ return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc)
+}
+
+// ParseWithClaims parses, validates, and verifies like Parse, but supplies a default object implementing the Claims
+// interface. This provides default values which can be overridden and allows a caller to use their own type, rather
+// than the default MapClaims implementation of Claims.
+//
+// Note: If you provide a custom claim implementation that embeds one of the standard claims (such as RegisteredClaims),
+// make sure that a) you either embed a non-pointer version of the claims or b) if you are using a pointer, allocate the
+// proper memory for it before passing in the overall claims, otherwise you might run into a panic.
+func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) {
+ token, parts, err := p.ParseUnverified(tokenString, claims)
+ if err != nil {
+ return token, err
+ }
+
+ // Verify signing method is in the required set
+ if p.ValidMethods != nil {
+ var signingMethodValid = false
+ var alg = token.Method.Alg()
+ for _, m := range p.ValidMethods {
+ if m == alg {
+ signingMethodValid = true
+ break
+ }
+ }
+ if !signingMethodValid {
+ // signing method is not in the listed set
+ return token, NewValidationError(fmt.Sprintf("signing method %v is invalid", alg), ValidationErrorSignatureInvalid)
+ }
+ }
+
+ // Lookup key
+ var key interface{}
+ if keyFunc == nil {
+ // keyFunc was not provided. short circuiting validation
+ return token, NewValidationError("no Keyfunc was provided.", ValidationErrorUnverifiable)
+ }
+ if key, err = keyFunc(token); err != nil {
+ // keyFunc returned an error
+ if ve, ok := err.(*ValidationError); ok {
+ return token, ve
+ }
+ return token, &ValidationError{Inner: err, Errors: ValidationErrorUnverifiable}
+ }
+
+ vErr := &ValidationError{}
+
+ // Validate Claims
+ if !p.SkipClaimsValidation {
+ if err := token.Claims.Valid(); err != nil {
+
+ // If the Claims Valid returned an error, check if it is a validation error,
+ // If it was another error type, create a ValidationError with a generic ClaimsInvalid flag set
+ if e, ok := err.(*ValidationError); !ok {
+ vErr = &ValidationError{Inner: err, Errors: ValidationErrorClaimsInvalid}
+ } else {
+ vErr = e
+ }
+ }
+ }
+
+ // Perform validation
+ token.Signature = parts[2]
+ if err = token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil {
+ vErr.Inner = err
+ vErr.Errors |= ValidationErrorSignatureInvalid
+ }
+
+ if vErr.valid() {
+ token.Valid = true
+ return token, nil
+ }
+
+ return token, vErr
+}
+
+// ParseUnverified parses the token but doesn't validate the signature.
+//
+// WARNING: Don't use this method unless you know what you're doing.
+//
+// It's only ever useful in cases where you know the signature is valid (because it has
+// been checked previously in the stack) and you want to extract values from it.
+func (p *Parser) ParseUnverified(tokenString string, claims Claims) (token *Token, parts []string, err error) {
+ parts = strings.Split(tokenString, ".")
+ if len(parts) != 3 {
+ return nil, parts, NewValidationError("token contains an invalid number of segments", ValidationErrorMalformed)
+ }
+
+ token = &Token{Raw: tokenString}
+
+ // parse Header
+ var headerBytes []byte
+ if headerBytes, err = DecodeSegment(parts[0]); err != nil {
+ if strings.HasPrefix(strings.ToLower(tokenString), "bearer ") {
+ return token, parts, NewValidationError("tokenstring should not contain 'bearer '", ValidationErrorMalformed)
+ }
+ return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
+ }
+ if err = json.Unmarshal(headerBytes, &token.Header); err != nil {
+ return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
+ }
+
+ // parse Claims
+ var claimBytes []byte
+ token.Claims = claims
+
+ if claimBytes, err = DecodeSegment(parts[1]); err != nil {
+ return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
+ }
+ dec := json.NewDecoder(bytes.NewBuffer(claimBytes))
+ if p.UseJSONNumber {
+ dec.UseNumber()
+ }
+ // JSON Decode. Special case for map type to avoid weird pointer behavior
+ if c, ok := token.Claims.(MapClaims); ok {
+ err = dec.Decode(&c)
+ } else {
+ err = dec.Decode(&claims)
+ }
+ // Handle decode error
+ if err != nil {
+ return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
+ }
+
+ // Lookup signature method
+ if method, ok := token.Header["alg"].(string); ok {
+ if token.Method = GetSigningMethod(method); token.Method == nil {
+ return token, parts, NewValidationError("signing method (alg) is unavailable.", ValidationErrorUnverifiable)
+ }
+ } else {
+ return token, parts, NewValidationError("signing method (alg) is unspecified.", ValidationErrorUnverifiable)
+ }
+
+ return token, parts, nil
+}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/parser_option.go b/vendor/github.com/golang-jwt/jwt/v4/parser_option.go
new file mode 100644
index 0000000000..6ea6f9527d
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/parser_option.go
@@ -0,0 +1,29 @@
+package jwt
+
+// ParserOption is used to implement functional-style options that modify the behavior of the parser. To add
+// new options, just create a function (ideally beginning with With or Without) that returns an anonymous function that
+// takes a *Parser type as input and manipulates its configuration accordingly.
+type ParserOption func(*Parser)
+
+// WithValidMethods is an option to supply algorithm methods that the parser will check. Only those methods will be considered valid.
+// It is heavily encouraged to use this option in order to prevent attacks such as https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/.
+func WithValidMethods(methods []string) ParserOption {
+ return func(p *Parser) {
+ p.ValidMethods = methods
+ }
+}
+
+// WithJSONNumber is an option to configure the underlying JSON parser with UseNumber
+func WithJSONNumber() ParserOption {
+ return func(p *Parser) {
+ p.UseJSONNumber = true
+ }
+}
+
+// WithoutClaimsValidation is an option to disable claims validation. This option should only be used if you exactly know
+// what you are doing.
+func WithoutClaimsValidation() ParserOption {
+ return func(p *Parser) {
+ p.SkipClaimsValidation = true
+ }
+}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/rsa.go b/vendor/github.com/golang-jwt/jwt/v4/rsa.go
new file mode 100644
index 0000000000..b910b19c0b
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/rsa.go
@@ -0,0 +1,101 @@
+package jwt
+
+import (
+ "crypto"
+ "crypto/rand"
+ "crypto/rsa"
+)
+
+// SigningMethodRSA implements the RSA family of signing methods.
+// Expects *rsa.PrivateKey for signing and *rsa.PublicKey for validation
+type SigningMethodRSA struct {
+ Name string
+ Hash crypto.Hash
+}
+
+// Specific instances for RS256 and company
+var (
+ SigningMethodRS256 *SigningMethodRSA
+ SigningMethodRS384 *SigningMethodRSA
+ SigningMethodRS512 *SigningMethodRSA
+)
+
+func init() {
+ // RS256
+ SigningMethodRS256 = &SigningMethodRSA{"RS256", crypto.SHA256}
+ RegisterSigningMethod(SigningMethodRS256.Alg(), func() SigningMethod {
+ return SigningMethodRS256
+ })
+
+ // RS384
+ SigningMethodRS384 = &SigningMethodRSA{"RS384", crypto.SHA384}
+ RegisterSigningMethod(SigningMethodRS384.Alg(), func() SigningMethod {
+ return SigningMethodRS384
+ })
+
+ // RS512
+ SigningMethodRS512 = &SigningMethodRSA{"RS512", crypto.SHA512}
+ RegisterSigningMethod(SigningMethodRS512.Alg(), func() SigningMethod {
+ return SigningMethodRS512
+ })
+}
+
+func (m *SigningMethodRSA) Alg() string {
+ return m.Name
+}
+
+// Verify implements token verification for the SigningMethod
+// For this signing method, must be an *rsa.PublicKey structure.
+func (m *SigningMethodRSA) Verify(signingString, signature string, key interface{}) error {
+ var err error
+
+ // Decode the signature
+ var sig []byte
+ if sig, err = DecodeSegment(signature); err != nil {
+ return err
+ }
+
+ var rsaKey *rsa.PublicKey
+ var ok bool
+
+ if rsaKey, ok = key.(*rsa.PublicKey); !ok {
+ return ErrInvalidKeyType
+ }
+
+ // Create hasher
+ if !m.Hash.Available() {
+ return ErrHashUnavailable
+ }
+ hasher := m.Hash.New()
+ hasher.Write([]byte(signingString))
+
+ // Verify the signature
+ return rsa.VerifyPKCS1v15(rsaKey, m.Hash, hasher.Sum(nil), sig)
+}
+
+// Sign implements token signing for the SigningMethod
+// For this signing method, must be an *rsa.PrivateKey structure.
+func (m *SigningMethodRSA) Sign(signingString string, key interface{}) (string, error) {
+ var rsaKey *rsa.PrivateKey
+ var ok bool
+
+ // Validate type of key
+ if rsaKey, ok = key.(*rsa.PrivateKey); !ok {
+ return "", ErrInvalidKey
+ }
+
+ // Create the hasher
+ if !m.Hash.Available() {
+ return "", ErrHashUnavailable
+ }
+
+ hasher := m.Hash.New()
+ hasher.Write([]byte(signingString))
+
+ // Sign the string and return the encoded bytes
+ if sigBytes, err := rsa.SignPKCS1v15(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil)); err == nil {
+ return EncodeSegment(sigBytes), nil
+ } else {
+ return "", err
+ }
+}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/rsa_pss.go b/vendor/github.com/golang-jwt/jwt/v4/rsa_pss.go
new file mode 100644
index 0000000000..4fd6f9e610
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/rsa_pss.go
@@ -0,0 +1,143 @@
+//go:build go1.4
+// +build go1.4
+
+package jwt
+
+import (
+ "crypto"
+ "crypto/rand"
+ "crypto/rsa"
+)
+
+// SigningMethodRSAPSS implements the RSAPSS family of signing methods signing methods
+type SigningMethodRSAPSS struct {
+ *SigningMethodRSA
+ Options *rsa.PSSOptions
+ // VerifyOptions is optional. If set overrides Options for rsa.VerifyPPS.
+ // Used to accept tokens signed with rsa.PSSSaltLengthAuto, what doesn't follow
+ // https://tools.ietf.org/html/rfc7518#section-3.5 but was used previously.
+ // See https://github.com/dgrijalva/jwt-go/issues/285#issuecomment-437451244 for details.
+ VerifyOptions *rsa.PSSOptions
+}
+
+// Specific instances for RS/PS and company.
+var (
+ SigningMethodPS256 *SigningMethodRSAPSS
+ SigningMethodPS384 *SigningMethodRSAPSS
+ SigningMethodPS512 *SigningMethodRSAPSS
+)
+
+func init() {
+ // PS256
+ SigningMethodPS256 = &SigningMethodRSAPSS{
+ SigningMethodRSA: &SigningMethodRSA{
+ Name: "PS256",
+ Hash: crypto.SHA256,
+ },
+ Options: &rsa.PSSOptions{
+ SaltLength: rsa.PSSSaltLengthEqualsHash,
+ },
+ VerifyOptions: &rsa.PSSOptions{
+ SaltLength: rsa.PSSSaltLengthAuto,
+ },
+ }
+ RegisterSigningMethod(SigningMethodPS256.Alg(), func() SigningMethod {
+ return SigningMethodPS256
+ })
+
+ // PS384
+ SigningMethodPS384 = &SigningMethodRSAPSS{
+ SigningMethodRSA: &SigningMethodRSA{
+ Name: "PS384",
+ Hash: crypto.SHA384,
+ },
+ Options: &rsa.PSSOptions{
+ SaltLength: rsa.PSSSaltLengthEqualsHash,
+ },
+ VerifyOptions: &rsa.PSSOptions{
+ SaltLength: rsa.PSSSaltLengthAuto,
+ },
+ }
+ RegisterSigningMethod(SigningMethodPS384.Alg(), func() SigningMethod {
+ return SigningMethodPS384
+ })
+
+ // PS512
+ SigningMethodPS512 = &SigningMethodRSAPSS{
+ SigningMethodRSA: &SigningMethodRSA{
+ Name: "PS512",
+ Hash: crypto.SHA512,
+ },
+ Options: &rsa.PSSOptions{
+ SaltLength: rsa.PSSSaltLengthEqualsHash,
+ },
+ VerifyOptions: &rsa.PSSOptions{
+ SaltLength: rsa.PSSSaltLengthAuto,
+ },
+ }
+ RegisterSigningMethod(SigningMethodPS512.Alg(), func() SigningMethod {
+ return SigningMethodPS512
+ })
+}
+
+// Verify implements token verification for the SigningMethod.
+// For this verify method, key must be an rsa.PublicKey struct
+func (m *SigningMethodRSAPSS) Verify(signingString, signature string, key interface{}) error {
+ var err error
+
+ // Decode the signature
+ var sig []byte
+ if sig, err = DecodeSegment(signature); err != nil {
+ return err
+ }
+
+ var rsaKey *rsa.PublicKey
+ switch k := key.(type) {
+ case *rsa.PublicKey:
+ rsaKey = k
+ default:
+ return ErrInvalidKey
+ }
+
+ // Create hasher
+ if !m.Hash.Available() {
+ return ErrHashUnavailable
+ }
+ hasher := m.Hash.New()
+ hasher.Write([]byte(signingString))
+
+ opts := m.Options
+ if m.VerifyOptions != nil {
+ opts = m.VerifyOptions
+ }
+
+ return rsa.VerifyPSS(rsaKey, m.Hash, hasher.Sum(nil), sig, opts)
+}
+
+// Sign implements token signing for the SigningMethod.
+// For this signing method, key must be an rsa.PrivateKey struct
+func (m *SigningMethodRSAPSS) Sign(signingString string, key interface{}) (string, error) {
+ var rsaKey *rsa.PrivateKey
+
+ switch k := key.(type) {
+ case *rsa.PrivateKey:
+ rsaKey = k
+ default:
+ return "", ErrInvalidKeyType
+ }
+
+ // Create the hasher
+ if !m.Hash.Available() {
+ return "", ErrHashUnavailable
+ }
+
+ hasher := m.Hash.New()
+ hasher.Write([]byte(signingString))
+
+ // Sign the string and return the encoded bytes
+ if sigBytes, err := rsa.SignPSS(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil), m.Options); err == nil {
+ return EncodeSegment(sigBytes), nil
+ } else {
+ return "", err
+ }
+}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/rsa_utils.go b/vendor/github.com/golang-jwt/jwt/v4/rsa_utils.go
new file mode 100644
index 0000000000..1966c450bf
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/rsa_utils.go
@@ -0,0 +1,105 @@
+package jwt
+
+import (
+ "crypto/rsa"
+ "crypto/x509"
+ "encoding/pem"
+ "errors"
+)
+
+var (
+ ErrKeyMustBePEMEncoded = errors.New("invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key")
+ ErrNotRSAPrivateKey = errors.New("key is not a valid RSA private key")
+ ErrNotRSAPublicKey = errors.New("key is not a valid RSA public key")
+)
+
+// ParseRSAPrivateKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 private key
+func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) {
+ var err error
+
+ // Parse PEM block
+ var block *pem.Block
+ if block, _ = pem.Decode(key); block == nil {
+ return nil, ErrKeyMustBePEMEncoded
+ }
+
+ var parsedKey interface{}
+ if parsedKey, err = x509.ParsePKCS1PrivateKey(block.Bytes); err != nil {
+ if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil {
+ return nil, err
+ }
+ }
+
+ var pkey *rsa.PrivateKey
+ var ok bool
+ if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok {
+ return nil, ErrNotRSAPrivateKey
+ }
+
+ return pkey, nil
+}
+
+// ParseRSAPrivateKeyFromPEMWithPassword parses a PEM encoded PKCS1 or PKCS8 private key protected with password
+//
+// Deprecated: This function is deprecated and should not be used anymore. It uses the deprecated x509.DecryptPEMBlock
+// function, which was deprecated since RFC 1423 is regarded insecure by design. Unfortunately, there is no alternative
+// in the Go standard library for now. See https://github.com/golang/go/issues/8860.
+func ParseRSAPrivateKeyFromPEMWithPassword(key []byte, password string) (*rsa.PrivateKey, error) {
+ var err error
+
+ // Parse PEM block
+ var block *pem.Block
+ if block, _ = pem.Decode(key); block == nil {
+ return nil, ErrKeyMustBePEMEncoded
+ }
+
+ var parsedKey interface{}
+
+ var blockDecrypted []byte
+ if blockDecrypted, err = x509.DecryptPEMBlock(block, []byte(password)); err != nil {
+ return nil, err
+ }
+
+ if parsedKey, err = x509.ParsePKCS1PrivateKey(blockDecrypted); err != nil {
+ if parsedKey, err = x509.ParsePKCS8PrivateKey(blockDecrypted); err != nil {
+ return nil, err
+ }
+ }
+
+ var pkey *rsa.PrivateKey
+ var ok bool
+ if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok {
+ return nil, ErrNotRSAPrivateKey
+ }
+
+ return pkey, nil
+}
+
+// ParseRSAPublicKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 public key
+func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) {
+ var err error
+
+ // Parse PEM block
+ var block *pem.Block
+ if block, _ = pem.Decode(key); block == nil {
+ return nil, ErrKeyMustBePEMEncoded
+ }
+
+ // Parse the key
+ var parsedKey interface{}
+ if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil {
+ if cert, err := x509.ParseCertificate(block.Bytes); err == nil {
+ parsedKey = cert.PublicKey
+ } else {
+ return nil, err
+ }
+ }
+
+ var pkey *rsa.PublicKey
+ var ok bool
+ if pkey, ok = parsedKey.(*rsa.PublicKey); !ok {
+ return nil, ErrNotRSAPublicKey
+ }
+
+ return pkey, nil
+}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/signing_method.go b/vendor/github.com/golang-jwt/jwt/v4/signing_method.go
new file mode 100644
index 0000000000..241ae9c60d
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/signing_method.go
@@ -0,0 +1,46 @@
+package jwt
+
+import (
+ "sync"
+)
+
+var signingMethods = map[string]func() SigningMethod{}
+var signingMethodLock = new(sync.RWMutex)
+
+// SigningMethod can be used add new methods for signing or verifying tokens.
+type SigningMethod interface {
+ Verify(signingString, signature string, key interface{}) error // Returns nil if signature is valid
+ Sign(signingString string, key interface{}) (string, error) // Returns encoded signature or error
+ Alg() string // returns the alg identifier for this method (example: 'HS256')
+}
+
+// RegisterSigningMethod registers the "alg" name and a factory function for signing method.
+// This is typically done during init() in the method's implementation
+func RegisterSigningMethod(alg string, f func() SigningMethod) {
+ signingMethodLock.Lock()
+ defer signingMethodLock.Unlock()
+
+ signingMethods[alg] = f
+}
+
+// GetSigningMethod retrieves a signing method from an "alg" string
+func GetSigningMethod(alg string) (method SigningMethod) {
+ signingMethodLock.RLock()
+ defer signingMethodLock.RUnlock()
+
+ if methodF, ok := signingMethods[alg]; ok {
+ method = methodF()
+ }
+ return
+}
+
+// GetAlgorithms returns a list of registered "alg" names
+func GetAlgorithms() (algs []string) {
+ signingMethodLock.RLock()
+ defer signingMethodLock.RUnlock()
+
+ for alg := range signingMethods {
+ algs = append(algs, alg)
+ }
+ return
+}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/staticcheck.conf b/vendor/github.com/golang-jwt/jwt/v4/staticcheck.conf
new file mode 100644
index 0000000000..53745d51d7
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/staticcheck.conf
@@ -0,0 +1 @@
+checks = ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1023"]
diff --git a/vendor/github.com/golang-jwt/jwt/v4/token.go b/vendor/github.com/golang-jwt/jwt/v4/token.go
new file mode 100644
index 0000000000..786b275ce0
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/token.go
@@ -0,0 +1,143 @@
+package jwt
+
+import (
+ "encoding/base64"
+ "encoding/json"
+ "strings"
+ "time"
+)
+
+// DecodePaddingAllowed will switch the codec used for decoding JWTs respectively. Note that the JWS RFC7515
+// states that the tokens will utilize a Base64url encoding with no padding. Unfortunately, some implementations
+// of JWT are producing non-standard tokens, and thus require support for decoding. Note that this is a global
+// variable, and updating it will change the behavior on a package level, and is also NOT go-routine safe.
+// To use the non-recommended decoding, set this boolean to `true` prior to using this package.
+var DecodePaddingAllowed bool
+
+// DecodeStrict will switch the codec used for decoding JWTs into strict mode.
+// In this mode, the decoder requires that trailing padding bits are zero, as described in RFC 4648 section 3.5.
+// Note that this is a global variable, and updating it will change the behavior on a package level, and is also NOT go-routine safe.
+// To use strict decoding, set this boolean to `true` prior to using this package.
+var DecodeStrict bool
+
+// TimeFunc provides the current time when parsing token to validate "exp" claim (expiration time).
+// You can override it to use another time value. This is useful for testing or if your
+// server uses a different time zone than your tokens.
+var TimeFunc = time.Now
+
+// Keyfunc will be used by the Parse methods as a callback function to supply
+// the key for verification. The function receives the parsed,
+// but unverified Token. This allows you to use properties in the
+// Header of the token (such as `kid`) to identify which key to use.
+type Keyfunc func(*Token) (interface{}, error)
+
+// Token represents a JWT Token. Different fields will be used depending on whether you're
+// creating or parsing/verifying a token.
+type Token struct {
+ Raw string // The raw token. Populated when you Parse a token
+ Method SigningMethod // The signing method used or to be used
+ Header map[string]interface{} // The first segment of the token
+ Claims Claims // The second segment of the token
+ Signature string // The third segment of the token. Populated when you Parse a token
+ Valid bool // Is the token valid? Populated when you Parse/Verify a token
+}
+
+// New creates a new Token with the specified signing method and an empty map of claims.
+func New(method SigningMethod) *Token {
+ return NewWithClaims(method, MapClaims{})
+}
+
+// NewWithClaims creates a new Token with the specified signing method and claims.
+func NewWithClaims(method SigningMethod, claims Claims) *Token {
+ return &Token{
+ Header: map[string]interface{}{
+ "typ": "JWT",
+ "alg": method.Alg(),
+ },
+ Claims: claims,
+ Method: method,
+ }
+}
+
+// SignedString creates and returns a complete, signed JWT.
+// The token is signed using the SigningMethod specified in the token.
+func (t *Token) SignedString(key interface{}) (string, error) {
+ var sig, sstr string
+ var err error
+ if sstr, err = t.SigningString(); err != nil {
+ return "", err
+ }
+ if sig, err = t.Method.Sign(sstr, key); err != nil {
+ return "", err
+ }
+ return strings.Join([]string{sstr, sig}, "."), nil
+}
+
+// SigningString generates the signing string. This is the
+// most expensive part of the whole deal. Unless you
+// need this for something special, just go straight for
+// the SignedString.
+func (t *Token) SigningString() (string, error) {
+ var err error
+ var jsonValue []byte
+
+ if jsonValue, err = json.Marshal(t.Header); err != nil {
+ return "", err
+ }
+ header := EncodeSegment(jsonValue)
+
+ if jsonValue, err = json.Marshal(t.Claims); err != nil {
+ return "", err
+ }
+ claim := EncodeSegment(jsonValue)
+
+ return strings.Join([]string{header, claim}, "."), nil
+}
+
+// Parse parses, validates, verifies the signature and returns the parsed token.
+// keyFunc will receive the parsed token and should return the cryptographic key
+// for verifying the signature.
+// The caller is strongly encouraged to set the WithValidMethods option to
+// validate the 'alg' claim in the token matches the expected algorithm.
+// For more details about the importance of validating the 'alg' claim,
+// see https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/
+func Parse(tokenString string, keyFunc Keyfunc, options ...ParserOption) (*Token, error) {
+ return NewParser(options...).Parse(tokenString, keyFunc)
+}
+
+// ParseWithClaims is a shortcut for NewParser().ParseWithClaims().
+//
+// Note: If you provide a custom claim implementation that embeds one of the standard claims (such as RegisteredClaims),
+// make sure that a) you either embed a non-pointer version of the claims or b) if you are using a pointer, allocate the
+// proper memory for it before passing in the overall claims, otherwise you might run into a panic.
+func ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc, options ...ParserOption) (*Token, error) {
+ return NewParser(options...).ParseWithClaims(tokenString, claims, keyFunc)
+}
+
+// EncodeSegment encodes a JWT specific base64url encoding with padding stripped
+//
+// Deprecated: In a future release, we will demote this function to a non-exported function, since it
+// should only be used internally
+func EncodeSegment(seg []byte) string {
+ return base64.RawURLEncoding.EncodeToString(seg)
+}
+
+// DecodeSegment decodes a JWT specific base64url encoding with padding stripped
+//
+// Deprecated: In a future release, we will demote this function to a non-exported function, since it
+// should only be used internally
+func DecodeSegment(seg string) ([]byte, error) {
+ encoding := base64.RawURLEncoding
+
+ if DecodePaddingAllowed {
+ if l := len(seg) % 4; l > 0 {
+ seg += strings.Repeat("=", 4-l)
+ }
+ encoding = base64.URLEncoding
+ }
+
+ if DecodeStrict {
+ encoding = encoding.Strict()
+ }
+ return encoding.DecodeString(seg)
+}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/types.go b/vendor/github.com/golang-jwt/jwt/v4/types.go
new file mode 100644
index 0000000000..ac8e140eb1
--- /dev/null
+++ b/vendor/github.com/golang-jwt/jwt/v4/types.go
@@ -0,0 +1,145 @@
+package jwt
+
+import (
+ "encoding/json"
+ "fmt"
+ "math"
+ "reflect"
+ "strconv"
+ "time"
+)
+
+// TimePrecision sets the precision of times and dates within this library.
+// This has an influence on the precision of times when comparing expiry or
+// other related time fields. Furthermore, it is also the precision of times
+// when serializing.
+//
+// For backwards compatibility the default precision is set to seconds, so that
+// no fractional timestamps are generated.
+var TimePrecision = time.Second
+
+// MarshalSingleStringAsArray modifies the behaviour of the ClaimStrings type, especially
+// its MarshalJSON function.
+//
+// If it is set to true (the default), it will always serialize the type as an
+// array of strings, even if it just contains one element, defaulting to the behaviour
+// of the underlying []string. If it is set to false, it will serialize to a single
+// string, if it contains one element. Otherwise, it will serialize to an array of strings.
+var MarshalSingleStringAsArray = true
+
+// NumericDate represents a JSON numeric date value, as referenced at
+// https://datatracker.ietf.org/doc/html/rfc7519#section-2.
+type NumericDate struct {
+ time.Time
+}
+
+// NewNumericDate constructs a new *NumericDate from a standard library time.Time struct.
+// It will truncate the timestamp according to the precision specified in TimePrecision.
+func NewNumericDate(t time.Time) *NumericDate {
+ return &NumericDate{t.Truncate(TimePrecision)}
+}
+
+// newNumericDateFromSeconds creates a new *NumericDate out of a float64 representing a
+// UNIX epoch with the float fraction representing non-integer seconds.
+func newNumericDateFromSeconds(f float64) *NumericDate {
+ round, frac := math.Modf(f)
+ return NewNumericDate(time.Unix(int64(round), int64(frac*1e9)))
+}
+
+// MarshalJSON is an implementation of the json.RawMessage interface and serializes the UNIX epoch
+// represented in NumericDate to a byte array, using the precision specified in TimePrecision.
+func (date NumericDate) MarshalJSON() (b []byte, err error) {
+ var prec int
+ if TimePrecision < time.Second {
+ prec = int(math.Log10(float64(time.Second) / float64(TimePrecision)))
+ }
+ truncatedDate := date.Truncate(TimePrecision)
+
+ // For very large timestamps, UnixNano would overflow an int64, but this
+ // function requires nanosecond level precision, so we have to use the
+ // following technique to get round the issue:
+ // 1. Take the normal unix timestamp to form the whole number part of the
+ // output,
+ // 2. Take the result of the Nanosecond function, which retuns the offset
+ // within the second of the particular unix time instance, to form the
+ // decimal part of the output
+ // 3. Concatenate them to produce the final result
+ seconds := strconv.FormatInt(truncatedDate.Unix(), 10)
+ nanosecondsOffset := strconv.FormatFloat(float64(truncatedDate.Nanosecond())/float64(time.Second), 'f', prec, 64)
+
+ output := append([]byte(seconds), []byte(nanosecondsOffset)[1:]...)
+
+ return output, nil
+}
+
+// UnmarshalJSON is an implementation of the json.RawMessage interface and deserializses a
+// NumericDate from a JSON representation, i.e. a json.Number. This number represents an UNIX epoch
+// with either integer or non-integer seconds.
+func (date *NumericDate) UnmarshalJSON(b []byte) (err error) {
+ var (
+ number json.Number
+ f float64
+ )
+
+ if err = json.Unmarshal(b, &number); err != nil {
+ return fmt.Errorf("could not parse NumericData: %w", err)
+ }
+
+ if f, err = number.Float64(); err != nil {
+ return fmt.Errorf("could not convert json number value to float: %w", err)
+ }
+
+ n := newNumericDateFromSeconds(f)
+ *date = *n
+
+ return nil
+}
+
+// ClaimStrings is basically just a slice of strings, but it can be either serialized from a string array or just a string.
+// This type is necessary, since the "aud" claim can either be a single string or an array.
+type ClaimStrings []string
+
+func (s *ClaimStrings) UnmarshalJSON(data []byte) (err error) {
+ var value interface{}
+
+ if err = json.Unmarshal(data, &value); err != nil {
+ return err
+ }
+
+ var aud []string
+
+ switch v := value.(type) {
+ case string:
+ aud = append(aud, v)
+ case []string:
+ aud = ClaimStrings(v)
+ case []interface{}:
+ for _, vv := range v {
+ vs, ok := vv.(string)
+ if !ok {
+ return &json.UnsupportedTypeError{Type: reflect.TypeOf(vv)}
+ }
+ aud = append(aud, vs)
+ }
+ case nil:
+ return nil
+ default:
+ return &json.UnsupportedTypeError{Type: reflect.TypeOf(v)}
+ }
+
+ *s = aud
+
+ return
+}
+
+func (s ClaimStrings) MarshalJSON() (b []byte, err error) {
+ // This handles a special case in the JWT RFC. If the string array, e.g. used by the "aud" field,
+ // only contains one element, it MAY be serialized as a single string. This may or may not be
+ // desired based on the ecosystem of other JWT library used, so we make it configurable by the
+ // variable MarshalSingleStringAsArray.
+ if len(s) == 1 && !MarshalSingleStringAsArray {
+ return json.Marshal(s[0])
+ }
+
+ return json.Marshal([]string(s))
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/LICENSE b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/LICENSE
new file mode 100644
index 0000000000..cc6010b566
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/LICENSE
@@ -0,0 +1,73 @@
+Copyright (c) Huawei Technologies Co., Ltd. 2020-present. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+
+Copyright of core/signer/escape.go
+
+Copyright (c) 2009 The Go Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+Copyright of core/signer/signer.go
+
+Copyright (c) 2014, Xianjie
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice, this
+ list of conditions and the following disclaimer in the documentation and/or
+ other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic/basic_icredential.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic/basic_icredential.go
new file mode 100644
index 0000000000..17577d6199
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic/basic_icredential.go
@@ -0,0 +1,305 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package basic
+
+import (
+ "fmt"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/cache"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/internal"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/impl"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdkerr"
+ "io/ioutil"
+ "os"
+ "time"
+)
+
+const (
+ ProjectIdInHeader = "X-Project-Id"
+ SecurityTokenInHeader = "X-Security-Token"
+ AuthTokenInHeader = "X-Auth-Token"
+)
+
+var DefaultDerivedPredicate = auth.GetDefaultDerivedPredicate()
+
+type Credentials struct {
+ IamEndpoint string
+ AK string
+ SK string
+ ProjectId string
+ SecurityToken string
+ IdpId string
+ IdTokenFile string
+ DerivedPredicate func(*request.DefaultHttpRequest) bool
+
+ derivedAuthServiceName string
+ regionId string
+ authToken string
+ expiredAt int64
+}
+
+func (s *Credentials) ProcessAuthParams(client *impl.DefaultHttpClient, region string) auth.ICredential {
+ if s.ProjectId != "" {
+ return s
+ }
+
+ authCache := cache.GetCache()
+ akWithName := s.AK + region
+ if projectId, ok := authCache.GetAuth(akWithName); ok {
+ s.ProjectId = projectId
+ return s
+ }
+
+ derivedPredicate := s.DerivedPredicate
+ s.DerivedPredicate = nil
+ r := internal.GetKeystoneListProjectsRequest(s.IamEndpoint, region, client.GetHttpConfig())
+ req, err := s.ProcessAuthRequest(client, r)
+ if err != nil {
+ panic(fmt.Sprintf("failed to get project id, %s", err.Error()))
+ }
+
+ id, err := internal.KeystoneListProjects(client, req)
+ if err != nil {
+ panic(fmt.Sprintf("failed to get project id, %s", err.Error()))
+ }
+
+ s.ProjectId = id
+ authCache.PutAuth(akWithName, id)
+
+ s.DerivedPredicate = derivedPredicate
+
+ return s
+}
+
+func (s *Credentials) ProcessAuthRequest(client *impl.DefaultHttpClient, req *request.DefaultHttpRequest) (*request.DefaultHttpRequest, error) {
+ if s.needUpdateAuthToken() {
+ err := s.updateAuthTokenByIdToken(client)
+ if err != nil {
+ return nil, err
+ }
+ } else if s.needUpdateSecurityToken() {
+ err := s.UpdateSecurityTokenFromMetadata()
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ reqBuilder := req.Builder()
+ if s.ProjectId != "" {
+ reqBuilder = reqBuilder.AddAutoFilledPathParam("project_id", s.ProjectId).AddHeaderParam(ProjectIdInHeader, s.ProjectId)
+ }
+
+ if s.authToken != "" {
+ req := reqBuilder.Build()
+ req.AddHeaderParam(AuthTokenInHeader, s.authToken)
+ return req, nil
+ }
+
+ if s.SecurityToken != "" {
+ reqBuilder.AddHeaderParam(SecurityTokenInHeader, s.SecurityToken)
+ }
+
+ var additionalHeaders map[string]string
+ var err error
+ if s.IsDerivedAuth(req) {
+ additionalHeaders, err = signer.GetDerivedSigner().Sign(reqBuilder.Build(), s.AK, s.SK, s.derivedAuthServiceName, s.regionId)
+ } else {
+ sn, err := signer.GetSigner(req.GetSigningAlgorithm())
+ if err != nil {
+ return nil, err
+ }
+ additionalHeaders, err = sn.Sign(reqBuilder.Build(), s.AK, s.SK)
+ }
+
+ if err != nil {
+ return nil, err
+ }
+
+ for key, value := range additionalHeaders {
+ req.AddHeaderParam(key, value)
+ }
+ return req, nil
+}
+
+func (s *Credentials) ProcessDerivedAuthParams(derivedAuthServiceName, regionId string) auth.ICredential {
+ if s.derivedAuthServiceName == "" {
+ s.derivedAuthServiceName = derivedAuthServiceName
+ }
+
+ if s.regionId == "" {
+ s.regionId = regionId
+ }
+
+ return s
+}
+
+func (s *Credentials) IsDerivedAuth(httpRequest *request.DefaultHttpRequest) bool {
+ if s.DerivedPredicate == nil {
+ return false
+ }
+
+ return s.DerivedPredicate(httpRequest)
+}
+
+func (s *Credentials) needUpdateSecurityToken() bool {
+ if s.authToken != "" {
+ return false
+ }
+ if s.AK == "" && s.SK == "" {
+ return true
+ }
+ if s.expiredAt == 0 || s.SecurityToken == "" {
+ return false
+ }
+ return s.expiredAt-time.Now().Unix() < 60
+}
+
+func (s *Credentials) UpdateSecurityTokenFromMetadata() error {
+ credential, err := internal.GetCredentialFromMetadata()
+ if err != nil {
+ return err
+ }
+
+ s.AK = credential.Access
+ s.SK = credential.Secret
+ s.SecurityToken = credential.Securitytoken
+ location, err := time.ParseInLocation(`2006-01-02T15:04:05Z`, credential.ExpiresAt, time.UTC)
+ if err != nil {
+ return err
+ }
+ s.expiredAt = location.Unix()
+
+ return nil
+}
+
+func (s *Credentials) needUpdateAuthToken() bool {
+ if s.IdpId == "" || s.IdTokenFile == "" {
+ return false
+ }
+ if s.authToken == "" {
+ return true
+ }
+ return s.expiredAt-time.Now().Unix() < 60
+}
+
+func (s *Credentials) updateAuthTokenByIdToken(client *impl.DefaultHttpClient) error {
+ idToken, err := s.getIdToken()
+ if err != nil {
+ return err
+ }
+
+ req := internal.GetProjectTokenWithIdTokenRequest(s.IamEndpoint, s.IdpId, idToken, s.ProjectId, client.GetHttpConfig())
+ resp, err := internal.CreateTokenWithIdToken(client, req)
+ if err != nil {
+ return err
+ }
+
+ location, err := time.ParseInLocation(`2006-01-02T15:04:05Z`, resp.Token.ExpiresAt, time.UTC)
+ if err != nil {
+ return err
+ }
+ s.expiredAt = location.Unix()
+ s.authToken = resp.XSubjectToken
+ return nil
+}
+
+func (s *Credentials) getIdToken() (string, error) {
+ _, err := os.Stat(s.IdTokenFile)
+ if err != nil {
+ return "", err
+ }
+
+ bytes, err := ioutil.ReadFile(s.IdTokenFile)
+ if err != nil {
+ return "", err
+ }
+ idToken := string(bytes)
+ if idToken == "" {
+ return "", sdkerr.NewCredentialsTypeError("id token is empty")
+ }
+ return idToken, nil
+}
+
+type CredentialsBuilder struct {
+ Credentials *Credentials
+}
+
+func NewCredentialsBuilder() *CredentialsBuilder {
+ return &CredentialsBuilder{Credentials: &Credentials{
+ IamEndpoint: internal.GetIamEndpoint(),
+ }}
+}
+
+func (builder *CredentialsBuilder) WithIamEndpointOverride(endpoint string) *CredentialsBuilder {
+ builder.Credentials.IamEndpoint = endpoint
+ return builder
+}
+
+func (builder *CredentialsBuilder) WithAk(ak string) *CredentialsBuilder {
+ builder.Credentials.AK = ak
+ return builder
+}
+
+func (builder *CredentialsBuilder) WithSk(sk string) *CredentialsBuilder {
+ builder.Credentials.SK = sk
+ return builder
+}
+
+func (builder *CredentialsBuilder) WithProjectId(projectId string) *CredentialsBuilder {
+ builder.Credentials.ProjectId = projectId
+ return builder
+}
+
+func (builder *CredentialsBuilder) WithSecurityToken(token string) *CredentialsBuilder {
+ builder.Credentials.SecurityToken = token
+ return builder
+}
+
+func (builder *CredentialsBuilder) WithDerivedPredicate(derivedPredicate func(*request.DefaultHttpRequest) bool) *CredentialsBuilder {
+ builder.Credentials.DerivedPredicate = derivedPredicate
+ return builder
+}
+
+func (builder *CredentialsBuilder) WithIdpId(idpId string) *CredentialsBuilder {
+ builder.Credentials.IdpId = idpId
+ return builder
+}
+
+func (builder *CredentialsBuilder) WithIdTokenFile(idTokenFile string) *CredentialsBuilder {
+ builder.Credentials.IdTokenFile = idTokenFile
+ return builder
+}
+
+func (builder *CredentialsBuilder) Build() *Credentials {
+ if builder.Credentials.IdpId != "" || builder.Credentials.IdTokenFile != "" {
+ if builder.Credentials.IdpId == "" {
+ panic(sdkerr.NewCredentialsTypeError("IdpId is required when using IdpId&IdTokenFile"))
+ }
+ if builder.Credentials.IdTokenFile == "" {
+ panic(sdkerr.NewCredentialsTypeError("IdTokenFile is required when using IdpId&IdTokenFile"))
+ }
+ if builder.Credentials.ProjectId == "" {
+ panic(sdkerr.NewCredentialsTypeError("ProjectId is required when using IdpId&IdTokenFile"))
+ }
+ }
+ return builder.Credentials
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/cache/auth_cache.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/cache/auth_cache.go
new file mode 100644
index 0000000000..c9cc7caaff
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/cache/auth_cache.go
@@ -0,0 +1,58 @@
+// Copyright 2020 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package cache
+
+import (
+ "sync"
+)
+
+var (
+ c *Cache
+ m sync.RWMutex
+ once sync.Once
+)
+
+type Cache struct {
+ value map[string]string
+}
+
+func GetCache() *Cache {
+ once.Do(func() {
+ c = &Cache{
+ value: make(map[string]string),
+ }
+ })
+
+ return c
+}
+
+func (c *Cache) PutAuth(key string, value string) error {
+ m.Lock()
+ defer m.Unlock()
+ c.value[key] = value
+ return nil
+}
+
+func (c *Cache) GetAuth(key string) (string, bool) {
+ m.RLock()
+ defer m.RUnlock()
+ value, ok := c.value[key]
+ return value, ok
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/derived_icredential.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/derived_icredential.go
new file mode 100644
index 0000000000..3e8b73974f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/derived_icredential.go
@@ -0,0 +1,45 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package auth
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request"
+ "regexp"
+ "strings"
+)
+
+const DefaultEndpointReg = "^[a-z][a-z0-9-]+(\\.[a-z]{2,}-[a-z]+-\\d{1,2})?\\.(my)?(huaweicloud|myhwclouds).(com|cn)"
+
+type IDerivedCredential interface {
+ ProcessDerivedAuthParams(derivedAuthServiceName, regionId string) ICredential
+ IsDerivedAuth(httpRequest *request.DefaultHttpRequest) bool
+ ICredential
+}
+
+func GetDefaultDerivedPredicate() func(*request.DefaultHttpRequest) bool {
+ return func(httpRequest *request.DefaultHttpRequest) bool {
+ matched, err := regexp.MatchString(DefaultEndpointReg, strings.Replace(httpRequest.GetEndpoint(), "https://", "", 1))
+ if err != nil {
+ return true
+ } else {
+ return !matched
+ }
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/global/global_icredential.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/global/global_icredential.go
new file mode 100644
index 0000000000..e8cd87ace1
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/global/global_icredential.go
@@ -0,0 +1,305 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package global
+
+import (
+ "fmt"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/cache"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/internal"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/impl"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdkerr"
+ "io/ioutil"
+ "os"
+ "time"
+)
+
+const (
+ DomainIdInHeader = "X-Domain-Id"
+ SecurityTokenInHeader = "X-Security-Token"
+ GlobalRegionId = "globe"
+ AuthTokenInHeader = "X-Auth-Token"
+)
+
+var DefaultDerivedPredicate = auth.GetDefaultDerivedPredicate()
+
+type Credentials struct {
+ IamEndpoint string
+ AK string
+ SK string
+ DomainId string
+ SecurityToken string
+ IdpId string
+ IdTokenFile string
+ DerivedPredicate func(*request.DefaultHttpRequest) bool
+
+ derivedAuthServiceName string
+ regionId string
+ authToken string
+ expiredAt int64
+}
+
+func (s *Credentials) ProcessAuthParams(client *impl.DefaultHttpClient, region string) auth.ICredential {
+ if s.DomainId != "" {
+ return s
+ }
+
+ authCache := cache.GetCache()
+ if domainId, ok := authCache.GetAuth(s.AK); ok {
+ s.DomainId = domainId
+ return s
+ }
+
+ derivedPredicate := s.DerivedPredicate
+ s.DerivedPredicate = nil
+
+ req, err := s.ProcessAuthRequest(client, internal.GetKeystoneListAuthDomainsRequest(s.IamEndpoint, client.GetHttpConfig()))
+ if err != nil {
+ panic(fmt.Sprintf("failed to get domain id, %s", err.Error()))
+ }
+
+ id, err := internal.KeystoneListAuthDomains(client, req)
+ if err != nil {
+ panic(fmt.Sprintf("failed to get domain id, %s", err.Error()))
+ }
+
+ s.DomainId = id
+ authCache.PutAuth(s.AK, id)
+
+ s.DerivedPredicate = derivedPredicate
+
+ return s
+}
+
+func (s *Credentials) ProcessAuthRequest(client *impl.DefaultHttpClient, req *request.DefaultHttpRequest) (*request.DefaultHttpRequest, error) {
+ if s.needUpdateAuthToken() {
+ err := s.updateAuthTokenByIdToken(client)
+ if err != nil {
+ return nil, err
+ }
+ } else if s.needUpdateSecurityToken() {
+ err := s.UpdateSecurityTokenFromMetadata()
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ reqBuilder := req.Builder()
+ if s.DomainId != "" {
+ reqBuilder = reqBuilder.AddAutoFilledPathParam("domain_id", s.DomainId).AddHeaderParam(DomainIdInHeader, s.DomainId)
+ }
+
+ if s.authToken != "" {
+ req := reqBuilder.Build()
+ req.AddHeaderParam(AuthTokenInHeader, s.authToken)
+ return req, nil
+ }
+
+ if s.SecurityToken != "" {
+ reqBuilder.AddHeaderParam(SecurityTokenInHeader, s.SecurityToken)
+ }
+
+ var additionalHeaders map[string]string
+ var err error
+ if s.IsDerivedAuth(req) {
+ additionalHeaders, err = signer.GetDerivedSigner().Sign(reqBuilder.Build(), s.AK, s.SK, s.derivedAuthServiceName, s.regionId)
+ } else {
+ sn, err := signer.GetSigner(req.GetSigningAlgorithm())
+ if err != nil {
+ return nil, err
+ }
+ additionalHeaders, err = sn.Sign(reqBuilder.Build(), s.AK, s.SK)
+ }
+
+ if err != nil {
+ return nil, err
+ }
+
+ for key, value := range additionalHeaders {
+ req.AddHeaderParam(key, value)
+ }
+ return req, nil
+}
+
+func (s *Credentials) ProcessDerivedAuthParams(derivedAuthServiceName, regionId string) auth.ICredential {
+ if s.derivedAuthServiceName == "" {
+ s.derivedAuthServiceName = derivedAuthServiceName
+ }
+
+ if s.regionId == "" {
+ s.regionId = GlobalRegionId
+ }
+
+ return s
+}
+
+func (s *Credentials) IsDerivedAuth(httpRequest *request.DefaultHttpRequest) bool {
+ if s.DerivedPredicate == nil {
+ return false
+ }
+
+ return s.DerivedPredicate(httpRequest)
+}
+
+func (s *Credentials) needUpdateSecurityToken() bool {
+ if s.authToken != "" {
+ return false
+ }
+ if s.AK == "" && s.SK == "" {
+ return true
+ }
+ if s.expiredAt == 0 || s.SecurityToken == "" {
+ return false
+ }
+ return s.expiredAt-time.Now().Unix() < 60
+}
+
+func (s *Credentials) needUpdateAuthToken() bool {
+ if s.IdpId == "" || s.IdTokenFile == "" {
+ return false
+ }
+ if s.authToken == "" {
+ return true
+ }
+ return s.expiredAt-time.Now().Unix() < 60
+}
+
+func (s *Credentials) getIdToken() (string, error) {
+ _, err := os.Stat(s.IdTokenFile)
+ if err != nil {
+ return "", err
+ }
+
+ bytes, err := ioutil.ReadFile(s.IdTokenFile)
+ if err != nil {
+ return "", err
+ }
+ idToken := string(bytes)
+ if idToken == "" {
+ return "", sdkerr.NewCredentialsTypeError("id token is empty")
+ }
+ return idToken, nil
+}
+
+func (s *Credentials) UpdateSecurityTokenFromMetadata() error {
+ credential, err := internal.GetCredentialFromMetadata()
+ if err != nil {
+ return err
+ }
+
+ s.AK = credential.Access
+ s.SK = credential.Secret
+ s.SecurityToken = credential.Securitytoken
+ location, err := time.ParseInLocation(`2006-01-02T15:04:05Z`, credential.ExpiresAt, time.UTC)
+ if err != nil {
+ return err
+ }
+ s.expiredAt = location.Unix()
+
+ return nil
+}
+
+func (s *Credentials) updateAuthTokenByIdToken(client *impl.DefaultHttpClient) error {
+ idToken, err := s.getIdToken()
+ if err != nil {
+ return err
+ }
+
+ req := internal.GetDomainTokenWithIdTokenRequest(s.IamEndpoint, s.IdpId, idToken, s.DomainId, client.GetHttpConfig())
+ resp, err := internal.CreateTokenWithIdToken(client, req)
+ if err != nil {
+ return err
+ }
+
+ location, err := time.ParseInLocation(`2006-01-02T15:04:05Z`, resp.Token.ExpiresAt, time.UTC)
+ if err != nil {
+ return err
+ }
+ s.expiredAt = location.Unix()
+ s.authToken = resp.XSubjectToken
+ return nil
+}
+
+type CredentialsBuilder struct {
+ Credentials *Credentials
+}
+
+func NewCredentialsBuilder() *CredentialsBuilder {
+ return &CredentialsBuilder{Credentials: &Credentials{
+ IamEndpoint: internal.GetIamEndpoint(),
+ }}
+}
+
+func (builder *CredentialsBuilder) WithAk(ak string) *CredentialsBuilder {
+ builder.Credentials.AK = ak
+ return builder
+}
+
+func (builder *CredentialsBuilder) WithSk(sk string) *CredentialsBuilder {
+ builder.Credentials.SK = sk
+ return builder
+}
+
+func (builder *CredentialsBuilder) WithDomainId(domainId string) *CredentialsBuilder {
+ builder.Credentials.DomainId = domainId
+ return builder
+}
+
+func (builder *CredentialsBuilder) WithSecurityToken(token string) *CredentialsBuilder {
+ builder.Credentials.SecurityToken = token
+ return builder
+}
+
+func (builder *CredentialsBuilder) WithIamEndpointOverride(endpoint string) *CredentialsBuilder {
+ builder.Credentials.IamEndpoint = endpoint
+ return builder
+}
+
+func (builder *CredentialsBuilder) WithDerivedPredicate(derivedPredicate func(*request.DefaultHttpRequest) bool) *CredentialsBuilder {
+ builder.Credentials.DerivedPredicate = derivedPredicate
+ return builder
+}
+
+func (builder *CredentialsBuilder) WithIdpId(idpId string) *CredentialsBuilder {
+ builder.Credentials.IdpId = idpId
+ return builder
+}
+
+func (builder *CredentialsBuilder) WithIdTokenFile(idTokenFile string) *CredentialsBuilder {
+ builder.Credentials.IdTokenFile = idTokenFile
+ return builder
+}
+
+func (builder *CredentialsBuilder) Build() *Credentials {
+ if builder.Credentials.IdpId != "" || builder.Credentials.IdTokenFile != "" {
+ if builder.Credentials.IdpId == "" {
+ panic(sdkerr.NewCredentialsTypeError("IdpId is required when using IdpId&IdTokenFile"))
+ }
+ if builder.Credentials.IdTokenFile == "" {
+ panic(sdkerr.NewCredentialsTypeError("IdTokenFile is required when using IdpId&IdTokenFile"))
+ }
+ if builder.Credentials.DomainId == "" {
+ panic(sdkerr.NewCredentialsTypeError("DomainId is required when using IdpId&IdTokenFile"))
+ }
+ }
+ return builder.Credentials
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/icredential.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/icredential.go
new file mode 100644
index 0000000000..a9392d8473
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/icredential.go
@@ -0,0 +1,30 @@
+// Copyright 2020 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package auth
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/impl"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request"
+)
+
+type ICredential interface {
+ ProcessAuthParams(httpClient *impl.DefaultHttpClient, region string) ICredential
+ ProcessAuthRequest(httpClient *impl.DefaultHttpClient, httpRequest *request.DefaultHttpRequest) (*request.DefaultHttpRequest, error)
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/internal/iam_service.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/internal/iam_service.go
new file mode 100644
index 0000000000..29b2780650
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/internal/iam_service.go
@@ -0,0 +1,369 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package internal
+
+import (
+ "bytes"
+ "errors"
+ "fmt"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/config"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/impl"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/response"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdkerr"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+ "io/ioutil"
+ "os"
+ "reflect"
+ "strings"
+)
+
+const (
+ DefaultIamEndpoint = "https://iam.myhuaweicloud.com"
+ KeystoneListProjectsUri = "/v3/projects"
+ KeystoneListAuthDomainsUri = "/v3/auth/domains"
+ IamEndpointEnv = "HUAWEICLOUD_SDK_IAM_ENDPOINT"
+ CreateTokenWithIdTokenUri = "/v3.0/OS-AUTH/id-token/tokens"
+
+ NoDomainIdFound = `no domain id found, please select one of the following solutions:
+ 1. Manually specify domainId when initializing the credentials,
+ credentials := global.NewCredentialsBuilder().
+ WithAk(ak).
+ WithSk(sk).
+ WithDomainId(domainId).
+ Build()
+ 2. Use the domain account to grant IAM read permission to the current account
+ 3. Replace the ak/sk of the IAM account with the ak/sk of the domain account`
+
+ NoProjectIdFound = `no project id found, please select one of the following solutions:
+ 1. Manually specify project_id when initializing the credentials,
+ credentials := basic.NewCredentialsBuilder().
+ WithAk(ak).
+ WithSk(sk).
+ WithProjectId(projectId).
+ Build()
+ 2. Use the domain account to grant IAM read permission to the current account
+ 3. Replace the ak/sk of the IAM account with the ak/sk of the domain account`
+)
+
+type KeystoneListProjectsResponse struct {
+ Projects *[]ProjectResult `json:"projects,omitempty"`
+}
+
+type ProjectResult struct {
+ Id string `json:"id"`
+ Name string `json:"name"`
+}
+
+func GetIamEndpoint() string {
+ if endpoint := os.Getenv(IamEndpointEnv); endpoint != "" {
+ https := "https://"
+ if !strings.HasPrefix(endpoint, https) {
+ endpoint = https + endpoint
+ }
+ return endpoint
+ }
+ return DefaultIamEndpoint
+}
+
+func GetKeystoneListProjectsRequest(iamEndpoint string, regionId string, httpConfig config.HttpConfig) *request.DefaultHttpRequest {
+ return request.NewHttpRequestBuilder().
+ WithEndpoint(iamEndpoint).
+ WithPath(KeystoneListProjectsUri).
+ WithMethod("GET").
+ WithSigningAlgorithm(httpConfig.SigningAlgorithm).
+ AddQueryParam("name", reflect.ValueOf(regionId)).
+ Build()
+}
+
+func KeystoneListProjects(client *impl.DefaultHttpClient, req *request.DefaultHttpRequest) (string, error) {
+ resp, err := client.SyncInvokeHttp(req)
+ if err != nil {
+ return "", err
+ }
+
+ data, err := GetResponseBody(resp)
+ if err != nil {
+ return "", err
+ }
+
+ keystoneListProjectResponse := new(KeystoneListProjectsResponse)
+ err = utils.Unmarshal(data, keystoneListProjectResponse)
+ if err != nil {
+ return "", err
+ }
+
+ projects := *keystoneListProjectResponse.Projects
+ if len(projects) == 1 {
+ return (projects)[0].Id, nil
+ } else if len(projects) > 1 {
+ projectIds := make([]string, 0, len(projects))
+ for _, project := range projects {
+ projectIds = append(projectIds, project.Id)
+ }
+
+ return "", errors.New(fmt.Sprintf("multiple project ids found: [%s], please specify one when initializing the credentials", strings.Join(projectIds, ",")))
+ }
+
+ return "", errors.New(NoProjectIdFound)
+}
+
+type KeystoneListAuthDomainsResponse struct {
+ Domains *[]Domains `json:"domains,omitempty"`
+}
+
+type Domains struct {
+ Id string `json:"id"`
+ Name string `json:"name"`
+}
+
+func GetKeystoneListAuthDomainsRequest(iamEndpoint string, httpConfig config.HttpConfig) *request.DefaultHttpRequest {
+ return request.NewHttpRequestBuilder().
+ WithEndpoint(iamEndpoint).
+ WithPath(KeystoneListAuthDomainsUri).
+ WithMethod("GET").
+ WithSigningAlgorithm(httpConfig.SigningAlgorithm).
+ Build()
+}
+
+func KeystoneListAuthDomains(client *impl.DefaultHttpClient, req *request.DefaultHttpRequest) (string, error) {
+ resp, err := client.SyncInvokeHttp(req)
+ if err != nil {
+ return "", err
+ }
+
+ data, err := GetResponseBody(resp)
+ if err != nil {
+ return "", err
+ }
+
+ keystoneListAuthDomainsResponse := new(KeystoneListAuthDomainsResponse)
+ err = utils.Unmarshal(data, keystoneListAuthDomainsResponse)
+ if err != nil {
+ return "", err
+ }
+
+ if len(*keystoneListAuthDomainsResponse.Domains) > 0 {
+
+ return (*keystoneListAuthDomainsResponse.Domains)[0].Id, nil
+ }
+
+ return "", errors.New(NoDomainIdFound)
+}
+
+func GetResponseBody(resp *response.DefaultHttpResponse) ([]byte, error) {
+ if resp.GetStatusCode() >= 400 {
+ return nil, sdkerr.NewServiceResponseError(resp.Response)
+ }
+
+ data, err := ioutil.ReadAll(resp.Response.Body)
+
+ if err != nil {
+ if closeErr := resp.Response.Body.Close(); closeErr != nil {
+ return nil, err
+ }
+ return nil, err
+ }
+
+ if err := resp.Response.Body.Close(); err != nil {
+ return nil, err
+ } else {
+ resp.Response.Body = ioutil.NopCloser(bytes.NewBuffer(data))
+ }
+
+ return data, nil
+}
+
+type CreateTokenWithIdTokenRequest struct {
+ XIdpId string `json:"X-Idp-Id"`
+ Body *GetIdTokenRequestBody `json:"body,omitempty"`
+}
+
+type GetIdTokenRequestBody struct {
+ Auth *GetIdTokenAuthParams `json:"auth"`
+}
+
+type GetIdTokenAuthParams struct {
+ IdToken *GetIdTokenIdTokenBody `json:"id_token"`
+
+ Scope *GetIdTokenIdScopeBody `json:"scope,omitempty"`
+}
+
+type GetIdTokenIdTokenBody struct {
+ Id string `json:"id"`
+}
+
+type GetIdTokenIdScopeBody struct {
+ Domain *GetIdTokenScopeDomainOrProjectBody `json:"domain,omitempty"`
+
+ Project *GetIdTokenScopeDomainOrProjectBody `json:"project,omitempty"`
+}
+
+type GetIdTokenScopeDomainOrProjectBody struct {
+ Id *string `json:"id,omitempty"`
+ Name *string `json:"name,omitempty"`
+}
+
+type CreateTokenWithIdTokenResponse struct {
+ Token *ScopedTokenInfo `json:"token"`
+ XSubjectToken string `json:"X-Subject-Token"`
+ XRequestId string `json:"X-Request-Id"`
+ HttpStatusCode int `json:"-"`
+}
+
+type ScopedTokenInfo struct {
+ ExpiresAt string `json:"expires_at"`
+ Methods []string `json:"methods"`
+ IssuedAt string `json:"issued_at"`
+ User *FederationUserBody `json:"user"`
+ Domain *DomainInfo `json:"domain,omitempty"`
+ Project *ProjectInfo `json:"project,omitempty"`
+ Roles []ScopedTokenInfoRoles `json:"roles"`
+ Catalog []UnscopedTokenInfoCatalog `json:"catalog"`
+}
+
+type FederationUserBody struct {
+ OsFederation *OsFederationInfo `json:"OS-FEDERATION"`
+ Domain *DomainInfo `json:"domain"`
+ Id *string `json:"id,omitempty"`
+ Name *string `json:"name,omitempty"`
+}
+
+type OsFederationInfo struct {
+ IdentityProvider *IdpIdInfo `json:"identity_provider"`
+ Protocol *ProtocolIdInfo `json:"protocol"`
+ Groups []interface{} `json:"groups"`
+}
+
+type IdpIdInfo struct {
+ Id string `json:"id"`
+}
+
+type ProtocolIdInfo struct {
+ Id string `json:"id"`
+}
+
+type DomainInfo struct {
+ Id *string `json:"id,omitempty"`
+ Name string `json:"name"`
+}
+
+type ProjectInfo struct {
+ Domain *DomainInfo `json:"domain,omitempty"`
+ Id *string `json:"id,omitempty"`
+ Name string `json:"name"`
+}
+
+type ScopedTokenInfoRoles struct {
+ Id *string `json:"id,omitempty"`
+ Name *string `json:"name,omitempty"`
+}
+
+type UnscopedTokenInfoCatalog struct {
+ Id *string `json:"id,omitempty"`
+ Interface *string `json:"interface,omitempty"`
+ Region *string `json:"region,omitempty"`
+ RegionId *string `json:"region_id,omitempty"`
+ Url *string `json:"url,omitempty"`
+}
+
+func getCreateTokenWithIdTokenRequestBody(idToken string, scope *GetIdTokenIdScopeBody) *GetIdTokenRequestBody {
+ idTokenAuth := &GetIdTokenIdTokenBody{
+ Id: idToken,
+ }
+ authbody := &GetIdTokenAuthParams{
+ IdToken: idTokenAuth,
+ Scope: scope,
+ }
+ body := &GetIdTokenRequestBody{
+ Auth: authbody,
+ }
+ return body
+}
+
+func getCreateTokenWithIdTokenRequest(iamEndpoint string, idpId string, body *GetIdTokenRequestBody, httpConfig config.HttpConfig) *request.DefaultHttpRequest {
+ req := request.NewHttpRequestBuilder().
+ WithEndpoint(iamEndpoint).
+ WithPath(CreateTokenWithIdTokenUri).
+ WithMethod("POST").
+ WithSigningAlgorithm(httpConfig.SigningAlgorithm).
+ WithBody("body", body).
+ Build()
+ req.AddHeaderParam("X-Idp-Id", idpId)
+ req.AddHeaderParam("Content-Type", "application/json;charset=UTF-8")
+ return req
+}
+
+func GetProjectTokenWithIdTokenRequest(iamEndpoint, idpId, idToken, projectId string, httpConfig config.HttpConfig) *request.DefaultHttpRequest {
+ projectScope := &GetIdTokenScopeDomainOrProjectBody{
+ Id: &projectId,
+ }
+ scopeAuth := &GetIdTokenIdScopeBody{
+ Project: projectScope,
+ }
+ body := getCreateTokenWithIdTokenRequestBody(idToken, scopeAuth)
+ return getCreateTokenWithIdTokenRequest(iamEndpoint, idpId, body, httpConfig)
+}
+
+func GetDomainTokenWithIdTokenRequest(iamEndpoint, idpId, idToken, domainId string, httpConfig config.HttpConfig) *request.DefaultHttpRequest {
+ domainScope := &GetIdTokenScopeDomainOrProjectBody{
+ Id: &domainId,
+ }
+ scopeAuth := &GetIdTokenIdScopeBody{
+ Domain: domainScope,
+ }
+ body := getCreateTokenWithIdTokenRequestBody(idToken, scopeAuth)
+ return getCreateTokenWithIdTokenRequest(iamEndpoint, idpId, body, httpConfig)
+}
+
+func CreateTokenWithIdToken(client *impl.DefaultHttpClient, req *request.DefaultHttpRequest) (*CreateTokenWithIdTokenResponse, error) {
+ resp, err := client.SyncInvokeHttp(req)
+ if err != nil {
+ return nil, err
+ }
+
+ data, err := GetResponseBody(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ createTokenWithIdTokenResponse := new(CreateTokenWithIdTokenResponse)
+ err = utils.Unmarshal(data, createTokenWithIdTokenResponse)
+ if err != nil {
+ return nil, err
+ }
+
+ if createTokenWithIdTokenResponse.Token.ExpiresAt == "" {
+ return nil, errors.New("[CreateTokenWithIdTokenError] failed to get the expiration time of X-Auth-Token")
+ }
+ requestId := resp.GetHeader("X-Request-Id")
+ if requestId == "" {
+ return nil, errors.New("[CreateTokenWithIdTokenError] failed to get X-Request-Id")
+ }
+ authToken := resp.GetHeader("X-Subject-Token")
+ if authToken == "" {
+ return nil, errors.New("[CreateTokenWithIdTokenError] failed to get X-Auth-Token")
+ }
+ createTokenWithIdTokenResponse.HttpStatusCode = resp.GetStatusCode()
+ createTokenWithIdTokenResponse.XRequestId = requestId
+ createTokenWithIdTokenResponse.XSubjectToken = authToken
+
+ return createTokenWithIdTokenResponse, nil
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/internal/metadata.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/internal/metadata.go
new file mode 100644
index 0000000000..53188089dc
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/internal/metadata.go
@@ -0,0 +1,73 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package internal
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdkerr"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+ "io/ioutil"
+ "net/http"
+ "time"
+)
+
+type GetTemporaryCredentialFromMetadataResponse struct {
+ Credential *Credential `json:"credential,omitempty"`
+}
+
+type Credential struct {
+ ExpiresAt string `json:"expires_at"`
+
+ Access string `json:"access"`
+
+ Secret string `json:"secret"`
+
+ Securitytoken string `json:"securitytoken"`
+}
+
+func GetCredentialFromMetadata() (*Credential, error) {
+ client := &http.Client{
+ Timeout: 3 * time.Second,
+ }
+ resp, err := client.Get("http://169.254.169.254/openstack/latest/securitykey")
+
+ if err != nil {
+ return nil, err
+ }
+
+ defer resp.Body.Close()
+ body, err := ioutil.ReadAll(resp.Body)
+ if err != nil {
+ return nil, err
+ }
+
+ if resp.StatusCode >= 400 {
+ return nil, &sdkerr.ServiceResponseError{
+ StatusCode: resp.StatusCode,
+ ErrorMessage: string(body),
+ }
+ }
+
+ respModel := &GetTemporaryCredentialFromMetadataResponse{}
+ err = utils.Unmarshal(body, respModel)
+ if err != nil {
+ return nil, err
+ }
+ return respModel.Credential, nil
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/provider/credential_provider.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/provider/credential_provider.go
new file mode 100644
index 0000000000..702fb3722b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/provider/credential_provider.go
@@ -0,0 +1,80 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package provider
+
+import (
+ "fmt"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdkerr"
+ "reflect"
+)
+
+const (
+ basicCredentialType = "basic"
+ globalCredentialType = "global"
+
+ credentialsAttr = "Credentials"
+ akAttr = "AK"
+ skAttr = "SK"
+ securityTokenAttr = "SecurityToken"
+ idpIdAttr = "IdpId"
+ idTokenFileAttr = "IdTokenFile"
+ iamEndpointAttr = "IamEndpoint"
+)
+
+type ICredentialProvider interface {
+ GetCredentials() (auth.ICredential, error)
+}
+
+type commonAttrs struct {
+ ak string
+ sk string
+ securityToken string
+ idpId string
+ idTokenFile string
+ iamEndpoint string
+}
+
+func fillCommonAttrs(builder interface{}, common commonAttrs) error {
+ v := reflect.ValueOf(builder)
+ if v.Kind() == reflect.Ptr {
+ v = v.Elem()
+ }
+ v = v.FieldByName(credentialsAttr)
+ if v.Kind() == reflect.Ptr {
+ v = v.Elem()
+ }
+
+ if common.iamEndpoint != "" {
+ v.FieldByName(iamEndpointAttr).SetString(common.iamEndpoint)
+ }
+ if common.idpId != "" && common.idTokenFile != "" {
+ v.FieldByName(idpIdAttr).SetString(common.idpId)
+ v.FieldByName(idTokenFileAttr).SetString(common.idTokenFile)
+ return nil
+ } else if common.ak != "" && common.sk != "" {
+ v.FieldByName(akAttr).SetString(common.ak)
+ v.FieldByName(skAttr).SetString(common.sk)
+ v.FieldByName(securityTokenAttr).SetString(common.securityToken)
+ return nil
+ }
+ return sdkerr.NewCredentialsTypeError(fmt.Sprintf("%s&%s or %s&%s does not exist",
+ akAttr, skAttr, idpIdAttr, idTokenFileAttr))
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/provider/env_provider.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/provider/env_provider.go
new file mode 100644
index 0000000000..5c045ddc27
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/provider/env_provider.go
@@ -0,0 +1,94 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package provider
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/global"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdkerr"
+ "os"
+ "strings"
+)
+
+const (
+ akEnvName = "HUAWEICLOUD_SDK_AK"
+ skEnvName = "HUAWEICLOUD_SDK_SK"
+ projectIdEnvName = "HUAWEICLOUD_SDK_PROJECT_ID"
+ domainIdEnvName = "HUAWEICLOUD_SDK_DOMAIN_ID"
+ securityTokenEnvName = "HUAWEICLOUD_SDK_SECURITY_TOKEN"
+ idpIdEnvName = "HUAWEICLOUD_SDK_IDP_ID"
+ idTokenFileEnvName = "HUAWEICLOUD_SDK_ID_TOKEN_FILE"
+)
+
+type EnvCredentialProvider struct {
+ credentialType string
+}
+
+// NewEnvCredentialProvider return a env credential provider
+// Supported credential types: basic, global
+func NewEnvCredentialProvider(credentialType string) *EnvCredentialProvider {
+ return &EnvCredentialProvider{credentialType: strings.ToLower(credentialType)}
+}
+
+// BasicCredentialEnvProvider return a env provider for basic.Credentials
+func BasicCredentialEnvProvider() *EnvCredentialProvider {
+ return NewEnvCredentialProvider(basicCredentialType)
+}
+
+// GlobalCredentialEnvProvider return a env provider for global.Credentials
+func GlobalCredentialEnvProvider() *EnvCredentialProvider {
+ return NewEnvCredentialProvider(globalCredentialType)
+}
+
+// GetCredentials get basic.Credentials or global.Credentials from environment variables
+func (p *EnvCredentialProvider) GetCredentials() (auth.ICredential, error) {
+ if p.credentialType == "" {
+ return nil, sdkerr.NewCredentialsTypeError("credential type is empty")
+ }
+
+ if strings.HasPrefix(p.credentialType, basicCredentialType) {
+ builder := basic.NewCredentialsBuilder().WithProjectId(os.Getenv(projectIdEnvName))
+ err := fillCommonAttrs(builder, getCommonAttrsFromEnv())
+ if err != nil {
+ return nil, err
+ }
+ return builder.Build(), nil
+ } else if strings.HasPrefix(p.credentialType, globalCredentialType) {
+ builder := global.NewCredentialsBuilder().WithDomainId(os.Getenv(domainIdEnvName))
+ err := fillCommonAttrs(builder, getCommonAttrsFromEnv())
+ if err != nil {
+ return nil, err
+ }
+ return builder.Build(), nil
+ }
+
+ return nil, sdkerr.NewCredentialsTypeError("unsupported credential type: " + p.credentialType)
+}
+
+func getCommonAttrsFromEnv() commonAttrs {
+ return commonAttrs{
+ ak: os.Getenv(akEnvName),
+ sk: os.Getenv(skEnvName),
+ securityToken: os.Getenv(securityTokenEnvName),
+ idpId: os.Getenv(idpIdEnvName),
+ idTokenFile: os.Getenv(idTokenFileEnvName),
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/provider/metadata_provider.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/provider/metadata_provider.go
new file mode 100644
index 0000000000..b0f1ece411
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/provider/metadata_provider.go
@@ -0,0 +1,73 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package provider
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/global"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdkerr"
+ "strings"
+)
+
+type MetadataCredentialProvider struct {
+ credentialType string
+}
+
+// NewMetadataCredentialProvider return a metadata credential provider
+// Supported credential types: basic, global
+func NewMetadataCredentialProvider(credentialType string) *MetadataCredentialProvider {
+ return &MetadataCredentialProvider{credentialType: strings.ToLower(credentialType)}
+}
+
+// BasicCredentialMetadataProvider return a metadata provider for basic.Credentials
+func BasicCredentialMetadataProvider() *MetadataCredentialProvider {
+ return NewMetadataCredentialProvider(basicCredentialType)
+}
+
+// GlobalCredentialMetadataProvider return a metadata provider for global.Credentials
+func GlobalCredentialMetadataProvider() *MetadataCredentialProvider {
+ return NewMetadataCredentialProvider(globalCredentialType)
+}
+
+// GetCredentials get basic.Credentials or global.Credentials from the instance's metadata
+func (p *MetadataCredentialProvider) GetCredentials() (auth.ICredential, error) {
+ if p.credentialType == "" {
+ return nil, sdkerr.NewCredentialsTypeError("credential type is empty")
+ }
+
+ if strings.HasPrefix(p.credentialType, basicCredentialType) {
+ credentials := basic.NewCredentialsBuilder().Build()
+ err := credentials.UpdateSecurityTokenFromMetadata()
+ if err != nil {
+ return nil, err
+ }
+ return credentials, nil
+ } else if strings.HasPrefix(p.credentialType, globalCredentialType) {
+ credentials := global.NewCredentialsBuilder().Build()
+ err := credentials.UpdateSecurityTokenFromMetadata()
+ if err != nil {
+ return nil, err
+ }
+ return credentials, nil
+ }
+
+ return nil, sdkerr.NewCredentialsTypeError("unsupported credential type: " + p.credentialType)
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/provider/profile_provider.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/provider/profile_provider.go
new file mode 100644
index 0000000000..1dc4eca878
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/provider/profile_provider.go
@@ -0,0 +1,125 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package provider
+
+import (
+ "fmt"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/global"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdkerr"
+ "gopkg.in/ini.v1"
+ "os"
+ "path/filepath"
+ "strings"
+)
+
+const (
+ credentialsFileEnvName = "HUAWEICLOUD_SDK_CREDENTIALS_FILE"
+ defaultDir = ".huaweicloud"
+ defaultFile = "credentials"
+
+ akName = "ak"
+ skName = "sk"
+ projectIdName = "project_id"
+ domainIdName = "domain_id"
+ securityTokenName = "security_token"
+ iamEndpointName = "iam_endpoint"
+ idpIdName = "idp_id"
+ idTokenFileName = "id_token_file"
+)
+
+type ProfileCredentialProvider struct {
+ credentialType string
+}
+
+// NewProfileCredentialProvider return a profile credential provider
+// Supported credential types: basic, global
+func NewProfileCredentialProvider(credentialType string) *ProfileCredentialProvider {
+ return &ProfileCredentialProvider{credentialType: strings.ToLower(credentialType)}
+}
+
+// BasicCredentialProfileProvider return a profile provider for basic.Credentials
+func BasicCredentialProfileProvider() *ProfileCredentialProvider {
+ return NewProfileCredentialProvider(basicCredentialType)
+}
+
+// GlobalCredentialProfileProvider return a profile provider for global.Credentials
+func GlobalCredentialProfileProvider() *ProfileCredentialProvider {
+ return NewProfileCredentialProvider(globalCredentialType)
+}
+
+// GetCredentials get basic.Credentials or global.Credentials from profile
+func (p *ProfileCredentialProvider) GetCredentials() (auth.ICredential, error) {
+ filePath, err := getCredentialsFilePath()
+ if err != nil {
+ return nil, err
+ }
+ file, err := ini.Load(filePath)
+ if err != nil {
+ return nil, err
+ }
+
+ section := file.Section(p.credentialType)
+ if section == nil {
+ return nil, sdkerr.NewCredentialsTypeError(fmt.Sprintf("credential type '%s' does not exist in '%s'", p.credentialType, filePath))
+ }
+
+ if strings.HasPrefix(p.credentialType, basicCredentialType) {
+ builder := basic.NewCredentialsBuilder().WithProjectId(section.Key(projectIdName).String())
+ err := fillCommonAttrs(builder, getCommonAttrsFromProfile(section))
+ if err != nil {
+ return nil, err
+ }
+ return builder.Build(), nil
+ } else if strings.HasPrefix(p.credentialType, globalCredentialType) {
+ builder := global.NewCredentialsBuilder().WithDomainId(section.Key(domainIdName).String())
+ err := fillCommonAttrs(builder, getCommonAttrsFromProfile(section))
+ if err != nil {
+ return nil, err
+ }
+ return builder.Build(), nil
+ }
+ return nil, sdkerr.NewCredentialsTypeError("unsupported credential type: " + p.credentialType)
+}
+
+func getCredentialsFilePath() (string, error) {
+ if path := os.Getenv(credentialsFileEnvName); path != "" {
+ return path, nil
+ }
+
+ dir, err := os.UserHomeDir()
+ if err != nil {
+ return "", err
+ }
+
+ return filepath.Join(dir, defaultDir, defaultFile), nil
+}
+
+func getCommonAttrsFromProfile(section *ini.Section) commonAttrs {
+ return commonAttrs{
+ ak: section.Key(akName).String(),
+ sk: section.Key(skName).String(),
+ securityToken: section.Key(securityTokenName).String(),
+ idpId: section.Key(idpIdName).String(),
+ idTokenFile: section.Key(idTokenFileName).String(),
+ iamEndpoint: section.Key(iamEndpointName).String(),
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/provider/provider_chain.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/provider/provider_chain.go
new file mode 100644
index 0000000000..4242c7980c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/provider/provider_chain.go
@@ -0,0 +1,82 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package provider
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdkerr"
+ "strings"
+)
+
+type CredentialProviderChain struct {
+ providers []ICredentialProvider
+}
+
+// NewCredentialProviderChain return a credential provider chain
+func NewCredentialProviderChain(providers []ICredentialProvider) *CredentialProviderChain {
+ return &CredentialProviderChain{providers: providers}
+}
+
+// DefaultCredentialProviderChain return a default credential provider chain
+// Supported credential types: basic, global
+// Default order: environment variables -> profile -> metadata
+func DefaultCredentialProviderChain(credentialType string) *CredentialProviderChain {
+ providers := []ICredentialProvider{
+ NewEnvCredentialProvider(credentialType),
+ NewProfileCredentialProvider(credentialType),
+ NewMetadataCredentialProvider(credentialType),
+ }
+ return NewCredentialProviderChain(providers)
+}
+
+// BasicCredentialProviderChain return a provider chain for basic.Credentials
+func BasicCredentialProviderChain() *CredentialProviderChain {
+ providers := []ICredentialProvider{
+ BasicCredentialEnvProvider(),
+ BasicCredentialProfileProvider(),
+ BasicCredentialMetadataProvider(),
+ }
+ return NewCredentialProviderChain(providers)
+}
+
+// GlobalCredentialProviderChain return a provider chain for global.Credentials
+func GlobalCredentialProviderChain() *CredentialProviderChain {
+ providers := []ICredentialProvider{
+ GlobalCredentialEnvProvider(),
+ GlobalCredentialProfileProvider(),
+ GlobalCredentialMetadataProvider(),
+ }
+ return NewCredentialProviderChain(providers)
+}
+
+// GetCredentials get basic.Credentials or global.Credentials in providers
+// In the order of providers, return the first found credentials
+// If credentials not found in every providers, return a error of all providers
+func (p *CredentialProviderChain) GetCredentials() (auth.ICredential, error) {
+ var errs []string
+ for _, provider := range p.providers {
+ credential, err := provider.GetCredentials()
+ if err == nil {
+ return credential, nil
+ }
+ errs = append(errs, err.Error())
+ }
+ return nil, sdkerr.NewCredentialsTypeError("unable to get credential in providers:\n" + strings.Join(errs, "\n"))
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/algorithm/signing_algorithm.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/algorithm/signing_algorithm.go
new file mode 100644
index 0000000000..9cdd12e394
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/algorithm/signing_algorithm.go
@@ -0,0 +1,33 @@
+// Copyright 2023 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package algorithm
+
+type SigningAlgorithm string
+
+const (
+ HmacSHA256 = "HmacSHA256"
+ HmacSM3 = "HmacSM3"
+ EcdsaP256SHA256 = "EcdsaP256SHA256"
+ SM2SM3 = "SM2SM3"
+)
+
+func GetDefaultSigningAlgorithm() SigningAlgorithm {
+ return HmacSHA256
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/derived_signer.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/derived_signer.go
new file mode 100644
index 0000000000..63a1afe2f9
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/derived_signer.go
@@ -0,0 +1,117 @@
+// Copyright 2020 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package signer
+
+import (
+ "crypto/sha256"
+ "encoding/hex"
+ "errors"
+ "fmt"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request"
+ "golang.org/x/crypto/hkdf"
+ "io"
+ "strings"
+ "time"
+)
+
+const (
+ DerivedDateFormat = "20060102"
+ AlgorithmV11 = "V11-HMAC-SHA256"
+)
+
+type DerivedSigner struct {
+}
+
+// Sign SignRequest set Authorization header
+func (s DerivedSigner) Sign(r *request.DefaultHttpRequest, ak, sk, derivedAuthServiceName, regionId string) (map[string]string, error) {
+ err := checkAKSK(ak, sk)
+ if err != nil {
+ return nil, err
+ }
+ if derivedAuthServiceName == "" {
+ return nil, errors.New("DerivedAuthServiceName is required in credentials when using derived auth")
+ }
+ if regionId == "" {
+ return nil, errors.New("RegionId is required in credentials when using derived auth")
+ }
+
+ originalHeaders := r.GetHeaderParams()
+ t := extractTime(originalHeaders)
+ headerDate := t.UTC().Format(BasicDateFormat)
+ originalHeaders[HeaderXDate] = headerDate
+ additionalHeaders := map[string]string{HeaderXDate: headerDate}
+
+ signedHeaders := extractSignedHeaders(originalHeaders)
+ cr, err := canonicalRequest(r, signedHeaders, xSdkContentSha256, sha256HasherInst)
+ if err != nil {
+ return nil, err
+ }
+ info := t.UTC().Format(DerivedDateFormat) + "/" + regionId + "/" + derivedAuthServiceName
+ sts, err := s.stringToSign(cr, info, t)
+ if err != nil {
+ return nil, err
+ }
+ derivationKey, err := s.getDerivationKey(ak, sk, info)
+ if err != nil {
+ return nil, err
+ }
+ sig, err := s.signStringToSign(sts, []byte(derivationKey))
+ if err != nil {
+ return nil, err
+ }
+ additionalHeaders[HeaderAuthorization] = s.authHeaderValue(sig, ak, info, signedHeaders)
+ return additionalHeaders, nil
+}
+
+// signStringToSign Create the Signature.
+func (s DerivedSigner) signStringToSign(stringToSign string, signingKey []byte) (string, error) {
+ hm, err := sha256HasherInst.hmac([]byte(stringToSign), signingKey)
+ return fmt.Sprintf("%x", hm), err
+}
+
+// authHeaderValue Get the finalized value for the "Authorization" header.
+// The signature parameter is the output from signStringToSign
+func (s DerivedSigner) authHeaderValue(signature, accessKey, info string, signedHeaders []string) string {
+ return fmt.Sprintf("%s Credential=%s/%s, SignedHeaders=%s, Signature=%s",
+ AlgorithmV11,
+ accessKey,
+ info,
+ strings.Join(signedHeaders, ";"),
+ signature)
+}
+
+// getDerivationKey Get the derivation key for derived credential.
+func (s DerivedSigner) getDerivationKey(accessKey, secretKey, info string) (string, error) {
+ hash := sha256.New
+ derivationKeyReader := hkdf.New(hash, []byte(secretKey), []byte(accessKey), []byte(info))
+ derivationKey := make([]byte, 32)
+ _, err := io.ReadFull(derivationKeyReader, derivationKey)
+ return hex.EncodeToString(derivationKey), err
+}
+
+// stringToSign Create a "String to Sign".
+func (s DerivedSigner) stringToSign(canonicalRequest, info string, t time.Time) (string, error) {
+ canonicalRequestHash, err := sha256HasherInst.hashHexString([]byte(canonicalRequest))
+ if err != nil {
+ return "", err
+ }
+
+ return fmt.Sprintf("%s\n%s\n%s\n%s", AlgorithmV11, t.UTC().Format(BasicDateFormat), info, canonicalRequestHash), nil
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/hasher.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/hasher.go
new file mode 100644
index 0000000000..79c3bb190e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/hasher.go
@@ -0,0 +1,89 @@
+// Copyright 2023 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package signer
+
+import (
+ chmac "crypto/hmac"
+ "crypto/sha256"
+ "encoding/hex"
+ "github.com/tjfoc/gmsm/sm3"
+)
+
+type iHasher interface {
+ hash(data []byte) ([]byte, error)
+ hashHexString(data []byte) (string, error)
+ hmac(data []byte, key []byte) ([]byte, error)
+}
+
+type sm3Hasher struct {
+}
+
+func (h sm3Hasher) hash(data []byte) ([]byte, error) {
+ hash := sm3.New()
+ _, err := hash.Write(data)
+ if err != nil {
+ return nil, err
+ }
+ return hash.Sum(nil), nil
+}
+
+func (h sm3Hasher) hashHexString(data []byte) (string, error) {
+ hash, err := h.hash(data)
+ if err != nil {
+ return "", err
+ }
+ return hex.EncodeToString(hash), nil
+}
+
+func (h sm3Hasher) hmac(data []byte, key []byte) ([]byte, error) {
+ hash := chmac.New(sm3.New, key)
+ if _, err := hash.Write(data); err != nil {
+ return nil, err
+ }
+ return hash.Sum(nil), nil
+}
+
+type sha256Hasher struct {
+}
+
+func (h sha256Hasher) hash(data []byte) ([]byte, error) {
+ hash := sha256.New()
+ _, err := hash.Write(data)
+ if err != nil {
+ return nil, err
+ }
+ return hash.Sum(nil), nil
+}
+
+func (h sha256Hasher) hashHexString(data []byte) (string, error) {
+ hash, err := h.hash(data)
+ if err != nil {
+ return "", err
+ }
+ return hex.EncodeToString(hash), nil
+}
+
+func (h sha256Hasher) hmac(data []byte, key []byte) ([]byte, error) {
+ hash := chmac.New(sha256.New, key)
+ if _, err := hash.Write(data); err != nil {
+ return nil, err
+ }
+ return hash.Sum(nil), nil
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/iaksksigner.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/iaksksigner.go
new file mode 100644
index 0000000000..9ed56ead61
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/iaksksigner.go
@@ -0,0 +1,45 @@
+// Copyright 2023 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package signer
+
+import (
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/algorithm"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request"
+)
+
+type IAKSKSigner interface {
+ Sign(req *request.DefaultHttpRequest, ak, sk string) (map[string]string, error)
+}
+
+func GetSigner(alg algorithm.SigningAlgorithm) (IAKSKSigner, error) {
+ switch alg {
+ case algorithm.HmacSHA256:
+ return signerInst, nil
+ case algorithm.HmacSM3:
+ return sm3SignerInst, nil
+ case algorithm.EcdsaP256SHA256:
+ return p256sha256SignerInst, nil
+ case algorithm.SM2SM3:
+ return sm2sm3SignerInst, nil
+ default:
+ return nil, errors.New("unsupported signing algorithm: " + string(alg))
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/init.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/init.go
new file mode 100644
index 0000000000..485dd18352
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/init.go
@@ -0,0 +1,44 @@
+// Copyright 2023 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package signer
+
+var (
+ sha256HasherInst sha256Hasher
+ sm3HasherInst sm3Hasher
+ signerInst Signer
+ derivedSignerInst DerivedSigner
+ sm3SignerInst SM3Signer
+ p256sha256SignerInst P256SHA256Signer
+ sm2sm3SignerInst SM2SM3Signer
+)
+
+func init() {
+ sha256HasherInst = sha256Hasher{}
+ sm3HasherInst = sm3Hasher{}
+ signerInst = Signer{}
+ derivedSignerInst = DerivedSigner{}
+ sm3SignerInst = SM3Signer{}
+ p256sha256SignerInst = P256SHA256Signer{}
+ sm2sm3SignerInst = SM2SM3Signer{}
+}
+
+func GetDerivedSigner() DerivedSigner {
+ return derivedSignerInst
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/p256_sha256_signer.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/p256_sha256_signer.go
new file mode 100644
index 0000000000..304ab4325a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/p256_sha256_signer.go
@@ -0,0 +1,140 @@
+// Copyright 2023 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package signer
+
+import (
+ "bytes"
+ "crypto/ecdsa"
+ "crypto/elliptic"
+ "encoding/hex"
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request"
+ "math/big"
+)
+
+const (
+ sdkEcdsaP256Sha256 = "SDK-ECDSA-P256-SHA256"
+)
+
+var (
+ one = big.NewInt(1)
+ curveP256 = elliptic.P256()
+ p256nMinusTwo = new(big.Int).Sub(new(big.Int).Set(curveP256.Params().N), big.NewInt(2))
+)
+
+type P256SHA256Signer struct {
+}
+
+func (s P256SHA256Signer) Sign(req *request.DefaultHttpRequest, ak, sk string) (map[string]string, error) {
+ err := checkAKSK(ak, sk)
+ if err != nil {
+ return nil, err
+ }
+
+ processContentHeader(req, xSdkContentSha256)
+ originalHeaders := req.GetHeaderParams()
+ t := extractTime(originalHeaders)
+ headerDate := t.UTC().Format(BasicDateFormat)
+ originalHeaders[HeaderXDate] = headerDate
+ additionalHeaders := map[string]string{HeaderXDate: headerDate}
+
+ signedHeaders := extractSignedHeaders(originalHeaders)
+
+ cr, err := canonicalRequest(req, signedHeaders, xSdkContentSha256, sha256HasherInst)
+ if err != nil {
+ return nil, err
+ }
+
+ sts, err := stringToSign(sdkEcdsaP256Sha256, cr, t, sha256HasherInst)
+ if err != nil {
+ return nil, err
+ }
+
+ signingKey, err := s.GetSigningKey(ak, sk)
+ if err != nil {
+ return nil, err
+ }
+
+ sig, err := signStringToSign(sts, signingKey)
+ if err != nil {
+ return nil, err
+ }
+
+ additionalHeaders[HeaderAuthorization] = authHeaderValue(sdkEcdsaP256Sha256, sig, ak, signedHeaders)
+ return additionalHeaders, nil
+}
+
+// GetSigningKey get the derived key based on ak and sk.
+func (s P256SHA256Signer) GetSigningKey(ak, sk string) (ISigningKey, error) {
+ privInt, err := derivePrivateInt(sdkEcdsaP256Sha256, ak, sk, p256nMinusTwo, sha256HasherInst)
+ if err != nil {
+ return nil, err
+ }
+
+ return s.deriveSigningKey(privInt), nil
+}
+
+func (s P256SHA256Signer) deriveSigningKey(priv *big.Int) ISigningKey {
+ privateKey := new(ecdsa.PrivateKey)
+ privateKey.PublicKey.Curve = curveP256
+ privateKey.D = priv
+ privateKey.PublicKey.X, privateKey.PublicKey.Y = curveP256.ScalarBaseMult(priv.Bytes())
+ return P256SigningKey{privateKey: privateKey}
+}
+
+func derivePrivateInt(alg, ak, sk string, nMinusTwo *big.Int, hasher iHasher) (*big.Int, error) {
+ context := bytes.NewBuffer(make([]byte, 0, len(ak)+1))
+ data := bytes.NewBuffer(nil)
+
+ for counter := 0; counter <= 0xff; counter++ {
+ context.Reset()
+ data.Reset()
+
+ context.WriteString(ak)
+ context.WriteByte(byte(counter))
+
+ data.Write([]byte{0x00, 0x00, 0x00, 0x01})
+ data.WriteString(alg)
+ data.WriteByte(0x00)
+ data.Write(context.Bytes())
+ data.Write([]byte{0x00, 0x00, 0x01, 0x00})
+
+ hmacBytes, err := hasher.hmac(data.Bytes(), []byte(sk))
+ if err != nil {
+ return nil, err
+ }
+
+ candidate := new(big.Int).SetBytes(hmacBytes)
+ if candidate.Cmp(nMinusTwo) <= 0 {
+ return candidate.Add(candidate, one), nil
+ }
+ }
+ return nil, errors.New("derive candidate failed, counter out of range")
+}
+
+// signStringToSign Create the Signature.
+func signStringToSign(stringToSign string, signingKey ISigningKey) (string, error) {
+ sig, err := signingKey.Sign([]byte(stringToSign))
+ if err != nil {
+ return "", err
+ }
+
+ return hex.EncodeToString(sig), nil
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/signer.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/signer.go
new file mode 100644
index 0000000000..a665b1252d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/signer.go
@@ -0,0 +1,307 @@
+// HWS API Gateway Signature
+// based on https://github.com/datastream/aws/blob/master/signv4.go
+// Copyright (c) 2014, Xianjie
+// License that can be found in the LICENSE file
+
+package signer
+
+import (
+ "encoding/hex"
+ "errors"
+ "fmt"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request"
+ "net/url"
+ "reflect"
+ "sort"
+ "strings"
+ "time"
+)
+
+const (
+ sdkHmacSha256 = "SDK-HMAC-SHA256"
+ xSdkContentSha256 = "X-Sdk-Content-Sha256"
+)
+
+type Signer struct {
+}
+
+// Sign SignRequest set Authorization header
+func (s Signer) Sign(req *request.DefaultHttpRequest, ak, sk string) (map[string]string, error) {
+ err := checkAKSK(ak, sk)
+ if err != nil {
+ return nil, err
+ }
+
+ processContentHeader(req, xSdkContentSha256)
+ originalHeaders := req.GetHeaderParams()
+ t := extractTime(originalHeaders)
+ headerDate := t.UTC().Format(BasicDateFormat)
+ originalHeaders[HeaderXDate] = headerDate
+ additionalHeaders := map[string]string{HeaderXDate: headerDate}
+
+ signedHeaders := extractSignedHeaders(originalHeaders)
+
+ cr, err := canonicalRequest(req, signedHeaders, xSdkContentSha256, sha256HasherInst)
+ if err != nil {
+ return nil, err
+ }
+
+ sts, err := stringToSign(sdkHmacSha256, cr, t, sha256HasherInst)
+ if err != nil {
+ return nil, err
+ }
+
+ sig, err := s.signStringToSign(sts, []byte(sk))
+ if err != nil {
+ return nil, err
+ }
+
+ additionalHeaders[HeaderAuthorization] = authHeaderValue(sdkHmacSha256, sig, ak, signedHeaders)
+ return additionalHeaders, nil
+}
+
+// signStringToSign Create the Signature.
+func (s Signer) signStringToSign(stringToSign string, signingKey []byte) (string, error) {
+ hmac, err := sha256HasherInst.hmac([]byte(stringToSign), signingKey)
+ if err != nil {
+ return "", err
+ }
+ return hex.EncodeToString(hmac), nil
+}
+
+const (
+ BasicDateFormat = "20060102T150405Z"
+ HeaderXDate = "X-Sdk-Date"
+ HeaderHost = "host"
+ HeaderAuthorization = "Authorization"
+)
+
+func checkAKSK(ak, sk string) error {
+ if ak == "" {
+ return errors.New("ak is required in credentials")
+ }
+ if sk == "" {
+ return errors.New("sk is required in credentials")
+ }
+
+ return nil
+}
+
+// stringToSign Create a "String to Sign".
+func stringToSign(alg, canonicalRequest string, t time.Time, hasher iHasher) (string, error) {
+ canonicalRequestHash, err := hasher.hashHexString([]byte(canonicalRequest))
+ if err != nil {
+ return "", err
+ }
+
+ return fmt.Sprintf("%s\n%s\n%s", alg, t.UTC().Format(BasicDateFormat), canonicalRequestHash), nil
+}
+
+// authHeaderValue Get the finalized value for the "Authorization" header.
+// The signature parameter is the output from stringToSign
+func authHeaderValue(alg, sig, ak string, signedHeaders []string) string {
+ return fmt.Sprintf("%s Access=%s, SignedHeaders=%s, Signature=%s",
+ alg,
+ ak,
+ strings.Join(signedHeaders, ";"),
+ sig)
+}
+
+func processContentHeader(req *request.DefaultHttpRequest, contentHeader string) {
+ if contentType, ok := req.GetHeaderParams()["Content-Type"]; ok && !strings.Contains(contentType, "application/json") {
+ req.AddHeaderParam(contentHeader, "UNSIGNED-PAYLOAD")
+ }
+}
+
+func canonicalRequest(req *request.DefaultHttpRequest, signedHeaders []string, contentHeader string, hasher iHasher) (string, error) {
+ hexEncode, err := getContentHash(req, contentHeader, hasher)
+ if err != nil {
+ return "", err
+ }
+
+ return fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s",
+ req.GetMethod(),
+ canonicalURI(req),
+ canonicalQueryString(req),
+ canonicalHeaders(req, signedHeaders),
+ strings.Join(signedHeaders, ";"), hexEncode), nil
+}
+
+func getContentHash(req *request.DefaultHttpRequest, contentHeader string, hasher iHasher) (string, error) {
+ if content, ok := req.GetHeaderParams()[contentHeader]; ok {
+ return content, nil
+ }
+
+ buffer, err := req.GetBodyToBytes()
+ if err != nil {
+ return "", err
+ }
+
+ data := buffer.Bytes()
+ hexEncode, err := hasher.hashHexString(data)
+ if err != nil {
+ return "", err
+ }
+ return hexEncode, nil
+}
+
+func extractTime(headers map[string]string) time.Time {
+ if date, ok := headers[HeaderXDate]; ok {
+ t, err := time.Parse(BasicDateFormat, date)
+ if date == "" || err != nil {
+ return time.Now()
+ }
+ return t
+ }
+ return time.Now()
+}
+
+// canonicalURI returns request uri
+func canonicalURI(r *request.DefaultHttpRequest) string {
+ pattens := strings.Split(r.GetPath(), "/")
+
+ var uri []string
+ for _, v := range pattens {
+ uri = append(uri, escape(v))
+ }
+
+ urlPath := strings.Join(uri, "/")
+ if len(urlPath) == 0 || urlPath[len(urlPath)-1] != '/' {
+ urlPath = urlPath + "/"
+ }
+
+ return urlPath
+}
+
+func canonicalQueryString(r *request.DefaultHttpRequest) string {
+ var query = make(map[string][]string, 0)
+ for key, value := range r.GetQueryParams() {
+ valueWithType, ok := value.(reflect.Value)
+ if !ok {
+ continue
+ }
+
+ if valueWithType.Kind() == reflect.Slice {
+ params := r.CanonicalSliceQueryParamsToMulti(valueWithType)
+ for _, param := range params {
+ if _, ok := query[key]; !ok {
+ query[key] = make([]string, 0)
+ }
+ query[key] = append(query[key], param)
+ }
+ } else if valueWithType.Kind() == reflect.Map {
+ params := r.CanonicalMapQueryParams(key, valueWithType)
+ for _, param := range params {
+ for k, v := range param {
+ if _, ok := query[k]; !ok {
+ query[k] = make([]string, 0)
+ }
+ query[k] = append(query[k], v)
+ }
+ }
+ } else {
+ if _, ok := query[key]; !ok {
+ query[key] = make([]string, 0)
+ }
+ query[key] = append(query[key], r.CanonicalStringQueryParams(valueWithType))
+ }
+ }
+
+ var keys []string
+ for key := range query {
+ keys = append(keys, key)
+ }
+ sort.Strings(keys)
+
+ var a []string
+ for _, key := range keys {
+ k := escape(key)
+ sort.Strings(query[key])
+ for _, v := range query[key] {
+ kv := fmt.Sprintf("%s=%s", k, escape(v))
+ a = append(a, kv)
+ }
+ }
+ queryStr := strings.Join(a, "&")
+
+ return queryStr
+}
+
+func canonicalHeaders(r *request.DefaultHttpRequest, signerHeaders []string) string {
+ var a []string
+ header := make(map[string][]string)
+ userHeaders := r.GetHeaderParams()
+
+ for k, v := range userHeaders {
+ if _, ok := header[strings.ToLower(k)]; !ok {
+ header[strings.ToLower(k)] = make([]string, 0)
+ }
+ header[strings.ToLower(k)] = append(header[strings.ToLower(k)], v)
+ }
+
+ for _, key := range signerHeaders {
+ value := header[key]
+ if strings.EqualFold(key, HeaderHost) {
+ if u, err := url.Parse(r.GetEndpoint()); err == nil {
+ header[HeaderHost] = []string{u.Host}
+ }
+ }
+
+ sort.Strings(value)
+ for _, v := range value {
+ a = append(a, key+":"+strings.TrimSpace(v))
+ }
+ }
+
+ return fmt.Sprintf("%s\n", strings.Join(a, "\n"))
+}
+
+func extractSignedHeaders(headers map[string]string) []string {
+ var sh []string
+ for key := range headers {
+ if strings.HasPrefix(strings.ToLower(key), "content-type") {
+ continue
+ }
+ sh = append(sh, strings.ToLower(key))
+ }
+ sort.Strings(sh)
+
+ return sh
+}
+
+func shouldEscape(c byte) bool {
+ if 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || '0' <= c && c <= '9' || c == '_' || c == '-' || c == '~' || c == '.' {
+ return false
+ }
+ return true
+}
+
+func escape(s string) string {
+ hexCount := 0
+ for i := 0; i < len(s); i++ {
+ c := s[i]
+ if shouldEscape(c) {
+ hexCount++
+ }
+ }
+
+ if hexCount == 0 {
+ return s
+ }
+
+ t := make([]byte, len(s)+2*hexCount)
+ j := 0
+ for i := 0; i < len(s); i++ {
+ switch c := s[i]; {
+ case shouldEscape(c):
+ t[j] = '%'
+ t[j+1] = "0123456789ABCDEF"[c>>4]
+ t[j+2] = "0123456789ABCDEF"[c&15]
+ j += 3
+ default:
+ t[j] = s[i]
+ j++
+ }
+ }
+ return string(t)
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/signing_key.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/signing_key.go
new file mode 100644
index 0000000000..eea03ee8f2
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/signing_key.go
@@ -0,0 +1,110 @@
+// Copyright 2023 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package signer
+
+import (
+ "crypto/ecdsa"
+ "crypto/rand"
+ "encoding/asn1"
+ "github.com/tjfoc/gmsm/sm2"
+ "math/big"
+)
+
+type ISigningKey interface {
+ Sign(data []byte) ([]byte, error)
+ Verify(signature, data []byte) bool
+}
+
+type ecSignature struct {
+ R *big.Int
+ S *big.Int
+}
+
+type P256SigningKey struct {
+ privateKey *ecdsa.PrivateKey
+}
+
+func (k P256SigningKey) Sign(data []byte) ([]byte, error) {
+ hashed, err := sha256HasherInst.hash(data)
+ if err != nil {
+ return nil, err
+ }
+ r, s, err := ecdsa.Sign(rand.Reader, k.privateKey, hashed)
+ if err != nil {
+ return nil, err
+ }
+
+ ecSig := ecSignature{
+ R: r,
+ S: s,
+ }
+ sig, err := asn1.Marshal(ecSig)
+ if err != nil {
+ return nil, err
+ }
+ return sig, nil
+}
+
+func (k P256SigningKey) Verify(signature, data []byte) bool {
+ ecSig := ecSignature{}
+ _, err := asn1.Unmarshal(signature, &ecSig)
+ if err != nil {
+ return false
+ }
+
+ hashed, err := sha256HasherInst.hash(data)
+ if err != nil {
+ return false
+ }
+
+ publicKey := &k.privateKey.PublicKey
+ return ecdsa.Verify(publicKey, hashed, ecSig.R, ecSig.S)
+}
+
+type SM2SigningKey struct {
+ privateKey *sm2.PrivateKey
+}
+
+func (k SM2SigningKey) Sign(data []byte) ([]byte, error) {
+ r, s, err := sm2.Sm2Sign(k.privateKey, data, []byte{}, rand.Reader)
+ if err != nil {
+ return nil, err
+ }
+
+ ecSig := ecSignature{
+ R: r,
+ S: s,
+ }
+ sig, err := asn1.Marshal(ecSig)
+ if err != nil {
+ return nil, err
+ }
+ return sig, nil
+}
+
+func (k SM2SigningKey) Verify(signature, data []byte) bool {
+ ecSig := ecSignature{}
+ _, err := asn1.Unmarshal(signature, &ecSig)
+ if err != nil {
+ return false
+ }
+
+ return sm2.Sm2Verify(&k.privateKey.PublicKey, data, []byte{}, ecSig.R, ecSig.S)
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/sm2_sm3_signer.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/sm2_sm3_signer.go
new file mode 100644
index 0000000000..9258753489
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/sm2_sm3_signer.go
@@ -0,0 +1,95 @@
+// Copyright 2023 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package signer
+
+import (
+ _ "crypto/ecdsa"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request"
+ "github.com/tjfoc/gmsm/sm2"
+ "math/big"
+)
+
+const (
+ sdkSm2Sm3 = "SDK-SM2-SM3"
+)
+
+var (
+ curveSm2 = sm2.P256Sm2()
+ sm2nMinusTwo = new(big.Int).Sub(new(big.Int).Set(curveSm2.Params().N), big.NewInt(2))
+)
+
+type SM2SM3Signer struct {
+}
+
+func (s SM2SM3Signer) Sign(req *request.DefaultHttpRequest, ak, sk string) (map[string]string, error) {
+ err := checkAKSK(ak, sk)
+ if err != nil {
+ return nil, err
+ }
+
+ processContentHeader(req, xSdkContentSm3)
+ originalHeaders := req.GetHeaderParams()
+ t := extractTime(originalHeaders)
+ headerDate := t.UTC().Format(BasicDateFormat)
+ originalHeaders[HeaderXDate] = headerDate
+ additionalHeaders := map[string]string{HeaderXDate: headerDate}
+
+ signedHeaders := extractSignedHeaders(originalHeaders)
+
+ cr, err := canonicalRequest(req, signedHeaders, xSdkContentSm3, sha256HasherInst)
+ if err != nil {
+ return nil, err
+ }
+
+ sts, err := stringToSign(sdkSm2Sm3, cr, t, sha256HasherInst)
+ if err != nil {
+ return nil, err
+ }
+
+ signingKey, err := s.GetSigningKey(ak, sk)
+ if err != nil {
+ return nil, err
+ }
+
+ sig, err := signStringToSign(sts, signingKey)
+ if err != nil {
+ return nil, err
+ }
+
+ additionalHeaders[HeaderAuthorization] = authHeaderValue(sdkSm2Sm3, sig, ak, signedHeaders)
+ return additionalHeaders, nil
+}
+
+func (s SM2SM3Signer) GetSigningKey(ak, sk string) (ISigningKey, error) {
+ privInt, err := derivePrivateInt(sdkSm2Sm3, ak, sk, sm2nMinusTwo, sm3HasherInst)
+ if err != nil {
+ return nil, err
+ }
+
+ return s.deriveSigningKey(privInt), nil
+}
+
+func (s SM2SM3Signer) deriveSigningKey(priv *big.Int) ISigningKey {
+ privateKey := new(sm2.PrivateKey)
+ privateKey.PublicKey.Curve = curveSm2
+ privateKey.D = priv
+ privateKey.PublicKey.X, privateKey.PublicKey.Y = curveSm2.ScalarBaseMult(priv.Bytes())
+ return SM2SigningKey{privateKey: privateKey}
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/sm3_signer.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/sm3_signer.go
new file mode 100644
index 0000000000..450561aa06
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/sm3_signer.go
@@ -0,0 +1,75 @@
+// Copyright 2023 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package signer
+
+import (
+ "encoding/hex"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request"
+)
+
+const (
+ sdkHmacSm3 = "SDK-HMAC-SM3"
+ xSdkContentSm3 = "X-Sdk-Content-Sm3"
+)
+
+type SM3Signer struct {
+}
+
+func (s SM3Signer) Sign(req *request.DefaultHttpRequest, ak, sk string) (map[string]string, error) {
+ err := checkAKSK(ak, sk)
+ if err != nil {
+ return nil, err
+ }
+
+ processContentHeader(req, xSdkContentSm3)
+ originalHeaders := req.GetHeaderParams()
+ t := extractTime(originalHeaders)
+ headerDate := t.UTC().Format(BasicDateFormat)
+ originalHeaders[HeaderXDate] = headerDate
+ additionalHeaders := map[string]string{HeaderXDate: headerDate}
+
+ signedHeaders := extractSignedHeaders(originalHeaders)
+
+ cr, err := canonicalRequest(req, signedHeaders, xSdkContentSm3, sm3HasherInst)
+ if err != nil {
+ return nil, err
+ }
+
+ sts, err := stringToSign(sdkHmacSm3, cr, t, sm3HasherInst)
+ if err != nil {
+ return nil, err
+ }
+
+ sig, err := s.signStringToSign(sts, []byte(sk))
+ if err != nil {
+ return nil, err
+ }
+
+ additionalHeaders[HeaderAuthorization] = authHeaderValue(sdkHmacSm3, sig, ak, signedHeaders)
+ return additionalHeaders, nil
+}
+
+func (s SM3Signer) signStringToSign(stringToSign string, signingKey []byte) (string, error) {
+ hmac, err := sm3HasherInst.hmac([]byte(stringToSign), signingKey)
+ if err != nil {
+ return "", err
+ }
+ return hex.EncodeToString(hmac), nil
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/config/http_config.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/config/http_config.go
new file mode 100644
index 0000000000..4c3186c81f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/config/http_config.go
@@ -0,0 +1,176 @@
+// Copyright 2020 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package config
+
+import (
+ "context"
+ "fmt"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/algorithm"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/httphandler"
+ "net"
+ "net/http"
+ "time"
+)
+
+const (
+ DefaultTimeout = 120 * time.Second
+ DefaultRetries = 0
+ DefaultIgnoreSSLVerification = false
+ DefaultIgnoreContentTypeForGetRequest = false
+)
+
+type DialContext func(ctx context.Context, network string, addr string) (net.Conn, error)
+
+type HttpConfig struct {
+ DialContext DialContext
+ Timeout time.Duration
+ Retries int
+ HttpProxy *Proxy
+ IgnoreSSLVerification bool
+ // AllowRedirects Experimental configuration, the default value is false.
+ // Automatic redirection is allowed when turns on, which may cause some request exceptions.
+ AllowRedirects bool
+ HttpHandler *httphandler.HttpHandler
+ // HttpTransport This configuration has the highest priority,
+ // which means specifying the HttpTransport will invalidate other configurations,
+ // such as DialContext, HttpProxy, IgnoreSSLVerification.
+ HttpTransport *http.Transport
+ // IgnoreContentTypeForGetRequest Ignore the request header Content-Type when sending a GET request,
+ // the default value is false
+ IgnoreContentTypeForGetRequest bool
+ SigningAlgorithm algorithm.SigningAlgorithm
+}
+
+func DefaultHttpConfig() *HttpConfig {
+ return &HttpConfig{
+ Timeout: DefaultTimeout,
+ Retries: DefaultRetries,
+ IgnoreSSLVerification: DefaultIgnoreSSLVerification,
+ IgnoreContentTypeForGetRequest: DefaultIgnoreContentTypeForGetRequest,
+ SigningAlgorithm: algorithm.GetDefaultSigningAlgorithm(),
+ }
+}
+
+func (config *HttpConfig) WithSigningAlgorithm(signingAlgorithm algorithm.SigningAlgorithm) *HttpConfig {
+ config.SigningAlgorithm = signingAlgorithm
+ return config
+}
+
+func (config *HttpConfig) WithDialContext(dial DialContext) *HttpConfig {
+ config.DialContext = dial
+ return config
+}
+
+func (config *HttpConfig) WithTimeout(timeout time.Duration) *HttpConfig {
+ config.Timeout = timeout
+ return config
+}
+
+func (config *HttpConfig) WithRetries(retries int) *HttpConfig {
+ config.Retries = retries
+ return config
+}
+
+func (config *HttpConfig) WithIgnoreSSLVerification(ignore bool) *HttpConfig {
+ config.IgnoreSSLVerification = ignore
+ return config
+}
+
+// WithAllowRedirects Experimental configuration, the default value is false.
+// Automatic redirection is allowed when turns on, which may cause some request exceptions.
+func (config *HttpConfig) WithAllowRedirects(allowRedirects bool) *HttpConfig {
+ config.AllowRedirects = allowRedirects
+ return config
+}
+
+func (config *HttpConfig) WithHttpHandler(handler *httphandler.HttpHandler) *HttpConfig {
+ config.HttpHandler = handler
+ return config
+}
+
+// WithHttpTransport This configuration has the highest priority,
+// which means specifying the HttpTransport will invalidate other configurations,
+// such as DialContext, HttpProxy, IgnoreSSLVerification.
+func (config *HttpConfig) WithHttpTransport(transport *http.Transport) *HttpConfig {
+ config.HttpTransport = transport
+ return config
+}
+
+func (config *HttpConfig) WithProxy(proxy *Proxy) *HttpConfig {
+ config.HttpProxy = proxy
+ return config
+}
+
+// WithIgnoreContentTypeForGetRequest Ignore the request header Content-Type when sending a GET request,
+// the default value is false
+func (config *HttpConfig) WithIgnoreContentTypeForGetRequest(ignoreContentTypeForGetRequest bool) *HttpConfig {
+ config.IgnoreContentTypeForGetRequest = ignoreContentTypeForGetRequest
+ return config
+}
+
+type Proxy struct {
+ Schema string
+ Host string
+ Port int
+ Username string
+ Password string
+}
+
+func NewProxy() *Proxy {
+ return &Proxy{}
+}
+
+func (p *Proxy) WithSchema(schema string) *Proxy {
+ p.Schema = schema
+ return p
+}
+
+func (p *Proxy) WithHost(host string) *Proxy {
+ p.Host = host
+ return p
+}
+
+func (p *Proxy) WithPort(port int) *Proxy {
+ p.Port = port
+ return p
+}
+
+func (p *Proxy) WithUsername(name string) *Proxy {
+ p.Username = name
+ return p
+}
+
+func (p *Proxy) WithPassword(pwd string) *Proxy {
+ p.Password = pwd
+ return p
+}
+
+func (p *Proxy) GetProxyUrl() string {
+ var proxyUrl string
+ if p.Username != "" {
+ proxyUrl = fmt.Sprintf("%s://%s:%s@%s", p.Schema, p.Username, p.Password, p.Host)
+ } else {
+ proxyUrl = fmt.Sprintf("%s://%s", p.Schema, p.Host)
+ }
+ if p.Port != 0 {
+ proxyUrl = fmt.Sprintf("%s:%d", proxyUrl, p.Port)
+ }
+ return proxyUrl
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter/converters.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter/converters.go
new file mode 100644
index 0000000000..96c0a8361c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter/converters.go
@@ -0,0 +1,77 @@
+package converter
+
+import (
+ "reflect"
+ "strconv"
+ "strings"
+
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+)
+
+type Converter interface {
+ CovertStringToInterface(value string) (interface{}, error)
+ CovertStringToPrimitiveTypeAndSetField(field reflect.Value, value string, isPtr bool) error
+}
+
+func StringConverterFactory(vType string) Converter {
+ switch vType {
+ case "string":
+ return StringConverter{}
+ case "int32":
+ return Int32Converter{}
+ case "int64":
+ return Int64Converter{}
+ case "float32":
+ return Float32Converter{}
+ case "float64":
+ return Float32Converter{}
+ case "bool":
+ return BooleanConverter{}
+ default:
+ return nil
+ }
+}
+
+func ConvertInterfaceToString(value interface{}) string {
+ if value == nil {
+ return ""
+ }
+ switch value.(type) {
+ case float64:
+ return strconv.FormatFloat(value.(float64), 'f', -1, 64)
+ case float32:
+ return strconv.FormatFloat(float64(value.(float32)), 'f', -1, 64)
+ case int:
+ return strconv.Itoa(value.(int))
+ case uint:
+ return strconv.Itoa(int(value.(uint)))
+ case int8:
+ return strconv.Itoa(int(value.(int8)))
+ case uint8:
+ return strconv.Itoa(int(value.(uint8)))
+ case int16:
+ return strconv.Itoa(int(value.(int16)))
+ case uint16:
+ return strconv.Itoa(int(value.(uint16)))
+ case int32:
+ return strconv.Itoa(int(value.(int32)))
+ case uint32:
+ return strconv.Itoa(int(value.(uint32)))
+ case int64:
+ return strconv.FormatInt(value.(int64), 10)
+ case uint64:
+ return strconv.FormatUint(value.(uint64), 10)
+ case bool:
+ return strconv.FormatBool(value.(bool))
+ case string:
+ return value.(string)
+ case []byte:
+ return string(value.([]byte))
+ default:
+ b, err := utils.Marshal(value)
+ if err != nil {
+ return ""
+ }
+ return strings.Trim(string(b[:]), "\"")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter/types.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter/types.go
new file mode 100644
index 0000000000..8ae2590303
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter/types.go
@@ -0,0 +1,165 @@
+package converter
+
+import (
+ "errors"
+ "fmt"
+ "reflect"
+ "strconv"
+)
+
+type Int32Converter struct{}
+
+func (i Int32Converter) CovertStringToInterface(value string) (interface{}, error) {
+ i64, err := strconv.ParseInt(value, 10, 32)
+ if err == nil {
+ return int32(i64), nil
+ }
+ return int32(0), err
+}
+
+func (i Int32Converter) CovertStringToPrimitiveTypeAndSetField(field reflect.Value, value string, isPtr bool) error {
+ v, err := i.CovertStringToInterface(value)
+ if err != nil {
+ return err
+ }
+ val, ok := v.(int32)
+ if !ok {
+ return errors.New(fmt.Sprintf("failed to convert string (%s) to int32", value))
+ }
+
+ if isPtr {
+ field.Set(reflect.ValueOf(&val))
+ } else {
+ field.Set(reflect.ValueOf(val))
+ }
+ return nil
+}
+
+type Int64Converter struct{}
+
+func (i Int64Converter) CovertStringToInterface(value string) (interface{}, error) {
+ i64, err := strconv.ParseInt(value, 10, 64)
+ if err == nil {
+ return i64, nil
+ }
+ return int64(0), err
+}
+
+func (i Int64Converter) CovertStringToPrimitiveTypeAndSetField(field reflect.Value, value string, isPtr bool) error {
+ v, err := i.CovertStringToInterface(value)
+ if err != nil {
+ return err
+ }
+ val, ok := v.(int64)
+ if !ok {
+ return errors.New(fmt.Sprintf("failed to convert string (%s) to int64", value))
+ }
+
+ if isPtr {
+ field.Set(reflect.ValueOf(&val))
+ } else {
+ field.Set(reflect.ValueOf(val))
+ }
+ return nil
+}
+
+type Float32Converter struct{}
+
+func (i Float32Converter) CovertStringToInterface(value string) (interface{}, error) {
+ f64, err := strconv.ParseFloat(value, 32)
+ if err == nil {
+ return float32(f64), nil
+ }
+ return float32(0), err
+}
+
+func (i Float32Converter) CovertStringToPrimitiveTypeAndSetField(field reflect.Value, value string, isPtr bool) error {
+ v, err := i.CovertStringToInterface(value)
+ if err != nil {
+ return err
+ }
+ val, ok := v.(float32)
+ if !ok {
+ return errors.New(fmt.Sprintf("failed to convert string (%s) to float32", value))
+ }
+
+ if isPtr {
+ field.Set(reflect.ValueOf(&val))
+ } else {
+ field.Set(reflect.ValueOf(val))
+ }
+ return nil
+}
+
+type Float64Converter struct{}
+
+func (i Float64Converter) CovertStringToInterface(value string) (interface{}, error) {
+ f64, err := strconv.ParseFloat(value, 32)
+ if err == nil {
+ return f64, nil
+ }
+ return float64(0), err
+}
+
+func (i Float64Converter) CovertStringToPrimitiveTypeAndSetField(field reflect.Value, value string, isPtr bool) error {
+ v, err := i.CovertStringToInterface(value)
+ if err != nil {
+ return err
+ }
+ val, ok := v.(float64)
+ if !ok {
+ return errors.New(fmt.Sprintf("failed to convert string (%s) to float64", value))
+ }
+
+ if isPtr {
+ field.Set(reflect.ValueOf(&val))
+ } else {
+ field.Set(reflect.ValueOf(val))
+ }
+ return nil
+}
+
+type BooleanConverter struct{}
+
+func (i BooleanConverter) CovertStringToInterface(value string) (interface{}, error) {
+ boolean, err := strconv.ParseBool(value)
+ if err == nil {
+ return boolean, nil
+ }
+ return false, err
+}
+
+func (i BooleanConverter) CovertStringToPrimitiveTypeAndSetField(field reflect.Value, value string, isPtr bool) error {
+ v, err := i.CovertStringToInterface(value)
+ if err != nil {
+ return err
+ }
+
+ val, ok := v.(bool)
+ if !ok {
+ return errors.New(fmt.Sprintf("failed to convert string (%s) to bool", value))
+ }
+
+ if isPtr {
+ field.Set(reflect.ValueOf(&val))
+ } else {
+ field.Set(reflect.ValueOf(val))
+ }
+ return nil
+}
+
+type StringConverter struct{}
+
+func (i StringConverter) CovertStringToInterface(value string) (interface{}, error) {
+ return value, nil
+}
+
+func (i StringConverter) CovertStringToPrimitiveTypeAndSetField(field reflect.Value, value string, isPtr bool) error {
+ val := value
+ if isPtr {
+ field.Set(reflect.ValueOf(&val))
+ } else {
+ field.Set(reflect.ValueOf(val))
+ }
+ return nil
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/def/field.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/def/field.go
new file mode 100644
index 0000000000..69ea7cd9d2
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/def/field.go
@@ -0,0 +1,62 @@
+// Copyright 2020 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package def
+
+type LocationType int32
+
+const (
+ Header LocationType = 1 << iota
+ Path
+ Query
+ Body
+ Form
+ Cname
+)
+
+type FieldDef struct {
+ LocationType LocationType
+ Name string
+ JsonTag string
+ KindName string
+}
+
+func NewFieldDef() *FieldDef {
+ return &FieldDef{}
+}
+
+func (field *FieldDef) WithLocationType(locationType LocationType) *FieldDef {
+ field.LocationType = locationType
+ return field
+}
+
+func (field *FieldDef) WithName(name string) *FieldDef {
+ field.Name = name
+ return field
+}
+
+func (field *FieldDef) WithJsonTag(tag string) *FieldDef {
+ field.JsonTag = tag
+ return field
+}
+
+func (field *FieldDef) WithKindName(kindName string) *FieldDef {
+ field.KindName = kindName
+ return field
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/def/http_request_def.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/def/http_request_def.go
new file mode 100644
index 0000000000..de853c683d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/def/http_request_def.go
@@ -0,0 +1,78 @@
+// Copyright 2020 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package def
+
+type HttpRequestDef struct {
+ Method string
+ Path string
+ ContentType string
+ RequestFields []*FieldDef
+ ResponseFields []*FieldDef
+ Response interface{}
+}
+
+type HttpRequestDefBuilder struct {
+ httpRequestDef *HttpRequestDef
+}
+
+func NewHttpRequestDefBuilder() *HttpRequestDefBuilder {
+ httpRequestDef := &HttpRequestDef{
+ RequestFields: []*FieldDef{},
+ ResponseFields: []*FieldDef{},
+ }
+ HttpRequestDefBuilder := &HttpRequestDefBuilder{
+ httpRequestDef: httpRequestDef,
+ }
+ return HttpRequestDefBuilder
+}
+
+func (builder *HttpRequestDefBuilder) WithPath(path string) *HttpRequestDefBuilder {
+ builder.httpRequestDef.Path = path
+ return builder
+}
+
+func (builder *HttpRequestDefBuilder) WithMethod(method string) *HttpRequestDefBuilder {
+ builder.httpRequestDef.Method = method
+ return builder
+}
+
+func (builder *HttpRequestDefBuilder) WithContentType(contentType string) *HttpRequestDefBuilder {
+ builder.httpRequestDef.ContentType = contentType
+ return builder
+}
+
+func (builder *HttpRequestDefBuilder) WithResponse(response interface{}) *HttpRequestDefBuilder {
+ builder.httpRequestDef.Response = response
+ return builder
+}
+
+func (builder *HttpRequestDefBuilder) WithRequestField(field *FieldDef) *HttpRequestDefBuilder {
+ builder.httpRequestDef.RequestFields = append(builder.httpRequestDef.RequestFields, field)
+ return builder
+}
+
+func (builder *HttpRequestDefBuilder) WithResponseField(field *FieldDef) *HttpRequestDefBuilder {
+ builder.httpRequestDef.ResponseFields = append(builder.httpRequestDef.ResponseFields, field)
+ return builder
+}
+
+func (builder *HttpRequestDefBuilder) Build() *HttpRequestDef {
+ return builder.httpRequestDef
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/def/multipart.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/def/multipart.go
new file mode 100644
index 0000000000..289901cd39
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/def/multipart.go
@@ -0,0 +1,108 @@
+// Copyright 2020 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package def
+
+import (
+ "errors"
+ "fmt"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+ "io"
+ "mime/multipart"
+ "net/textproto"
+ "os"
+ "path/filepath"
+ "strings"
+)
+
+var quoteEscape = strings.NewReplacer("\\", "\\\\", `"`, "\\\"")
+
+func escapeQuotes(s string) string {
+ return quoteEscape.Replace(s)
+}
+
+type FilePart struct {
+ Headers textproto.MIMEHeader
+ Content *os.File
+}
+
+func NewFilePart(content *os.File) *FilePart {
+ return &FilePart{
+ Content: content,
+ }
+}
+
+func NewFilePartWithContentType(content *os.File, contentType string) *FilePart {
+ var headers = make(textproto.MIMEHeader)
+ headers.Set("Content-Type", contentType)
+
+ return &FilePart{
+ Headers: headers,
+ Content: content,
+ }
+}
+
+func (f FilePart) Write(w *multipart.Writer, name string) error {
+ var h textproto.MIMEHeader
+ if f.Headers != nil {
+ h = f.Headers
+ } else {
+ h = make(textproto.MIMEHeader)
+ }
+
+ filename := filepath.Base(f.Content.Name())
+ if filename == "" {
+ return errors.New("failed to obtain filename from: " + f.Content.Name())
+ }
+
+ h.Set("Content-Disposition",
+ fmt.Sprintf(`form-data; name="%s"; filename="%s"`,
+ escapeQuotes(name), escapeQuotes(filename)))
+
+ if f.Headers.Get("Content-Type") == "" {
+ h.Set("Content-Type", "application/octet-stream")
+ }
+
+ writer, err := w.CreatePart(h)
+ if err != nil {
+ return err
+ }
+
+ _, err = io.Copy(writer, f.Content)
+ return err
+}
+
+type MultiPart struct {
+ Content interface{}
+}
+
+func NewMultiPart(content interface{}) *MultiPart {
+ return &MultiPart{
+ Content: content,
+ }
+}
+
+func (m MultiPart) Write(w *multipart.Writer, name string) error {
+ err := w.WriteField(name, converter.ConvertInterfaceToString(m.Content))
+ return err
+}
+
+type FormData interface {
+ Write(*multipart.Writer, string) error
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/exchange/exchange.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/exchange/exchange.go
new file mode 100644
index 0000000000..aaebcdb046
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/exchange/exchange.go
@@ -0,0 +1,25 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package exchange
+
+type SdkExchange struct {
+ ApiReference *ApiReference
+ Attributes map[string]interface{}
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/exchange/reference.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/exchange/reference.go
new file mode 100644
index 0000000000..d3c0c9a2ff
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/exchange/reference.go
@@ -0,0 +1,35 @@
+// Copyright 2020 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package exchange
+
+import "time"
+
+type ApiReference struct {
+ Host string
+ Method string
+ Path string
+ Raw string
+ UserAgent string
+ StartedTime time.Time
+ DurationMs time.Duration
+ RequestId string
+ StatusCode int
+ ContentLength int64
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/hc_http_client.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/hc_http_client.go
new file mode 100644
index 0000000000..e352c4af86
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/hc_http_client.go
@@ -0,0 +1,522 @@
+// Copyright 2020 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package core
+
+import (
+ "bytes"
+ "encoding/json"
+ "encoding/xml"
+ "errors"
+ "fmt"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/def"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/exchange"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/impl"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/progress"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/response"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdkerr"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+ "go.mongodb.org/mongo-driver/bson"
+ "io/ioutil"
+ "net"
+ "net/url"
+ "reflect"
+ "strings"
+ "sync/atomic"
+)
+
+const (
+ userAgent = "User-Agent"
+ xRequestId = "X-Request-Id"
+ contentType = "Content-Type"
+ applicationXml = "application/xml"
+ applicationBson = "application/bson"
+)
+
+type HcHttpClient struct {
+ endpoints []string
+ endpointIndex int32
+ credential auth.ICredential
+ extraHeader map[string]string
+ httpClient *impl.DefaultHttpClient
+ errorHandler sdkerr.ErrorHandler
+}
+
+func NewHcHttpClient(httpClient *impl.DefaultHttpClient) *HcHttpClient {
+ return &HcHttpClient{httpClient: httpClient}
+}
+
+func (hc *HcHttpClient) WithEndpoints(endpoints []string) *HcHttpClient {
+ hc.endpoints = endpoints
+ return hc
+}
+
+func (hc *HcHttpClient) WithCredential(credential auth.ICredential) *HcHttpClient {
+ hc.credential = credential
+ return hc
+}
+
+func (hc *HcHttpClient) WithErrorHandler(errorHandler sdkerr.ErrorHandler) *HcHttpClient {
+ hc.errorHandler = errorHandler
+ return hc
+}
+
+func (hc *HcHttpClient) GetCredential() auth.ICredential {
+ return hc.credential
+}
+
+func (hc *HcHttpClient) PreInvoke(headers map[string]string) *HcHttpClient {
+ hc.extraHeader = headers
+ return hc
+}
+
+func (hc *HcHttpClient) Sync(req interface{}, reqDef *def.HttpRequestDef) (interface{}, error) {
+ exg := &exchange.SdkExchange{
+ ApiReference: &exchange.ApiReference{},
+ Attributes: make(map[string]interface{}),
+ }
+ return hc.SyncInvoke(req, reqDef, exg)
+}
+
+func (hc *HcHttpClient) SyncInvoke(req interface{}, reqDef *def.HttpRequestDef,
+ exchange *exchange.SdkExchange) (interface{}, error) {
+ var (
+ httpRequest *request.DefaultHttpRequest
+ resp *response.DefaultHttpResponse
+ err error
+ )
+
+ for {
+ httpRequest, err = hc.buildRequest(req, reqDef)
+ if err != nil {
+ return nil, err
+ }
+
+ resp, err = hc.httpClient.SyncInvokeHttpWithExchange(httpRequest, exchange)
+ if err == nil {
+ break
+ }
+
+ if isNoSuchHostErr(err) && atomic.LoadInt32(&hc.endpointIndex) < int32(len(hc.endpoints)-1) {
+ atomic.AddInt32(&hc.endpointIndex, 1)
+ } else {
+ return nil, err
+ }
+ }
+
+ return hc.extractResponse(httpRequest, resp, reqDef)
+}
+
+func (hc *HcHttpClient) extractEndpoint(req interface{}, reqDef *def.HttpRequestDef, attrMaps map[string]string) (string, error) {
+ var endpoint string
+ for _, v := range reqDef.RequestFields {
+ if v.LocationType == def.Cname {
+ u, err := url.Parse(hc.endpoints[atomic.LoadInt32(&hc.endpointIndex)])
+ if err != nil {
+ return "", err
+ }
+ value, err := hc.getFieldValueByName(v.Name, attrMaps, req)
+ if err != nil {
+ return "", err
+ }
+ endpoint = fmt.Sprintf("%s://%s.%s", u.Scheme, value, u.Host)
+ }
+ }
+
+ if endpoint == "" {
+ endpoint = hc.endpoints[hc.endpointIndex]
+ }
+
+ return endpoint, nil
+}
+
+func (hc *HcHttpClient) buildRequest(req interface{}, reqDef *def.HttpRequestDef) (*request.DefaultHttpRequest, error) {
+ t := reflect.TypeOf(req)
+ if t.Kind() == reflect.Ptr {
+ t = t.Elem()
+ }
+ attrMaps := hc.getFieldJsonTags(t)
+
+ endpoint, err := hc.extractEndpoint(req, reqDef, attrMaps)
+ if err != nil {
+ return nil, err
+ }
+
+ builder := request.NewHttpRequestBuilder().WithEndpoint(endpoint).WithMethod(reqDef.Method).WithPath(reqDef.Path).
+ WithSigningAlgorithm(hc.httpClient.GetHttpConfig().SigningAlgorithm)
+
+ if pq, ok := req.(progress.Request); ok {
+ builder.WithProgressListener(pq.GetProgressListener()).WithProgressInterval(pq.GetProgressInterval())
+ }
+
+ uaValue := "huaweicloud-usdk-go/3.0"
+ for k, v := range hc.extraHeader {
+ if strings.ToLower(k) == strings.ToLower(userAgent) {
+ uaValue = uaValue + ";" + v
+ } else {
+ builder.AddHeaderParam(k, v)
+ }
+ }
+ builder.AddHeaderParam(userAgent, uaValue)
+
+ builder, err = hc.fillParamsFromReq(req, t, reqDef, attrMaps, builder)
+ if err != nil {
+ return nil, err
+ }
+
+ var httpRequest = builder.Build()
+
+ currentHeaderParams := httpRequest.GetHeaderParams()
+ if _, ok := currentHeaderParams["Authorization"]; !ok {
+ httpRequest, err = hc.credential.ProcessAuthRequest(hc.httpClient, httpRequest)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ return httpRequest, err
+}
+
+func (hc *HcHttpClient) fillParamsFromReq(req interface{}, t reflect.Type, reqDef *def.HttpRequestDef,
+ attrMaps map[string]string, builder *request.HttpRequestBuilder) (*request.HttpRequestBuilder, error) {
+ hasBody := false
+ for _, fieldDef := range reqDef.RequestFields {
+ value, err := hc.getFieldValueByName(fieldDef.Name, attrMaps, req)
+ if err != nil {
+ return nil, err
+ }
+
+ if !value.IsValid() {
+ continue
+ }
+
+ v, err := flattenEnumStruct(value)
+ if err != nil {
+ return nil, err
+ }
+
+ switch fieldDef.LocationType {
+ case def.Header:
+ builder.AddHeaderParam(fieldDef.JsonTag, fmt.Sprintf("%v", v))
+ case def.Path:
+ builder.AddPathParam(fieldDef.JsonTag, fmt.Sprintf("%v", v))
+ case def.Query:
+ builder.AddQueryParam(fieldDef.JsonTag, v)
+ case def.Body:
+ if body, ok := t.FieldByName("Body"); ok {
+ builder.WithBody(body.Tag.Get("type"), value.Interface())
+ } else {
+ builder.WithBody("", value.Interface())
+ }
+ hasBody = true
+ case def.Form:
+ builder.AddFormParam(fieldDef.JsonTag, value.Interface().(def.FormData))
+ }
+ }
+
+ if reqDef.ContentType != "" && !(hc.httpClient.GetHttpConfig().IgnoreContentTypeForGetRequest && reqDef.Method == "GET" && !hasBody) {
+ builder.AddHeaderParam(contentType, reqDef.ContentType)
+ }
+
+ return builder, nil
+}
+
+func (hc *HcHttpClient) getFieldJsonTags(t reflect.Type) map[string]string {
+ attrMaps := make(map[string]string)
+
+ fieldNum := t.NumField()
+ for i := 0; i < fieldNum; i++ {
+ jsonTag := t.Field(i).Tag.Get("json")
+ if jsonTag != "" {
+ attrMaps[t.Field(i).Name] = jsonTag
+ }
+ }
+
+ return attrMaps
+}
+
+func (hc *HcHttpClient) getFieldValueByName(name string, jsonTag map[string]string,
+ structName interface{}) (reflect.Value, error) {
+ v := reflect.ValueOf(structName)
+ if v.Kind() == reflect.Ptr {
+ v = v.Elem()
+ }
+
+ value := v.FieldByName(name)
+ if value.Kind() == reflect.Ptr {
+ if value.IsNil() {
+ if strings.Contains(jsonTag[name], "omitempty") {
+ return reflect.ValueOf(nil), nil
+ }
+ return reflect.ValueOf(nil), errors.New("request field " + name + " read null value")
+ }
+ return value.Elem(), nil
+ }
+
+ return value, nil
+}
+
+func flattenEnumStruct(value reflect.Value) (reflect.Value, error) {
+ if value.Kind() == reflect.Struct {
+ if method := value.MethodByName("Value"); method.IsValid() {
+ return method.Call(nil)[0], nil
+ }
+
+ v, e := utils.Marshal(value.Interface())
+ if e == nil {
+ str := string(v)
+ if strings.HasSuffix(str, "\n") {
+ str = strings.Trim(str, "\n")
+ }
+ if strings.HasPrefix(str, "\"") {
+ str = strings.Trim(str, "\"")
+ }
+ return reflect.ValueOf(str), nil
+ }
+ return reflect.ValueOf(nil), e
+ }
+ return value, nil
+}
+
+func (hc *HcHttpClient) extractResponse(req *request.DefaultHttpRequest, resp *response.DefaultHttpResponse, reqDef *def.HttpRequestDef) (interface{},
+ error) {
+ if hc.errorHandler == nil {
+ hc.errorHandler = sdkerr.DefaultErrorHandler{}
+ }
+ err := hc.errorHandler.HandleError(req, resp)
+ if err != nil {
+ return nil, err
+ }
+
+ if err = hc.deserializeResponse(resp, reqDef); err != nil {
+ return nil, err
+ }
+
+ return reqDef.Response, nil
+}
+
+func (hc *HcHttpClient) deserializeResponse(resp *response.DefaultHttpResponse, reqDef *def.HttpRequestDef) error {
+ t := reflect.TypeOf(reqDef.Response)
+ if t.Kind() == reflect.Ptr {
+ t = t.Elem()
+ }
+
+ v := reflect.ValueOf(reqDef.Response)
+ if v.Kind() == reflect.Ptr {
+ v = v.Elem()
+ }
+
+ addStatusCode := func() {
+ field := v.FieldByName("HttpStatusCode")
+ field.Set(reflect.ValueOf(resp.GetStatusCode()))
+ }
+
+ if body, ok := t.FieldByName("Body"); ok && body.Type.Name() == "ReadCloser" {
+ v.FieldByName("Body").Set(reflect.ValueOf(resp.Response.Body))
+ addStatusCode()
+ return nil
+ }
+
+ err := hc.deserializeResponseFields(resp, reqDef)
+ if err != nil {
+ return err
+ }
+
+ addStatusCode()
+ return nil
+}
+
+func (hc *HcHttpClient) deserializeResponseFields(resp *response.DefaultHttpResponse, reqDef *def.HttpRequestDef) error {
+ data, err := ioutil.ReadAll(resp.Response.Body)
+ if err != nil {
+ if closeErr := resp.Response.Body.Close(); closeErr != nil {
+ return err
+ }
+ return err
+ }
+ if err = resp.Response.Body.Close(); err != nil {
+ return err
+ } else {
+ resp.Response.Body = ioutil.NopCloser(bytes.NewBuffer(data))
+ }
+
+ processError := func(err error) error {
+ return &sdkerr.ServiceResponseError{
+ StatusCode: resp.GetStatusCode(),
+ RequestId: resp.GetHeader(xRequestId),
+ ErrorMessage: err.Error(),
+ }
+ }
+
+ hasBody := false
+ for _, item := range reqDef.ResponseFields {
+ if item.LocationType == def.Header {
+ headerErr := hc.deserializeResponseHeaders(resp, reqDef, item)
+ if headerErr != nil {
+ return processError(headerErr)
+ }
+ }
+
+ if item.LocationType == def.Body {
+ hasBody = true
+
+ bodyErr := hc.deserializeResponseBody(reqDef, data)
+ if bodyErr != nil {
+ return processError(bodyErr)
+ }
+ }
+ }
+
+ if len(data) != 0 && !hasBody {
+ if strings.Contains(resp.Response.Header.Get(contentType), applicationXml) {
+ err = xml.Unmarshal(data, &reqDef.Response)
+ } else if strings.Contains(resp.Response.Header.Get(contentType), applicationBson) {
+ err = bson.Unmarshal(data, reqDef.Response)
+ } else {
+ err = utils.Unmarshal(data, &reqDef.Response)
+ }
+
+ if err != nil {
+ return processError(err)
+ }
+ }
+
+ return nil
+}
+
+func (hc *HcHttpClient) deserializeResponseBody(reqDef *def.HttpRequestDef, data []byte) error {
+ dataStr := string(data)
+
+ v := reflect.ValueOf(reqDef.Response)
+ if v.Kind() == reflect.Ptr {
+ v = v.Elem()
+ }
+
+ t := reflect.TypeOf(reqDef.Response)
+ if t.Kind() == reflect.Ptr {
+ t = t.Elem()
+ }
+
+ if body, ok := t.FieldByName("Body"); ok {
+ if body.Type.Kind() == reflect.Ptr && body.Type.Elem().Kind() == reflect.String {
+ v.FieldByName("Body").Set(reflect.ValueOf(&dataStr))
+ } else if body.Type.Kind() == reflect.String {
+ v.FieldByName("Body").Set(reflect.ValueOf(dataStr))
+ } else {
+ var bodyIns interface{}
+ if body.Type.Kind() == reflect.Ptr {
+ bodyIns = reflect.New(body.Type.Elem()).Interface()
+ } else {
+ bodyIns = reflect.New(body.Type).Interface()
+ }
+ var err error
+ if reqDef.ContentType == applicationBson {
+ err = bson.Unmarshal(data, bodyIns)
+ } else {
+ err = json.Unmarshal(data, bodyIns)
+ }
+ if err != nil {
+ return err
+ }
+
+ if body.Type.Kind() == reflect.Ptr {
+ v.FieldByName("Body").Set(reflect.ValueOf(bodyIns))
+ } else {
+ v.FieldByName("Body").Set(reflect.ValueOf(bodyIns).Elem())
+ }
+ }
+ }
+
+ return nil
+}
+
+func (hc *HcHttpClient) deserializeResponseHeaders(resp *response.DefaultHttpResponse, reqDef *def.HttpRequestDef,
+ item *def.FieldDef) error {
+ isPtr, fieldKind := hc.getFieldInfo(reqDef, item)
+ v := reflect.ValueOf(reqDef.Response)
+ if v.Kind() == reflect.Ptr {
+ v = v.Elem()
+ }
+
+ fieldValue := v.FieldByName(item.Name)
+ headerValue := resp.GetHeader(item.JsonTag)
+ if headerValue == "" {
+ return nil
+ }
+
+ sdkConverter := converter.StringConverterFactory(fieldKind)
+ if sdkConverter == nil {
+ return fmt.Errorf("failed to convert %s", item.JsonTag)
+ }
+
+ if err := sdkConverter.CovertStringToPrimitiveTypeAndSetField(fieldValue, headerValue, isPtr); err != nil {
+
+ return err
+ }
+
+ return nil
+}
+
+func (hc *HcHttpClient) getFieldInfo(reqDef *def.HttpRequestDef, item *def.FieldDef) (bool, string) {
+
+ var isPtr = false
+ var fieldKind string
+
+ t := reflect.TypeOf(reqDef.Response)
+ if t.Kind() == reflect.Ptr {
+ isPtr = true
+ t = t.Elem()
+ }
+
+ field, _ := t.FieldByName(item.Name)
+ if field.Type.Kind() == reflect.Ptr {
+ fieldKind = field.Type.Elem().Kind().String()
+ } else {
+ fieldKind = field.Type.Kind().String()
+ }
+
+ return isPtr, fieldKind
+}
+
+func isNoSuchHostErr(err error) bool {
+ if err == nil {
+ return false
+ }
+ var errInterface interface{} = err
+ if innerErr, ok := errInterface.(*url.Error); !ok {
+ return false
+ } else {
+ errInterface = innerErr.Err
+ }
+
+ if innerErr, ok := errInterface.(*net.OpError); !ok {
+ return false
+ } else {
+ errInterface = innerErr.Err
+ }
+
+ if innerErr, ok := errInterface.(*net.DNSError); !ok {
+ return false
+ } else {
+ return innerErr.Err == "no such host"
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/hc_http_client_builder.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/hc_http_client_builder.go
new file mode 100644
index 0000000000..58739a9f6c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/hc_http_client_builder.go
@@ -0,0 +1,144 @@
+// Copyright 2020 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package core
+
+import (
+ "fmt"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/provider"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/config"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/impl"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/region"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdkerr"
+ "reflect"
+ "strings"
+)
+
+type HcHttpClientBuilder struct {
+ CredentialsType []string
+ derivedAuthServiceName string
+ credentials auth.ICredential
+ endpoints []string
+ httpConfig *config.HttpConfig
+ region *region.Region
+ errorHandler sdkerr.ErrorHandler
+}
+
+func NewHcHttpClientBuilder() *HcHttpClientBuilder {
+ hcHttpClientBuilder := &HcHttpClientBuilder{
+ CredentialsType: []string{"basic.Credentials"},
+ errorHandler: sdkerr.DefaultErrorHandler{},
+ }
+ return hcHttpClientBuilder
+}
+
+func (builder *HcHttpClientBuilder) WithCredentialsType(credentialsType string) *HcHttpClientBuilder {
+ builder.CredentialsType = strings.Split(credentialsType, ",")
+ return builder
+}
+
+func (builder *HcHttpClientBuilder) WithDerivedAuthServiceName(derivedAuthServiceName string) *HcHttpClientBuilder {
+ builder.derivedAuthServiceName = derivedAuthServiceName
+ return builder
+}
+
+// Deprecated: As of 0.1.27, because of the support of the multi-endpoint feature, use WithEndpoints instead
+func (builder *HcHttpClientBuilder) WithEndpoint(endpoint string) *HcHttpClientBuilder {
+ return builder.WithEndpoints([]string{endpoint})
+}
+
+func (builder *HcHttpClientBuilder) WithEndpoints(endpoints []string) *HcHttpClientBuilder {
+ builder.endpoints = endpoints
+ return builder
+}
+
+func (builder *HcHttpClientBuilder) WithRegion(region *region.Region) *HcHttpClientBuilder {
+ builder.region = region
+ return builder
+}
+
+func (builder *HcHttpClientBuilder) WithHttpConfig(httpConfig *config.HttpConfig) *HcHttpClientBuilder {
+ builder.httpConfig = httpConfig
+ return builder
+}
+
+func (builder *HcHttpClientBuilder) WithCredential(iCredential auth.ICredential) *HcHttpClientBuilder {
+ builder.credentials = iCredential
+ return builder
+}
+
+func (builder *HcHttpClientBuilder) WithErrorHandler(errorHandler sdkerr.ErrorHandler) *HcHttpClientBuilder {
+ builder.errorHandler = errorHandler
+ return builder
+}
+
+func (builder *HcHttpClientBuilder) Build() *HcHttpClient {
+ if builder.httpConfig == nil {
+ builder.httpConfig = config.DefaultHttpConfig()
+ }
+
+ defaultHttpClient := impl.NewDefaultHttpClient(builder.httpConfig)
+
+ if builder.credentials == nil {
+ p := provider.DefaultCredentialProviderChain(builder.CredentialsType[0])
+ credentials, err := p.GetCredentials()
+ if err != nil {
+ panic(err)
+ }
+ builder.credentials = credentials
+ }
+
+ t := reflect.TypeOf(builder.credentials)
+ if t.Kind() == reflect.Ptr {
+ t = t.Elem()
+ }
+ givenCredentialsType := t.String()
+ match := false
+ for _, credentialsType := range builder.CredentialsType {
+ if credentialsType == givenCredentialsType {
+ match = true
+ break
+ }
+ }
+ if !match {
+ panic(fmt.Sprintf("Need credential type is %s, actually is %s", builder.CredentialsType, givenCredentialsType))
+ }
+
+ if builder.region != nil {
+ builder.endpoints = builder.region.Endpoints
+ builder.credentials.ProcessAuthParams(defaultHttpClient, builder.region.Id)
+
+ if credential, ok := builder.credentials.(auth.IDerivedCredential); ok {
+ credential.ProcessDerivedAuthParams(builder.derivedAuthServiceName, builder.region.Id)
+ }
+ }
+
+ for index, endpoint := range builder.endpoints {
+ if !strings.HasPrefix(endpoint, "http") {
+ builder.endpoints[index] = "https://" + endpoint
+ }
+ }
+
+ hcHttpClient := NewHcHttpClient(defaultHttpClient).
+ WithEndpoints(builder.endpoints).
+ WithCredential(builder.credentials).
+ WithErrorHandler(builder.errorHandler)
+ return hcHttpClient
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/httphandler/http_handler.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/httphandler/http_handler.go
new file mode 100644
index 0000000000..2d5aeca3ce
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/httphandler/http_handler.go
@@ -0,0 +1,63 @@
+// Copyright 2020 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package httphandler
+
+import (
+ "net/http"
+ "time"
+)
+
+type MonitorMetric struct {
+ Host string
+ Path string
+ Method string
+ Raw string
+ UserAgent string
+ RequestId string
+ StatusCode int
+ ContentLength int64
+ Latency time.Duration
+}
+
+type HttpHandler struct {
+ RequestHandlers func(http.Request)
+ ResponseHandlers func(http.Response)
+ MonitorHandlers func(*MonitorMetric)
+}
+
+func NewHttpHandler() *HttpHandler {
+ handler := HttpHandler{}
+ return &handler
+}
+
+func (handler *HttpHandler) AddRequestHandler(requestHandler func(http.Request)) *HttpHandler {
+ handler.RequestHandlers = requestHandler
+ return handler
+}
+
+func (handler *HttpHandler) AddResponseHandler(responseHandler func(response http.Response)) *HttpHandler {
+ handler.ResponseHandlers = responseHandler
+ return handler
+}
+
+func (handler *HttpHandler) AddMonitorHandler(monitorHandler func(*MonitorMetric)) *HttpHandler {
+ handler.MonitorHandlers = monitorHandler
+ return handler
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/impl/default_http_client.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/impl/default_http_client.go
new file mode 100644
index 0000000000..ff6187196d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/impl/default_http_client.go
@@ -0,0 +1,246 @@
+// Copyright 2020 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package impl
+
+import (
+ "bytes"
+ "crypto/tls"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/config"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/exchange"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/httphandler"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/progress"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/response"
+ "io/ioutil"
+ "net/http"
+ "net/url"
+ "strconv"
+ "strings"
+ "time"
+)
+
+type DefaultHttpClient struct {
+ httpHandler *httphandler.HttpHandler
+ httpConfig *config.HttpConfig
+ transport *http.Transport
+ goHttpClient *http.Client
+}
+
+func NewDefaultHttpClient(httpConfig *config.HttpConfig) *DefaultHttpClient {
+ var transport *http.Transport
+ if httpConfig.HttpTransport != nil {
+ transport = httpConfig.HttpTransport
+ } else {
+ transport = &http.Transport{
+ TLSClientConfig: &tls.Config{InsecureSkipVerify: httpConfig.IgnoreSSLVerification},
+ }
+
+ if httpConfig.DialContext != nil {
+ transport.DialContext = httpConfig.DialContext
+ }
+
+ if httpConfig.HttpProxy != nil {
+ proxyUrl := httpConfig.HttpProxy.GetProxyUrl()
+ proxy, err := url.Parse(proxyUrl)
+ if err == nil {
+ transport.Proxy = http.ProxyURL(proxy)
+ }
+ }
+ }
+
+ client := &DefaultHttpClient{
+ transport: transport,
+ httpConfig: httpConfig,
+ }
+
+ client.goHttpClient = &http.Client{
+ Transport: client.transport,
+ Timeout: httpConfig.Timeout,
+ }
+
+ if !httpConfig.AllowRedirects {
+ client.goHttpClient.CheckRedirect = func(req *http.Request, via []*http.Request) error {
+ return http.ErrUseLastResponse
+ }
+ }
+
+ client.httpHandler = httpConfig.HttpHandler
+
+ return client
+}
+
+func (client *DefaultHttpClient) GetHttpConfig() config.HttpConfig {
+ return *client.httpConfig
+}
+
+func (client *DefaultHttpClient) SyncInvokeHttp(request *request.DefaultHttpRequest) (*response.DefaultHttpResponse,
+ error) {
+ exch := &exchange.SdkExchange{
+ ApiReference: &exchange.ApiReference{},
+ Attributes: make(map[string]interface{}),
+ }
+ return client.SyncInvokeHttpWithExchange(request, exch)
+}
+
+func (client *DefaultHttpClient) SyncInvokeHttpWithExchange(request *request.DefaultHttpRequest,
+ exch *exchange.SdkExchange) (*response.DefaultHttpResponse, error) {
+ req, err := request.ConvertRequest()
+ if err != nil {
+ return nil, err
+ }
+
+ if lnErr := client.listenRequest(req); lnErr != nil {
+ return nil, lnErr
+ }
+
+ client.recordRequestInfo(exch, req)
+ resp, err := client.goHttpClient.Do(req)
+ if err != nil {
+ return nil, err
+ }
+
+ processProgressResponse(request, resp)
+ client.recordResponseInfo(exch, resp)
+
+ if lnErr := client.listenResponse(resp); lnErr != nil {
+ return nil, lnErr
+ }
+ client.monitorHttp(exch, resp)
+
+ return response.NewDefaultHttpResponse(resp), nil
+}
+
+func (client *DefaultHttpClient) recordRequestInfo(exch *exchange.SdkExchange, req *http.Request) {
+ exch.ApiReference.Host = req.URL.Host
+ exch.ApiReference.Method = req.Method
+ exch.ApiReference.Path = req.URL.Path
+ exch.ApiReference.Raw = req.URL.RawQuery
+ exch.ApiReference.UserAgent = req.UserAgent()
+ exch.ApiReference.StartedTime = time.Now()
+}
+
+func (client *DefaultHttpClient) recordResponseInfo(exch *exchange.SdkExchange, resp *http.Response) {
+ exch.ApiReference.RequestId = resp.Header.Get("X-Request-Id")
+ exch.ApiReference.StatusCode = resp.StatusCode
+ exch.ApiReference.ContentLength = resp.ContentLength
+ exch.ApiReference.DurationMs = time.Since(exch.ApiReference.StartedTime)
+}
+
+func (client *DefaultHttpClient) listenRequest(req *http.Request) error {
+ if client.httpHandler == nil || client.httpHandler.RequestHandlers == nil || req == nil {
+ return nil
+ }
+
+ reqClone := req.Clone(req.Context())
+ if req.Body != nil {
+ if isStream(req.Header) {
+ reqClone.Body = ioutil.NopCloser(strings.NewReader("{stream: *****}"))
+ } else {
+ bodyBytes, err := ioutil.ReadAll(req.Body)
+ if err != nil {
+ return err
+ }
+ req.Body = ioutil.NopCloser(bytes.NewBuffer(bodyBytes))
+ reqClone.Body = ioutil.NopCloser(bytes.NewBuffer(bodyBytes))
+ }
+ defer reqClone.Body.Close()
+ }
+
+ client.httpHandler.RequestHandlers(*reqClone)
+ return nil
+}
+
+func (client *DefaultHttpClient) listenResponse(resp *http.Response) error {
+ if client.httpHandler == nil || client.httpHandler.ResponseHandlers == nil || resp == nil {
+ return nil
+ }
+
+ respClone := http.Response{
+ Status: resp.Status,
+ StatusCode: resp.StatusCode,
+ Proto: resp.Proto,
+ ProtoMajor: resp.ProtoMajor,
+ ProtoMinor: resp.ProtoMinor,
+ Header: resp.Header,
+ ContentLength: resp.ContentLength,
+ TransferEncoding: resp.TransferEncoding,
+ Close: resp.Close,
+ Uncompressed: resp.Uncompressed,
+ Trailer: resp.Trailer,
+ }
+
+ if resp.Body != nil {
+ if isStream(resp.Header) {
+ respClone.Body = ioutil.NopCloser(strings.NewReader("{stream: *****}"))
+ } else {
+ bodyBytes, err := ioutil.ReadAll(resp.Body)
+ if err != nil {
+ return err
+ }
+ resp.Body = ioutil.NopCloser(bytes.NewBuffer(bodyBytes))
+ respClone.Body = ioutil.NopCloser(bytes.NewBuffer(bodyBytes))
+ }
+
+ defer respClone.Body.Close()
+ }
+
+ client.httpHandler.ResponseHandlers(respClone)
+ return nil
+}
+
+func (client *DefaultHttpClient) monitorHttp(exch *exchange.SdkExchange, resp *http.Response) {
+ if client.httpHandler != nil && client.httpHandler.MonitorHandlers != nil {
+ metric := &httphandler.MonitorMetric{
+ Host: exch.ApiReference.Host,
+ Method: exch.ApiReference.Method,
+ Path: exch.ApiReference.Path,
+ Raw: exch.ApiReference.Raw,
+ UserAgent: exch.ApiReference.UserAgent,
+ Latency: exch.ApiReference.DurationMs,
+ RequestId: exch.ApiReference.RequestId,
+ StatusCode: exch.ApiReference.StatusCode,
+ ContentLength: exch.ApiReference.ContentLength,
+ }
+
+ client.httpHandler.MonitorHandlers(metric)
+ }
+}
+
+func isStream(header http.Header) bool {
+ contentType := header.Get("Content-Type")
+ if contentType == "" {
+ return false
+ }
+ return strings.Contains(contentType, "octet-stream")
+}
+
+func processProgressResponse(request *request.DefaultHttpRequest, response *http.Response) {
+ if request.GetProgressListener() == nil || !isStream(response.Header) {
+ return
+ }
+ contentLength := int64(-1)
+ if value := response.Header.Get("Content-Length"); value != "" {
+ i, err := strconv.ParseInt(value, 10, 64)
+ if err == nil {
+ contentLength = i
+ }
+ }
+ response.Body = progress.NewTeeReader(response.Body, nil, contentLength, request.GetProgressListener(), request.GetProgressInterval())
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/impl/http_client.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/impl/http_client.go
new file mode 100644
index 0000000000..a7cb2dfdfc
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/impl/http_client.go
@@ -0,0 +1,29 @@
+// Copyright 2020 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package impl
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/response"
+)
+
+type HttpClient interface {
+ sync(request *request.HttpRequest) (*response.HttpResponse, error)
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/invoker.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/invoker.go
new file mode 100644
index 0000000000..2c5f8905ee
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/invoker.go
@@ -0,0 +1,104 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package invoker
+
+import (
+ "time"
+
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/def"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/exchange"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/retry"
+)
+
+type RetryChecker func(interface{}, error) bool
+
+type BaseInvoker struct {
+ Exchange *exchange.SdkExchange
+
+ client *core.HcHttpClient
+ request interface{}
+ meta *def.HttpRequestDef
+ headers map[string]string
+
+ retryTimes int
+ retryChecker RetryChecker
+ backoffStrategy retry.Strategy
+}
+
+func NewBaseInvoker(client *core.HcHttpClient, request interface{}, meta *def.HttpRequestDef) *BaseInvoker {
+ exch := &exchange.SdkExchange{
+ ApiReference: &exchange.ApiReference{
+ Method: meta.Method,
+ Path: meta.Path,
+ },
+ Attributes: make(map[string]interface{}),
+ }
+
+ return &BaseInvoker{
+ Exchange: exch,
+ client: client,
+ request: request,
+ meta: meta,
+ headers: make(map[string]string),
+ }
+}
+
+func (b *BaseInvoker) ReplaceCredentialWhen(fun func(auth.ICredential) auth.ICredential) *BaseInvoker {
+ b.client.WithCredential(fun(b.client.GetCredential()))
+ return b
+}
+
+func (b *BaseInvoker) AddHeader(headers map[string]string) *BaseInvoker {
+ b.headers = headers
+ return b
+}
+
+func (b *BaseInvoker) WithRetry(retryTimes int, checker RetryChecker, backoffStrategy retry.Strategy) *BaseInvoker {
+ b.retryTimes = retryTimes
+ b.retryChecker = checker
+ b.backoffStrategy = backoffStrategy
+ return b
+}
+
+func (b *BaseInvoker) Invoke() (interface{}, error) {
+ if b.retryTimes != 0 && b.retryChecker != nil {
+ var execTimes int
+ var resp interface{}
+ var err error
+ for {
+ if execTimes == b.retryTimes {
+ break
+ }
+ resp, err = b.client.PreInvoke(b.headers).SyncInvoke(b.request, b.meta, b.Exchange)
+ execTimes += 1
+
+ if b.retryChecker(resp, err) {
+ time.Sleep(time.Duration(b.backoffStrategy.ComputeDelayBeforeNextRetry(int32(execTimes))) * time.Millisecond)
+ } else {
+ break
+ }
+ }
+ return resp, err
+ } else {
+ return b.client.PreInvoke(b.headers).SyncInvoke(b.request, b.meta, b.Exchange)
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/retry/decorrelated_jitter.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/retry/decorrelated_jitter.go
new file mode 100644
index 0000000000..59294feb68
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/retry/decorrelated_jitter.go
@@ -0,0 +1,37 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package retry
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+)
+
+// DecorRelatedJitter 去相关抖动退避 delay = min(最大等待时间, random(基础等待时间, 基础等待时间 * 3);
+type DecorRelatedJitter struct {
+ *strategyBase
+}
+
+func NewDecorRelatedJitter() *DecorRelatedJitter {
+ return &DecorRelatedJitter{strategyBase: newStrategyBase()}
+}
+
+func (d *DecorRelatedJitter) ComputeDelayBeforeNextRetry(int32) int32 {
+ return utils.Min32(MaxDelay, utils.RandInt32(d.GetBaseDelay(), d.GetBaseDelay()*3))
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/retry/equal_jitter.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/retry/equal_jitter.go
new file mode 100644
index 0000000000..2c06cf2cf2
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/retry/equal_jitter.go
@@ -0,0 +1,38 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package retry
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+)
+
+// EqualJitter 等抖动指数退避 delay = Exponential/2 + random(0, Exponential/2)
+type EqualJitter struct {
+ *strategyBase
+}
+
+func NewEqualJitter() *EqualJitter {
+ return &EqualJitter{strategyBase: newStrategyBase()}
+}
+
+func (e *EqualJitter) ComputeDelayBeforeNextRetry(retryTimes int32) int32 {
+ expoDelay := getExponentialDelay(e.GetBaseDelay(), retryTimes)
+ return expoDelay/2 + utils.RandInt32(1, expoDelay/2)
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/retry/exponential.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/retry/exponential.go
new file mode 100644
index 0000000000..63b573cca8
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/retry/exponential.go
@@ -0,0 +1,42 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package retry
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+)
+
+// Exponential 指数退避 delay = min(最大等待时间, 基础等待时间 * (2^已重试次数))
+type Exponential struct {
+ *strategyBase
+}
+
+func NewExponential() *Exponential {
+ return &Exponential{strategyBase: newStrategyBase()}
+}
+
+func (e *Exponential) ComputeDelayBeforeNextRetry(retryTimes int32) int32 {
+ return getExponentialDelay(e.GetBaseDelay(), retryTimes)
+}
+
+// getExponentialDelay 等于 min(最大等待时间, 基础等待时间 * (2^已重试次数))
+func getExponentialDelay(baseDelay, retryTimes int32) int32 {
+ return utils.Min32(MaxDelay, baseDelay*(utils.Pow32(2, retryTimes)))
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/retry/none.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/retry/none.go
new file mode 100644
index 0000000000..45f0ed54c6
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/retry/none.go
@@ -0,0 +1,28 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package retry
+
+type None struct{}
+
+func (n None) SetBaseDelay(int32) {}
+
+func (n None) ComputeDelayBeforeNextRetry(int32) int32 {
+ return 0
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/retry/random_jitter.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/retry/random_jitter.go
new file mode 100644
index 0000000000..38dab8d339
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/retry/random_jitter.go
@@ -0,0 +1,38 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package retry
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+)
+
+// RandomJitter 全抖动指数退避 delay = random(0, Exponential)
+type RandomJitter struct {
+ *strategyBase
+}
+
+func NewRandomJitter() *RandomJitter {
+ return &RandomJitter{strategyBase: newStrategyBase()}
+}
+
+func (r *RandomJitter) ComputeDelayBeforeNextRetry(retryTimes int32) int32 {
+ expoDelay := getExponentialDelay(r.GetBaseDelay(), retryTimes)
+ return utils.RandInt32(1, expoDelay)
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/retry/strategy.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/retry/strategy.go
new file mode 100644
index 0000000000..5ed78737d2
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker/retry/strategy.go
@@ -0,0 +1,52 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package retry
+
+const (
+ BaseDelay = 10 // base delay is 10ms
+ MaxDelay = 60 * 1000 // max delay is 60s
+)
+
+type strategyBase struct {
+ baseDelay int32
+}
+
+// newStrategyBase new struct with default base delay: BaseDelay
+func newStrategyBase() *strategyBase {
+ return &strategyBase{baseDelay: BaseDelay}
+}
+
+func (s *strategyBase) SetBaseDelay(baseDelay int32) {
+ if s != nil {
+ s.baseDelay = baseDelay
+ }
+}
+
+func (s *strategyBase) GetBaseDelay() int32 {
+ if s != nil {
+ return s.baseDelay
+ }
+ return BaseDelay
+}
+
+type Strategy interface {
+ SetBaseDelay(int32)
+ ComputeDelayBeforeNextRetry(int32) int32
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/progress/event.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/progress/event.go
new file mode 100644
index 0000000000..a45e6163f2
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/progress/event.go
@@ -0,0 +1,45 @@
+// Copyright 2023 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package progress
+
+type EventType int
+
+const (
+ TransferStartedEvent EventType = iota
+ TransferDataEvent
+ TransferCompletedEvent
+ TransferFailedEvent
+)
+
+type Event struct {
+ Type EventType
+ TransferredBytes int64
+ TotalBytes int64
+ Err error
+}
+
+func NewEvent(eventType EventType, transferredBytes int64, totalBytes int64, err error) *Event {
+ return &Event{
+ Type: eventType,
+ TransferredBytes: transferredBytes,
+ TotalBytes: totalBytes,
+ Err: err,
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/progress/listener.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/progress/listener.go
new file mode 100644
index 0000000000..d02737c2ad
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/progress/listener.go
@@ -0,0 +1,24 @@
+// Copyright 2023 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package progress
+
+type Listener interface {
+ ProgressChanged(event *Event)
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/progress/reader.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/progress/reader.go
new file mode 100644
index 0000000000..9bc569cad3
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/progress/reader.go
@@ -0,0 +1,95 @@
+// Copyright 2023 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package progress
+
+import (
+ "io"
+)
+
+const defaultProgressInterval = int64(102400)
+
+func NewTeeReader(reader io.Reader, writer io.Writer, totalBytes int64, progressListener Listener, progressInterval int64) *TeeReader {
+ if progressInterval <= 0 {
+ progressInterval = defaultProgressInterval
+ }
+
+ return &TeeReader{
+ reader: reader,
+ writer: writer,
+ progressInterval: progressInterval,
+ totalBytes: totalBytes,
+ listener: progressListener,
+ }
+}
+
+type TeeReader struct {
+ reader io.Reader
+ writer io.Writer
+ cacheBytes int64
+ progressInterval int64
+ transferredBytes int64
+ totalBytes int64
+ listener Listener
+}
+
+func (r *TeeReader) Read(p []byte) (int, error) {
+ if r.transferredBytes == 0 {
+ event := NewEvent(TransferStartedEvent, r.transferredBytes, r.totalBytes, nil)
+ r.listener.ProgressChanged(event)
+ }
+
+ n, err := r.reader.Read(p)
+ if err != nil && err != io.EOF {
+ event := NewEvent(TransferFailedEvent, r.transferredBytes, r.totalBytes, err)
+ r.listener.ProgressChanged(event)
+ }
+
+ if n > 0 {
+ n64 := int64(n)
+ r.transferredBytes += n64
+ if r.writer != nil {
+ if n, err := r.writer.Write(p[:n]); err != nil {
+ return n, err
+ }
+ }
+
+ r.cacheBytes += n64
+ if r.cacheBytes >= r.progressInterval || r.transferredBytes == r.totalBytes {
+ r.cacheBytes = 0
+ event := NewEvent(TransferDataEvent, r.transferredBytes, r.totalBytes, nil)
+ r.listener.ProgressChanged(event)
+ }
+ }
+
+ if err == io.EOF {
+ r.cacheBytes = 0
+ event := NewEvent(TransferCompletedEvent, r.transferredBytes, r.totalBytes, nil)
+ r.listener.ProgressChanged(event)
+ }
+
+ return n, err
+}
+
+func (r *TeeReader) Close() error {
+ if closer, ok := r.reader.(io.ReadCloser); ok {
+ return closer.Close()
+ }
+ return nil
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/progress/request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/progress/request.go
new file mode 100644
index 0000000000..17fd347dc4
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/progress/request.go
@@ -0,0 +1,27 @@
+// Copyright 2023 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package progress
+
+type Request interface {
+ SetProgressListener(progressListener Listener)
+ GetProgressListener() Listener
+ SetProgressInterval(progressInterval int64)
+ GetProgressInterval() int64
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/region/env_region.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/region/env_region.go
new file mode 100644
index 0000000000..fb7fa379b9
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/region/env_region.go
@@ -0,0 +1,73 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package region
+
+import (
+ "fmt"
+ "os"
+ "strings"
+ "sync"
+)
+
+const (
+ regionEnvPrefix = "HUAWEICLOUD_SDK_REGION"
+)
+
+var (
+ envOnce sync.Once
+ envCache *EnvCache
+)
+
+type EnvCache struct {
+ value map[string]*Region
+}
+
+func getEnvCache() *EnvCache {
+ envOnce.Do(func() {
+ envCache = &EnvCache{value: make(map[string]*Region)}
+ })
+
+ return envCache
+}
+
+type EnvProvider struct {
+ serviceName string
+}
+
+func NewEnvProvider(serviceName string) *EnvProvider {
+ return &EnvProvider{serviceName: strings.ToUpper(serviceName)}
+}
+
+func (p *EnvProvider) GetRegion(regionId string) *Region {
+ if reg, ok := getEnvCache().value[p.serviceName+regionId]; ok {
+ return reg
+ }
+
+ envName := fmt.Sprintf("%s_%s_%s", regionEnvPrefix, p.serviceName, strings.ToUpper(strings.Replace(regionId, "-", "_", -1)))
+ endpoint := os.Getenv(envName)
+ if endpoint == "" {
+ return nil
+ }
+
+ endpoints := strings.Split(endpoint, ",")
+ reg := NewRegion(regionId, endpoints...)
+ getEnvCache().value[p.serviceName+regionId] = reg
+ return reg
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/region/profile_region.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/region/profile_region.go
new file mode 100644
index 0000000000..bc3d2ba2d8
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/region/profile_region.go
@@ -0,0 +1,136 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package region
+
+import (
+ "fmt"
+ "gopkg.in/yaml.v3"
+ "io/ioutil"
+ "os"
+ "path/filepath"
+ "strings"
+ "sync"
+)
+
+const (
+ regionsFileEnv = "HUAWEICLOUD_SDK_REGIONS_FILE"
+ defaultRegionsFileDirName = ".huaweicloud"
+ defaultRegionsFileName = "regions.yaml"
+)
+
+var (
+ profileOnce sync.Once
+ profileCache *ProfileCache
+)
+
+type ProfileCache struct {
+ value map[string]*Region
+}
+
+type regionInfo struct {
+ Id string `yaml:"id"`
+ Endpoint string `yaml:"endpoint"`
+ Endpoints []string `yaml:"endpoints"`
+}
+
+func getProfileCache() *ProfileCache {
+ profileOnce.Do(func() {
+ profileCache = &ProfileCache{value: resolveProfile()}
+ })
+
+ return profileCache
+}
+
+func getRegionsFilePath() string {
+ if path := os.Getenv(regionsFileEnv); path != "" {
+ return path
+ }
+
+ dir, err := os.UserHomeDir()
+ if err != nil {
+ return ""
+ }
+
+ return filepath.Join(dir, defaultRegionsFileDirName, defaultRegionsFileName)
+}
+
+func isPathExist(path string) bool {
+ _, err := os.Stat(path)
+ if err == nil {
+ return true
+ }
+ return false
+}
+
+func resolveProfile() map[string]*Region {
+ result := make(map[string]*Region)
+
+ path := getRegionsFilePath()
+ if !isPathExist(path) {
+ return result
+ }
+
+ bytes, err := ioutil.ReadFile(path)
+ if err != nil {
+ panic(fmt.Sprintf("failed to read file: '%s'\n%s", path, err.Error()))
+ }
+
+ var servReg map[string][]*regionInfo
+ err = yaml.Unmarshal(bytes, &servReg)
+ if err != nil {
+ panic(fmt.Sprintf("failed to resolve file: '%s'\n%s", path, err.Error()))
+ }
+
+ for serv, regInfos := range servReg {
+ for _, regInfo := range regInfos {
+ if regInfo.Id == "" {
+ continue
+ }
+
+ endpoints := make([]string, 0, len(regInfo.Endpoints)+1)
+ if regInfo.Endpoint != "" {
+ endpoints = append(endpoints, regInfo.Endpoint)
+ }
+ if regInfo.Endpoints != nil {
+ endpoints = append(endpoints, regInfo.Endpoints...)
+ }
+
+ if len(endpoints) != 0 {
+ result[strings.ToUpper(serv)+regInfo.Id] = NewRegion(regInfo.Id, endpoints...)
+ }
+ }
+ }
+ return result
+}
+
+type ProfileProvider struct {
+ serviceName string
+}
+
+func NewProfileProvider(serviceName string) *ProfileProvider {
+
+ return &ProfileProvider{
+ serviceName: strings.ToUpper(serviceName),
+ }
+}
+
+func (p *ProfileProvider) GetRegion(regionId string) *Region {
+ return getProfileCache().value[p.serviceName+regionId]
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/region/region.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/region/region.go
new file mode 100644
index 0000000000..74673871be
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/region/region.go
@@ -0,0 +1,42 @@
+// Copyright 2020 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package region
+
+type Region struct {
+ Id string
+ Endpoints []string
+}
+
+func NewRegion(id string, endpoints ...string) *Region {
+ return &Region{
+ Id: id,
+ Endpoints: endpoints,
+ }
+}
+
+// Deprecated: As of 0.1.27, because of the support of the multi-endpoint feature, use WithEndpointsOverride instead
+func (r *Region) WithEndpointOverride(endpoint string) *Region {
+ return r.WithEndpointsOverride([]string{endpoint})
+}
+
+func (r *Region) WithEndpointsOverride(endpoints []string) *Region {
+ r.Endpoints = endpoints
+ return r
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/region/region_chain.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/region/region_chain.go
new file mode 100644
index 0000000000..b8306cd886
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/region/region_chain.go
@@ -0,0 +1,39 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package region
+
+type ProviderChain struct {
+ providers []IRegionProvider
+}
+
+func DefaultProviderChain(serviceName string) *ProviderChain {
+ providers := []IRegionProvider{NewEnvProvider(serviceName), NewProfileProvider(serviceName)}
+ return &ProviderChain{providers: providers}
+}
+
+func (p *ProviderChain) GetRegion(regionId string) *Region {
+ for _, provider := range p.providers {
+ reg := provider.GetRegion(regionId)
+ if reg != nil {
+ return reg
+ }
+ }
+ return nil
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/region/region_provider.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/region/region_provider.go
new file mode 100644
index 0000000000..f549ca97ec
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/region/region_provider.go
@@ -0,0 +1,24 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package region
+
+type IRegionProvider interface {
+ GetRegion(regionId string) *Region
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request/default_http_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request/default_http_request.go
new file mode 100644
index 0000000000..29361e8110
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request/default_http_request.go
@@ -0,0 +1,405 @@
+// Copyright 2020 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package request
+
+import (
+ "bytes"
+ "encoding/json"
+ "encoding/xml"
+ "errors"
+ "fmt"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/algorithm"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/progress"
+ "go.mongodb.org/mongo-driver/bson"
+ "io"
+ "mime/multipart"
+ "net/http"
+ "os"
+ "reflect"
+ "strconv"
+ "strings"
+
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/def"
+)
+
+type DefaultHttpRequest struct {
+ endpoint string
+ path string
+ method string
+
+ queryParams map[string]interface{}
+ pathParams map[string]string
+ headerParams map[string]string
+ formParams map[string]def.FormData
+ body interface{}
+
+ autoFilledPathParams map[string]string
+ progressListener progress.Listener
+ progressInterval int64
+ signingAlgorithm algorithm.SigningAlgorithm
+}
+
+func (httpRequest *DefaultHttpRequest) fillParamsInPath() *DefaultHttpRequest {
+ for key, value := range httpRequest.pathParams {
+ httpRequest.path = strings.ReplaceAll(httpRequest.path, "{"+key+"}", value)
+ }
+ for key, value := range httpRequest.autoFilledPathParams {
+ httpRequest.path = strings.ReplaceAll(httpRequest.path, "{"+key+"}", value)
+ }
+ return httpRequest
+}
+
+func (httpRequest *DefaultHttpRequest) Builder() *HttpRequestBuilder {
+ httpRequestBuilder := HttpRequestBuilder{httpRequest: httpRequest}
+ return &httpRequestBuilder
+}
+
+func (httpRequest *DefaultHttpRequest) GetEndpoint() string {
+ return httpRequest.endpoint
+}
+
+func (httpRequest *DefaultHttpRequest) GetPath() string {
+ return httpRequest.path
+}
+
+func (httpRequest *DefaultHttpRequest) GetSigningAlgorithm() algorithm.SigningAlgorithm {
+ return httpRequest.signingAlgorithm
+}
+
+func (httpRequest *DefaultHttpRequest) GetMethod() string {
+ return httpRequest.method
+}
+
+func (httpRequest *DefaultHttpRequest) GetQueryParams() map[string]interface{} {
+ return httpRequest.queryParams
+}
+
+func (httpRequest *DefaultHttpRequest) GetHeaderParams() map[string]string {
+ return httpRequest.headerParams
+}
+
+func (httpRequest *DefaultHttpRequest) GetPathPrams() map[string]string {
+ return httpRequest.pathParams
+}
+
+func (httpRequest *DefaultHttpRequest) GetFormPrams() map[string]def.FormData {
+ return httpRequest.formParams
+}
+
+func (httpRequest *DefaultHttpRequest) GetBody() interface{} {
+ return httpRequest.body
+}
+
+func (httpRequest *DefaultHttpRequest) GetBodyToBytes() (*bytes.Buffer, error) {
+ buf := &bytes.Buffer{}
+
+ if httpRequest.body != nil {
+ v := reflect.ValueOf(httpRequest.body)
+ if v.Kind() == reflect.Ptr {
+ v = v.Elem()
+ }
+
+ if v.Kind() == reflect.String {
+ buf.WriteString(v.Interface().(string))
+ } else {
+ var err error
+ if httpRequest.headerParams["Content-Type"] == "application/xml" {
+ encoder := xml.NewEncoder(buf)
+ err = encoder.Encode(httpRequest.body)
+ } else if httpRequest.headerParams["Content-Type"] == "application/bson" {
+ buffer, err := bson.Marshal(httpRequest.body)
+ if err != nil {
+ return nil, err
+ }
+ buf.Write(buffer)
+ } else {
+ encoder := json.NewEncoder(buf)
+ encoder.SetEscapeHTML(false)
+ err = encoder.Encode(httpRequest.body)
+ }
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+
+ return buf, nil
+}
+
+func (httpRequest *DefaultHttpRequest) GetProgressListener() progress.Listener {
+ return httpRequest.progressListener
+}
+
+func (httpRequest *DefaultHttpRequest) GetProgressInterval() int64 {
+ return httpRequest.progressInterval
+}
+
+func (httpRequest *DefaultHttpRequest) AddQueryParam(key string, value string) {
+ httpRequest.queryParams[key] = value
+}
+
+func (httpRequest *DefaultHttpRequest) AddPathParam(key string, value string) {
+ httpRequest.pathParams[key] = value
+}
+
+func (httpRequest *DefaultHttpRequest) AddHeaderParam(key string, value string) {
+ httpRequest.headerParams[key] = value
+}
+
+func (httpRequest *DefaultHttpRequest) AddFormParam(key string, value def.FormData) {
+ httpRequest.formParams[key] = value
+}
+
+func (httpRequest *DefaultHttpRequest) ConvertRequest() (*http.Request, error) {
+ t := reflect.TypeOf(httpRequest.body)
+ if t != nil && t.Kind() == reflect.Ptr {
+ t = t.Elem()
+ }
+
+ var req *http.Request
+ var err error
+ if httpRequest.body != nil && t != nil && t.Name() == "File" {
+ req, err = httpRequest.convertStreamBody(err, req)
+ if err != nil {
+ return nil, err
+ }
+ } else if len(httpRequest.GetFormPrams()) != 0 {
+ req, err = httpRequest.covertFormBody()
+ if err != nil {
+ return nil, err
+ }
+ } else {
+ var buf *bytes.Buffer
+
+ buf, err = httpRequest.GetBodyToBytes()
+ if err != nil {
+ return nil, err
+ }
+
+ req, err = http.NewRequest(httpRequest.GetMethod(), httpRequest.GetEndpoint(), buf)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ httpRequest.fillPath(req)
+ httpRequest.fillQueryParams(req)
+ httpRequest.fillHeaderParams(req)
+
+ return req, nil
+}
+
+func (httpRequest *DefaultHttpRequest) covertFormBody() (*http.Request, error) {
+ bodyBuffer := &bytes.Buffer{}
+ bodyWriter := multipart.NewWriter(bodyBuffer)
+
+ sortedKeys := make([]string, 0, len(httpRequest.GetFormPrams()))
+ for k, v := range httpRequest.GetFormPrams() {
+ if _, ok := v.(*def.FilePart); ok {
+ sortedKeys = append(sortedKeys, k)
+ } else {
+ sortedKeys = append([]string{k}, sortedKeys...)
+ }
+ }
+
+ for _, k := range sortedKeys {
+ if err := httpRequest.GetFormPrams()[k].Write(bodyWriter, k); err != nil {
+ return nil, err
+ }
+ }
+
+ contentType := bodyWriter.FormDataContentType()
+ if err := bodyWriter.Close(); err != nil {
+ return nil, err
+ }
+
+ req, err := http.NewRequest(httpRequest.GetMethod(), httpRequest.GetEndpoint(), bodyBuffer)
+ if err != nil {
+ return nil, err
+ }
+
+ req.Header.Set("Content-type", contentType)
+ return req, nil
+}
+
+func (httpRequest *DefaultHttpRequest) getContentLength() int64 {
+ contentLength := int64(-1)
+ if value, ok := httpRequest.GetHeaderParams()["Content-Length"]; ok {
+ parseInt, err := strconv.ParseInt(value, 10, 64)
+ if err == nil {
+ contentLength = parseInt
+ }
+ }
+
+ if contentLength == -1 {
+ if value, ok := httpRequest.GetBody().(os.File); ok {
+ if stat, err := value.Stat(); err == nil {
+ contentLength = stat.Size()
+ }
+ }
+ }
+
+ return contentLength
+}
+
+func (httpRequest *DefaultHttpRequest) convertStreamBody(err error, req *http.Request) (*http.Request, error) {
+ if f, ok := httpRequest.body.(os.File); !ok {
+ return nil, errors.New("failed to get stream request body")
+ } else {
+ var reader io.Reader
+ if httpRequest.progressListener != nil {
+ reader = progress.NewTeeReader(&f, nil, httpRequest.getContentLength(), httpRequest.progressListener, httpRequest.progressInterval)
+ } else {
+ reader = &f
+ }
+
+ req, err = http.NewRequest(httpRequest.GetMethod(), httpRequest.GetEndpoint(), reader)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ return req, nil
+}
+
+func (httpRequest *DefaultHttpRequest) fillHeaderParams(req *http.Request) {
+ if len(httpRequest.GetHeaderParams()) == 0 {
+ return
+ }
+
+ for key, value := range httpRequest.GetHeaderParams() {
+ if strings.EqualFold(key, "Content-type") && req.Header.Get("Content-type") != "" {
+ continue
+ }
+ req.Header.Add(key, value)
+ }
+}
+
+func (httpRequest *DefaultHttpRequest) fillQueryParams(req *http.Request) {
+ if len(httpRequest.GetQueryParams()) == 0 {
+ return
+ }
+
+ q := req.URL.Query()
+ for key, value := range httpRequest.GetQueryParams() {
+ valueWithType, ok := value.(reflect.Value)
+ if !ok {
+ continue
+ }
+
+ if valueWithType.Kind() == reflect.Slice {
+ params := httpRequest.CanonicalSliceQueryParamsToMulti(valueWithType)
+ for _, param := range params {
+ q.Add(key, param)
+ }
+ } else if valueWithType.Kind() == reflect.Map {
+ params := httpRequest.CanonicalMapQueryParams(key, valueWithType)
+ for _, param := range params {
+ for k, v := range param {
+ q.Add(k, v)
+ }
+ }
+ } else {
+ q.Add(key, httpRequest.CanonicalStringQueryParams(valueWithType))
+ }
+ }
+
+ req.URL.RawQuery = strings.ReplaceAll(strings.ReplaceAll(strings.Trim(q.Encode(), "="), "=&", "&"), "+", "%20")
+}
+
+func (httpRequest *DefaultHttpRequest) CanonicalStringQueryParams(value reflect.Value) string {
+ return fmt.Sprintf("%v", value)
+}
+
+func (httpRequest *DefaultHttpRequest) CanonicalSliceQueryParamsToMulti(value reflect.Value) []string {
+ params := make([]string, 0)
+
+ for i := 0; i < value.Len(); i++ {
+ if value.Index(i).Kind() == reflect.Struct {
+ methodByName := value.Index(i).MethodByName("Value")
+ if methodByName.IsValid() {
+ value := converter.ConvertInterfaceToString(methodByName.Call([]reflect.Value{})[0].Interface())
+ params = append(params, value)
+ } else {
+ v, e := json.Marshal(value.Interface())
+ if e == nil {
+ if strings.HasPrefix(string(v), "\"") {
+ params = append(params, strings.Trim(string(v), "\""))
+ } else {
+ params = append(params, string(v))
+ }
+ }
+ }
+ } else {
+ params = append(params, httpRequest.CanonicalStringQueryParams(value.Index(i)))
+ }
+ }
+
+ return params
+}
+
+func (httpRequest *DefaultHttpRequest) CanonicalMapQueryParams(key string, value reflect.Value) []map[string]string {
+ queryParams := make([]map[string]string, 0)
+
+ for _, k := range value.MapKeys() {
+ if value.MapIndex(k).Kind() == reflect.Struct {
+ v, e := json.Marshal(value.Interface())
+ if e == nil {
+ if strings.HasPrefix(string(v), "\"") {
+ queryParams = append(queryParams, map[string]string{
+ key: strings.Trim(string(v), "\""),
+ })
+ } else {
+ queryParams = append(queryParams, map[string]string{
+ key: string(v),
+ })
+ }
+ }
+ } else if value.MapIndex(k).Kind() == reflect.Slice {
+ params := httpRequest.CanonicalSliceQueryParamsToMulti(value.MapIndex(k))
+ if len(params) == 0 {
+ queryParams = append(queryParams, map[string]string{
+ fmt.Sprintf("%s[%s]", key, k): "",
+ })
+ continue
+ }
+ for _, paramValue := range httpRequest.CanonicalSliceQueryParamsToMulti(value.MapIndex(k)) {
+ queryParams = append(queryParams, map[string]string{
+ fmt.Sprintf("%s[%s]", key, k): paramValue,
+ })
+ }
+ } else if value.MapIndex(k).Kind() == reflect.Map {
+ queryParams = append(queryParams, httpRequest.CanonicalMapQueryParams(fmt.Sprintf("%s[%s]", key, k), value.MapIndex(k))...)
+ } else {
+ queryParams = append(queryParams, map[string]string{
+ fmt.Sprintf("%s[%s]", key, k): httpRequest.CanonicalStringQueryParams(value.MapIndex(k)),
+ })
+ }
+ }
+
+ return queryParams
+}
+
+func (httpRequest *DefaultHttpRequest) fillPath(req *http.Request) {
+ if "" != httpRequest.GetPath() {
+ req.URL.Path = httpRequest.GetPath()
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request/http_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request/http_request.go
new file mode 100644
index 0000000000..5dc6dd21c1
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request/http_request.go
@@ -0,0 +1,39 @@
+// Copyright 2020 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package request
+
+import (
+ "bytes"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/progress"
+)
+
+type HttpRequest interface {
+ Builder() *HttpRequestBuilder
+ GetEndpoint() string
+ GetMethod() string
+ GetPath() string
+ GetHeaderParams() map[string]string
+ GetPathPrams() map[string]string
+ GetQueryParams() map[string]interface{}
+ GetBody() interface{}
+ GetBodyToBytes() (*bytes.Buffer, error)
+ GetProgressListener() progress.Listener
+ GetProgressInterval() int64
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request/http_request_builder.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request/http_request_builder.go
new file mode 100644
index 0000000000..59797e81d2
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request/http_request_builder.go
@@ -0,0 +1,136 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package request
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/signer/algorithm"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/def"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/progress"
+ "reflect"
+ "strings"
+)
+
+type HttpRequestBuilder struct {
+ httpRequest *DefaultHttpRequest
+}
+
+func NewHttpRequestBuilder() *HttpRequestBuilder {
+ httpRequest := &DefaultHttpRequest{
+ queryParams: make(map[string]interface{}),
+ headerParams: make(map[string]string),
+ pathParams: make(map[string]string),
+ autoFilledPathParams: make(map[string]string),
+ formParams: make(map[string]def.FormData),
+ }
+ httpRequestBuilder := &HttpRequestBuilder{
+ httpRequest: httpRequest,
+ }
+ return httpRequestBuilder
+}
+
+func (builder *HttpRequestBuilder) WithEndpoint(endpoint string) *HttpRequestBuilder {
+ builder.httpRequest.endpoint = endpoint
+ return builder
+}
+
+func (builder *HttpRequestBuilder) WithPath(path string) *HttpRequestBuilder {
+ builder.httpRequest.path = path
+ return builder
+}
+
+func (builder *HttpRequestBuilder) WithMethod(method string) *HttpRequestBuilder {
+ builder.httpRequest.method = method
+ return builder
+}
+
+func (builder *HttpRequestBuilder) WithSigningAlgorithm(signingAlgorithm algorithm.SigningAlgorithm) *HttpRequestBuilder {
+ builder.httpRequest.signingAlgorithm = signingAlgorithm
+ return builder
+}
+
+func (builder *HttpRequestBuilder) AddQueryParam(key string, value interface{}) *HttpRequestBuilder {
+ builder.httpRequest.queryParams[key] = value
+ return builder
+}
+
+func (builder *HttpRequestBuilder) AddPathParam(key string, value string) *HttpRequestBuilder {
+ builder.httpRequest.pathParams[key] = value
+ return builder
+}
+
+func (builder *HttpRequestBuilder) AddAutoFilledPathParam(key string, value string) *HttpRequestBuilder {
+ builder.httpRequest.autoFilledPathParams[key] = value
+ return builder
+}
+
+func (builder *HttpRequestBuilder) AddHeaderParam(key string, value string) *HttpRequestBuilder {
+ builder.httpRequest.headerParams[key] = value
+ return builder
+}
+
+func (builder *HttpRequestBuilder) AddFormParam(key string, value def.FormData) *HttpRequestBuilder {
+ builder.httpRequest.formParams[key] = value
+ return builder
+}
+
+func (builder *HttpRequestBuilder) WithBody(kind string, body interface{}) *HttpRequestBuilder {
+ if kind == "multipart" {
+ v := reflect.ValueOf(body)
+ if v.Kind() == reflect.Ptr {
+ v = v.Elem()
+ }
+
+ t := reflect.TypeOf(body)
+ if t.Kind() == reflect.Ptr {
+ t = t.Elem()
+ }
+
+ fieldNum := t.NumField()
+ for i := 0; i < fieldNum; i++ {
+ jsonTag := t.Field(i).Tag.Get("json")
+ if jsonTag != "" {
+ if v.FieldByName(t.Field(i).Name).IsNil() && strings.Contains(jsonTag, "omitempty") {
+ continue
+ }
+ builder.AddFormParam(strings.Split(jsonTag, ",")[0], v.FieldByName(t.Field(i).Name).Interface().(def.FormData))
+ } else {
+ builder.AddFormParam(t.Field(i).Name, v.FieldByName(t.Field(i).Name).Interface().(def.FormData))
+ }
+ }
+ } else {
+ builder.httpRequest.body = body
+ }
+
+ return builder
+}
+
+func (builder *HttpRequestBuilder) WithProgressListener(progressListener progress.Listener) *HttpRequestBuilder {
+ builder.httpRequest.progressListener = progressListener
+ return builder
+}
+
+func (builder *HttpRequestBuilder) WithProgressInterval(progressInterval int64) *HttpRequestBuilder {
+ builder.httpRequest.progressInterval = progressInterval
+ return builder
+}
+
+func (builder *HttpRequestBuilder) Build() *DefaultHttpRequest {
+ return builder.httpRequest.fillParamsInPath()
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/response/default_http_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/response/default_http_response.go
new file mode 100644
index 0000000000..1eb618a56a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/response/default_http_response.go
@@ -0,0 +1,65 @@
+// Copyright 2020 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package response
+
+import (
+ "bytes"
+ "io/ioutil"
+ "net/http"
+)
+
+type DefaultHttpResponse struct {
+ Response *http.Response
+}
+
+func NewDefaultHttpResponse(response *http.Response) *DefaultHttpResponse {
+ return &DefaultHttpResponse{Response: response}
+}
+
+func (r *DefaultHttpResponse) GetStatusCode() int {
+ return r.Response.StatusCode
+}
+
+func (r *DefaultHttpResponse) GetHeaders() map[string]string {
+ headerParams := map[string]string{}
+ for key, values := range r.Response.Header {
+ if values == nil || len(values) <= 0 {
+ continue
+ }
+ headerParams[key] = values[0]
+ }
+ return headerParams
+}
+
+func (r *DefaultHttpResponse) GetBody() string {
+ body, err := ioutil.ReadAll(r.Response.Body)
+ if err != nil {
+ return ""
+ }
+ if err := r.Response.Body.Close(); err == nil {
+ r.Response.Body = ioutil.NopCloser(bytes.NewBuffer(body))
+ }
+ return string(body)
+}
+
+func (r *DefaultHttpResponse) GetHeader(key string) string {
+ header := r.Response.Header
+ return header.Get(key)
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/response/http_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/response/http_response.go
new file mode 100644
index 0000000000..9a5b397cfb
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/response/http_response.go
@@ -0,0 +1,28 @@
+// Copyright 2020 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package response
+
+type HttpResponse interface {
+ GetStatusCode() int
+ GetHeaders() map[string]string
+ GetBody() string
+ GetBodyJson() interface{}
+ GetHeader(key string) string
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdkerr/error_handler.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdkerr/error_handler.go
new file mode 100644
index 0000000000..5785c6c67a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdkerr/error_handler.go
@@ -0,0 +1,20 @@
+package sdkerr
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/request"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/response"
+)
+
+type ErrorHandler interface {
+ HandleError(req *request.DefaultHttpRequest, resp *response.DefaultHttpResponse) error
+}
+
+type DefaultErrorHandler struct {
+}
+
+func (h DefaultErrorHandler) HandleError(req *request.DefaultHttpRequest, resp *response.DefaultHttpResponse) error {
+ if resp.GetStatusCode() < 400 {
+ return nil
+ }
+ return NewServiceResponseError(resp.Response)
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdkerr/errors.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdkerr/errors.go
new file mode 100644
index 0000000000..82bd7d63c5
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdkerr/errors.go
@@ -0,0 +1,175 @@
+// Copyright 2020 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package sdkerr
+
+import (
+ "bytes"
+ "fmt"
+ "io/ioutil"
+ "net/http"
+
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+)
+
+const (
+ xRequestId = "X-Request-Id"
+ code = "code"
+ message = "message"
+ errorCode = "error_code"
+ errorMsg = "error_msg"
+ encodedAuthorizationMessage = "encoded_authorization_message"
+)
+
+type CredentialsTypeError struct {
+ ErrorMessage string
+}
+
+func NewCredentialsTypeError(msg string) *CredentialsTypeError {
+ c := &CredentialsTypeError{
+ ErrorMessage: msg,
+ }
+ return c
+}
+
+func (c *CredentialsTypeError) Error() string {
+ return fmt.Sprintf("{\"ErrorMessage\": \"%s\"}", c.ErrorMessage)
+}
+
+type ConnectionError struct {
+ ErrorMessage string
+}
+
+func NewConnectionError(msg string) *ConnectionError {
+ c := &ConnectionError{
+ ErrorMessage: msg,
+ }
+ return c
+}
+
+func (c *ConnectionError) Error() string {
+ return fmt.Sprintf("{\"ErrorMessage\": \"%s\"}", c.ErrorMessage)
+}
+
+type RequestTimeoutError struct {
+ ErrorMessage string
+}
+
+func NewRequestTimeoutError(msg string) *RequestTimeoutError {
+ rt := &RequestTimeoutError{
+ ErrorMessage: msg,
+ }
+ return rt
+}
+
+func (rt *RequestTimeoutError) Error() string {
+ return fmt.Sprintf("{\"ErrorMessage\": \"%s\"}", rt.ErrorMessage)
+}
+
+type errMap map[string]interface{}
+
+func (m errMap) getStringValue(key string) string {
+ var result string
+
+ value, isExist := m[key]
+ if !isExist {
+ return result
+ }
+
+ if strVal, ok := value.(string); ok {
+ result = strVal
+ }
+
+ return result
+}
+
+type ServiceResponseError struct {
+ StatusCode int `json:"status_code"`
+ RequestId string `json:"request_id"`
+ ErrorCode string `json:"error_code"`
+ ErrorMessage string `json:"error_message"`
+ EncodedAuthorizationMessage string `json:"encoded_authorization_message"`
+}
+
+func NewServiceResponseError(resp *http.Response) *ServiceResponseError {
+ sr := &ServiceResponseError{
+ StatusCode: resp.StatusCode,
+ RequestId: resp.Header.Get(xRequestId),
+ }
+
+ data, err := ioutil.ReadAll(resp.Body)
+ defer func() {
+ closeErr := resp.Body.Close()
+ if closeErr == nil && err == nil {
+ resp.Body = ioutil.NopCloser(bytes.NewBuffer(data))
+ }
+ }()
+
+ if err == nil {
+ dataBuf := errMap{}
+ err := utils.Unmarshal(data, &dataBuf)
+ if err != nil {
+ sr.ErrorMessage = string(data)
+ } else {
+ processServiceResponseError(dataBuf, sr)
+ if sr.ErrorMessage == "" {
+ sr.ErrorMessage = string(data)
+ }
+ }
+ }
+
+ return sr
+}
+
+func processServiceResponseError(m errMap, sr *ServiceResponseError) {
+ if value := m.getStringValue(encodedAuthorizationMessage); value != "" {
+ sr.EncodedAuthorizationMessage = value
+ }
+
+ _code := m.getStringValue(errorCode)
+ msg := m.getStringValue(errorMsg)
+ if _code != "" && msg != "" {
+ sr.ErrorCode = _code
+ sr.ErrorMessage = msg
+ return
+ }
+
+ _code = m.getStringValue(code)
+ msg = m.getStringValue(message)
+ if _code != "" && msg != "" {
+ sr.ErrorCode = _code
+ sr.ErrorMessage = msg
+ return
+ }
+
+ for _, v := range m {
+ if val, ok := v.(map[string]interface{}); ok {
+ processServiceResponseError(val, sr)
+ }
+ }
+}
+
+func (sr ServiceResponseError) Error() string {
+ data, err := utils.Marshal(sr)
+ if err != nil {
+ return fmt.Sprintf("{\"ErrorMessage\": \"%s\",\"ErrorCode\": \"%s\",\"EncodedAuthorizationMessage\": \"%s\"}",
+ sr.ErrorMessage, sr.ErrorCode, sr.EncodedAuthorizationMessage)
+ }
+ return fmt.Sprintf(string(data))
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdktime/sdk_time.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdktime/sdk_time.go
new file mode 100644
index 0000000000..690ae0da1e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdktime/sdk_time.go
@@ -0,0 +1,60 @@
+package sdktime
+
+import (
+ "fmt"
+ "strings"
+ "time"
+)
+
+type SdkTime time.Time
+
+func (t *SdkTime) UnmarshalJSON(data []byte) error {
+ tmp := strings.Trim(string(data[:]), "\"")
+
+ now, err := time.ParseInLocation(`2006-01-02T15:04:05Z`, tmp, time.UTC)
+ if err == nil {
+ *t = SdkTime(now)
+ return err
+ }
+
+ now, err = time.ParseInLocation(`2006-01-02T15:04:05`, tmp, time.UTC)
+ if err == nil {
+ *t = SdkTime(now)
+ return err
+ }
+
+ now, err = time.ParseInLocation(`2006-01-02 15:04:05`, tmp, time.UTC)
+ if err == nil {
+ *t = SdkTime(now)
+ return err
+ }
+
+ now, err = time.ParseInLocation(`2006-01-02T15:04:05+08:00`, tmp, time.UTC)
+ if err == nil {
+ *t = SdkTime(now)
+ return err
+ }
+
+ now, err = time.ParseInLocation(time.RFC3339, tmp, time.UTC)
+ if err == nil {
+ *t = SdkTime(now)
+ return err
+ }
+
+ now, err = time.ParseInLocation(time.RFC3339Nano, tmp, time.UTC)
+ if err == nil {
+ *t = SdkTime(now)
+ return err
+ }
+
+ return err
+}
+
+func (t SdkTime) MarshalJSON() ([]byte, error) {
+ rs := []byte(fmt.Sprintf(`"%s"`, t.String()))
+ return rs, nil
+}
+
+func (t SdkTime) String() string {
+ return time.Time(t).Format(`2006-01-02T15:04:05Z`)
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils/json_utils.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils/json_utils.go
new file mode 100644
index 0000000000..5b50a23572
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils/json_utils.go
@@ -0,0 +1,21 @@
+package utils
+
+import (
+ "bytes"
+ jsoniter "github.com/json-iterator/go"
+)
+
+func Marshal(i interface{}) ([]byte, error) {
+ buffer := bytes.NewBuffer([]byte{})
+ encoder := jsoniter.NewEncoder(buffer)
+ encoder.SetEscapeHTML(false)
+ err := encoder.Encode(i)
+ return buffer.Bytes(), err
+}
+
+func Unmarshal(data []byte, i interface{}) error {
+ reader := bytes.NewReader(data)
+ decoder := jsoniter.NewDecoder(reader)
+ decoder.UseNumber()
+ return decoder.Decode(i)
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils/math_utils.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils/math_utils.go
new file mode 100644
index 0000000000..0839fa130f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils/math_utils.go
@@ -0,0 +1,64 @@
+// Copyright 2022 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package utils
+
+import (
+ "crypto/rand"
+ "math/big"
+)
+
+var reader = rand.Reader
+
+func Max32(x, y int32) int32 {
+ if x > y {
+ return x
+ }
+ return y
+}
+
+func Min32(x, y int32) int32 {
+ if x > y {
+ return y
+ }
+ return x
+}
+
+// RandInt32 生成一个随机数,有效区间是: [min, max), 其中要求 min > 0 & max > min
+func RandInt32(min, max int32) int32 {
+ if min <= 0 || max <= min {
+ return max
+ }
+
+ limit := big.NewInt(int64(max - min))
+ r, err := rand.Int(reader, limit)
+ if err != nil {
+ return max
+ }
+ return int32(r.Int64()) + min
+}
+
+func Pow32(x, y int32) int32 {
+ var ans int32 = 1
+ for y != 0 {
+ ans *= x
+ y--
+ }
+ return ans
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils/string_utils.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils/string_utils.go
new file mode 100644
index 0000000000..164ebe9528
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils/string_utils.go
@@ -0,0 +1,28 @@
+// Copyright 2020 Huawei Technologies Co.,Ltd.
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package utils
+
+import "strings"
+
+func UnderscoreToCamel(name string) string {
+ name = strings.Replace(name, "_", " ", -1)
+ name = strings.Title(name)
+ return strings.Replace(name, " ", "", -1)
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_ad_domain_info.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_ad_domain_info.go
new file mode 100644
index 0000000000..f4df75ab09
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_ad_domain_info.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// AdDomainInfo 域信息,加域实例单转主备时必填,非加域实例不需要填写
+type AdDomainInfo struct {
+
+ // 域管理员账号名
+ DomainAdminAccountName string `json:"domain_admin_account_name"`
+
+ // 域管理员密码
+ DomainAdminPwd string `json:"domain_admin_pwd"`
+}
+
+func (o AdDomainInfo) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "AdDomainInfo struct{}"
+ }
+
+ return strings.Join([]string{"AdDomainInfo", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_add_msdtc_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_add_msdtc_request_body.go
new file mode 100644
index 0000000000..2cdd35c80c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_add_msdtc_request_body.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type AddMsdtcRequestBody struct {
+
+ // 主机信息,key为hostname ,value 为IP
+ Hosts *[]MsdtcHostOption `json:"hosts,omitempty"`
+}
+
+func (o AddMsdtcRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "AddMsdtcRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"AddMsdtcRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_add_postgresql_hba_conf_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_add_postgresql_hba_conf_request.go
new file mode 100644
index 0000000000..e41d8a7896
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_add_postgresql_hba_conf_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// AddPostgresqlHbaConfRequest Request Object
+type AddPostgresqlHbaConfRequest struct {
+
+ // 实例id
+ InstanceId string `json:"instance_id"`
+
+ Body *[]PostgresqlHbaConf `json:"body,omitempty"`
+}
+
+func (o AddPostgresqlHbaConfRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "AddPostgresqlHbaConfRequest struct{}"
+ }
+
+ return strings.Join([]string{"AddPostgresqlHbaConfRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_add_postgresql_hba_conf_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_add_postgresql_hba_conf_response.go
new file mode 100644
index 0000000000..e93b9a56b2
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_add_postgresql_hba_conf_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// AddPostgresqlHbaConfResponse Response Object
+type AddPostgresqlHbaConfResponse struct {
+
+ // 结果码
+ Code *string `json:"code,omitempty"`
+
+ // 结果描述
+ Message *string `json:"message,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o AddPostgresqlHbaConfResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "AddPostgresqlHbaConfResponse struct{}"
+ }
+
+ return strings.Join([]string{"AddPostgresqlHbaConfResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_allow_db_privilege_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_allow_db_privilege_request.go
new file mode 100644
index 0000000000..e06f3e2b36
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_allow_db_privilege_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// AllowDbPrivilegeRequest Request Object
+type AllowDbPrivilegeRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *PostgresqlGrantRequest `json:"body,omitempty"`
+}
+
+func (o AllowDbPrivilegeRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "AllowDbPrivilegeRequest struct{}"
+ }
+
+ return strings.Join([]string{"AllowDbPrivilegeRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_allow_db_privilege_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_allow_db_privilege_response.go
new file mode 100644
index 0000000000..58fd477e81
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_allow_db_privilege_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// AllowDbPrivilegeResponse Response Object
+type AllowDbPrivilegeResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o AllowDbPrivilegeResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "AllowDbPrivilegeResponse struct{}"
+ }
+
+ return strings.Join([]string{"AllowDbPrivilegeResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_allow_db_user_privilege_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_allow_db_user_privilege_request.go
new file mode 100644
index 0000000000..49185d3e56
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_allow_db_user_privilege_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// AllowDbUserPrivilegeRequest Request Object
+type AllowDbUserPrivilegeRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *GrantRequest `json:"body,omitempty"`
+}
+
+func (o AllowDbUserPrivilegeRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "AllowDbUserPrivilegeRequest struct{}"
+ }
+
+ return strings.Join([]string{"AllowDbUserPrivilegeRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_allow_db_user_privilege_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_allow_db_user_privilege_response.go
new file mode 100644
index 0000000000..94366e9cab
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_allow_db_user_privilege_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// AllowDbUserPrivilegeResponse Response Object
+type AllowDbUserPrivilegeResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o AllowDbUserPrivilegeResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "AllowDbUserPrivilegeResponse struct{}"
+ }
+
+ return strings.Join([]string{"AllowDbUserPrivilegeResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_allow_sqlserver_db_user_privilege_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_allow_sqlserver_db_user_privilege_request.go
new file mode 100644
index 0000000000..0c2edf9a60
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_allow_sqlserver_db_user_privilege_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// AllowSqlserverDbUserPrivilegeRequest Request Object
+type AllowSqlserverDbUserPrivilegeRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *SqlserverGrantRequest `json:"body,omitempty"`
+}
+
+func (o AllowSqlserverDbUserPrivilegeRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "AllowSqlserverDbUserPrivilegeRequest struct{}"
+ }
+
+ return strings.Join([]string{"AllowSqlserverDbUserPrivilegeRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_allow_sqlserver_db_user_privilege_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_allow_sqlserver_db_user_privilege_response.go
new file mode 100644
index 0000000000..708c9fa48d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_allow_sqlserver_db_user_privilege_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// AllowSqlserverDbUserPrivilegeResponse Response Object
+type AllowSqlserverDbUserPrivilegeResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o AllowSqlserverDbUserPrivilegeResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "AllowSqlserverDbUserPrivilegeResponse struct{}"
+ }
+
+ return strings.Join([]string{"AllowSqlserverDbUserPrivilegeResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_api_version.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_api_version.go
new file mode 100644
index 0000000000..5a0aa019b5
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_api_version.go
@@ -0,0 +1,32 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ApiVersion API版本详细信息列表。
+type ApiVersion struct {
+
+ // API版本号,如v1、v3。
+ Id string `json:"id"`
+
+ // 对应API的链接信息,v1、v3版本该字段为空。
+ Links []LinksInfoResponse `json:"links"`
+
+ // 版本状态。 取值“CURRENT”,表示该版本为主推版本。 取值“DEPRECATED”,表示为废弃版本,存在后续删除的可能。
+ Status string `json:"status"`
+
+ // 版本更新时间。 格式为“yyyy-mm-dd Thh:mm:ssZ”。 其中,T指某个时间的开始;Z指UTC时间。
+ Updated string `json:"updated"`
+}
+
+func (o ApiVersion) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ApiVersion struct{}"
+ }
+
+ return strings.Join([]string{"ApiVersion", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_apply_configuration_async_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_apply_configuration_async_request.go
new file mode 100644
index 0000000000..dd67b5bb82
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_apply_configuration_async_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ApplyConfigurationAsyncRequest Request Object
+type ApplyConfigurationAsyncRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 参数模板ID。
+ ConfigId string `json:"config_id"`
+
+ Body *ApplyConfigurationRequest `json:"body,omitempty"`
+}
+
+func (o ApplyConfigurationAsyncRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ApplyConfigurationAsyncRequest struct{}"
+ }
+
+ return strings.Join([]string{"ApplyConfigurationAsyncRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_apply_configuration_async_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_apply_configuration_async_response.go
new file mode 100644
index 0000000000..c93bf90d47
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_apply_configuration_async_response.go
@@ -0,0 +1,33 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ApplyConfigurationAsyncResponse Response Object
+type ApplyConfigurationAsyncResponse struct {
+
+ // 参数组ID。
+ ConfigurationId *string `json:"configuration_id,omitempty"`
+
+ // 参数组名称。
+ ConfigurationName *string `json:"configuration_name,omitempty"`
+
+ // 参数模板是否都应用成功。 - “true”表示参数模板都应用成功。 - “false”表示存在应用失败的参数模板。
+ Success *bool `json:"success,omitempty"`
+
+ // 任务流id
+ JobId *string `json:"job_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ApplyConfigurationAsyncResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ApplyConfigurationAsyncResponse struct{}"
+ }
+
+ return strings.Join([]string{"ApplyConfigurationAsyncResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_apply_configuration_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_apply_configuration_request.go
new file mode 100644
index 0000000000..8c2ddb8714
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_apply_configuration_request.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ApplyConfigurationRequest struct {
+
+ // 实例ID列表。
+ InstanceIds []string `json:"instance_ids"`
+}
+
+func (o ApplyConfigurationRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ApplyConfigurationRequest struct{}"
+ }
+
+ return strings.Join([]string{"ApplyConfigurationRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_apply_configuration_response_apply_results.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_apply_configuration_response_apply_results.go
new file mode 100644
index 0000000000..c79cd71bfb
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_apply_configuration_response_apply_results.go
@@ -0,0 +1,31 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ApplyConfigurationResponseApplyResults struct {
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 实例名称。
+ InstanceName string `json:"instance_name"`
+
+ // 实例是否需要重启。 - “true”需要重启。 - “false”不需要重启。
+ RestartRequired bool `json:"restart_required"`
+
+ // 参数模板是否应用成功。 - “true”表示参数模板应用成功。 - “false”表示参数模板应用失败。
+ Success bool `json:"success"`
+}
+
+func (o ApplyConfigurationResponseApplyResults) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ApplyConfigurationResponseApplyResults struct{}"
+ }
+
+ return strings.Join([]string{"ApplyConfigurationResponseApplyResults", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_attach_eip_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_attach_eip_request.go
new file mode 100644
index 0000000000..f302baa515
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_attach_eip_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// AttachEipRequest Request Object
+type AttachEipRequest struct {
+
+ // 语言
+ XLanguage *AttachEipRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *BindEipRequest `json:"body,omitempty"`
+}
+
+func (o AttachEipRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "AttachEipRequest struct{}"
+ }
+
+ return strings.Join([]string{"AttachEipRequest", string(data)}, " ")
+}
+
+type AttachEipRequestXLanguage struct {
+ value string
+}
+
+type AttachEipRequestXLanguageEnum struct {
+ ZH_CN AttachEipRequestXLanguage
+ EN_US AttachEipRequestXLanguage
+}
+
+func GetAttachEipRequestXLanguageEnum() AttachEipRequestXLanguageEnum {
+ return AttachEipRequestXLanguageEnum{
+ ZH_CN: AttachEipRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: AttachEipRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c AttachEipRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c AttachEipRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *AttachEipRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_attach_eip_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_attach_eip_response.go
new file mode 100644
index 0000000000..23cbeab1e6
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_attach_eip_response.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// AttachEipResponse Response Object
+type AttachEipResponse struct {
+ HttpStatusCode int `json:"-"`
+}
+
+func (o AttachEipResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "AttachEipResponse struct{}"
+ }
+
+ return strings.Join([]string{"AttachEipResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_auditlog.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_auditlog.go
new file mode 100644
index 0000000000..6e3987790b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_auditlog.go
@@ -0,0 +1,35 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// Auditlog 审计日志信息。
+type Auditlog struct {
+
+ // 审计日志ID。
+ Id *string `json:"id,omitempty"`
+
+ // 审计日志文件名。
+ Name *string `json:"name,omitempty"`
+
+ // 审计日志大小,单位:KB。
+ Size *int64 `json:"size,omitempty"`
+
+ // 审计日志开始时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始,Z指时区偏移量,例如北京时间偏移显示为+0800。
+ BeginTime *string `json:"begin_time,omitempty"`
+
+ // 审计日志结束时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始,Z指时区偏移量,例如北京时间偏移显示为+0800。
+ EndTime *string `json:"end_time,omitempty"`
+}
+
+func (o Auditlog) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "Auditlog struct{}"
+ }
+
+ return strings.Join([]string{"Auditlog", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_available_zone.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_available_zone.go
new file mode 100644
index 0000000000..c3605b2421
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_available_zone.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type AvailableZone struct {
+
+ // 可用区编码。
+ Code string `json:"code"`
+
+ // 可用区描述。
+ Description string `json:"description"`
+}
+
+func (o AvailableZone) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "AvailableZone struct{}"
+ }
+
+ return strings.Join([]string{"AvailableZone", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_database.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_database.go
new file mode 100644
index 0000000000..a1e86058e6
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_database.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type BackupDatabase struct {
+
+ // SqlServer引擎指定备份的数据库。
+ Name string `json:"name"`
+}
+
+func (o BackupDatabase) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BackupDatabase struct{}"
+ }
+
+ return strings.Join([]string{"BackupDatabase", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_datastore.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_datastore.go
new file mode 100644
index 0000000000..84b57eff0c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_datastore.go
@@ -0,0 +1,83 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+type BackupDatastore struct {
+
+ // 数据库引擎,不区分大小写: - MySQL - PostgreSQL - SQLServer - MariaDB
+ Type BackupDatastoreType `json:"type"`
+
+ // 数据库版本。
+ Version string `json:"version"`
+}
+
+func (o BackupDatastore) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BackupDatastore struct{}"
+ }
+
+ return strings.Join([]string{"BackupDatastore", string(data)}, " ")
+}
+
+type BackupDatastoreType struct {
+ value string
+}
+
+type BackupDatastoreTypeEnum struct {
+ MY_SQL BackupDatastoreType
+ POSTGRE_SQL BackupDatastoreType
+ SQL_SERVER BackupDatastoreType
+ MARIA_DB BackupDatastoreType
+}
+
+func GetBackupDatastoreTypeEnum() BackupDatastoreTypeEnum {
+ return BackupDatastoreTypeEnum{
+ MY_SQL: BackupDatastoreType{
+ value: "MySQL",
+ },
+ POSTGRE_SQL: BackupDatastoreType{
+ value: "PostgreSQL",
+ },
+ SQL_SERVER: BackupDatastoreType{
+ value: "SQLServer",
+ },
+ MARIA_DB: BackupDatastoreType{
+ value: "MariaDB",
+ },
+ }
+}
+
+func (c BackupDatastoreType) Value() string {
+ return c.value
+}
+
+func (c BackupDatastoreType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *BackupDatastoreType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_for_list.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_for_list.go
new file mode 100644
index 0000000000..2c605cd1eb
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_for_list.go
@@ -0,0 +1,165 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// BackupForList 备份信息。
+type BackupForList struct {
+
+ // 备份ID。
+ Id string `json:"id"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 备份名称。
+ Name string `json:"name"`
+
+ // 备份的数据库。
+ Databases *[]BackupDatabase `json:"databases,omitempty"`
+
+ // 备份开始时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ BeginTime string `json:"begin_time"`
+
+ // 备份结束时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ EndTime string `json:"end_time"`
+
+ // 备份状态,取值: - BUILDING: 备份中。 - COMPLETED: 备份完成。 - FAILED:备份失败。 - DELETING:备份删除中。
+ Status BackupForListStatus `json:"status"`
+
+ // 备份类型,取值: - “auto”: 自动全量备份 - “manual”: 手动全量备份 - “fragment”: 差异全量备份 - “incremental”: 自动增量备份
+ Type BackupForListType `json:"type"`
+
+ // 备份大小,单位为KB。
+ Size int64 `json:"size"`
+
+ Datastore *BackupDatastore `json:"datastore"`
+
+ // 是否已被DDM实例关联。
+ AssociatedWithDdm *bool `json:"associated_with_ddm,omitempty"`
+}
+
+func (o BackupForList) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BackupForList struct{}"
+ }
+
+ return strings.Join([]string{"BackupForList", string(data)}, " ")
+}
+
+type BackupForListStatus struct {
+ value string
+}
+
+type BackupForListStatusEnum struct {
+ BUILDING BackupForListStatus
+ COMPLETED BackupForListStatus
+ FAILED BackupForListStatus
+ DELETING BackupForListStatus
+}
+
+func GetBackupForListStatusEnum() BackupForListStatusEnum {
+ return BackupForListStatusEnum{
+ BUILDING: BackupForListStatus{
+ value: "BUILDING",
+ },
+ COMPLETED: BackupForListStatus{
+ value: "COMPLETED",
+ },
+ FAILED: BackupForListStatus{
+ value: "FAILED",
+ },
+ DELETING: BackupForListStatus{
+ value: "DELETING",
+ },
+ }
+}
+
+func (c BackupForListStatus) Value() string {
+ return c.value
+}
+
+func (c BackupForListStatus) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *BackupForListStatus) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
+
+type BackupForListType struct {
+ value string
+}
+
+type BackupForListTypeEnum struct {
+ AUTO BackupForListType
+ MANUAL BackupForListType
+ FRAGMENT BackupForListType
+ INCREMENTAL BackupForListType
+}
+
+func GetBackupForListTypeEnum() BackupForListTypeEnum {
+ return BackupForListTypeEnum{
+ AUTO: BackupForListType{
+ value: "auto",
+ },
+ MANUAL: BackupForListType{
+ value: "manual",
+ },
+ FRAGMENT: BackupForListType{
+ value: "fragment",
+ },
+ INCREMENTAL: BackupForListType{
+ value: "incremental",
+ },
+ }
+}
+
+func (c BackupForListType) Value() string {
+ return c.value
+}
+
+func (c BackupForListType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *BackupForListType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_info.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_info.go
new file mode 100644
index 0000000000..1cd98d5d5a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_info.go
@@ -0,0 +1,157 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// BackupInfo 备份信息。
+type BackupInfo struct {
+
+ // 备份ID。
+ Id string `json:"id"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 备份名称。
+ Name string `json:"name"`
+
+ // 备份描述。
+ Description *string `json:"description,omitempty"`
+
+ // 只支持Microsoft SQL Server,局部备份的用户自建数据库名列表,当有此参数时以局部备份为准。
+ Databases *[]BackupDatabase `json:"databases,omitempty"`
+
+ // 备份开始时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ BeginTime string `json:"begin_time"`
+
+ // 备份状态,取值: - BUILDING: 备份中。 - COMPLETED: 备份完成。 - FAILED:备份失败。 - DELETING:备份删除中。
+ Status BackupInfoStatus `json:"status"`
+
+ // 备份类型,取值: - “auto”: 自动全量备份 - “manual”: 手动全量备份 - “fragment”: 差异全量备份 - “incremental”: 自动增量备份
+ Type BackupInfoType `json:"type"`
+}
+
+func (o BackupInfo) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BackupInfo struct{}"
+ }
+
+ return strings.Join([]string{"BackupInfo", string(data)}, " ")
+}
+
+type BackupInfoStatus struct {
+ value string
+}
+
+type BackupInfoStatusEnum struct {
+ BUILDING BackupInfoStatus
+ COMPLETED BackupInfoStatus
+ FAILED BackupInfoStatus
+ DELETING BackupInfoStatus
+}
+
+func GetBackupInfoStatusEnum() BackupInfoStatusEnum {
+ return BackupInfoStatusEnum{
+ BUILDING: BackupInfoStatus{
+ value: "BUILDING",
+ },
+ COMPLETED: BackupInfoStatus{
+ value: "COMPLETED",
+ },
+ FAILED: BackupInfoStatus{
+ value: "FAILED",
+ },
+ DELETING: BackupInfoStatus{
+ value: "DELETING",
+ },
+ }
+}
+
+func (c BackupInfoStatus) Value() string {
+ return c.value
+}
+
+func (c BackupInfoStatus) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *BackupInfoStatus) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
+
+type BackupInfoType struct {
+ value string
+}
+
+type BackupInfoTypeEnum struct {
+ AUTO BackupInfoType
+ MANUAL BackupInfoType
+ FRAGMENT BackupInfoType
+ INCREMENTAL BackupInfoType
+}
+
+func GetBackupInfoTypeEnum() BackupInfoTypeEnum {
+ return BackupInfoTypeEnum{
+ AUTO: BackupInfoType{
+ value: "auto",
+ },
+ MANUAL: BackupInfoType{
+ value: "manual",
+ },
+ FRAGMENT: BackupInfoType{
+ value: "fragment",
+ },
+ INCREMENTAL: BackupInfoType{
+ value: "incremental",
+ },
+ }
+}
+
+func (c BackupInfoType) Value() string {
+ return c.value
+}
+
+func (c BackupInfoType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *BackupInfoType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_policy.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_policy.go
new file mode 100644
index 0000000000..47522d1325
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_policy.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// BackupPolicy 备份策略信息。
+type BackupPolicy struct {
+
+ // 指定已生成的备份文件可以保存的天数。 取值范围:0~732。取0值,表示关闭自动备份策略。如果需要延长保留时间请联系客服人员申请,自动备份最长可以保留2562天。 注意: 关闭备份策略后,备份任务将立即停止,所有增量备份任务将立即删除,使用增量备份的相关操作可能失败,相关操作不限于下载、复制、恢复、重建等,请谨慎操作。
+ KeepDays int32 `json:"keep_days"`
+
+ // 备份时间段。自动备份将在该时间段内触发。除关闭自动备份策略外,必选。 取值范围:格式必须为hh:mm-HH:MM且有效,当前时间指UTC时间。 - HH取值必须比hh大1。 - mm和MM取值必须相同,且取值必须为00、15、30或45。
+ StartTime *string `json:"start_time,omitempty"`
+
+ // 备份周期配置。自动备份将在每星期指定的天进行。除关闭自动备份策略外,必选。 取值范围:格式为逗号隔开的数字,数字代表星期。
+ Period *string `json:"period,omitempty"`
+}
+
+func (o BackupPolicy) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BackupPolicy struct{}"
+ }
+
+ return strings.Join([]string{"BackupPolicy", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_strategy.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_strategy.go
new file mode 100644
index 0000000000..4727951fad
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_strategy.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// BackupStrategy 自动备份策略。
+type BackupStrategy struct {
+
+ // 备份时间段。自动备份将在该时间段内触发。 取值范围:非空,格式必须为hh:mm-HH:MM且有效,当前时间指UTC时间。 HH取值必须比hh大1。 mm和MM取值必须相同,且取值必须为00、15、30或45。
+ StartTime string `json:"start_time"`
+
+ // 指定备份文件的可保存天数。 取值范围:0~732。该参数缺省,或取值为0,表示关闭自动备份策略。如果需要延长保留时间请联系客服人员申请,自动备份最长可以保留2562天。 说明:SQL Server的HA实例不支持关闭自动备份策略。
+ KeepDays *int32 `json:"keep_days,omitempty"`
+}
+
+func (o BackupStrategy) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BackupStrategy struct{}"
+ }
+
+ return strings.Join([]string{"BackupStrategy", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_strategy_for_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_strategy_for_response.go
new file mode 100644
index 0000000000..d0007e8398
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_backup_strategy_for_response.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// BackupStrategyForResponse 自动备份策略。
+type BackupStrategyForResponse struct {
+
+ // 备份时间段。自动备份将在该时间段内触发。 取值范围:非空,格式必须为hh:mm-HH:MM且有效,当前时间指UTC时间。 HH取值必须比hh大1。 mm和MM取值必须相同,且取值必须为00、15、30或45。
+ StartTime string `json:"start_time"`
+
+ // 指定备份文件的可保存天数。 取值范围:0~732。该参数缺省,或取值为0,表示关闭自动备份策略。如果需要延长保留时间请联系客服人员申请,自动备份最长可以保留2562天。 说明:SQL Server的HA实例不支持关闭自动备份策略。
+ KeepDays int32 `json:"keep_days"`
+}
+
+func (o BackupStrategyForResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BackupStrategyForResponse struct{}"
+ }
+
+ return strings.Join([]string{"BackupStrategyForResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_add_msdtcs_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_add_msdtcs_request.go
new file mode 100644
index 0000000000..196c2847f6
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_add_msdtcs_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// BatchAddMsdtcsRequest Request Object
+type BatchAddMsdtcsRequest struct {
+
+ // 实例ID
+ InstanceId string `json:"instance_id"`
+
+ Body *AddMsdtcRequestBody `json:"body,omitempty"`
+}
+
+func (o BatchAddMsdtcsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BatchAddMsdtcsRequest struct{}"
+ }
+
+ return strings.Join([]string{"BatchAddMsdtcsRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_add_msdtcs_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_add_msdtcs_response.go
new file mode 100644
index 0000000000..75b889adde
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_add_msdtcs_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// BatchAddMsdtcsResponse Response Object
+type BatchAddMsdtcsResponse struct {
+
+ // 任务流id
+ JobId *string `json:"job_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o BatchAddMsdtcsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BatchAddMsdtcsResponse struct{}"
+ }
+
+ return strings.Join([]string{"BatchAddMsdtcsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_delete_backup_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_delete_backup_request_body.go
new file mode 100644
index 0000000000..28f7b23304
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_delete_backup_request_body.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type BatchDeleteBackupRequestBody struct {
+
+ // 需要删除的手动备份ID列表。列表大小范围:[1-50]
+ BackupIds []string `json:"backup_ids"`
+}
+
+func (o BatchDeleteBackupRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BatchDeleteBackupRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"BatchDeleteBackupRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_delete_manual_backup_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_delete_manual_backup_request.go
new file mode 100644
index 0000000000..2004ab44e2
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_delete_manual_backup_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// BatchDeleteManualBackupRequest Request Object
+type BatchDeleteManualBackupRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ Body *BatchDeleteBackupRequestBody `json:"body,omitempty"`
+}
+
+func (o BatchDeleteManualBackupRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BatchDeleteManualBackupRequest struct{}"
+ }
+
+ return strings.Join([]string{"BatchDeleteManualBackupRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_delete_manual_backup_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_delete_manual_backup_response.go
new file mode 100644
index 0000000000..f936083594
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_delete_manual_backup_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// BatchDeleteManualBackupResponse Response Object
+type BatchDeleteManualBackupResponse struct {
+
+ // 备份删除结果
+ DeleteResults *[]DeleteBackupResult `json:"delete_results,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o BatchDeleteManualBackupResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BatchDeleteManualBackupResponse struct{}"
+ }
+
+ return strings.Join([]string{"BatchDeleteManualBackupResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_restore_database_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_restore_database_request.go
new file mode 100644
index 0000000000..e19f2cfa6e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_restore_database_request.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// BatchRestoreDatabaseRequest Request Object
+type BatchRestoreDatabaseRequest struct {
+ Body *PostgreSqlRestoreDatabaseRequest `json:"body,omitempty"`
+}
+
+func (o BatchRestoreDatabaseRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BatchRestoreDatabaseRequest struct{}"
+ }
+
+ return strings.Join([]string{"BatchRestoreDatabaseRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_restore_database_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_restore_database_response.go
new file mode 100644
index 0000000000..f8ea9c6577
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_restore_database_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// BatchRestoreDatabaseResponse Response Object
+type BatchRestoreDatabaseResponse struct {
+
+ // 表信息
+ RestoreResult *[]PostgreSqlRestoreResult `json:"restore_result,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o BatchRestoreDatabaseResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BatchRestoreDatabaseResponse struct{}"
+ }
+
+ return strings.Join([]string{"BatchRestoreDatabaseResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_restore_postgre_sql_tables_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_restore_postgre_sql_tables_request.go
new file mode 100644
index 0000000000..9a02de865d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_restore_postgre_sql_tables_request.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// BatchRestorePostgreSqlTablesRequest Request Object
+type BatchRestorePostgreSqlTablesRequest struct {
+ Body *PostgreSqlRestoreTableRequest `json:"body,omitempty"`
+}
+
+func (o BatchRestorePostgreSqlTablesRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BatchRestorePostgreSqlTablesRequest struct{}"
+ }
+
+ return strings.Join([]string{"BatchRestorePostgreSqlTablesRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_restore_postgre_sql_tables_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_restore_postgre_sql_tables_response.go
new file mode 100644
index 0000000000..24d89704e1
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_restore_postgre_sql_tables_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// BatchRestorePostgreSqlTablesResponse Response Object
+type BatchRestorePostgreSqlTablesResponse struct {
+
+ // 表信息
+ RestoreResult *[]PostgreSqlRestoreResult `json:"restore_result,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o BatchRestorePostgreSqlTablesResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BatchRestorePostgreSqlTablesResponse struct{}"
+ }
+
+ return strings.Join([]string{"BatchRestorePostgreSqlTablesResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_tag_action_add_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_tag_action_add_request_body.go
new file mode 100644
index 0000000000..f47bfb73b7
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_tag_action_add_request_body.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type BatchTagActionAddRequestBody struct {
+
+ // 操作标识(区分大小写):创建时为“create”。
+ Action string `json:"action"`
+
+ // 标签列表。单个实例总标签数上限20个。
+ Tags []TagWithKeyValue `json:"tags"`
+}
+
+func (o BatchTagActionAddRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BatchTagActionAddRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"BatchTagActionAddRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_tag_action_del_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_tag_action_del_request_body.go
new file mode 100644
index 0000000000..bede383457
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_tag_action_del_request_body.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type BatchTagActionDelRequestBody struct {
+
+ // 操作标识(区分大小写):删除时为“delete”。
+ Action string `json:"action"`
+
+ // 标签列表。单个实例总标签数上限20个。
+ Tags []TagDelWithKeyValue `json:"tags"`
+}
+
+func (o BatchTagActionDelRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BatchTagActionDelRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"BatchTagActionDelRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_tag_add_action_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_tag_add_action_request.go
new file mode 100644
index 0000000000..baf95cfaee
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_tag_add_action_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// BatchTagAddActionRequest Request Object
+type BatchTagAddActionRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *BatchTagActionAddRequestBody `json:"body,omitempty"`
+}
+
+func (o BatchTagAddActionRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BatchTagAddActionRequest struct{}"
+ }
+
+ return strings.Join([]string{"BatchTagAddActionRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_tag_add_action_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_tag_add_action_response.go
new file mode 100644
index 0000000000..4da0567cc7
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_tag_add_action_response.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// BatchTagAddActionResponse Response Object
+type BatchTagAddActionResponse struct {
+ HttpStatusCode int `json:"-"`
+}
+
+func (o BatchTagAddActionResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BatchTagAddActionResponse struct{}"
+ }
+
+ return strings.Join([]string{"BatchTagAddActionResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_tag_del_action_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_tag_del_action_request.go
new file mode 100644
index 0000000000..ffab22ce65
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_tag_del_action_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// BatchTagDelActionRequest Request Object
+type BatchTagDelActionRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *BatchTagActionDelRequestBody `json:"body,omitempty"`
+}
+
+func (o BatchTagDelActionRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BatchTagDelActionRequest struct{}"
+ }
+
+ return strings.Join([]string{"BatchTagDelActionRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_tag_del_action_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_tag_del_action_response.go
new file mode 100644
index 0000000000..4426466f7e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_batch_tag_del_action_response.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// BatchTagDelActionResponse Response Object
+type BatchTagDelActionResponse struct {
+ HttpStatusCode int `json:"-"`
+}
+
+func (o BatchTagDelActionResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BatchTagDelActionResponse struct{}"
+ }
+
+ return strings.Join([]string{"BatchTagDelActionResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_bind_eip_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_bind_eip_request.go
new file mode 100644
index 0000000000..da118123da
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_bind_eip_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type BindEipRequest struct {
+
+ // 待绑定的弹性公网IP地址,仅允许使用标准的IP地址格式。is_bind为true时必选
+ PublicIp *string `json:"public_ip,omitempty"`
+
+ // 弹性公网IP对应的ID,仅允许使用标准的UUID格式。is_bind为true时必选
+ PublicIpId *string `json:"public_ip_id,omitempty"`
+
+ // - true,绑定弹性公网IP。 - false,解绑弹性公网IP。
+ IsBind bool `json:"is_bind"`
+}
+
+func (o BindEipRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BindEipRequest struct{}"
+ }
+
+ return strings.Join([]string{"BindEipRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_binlog_clear_policy_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_binlog_clear_policy_request_body.go
new file mode 100644
index 0000000000..e9274469ae
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_binlog_clear_policy_request_body.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type BinlogClearPolicyRequestBody struct {
+
+ // 取值范围0-7*24
+ BinlogRetentionHours int64 `json:"binlog_retention_hours"`
+}
+
+func (o BinlogClearPolicyRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "BinlogClearPolicyRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"BinlogClearPolicyRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_failover_mode_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_failover_mode_request.go
new file mode 100644
index 0000000000..d8677a6a48
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_failover_mode_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ChangeFailoverModeRequest Request Object
+type ChangeFailoverModeRequest struct {
+
+ // 语言
+ XLanguage *ChangeFailoverModeRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *FailoverModeRequest `json:"body,omitempty"`
+}
+
+func (o ChangeFailoverModeRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ChangeFailoverModeRequest struct{}"
+ }
+
+ return strings.Join([]string{"ChangeFailoverModeRequest", string(data)}, " ")
+}
+
+type ChangeFailoverModeRequestXLanguage struct {
+ value string
+}
+
+type ChangeFailoverModeRequestXLanguageEnum struct {
+ ZH_CN ChangeFailoverModeRequestXLanguage
+ EN_US ChangeFailoverModeRequestXLanguage
+}
+
+func GetChangeFailoverModeRequestXLanguageEnum() ChangeFailoverModeRequestXLanguageEnum {
+ return ChangeFailoverModeRequestXLanguageEnum{
+ ZH_CN: ChangeFailoverModeRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: ChangeFailoverModeRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c ChangeFailoverModeRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c ChangeFailoverModeRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ChangeFailoverModeRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_failover_mode_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_failover_mode_response.go
new file mode 100644
index 0000000000..b9fd646bb4
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_failover_mode_response.go
@@ -0,0 +1,30 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ChangeFailoverModeResponse Response Object
+type ChangeFailoverModeResponse struct {
+
+ // 实例Id
+ InstanceId *string `json:"instanceId,omitempty"`
+
+ // 同步模式
+ ReplicationMode *string `json:"replicationMode,omitempty"`
+
+ // 任务id
+ WorkflowId *string `json:"workflowId,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ChangeFailoverModeResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ChangeFailoverModeResponse struct{}"
+ }
+
+ return strings.Join([]string{"ChangeFailoverModeResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_failover_strategy_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_failover_strategy_request.go
new file mode 100644
index 0000000000..eb1669e980
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_failover_strategy_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ChangeFailoverStrategyRequest Request Object
+type ChangeFailoverStrategyRequest struct {
+
+ // 语言
+ XLanguage *ChangeFailoverStrategyRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *FailoverStrategyRequest `json:"body,omitempty"`
+}
+
+func (o ChangeFailoverStrategyRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ChangeFailoverStrategyRequest struct{}"
+ }
+
+ return strings.Join([]string{"ChangeFailoverStrategyRequest", string(data)}, " ")
+}
+
+type ChangeFailoverStrategyRequestXLanguage struct {
+ value string
+}
+
+type ChangeFailoverStrategyRequestXLanguageEnum struct {
+ ZH_CN ChangeFailoverStrategyRequestXLanguage
+ EN_US ChangeFailoverStrategyRequestXLanguage
+}
+
+func GetChangeFailoverStrategyRequestXLanguageEnum() ChangeFailoverStrategyRequestXLanguageEnum {
+ return ChangeFailoverStrategyRequestXLanguageEnum{
+ ZH_CN: ChangeFailoverStrategyRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: ChangeFailoverStrategyRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c ChangeFailoverStrategyRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c ChangeFailoverStrategyRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ChangeFailoverStrategyRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_failover_strategy_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_failover_strategy_response.go
new file mode 100644
index 0000000000..99e9638ec9
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_failover_strategy_response.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ChangeFailoverStrategyResponse Response Object
+type ChangeFailoverStrategyResponse struct {
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ChangeFailoverStrategyResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ChangeFailoverStrategyResponse struct{}"
+ }
+
+ return strings.Join([]string{"ChangeFailoverStrategyResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_ops_window_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_ops_window_request.go
new file mode 100644
index 0000000000..a9cb0551f9
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_ops_window_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ChangeOpsWindowRequest Request Object
+type ChangeOpsWindowRequest struct {
+
+ // 语言
+ XLanguage *ChangeOpsWindowRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *OpsWindowRequest `json:"body,omitempty"`
+}
+
+func (o ChangeOpsWindowRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ChangeOpsWindowRequest struct{}"
+ }
+
+ return strings.Join([]string{"ChangeOpsWindowRequest", string(data)}, " ")
+}
+
+type ChangeOpsWindowRequestXLanguage struct {
+ value string
+}
+
+type ChangeOpsWindowRequestXLanguageEnum struct {
+ ZH_CN ChangeOpsWindowRequestXLanguage
+ EN_US ChangeOpsWindowRequestXLanguage
+}
+
+func GetChangeOpsWindowRequestXLanguageEnum() ChangeOpsWindowRequestXLanguageEnum {
+ return ChangeOpsWindowRequestXLanguageEnum{
+ ZH_CN: ChangeOpsWindowRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: ChangeOpsWindowRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c ChangeOpsWindowRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c ChangeOpsWindowRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ChangeOpsWindowRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_ops_window_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_ops_window_response.go
new file mode 100644
index 0000000000..9d2b5bc556
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_ops_window_response.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ChangeOpsWindowResponse Response Object
+type ChangeOpsWindowResponse struct {
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ChangeOpsWindowResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ChangeOpsWindowResponse struct{}"
+ }
+
+ return strings.Join([]string{"ChangeOpsWindowResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_proxy_scale_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_proxy_scale_request.go
new file mode 100644
index 0000000000..db96d4d801
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_proxy_scale_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ChangeProxyScaleRequest Request Object
+type ChangeProxyScaleRequest struct {
+
+ // 语言
+ XLanguage *ChangeProxyScaleRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *ScaleProxyRequestBody `json:"body,omitempty"`
+}
+
+func (o ChangeProxyScaleRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ChangeProxyScaleRequest struct{}"
+ }
+
+ return strings.Join([]string{"ChangeProxyScaleRequest", string(data)}, " ")
+}
+
+type ChangeProxyScaleRequestXLanguage struct {
+ value string
+}
+
+type ChangeProxyScaleRequestXLanguageEnum struct {
+ ZH_CN ChangeProxyScaleRequestXLanguage
+ EN_US ChangeProxyScaleRequestXLanguage
+}
+
+func GetChangeProxyScaleRequestXLanguageEnum() ChangeProxyScaleRequestXLanguageEnum {
+ return ChangeProxyScaleRequestXLanguageEnum{
+ ZH_CN: ChangeProxyScaleRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: ChangeProxyScaleRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c ChangeProxyScaleRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c ChangeProxyScaleRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ChangeProxyScaleRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_proxy_scale_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_proxy_scale_response.go
new file mode 100644
index 0000000000..21bea6d7c2
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_proxy_scale_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ChangeProxyScaleResponse Response Object
+type ChangeProxyScaleResponse struct {
+
+ // 任务ID。
+ JobId *string `json:"job_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ChangeProxyScaleResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ChangeProxyScaleResponse struct{}"
+ }
+
+ return strings.Join([]string{"ChangeProxyScaleResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_the_delay_threshold_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_the_delay_threshold_request.go
new file mode 100644
index 0000000000..1fe5632fe0
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_the_delay_threshold_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ChangeTheDelayThresholdRequest Request Object
+type ChangeTheDelayThresholdRequest struct {
+
+ // 语言
+ XLanguage *ChangeTheDelayThresholdRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *ChangingTheDelayThresholdRequestBody `json:"body,omitempty"`
+}
+
+func (o ChangeTheDelayThresholdRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ChangeTheDelayThresholdRequest struct{}"
+ }
+
+ return strings.Join([]string{"ChangeTheDelayThresholdRequest", string(data)}, " ")
+}
+
+type ChangeTheDelayThresholdRequestXLanguage struct {
+ value string
+}
+
+type ChangeTheDelayThresholdRequestXLanguageEnum struct {
+ ZH_CN ChangeTheDelayThresholdRequestXLanguage
+ EN_US ChangeTheDelayThresholdRequestXLanguage
+}
+
+func GetChangeTheDelayThresholdRequestXLanguageEnum() ChangeTheDelayThresholdRequestXLanguageEnum {
+ return ChangeTheDelayThresholdRequestXLanguageEnum{
+ ZH_CN: ChangeTheDelayThresholdRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: ChangeTheDelayThresholdRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c ChangeTheDelayThresholdRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c ChangeTheDelayThresholdRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ChangeTheDelayThresholdRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_the_delay_threshold_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_the_delay_threshold_response.go
new file mode 100644
index 0000000000..f9fc5feba7
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_change_the_delay_threshold_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ChangeTheDelayThresholdResponse Response Object
+type ChangeTheDelayThresholdResponse struct {
+
+ // 修改读写分离权重或延时阈值的结果。
+ Result *string `json:"result,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ChangeTheDelayThresholdResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ChangeTheDelayThresholdResponse struct{}"
+ }
+
+ return strings.Join([]string{"ChangeTheDelayThresholdResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_changing_the_delay_threshold_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_changing_the_delay_threshold_request_body.go
new file mode 100644
index 0000000000..0d06035f72
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_changing_the_delay_threshold_request_body.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ChangingTheDelayThresholdRequestBody struct {
+
+ // 延时阈值(单位:KB),取值范围为0~10485760。
+ DelayThresholdInKilobytes int32 `json:"delay_threshold_in_kilobytes"`
+}
+
+func (o ChangingTheDelayThresholdRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ChangingTheDelayThresholdRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"ChangingTheDelayThresholdRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_charge_info.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_charge_info.go
new file mode 100644
index 0000000000..c1dd8644a4
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_charge_info.go
@@ -0,0 +1,132 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ChargeInfo 计费类型信息,支持包年包月和按需,默认为按需。
+type ChargeInfo struct {
+
+ // 计费模式。 取值范围: - prePaid:预付费,即包年/包月。 - postPaid:后付费,即按需付费。
+ ChargeMode ChargeInfoChargeMode `json:"charge_mode"`
+
+ // 订购周期类型。 取值范围: - month:包月。 - year:包年。
+ PeriodType *ChargeInfoPeriodType `json:"period_type,omitempty"`
+
+ // “charge_mode”为“prePaid”时生效,且为必选值,指定订购的时间。 取值范围: 当“period_type”为“month”时,取值为1~9。 当“period_type”为“year”时,取值为1~3。
+ PeriodNum *int32 `json:"period_num,omitempty"`
+
+ // 创建包周期实例时可指定,表示是否自动续订,续订的周期和原周期相同,且续订时会自动支付。 - true,为自动续订。 - false,为不自动续订,默认该方式。
+ IsAutoRenew *bool `json:"is_auto_renew,omitempty"`
+
+ // 创建包周期时可指定,表示是否自动从客户的账户中支付,此字段不影响自动续订的支付方式。 - true,为自动支付。 - false,为手动支付,默认该方式。
+ IsAutoPay *bool `json:"is_auto_pay,omitempty"`
+}
+
+func (o ChargeInfo) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ChargeInfo struct{}"
+ }
+
+ return strings.Join([]string{"ChargeInfo", string(data)}, " ")
+}
+
+type ChargeInfoChargeMode struct {
+ value string
+}
+
+type ChargeInfoChargeModeEnum struct {
+ PRE_PAID ChargeInfoChargeMode
+ POST_PAID ChargeInfoChargeMode
+}
+
+func GetChargeInfoChargeModeEnum() ChargeInfoChargeModeEnum {
+ return ChargeInfoChargeModeEnum{
+ PRE_PAID: ChargeInfoChargeMode{
+ value: "prePaid",
+ },
+ POST_PAID: ChargeInfoChargeMode{
+ value: "postPaid",
+ },
+ }
+}
+
+func (c ChargeInfoChargeMode) Value() string {
+ return c.value
+}
+
+func (c ChargeInfoChargeMode) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ChargeInfoChargeMode) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
+
+type ChargeInfoPeriodType struct {
+ value string
+}
+
+type ChargeInfoPeriodTypeEnum struct {
+ MONTH ChargeInfoPeriodType
+ YEAR ChargeInfoPeriodType
+}
+
+func GetChargeInfoPeriodTypeEnum() ChargeInfoPeriodTypeEnum {
+ return ChargeInfoPeriodTypeEnum{
+ MONTH: ChargeInfoPeriodType{
+ value: "month",
+ },
+ YEAR: ChargeInfoPeriodType{
+ value: "year",
+ },
+ }
+}
+
+func (c ChargeInfoPeriodType) Value() string {
+ return c.value
+}
+
+func (c ChargeInfoPeriodType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ChargeInfoPeriodType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_charge_info_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_charge_info_response.go
new file mode 100644
index 0000000000..42b2798196
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_charge_info_response.go
@@ -0,0 +1,73 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ChargeInfoResponse 计费类型信息,支持包年包月和按需,默认为按需。
+type ChargeInfoResponse struct {
+
+ // 计费模式。 取值范围: - prePaid:预付费,即包年/包月。 - postPaid:后付费,即按需付费。
+ ChargeMode ChargeInfoResponseChargeMode `json:"charge_mode"`
+}
+
+func (o ChargeInfoResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ChargeInfoResponse struct{}"
+ }
+
+ return strings.Join([]string{"ChargeInfoResponse", string(data)}, " ")
+}
+
+type ChargeInfoResponseChargeMode struct {
+ value string
+}
+
+type ChargeInfoResponseChargeModeEnum struct {
+ PRE_PAID ChargeInfoResponseChargeMode
+ POST_PAID ChargeInfoResponseChargeMode
+}
+
+func GetChargeInfoResponseChargeModeEnum() ChargeInfoResponseChargeModeEnum {
+ return ChargeInfoResponseChargeModeEnum{
+ PRE_PAID: ChargeInfoResponseChargeMode{
+ value: "prePaid",
+ },
+ POST_PAID: ChargeInfoResponseChargeMode{
+ value: "postPaid",
+ },
+ }
+}
+
+func (c ChargeInfoResponseChargeMode) Value() string {
+ return c.value
+}
+
+func (c ChargeInfoResponseChargeMode) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ChargeInfoResponseChargeMode) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_computes.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_computes.go
new file mode 100644
index 0000000000..ee37ef8a1a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_computes.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type Computes struct {
+
+ // 群组类型。 - X86:X86架构。 - ARM:ARM架构。
+ GroupType *string `json:"group_type,omitempty"`
+
+ // 计算规格信息。
+ ComputeFlavors *[]ScaleFlavors `json:"compute_flavors,omitempty"`
+}
+
+func (o Computes) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "Computes struct{}"
+ }
+
+ return strings.Join([]string{"Computes", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_configuration_copy_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_configuration_copy_request_body.go
new file mode 100644
index 0000000000..c10c086a6b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_configuration_copy_request_body.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ConfigurationCopyRequestBody struct {
+
+ // 只支持a-zA-Z0-9._- 以上字符,长度限制1-64字符
+ Name string `json:"name"`
+
+ // 不支持 !<>=&\" ' 字符,长度限制0-256字符
+ Description *string `json:"description,omitempty"`
+}
+
+func (o ConfigurationCopyRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ConfigurationCopyRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"ConfigurationCopyRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_configuration_for_creation.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_configuration_for_creation.go
new file mode 100644
index 0000000000..72d3a1c038
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_configuration_for_creation.go
@@ -0,0 +1,30 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ConfigurationForCreation struct {
+
+ // 参数模板名称。最长64个字符,只允许大写字母、小写字母、数字、和“-_.”特殊字符。
+ Name string `json:"name"`
+
+ // 参数模板描述。最长256个字符,不支持>!<\"&'=特殊字符。默认为空。
+ Description *string `json:"description,omitempty"`
+
+ Datastore *ParaGroupDatastore `json:"datastore"`
+
+ // 参数值对象,用户基于默认参数模板自定义的参数值。为空时不修改参数值。 - key:参数名称,\"max_connections\":\"10\"。为空时不修改参数值,key不为空时value也不可为空。 - value:参数值,\"max_connections\":\"10\"。
+ Values map[string]string `json:"values,omitempty"`
+}
+
+func (o ConfigurationForCreation) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ConfigurationForCreation struct{}"
+ }
+
+ return strings.Join([]string{"ConfigurationForCreation", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_configuration_for_update.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_configuration_for_update.go
new file mode 100644
index 0000000000..90a0bcdb9c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_configuration_for_update.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ConfigurationForUpdate struct {
+
+ // 参数模板名称。最长64个字符,只允许大写字母、小写字母、数字、和“-_.”特殊字符。
+ Name *string `json:"name,omitempty"`
+
+ // 参数模板描述。最长256个字符,不支持>!<\"&'=特殊字符。默认为空。
+ Description *string `json:"description,omitempty"`
+
+ // 参数值对象,用户基于默认参数模板自定义的参数值。为空时不修改参数值。 - key:参数名称,\"max_connections\":\"10\"。为空时不修改参数值,key不为空时value也不可为空。 - value:参数值,\"max_connections\":\"10\"。
+ Values map[string]string `json:"values,omitempty"`
+}
+
+func (o ConfigurationForUpdate) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ConfigurationForUpdate struct{}"
+ }
+
+ return strings.Join([]string{"ConfigurationForUpdate", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_configuration_parameter.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_configuration_parameter.go
new file mode 100644
index 0000000000..8fafc2f48e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_configuration_parameter.go
@@ -0,0 +1,102 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+type ConfigurationParameter struct {
+
+ // 参数名称。
+ Name string `json:"name"`
+
+ // 参数值。
+ Value string `json:"value"`
+
+ // 修改该参数是否需要重启实例。
+ RestartRequired bool `json:"restart_required"`
+
+ // 该参数是否只读。
+ Readonly bool `json:"readonly"`
+
+ // 参数取值范围。
+ ValueRange string `json:"value_range"`
+
+ // 参数类型,取值为“string”、“integer”、“boolean”、“list”或“float”之一。
+ Type ConfigurationParameterType `json:"type"`
+
+ // 参数描述。
+ Description string `json:"description"`
+}
+
+func (o ConfigurationParameter) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ConfigurationParameter struct{}"
+ }
+
+ return strings.Join([]string{"ConfigurationParameter", string(data)}, " ")
+}
+
+type ConfigurationParameterType struct {
+ value string
+}
+
+type ConfigurationParameterTypeEnum struct {
+ STRING ConfigurationParameterType
+ INTEGER ConfigurationParameterType
+ BOOLEAN ConfigurationParameterType
+ LIST ConfigurationParameterType
+ FLOAT ConfigurationParameterType
+}
+
+func GetConfigurationParameterTypeEnum() ConfigurationParameterTypeEnum {
+ return ConfigurationParameterTypeEnum{
+ STRING: ConfigurationParameterType{
+ value: "string",
+ },
+ INTEGER: ConfigurationParameterType{
+ value: "integer",
+ },
+ BOOLEAN: ConfigurationParameterType{
+ value: "boolean",
+ },
+ LIST: ConfigurationParameterType{
+ value: "list",
+ },
+ FLOAT: ConfigurationParameterType{
+ value: "float",
+ },
+ }
+}
+
+func (c ConfigurationParameterType) Value() string {
+ return c.value
+}
+
+func (c ConfigurationParameterType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ConfigurationParameterType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_configuration_summary.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_configuration_summary.go
new file mode 100644
index 0000000000..c70fd8ef63
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_configuration_summary.go
@@ -0,0 +1,102 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ConfigurationSummary 参数模板信息。
+type ConfigurationSummary struct {
+
+ // 参数组ID。
+ Id string `json:"id"`
+
+ // 参数组名称。
+ Name string `json:"name"`
+
+ // 参数组描述。
+ Description *string `json:"description,omitempty"`
+
+ // 引擎版本。
+ DatastoreVersionName string `json:"datastore_version_name"`
+
+ // 引擎名。
+ DatastoreName ConfigurationSummaryDatastoreName `json:"datastore_name"`
+
+ // 创建时间,格式为\"yyyy-MM-ddTHH:mm:ssZ\"。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ Created string `json:"created"`
+
+ // 更新时间,格式为\"yyyy-MM-ddTHH:mm:ssZ\"。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ Updated string `json:"updated"`
+
+ // 是否是用户自定义参数模板: - false,表示为系统默认参数模板。 - true,表示为用户自定义参数模板。
+ UserDefined bool `json:"user_defined"`
+}
+
+func (o ConfigurationSummary) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ConfigurationSummary struct{}"
+ }
+
+ return strings.Join([]string{"ConfigurationSummary", string(data)}, " ")
+}
+
+type ConfigurationSummaryDatastoreName struct {
+ value string
+}
+
+type ConfigurationSummaryDatastoreNameEnum struct {
+ MYSQL ConfigurationSummaryDatastoreName
+ POSTGRESQL ConfigurationSummaryDatastoreName
+ SQLSERVER ConfigurationSummaryDatastoreName
+ MARIADB ConfigurationSummaryDatastoreName
+}
+
+func GetConfigurationSummaryDatastoreNameEnum() ConfigurationSummaryDatastoreNameEnum {
+ return ConfigurationSummaryDatastoreNameEnum{
+ MYSQL: ConfigurationSummaryDatastoreName{
+ value: "mysql",
+ },
+ POSTGRESQL: ConfigurationSummaryDatastoreName{
+ value: "postgresql",
+ },
+ SQLSERVER: ConfigurationSummaryDatastoreName{
+ value: "sqlserver",
+ },
+ MARIADB: ConfigurationSummaryDatastoreName{
+ value: "mariadb",
+ },
+ }
+}
+
+func (c ConfigurationSummaryDatastoreName) Value() string {
+ return c.value
+}
+
+func (c ConfigurationSummaryDatastoreName) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ConfigurationSummaryDatastoreName) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_configuration_summary_for_create.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_configuration_summary_for_create.go
new file mode 100644
index 0000000000..96736710a6
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_configuration_summary_for_create.go
@@ -0,0 +1,99 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ConfigurationSummaryForCreate 参数模板信息。
+type ConfigurationSummaryForCreate struct {
+
+ // 参数组ID。
+ Id string `json:"id"`
+
+ // 参数组名称。
+ Name string `json:"name"`
+
+ // 参数组描述。
+ Description *string `json:"description,omitempty"`
+
+ // 引擎版本。
+ DatastoreVersionName string `json:"datastore_version_name"`
+
+ // 引擎名。
+ DatastoreName ConfigurationSummaryForCreateDatastoreName `json:"datastore_name"`
+
+ // 创建时间,格式为\"yyyy-MM-ddTHH:mm:ssZ\"。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ Created string `json:"created"`
+
+ // 更新时间,格式为\"yyyy-MM-ddTHH:mm:ssZ\"。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ Updated string `json:"updated"`
+}
+
+func (o ConfigurationSummaryForCreate) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ConfigurationSummaryForCreate struct{}"
+ }
+
+ return strings.Join([]string{"ConfigurationSummaryForCreate", string(data)}, " ")
+}
+
+type ConfigurationSummaryForCreateDatastoreName struct {
+ value string
+}
+
+type ConfigurationSummaryForCreateDatastoreNameEnum struct {
+ MYSQL ConfigurationSummaryForCreateDatastoreName
+ POSTGRESQL ConfigurationSummaryForCreateDatastoreName
+ SQLSERVER ConfigurationSummaryForCreateDatastoreName
+ MARIADB ConfigurationSummaryForCreateDatastoreName
+}
+
+func GetConfigurationSummaryForCreateDatastoreNameEnum() ConfigurationSummaryForCreateDatastoreNameEnum {
+ return ConfigurationSummaryForCreateDatastoreNameEnum{
+ MYSQL: ConfigurationSummaryForCreateDatastoreName{
+ value: "mysql",
+ },
+ POSTGRESQL: ConfigurationSummaryForCreateDatastoreName{
+ value: "postgresql",
+ },
+ SQLSERVER: ConfigurationSummaryForCreateDatastoreName{
+ value: "sqlserver",
+ },
+ MARIADB: ConfigurationSummaryForCreateDatastoreName{
+ value: "mariadb",
+ },
+ }
+}
+
+func (c ConfigurationSummaryForCreateDatastoreName) Value() string {
+ return c.value
+}
+
+func (c ConfigurationSummaryForCreateDatastoreName) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ConfigurationSummaryForCreateDatastoreName) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_copy_configuration_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_copy_configuration_request.go
new file mode 100644
index 0000000000..a4b936114e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_copy_configuration_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CopyConfigurationRequest Request Object
+type CopyConfigurationRequest struct {
+
+ // 参数模板ID
+ ConfigId string `json:"config_id"`
+
+ Body *ConfigurationCopyRequestBody `json:"body,omitempty"`
+}
+
+func (o CopyConfigurationRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CopyConfigurationRequest struct{}"
+ }
+
+ return strings.Join([]string{"CopyConfigurationRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_copy_configuration_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_copy_configuration_response.go
new file mode 100644
index 0000000000..30dddad347
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_copy_configuration_response.go
@@ -0,0 +1,42 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CopyConfigurationResponse Response Object
+type CopyConfigurationResponse struct {
+
+ // 参数模板ID。
+ Id *string `json:"id,omitempty"`
+
+ // 参数模板名称。
+ Name *string `json:"name,omitempty"`
+
+ // 描述。
+ Description *string `json:"description,omitempty"`
+
+ // 数据库版本名称
+ DatastoreVersionName *string `json:"datastore_version_name,omitempty"`
+
+ // 数据库名称。
+ DatastoreName *string `json:"datastore_name,omitempty"`
+
+ // 创建时间,格式为\"yyyy-MM-ddTHH:mm:ssZ\"。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ CreateTime *string `json:"create_time,omitempty"`
+
+ // 更新时间,格式为\"yyyy-MM-ddTHH:mm:ssZ\"。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ UpdateTime *string `json:"update_time,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o CopyConfigurationResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CopyConfigurationResponse struct{}"
+ }
+
+ return strings.Join([]string{"CopyConfigurationResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_configuration_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_configuration_request.go
new file mode 100644
index 0000000000..5b9c5f8360
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_configuration_request.go
@@ -0,0 +1,75 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// CreateConfigurationRequest Request Object
+type CreateConfigurationRequest struct {
+
+ // 语言
+ XLanguage *CreateConfigurationRequestXLanguage `json:"X-Language,omitempty"`
+
+ Body *ConfigurationForCreation `json:"body,omitempty"`
+}
+
+func (o CreateConfigurationRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateConfigurationRequest struct{}"
+ }
+
+ return strings.Join([]string{"CreateConfigurationRequest", string(data)}, " ")
+}
+
+type CreateConfigurationRequestXLanguage struct {
+ value string
+}
+
+type CreateConfigurationRequestXLanguageEnum struct {
+ ZH_CN CreateConfigurationRequestXLanguage
+ EN_US CreateConfigurationRequestXLanguage
+}
+
+func GetCreateConfigurationRequestXLanguageEnum() CreateConfigurationRequestXLanguageEnum {
+ return CreateConfigurationRequestXLanguageEnum{
+ ZH_CN: CreateConfigurationRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: CreateConfigurationRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c CreateConfigurationRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c CreateConfigurationRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *CreateConfigurationRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_configuration_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_configuration_response.go
new file mode 100644
index 0000000000..80cc7c9916
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_configuration_response.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreateConfigurationResponse Response Object
+type CreateConfigurationResponse struct {
+ Configuration *ConfigurationSummaryForCreate `json:"configuration,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o CreateConfigurationResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateConfigurationResponse struct{}"
+ }
+
+ return strings.Join([]string{"CreateConfigurationResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_database_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_database_request.go
new file mode 100644
index 0000000000..d8cfb596bf
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_database_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreateDatabaseRequest Request Object
+type CreateDatabaseRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *DatabaseForCreation `json:"body,omitempty"`
+}
+
+func (o CreateDatabaseRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateDatabaseRequest struct{}"
+ }
+
+ return strings.Join([]string{"CreateDatabaseRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_database_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_database_response.go
new file mode 100644
index 0000000000..d09d4964b4
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_database_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreateDatabaseResponse Response Object
+type CreateDatabaseResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o CreateDatabaseResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateDatabaseResponse struct{}"
+ }
+
+ return strings.Join([]string{"CreateDatabaseResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_db_user_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_db_user_request.go
new file mode 100644
index 0000000000..c51304c2a2
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_db_user_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreateDbUserRequest Request Object
+type CreateDbUserRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *UserForCreation `json:"body,omitempty"`
+}
+
+func (o CreateDbUserRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateDbUserRequest struct{}"
+ }
+
+ return strings.Join([]string{"CreateDbUserRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_db_user_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_db_user_response.go
new file mode 100644
index 0000000000..6b8abf1bbd
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_db_user_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreateDbUserResponse Response Object
+type CreateDbUserResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o CreateDbUserResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateDbUserResponse struct{}"
+ }
+
+ return strings.Join([]string{"CreateDbUserResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_dns_name_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_dns_name_request.go
new file mode 100644
index 0000000000..8aefe6b510
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_dns_name_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// CreateDnsNameRequest Request Object
+type CreateDnsNameRequest struct {
+
+ // 语言
+ XLanguage *CreateDnsNameRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *CreateDnsNameRequestBody `json:"body,omitempty"`
+}
+
+func (o CreateDnsNameRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateDnsNameRequest struct{}"
+ }
+
+ return strings.Join([]string{"CreateDnsNameRequest", string(data)}, " ")
+}
+
+type CreateDnsNameRequestXLanguage struct {
+ value string
+}
+
+type CreateDnsNameRequestXLanguageEnum struct {
+ ZH_CN CreateDnsNameRequestXLanguage
+ EN_US CreateDnsNameRequestXLanguage
+}
+
+func GetCreateDnsNameRequestXLanguageEnum() CreateDnsNameRequestXLanguageEnum {
+ return CreateDnsNameRequestXLanguageEnum{
+ ZH_CN: CreateDnsNameRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: CreateDnsNameRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c CreateDnsNameRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c CreateDnsNameRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *CreateDnsNameRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_dns_name_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_dns_name_request_body.go
new file mode 100644
index 0000000000..aaea8e08a3
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_dns_name_request_body.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type CreateDnsNameRequestBody struct {
+
+ // 域名类型,当前只支持private
+ DnsType string `json:"dns_type"`
+}
+
+func (o CreateDnsNameRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateDnsNameRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"CreateDnsNameRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_dns_name_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_dns_name_response.go
new file mode 100644
index 0000000000..ef0e127d87
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_dns_name_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreateDnsNameResponse Response Object
+type CreateDnsNameResponse struct {
+
+ // 任务ID。
+ JobId *string `json:"job_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o CreateDnsNameResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateDnsNameResponse struct{}"
+ }
+
+ return strings.Join([]string{"CreateDnsNameResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_instance_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_instance_request.go
new file mode 100644
index 0000000000..8390be39d7
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_instance_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// CreateInstanceRequest Request Object
+type CreateInstanceRequest struct {
+
+ // 语言
+ XLanguage *CreateInstanceRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 保证客户端请求幂等性的标识。 该标识为32位UUID格式,由客户端生成,且需确保72小时内不同请求之间该标识具有唯一性。
+ XClientToken *string `json:"X-Client-Token,omitempty"`
+
+ Body *InstanceRequest `json:"body,omitempty"`
+}
+
+func (o CreateInstanceRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateInstanceRequest struct{}"
+ }
+
+ return strings.Join([]string{"CreateInstanceRequest", string(data)}, " ")
+}
+
+type CreateInstanceRequestXLanguage struct {
+ value string
+}
+
+type CreateInstanceRequestXLanguageEnum struct {
+ ZH_CN CreateInstanceRequestXLanguage
+ EN_US CreateInstanceRequestXLanguage
+}
+
+func GetCreateInstanceRequestXLanguageEnum() CreateInstanceRequestXLanguageEnum {
+ return CreateInstanceRequestXLanguageEnum{
+ ZH_CN: CreateInstanceRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: CreateInstanceRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c CreateInstanceRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c CreateInstanceRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *CreateInstanceRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_instance_resp_item.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_instance_resp_item.go
new file mode 100644
index 0000000000..9bedb0e192
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_instance_resp_item.go
@@ -0,0 +1,74 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreateInstanceRespItem 实例信息。
+type CreateInstanceRespItem struct {
+
+ // 实例id
+ Id *string `json:"id,omitempty"`
+
+ // 实例名称。 用于表示实例的名称,同一租户下,同类型的实例名可重名,其中,SQL Server实例名唯一。 取值范围:4~64个字符之间,必须以字母开头,区分大小写,可以包含字母、数字、中划线或者下划线,不能包含其他的特殊字符。
+ Name string `json:"name"`
+
+ // 实例状态。如BUILD,表示创建中。 仅创建按需实例时会返回该参数。
+ Status *string `json:"status,omitempty"`
+
+ Datastore *Datastore `json:"datastore"`
+
+ Ha *Ha `json:"ha,omitempty"`
+
+ // 参数组ID。
+ ConfigurationId *string `json:"configuration_id,omitempty"`
+
+ // 数据库端口信息。 - MySQL数据库端口设置范围为1024~65535(其中12017和33071被RDS系统占用不可设置)。 - PostgreSQL数据库端口修改范围为2100~9500。 - Microsoft SQL Server实例的端口设置范围为1433和2100~9500(其中5355和5985不可设置。对于2017 EE、2017 SE、2017 Web版,5050、5353和5986不可设置。 当不传该参数时,默认端口如下: - MySQL默认3306。 - PostgreSQL默认5432。 - Microsoft SQL Server默认1433。
+ Port *string `json:"port,omitempty"`
+
+ BackupStrategy *BackupStrategy `json:"backup_strategy,omitempty"`
+
+ // 企业项目ID。
+ EnterpriseProjectId *string `json:"enterprise_project_id,omitempty"`
+
+ // 用于磁盘加密的密钥ID。
+ DiskEncryptionId *string `json:"disk_encryption_id,omitempty"`
+
+ // 规格码。
+ FlavorRef string `json:"flavor_ref"`
+
+ Volume *Volume `json:"volume"`
+
+ // 区域ID。创建主实例时必选,其它场景不可选。 取值参见[地区和终端节点](https://developer.huaweicloud.com/endpoint)。
+ Region string `json:"region"`
+
+ // 可用区ID。对于数据库实例类型不是单机的实例,需要分别为实例所有节点指定可用区,并用逗号隔开。 取值参见[地区和终端节点](https://developer.huaweicloud.com/endpoint)。
+ AvailabilityZone string `json:"availability_zone"`
+
+ // 虚拟私有云ID。创建只读实例时不可选(只读实例的网络属性默认和主实例相同),其它场景必选。
+ VpcId string `json:"vpc_id"`
+
+ // 子网ID。创建只读实例时不可选(只读实例的网络属性默认和主实例相同),其它场景必选。
+ SubnetId string `json:"subnet_id"`
+
+ // 安全组ID。创建只读实例时不可选(只读实例的网络属性默认和主实例相同),其它场景必选。
+ SecurityGroupId string `json:"security_group_id"`
+
+ ChargeInfo *ChargeInfo `json:"charge_info,omitempty"`
+
+ // 仅限Microsoft SQL Server实例使用。取值范围:根据查询SQL Server可用字符集的字符集查询列表查询可设置的字符集。
+ Collation *string `json:"collation,omitempty"`
+
+ RestorePoint *RestorePoint `json:"restore_point,omitempty"`
+}
+
+func (o CreateInstanceRespItem) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateInstanceRespItem struct{}"
+ }
+
+ return strings.Join([]string{"CreateInstanceRespItem", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_instance_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_instance_response.go
new file mode 100644
index 0000000000..f478be053f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_instance_response.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreateInstanceResponse Response Object
+type CreateInstanceResponse struct {
+ Instance *CreateInstanceRespItem `json:"instance,omitempty"`
+
+ // 实例创建的任务id。 仅创建按需实例时会返回该参数。
+ JobId *string `json:"job_id,omitempty"`
+
+ // 订单号,创建包年包月时返回该参数。
+ OrderId *string `json:"order_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o CreateInstanceResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateInstanceResponse struct{}"
+ }
+
+ return strings.Join([]string{"CreateInstanceResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_manual_backup_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_manual_backup_request.go
new file mode 100644
index 0000000000..589223592b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_manual_backup_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreateManualBackupRequest Request Object
+type CreateManualBackupRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ Body *CreateManualBackupRequestBody `json:"body,omitempty"`
+}
+
+func (o CreateManualBackupRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateManualBackupRequest struct{}"
+ }
+
+ return strings.Join([]string{"CreateManualBackupRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_manual_backup_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_manual_backup_request_body.go
new file mode 100644
index 0000000000..77c71042b5
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_manual_backup_request_body.go
@@ -0,0 +1,31 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type CreateManualBackupRequestBody struct {
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 备份名称,4~64个字符,必须以英文字母开头,区分大小写,可以包含英文字母、数字、中划线或者下划线,不能包含其他特殊字符。
+ Name string `json:"name"`
+
+ // 备份描述,不能包含>!<\"&'=特殊字符,不大于256个字符。
+ Description *string `json:"description,omitempty"`
+
+ // 只支持Microsoft SQL Server,局部备份的用户自建数据库名列表,当有此参数时以局部备份为准。
+ Databases *[]BackupDatabase `json:"databases,omitempty"`
+}
+
+func (o CreateManualBackupRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateManualBackupRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"CreateManualBackupRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_manual_backup_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_manual_backup_response.go
new file mode 100644
index 0000000000..9e056f3059
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_manual_backup_response.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreateManualBackupResponse Response Object
+type CreateManualBackupResponse struct {
+ Backup *BackupInfo `json:"backup,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o CreateManualBackupResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateManualBackupResponse struct{}"
+ }
+
+ return strings.Join([]string{"CreateManualBackupResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_database_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_database_request.go
new file mode 100644
index 0000000000..9586d687de
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_database_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreatePostgresqlDatabaseRequest Request Object
+type CreatePostgresqlDatabaseRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *PostgresqlDatabaseForCreation `json:"body,omitempty"`
+}
+
+func (o CreatePostgresqlDatabaseRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreatePostgresqlDatabaseRequest struct{}"
+ }
+
+ return strings.Join([]string{"CreatePostgresqlDatabaseRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_database_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_database_response.go
new file mode 100644
index 0000000000..e1ddf902b6
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_database_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreatePostgresqlDatabaseResponse Response Object
+type CreatePostgresqlDatabaseResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o CreatePostgresqlDatabaseResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreatePostgresqlDatabaseResponse struct{}"
+ }
+
+ return strings.Join([]string{"CreatePostgresqlDatabaseResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_database_schema_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_database_schema_request.go
new file mode 100644
index 0000000000..da2ae4a4f9
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_database_schema_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreatePostgresqlDatabaseSchemaRequest Request Object
+type CreatePostgresqlDatabaseSchemaRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *PostgresqlDatabaseSchemaReq `json:"body,omitempty"`
+}
+
+func (o CreatePostgresqlDatabaseSchemaRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreatePostgresqlDatabaseSchemaRequest struct{}"
+ }
+
+ return strings.Join([]string{"CreatePostgresqlDatabaseSchemaRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_database_schema_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_database_schema_response.go
new file mode 100644
index 0000000000..07c4855517
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_database_schema_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreatePostgresqlDatabaseSchemaResponse Response Object
+type CreatePostgresqlDatabaseSchemaResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o CreatePostgresqlDatabaseSchemaResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreatePostgresqlDatabaseSchemaResponse struct{}"
+ }
+
+ return strings.Join([]string{"CreatePostgresqlDatabaseSchemaResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_db_user_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_db_user_request.go
new file mode 100644
index 0000000000..a6b262ad32
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_db_user_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreatePostgresqlDbUserRequest Request Object
+type CreatePostgresqlDbUserRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *PostgresqlUserForCreation `json:"body,omitempty"`
+}
+
+func (o CreatePostgresqlDbUserRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreatePostgresqlDbUserRequest struct{}"
+ }
+
+ return strings.Join([]string{"CreatePostgresqlDbUserRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_db_user_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_db_user_response.go
new file mode 100644
index 0000000000..9ac23284c1
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_db_user_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreatePostgresqlDbUserResponse Response Object
+type CreatePostgresqlDbUserResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o CreatePostgresqlDbUserResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreatePostgresqlDbUserResponse struct{}"
+ }
+
+ return strings.Join([]string{"CreatePostgresqlDbUserResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_extension_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_extension_request.go
new file mode 100644
index 0000000000..7b6b32ed34
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_extension_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreatePostgresqlExtensionRequest Request Object
+type CreatePostgresqlExtensionRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *ExtensionRequest `json:"body,omitempty"`
+}
+
+func (o CreatePostgresqlExtensionRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreatePostgresqlExtensionRequest struct{}"
+ }
+
+ return strings.Join([]string{"CreatePostgresqlExtensionRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_extension_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_extension_response.go
new file mode 100644
index 0000000000..375dd09aaf
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_postgresql_extension_response.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreatePostgresqlExtensionResponse Response Object
+type CreatePostgresqlExtensionResponse struct {
+ Body *string `json:"body,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o CreatePostgresqlExtensionResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreatePostgresqlExtensionResponse struct{}"
+ }
+
+ return strings.Join([]string{"CreatePostgresqlExtensionResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_restore_instance_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_restore_instance_request.go
new file mode 100644
index 0000000000..fdbd861f56
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_restore_instance_request.go
@@ -0,0 +1,75 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// CreateRestoreInstanceRequest Request Object
+type CreateRestoreInstanceRequest struct {
+
+ // 语言
+ XLanguage *CreateRestoreInstanceRequestXLanguage `json:"X-Language,omitempty"`
+
+ Body *CreateRestoreInstanceRequestBody `json:"body,omitempty"`
+}
+
+func (o CreateRestoreInstanceRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateRestoreInstanceRequest struct{}"
+ }
+
+ return strings.Join([]string{"CreateRestoreInstanceRequest", string(data)}, " ")
+}
+
+type CreateRestoreInstanceRequestXLanguage struct {
+ value string
+}
+
+type CreateRestoreInstanceRequestXLanguageEnum struct {
+ ZH_CN CreateRestoreInstanceRequestXLanguage
+ EN_US CreateRestoreInstanceRequestXLanguage
+}
+
+func GetCreateRestoreInstanceRequestXLanguageEnum() CreateRestoreInstanceRequestXLanguageEnum {
+ return CreateRestoreInstanceRequestXLanguageEnum{
+ ZH_CN: CreateRestoreInstanceRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: CreateRestoreInstanceRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c CreateRestoreInstanceRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c CreateRestoreInstanceRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *CreateRestoreInstanceRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_restore_instance_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_restore_instance_request_body.go
new file mode 100644
index 0000000000..04b89cf42c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_restore_instance_request_body.go
@@ -0,0 +1,91 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreateRestoreInstanceRequestBody 实例信息。
+type CreateRestoreInstanceRequestBody struct {
+
+ // 实例名称。 用于表示实例的名称,同一租户下,同类型的实例名可重名。取值范围如下: - MySQL数据库支持的字符长度是4~64个字符,必须以字母开头,区分大小写,可以包含字母、数字、中文字符、中划线或者下划线,不能包含其他的特殊字符。 - PostgreSQL和SQL Server数据库支持的字符长度是4~64个字符,必须以字母开头,区分大小写,可以包含字母、数字、中划线或者下划线,不能包含其他的特殊字符。
+ Name string `json:"name"`
+
+ Datastore *Datastore `json:"datastore"`
+
+ Ha *Ha `json:"ha,omitempty"`
+
+ // 参数模板ID。可调用[获取参数模板列表](https://support.huaweicloud.com/api-rds/rds_09_0301.html)接口返回的ID获取。
+ ConfigurationId *string `json:"configuration_id,omitempty"`
+
+ // 数据库端口信息。 - MySQL数据库端口设置范围为1024~65535(其中12017和33071被RDS系统占用不可设置)。 - PostgreSQL数据库端口修改范围为2100~9500。 - Microsoft SQL Server实例的端口设置范围为1433和2100~9500(其中5355和5985不可设置。对于2017 EE、2017 SE、2017 Web版,5050、5353和5986不可设置。 当不传该参数时,默认端口如下: - MySQL默认3306。 - PostgreSQL默认5432。 - Microsoft SQL Server默认1433。
+ Port *string `json:"port,omitempty"`
+
+ // 数据库密码。创建只读实例时不可选,其它场景必选。 取值范围: 非空,由大小写字母、数字和特殊符号~!@#%^*-_=+?组成,长度8~32个字符。 其中允许的特殊字符如下: - MySQL数据库允许输入~!@#$%^*-_=+?,特殊字符。 - SQL Server数据库允许输入~!@#$%^*-_+?,特殊字符。 - PostgreSQL数据库允许输入~!@#%^*-_=+?,特殊字符。 建议您输入高强度密码,以提高安全性,防止出现密码被暴力破解等安全风险。
+ Password *string `json:"password,omitempty"`
+
+ BackupStrategy *BackupStrategy `json:"backup_strategy,omitempty"`
+
+ // 企业项目ID。 使用请参考《企业管理 API参考》的[查询企业项目列表](https://support.huaweicloud.com/api-em/zh-cn_topic_0121230880.html)响应消息表“enterprise_project字段数据结构说明”的“id”。
+ EnterpriseProjectId *string `json:"enterprise_project_id,omitempty"`
+
+ // 用于磁盘加密的密钥ID,默认为空。
+ DiskEncryptionId *string `json:"disk_encryption_id,omitempty"`
+
+ // 规格码,取值范围:非空。 使用[查询数据库规格](https://support.huaweicloud.com/api-rds/rds_06_0002.html)接口响应消息中的 flavors字段中“spec_code”获取且对应az_status为“在售”状态。
+ FlavorRef string `json:"flavor_ref"`
+
+ Volume *Volume `json:"volume"`
+
+ // 区域ID。创建主实例时必选,其它场景不可选。 取值参见[地区和终端节点](https://developer.huaweicloud.com/endpoint)。
+ Region string `json:"region"`
+
+ // 可用区ID。对于数据库实例类型不是单机的实例,需要分别为实例所有节点指定可用区,并用逗号隔开。 取值参见[地区和终端节点](https://developer.huaweicloud.com/endpoint)。
+ AvailabilityZone string `json:"availability_zone"`
+
+ // 虚拟私有云ID。创建只读实例时不可选(只读实例的网络属性默认和主实例相同),其它场景必选。 获取方法如下: - 方法1:登录虚拟私有云服务的控制台界面,在虚拟私有云的详情页面查找VPC ID。 - 方法2:通过虚拟私有云服务的API接口查询,具体操作可参考[查询VPC列表](https://support.huaweicloud.com/api-vpc/vpc_api01_0003.html)。
+ VpcId string `json:"vpc_id"`
+
+ // 子网的网络ID信息。创建只读实例时不可选(只读实例的网络属性默认和主实例相同),其它场景必选。 获取方法如下: - 方法1:登录虚拟私有云服务的控制台界面,单击VPC下的子网,进入子网详情页面,查找网络ID。 - 方法2:通过虚拟私有云服务的API接口查询,具体操作可参考[查询子网列表](https://support.huaweicloud.com/api-vpc/vpc_subnet01_0003.html)。
+ SubnetId string `json:"subnet_id"`
+
+ // 指定实例的内网IP,目前仅支持设置IPv4地址。 获取方法如下: - 方法1:登录虚拟私有云服务的控制台界面,单击VPC下的子网,进入子网详情页面,查找子网的网段,选择未被占用的IP。 - 方法2:通过虚拟私有云服务的API接口查询,具体操作可参考[查询私有IP列表](https://support.huaweicloud.com/api-vpc/vpc_privateip_0003.html),选择“device_owner”为空的私有IP。
+ DataVip *string `json:"data_vip,omitempty"`
+
+ // 安全组ID。创建只读实例时不可选(只读实例的网络属性默认和主实例相同),其它场景必选。 获取方法如下: - 方法1:登录虚拟私有云服务的控制台界面,在安全组的详情页面查找安全组ID。 - 方法2:通过虚拟私有云服务的API接口查询,具体操作可参考[查询安全组列表](https://support.huaweicloud.com/api-vpc/vpc_sg01_0003.html)。
+ SecurityGroupId string `json:"security_group_id"`
+
+ ChargeInfo *ChargeInfo `json:"charge_info,omitempty"`
+
+ // 时区。 - 不选择时,各个引擎时区如下: - MySQL国内站、国际站默认为UTC时间。 - PostgreSQL国内站、国际站默认为UTC时间。 - Microsoft SQL Server国内站默认为China Standard Time,国际站默认为UTC时间。 - MySQL和PostgreSQL引擎选择填写时,取值范围为UTC-12:00~UTC+12:00,且只支持整段时间,如UTC+08:00,不支持UTC+08:30。 - Microsoft SQL Server引擎选择填写时,请参见“创建数据库实例”接口[表10](https://support.huaweicloud.com/api-rds/rds_01_0002.html#rds_01_0002__table613473883617) 时区与UTC偏移量对照表,填写时区列字符串,如:China Standard Time。
+ TimeZone *string `json:"time_zone,omitempty"`
+
+ // Dec用户专属存储ID,每个az配置的专属存储不同,Dec用户创建实例时,对于数据库实例类型不是单机或只读的实例,需要分别为实例所有节点指定dsspoolId,并用逗号隔开。 获取方法如下: - 方法1:登录专属分布式存储服务DSS的控制台界面,查看专属存储列表,选择符合条件的az下的专属dss的ID。 - 方法2:通过专属分布式存储服务DSS的API接口查询,具体操作可参考[获取专属存储详情列表](https://support.huaweicloud.com/api-dss/dss_02_1002.html)。
+ DsspoolId *string `json:"dsspool_id,omitempty"`
+
+ // 只读实例的主实例ID。创建只读实例时必选,其它场景不可选。
+ ReplicaOfId *string `json:"replica_of_id,omitempty"`
+
+ RestorePoint *RestorePoint `json:"restore_point,omitempty"`
+
+ // 仅限Microsoft SQL Server实例创建使用。对于MySQL和PostgreSQL实例,该参数无意义。取值范围:根据查询SQL Server可用字符集的字符集查询列表查询可设置的字符集。 取值范围:根据[查询SQL Server可用字符集](https://support.huaweicloud.com/api-rds/rds_05_0010.html)查询可设置的字符集。
+ Collation *string `json:"collation,omitempty"`
+
+ // 标签列表。单个实例总标签数上限20个。
+ Tags *[]TagWithKeyValue `json:"tags,omitempty"`
+
+ UnchangeableParam *UnchangeableParam `json:"unchangeable_param,omitempty"`
+
+ // 是否只预检此次请求,仅支持MySQL。 - true:发送参数检查请求,不会创建实例。 - 检查通过:返回202状态码。 - 检查不通过:返回对应错误码,详情请参考错误码。 - false:发送正常请求,通过检查后,并且执行创建实例的请求。
+ DryRun *bool `json:"dry_run,omitempty"`
+}
+
+func (o CreateRestoreInstanceRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateRestoreInstanceRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"CreateRestoreInstanceRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_restore_instance_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_restore_instance_response.go
new file mode 100644
index 0000000000..7552ef4070
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_restore_instance_response.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreateRestoreInstanceResponse Response Object
+type CreateRestoreInstanceResponse struct {
+ Instance *CreateInstanceRespItem `json:"instance,omitempty"`
+
+ // 实例创建的任务id。 仅创建按需实例时会返回该参数。
+ JobId *string `json:"job_id,omitempty"`
+
+ // 订单号,创建包年包月时返回该参数。
+ OrderId *string `json:"order_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o CreateRestoreInstanceResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateRestoreInstanceResponse struct{}"
+ }
+
+ return strings.Join([]string{"CreateRestoreInstanceResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_sqlserver_database_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_sqlserver_database_request.go
new file mode 100644
index 0000000000..d1ba39d382
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_sqlserver_database_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreateSqlserverDatabaseRequest Request Object
+type CreateSqlserverDatabaseRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *SqlserverDatabaseForCreation `json:"body,omitempty"`
+}
+
+func (o CreateSqlserverDatabaseRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateSqlserverDatabaseRequest struct{}"
+ }
+
+ return strings.Join([]string{"CreateSqlserverDatabaseRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_sqlserver_database_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_sqlserver_database_response.go
new file mode 100644
index 0000000000..fb05cfd993
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_sqlserver_database_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreateSqlserverDatabaseResponse Response Object
+type CreateSqlserverDatabaseResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o CreateSqlserverDatabaseResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateSqlserverDatabaseResponse struct{}"
+ }
+
+ return strings.Join([]string{"CreateSqlserverDatabaseResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_sqlserver_db_user_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_sqlserver_db_user_request.go
new file mode 100644
index 0000000000..49c50a9510
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_sqlserver_db_user_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreateSqlserverDbUserRequest Request Object
+type CreateSqlserverDbUserRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *SqlserverUserForCreation `json:"body,omitempty"`
+}
+
+func (o CreateSqlserverDbUserRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateSqlserverDbUserRequest struct{}"
+ }
+
+ return strings.Join([]string{"CreateSqlserverDbUserRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_sqlserver_db_user_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_sqlserver_db_user_response.go
new file mode 100644
index 0000000000..444df01c10
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_sqlserver_db_user_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreateSqlserverDbUserResponse Response Object
+type CreateSqlserverDbUserResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o CreateSqlserverDbUserResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateSqlserverDbUserResponse struct{}"
+ }
+
+ return strings.Join([]string{"CreateSqlserverDbUserResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_xel_log_download_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_xel_log_download_request.go
new file mode 100644
index 0000000000..7a34907023
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_xel_log_download_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// CreateXelLogDownloadRequest Request Object
+type CreateXelLogDownloadRequest struct {
+
+ // 语言
+ XLanguage *CreateXelLogDownloadRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *CreateXelLogDownloadRequestBody `json:"body,omitempty"`
+}
+
+func (o CreateXelLogDownloadRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateXelLogDownloadRequest struct{}"
+ }
+
+ return strings.Join([]string{"CreateXelLogDownloadRequest", string(data)}, " ")
+}
+
+type CreateXelLogDownloadRequestXLanguage struct {
+ value string
+}
+
+type CreateXelLogDownloadRequestXLanguageEnum struct {
+ ZH_CN CreateXelLogDownloadRequestXLanguage
+ EN_US CreateXelLogDownloadRequestXLanguage
+}
+
+func GetCreateXelLogDownloadRequestXLanguageEnum() CreateXelLogDownloadRequestXLanguageEnum {
+ return CreateXelLogDownloadRequestXLanguageEnum{
+ ZH_CN: CreateXelLogDownloadRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: CreateXelLogDownloadRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c CreateXelLogDownloadRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c CreateXelLogDownloadRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *CreateXelLogDownloadRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_xel_log_download_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_xel_log_download_request_body.go
new file mode 100644
index 0000000000..4a0b7eef31
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_xel_log_download_request_body.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type CreateXelLogDownloadRequestBody struct {
+
+ // 文件名。取值范围:不为null和空字符串,只为大小写字母,数字和下划线,以“.xel”结尾
+ FileName string `json:"file_name"`
+}
+
+func (o CreateXelLogDownloadRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateXelLogDownloadRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"CreateXelLogDownloadRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_xel_log_download_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_xel_log_download_response.go
new file mode 100644
index 0000000000..fb92b1323c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_xel_log_download_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// CreateXelLogDownloadResponse Response Object
+type CreateXelLogDownloadResponse struct {
+
+ // 扩展日志文件返回实体
+ List *[]CreateXelLogDownloadResult `json:"list,omitempty"`
+
+ // 扩展日志文件信息数量。
+ Count *int32 `json:"count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o CreateXelLogDownloadResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateXelLogDownloadResponse struct{}"
+ }
+
+ return strings.Join([]string{"CreateXelLogDownloadResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_xel_log_download_result.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_xel_log_download_result.go
new file mode 100644
index 0000000000..55cba9974c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_create_xel_log_download_result.go
@@ -0,0 +1,37 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type CreateXelLogDownloadResult struct {
+
+ // 下载文件名
+ FileName string `json:"file_name"`
+
+ // 生成链接的生成状态。FINISH,表示下载链接已经生成完成。EXPORTING,,表示正在生成文件。FAILED,表示存在日志文件准备失败。
+ Status string `json:"status"`
+
+ // 日志大小,单位:KB
+ FileSize string `json:"file_size"`
+
+ // 下载链接,链接的生成状态为EXPORTING,或者FAILED不予返回
+ FileLink string `json:"file_link"`
+
+ // 生成时间
+ CreateAt string `json:"create_at"`
+
+ // 更新时间
+ UpdateAt string `json:"update_at"`
+}
+
+func (o CreateXelLogDownloadResult) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CreateXelLogDownloadResult struct{}"
+ }
+
+ return strings.Join([]string{"CreateXelLogDownloadResult", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_customer_modify_auto_enlarge_policy_req.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_customer_modify_auto_enlarge_policy_req.go
new file mode 100644
index 0000000000..50fdbc6e47
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_customer_modify_auto_enlarge_policy_req.go
@@ -0,0 +1,80 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+type CustomerModifyAutoEnlargePolicyReq struct {
+
+ // 是否开启自动扩容,true为开启,false为关闭
+ SwitchOption bool `json:"switch_option"`
+
+ // 扩容上限,单位GB, 取值范围40~4000,需要大于等于实例当前存储空间总大小,switch_option为true必填
+ LimitSize *int32 `json:"limit_size,omitempty"`
+
+ // 可用存储空间百分比,小于等于此值或者10GB时触发扩容,switch_option为true时必填
+ TriggerThreshold *CustomerModifyAutoEnlargePolicyReqTriggerThreshold `json:"trigger_threshold,omitempty"`
+}
+
+func (o CustomerModifyAutoEnlargePolicyReq) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CustomerModifyAutoEnlargePolicyReq struct{}"
+ }
+
+ return strings.Join([]string{"CustomerModifyAutoEnlargePolicyReq", string(data)}, " ")
+}
+
+type CustomerModifyAutoEnlargePolicyReqTriggerThreshold struct {
+ value int32
+}
+
+type CustomerModifyAutoEnlargePolicyReqTriggerThresholdEnum struct {
+ E_10 CustomerModifyAutoEnlargePolicyReqTriggerThreshold
+ E_15 CustomerModifyAutoEnlargePolicyReqTriggerThreshold
+ E_20 CustomerModifyAutoEnlargePolicyReqTriggerThreshold
+}
+
+func GetCustomerModifyAutoEnlargePolicyReqTriggerThresholdEnum() CustomerModifyAutoEnlargePolicyReqTriggerThresholdEnum {
+ return CustomerModifyAutoEnlargePolicyReqTriggerThresholdEnum{
+ E_10: CustomerModifyAutoEnlargePolicyReqTriggerThreshold{
+ value: 10,
+ }, E_15: CustomerModifyAutoEnlargePolicyReqTriggerThreshold{
+ value: 15,
+ }, E_20: CustomerModifyAutoEnlargePolicyReqTriggerThreshold{
+ value: 20,
+ },
+ }
+}
+
+func (c CustomerModifyAutoEnlargePolicyReqTriggerThreshold) Value() int32 {
+ return c.value
+}
+
+func (c CustomerModifyAutoEnlargePolicyReqTriggerThreshold) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *CustomerModifyAutoEnlargePolicyReqTriggerThreshold) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("int32")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: int32")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(int32); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to int32 error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_customer_upgrade_database_version_req.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_customer_upgrade_database_version_req.go
new file mode 100644
index 0000000000..f9df407957
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_customer_upgrade_database_version_req.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type CustomerUpgradeDatabaseVersionReq struct {
+
+ // 是否延迟至可维护时间段内升级。 取值范围: - true:延迟升级。表示实例将在设置的可维护时间段内升级。 - false:立即升级,默认该方式。
+ Delay *bool `json:"delay,omitempty"`
+}
+
+func (o CustomerUpgradeDatabaseVersionReq) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CustomerUpgradeDatabaseVersionReq struct{}"
+ }
+
+ return strings.Join([]string{"CustomerUpgradeDatabaseVersionReq", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_customer_upgrade_database_version_req_new.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_customer_upgrade_database_version_req_new.go
new file mode 100644
index 0000000000..375917a953
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_customer_upgrade_database_version_req_new.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type CustomerUpgradeDatabaseVersionReqNew struct {
+
+ // 是否延迟至可维护时间段内升级。 取值范围: - true:延迟升级。表示实例将在设置的可维护时间段内升级。 - false:立即升级,默认该方式。
+ IsDelayed *bool `json:"is_delayed,omitempty"`
+}
+
+func (o CustomerUpgradeDatabaseVersionReqNew) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "CustomerUpgradeDatabaseVersionReqNew struct{}"
+ }
+
+ return strings.Join([]string{"CustomerUpgradeDatabaseVersionReqNew", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_data_ip_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_data_ip_request.go
new file mode 100644
index 0000000000..ab0d17ace3
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_data_ip_request.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type DataIpRequest struct {
+
+ // 内网ip
+ NewIp string `json:"new_ip"`
+}
+
+func (o DataIpRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DataIpRequest struct{}"
+ }
+
+ return strings.Join([]string{"DataIpRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_database_for_creation.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_database_for_creation.go
new file mode 100644
index 0000000000..6a7faa65bb
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_database_for_creation.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DatabaseForCreation 数据库信息。
+type DatabaseForCreation struct {
+
+ // 数据库名称。 数据库名称长度可在1~64个字符之间,由字母、数字、中划线、下划线或$组成,$累计总长度小于等于10个字符,(MySQL 8.0不可包含$)。
+ Name string `json:"name"`
+
+ // 数据库使用的字符集,例如utf8、gbk、ascii等MySQL支持的字符集。
+ CharacterSet string `json:"character_set"`
+
+ // 数据库备注,最大长度512
+ Comment *string `json:"comment,omitempty"`
+}
+
+func (o DatabaseForCreation) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DatabaseForCreation struct{}"
+ }
+
+ return strings.Join([]string{"DatabaseForCreation", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_database_with_privilege.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_database_with_privilege.go
new file mode 100644
index 0000000000..5af78ed680
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_database_with_privilege.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DatabaseWithPrivilege 数据库及其权限。
+type DatabaseWithPrivilege struct {
+
+ // 数据库名称。
+ Name string `json:"name"`
+
+ // 是否为只读权限。
+ Readonly bool `json:"readonly"`
+}
+
+func (o DatabaseWithPrivilege) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DatabaseWithPrivilege struct{}"
+ }
+
+ return strings.Join([]string{"DatabaseWithPrivilege", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_database_with_privilege_object.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_database_with_privilege_object.go
new file mode 100644
index 0000000000..47d2874fa3
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_database_with_privilege_object.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DatabaseWithPrivilegeObject 数据库及其权限。
+type DatabaseWithPrivilegeObject struct {
+
+ // 已有数据库名称。
+ Name string `json:"name"`
+
+ // 是否为只读权限。
+ Readonly *bool `json:"readonly,omitempty"`
+}
+
+func (o DatabaseWithPrivilegeObject) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DatabaseWithPrivilegeObject struct{}"
+ }
+
+ return strings.Join([]string{"DatabaseWithPrivilegeObject", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_datastore.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_datastore.go
new file mode 100644
index 0000000000..2769ff8f74
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_datastore.go
@@ -0,0 +1,86 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+type Datastore struct {
+
+ // 数据库引擎,不区分大小写: - MySQL - PostgreSQL - SQLServer - MariaDB
+ Type DatastoreType `json:"type"`
+
+ // 数据库版本。 - MySQL引擎支持5.6、5.7、8.0版本。取值示例:5.7。具有相应权限的用户才可使用8.0,您可联系华为云客服人员申请。 - PostgreSQL引擎支持9.5、9.6、10、11版本。取值示例:9.6。 - Microsoft SQL Server:仅支持2017 企业版、2017 标准版、2017 web版、2014 标准版、2014 企业版、2016 标准版、2016 企业版、2012 企业版、2012 标准版、2012 web版、2008 R2 企业版、2008 R2 web版、2014 web版、2016 web版。取值示例2014_SE。 例如:2017标准版可填写2017_SE,2017企业版可填写2017_EE,2017web版可以填写2017_WEB
+ Version string `json:"version"`
+
+ // 数据库完整版本号。仅在数据库引擎是”PostgreSQL”时返回。
+ CompleteVersion *string `json:"complete_version,omitempty"`
+}
+
+func (o Datastore) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "Datastore struct{}"
+ }
+
+ return strings.Join([]string{"Datastore", string(data)}, " ")
+}
+
+type DatastoreType struct {
+ value string
+}
+
+type DatastoreTypeEnum struct {
+ MY_SQL DatastoreType
+ POSTGRE_SQL DatastoreType
+ SQL_SERVER DatastoreType
+ MARIA_DB DatastoreType
+}
+
+func GetDatastoreTypeEnum() DatastoreTypeEnum {
+ return DatastoreTypeEnum{
+ MY_SQL: DatastoreType{
+ value: "MySQL",
+ },
+ POSTGRE_SQL: DatastoreType{
+ value: "PostgreSQL",
+ },
+ SQL_SERVER: DatastoreType{
+ value: "SQLServer",
+ },
+ MARIA_DB: DatastoreType{
+ value: "MariaDB",
+ },
+ }
+}
+
+func (c DatastoreType) Value() string {
+ return c.value
+}
+
+func (c DatastoreType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *DatastoreType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_db_user_privilege_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_db_user_privilege_request.go
new file mode 100644
index 0000000000..10a2ac38fd
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_db_user_privilege_request.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DbUserPrivilegeRequest 入参对象
+type DbUserPrivilegeRequest struct {
+
+ // 账号,数据库相关联的帐号
+ UserName string `json:"user_name"`
+
+ // 授权SQL类型,枚举: 1、ROLE(支持对指定用户设置以下权限) 2、RECYCLING_ROLE(支持对指定用户回收以下权限) 3、SYSTEM_ROLE(支持对指定用户授予以下系统角色) 4、RECYCLING_SYSTEM_ROLE(支持对指定用户回收以下系统角色)
+ AuthorizationType string `json:"authorization_type"`
+
+ // 支持用户设置的权限集合。 1、privilege_type为ROLE时需要使用,枚举: CREATEDB CREATEROLE LOGIN REPLICATION 2、privilege_type为RECYCLING_ROLE时需要使用,枚举: NOCREATEDB NOCREATEROLE NOLOGIN NOREPLICATION 3、privilege_type为SYSTEM_ROLE /RECYCLING_ SYSTEM_ROLE时需要使用,枚举: pg_monitor pg_signal_backend root
+ Privileges []string `json:"privileges"`
+}
+
+func (o DbUserPrivilegeRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DbUserPrivilegeRequest struct{}"
+ }
+
+ return strings.Join([]string{"DbUserPrivilegeRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_db_user_pwd_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_db_user_pwd_request.go
new file mode 100644
index 0000000000..9c02f0bbe6
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_db_user_pwd_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type DbUserPwdRequest struct {
+
+ // 数据库帐号名称。
+ Name string `json:"name"`
+
+ // 数据库帐号密码。 取值范围: 非空,至少包含以下字符中的三种:大写字母、小写字母、数字和特殊符号~!@#%^*-_=+?,组成,长度8~32个字符,不能和数据库帐号“name”或“name”的逆序相同。 建议您输入高强度密码,以提高安全性,防止出现密码被暴力破解等安全风险。
+ Password string `json:"password"`
+}
+
+func (o DbUserPwdRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DbUserPwdRequest struct{}"
+ }
+
+ return strings.Join([]string{"DbUserPwdRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_dbs_instance_host_info_result.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_dbs_instance_host_info_result.go
new file mode 100644
index 0000000000..cd44e4e656
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_dbs_instance_host_info_result.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type DbsInstanceHostInfoResult struct {
+
+ // host id
+ Id *string `json:"id,omitempty"`
+
+ // host地址
+ Host *string `json:"host,omitempty"`
+
+ // host 名称
+ HostName *string `json:"host_name,omitempty"`
+}
+
+func (o DbsInstanceHostInfoResult) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DbsInstanceHostInfoResult struct{}"
+ }
+
+ return strings.Join([]string{"DbsInstanceHostInfoResult", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_backup_result.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_backup_result.go
new file mode 100644
index 0000000000..f4f6de3b33
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_backup_result.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type DeleteBackupResult struct {
+
+ // 备份id
+ BackupId *string `json:"backup_id,omitempty"`
+
+ // 提交任务异常时返回的错误编码。0表示成功。
+ ErrorCode *string `json:"error_code,omitempty"`
+
+ // 提交任务异常时返回的错误描述信息。
+ ErrorMsg *string `json:"error_msg,omitempty"`
+}
+
+func (o DeleteBackupResult) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeleteBackupResult struct{}"
+ }
+
+ return strings.Join([]string{"DeleteBackupResult", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_configuration_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_configuration_request.go
new file mode 100644
index 0000000000..d45d1154d5
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_configuration_request.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeleteConfigurationRequest Request Object
+type DeleteConfigurationRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 参数模板ID。
+ ConfigId string `json:"config_id"`
+}
+
+func (o DeleteConfigurationRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeleteConfigurationRequest struct{}"
+ }
+
+ return strings.Join([]string{"DeleteConfigurationRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_configuration_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_configuration_response.go
new file mode 100644
index 0000000000..20c66030aa
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_configuration_response.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeleteConfigurationResponse Response Object
+type DeleteConfigurationResponse struct {
+ HttpStatusCode int `json:"-"`
+}
+
+func (o DeleteConfigurationResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeleteConfigurationResponse struct{}"
+ }
+
+ return strings.Join([]string{"DeleteConfigurationResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_database_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_database_request.go
new file mode 100644
index 0000000000..4be48f42f3
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_database_request.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeleteDatabaseRequest Request Object
+type DeleteDatabaseRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 需要删除的数据库名。
+ DbName string `json:"db_name"`
+}
+
+func (o DeleteDatabaseRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeleteDatabaseRequest struct{}"
+ }
+
+ return strings.Join([]string{"DeleteDatabaseRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_database_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_database_response.go
new file mode 100644
index 0000000000..52307457c1
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_database_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeleteDatabaseResponse Response Object
+type DeleteDatabaseResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o DeleteDatabaseResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeleteDatabaseResponse struct{}"
+ }
+
+ return strings.Join([]string{"DeleteDatabaseResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_db_user_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_db_user_request.go
new file mode 100644
index 0000000000..819fb57f53
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_db_user_request.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeleteDbUserRequest Request Object
+type DeleteDbUserRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 需要删除的帐号名。
+ UserName string `json:"user_name"`
+}
+
+func (o DeleteDbUserRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeleteDbUserRequest struct{}"
+ }
+
+ return strings.Join([]string{"DeleteDbUserRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_db_user_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_db_user_response.go
new file mode 100644
index 0000000000..22b8e44ea7
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_db_user_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeleteDbUserResponse Response Object
+type DeleteDbUserResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o DeleteDbUserResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeleteDbUserResponse struct{}"
+ }
+
+ return strings.Join([]string{"DeleteDbUserResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_instance_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_instance_request.go
new file mode 100644
index 0000000000..8fb6e55a7b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_instance_request.go
@@ -0,0 +1,76 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// DeleteInstanceRequest Request Object
+type DeleteInstanceRequest struct {
+
+ // 语言
+ XLanguage *DeleteInstanceRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+}
+
+func (o DeleteInstanceRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeleteInstanceRequest struct{}"
+ }
+
+ return strings.Join([]string{"DeleteInstanceRequest", string(data)}, " ")
+}
+
+type DeleteInstanceRequestXLanguage struct {
+ value string
+}
+
+type DeleteInstanceRequestXLanguageEnum struct {
+ ZH_CN DeleteInstanceRequestXLanguage
+ EN_US DeleteInstanceRequestXLanguage
+}
+
+func GetDeleteInstanceRequestXLanguageEnum() DeleteInstanceRequestXLanguageEnum {
+ return DeleteInstanceRequestXLanguageEnum{
+ ZH_CN: DeleteInstanceRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: DeleteInstanceRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c DeleteInstanceRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c DeleteInstanceRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *DeleteInstanceRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_instance_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_instance_response.go
new file mode 100644
index 0000000000..cdb17bc86a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_instance_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeleteInstanceResponse Response Object
+type DeleteInstanceResponse struct {
+
+ // 任务ID。
+ JobId *string `json:"job_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o DeleteInstanceResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeleteInstanceResponse struct{}"
+ }
+
+ return strings.Join([]string{"DeleteInstanceResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_job_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_job_request.go
new file mode 100644
index 0000000000..12834d66ef
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_job_request.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeleteJobRequest Request Object
+type DeleteJobRequest struct {
+ Id string `json:"id"`
+}
+
+func (o DeleteJobRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeleteJobRequest struct{}"
+ }
+
+ return strings.Join([]string{"DeleteJobRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_job_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_job_response.go
new file mode 100644
index 0000000000..76ff2a638b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_job_response.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeleteJobResponse Response Object
+type DeleteJobResponse struct {
+ Body *string `json:"body,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o DeleteJobResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeleteJobResponse struct{}"
+ }
+
+ return strings.Join([]string{"DeleteJobResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_manual_backup_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_manual_backup_request.go
new file mode 100644
index 0000000000..ed9ee0934d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_manual_backup_request.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeleteManualBackupRequest Request Object
+type DeleteManualBackupRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 备份ID。
+ BackupId string `json:"backup_id"`
+}
+
+func (o DeleteManualBackupRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeleteManualBackupRequest struct{}"
+ }
+
+ return strings.Join([]string{"DeleteManualBackupRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_manual_backup_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_manual_backup_response.go
new file mode 100644
index 0000000000..11c397f5f6
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_manual_backup_response.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeleteManualBackupResponse Response Object
+type DeleteManualBackupResponse struct {
+ HttpStatusCode int `json:"-"`
+}
+
+func (o DeleteManualBackupResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeleteManualBackupResponse struct{}"
+ }
+
+ return strings.Join([]string{"DeleteManualBackupResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_database_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_database_request.go
new file mode 100644
index 0000000000..b9fea84031
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_database_request.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeletePostgresqlDatabaseRequest Request Object
+type DeletePostgresqlDatabaseRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 需要删除的数据库名。
+ DbName string `json:"db_name"`
+}
+
+func (o DeletePostgresqlDatabaseRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeletePostgresqlDatabaseRequest struct{}"
+ }
+
+ return strings.Join([]string{"DeletePostgresqlDatabaseRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_database_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_database_response.go
new file mode 100644
index 0000000000..a6245ce3a2
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_database_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeletePostgresqlDatabaseResponse Response Object
+type DeletePostgresqlDatabaseResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o DeletePostgresqlDatabaseResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeletePostgresqlDatabaseResponse struct{}"
+ }
+
+ return strings.Join([]string{"DeletePostgresqlDatabaseResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_db_user_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_db_user_request.go
new file mode 100644
index 0000000000..5c149605c6
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_db_user_request.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeletePostgresqlDbUserRequest Request Object
+type DeletePostgresqlDbUserRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 需要删除的帐号名。
+ UserName string `json:"user_name"`
+}
+
+func (o DeletePostgresqlDbUserRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeletePostgresqlDbUserRequest struct{}"
+ }
+
+ return strings.Join([]string{"DeletePostgresqlDbUserRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_db_user_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_db_user_response.go
new file mode 100644
index 0000000000..1483fdf7fb
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_db_user_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeletePostgresqlDbUserResponse Response Object
+type DeletePostgresqlDbUserResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o DeletePostgresqlDbUserResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeletePostgresqlDbUserResponse struct{}"
+ }
+
+ return strings.Join([]string{"DeletePostgresqlDbUserResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_extension_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_extension_request.go
new file mode 100644
index 0000000000..66150c61d8
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_extension_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeletePostgresqlExtensionRequest Request Object
+type DeletePostgresqlExtensionRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *ExtensionRequest `json:"body,omitempty"`
+}
+
+func (o DeletePostgresqlExtensionRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeletePostgresqlExtensionRequest struct{}"
+ }
+
+ return strings.Join([]string{"DeletePostgresqlExtensionRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_extension_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_extension_response.go
new file mode 100644
index 0000000000..93b8e72948
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_extension_response.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeletePostgresqlExtensionResponse Response Object
+type DeletePostgresqlExtensionResponse struct {
+ Body *string `json:"body,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o DeletePostgresqlExtensionResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeletePostgresqlExtensionResponse struct{}"
+ }
+
+ return strings.Join([]string{"DeletePostgresqlExtensionResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_hba_conf_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_hba_conf_request.go
new file mode 100644
index 0000000000..afd54d181b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_hba_conf_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeletePostgresqlHbaConfRequest Request Object
+type DeletePostgresqlHbaConfRequest struct {
+
+ // 实例id
+ InstanceId string `json:"instance_id"`
+
+ Body *[]PostgresqlHbaConf `json:"body,omitempty"`
+}
+
+func (o DeletePostgresqlHbaConfRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeletePostgresqlHbaConfRequest struct{}"
+ }
+
+ return strings.Join([]string{"DeletePostgresqlHbaConfRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_hba_conf_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_hba_conf_response.go
new file mode 100644
index 0000000000..00d0e0a427
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_postgresql_hba_conf_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeletePostgresqlHbaConfResponse Response Object
+type DeletePostgresqlHbaConfResponse struct {
+
+ // 结果码
+ Code *string `json:"code,omitempty"`
+
+ // 结果描述
+ Message *string `json:"message,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o DeletePostgresqlHbaConfResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeletePostgresqlHbaConfResponse struct{}"
+ }
+
+ return strings.Join([]string{"DeletePostgresqlHbaConfResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_sqlserver_database_ex_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_sqlserver_database_ex_request.go
new file mode 100644
index 0000000000..9cdac0bc1e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_sqlserver_database_ex_request.go
@@ -0,0 +1,31 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeleteSqlserverDatabaseExRequest Request Object
+type DeleteSqlserverDatabaseExRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 需要删除的数据库名。
+ DbName string `json:"db_name"`
+
+ Body *DropDatabaseV3Req `json:"body,omitempty"`
+}
+
+func (o DeleteSqlserverDatabaseExRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeleteSqlserverDatabaseExRequest struct{}"
+ }
+
+ return strings.Join([]string{"DeleteSqlserverDatabaseExRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_sqlserver_database_ex_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_sqlserver_database_ex_response.go
new file mode 100644
index 0000000000..66de349d6d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_sqlserver_database_ex_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeleteSqlserverDatabaseExResponse Response Object
+type DeleteSqlserverDatabaseExResponse struct {
+
+ // 任务ID。
+ JobId *string `json:"job_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o DeleteSqlserverDatabaseExResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeleteSqlserverDatabaseExResponse struct{}"
+ }
+
+ return strings.Join([]string{"DeleteSqlserverDatabaseExResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_sqlserver_database_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_sqlserver_database_request.go
new file mode 100644
index 0000000000..677b846e8f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_sqlserver_database_request.go
@@ -0,0 +1,31 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeleteSqlserverDatabaseRequest Request Object
+type DeleteSqlserverDatabaseRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 需要删除的数据库名。
+ DbName string `json:"db_name"`
+
+ Body *DropDatabaseV3Req `json:"body,omitempty"`
+}
+
+func (o DeleteSqlserverDatabaseRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeleteSqlserverDatabaseRequest struct{}"
+ }
+
+ return strings.Join([]string{"DeleteSqlserverDatabaseRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_sqlserver_database_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_sqlserver_database_response.go
new file mode 100644
index 0000000000..d67fe705cf
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_sqlserver_database_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeleteSqlserverDatabaseResponse Response Object
+type DeleteSqlserverDatabaseResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o DeleteSqlserverDatabaseResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeleteSqlserverDatabaseResponse struct{}"
+ }
+
+ return strings.Join([]string{"DeleteSqlserverDatabaseResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_sqlserver_db_user_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_sqlserver_db_user_request.go
new file mode 100644
index 0000000000..b60524c9bb
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_sqlserver_db_user_request.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeleteSqlserverDbUserRequest Request Object
+type DeleteSqlserverDbUserRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 需要删除的帐号名。
+ UserName string `json:"user_name"`
+}
+
+func (o DeleteSqlserverDbUserRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeleteSqlserverDbUserRequest struct{}"
+ }
+
+ return strings.Join([]string{"DeleteSqlserverDbUserRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_sqlserver_db_user_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_sqlserver_db_user_response.go
new file mode 100644
index 0000000000..a8be6540fb
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_delete_sqlserver_db_user_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DeleteSqlserverDbUserResponse Response Object
+type DeleteSqlserverDbUserResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o DeleteSqlserverDbUserResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DeleteSqlserverDbUserResponse struct{}"
+ }
+
+ return strings.Join([]string{"DeleteSqlserverDbUserResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_diagnosis_instances_info_result.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_diagnosis_instances_info_result.go
new file mode 100644
index 0000000000..e368620f0c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_diagnosis_instances_info_result.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type DiagnosisInstancesInfoResult struct {
+
+ // 实例id
+ Id *string `json:"id,omitempty"`
+}
+
+func (o DiagnosisInstancesInfoResult) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DiagnosisInstancesInfoResult struct{}"
+ }
+
+ return strings.Join([]string{"DiagnosisInstancesInfoResult", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_diagnosis_item_result.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_diagnosis_item_result.go
new file mode 100644
index 0000000000..4118f269fd
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_diagnosis_item_result.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type DiagnosisItemResult struct {
+
+ // 诊断项
+ Name *string `json:"name,omitempty"`
+
+ // 实例数量
+ Count *int32 `json:"count,omitempty"`
+}
+
+func (o DiagnosisItemResult) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DiagnosisItemResult struct{}"
+ }
+
+ return strings.Join([]string{"DiagnosisItemResult", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_download_info_rsp.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_download_info_rsp.go
new file mode 100644
index 0000000000..46d832bcc0
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_download_info_rsp.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type DownloadInfoRsp struct {
+
+ // 证书下载地址
+ DownloadLink string `json:"download_link"`
+
+ // 证书类型
+ Category string `json:"category"`
+}
+
+func (o DownloadInfoRsp) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DownloadInfoRsp struct{}"
+ }
+
+ return strings.Join([]string{"DownloadInfoRsp", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_download_slowlog_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_download_slowlog_request.go
new file mode 100644
index 0000000000..ba5273d051
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_download_slowlog_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// DownloadSlowlogRequest Request Object
+type DownloadSlowlogRequest struct {
+
+ // 语言
+ XLanguage *DownloadSlowlogRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *SlowlogDownloadRequest `json:"body,omitempty"`
+}
+
+func (o DownloadSlowlogRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DownloadSlowlogRequest struct{}"
+ }
+
+ return strings.Join([]string{"DownloadSlowlogRequest", string(data)}, " ")
+}
+
+type DownloadSlowlogRequestXLanguage struct {
+ value string
+}
+
+type DownloadSlowlogRequestXLanguageEnum struct {
+ ZH_CN DownloadSlowlogRequestXLanguage
+ EN_US DownloadSlowlogRequestXLanguage
+}
+
+func GetDownloadSlowlogRequestXLanguageEnum() DownloadSlowlogRequestXLanguageEnum {
+ return DownloadSlowlogRequestXLanguageEnum{
+ ZH_CN: DownloadSlowlogRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: DownloadSlowlogRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c DownloadSlowlogRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c DownloadSlowlogRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *DownloadSlowlogRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_download_slowlog_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_download_slowlog_response.go
new file mode 100644
index 0000000000..ebb2c723a4
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_download_slowlog_response.go
@@ -0,0 +1,30 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DownloadSlowlogResponse Response Object
+type DownloadSlowlogResponse struct {
+
+ // 慢日志下载链接列表
+ List *[]SlowlogDownloadInfo `json:"list,omitempty"`
+
+ // - 慢日志下载链接生成状态。FINISH,表示下载链接已经生成完成。CREATING,表示正在生成文件,准备下载链接。FAILED,表示存在日志文件准备失败。
+ Status *string `json:"status,omitempty"`
+
+ // - 慢日志链接数量。
+ Count *int32 `json:"count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o DownloadSlowlogResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DownloadSlowlogResponse struct{}"
+ }
+
+ return strings.Join([]string{"DownloadSlowlogResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_drop_database_v3_req.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_drop_database_v3_req.go
new file mode 100644
index 0000000000..e885198147
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_drop_database_v3_req.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type DropDatabaseV3Req struct {
+
+ // 是否强制删除数据库,默认是false。
+ IsForceDelete *bool `json:"is_force_delete,omitempty"`
+}
+
+func (o DropDatabaseV3Req) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DropDatabaseV3Req struct{}"
+ }
+
+ return strings.Join([]string{"DropDatabaseV3Req", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_dss_pool_info.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_dss_pool_info.go
new file mode 100644
index 0000000000..8000a064fd
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_dss_pool_info.go
@@ -0,0 +1,35 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// DssPoolInfo 实例专属存储信息。
+type DssPoolInfo struct {
+
+ // 专属存储池所在az
+ AzName string `json:"az_name"`
+
+ // 专属存储池免费空间大小,单位GB
+ FreeCapacityGb string `json:"free_capacity_gb"`
+
+ // 专属存储池磁盘类型名称,可能取值如下: - ULTRAHIGH,表示SSD。 - LOCALSSD:表示本地SSD。 - CLOUDSSD:表示SSD云盘,仅支持通用型和独享型规格实例。 - ESSD:表示极速型SSD,仅支持独享型规格实例。
+ DsspoolVolumeType string `json:"dsspool_volume_type"`
+
+ // 专属存储池ID
+ DsspoolId string `json:"dsspool_id"`
+
+ // 专属存储池当前状态,可能取值如下: - available,表示可用。 - deploying,表示正在部署。 - enlarging,表示正在扩容。 - frozen,表示冻结。 - sellout,表示售罄。
+ DsspoolStatus string `json:"dsspool_status"`
+}
+
+func (o DssPoolInfo) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "DssPoolInfo struct{}"
+ }
+
+ return strings.Join([]string{"DssPoolInfo", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_enable_configuration_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_enable_configuration_request.go
new file mode 100644
index 0000000000..aa4b00d0b3
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_enable_configuration_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// EnableConfigurationRequest Request Object
+type EnableConfigurationRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 参数模板ID。
+ ConfigId string `json:"config_id"`
+
+ Body *ApplyConfigurationRequest `json:"body,omitempty"`
+}
+
+func (o EnableConfigurationRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "EnableConfigurationRequest struct{}"
+ }
+
+ return strings.Join([]string{"EnableConfigurationRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_enable_configuration_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_enable_configuration_response.go
new file mode 100644
index 0000000000..43d8052ffc
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_enable_configuration_response.go
@@ -0,0 +1,33 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// EnableConfigurationResponse Response Object
+type EnableConfigurationResponse struct {
+
+ // 参数组ID。
+ ConfigurationId *string `json:"configuration_id,omitempty"`
+
+ // 参数组名称。
+ ConfigurationName *string `json:"configuration_name,omitempty"`
+
+ // 参数模板是否都应用成功。 - “true”表示参数模板都应用成功。 - “false”表示存在应用失败的参数模板。
+ Success *bool `json:"success,omitempty"`
+
+ // 对每个实例的应用结果。
+ ApplyResults *[]ApplyConfigurationResponseApplyResults `json:"apply_results,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o EnableConfigurationResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "EnableConfigurationResponse struct{}"
+ }
+
+ return strings.Join([]string{"EnableConfigurationResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_engine_flavor_data.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_engine_flavor_data.go
new file mode 100644
index 0000000000..35c336634b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_engine_flavor_data.go
@@ -0,0 +1,55 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type EngineFlavorData struct {
+
+ // CPU大小。例如:1表示1U。
+ Vcpus *string `json:"vcpus,omitempty"`
+
+ // 内存大小,单位为GB。
+ Ram *string `json:"ram,omitempty"`
+
+ // 资源规格编码。例如:rds.mysql.m1.xlarge.rr。 更多规格说明请参考数据库实例规格。 “rds”代表RDS产品。 “mysql”代表数据库引擎。 “m1.xlarge”代表性能规格,为高内存类型。 “rr”表示只读实例(“.ha”表示主备实例)。 “rha.rr”表示高可用只读实例,规格编码示例:rds.mysql.n1.large.4.rha.rr。 具有公测权限的用户才可选择高可用,您可联系华为云客服人员申请。 高可用只读功能介绍请参见高可用只读简介。
+ SpecCode *string `json:"spec_code,omitempty"`
+
+ // 是否支持ipv6。
+ IsIpv6Supported *bool `json:"is_ipv6_supported,omitempty"`
+
+ // 资源类型
+ TypeCode *string `json:"type_code,omitempty"`
+
+ // 规格所在az的状态,包含以下状态: normal:在售。 unsupported:暂不支持该规格。 sellout:售罄。 abandon:未启用
+ AzStatus map[string]string `json:"az_status,omitempty"`
+
+ // 性能规格,包含以下状态: normal:通用增强型。 normal2:通用增强Ⅱ型。 armFlavors:鲲鹏通用增强型。 dedicicateNormal(dedicatedNormalLocalssd):x86独享型。 armLocalssd:鲲鹏通用型。 normalLocalssd:x86通用型。 general:通用型。 dedicated 对于MySQL引擎:独享型。 对于PostgreSQL和SQL Server引擎:独享型,仅云盘SSD支持。 rapid 对于MySQL引擎:独享型(已下线)。 对于PostgreSQL和SQL Server引擎:独享型,仅极速型SSD支持。 bigmem:超大内存型。 highPerformancePrivilegeEdition:超高IO 尊享版
+ GroupType *string `json:"group_type,omitempty"`
+
+ // 最大连接数
+ MaxConnection *string `json:"max_connection,omitempty"`
+
+ // 数据库每秒执行的事务数,每个事务中包含18条SQL语句。
+ Tps *string `json:"tps,omitempty"`
+
+ // 数据库每秒执行的SQL数,包含insert、select、update、delete等。
+ Qps *string `json:"qps,omitempty"`
+
+ // 最小磁盘容量,单位G
+ MinVolumeSize *string `json:"min_volume_size,omitempty"`
+
+ // 最大磁盘容量,单位G
+ MaxVolumeSize *string `json:"max_volume_size,omitempty"`
+}
+
+func (o EngineFlavorData) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "EngineFlavorData struct{}"
+ }
+
+ return strings.Join([]string{"EngineFlavorData", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_enlarge_volume_object.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_enlarge_volume_object.go
new file mode 100644
index 0000000000..5e85edee76
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_enlarge_volume_object.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// EnlargeVolumeObject 扩容实例磁盘时必填。
+type EnlargeVolumeObject struct {
+
+ // 每次扩容最小容量为10GB,实例所选容量大小必须为10的整数倍,取值范围:40GB~4000GB。 - MySQL部分用户支持11GB~10000GB,如果您想开通该功能,请联系客服。 - PostgreSQL部分用户支持40GB~15000GB,如果您想开通该功能,请联系客服。
+ Size int32 `json:"size"`
+
+ // 变更包周期实例的规格时可指定,表示是否自动从客户的账户中支付。 - true,为自动支付。 - false,为手动支付,默认该方式。
+ IsAutoPay *bool `json:"is_auto_pay,omitempty"`
+}
+
+func (o EnlargeVolumeObject) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "EnlargeVolumeObject struct{}"
+ }
+
+ return strings.Join([]string{"EnlargeVolumeObject", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_enlarge_volume_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_enlarge_volume_request_body.go
new file mode 100644
index 0000000000..9eaf8bcb8a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_enlarge_volume_request_body.go
@@ -0,0 +1,20 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type EnlargeVolumeRequestBody struct {
+ EnlargeVolume *EnlargeVolumeObject `json:"enlarge_volume"`
+}
+
+func (o EnlargeVolumeRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "EnlargeVolumeRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"EnlargeVolumeRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_error_log.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_error_log.go
new file mode 100644
index 0000000000..c9fdd98b1a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_error_log.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ErrorLog 错误日志信息。
+type ErrorLog struct {
+
+ // 日期时间UTC时间。
+ Time string `json:"time"`
+
+ // 日志级别。
+ Level string `json:"level"`
+
+ // 错误日志内容。
+ Content string `json:"content"`
+}
+
+func (o ErrorLog) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ErrorLog struct{}"
+ }
+
+ return strings.Join([]string{"ErrorLog", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_error_log_item.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_error_log_item.go
new file mode 100644
index 0000000000..67daeaf3f3
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_error_log_item.go
@@ -0,0 +1,31 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ErrorLogItem struct {
+
+ // 日期时间UTC时间。
+ Time *string `json:"time,omitempty"`
+
+ // 日志级别。
+ Level *string `json:"level,omitempty"`
+
+ // 错误日志内容。
+ Content *string `json:"content,omitempty"`
+
+ // 日志单行序列号。
+ LineNum *string `json:"line_num,omitempty"`
+}
+
+func (o ErrorLogItem) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ErrorLogItem struct{}"
+ }
+
+ return strings.Join([]string{"ErrorLogItem", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_error_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_error_response.go
new file mode 100644
index 0000000000..9849c1e847
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_error_response.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ErrorResponse struct {
+
+ // 错误码。
+ ErrorCode string `json:"error_code"`
+
+ // 错误消息。
+ ErrorMsg string `json:"error_msg"`
+}
+
+func (o ErrorResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ErrorResponse struct{}"
+ }
+
+ return strings.Join([]string{"ErrorResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_errorlog_for_lts_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_errorlog_for_lts_request.go
new file mode 100644
index 0000000000..d0cef04467
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_errorlog_for_lts_request.go
@@ -0,0 +1,112 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ErrorlogForLtsRequest 查询实例的错误日志对象
+type ErrorlogForLtsRequest struct {
+
+ // 开始日期,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ StartTime string `json:"start_time"`
+
+ // 结束时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。只能查询当前时间前一个月内的慢日志。
+ EndTime string `json:"end_time"`
+
+ // 日志级别,默认为ALL。
+ Level *ErrorlogForLtsRequestLevel `json:"level,omitempty"`
+
+ // 日志单行序列号,第一次查询时不需要此参数,后续分页查询时需要使用,可从上次查询的返回信息中获取。line_num应在start_time和end_time之间。
+ LineNum *string `json:"line_num,omitempty"`
+
+ // 每页多少条记录(查询结果),取值范围是1~100,不填时默认为10。
+ Limit *int32 `json:"limit,omitempty"`
+
+ // 搜索方式。默认forwards。配合line_num使用,以line_num为起点,向前搜索或向后搜索。
+ SearchType *string `json:"search_type,omitempty"`
+}
+
+func (o ErrorlogForLtsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ErrorlogForLtsRequest struct{}"
+ }
+
+ return strings.Join([]string{"ErrorlogForLtsRequest", string(data)}, " ")
+}
+
+type ErrorlogForLtsRequestLevel struct {
+ value string
+}
+
+type ErrorlogForLtsRequestLevelEnum struct {
+ ALL ErrorlogForLtsRequestLevel
+ INFO ErrorlogForLtsRequestLevel
+ LOG ErrorlogForLtsRequestLevel
+ WARNING ErrorlogForLtsRequestLevel
+ ERROR ErrorlogForLtsRequestLevel
+ FATAL ErrorlogForLtsRequestLevel
+ PANIC ErrorlogForLtsRequestLevel
+ NOTE ErrorlogForLtsRequestLevel
+}
+
+func GetErrorlogForLtsRequestLevelEnum() ErrorlogForLtsRequestLevelEnum {
+ return ErrorlogForLtsRequestLevelEnum{
+ ALL: ErrorlogForLtsRequestLevel{
+ value: "ALL",
+ },
+ INFO: ErrorlogForLtsRequestLevel{
+ value: "INFO",
+ },
+ LOG: ErrorlogForLtsRequestLevel{
+ value: "LOG",
+ },
+ WARNING: ErrorlogForLtsRequestLevel{
+ value: "WARNING",
+ },
+ ERROR: ErrorlogForLtsRequestLevel{
+ value: "ERROR",
+ },
+ FATAL: ErrorlogForLtsRequestLevel{
+ value: "FATAL",
+ },
+ PANIC: ErrorlogForLtsRequestLevel{
+ value: "PANIC",
+ },
+ NOTE: ErrorlogForLtsRequestLevel{
+ value: "NOTE",
+ },
+ }
+}
+
+func (c ErrorlogForLtsRequestLevel) Value() string {
+ return c.value
+}
+
+func (c ErrorlogForLtsRequestLevel) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ErrorlogForLtsRequestLevel) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_extension_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_extension_request.go
new file mode 100644
index 0000000000..28f61fb21a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_extension_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ExtensionRequest struct {
+
+ // 数据库名称。
+ DatabaseName string `json:"database_name"`
+
+ // 插件名称。
+ ExtensionName string `json:"extension_name"`
+}
+
+func (o ExtensionRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ExtensionRequest struct{}"
+ }
+
+ return strings.Join([]string{"ExtensionRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_extensions_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_extensions_response.go
new file mode 100644
index 0000000000..86658ab613
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_extensions_response.go
@@ -0,0 +1,37 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ExtensionsResponse struct {
+
+ // 插件名称。
+ Name *string `json:"name,omitempty"`
+
+ // 数据库名称。
+ DatabaseName *string `json:"database_name,omitempty"`
+
+ // 插件版本。
+ Version *string `json:"version,omitempty"`
+
+ // 依赖预加载库。
+ SharedPreloadLibraries *string `json:"shared_preload_libraries,omitempty"`
+
+ // 是否创建。
+ Created *bool `json:"created,omitempty"`
+
+ // 插件描述。
+ Description *string `json:"description,omitempty"`
+}
+
+func (o ExtensionsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ExtensionsResponse struct{}"
+ }
+
+ return strings.Join([]string{"ExtensionsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_failover_mode_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_failover_mode_request.go
new file mode 100644
index 0000000000..53f80227c5
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_failover_mode_request.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type FailoverModeRequest struct {
+
+ // 同步模式,各引擎可选择方式具体如下: MySQL: - async:异步。 - semisync:半同步。
+ Mode string `json:"mode"`
+}
+
+func (o FailoverModeRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "FailoverModeRequest struct{}"
+ }
+
+ return strings.Join([]string{"FailoverModeRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_failover_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_failover_request.go
new file mode 100644
index 0000000000..9b6f3aa80b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_failover_request.go
@@ -0,0 +1,23 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// FailoverRequest 强制倒换请求参数对象。
+type FailoverRequest struct {
+
+ // 是否强制倒换;true:强制倒换;false和默认null为不强制。
+ Force *bool `json:"force,omitempty"`
+}
+
+func (o FailoverRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "FailoverRequest struct{}"
+ }
+
+ return strings.Join([]string{"FailoverRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_failover_strategy_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_failover_strategy_request.go
new file mode 100644
index 0000000000..32a57e2629
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_failover_strategy_request.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type FailoverStrategyRequest struct {
+
+ // 可用性策略,可选择如下方式: - reliability:可靠性优先,数据库应该尽可能保障数据的可靠性,即数据丢失量最少。对于数据一致性要求较高的业务,建议选择该策略。 - availability:可用性优先,数据库应该可快恢复服务,即可用时间最长。对于数据库在线时间要求较高的业务,建议选择该策略。
+ RepairStrategy string `json:"repairStrategy"`
+}
+
+func (o FailoverStrategyRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "FailoverStrategyRequest struct{}"
+ }
+
+ return strings.Join([]string{"FailoverStrategyRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_flavor.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_flavor.go
new file mode 100644
index 0000000000..50639512ae
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_flavor.go
@@ -0,0 +1,47 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// Flavor 规格信息。
+type Flavor struct {
+
+ // 规格id
+ Id string `json:"id"`
+
+ // CPU个数。
+ Vcpus string `json:"vcpus"`
+
+ // 内存大小,单位为GB。
+ Ram int32 `json:"ram"`
+
+ // 资源规格编码。例如:rds.mysql.m1.xlarge.rr。 其中形如“xxx.xxx.mcs.i3.xxx.xxx.xxx”是超高性能型(尊享版),需要申请一定权限才可使用,更多规格说明请参考数据库实例规格。 - “rds”代表RDS产品。 - “mysql”代表数据库引擎。 - “m1.xlarge”代表性能规格,为高内存类型。
+ SpecCode string `json:"spec_code"`
+
+ // 实例模型,包括如下类型: - ha,主备实例。 - replica,只读实例。 - single,单实例。
+ InstanceMode string `json:"instance_mode"`
+
+ // 其中key是可用区编号,value是规格所在az的状态,包含以下状态: - normal,在售。 - unsupported,暂不支持该规格。 - sellout,售罄。
+ AzStatus map[string]string `json:"az_status"`
+
+ // 规格所在az的描述。
+ AzDesc map[string]string `json:"az_desc"`
+
+ // 数组形式版本号
+ VersionName []string `json:"version_name"`
+
+ // 性能规格,包含以下状态: - normal:通用增强型。 - normal2:通用增强Ⅱ型。 - armFlavors:鲲鹏通用增强型。 - dedicicatenormal :x86独享型。 - armlocalssd:鲲鹏通用型。 - normallocalssd:x86通用型。 - general:通用型。 - dedicated:独享型,仅云盘SSD支持。 - rapid:独享型,仅极速型SSD支持。 - bigmen:超大内存型。
+ GroupType string `json:"group_type"`
+}
+
+func (o Flavor) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "Flavor struct{}"
+ }
+
+ return strings.Join([]string{"Flavor", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_follower_migrate_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_follower_migrate_request.go
new file mode 100644
index 0000000000..dd68d74ffb
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_follower_migrate_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type FollowerMigrateRequest struct {
+
+ // 备机节点Id
+ NodeId string `json:"nodeId"`
+
+ // 要迁入的可用区code
+ AzCode string `json:"azCode"`
+}
+
+func (o FollowerMigrateRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "FollowerMigrateRequest struct{}"
+ }
+
+ return strings.Join([]string{"FollowerMigrateRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_generate_auditlog_download_link_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_generate_auditlog_download_link_request.go
new file mode 100644
index 0000000000..142a4caa01
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_generate_auditlog_download_link_request.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type GenerateAuditlogDownloadLinkRequest struct {
+
+ // 审计日志ID列表,限制50条以内。
+ Ids []string `json:"ids"`
+}
+
+func (o GenerateAuditlogDownloadLinkRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "GenerateAuditlogDownloadLinkRequest struct{}"
+ }
+
+ return strings.Join([]string{"GenerateAuditlogDownloadLinkRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_get_backup_download_link_files.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_get_backup_download_link_files.go
new file mode 100644
index 0000000000..f9afa60fc8
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_get_backup_download_link_files.go
@@ -0,0 +1,34 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type GetBackupDownloadLinkFiles struct {
+
+ // 文件名。
+ Name string `json:"name"`
+
+ // 文件大小,单位为KB。
+ Size int64 `json:"size"`
+
+ // 文件下载链接。
+ DownloadLink string `json:"download_link"`
+
+ // 下载链接过期时间,格式为“yyyy-mm-ddThh:mm:ssZ”。其中,T指某个时间的开始,Z指时区偏移量,例如北京时间偏移显示为+0800。
+ LinkExpiredTime string `json:"link_expired_time"`
+
+ // 数据库名。若文件不是数据库备份,则返回空
+ DatabaseName string `json:"database_name"`
+}
+
+func (o GetBackupDownloadLinkFiles) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "GetBackupDownloadLinkFiles struct{}"
+ }
+
+ return strings.Join([]string{"GetBackupDownloadLinkFiles", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_get_job_info_response_body_job.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_get_job_info_response_body_job.go
new file mode 100644
index 0000000000..48e9d7a578
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_get_job_info_response_body_job.go
@@ -0,0 +1,100 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// GetJobInfoResponseBodyJob 任务信息。
+type GetJobInfoResponseBodyJob struct {
+
+ // 任务ID。
+ Id string `json:"id"`
+
+ // 任务名称。
+ Name string `json:"name"`
+
+ // 任务执行状态。 取值: - 值为“Running”,表示任务正在执行。 - 值为“Completed”,表示任务执行成功。 - 值为“Failed”,表示任务执行失败。
+ Status GetJobInfoResponseBodyJobStatus `json:"status"`
+
+ // 创建时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ Created string `json:"created"`
+
+ // 结束时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ Ended *string `json:"ended,omitempty"`
+
+ // 任务执行进度。执行中状态才返回执行进度,例如60%,否则返回“”。
+ Process *string `json:"process,omitempty"`
+
+ Instance *GetTaskDetailListRspJobsInstance `json:"instance"`
+
+ // 根据不同的任务,显示不同的内容。
+ Entities *interface{} `json:"entities,omitempty"`
+
+ // 任务执行失败时的错误信息。
+ FailReason *string `json:"fail_reason,omitempty"`
+}
+
+func (o GetJobInfoResponseBodyJob) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "GetJobInfoResponseBodyJob struct{}"
+ }
+
+ return strings.Join([]string{"GetJobInfoResponseBodyJob", string(data)}, " ")
+}
+
+type GetJobInfoResponseBodyJobStatus struct {
+ value string
+}
+
+type GetJobInfoResponseBodyJobStatusEnum struct {
+ RUNNING GetJobInfoResponseBodyJobStatus
+ COMPLETED GetJobInfoResponseBodyJobStatus
+ FAILED GetJobInfoResponseBodyJobStatus
+}
+
+func GetGetJobInfoResponseBodyJobStatusEnum() GetJobInfoResponseBodyJobStatusEnum {
+ return GetJobInfoResponseBodyJobStatusEnum{
+ RUNNING: GetJobInfoResponseBodyJobStatus{
+ value: "Running",
+ },
+ COMPLETED: GetJobInfoResponseBodyJobStatus{
+ value: "Completed",
+ },
+ FAILED: GetJobInfoResponseBodyJobStatus{
+ value: "Failed",
+ },
+ }
+}
+
+func (c GetJobInfoResponseBodyJobStatus) Value() string {
+ return c.value
+}
+
+func (c GetJobInfoResponseBodyJobStatus) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *GetJobInfoResponseBodyJobStatus) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_get_off_site_backup_policy.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_get_off_site_backup_policy.go
new file mode 100644
index 0000000000..321f32213d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_get_off_site_backup_policy.go
@@ -0,0 +1,32 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// GetOffSiteBackupPolicy 备份策略对象,包括备份类型、备份保留天数、目标区域ID和目标project ID。
+type GetOffSiteBackupPolicy struct {
+
+ // 指定备份的类型。取值如下: - auto:自动全量备份。 - incremental:自动增量备份。 - manual:手动备份,仅SQL Server返回该备份类型 。
+ BackupType *string `json:"backup_type,omitempty"`
+
+ // 备份文件可以保存的天数。
+ KeepDays *int32 `json:"keep_days,omitempty"`
+
+ // 设置跨区域备份策略的目标区域ID。
+ DestinationRegion *string `json:"destination_region,omitempty"`
+
+ // 设置跨区域备份策略的目标project ID。
+ DestinationProjectId *string `json:"destination_project_id,omitempty"`
+}
+
+func (o GetOffSiteBackupPolicy) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "GetOffSiteBackupPolicy struct{}"
+ }
+
+ return strings.Join([]string{"GetOffSiteBackupPolicy", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_get_restore_time_response_restore_time.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_get_restore_time_response_restore_time.go
new file mode 100644
index 0000000000..5aeec21a02
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_get_restore_time_response_restore_time.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type GetRestoreTimeResponseRestoreTime struct {
+
+ // 可恢复时间段的起始时间点,UNIX时间戳格式,单位是毫秒,时区是UTC。
+ StartTime int64 `json:"start_time"`
+
+ // 可恢复时间段的结束时间点,UNIX时间戳格式,单位是毫秒,时区是UTC。
+ EndTime int64 `json:"end_time"`
+}
+
+func (o GetRestoreTimeResponseRestoreTime) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "GetRestoreTimeResponseRestoreTime struct{}"
+ }
+
+ return strings.Join([]string{"GetRestoreTimeResponseRestoreTime", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_get_task_detail_list_rsp_jobs.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_get_task_detail_list_rsp_jobs.go
new file mode 100644
index 0000000000..8b40c4b5d5
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_get_task_detail_list_rsp_jobs.go
@@ -0,0 +1,103 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// GetTaskDetailListRspJobs 任务信息。
+type GetTaskDetailListRspJobs struct {
+
+ // 任务ID。
+ Id string `json:"id"`
+
+ // 任务名称。
+ Name string `json:"name"`
+
+ // 任务执行状态。 取值: - 值为“Running”,表示任务正在执行。 - 值为“Completed”,表示任务执行成功。 - 值为“Failed”,表示任务执行失败。
+ Status GetTaskDetailListRspJobsStatus `json:"status"`
+
+ // 创建时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ Created string `json:"created"`
+
+ // 结束时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ Ended *string `json:"ended,omitempty"`
+
+ // 任务执行进度。执行中状态才返回执行进度,例如60%,否则返回“”。
+ Process *string `json:"process,omitempty"`
+
+ // 任务执行的具体的参数信息,为空则不返回该字段。
+ TaskDetail *string `json:"task_detail,omitempty"`
+
+ Instance *GetTaskDetailListRspJobsInstance `json:"instance"`
+
+ // 根据不同的任务,显示不同的内容。
+ Entities *interface{} `json:"entities,omitempty"`
+
+ // 任务执行失败时的错误信息。
+ FailReason *string `json:"fail_reason,omitempty"`
+}
+
+func (o GetTaskDetailListRspJobs) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "GetTaskDetailListRspJobs struct{}"
+ }
+
+ return strings.Join([]string{"GetTaskDetailListRspJobs", string(data)}, " ")
+}
+
+type GetTaskDetailListRspJobsStatus struct {
+ value string
+}
+
+type GetTaskDetailListRspJobsStatusEnum struct {
+ RUNNING GetTaskDetailListRspJobsStatus
+ COMPLETED GetTaskDetailListRspJobsStatus
+ FAILED GetTaskDetailListRspJobsStatus
+}
+
+func GetGetTaskDetailListRspJobsStatusEnum() GetTaskDetailListRspJobsStatusEnum {
+ return GetTaskDetailListRspJobsStatusEnum{
+ RUNNING: GetTaskDetailListRspJobsStatus{
+ value: "Running",
+ },
+ COMPLETED: GetTaskDetailListRspJobsStatus{
+ value: "Completed",
+ },
+ FAILED: GetTaskDetailListRspJobsStatus{
+ value: "Failed",
+ },
+ }
+}
+
+func (c GetTaskDetailListRspJobsStatus) Value() string {
+ return c.value
+}
+
+func (c GetTaskDetailListRspJobsStatus) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *GetTaskDetailListRspJobsStatus) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_get_task_detail_list_rsp_jobs_instance.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_get_task_detail_list_rsp_jobs_instance.go
new file mode 100644
index 0000000000..bbe2f51c73
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_get_task_detail_list_rsp_jobs_instance.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// GetTaskDetailListRspJobsInstance 执行任务的实例信息。
+type GetTaskDetailListRspJobsInstance struct {
+
+ // 实例ID。
+ Id string `json:"id"`
+
+ // 实例名称。
+ Name string `json:"name"`
+}
+
+func (o GetTaskDetailListRspJobsInstance) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "GetTaskDetailListRspJobsInstance struct{}"
+ }
+
+ return strings.Join([]string{"GetTaskDetailListRspJobsInstance", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_grant_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_grant_request.go
new file mode 100644
index 0000000000..db0fa7b2f9
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_grant_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type GrantRequest struct {
+
+ // 数据库名称。
+ DbName string `json:"db_name"`
+
+ // 每个元素都是与数据库相关联的帐号。单次请求最多支持50个元素。
+ Users []UserWithPrivilege `json:"users"`
+}
+
+func (o GrantRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "GrantRequest struct{}"
+ }
+
+ return strings.Join([]string{"GrantRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_ha.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_ha.go
new file mode 100644
index 0000000000..ffcdb70e82
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_ha.go
@@ -0,0 +1,127 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// Ha HA配置参数,创建HA实例时使用。
+type Ha struct {
+
+ // 实例主备模式,取值:Ha(主备),不区分大小写。
+ Mode HaMode `json:"mode"`
+
+ // 备机同步参数。实例主备模式为Ha时有效。 取值: - MySQL为“async”或“semisync”。 - PostgreSQL为“async”或“sync”。 - Microsoft SQL Server为“sync”。
+ ReplicationMode HaReplicationMode `json:"replication_mode"`
+}
+
+func (o Ha) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "Ha struct{}"
+ }
+
+ return strings.Join([]string{"Ha", string(data)}, " ")
+}
+
+type HaMode struct {
+ value string
+}
+
+type HaModeEnum struct {
+ HA HaMode
+ SINGLE HaMode
+}
+
+func GetHaModeEnum() HaModeEnum {
+ return HaModeEnum{
+ HA: HaMode{
+ value: "Ha",
+ },
+ SINGLE: HaMode{
+ value: "Single",
+ },
+ }
+}
+
+func (c HaMode) Value() string {
+ return c.value
+}
+
+func (c HaMode) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *HaMode) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
+
+type HaReplicationMode struct {
+ value string
+}
+
+type HaReplicationModeEnum struct {
+ ASYNC HaReplicationMode
+ SEMISYNC HaReplicationMode
+ SYNC HaReplicationMode
+}
+
+func GetHaReplicationModeEnum() HaReplicationModeEnum {
+ return HaReplicationModeEnum{
+ ASYNC: HaReplicationMode{
+ value: "async",
+ },
+ SEMISYNC: HaReplicationMode{
+ value: "semisync",
+ },
+ SYNC: HaReplicationMode{
+ value: "sync",
+ },
+ }
+}
+
+func (c HaReplicationMode) Value() string {
+ return c.value
+}
+
+func (c HaReplicationMode) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *HaReplicationMode) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_ha_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_ha_response.go
new file mode 100644
index 0000000000..765c24ddca
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_ha_response.go
@@ -0,0 +1,77 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// HaResponse HA配置参数,创建HA实例时使用。
+type HaResponse struct {
+
+ // 备机同步参数。实例主备模式为Ha时有效。 取值: - MySQL为“async”或“semisync”。 - PostgreSQL为“async”或“sync”。 - Microsoft SQL Server为“sync”。
+ ReplicationMode HaResponseReplicationMode `json:"replication_mode"`
+}
+
+func (o HaResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "HaResponse struct{}"
+ }
+
+ return strings.Join([]string{"HaResponse", string(data)}, " ")
+}
+
+type HaResponseReplicationMode struct {
+ value string
+}
+
+type HaResponseReplicationModeEnum struct {
+ ASYNC HaResponseReplicationMode
+ SEMISYNC HaResponseReplicationMode
+ SYNC HaResponseReplicationMode
+}
+
+func GetHaResponseReplicationModeEnum() HaResponseReplicationModeEnum {
+ return HaResponseReplicationModeEnum{
+ ASYNC: HaResponseReplicationMode{
+ value: "async",
+ },
+ SEMISYNC: HaResponseReplicationMode{
+ value: "semisync",
+ },
+ SYNC: HaResponseReplicationMode{
+ value: "sync",
+ },
+ }
+}
+
+func (c HaResponseReplicationMode) Value() string {
+ return c.value
+}
+
+func (c HaResponseReplicationMode) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *HaResponseReplicationMode) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_inspection_reports.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_inspection_reports.go
new file mode 100644
index 0000000000..73449f3d9b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_inspection_reports.go
@@ -0,0 +1,37 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type InspectionReports struct {
+
+ // 检查报告ID。
+ Id string `json:"id"`
+
+ // 检查时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如偏移1个小时显示为+0100。
+ CheckTime string `json:"check_time"`
+
+ // 到期时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如偏移1个小时显示为+0100。
+ ExpirationTime string `json:"expiration_time"`
+
+ // 目标版本。
+ TargetVersion string `json:"target_version"`
+
+ // 检查结果。 success,表示成功。 failed,表示失败。 running, 表示检查中。
+ Result string `json:"result"`
+
+ // 检查报告详情。
+ Detail string `json:"detail"`
+}
+
+func (o InspectionReports) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "InspectionReports struct{}"
+ }
+
+ return strings.Join([]string{"InspectionReports", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_instance_dr_relation.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_instance_dr_relation.go
new file mode 100644
index 0000000000..5ccb0121ab
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_instance_dr_relation.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// InstanceDrRelation 容灾实例信息。
+type InstanceDrRelation struct {
+
+ // 当前区域实例ID。
+ InstanceId *string `json:"instance_id,omitempty"`
+
+ MasterInstance *MasterInstance `json:"master_instance,omitempty"`
+
+ // 容灾实例信息列表。
+ SlaveInstances *[]SlaveInstance `json:"slave_instances,omitempty"`
+}
+
+func (o InstanceDrRelation) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "InstanceDrRelation struct{}"
+ }
+
+ return strings.Join([]string{"InstanceDrRelation", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_instance_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_instance_request.go
new file mode 100644
index 0000000000..d0b2c637b2
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_instance_request.go
@@ -0,0 +1,94 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// InstanceRequest 实例信息。
+type InstanceRequest struct {
+
+ // 实例名称。 用于表示实例的名称,同一租户下,同类型的实例名可重名。取值范围如下: - MySQL数据库支持的字符长度是4~64个字符,必须以字母开头,区分大小写,可以包含字母、数字、中文字符、中划线或者下划线,不能包含其他的特殊字符。 - PostgreSQL和SQL Server数据库支持的字符长度是4~64个字符,必须以字母开头,区分大小写,可以包含字母、数字、中划线或者下划线,不能包含其他的特殊字符。
+ Name string `json:"name"`
+
+ Datastore *Datastore `json:"datastore"`
+
+ Ha *Ha `json:"ha,omitempty"`
+
+ // 参数模板ID。可调用[获取参数模板列表](https://support.huaweicloud.com/api-rds/rds_09_0301.html)接口返回的ID获取。
+ ConfigurationId *string `json:"configuration_id,omitempty"`
+
+ // 数据库端口信息。 - MySQL数据库端口设置范围为1024~65535(其中12017和33071被RDS系统占用不可设置)。 - PostgreSQL数据库端口修改范围为2100~9500。 - Microsoft SQL Server实例的端口设置范围为1433和2100~9500(其中5355和5985不可设置。对于2017 EE、2017 SE、2017 Web版,5050、5353和5986不可设置。 当不传该参数时,默认端口如下: - MySQL默认3306。 - PostgreSQL默认5432。 - Microsoft SQL Server默认1433。
+ Port *string `json:"port,omitempty"`
+
+ // 数据库密码。创建只读实例时不可选,其它场景必选。 取值范围: 非空,由大小写字母、数字和特殊符号~!@#%^*-_=+?组成,长度8~32个字符。 其中允许的特殊字符如下: - MySQL数据库允许输入~!@#$%^*-_=+?,特殊字符。 - SQL Server数据库允许输入~!@#$%^*-_+?,特殊字符。 - PostgreSQL数据库允许输入~!@#%^*-_=+?,特殊字符。 建议您输入高强度密码,以提高安全性,防止出现密码被暴力破解等安全风险。
+ Password *string `json:"password,omitempty"`
+
+ BackupStrategy *BackupStrategy `json:"backup_strategy,omitempty"`
+
+ // 企业项目ID。 使用请参考《企业管理 API参考》的[查询企业项目列表](https://support.huaweicloud.com/api-em/zh-cn_topic_0121230880.html)响应消息表“enterprise_project字段数据结构说明”的“id”。
+ EnterpriseProjectId *string `json:"enterprise_project_id,omitempty"`
+
+ // 用于磁盘加密的密钥ID,默认为空。
+ DiskEncryptionId *string `json:"disk_encryption_id,omitempty"`
+
+ // 规格码,取值范围:非空。 使用[查询数据库规格](https://support.huaweicloud.com/api-rds/rds_06_0002.html)接口响应消息中的 flavors字段中“spec_code”获取且对应az_status为“在售”状态。
+ FlavorRef string `json:"flavor_ref"`
+
+ Volume *Volume `json:"volume"`
+
+ // 区域ID。创建主实例时必选,其它场景不可选。 取值参见[地区和终端节点](https://developer.huaweicloud.com/endpoint)。
+ Region string `json:"region"`
+
+ // 可用区ID。对于数据库实例类型不是单机的实例,需要分别为实例所有节点指定可用区,并用逗号隔开。 取值参见[地区和终端节点](https://developer.huaweicloud.com/endpoint)。
+ AvailabilityZone string `json:"availability_zone"`
+
+ // 虚拟私有云ID。创建只读实例时不可选(只读实例的网络属性默认和主实例相同),其它场景必选。 获取方法如下: - 方法1:登录虚拟私有云服务的控制台界面,在虚拟私有云的详情页面查找VPC ID。 - 方法2:通过虚拟私有云服务的API接口查询,具体操作可参考[查询VPC列表](https://support.huaweicloud.com/api-vpc/vpc_api01_0003.html)。
+ VpcId string `json:"vpc_id"`
+
+ // 子网的网络ID信息。创建只读实例时不可选(只读实例的网络属性默认和主实例相同),其它场景必选。 获取方法如下: - 方法1:登录虚拟私有云服务的控制台界面,单击VPC下的子网,进入子网详情页面,查找网络ID。 - 方法2:通过虚拟私有云服务的API接口查询,具体操作可参考[查询子网列表](https://support.huaweicloud.com/api-vpc/vpc_subnet01_0003.html)。
+ SubnetId string `json:"subnet_id"`
+
+ // 指定实例的内网IP,目前仅支持设置IPv4地址。 获取方法如下: - 方法1:登录虚拟私有云服务的控制台界面,单击VPC下的子网,进入子网详情页面,查找子网的网段,选择未被占用的IP。 - 方法2:通过虚拟私有云服务的API接口查询,具体操作可参考[查询私有IP列表](https://support.huaweicloud.com/api-vpc/vpc_privateip_0003.html),选择“device_owner”为空的私有IP。
+ DataVip *string `json:"data_vip,omitempty"`
+
+ // 安全组ID。创建只读实例时不可选(只读实例的网络属性默认和主实例相同),其它场景必选。 获取方法如下: - 方法1:登录虚拟私有云服务的控制台界面,在安全组的详情页面查找安全组ID。 - 方法2:通过虚拟私有云服务的API接口查询,具体操作可参考[查询安全组列表](https://support.huaweicloud.com/api-vpc/vpc_sg01_0003.html)。
+ SecurityGroupId string `json:"security_group_id"`
+
+ ChargeInfo *ChargeInfo `json:"charge_info,omitempty"`
+
+ // 时区。 - 不选择时,各个引擎时区如下: - MySQL国内站、国际站默认为UTC时间。 - PostgreSQL国内站、国际站默认为UTC时间。 - Microsoft SQL Server国内站默认为China Standard Time,国际站默认为UTC时间。 - MySQL和PostgreSQL引擎选择填写时,取值范围为UTC-12:00~UTC+12:00,且只支持整段时间,如UTC+08:00,不支持UTC+08:30。 - Microsoft SQL Server引擎选择填写时,请参见“创建数据库实例”接口[表10](https://support.huaweicloud.com/api-rds/rds_01_0002.html#rds_01_0002__table613473883617) 时区与UTC偏移量对照表,填写时区列字符串,如:China Standard Time。
+ TimeZone *string `json:"time_zone,omitempty"`
+
+ // Dec用户专属存储ID,每个az配置的专属存储不同,Dec用户创建实例时,对于数据库实例类型不是单机或只读的实例,需要分别为实例所有节点指定dsspoolId,并用逗号隔开。 获取方法如下: - 方法1:登录专属分布式存储服务DSS的控制台界面,查看专属存储列表,选择符合条件的az下的专属dss的ID。 - 方法2:通过专属分布式存储服务DSS的API接口查询,具体操作可参考[获取专属存储详情列表](https://support.huaweicloud.com/api-dss/dss_02_1002.html)。
+ DsspoolId *string `json:"dsspool_id,omitempty"`
+
+ // 只读实例的主实例ID。创建只读实例时必选,其它场景不可选。
+ ReplicaOfId *string `json:"replica_of_id,omitempty"`
+
+ RestorePoint *RestorePoint `json:"restore_point,omitempty"`
+
+ // 仅限Microsoft SQL Server实例创建使用。对于MySQL和PostgreSQL实例,该参数无意义。取值范围:根据查询SQL Server可用字符集的字符集查询列表查询可设置的字符集。 取值范围:根据[查询SQL Server可用字符集](https://support.huaweicloud.com/api-rds/rds_05_0010.html)查询可设置的字符集。
+ Collation *string `json:"collation,omitempty"`
+
+ // 标签列表。单个实例总标签数上限20个。
+ Tags *[]TagWithKeyValue `json:"tags,omitempty"`
+
+ UnchangeableParam *UnchangeableParam `json:"unchangeable_param,omitempty"`
+
+ // 是否只预检此次请求,仅支持MySQL。 - true:发送参数检查请求,不会创建实例。 - 检查通过:返回202状态码。 - 检查不通过:返回对应错误码,详情请参考错误码。 - false:发送正常请求,通过检查后,并且执行创建实例的请求。
+ DryRun *bool `json:"dry_run,omitempty"`
+
+ // 批量创建实例的数量,取值范围为1~50。
+ Count *int32 `json:"count,omitempty"`
+}
+
+func (o InstanceRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "InstanceRequest struct{}"
+ }
+
+ return strings.Join([]string{"InstanceRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_instance_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_instance_response.go
new file mode 100644
index 0000000000..16ad14d0a5
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_instance_response.go
@@ -0,0 +1,135 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// InstanceResponse 实例信息。
+type InstanceResponse struct {
+
+ // 实例ID。
+ Id string `json:"id"`
+
+ // 实例状态。 - 值为“BUILD”,表示实例正在创建。 - 值为“ACTIVE”,表示实例正常。 - 值为“FAILED”,表示实例异常。 - 值为“FROZEN”,表示实例冻结。 - 值为“MODIFYING”,表示实例正在扩容。 - 值为“REBOOTING”,表示实例正在重启。 - 值为“RESTORING”,表示实例正在恢复。 - 值为“MODIFYING INSTANCE TYPE”,表示实例正在转主备。 - 值为“SWITCHOVER”,表示实例正在主备切换。 - 值为“MIGRATING”,表示实例正在迁移。 - 值为“BACKING UP”,表示实例正在进行备份。 - 值为“MODIFYING DATABASE PORT”,表示实例正在修改数据库端口。 - 值为“STORAGE FULL”,表示实例磁盘空间满。
+ Status string `json:"status"`
+
+ // 实例是否开启SSL,取值为\"true\"表示实例开启了SSL,取值为\"false\"表示实例未开启SSL。
+ EnableSsl bool `json:"enable_ssl"`
+
+ // 实例内网IP地址列表。弹性云服务器创建成功后该值存在,其他情况下为空字符串。
+ PrivateIps []string `json:"private_ips"`
+
+ // 内网域名列表
+ PrivateDnsNames *[]string `json:"private_dns_names,omitempty"`
+
+ // 公网域名列表
+ PublicDnsNames *[]string `json:"public_dns_names,omitempty"`
+
+ // 实例外网IP地址列表。
+ PublicIps []string `json:"public_ips"`
+
+ // 实例类型,取值为“Single”,“Ha”或“Replica”,分别对应于单机实例、主备实例、只读实例。
+ Type string `json:"type"`
+
+ // 创建时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。 说明:创建时返回值为空,数据库实例创建成功后该值不为空。
+ Created string `json:"created"`
+
+ // 更新时间,格式与“created”字段对应格式完全相同。 说明:创建时返回值为空,数据库实例创建成功后该值不为空。
+ Updated string `json:"updated"`
+
+ // 默认用户名。
+ DbUserName string `json:"db_user_name"`
+
+ // 数据库切换策略。取值为“reliability”或“availability”,分别对应于可靠性优先和可用性优先。
+ SwitchStrategy string `json:"switch_strategy"`
+
+ // 客户设置实例只读API的状态信息。仅支持RDS for MySQL引擎。 - true,表示该实例为客户设置的只读状态 - false, 表示该实例未被客户设置只读
+ ReadOnlyByUser *bool `json:"read_only_by_user,omitempty"`
+
+ // 可维护时间窗,为UTC时间。
+ MaintenanceWindow string `json:"maintenance_window"`
+
+ Nodes []NodeResponse `json:"nodes"`
+
+ RelatedInstance []RelatedInstance `json:"related_instance"`
+
+ // 实例名称。
+ Name string `json:"name"`
+
+ Datastore *Datastore `json:"datastore"`
+
+ Ha *HaResponse `json:"ha,omitempty"`
+
+ // 数据库端口信息。 - MySQL数据库端口设置范围为1024~65535(其中12017和33071被RDS系统占用不可设置)。 - PostgreSQL数据库端口修改范围为2100~9500。 - Microsoft SQL Server实例的端口设置范围为1433和2100~9500(其中5355和5985不可设置。对于2017 EE版,5050、5353和5986不可设置)。 当不传该参数时,默认端口如下: - MySQL默认3306。 - PostgreSQL默认5432。 - Microsoft SQL Server默认1433。
+ Port int32 `json:"port"`
+
+ BackupStrategy *BackupStrategyForResponse `json:"backup_strategy"`
+
+ // 企业项目ID。
+ EnterpriseProjectId string `json:"enterprise_project_id"`
+
+ // 用于磁盘加密的密钥ID。
+ DiskEncryptionId string `json:"disk_encryption_id"`
+
+ // 规格码。
+ FlavorRef string `json:"flavor_ref"`
+
+ // CPU大小。例如,1表示1U。
+ Cpu *string `json:"cpu,omitempty"`
+
+ // 内存大小(单位:GB)。
+ Mem *string `json:"mem,omitempty"`
+
+ Volume *Volume `json:"volume"`
+
+ // 区域ID。
+ Region string `json:"region"`
+
+ // 虚拟私有云ID。
+ VpcId string `json:"vpc_id"`
+
+ // 子网ID。
+ SubnetId string `json:"subnet_id"`
+
+ // 安全组ID。
+ SecurityGroupId string `json:"security_group_id"`
+
+ ChargeInfo *ChargeInfoResponse `json:"charge_info"`
+
+ // 时区。
+ TimeZone string `json:"time_zone"`
+
+ Tags []TagResponse `json:"tags"`
+
+ // 备份空间使用量,单位GB。 该字段仅用于查询指定SQL Server实例信息时返回。
+ BackupUsedSpace *float64 `json:"backup_used_space,omitempty"`
+
+ // 磁盘空间使用量,单位GB。 该字段仅用于查询指定SQL Server实例信息时返回。
+ StorageUsedSpace *float64 `json:"storage_used_space,omitempty"`
+
+ // 订单ID,仅包周期场景返回。
+ OrderId *string `json:"order_id,omitempty"`
+
+ // 是否已被DDM实例关联。
+ AssociatedWithDdm *bool `json:"associated_with_ddm,omitempty"`
+
+ // 实例的备注信息。
+ Alias *string `json:"alias,omitempty"`
+
+ // 实例磁盘的最大IOPS值。 当前该字段仅对于SQL Server引擎实例返回。
+ MaxIops *int64 `json:"max_iops,omitempty"`
+
+ // 实例的到期时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 仅包周期场景返回。
+ ExpirationTime *string `json:"expiration_time,omitempty"`
+}
+
+func (o InstanceResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "InstanceResponse struct{}"
+ }
+
+ return strings.Join([]string{"InstanceResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_instance_restart_requset_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_instance_restart_requset_body.go
new file mode 100644
index 0000000000..e3e8d7aea4
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_instance_restart_requset_body.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type InstanceRestartRequsetBody struct {
+
+ // 空值
+ Restart *interface{} `json:"restart"`
+}
+
+func (o InstanceRestartRequsetBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "InstanceRestartRequsetBody struct{}"
+ }
+
+ return strings.Join([]string{"InstanceRestartRequsetBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_l_datastore.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_l_datastore.go
new file mode 100644
index 0000000000..9a6cb63e81
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_l_datastore.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// LDatastore 数据库版本信息。
+type LDatastore struct {
+
+ // 数据库版本ID。
+ Id string `json:"id"`
+
+ // 数据库版本号。 - 对于MySQL引擎可以返回小版本号,例如MySQL 5.6.51版本,将返回5.6.51。 - 对于PostgreSQL和SQL Server引擎,只返回两位数的大版本号,例如PostgreSQL 9.6.X版本,仅返回9.6。
+ Name string `json:"name"`
+}
+
+func (o LDatastore) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "LDatastore struct{}"
+ }
+
+ return strings.Join([]string{"LDatastore", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_links_info_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_links_info_response.go
new file mode 100644
index 0000000000..ca3db1f81c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_links_info_response.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type LinksInfoResponse struct {
+
+ // 对应该API的URL
+ Href *string `json:"href,omitempty"`
+
+ // 取值为“self”,表示href为本地链接。
+ Rel *string `json:"rel,omitempty"`
+}
+
+func (o LinksInfoResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "LinksInfoResponse struct{}"
+ }
+
+ return strings.Join([]string{"LinksInfoResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_api_version_new_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_api_version_new_request.go
new file mode 100644
index 0000000000..f2bc7cdc96
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_api_version_new_request.go
@@ -0,0 +1,20 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListApiVersionNewRequest Request Object
+type ListApiVersionNewRequest struct {
+}
+
+func (o ListApiVersionNewRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListApiVersionNewRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListApiVersionNewRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_api_version_new_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_api_version_new_response.go
new file mode 100644
index 0000000000..d719d836a0
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_api_version_new_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListApiVersionNewResponse Response Object
+type ListApiVersionNewResponse struct {
+
+ // API版本详细信息列表。
+ Versions *[]ApiVersion `json:"versions,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListApiVersionNewResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListApiVersionNewResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListApiVersionNewResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_api_version_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_api_version_request.go
new file mode 100644
index 0000000000..0297d3720a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_api_version_request.go
@@ -0,0 +1,20 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListApiVersionRequest Request Object
+type ListApiVersionRequest struct {
+}
+
+func (o ListApiVersionRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListApiVersionRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListApiVersionRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_api_version_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_api_version_response.go
new file mode 100644
index 0000000000..cd0f6d4513
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_api_version_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListApiVersionResponse Response Object
+type ListApiVersionResponse struct {
+
+ // API版本详细信息列表。
+ Versions *[]ApiVersion `json:"versions,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListApiVersionResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListApiVersionResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListApiVersionResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_auditlogs_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_auditlogs_request.go
new file mode 100644
index 0000000000..ee33ae4a96
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_auditlogs_request.go
@@ -0,0 +1,38 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListAuditlogsRequest Request Object
+type ListAuditlogsRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 查询开始时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ StartTime string `json:"start_time"`
+
+ // 查询结束时间,格式为“yyyy-mm-ddThh:mm:ssZ”,且大于查询开始时间,时间跨度不超过30天。 其中,T指某个时间的开始,Z指时区偏移量,例如北京时间偏移显示为+0800。
+ EndTime string `json:"end_time"`
+
+ // 索引位置,偏移量。 从第一条数据偏移offset条数据后开始查询,默认为0(偏移0条数据,表示从第一条数据开始查询),必须为数字,不能为负数。
+ Offset int32 `json:"offset"`
+
+ // 查询记录数。取值范围[1, 50]。
+ Limit int32 `json:"limit"`
+}
+
+func (o ListAuditlogsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListAuditlogsRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListAuditlogsRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_auditlogs_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_auditlogs_response.go
new file mode 100644
index 0000000000..e45d6a88cb
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_auditlogs_response.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListAuditlogsResponse Response Object
+type ListAuditlogsResponse struct {
+ Auditlogs *[]Auditlog `json:"auditlogs,omitempty"`
+
+ // 总记录数。
+ TotalRecord *int32 `json:"total_record,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListAuditlogsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListAuditlogsResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListAuditlogsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_authorized_databases_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_authorized_databases_request.go
new file mode 100644
index 0000000000..1f91ebe387
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_authorized_databases_request.go
@@ -0,0 +1,35 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListAuthorizedDatabasesRequest Request Object
+type ListAuthorizedDatabasesRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 数据库用户名。
+ UserName string `json:"user-name"`
+
+ // 分页页码,从1开始。
+ Page int32 `json:"page"`
+
+ // 每页数据条数。取值范围[1, 100]。
+ Limit int32 `json:"limit"`
+}
+
+func (o ListAuthorizedDatabasesRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListAuthorizedDatabasesRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListAuthorizedDatabasesRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_authorized_databases_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_authorized_databases_response.go
new file mode 100644
index 0000000000..d391261e24
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_authorized_databases_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListAuthorizedDatabasesResponse Response Object
+type ListAuthorizedDatabasesResponse struct {
+
+ // 数据库及相关权限。
+ Databases *[]DatabaseWithPrivilege `json:"databases,omitempty"`
+
+ // 总数。
+ TotalCount *int32 `json:"total_count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListAuthorizedDatabasesResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListAuthorizedDatabasesResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListAuthorizedDatabasesResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_authorized_db_users_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_authorized_db_users_request.go
new file mode 100644
index 0000000000..7da05dd852
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_authorized_db_users_request.go
@@ -0,0 +1,35 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListAuthorizedDbUsersRequest Request Object
+type ListAuthorizedDbUsersRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 数据库名。
+ DbName string `json:"db-name"`
+
+ // 分页页码,从1开始。
+ Page int32 `json:"page"`
+
+ // 每页数据条数。取值范围[1, 100]。
+ Limit int32 `json:"limit"`
+}
+
+func (o ListAuthorizedDbUsersRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListAuthorizedDbUsersRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListAuthorizedDbUsersRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_authorized_db_users_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_authorized_db_users_response.go
new file mode 100644
index 0000000000..596a10f980
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_authorized_db_users_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListAuthorizedDbUsersResponse Response Object
+type ListAuthorizedDbUsersResponse struct {
+
+ // 用户及相关权限。
+ Users *[]UserWithPrivilege `json:"users,omitempty"`
+
+ // 总数。
+ TotalCount *int32 `json:"total_count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListAuthorizedDbUsersResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListAuthorizedDbUsersResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListAuthorizedDbUsersResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_authorized_sqlserver_db_users_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_authorized_sqlserver_db_users_request.go
new file mode 100644
index 0000000000..e99aa7f7e9
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_authorized_sqlserver_db_users_request.go
@@ -0,0 +1,35 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListAuthorizedSqlserverDbUsersRequest Request Object
+type ListAuthorizedSqlserverDbUsersRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 数据库名。
+ DbName string `json:"db-name"`
+
+ // 分页页码,从1开始。
+ Page int32 `json:"page"`
+
+ // 每页数据条数。取值范围[1, 100]。
+ Limit int32 `json:"limit"`
+}
+
+func (o ListAuthorizedSqlserverDbUsersRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListAuthorizedSqlserverDbUsersRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListAuthorizedSqlserverDbUsersRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_authorized_sqlserver_db_users_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_authorized_sqlserver_db_users_response.go
new file mode 100644
index 0000000000..631f311050
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_authorized_sqlserver_db_users_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListAuthorizedSqlserverDbUsersResponse Response Object
+type ListAuthorizedSqlserverDbUsersResponse struct {
+
+ // 用户及相关权限。
+ Users *[]UserWithPrivilege `json:"users,omitempty"`
+
+ // 总数。
+ TotalCount *int32 `json:"total_count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListAuthorizedSqlserverDbUsersResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListAuthorizedSqlserverDbUsersResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListAuthorizedSqlserverDbUsersResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_backups_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_backups_request.go
new file mode 100644
index 0000000000..2c8a486a3c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_backups_request.go
@@ -0,0 +1,102 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListBackupsRequest Request Object
+type ListBackupsRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 备份ID。
+ BackupId *string `json:"backup_id,omitempty"`
+
+ // 备份类型,取值: - “auto”: 自动全量备份 - “manual”: 手动全量备份 - “fragment”: 差异全量备份 - “incremental”: 自动增量备份
+ BackupType *ListBackupsRequestBackupType `json:"backup_type,omitempty"`
+
+ // 索引位置,偏移量。从第一条数据偏移offset条数据后开始查询,默认为0(偏移0条数据,表示从第一条数据开始查询),必须为数字,不能为负数。
+ Offset *int32 `json:"offset,omitempty"`
+
+ // 查询记录数。默认为100,不能为负数,最小值为1,最大值为100。
+ Limit *int32 `json:"limit,omitempty"`
+
+ // 查询开始时间,格式为“yyyy-mm-ddThh:mm:ssZ”。其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。与end_time必须同时使用。
+ BeginTime *string `json:"begin_time,omitempty"`
+
+ // 查询结束时间,格式为“yyyy-mm-ddThh:mm:ssZ”,且大于查询开始时间。其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。与begin_time必须同时使用。
+ EndTime *string `json:"end_time,omitempty"`
+}
+
+func (o ListBackupsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListBackupsRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListBackupsRequest", string(data)}, " ")
+}
+
+type ListBackupsRequestBackupType struct {
+ value string
+}
+
+type ListBackupsRequestBackupTypeEnum struct {
+ AUTO ListBackupsRequestBackupType
+ MANUAL ListBackupsRequestBackupType
+ FRAGMENT ListBackupsRequestBackupType
+ INCREMENTAL ListBackupsRequestBackupType
+}
+
+func GetListBackupsRequestBackupTypeEnum() ListBackupsRequestBackupTypeEnum {
+ return ListBackupsRequestBackupTypeEnum{
+ AUTO: ListBackupsRequestBackupType{
+ value: "auto",
+ },
+ MANUAL: ListBackupsRequestBackupType{
+ value: "manual",
+ },
+ FRAGMENT: ListBackupsRequestBackupType{
+ value: "fragment",
+ },
+ INCREMENTAL: ListBackupsRequestBackupType{
+ value: "incremental",
+ },
+ }
+}
+
+func (c ListBackupsRequestBackupType) Value() string {
+ return c.value
+}
+
+func (c ListBackupsRequestBackupType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListBackupsRequestBackupType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_backups_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_backups_response.go
new file mode 100644
index 0000000000..12a58c3c22
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_backups_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListBackupsResponse Response Object
+type ListBackupsResponse struct {
+
+ // 备份信息。
+ Backups *[]BackupForList `json:"backups,omitempty"`
+
+ // 总记录数。
+ TotalCount *int32 `json:"total_count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListBackupsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListBackupsResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListBackupsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_collations_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_collations_request.go
new file mode 100644
index 0000000000..428f58ddc5
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_collations_request.go
@@ -0,0 +1,73 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListCollationsRequest Request Object
+type ListCollationsRequest struct {
+
+ // 语言
+ XLanguage *ListCollationsRequestXLanguage `json:"X-Language,omitempty"`
+}
+
+func (o ListCollationsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListCollationsRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListCollationsRequest", string(data)}, " ")
+}
+
+type ListCollationsRequestXLanguage struct {
+ value string
+}
+
+type ListCollationsRequestXLanguageEnum struct {
+ ZH_CN ListCollationsRequestXLanguage
+ EN_US ListCollationsRequestXLanguage
+}
+
+func GetListCollationsRequestXLanguageEnum() ListCollationsRequestXLanguageEnum {
+ return ListCollationsRequestXLanguageEnum{
+ ZH_CN: ListCollationsRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: ListCollationsRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c ListCollationsRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c ListCollationsRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListCollationsRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_collations_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_collations_response.go
new file mode 100644
index 0000000000..2e8bff6de6
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_collations_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListCollationsResponse Response Object
+type ListCollationsResponse struct {
+
+ // 字符集信息列表
+ CharSets *[]string `json:"charSets,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListCollationsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListCollationsResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListCollationsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_configurations_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_configurations_request.go
new file mode 100644
index 0000000000..f402d2f150
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_configurations_request.go
@@ -0,0 +1,73 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListConfigurationsRequest Request Object
+type ListConfigurationsRequest struct {
+
+ // 语言
+ XLanguage *ListConfigurationsRequestXLanguage `json:"X-Language,omitempty"`
+}
+
+func (o ListConfigurationsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListConfigurationsRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListConfigurationsRequest", string(data)}, " ")
+}
+
+type ListConfigurationsRequestXLanguage struct {
+ value string
+}
+
+type ListConfigurationsRequestXLanguageEnum struct {
+ ZH_CN ListConfigurationsRequestXLanguage
+ EN_US ListConfigurationsRequestXLanguage
+}
+
+func GetListConfigurationsRequestXLanguageEnum() ListConfigurationsRequestXLanguageEnum {
+ return ListConfigurationsRequestXLanguageEnum{
+ ZH_CN: ListConfigurationsRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: ListConfigurationsRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c ListConfigurationsRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c ListConfigurationsRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListConfigurationsRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_configurations_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_configurations_response.go
new file mode 100644
index 0000000000..e7d1967da7
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_configurations_response.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListConfigurationsResponse Response Object
+type ListConfigurationsResponse struct {
+ Configurations *[]ConfigurationSummary `json:"configurations,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListConfigurationsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListConfigurationsResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListConfigurationsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_databases_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_databases_request.go
new file mode 100644
index 0000000000..a42c843705
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_databases_request.go
@@ -0,0 +1,32 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListDatabasesRequest Request Object
+type ListDatabasesRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 分页页码,从1开始。
+ Page int32 `json:"page"`
+
+ // 每页数据条数。取值范围[1, 100]。
+ Limit int32 `json:"limit"`
+}
+
+func (o ListDatabasesRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListDatabasesRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListDatabasesRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_databases_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_databases_response.go
new file mode 100644
index 0000000000..72c2f35c9a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_databases_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListDatabasesResponse Response Object
+type ListDatabasesResponse struct {
+
+ // 数据库信息。
+ Databases *[]DatabaseForCreation `json:"databases,omitempty"`
+
+ // 总数。
+ TotalCount *int32 `json:"total_count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListDatabasesResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListDatabasesResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListDatabasesResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_datastores_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_datastores_request.go
new file mode 100644
index 0000000000..7e89f6a56f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_datastores_request.go
@@ -0,0 +1,84 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListDatastoresRequest Request Object
+type ListDatastoresRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 数据库引擎。支持的引擎如下,不区分大小写: MySQL PostgreSQL SQLServer
+ DatabaseName ListDatastoresRequestDatabaseName `json:"database_name"`
+}
+
+func (o ListDatastoresRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListDatastoresRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListDatastoresRequest", string(data)}, " ")
+}
+
+type ListDatastoresRequestDatabaseName struct {
+ value string
+}
+
+type ListDatastoresRequestDatabaseNameEnum struct {
+ MY_SQL ListDatastoresRequestDatabaseName
+ POSTGRE_SQL ListDatastoresRequestDatabaseName
+ SQL_SERVER ListDatastoresRequestDatabaseName
+ MARIA_DB ListDatastoresRequestDatabaseName
+}
+
+func GetListDatastoresRequestDatabaseNameEnum() ListDatastoresRequestDatabaseNameEnum {
+ return ListDatastoresRequestDatabaseNameEnum{
+ MY_SQL: ListDatastoresRequestDatabaseName{
+ value: "MySQL",
+ },
+ POSTGRE_SQL: ListDatastoresRequestDatabaseName{
+ value: "PostgreSQL",
+ },
+ SQL_SERVER: ListDatastoresRequestDatabaseName{
+ value: "SQLServer",
+ },
+ MARIA_DB: ListDatastoresRequestDatabaseName{
+ value: "MariaDB",
+ },
+ }
+}
+
+func (c ListDatastoresRequestDatabaseName) Value() string {
+ return c.value
+}
+
+func (c ListDatastoresRequestDatabaseName) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListDatastoresRequestDatabaseName) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_datastores_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_datastores_response.go
new file mode 100644
index 0000000000..62210121d8
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_datastores_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListDatastoresResponse Response Object
+type ListDatastoresResponse struct {
+
+ // 数据库引擎信息。
+ DataStores *[]LDatastore `json:"dataStores,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListDatastoresResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListDatastoresResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListDatastoresResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_db_users_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_db_users_request.go
new file mode 100644
index 0000000000..98bcee26de
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_db_users_request.go
@@ -0,0 +1,32 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListDbUsersRequest Request Object
+type ListDbUsersRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 分页页码,从1开始。
+ Page int32 `json:"page"`
+
+ // 每页数据条数。取值范围[1, 100]。
+ Limit int32 `json:"limit"`
+}
+
+func (o ListDbUsersRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListDbUsersRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListDbUsersRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_db_users_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_db_users_response.go
new file mode 100644
index 0000000000..186f4d04e9
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_db_users_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListDbUsersResponse Response Object
+type ListDbUsersResponse struct {
+
+ // 用户信息。
+ Users *[]UserForList `json:"users,omitempty"`
+
+ // 总条数。
+ TotalCount *int32 `json:"total_count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListDbUsersResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListDbUsersResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListDbUsersResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_dr_relations_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_dr_relations_request.go
new file mode 100644
index 0000000000..5ce4d7e489
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_dr_relations_request.go
@@ -0,0 +1,23 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListDrRelationsRequest Request Object
+type ListDrRelationsRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+}
+
+func (o ListDrRelationsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListDrRelationsRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListDrRelationsRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_dr_relations_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_dr_relations_response.go
new file mode 100644
index 0000000000..4c19f87788
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_dr_relations_response.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListDrRelationsResponse Response Object
+type ListDrRelationsResponse struct {
+ InstanceDrRelations *[]InstanceDrRelation `json:"instance_dr_relations,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListDrRelationsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListDrRelationsResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListDrRelationsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_engine_flavors_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_engine_flavors_request.go
new file mode 100644
index 0000000000..9d97ecdce2
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_engine_flavors_request.go
@@ -0,0 +1,44 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListEngineFlavorsRequest Request Object
+type ListEngineFlavorsRequest struct {
+
+ // 实例ID
+ InstanceId string `json:"instance_id"`
+
+ // 可用区,多个用\",\"分割,如cn-southwest-244a,cn-southwest-244b
+ AvailabilityZoneIds string `json:"availability_zone_ids"`
+
+ // 模式,包括如下类型: ha:主备实例。 replica:只读实例。 single:单实例。
+ HaMode string `json:"ha_mode"`
+
+ // 性能规格,如rds.dec.pg.s1.medium,模糊匹配该规格类型
+ SpecCodeLike *string `json:"spec_code_like,omitempty"`
+
+ // 规格类型,包括如下类型:simple、dec
+ FlavorCategoryType *string `json:"flavor_category_type,omitempty"`
+
+ // 是否显示高可用只读类型
+ IsRhaFlavor *bool `json:"is_rha_flavor,omitempty"`
+
+ // 索引位置,偏移量。 从第一条数据偏移offset条数据后开始查询,默认为0。 取值必须为数字,且不能为负数。
+ Offset *int32 `json:"offset,omitempty"`
+
+ // 查询个数上限值。 取值范围:1~100。 不传该参数时,默认查询前100条信息。
+ Limit *int32 `json:"limit,omitempty"`
+}
+
+func (o ListEngineFlavorsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListEngineFlavorsRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListEngineFlavorsRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_engine_flavors_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_engine_flavors_response.go
new file mode 100644
index 0000000000..19acca143f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_engine_flavors_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListEngineFlavorsResponse Response Object
+type ListEngineFlavorsResponse struct {
+
+ // 可用的规格列表信息
+ OptionalFlavors *[]EngineFlavorData `json:"optional_flavors,omitempty"`
+
+ // 可用的规格总数
+ TotalCount *int32 `json:"total_count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListEngineFlavorsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListEngineFlavorsResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListEngineFlavorsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_error_logs_new_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_error_logs_new_request.go
new file mode 100644
index 0000000000..53f40fb031
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_error_logs_new_request.go
@@ -0,0 +1,115 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListErrorLogsNewRequest Request Object
+type ListErrorLogsNewRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 开始时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ StartDate string `json:"start_date"`
+
+ // 结束时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。 只能查询当前时间前一个月内的错误日志。
+ EndDate string `json:"end_date"`
+
+ // 索引位置,偏移量。从第一条数据偏移offset条数据后开始查询,默认为0(偏移0条数据,表示从第一条数据开始查询),必须为数字,不能为负数。
+ Offset *int64 `json:"offset,omitempty"`
+
+ // 每页多少条记录,取值范围是1~100,不填时默认为10。
+ Limit *int64 `json:"limit,omitempty"`
+
+ // 日志级别,默认为ALL。
+ Level *ListErrorLogsNewRequestLevel `json:"level,omitempty"`
+}
+
+func (o ListErrorLogsNewRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListErrorLogsNewRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListErrorLogsNewRequest", string(data)}, " ")
+}
+
+type ListErrorLogsNewRequestLevel struct {
+ value string
+}
+
+type ListErrorLogsNewRequestLevelEnum struct {
+ ALL ListErrorLogsNewRequestLevel
+ INFO ListErrorLogsNewRequestLevel
+ LOG ListErrorLogsNewRequestLevel
+ WARNING ListErrorLogsNewRequestLevel
+ ERROR ListErrorLogsNewRequestLevel
+ FATAL ListErrorLogsNewRequestLevel
+ PANIC ListErrorLogsNewRequestLevel
+ NOTE ListErrorLogsNewRequestLevel
+}
+
+func GetListErrorLogsNewRequestLevelEnum() ListErrorLogsNewRequestLevelEnum {
+ return ListErrorLogsNewRequestLevelEnum{
+ ALL: ListErrorLogsNewRequestLevel{
+ value: "ALL",
+ },
+ INFO: ListErrorLogsNewRequestLevel{
+ value: "INFO",
+ },
+ LOG: ListErrorLogsNewRequestLevel{
+ value: "LOG",
+ },
+ WARNING: ListErrorLogsNewRequestLevel{
+ value: "WARNING",
+ },
+ ERROR: ListErrorLogsNewRequestLevel{
+ value: "ERROR",
+ },
+ FATAL: ListErrorLogsNewRequestLevel{
+ value: "FATAL",
+ },
+ PANIC: ListErrorLogsNewRequestLevel{
+ value: "PANIC",
+ },
+ NOTE: ListErrorLogsNewRequestLevel{
+ value: "NOTE",
+ },
+ }
+}
+
+func (c ListErrorLogsNewRequestLevel) Value() string {
+ return c.value
+}
+
+func (c ListErrorLogsNewRequestLevel) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListErrorLogsNewRequestLevel) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_error_logs_new_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_error_logs_new_response.go
new file mode 100644
index 0000000000..4396e1a1d3
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_error_logs_new_response.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListErrorLogsNewResponse Response Object
+type ListErrorLogsNewResponse struct {
+ ErrorLogList *[]ErrorLog `json:"error_log_list,omitempty"`
+
+ // 总记录数。
+ TotalRecord *int32 `json:"total_record,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListErrorLogsNewResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListErrorLogsNewResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListErrorLogsNewResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_error_logs_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_error_logs_request.go
new file mode 100644
index 0000000000..1b6f670bdc
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_error_logs_request.go
@@ -0,0 +1,115 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListErrorLogsRequest Request Object
+type ListErrorLogsRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 开始时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ StartDate string `json:"start_date"`
+
+ // 结束时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。 只能查询当前时间前一个月内的错误日志。
+ EndDate string `json:"end_date"`
+
+ // 页数偏移量,如1、2、3、4等,不填时默认为1。
+ Offset *int32 `json:"offset,omitempty"`
+
+ // 每页多少条记录,取值范围是1~100,不填时默认为10。
+ Limit *int32 `json:"limit,omitempty"`
+
+ // 日志级别,默认为ALL。
+ Level *ListErrorLogsRequestLevel `json:"level,omitempty"`
+}
+
+func (o ListErrorLogsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListErrorLogsRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListErrorLogsRequest", string(data)}, " ")
+}
+
+type ListErrorLogsRequestLevel struct {
+ value string
+}
+
+type ListErrorLogsRequestLevelEnum struct {
+ ALL ListErrorLogsRequestLevel
+ INFO ListErrorLogsRequestLevel
+ LOG ListErrorLogsRequestLevel
+ WARNING ListErrorLogsRequestLevel
+ ERROR ListErrorLogsRequestLevel
+ FATAL ListErrorLogsRequestLevel
+ PANIC ListErrorLogsRequestLevel
+ NOTE ListErrorLogsRequestLevel
+}
+
+func GetListErrorLogsRequestLevelEnum() ListErrorLogsRequestLevelEnum {
+ return ListErrorLogsRequestLevelEnum{
+ ALL: ListErrorLogsRequestLevel{
+ value: "ALL",
+ },
+ INFO: ListErrorLogsRequestLevel{
+ value: "INFO",
+ },
+ LOG: ListErrorLogsRequestLevel{
+ value: "LOG",
+ },
+ WARNING: ListErrorLogsRequestLevel{
+ value: "WARNING",
+ },
+ ERROR: ListErrorLogsRequestLevel{
+ value: "ERROR",
+ },
+ FATAL: ListErrorLogsRequestLevel{
+ value: "FATAL",
+ },
+ PANIC: ListErrorLogsRequestLevel{
+ value: "PANIC",
+ },
+ NOTE: ListErrorLogsRequestLevel{
+ value: "NOTE",
+ },
+ }
+}
+
+func (c ListErrorLogsRequestLevel) Value() string {
+ return c.value
+}
+
+func (c ListErrorLogsRequestLevel) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListErrorLogsRequestLevel) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_error_logs_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_error_logs_response.go
new file mode 100644
index 0000000000..6f749551c1
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_error_logs_response.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListErrorLogsResponse Response Object
+type ListErrorLogsResponse struct {
+ ErrorLogList *[]ErrorLog `json:"error_log_list,omitempty"`
+
+ // 总记录数。
+ TotalRecord *int32 `json:"total_record,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListErrorLogsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListErrorLogsResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListErrorLogsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_errorlog_for_lts_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_errorlog_for_lts_request.go
new file mode 100644
index 0000000000..a6c08941b8
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_errorlog_for_lts_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListErrorlogForLtsRequest Request Object
+type ListErrorlogForLtsRequest struct {
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 语言。默认en-us。
+ XLanguage *ListErrorlogForLtsRequestXLanguage `json:"X-Language,omitempty"`
+
+ Body *ErrorlogForLtsRequest `json:"body,omitempty"`
+}
+
+func (o ListErrorlogForLtsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListErrorlogForLtsRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListErrorlogForLtsRequest", string(data)}, " ")
+}
+
+type ListErrorlogForLtsRequestXLanguage struct {
+ value string
+}
+
+type ListErrorlogForLtsRequestXLanguageEnum struct {
+ ZH_CN ListErrorlogForLtsRequestXLanguage
+ EN_US ListErrorlogForLtsRequestXLanguage
+}
+
+func GetListErrorlogForLtsRequestXLanguageEnum() ListErrorlogForLtsRequestXLanguageEnum {
+ return ListErrorlogForLtsRequestXLanguageEnum{
+ ZH_CN: ListErrorlogForLtsRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: ListErrorlogForLtsRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c ListErrorlogForLtsRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c ListErrorlogForLtsRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListErrorlogForLtsRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_errorlog_for_lts_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_errorlog_for_lts_response.go
new file mode 100644
index 0000000000..4aaf3fc5cc
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_errorlog_for_lts_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListErrorlogForLtsResponse Response Object
+type ListErrorlogForLtsResponse struct {
+
+ // 日志数据集合。
+ ErrorLogList *[]ErrorLogItem `json:"error_log_list,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListErrorlogForLtsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListErrorlogForLtsResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListErrorlogForLtsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_flavors_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_flavors_request.go
new file mode 100644
index 0000000000..bfab8de751
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_flavors_request.go
@@ -0,0 +1,90 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListFlavorsRequest Request Object
+type ListFlavorsRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 数据库引擎。支持的引擎如下,不区分大小写: MySQL PostgreSQL SQLServer
+ DatabaseName ListFlavorsRequestDatabaseName `json:"database_name"`
+
+ // 数据库版本号,获取方法请参见5.1查询数据库引擎的版本。(可输入小版本号)
+ VersionName *string `json:"version_name,omitempty"`
+
+ // 规格编码
+ SpecCode *string `json:"spec_code,omitempty"`
+}
+
+func (o ListFlavorsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListFlavorsRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListFlavorsRequest", string(data)}, " ")
+}
+
+type ListFlavorsRequestDatabaseName struct {
+ value string
+}
+
+type ListFlavorsRequestDatabaseNameEnum struct {
+ MY_SQL ListFlavorsRequestDatabaseName
+ POSTGRE_SQL ListFlavorsRequestDatabaseName
+ SQL_SERVER ListFlavorsRequestDatabaseName
+ MARIA_DB ListFlavorsRequestDatabaseName
+}
+
+func GetListFlavorsRequestDatabaseNameEnum() ListFlavorsRequestDatabaseNameEnum {
+ return ListFlavorsRequestDatabaseNameEnum{
+ MY_SQL: ListFlavorsRequestDatabaseName{
+ value: "MySQL",
+ },
+ POSTGRE_SQL: ListFlavorsRequestDatabaseName{
+ value: "PostgreSQL",
+ },
+ SQL_SERVER: ListFlavorsRequestDatabaseName{
+ value: "SQLServer",
+ },
+ MARIA_DB: ListFlavorsRequestDatabaseName{
+ value: "MariaDB",
+ },
+ }
+}
+
+func (c ListFlavorsRequestDatabaseName) Value() string {
+ return c.value
+}
+
+func (c ListFlavorsRequestDatabaseName) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListFlavorsRequestDatabaseName) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_flavors_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_flavors_response.go
new file mode 100644
index 0000000000..c2843c89ee
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_flavors_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListFlavorsResponse Response Object
+type ListFlavorsResponse struct {
+
+ // 实例规格信息。
+ Flavors *[]Flavor `json:"flavors,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListFlavorsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListFlavorsResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListFlavorsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_history_database_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_history_database_request.go
new file mode 100644
index 0000000000..98be32abf0
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_history_database_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListHistoryDatabaseRequest Request Object
+type ListHistoryDatabaseRequest struct {
+
+ // 数据库引擎。支持的引擎如下,不区分大小写:postgresql
+ DatabaseName string `json:"database_name"`
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ Body *PostgreSqlHistoryDatabaseRequest `json:"body,omitempty"`
+}
+
+func (o ListHistoryDatabaseRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListHistoryDatabaseRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListHistoryDatabaseRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_history_database_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_history_database_response.go
new file mode 100644
index 0000000000..7788a7b80e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_history_database_response.go
@@ -0,0 +1,30 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListHistoryDatabaseResponse Response Object
+type ListHistoryDatabaseResponse struct {
+
+ // 恢复库数量限制个数
+ DatabaseLimit *int32 `json:"database_limit,omitempty"`
+
+ // 恢复表数量限制个数
+ TableLimit *int32 `json:"table_limit,omitempty"`
+
+ // 实例信息
+ Instances *[]PostgreSqlHistoryDatabaseInstance `json:"instances,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListHistoryDatabaseResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListHistoryDatabaseResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListHistoryDatabaseResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_inspection_histories_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_inspection_histories_request.go
new file mode 100644
index 0000000000..e45a9d08a2
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_inspection_histories_request.go
@@ -0,0 +1,44 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListInspectionHistoriesRequest Request Object
+type ListInspectionHistoriesRequest struct {
+
+ // 实例ID
+ InstanceId string `json:"instance_id"`
+
+ // 索引位置,偏移量。从第一条数据偏移offset条数据后开始查询,默认为0(偏移0条数据,表示从第一条数据开始查询),必须为数字,不能为负数。
+ Offset *int32 `json:"offset,omitempty"`
+
+ // 查询记录数。默认为10,不能为负数,最小值为1,最大值为100。
+ Limit *int32 `json:"limit,omitempty"`
+
+ // 排序方式。 DESC,降序。 ASC,升序。 默认降序。
+ Order *string `json:"order,omitempty"`
+
+ // 排序字段。 check_time 检查时间。 expiration_time 过期时间。 默认检查时间。
+ SortField *string `json:"sort_field,omitempty"`
+
+ // 目标版本。
+ TargetVersion *string `json:"target_version,omitempty"`
+
+ // 是否有效。 true 表示有效。 false 表示无效。
+ IsAvailable *bool `json:"is_available,omitempty"`
+
+ // 语言。默认en-us。
+ XLanguage *string `json:"X-Language,omitempty"`
+}
+
+func (o ListInspectionHistoriesRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListInspectionHistoriesRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListInspectionHistoriesRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_inspection_histories_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_inspection_histories_response.go
new file mode 100644
index 0000000000..15f5ff992f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_inspection_histories_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListInspectionHistoriesResponse Response Object
+type ListInspectionHistoriesResponse struct {
+
+ // 总记录数。
+ TotalCount *int32 `json:"total_count,omitempty"`
+
+ // 检查报告信息。
+ InspectionReports *[]InspectionReports `json:"inspection_reports,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListInspectionHistoriesResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListInspectionHistoriesResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListInspectionHistoriesResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instance_diagnosis_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instance_diagnosis_request.go
new file mode 100644
index 0000000000..591abefcc4
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instance_diagnosis_request.go
@@ -0,0 +1,77 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListInstanceDiagnosisRequest Request Object
+type ListInstanceDiagnosisRequest struct {
+
+ // 引擎类型
+ Engine ListInstanceDiagnosisRequestEngine `json:"engine"`
+}
+
+func (o ListInstanceDiagnosisRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListInstanceDiagnosisRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListInstanceDiagnosisRequest", string(data)}, " ")
+}
+
+type ListInstanceDiagnosisRequestEngine struct {
+ value string
+}
+
+type ListInstanceDiagnosisRequestEngineEnum struct {
+ MYSQL ListInstanceDiagnosisRequestEngine
+ POSTGRESQL ListInstanceDiagnosisRequestEngine
+ SQLSERVER ListInstanceDiagnosisRequestEngine
+}
+
+func GetListInstanceDiagnosisRequestEngineEnum() ListInstanceDiagnosisRequestEngineEnum {
+ return ListInstanceDiagnosisRequestEngineEnum{
+ MYSQL: ListInstanceDiagnosisRequestEngine{
+ value: "mysql",
+ },
+ POSTGRESQL: ListInstanceDiagnosisRequestEngine{
+ value: "postgresql",
+ },
+ SQLSERVER: ListInstanceDiagnosisRequestEngine{
+ value: "sqlserver",
+ },
+ }
+}
+
+func (c ListInstanceDiagnosisRequestEngine) Value() string {
+ return c.value
+}
+
+func (c ListInstanceDiagnosisRequestEngine) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListInstanceDiagnosisRequestEngine) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instance_diagnosis_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instance_diagnosis_response.go
new file mode 100644
index 0000000000..da4e3d09ec
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instance_diagnosis_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListInstanceDiagnosisResponse Response Object
+type ListInstanceDiagnosisResponse struct {
+
+ // diagnosis info
+ Diagnosis *[]DiagnosisItemResult `json:"diagnosis,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListInstanceDiagnosisResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListInstanceDiagnosisResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListInstanceDiagnosisResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instance_param_histories_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instance_param_histories_request.go
new file mode 100644
index 0000000000..1a4102c1aa
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instance_param_histories_request.go
@@ -0,0 +1,38 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListInstanceParamHistoriesRequest Request Object
+type ListInstanceParamHistoriesRequest struct {
+
+ // 实例ID
+ InstanceId string `json:"instance_id"`
+
+ // 分页参数
+ Offset *int32 `json:"offset,omitempty"`
+
+ // 分页参数
+ Limit *int32 `json:"limit,omitempty"`
+
+ // 开始时间 默认为当前时间的前7天 格式如 2020-09-01T18:50:20Z
+ StartTime *string `json:"start_time,omitempty"`
+
+ // 结束时间 默认为当前时间 格式如 2020-09-01T18:50:20Z
+ EndTime *string `json:"end_time,omitempty"`
+
+ // 参数名称
+ ParamName *string `json:"param_name,omitempty"`
+}
+
+func (o ListInstanceParamHistoriesRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListInstanceParamHistoriesRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListInstanceParamHistoriesRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instance_param_histories_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instance_param_histories_response.go
new file mode 100644
index 0000000000..6fd65eddc9
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instance_param_histories_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListInstanceParamHistoriesResponse Response Object
+type ListInstanceParamHistoriesResponse struct {
+
+ // 历史记录总数
+ TotalCount *int32 `json:"total_count,omitempty"`
+
+ // host列表
+ Histories *[]ParamGroupHistoryResult `json:"histories,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListInstanceParamHistoriesResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListInstanceParamHistoriesResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListInstanceParamHistoriesResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instance_tags_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instance_tags_request.go
new file mode 100644
index 0000000000..88d4a09c03
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instance_tags_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListInstanceTagsRequest Request Object
+type ListInstanceTagsRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ InstanceId string `json:"instance_id"`
+}
+
+func (o ListInstanceTagsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListInstanceTagsRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListInstanceTagsRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instance_tags_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instance_tags_response.go
new file mode 100644
index 0000000000..e9695e5a19
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instance_tags_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListInstanceTagsResponse Response Object
+type ListInstanceTagsResponse struct {
+
+ // 标签列表,没有标签默认为空数组。
+ Tags *[]ResourceTag `json:"tags,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListInstanceTagsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListInstanceTagsResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListInstanceTagsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_info_diagnosis_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_info_diagnosis_request.go
new file mode 100644
index 0000000000..487b3534fb
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_info_diagnosis_request.go
@@ -0,0 +1,157 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListInstancesInfoDiagnosisRequest Request Object
+type ListInstancesInfoDiagnosisRequest struct {
+
+ // 引擎类型
+ Engine ListInstancesInfoDiagnosisRequestEngine `json:"engine"`
+
+ // 诊断项
+ Diagnosis ListInstancesInfoDiagnosisRequestDiagnosis `json:"diagnosis"`
+
+ // offset
+ Offset *int32 `json:"offset,omitempty"`
+
+ // limit
+ Limit *int32 `json:"limit,omitempty"`
+}
+
+func (o ListInstancesInfoDiagnosisRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListInstancesInfoDiagnosisRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListInstancesInfoDiagnosisRequest", string(data)}, " ")
+}
+
+type ListInstancesInfoDiagnosisRequestEngine struct {
+ value string
+}
+
+type ListInstancesInfoDiagnosisRequestEngineEnum struct {
+ MYSQL ListInstancesInfoDiagnosisRequestEngine
+ POSTGRESQL ListInstancesInfoDiagnosisRequestEngine
+ SQLSERVER ListInstancesInfoDiagnosisRequestEngine
+}
+
+func GetListInstancesInfoDiagnosisRequestEngineEnum() ListInstancesInfoDiagnosisRequestEngineEnum {
+ return ListInstancesInfoDiagnosisRequestEngineEnum{
+ MYSQL: ListInstancesInfoDiagnosisRequestEngine{
+ value: "mysql",
+ },
+ POSTGRESQL: ListInstancesInfoDiagnosisRequestEngine{
+ value: "postgresql",
+ },
+ SQLSERVER: ListInstancesInfoDiagnosisRequestEngine{
+ value: "sqlserver",
+ },
+ }
+}
+
+func (c ListInstancesInfoDiagnosisRequestEngine) Value() string {
+ return c.value
+}
+
+func (c ListInstancesInfoDiagnosisRequestEngine) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListInstancesInfoDiagnosisRequestEngine) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
+
+type ListInstancesInfoDiagnosisRequestDiagnosis struct {
+ value string
+}
+
+type ListInstancesInfoDiagnosisRequestDiagnosisEnum struct {
+ HIGH_PRESSURE ListInstancesInfoDiagnosisRequestDiagnosis
+ LOCK_WAIT ListInstancesInfoDiagnosisRequestDiagnosis
+ INSUFFICIENT_CAPACITY ListInstancesInfoDiagnosisRequestDiagnosis
+ SLOW_SQL_FREQUENCY ListInstancesInfoDiagnosisRequestDiagnosis
+ DISK_PERFORMANCE_CAP ListInstancesInfoDiagnosisRequestDiagnosis
+ MEM_OVERRUN ListInstancesInfoDiagnosisRequestDiagnosis
+ AGE_EXCEED ListInstancesInfoDiagnosisRequestDiagnosis
+ CONNECTIONS_EXCEED ListInstancesInfoDiagnosisRequestDiagnosis
+}
+
+func GetListInstancesInfoDiagnosisRequestDiagnosisEnum() ListInstancesInfoDiagnosisRequestDiagnosisEnum {
+ return ListInstancesInfoDiagnosisRequestDiagnosisEnum{
+ HIGH_PRESSURE: ListInstancesInfoDiagnosisRequestDiagnosis{
+ value: "high_pressure",
+ },
+ LOCK_WAIT: ListInstancesInfoDiagnosisRequestDiagnosis{
+ value: "lock_wait",
+ },
+ INSUFFICIENT_CAPACITY: ListInstancesInfoDiagnosisRequestDiagnosis{
+ value: "insufficient_capacity",
+ },
+ SLOW_SQL_FREQUENCY: ListInstancesInfoDiagnosisRequestDiagnosis{
+ value: "slow_sql_frequency",
+ },
+ DISK_PERFORMANCE_CAP: ListInstancesInfoDiagnosisRequestDiagnosis{
+ value: "disk_performance_cap",
+ },
+ MEM_OVERRUN: ListInstancesInfoDiagnosisRequestDiagnosis{
+ value: "mem_overrun",
+ },
+ AGE_EXCEED: ListInstancesInfoDiagnosisRequestDiagnosis{
+ value: "age_exceed",
+ },
+ CONNECTIONS_EXCEED: ListInstancesInfoDiagnosisRequestDiagnosis{
+ value: "connections_exceed",
+ },
+ }
+}
+
+func (c ListInstancesInfoDiagnosisRequestDiagnosis) Value() string {
+ return c.value
+}
+
+func (c ListInstancesInfoDiagnosisRequestDiagnosis) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListInstancesInfoDiagnosisRequestDiagnosis) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_info_diagnosis_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_info_diagnosis_response.go
new file mode 100644
index 0000000000..0a86a9868d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_info_diagnosis_response.go
@@ -0,0 +1,104 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListInstancesInfoDiagnosisResponse Response Object
+type ListInstancesInfoDiagnosisResponse struct {
+
+ // 诊断项
+ Diagnosis *ListInstancesInfoDiagnosisResponseDiagnosis `json:"diagnosis,omitempty"`
+
+ // 实例数量
+ TotalCount *int32 `json:"total_count,omitempty"`
+
+ // 实例信息
+ Instances *[]DiagnosisInstancesInfoResult `json:"instances,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListInstancesInfoDiagnosisResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListInstancesInfoDiagnosisResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListInstancesInfoDiagnosisResponse", string(data)}, " ")
+}
+
+type ListInstancesInfoDiagnosisResponseDiagnosis struct {
+ value string
+}
+
+type ListInstancesInfoDiagnosisResponseDiagnosisEnum struct {
+ HIGH_PRESSURE ListInstancesInfoDiagnosisResponseDiagnosis
+ LOCK_WAIT ListInstancesInfoDiagnosisResponseDiagnosis
+ INSUFFICIENT_CAPACITY ListInstancesInfoDiagnosisResponseDiagnosis
+ SLOW_SQL_FREQUENCY ListInstancesInfoDiagnosisResponseDiagnosis
+ DISK_PERFORMANCE_CAP ListInstancesInfoDiagnosisResponseDiagnosis
+ MEM_OVERRUN ListInstancesInfoDiagnosisResponseDiagnosis
+ AGE_EXCEED ListInstancesInfoDiagnosisResponseDiagnosis
+ CONNECTIONS_EXCEED ListInstancesInfoDiagnosisResponseDiagnosis
+}
+
+func GetListInstancesInfoDiagnosisResponseDiagnosisEnum() ListInstancesInfoDiagnosisResponseDiagnosisEnum {
+ return ListInstancesInfoDiagnosisResponseDiagnosisEnum{
+ HIGH_PRESSURE: ListInstancesInfoDiagnosisResponseDiagnosis{
+ value: "high_pressure",
+ },
+ LOCK_WAIT: ListInstancesInfoDiagnosisResponseDiagnosis{
+ value: "lock_wait",
+ },
+ INSUFFICIENT_CAPACITY: ListInstancesInfoDiagnosisResponseDiagnosis{
+ value: "insufficient_capacity",
+ },
+ SLOW_SQL_FREQUENCY: ListInstancesInfoDiagnosisResponseDiagnosis{
+ value: "slow_sql_frequency",
+ },
+ DISK_PERFORMANCE_CAP: ListInstancesInfoDiagnosisResponseDiagnosis{
+ value: "disk_performance_cap",
+ },
+ MEM_OVERRUN: ListInstancesInfoDiagnosisResponseDiagnosis{
+ value: "mem_overrun",
+ },
+ AGE_EXCEED: ListInstancesInfoDiagnosisResponseDiagnosis{
+ value: "age_exceed",
+ },
+ CONNECTIONS_EXCEED: ListInstancesInfoDiagnosisResponseDiagnosis{
+ value: "connections_exceed",
+ },
+ }
+}
+
+func (c ListInstancesInfoDiagnosisResponseDiagnosis) Value() string {
+ return c.value
+}
+
+func (c ListInstancesInfoDiagnosisResponseDiagnosis) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListInstancesInfoDiagnosisResponseDiagnosis) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_request.go
new file mode 100644
index 0000000000..127caf592e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_request.go
@@ -0,0 +1,207 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListInstancesRequest Request Object
+type ListInstancesRequest struct {
+ ContentType *string `json:"Content-Type,omitempty"`
+
+ // 语言
+ XLanguage *ListInstancesRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。 “\\*”为系统保留字符,如果id是以“\\*”起始,表示按照\\*后面的值模糊匹配,否则,按照id精确匹配查询。不能只传入“\\*”。
+ Id *string `json:"id,omitempty"`
+
+ // 实例名称。 “\\*”为系统保留字符,如果name是以“\\*”起始,表示按照\\*后面的值模糊匹配,否则,按照name精确匹配查询。不能只传入“\\*”。
+ Name *string `json:"name,omitempty"`
+
+ // 按照实例类型查询。取值Single、Ha、Replica,分别对应于单实例、主备实例和只读实例。
+ Type *ListInstancesRequestType `json:"type,omitempty"`
+
+ // 数据库类型,区分大小写。 - MySQL - PostgreSQL - SQLServer - MariaDB
+ DatastoreType *ListInstancesRequestDatastoreType `json:"datastore_type,omitempty"`
+
+ // 虚拟私有云ID。
+ VpcId *string `json:"vpc_id,omitempty"`
+
+ // 子网ID。
+ SubnetId *string `json:"subnet_id,omitempty"`
+
+ // 索引位置,偏移量。从第一条数据偏移offset条数据后开始查询,默认为0(偏移0条数据,表示从第一条数据开始查询),必须为数字,不能为负数。
+ Offset *int32 `json:"offset,omitempty"`
+
+ // 查询记录数。默认为100,不能为负数,最小值为1,最大值为100。
+ Limit *int32 `json:"limit,omitempty"`
+
+ // 根据实例标签键值对进行查询。 {key}表示标签键,不可以为空或重复。最大长度127个unicode字符。key不能为空或者空字符串,不能为空格,使用之前先trim前后半角空格。不能包含+/?#&=,%特殊字符。 {value}表示标签值,可以为空。最大长度255个unicode字符,使用之前先trim 前后半角空格。不能包含+/?#&=,%特殊字符。如果value为空,则表示any_value(查询任意value)。 如果同时使用多个标签键值对进行查询,中间使用逗号分隔开,最多包含10组。
+ Tags *string `json:"tags,omitempty"`
+}
+
+func (o ListInstancesRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListInstancesRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListInstancesRequest", string(data)}, " ")
+}
+
+type ListInstancesRequestXLanguage struct {
+ value string
+}
+
+type ListInstancesRequestXLanguageEnum struct {
+ ZH_CN ListInstancesRequestXLanguage
+ EN_US ListInstancesRequestXLanguage
+}
+
+func GetListInstancesRequestXLanguageEnum() ListInstancesRequestXLanguageEnum {
+ return ListInstancesRequestXLanguageEnum{
+ ZH_CN: ListInstancesRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: ListInstancesRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c ListInstancesRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c ListInstancesRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListInstancesRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
+
+type ListInstancesRequestType struct {
+ value string
+}
+
+type ListInstancesRequestTypeEnum struct {
+ SINGLE ListInstancesRequestType
+ HA ListInstancesRequestType
+ REPLICA ListInstancesRequestType
+}
+
+func GetListInstancesRequestTypeEnum() ListInstancesRequestTypeEnum {
+ return ListInstancesRequestTypeEnum{
+ SINGLE: ListInstancesRequestType{
+ value: "Single",
+ },
+ HA: ListInstancesRequestType{
+ value: "Ha",
+ },
+ REPLICA: ListInstancesRequestType{
+ value: "Replica",
+ },
+ }
+}
+
+func (c ListInstancesRequestType) Value() string {
+ return c.value
+}
+
+func (c ListInstancesRequestType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListInstancesRequestType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
+
+type ListInstancesRequestDatastoreType struct {
+ value string
+}
+
+type ListInstancesRequestDatastoreTypeEnum struct {
+ MY_SQL ListInstancesRequestDatastoreType
+ POSTGRE_SQL ListInstancesRequestDatastoreType
+ SQL_SERVER ListInstancesRequestDatastoreType
+ MARIA_DB ListInstancesRequestDatastoreType
+}
+
+func GetListInstancesRequestDatastoreTypeEnum() ListInstancesRequestDatastoreTypeEnum {
+ return ListInstancesRequestDatastoreTypeEnum{
+ MY_SQL: ListInstancesRequestDatastoreType{
+ value: "MySQL",
+ },
+ POSTGRE_SQL: ListInstancesRequestDatastoreType{
+ value: "PostgreSQL",
+ },
+ SQL_SERVER: ListInstancesRequestDatastoreType{
+ value: "SQLServer",
+ },
+ MARIA_DB: ListInstancesRequestDatastoreType{
+ value: "MariaDB",
+ },
+ }
+}
+
+func (c ListInstancesRequestDatastoreType) Value() string {
+ return c.value
+}
+
+func (c ListInstancesRequestDatastoreType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListInstancesRequestDatastoreType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_response.go
new file mode 100644
index 0000000000..fdf567550d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_response.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListInstancesResponse Response Object
+type ListInstancesResponse struct {
+ Instances *[]InstanceResponse `json:"instances,omitempty"`
+
+ // 总实例数。
+ TotalCount *int32 `json:"total_count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListInstancesResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListInstancesResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListInstancesResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_support_fast_restore_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_support_fast_restore_request.go
new file mode 100644
index 0000000000..be0fa10f8f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_support_fast_restore_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListInstancesSupportFastRestoreRequest Request Object
+type ListInstancesSupportFastRestoreRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ Body *ListInstancesSupportFastRestoreRequestBody `json:"body,omitempty"`
+}
+
+func (o ListInstancesSupportFastRestoreRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListInstancesSupportFastRestoreRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListInstancesSupportFastRestoreRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_support_fast_restore_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_support_fast_restore_request_body.go
new file mode 100644
index 0000000000..41b1278711
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_support_fast_restore_request_body.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ListInstancesSupportFastRestoreRequestBody struct {
+
+ // 要恢复的时间点,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ RestoreTime string `json:"restore_time"`
+
+ // 实例id列表。
+ InstanceIds []string `json:"instance_ids"`
+}
+
+func (o ListInstancesSupportFastRestoreRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListInstancesSupportFastRestoreRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"ListInstancesSupportFastRestoreRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_support_fast_restore_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_support_fast_restore_response.go
new file mode 100644
index 0000000000..236e91acd5
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_instances_support_fast_restore_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListInstancesSupportFastRestoreResponse Response Object
+type ListInstancesSupportFastRestoreResponse struct {
+
+ // 实例的极速恢复支持情况。
+ SupportFastRestoreList *[]SupportFastRestoreList `json:"support_fast_restore_list,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListInstancesSupportFastRestoreResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListInstancesSupportFastRestoreResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListInstancesSupportFastRestoreResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_job_info_detail_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_job_info_detail_request.go
new file mode 100644
index 0000000000..554e261086
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_job_info_detail_request.go
@@ -0,0 +1,32 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListJobInfoDetailRequest Request Object
+type ListJobInfoDetailRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 开始时间,格式为UTC时间戳。
+ StartTime string `json:"start_time"`
+
+ // 结束时间,格式为UTC时间戳。
+ EndTime *string `json:"end_time,omitempty"`
+}
+
+func (o ListJobInfoDetailRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListJobInfoDetailRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListJobInfoDetailRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_job_info_detail_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_job_info_detail_response.go
new file mode 100644
index 0000000000..d042bccd4a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_job_info_detail_response.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListJobInfoDetailResponse Response Object
+type ListJobInfoDetailResponse struct {
+ Jobs *GetTaskDetailListRspJobs `json:"jobs,omitempty"`
+
+ // 任务数量。
+ Count *int32 `json:"count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListJobInfoDetailResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListJobInfoDetailResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListJobInfoDetailResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_job_info_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_job_info_request.go
new file mode 100644
index 0000000000..2b816ab1bb
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_job_info_request.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListJobInfoRequest Request Object
+type ListJobInfoRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 任务ID。
+ Id string `json:"id"`
+}
+
+func (o ListJobInfoRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListJobInfoRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListJobInfoRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_job_info_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_job_info_response.go
new file mode 100644
index 0000000000..1fba6b251a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_job_info_response.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListJobInfoResponse Response Object
+type ListJobInfoResponse struct {
+ Job *GetJobInfoResponseBodyJob `json:"job,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListJobInfoResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListJobInfoResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListJobInfoResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_msdtc_hosts_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_msdtc_hosts_request.go
new file mode 100644
index 0000000000..8808b73702
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_msdtc_hosts_request.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListMsdtcHostsRequest Request Object
+type ListMsdtcHostsRequest struct {
+
+ // 实例ID
+ InstanceId string `json:"instance_id"`
+
+ // 分页参数 最小为0
+ Offset *int32 `json:"offset,omitempty"`
+
+ // 分页参数 取值范围为 1-100
+ Limit *int32 `json:"limit,omitempty"`
+}
+
+func (o ListMsdtcHostsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListMsdtcHostsRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListMsdtcHostsRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_msdtc_hosts_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_msdtc_hosts_response.go
new file mode 100644
index 0000000000..f26d835a5d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_msdtc_hosts_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListMsdtcHostsResponse Response Object
+type ListMsdtcHostsResponse struct {
+
+ // host总数
+ TotalCount *int32 `json:"total_count,omitempty"`
+
+ // host列表
+ Hosts *[]DbsInstanceHostInfoResult `json:"hosts,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListMsdtcHostsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListMsdtcHostsResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListMsdtcHostsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_off_site_backups_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_off_site_backups_request.go
new file mode 100644
index 0000000000..fb4d81f71c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_off_site_backups_request.go
@@ -0,0 +1,94 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListOffSiteBackupsRequest Request Object
+type ListOffSiteBackupsRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 备份ID。
+ BackupId *string `json:"backup_id,omitempty"`
+
+ // 备份类型,取值: - “auto”: 自动全量备份。SQL Server仅支持查询备份类型为“auto”的备份列表 - “incremental”: 自动增量备份
+ BackupType *ListOffSiteBackupsRequestBackupType `json:"backup_type,omitempty"`
+
+ // 索引位置,偏移量。从第一条数据偏移offset条数据后开始查询,默认为0(偏移0条数据,表示从第一条数据开始查询),必须为数字,不能为负数。
+ Offset *int32 `json:"offset,omitempty"`
+
+ // 查询记录数。默认为100,不能为负数,最小值为1,最大值为100。
+ Limit *int32 `json:"limit,omitempty"`
+
+ // 查询开始时间,格式为“yyyy-mm-ddThh:mm:ssZ”。其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。与end_time必须同时使用。
+ BeginTime *string `json:"begin_time,omitempty"`
+
+ // 查询结束时间,格式为“yyyy-mm-ddThh:mm:ssZ”,且大于查询开始时间。其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。与begin_time必须同时使用。
+ EndTime *string `json:"end_time,omitempty"`
+}
+
+func (o ListOffSiteBackupsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListOffSiteBackupsRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListOffSiteBackupsRequest", string(data)}, " ")
+}
+
+type ListOffSiteBackupsRequestBackupType struct {
+ value string
+}
+
+type ListOffSiteBackupsRequestBackupTypeEnum struct {
+ AUTO ListOffSiteBackupsRequestBackupType
+ INCREMENTAL ListOffSiteBackupsRequestBackupType
+}
+
+func GetListOffSiteBackupsRequestBackupTypeEnum() ListOffSiteBackupsRequestBackupTypeEnum {
+ return ListOffSiteBackupsRequestBackupTypeEnum{
+ AUTO: ListOffSiteBackupsRequestBackupType{
+ value: "auto",
+ },
+ INCREMENTAL: ListOffSiteBackupsRequestBackupType{
+ value: "incremental",
+ },
+ }
+}
+
+func (c ListOffSiteBackupsRequestBackupType) Value() string {
+ return c.value
+}
+
+func (c ListOffSiteBackupsRequestBackupType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListOffSiteBackupsRequestBackupType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_off_site_backups_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_off_site_backups_response.go
new file mode 100644
index 0000000000..b2b7589e7a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_off_site_backups_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListOffSiteBackupsResponse Response Object
+type ListOffSiteBackupsResponse struct {
+
+ // 跨区域备份信息。
+ Backups *[]OffSiteBackupForList `json:"backups,omitempty"`
+
+ // 总记录数。
+ TotalCount *int32 `json:"total_count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListOffSiteBackupsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListOffSiteBackupsResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListOffSiteBackupsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_off_site_instances_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_off_site_instances_request.go
new file mode 100644
index 0000000000..6b146f32b0
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_off_site_instances_request.go
@@ -0,0 +1,80 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListOffSiteInstancesRequest Request Object
+type ListOffSiteInstancesRequest struct {
+ ContentType *string `json:"Content-Type,omitempty"`
+
+ // 语言
+ XLanguage *ListOffSiteInstancesRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 索引位置,偏移量。从第一条数据偏移offset条数据后开始查询,默认为0(偏移0条数据,表示从第一条数据开始查询),必须为数字,不能为负数。
+ Offset *interface{} `json:"offset,omitempty"`
+
+ // 查询记录数。默认为100,不能为负数,最小值为1,最大值为100。
+ Limit *interface{} `json:"limit,omitempty"`
+}
+
+func (o ListOffSiteInstancesRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListOffSiteInstancesRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListOffSiteInstancesRequest", string(data)}, " ")
+}
+
+type ListOffSiteInstancesRequestXLanguage struct {
+ value string
+}
+
+type ListOffSiteInstancesRequestXLanguageEnum struct {
+ ZH_CN ListOffSiteInstancesRequestXLanguage
+ EN_US ListOffSiteInstancesRequestXLanguage
+}
+
+func GetListOffSiteInstancesRequestXLanguageEnum() ListOffSiteInstancesRequestXLanguageEnum {
+ return ListOffSiteInstancesRequestXLanguageEnum{
+ ZH_CN: ListOffSiteInstancesRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: ListOffSiteInstancesRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c ListOffSiteInstancesRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c ListOffSiteInstancesRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListOffSiteInstancesRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_off_site_instances_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_off_site_instances_response.go
new file mode 100644
index 0000000000..93197c12d4
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_off_site_instances_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListOffSiteInstancesResponse Response Object
+type ListOffSiteInstancesResponse struct {
+
+ // 跨区域备份实例信息。
+ OffsiteBackupInstances *[]OffsiteBackupInstance `json:"offsite_backup_instances,omitempty"`
+
+ // 总记录数。
+ TotalCount *int32 `json:"total_count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListOffSiteInstancesResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListOffSiteInstancesResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListOffSiteInstancesResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_off_site_restore_times_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_off_site_restore_times_request.go
new file mode 100644
index 0000000000..f5e932a4b9
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_off_site_restore_times_request.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListOffSiteRestoreTimesRequest Request Object
+type ListOffSiteRestoreTimesRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 所需查询的日期,为yyyy-mm-dd字符串格式,时区为UTC。
+ Date *string `json:"date,omitempty"`
+}
+
+func (o ListOffSiteRestoreTimesRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListOffSiteRestoreTimesRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListOffSiteRestoreTimesRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_off_site_restore_times_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_off_site_restore_times_response.go
new file mode 100644
index 0000000000..19fe9311aa
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_off_site_restore_times_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListOffSiteRestoreTimesResponse Response Object
+type ListOffSiteRestoreTimesResponse struct {
+
+ // 可恢复时间段列表。
+ RestoreTime *[]GetRestoreTimeResponseRestoreTime `json:"restore_time,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListOffSiteRestoreTimesResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListOffSiteRestoreTimesResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListOffSiteRestoreTimesResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_database_schemas_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_database_schemas_request.go
new file mode 100644
index 0000000000..86cfe937e4
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_database_schemas_request.go
@@ -0,0 +1,35 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListPostgresqlDatabaseSchemasRequest Request Object
+type ListPostgresqlDatabaseSchemasRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 数据库名称。
+ DbName string `json:"db_name"`
+
+ // 分页页码,从1开始。
+ Page int32 `json:"page"`
+
+ // 每页数据条数。取值范围[1, 100]。
+ Limit int32 `json:"limit"`
+}
+
+func (o ListPostgresqlDatabaseSchemasRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListPostgresqlDatabaseSchemasRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListPostgresqlDatabaseSchemasRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_database_schemas_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_database_schemas_response.go
new file mode 100644
index 0000000000..05aa5594cd
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_database_schemas_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListPostgresqlDatabaseSchemasResponse Response Object
+type ListPostgresqlDatabaseSchemasResponse struct {
+
+ // 列表中每个元素表示一个数据库schema。
+ DatabaseSchemas *[]PostgresqlDatabaseForListSchema `json:"database_schemas,omitempty"`
+
+ // 数据库schema总数。
+ TotalCount *int32 `json:"total_count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListPostgresqlDatabaseSchemasResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListPostgresqlDatabaseSchemasResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListPostgresqlDatabaseSchemasResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_databases_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_databases_request.go
new file mode 100644
index 0000000000..d7e14a92a9
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_databases_request.go
@@ -0,0 +1,32 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListPostgresqlDatabasesRequest Request Object
+type ListPostgresqlDatabasesRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 分页页码,从1开始。
+ Page int32 `json:"page"`
+
+ // 每页数据条数。取值范围[1, 100]。
+ Limit int32 `json:"limit"`
+}
+
+func (o ListPostgresqlDatabasesRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListPostgresqlDatabasesRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListPostgresqlDatabasesRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_databases_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_databases_response.go
new file mode 100644
index 0000000000..6a44615a15
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_databases_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListPostgresqlDatabasesResponse Response Object
+type ListPostgresqlDatabasesResponse struct {
+
+ // 列表中每个元素表示一个数据库。
+ Databases *[]PostgresqlListDatabase `json:"databases,omitempty"`
+
+ // 数据库总数。
+ TotalCount *int32 `json:"total_count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListPostgresqlDatabasesResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListPostgresqlDatabasesResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListPostgresqlDatabasesResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_db_user_paginated_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_db_user_paginated_request.go
new file mode 100644
index 0000000000..c8430193c2
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_db_user_paginated_request.go
@@ -0,0 +1,32 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListPostgresqlDbUserPaginatedRequest Request Object
+type ListPostgresqlDbUserPaginatedRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 分页页码,从1开始。
+ Page int32 `json:"page"`
+
+ // 每页数据条数。取值范围[1, 100]。
+ Limit int32 `json:"limit"`
+}
+
+func (o ListPostgresqlDbUserPaginatedRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListPostgresqlDbUserPaginatedRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListPostgresqlDbUserPaginatedRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_db_user_paginated_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_db_user_paginated_response.go
new file mode 100644
index 0000000000..eb1c2984f7
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_db_user_paginated_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListPostgresqlDbUserPaginatedResponse Response Object
+type ListPostgresqlDbUserPaginatedResponse struct {
+
+ // 列表中每个元素表示一个数据库用户。
+ Users *[]PostgresqlUserForList `json:"users,omitempty"`
+
+ // 数据库用户总数。
+ TotalCount *int32 `json:"total_count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListPostgresqlDbUserPaginatedResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListPostgresqlDbUserPaginatedResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListPostgresqlDbUserPaginatedResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_extension_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_extension_request.go
new file mode 100644
index 0000000000..2b5d16be6f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_extension_request.go
@@ -0,0 +1,35 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListPostgresqlExtensionRequest Request Object
+type ListPostgresqlExtensionRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 数据库名称。
+ DatabaseName string `json:"database_name"`
+
+ // 索引位置,偏移量。从第一条数据偏移offset条数据后开始查询,默认为0(偏移0条数据,表示从第一条数据开始查询),必须为数字,不能为负数。
+ Offset *int32 `json:"offset,omitempty"`
+
+ // 查询记录数。默认为100,不能为负数,最小值为1,最大值为100。
+ Limit *int32 `json:"limit,omitempty"`
+}
+
+func (o ListPostgresqlExtensionRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListPostgresqlExtensionRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListPostgresqlExtensionRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_extension_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_extension_response.go
new file mode 100644
index 0000000000..eeaf896a5f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_extension_response.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListPostgresqlExtensionResponse Response Object
+type ListPostgresqlExtensionResponse struct {
+ Extensions *[]ExtensionsResponse `json:"extensions,omitempty"`
+
+ // 总插件数。
+ TotalCount *int32 `json:"total_count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListPostgresqlExtensionResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListPostgresqlExtensionResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListPostgresqlExtensionResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_hba_info_history_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_hba_info_history_request.go
new file mode 100644
index 0000000000..859183689e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_hba_info_history_request.go
@@ -0,0 +1,30 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdktime"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListPostgresqlHbaInfoHistoryRequest Request Object
+type ListPostgresqlHbaInfoHistoryRequest struct {
+
+ // 实例id
+ InstanceId string `json:"instance_id"`
+
+ // 开始时间,不传默认当天0点(UTC时区)
+ StartTime *sdktime.SdkTime `json:"start_time,omitempty"`
+
+ // 结束时间,不传默认当前时间(UTC时区)
+ EndTime *sdktime.SdkTime `json:"end_time,omitempty"`
+}
+
+func (o ListPostgresqlHbaInfoHistoryRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListPostgresqlHbaInfoHistoryRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListPostgresqlHbaInfoHistoryRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_hba_info_history_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_hba_info_history_response.go
new file mode 100644
index 0000000000..fdce97613d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_hba_info_history_response.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListPostgresqlHbaInfoHistoryResponse Response Object
+type ListPostgresqlHbaInfoHistoryResponse struct {
+ Body *[]PostgresqlHbaHistory `json:"body,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListPostgresqlHbaInfoHistoryResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListPostgresqlHbaInfoHistoryResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListPostgresqlHbaInfoHistoryResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_hba_info_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_hba_info_request.go
new file mode 100644
index 0000000000..ff2ce9aab3
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_hba_info_request.go
@@ -0,0 +1,23 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListPostgresqlHbaInfoRequest Request Object
+type ListPostgresqlHbaInfoRequest struct {
+
+ // 实例id
+ InstanceId string `json:"instance_id"`
+}
+
+func (o ListPostgresqlHbaInfoRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListPostgresqlHbaInfoRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListPostgresqlHbaInfoRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_hba_info_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_hba_info_response.go
new file mode 100644
index 0000000000..d21989db70
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_hba_info_response.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListPostgresqlHbaInfoResponse Response Object
+type ListPostgresqlHbaInfoResponse struct {
+ Body *[]PostgresqlHbaConf `json:"body,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListPostgresqlHbaInfoResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListPostgresqlHbaInfoResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListPostgresqlHbaInfoResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_list_history_tables_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_list_history_tables_request.go
new file mode 100644
index 0000000000..d6610313ca
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_list_history_tables_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListPostgresqlListHistoryTablesRequest Request Object
+type ListPostgresqlListHistoryTablesRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 数据库引擎。支持的引擎如下,不区分大小写:postgresql
+ DatabaseName string `json:"database_name"`
+
+ Body *PostgreSqlHistoryTableRequest `json:"body,omitempty"`
+}
+
+func (o ListPostgresqlListHistoryTablesRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListPostgresqlListHistoryTablesRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListPostgresqlListHistoryTablesRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_list_history_tables_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_list_history_tables_response.go
new file mode 100644
index 0000000000..81925b2af7
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_postgresql_list_history_tables_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListPostgresqlListHistoryTablesResponse Response Object
+type ListPostgresqlListHistoryTablesResponse struct {
+
+ // 恢复表数量限制个数
+ TableLimit *int32 `json:"table_limit,omitempty"`
+
+ // 实例信息
+ Instances *[]PostgreSqlHistoryTableInstance `json:"instances,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListPostgresqlListHistoryTablesResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListPostgresqlListHistoryTablesResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListPostgresqlListHistoryTablesResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_predefined_tag_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_predefined_tag_request.go
new file mode 100644
index 0000000000..7942c76d37
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_predefined_tag_request.go
@@ -0,0 +1,73 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListPredefinedTagRequest Request Object
+type ListPredefinedTagRequest struct {
+
+ // 语言
+ XLanguage *ListPredefinedTagRequestXLanguage `json:"X-Language,omitempty"`
+}
+
+func (o ListPredefinedTagRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListPredefinedTagRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListPredefinedTagRequest", string(data)}, " ")
+}
+
+type ListPredefinedTagRequestXLanguage struct {
+ value string
+}
+
+type ListPredefinedTagRequestXLanguageEnum struct {
+ ZH_CN ListPredefinedTagRequestXLanguage
+ EN_US ListPredefinedTagRequestXLanguage
+}
+
+func GetListPredefinedTagRequestXLanguageEnum() ListPredefinedTagRequestXLanguageEnum {
+ return ListPredefinedTagRequestXLanguageEnum{
+ ZH_CN: ListPredefinedTagRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: ListPredefinedTagRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c ListPredefinedTagRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c ListPredefinedTagRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListPredefinedTagRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_predefined_tag_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_predefined_tag_response.go
new file mode 100644
index 0000000000..7a4cab5618
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_predefined_tag_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListPredefinedTagResponse Response Object
+type ListPredefinedTagResponse struct {
+
+ // 标签集合
+ Tags *[]TagResp `json:"tags,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListPredefinedTagResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListPredefinedTagResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListPredefinedTagResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_project_tags_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_project_tags_request.go
new file mode 100644
index 0000000000..de16c204d1
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_project_tags_request.go
@@ -0,0 +1,23 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListProjectTagsRequest Request Object
+type ListProjectTagsRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+}
+
+func (o ListProjectTagsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListProjectTagsRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListProjectTagsRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_project_tags_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_project_tags_response.go
new file mode 100644
index 0000000000..d07ae448ac
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_project_tags_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListProjectTagsResponse Response Object
+type ListProjectTagsResponse struct {
+
+ // 标签列表,没有标签默认为空数组。
+ Tags *[]ProjectTagInfoResponse `json:"tags,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListProjectTagsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListProjectTagsResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListProjectTagsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_recycle_instances_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_recycle_instances_request.go
new file mode 100644
index 0000000000..a8e80b839d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_recycle_instances_request.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListRecycleInstancesRequest Request Object
+type ListRecycleInstancesRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 索引位置,偏移量。从第一条数据偏移offset条数据后开始查询,必须为数字,不能为负数。
+ Offset int32 `json:"offset"`
+
+ // 每页数据条数。取值范围[1, 50]。
+ Limit int32 `json:"limit"`
+}
+
+func (o ListRecycleInstancesRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListRecycleInstancesRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListRecycleInstancesRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_recycle_instances_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_recycle_instances_response.go
new file mode 100644
index 0000000000..4cb7626ec9
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_recycle_instances_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListRecycleInstancesResponse Response Object
+type ListRecycleInstancesResponse struct {
+
+ // 回收站数据条数
+ TotalCount *int32 `json:"total_count,omitempty"`
+
+ // 回收站信息
+ Instances *[]RecycleInstsanceV3 `json:"instances,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListRecycleInstancesResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListRecycleInstancesResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListRecycleInstancesResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_restore_times_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_restore_times_request.go
new file mode 100644
index 0000000000..f2c06a9d8f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_restore_times_request.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListRestoreTimesRequest Request Object
+type ListRestoreTimesRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 所需查询的日期,为yyyy-mm-dd字符串格式,时区为UTC。
+ Date *string `json:"date,omitempty"`
+}
+
+func (o ListRestoreTimesRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListRestoreTimesRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListRestoreTimesRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_restore_times_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_restore_times_response.go
new file mode 100644
index 0000000000..f9a862c4d1
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_restore_times_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListRestoreTimesResponse Response Object
+type ListRestoreTimesResponse struct {
+
+ // 可恢复时间段列表。
+ RestoreTime *[]GetRestoreTimeResponseRestoreTime `json:"restore_time,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListRestoreTimesResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListRestoreTimesResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListRestoreTimesResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_simplified_instances_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_simplified_instances_request.go
new file mode 100644
index 0000000000..202a68e53c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_simplified_instances_request.go
@@ -0,0 +1,75 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListSimplifiedInstancesRequest Request Object
+type ListSimplifiedInstancesRequest struct {
+
+ // 语言
+ XLanguage *ListSimplifiedInstancesRequestXLanguage `json:"X-Language,omitempty"`
+
+ Body *SimplifiedInstancesRequest `json:"body,omitempty"`
+}
+
+func (o ListSimplifiedInstancesRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListSimplifiedInstancesRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListSimplifiedInstancesRequest", string(data)}, " ")
+}
+
+type ListSimplifiedInstancesRequestXLanguage struct {
+ value string
+}
+
+type ListSimplifiedInstancesRequestXLanguageEnum struct {
+ ZH_CN ListSimplifiedInstancesRequestXLanguage
+ EN_US ListSimplifiedInstancesRequestXLanguage
+}
+
+func GetListSimplifiedInstancesRequestXLanguageEnum() ListSimplifiedInstancesRequestXLanguageEnum {
+ return ListSimplifiedInstancesRequestXLanguageEnum{
+ ZH_CN: ListSimplifiedInstancesRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: ListSimplifiedInstancesRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c ListSimplifiedInstancesRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c ListSimplifiedInstancesRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListSimplifiedInstancesRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_simplified_instances_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_simplified_instances_response.go
new file mode 100644
index 0000000000..bae6465957
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_simplified_instances_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListSimplifiedInstancesResponse Response Object
+type ListSimplifiedInstancesResponse struct {
+
+ // 实例集合
+ Instances *[]SimplifiedInstanceEntry `json:"instances,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListSimplifiedInstancesResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListSimplifiedInstancesResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListSimplifiedInstancesResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_log_file_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_log_file_request.go
new file mode 100644
index 0000000000..e3a41786d3
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_log_file_request.go
@@ -0,0 +1,32 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListSlowLogFileRequest Request Object
+type ListSlowLogFileRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 索引位置,偏移量。 从第一条数据偏移offset条数据后开始查询,默认为0(偏移0条数据,表示从第一条数据开始查询),必须为数字,不能为负数。
+ Offset *int32 `json:"offset,omitempty"`
+
+ // 查询记录数。取值范围[1, 100]。
+ Limit *int32 `json:"limit,omitempty"`
+}
+
+func (o ListSlowLogFileRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListSlowLogFileRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListSlowLogFileRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_log_file_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_log_file_response.go
new file mode 100644
index 0000000000..bf740501ec
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_log_file_response.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListSlowLogFileResponse Response Object
+type ListSlowLogFileResponse struct {
+ List *[]SlowLogFile `json:"list,omitempty"`
+
+ // 文件总数。
+ TotalCount *int64 `json:"total_count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListSlowLogFileResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListSlowLogFileResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListSlowLogFileResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_log_statistics_for_lts_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_log_statistics_for_lts_request.go
new file mode 100644
index 0000000000..7770ec2cdc
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_log_statistics_for_lts_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListSlowLogStatisticsForLtsRequest Request Object
+type ListSlowLogStatisticsForLtsRequest struct {
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 语言。默认en-us。
+ XLanguage *ListSlowLogStatisticsForLtsRequestXLanguage `json:"X-Language,omitempty"`
+
+ Body *SlowLogStatisticsForLtsRequest `json:"body,omitempty"`
+}
+
+func (o ListSlowLogStatisticsForLtsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListSlowLogStatisticsForLtsRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListSlowLogStatisticsForLtsRequest", string(data)}, " ")
+}
+
+type ListSlowLogStatisticsForLtsRequestXLanguage struct {
+ value string
+}
+
+type ListSlowLogStatisticsForLtsRequestXLanguageEnum struct {
+ ZH_CN ListSlowLogStatisticsForLtsRequestXLanguage
+ EN_US ListSlowLogStatisticsForLtsRequestXLanguage
+}
+
+func GetListSlowLogStatisticsForLtsRequestXLanguageEnum() ListSlowLogStatisticsForLtsRequestXLanguageEnum {
+ return ListSlowLogStatisticsForLtsRequestXLanguageEnum{
+ ZH_CN: ListSlowLogStatisticsForLtsRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: ListSlowLogStatisticsForLtsRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c ListSlowLogStatisticsForLtsRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c ListSlowLogStatisticsForLtsRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListSlowLogStatisticsForLtsRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_log_statistics_for_lts_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_log_statistics_for_lts_response.go
new file mode 100644
index 0000000000..8ea799d1ba
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_log_statistics_for_lts_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListSlowLogStatisticsForLtsResponse Response Object
+type ListSlowLogStatisticsForLtsResponse struct {
+
+ // 数据集合。
+ SlowLogList *[]MysqlSlowLogStatisticsItem `json:"slow_log_list,omitempty"`
+
+ // 总条数。
+ TotalCount *int32 `json:"total_count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListSlowLogStatisticsForLtsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListSlowLogStatisticsForLtsResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListSlowLogStatisticsForLtsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_logs_new_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_logs_new_request.go
new file mode 100644
index 0000000000..139d65d907
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_logs_new_request.go
@@ -0,0 +1,103 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListSlowLogsNewRequest Request Object
+type ListSlowLogsNewRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 开始日期,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ StartDate string `json:"start_date"`
+
+ // 结束时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。只能查询当前时间前一个月内的慢日志。
+ EndDate string `json:"end_date"`
+
+ // 索引位置,偏移量。从第一条数据偏移offset条数据后开始查询,默认为0(偏移0条数据,表示从第一条数据开始查询),必须为数字,不能为负数。
+ Offset *int64 `json:"offset,omitempty"`
+
+ // 每页多少条记录,取值范围是1~100,不填时默认为10。
+ Limit *int64 `json:"limit,omitempty"`
+
+ // 语句类型,取空值,表示查询所有语句类型。
+ Type *ListSlowLogsNewRequestType `json:"type,omitempty"`
+}
+
+func (o ListSlowLogsNewRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListSlowLogsNewRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListSlowLogsNewRequest", string(data)}, " ")
+}
+
+type ListSlowLogsNewRequestType struct {
+ value string
+}
+
+type ListSlowLogsNewRequestTypeEnum struct {
+ INSERT ListSlowLogsNewRequestType
+ UPDATE ListSlowLogsNewRequestType
+ SELECT ListSlowLogsNewRequestType
+ DELETE ListSlowLogsNewRequestType
+ CREATE ListSlowLogsNewRequestType
+}
+
+func GetListSlowLogsNewRequestTypeEnum() ListSlowLogsNewRequestTypeEnum {
+ return ListSlowLogsNewRequestTypeEnum{
+ INSERT: ListSlowLogsNewRequestType{
+ value: "INSERT",
+ },
+ UPDATE: ListSlowLogsNewRequestType{
+ value: "UPDATE",
+ },
+ SELECT: ListSlowLogsNewRequestType{
+ value: "SELECT",
+ },
+ DELETE: ListSlowLogsNewRequestType{
+ value: "DELETE",
+ },
+ CREATE: ListSlowLogsNewRequestType{
+ value: "CREATE",
+ },
+ }
+}
+
+func (c ListSlowLogsNewRequestType) Value() string {
+ return c.value
+}
+
+func (c ListSlowLogsNewRequestType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListSlowLogsNewRequestType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_logs_new_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_logs_new_response.go
new file mode 100644
index 0000000000..8adb3d38c4
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_logs_new_response.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListSlowLogsNewResponse Response Object
+type ListSlowLogsNewResponse struct {
+ SlowLogList *[]SlowLog `json:"slow_log_list,omitempty"`
+
+ // 总记录数。
+ TotalRecord *int32 `json:"total_record,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListSlowLogsNewResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListSlowLogsNewResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListSlowLogsNewResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_logs_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_logs_request.go
new file mode 100644
index 0000000000..11fd298f32
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_logs_request.go
@@ -0,0 +1,103 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListSlowLogsRequest Request Object
+type ListSlowLogsRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 开始日期,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ StartDate string `json:"start_date"`
+
+ // 结束时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。只能查询当前时间前一个月内的慢日志。
+ EndDate string `json:"end_date"`
+
+ // 页数偏移量,如1、2、3、4等,不填时默认为1。
+ Offset *int32 `json:"offset,omitempty"`
+
+ // 每页多少条记录,取值范围是1~100,不填时默认为10。
+ Limit *int32 `json:"limit,omitempty"`
+
+ // 语句类型,取空值,表示查询所有语句类型。
+ Type *ListSlowLogsRequestType `json:"type,omitempty"`
+}
+
+func (o ListSlowLogsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListSlowLogsRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListSlowLogsRequest", string(data)}, " ")
+}
+
+type ListSlowLogsRequestType struct {
+ value string
+}
+
+type ListSlowLogsRequestTypeEnum struct {
+ INSERT ListSlowLogsRequestType
+ UPDATE ListSlowLogsRequestType
+ SELECT ListSlowLogsRequestType
+ DELETE ListSlowLogsRequestType
+ CREATE ListSlowLogsRequestType
+}
+
+func GetListSlowLogsRequestTypeEnum() ListSlowLogsRequestTypeEnum {
+ return ListSlowLogsRequestTypeEnum{
+ INSERT: ListSlowLogsRequestType{
+ value: "INSERT",
+ },
+ UPDATE: ListSlowLogsRequestType{
+ value: "UPDATE",
+ },
+ SELECT: ListSlowLogsRequestType{
+ value: "SELECT",
+ },
+ DELETE: ListSlowLogsRequestType{
+ value: "DELETE",
+ },
+ CREATE: ListSlowLogsRequestType{
+ value: "CREATE",
+ },
+ }
+}
+
+func (c ListSlowLogsRequestType) Value() string {
+ return c.value
+}
+
+func (c ListSlowLogsRequestType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListSlowLogsRequestType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_logs_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_logs_response.go
new file mode 100644
index 0000000000..02be2c6632
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slow_logs_response.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListSlowLogsResponse Response Object
+type ListSlowLogsResponse struct {
+ SlowLogList *[]SlowLog `json:"slow_log_list,omitempty"`
+
+ // 总记录数。
+ TotalRecord *int32 `json:"total_record,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListSlowLogsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListSlowLogsResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListSlowLogsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slowlog_for_lts_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slowlog_for_lts_request.go
new file mode 100644
index 0000000000..69b841809f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slowlog_for_lts_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListSlowlogForLtsRequest Request Object
+type ListSlowlogForLtsRequest struct {
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 语言。默认en-us。
+ XLanguage *ListSlowlogForLtsRequestXLanguage `json:"X-Language,omitempty"`
+
+ Body *SlowlogForLtsRequest `json:"body,omitempty"`
+}
+
+func (o ListSlowlogForLtsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListSlowlogForLtsRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListSlowlogForLtsRequest", string(data)}, " ")
+}
+
+type ListSlowlogForLtsRequestXLanguage struct {
+ value string
+}
+
+type ListSlowlogForLtsRequestXLanguageEnum struct {
+ ZH_CN ListSlowlogForLtsRequestXLanguage
+ EN_US ListSlowlogForLtsRequestXLanguage
+}
+
+func GetListSlowlogForLtsRequestXLanguageEnum() ListSlowlogForLtsRequestXLanguageEnum {
+ return ListSlowlogForLtsRequestXLanguageEnum{
+ ZH_CN: ListSlowlogForLtsRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: ListSlowlogForLtsRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c ListSlowlogForLtsRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c ListSlowlogForLtsRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListSlowlogForLtsRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slowlog_for_lts_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slowlog_for_lts_response.go
new file mode 100644
index 0000000000..5bae4c00aa
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slowlog_for_lts_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListSlowlogForLtsResponse Response Object
+type ListSlowlogForLtsResponse struct {
+
+ // 日志数据集合。
+ SlowLogList *[]MysqlSlowLogDetailsItem `json:"slow_log_list,omitempty"`
+
+ // 当前慢日志阈值时间。
+ LongQueryTime *string `json:"long_query_time,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListSlowlogForLtsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListSlowlogForLtsResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListSlowlogForLtsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slowlog_statistics_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slowlog_statistics_request.go
new file mode 100644
index 0000000000..6b7b48e580
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slowlog_statistics_request.go
@@ -0,0 +1,157 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListSlowlogStatisticsRequest Request Object
+type ListSlowlogStatisticsRequest struct {
+
+ // 语言
+ XLanguage *ListSlowlogStatisticsRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 当前页号
+ CurPage int32 `json:"cur_page"`
+
+ // 每页多少条记录,取值范围0~100
+ PerPage int32 `json:"per_page"`
+
+ // 开始时间,格式为“yyyy-mm-ddThh:mm:ssZ”。其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ StartDate string `json:"start_date"`
+
+ // 结束时间,格式为“yyyy-mm-ddThh:mm:ssZ”。其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ EndDate string `json:"end_date"`
+
+ // 语句类型,ALL表示查询所有语句类型,也可指定日志类型 - INSERT - UPDATE - SELECT - DELETE - CREATE - ALL
+ Type ListSlowlogStatisticsRequestType `json:"type"`
+
+ // 取值范围:\"executeTime\",表示按执行时间降序排序,不传或者传其他表示按执行次数降序排序
+ Sort *string `json:"sort,omitempty"`
+}
+
+func (o ListSlowlogStatisticsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListSlowlogStatisticsRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListSlowlogStatisticsRequest", string(data)}, " ")
+}
+
+type ListSlowlogStatisticsRequestXLanguage struct {
+ value string
+}
+
+type ListSlowlogStatisticsRequestXLanguageEnum struct {
+ ZH_CN ListSlowlogStatisticsRequestXLanguage
+ EN_US ListSlowlogStatisticsRequestXLanguage
+}
+
+func GetListSlowlogStatisticsRequestXLanguageEnum() ListSlowlogStatisticsRequestXLanguageEnum {
+ return ListSlowlogStatisticsRequestXLanguageEnum{
+ ZH_CN: ListSlowlogStatisticsRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: ListSlowlogStatisticsRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c ListSlowlogStatisticsRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c ListSlowlogStatisticsRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListSlowlogStatisticsRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
+
+type ListSlowlogStatisticsRequestType struct {
+ value string
+}
+
+type ListSlowlogStatisticsRequestTypeEnum struct {
+ INSERT ListSlowlogStatisticsRequestType
+ UPDATE ListSlowlogStatisticsRequestType
+ SELECT ListSlowlogStatisticsRequestType
+ DELETE ListSlowlogStatisticsRequestType
+ CREATE ListSlowlogStatisticsRequestType
+ ALL ListSlowlogStatisticsRequestType
+}
+
+func GetListSlowlogStatisticsRequestTypeEnum() ListSlowlogStatisticsRequestTypeEnum {
+ return ListSlowlogStatisticsRequestTypeEnum{
+ INSERT: ListSlowlogStatisticsRequestType{
+ value: "INSERT",
+ },
+ UPDATE: ListSlowlogStatisticsRequestType{
+ value: "UPDATE",
+ },
+ SELECT: ListSlowlogStatisticsRequestType{
+ value: "SELECT",
+ },
+ DELETE: ListSlowlogStatisticsRequestType{
+ value: "DELETE",
+ },
+ CREATE: ListSlowlogStatisticsRequestType{
+ value: "CREATE",
+ },
+ ALL: ListSlowlogStatisticsRequestType{
+ value: "ALL",
+ },
+ }
+}
+
+func (c ListSlowlogStatisticsRequestType) Value() string {
+ return c.value
+}
+
+func (c ListSlowlogStatisticsRequestType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListSlowlogStatisticsRequestType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slowlog_statistics_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slowlog_statistics_response.go
new file mode 100644
index 0000000000..0818cb5bb3
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_slowlog_statistics_response.go
@@ -0,0 +1,39 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListSlowlogStatisticsResponse Response Object
+type ListSlowlogStatisticsResponse struct {
+
+ // 当前页码
+ PageNumber *int32 `json:"pageNumber,omitempty"`
+
+ // 每页条数
+ PageRecord *int32 `json:"pageRecord,omitempty"`
+
+ // 慢日志列表
+ SlowLogList *[]SlowLogStatistics `json:"slowLogList,omitempty"`
+
+ // 总条数
+ TotalRecord *int32 `json:"totalRecord,omitempty"`
+
+ // 开始时间
+ StartTime *int64 `json:"startTime,omitempty"`
+
+ // 结束时间
+ EndTime *int64 `json:"endTime,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListSlowlogStatisticsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListSlowlogStatisticsResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListSlowlogStatisticsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_sqlserver_databases_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_sqlserver_databases_request.go
new file mode 100644
index 0000000000..0e230d8414
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_sqlserver_databases_request.go
@@ -0,0 +1,38 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListSqlserverDatabasesRequest Request Object
+type ListSqlserverDatabasesRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 分页页码,从1开始。
+ Page int32 `json:"page"`
+
+ // 每页数据条数。取值范围[1, 100]。
+ Limit int32 `json:"limit"`
+
+ // 数据库名。当指定该参数时,page和limit参数需要传入但不生效。
+ DbName *string `json:"db-name,omitempty"`
+
+ // 数据库恢复健康模式,取值:FULL :完整模式,SIMPLE :简单模式,BUlK_LOGGED :大容量日志恢复模式(该参数仅用于SQL server引擎)
+ RecoverModel *string `json:"recover_model,omitempty"`
+}
+
+func (o ListSqlserverDatabasesRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListSqlserverDatabasesRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListSqlserverDatabasesRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_sqlserver_databases_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_sqlserver_databases_response.go
new file mode 100644
index 0000000000..5988fafdb4
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_sqlserver_databases_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListSqlserverDatabasesResponse Response Object
+type ListSqlserverDatabasesResponse struct {
+
+ // 数据库信息。
+ Databases *[]SqlserverDatabaseForDetail `json:"databases,omitempty"`
+
+ // 总数。
+ TotalCount *int32 `json:"total_count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListSqlserverDatabasesResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListSqlserverDatabasesResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListSqlserverDatabasesResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_sqlserver_db_users_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_sqlserver_db_users_request.go
new file mode 100644
index 0000000000..0ec44c11ac
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_sqlserver_db_users_request.go
@@ -0,0 +1,32 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListSqlserverDbUsersRequest Request Object
+type ListSqlserverDbUsersRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 分页页码,从1开始。
+ Page int32 `json:"page"`
+
+ // 每页数据条数。取值范围[1, 100]。
+ Limit int32 `json:"limit"`
+}
+
+func (o ListSqlserverDbUsersRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListSqlserverDbUsersRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListSqlserverDbUsersRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_sqlserver_db_users_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_sqlserver_db_users_response.go
new file mode 100644
index 0000000000..4258012ba4
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_sqlserver_db_users_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListSqlserverDbUsersResponse Response Object
+type ListSqlserverDbUsersResponse struct {
+
+ // 用户信息。
+ Users *[]UserForList `json:"users,omitempty"`
+
+ // 总条数。
+ TotalCount *int32 `json:"total_count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListSqlserverDbUsersResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListSqlserverDbUsersResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListSqlserverDbUsersResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_ssl_cert_download_link_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_ssl_cert_download_link_request.go
new file mode 100644
index 0000000000..ed14103dcc
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_ssl_cert_download_link_request.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListSslCertDownloadLinkRequest Request Object
+type ListSslCertDownloadLinkRequest struct {
+ InstanceId string `json:"instance_id"`
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+}
+
+func (o ListSslCertDownloadLinkRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListSslCertDownloadLinkRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListSslCertDownloadLinkRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_ssl_cert_download_link_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_ssl_cert_download_link_response.go
new file mode 100644
index 0000000000..8147c4d8aa
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_ssl_cert_download_link_response.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListSslCertDownloadLinkResponse Response Object
+type ListSslCertDownloadLinkResponse struct {
+ CertInfoList *[]DownloadInfoRsp `json:"cert_info_list,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListSslCertDownloadLinkResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListSslCertDownloadLinkResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListSslCertDownloadLinkResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_storage_types_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_storage_types_request.go
new file mode 100644
index 0000000000..65315d3e14
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_storage_types_request.go
@@ -0,0 +1,141 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ListStorageTypesRequest Request Object
+type ListStorageTypesRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 数据库引擎。支持的引擎如下,不区分大小写: MySQL PostgreSQL SQLServer
+ DatabaseName ListStorageTypesRequestDatabaseName `json:"database_name"`
+
+ // 数据库版本号。
+ VersionName string `json:"version_name"`
+
+ // 主备模式: single:单机模式。 ha:主备模式。 replica:只读模式。
+ HaMode *ListStorageTypesRequestHaMode `json:"ha_mode,omitempty"`
+}
+
+func (o ListStorageTypesRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListStorageTypesRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListStorageTypesRequest", string(data)}, " ")
+}
+
+type ListStorageTypesRequestDatabaseName struct {
+ value string
+}
+
+type ListStorageTypesRequestDatabaseNameEnum struct {
+ MY_SQL ListStorageTypesRequestDatabaseName
+ POSTGRE_SQL ListStorageTypesRequestDatabaseName
+ SQL_SERVER ListStorageTypesRequestDatabaseName
+ MARIA_DB ListStorageTypesRequestDatabaseName
+}
+
+func GetListStorageTypesRequestDatabaseNameEnum() ListStorageTypesRequestDatabaseNameEnum {
+ return ListStorageTypesRequestDatabaseNameEnum{
+ MY_SQL: ListStorageTypesRequestDatabaseName{
+ value: "MySQL",
+ },
+ POSTGRE_SQL: ListStorageTypesRequestDatabaseName{
+ value: "PostgreSQL",
+ },
+ SQL_SERVER: ListStorageTypesRequestDatabaseName{
+ value: "SQLServer",
+ },
+ MARIA_DB: ListStorageTypesRequestDatabaseName{
+ value: "MariaDB",
+ },
+ }
+}
+
+func (c ListStorageTypesRequestDatabaseName) Value() string {
+ return c.value
+}
+
+func (c ListStorageTypesRequestDatabaseName) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListStorageTypesRequestDatabaseName) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
+
+type ListStorageTypesRequestHaMode struct {
+ value string
+}
+
+type ListStorageTypesRequestHaModeEnum struct {
+ HA ListStorageTypesRequestHaMode
+ SINGLE ListStorageTypesRequestHaMode
+ REPLICA ListStorageTypesRequestHaMode
+}
+
+func GetListStorageTypesRequestHaModeEnum() ListStorageTypesRequestHaModeEnum {
+ return ListStorageTypesRequestHaModeEnum{
+ HA: ListStorageTypesRequestHaMode{
+ value: "ha",
+ },
+ SINGLE: ListStorageTypesRequestHaMode{
+ value: "single",
+ },
+ REPLICA: ListStorageTypesRequestHaMode{
+ value: "replica",
+ },
+ }
+}
+
+func (c ListStorageTypesRequestHaMode) Value() string {
+ return c.value
+}
+
+func (c ListStorageTypesRequestHaMode) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ListStorageTypesRequestHaMode) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_storage_types_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_storage_types_response.go
new file mode 100644
index 0000000000..5fc403826a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_storage_types_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListStorageTypesResponse Response Object
+type ListStorageTypesResponse struct {
+
+ // 实例磁盘类型信息。
+ StorageType *[]Storage `json:"storage_type,omitempty"`
+
+ // 实例专属存储信息。
+ DsspoolInfo *[]DssPoolInfo `json:"dsspool_info,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListStorageTypesResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListStorageTypesResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListStorageTypesResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_upgrade_histories_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_upgrade_histories_request.go
new file mode 100644
index 0000000000..d19cb3d694
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_upgrade_histories_request.go
@@ -0,0 +1,38 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListUpgradeHistoriesRequest Request Object
+type ListUpgradeHistoriesRequest struct {
+
+ // 实例ID
+ InstanceId string `json:"instance_id"`
+
+ // 索引位置,偏移量。从第一条数据偏移offset条数据后开始查询,默认为0(偏移0条数据,表示从第一条数据开始查询),必须为数字,不能为负数。
+ Offset *int32 `json:"offset,omitempty"`
+
+ // 查询记录数。默认为10,不能为负数,最小值为1,最大值为100。
+ Limit *int32 `json:"limit,omitempty"`
+
+ // 排序方式。 DESC,降序。 ASC,升序。 默认降序。
+ Order *string `json:"order,omitempty"`
+
+ // 排序字段。 start_time 开始时间。 end_time 结束时间。 默认开始时间。
+ SortField *string `json:"sort_field,omitempty"`
+
+ // 语言。默认en-us。
+ XLanguage *string `json:"X-Language,omitempty"`
+}
+
+func (o ListUpgradeHistoriesRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListUpgradeHistoriesRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListUpgradeHistoriesRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_upgrade_histories_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_upgrade_histories_response.go
new file mode 100644
index 0000000000..f6d37559d7
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_upgrade_histories_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListUpgradeHistoriesResponse Response Object
+type ListUpgradeHistoriesResponse struct {
+
+ // 总记录数。
+ TotalCount *int32 `json:"total_count,omitempty"`
+
+ // 升级报告信息。
+ UpgradeReports *[]UpgradeReports `json:"upgrade_reports,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListUpgradeHistoriesResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListUpgradeHistoriesResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListUpgradeHistoriesResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_xel_log_response_result.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_xel_log_response_result.go
new file mode 100644
index 0000000000..755d2a70f7
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_xel_log_response_result.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListXelLogResponseResult 扩展日志信息
+type ListXelLogResponseResult struct {
+
+ // 文件名
+ FileName string `json:"file_name"`
+
+ // 日志大小,单位:KB
+ FileSize string `json:"file_size"`
+}
+
+func (o ListXelLogResponseResult) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListXelLogResponseResult struct{}"
+ }
+
+ return strings.Join([]string{"ListXelLogResponseResult", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_xellog_files_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_xellog_files_request.go
new file mode 100644
index 0000000000..1b4c8f366e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_xellog_files_request.go
@@ -0,0 +1,32 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListXellogFilesRequest Request Object
+type ListXellogFilesRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 索引位置,偏移量。 从第一条数据偏移offset条数据后开始查询,默认为0(偏移0条数据,表示从第一条数据开始查询),必须为数字,不能为负数。
+ Offset *int32 `json:"offset,omitempty"`
+
+ // 查询记录数。取值范围[1, 100]。
+ Limit *int32 `json:"limit,omitempty"`
+}
+
+func (o ListXellogFilesRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListXellogFilesRequest struct{}"
+ }
+
+ return strings.Join([]string{"ListXellogFilesRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_xellog_files_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_xellog_files_response.go
new file mode 100644
index 0000000000..b47d9622f9
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_list_xellog_files_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ListXellogFilesResponse Response Object
+type ListXellogFilesResponse struct {
+
+ // 扩展日志文件返回体
+ List *[]ListXelLogResponseResult `json:"list,omitempty"`
+
+ // 扩展日志文件数量
+ Count *int32 `json:"count,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ListXellogFilesResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ListXellogFilesResponse struct{}"
+ }
+
+ return strings.Join([]string{"ListXellogFilesResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_master_instance.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_master_instance.go
new file mode 100644
index 0000000000..171bffa8f7
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_master_instance.go
@@ -0,0 +1,32 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// MasterInstance 主实例信息。
+type MasterInstance struct {
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 区域。
+ Region string `json:"region"`
+
+ // 项目ID。
+ ProjectId string `json:"project_id"`
+
+ // 项目名称。
+ ProjectName string `json:"project_name"`
+}
+
+func (o MasterInstance) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "MasterInstance struct{}"
+ }
+
+ return strings.Join([]string{"MasterInstance", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_migrate_follower_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_migrate_follower_request.go
new file mode 100644
index 0000000000..4da07d8f76
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_migrate_follower_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// MigrateFollowerRequest Request Object
+type MigrateFollowerRequest struct {
+
+ // 语言
+ XLanguage *MigrateFollowerRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *FollowerMigrateRequest `json:"body,omitempty"`
+}
+
+func (o MigrateFollowerRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "MigrateFollowerRequest struct{}"
+ }
+
+ return strings.Join([]string{"MigrateFollowerRequest", string(data)}, " ")
+}
+
+type MigrateFollowerRequestXLanguage struct {
+ value string
+}
+
+type MigrateFollowerRequestXLanguageEnum struct {
+ ZH_CN MigrateFollowerRequestXLanguage
+ EN_US MigrateFollowerRequestXLanguage
+}
+
+func GetMigrateFollowerRequestXLanguageEnum() MigrateFollowerRequestXLanguageEnum {
+ return MigrateFollowerRequestXLanguageEnum{
+ ZH_CN: MigrateFollowerRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: MigrateFollowerRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c MigrateFollowerRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c MigrateFollowerRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *MigrateFollowerRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_migrate_follower_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_migrate_follower_response.go
new file mode 100644
index 0000000000..4fb9edafb1
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_migrate_follower_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// MigrateFollowerResponse Response Object
+type MigrateFollowerResponse struct {
+
+ // 任务ID
+ WorkflowId *string `json:"workflowId,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o MigrateFollowerResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "MigrateFollowerResponse struct{}"
+ }
+
+ return strings.Join([]string{"MigrateFollowerResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modifiy_instance_name_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modifiy_instance_name_request.go
new file mode 100644
index 0000000000..5fa3b69ee9
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modifiy_instance_name_request.go
@@ -0,0 +1,23 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ModifiyInstanceNameRequest 修改实例名称必填。
+type ModifiyInstanceNameRequest struct {
+
+ // 实例名称。 用于表示实例的名称,同一租户下,同类型的实例名可重名。取值范围如下: - MySQL数据库支持的字符长度是4~64个字符,必须以字母开头,区分大小写,可以包含字母、数字、中文字符、中划线或者下划线,不能包含其他的特殊字符。 - PostgreSQL和SQL Server数据库支持的字符长度是4~64个字符,必须以字母开头,区分大小写,可以包含字母、数字、中划线或者下划线,不能包含其他的特殊字符。
+ Name string `json:"name"`
+}
+
+func (o ModifiyInstanceNameRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ModifiyInstanceNameRequest struct{}"
+ }
+
+ return strings.Join([]string{"ModifiyInstanceNameRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_collation_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_collation_request.go
new file mode 100644
index 0000000000..e4a3563d3e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_collation_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ModifyCollationRequest Request Object
+type ModifyCollationRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *ModifyCollationRequestBody `json:"body,omitempty"`
+}
+
+func (o ModifyCollationRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ModifyCollationRequest struct{}"
+ }
+
+ return strings.Join([]string{"ModifyCollationRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_collation_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_collation_request_body.go
new file mode 100644
index 0000000000..2d3ddf3b9f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_collation_request_body.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ModifyCollationRequestBody struct {
+
+ // 字符集。 取值范围:根据查询SQL Server可用字符集查询可设置的字符集。
+ Collation string `json:"collation"`
+}
+
+func (o ModifyCollationRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ModifyCollationRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"ModifyCollationRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_collation_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_collation_response.go
new file mode 100644
index 0000000000..6c3309bd76
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_collation_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ModifyCollationResponse Response Object
+type ModifyCollationResponse struct {
+
+ // 任务ID。
+ JobId *string `json:"job_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ModifyCollationResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ModifyCollationResponse struct{}"
+ }
+
+ return strings.Join([]string{"ModifyCollationResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_dns_name_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_dns_name_request_body.go
new file mode 100644
index 0000000000..c06dd536d8
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_dns_name_request_body.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ModifyDnsNameRequestBody struct {
+
+ // 新域名的前缀,校验规则是^[0-9a-zA-Z]{8,64}$
+ DnsName string `json:"dns_name"`
+}
+
+func (o ModifyDnsNameRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ModifyDnsNameRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"ModifyDnsNameRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_param_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_param_request.go
new file mode 100644
index 0000000000..0624731ebd
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_param_request.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ModifyParamRequest struct {
+
+ // 参数值。
+ Value string `json:"value"`
+}
+
+func (o ModifyParamRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ModifyParamRequest struct{}"
+ }
+
+ return strings.Join([]string{"ModifyParamRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_postgresql_hba_conf_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_postgresql_hba_conf_request.go
new file mode 100644
index 0000000000..e98e0e37cc
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_postgresql_hba_conf_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ModifyPostgresqlHbaConfRequest Request Object
+type ModifyPostgresqlHbaConfRequest struct {
+
+ // 实例id
+ InstanceId string `json:"instance_id"`
+
+ Body *[]PostgresqlHbaConf `json:"body,omitempty"`
+}
+
+func (o ModifyPostgresqlHbaConfRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ModifyPostgresqlHbaConfRequest struct{}"
+ }
+
+ return strings.Join([]string{"ModifyPostgresqlHbaConfRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_postgresql_hba_conf_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_postgresql_hba_conf_response.go
new file mode 100644
index 0000000000..2823c916c6
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_postgresql_hba_conf_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ModifyPostgresqlHbaConfResponse Response Object
+type ModifyPostgresqlHbaConfResponse struct {
+
+ // 结果码
+ Code *string `json:"code,omitempty"`
+
+ // 结果描述
+ Message *string `json:"message,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ModifyPostgresqlHbaConfResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ModifyPostgresqlHbaConfResponse struct{}"
+ }
+
+ return strings.Join([]string{"ModifyPostgresqlHbaConfResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_proxy_weight_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_proxy_weight_request.go
new file mode 100644
index 0000000000..6b0d7b78f8
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_modify_proxy_weight_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ModifyProxyWeightRequest struct {
+
+ // 主实例权重,取值范围为0~1000。
+ MasterWeight string `json:"master_weight"`
+
+ // 只读实例信息。
+ ReadonlyInstances []ProxyReadonlyInstances `json:"readonly_instances"`
+}
+
+func (o ModifyProxyWeightRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ModifyProxyWeightRequest struct{}"
+ }
+
+ return strings.Join([]string{"ModifyProxyWeightRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_msdtc_host_option.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_msdtc_host_option.go
new file mode 100644
index 0000000000..778bb4a341
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_msdtc_host_option.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type MsdtcHostOption struct {
+
+ // 主机名称 hostname
+ HostName string `json:"host_name"`
+
+ // 主机ip
+ Ip string `json:"ip"`
+}
+
+func (o MsdtcHostOption) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "MsdtcHostOption struct{}"
+ }
+
+ return strings.Join([]string{"MsdtcHostOption", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_mysql_read_only_switch.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_mysql_read_only_switch.go
new file mode 100644
index 0000000000..21ef222523
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_mysql_read_only_switch.go
@@ -0,0 +1,23 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// MysqlReadOnlySwitch 设置实例只读参数。
+type MysqlReadOnlySwitch struct {
+
+ // 是否设置为只读权限 - true,表示设置为只读权限 - false,表示解除已设置的只读权限
+ Readonly bool `json:"readonly"`
+}
+
+func (o MysqlReadOnlySwitch) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "MysqlReadOnlySwitch struct{}"
+ }
+
+ return strings.Join([]string{"MysqlReadOnlySwitch", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_mysql_slow_log_details_item.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_mysql_slow_log_details_item.go
new file mode 100644
index 0000000000..80483fd3d3
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_mysql_slow_log_details_item.go
@@ -0,0 +1,55 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type MysqlSlowLogDetailsItem struct {
+
+ // 执行次数。
+ Count *string `json:"count,omitempty"`
+
+ // 执行时间。
+ Time *string `json:"time,omitempty"`
+
+ // 等待锁时间。mysql支持
+ LockTime *string `json:"lock_time,omitempty"`
+
+ // 结果行数量。mysql支持
+ RowsSent *string `json:"rows_sent,omitempty"`
+
+ // 扫描的行数量。mysql支持
+ RowsExamined *string `json:"rows_examined,omitempty"`
+
+ // 所属数据库。
+ Database *string `json:"database,omitempty"`
+
+ // 帐号。
+ Users *string `json:"users,omitempty"`
+
+ // 执行语法。慢日志默认脱敏显示,如需明文显示,请联系客服人员添加白名单。
+ QuerySample *string `json:"query_sample,omitempty"`
+
+ // 语句类型。
+ Type *string `json:"type,omitempty"`
+
+ // 发生时间,UTC时间。
+ StartTime *string `json:"start_time,omitempty"`
+
+ // IP地址。
+ ClientIp *string `json:"client_ip,omitempty"`
+
+ // 日志单行序列号。
+ LineNum *string `json:"line_num,omitempty"`
+}
+
+func (o MysqlSlowLogDetailsItem) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "MysqlSlowLogDetailsItem struct{}"
+ }
+
+ return strings.Join([]string{"MysqlSlowLogDetailsItem", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_mysql_slow_log_statistics_item.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_mysql_slow_log_statistics_item.go
new file mode 100644
index 0000000000..5f7a2b57a6
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_mysql_slow_log_statistics_item.go
@@ -0,0 +1,49 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type MysqlSlowLogStatisticsItem struct {
+
+ // 执行次数。
+ Count *string `json:"count,omitempty"`
+
+ // 执行时间。
+ Time *string `json:"time,omitempty"`
+
+ // 等待锁时间。mysql支持
+ LockTime *string `json:"lock_time,omitempty"`
+
+ // 结果行数量。mysql支持
+ RowsSent *int64 `json:"rows_sent,omitempty"`
+
+ // 扫描的行数量。mysql支持
+ RowsExamined *int64 `json:"rows_examined,omitempty"`
+
+ // 所属数据库。
+ Database *string `json:"database,omitempty"`
+
+ // 帐号。
+ Users *string `json:"users,omitempty"`
+
+ // 执行语法。
+ QuerySample *string `json:"query_sample,omitempty"`
+
+ // IP地址。
+ ClientIp *string `json:"client_ip,omitempty"`
+
+ // 语句类型。
+ Type *string `json:"type,omitempty"`
+}
+
+func (o MysqlSlowLogStatisticsItem) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "MysqlSlowLogStatisticsItem struct{}"
+ }
+
+ return strings.Join([]string{"MysqlSlowLogStatisticsItem", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_node_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_node_response.go
new file mode 100644
index 0000000000..4a3db7c84f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_node_response.go
@@ -0,0 +1,35 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// NodeResponse 实例节点信息。
+type NodeResponse struct {
+
+ // 节点ID。
+ Id string `json:"id"`
+
+ // 节点名称。
+ Name string `json:"name"`
+
+ // 节点类型,取值为“master”、“slave”或“readreplica”,分别对应于主节点、备节点和只读节点。
+ Role string `json:"role"`
+
+ // 节点状态。
+ Status string `json:"status"`
+
+ // 可用区。
+ AvailabilityZone string `json:"availability_zone"`
+}
+
+func (o NodeResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "NodeResponse struct{}"
+ }
+
+ return strings.Join([]string{"NodeResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_off_site_backup_for_list.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_off_site_backup_for_list.go
new file mode 100644
index 0000000000..fc3d4fb1f8
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_off_site_backup_for_list.go
@@ -0,0 +1,157 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// OffSiteBackupForList 跨区域备份信息。
+type OffSiteBackupForList struct {
+
+ // 备份ID。
+ Id string `json:"id"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 备份名称。
+ Name string `json:"name"`
+
+ // 备份的数据库。
+ Databases *[]BackupDatabase `json:"databases,omitempty"`
+
+ // 备份开始时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ BeginTime string `json:"begin_time"`
+
+ // 备份结束时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ EndTime string `json:"end_time"`
+
+ // 备份状态,取值: - BUILDING: 备份中。 - COMPLETED: 备份完成。 - FAILED:备份失败。 - DELETING:备份删除中。
+ Status OffSiteBackupForListStatus `json:"status"`
+
+ // 备份类型,取值: - “auto”: 自动全量备份 - “incremental”: 自动增量备份
+ Type OffSiteBackupForListType `json:"type"`
+
+ // 备份大小,单位为KB。
+ Size int64 `json:"size"`
+
+ Datastore *ParaGroupDatastore `json:"datastore"`
+
+ // 是否已被DDM实例关联。
+ AssociatedWithDdm *bool `json:"associated_with_ddm,omitempty"`
+}
+
+func (o OffSiteBackupForList) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "OffSiteBackupForList struct{}"
+ }
+
+ return strings.Join([]string{"OffSiteBackupForList", string(data)}, " ")
+}
+
+type OffSiteBackupForListStatus struct {
+ value string
+}
+
+type OffSiteBackupForListStatusEnum struct {
+ BUILDING OffSiteBackupForListStatus
+ COMPLETED OffSiteBackupForListStatus
+ FAILED OffSiteBackupForListStatus
+ DELETING OffSiteBackupForListStatus
+}
+
+func GetOffSiteBackupForListStatusEnum() OffSiteBackupForListStatusEnum {
+ return OffSiteBackupForListStatusEnum{
+ BUILDING: OffSiteBackupForListStatus{
+ value: "BUILDING",
+ },
+ COMPLETED: OffSiteBackupForListStatus{
+ value: "COMPLETED",
+ },
+ FAILED: OffSiteBackupForListStatus{
+ value: "FAILED",
+ },
+ DELETING: OffSiteBackupForListStatus{
+ value: "DELETING",
+ },
+ }
+}
+
+func (c OffSiteBackupForListStatus) Value() string {
+ return c.value
+}
+
+func (c OffSiteBackupForListStatus) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *OffSiteBackupForListStatus) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
+
+type OffSiteBackupForListType struct {
+ value string
+}
+
+type OffSiteBackupForListTypeEnum struct {
+ AUTO OffSiteBackupForListType
+ INCREMENTAL OffSiteBackupForListType
+}
+
+func GetOffSiteBackupForListTypeEnum() OffSiteBackupForListTypeEnum {
+ return OffSiteBackupForListTypeEnum{
+ AUTO: OffSiteBackupForListType{
+ value: "auto",
+ },
+ INCREMENTAL: OffSiteBackupForListType{
+ value: "incremental",
+ },
+ }
+}
+
+func (c OffSiteBackupForListType) Value() string {
+ return c.value
+}
+
+func (c OffSiteBackupForListType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *OffSiteBackupForListType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_off_site_backup_policy.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_off_site_backup_policy.go
new file mode 100644
index 0000000000..489f6d0001
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_off_site_backup_policy.go
@@ -0,0 +1,32 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// OffSiteBackupPolicy 备份策略对象,包括备份类型、备份保留天数、目标区域ID和目标project ID。
+type OffSiteBackupPolicy struct {
+
+ // 指定备份的类型。 SQL Server仅支持设置为“all”。 取值如下: - auto:自动全量备份。 - incremental:自动增量备份。 - all:同时设置所有备份类型。 - MySQL:同时设置自动全量和自动增量备份。 - SQL Server:同时设置自动全量、自动增量备份和手动备份。
+ BackupType string `json:"backup_type"`
+
+ // 备份文件可以保存的天数。
+ KeepDays int32 `json:"keep_days"`
+
+ // 设置跨区域备份策略的目标区域ID。
+ DestinationRegion string `json:"destination_region"`
+
+ // 设置跨区域备份策略的目标project ID。
+ DestinationProjectId string `json:"destination_project_id"`
+}
+
+func (o OffSiteBackupPolicy) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "OffSiteBackupPolicy struct{}"
+ }
+
+ return strings.Join([]string{"OffSiteBackupPolicy", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_offsite_backup_instance.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_offsite_backup_instance.go
new file mode 100644
index 0000000000..a45cc58816
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_offsite_backup_instance.go
@@ -0,0 +1,43 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// OffsiteBackupInstance 跨区域备份实例信息。
+type OffsiteBackupInstance struct {
+
+ // 实例ID。
+ Id string `json:"id"`
+
+ // 创建的实例名称。
+ Name *string `json:"name,omitempty"`
+
+ // 源区域。
+ SourceRegion *string `json:"source_region,omitempty"`
+
+ // 租户在源区域下的project ID。
+ SourceProjectId *string `json:"source_project_id,omitempty"`
+
+ Datastore *ParaGroupDatastore `json:"datastore,omitempty"`
+
+ // 跨区域备份所在区域。
+ DestinationRegion *string `json:"destination_region,omitempty"`
+
+ // 租户在目标区域下的project ID。
+ DestinationProjectId *string `json:"destination_project_id,omitempty"`
+
+ // 跨区域备份保留天数。
+ KeepDays *int64 `json:"keep_days,omitempty"`
+}
+
+func (o OffsiteBackupInstance) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "OffsiteBackupInstance struct{}"
+ }
+
+ return strings.Join([]string{"OffsiteBackupInstance", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_open_proxy_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_open_proxy_request.go
new file mode 100644
index 0000000000..b4eb49c7e1
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_open_proxy_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type OpenProxyRequest struct {
+
+ // 规格ID。
+ FlavorId *string `json:"flavor_id,omitempty"`
+
+ // 节点数量。
+ NodeNum *int32 `json:"node_num,omitempty"`
+}
+
+func (o OpenProxyRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "OpenProxyRequest struct{}"
+ }
+
+ return strings.Join([]string{"OpenProxyRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_ops_window_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_ops_window_request.go
new file mode 100644
index 0000000000..ae5ad94eba
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_ops_window_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type OpsWindowRequest struct {
+
+ // - 开始时间, UTC时间
+ StartTime string `json:"start_time"`
+
+ // - 结束时间,UTC时间
+ EndTime string `json:"end_time"`
+}
+
+func (o OpsWindowRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "OpsWindowRequest struct{}"
+ }
+
+ return strings.Join([]string{"OpsWindowRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_para_group_datastore.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_para_group_datastore.go
new file mode 100644
index 0000000000..b92b64e248
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_para_group_datastore.go
@@ -0,0 +1,83 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+type ParaGroupDatastore struct {
+
+ // 数据库引擎,不区分大小写: - MySQL - PostgreSQL - SQLServer - MariaDB
+ Type ParaGroupDatastoreType `json:"type"`
+
+ // 数据库版本。 - MySQL引擎支持5.6、5.7、8.0版本。取值示例:5.7。具有相应权限的用户才可使用8.0,您可联系华为云客服人员申请。 - PostgreSQL引擎支持9.5、9.6、10、11版本。取值示例:9.6。 - Microsoft SQL Server:仅支持2017 企业版、2017 标准版、2017 web版、2014 标准版、2014 企业版、2016 标准版、2016 企业版、2012 企业版、2012 标准版、2012 web版、2008 R2 企业版、2008 R2 web版、2014 web版、2016 web版。取值示例2014_SE。 例如:2017标准版可填写2017_SE,2017企业版可填写2017_EE,2017web版可以填写2017_WEB
+ Version string `json:"version"`
+}
+
+func (o ParaGroupDatastore) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ParaGroupDatastore struct{}"
+ }
+
+ return strings.Join([]string{"ParaGroupDatastore", string(data)}, " ")
+}
+
+type ParaGroupDatastoreType struct {
+ value string
+}
+
+type ParaGroupDatastoreTypeEnum struct {
+ MY_SQL ParaGroupDatastoreType
+ POSTGRE_SQL ParaGroupDatastoreType
+ SQL_SERVER ParaGroupDatastoreType
+ MARIA_DB ParaGroupDatastoreType
+}
+
+func GetParaGroupDatastoreTypeEnum() ParaGroupDatastoreTypeEnum {
+ return ParaGroupDatastoreTypeEnum{
+ MY_SQL: ParaGroupDatastoreType{
+ value: "MySQL",
+ },
+ POSTGRE_SQL: ParaGroupDatastoreType{
+ value: "PostgreSQL",
+ },
+ SQL_SERVER: ParaGroupDatastoreType{
+ value: "SQLServer",
+ },
+ MARIA_DB: ParaGroupDatastoreType{
+ value: "MariaDB",
+ },
+ }
+}
+
+func (c ParaGroupDatastoreType) Value() string {
+ return c.value
+}
+
+func (c ParaGroupDatastoreType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ParaGroupDatastoreType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_param_group_history_result.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_param_group_history_result.go
new file mode 100644
index 0000000000..e7b57942d1
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_param_group_history_result.go
@@ -0,0 +1,40 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ParamGroupHistoryResult struct {
+
+ // 参数名称
+ ParameterName *string `json:"parameter_name,omitempty"`
+
+ // 旧值
+ OldValue *string `json:"old_value,omitempty"`
+
+ // 新值
+ NewValue *string `json:"new_value,omitempty"`
+
+ // 更新结果 成功:SUCCESS 失败: FAILED
+ UpdateResult *string `json:"update_result,omitempty"`
+
+ // 是否已应用 true:已应用 false:未应用
+ Applied *bool `json:"applied,omitempty"`
+
+ // 修改时间
+ UpdateTime *string `json:"update_time,omitempty"`
+
+ // 应用时间
+ ApplyTime *string `json:"apply_time,omitempty"`
+}
+
+func (o ParamGroupHistoryResult) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ParamGroupHistoryResult struct{}"
+ }
+
+ return strings.Join([]string{"ParamGroupHistoryResult", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_database.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_database.go
new file mode 100644
index 0000000000..6babf4cda7
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_database.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgreSqlHistoryDatabase PostgreSQL查询可恢复表的数据库信息
+type PostgreSqlHistoryDatabase struct {
+
+ // 数据库名
+ Name *string `json:"name,omitempty"`
+
+ // 可恢复表的数量
+ TotalTables *int32 `json:"total_tables,omitempty"`
+
+ // 模式信息
+ Schemas *[]PostgreSqlHistorySchema `json:"schemas,omitempty"`
+}
+
+func (o PostgreSqlHistoryDatabase) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgreSqlHistoryDatabase struct{}"
+ }
+
+ return strings.Join([]string{"PostgreSqlHistoryDatabase", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_database_info.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_database_info.go
new file mode 100644
index 0000000000..016953b3ff
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_database_info.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgreSqlHistoryDatabaseInfo PostgreSQL查询可恢复库的数据库库信息
+type PostgreSqlHistoryDatabaseInfo struct {
+
+ // 数据库名
+ Name *string `json:"name,omitempty"`
+
+ // 表的个数
+ TotalTables *int32 `json:"total_tables,omitempty"`
+}
+
+func (o PostgreSqlHistoryDatabaseInfo) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgreSqlHistoryDatabaseInfo struct{}"
+ }
+
+ return strings.Join([]string{"PostgreSqlHistoryDatabaseInfo", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_database_instance.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_database_instance.go
new file mode 100644
index 0000000000..7bb66689e3
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_database_instance.go
@@ -0,0 +1,32 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgreSqlHistoryDatabaseInstance PostgreSQL查询可恢复库的实例信息
+type PostgreSqlHistoryDatabaseInstance struct {
+
+ // 实例ID
+ Id *string `json:"id,omitempty"`
+
+ // 实例名称
+ Name *string `json:"name,omitempty"`
+
+ // 表的个数
+ TotalTables *int32 `json:"total_tables,omitempty"`
+
+ // 数据库信息
+ Databases *[]PostgreSqlHistoryDatabaseInfo `json:"databases,omitempty"`
+}
+
+func (o PostgreSqlHistoryDatabaseInstance) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgreSqlHistoryDatabaseInstance struct{}"
+ }
+
+ return strings.Join([]string{"PostgreSqlHistoryDatabaseInstance", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_database_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_database_request.go
new file mode 100644
index 0000000000..7c13e5adee
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_database_request.go
@@ -0,0 +1,32 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgreSqlHistoryDatabaseRequest 查询可恢复库的请求信息
+type PostgreSqlHistoryDatabaseRequest struct {
+
+ // 实例ID集合
+ InstanceIds []string `json:"instance_ids"`
+
+ // 恢复时间点
+ RestoreTime int64 `json:"restore_time"`
+
+ // 数据库名,模糊查询
+ DatabaseNameLike *string `json:"database_name_like,omitempty"`
+
+ // 实例名称,模糊查询
+ InstanceNameLike *string `json:"instance_name_like,omitempty"`
+}
+
+func (o PostgreSqlHistoryDatabaseRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgreSqlHistoryDatabaseRequest struct{}"
+ }
+
+ return strings.Join([]string{"PostgreSqlHistoryDatabaseRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_schema.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_schema.go
new file mode 100644
index 0000000000..5310ce9101
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_schema.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgreSqlHistorySchema PostgreSQL查询可恢复表的模式信息
+type PostgreSqlHistorySchema struct {
+
+ // 模式名
+ Name *string `json:"name,omitempty"`
+
+ // 可恢复表的数量
+ TotalTables *int32 `json:"total_tables,omitempty"`
+
+ // 表信息
+ Tables *[]PostgreSqlHistoryTable `json:"tables,omitempty"`
+}
+
+func (o PostgreSqlHistorySchema) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgreSqlHistorySchema struct{}"
+ }
+
+ return strings.Join([]string{"PostgreSqlHistorySchema", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_table.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_table.go
new file mode 100644
index 0000000000..57d42c0592
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_table.go
@@ -0,0 +1,23 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgreSqlHistoryTable PostgreSQL查询可恢复表的表信息
+type PostgreSqlHistoryTable struct {
+
+ // 表名
+ Name *string `json:"name,omitempty"`
+}
+
+func (o PostgreSqlHistoryTable) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgreSqlHistoryTable struct{}"
+ }
+
+ return strings.Join([]string{"PostgreSqlHistoryTable", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_table_instance.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_table_instance.go
new file mode 100644
index 0000000000..553d4b16fa
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_table_instance.go
@@ -0,0 +1,32 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgreSqlHistoryTableInstance PostgreSQL查询可恢复表的实例信息
+type PostgreSqlHistoryTableInstance struct {
+
+ // 实例ID
+ Id *string `json:"id,omitempty"`
+
+ // 实例名称
+ Name *string `json:"name,omitempty"`
+
+ // 可恢复表的数量
+ TotalTables *int32 `json:"total_tables,omitempty"`
+
+ // 数据库信息
+ Databases *[]PostgreSqlHistoryDatabase `json:"databases,omitempty"`
+}
+
+func (o PostgreSqlHistoryTableInstance) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgreSqlHistoryTableInstance struct{}"
+ }
+
+ return strings.Join([]string{"PostgreSqlHistoryTableInstance", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_table_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_table_request.go
new file mode 100644
index 0000000000..e817cfde09
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_history_table_request.go
@@ -0,0 +1,35 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgreSqlHistoryTableRequest 查询可恢复表的请求信息
+type PostgreSqlHistoryTableRequest struct {
+
+ // 实例ID集合
+ InstanceIds []string `json:"instance_ids"`
+
+ // 恢复时间点
+ RestoreTime int64 `json:"restore_time"`
+
+ // 数据库名,模糊查询
+ DatabaseNameLike *string `json:"database_name_like,omitempty"`
+
+ // 数据库表名,模糊查询
+ TableNameLike *string `json:"table_name_like,omitempty"`
+
+ // 实例名称,模糊查询
+ InstanceNameLike *string `json:"instance_name_like,omitempty"`
+}
+
+func (o PostgreSqlHistoryTableRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgreSqlHistoryTableRequest struct{}"
+ }
+
+ return strings.Join([]string{"PostgreSqlHistoryTableRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_database.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_database.go
new file mode 100644
index 0000000000..d77f1183d3
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_database.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgreSqlRestoreDatabase 恢复库信息
+type PostgreSqlRestoreDatabase struct {
+
+ // 数据库名
+ Database *string `json:"database,omitempty"`
+
+ // 模式信息
+ Schemas *[]PostgreSqlRestoreSchema `json:"schemas,omitempty"`
+}
+
+func (o PostgreSqlRestoreDatabase) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgreSqlRestoreDatabase struct{}"
+ }
+
+ return strings.Join([]string{"PostgreSqlRestoreDatabase", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_database_info.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_database_info.go
new file mode 100644
index 0000000000..80248f44b2
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_database_info.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgreSqlRestoreDatabaseInfo 库级恢复数据库信息
+type PostgreSqlRestoreDatabaseInfo struct {
+
+ // 恢复前库名
+ OldName *string `json:"old_name,omitempty"`
+
+ // 恢复后库名
+ NewName *string `json:"new_name,omitempty"`
+}
+
+func (o PostgreSqlRestoreDatabaseInfo) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgreSqlRestoreDatabaseInfo struct{}"
+ }
+
+ return strings.Join([]string{"PostgreSqlRestoreDatabaseInfo", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_database_instance.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_database_instance.go
new file mode 100644
index 0000000000..0bcee1af72
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_database_instance.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgreSqlRestoreDatabaseInstance 查询可恢复库的响应信息
+type PostgreSqlRestoreDatabaseInstance struct {
+
+ // 恢复时间
+ RestoreTime *int64 `json:"restore_time,omitempty"`
+
+ // 实例ID
+ InstanceId *string `json:"instance_id,omitempty"`
+
+ // 库信息
+ Databases *[]PostgreSqlRestoreDatabaseInfo `json:"databases,omitempty"`
+}
+
+func (o PostgreSqlRestoreDatabaseInstance) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgreSqlRestoreDatabaseInstance struct{}"
+ }
+
+ return strings.Join([]string{"PostgreSqlRestoreDatabaseInstance", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_database_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_database_request.go
new file mode 100644
index 0000000000..e58d48d1a8
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_database_request.go
@@ -0,0 +1,23 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgreSqlRestoreDatabaseRequest 库级恢复请求信息
+type PostgreSqlRestoreDatabaseRequest struct {
+
+ // 库级恢复实例信息
+ Instances *[]PostgreSqlRestoreDatabaseInstance `json:"instances,omitempty"`
+}
+
+func (o PostgreSqlRestoreDatabaseRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgreSqlRestoreDatabaseRequest struct{}"
+ }
+
+ return strings.Join([]string{"PostgreSqlRestoreDatabaseRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_result.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_result.go
new file mode 100644
index 0000000000..692c24ea78
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_result.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgreSqlRestoreResult 表级时间点恢复的请求信息
+type PostgreSqlRestoreResult struct {
+
+ // 实例ID
+ InstanceId *string `json:"instance_id,omitempty"`
+
+ // 工作流id
+ JobId *string `json:"job_id,omitempty"`
+}
+
+func (o PostgreSqlRestoreResult) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgreSqlRestoreResult struct{}"
+ }
+
+ return strings.Join([]string{"PostgreSqlRestoreResult", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_schema.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_schema.go
new file mode 100644
index 0000000000..6638d5ca8d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_schema.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgreSqlRestoreSchema 恢复模式信息
+type PostgreSqlRestoreSchema struct {
+
+ // 模式信息
+ Schema *string `json:"schema,omitempty"`
+
+ // 表信息
+ Tables *[]PostgreSqlRestoreTable `json:"tables,omitempty"`
+}
+
+func (o PostgreSqlRestoreSchema) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgreSqlRestoreSchema struct{}"
+ }
+
+ return strings.Join([]string{"PostgreSqlRestoreSchema", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_table.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_table.go
new file mode 100644
index 0000000000..4dbe2cbe36
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_table.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgreSqlRestoreTable 恢复表信息
+type PostgreSqlRestoreTable struct {
+
+ // 恢复前表名
+ OldName *string `json:"old_name,omitempty"`
+
+ // 恢复后表名
+ NewName *string `json:"new_name,omitempty"`
+}
+
+func (o PostgreSqlRestoreTable) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgreSqlRestoreTable struct{}"
+ }
+
+ return strings.Join([]string{"PostgreSqlRestoreTable", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_table_instance.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_table_instance.go
new file mode 100644
index 0000000000..e38c07f6d5
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_table_instance.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgreSqlRestoreTableInstance 表级恢复实例信息
+type PostgreSqlRestoreTableInstance struct {
+
+ // 恢复时间
+ RestoreTime *int64 `json:"restore_time,omitempty"`
+
+ // 实例ID
+ InstanceId *string `json:"instance_id,omitempty"`
+
+ // 数据库信息
+ Databases *[]PostgreSqlRestoreDatabase `json:"databases,omitempty"`
+}
+
+func (o PostgreSqlRestoreTableInstance) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgreSqlRestoreTableInstance struct{}"
+ }
+
+ return strings.Join([]string{"PostgreSqlRestoreTableInstance", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_table_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_table_request.go
new file mode 100644
index 0000000000..baad717668
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgre_sql_restore_table_request.go
@@ -0,0 +1,23 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgreSqlRestoreTableRequest 表级时间点恢复的请求信息
+type PostgreSqlRestoreTableRequest struct {
+
+ // 表信息
+ Instances *[]PostgreSqlRestoreTableInstance `json:"instances,omitempty"`
+}
+
+func (o PostgreSqlRestoreTableRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgreSqlRestoreTableRequest struct{}"
+ }
+
+ return strings.Join([]string{"PostgreSqlRestoreTableRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_create_schema_req.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_create_schema_req.go
new file mode 100644
index 0000000000..d6d07524a8
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_create_schema_req.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type PostgresqlCreateSchemaReq struct {
+
+ // schema名称。 schema名称在1到63个字符之间,由字母、数字、或下划线组成,不能包含其他特殊字符,不能以“pg”和数字开头,且不能和RDS for PostgreSQL模板库和已存在的schema重名。 RDS for PostgreSQL模板库包括postgres, template0 ,template1。 已存在的schema包括public,information_schema。
+ SchemaName string `json:"schema_name"`
+
+ // 数据库属主用户。 数据库属主名称在1到63个字符之间,不能以“pg”和数字开头,不能和系统用户名称相同。 系统用户包括“rdsAdmin”,“ rdsMetric”, “rdsBackup”, “rdsRepl”,“ rdsProxy”, “rdsDdm”。
+ Owner string `json:"owner"`
+}
+
+func (o PostgresqlCreateSchemaReq) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgresqlCreateSchemaReq struct{}"
+ }
+
+ return strings.Join([]string{"PostgresqlCreateSchemaReq", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_database_for_creation.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_database_for_creation.go
new file mode 100644
index 0000000000..7a7b95188f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_database_for_creation.go
@@ -0,0 +1,44 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgresqlDatabaseForCreation 数据库信息。
+type PostgresqlDatabaseForCreation struct {
+
+ // 数据库名称。 数据库名称长度可在1~63个字符之间,由字母、数字、或下划线组成,不能包含其他特殊字符,不能以“pg”和数字开头,且不能和RDS for PostgreSQL模板库重名。 RDS for PostgreSQL模板库包括postgres, template0 ,template1。
+ Name string `json:"name"`
+
+ // 数据库字符集。默认UTF8。
+ CharacterSet *string `json:"character_set,omitempty"`
+
+ // 数据库所属用户,缺省时默认是root,不能和系统用户重名,且必须是已存在的用户。 系统用户包括“rdsAdmin”,“ rdsMetric”, “rdsBackup”, “rdsRepl”,“ rdsProxy”, “rdsDdm”。
+ Owner *string `json:"owner,omitempty"`
+
+ // 数据库模板名称,可选值template0,template1。默认template1。
+ Template *string `json:"template,omitempty"`
+
+ // 数据库排序集。默认en_US.UTF-8。 - 须知: 不同的排序规则下,相同字符串的比较其结果可能是不同的。 例如,在en_US.utf8下, select 'a'>'A';执行结果为false,但在'C'下,select 'a'>'A';结果为true。如果数据库从“O”迁移到PostgreSQL,数据库排序集需使用'C'才能得到一致的预期。支持的排序规则可以查询系统表 pg_collation。
+ LcCollate *string `json:"lc_collate,omitempty"`
+
+ // 数据库分类集。默认en_US.UTF-8。
+ LcCtype *string `json:"lc_ctype,omitempty"`
+
+ // 是否回收public schema的PUBLIC CREATE权限。 true,表示回收该权限。 false,表示不回收该权限。 缺省时默认是false。
+ IsRevokePublicPrivilege *bool `json:"is_revoke_public_privilege,omitempty"`
+
+ // 数据库备注。 取值范围:长度1~512个字符。
+ Comment *string `json:"comment,omitempty"`
+}
+
+func (o PostgresqlDatabaseForCreation) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgresqlDatabaseForCreation struct{}"
+ }
+
+ return strings.Join([]string{"PostgresqlDatabaseForCreation", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_database_for_list_schema.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_database_for_list_schema.go
new file mode 100644
index 0000000000..71bb7dc71b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_database_for_list_schema.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgresqlDatabaseForListSchema 数据库schema信息。
+type PostgresqlDatabaseForListSchema struct {
+
+ // schema名称。
+ SchemaName string `json:"schema_name"`
+
+ // schema所属用户。
+ Owner string `json:"owner"`
+}
+
+func (o PostgresqlDatabaseForListSchema) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgresqlDatabaseForListSchema struct{}"
+ }
+
+ return strings.Join([]string{"PostgresqlDatabaseForListSchema", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_database_schema_req.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_database_schema_req.go
new file mode 100644
index 0000000000..35a2aca696
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_database_schema_req.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgresqlDatabaseSchemaReq 创建数据库schema信息。
+type PostgresqlDatabaseSchemaReq struct {
+
+ // 数据库名称。 数据库名称在1到63个字符之间,由字母、数字、或下划线组成,不能包含其他特殊字符,不能以“pg”和数字开头,且不能和RDS for PostgreSQL模板库重名。 RDS for PostgreSQL模板库包括postgres, template0 ,template1。
+ DbName string `json:"db_name"`
+
+ // 每个元素都是与数据库相关联的schmea信息。单次请求最多支持20个元素。
+ Schemas []PostgresqlCreateSchemaReq `json:"schemas"`
+}
+
+func (o PostgresqlDatabaseSchemaReq) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgresqlDatabaseSchemaReq struct{}"
+ }
+
+ return strings.Join([]string{"PostgresqlDatabaseSchemaReq", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_grant_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_grant_request.go
new file mode 100644
index 0000000000..2c068d2d52
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_grant_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type PostgresqlGrantRequest struct {
+
+ // 数据库名称。 数据库名称在1到63个字符之间,由字母、数字、或下划线组成,不能包含其他特殊字符,不能以“pg”和数字开头,且不能和RDS for PostgreSQL模板库重名。 RDS for PostgreSQL模板库包括postgres, template0 ,template1。
+ DbName string `json:"db_name"`
+
+ // 每个元素都是与数据库相关联的帐号。单次请求最多支持50个元素。
+ Users []PostgresqlUserWithPrivilege `json:"users"`
+}
+
+func (o PostgresqlGrantRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgresqlGrantRequest struct{}"
+ }
+
+ return strings.Join([]string{"PostgresqlGrantRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_hba_conf.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_hba_conf.go
new file mode 100644
index 0000000000..808b7b870d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_hba_conf.go
@@ -0,0 +1,40 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type PostgresqlHbaConf struct {
+
+ // 连接类型,枚举,host、hostssl、hostnossl
+ Type string `json:"type"`
+
+ // 数据库名,除template0,template1的数据库名,多个以逗号隔开
+ Database string `json:"database"`
+
+ // 用户名,all,除内置用户(rdsAdmin, rdsMetric, rdsBackup, rdsRepl, rdsProxy)以外,多个以逗号隔开
+ User string `json:"user"`
+
+ // 客户端IP地址。0.0.0.0/0表示允许用户从任意IP地址访问数据库
+ Address string `json:"address"`
+
+ // 掩码,默认为空字符串
+ Mask *string `json:"mask,omitempty"`
+
+ // 认证方式。枚举:reject、md5、scram-sha-256
+ Method string `json:"method"`
+
+ // 优先级,表示配置的先后
+ Priority int32 `json:"priority"`
+}
+
+func (o PostgresqlHbaConf) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgresqlHbaConf struct{}"
+ }
+
+ return strings.Join([]string{"PostgresqlHbaConf", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_hba_history.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_hba_history.go
new file mode 100644
index 0000000000..792e84e333
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_hba_history.go
@@ -0,0 +1,35 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/sdktime"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type PostgresqlHbaHistory struct {
+
+ // 修改结果, success:已生效 failed:未生效 setting:设置中\",
+ Status *string `json:"status,omitempty"`
+
+ // 修改时间
+ Time *sdktime.SdkTime `json:"time,omitempty"`
+
+ // 修改失败原因
+ FailReason *string `json:"fail_reason,omitempty"`
+
+ // 修改之前的值
+ BeforeConfs *[]PostgresqlHbaConf `json:"before_confs,omitempty"`
+
+ // 修改之后的值
+ AfterConfs *[]PostgresqlHbaConf `json:"after_confs,omitempty"`
+}
+
+func (o PostgresqlHbaHistory) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgresqlHbaHistory struct{}"
+ }
+
+ return strings.Join([]string{"PostgresqlHbaHistory", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_list_database.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_list_database.go
new file mode 100644
index 0000000000..419236ed72
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_list_database.go
@@ -0,0 +1,38 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgresqlListDatabase 数据库信息。
+type PostgresqlListDatabase struct {
+
+ // 数据库名称。
+ Name *string `json:"name,omitempty"`
+
+ // 数据库所属用户。
+ Owner *string `json:"owner,omitempty"`
+
+ // 数据库使用的字符集,例如UTF8。
+ CharacterSet *string `json:"character_set,omitempty"`
+
+ // 数据库排序集,例如en_US.UTF-8等。
+ CollateSet *string `json:"collate_set,omitempty"`
+
+ // 数据库大小(单位:字节)。
+ Size *int64 `json:"size,omitempty"`
+
+ // 数据库备注
+ Comment *string `json:"comment,omitempty"`
+}
+
+func (o PostgresqlListDatabase) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgresqlListDatabase struct{}"
+ }
+
+ return strings.Join([]string{"PostgresqlListDatabase", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_pre_check_upgrade_major_version_req.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_pre_check_upgrade_major_version_req.go
new file mode 100644
index 0000000000..b60c695b0a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_pre_check_upgrade_major_version_req.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type PostgresqlPreCheckUpgradeMajorVersionReq struct {
+
+ // 目标版本。
+ TargetVersion string `json:"target_version"`
+}
+
+func (o PostgresqlPreCheckUpgradeMajorVersionReq) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgresqlPreCheckUpgradeMajorVersionReq struct{}"
+ }
+
+ return strings.Join([]string{"PostgresqlPreCheckUpgradeMajorVersionReq", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_user_for_creation.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_user_for_creation.go
new file mode 100644
index 0000000000..4e5b2b30fc
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_user_for_creation.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type PostgresqlUserForCreation struct {
+
+ // 数据库用户名称。 数据库用户名称在1到63个字符之间,由字母、数字、或下划线组成,不能包含其他特殊字符,不能以“pg”和数字开头,不能和系统用户名称相同。 系统用户包括“rdsAdmin”,“ rdsMetric”, “rdsBackup”, “rdsRepl”,“ rdsProxy”, “rdsDdm”。
+ Name string `json:"name"`
+
+ // 数据库用户密码。 取值范围:非空,密码长度在8到32个字符之间,至少包含大写字母、小写字母、数字、特殊字符~!@#%^*-_=+?,三种字符的组合,不能和数据库帐号“name”或“name”的逆序相同。 建议您输入高强度密码,以提高安全性,防止出现密码被暴力破解等安全风险。
+ Password string `json:"password"`
+
+ // 数据库用户备注。 取值范围:长度1~512个字符。
+ Comment *string `json:"comment,omitempty"`
+}
+
+func (o PostgresqlUserForCreation) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgresqlUserForCreation struct{}"
+ }
+
+ return strings.Join([]string{"PostgresqlUserForCreation", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_user_for_list.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_user_for_list.go
new file mode 100644
index 0000000000..e68d16f807
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_user_for_list.go
@@ -0,0 +1,32 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgresqlUserForList 数据库用户信息。
+type PostgresqlUserForList struct {
+
+ // 帐号名。
+ Name string `json:"name"`
+
+ // 用户的权限属性。
+ Attributes *interface{} `json:"attributes,omitempty"`
+
+ // 用户的默认权限。
+ Memberof *[]string `json:"memberof,omitempty"`
+
+ // 数据库用户备注。
+ Comment *string `json:"comment,omitempty"`
+}
+
+func (o PostgresqlUserForList) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgresqlUserForList struct{}"
+ }
+
+ return strings.Join([]string{"PostgresqlUserForList", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_user_with_privilege.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_user_with_privilege.go
new file mode 100644
index 0000000000..f56ae82f0c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_postgresql_user_with_privilege.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// PostgresqlUserWithPrivilege 用户及其权限。
+type PostgresqlUserWithPrivilege struct {
+
+ // 数据库帐号名称。 数据库帐号名称在1到63个字符之间,由字母、数字、或下划线组成,不能包含其他特殊字符,不能以“pg”和数字开头,不能和系统用户名称相同且帐号名称必须存在。 系统用户包括“rdsAdmin”,“ rdsMetric”, “rdsBackup”, “rdsRepl”,“ rdsProxy”, “rdsDdm”。
+ Name string `json:"name"`
+
+ // 数据库帐号权限。 - true:只读。 - false:可读可写。
+ Readonly bool `json:"readonly"`
+
+ // schema名称。 schema名称在1到63个字符之间,由字母、数字、或下划线组成,不能包含其他特殊字符,不能以“pg”和数字开头,不能和RDS for PostgreSQL模板库重名,且schema名称必须存在。 RDS for PostgreSQL模板库包括postgres, template0 ,template1。
+ SchemaName string `json:"schema_name"`
+}
+
+func (o PostgresqlUserWithPrivilege) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PostgresqlUserWithPrivilege struct{}"
+ }
+
+ return strings.Join([]string{"PostgresqlUserWithPrivilege", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_project_tag_info_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_project_tag_info_response.go
new file mode 100644
index 0000000000..94c515da9d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_project_tag_info_response.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ProjectTagInfoResponse 项目标签信息。
+type ProjectTagInfoResponse struct {
+
+ // 标签键。
+ Key string `json:"key"`
+
+ // 标签值列表。
+ Values []string `json:"values"`
+}
+
+func (o ProjectTagInfoResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ProjectTagInfoResponse struct{}"
+ }
+
+ return strings.Join([]string{"ProjectTagInfoResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_proxy.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_proxy.go
new file mode 100644
index 0000000000..1f7c48b460
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_proxy.go
@@ -0,0 +1,58 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type Proxy struct {
+
+ // Proxy实例ID。
+ PoolId string `json:"pool_id"`
+
+ // Proxy实例开启状态,取值范围如下。 - open:打开。 - closed:关闭。 - frozen:已冻结。 - opening:打开中。 - closing:关闭中。 - freezing:冻结中。 - unfreezing:解冻中。
+ Status string `json:"status"`
+
+ // Proxy读写分离地址。
+ Address string `json:"address"`
+
+ // elb模式的虚拟IP信息。
+ ElbVip string `json:"elb_vip"`
+
+ // 弹性公网IP信息。
+ Eip string `json:"eip"`
+
+ // Proxy端口信息。
+ Port int32 `json:"port"`
+
+ // Proxy实例状态。 - abnormal:异常。 - normal:正常。 - creating:创建中。 - deleted:已删除。
+ PoolStatus string `json:"pool_status"`
+
+ // 延时阈值(单位:KB)。
+ DelayThresholdInKilobytes int32 `json:"delay_threshold_in_kilobytes"`
+
+ // Proxy实例规格的CPU数量。
+ Cpu string `json:"cpu"`
+
+ // Proxy实例规格的内存数量。
+ Mem string `json:"mem"`
+
+ // Proxy节点个数。
+ NodeNum int32 `json:"node_num"`
+
+ // Proxy节点信息。
+ Nodes []ProxyNode `json:"nodes"`
+
+ // Proxy主备模式,取值范围:Ha。
+ Mode string `json:"mode"`
+}
+
+func (o Proxy) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "Proxy struct{}"
+ }
+
+ return strings.Join([]string{"Proxy", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_proxy_node.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_proxy_node.go
new file mode 100644
index 0000000000..f468c7e03d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_proxy_node.go
@@ -0,0 +1,37 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ProxyNode struct {
+
+ // Proxy节点ID。
+ Id string `json:"id"`
+
+ // Proxy节点名称。
+ Name string `json:"name"`
+
+ // Proxy节点角色。 - master:主节点。 - slave:备节点。
+ Role string `json:"role"`
+
+ // 可用区。
+ AzCode string `json:"az_code"`
+
+ // Proxy节点状态。 - normal:正常。 - abnormal:异常。 - creating:创建中。 - deleted:已删除。
+ Status string `json:"status"`
+
+ // Proxy节点是否被冻结。 - 0:未冻结。 - 1:冻结。 - 2:冻结删除。
+ FrozenFlag int32 `json:"frozen_flag"`
+}
+
+func (o ProxyNode) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ProxyNode struct{}"
+ }
+
+ return strings.Join([]string{"ProxyNode", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_proxy_readonly_instances.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_proxy_readonly_instances.go
new file mode 100644
index 0000000000..e549f0d30e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_proxy_readonly_instances.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ProxyReadonlyInstances struct {
+
+ // 只读实例ID。
+ Id string `json:"id"`
+
+ // 只读实例权重,取值范围为0~1000。
+ Weight int32 `json:"weight"`
+}
+
+func (o ProxyReadonlyInstances) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ProxyReadonlyInstances struct{}"
+ }
+
+ return strings.Join([]string{"ProxyReadonlyInstances", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_pwd_reset_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_pwd_reset_request.go
new file mode 100644
index 0000000000..9875a97870
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_pwd_reset_request.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type PwdResetRequest struct {
+
+ // 数据库密码
+ DbUserPwd string `json:"db_user_pwd"`
+}
+
+func (o PwdResetRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "PwdResetRequest struct{}"
+ }
+
+ return strings.Join([]string{"PwdResetRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_quotas.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_quotas.go
new file mode 100644
index 0000000000..7d40555246
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_quotas.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type Quotas struct {
+
+ // 资源列表对象。
+ Resources *[]Resources `json:"resources,omitempty"`
+}
+
+func (o Quotas) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "Quotas struct{}"
+ }
+
+ return strings.Join([]string{"Quotas", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_readonly_instances.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_readonly_instances.go
new file mode 100644
index 0000000000..307a78ccaa
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_readonly_instances.go
@@ -0,0 +1,37 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ReadonlyInstances struct {
+
+ // 只读实例ID。
+ Id string `json:"id"`
+
+ // 只读实例状态。
+ Status string `json:"status"`
+
+ // 只读实例名称。
+ Name string `json:"name"`
+
+ // 只读实例读写分离权重。
+ Weight int32 `json:"weight"`
+
+ // 可用区信息。
+ AvailableZones []AvailableZone `json:"available_zones"`
+
+ // 只读实例CPU个数。
+ CpuNum int32 `json:"cpu_num"`
+}
+
+func (o ReadonlyInstances) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ReadonlyInstances struct{}"
+ }
+
+ return strings.Join([]string{"ReadonlyInstances", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_recycle_instsance_v3.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_recycle_instsance_v3.go
new file mode 100644
index 0000000000..b8151c7b58
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_recycle_instsance_v3.go
@@ -0,0 +1,67 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type RecycleInstsanceV3 struct {
+
+ // 实例id
+ Id *string `json:"id,omitempty"`
+
+ // 实例名
+ Name *string `json:"name,omitempty"`
+
+ // 实例主备模式,取值:Ha(主备),不区分大小写。
+ HaMode *string `json:"ha_mode,omitempty"`
+
+ // 引擎名
+ EngineName *string `json:"engine_name,omitempty"`
+
+ // 数据库引擎版本
+ EngineVersion *string `json:"engine_version,omitempty"`
+
+ // 计费方式
+ PayModel *string `json:"pay_model,omitempty"`
+
+ // 创建时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如偏移1个小时显示为+0100。
+ CreatedAt *string `json:"created_at,omitempty"`
+
+ // 删除时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如偏移1个小时显示为+0100。
+ DeletedAt *string `json:"deleted_at,omitempty"`
+
+ // 磁盘类型。 取值范围如下,区分大小写: - COMMON,表示SATA。 - HIGH,表示SAS。 - ULTRAHIGH,表示SSD。 - ULTRAHIGHPRO,表示SSD尊享版,仅支持超高性能型尊享版(需申请权限)。 - CLOUDSSD,表示SSD云盘,仅支持通用型和独享型规格实例。 - LOCALSSD,表示本地SSD。
+ VolumeType *string `json:"volume_type,omitempty"`
+
+ // 磁盘大小,单位为GB。 取值范围:40GB~4000GB,必须为10的整数倍。 部分用户支持40GB~6000GB,如果您想创建存储空间最大为6000GB的数据库实例,或提高扩容上限到10000GB,请联系客服开通。 说明:对于只读实例,该参数无效,磁盘大小,默认和主实例相同。
+ VolumeSize *int32 `json:"volume_size,omitempty"`
+
+ // 内网地址
+ DataVip *string `json:"data_vip,omitempty"`
+
+ // ipv6内网地址
+ DataVipV6 *string `json:"data_vip_v6,omitempty"`
+
+ // 企业项目ID
+ EnterpriseProjectId *string `json:"enterprise_project_id,omitempty"`
+
+ // 保留时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如偏移1个小时显示为+0100。
+ RetainedUntil *string `json:"retained_until,omitempty"`
+
+ // 备份id
+ RecycleBackupId *string `json:"recycle_backup_id,omitempty"`
+
+ // 备份状态 取值范围如下,区分大小写: - BUILDING 备份中,不能进行重建 - COMPLETED,标识备份完成,可以重建
+ RecycleStatus *string `json:"recycle_status,omitempty"`
+}
+
+func (o RecycleInstsanceV3) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RecycleInstsanceV3 struct{}"
+ }
+
+ return strings.Join([]string{"RecycleInstsanceV3", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_recycle_policy.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_recycle_policy.go
new file mode 100644
index 0000000000..9849d043cb
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_recycle_policy.go
@@ -0,0 +1,23 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// RecyclePolicy 回收策略。
+type RecyclePolicy struct {
+
+ // 保留时间,设置已删除实例保留天数,支持整数,可设置范围为1~7天。 当“retention_period_in_days”为空,保留时间默认是7天。
+ RetentionPeriodInDays *string `json:"retention_period_in_days,omitempty"`
+}
+
+func (o RecyclePolicy) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RecyclePolicy struct{}"
+ }
+
+ return strings.Join([]string{"RecyclePolicy", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_recycle_policy_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_recycle_policy_request_body.go
new file mode 100644
index 0000000000..050b05a4f2
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_recycle_policy_request_body.go
@@ -0,0 +1,20 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type RecyclePolicyRequestBody struct {
+ RecyclePolicy *RecyclePolicy `json:"recycle_policy"`
+}
+
+func (o RecyclePolicyRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RecyclePolicyRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"RecyclePolicyRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_related_instance.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_related_instance.go
new file mode 100644
index 0000000000..0aec78f486
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_related_instance.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// RelatedInstance 所关联的数据库实例列表。
+type RelatedInstance struct {
+
+ // 关联实例id。
+ Id string `json:"id"`
+
+ // 关联实例类型。 - “replica_of”对应于“主实例”。 - “replica”对应于“只读实例”。
+ Type string `json:"type"`
+}
+
+func (o RelatedInstance) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RelatedInstance struct{}"
+ }
+
+ return strings.Join([]string{"RelatedInstance", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_reset_pwd_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_reset_pwd_request.go
new file mode 100644
index 0000000000..bda242278b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_reset_pwd_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ResetPwdRequest Request Object
+type ResetPwdRequest struct {
+
+ // 语言
+ XLanguage *ResetPwdRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *PwdResetRequest `json:"body,omitempty"`
+}
+
+func (o ResetPwdRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ResetPwdRequest struct{}"
+ }
+
+ return strings.Join([]string{"ResetPwdRequest", string(data)}, " ")
+}
+
+type ResetPwdRequestXLanguage struct {
+ value string
+}
+
+type ResetPwdRequestXLanguageEnum struct {
+ ZH_CN ResetPwdRequestXLanguage
+ EN_US ResetPwdRequestXLanguage
+}
+
+func GetResetPwdRequestXLanguageEnum() ResetPwdRequestXLanguageEnum {
+ return ResetPwdRequestXLanguageEnum{
+ ZH_CN: ResetPwdRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: ResetPwdRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c ResetPwdRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c ResetPwdRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ResetPwdRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_reset_pwd_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_reset_pwd_response.go
new file mode 100644
index 0000000000..e95baaf482
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_reset_pwd_response.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ResetPwdResponse Response Object
+type ResetPwdResponse struct {
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ResetPwdResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ResetPwdResponse struct{}"
+ }
+
+ return strings.Join([]string{"ResetPwdResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_resize_flavor_object.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_resize_flavor_object.go
new file mode 100644
index 0000000000..a4d0dafab0
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_resize_flavor_object.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ResizeFlavorObject struct {
+
+ // 资源规格编码。例如:rds.mysql.m1.xlarge。其中,rds代表RDS产品,mysql代表数据库引擎,m1.xlarge代表性能规格,为高内存类型。带\"rr\"的表示只读实例规格,反之表示单实例和HA实例规格。
+ SpecCode string `json:"spec_code"`
+
+ // 变更包周期实例的规格时可指定,表示是否自动从客户的账户中支付。 - true,为自动支付。 - false,为手动支付,默认该方式。
+ IsAutoPay *bool `json:"is_auto_pay,omitempty"`
+}
+
+func (o ResizeFlavorObject) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ResizeFlavorObject struct{}"
+ }
+
+ return strings.Join([]string{"ResizeFlavorObject", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_resize_flavor_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_resize_flavor_request.go
new file mode 100644
index 0000000000..6538772273
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_resize_flavor_request.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ResizeFlavorRequest 变更实例规格时必填。
+type ResizeFlavorRequest struct {
+ ResizeFlavor *ResizeFlavorObject `json:"resize_flavor"`
+}
+
+func (o ResizeFlavorRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ResizeFlavorRequest struct{}"
+ }
+
+ return strings.Join([]string{"ResizeFlavorRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_resource_tag.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_resource_tag.go
new file mode 100644
index 0000000000..255b87ba56
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_resource_tag.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ResourceTag struct {
+
+ // 标签键
+ Key string `json:"key"`
+
+ // 标签值
+ Value string `json:"value"`
+
+ // 标签类型
+ TagType string `json:"tag_type"`
+}
+
+func (o ResourceTag) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ResourceTag struct{}"
+ }
+
+ return strings.Join([]string{"ResourceTag", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_resources.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_resources.go
new file mode 100644
index 0000000000..db7b79c262
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_resources.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type Resources struct {
+
+ // 项目资源配额。
+ Quota *int32 `json:"quota,omitempty"`
+
+ // 已使用的资源数量。
+ Used *int32 `json:"used,omitempty"`
+
+ // 项目资源类型,取值范围:instance。
+ Type *string `json:"type,omitempty"`
+}
+
+func (o Resources) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "Resources struct{}"
+ }
+
+ return strings.Join([]string{"Resources", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_databases_info.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_databases_info.go
new file mode 100644
index 0000000000..f51ec25512
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_databases_info.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type RestoreDatabasesInfo struct {
+
+ // 库名
+ Database string `json:"database"`
+
+ // 表信息
+ Tables []RestoreTableInfo `json:"tables"`
+}
+
+func (o RestoreDatabasesInfo) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RestoreDatabasesInfo struct{}"
+ }
+
+ return strings.Join([]string{"RestoreDatabasesInfo", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_databases_info_new.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_databases_info_new.go
new file mode 100644
index 0000000000..3ae7fc7413
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_databases_info_new.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type RestoreDatabasesInfoNew struct {
+
+ // 库名
+ Database string `json:"database"`
+
+ // 表信息
+ Tables []RestoreTableInfoNew `json:"tables"`
+}
+
+func (o RestoreDatabasesInfoNew) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RestoreDatabasesInfoNew struct{}"
+ }
+
+ return strings.Join([]string{"RestoreDatabasesInfoNew", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_exist_instance_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_exist_instance_request.go
new file mode 100644
index 0000000000..34e3e5ff61
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_exist_instance_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// RestoreExistInstanceRequest Request Object
+type RestoreExistInstanceRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ Body *RestoreExistingInstanceRequestBody `json:"body,omitempty"`
+}
+
+func (o RestoreExistInstanceRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RestoreExistInstanceRequest struct{}"
+ }
+
+ return strings.Join([]string{"RestoreExistInstanceRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_exist_instance_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_exist_instance_response.go
new file mode 100644
index 0000000000..4ee46ef86d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_exist_instance_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// RestoreExistInstanceResponse Response Object
+type RestoreExistInstanceResponse struct {
+
+ // 任务ID。
+ JobId *string `json:"job_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o RestoreExistInstanceResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RestoreExistInstanceResponse struct{}"
+ }
+
+ return strings.Join([]string{"RestoreExistInstanceResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_existing_instance_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_existing_instance_request_body.go
new file mode 100644
index 0000000000..bcbc4b30d8
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_existing_instance_request_body.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type RestoreExistingInstanceRequestBody struct {
+ Source *RestoreExistingInstanceRequestBodySource `json:"source"`
+
+ Target *TargetInstanceRequest `json:"target"`
+}
+
+func (o RestoreExistingInstanceRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RestoreExistingInstanceRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"RestoreExistingInstanceRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_existing_instance_request_body_source.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_existing_instance_request_body_source.go
new file mode 100644
index 0000000000..6086d562af
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_existing_instance_request_body_source.go
@@ -0,0 +1,88 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// RestoreExistingInstanceRequestBodySource 恢复数据源对象。
+type RestoreExistingInstanceRequestBodySource struct {
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 表示恢复方式,枚举值: - “backup”,表示使用备份文件恢复,按照此方式恢复时,“type”字段为非必选,“backup_id”必选。 - “timestamp”,表示按时间点恢复,按照此方式恢复时,“type”字段必选,“restore_time”必选。
+ Type *RestoreExistingInstanceRequestBodySourceType `json:"type,omitempty"`
+
+ // 用于恢复的备份ID。当使用备份文件恢复时需要指定该参数。
+ BackupId *string `json:"backup_id,omitempty"`
+
+ // 恢复数据的时间点,格式为UNIX时间戳,单位是毫秒,时区为UTC。
+ RestoreTime *int64 `json:"restore_time,omitempty"`
+
+ // 仅适用于SQL Server引擎,当有此参数时表示支持局部恢复和重命名恢复,恢复数据以局部恢复为主。不填写该字段时,默认恢复全部数据库。 - 新数据库名称不可与源实例或目标实例数据库名称重名,新数据库名称为空,默认按照原数据库名进行恢复。 - 新数据库名不能包含rdsadmin、master、msdb、tempdb、model或resource字段(不区分大小写)。 - 数据库名称长度在1~64个字符之间,包含字母、数字、下划线或中划线,不能包含其他特殊字符。
+ DatabaseName map[string]string `json:"database_name,omitempty"`
+
+ // 该字段仅适用于SQL Server引擎。是否恢复所有数据库,不填写该字段默认为false,不会恢复所有数据库到目标实例。 - 须知: 如果您想恢复所有数据库到已有实例,必须设置restore_all_database为true。
+ RestoreAllDatabase *bool `json:"restore_all_database,omitempty"`
+}
+
+func (o RestoreExistingInstanceRequestBodySource) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RestoreExistingInstanceRequestBodySource struct{}"
+ }
+
+ return strings.Join([]string{"RestoreExistingInstanceRequestBodySource", string(data)}, " ")
+}
+
+type RestoreExistingInstanceRequestBodySourceType struct {
+ value string
+}
+
+type RestoreExistingInstanceRequestBodySourceTypeEnum struct {
+ BACKUP RestoreExistingInstanceRequestBodySourceType
+ TIMESTAMP RestoreExistingInstanceRequestBodySourceType
+}
+
+func GetRestoreExistingInstanceRequestBodySourceTypeEnum() RestoreExistingInstanceRequestBodySourceTypeEnum {
+ return RestoreExistingInstanceRequestBodySourceTypeEnum{
+ BACKUP: RestoreExistingInstanceRequestBodySourceType{
+ value: "backup",
+ },
+ TIMESTAMP: RestoreExistingInstanceRequestBodySourceType{
+ value: "timestamp",
+ },
+ }
+}
+
+func (c RestoreExistingInstanceRequestBodySourceType) Value() string {
+ return c.value
+}
+
+func (c RestoreExistingInstanceRequestBodySourceType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *RestoreExistingInstanceRequestBodySourceType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_point.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_point.go
new file mode 100644
index 0000000000..b4dfe74969
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_point.go
@@ -0,0 +1,34 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type RestorePoint struct {
+
+ // 源实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 表示恢复方式,枚举值: - “backup”,表示使用备份文件恢复,按照此方式恢复时,“type”字段为非必选,“backup_id”必选。 - “timestamp”,表示按时间点恢复,按照此方式恢复时,“type”字段必选,“restore_time”必选。
+ Type string `json:"type"`
+
+ // 用于恢复的备份ID。当使用备份文件恢复时需要指定该参数。
+ BackupId *string `json:"backup_id,omitempty"`
+
+ // 恢复数据的时间点,格式为UNIX时间戳,单位是毫秒,时区为UTC。
+ RestoreTime *int64 `json:"restore_time,omitempty"`
+
+ // 仅适用于SQL Server引擎,当有此参数时表示支持局部恢复和重命名恢复,恢复数据以局部恢复为主。 - 新数据库名称不可与源实例数据库名称重名,新数据库名称为空,默认按照原数据库名进行恢复。 注意: 不填写该字段时,默认恢复全部数据库。 示例:”database_name”:{“原库名”:”新库名”} - 新数据库名不能包含rdsadmin、master、msdb、tempdb、model或resource字段(不区分大小写)。 - 数据库名称长度在1~64个字符之间,包含字母、数字、下划线或中划线,不能包含其他特殊字符。
+ DatabaseName map[string]string `json:"database_name,omitempty"`
+}
+
+func (o RestorePoint) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RestorePoint struct{}"
+ }
+
+ return strings.Join([]string{"RestorePoint", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_table_info.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_table_info.go
new file mode 100644
index 0000000000..a5f2331f29
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_table_info.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type RestoreTableInfo struct {
+
+ // 旧表名
+ OldName string `json:"oldName"`
+
+ // 新表名
+ NewName string `json:"newName"`
+}
+
+func (o RestoreTableInfo) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RestoreTableInfo struct{}"
+ }
+
+ return strings.Join([]string{"RestoreTableInfo", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_table_info_new.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_table_info_new.go
new file mode 100644
index 0000000000..d1c7aac2bf
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_table_info_new.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type RestoreTableInfoNew struct {
+
+ // 旧表名
+ OldName string `json:"old_name"`
+
+ // 新表名
+ NewName string `json:"new_name"`
+}
+
+func (o RestoreTableInfoNew) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RestoreTableInfoNew struct{}"
+ }
+
+ return strings.Join([]string{"RestoreTableInfoNew", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_tables_new_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_tables_new_request.go
new file mode 100644
index 0000000000..bfcb4adfb1
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_tables_new_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// RestoreTablesNewRequest Request Object
+type RestoreTablesNewRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *RestoreTablesNewRequestBody `json:"body,omitempty"`
+}
+
+func (o RestoreTablesNewRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RestoreTablesNewRequest struct{}"
+ }
+
+ return strings.Join([]string{"RestoreTablesNewRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_tables_new_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_tables_new_request_body.go
new file mode 100644
index 0000000000..90746136f7
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_tables_new_request_body.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type RestoreTablesNewRequestBody struct {
+
+ // 恢复时间戳
+ RestoreTime int64 `json:"restore_time"`
+
+ // 表信息
+ RestoreTables []RestoreDatabasesInfoNew `json:"restore_tables"`
+
+ // 是否使用极速恢复,可先根据“获取实例是否能使用极速恢复”接口判断本次恢复是否能使用急速恢复。 如果实例使用了XA事务,则不可使用极速恢复!使用恢复会导致恢复失败!
+ IsFastRestore *bool `json:"is_fast_restore,omitempty"`
+}
+
+func (o RestoreTablesNewRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RestoreTablesNewRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"RestoreTablesNewRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_tables_new_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_tables_new_response.go
new file mode 100644
index 0000000000..071d9c0e91
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_tables_new_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// RestoreTablesNewResponse Response Object
+type RestoreTablesNewResponse struct {
+
+ // 任务ID。
+ JobId *string `json:"job_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o RestoreTablesNewResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RestoreTablesNewResponse struct{}"
+ }
+
+ return strings.Join([]string{"RestoreTablesNewResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_tables_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_tables_request.go
new file mode 100644
index 0000000000..832d1e6987
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_tables_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// RestoreTablesRequest Request Object
+type RestoreTablesRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *RestoreTablesRequestBody `json:"body,omitempty"`
+}
+
+func (o RestoreTablesRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RestoreTablesRequest struct{}"
+ }
+
+ return strings.Join([]string{"RestoreTablesRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_tables_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_tables_request_body.go
new file mode 100644
index 0000000000..3c41a2b71f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_tables_request_body.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type RestoreTablesRequestBody struct {
+
+ // 恢复时间戳
+ RestoreTime int64 `json:"restoreTime"`
+
+ // 表信息
+ RestoreTables []RestoreDatabasesInfo `json:"restoreTables"`
+
+ // 是否使用极速恢复,可先根据”获取实例是否能使用极速恢复“接口判断本次恢复是否能使用急速恢复。 如果实例使用了XA事务,则不可使用极速恢复!使用恢复会导致恢复失败!
+ IsFastRestore *bool `json:"is_fast_restore,omitempty"`
+}
+
+func (o RestoreTablesRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RestoreTablesRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"RestoreTablesRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_tables_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_tables_response.go
new file mode 100644
index 0000000000..a5612ec9dc
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_tables_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// RestoreTablesResponse Response Object
+type RestoreTablesResponse struct {
+
+ // 任务ID。
+ JobId *string `json:"jobId,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o RestoreTablesResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RestoreTablesResponse struct{}"
+ }
+
+ return strings.Join([]string{"RestoreTablesResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_to_existing_instance_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_to_existing_instance_request.go
new file mode 100644
index 0000000000..2f8e806315
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_to_existing_instance_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// RestoreToExistingInstanceRequest Request Object
+type RestoreToExistingInstanceRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ Body *RestoreToExistingInstanceRequestBody `json:"body,omitempty"`
+}
+
+func (o RestoreToExistingInstanceRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RestoreToExistingInstanceRequest struct{}"
+ }
+
+ return strings.Join([]string{"RestoreToExistingInstanceRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_to_existing_instance_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_to_existing_instance_request_body.go
new file mode 100644
index 0000000000..f2b6bcb60a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_to_existing_instance_request_body.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type RestoreToExistingInstanceRequestBody struct {
+ Source *RestoreToExistingInstanceRequestBodySource `json:"source"`
+
+ Target *RestoreToExistingInstanceRequestBodyTarget `json:"target"`
+}
+
+func (o RestoreToExistingInstanceRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RestoreToExistingInstanceRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"RestoreToExistingInstanceRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_to_existing_instance_request_body_source.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_to_existing_instance_request_body_source.go
new file mode 100644
index 0000000000..0ca08dc79e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_to_existing_instance_request_body_source.go
@@ -0,0 +1,85 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// RestoreToExistingInstanceRequestBodySource 恢复数据源对象。
+type RestoreToExistingInstanceRequestBodySource struct {
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 表示恢复方式,枚举值: - “backup”,表示使用备份文件恢复,按照此方式恢复时,“type”字段为非必选,“backup_id”必选。 - “timestamp”,表示按时间点恢复,按照此方式恢复时,“type”字段必选,“restore_time”必选。
+ Type *RestoreToExistingInstanceRequestBodySourceType `json:"type,omitempty"`
+
+ // 用于恢复的备份ID。当使用备份文件恢复时需要指定该参数。
+ BackupId *string `json:"backup_id,omitempty"`
+
+ // 恢复数据的时间点,格式为UNIX时间戳,单位是毫秒,时区为UTC。
+ RestoreTime *int64 `json:"restore_time,omitempty"`
+
+ // 仅适用于SQL Server引擎,当有此参数时表示支持局部恢复和重命名恢复,恢复数据以局部恢复为主。不填写该字段时,默认恢复全部数据库。 - 新数据库名称不可与源实例或目标实例数据库名称重名,新数据库名称为空,默认按照原数据库名进行恢复。 - 新数据库名不能包含rdsadmin、master、msdb、tempdb、model或resource字段(不区分大小写)。 - 数据库名称长度在1~64个字符之间,包含字母、数字、下划线或中划线,不能包含其他特殊字符。
+ DatabaseName map[string]string `json:"database_name,omitempty"`
+}
+
+func (o RestoreToExistingInstanceRequestBodySource) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RestoreToExistingInstanceRequestBodySource struct{}"
+ }
+
+ return strings.Join([]string{"RestoreToExistingInstanceRequestBodySource", string(data)}, " ")
+}
+
+type RestoreToExistingInstanceRequestBodySourceType struct {
+ value string
+}
+
+type RestoreToExistingInstanceRequestBodySourceTypeEnum struct {
+ BACKUP RestoreToExistingInstanceRequestBodySourceType
+ TIMESTAMP RestoreToExistingInstanceRequestBodySourceType
+}
+
+func GetRestoreToExistingInstanceRequestBodySourceTypeEnum() RestoreToExistingInstanceRequestBodySourceTypeEnum {
+ return RestoreToExistingInstanceRequestBodySourceTypeEnum{
+ BACKUP: RestoreToExistingInstanceRequestBodySourceType{
+ value: "backup",
+ },
+ TIMESTAMP: RestoreToExistingInstanceRequestBodySourceType{
+ value: "timestamp",
+ },
+ }
+}
+
+func (c RestoreToExistingInstanceRequestBodySourceType) Value() string {
+ return c.value
+}
+
+func (c RestoreToExistingInstanceRequestBodySourceType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *RestoreToExistingInstanceRequestBodySourceType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_to_existing_instance_request_body_target.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_to_existing_instance_request_body_target.go
new file mode 100644
index 0000000000..eed2fa1923
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_to_existing_instance_request_body_target.go
@@ -0,0 +1,23 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// RestoreToExistingInstanceRequestBodyTarget 恢复目标对象。
+type RestoreToExistingInstanceRequestBodyTarget struct {
+
+ // 恢复目标实例ID。
+ InstanceId string `json:"instance_id"`
+}
+
+func (o RestoreToExistingInstanceRequestBodyTarget) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RestoreToExistingInstanceRequestBodyTarget struct{}"
+ }
+
+ return strings.Join([]string{"RestoreToExistingInstanceRequestBodyTarget", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_to_existing_instance_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_to_existing_instance_response.go
new file mode 100644
index 0000000000..d1c0525315
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_restore_to_existing_instance_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// RestoreToExistingInstanceResponse Response Object
+type RestoreToExistingInstanceResponse struct {
+
+ // 任务ID。
+ JobId *string `json:"job_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o RestoreToExistingInstanceResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RestoreToExistingInstanceResponse struct{}"
+ }
+
+ return strings.Join([]string{"RestoreToExistingInstanceResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_postgresql_db_privilege_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_postgresql_db_privilege_request.go
new file mode 100644
index 0000000000..1a8d54f80a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_postgresql_db_privilege_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// RevokePostgresqlDbPrivilegeRequest Request Object
+type RevokePostgresqlDbPrivilegeRequest struct {
+
+ // 实例ID
+ InstanceId string `json:"instance_id"`
+
+ Body *RevokePostgresqlDbPrivilegeRequestBody `json:"body,omitempty"`
+}
+
+func (o RevokePostgresqlDbPrivilegeRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RevokePostgresqlDbPrivilegeRequest struct{}"
+ }
+
+ return strings.Join([]string{"RevokePostgresqlDbPrivilegeRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_postgresql_db_privilege_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_postgresql_db_privilege_request_body.go
new file mode 100644
index 0000000000..52fcc33262
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_postgresql_db_privilege_request_body.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type RevokePostgresqlDbPrivilegeRequestBody struct {
+
+ // 数据库名称
+ DbName string `json:"db_name"`
+
+ // 用户信息,最大值50个
+ Users []RevokePostgresqlDbPrivilegeUser `json:"users"`
+}
+
+func (o RevokePostgresqlDbPrivilegeRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RevokePostgresqlDbPrivilegeRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"RevokePostgresqlDbPrivilegeRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_postgresql_db_privilege_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_postgresql_db_privilege_response.go
new file mode 100644
index 0000000000..4a6cf0e86e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_postgresql_db_privilege_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// RevokePostgresqlDbPrivilegeResponse Response Object
+type RevokePostgresqlDbPrivilegeResponse struct {
+
+ // 调用正常时,返回“successful”。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o RevokePostgresqlDbPrivilegeResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RevokePostgresqlDbPrivilegeResponse struct{}"
+ }
+
+ return strings.Join([]string{"RevokePostgresqlDbPrivilegeResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_postgresql_db_privilege_user.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_postgresql_db_privilege_user.go
new file mode 100644
index 0000000000..d0d30807f3
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_postgresql_db_privilege_user.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type RevokePostgresqlDbPrivilegeUser struct {
+
+ // 数据库账号名称
+ Name string `json:"name"`
+
+ // 数据库下模式名称
+ SchemaName string `json:"schema_name"`
+}
+
+func (o RevokePostgresqlDbPrivilegeUser) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RevokePostgresqlDbPrivilegeUser struct{}"
+ }
+
+ return strings.Join([]string{"RevokePostgresqlDbPrivilegeUser", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_request.go
new file mode 100644
index 0000000000..72e6378050
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// RevokeRequest Request Object
+type RevokeRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *RevokeRequestBody `json:"body,omitempty"`
+}
+
+func (o RevokeRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RevokeRequest struct{}"
+ }
+
+ return strings.Join([]string{"RevokeRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_request_body.go
new file mode 100644
index 0000000000..d34e69f82a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_request_body.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type RevokeRequestBody struct {
+
+ // 数据库名称。
+ DbName string `json:"db_name"`
+
+ // 解除授权的用户列表。
+ Users []RevokeRequestBodyUsers `json:"users"`
+}
+
+func (o RevokeRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RevokeRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"RevokeRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_request_body_users.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_request_body_users.go
new file mode 100644
index 0000000000..e5f1a71fb7
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_request_body_users.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type RevokeRequestBodyUsers struct {
+
+ // 数据库用户名称。
+ Name string `json:"name"`
+}
+
+func (o RevokeRequestBodyUsers) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RevokeRequestBodyUsers struct{}"
+ }
+
+ return strings.Join([]string{"RevokeRequestBodyUsers", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_response.go
new file mode 100644
index 0000000000..fc093cad9f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// RevokeResponse Response Object
+type RevokeResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o RevokeResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RevokeResponse struct{}"
+ }
+
+ return strings.Join([]string{"RevokeResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_sqlserver_db_user_privilege_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_sqlserver_db_user_privilege_request.go
new file mode 100644
index 0000000000..18ea34c197
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_sqlserver_db_user_privilege_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// RevokeSqlserverDbUserPrivilegeRequest Request Object
+type RevokeSqlserverDbUserPrivilegeRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *SqlserverRevokeRequest `json:"body,omitempty"`
+}
+
+func (o RevokeSqlserverDbUserPrivilegeRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RevokeSqlserverDbUserPrivilegeRequest struct{}"
+ }
+
+ return strings.Join([]string{"RevokeSqlserverDbUserPrivilegeRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_sqlserver_db_user_privilege_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_sqlserver_db_user_privilege_response.go
new file mode 100644
index 0000000000..066a3138ab
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_revoke_sqlserver_db_user_privilege_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// RevokeSqlserverDbUserPrivilegeResponse Response Object
+type RevokeSqlserverDbUserPrivilegeResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o RevokeSqlserverDbUserPrivilegeResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "RevokeSqlserverDbUserPrivilegeResponse struct{}"
+ }
+
+ return strings.Join([]string{"RevokeSqlserverDbUserPrivilegeResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_scale_flavors.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_scale_flavors.go
new file mode 100644
index 0000000000..29c42a13ca
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_scale_flavors.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ScaleFlavors struct {
+
+ // 规格码。
+ Code *string `json:"code,omitempty"`
+
+ // CPU个数。
+ Cpu *string `json:"cpu,omitempty"`
+
+ // 内存大小(单位:GB)。
+ Mem *string `json:"mem,omitempty"`
+}
+
+func (o ScaleFlavors) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ScaleFlavors struct{}"
+ }
+
+ return strings.Join([]string{"ScaleFlavors", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_scale_proxy_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_scale_proxy_request_body.go
new file mode 100644
index 0000000000..ae54047818
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_scale_proxy_request_body.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type ScaleProxyRequestBody struct {
+
+ // 需要变更的新规格ID。
+ FlavorRef string `json:"flavor_ref"`
+
+ // 是否延迟变更。 - true:延迟变更,将在运维时间窗内自动变更。 - false:立即变更。
+ Delay bool `json:"delay"`
+}
+
+func (o ScaleProxyRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ScaleProxyRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"ScaleProxyRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_search_query_scale_compute_flavors_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_search_query_scale_compute_flavors_request.go
new file mode 100644
index 0000000000..b4f929ba2c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_search_query_scale_compute_flavors_request.go
@@ -0,0 +1,32 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SearchQueryScaleComputeFlavorsRequest Request Object
+type SearchQueryScaleComputeFlavorsRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 索引位置,偏移量。从第一条数据偏移offset条数据后开始查询,默认为0(偏移0条数据,表示从第一条数据开始查询),必须为数字,不能为负数。
+ Offset *int32 `json:"offset,omitempty"`
+
+ // 查询记录数。默认为100,不能为负数,最小值为1,最大值为100。
+ Limit *int32 `json:"limit,omitempty"`
+}
+
+func (o SearchQueryScaleComputeFlavorsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SearchQueryScaleComputeFlavorsRequest struct{}"
+ }
+
+ return strings.Join([]string{"SearchQueryScaleComputeFlavorsRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_search_query_scale_compute_flavors_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_search_query_scale_compute_flavors_response.go
new file mode 100644
index 0000000000..7630c44270
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_search_query_scale_compute_flavors_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SearchQueryScaleComputeFlavorsResponse Response Object
+type SearchQueryScaleComputeFlavorsResponse struct {
+
+ // 计算规格列表对象。
+ ComputeFlavorGroups *[]Computes `json:"compute_flavor_groups,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o SearchQueryScaleComputeFlavorsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SearchQueryScaleComputeFlavorsResponse struct{}"
+ }
+
+ return strings.Join([]string{"SearchQueryScaleComputeFlavorsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_search_query_scale_flavors_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_search_query_scale_flavors_request.go
new file mode 100644
index 0000000000..7f9d76f189
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_search_query_scale_flavors_request.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SearchQueryScaleFlavorsRequest Request Object
+type SearchQueryScaleFlavorsRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+}
+
+func (o SearchQueryScaleFlavorsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SearchQueryScaleFlavorsRequest struct{}"
+ }
+
+ return strings.Join([]string{"SearchQueryScaleFlavorsRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_search_query_scale_flavors_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_search_query_scale_flavors_response.go
new file mode 100644
index 0000000000..6a95115a3b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_search_query_scale_flavors_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SearchQueryScaleFlavorsResponse Response Object
+type SearchQueryScaleFlavorsResponse struct {
+
+ // 计算规格列表对象。
+ ComputeFlavorGroups *[]Computes `json:"compute_flavor_groups,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o SearchQueryScaleFlavorsResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SearchQueryScaleFlavorsResponse struct{}"
+ }
+
+ return strings.Join([]string{"SearchQueryScaleFlavorsResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_second_monitor.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_second_monitor.go
new file mode 100644
index 0000000000..5ed0f0bbb5
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_second_monitor.go
@@ -0,0 +1,75 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// SecondMonitor 秒级监控信息
+type SecondMonitor struct {
+
+ // 秒级监控开关
+ SwitchOption bool `json:"switch_option"`
+
+ // 监控间隔, 支持1秒和5秒
+ Interval *SecondMonitorInterval `json:"interval,omitempty"`
+}
+
+func (o SecondMonitor) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SecondMonitor struct{}"
+ }
+
+ return strings.Join([]string{"SecondMonitor", string(data)}, " ")
+}
+
+type SecondMonitorInterval struct {
+ value int32
+}
+
+type SecondMonitorIntervalEnum struct {
+ E_1 SecondMonitorInterval
+ E_5 SecondMonitorInterval
+}
+
+func GetSecondMonitorIntervalEnum() SecondMonitorIntervalEnum {
+ return SecondMonitorIntervalEnum{
+ E_1: SecondMonitorInterval{
+ value: 1,
+ }, E_5: SecondMonitorInterval{
+ value: 5,
+ },
+ }
+}
+
+func (c SecondMonitorInterval) Value() int32 {
+ return c.value
+}
+
+func (c SecondMonitorInterval) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *SecondMonitorInterval) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("int32")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: int32")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(int32); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to int32 error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_security_group_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_security_group_request.go
new file mode 100644
index 0000000000..aa0db987b0
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_security_group_request.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type SecurityGroupRequest struct {
+
+ // - 安全组ID。
+ SecurityGroupId string `json:"security_group_id"`
+}
+
+func (o SecurityGroupRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SecurityGroupRequest struct{}"
+ }
+
+ return strings.Join([]string{"SecurityGroupRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_auditlog_policy_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_auditlog_policy_request.go
new file mode 100644
index 0000000000..4145f1583d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_auditlog_policy_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetAuditlogPolicyRequest Request Object
+type SetAuditlogPolicyRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *SetAuditlogPolicyRequestBody `json:"body,omitempty"`
+}
+
+func (o SetAuditlogPolicyRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetAuditlogPolicyRequest struct{}"
+ }
+
+ return strings.Join([]string{"SetAuditlogPolicyRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_auditlog_policy_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_auditlog_policy_request_body.go
new file mode 100644
index 0000000000..b559b99184
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_auditlog_policy_request_body.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type SetAuditlogPolicyRequestBody struct {
+
+ // 审计日志保存天数,取值范围0~732。0表示关闭审计日志策略。
+ KeepDays int32 `json:"keep_days"`
+
+ // 仅关闭审计日志策略时有效。 - true(默认),表示关闭审计日志策略的同时,延迟删除已有的历史审计日志。 - false,表示关闭审计日志策略的同时,删除已有的历史审计日志。
+ ReserveAuditlogs *bool `json:"reserve_auditlogs,omitempty"`
+}
+
+func (o SetAuditlogPolicyRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetAuditlogPolicyRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"SetAuditlogPolicyRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_auditlog_policy_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_auditlog_policy_response.go
new file mode 100644
index 0000000000..ab8ad6baa5
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_auditlog_policy_response.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetAuditlogPolicyResponse Response Object
+type SetAuditlogPolicyResponse struct {
+ HttpStatusCode int `json:"-"`
+}
+
+func (o SetAuditlogPolicyResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetAuditlogPolicyResponse struct{}"
+ }
+
+ return strings.Join([]string{"SetAuditlogPolicyResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_auto_enlarge_policy_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_auto_enlarge_policy_request.go
new file mode 100644
index 0000000000..cf734df1f4
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_auto_enlarge_policy_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetAutoEnlargePolicyRequest Request Object
+type SetAutoEnlargePolicyRequest struct {
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ Body *CustomerModifyAutoEnlargePolicyReq `json:"body,omitempty"`
+}
+
+func (o SetAutoEnlargePolicyRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetAutoEnlargePolicyRequest struct{}"
+ }
+
+ return strings.Join([]string{"SetAutoEnlargePolicyRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_auto_enlarge_policy_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_auto_enlarge_policy_response.go
new file mode 100644
index 0000000000..7ecbea4a48
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_auto_enlarge_policy_response.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetAutoEnlargePolicyResponse Response Object
+type SetAutoEnlargePolicyResponse struct {
+ Body *string `json:"body,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o SetAutoEnlargePolicyResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetAutoEnlargePolicyResponse struct{}"
+ }
+
+ return strings.Join([]string{"SetAutoEnlargePolicyResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_backup_policy_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_backup_policy_request.go
new file mode 100644
index 0000000000..4fad157f31
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_backup_policy_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetBackupPolicyRequest Request Object
+type SetBackupPolicyRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *SetBackupPolicyRequestBody `json:"body,omitempty"`
+}
+
+func (o SetBackupPolicyRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetBackupPolicyRequest struct{}"
+ }
+
+ return strings.Join([]string{"SetBackupPolicyRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_backup_policy_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_backup_policy_request_body.go
new file mode 100644
index 0000000000..7f130e2d63
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_backup_policy_request_body.go
@@ -0,0 +1,23 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type SetBackupPolicyRequestBody struct {
+ BackupPolicy *BackupPolicy `json:"backup_policy"`
+
+ // 仅关闭备份策略时有效。 - true(默认),表示保留自动备份和差异备份。 - false,表示关闭备份策略的同时,删除已有的自动备份和差异备份。
+ ReserveBackups *bool `json:"reserve_backups,omitempty"`
+}
+
+func (o SetBackupPolicyRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetBackupPolicyRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"SetBackupPolicyRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_backup_policy_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_backup_policy_response.go
new file mode 100644
index 0000000000..78f00f6e87
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_backup_policy_response.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetBackupPolicyResponse Response Object
+type SetBackupPolicyResponse struct {
+ HttpStatusCode int `json:"-"`
+}
+
+func (o SetBackupPolicyResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetBackupPolicyResponse struct{}"
+ }
+
+ return strings.Join([]string{"SetBackupPolicyResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_binlog_clear_policy_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_binlog_clear_policy_request.go
new file mode 100644
index 0000000000..6136c0e34a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_binlog_clear_policy_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetBinlogClearPolicyRequest Request Object
+type SetBinlogClearPolicyRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *BinlogClearPolicyRequestBody `json:"body,omitempty"`
+}
+
+func (o SetBinlogClearPolicyRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetBinlogClearPolicyRequest struct{}"
+ }
+
+ return strings.Join([]string{"SetBinlogClearPolicyRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_binlog_clear_policy_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_binlog_clear_policy_response.go
new file mode 100644
index 0000000000..74b23c4524
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_binlog_clear_policy_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetBinlogClearPolicyResponse Response Object
+type SetBinlogClearPolicyResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o SetBinlogClearPolicyResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetBinlogClearPolicyResponse struct{}"
+ }
+
+ return strings.Join([]string{"SetBinlogClearPolicyResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_database_user_privilege_req_v3.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_database_user_privilege_req_v3.go
new file mode 100644
index 0000000000..966887fd8a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_database_user_privilege_req_v3.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type SetDatabaseUserPrivilegeReqV3 struct {
+
+ // 是否设置所有用户。
+ AllUsers bool `json:"all_users"`
+
+ // 数据库用户名。
+ UserName *string `json:"user_name,omitempty"`
+
+ // 是否为只读权限。
+ Readonly bool `json:"readonly"`
+}
+
+func (o SetDatabaseUserPrivilegeReqV3) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetDatabaseUserPrivilegeReqV3 struct{}"
+ }
+
+ return strings.Join([]string{"SetDatabaseUserPrivilegeReqV3", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_database_user_privilege_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_database_user_privilege_request.go
new file mode 100644
index 0000000000..e92f420c27
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_database_user_privilege_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetDatabaseUserPrivilegeRequest Request Object
+type SetDatabaseUserPrivilegeRequest struct {
+
+ // 实例ID
+ InstanceId string `json:"instance_id"`
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ Body *SetDatabaseUserPrivilegeReqV3 `json:"body,omitempty"`
+}
+
+func (o SetDatabaseUserPrivilegeRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetDatabaseUserPrivilegeRequest struct{}"
+ }
+
+ return strings.Join([]string{"SetDatabaseUserPrivilegeRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_database_user_privilege_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_database_user_privilege_response.go
new file mode 100644
index 0000000000..9538bc47a3
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_database_user_privilege_response.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetDatabaseUserPrivilegeResponse Response Object
+type SetDatabaseUserPrivilegeResponse struct {
+ HttpStatusCode int `json:"-"`
+}
+
+func (o SetDatabaseUserPrivilegeResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetDatabaseUserPrivilegeResponse struct{}"
+ }
+
+ return strings.Join([]string{"SetDatabaseUserPrivilegeResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_db_user_pwd_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_db_user_pwd_request.go
new file mode 100644
index 0000000000..3a13036669
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_db_user_pwd_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// SetDbUserPwdRequest Request Object
+type SetDbUserPwdRequest struct {
+
+ // 语言
+ XLanguage *SetDbUserPwdRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *DbUserPwdRequest `json:"body,omitempty"`
+}
+
+func (o SetDbUserPwdRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetDbUserPwdRequest struct{}"
+ }
+
+ return strings.Join([]string{"SetDbUserPwdRequest", string(data)}, " ")
+}
+
+type SetDbUserPwdRequestXLanguage struct {
+ value string
+}
+
+type SetDbUserPwdRequestXLanguageEnum struct {
+ ZH_CN SetDbUserPwdRequestXLanguage
+ EN_US SetDbUserPwdRequestXLanguage
+}
+
+func GetSetDbUserPwdRequestXLanguageEnum() SetDbUserPwdRequestXLanguageEnum {
+ return SetDbUserPwdRequestXLanguageEnum{
+ ZH_CN: SetDbUserPwdRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: SetDbUserPwdRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c SetDbUserPwdRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c SetDbUserPwdRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *SetDbUserPwdRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_db_user_pwd_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_db_user_pwd_response.go
new file mode 100644
index 0000000000..2980756858
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_db_user_pwd_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetDbUserPwdResponse Response Object
+type SetDbUserPwdResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o SetDbUserPwdResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetDbUserPwdResponse struct{}"
+ }
+
+ return strings.Join([]string{"SetDbUserPwdResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_off_site_backup_policy_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_off_site_backup_policy_request.go
new file mode 100644
index 0000000000..a51df9c40b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_off_site_backup_policy_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetOffSiteBackupPolicyRequest Request Object
+type SetOffSiteBackupPolicyRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *SetOffSiteBackupPolicyRequestBody `json:"body,omitempty"`
+}
+
+func (o SetOffSiteBackupPolicyRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetOffSiteBackupPolicyRequest struct{}"
+ }
+
+ return strings.Join([]string{"SetOffSiteBackupPolicyRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_off_site_backup_policy_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_off_site_backup_policy_request_body.go
new file mode 100644
index 0000000000..a41014bbd0
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_off_site_backup_policy_request_body.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type SetOffSiteBackupPolicyRequestBody struct {
+
+ // 备份策略对象,包括备份类型、备份保留天数、目标区域ID和目标project ID。
+ PolicyPara []OffSiteBackupPolicy `json:"policy_para"`
+}
+
+func (o SetOffSiteBackupPolicyRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetOffSiteBackupPolicyRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"SetOffSiteBackupPolicyRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_off_site_backup_policy_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_off_site_backup_policy_response.go
new file mode 100644
index 0000000000..256a23dbfe
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_off_site_backup_policy_response.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetOffSiteBackupPolicyResponse Response Object
+type SetOffSiteBackupPolicyResponse struct {
+ HttpStatusCode int `json:"-"`
+}
+
+func (o SetOffSiteBackupPolicyResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetOffSiteBackupPolicyResponse struct{}"
+ }
+
+ return strings.Join([]string{"SetOffSiteBackupPolicyResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_postgresql_db_user_pwd_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_postgresql_db_user_pwd_request.go
new file mode 100644
index 0000000000..ee82b4093a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_postgresql_db_user_pwd_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// SetPostgresqlDbUserPwdRequest Request Object
+type SetPostgresqlDbUserPwdRequest struct {
+
+ // 语言
+ XLanguage *SetPostgresqlDbUserPwdRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *DbUserPwdRequest `json:"body,omitempty"`
+}
+
+func (o SetPostgresqlDbUserPwdRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetPostgresqlDbUserPwdRequest struct{}"
+ }
+
+ return strings.Join([]string{"SetPostgresqlDbUserPwdRequest", string(data)}, " ")
+}
+
+type SetPostgresqlDbUserPwdRequestXLanguage struct {
+ value string
+}
+
+type SetPostgresqlDbUserPwdRequestXLanguageEnum struct {
+ ZH_CN SetPostgresqlDbUserPwdRequestXLanguage
+ EN_US SetPostgresqlDbUserPwdRequestXLanguage
+}
+
+func GetSetPostgresqlDbUserPwdRequestXLanguageEnum() SetPostgresqlDbUserPwdRequestXLanguageEnum {
+ return SetPostgresqlDbUserPwdRequestXLanguageEnum{
+ ZH_CN: SetPostgresqlDbUserPwdRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: SetPostgresqlDbUserPwdRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c SetPostgresqlDbUserPwdRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c SetPostgresqlDbUserPwdRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *SetPostgresqlDbUserPwdRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_postgresql_db_user_pwd_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_postgresql_db_user_pwd_response.go
new file mode 100644
index 0000000000..d3cca0ddd8
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_postgresql_db_user_pwd_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetPostgresqlDbUserPwdResponse Response Object
+type SetPostgresqlDbUserPwdResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o SetPostgresqlDbUserPwdResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetPostgresqlDbUserPwdResponse struct{}"
+ }
+
+ return strings.Join([]string{"SetPostgresqlDbUserPwdResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_read_only_switch_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_read_only_switch_request.go
new file mode 100644
index 0000000000..415cb419a0
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_read_only_switch_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetReadOnlySwitchRequest Request Object
+type SetReadOnlySwitchRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *MysqlReadOnlySwitch `json:"body,omitempty"`
+}
+
+func (o SetReadOnlySwitchRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetReadOnlySwitchRequest struct{}"
+ }
+
+ return strings.Join([]string{"SetReadOnlySwitchRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_read_only_switch_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_read_only_switch_response.go
new file mode 100644
index 0000000000..0ed2f6aee5
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_read_only_switch_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetReadOnlySwitchResponse Response Object
+type SetReadOnlySwitchResponse struct {
+
+ // 任务ID。
+ JobId *string `json:"job_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o SetReadOnlySwitchResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetReadOnlySwitchResponse struct{}"
+ }
+
+ return strings.Join([]string{"SetReadOnlySwitchResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_second_level_monitor_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_second_level_monitor_request.go
new file mode 100644
index 0000000000..412076677b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_second_level_monitor_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetSecondLevelMonitorRequest Request Object
+type SetSecondLevelMonitorRequest struct {
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ Body *SecondMonitor `json:"body,omitempty"`
+}
+
+func (o SetSecondLevelMonitorRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetSecondLevelMonitorRequest struct{}"
+ }
+
+ return strings.Join([]string{"SetSecondLevelMonitorRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_second_level_monitor_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_second_level_monitor_response.go
new file mode 100644
index 0000000000..87eaea6084
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_second_level_monitor_response.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetSecondLevelMonitorResponse Response Object
+type SetSecondLevelMonitorResponse struct {
+ Body *string `json:"body,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o SetSecondLevelMonitorResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetSecondLevelMonitorResponse struct{}"
+ }
+
+ return strings.Join([]string{"SetSecondLevelMonitorResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_security_group_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_security_group_request.go
new file mode 100644
index 0000000000..3d2a82906f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_security_group_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// SetSecurityGroupRequest Request Object
+type SetSecurityGroupRequest struct {
+
+ // 语言
+ XLanguage *SetSecurityGroupRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *SecurityGroupRequest `json:"body,omitempty"`
+}
+
+func (o SetSecurityGroupRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetSecurityGroupRequest struct{}"
+ }
+
+ return strings.Join([]string{"SetSecurityGroupRequest", string(data)}, " ")
+}
+
+type SetSecurityGroupRequestXLanguage struct {
+ value string
+}
+
+type SetSecurityGroupRequestXLanguageEnum struct {
+ ZH_CN SetSecurityGroupRequestXLanguage
+ EN_US SetSecurityGroupRequestXLanguage
+}
+
+func GetSetSecurityGroupRequestXLanguageEnum() SetSecurityGroupRequestXLanguageEnum {
+ return SetSecurityGroupRequestXLanguageEnum{
+ ZH_CN: SetSecurityGroupRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: SetSecurityGroupRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c SetSecurityGroupRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c SetSecurityGroupRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *SetSecurityGroupRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_security_group_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_security_group_response.go
new file mode 100644
index 0000000000..dc445e5b2e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_security_group_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetSecurityGroupResponse Response Object
+type SetSecurityGroupResponse struct {
+
+ // 任务ID
+ WorkflowId *string `json:"workflowId,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o SetSecurityGroupResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetSecurityGroupResponse struct{}"
+ }
+
+ return strings.Join([]string{"SetSecurityGroupResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_sensitive_slow_log_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_sensitive_slow_log_request.go
new file mode 100644
index 0000000000..4d4fc5cbd0
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_sensitive_slow_log_request.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetSensitiveSlowLogRequest Request Object
+type SetSensitiveSlowLogRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID,可以调用“查询实例列表”接口获取。如果未申请实例,可以调用“创建实例”接口创建。
+ InstanceId string `json:"instance_id"`
+
+ // 开启或关闭慢日志敏感信息明文,取值为on或off。
+ Status string `json:"status"`
+}
+
+func (o SetSensitiveSlowLogRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetSensitiveSlowLogRequest struct{}"
+ }
+
+ return strings.Join([]string{"SetSensitiveSlowLogRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_sensitive_slow_log_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_sensitive_slow_log_response.go
new file mode 100644
index 0000000000..0942407046
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_set_sensitive_slow_log_response.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SetSensitiveSlowLogResponse Response Object
+type SetSensitiveSlowLogResponse struct {
+ HttpStatusCode int `json:"-"`
+}
+
+func (o SetSensitiveSlowLogResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SetSensitiveSlowLogResponse struct{}"
+ }
+
+ return strings.Join([]string{"SetSensitiveSlowLogResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_api_version_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_api_version_request.go
new file mode 100644
index 0000000000..bbec27f75e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_api_version_request.go
@@ -0,0 +1,23 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowApiVersionRequest Request Object
+type ShowApiVersionRequest struct {
+
+ // API版本
+ Version string `json:"version"`
+}
+
+func (o ShowApiVersionRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowApiVersionRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowApiVersionRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_api_version_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_api_version_response.go
new file mode 100644
index 0000000000..c2af8c0585
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_api_version_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowApiVersionResponse Response Object
+type ShowApiVersionResponse struct {
+ Versions *ApiVersion `json:"versions,omitempty"`
+
+ Version *ApiVersion `json:"version,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowApiVersionResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowApiVersionResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowApiVersionResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_auditlog_download_link_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_auditlog_download_link_request.go
new file mode 100644
index 0000000000..e9748f7e8d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_auditlog_download_link_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowAuditlogDownloadLinkRequest Request Object
+type ShowAuditlogDownloadLinkRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *GenerateAuditlogDownloadLinkRequest `json:"body,omitempty"`
+}
+
+func (o ShowAuditlogDownloadLinkRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowAuditlogDownloadLinkRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowAuditlogDownloadLinkRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_auditlog_download_link_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_auditlog_download_link_response.go
new file mode 100644
index 0000000000..fda4250e19
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_auditlog_download_link_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowAuditlogDownloadLinkResponse Response Object
+type ShowAuditlogDownloadLinkResponse struct {
+
+ // 审计日志下载链接列表。
+ Links *[]string `json:"links,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowAuditlogDownloadLinkResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowAuditlogDownloadLinkResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowAuditlogDownloadLinkResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_auditlog_policy_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_auditlog_policy_request.go
new file mode 100644
index 0000000000..53f2c41324
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_auditlog_policy_request.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowAuditlogPolicyRequest Request Object
+type ShowAuditlogPolicyRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+}
+
+func (o ShowAuditlogPolicyRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowAuditlogPolicyRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowAuditlogPolicyRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_auditlog_policy_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_auditlog_policy_response.go
new file mode 100644
index 0000000000..9791664095
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_auditlog_policy_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowAuditlogPolicyResponse Response Object
+type ShowAuditlogPolicyResponse struct {
+
+ // 审计日志保存天数,取值范围0~732。0表示关闭审计日志策略。
+ KeepDays *int32 `json:"keep_days,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowAuditlogPolicyResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowAuditlogPolicyResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowAuditlogPolicyResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_auto_enlarge_policy_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_auto_enlarge_policy_request.go
new file mode 100644
index 0000000000..59614dcbd4
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_auto_enlarge_policy_request.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowAutoEnlargePolicyRequest Request Object
+type ShowAutoEnlargePolicyRequest struct {
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+}
+
+func (o ShowAutoEnlargePolicyRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowAutoEnlargePolicyRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowAutoEnlargePolicyRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_auto_enlarge_policy_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_auto_enlarge_policy_response.go
new file mode 100644
index 0000000000..b255c444da
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_auto_enlarge_policy_response.go
@@ -0,0 +1,30 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowAutoEnlargePolicyResponse Response Object
+type ShowAutoEnlargePolicyResponse struct {
+
+ // 是否已开启自动扩容,true为开启
+ SwitchOption *bool `json:"switch_option,omitempty"`
+
+ // 扩容上限,单位GB
+ LimitSize *int32 `json:"limit_size,omitempty"`
+
+ // 可用空间百分比,小于等于此值或者10GB时触发扩容
+ TriggerThreshold *int32 `json:"trigger_threshold,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowAutoEnlargePolicyResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowAutoEnlargePolicyResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowAutoEnlargePolicyResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_available_version_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_available_version_request.go
new file mode 100644
index 0000000000..c19b33f95a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_available_version_request.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowAvailableVersionRequest Request Object
+type ShowAvailableVersionRequest struct {
+
+ // 实例ID
+ InstanceId string `json:"instance_id"`
+
+ // 语言。默认en-us。
+ XLanguage *string `json:"X-Language,omitempty"`
+}
+
+func (o ShowAvailableVersionRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowAvailableVersionRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowAvailableVersionRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_available_version_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_available_version_response.go
new file mode 100644
index 0000000000..9215f36a6f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_available_version_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowAvailableVersionResponse Response Object
+type ShowAvailableVersionResponse struct {
+
+ // 可选版本列表。
+ AvailableVersions *[]string `json:"available_versions,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowAvailableVersionResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowAvailableVersionResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowAvailableVersionResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_backup_download_link_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_backup_download_link_request.go
new file mode 100644
index 0000000000..2f6778887e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_backup_download_link_request.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowBackupDownloadLinkRequest Request Object
+type ShowBackupDownloadLinkRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 备份ID。
+ BackupId string `json:"backup_id"`
+}
+
+func (o ShowBackupDownloadLinkRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowBackupDownloadLinkRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowBackupDownloadLinkRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_backup_download_link_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_backup_download_link_response.go
new file mode 100644
index 0000000000..fdb92632d2
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_backup_download_link_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowBackupDownloadLinkResponse Response Object
+type ShowBackupDownloadLinkResponse struct {
+
+ // 备份文件信息。
+ Files *[]GetBackupDownloadLinkFiles `json:"files,omitempty"`
+
+ // OBS桶名。
+ Bucket *string `json:"bucket,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowBackupDownloadLinkResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowBackupDownloadLinkResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowBackupDownloadLinkResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_backup_policy_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_backup_policy_request.go
new file mode 100644
index 0000000000..c7c088afcf
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_backup_policy_request.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowBackupPolicyRequest Request Object
+type ShowBackupPolicyRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+}
+
+func (o ShowBackupPolicyRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowBackupPolicyRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowBackupPolicyRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_backup_policy_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_backup_policy_response.go
new file mode 100644
index 0000000000..0e15ee65b4
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_backup_policy_response.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowBackupPolicyResponse Response Object
+type ShowBackupPolicyResponse struct {
+ BackupPolicy *BackupPolicy `json:"backup_policy,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowBackupPolicyResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowBackupPolicyResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowBackupPolicyResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_binlog_clear_policy_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_binlog_clear_policy_request.go
new file mode 100644
index 0000000000..8322ea79ff
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_binlog_clear_policy_request.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowBinlogClearPolicyRequest Request Object
+type ShowBinlogClearPolicyRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+}
+
+func (o ShowBinlogClearPolicyRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowBinlogClearPolicyRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowBinlogClearPolicyRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_binlog_clear_policy_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_binlog_clear_policy_response.go
new file mode 100644
index 0000000000..0f4a503fbd
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_binlog_clear_policy_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowBinlogClearPolicyResponse Response Object
+type ShowBinlogClearPolicyResponse struct {
+
+ // binlog保留时长
+ BinlogRetentionHours *int32 `json:"binlog_retention_hours,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowBinlogClearPolicyResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowBinlogClearPolicyResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowBinlogClearPolicyResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_configuration_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_configuration_request.go
new file mode 100644
index 0000000000..04ee17d47e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_configuration_request.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowConfigurationRequest Request Object
+type ShowConfigurationRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 参数模板ID。
+ ConfigId string `json:"config_id"`
+}
+
+func (o ShowConfigurationRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowConfigurationRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowConfigurationRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_configuration_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_configuration_response.go
new file mode 100644
index 0000000000..d83d5e0aeb
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_configuration_response.go
@@ -0,0 +1,103 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ShowConfigurationResponse Response Object
+type ShowConfigurationResponse struct {
+
+ // 参数组ID。
+ Id *string `json:"id,omitempty"`
+
+ // 参数组名称。
+ Name *string `json:"name,omitempty"`
+
+ // 参数组描述。
+ Description *string `json:"description,omitempty"`
+
+ // 引擎版本。
+ DatastoreVersionName *string `json:"datastore_version_name,omitempty"`
+
+ // 引擎名。
+ DatastoreName *ShowConfigurationResponseDatastoreName `json:"datastore_name,omitempty"`
+
+ // 创建时间,格式为\"yyyy-MM-ddTHH:mm:ssZ\"。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ Created *string `json:"created,omitempty"`
+
+ // 更新时间,格式为\"yyyy-MM-ddTHH:mm:ssZ\"。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ Updated *string `json:"updated,omitempty"`
+
+ // 参数对象,用户基于默认参数模板自定义的参数配置。
+ ConfigurationParameters *[]ConfigurationParameter `json:"configuration_parameters,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowConfigurationResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowConfigurationResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowConfigurationResponse", string(data)}, " ")
+}
+
+type ShowConfigurationResponseDatastoreName struct {
+ value string
+}
+
+type ShowConfigurationResponseDatastoreNameEnum struct {
+ MYSQL ShowConfigurationResponseDatastoreName
+ POSTGRESQL ShowConfigurationResponseDatastoreName
+ SQLSERVER ShowConfigurationResponseDatastoreName
+ MARIADB ShowConfigurationResponseDatastoreName
+}
+
+func GetShowConfigurationResponseDatastoreNameEnum() ShowConfigurationResponseDatastoreNameEnum {
+ return ShowConfigurationResponseDatastoreNameEnum{
+ MYSQL: ShowConfigurationResponseDatastoreName{
+ value: "mysql",
+ },
+ POSTGRESQL: ShowConfigurationResponseDatastoreName{
+ value: "postgresql",
+ },
+ SQLSERVER: ShowConfigurationResponseDatastoreName{
+ value: "sqlserver",
+ },
+ MARIADB: ShowConfigurationResponseDatastoreName{
+ value: "mariadb",
+ },
+ }
+}
+
+func (c ShowConfigurationResponseDatastoreName) Value() string {
+ return c.value
+}
+
+func (c ShowConfigurationResponseDatastoreName) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ShowConfigurationResponseDatastoreName) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_dns_name_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_dns_name_request.go
new file mode 100644
index 0000000000..fe7915b668
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_dns_name_request.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowDnsNameRequest Request Object
+type ShowDnsNameRequest struct {
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例域名类型,当前只支持\"private\"。
+ DnsType string `json:"dns_type"`
+}
+
+func (o ShowDnsNameRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowDnsNameRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowDnsNameRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_dns_name_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_dns_name_response.go
new file mode 100644
index 0000000000..547e5a2d29
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_dns_name_response.go
@@ -0,0 +1,36 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowDnsNameResponse Response Object
+type ShowDnsNameResponse struct {
+
+ // 实例ID。
+ InstanceId *string `json:"instance_id,omitempty"`
+
+ // 实例域名。
+ DnsName *string `json:"dns_name,omitempty"`
+
+ // 实例域名类型,当前只支持private。
+ DnsType *string `json:"dns_type,omitempty"`
+
+ // 实例内网IPv6地址。
+ Ipv6Address *string `json:"ipv6_address,omitempty"`
+
+ // 域名状态。
+ Status *string `json:"status,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowDnsNameResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowDnsNameResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowDnsNameResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_domain_name_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_domain_name_request.go
new file mode 100644
index 0000000000..84f104c1a3
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_domain_name_request.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowDomainNameRequest Request Object
+type ShowDomainNameRequest struct {
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 实例域名类型,当前只支持private。
+ DnsType string `json:"dns_type"`
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+}
+
+func (o ShowDomainNameRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowDomainNameRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowDomainNameRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_domain_name_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_domain_name_response.go
new file mode 100644
index 0000000000..1b3333e00b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_domain_name_response.go
@@ -0,0 +1,36 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowDomainNameResponse Response Object
+type ShowDomainNameResponse struct {
+
+ // 实例ID。
+ InstanceId *string `json:"instance_id,omitempty"`
+
+ // 实例域名。
+ DnsName *string `json:"dns_name,omitempty"`
+
+ // 实例域名类型,当前只支持private。
+ DnsType *string `json:"dns_type,omitempty"`
+
+ // 实例内网IPv4地址。
+ Ipv4Address *string `json:"ipv4_address,omitempty"`
+
+ // 域名状态
+ Status *string `json:"status,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowDomainNameResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowDomainNameResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowDomainNameResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_dr_replica_status_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_dr_replica_status_request.go
new file mode 100644
index 0000000000..ae006c010f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_dr_replica_status_request.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowDrReplicaStatusRequest Request Object
+type ShowDrReplicaStatusRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+}
+
+func (o ShowDrReplicaStatusRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowDrReplicaStatusRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowDrReplicaStatusRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_dr_replica_status_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_dr_replica_status_response.go
new file mode 100644
index 0000000000..c16b0b5110
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_dr_replica_status_response.go
@@ -0,0 +1,33 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowDrReplicaStatusResponse Response Object
+type ShowDrReplicaStatusResponse struct {
+
+ // 同步状态,取值范围是0或-1,0表示正常,-1表示异常。
+ ReplicaState *string `json:"replica_state,omitempty"`
+
+ // 发送延迟大小(MB),即主实例当前wal日志写入位点与灾备实例当前接收wal日志位点的差值。
+ WalWriteReceiveDelayInMb *string `json:"wal_write_receive_delay_in_mb,omitempty"`
+
+ // 端到端延迟大小(MB),即主实例当前wal日志写入位点与灾备实例当前回放wal日志位点的差值。
+ WalWriteReplayDelayInMb *string `json:"wal_write_replay_delay_in_mb,omitempty"`
+
+ // 回放延迟时间(ms),即数据在灾备上回放的延迟时间。
+ WalReceiveReplayDelayInMs *string `json:"wal_receive_replay_delay_in_ms,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowDrReplicaStatusResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowDrReplicaStatusResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowDrReplicaStatusResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_information_about_database_proxy_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_information_about_database_proxy_request.go
new file mode 100644
index 0000000000..8ccdec0fcb
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_information_about_database_proxy_request.go
@@ -0,0 +1,76 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ShowInformationAboutDatabaseProxyRequest Request Object
+type ShowInformationAboutDatabaseProxyRequest struct {
+
+ // 语言
+ XLanguage *ShowInformationAboutDatabaseProxyRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+}
+
+func (o ShowInformationAboutDatabaseProxyRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowInformationAboutDatabaseProxyRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowInformationAboutDatabaseProxyRequest", string(data)}, " ")
+}
+
+type ShowInformationAboutDatabaseProxyRequestXLanguage struct {
+ value string
+}
+
+type ShowInformationAboutDatabaseProxyRequestXLanguageEnum struct {
+ ZH_CN ShowInformationAboutDatabaseProxyRequestXLanguage
+ EN_US ShowInformationAboutDatabaseProxyRequestXLanguage
+}
+
+func GetShowInformationAboutDatabaseProxyRequestXLanguageEnum() ShowInformationAboutDatabaseProxyRequestXLanguageEnum {
+ return ShowInformationAboutDatabaseProxyRequestXLanguageEnum{
+ ZH_CN: ShowInformationAboutDatabaseProxyRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: ShowInformationAboutDatabaseProxyRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c ShowInformationAboutDatabaseProxyRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c ShowInformationAboutDatabaseProxyRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ShowInformationAboutDatabaseProxyRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_information_about_database_proxy_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_information_about_database_proxy_response.go
new file mode 100644
index 0000000000..083487973b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_information_about_database_proxy_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowInformationAboutDatabaseProxyResponse Response Object
+type ShowInformationAboutDatabaseProxyResponse struct {
+ Proxy *Proxy `json:"proxy,omitempty"`
+
+ MasterInstance *MasterInstance `json:"master_instance,omitempty"`
+
+ // 只读实例信息。
+ ReadonlyInstances *[]ReadonlyInstances `json:"readonly_instances,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowInformationAboutDatabaseProxyResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowInformationAboutDatabaseProxyResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowInformationAboutDatabaseProxyResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_instance_configuration_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_instance_configuration_request.go
new file mode 100644
index 0000000000..25dd6a6bac
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_instance_configuration_request.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowInstanceConfigurationRequest Request Object
+type ShowInstanceConfigurationRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+}
+
+func (o ShowInstanceConfigurationRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowInstanceConfigurationRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowInstanceConfigurationRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_instance_configuration_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_instance_configuration_response.go
new file mode 100644
index 0000000000..814abdfcd0
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_instance_configuration_response.go
@@ -0,0 +1,94 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ShowInstanceConfigurationResponse Response Object
+type ShowInstanceConfigurationResponse struct {
+
+ // 引擎版本。
+ DatastoreVersionName *string `json:"datastore_version_name,omitempty"`
+
+ // 引擎名。
+ DatastoreName *ShowInstanceConfigurationResponseDatastoreName `json:"datastore_name,omitempty"`
+
+ // 创建时间,格式为\"yyyy-MM-ddTHH:mm:ssZ\"。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ Created *string `json:"created,omitempty"`
+
+ // 更新时间,格式为\"yyyy-MM-ddTHH:mm:ssZ\"。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ Updated *string `json:"updated,omitempty"`
+
+ // 参数对象,用户基于默认参数模板自定义的参数配置。
+ ConfigurationParameters *[]ConfigurationParameter `json:"configuration_parameters,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowInstanceConfigurationResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowInstanceConfigurationResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowInstanceConfigurationResponse", string(data)}, " ")
+}
+
+type ShowInstanceConfigurationResponseDatastoreName struct {
+ value string
+}
+
+type ShowInstanceConfigurationResponseDatastoreNameEnum struct {
+ MYSQL ShowInstanceConfigurationResponseDatastoreName
+ POSTGRESQL ShowInstanceConfigurationResponseDatastoreName
+ SQLSERVER ShowInstanceConfigurationResponseDatastoreName
+ MARIADB ShowInstanceConfigurationResponseDatastoreName
+}
+
+func GetShowInstanceConfigurationResponseDatastoreNameEnum() ShowInstanceConfigurationResponseDatastoreNameEnum {
+ return ShowInstanceConfigurationResponseDatastoreNameEnum{
+ MYSQL: ShowInstanceConfigurationResponseDatastoreName{
+ value: "mysql",
+ },
+ POSTGRESQL: ShowInstanceConfigurationResponseDatastoreName{
+ value: "postgresql",
+ },
+ SQLSERVER: ShowInstanceConfigurationResponseDatastoreName{
+ value: "sqlserver",
+ },
+ MARIADB: ShowInstanceConfigurationResponseDatastoreName{
+ value: "mariadb",
+ },
+ }
+}
+
+func (c ShowInstanceConfigurationResponseDatastoreName) Value() string {
+ return c.value
+}
+
+func (c ShowInstanceConfigurationResponseDatastoreName) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ShowInstanceConfigurationResponseDatastoreName) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_off_site_backup_policy_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_off_site_backup_policy_request.go
new file mode 100644
index 0000000000..544a6dd0ee
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_off_site_backup_policy_request.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowOffSiteBackupPolicyRequest Request Object
+type ShowOffSiteBackupPolicyRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+}
+
+func (o ShowOffSiteBackupPolicyRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowOffSiteBackupPolicyRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowOffSiteBackupPolicyRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_off_site_backup_policy_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_off_site_backup_policy_response.go
new file mode 100644
index 0000000000..c293ef7e1b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_off_site_backup_policy_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowOffSiteBackupPolicyResponse Response Object
+type ShowOffSiteBackupPolicyResponse struct {
+
+ // 备份策略对象,包括备份类型、备份保留天数、目标区域ID和目标project ID。
+ PolicyPara *[]GetOffSiteBackupPolicy `json:"policy_para,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowOffSiteBackupPolicyResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowOffSiteBackupPolicyResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowOffSiteBackupPolicyResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_postgresql_param_value_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_postgresql_param_value_request.go
new file mode 100644
index 0000000000..7493fe422d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_postgresql_param_value_request.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowPostgresqlParamValueRequest Request Object
+type ShowPostgresqlParamValueRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 参数名称。
+ Name string `json:"name"`
+}
+
+func (o ShowPostgresqlParamValueRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowPostgresqlParamValueRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowPostgresqlParamValueRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_postgresql_param_value_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_postgresql_param_value_response.go
new file mode 100644
index 0000000000..cd89178e33
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_postgresql_param_value_response.go
@@ -0,0 +1,39 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowPostgresqlParamValueResponse Response Object
+type ShowPostgresqlParamValueResponse struct {
+
+ // 参数名称。
+ Name *string `json:"name,omitempty"`
+
+ // 参数值。
+ Value *string `json:"value,omitempty"`
+
+ // 是否需要重启。 - \"false\"表示否 - \"true\"表示是
+ RestartRequired *bool `json:"restart_required,omitempty"`
+
+ // 参数值范围,如Integer取值0-1、Boolean取值true|false等。
+ ValueRange *string `json:"value_range,omitempty"`
+
+ // 参数类型,取值为“string”、“integer”、“boolean”、“list”或“float”之一。
+ Type *string `json:"type,omitempty"`
+
+ // 参数描述。
+ Description *string `json:"description,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowPostgresqlParamValueResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowPostgresqlParamValueResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowPostgresqlParamValueResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_quotas_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_quotas_request.go
new file mode 100644
index 0000000000..99a1b057ad
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_quotas_request.go
@@ -0,0 +1,73 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ShowQuotasRequest Request Object
+type ShowQuotasRequest struct {
+
+ // 语言
+ XLanguage *ShowQuotasRequestXLanguage `json:"X-Language,omitempty"`
+}
+
+func (o ShowQuotasRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowQuotasRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowQuotasRequest", string(data)}, " ")
+}
+
+type ShowQuotasRequestXLanguage struct {
+ value string
+}
+
+type ShowQuotasRequestXLanguageEnum struct {
+ ZH_CN ShowQuotasRequestXLanguage
+ EN_US ShowQuotasRequestXLanguage
+}
+
+func GetShowQuotasRequestXLanguageEnum() ShowQuotasRequestXLanguageEnum {
+ return ShowQuotasRequestXLanguageEnum{
+ ZH_CN: ShowQuotasRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: ShowQuotasRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c ShowQuotasRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c ShowQuotasRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ShowQuotasRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_quotas_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_quotas_response.go
new file mode 100644
index 0000000000..929aa37424
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_quotas_response.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowQuotasResponse Response Object
+type ShowQuotasResponse struct {
+ Quotas *Quotas `json:"quotas,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowQuotasResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowQuotasResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowQuotasResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_recycle_policy_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_recycle_policy_request.go
new file mode 100644
index 0000000000..00fb6e3f39
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_recycle_policy_request.go
@@ -0,0 +1,23 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowRecyclePolicyRequest Request Object
+type ShowRecyclePolicyRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+}
+
+func (o ShowRecyclePolicyRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowRecyclePolicyRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowRecyclePolicyRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_recycle_policy_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_recycle_policy_response.go
new file mode 100644
index 0000000000..07c6e4ad51
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_recycle_policy_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowRecyclePolicyResponse Response Object
+type ShowRecyclePolicyResponse struct {
+
+ // 回收站实例保留天数
+ RetentionPeriodInDays *int32 `json:"retention_period_in_days,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowRecyclePolicyResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowRecyclePolicyResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowRecyclePolicyResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_replication_status_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_replication_status_request.go
new file mode 100644
index 0000000000..55778db42b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_replication_status_request.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowReplicationStatusRequest Request Object
+type ShowReplicationStatusRequest struct {
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+}
+
+func (o ShowReplicationStatusRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowReplicationStatusRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowReplicationStatusRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_replication_status_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_replication_status_response.go
new file mode 100644
index 0000000000..e314e2ca17
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_replication_status_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowReplicationStatusResponse Response Object
+type ShowReplicationStatusResponse struct {
+
+ // 复制状态。
+ ReplicationStatus *string `json:"replication_status,omitempty"`
+
+ // 复制异常原因。
+ AbnormalReason *string `json:"abnormal_reason,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowReplicationStatusResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowReplicationStatusResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowReplicationStatusResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_second_level_monitoring_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_second_level_monitoring_request.go
new file mode 100644
index 0000000000..65dc596163
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_second_level_monitoring_request.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowSecondLevelMonitoringRequest Request Object
+type ShowSecondLevelMonitoringRequest struct {
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+}
+
+func (o ShowSecondLevelMonitoringRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowSecondLevelMonitoringRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowSecondLevelMonitoringRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_second_level_monitoring_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_second_level_monitoring_response.go
new file mode 100644
index 0000000000..2ba59789dd
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_second_level_monitoring_response.go
@@ -0,0 +1,76 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// ShowSecondLevelMonitoringResponse Response Object
+type ShowSecondLevelMonitoringResponse struct {
+
+ // 秒级监控开关
+ SwitchOption *bool `json:"switch_option,omitempty"`
+
+ // 监控间隔, 支持1秒和5秒
+ Interval *ShowSecondLevelMonitoringResponseInterval `json:"interval,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowSecondLevelMonitoringResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowSecondLevelMonitoringResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowSecondLevelMonitoringResponse", string(data)}, " ")
+}
+
+type ShowSecondLevelMonitoringResponseInterval struct {
+ value int32
+}
+
+type ShowSecondLevelMonitoringResponseIntervalEnum struct {
+ E_1 ShowSecondLevelMonitoringResponseInterval
+ E_5 ShowSecondLevelMonitoringResponseInterval
+}
+
+func GetShowSecondLevelMonitoringResponseIntervalEnum() ShowSecondLevelMonitoringResponseIntervalEnum {
+ return ShowSecondLevelMonitoringResponseIntervalEnum{
+ E_1: ShowSecondLevelMonitoringResponseInterval{
+ value: 1,
+ }, E_5: ShowSecondLevelMonitoringResponseInterval{
+ value: 5,
+ },
+ }
+}
+
+func (c ShowSecondLevelMonitoringResponseInterval) Value() int32 {
+ return c.value
+}
+
+func (c ShowSecondLevelMonitoringResponseInterval) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *ShowSecondLevelMonitoringResponseInterval) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("int32")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: int32")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(int32); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to int32 error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_tde_status_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_tde_status_request.go
new file mode 100644
index 0000000000..bce8440495
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_tde_status_request.go
@@ -0,0 +1,23 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowTdeStatusRequest Request Object
+type ShowTdeStatusRequest struct {
+
+ // 实例ID
+ InstanceId string `json:"instance_id"`
+}
+
+func (o ShowTdeStatusRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowTdeStatusRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowTdeStatusRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_tde_status_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_tde_status_response.go
new file mode 100644
index 0000000000..eaae949f0a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_tde_status_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowTdeStatusResponse Response Object
+type ShowTdeStatusResponse struct {
+
+ // 实例ID
+ InstanceId *string `json:"instance_id,omitempty"`
+
+ // TDE状态
+ TdeStatus *string `json:"tde_status,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowTdeStatusResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowTdeStatusResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowTdeStatusResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_upgrade_db_major_version_status_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_upgrade_db_major_version_status_request.go
new file mode 100644
index 0000000000..3babd36e40
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_upgrade_db_major_version_status_request.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowUpgradeDbMajorVersionStatusRequest Request Object
+type ShowUpgradeDbMajorVersionStatusRequest struct {
+
+ // 实例ID
+ InstanceId string `json:"instance_id"`
+
+ // 要查询的状态 check:查询升级预检查的状态。 upgrade:查询大板本升级的状态。
+ Action string `json:"action"`
+
+ // 语言。默认en-us。
+ XLanguage *string `json:"X-Language,omitempty"`
+}
+
+func (o ShowUpgradeDbMajorVersionStatusRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowUpgradeDbMajorVersionStatusRequest struct{}"
+ }
+
+ return strings.Join([]string{"ShowUpgradeDbMajorVersionStatusRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_upgrade_db_major_version_status_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_upgrade_db_major_version_status_response.go
new file mode 100644
index 0000000000..225fdd9d0a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_show_upgrade_db_major_version_status_response.go
@@ -0,0 +1,36 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// ShowUpgradeDbMajorVersionStatusResponse Response Object
+type ShowUpgradeDbMajorVersionStatusResponse struct {
+
+ // 实例大版本升级状态 \" running\":预检查或大版本升级进行中 \" success\":预检查或大版本升级成功 \" failed\":预检查或大版本升级失败
+ Status *string `json:"status,omitempty"`
+
+ // 目标版本。
+ TargetVersion *string `json:"target_version,omitempty"`
+
+ // 开始时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如偏移1个小时显示为+0100。
+ StartTime *string `json:"start_time,omitempty"`
+
+ // 检查成功时,检查报告到期时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如偏移1个小时显示为+0100。 该字段仅在action为check时返回。
+ ReportExpirationTime *string `json:"report_expiration_time,omitempty"`
+
+ // 预检查或升级报告信息。
+ Detail *string `json:"detail,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o ShowUpgradeDbMajorVersionStatusResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "ShowUpgradeDbMajorVersionStatusResponse struct{}"
+ }
+
+ return strings.Join([]string{"ShowUpgradeDbMajorVersionStatusResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_simplified_instance_entry.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_simplified_instance_entry.go
new file mode 100644
index 0000000000..0bec3bea8e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_simplified_instance_entry.go
@@ -0,0 +1,64 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type SimplifiedInstanceEntry struct {
+
+ // 实例id
+ Id string `json:"id"`
+
+ // 创建的实例名称
+ Name string `json:"name"`
+
+ // 引擎名字
+ EngineName string `json:"engine_name"`
+
+ // 引擎版本
+ EngineVersion string `json:"engine_version"`
+
+ // 实例状态。 normal,表示正常 abnormal,表示异常 creating,表示创建中 createfail,表示创建失败 data_disk_full,表示磁盘满 deleted,表示删除 shutdown,表示关机
+ InstanceStatus string `json:"instance_status"`
+
+ // 是否冻结
+ Frozen bool `json:"frozen"`
+
+ // 按照实例类型查询。取值Single、Ha、Replica、Enterprise,分别对应于单实例、主备实例和只读实例、分布式实例(企业版)。
+ Type string `json:"type"`
+
+ // 按需还是包周期
+ PayModel string `json:"pay_model"`
+
+ // 规格码
+ SpecCode string `json:"spec_code"`
+
+ // 可用区集合
+ AvailabilityZoneIds []string `json:"availability_zone_ids"`
+
+ // 只读实例id集合
+ ReadOnlyInstances []string `json:"read_only_instances"`
+
+ // 当前实例操作动作集合
+ CurrentActions []string `json:"current_actions"`
+
+ // 磁盘类型。
+ VolumeType string `json:"volume_type"`
+
+ // 磁盘大小(单位:G)。
+ VolumeSize int64 `json:"volume_size"`
+
+ // 企业项目标签ID。
+ EnterpriseProjectId string `json:"enterprise_project_id"`
+}
+
+func (o SimplifiedInstanceEntry) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SimplifiedInstanceEntry struct{}"
+ }
+
+ return strings.Join([]string{"SimplifiedInstanceEntry", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_simplified_instances_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_simplified_instances_request.go
new file mode 100644
index 0000000000..e20a1fa2d0
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_simplified_instances_request.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type SimplifiedInstancesRequest struct {
+
+ // 实例id集合
+ InstanceIds []string `json:"instance_ids"`
+}
+
+func (o SimplifiedInstancesRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SimplifiedInstancesRequest struct{}"
+ }
+
+ return strings.Join([]string{"SimplifiedInstancesRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_single2_ha.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_single2_ha.go
new file mode 100644
index 0000000000..b6cccd4f0c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_single2_ha.go
@@ -0,0 +1,20 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type Single2Ha struct {
+ SingleToHa *Single2HaObject `json:"single_to_ha"`
+}
+
+func (o Single2Ha) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "Single2Ha struct{}"
+ }
+
+ return strings.Join([]string{"Single2Ha", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_single2_ha_object.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_single2_ha_object.go
new file mode 100644
index 0000000000..3229edcca7
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_single2_ha_object.go
@@ -0,0 +1,31 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// Single2HaObject 单机转主备时必填。
+type Single2HaObject struct {
+
+ // 实例节点可用区码(AZ)。
+ AzCodeNewNode string `json:"az_code_new_node"`
+
+ // Dec用户专属存储ID,每个az配置的专属存储不同,实例节点所在专属存储ID,仅支持DEC用户创建时使用。
+ DsspoolId *string `json:"dsspool_id,omitempty"`
+
+ // 仅包周期实例进行单机转主备时可指定,表示是否自动从客户的账户中支付。 - true,为自动支付。 - false,为手动支付,默认该方式。
+ IsAutoPay *bool `json:"is_auto_pay,omitempty"`
+
+ AdDomainInfo *AdDomainInfo `json:"ad_domain_info,omitempty"`
+}
+
+func (o Single2HaObject) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "Single2HaObject struct{}"
+ }
+
+ return strings.Join([]string{"Single2HaObject", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slave_instance.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slave_instance.go
new file mode 100644
index 0000000000..e8331e30c7
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slave_instance.go
@@ -0,0 +1,32 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SlaveInstance 容灾实例信息。
+type SlaveInstance struct {
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 区域。
+ Region string `json:"region"`
+
+ // 项目ID。
+ ProjectId string `json:"project_id"`
+
+ // 项目名称。
+ ProjectName string `json:"project_name"`
+}
+
+func (o SlaveInstance) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SlaveInstance struct{}"
+ }
+
+ return strings.Join([]string{"SlaveInstance", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slow_log.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slow_log.go
new file mode 100644
index 0000000000..6dfa30b991
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slow_log.go
@@ -0,0 +1,53 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SlowLog 慢日志信息。
+type SlowLog struct {
+
+ // 执行次数。
+ Count string `json:"count"`
+
+ // 平均执行时间。
+ Time string `json:"time"`
+
+ // 平均等待锁时间。
+ LockTime string `json:"lock_time"`
+
+ // 平均结果行数量。
+ RowsSent string `json:"rows_sent"`
+
+ // 平均扫描的行数量。
+ RowsExamined string `json:"rows_examined"`
+
+ // 所属数据库。
+ Database string `json:"database"`
+
+ // 帐号。
+ Users string `json:"users"`
+
+ // 执行语法。
+ QuerySample string `json:"query_sample"`
+
+ // 语句类型。
+ Type string `json:"type"`
+
+ // 发生时间,UTC时间。
+ StartTime string `json:"start_time"`
+
+ // IP地址。
+ ClientIp string `json:"client_ip"`
+}
+
+func (o SlowLog) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SlowLog struct{}"
+ }
+
+ return strings.Join([]string{"SlowLog", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slow_log_file.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slow_log_file.go
new file mode 100644
index 0000000000..1ae268a826
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slow_log_file.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SlowLogFile 慢日志信息。
+type SlowLogFile struct {
+
+ // 文件名。
+ FileName string `json:"file_name"`
+
+ // 文件大小(单位Byte)
+ FileSize string `json:"file_size"`
+}
+
+func (o SlowLogFile) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SlowLogFile struct{}"
+ }
+
+ return strings.Join([]string{"SlowLogFile", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slow_log_statistics.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slow_log_statistics.go
new file mode 100644
index 0000000000..8361825f1f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slow_log_statistics.go
@@ -0,0 +1,50 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SlowLogStatistics 慢日志信息。
+type SlowLogStatistics struct {
+
+ // 执行次数。
+ Count string `json:"count"`
+
+ // 平均执行时间。
+ Time string `json:"time"`
+
+ // 平均等待锁时间。
+ LockTime string `json:"lockTime"`
+
+ // 平均结果行数量。
+ RowsSent int64 `json:"rowsSent"`
+
+ // 平均扫描的行数量。
+ RowsExamined int64 `json:"rowsExamined"`
+
+ // 所属数据库。
+ Database string `json:"database"`
+
+ // 帐号。
+ Users string `json:"users"`
+
+ // 执行语法。
+ QuerySample string `json:"querySample"`
+
+ // 语句类型。
+ Type string `json:"type"`
+
+ // IP地址。
+ ClientIP string `json:"clientIP"`
+}
+
+func (o SlowLogStatistics) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SlowLogStatistics struct{}"
+ }
+
+ return strings.Join([]string{"SlowLogStatistics", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slow_log_statistics_for_lts_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slow_log_statistics_for_lts_request.go
new file mode 100644
index 0000000000..80b7c6044b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slow_log_statistics_for_lts_request.go
@@ -0,0 +1,157 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// SlowLogStatisticsForLtsRequest 查询实例的慢日志对象
+type SlowLogStatisticsForLtsRequest struct {
+
+ // 开始日期,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ StartTime string `json:"start_time"`
+
+ // 结束时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。只能查询当前时间前一个月内的慢日志。
+ EndTime string `json:"end_time"`
+
+ // 索引位置,偏移量。默认为0,表示从第一条数据开始查询。
+ Offset *int32 `json:"offset,omitempty"`
+
+ // 每页多少条记录(查询结果),取值范围是1~100,不填时默认为10。
+ Limit *int32 `json:"limit,omitempty"`
+
+ // 语句类型,取空值,表示查询所有语句类型。
+ Type *SlowLogStatisticsForLtsRequestType `json:"type,omitempty"`
+
+ // 数据库名称。
+ Database *string `json:"database,omitempty"`
+
+ // 指定排序字段。\"executeTime\",表示按照执行时间降序排序。字段为空或传入其他值,表示按照执行次数降序排序。
+ Sort *string `json:"sort,omitempty"`
+
+ // 排序顺序。默认desc。
+ Order *SlowLogStatisticsForLtsRequestOrder `json:"order,omitempty"`
+}
+
+func (o SlowLogStatisticsForLtsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SlowLogStatisticsForLtsRequest struct{}"
+ }
+
+ return strings.Join([]string{"SlowLogStatisticsForLtsRequest", string(data)}, " ")
+}
+
+type SlowLogStatisticsForLtsRequestType struct {
+ value string
+}
+
+type SlowLogStatisticsForLtsRequestTypeEnum struct {
+ INSERT SlowLogStatisticsForLtsRequestType
+ UPDATE SlowLogStatisticsForLtsRequestType
+ SELECT SlowLogStatisticsForLtsRequestType
+ DELETE SlowLogStatisticsForLtsRequestType
+ CREATE SlowLogStatisticsForLtsRequestType
+ ALL SlowLogStatisticsForLtsRequestType
+}
+
+func GetSlowLogStatisticsForLtsRequestTypeEnum() SlowLogStatisticsForLtsRequestTypeEnum {
+ return SlowLogStatisticsForLtsRequestTypeEnum{
+ INSERT: SlowLogStatisticsForLtsRequestType{
+ value: "INSERT",
+ },
+ UPDATE: SlowLogStatisticsForLtsRequestType{
+ value: "UPDATE",
+ },
+ SELECT: SlowLogStatisticsForLtsRequestType{
+ value: "SELECT",
+ },
+ DELETE: SlowLogStatisticsForLtsRequestType{
+ value: "DELETE",
+ },
+ CREATE: SlowLogStatisticsForLtsRequestType{
+ value: "CREATE",
+ },
+ ALL: SlowLogStatisticsForLtsRequestType{
+ value: "ALL",
+ },
+ }
+}
+
+func (c SlowLogStatisticsForLtsRequestType) Value() string {
+ return c.value
+}
+
+func (c SlowLogStatisticsForLtsRequestType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *SlowLogStatisticsForLtsRequestType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
+
+type SlowLogStatisticsForLtsRequestOrder struct {
+ value string
+}
+
+type SlowLogStatisticsForLtsRequestOrderEnum struct {
+ DESC SlowLogStatisticsForLtsRequestOrder
+ ASC SlowLogStatisticsForLtsRequestOrder
+}
+
+func GetSlowLogStatisticsForLtsRequestOrderEnum() SlowLogStatisticsForLtsRequestOrderEnum {
+ return SlowLogStatisticsForLtsRequestOrderEnum{
+ DESC: SlowLogStatisticsForLtsRequestOrder{
+ value: "desc",
+ },
+ ASC: SlowLogStatisticsForLtsRequestOrder{
+ value: "asc",
+ },
+ }
+}
+
+func (c SlowLogStatisticsForLtsRequestOrder) Value() string {
+ return c.value
+}
+
+func (c SlowLogStatisticsForLtsRequestOrder) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *SlowLogStatisticsForLtsRequestOrder) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slowlog_download_info.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slowlog_download_info.go
new file mode 100644
index 0000000000..ed4fb28728
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slowlog_download_info.go
@@ -0,0 +1,40 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type SlowlogDownloadInfo struct {
+
+ // 任务ID
+ WorkflowId string `json:"workflow_id"`
+
+ // 生成的下载文件名
+ FileName string `json:"file_name"`
+
+ // 生成链接的生成状态
+ Status string `json:"status"`
+
+ // 文件大小
+ FileSize string `json:"file_size"`
+
+ // 下载链接
+ FileLink string `json:"file_link"`
+
+ // 生成时间
+ CreateAt int64 `json:"create_at"`
+
+ // 更新时间
+ UpdateAt int64 `json:"update_at"`
+}
+
+func (o SlowlogDownloadInfo) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SlowlogDownloadInfo struct{}"
+ }
+
+ return strings.Join([]string{"SlowlogDownloadInfo", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slowlog_download_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slowlog_download_request.go
new file mode 100644
index 0000000000..34bb62ffd8
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slowlog_download_request.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type SlowlogDownloadRequest struct {
+
+ // - 需要下载的文件的文件名, 当引擎为SQL Server时为必选。
+ FileName *string `json:"file_name,omitempty"`
+}
+
+func (o SlowlogDownloadRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SlowlogDownloadRequest struct{}"
+ }
+
+ return strings.Join([]string{"SlowlogDownloadRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slowlog_for_lts_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slowlog_for_lts_request.go
new file mode 100644
index 0000000000..67e9730a94
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_slowlog_for_lts_request.go
@@ -0,0 +1,150 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// SlowlogForLtsRequest 查询实例的慢日志对象
+type SlowlogForLtsRequest struct {
+
+ // 开始日期,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。
+ StartTime string `json:"start_time"`
+
+ // 结束时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。只能查询当前时间前一个月内的慢日志。
+ EndTime string `json:"end_time"`
+
+ // 语句类型,取空值,表示查询所有语句类型。
+ Type *SlowlogForLtsRequestType `json:"type,omitempty"`
+
+ // 日志单行序列号,第一次查询时不需要此参数,后续分页查询时需要使用,可从上次查询的返回信息中获取。line_num应在start_time和end_time之间。
+ LineNum *string `json:"line_num,omitempty"`
+
+ // 每页多少条记录(查询结果),取值范围是1~100,不填时默认为10。
+ Limit *int32 `json:"limit,omitempty"`
+
+ // 搜索方式。默认forwards。配合line_num使用,以line_num为起点,向前搜索或向后搜索。
+ SearchType *SlowlogForLtsRequestSearchType `json:"search_type,omitempty"`
+
+ // 数据库名称。
+ Database *string `json:"database,omitempty"`
+}
+
+func (o SlowlogForLtsRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SlowlogForLtsRequest struct{}"
+ }
+
+ return strings.Join([]string{"SlowlogForLtsRequest", string(data)}, " ")
+}
+
+type SlowlogForLtsRequestType struct {
+ value string
+}
+
+type SlowlogForLtsRequestTypeEnum struct {
+ INSERT SlowlogForLtsRequestType
+ UPDATE SlowlogForLtsRequestType
+ SELECT SlowlogForLtsRequestType
+ DELETE SlowlogForLtsRequestType
+ CREATE SlowlogForLtsRequestType
+}
+
+func GetSlowlogForLtsRequestTypeEnum() SlowlogForLtsRequestTypeEnum {
+ return SlowlogForLtsRequestTypeEnum{
+ INSERT: SlowlogForLtsRequestType{
+ value: "INSERT",
+ },
+ UPDATE: SlowlogForLtsRequestType{
+ value: "UPDATE",
+ },
+ SELECT: SlowlogForLtsRequestType{
+ value: "SELECT",
+ },
+ DELETE: SlowlogForLtsRequestType{
+ value: "DELETE",
+ },
+ CREATE: SlowlogForLtsRequestType{
+ value: "CREATE",
+ },
+ }
+}
+
+func (c SlowlogForLtsRequestType) Value() string {
+ return c.value
+}
+
+func (c SlowlogForLtsRequestType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *SlowlogForLtsRequestType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
+
+type SlowlogForLtsRequestSearchType struct {
+ value string
+}
+
+type SlowlogForLtsRequestSearchTypeEnum struct {
+ FORWARDS SlowlogForLtsRequestSearchType
+ BACKWARDS SlowlogForLtsRequestSearchType
+}
+
+func GetSlowlogForLtsRequestSearchTypeEnum() SlowlogForLtsRequestSearchTypeEnum {
+ return SlowlogForLtsRequestSearchTypeEnum{
+ FORWARDS: SlowlogForLtsRequestSearchType{
+ value: "forwards",
+ },
+ BACKWARDS: SlowlogForLtsRequestSearchType{
+ value: "backwards",
+ },
+ }
+}
+
+func (c SlowlogForLtsRequestSearchType) Value() string {
+ return c.value
+}
+
+func (c SlowlogForLtsRequestSearchType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *SlowlogForLtsRequestSearchType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_sqlserver_database_for_creation.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_sqlserver_database_for_creation.go
new file mode 100644
index 0000000000..40e276b1c7
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_sqlserver_database_for_creation.go
@@ -0,0 +1,23 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SqlserverDatabaseForCreation 数据库信息。
+type SqlserverDatabaseForCreation struct {
+
+ // 数据库名称。 数据库名称长度可在1~64个字符之间,由字母、数字、中划线或下划线组成,不能包含其他特殊字符,且不能以RDS for SQL Server系统库开头或结尾。 RDS for SQL Server系统库包括master,msdb,model,tempdb,resource以及rdsadmin。
+ Name string `json:"name"`
+}
+
+func (o SqlserverDatabaseForCreation) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SqlserverDatabaseForCreation struct{}"
+ }
+
+ return strings.Join([]string{"SqlserverDatabaseForCreation", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_sqlserver_database_for_detail.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_sqlserver_database_for_detail.go
new file mode 100644
index 0000000000..80295120c7
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_sqlserver_database_for_detail.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SqlserverDatabaseForDetail 数据库信息。
+type SqlserverDatabaseForDetail struct {
+
+ // 数据库名称。
+ Name string `json:"name"`
+
+ // 数据库使用的字符集,例如Chinese_PRC_CI_AS等。
+ CharacterSet string `json:"character_set"`
+
+ // 数据库状态。取值如下: Creating:表示创建中。 Running:表示使用中。 Deleting:表示删除中。 NotExists:表示不存在。
+ State string `json:"state"`
+}
+
+func (o SqlserverDatabaseForDetail) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SqlserverDatabaseForDetail struct{}"
+ }
+
+ return strings.Join([]string{"SqlserverDatabaseForDetail", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_sqlserver_grant_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_sqlserver_grant_request.go
new file mode 100644
index 0000000000..f0bc5cf422
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_sqlserver_grant_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type SqlserverGrantRequest struct {
+
+ // 数据库名称。
+ DbName string `json:"db_name"`
+
+ // 每个元素都是与数据库相关联的帐号。单次请求最多支持50个元素。
+ Users []SqlserverUserWithPrivilege `json:"users"`
+}
+
+func (o SqlserverGrantRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SqlserverGrantRequest struct{}"
+ }
+
+ return strings.Join([]string{"SqlserverGrantRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_sqlserver_revoke_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_sqlserver_revoke_request.go
new file mode 100644
index 0000000000..f12bc77ac3
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_sqlserver_revoke_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type SqlserverRevokeRequest struct {
+
+ // 数据库名称。
+ DbName string `json:"db_name"`
+
+ // 每个元素都是与数据库相关联的帐号。单次请求最多支持50个元素。
+ Users []SqlserverUserWithPrivilege `json:"users"`
+}
+
+func (o SqlserverRevokeRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SqlserverRevokeRequest struct{}"
+ }
+
+ return strings.Join([]string{"SqlserverRevokeRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_sqlserver_user_for_creation.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_sqlserver_user_for_creation.go
new file mode 100644
index 0000000000..cf1e5513bf
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_sqlserver_user_for_creation.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type SqlserverUserForCreation struct {
+
+ // 数据库用户名称。 数据库帐号名称在1到128个字符之间,不能和系统用户名称相同。 系统用户包括:rdsadmin, rdsuser, rdsbackup, rdsmirror。
+ Name string `json:"name"`
+
+ // 数据库帐号密码。 取值范围:非空,密码长度在8到128个字符之间,至少包含大写字母、小写字母、数字、特殊字符三种字符的组合。 建议您输入高强度密码,以提高安全性,防止出现密码被暴力破解等安全风险。
+ Password string `json:"password"`
+}
+
+func (o SqlserverUserForCreation) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SqlserverUserForCreation struct{}"
+ }
+
+ return strings.Join([]string{"SqlserverUserForCreation", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_sqlserver_user_with_privilege.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_sqlserver_user_with_privilege.go
new file mode 100644
index 0000000000..45e4a7ea6a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_sqlserver_user_with_privilege.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SqlserverUserWithPrivilege 数据库帐号名称。 数据库帐号名称在1到128个字符之间,不能和系统用户名称相同。 系统用户包括:rdsadmin, rdsuser, rdsbackup, rdsmirror。
+type SqlserverUserWithPrivilege struct {
+
+ // 数据库帐号名称。
+ Name string `json:"name"`
+
+ // 是否为只读权限。
+ Readonly *bool `json:"readonly,omitempty"`
+}
+
+func (o SqlserverUserWithPrivilege) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SqlserverUserWithPrivilege struct{}"
+ }
+
+ return strings.Join([]string{"SqlserverUserWithPrivilege", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_ssl_option_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_ssl_option_request.go
new file mode 100644
index 0000000000..5cfc15afd4
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_ssl_option_request.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type SslOptionRequest struct {
+
+ // - true, 打开ssl开关。 - false, 关闭ssl开关。
+ SslOption bool `json:"ssl_option"`
+}
+
+func (o SslOptionRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SslOptionRequest struct{}"
+ }
+
+ return strings.Join([]string{"SslOptionRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_database_proxy_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_database_proxy_request.go
new file mode 100644
index 0000000000..935a78f818
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_database_proxy_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// StartDatabaseProxyRequest Request Object
+type StartDatabaseProxyRequest struct {
+
+ // 语言
+ XLanguage *StartDatabaseProxyRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *OpenProxyRequest `json:"body,omitempty"`
+}
+
+func (o StartDatabaseProxyRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "StartDatabaseProxyRequest struct{}"
+ }
+
+ return strings.Join([]string{"StartDatabaseProxyRequest", string(data)}, " ")
+}
+
+type StartDatabaseProxyRequestXLanguage struct {
+ value string
+}
+
+type StartDatabaseProxyRequestXLanguageEnum struct {
+ ZH_CN StartDatabaseProxyRequestXLanguage
+ EN_US StartDatabaseProxyRequestXLanguage
+}
+
+func GetStartDatabaseProxyRequestXLanguageEnum() StartDatabaseProxyRequestXLanguageEnum {
+ return StartDatabaseProxyRequestXLanguageEnum{
+ ZH_CN: StartDatabaseProxyRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: StartDatabaseProxyRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c StartDatabaseProxyRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c StartDatabaseProxyRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *StartDatabaseProxyRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_database_proxy_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_database_proxy_response.go
new file mode 100644
index 0000000000..ce253becc5
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_database_proxy_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// StartDatabaseProxyResponse Response Object
+type StartDatabaseProxyResponse struct {
+
+ // 工作流ID
+ WorkflowId *string `json:"workflow_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o StartDatabaseProxyResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "StartDatabaseProxyResponse struct{}"
+ }
+
+ return strings.Join([]string{"StartDatabaseProxyResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_failover_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_failover_request.go
new file mode 100644
index 0000000000..6dba503d3c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_failover_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// StartFailoverRequest Request Object
+type StartFailoverRequest struct {
+
+ // 语言
+ XLanguage *StartFailoverRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *FailoverRequest `json:"body,omitempty"`
+}
+
+func (o StartFailoverRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "StartFailoverRequest struct{}"
+ }
+
+ return strings.Join([]string{"StartFailoverRequest", string(data)}, " ")
+}
+
+type StartFailoverRequestXLanguage struct {
+ value string
+}
+
+type StartFailoverRequestXLanguageEnum struct {
+ ZH_CN StartFailoverRequestXLanguage
+ EN_US StartFailoverRequestXLanguage
+}
+
+func GetStartFailoverRequestXLanguageEnum() StartFailoverRequestXLanguageEnum {
+ return StartFailoverRequestXLanguageEnum{
+ ZH_CN: StartFailoverRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: StartFailoverRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c StartFailoverRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c StartFailoverRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *StartFailoverRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_failover_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_failover_response.go
new file mode 100644
index 0000000000..5abef02b3f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_failover_response.go
@@ -0,0 +1,30 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// StartFailoverResponse Response Object
+type StartFailoverResponse struct {
+
+ // 实例Id
+ InstanceId *string `json:"instanceId,omitempty"`
+
+ // 节点Id
+ NodeId *string `json:"nodeId,omitempty"`
+
+ // 任务Id
+ WorkflowId *string `json:"workflowId,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o StartFailoverResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "StartFailoverResponse struct{}"
+ }
+
+ return strings.Join([]string{"StartFailoverResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_instance_enlarge_volume_action_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_instance_enlarge_volume_action_request.go
new file mode 100644
index 0000000000..7b27ad985f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_instance_enlarge_volume_action_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// StartInstanceEnlargeVolumeActionRequest Request Object
+type StartInstanceEnlargeVolumeActionRequest struct {
+
+ // 语言
+ XLanguage *StartInstanceEnlargeVolumeActionRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *EnlargeVolumeRequestBody `json:"body,omitempty"`
+}
+
+func (o StartInstanceEnlargeVolumeActionRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "StartInstanceEnlargeVolumeActionRequest struct{}"
+ }
+
+ return strings.Join([]string{"StartInstanceEnlargeVolumeActionRequest", string(data)}, " ")
+}
+
+type StartInstanceEnlargeVolumeActionRequestXLanguage struct {
+ value string
+}
+
+type StartInstanceEnlargeVolumeActionRequestXLanguageEnum struct {
+ ZH_CN StartInstanceEnlargeVolumeActionRequestXLanguage
+ EN_US StartInstanceEnlargeVolumeActionRequestXLanguage
+}
+
+func GetStartInstanceEnlargeVolumeActionRequestXLanguageEnum() StartInstanceEnlargeVolumeActionRequestXLanguageEnum {
+ return StartInstanceEnlargeVolumeActionRequestXLanguageEnum{
+ ZH_CN: StartInstanceEnlargeVolumeActionRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: StartInstanceEnlargeVolumeActionRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c StartInstanceEnlargeVolumeActionRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c StartInstanceEnlargeVolumeActionRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *StartInstanceEnlargeVolumeActionRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_instance_enlarge_volume_action_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_instance_enlarge_volume_action_response.go
new file mode 100644
index 0000000000..5c5b693258
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_instance_enlarge_volume_action_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// StartInstanceEnlargeVolumeActionResponse Response Object
+type StartInstanceEnlargeVolumeActionResponse struct {
+
+ // 任务ID。
+ JobId *string `json:"job_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o StartInstanceEnlargeVolumeActionResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "StartInstanceEnlargeVolumeActionResponse struct{}"
+ }
+
+ return strings.Join([]string{"StartInstanceEnlargeVolumeActionResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_instance_restart_action_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_instance_restart_action_request.go
new file mode 100644
index 0000000000..bb255f920a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_instance_restart_action_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// StartInstanceRestartActionRequest Request Object
+type StartInstanceRestartActionRequest struct {
+
+ // 语言
+ XLanguage *StartInstanceRestartActionRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *InstanceRestartRequsetBody `json:"body,omitempty"`
+}
+
+func (o StartInstanceRestartActionRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "StartInstanceRestartActionRequest struct{}"
+ }
+
+ return strings.Join([]string{"StartInstanceRestartActionRequest", string(data)}, " ")
+}
+
+type StartInstanceRestartActionRequestXLanguage struct {
+ value string
+}
+
+type StartInstanceRestartActionRequestXLanguageEnum struct {
+ ZH_CN StartInstanceRestartActionRequestXLanguage
+ EN_US StartInstanceRestartActionRequestXLanguage
+}
+
+func GetStartInstanceRestartActionRequestXLanguageEnum() StartInstanceRestartActionRequestXLanguageEnum {
+ return StartInstanceRestartActionRequestXLanguageEnum{
+ ZH_CN: StartInstanceRestartActionRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: StartInstanceRestartActionRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c StartInstanceRestartActionRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c StartInstanceRestartActionRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *StartInstanceRestartActionRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_instance_restart_action_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_instance_restart_action_response.go
new file mode 100644
index 0000000000..06871a05d2
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_instance_restart_action_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// StartInstanceRestartActionResponse Response Object
+type StartInstanceRestartActionResponse struct {
+
+ // 任务ID。
+ JobId *string `json:"job_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o StartInstanceRestartActionResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "StartInstanceRestartActionResponse struct{}"
+ }
+
+ return strings.Join([]string{"StartInstanceRestartActionResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_instance_single_to_ha_action_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_instance_single_to_ha_action_request.go
new file mode 100644
index 0000000000..1a7401f73e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_instance_single_to_ha_action_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// StartInstanceSingleToHaActionRequest Request Object
+type StartInstanceSingleToHaActionRequest struct {
+
+ // 语言
+ XLanguage *StartInstanceSingleToHaActionRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *Single2Ha `json:"body,omitempty"`
+}
+
+func (o StartInstanceSingleToHaActionRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "StartInstanceSingleToHaActionRequest struct{}"
+ }
+
+ return strings.Join([]string{"StartInstanceSingleToHaActionRequest", string(data)}, " ")
+}
+
+type StartInstanceSingleToHaActionRequestXLanguage struct {
+ value string
+}
+
+type StartInstanceSingleToHaActionRequestXLanguageEnum struct {
+ ZH_CN StartInstanceSingleToHaActionRequestXLanguage
+ EN_US StartInstanceSingleToHaActionRequestXLanguage
+}
+
+func GetStartInstanceSingleToHaActionRequestXLanguageEnum() StartInstanceSingleToHaActionRequestXLanguageEnum {
+ return StartInstanceSingleToHaActionRequestXLanguageEnum{
+ ZH_CN: StartInstanceSingleToHaActionRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: StartInstanceSingleToHaActionRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c StartInstanceSingleToHaActionRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c StartInstanceSingleToHaActionRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *StartInstanceSingleToHaActionRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_instance_single_to_ha_action_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_instance_single_to_ha_action_response.go
new file mode 100644
index 0000000000..d4959c3992
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_instance_single_to_ha_action_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// StartInstanceSingleToHaActionResponse Response Object
+type StartInstanceSingleToHaActionResponse struct {
+
+ // 任务ID。
+ JobId *string `json:"job_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o StartInstanceSingleToHaActionResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "StartInstanceSingleToHaActionResponse struct{}"
+ }
+
+ return strings.Join([]string{"StartInstanceSingleToHaActionResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_recycle_policy_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_recycle_policy_request.go
new file mode 100644
index 0000000000..bf40a73577
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_recycle_policy_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// StartRecyclePolicyRequest Request Object
+type StartRecyclePolicyRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ Body *RecyclePolicyRequestBody `json:"body,omitempty"`
+}
+
+func (o StartRecyclePolicyRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "StartRecyclePolicyRequest struct{}"
+ }
+
+ return strings.Join([]string{"StartRecyclePolicyRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_recycle_policy_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_recycle_policy_response.go
new file mode 100644
index 0000000000..369faad31c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_recycle_policy_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// StartRecyclePolicyResponse Response Object
+type StartRecyclePolicyResponse struct {
+
+ // 操作结果。
+ Result *string `json:"result,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o StartRecyclePolicyResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "StartRecyclePolicyResponse struct{}"
+ }
+
+ return strings.Join([]string{"StartRecyclePolicyResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_resize_flavor_action_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_resize_flavor_action_request.go
new file mode 100644
index 0000000000..9de99c9632
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_resize_flavor_action_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// StartResizeFlavorActionRequest Request Object
+type StartResizeFlavorActionRequest struct {
+
+ // 语言
+ XLanguage *StartResizeFlavorActionRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *ResizeFlavorRequest `json:"body,omitempty"`
+}
+
+func (o StartResizeFlavorActionRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "StartResizeFlavorActionRequest struct{}"
+ }
+
+ return strings.Join([]string{"StartResizeFlavorActionRequest", string(data)}, " ")
+}
+
+type StartResizeFlavorActionRequestXLanguage struct {
+ value string
+}
+
+type StartResizeFlavorActionRequestXLanguageEnum struct {
+ ZH_CN StartResizeFlavorActionRequestXLanguage
+ EN_US StartResizeFlavorActionRequestXLanguage
+}
+
+func GetStartResizeFlavorActionRequestXLanguageEnum() StartResizeFlavorActionRequestXLanguageEnum {
+ return StartResizeFlavorActionRequestXLanguageEnum{
+ ZH_CN: StartResizeFlavorActionRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: StartResizeFlavorActionRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c StartResizeFlavorActionRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c StartResizeFlavorActionRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *StartResizeFlavorActionRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_resize_flavor_action_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_resize_flavor_action_response.go
new file mode 100644
index 0000000000..7cb5a6aca4
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_start_resize_flavor_action_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// StartResizeFlavorActionResponse Response Object
+type StartResizeFlavorActionResponse struct {
+
+ // 任务ID。
+ JobId *string `json:"job_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o StartResizeFlavorActionResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "StartResizeFlavorActionResponse struct{}"
+ }
+
+ return strings.Join([]string{"StartResizeFlavorActionResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_startup_instance_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_startup_instance_request.go
new file mode 100644
index 0000000000..0643114809
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_startup_instance_request.go
@@ -0,0 +1,76 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// StartupInstanceRequest Request Object
+type StartupInstanceRequest struct {
+
+ // 语言
+ XLanguage *StartupInstanceRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+}
+
+func (o StartupInstanceRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "StartupInstanceRequest struct{}"
+ }
+
+ return strings.Join([]string{"StartupInstanceRequest", string(data)}, " ")
+}
+
+type StartupInstanceRequestXLanguage struct {
+ value string
+}
+
+type StartupInstanceRequestXLanguageEnum struct {
+ ZH_CN StartupInstanceRequestXLanguage
+ EN_US StartupInstanceRequestXLanguage
+}
+
+func GetStartupInstanceRequestXLanguageEnum() StartupInstanceRequestXLanguageEnum {
+ return StartupInstanceRequestXLanguageEnum{
+ ZH_CN: StartupInstanceRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: StartupInstanceRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c StartupInstanceRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c StartupInstanceRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *StartupInstanceRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_startup_instance_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_startup_instance_response.go
new file mode 100644
index 0000000000..b3f5fcf330
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_startup_instance_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// StartupInstanceResponse Response Object
+type StartupInstanceResponse struct {
+
+ // 任务ID。
+ JobId *string `json:"job_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o StartupInstanceResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "StartupInstanceResponse struct{}"
+ }
+
+ return strings.Join([]string{"StartupInstanceResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_stop_database_proxy_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_stop_database_proxy_request.go
new file mode 100644
index 0000000000..4b9b2b5cdb
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_stop_database_proxy_request.go
@@ -0,0 +1,76 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// StopDatabaseProxyRequest Request Object
+type StopDatabaseProxyRequest struct {
+
+ // 语言
+ XLanguage *StopDatabaseProxyRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+}
+
+func (o StopDatabaseProxyRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "StopDatabaseProxyRequest struct{}"
+ }
+
+ return strings.Join([]string{"StopDatabaseProxyRequest", string(data)}, " ")
+}
+
+type StopDatabaseProxyRequestXLanguage struct {
+ value string
+}
+
+type StopDatabaseProxyRequestXLanguageEnum struct {
+ ZH_CN StopDatabaseProxyRequestXLanguage
+ EN_US StopDatabaseProxyRequestXLanguage
+}
+
+func GetStopDatabaseProxyRequestXLanguageEnum() StopDatabaseProxyRequestXLanguageEnum {
+ return StopDatabaseProxyRequestXLanguageEnum{
+ ZH_CN: StopDatabaseProxyRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: StopDatabaseProxyRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c StopDatabaseProxyRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c StopDatabaseProxyRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *StopDatabaseProxyRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_stop_database_proxy_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_stop_database_proxy_response.go
new file mode 100644
index 0000000000..8f20819365
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_stop_database_proxy_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// StopDatabaseProxyResponse Response Object
+type StopDatabaseProxyResponse struct {
+
+ // 工作流ID
+ WorkflowId *string `json:"workflow_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o StopDatabaseProxyResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "StopDatabaseProxyResponse struct{}"
+ }
+
+ return strings.Join([]string{"StopDatabaseProxyResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_stop_instance_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_stop_instance_request.go
new file mode 100644
index 0000000000..3bee05d2a8
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_stop_instance_request.go
@@ -0,0 +1,76 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// StopInstanceRequest Request Object
+type StopInstanceRequest struct {
+
+ // 语言
+ XLanguage *StopInstanceRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+}
+
+func (o StopInstanceRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "StopInstanceRequest struct{}"
+ }
+
+ return strings.Join([]string{"StopInstanceRequest", string(data)}, " ")
+}
+
+type StopInstanceRequestXLanguage struct {
+ value string
+}
+
+type StopInstanceRequestXLanguageEnum struct {
+ ZH_CN StopInstanceRequestXLanguage
+ EN_US StopInstanceRequestXLanguage
+}
+
+func GetStopInstanceRequestXLanguageEnum() StopInstanceRequestXLanguageEnum {
+ return StopInstanceRequestXLanguageEnum{
+ ZH_CN: StopInstanceRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: StopInstanceRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c StopInstanceRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c StopInstanceRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *StopInstanceRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_stop_instance_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_stop_instance_response.go
new file mode 100644
index 0000000000..285e45b985
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_stop_instance_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// StopInstanceResponse Response Object
+type StopInstanceResponse struct {
+
+ // 任务ID。
+ JobId *string `json:"job_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o StopInstanceResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "StopInstanceResponse struct{}"
+ }
+
+ return strings.Join([]string{"StopInstanceResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_storage.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_storage.go
new file mode 100644
index 0000000000..a719488b53
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_storage.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// Storage 实例磁盘类型信息。
+type Storage struct {
+
+ // 磁盘类型名称,可能取值如下: - ULTRAHIGH:表示SSD。 - LOCALSSD:表示本地SSD。 - CLOUDSSD:表示SSD云盘,仅支持通用型和独享型规格实例。 - ESSD:表示极速型SSD,仅支持独享型规格实例。
+ Name string `json:"name"`
+
+ // 其中key是可用区编号,value是规格所在az的状态,包含以下状态: - normal,在售。 - unsupported,暂不支持该规格。 - sellout,售罄。
+ AzStatus map[string]string `json:"az_status"`
+
+ // 性能规格,包含以下状态: - normal:通用增强型。 - normal2:通用增强Ⅱ型。 - armFlavors:鲲鹏通用增强型。 - dedicicatenormal :x86独享型。 - armlocalssd:鲲鹏通用型。 - normallocalssd:x86通用型。 - general:通用型。 - dedicated:独享型,仅云盘SSD支持。 - rapid:独享型,仅极速型SSD支持。 - bigmen:超大内存型。
+ SupportComputeGroupType *[]string `json:"support_compute_group_type,omitempty"`
+}
+
+func (o Storage) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "Storage struct{}"
+ }
+
+ return strings.Join([]string{"Storage", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_support_fast_restore_list.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_support_fast_restore_list.go
new file mode 100644
index 0000000000..8e48e6ec20
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_support_fast_restore_list.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type SupportFastRestoreList struct {
+
+ // 实例id。
+ InstanceId *string `json:"instance_id,omitempty"`
+
+ // 表级恢复是否支持极速恢复。
+ IsSupportFastTableRestore *bool `json:"is_support_fast_table_restore,omitempty"`
+
+ // 库级恢复是否支持极速恢复。
+ IsSupportFastDatabaseRestore *bool `json:"is_support_fast_database_restore,omitempty"`
+}
+
+func (o SupportFastRestoreList) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SupportFastRestoreList struct{}"
+ }
+
+ return strings.Join([]string{"SupportFastRestoreList", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_switch_ssl_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_switch_ssl_request.go
new file mode 100644
index 0000000000..9405b50483
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_switch_ssl_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// SwitchSslRequest Request Object
+type SwitchSslRequest struct {
+
+ // 语言
+ XLanguage *SwitchSslRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *SslOptionRequest `json:"body,omitempty"`
+}
+
+func (o SwitchSslRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SwitchSslRequest struct{}"
+ }
+
+ return strings.Join([]string{"SwitchSslRequest", string(data)}, " ")
+}
+
+type SwitchSslRequestXLanguage struct {
+ value string
+}
+
+type SwitchSslRequestXLanguageEnum struct {
+ ZH_CN SwitchSslRequestXLanguage
+ EN_US SwitchSslRequestXLanguage
+}
+
+func GetSwitchSslRequestXLanguageEnum() SwitchSslRequestXLanguageEnum {
+ return SwitchSslRequestXLanguageEnum{
+ ZH_CN: SwitchSslRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: SwitchSslRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c SwitchSslRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c SwitchSslRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *SwitchSslRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_switch_ssl_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_switch_ssl_response.go
new file mode 100644
index 0000000000..3521a55811
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_switch_ssl_response.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// SwitchSslResponse Response Object
+type SwitchSslResponse struct {
+ HttpStatusCode int `json:"-"`
+}
+
+func (o SwitchSslResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "SwitchSslResponse struct{}"
+ }
+
+ return strings.Join([]string{"SwitchSslResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_tag_del_with_key_value.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_tag_del_with_key_value.go
new file mode 100644
index 0000000000..b8d9f1fc8b
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_tag_del_with_key_value.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// TagDelWithKeyValue 键值对标签。
+type TagDelWithKeyValue struct {
+
+ // 标签键。最大长度127个unicode字符。 key不能为空,不能为空字符串。
+ Key string `json:"key"`
+
+ // 标签值。每个值最大长度255个unicode字符。 删除说明如下: - 如果“value”有值,按照“key”/“value”删除。 - 如果“value”没值,则按照“key”删除。
+ Value *string `json:"value,omitempty"`
+}
+
+func (o TagDelWithKeyValue) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "TagDelWithKeyValue struct{}"
+ }
+
+ return strings.Join([]string{"TagDelWithKeyValue", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_tag_resp.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_tag_resp.go
new file mode 100644
index 0000000000..159ca2bd73
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_tag_resp.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type TagResp struct {
+
+ // 标签的key
+ Key string `json:"key"`
+
+ // 标签value的集合
+ Values []string `json:"values"`
+}
+
+func (o TagResp) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "TagResp struct{}"
+ }
+
+ return strings.Join([]string{"TagResp", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_tag_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_tag_response.go
new file mode 100644
index 0000000000..838da63445
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_tag_response.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// TagResponse 标签信息。
+type TagResponse struct {
+
+ // 标签键。
+ Key string `json:"key"`
+
+ // 标签值。
+ Value string `json:"value"`
+}
+
+func (o TagResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "TagResponse struct{}"
+ }
+
+ return strings.Join([]string{"TagResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_tag_with_key_value.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_tag_with_key_value.go
new file mode 100644
index 0000000000..04c2a28b26
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_tag_with_key_value.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// TagWithKeyValue 键值对标签。
+type TagWithKeyValue struct {
+
+ // 标签键。长度为1-128个unicode字符。 可以包含任何语种字母、数字、空格和_.:=+-@, 但首尾不能含有空格,不能以sys开头。
+ Key string `json:"key"`
+
+ // 标签值。最大长度255个unicode字符。 可以为空字符串。可以包含任何语种字母、数字、空格和_.:=+-@,
+ Value string `json:"value"`
+}
+
+func (o TagWithKeyValue) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "TagWithKeyValue struct{}"
+ }
+
+ return strings.Join([]string{"TagWithKeyValue", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_target_instance_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_target_instance_request.go
new file mode 100644
index 0000000000..533b879b0a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_target_instance_request.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type TargetInstanceRequest struct {
+
+ // 实例ID
+ InstanceId string `json:"instance_id"`
+}
+
+func (o TargetInstanceRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "TargetInstanceRequest struct{}"
+ }
+
+ return strings.Join([]string{"TargetInstanceRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_unchangeable_param.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_unchangeable_param.go
new file mode 100644
index 0000000000..5645d4dcdf
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_unchangeable_param.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type UnchangeableParam struct {
+
+ // 表名大小写是否敏感,默认值是“1”,当前仅MySQL 8.0支持。 取值范围: - 0:表名被存储成固定且表名称大小写敏感。 - 1:表名将被存储成小写且表名称大小写不敏感。
+ LowerCaseTableNames *string `json:"lower_case_table_names,omitempty"`
+}
+
+func (o UnchangeableParam) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UnchangeableParam struct{}"
+ }
+
+ return strings.Join([]string{"UnchangeableParam", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_configuration_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_configuration_request.go
new file mode 100644
index 0000000000..46bcd1a8e0
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_configuration_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdateConfigurationRequest Request Object
+type UpdateConfigurationRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 参数模板ID。
+ ConfigId string `json:"config_id"`
+
+ Body *ConfigurationForUpdate `json:"body,omitempty"`
+}
+
+func (o UpdateConfigurationRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateConfigurationRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpdateConfigurationRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_configuration_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_configuration_response.go
new file mode 100644
index 0000000000..d3b9da583a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_configuration_response.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdateConfigurationResponse Response Object
+type UpdateConfigurationResponse struct {
+ Configuration *UpdateConfigurationRspConfiguration `json:"configuration,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o UpdateConfigurationResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateConfigurationResponse struct{}"
+ }
+
+ return strings.Join([]string{"UpdateConfigurationResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_configuration_rsp_configuration.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_configuration_rsp_configuration.go
new file mode 100644
index 0000000000..2014843327
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_configuration_rsp_configuration.go
@@ -0,0 +1,29 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdateConfigurationRspConfiguration 参数模板信息
+type UpdateConfigurationRspConfiguration struct {
+
+ // 参数模板ID。
+ Id *string `json:"id,omitempty"`
+
+ // 参数模板名称。
+ Name *string `json:"name,omitempty"`
+
+ // 请求参数“values”中被忽略掉,没有生效的参数名称列表。 当参数不存在时,参数修改不会下发,并通过此参数返回所有被忽略的参数名称。
+ IgnoredParams *[]string `json:"ignored_params,omitempty"`
+}
+
+func (o UpdateConfigurationRspConfiguration) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateConfigurationRspConfiguration struct{}"
+ }
+
+ return strings.Join([]string{"UpdateConfigurationRspConfiguration", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_data_ip_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_data_ip_request.go
new file mode 100644
index 0000000000..fd5c78a33a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_data_ip_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// UpdateDataIpRequest Request Object
+type UpdateDataIpRequest struct {
+
+ // 语言
+ XLanguage *UpdateDataIpRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *DataIpRequest `json:"body,omitempty"`
+}
+
+func (o UpdateDataIpRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateDataIpRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpdateDataIpRequest", string(data)}, " ")
+}
+
+type UpdateDataIpRequestXLanguage struct {
+ value string
+}
+
+type UpdateDataIpRequestXLanguageEnum struct {
+ ZH_CN UpdateDataIpRequestXLanguage
+ EN_US UpdateDataIpRequestXLanguage
+}
+
+func GetUpdateDataIpRequestXLanguageEnum() UpdateDataIpRequestXLanguageEnum {
+ return UpdateDataIpRequestXLanguageEnum{
+ ZH_CN: UpdateDataIpRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: UpdateDataIpRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c UpdateDataIpRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c UpdateDataIpRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *UpdateDataIpRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_data_ip_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_data_ip_response.go
new file mode 100644
index 0000000000..d5c06b262a
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_data_ip_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdateDataIpResponse Response Object
+type UpdateDataIpResponse struct {
+
+ // 任务ID
+ WorkflowId *string `json:"workflowId,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o UpdateDataIpResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateDataIpResponse struct{}"
+ }
+
+ return strings.Join([]string{"UpdateDataIpResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_database_req.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_database_req.go
new file mode 100644
index 0000000000..270cda0c36
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_database_req.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type UpdateDatabaseReq struct {
+
+ // 数据库名称。
+ Name string `json:"name"`
+
+ // 数据库备注。
+ Comment *string `json:"comment,omitempty"`
+}
+
+func (o UpdateDatabaseReq) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateDatabaseReq struct{}"
+ }
+
+ return strings.Join([]string{"UpdateDatabaseReq", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_database_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_database_request.go
new file mode 100644
index 0000000000..bb9361b15c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_database_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// UpdateDatabaseRequest Request Object
+type UpdateDatabaseRequest struct {
+
+ // 语言
+ XLanguage *UpdateDatabaseRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *UpdateDatabaseReq `json:"body,omitempty"`
+}
+
+func (o UpdateDatabaseRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateDatabaseRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpdateDatabaseRequest", string(data)}, " ")
+}
+
+type UpdateDatabaseRequestXLanguage struct {
+ value string
+}
+
+type UpdateDatabaseRequestXLanguageEnum struct {
+ ZH_CN UpdateDatabaseRequestXLanguage
+ EN_US UpdateDatabaseRequestXLanguage
+}
+
+func GetUpdateDatabaseRequestXLanguageEnum() UpdateDatabaseRequestXLanguageEnum {
+ return UpdateDatabaseRequestXLanguageEnum{
+ ZH_CN: UpdateDatabaseRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: UpdateDatabaseRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c UpdateDatabaseRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c UpdateDatabaseRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *UpdateDatabaseRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_database_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_database_response.go
new file mode 100644
index 0000000000..683d05a885
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_database_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdateDatabaseResponse Response Object
+type UpdateDatabaseResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o UpdateDatabaseResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateDatabaseResponse struct{}"
+ }
+
+ return strings.Join([]string{"UpdateDatabaseResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_db_port_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_db_port_request.go
new file mode 100644
index 0000000000..f5a1c37e93
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_db_port_request.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type UpdateDbPortRequest struct {
+
+ // MySQL端口号范围:大于等于1024,小于等于65535,不包含12017和33071。
+ Port int32 `json:"port"`
+}
+
+func (o UpdateDbPortRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateDbPortRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpdateDbPortRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_db_user_comment_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_db_user_comment_request.go
new file mode 100644
index 0000000000..3181b10752
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_db_user_comment_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdateDbUserCommentRequest Request Object
+type UpdateDbUserCommentRequest struct {
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 数据库用户名。
+ UserName string `json:"user_name"`
+
+ Body *UpdateDbUserReq `json:"body,omitempty"`
+}
+
+func (o UpdateDbUserCommentRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateDbUserCommentRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpdateDbUserCommentRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_db_user_comment_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_db_user_comment_response.go
new file mode 100644
index 0000000000..6bd215a8e9
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_db_user_comment_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdateDbUserCommentResponse Response Object
+type UpdateDbUserCommentResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o UpdateDbUserCommentResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateDbUserCommentResponse struct{}"
+ }
+
+ return strings.Join([]string{"UpdateDbUserCommentResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_db_user_privilege_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_db_user_privilege_request.go
new file mode 100644
index 0000000000..9b40582156
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_db_user_privilege_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdateDbUserPrivilegeRequest Request Object
+type UpdateDbUserPrivilegeRequest struct {
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *DbUserPrivilegeRequest `json:"body,omitempty"`
+}
+
+func (o UpdateDbUserPrivilegeRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateDbUserPrivilegeRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpdateDbUserPrivilegeRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_db_user_privilege_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_db_user_privilege_response.go
new file mode 100644
index 0000000000..a7db53c6c5
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_db_user_privilege_response.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdateDbUserPrivilegeResponse Response Object
+type UpdateDbUserPrivilegeResponse struct {
+ HttpStatusCode int `json:"-"`
+}
+
+func (o UpdateDbUserPrivilegeResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateDbUserPrivilegeResponse struct{}"
+ }
+
+ return strings.Join([]string{"UpdateDbUserPrivilegeResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_db_user_req.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_db_user_req.go
new file mode 100644
index 0000000000..8a0ca62f59
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_db_user_req.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type UpdateDbUserReq struct {
+
+ // 数据库用户备注。
+ Comment *string `json:"comment,omitempty"`
+}
+
+func (o UpdateDbUserReq) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateDbUserReq struct{}"
+ }
+
+ return strings.Join([]string{"UpdateDbUserReq", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_dns_name_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_dns_name_request.go
new file mode 100644
index 0000000000..71cccf2ccb
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_dns_name_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// UpdateDnsNameRequest Request Object
+type UpdateDnsNameRequest struct {
+
+ // 语言
+ XLanguage *UpdateDnsNameRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *ModifyDnsNameRequestBody `json:"body,omitempty"`
+}
+
+func (o UpdateDnsNameRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateDnsNameRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpdateDnsNameRequest", string(data)}, " ")
+}
+
+type UpdateDnsNameRequestXLanguage struct {
+ value string
+}
+
+type UpdateDnsNameRequestXLanguageEnum struct {
+ ZH_CN UpdateDnsNameRequestXLanguage
+ EN_US UpdateDnsNameRequestXLanguage
+}
+
+func GetUpdateDnsNameRequestXLanguageEnum() UpdateDnsNameRequestXLanguageEnum {
+ return UpdateDnsNameRequestXLanguageEnum{
+ ZH_CN: UpdateDnsNameRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: UpdateDnsNameRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c UpdateDnsNameRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c UpdateDnsNameRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *UpdateDnsNameRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_dns_name_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_dns_name_response.go
new file mode 100644
index 0000000000..32f4576e65
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_dns_name_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdateDnsNameResponse Response Object
+type UpdateDnsNameResponse struct {
+
+ // 任务ID。
+ JobId *string `json:"job_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o UpdateDnsNameResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateDnsNameResponse struct{}"
+ }
+
+ return strings.Join([]string{"UpdateDnsNameResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_configuration_async_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_configuration_async_request.go
new file mode 100644
index 0000000000..d02a5f0dff
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_configuration_async_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdateInstanceConfigurationAsyncRequest Request Object
+type UpdateInstanceConfigurationAsyncRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *UpdateInstanceConfigurationRequestBody `json:"body,omitempty"`
+}
+
+func (o UpdateInstanceConfigurationAsyncRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateInstanceConfigurationAsyncRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpdateInstanceConfigurationAsyncRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_configuration_async_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_configuration_async_response.go
new file mode 100644
index 0000000000..d6b226b2a8
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_configuration_async_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdateInstanceConfigurationAsyncResponse Response Object
+type UpdateInstanceConfigurationAsyncResponse struct {
+
+ // 任务流id
+ JobId *string `json:"job_id,omitempty"`
+
+ // 实例是否需要重启。 - “true”需要重启。 - “false”不需要重启。
+ RestartRequired *bool `json:"restart_required,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o UpdateInstanceConfigurationAsyncResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateInstanceConfigurationAsyncResponse struct{}"
+ }
+
+ return strings.Join([]string{"UpdateInstanceConfigurationAsyncResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_configuration_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_configuration_request.go
new file mode 100644
index 0000000000..d195524ded
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_configuration_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdateInstanceConfigurationRequest Request Object
+type UpdateInstanceConfigurationRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *UpdateInstanceConfigurationRequestBody `json:"body,omitempty"`
+}
+
+func (o UpdateInstanceConfigurationRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateInstanceConfigurationRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpdateInstanceConfigurationRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_configuration_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_configuration_request_body.go
new file mode 100644
index 0000000000..ecf10f48a5
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_configuration_request_body.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type UpdateInstanceConfigurationRequestBody struct {
+
+ // 参数值对象,用户基于默认参数模板自定义的参数值。为空时不修改参数值。 - key:参数名称,\"max_connections\":\"10\"。为空时不修改参数值,key不为空时value也不可为空。 - value:参数值,\"max_connections\":\"10\"。
+ Values map[string]string `json:"values"`
+}
+
+func (o UpdateInstanceConfigurationRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateInstanceConfigurationRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"UpdateInstanceConfigurationRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_configuration_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_configuration_response.go
new file mode 100644
index 0000000000..e1bf2be848
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_configuration_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdateInstanceConfigurationResponse Response Object
+type UpdateInstanceConfigurationResponse struct {
+
+ // 实例是否需要重启。 - “true”需要重启。 - “false”不需要重启。
+ RestartRequired *bool `json:"restart_required,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o UpdateInstanceConfigurationResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateInstanceConfigurationResponse struct{}"
+ }
+
+ return strings.Join([]string{"UpdateInstanceConfigurationResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_name_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_name_request.go
new file mode 100644
index 0000000000..8f7a85725e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_name_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// UpdateInstanceNameRequest Request Object
+type UpdateInstanceNameRequest struct {
+
+ // 语言
+ XLanguage *UpdateInstanceNameRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *ModifiyInstanceNameRequest `json:"body,omitempty"`
+}
+
+func (o UpdateInstanceNameRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateInstanceNameRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpdateInstanceNameRequest", string(data)}, " ")
+}
+
+type UpdateInstanceNameRequestXLanguage struct {
+ value string
+}
+
+type UpdateInstanceNameRequestXLanguageEnum struct {
+ ZH_CN UpdateInstanceNameRequestXLanguage
+ EN_US UpdateInstanceNameRequestXLanguage
+}
+
+func GetUpdateInstanceNameRequestXLanguageEnum() UpdateInstanceNameRequestXLanguageEnum {
+ return UpdateInstanceNameRequestXLanguageEnum{
+ ZH_CN: UpdateInstanceNameRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: UpdateInstanceNameRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c UpdateInstanceNameRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c UpdateInstanceNameRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *UpdateInstanceNameRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_name_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_name_response.go
new file mode 100644
index 0000000000..d739593a94
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_instance_name_response.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdateInstanceNameResponse Response Object
+type UpdateInstanceNameResponse struct {
+ HttpStatusCode int `json:"-"`
+}
+
+func (o UpdateInstanceNameResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateInstanceNameResponse struct{}"
+ }
+
+ return strings.Join([]string{"UpdateInstanceNameResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_port_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_port_request.go
new file mode 100644
index 0000000000..4cccee477c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_port_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// UpdatePortRequest Request Object
+type UpdatePortRequest struct {
+
+ // 语言
+ XLanguage *UpdatePortRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *UpdateDbPortRequest `json:"body,omitempty"`
+}
+
+func (o UpdatePortRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdatePortRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpdatePortRequest", string(data)}, " ")
+}
+
+type UpdatePortRequestXLanguage struct {
+ value string
+}
+
+type UpdatePortRequestXLanguageEnum struct {
+ ZH_CN UpdatePortRequestXLanguage
+ EN_US UpdatePortRequestXLanguage
+}
+
+func GetUpdatePortRequestXLanguageEnum() UpdatePortRequestXLanguageEnum {
+ return UpdatePortRequestXLanguageEnum{
+ ZH_CN: UpdatePortRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: UpdatePortRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c UpdatePortRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c UpdatePortRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *UpdatePortRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_port_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_port_response.go
new file mode 100644
index 0000000000..d79ebb2a48
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_port_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdatePortResponse Response Object
+type UpdatePortResponse struct {
+
+ // 任务ID
+ WorkflowId *string `json:"workflowId,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o UpdatePortResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdatePortResponse struct{}"
+ }
+
+ return strings.Join([]string{"UpdatePortResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_database_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_database_request.go
new file mode 100644
index 0000000000..889de19775
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_database_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// UpdatePostgresqlDatabaseRequest Request Object
+type UpdatePostgresqlDatabaseRequest struct {
+
+ // 语言
+ XLanguage *UpdatePostgresqlDatabaseRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *UpdateDatabaseReq `json:"body,omitempty"`
+}
+
+func (o UpdatePostgresqlDatabaseRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdatePostgresqlDatabaseRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpdatePostgresqlDatabaseRequest", string(data)}, " ")
+}
+
+type UpdatePostgresqlDatabaseRequestXLanguage struct {
+ value string
+}
+
+type UpdatePostgresqlDatabaseRequestXLanguageEnum struct {
+ ZH_CN UpdatePostgresqlDatabaseRequestXLanguage
+ EN_US UpdatePostgresqlDatabaseRequestXLanguage
+}
+
+func GetUpdatePostgresqlDatabaseRequestXLanguageEnum() UpdatePostgresqlDatabaseRequestXLanguageEnum {
+ return UpdatePostgresqlDatabaseRequestXLanguageEnum{
+ ZH_CN: UpdatePostgresqlDatabaseRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: UpdatePostgresqlDatabaseRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c UpdatePostgresqlDatabaseRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c UpdatePostgresqlDatabaseRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *UpdatePostgresqlDatabaseRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_database_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_database_response.go
new file mode 100644
index 0000000000..a4828a25a4
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_database_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdatePostgresqlDatabaseResponse Response Object
+type UpdatePostgresqlDatabaseResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o UpdatePostgresqlDatabaseResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdatePostgresqlDatabaseResponse struct{}"
+ }
+
+ return strings.Join([]string{"UpdatePostgresqlDatabaseResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_db_user_comment_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_db_user_comment_request.go
new file mode 100644
index 0000000000..030a308695
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_db_user_comment_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdatePostgresqlDbUserCommentRequest Request Object
+type UpdatePostgresqlDbUserCommentRequest struct {
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 数据库用户名。
+ UserName string `json:"user_name"`
+
+ Body *UpdateDbUserReq `json:"body,omitempty"`
+}
+
+func (o UpdatePostgresqlDbUserCommentRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdatePostgresqlDbUserCommentRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpdatePostgresqlDbUserCommentRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_db_user_comment_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_db_user_comment_response.go
new file mode 100644
index 0000000000..234a4f5c84
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_db_user_comment_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdatePostgresqlDbUserCommentResponse Response Object
+type UpdatePostgresqlDbUserCommentResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o UpdatePostgresqlDbUserCommentResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdatePostgresqlDbUserCommentResponse struct{}"
+ }
+
+ return strings.Join([]string{"UpdatePostgresqlDbUserCommentResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_instance_alias_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_instance_alias_request.go
new file mode 100644
index 0000000000..2f59a7cbf1
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_instance_alias_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdatePostgresqlInstanceAliasRequest Request Object
+type UpdatePostgresqlInstanceAliasRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *UpdateRdsInstanceAliasRequest `json:"body,omitempty"`
+}
+
+func (o UpdatePostgresqlInstanceAliasRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdatePostgresqlInstanceAliasRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpdatePostgresqlInstanceAliasRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_instance_alias_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_instance_alias_response.go
new file mode 100644
index 0000000000..6d238ecbf7
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_instance_alias_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdatePostgresqlInstanceAliasResponse Response Object
+type UpdatePostgresqlInstanceAliasResponse struct {
+
+ // 操作结果。
+ Resp *string `json:"resp,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o UpdatePostgresqlInstanceAliasResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdatePostgresqlInstanceAliasResponse struct{}"
+ }
+
+ return strings.Join([]string{"UpdatePostgresqlInstanceAliasResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_parameter_value_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_parameter_value_request.go
new file mode 100644
index 0000000000..936d3e15fd
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_parameter_value_request.go
@@ -0,0 +1,31 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdatePostgresqlParameterValueRequest Request Object
+type UpdatePostgresqlParameterValueRequest struct {
+
+ // 语言
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ // 参数名称。
+ Name string `json:"name"`
+
+ Body *ModifyParamRequest `json:"body,omitempty"`
+}
+
+func (o UpdatePostgresqlParameterValueRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdatePostgresqlParameterValueRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpdatePostgresqlParameterValueRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_parameter_value_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_parameter_value_response.go
new file mode 100644
index 0000000000..dd59645534
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_postgresql_parameter_value_response.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdatePostgresqlParameterValueResponse Response Object
+type UpdatePostgresqlParameterValueResponse struct {
+
+ // 任务ID。
+ JobId *string `json:"job_id,omitempty"`
+
+ // 实例是否需要重启。 - “true”需要重启。 - “false”不需要重启。
+ RestartRequired *bool `json:"restart_required,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o UpdatePostgresqlParameterValueResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdatePostgresqlParameterValueResponse struct{}"
+ }
+
+ return strings.Join([]string{"UpdatePostgresqlParameterValueResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_rds_instance_alias_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_rds_instance_alias_request.go
new file mode 100644
index 0000000000..c316c2da67
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_rds_instance_alias_request.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type UpdateRdsInstanceAliasRequest struct {
+
+ // 长度可在0~64个字符之间,由字母、数字、汉字、英文句号、下划线、中划线组成。此参数为空时可以清空原有备注。
+ Alias *string `json:"alias,omitempty"`
+}
+
+func (o UpdateRdsInstanceAliasRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateRdsInstanceAliasRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpdateRdsInstanceAliasRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_read_weight_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_read_weight_request.go
new file mode 100644
index 0000000000..096e5a1522
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_read_weight_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// UpdateReadWeightRequest Request Object
+type UpdateReadWeightRequest struct {
+
+ // 语言
+ XLanguage *UpdateReadWeightRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *ModifyProxyWeightRequest `json:"body,omitempty"`
+}
+
+func (o UpdateReadWeightRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateReadWeightRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpdateReadWeightRequest", string(data)}, " ")
+}
+
+type UpdateReadWeightRequestXLanguage struct {
+ value string
+}
+
+type UpdateReadWeightRequestXLanguageEnum struct {
+ ZH_CN UpdateReadWeightRequestXLanguage
+ EN_US UpdateReadWeightRequestXLanguage
+}
+
+func GetUpdateReadWeightRequestXLanguageEnum() UpdateReadWeightRequestXLanguageEnum {
+ return UpdateReadWeightRequestXLanguageEnum{
+ ZH_CN: UpdateReadWeightRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: UpdateReadWeightRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c UpdateReadWeightRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c UpdateReadWeightRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *UpdateReadWeightRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_read_weight_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_read_weight_response.go
new file mode 100644
index 0000000000..668f1b7d0e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_read_weight_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdateReadWeightResponse Response Object
+type UpdateReadWeightResponse struct {
+
+ // 修改读写分离权重或延时阈值的结果。
+ Result *string `json:"result,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o UpdateReadWeightResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateReadWeightResponse struct{}"
+ }
+
+ return strings.Join([]string{"UpdateReadWeightResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_tde_status_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_tde_status_request.go
new file mode 100644
index 0000000000..c220cd509c
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_tde_status_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdateTdeStatusRequest Request Object
+type UpdateTdeStatusRequest struct {
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *UpdateTdeStatusRequestBody `json:"body,omitempty"`
+}
+
+func (o UpdateTdeStatusRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateTdeStatusRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpdateTdeStatusRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_tde_status_request_body.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_tde_status_request_body.go
new file mode 100644
index 0000000000..d89ca393d0
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_tde_status_request_body.go
@@ -0,0 +1,32 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdateTdeStatusRequestBody sqlserverTDE开关信息
+type UpdateTdeStatusRequestBody struct {
+
+ // 轮转天数
+ RotateDay *int32 `json:"rotate_day,omitempty"`
+
+ // 密钥ID
+ SecretId *string `json:"secret_id,omitempty"`
+
+ // 密钥名称
+ SecretName *string `json:"secret_name,omitempty"`
+
+ // 密钥版本
+ SecretVersion *string `json:"secret_version,omitempty"`
+}
+
+func (o UpdateTdeStatusRequestBody) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateTdeStatusRequestBody struct{}"
+ }
+
+ return strings.Join([]string{"UpdateTdeStatusRequestBody", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_tde_status_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_tde_status_response.go
new file mode 100644
index 0000000000..545fcd1386
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_update_tde_status_response.go
@@ -0,0 +1,21 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpdateTdeStatusResponse Response Object
+type UpdateTdeStatusResponse struct {
+ HttpStatusCode int `json:"-"`
+}
+
+func (o UpdateTdeStatusResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpdateTdeStatusResponse struct{}"
+ }
+
+ return strings.Join([]string{"UpdateTdeStatusResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_major_version_pre_check_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_major_version_pre_check_request.go
new file mode 100644
index 0000000000..064177f81d
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_major_version_pre_check_request.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpgradeDbMajorVersionPreCheckRequest Request Object
+type UpgradeDbMajorVersionPreCheckRequest struct {
+
+ // 实例ID
+ InstanceId string `json:"instance_id"`
+
+ // 语言。默认en-us。
+ XLanguage *string `json:"X-Language,omitempty"`
+
+ Body *PostgresqlPreCheckUpgradeMajorVersionReq `json:"body,omitempty"`
+}
+
+func (o UpgradeDbMajorVersionPreCheckRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpgradeDbMajorVersionPreCheckRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpgradeDbMajorVersionPreCheckRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_major_version_pre_check_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_major_version_pre_check_response.go
new file mode 100644
index 0000000000..07daa2ab32
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_major_version_pre_check_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpgradeDbMajorVersionPreCheckResponse Response Object
+type UpgradeDbMajorVersionPreCheckResponse struct {
+
+ // 检查报告ID。
+ ReportId *string `json:"report_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o UpgradeDbMajorVersionPreCheckResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpgradeDbMajorVersionPreCheckResponse struct{}"
+ }
+
+ return strings.Join([]string{"UpgradeDbMajorVersionPreCheckResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_major_version_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_major_version_request.go
new file mode 100644
index 0000000000..91ddab072e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_major_version_request.go
@@ -0,0 +1,25 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpgradeDbMajorVersionRequest Request Object
+type UpgradeDbMajorVersionRequest struct {
+
+ // 实例ID
+ InstanceId string `json:"instance_id"`
+
+ Body *UpgradePgMajorVersion `json:"body,omitempty"`
+}
+
+func (o UpgradeDbMajorVersionRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpgradeDbMajorVersionRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpgradeDbMajorVersionRequest", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_major_version_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_major_version_response.go
new file mode 100644
index 0000000000..fc7c1e1f81
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_major_version_response.go
@@ -0,0 +1,22 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpgradeDbMajorVersionResponse Response Object
+type UpgradeDbMajorVersionResponse struct {
+ Body *string `json:"body,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o UpgradeDbMajorVersionResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpgradeDbMajorVersionResponse struct{}"
+ }
+
+ return strings.Join([]string{"UpgradeDbMajorVersionResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_version_new_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_version_new_request.go
new file mode 100644
index 0000000000..461be2ec8e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_version_new_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// UpgradeDbVersionNewRequest Request Object
+type UpgradeDbVersionNewRequest struct {
+
+ // 语言
+ XLanguage *UpgradeDbVersionNewRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *CustomerUpgradeDatabaseVersionReqNew `json:"body,omitempty"`
+}
+
+func (o UpgradeDbVersionNewRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpgradeDbVersionNewRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpgradeDbVersionNewRequest", string(data)}, " ")
+}
+
+type UpgradeDbVersionNewRequestXLanguage struct {
+ value string
+}
+
+type UpgradeDbVersionNewRequestXLanguageEnum struct {
+ ZH_CN UpgradeDbVersionNewRequestXLanguage
+ EN_US UpgradeDbVersionNewRequestXLanguage
+}
+
+func GetUpgradeDbVersionNewRequestXLanguageEnum() UpgradeDbVersionNewRequestXLanguageEnum {
+ return UpgradeDbVersionNewRequestXLanguageEnum{
+ ZH_CN: UpgradeDbVersionNewRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: UpgradeDbVersionNewRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c UpgradeDbVersionNewRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c UpgradeDbVersionNewRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *UpgradeDbVersionNewRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_version_new_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_version_new_response.go
new file mode 100644
index 0000000000..d73014e323
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_version_new_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpgradeDbVersionNewResponse Response Object
+type UpgradeDbVersionNewResponse struct {
+
+ // 任务ID。
+ JobId *string `json:"job_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o UpgradeDbVersionNewResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpgradeDbVersionNewResponse struct{}"
+ }
+
+ return strings.Join([]string{"UpgradeDbVersionNewResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_version_request.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_version_request.go
new file mode 100644
index 0000000000..d7cb9d5667
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_version_request.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+// UpgradeDbVersionRequest Request Object
+type UpgradeDbVersionRequest struct {
+
+ // 语言
+ XLanguage *UpgradeDbVersionRequestXLanguage `json:"X-Language,omitempty"`
+
+ // 实例ID。
+ InstanceId string `json:"instance_id"`
+
+ Body *CustomerUpgradeDatabaseVersionReq `json:"body,omitempty"`
+}
+
+func (o UpgradeDbVersionRequest) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpgradeDbVersionRequest struct{}"
+ }
+
+ return strings.Join([]string{"UpgradeDbVersionRequest", string(data)}, " ")
+}
+
+type UpgradeDbVersionRequestXLanguage struct {
+ value string
+}
+
+type UpgradeDbVersionRequestXLanguageEnum struct {
+ ZH_CN UpgradeDbVersionRequestXLanguage
+ EN_US UpgradeDbVersionRequestXLanguage
+}
+
+func GetUpgradeDbVersionRequestXLanguageEnum() UpgradeDbVersionRequestXLanguageEnum {
+ return UpgradeDbVersionRequestXLanguageEnum{
+ ZH_CN: UpgradeDbVersionRequestXLanguage{
+ value: "zh-cn",
+ },
+ EN_US: UpgradeDbVersionRequestXLanguage{
+ value: "en-us",
+ },
+ }
+}
+
+func (c UpgradeDbVersionRequestXLanguage) Value() string {
+ return c.value
+}
+
+func (c UpgradeDbVersionRequestXLanguage) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *UpgradeDbVersionRequestXLanguage) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_version_response.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_version_response.go
new file mode 100644
index 0000000000..1ca2ed6a79
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_db_version_response.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UpgradeDbVersionResponse Response Object
+type UpgradeDbVersionResponse struct {
+
+ // 任务ID。
+ JobId *string `json:"job_id,omitempty"`
+ HttpStatusCode int `json:"-"`
+}
+
+func (o UpgradeDbVersionResponse) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpgradeDbVersionResponse struct{}"
+ }
+
+ return strings.Join([]string{"UpgradeDbVersionResponse", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_pg_major_version.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_pg_major_version.go
new file mode 100644
index 0000000000..aa35e8101f
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_pg_major_version.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type UpgradePgMajorVersion struct {
+
+ // 目标版本。 高于实例当前的大版本,如当前为12,目标版本需要是13或14。
+ TargetVersion string `json:"target_version"`
+
+ // 是否将实例内网IP切换到大版本实例 true:升级后切换当前实例的内网IP到大版本实例 false:升级后当前实例的内网IP不变,大版本实例使用新的内网IP
+ IsChangePrivateIp bool `json:"is_change_private_ip"`
+
+ // 统计信息收集方式。is_change_private_ip为true时必选 before_change_private_ip:将实例内网IP切换到大版本实例前收集 after_change_private_ip:将实例内网IP切换到大版本实例后收集
+ StatisticsCollectionMode string `json:"statistics_collection_mode"`
+}
+
+func (o UpgradePgMajorVersion) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpgradePgMajorVersion struct{}"
+ }
+
+ return strings.Join([]string{"UpgradePgMajorVersion", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_reports.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_reports.go
new file mode 100644
index 0000000000..388de8dd53
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_upgrade_reports.go
@@ -0,0 +1,55 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type UpgradeReports struct {
+
+ // 升级报告ID。
+ Id string `json:"id"`
+
+ // 升级开始时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如偏移1个小时显示为+0100。
+ StartTime string `json:"start_time"`
+
+ // 升级结束时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如偏移1个小时显示为+0100。
+ EndTime string `json:"end_time"`
+
+ // 原实例ID。
+ SrcInstanceId string `json:"src_instance_id"`
+
+ // 原数据库版本。
+ SrcDatabaseVersion string `json:"src_database_version"`
+
+ // 目标实例ID。
+ DstInstanceId string `json:"dst_instance_id"`
+
+ // 目标数据库版本。
+ DstDatabaseVersion string `json:"dst_database_version"`
+
+ // 升级结果。 success,表示成功。 failed,表示失败。 running, 表示升级中。
+ Result string `json:"result"`
+
+ // 实例内网IP是否改变。 true,表示改变。 false,表示不改变。
+ IsPrivateIpChanged bool `json:"is_private_ip_changed"`
+
+ // 实例内网IP修改时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如偏移1个小时显示为+0100。
+ PrivateIpChangeTime string `json:"private_ip_change_time"`
+
+ // 统计信息收集模式。 before_change_private_ip,修改实例内网IP前收集。 after_change_private_ip,修改实例内网IP后收集。
+ StatisticsCollectionMode string `json:"statistics_collection_mode"`
+
+ // 升级报告详情。
+ Detail string `json:"detail"`
+}
+
+func (o UpgradeReports) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UpgradeReports struct{}"
+ }
+
+ return strings.Join([]string{"UpgradeReports", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_user_for_creation.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_user_for_creation.go
new file mode 100644
index 0000000000..299be40579
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_user_for_creation.go
@@ -0,0 +1,34 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+type UserForCreation struct {
+
+ // 数据库用户名称。 数据库帐号名称在1到32个字符之间,由字母、数字、中划线或下划线组成,不能包含其他特殊字符。 - 若数据库版本为MySQL5.6,帐号长度为1~16个字符。 - 若数据库版本为MySQL5.7和8.0,帐号长度为1~32个字符。
+ Name string `json:"name"`
+
+ // 数据库帐号密码。 取值范围: 非空,由大小写字母、数字和特殊符号~!@#$%^*-_=+?,()&组成,长度8~32个字符,不能和数据库帐号“name”或“name”的逆序相同。 建议您输入高强度密码,以提高安全性,防止出现密码被暴力破解等安全风险。
+ Password string `json:"password"`
+
+ // 数据库用户备注。 取值范围:长度1~512个字符。目前仅支持MySQL 8.0.25及以上版本。
+ Comment *string `json:"comment,omitempty"`
+
+ // 授权用户登录主机IP列表 • 若IP地址为%,则表示允许所有地址访问MySQL实例。 • 若IP地址为“10.10.10.%”,则表示10.10.10.X的IP地址都可以访问该MySQL实例。 • 支持添加多个IP地址。
+ Hosts *[]string `json:"hosts,omitempty"`
+
+ // 授权用户数据库权限
+ Databases *[]DatabaseWithPrivilegeObject `json:"databases,omitempty"`
+}
+
+func (o UserForCreation) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UserForCreation struct{}"
+ }
+
+ return strings.Join([]string{"UserForCreation", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_user_for_list.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_user_for_list.go
new file mode 100644
index 0000000000..98a844886e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_user_for_list.go
@@ -0,0 +1,23 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UserForList 数据库用户信息。
+type UserForList struct {
+
+ // 数据库用户名称。
+ Name string `json:"name"`
+}
+
+func (o UserForList) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UserForList struct{}"
+ }
+
+ return strings.Join([]string{"UserForList", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_user_with_privilege.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_user_with_privilege.go
new file mode 100644
index 0000000000..4d08538206
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_user_with_privilege.go
@@ -0,0 +1,26 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "strings"
+)
+
+// UserWithPrivilege 用户及其权限。
+type UserWithPrivilege struct {
+
+ // 用户名。
+ Name string `json:"name"`
+
+ // 是否为只读权限。
+ Readonly bool `json:"readonly"`
+}
+
+func (o UserWithPrivilege) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "UserWithPrivilege struct{}"
+ }
+
+ return strings.Join([]string{"UserWithPrivilege", string(data)}, " ")
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_volume.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_volume.go
new file mode 100644
index 0000000000..bfdc4623d9
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model/model_volume.go
@@ -0,0 +1,99 @@
+package model
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
+
+ "errors"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
+
+ "strings"
+)
+
+type Volume struct {
+
+ // 磁盘类型。 取值范围如下,区分大小写: - COMMON,表示SATA。 - HIGH,表示SAS。 - ULTRAHIGH,表示SSD。 - ULTRAHIGHPRO,表示SSD尊享版,仅支持超高性能型尊享版(需申请权限)。 - CLOUDSSD,表示SSD云盘,仅支持通用型和独享型规格实例。 - LOCALSSD,表示本地SSD。 - ESSD,表示极速型SSD,仅支持独享型规格实例。
+ Type VolumeType `json:"type"`
+
+ // 磁盘大小,单位为GB。 取值范围:40GB~4000GB,必须为10的整数倍。 部分用户支持40GB~6000GB,如果您想创建存储空间最大为6000GB的数据库实例,或提高扩容上限到10000GB,请联系客服开通。 说明:对于只读实例,该参数无效,磁盘大小,默认和主实例相同。
+ Size int32 `json:"size"`
+}
+
+func (o Volume) String() string {
+ data, err := utils.Marshal(o)
+ if err != nil {
+ return "Volume struct{}"
+ }
+
+ return strings.Join([]string{"Volume", string(data)}, " ")
+}
+
+type VolumeType struct {
+ value string
+}
+
+type VolumeTypeEnum struct {
+ ULTRAHIGH VolumeType
+ HIGH VolumeType
+ COMMON VolumeType
+ NVMESSD VolumeType
+ ULTRAHIGHPRO VolumeType
+ CLOUDSSD VolumeType
+ LOCALSSD VolumeType
+ ESSD VolumeType
+}
+
+func GetVolumeTypeEnum() VolumeTypeEnum {
+ return VolumeTypeEnum{
+ ULTRAHIGH: VolumeType{
+ value: "ULTRAHIGH",
+ },
+ HIGH: VolumeType{
+ value: "HIGH",
+ },
+ COMMON: VolumeType{
+ value: "COMMON",
+ },
+ NVMESSD: VolumeType{
+ value: "NVMESSD",
+ },
+ ULTRAHIGHPRO: VolumeType{
+ value: "ULTRAHIGHPRO",
+ },
+ CLOUDSSD: VolumeType{
+ value: "CLOUDSSD",
+ },
+ LOCALSSD: VolumeType{
+ value: "LOCALSSD",
+ },
+ ESSD: VolumeType{
+ value: "ESSD",
+ },
+ }
+}
+
+func (c VolumeType) Value() string {
+ return c.value
+}
+
+func (c VolumeType) MarshalJSON() ([]byte, error) {
+ return utils.Marshal(c.value)
+}
+
+func (c *VolumeType) UnmarshalJSON(b []byte) error {
+ myConverter := converter.StringConverterFactory("string")
+ if myConverter == nil {
+ return errors.New("unsupported StringConverter type: string")
+ }
+
+ interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
+ if err != nil {
+ return err
+ }
+
+ if val, ok := interf.(string); ok {
+ c.value = val
+ return nil
+ } else {
+ return errors.New("convert enum data to string error")
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/rds_client.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/rds_client.go
new file mode 100644
index 0000000000..bc75952fa6
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/rds_client.go
@@ -0,0 +1,3835 @@
+package v3
+
+import (
+ http_client "github.com/huaweicloud/huaweicloud-sdk-go-v3/core"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model"
+)
+
+type RdsClient struct {
+ HcClient *http_client.HcHttpClient
+}
+
+func NewRdsClient(hcClient *http_client.HcHttpClient) *RdsClient {
+ return &RdsClient{HcClient: hcClient}
+}
+
+func RdsClientBuilder() *http_client.HcHttpClientBuilder {
+ builder := http_client.NewHcHttpClientBuilder()
+ return builder
+}
+
+// AddPostgresqlHbaConf 在pg_hba.conf文件最后新增单个或多个配置
+//
+// 以传入配置全量覆盖当前pg_hba.conf文件内容,入参为空时用默认配置覆盖当前文件内容
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) AddPostgresqlHbaConf(request *model.AddPostgresqlHbaConfRequest) (*model.AddPostgresqlHbaConfResponse, error) {
+ requestDef := GenReqDefForAddPostgresqlHbaConf()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.AddPostgresqlHbaConfResponse), nil
+ }
+}
+
+// AddPostgresqlHbaConfInvoker 在pg_hba.conf文件最后新增单个或多个配置
+func (c *RdsClient) AddPostgresqlHbaConfInvoker(request *model.AddPostgresqlHbaConfRequest) *AddPostgresqlHbaConfInvoker {
+ requestDef := GenReqDefForAddPostgresqlHbaConf()
+ return &AddPostgresqlHbaConfInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ApplyConfigurationAsync 应用参数模板
+//
+// 应用参数模板。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ApplyConfigurationAsync(request *model.ApplyConfigurationAsyncRequest) (*model.ApplyConfigurationAsyncResponse, error) {
+ requestDef := GenReqDefForApplyConfigurationAsync()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ApplyConfigurationAsyncResponse), nil
+ }
+}
+
+// ApplyConfigurationAsyncInvoker 应用参数模板
+func (c *RdsClient) ApplyConfigurationAsyncInvoker(request *model.ApplyConfigurationAsyncRequest) *ApplyConfigurationAsyncInvoker {
+ requestDef := GenReqDefForApplyConfigurationAsync()
+ return &ApplyConfigurationAsyncInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// AttachEip 绑定和解绑弹性公网IP
+//
+// 绑定和解绑弹性公网IP。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) AttachEip(request *model.AttachEipRequest) (*model.AttachEipResponse, error) {
+ requestDef := GenReqDefForAttachEip()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.AttachEipResponse), nil
+ }
+}
+
+// AttachEipInvoker 绑定和解绑弹性公网IP
+func (c *RdsClient) AttachEipInvoker(request *model.AttachEipRequest) *AttachEipInvoker {
+ requestDef := GenReqDefForAttachEip()
+ return &AttachEipInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// BatchDeleteManualBackup 批量删除手动备份
+//
+// 批量删除手动备份。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) BatchDeleteManualBackup(request *model.BatchDeleteManualBackupRequest) (*model.BatchDeleteManualBackupResponse, error) {
+ requestDef := GenReqDefForBatchDeleteManualBackup()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.BatchDeleteManualBackupResponse), nil
+ }
+}
+
+// BatchDeleteManualBackupInvoker 批量删除手动备份
+func (c *RdsClient) BatchDeleteManualBackupInvoker(request *model.BatchDeleteManualBackupRequest) *BatchDeleteManualBackupInvoker {
+ requestDef := GenReqDefForBatchDeleteManualBackup()
+ return &BatchDeleteManualBackupInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// BatchRestoreDatabase 库级时间点恢复
+//
+// 库级时间点恢复
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) BatchRestoreDatabase(request *model.BatchRestoreDatabaseRequest) (*model.BatchRestoreDatabaseResponse, error) {
+ requestDef := GenReqDefForBatchRestoreDatabase()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.BatchRestoreDatabaseResponse), nil
+ }
+}
+
+// BatchRestoreDatabaseInvoker 库级时间点恢复
+func (c *RdsClient) BatchRestoreDatabaseInvoker(request *model.BatchRestoreDatabaseRequest) *BatchRestoreDatabaseInvoker {
+ requestDef := GenReqDefForBatchRestoreDatabase()
+ return &BatchRestoreDatabaseInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// BatchRestorePostgreSqlTables 表级时间点恢复(PostgreSQL)
+//
+// 表级时间点恢复(PostgreSQL)
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) BatchRestorePostgreSqlTables(request *model.BatchRestorePostgreSqlTablesRequest) (*model.BatchRestorePostgreSqlTablesResponse, error) {
+ requestDef := GenReqDefForBatchRestorePostgreSqlTables()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.BatchRestorePostgreSqlTablesResponse), nil
+ }
+}
+
+// BatchRestorePostgreSqlTablesInvoker 表级时间点恢复(PostgreSQL)
+func (c *RdsClient) BatchRestorePostgreSqlTablesInvoker(request *model.BatchRestorePostgreSqlTablesRequest) *BatchRestorePostgreSqlTablesInvoker {
+ requestDef := GenReqDefForBatchRestorePostgreSqlTables()
+ return &BatchRestorePostgreSqlTablesInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// BatchTagAddAction 批量添加标签
+//
+// 批量添加标签。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) BatchTagAddAction(request *model.BatchTagAddActionRequest) (*model.BatchTagAddActionResponse, error) {
+ requestDef := GenReqDefForBatchTagAddAction()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.BatchTagAddActionResponse), nil
+ }
+}
+
+// BatchTagAddActionInvoker 批量添加标签
+func (c *RdsClient) BatchTagAddActionInvoker(request *model.BatchTagAddActionRequest) *BatchTagAddActionInvoker {
+ requestDef := GenReqDefForBatchTagAddAction()
+ return &BatchTagAddActionInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// BatchTagDelAction 批量删除标签
+//
+// 批量删除标签。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) BatchTagDelAction(request *model.BatchTagDelActionRequest) (*model.BatchTagDelActionResponse, error) {
+ requestDef := GenReqDefForBatchTagDelAction()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.BatchTagDelActionResponse), nil
+ }
+}
+
+// BatchTagDelActionInvoker 批量删除标签
+func (c *RdsClient) BatchTagDelActionInvoker(request *model.BatchTagDelActionRequest) *BatchTagDelActionInvoker {
+ requestDef := GenReqDefForBatchTagDelAction()
+ return &BatchTagDelActionInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ChangeFailoverMode 更改主备实例的数据同步方式
+//
+// 更改主备实例的数据同步方式。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ChangeFailoverMode(request *model.ChangeFailoverModeRequest) (*model.ChangeFailoverModeResponse, error) {
+ requestDef := GenReqDefForChangeFailoverMode()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ChangeFailoverModeResponse), nil
+ }
+}
+
+// ChangeFailoverModeInvoker 更改主备实例的数据同步方式
+func (c *RdsClient) ChangeFailoverModeInvoker(request *model.ChangeFailoverModeRequest) *ChangeFailoverModeInvoker {
+ requestDef := GenReqDefForChangeFailoverMode()
+ return &ChangeFailoverModeInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ChangeFailoverStrategy 切换主备实例的倒换策略
+//
+// 切换主备实例的倒换策略.
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ChangeFailoverStrategy(request *model.ChangeFailoverStrategyRequest) (*model.ChangeFailoverStrategyResponse, error) {
+ requestDef := GenReqDefForChangeFailoverStrategy()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ChangeFailoverStrategyResponse), nil
+ }
+}
+
+// ChangeFailoverStrategyInvoker 切换主备实例的倒换策略
+func (c *RdsClient) ChangeFailoverStrategyInvoker(request *model.ChangeFailoverStrategyRequest) *ChangeFailoverStrategyInvoker {
+ requestDef := GenReqDefForChangeFailoverStrategy()
+ return &ChangeFailoverStrategyInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ChangeOpsWindow 设置可维护时间段
+//
+// 设置可维护时间段
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ChangeOpsWindow(request *model.ChangeOpsWindowRequest) (*model.ChangeOpsWindowResponse, error) {
+ requestDef := GenReqDefForChangeOpsWindow()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ChangeOpsWindowResponse), nil
+ }
+}
+
+// ChangeOpsWindowInvoker 设置可维护时间段
+func (c *RdsClient) ChangeOpsWindowInvoker(request *model.ChangeOpsWindowRequest) *ChangeOpsWindowInvoker {
+ requestDef := GenReqDefForChangeOpsWindow()
+ return &ChangeOpsWindowInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// CopyConfiguration 复制参数模板
+//
+// 复制参数模板
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) CopyConfiguration(request *model.CopyConfigurationRequest) (*model.CopyConfigurationResponse, error) {
+ requestDef := GenReqDefForCopyConfiguration()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.CopyConfigurationResponse), nil
+ }
+}
+
+// CopyConfigurationInvoker 复制参数模板
+func (c *RdsClient) CopyConfigurationInvoker(request *model.CopyConfigurationRequest) *CopyConfigurationInvoker {
+ requestDef := GenReqDefForCopyConfiguration()
+ return &CopyConfigurationInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// CreateConfiguration 创建参数模板
+//
+// 创建参数模板。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) CreateConfiguration(request *model.CreateConfigurationRequest) (*model.CreateConfigurationResponse, error) {
+ requestDef := GenReqDefForCreateConfiguration()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.CreateConfigurationResponse), nil
+ }
+}
+
+// CreateConfigurationInvoker 创建参数模板
+func (c *RdsClient) CreateConfigurationInvoker(request *model.CreateConfigurationRequest) *CreateConfigurationInvoker {
+ requestDef := GenReqDefForCreateConfiguration()
+ return &CreateConfigurationInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// CreateDnsName 申请域名
+//
+// 申请域名
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) CreateDnsName(request *model.CreateDnsNameRequest) (*model.CreateDnsNameResponse, error) {
+ requestDef := GenReqDefForCreateDnsName()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.CreateDnsNameResponse), nil
+ }
+}
+
+// CreateDnsNameInvoker 申请域名
+func (c *RdsClient) CreateDnsNameInvoker(request *model.CreateDnsNameRequest) *CreateDnsNameInvoker {
+ requestDef := GenReqDefForCreateDnsName()
+ return &CreateDnsNameInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// CreateInstance 创建数据库实例
+//
+// 创建数据库实例。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) CreateInstance(request *model.CreateInstanceRequest) (*model.CreateInstanceResponse, error) {
+ requestDef := GenReqDefForCreateInstance()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.CreateInstanceResponse), nil
+ }
+}
+
+// CreateInstanceInvoker 创建数据库实例
+func (c *RdsClient) CreateInstanceInvoker(request *model.CreateInstanceRequest) *CreateInstanceInvoker {
+ requestDef := GenReqDefForCreateInstance()
+ return &CreateInstanceInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// CreateManualBackup 创建手动备份
+//
+// 创建手动备份。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) CreateManualBackup(request *model.CreateManualBackupRequest) (*model.CreateManualBackupResponse, error) {
+ requestDef := GenReqDefForCreateManualBackup()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.CreateManualBackupResponse), nil
+ }
+}
+
+// CreateManualBackupInvoker 创建手动备份
+func (c *RdsClient) CreateManualBackupInvoker(request *model.CreateManualBackupRequest) *CreateManualBackupInvoker {
+ requestDef := GenReqDefForCreateManualBackup()
+ return &CreateManualBackupInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// CreateRestoreInstance 恢复到新实例
+//
+// 恢复到新实例。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) CreateRestoreInstance(request *model.CreateRestoreInstanceRequest) (*model.CreateRestoreInstanceResponse, error) {
+ requestDef := GenReqDefForCreateRestoreInstance()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.CreateRestoreInstanceResponse), nil
+ }
+}
+
+// CreateRestoreInstanceInvoker 恢复到新实例
+func (c *RdsClient) CreateRestoreInstanceInvoker(request *model.CreateRestoreInstanceRequest) *CreateRestoreInstanceInvoker {
+ requestDef := GenReqDefForCreateRestoreInstance()
+ return &CreateRestoreInstanceInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// CreateXelLogDownload 获取扩展日志下载信息
+//
+// 获取扩展日志下载信息
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) CreateXelLogDownload(request *model.CreateXelLogDownloadRequest) (*model.CreateXelLogDownloadResponse, error) {
+ requestDef := GenReqDefForCreateXelLogDownload()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.CreateXelLogDownloadResponse), nil
+ }
+}
+
+// CreateXelLogDownloadInvoker 获取扩展日志下载信息
+func (c *RdsClient) CreateXelLogDownloadInvoker(request *model.CreateXelLogDownloadRequest) *CreateXelLogDownloadInvoker {
+ requestDef := GenReqDefForCreateXelLogDownload()
+ return &CreateXelLogDownloadInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// DeleteConfiguration 删除参数模板
+//
+// 删除参数模板。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) DeleteConfiguration(request *model.DeleteConfigurationRequest) (*model.DeleteConfigurationResponse, error) {
+ requestDef := GenReqDefForDeleteConfiguration()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.DeleteConfigurationResponse), nil
+ }
+}
+
+// DeleteConfigurationInvoker 删除参数模板
+func (c *RdsClient) DeleteConfigurationInvoker(request *model.DeleteConfigurationRequest) *DeleteConfigurationInvoker {
+ requestDef := GenReqDefForDeleteConfiguration()
+ return &DeleteConfigurationInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// DeleteInstance 删除数据库实例
+//
+// 删除数据库实例。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) DeleteInstance(request *model.DeleteInstanceRequest) (*model.DeleteInstanceResponse, error) {
+ requestDef := GenReqDefForDeleteInstance()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.DeleteInstanceResponse), nil
+ }
+}
+
+// DeleteInstanceInvoker 删除数据库实例
+func (c *RdsClient) DeleteInstanceInvoker(request *model.DeleteInstanceRequest) *DeleteInstanceInvoker {
+ requestDef := GenReqDefForDeleteInstance()
+ return &DeleteInstanceInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// DeleteJob 删除即时任务
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) DeleteJob(request *model.DeleteJobRequest) (*model.DeleteJobResponse, error) {
+ requestDef := GenReqDefForDeleteJob()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.DeleteJobResponse), nil
+ }
+}
+
+// DeleteJobInvoker 删除即时任务
+func (c *RdsClient) DeleteJobInvoker(request *model.DeleteJobRequest) *DeleteJobInvoker {
+ requestDef := GenReqDefForDeleteJob()
+ return &DeleteJobInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// DeleteManualBackup 删除手动备份
+//
+// 删除手动备份。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) DeleteManualBackup(request *model.DeleteManualBackupRequest) (*model.DeleteManualBackupResponse, error) {
+ requestDef := GenReqDefForDeleteManualBackup()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.DeleteManualBackupResponse), nil
+ }
+}
+
+// DeleteManualBackupInvoker 删除手动备份
+func (c *RdsClient) DeleteManualBackupInvoker(request *model.DeleteManualBackupRequest) *DeleteManualBackupInvoker {
+ requestDef := GenReqDefForDeleteManualBackup()
+ return &DeleteManualBackupInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// DeletePostgresqlHbaConf 删除pg_hba.conf文件的单个或多个配置
+//
+// 删除pg_hba.conf文件的单个或多个配置,以priority做唯一标识
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) DeletePostgresqlHbaConf(request *model.DeletePostgresqlHbaConfRequest) (*model.DeletePostgresqlHbaConfResponse, error) {
+ requestDef := GenReqDefForDeletePostgresqlHbaConf()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.DeletePostgresqlHbaConfResponse), nil
+ }
+}
+
+// DeletePostgresqlHbaConfInvoker 删除pg_hba.conf文件的单个或多个配置
+func (c *RdsClient) DeletePostgresqlHbaConfInvoker(request *model.DeletePostgresqlHbaConfRequest) *DeletePostgresqlHbaConfInvoker {
+ requestDef := GenReqDefForDeletePostgresqlHbaConf()
+ return &DeletePostgresqlHbaConfInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// DownloadSlowlog 获取慢日志下载链接
+//
+// 获取慢日志下载链接。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) DownloadSlowlog(request *model.DownloadSlowlogRequest) (*model.DownloadSlowlogResponse, error) {
+ requestDef := GenReqDefForDownloadSlowlog()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.DownloadSlowlogResponse), nil
+ }
+}
+
+// DownloadSlowlogInvoker 获取慢日志下载链接
+func (c *RdsClient) DownloadSlowlogInvoker(request *model.DownloadSlowlogRequest) *DownloadSlowlogInvoker {
+ requestDef := GenReqDefForDownloadSlowlog()
+ return &DownloadSlowlogInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// EnableConfiguration 应用参数模板
+//
+// 应用参数模板。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) EnableConfiguration(request *model.EnableConfigurationRequest) (*model.EnableConfigurationResponse, error) {
+ requestDef := GenReqDefForEnableConfiguration()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.EnableConfigurationResponse), nil
+ }
+}
+
+// EnableConfigurationInvoker 应用参数模板
+func (c *RdsClient) EnableConfigurationInvoker(request *model.EnableConfigurationRequest) *EnableConfigurationInvoker {
+ requestDef := GenReqDefForEnableConfiguration()
+ return &EnableConfigurationInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListAuditlogs 获取审计日志列表
+//
+// 获取审计日志列表。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListAuditlogs(request *model.ListAuditlogsRequest) (*model.ListAuditlogsResponse, error) {
+ requestDef := GenReqDefForListAuditlogs()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListAuditlogsResponse), nil
+ }
+}
+
+// ListAuditlogsInvoker 获取审计日志列表
+func (c *RdsClient) ListAuditlogsInvoker(request *model.ListAuditlogsRequest) *ListAuditlogsInvoker {
+ requestDef := GenReqDefForListAuditlogs()
+ return &ListAuditlogsInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListBackups 获取备份列表
+//
+// 获取备份列表。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListBackups(request *model.ListBackupsRequest) (*model.ListBackupsResponse, error) {
+ requestDef := GenReqDefForListBackups()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListBackupsResponse), nil
+ }
+}
+
+// ListBackupsInvoker 获取备份列表
+func (c *RdsClient) ListBackupsInvoker(request *model.ListBackupsRequest) *ListBackupsInvoker {
+ requestDef := GenReqDefForListBackups()
+ return &ListBackupsInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListCollations 查询SQLServer可用字符集
+//
+// 查询SQLServer可用字符集
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListCollations(request *model.ListCollationsRequest) (*model.ListCollationsResponse, error) {
+ requestDef := GenReqDefForListCollations()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListCollationsResponse), nil
+ }
+}
+
+// ListCollationsInvoker 查询SQLServer可用字符集
+func (c *RdsClient) ListCollationsInvoker(request *model.ListCollationsRequest) *ListCollationsInvoker {
+ requestDef := GenReqDefForListCollations()
+ return &ListCollationsInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListConfigurations 获取参数模板列表
+//
+// 获取参数模板列表,包括所有数据库的默认参数模板和用户创建的参数模板。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListConfigurations(request *model.ListConfigurationsRequest) (*model.ListConfigurationsResponse, error) {
+ requestDef := GenReqDefForListConfigurations()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListConfigurationsResponse), nil
+ }
+}
+
+// ListConfigurationsInvoker 获取参数模板列表
+func (c *RdsClient) ListConfigurationsInvoker(request *model.ListConfigurationsRequest) *ListConfigurationsInvoker {
+ requestDef := GenReqDefForListConfigurations()
+ return &ListConfigurationsInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListDatastores 查询数据库引擎的版本
+//
+// 查询数据库引擎的版本。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListDatastores(request *model.ListDatastoresRequest) (*model.ListDatastoresResponse, error) {
+ requestDef := GenReqDefForListDatastores()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListDatastoresResponse), nil
+ }
+}
+
+// ListDatastoresInvoker 查询数据库引擎的版本
+func (c *RdsClient) ListDatastoresInvoker(request *model.ListDatastoresRequest) *ListDatastoresInvoker {
+ requestDef := GenReqDefForListDatastores()
+ return &ListDatastoresInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListDrRelations
+//
+// 批量查询容灾实例信息
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListDrRelations(request *model.ListDrRelationsRequest) (*model.ListDrRelationsResponse, error) {
+ requestDef := GenReqDefForListDrRelations()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListDrRelationsResponse), nil
+ }
+}
+
+// ListDrRelationsInvoker
+func (c *RdsClient) ListDrRelationsInvoker(request *model.ListDrRelationsRequest) *ListDrRelationsInvoker {
+ requestDef := GenReqDefForListDrRelations()
+ return &ListDrRelationsInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListEngineFlavors 查询实例可变更规格
+//
+// 查询实例可变更规格
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListEngineFlavors(request *model.ListEngineFlavorsRequest) (*model.ListEngineFlavorsResponse, error) {
+ requestDef := GenReqDefForListEngineFlavors()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListEngineFlavorsResponse), nil
+ }
+}
+
+// ListEngineFlavorsInvoker 查询实例可变更规格
+func (c *RdsClient) ListEngineFlavorsInvoker(request *model.ListEngineFlavorsRequest) *ListEngineFlavorsInvoker {
+ requestDef := GenReqDefForListEngineFlavors()
+ return &ListEngineFlavorsInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListErrorLogs 查询数据库错误日志
+//
+// 查询数据库错误日志。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListErrorLogs(request *model.ListErrorLogsRequest) (*model.ListErrorLogsResponse, error) {
+ requestDef := GenReqDefForListErrorLogs()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListErrorLogsResponse), nil
+ }
+}
+
+// ListErrorLogsInvoker 查询数据库错误日志
+func (c *RdsClient) ListErrorLogsInvoker(request *model.ListErrorLogsRequest) *ListErrorLogsInvoker {
+ requestDef := GenReqDefForListErrorLogs()
+ return &ListErrorLogsInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListErrorLogsNew 查询数据库错误日志
+//
+// 查询数据库错误日志。(与原v3接口相比修改offset,符合华为云服务开放 API遵从性规范3.0)
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListErrorLogsNew(request *model.ListErrorLogsNewRequest) (*model.ListErrorLogsNewResponse, error) {
+ requestDef := GenReqDefForListErrorLogsNew()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListErrorLogsNewResponse), nil
+ }
+}
+
+// ListErrorLogsNewInvoker 查询数据库错误日志
+func (c *RdsClient) ListErrorLogsNewInvoker(request *model.ListErrorLogsNewRequest) *ListErrorLogsNewInvoker {
+ requestDef := GenReqDefForListErrorLogsNew()
+ return &ListErrorLogsNewInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListErrorlogForLts
+//
+// 查询实例的错误日志数据。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListErrorlogForLts(request *model.ListErrorlogForLtsRequest) (*model.ListErrorlogForLtsResponse, error) {
+ requestDef := GenReqDefForListErrorlogForLts()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListErrorlogForLtsResponse), nil
+ }
+}
+
+// ListErrorlogForLtsInvoker
+func (c *RdsClient) ListErrorlogForLtsInvoker(request *model.ListErrorlogForLtsRequest) *ListErrorlogForLtsInvoker {
+ requestDef := GenReqDefForListErrorlogForLts()
+ return &ListErrorlogForLtsInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListFlavors 查询数据库规格
+//
+// 查询数据库规格。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListFlavors(request *model.ListFlavorsRequest) (*model.ListFlavorsResponse, error) {
+ requestDef := GenReqDefForListFlavors()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListFlavorsResponse), nil
+ }
+}
+
+// ListFlavorsInvoker 查询数据库规格
+func (c *RdsClient) ListFlavorsInvoker(request *model.ListFlavorsRequest) *ListFlavorsInvoker {
+ requestDef := GenReqDefForListFlavors()
+ return &ListFlavorsInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListHistoryDatabase 查询指定时间点可恢复的库
+//
+// 查询指定时间点可恢复的库
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListHistoryDatabase(request *model.ListHistoryDatabaseRequest) (*model.ListHistoryDatabaseResponse, error) {
+ requestDef := GenReqDefForListHistoryDatabase()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListHistoryDatabaseResponse), nil
+ }
+}
+
+// ListHistoryDatabaseInvoker 查询指定时间点可恢复的库
+func (c *RdsClient) ListHistoryDatabaseInvoker(request *model.ListHistoryDatabaseRequest) *ListHistoryDatabaseInvoker {
+ requestDef := GenReqDefForListHistoryDatabase()
+ return &ListHistoryDatabaseInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListInspectionHistories
+//
+// 查询实例大版本升级检查历史。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListInspectionHistories(request *model.ListInspectionHistoriesRequest) (*model.ListInspectionHistoriesResponse, error) {
+ requestDef := GenReqDefForListInspectionHistories()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListInspectionHistoriesResponse), nil
+ }
+}
+
+// ListInspectionHistoriesInvoker
+func (c *RdsClient) ListInspectionHistoriesInvoker(request *model.ListInspectionHistoriesRequest) *ListInspectionHistoriesInvoker {
+ requestDef := GenReqDefForListInspectionHistories()
+ return &ListInspectionHistoriesInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListInstanceDiagnosis 获取诊断后的实例数量
+//
+// 获取诊断后的实例数量
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListInstanceDiagnosis(request *model.ListInstanceDiagnosisRequest) (*model.ListInstanceDiagnosisResponse, error) {
+ requestDef := GenReqDefForListInstanceDiagnosis()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListInstanceDiagnosisResponse), nil
+ }
+}
+
+// ListInstanceDiagnosisInvoker 获取诊断后的实例数量
+func (c *RdsClient) ListInstanceDiagnosisInvoker(request *model.ListInstanceDiagnosisRequest) *ListInstanceDiagnosisInvoker {
+ requestDef := GenReqDefForListInstanceDiagnosis()
+ return &ListInstanceDiagnosisInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListInstanceParamHistories 查询实例参数修改历史
+//
+// 实例参数修改历史。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListInstanceParamHistories(request *model.ListInstanceParamHistoriesRequest) (*model.ListInstanceParamHistoriesResponse, error) {
+ requestDef := GenReqDefForListInstanceParamHistories()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListInstanceParamHistoriesResponse), nil
+ }
+}
+
+// ListInstanceParamHistoriesInvoker 查询实例参数修改历史
+func (c *RdsClient) ListInstanceParamHistoriesInvoker(request *model.ListInstanceParamHistoriesRequest) *ListInstanceParamHistoriesInvoker {
+ requestDef := GenReqDefForListInstanceParamHistories()
+ return &ListInstanceParamHistoriesInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListInstanceTags 查询实例标签
+//
+// 查询实例标签。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListInstanceTags(request *model.ListInstanceTagsRequest) (*model.ListInstanceTagsResponse, error) {
+ requestDef := GenReqDefForListInstanceTags()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListInstanceTagsResponse), nil
+ }
+}
+
+// ListInstanceTagsInvoker 查询实例标签
+func (c *RdsClient) ListInstanceTagsInvoker(request *model.ListInstanceTagsRequest) *ListInstanceTagsInvoker {
+ requestDef := GenReqDefForListInstanceTags()
+ return &ListInstanceTagsInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListInstances 查询数据库实例列表
+//
+// 查询数据库实例列表。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListInstances(request *model.ListInstancesRequest) (*model.ListInstancesResponse, error) {
+ requestDef := GenReqDefForListInstances()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListInstancesResponse), nil
+ }
+}
+
+// ListInstancesInvoker 查询数据库实例列表
+func (c *RdsClient) ListInstancesInvoker(request *model.ListInstancesRequest) *ListInstancesInvoker {
+ requestDef := GenReqDefForListInstances()
+ return &ListInstancesInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListInstancesInfoDiagnosis 获取指定诊断项的诊断结果
+//
+// 获取指定诊断项的诊断结果
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListInstancesInfoDiagnosis(request *model.ListInstancesInfoDiagnosisRequest) (*model.ListInstancesInfoDiagnosisResponse, error) {
+ requestDef := GenReqDefForListInstancesInfoDiagnosis()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListInstancesInfoDiagnosisResponse), nil
+ }
+}
+
+// ListInstancesInfoDiagnosisInvoker 获取指定诊断项的诊断结果
+func (c *RdsClient) ListInstancesInfoDiagnosisInvoker(request *model.ListInstancesInfoDiagnosisRequest) *ListInstancesInfoDiagnosisInvoker {
+ requestDef := GenReqDefForListInstancesInfoDiagnosis()
+ return &ListInstancesInfoDiagnosisInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListInstancesSupportFastRestore 获取实例是否能使用极速恢复
+//
+// 批量获取实例是否能在库表恢复时使用极速恢复。
+//
+// - 调用接口前,您需要了解API 认证鉴权。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListInstancesSupportFastRestore(request *model.ListInstancesSupportFastRestoreRequest) (*model.ListInstancesSupportFastRestoreResponse, error) {
+ requestDef := GenReqDefForListInstancesSupportFastRestore()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListInstancesSupportFastRestoreResponse), nil
+ }
+}
+
+// ListInstancesSupportFastRestoreInvoker 获取实例是否能使用极速恢复
+func (c *RdsClient) ListInstancesSupportFastRestoreInvoker(request *model.ListInstancesSupportFastRestoreRequest) *ListInstancesSupportFastRestoreInvoker {
+ requestDef := GenReqDefForListInstancesSupportFastRestore()
+ return &ListInstancesSupportFastRestoreInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListJobInfo 获取指定ID的任务信息
+//
+// 获取指定ID的任务信息。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListJobInfo(request *model.ListJobInfoRequest) (*model.ListJobInfoResponse, error) {
+ requestDef := GenReqDefForListJobInfo()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListJobInfoResponse), nil
+ }
+}
+
+// ListJobInfoInvoker 获取指定ID的任务信息
+func (c *RdsClient) ListJobInfoInvoker(request *model.ListJobInfoRequest) *ListJobInfoInvoker {
+ requestDef := GenReqDefForListJobInfo()
+ return &ListJobInfoInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListJobInfoDetail 获取指定实例和时间范围的任务信息(SQL Server)
+//
+// 获取指定实例和时间范围的任务信息(SQL Server)。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListJobInfoDetail(request *model.ListJobInfoDetailRequest) (*model.ListJobInfoDetailResponse, error) {
+ requestDef := GenReqDefForListJobInfoDetail()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListJobInfoDetailResponse), nil
+ }
+}
+
+// ListJobInfoDetailInvoker 获取指定实例和时间范围的任务信息(SQL Server)
+func (c *RdsClient) ListJobInfoDetailInvoker(request *model.ListJobInfoDetailRequest) *ListJobInfoDetailInvoker {
+ requestDef := GenReqDefForListJobInfoDetail()
+ return &ListJobInfoDetailInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListOffSiteBackups 查询跨区域备份列表
+//
+// 查询跨区域备份列表。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListOffSiteBackups(request *model.ListOffSiteBackupsRequest) (*model.ListOffSiteBackupsResponse, error) {
+ requestDef := GenReqDefForListOffSiteBackups()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListOffSiteBackupsResponse), nil
+ }
+}
+
+// ListOffSiteBackupsInvoker 查询跨区域备份列表
+func (c *RdsClient) ListOffSiteBackupsInvoker(request *model.ListOffSiteBackupsRequest) *ListOffSiteBackupsInvoker {
+ requestDef := GenReqDefForListOffSiteBackups()
+ return &ListOffSiteBackupsInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListOffSiteInstances 查询跨区域备份实例列表
+//
+// 查询跨区域备份实例列表。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListOffSiteInstances(request *model.ListOffSiteInstancesRequest) (*model.ListOffSiteInstancesResponse, error) {
+ requestDef := GenReqDefForListOffSiteInstances()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListOffSiteInstancesResponse), nil
+ }
+}
+
+// ListOffSiteInstancesInvoker 查询跨区域备份实例列表
+func (c *RdsClient) ListOffSiteInstancesInvoker(request *model.ListOffSiteInstancesRequest) *ListOffSiteInstancesInvoker {
+ requestDef := GenReqDefForListOffSiteInstances()
+ return &ListOffSiteInstancesInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListOffSiteRestoreTimes 查询跨区域备份可恢复时间段
+//
+// 查询跨区域备份可恢复时间段。
+// 如果您备份策略中的保存天数设置较长,建议您传入查询日期“date”。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListOffSiteRestoreTimes(request *model.ListOffSiteRestoreTimesRequest) (*model.ListOffSiteRestoreTimesResponse, error) {
+ requestDef := GenReqDefForListOffSiteRestoreTimes()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListOffSiteRestoreTimesResponse), nil
+ }
+}
+
+// ListOffSiteRestoreTimesInvoker 查询跨区域备份可恢复时间段
+func (c *RdsClient) ListOffSiteRestoreTimesInvoker(request *model.ListOffSiteRestoreTimesRequest) *ListOffSiteRestoreTimesInvoker {
+ requestDef := GenReqDefForListOffSiteRestoreTimes()
+ return &ListOffSiteRestoreTimesInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListPostgresqlHbaInfo 查询实例的pg_hba.conf文件配置
+//
+// 查询实例的pg_hba.conf文件配置
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListPostgresqlHbaInfo(request *model.ListPostgresqlHbaInfoRequest) (*model.ListPostgresqlHbaInfoResponse, error) {
+ requestDef := GenReqDefForListPostgresqlHbaInfo()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListPostgresqlHbaInfoResponse), nil
+ }
+}
+
+// ListPostgresqlHbaInfoInvoker 查询实例的pg_hba.conf文件配置
+func (c *RdsClient) ListPostgresqlHbaInfoInvoker(request *model.ListPostgresqlHbaInfoRequest) *ListPostgresqlHbaInfoInvoker {
+ requestDef := GenReqDefForListPostgresqlHbaInfo()
+ return &ListPostgresqlHbaInfoInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListPostgresqlHbaInfoHistory 查询实例的pg_hba.conf文件修改历史
+//
+// 查询实例的pg_hba.conf文件修改历史
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListPostgresqlHbaInfoHistory(request *model.ListPostgresqlHbaInfoHistoryRequest) (*model.ListPostgresqlHbaInfoHistoryResponse, error) {
+ requestDef := GenReqDefForListPostgresqlHbaInfoHistory()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListPostgresqlHbaInfoHistoryResponse), nil
+ }
+}
+
+// ListPostgresqlHbaInfoHistoryInvoker 查询实例的pg_hba.conf文件修改历史
+func (c *RdsClient) ListPostgresqlHbaInfoHistoryInvoker(request *model.ListPostgresqlHbaInfoHistoryRequest) *ListPostgresqlHbaInfoHistoryInvoker {
+ requestDef := GenReqDefForListPostgresqlHbaInfoHistory()
+ return &ListPostgresqlHbaInfoHistoryInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListPostgresqlListHistoryTables 查询指定时间点可恢复的表(PostgreSQL)
+//
+// 查询指定时间点可恢复的表(PostgreSQL)
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListPostgresqlListHistoryTables(request *model.ListPostgresqlListHistoryTablesRequest) (*model.ListPostgresqlListHistoryTablesResponse, error) {
+ requestDef := GenReqDefForListPostgresqlListHistoryTables()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListPostgresqlListHistoryTablesResponse), nil
+ }
+}
+
+// ListPostgresqlListHistoryTablesInvoker 查询指定时间点可恢复的表(PostgreSQL)
+func (c *RdsClient) ListPostgresqlListHistoryTablesInvoker(request *model.ListPostgresqlListHistoryTablesRequest) *ListPostgresqlListHistoryTablesInvoker {
+ requestDef := GenReqDefForListPostgresqlListHistoryTables()
+ return &ListPostgresqlListHistoryTablesInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListPredefinedTag
+//
+// 查询预定义标签
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListPredefinedTag(request *model.ListPredefinedTagRequest) (*model.ListPredefinedTagResponse, error) {
+ requestDef := GenReqDefForListPredefinedTag()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListPredefinedTagResponse), nil
+ }
+}
+
+// ListPredefinedTagInvoker
+func (c *RdsClient) ListPredefinedTagInvoker(request *model.ListPredefinedTagRequest) *ListPredefinedTagInvoker {
+ requestDef := GenReqDefForListPredefinedTag()
+ return &ListPredefinedTagInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListProjectTags 查询项目标签
+//
+// 查询项目标签。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListProjectTags(request *model.ListProjectTagsRequest) (*model.ListProjectTagsResponse, error) {
+ requestDef := GenReqDefForListProjectTags()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListProjectTagsResponse), nil
+ }
+}
+
+// ListProjectTagsInvoker 查询项目标签
+func (c *RdsClient) ListProjectTagsInvoker(request *model.ListProjectTagsRequest) *ListProjectTagsInvoker {
+ requestDef := GenReqDefForListProjectTags()
+ return &ListProjectTagsInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListRecycleInstances 查询回收站
+//
+// 查询回收站实例信息
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListRecycleInstances(request *model.ListRecycleInstancesRequest) (*model.ListRecycleInstancesResponse, error) {
+ requestDef := GenReqDefForListRecycleInstances()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListRecycleInstancesResponse), nil
+ }
+}
+
+// ListRecycleInstancesInvoker 查询回收站
+func (c *RdsClient) ListRecycleInstancesInvoker(request *model.ListRecycleInstancesRequest) *ListRecycleInstancesInvoker {
+ requestDef := GenReqDefForListRecycleInstances()
+ return &ListRecycleInstancesInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListRestoreTimes 查询可恢复时间段
+//
+// 查询可恢复时间段。
+// 如果您备份策略中的保存天数设置较长,建议您传入查询日期“date”。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListRestoreTimes(request *model.ListRestoreTimesRequest) (*model.ListRestoreTimesResponse, error) {
+ requestDef := GenReqDefForListRestoreTimes()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListRestoreTimesResponse), nil
+ }
+}
+
+// ListRestoreTimesInvoker 查询可恢复时间段
+func (c *RdsClient) ListRestoreTimesInvoker(request *model.ListRestoreTimesRequest) *ListRestoreTimesInvoker {
+ requestDef := GenReqDefForListRestoreTimes()
+ return &ListRestoreTimesInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListSimplifiedInstances
+//
+// 获取指定实例详情
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListSimplifiedInstances(request *model.ListSimplifiedInstancesRequest) (*model.ListSimplifiedInstancesResponse, error) {
+ requestDef := GenReqDefForListSimplifiedInstances()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListSimplifiedInstancesResponse), nil
+ }
+}
+
+// ListSimplifiedInstancesInvoker
+func (c *RdsClient) ListSimplifiedInstancesInvoker(request *model.ListSimplifiedInstancesRequest) *ListSimplifiedInstancesInvoker {
+ requestDef := GenReqDefForListSimplifiedInstances()
+ return &ListSimplifiedInstancesInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListSlowLogFile 查询慢日志文件列表
+//
+// 查询慢日志文件列表。
+// 调用该接口取到慢日志文件名后,可以调用接口/v3/{project_id}/instances/{instance_id}/slowlog-download 获取慢日志文件下载链接
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListSlowLogFile(request *model.ListSlowLogFileRequest) (*model.ListSlowLogFileResponse, error) {
+ requestDef := GenReqDefForListSlowLogFile()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListSlowLogFileResponse), nil
+ }
+}
+
+// ListSlowLogFileInvoker 查询慢日志文件列表
+func (c *RdsClient) ListSlowLogFileInvoker(request *model.ListSlowLogFileRequest) *ListSlowLogFileInvoker {
+ requestDef := GenReqDefForListSlowLogFile()
+ return &ListSlowLogFileInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListSlowLogStatisticsForLts
+//
+// 查询实例慢日志的统计数据。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListSlowLogStatisticsForLts(request *model.ListSlowLogStatisticsForLtsRequest) (*model.ListSlowLogStatisticsForLtsResponse, error) {
+ requestDef := GenReqDefForListSlowLogStatisticsForLts()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListSlowLogStatisticsForLtsResponse), nil
+ }
+}
+
+// ListSlowLogStatisticsForLtsInvoker
+func (c *RdsClient) ListSlowLogStatisticsForLtsInvoker(request *model.ListSlowLogStatisticsForLtsRequest) *ListSlowLogStatisticsForLtsInvoker {
+ requestDef := GenReqDefForListSlowLogStatisticsForLts()
+ return &ListSlowLogStatisticsForLtsInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListSlowLogs 查询数据库慢日志
+//
+// 查询数据库慢日志。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListSlowLogs(request *model.ListSlowLogsRequest) (*model.ListSlowLogsResponse, error) {
+ requestDef := GenReqDefForListSlowLogs()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListSlowLogsResponse), nil
+ }
+}
+
+// ListSlowLogsInvoker 查询数据库慢日志
+func (c *RdsClient) ListSlowLogsInvoker(request *model.ListSlowLogsRequest) *ListSlowLogsInvoker {
+ requestDef := GenReqDefForListSlowLogs()
+ return &ListSlowLogsInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListSlowLogsNew 查询数据库慢日志
+//
+// 查询数据库慢日志。(与原v3接口相比修改offset,符合华为云服务开放 API遵从性规范3.0)
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListSlowLogsNew(request *model.ListSlowLogsNewRequest) (*model.ListSlowLogsNewResponse, error) {
+ requestDef := GenReqDefForListSlowLogsNew()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListSlowLogsNewResponse), nil
+ }
+}
+
+// ListSlowLogsNewInvoker 查询数据库慢日志
+func (c *RdsClient) ListSlowLogsNewInvoker(request *model.ListSlowLogsNewRequest) *ListSlowLogsNewInvoker {
+ requestDef := GenReqDefForListSlowLogsNew()
+ return &ListSlowLogsNewInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListSlowlogForLts
+//
+// 查询实例的慢日志数据。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListSlowlogForLts(request *model.ListSlowlogForLtsRequest) (*model.ListSlowlogForLtsResponse, error) {
+ requestDef := GenReqDefForListSlowlogForLts()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListSlowlogForLtsResponse), nil
+ }
+}
+
+// ListSlowlogForLtsInvoker
+func (c *RdsClient) ListSlowlogForLtsInvoker(request *model.ListSlowlogForLtsRequest) *ListSlowlogForLtsInvoker {
+ requestDef := GenReqDefForListSlowlogForLts()
+ return &ListSlowlogForLtsInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListSlowlogStatistics 获取慢日志统计信息
+//
+// 获取慢日志统计信息
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListSlowlogStatistics(request *model.ListSlowlogStatisticsRequest) (*model.ListSlowlogStatisticsResponse, error) {
+ requestDef := GenReqDefForListSlowlogStatistics()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListSlowlogStatisticsResponse), nil
+ }
+}
+
+// ListSlowlogStatisticsInvoker 获取慢日志统计信息
+func (c *RdsClient) ListSlowlogStatisticsInvoker(request *model.ListSlowlogStatisticsRequest) *ListSlowlogStatisticsInvoker {
+ requestDef := GenReqDefForListSlowlogStatistics()
+ return &ListSlowlogStatisticsInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListSslCertDownloadLink 获取SSL证书下载地址
+//
+// 获取SSL证书下载地址
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListSslCertDownloadLink(request *model.ListSslCertDownloadLinkRequest) (*model.ListSslCertDownloadLinkResponse, error) {
+ requestDef := GenReqDefForListSslCertDownloadLink()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListSslCertDownloadLinkResponse), nil
+ }
+}
+
+// ListSslCertDownloadLinkInvoker 获取SSL证书下载地址
+func (c *RdsClient) ListSslCertDownloadLinkInvoker(request *model.ListSslCertDownloadLinkRequest) *ListSslCertDownloadLinkInvoker {
+ requestDef := GenReqDefForListSslCertDownloadLink()
+ return &ListSslCertDownloadLinkInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListStorageTypes 查询数据库磁盘类型
+//
+// 查询数据库磁盘类型。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListStorageTypes(request *model.ListStorageTypesRequest) (*model.ListStorageTypesResponse, error) {
+ requestDef := GenReqDefForListStorageTypes()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListStorageTypesResponse), nil
+ }
+}
+
+// ListStorageTypesInvoker 查询数据库磁盘类型
+func (c *RdsClient) ListStorageTypesInvoker(request *model.ListStorageTypesRequest) *ListStorageTypesInvoker {
+ requestDef := GenReqDefForListStorageTypes()
+ return &ListStorageTypesInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListUpgradeHistories
+//
+// 查询实例大版本升级历史信息。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListUpgradeHistories(request *model.ListUpgradeHistoriesRequest) (*model.ListUpgradeHistoriesResponse, error) {
+ requestDef := GenReqDefForListUpgradeHistories()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListUpgradeHistoriesResponse), nil
+ }
+}
+
+// ListUpgradeHistoriesInvoker
+func (c *RdsClient) ListUpgradeHistoriesInvoker(request *model.ListUpgradeHistoriesRequest) *ListUpgradeHistoriesInvoker {
+ requestDef := GenReqDefForListUpgradeHistories()
+ return &ListUpgradeHistoriesInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListXellogFiles 查询扩展日志文件列表
+//
+// 查询扩展日志文件列表。
+// 查询扩展日志文件列表,可以调用接口/v3/{project_id}/instances/{instance_id}/xellog-download 获取扩展日志下载链接
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListXellogFiles(request *model.ListXellogFilesRequest) (*model.ListXellogFilesResponse, error) {
+ requestDef := GenReqDefForListXellogFiles()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListXellogFilesResponse), nil
+ }
+}
+
+// ListXellogFilesInvoker 查询扩展日志文件列表
+func (c *RdsClient) ListXellogFilesInvoker(request *model.ListXellogFilesRequest) *ListXellogFilesInvoker {
+ requestDef := GenReqDefForListXellogFiles()
+ return &ListXellogFilesInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// MigrateFollower 迁移主备实例的备机
+//
+// 迁移主备实例的备机
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) MigrateFollower(request *model.MigrateFollowerRequest) (*model.MigrateFollowerResponse, error) {
+ requestDef := GenReqDefForMigrateFollower()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.MigrateFollowerResponse), nil
+ }
+}
+
+// MigrateFollowerInvoker 迁移主备实例的备机
+func (c *RdsClient) MigrateFollowerInvoker(request *model.MigrateFollowerRequest) *MigrateFollowerInvoker {
+ requestDef := GenReqDefForMigrateFollower()
+ return &MigrateFollowerInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ModifyPostgresqlHbaConf 修改pg_hba.conf文件的单个或多个配置
+//
+// 修改/新增pg_hba.conf文件的单个或多个配置,以priority做唯一标识,priority不存在的新增,存在的修改
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ModifyPostgresqlHbaConf(request *model.ModifyPostgresqlHbaConfRequest) (*model.ModifyPostgresqlHbaConfResponse, error) {
+ requestDef := GenReqDefForModifyPostgresqlHbaConf()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ModifyPostgresqlHbaConfResponse), nil
+ }
+}
+
+// ModifyPostgresqlHbaConfInvoker 修改pg_hba.conf文件的单个或多个配置
+func (c *RdsClient) ModifyPostgresqlHbaConfInvoker(request *model.ModifyPostgresqlHbaConfRequest) *ModifyPostgresqlHbaConfInvoker {
+ requestDef := GenReqDefForModifyPostgresqlHbaConf()
+ return &ModifyPostgresqlHbaConfInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// RestoreExistInstance 恢复到已有实例
+//
+// 恢复到已有实例。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) RestoreExistInstance(request *model.RestoreExistInstanceRequest) (*model.RestoreExistInstanceResponse, error) {
+ requestDef := GenReqDefForRestoreExistInstance()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.RestoreExistInstanceResponse), nil
+ }
+}
+
+// RestoreExistInstanceInvoker 恢复到已有实例
+func (c *RdsClient) RestoreExistInstanceInvoker(request *model.RestoreExistInstanceRequest) *RestoreExistInstanceInvoker {
+ requestDef := GenReqDefForRestoreExistInstance()
+ return &RestoreExistInstanceInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// RestoreTables 表级时间点恢复(MySQL)
+//
+// 表级时间点恢复(MySQL)。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) RestoreTables(request *model.RestoreTablesRequest) (*model.RestoreTablesResponse, error) {
+ requestDef := GenReqDefForRestoreTables()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.RestoreTablesResponse), nil
+ }
+}
+
+// RestoreTablesInvoker 表级时间点恢复(MySQL)
+func (c *RdsClient) RestoreTablesInvoker(request *model.RestoreTablesRequest) *RestoreTablesInvoker {
+ requestDef := GenReqDefForRestoreTables()
+ return &RestoreTablesInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// RestoreTablesNew 表级时间点恢复(MySQL)
+//
+// 表级时间点恢复(MySQL)。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) RestoreTablesNew(request *model.RestoreTablesNewRequest) (*model.RestoreTablesNewResponse, error) {
+ requestDef := GenReqDefForRestoreTablesNew()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.RestoreTablesNewResponse), nil
+ }
+}
+
+// RestoreTablesNewInvoker 表级时间点恢复(MySQL)
+func (c *RdsClient) RestoreTablesNewInvoker(request *model.RestoreTablesNewRequest) *RestoreTablesNewInvoker {
+ requestDef := GenReqDefForRestoreTablesNew()
+ return &RestoreTablesNewInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// RestoreToExistingInstance 恢复到已有实例
+//
+// 恢复到已有实例。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) RestoreToExistingInstance(request *model.RestoreToExistingInstanceRequest) (*model.RestoreToExistingInstanceResponse, error) {
+ requestDef := GenReqDefForRestoreToExistingInstance()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.RestoreToExistingInstanceResponse), nil
+ }
+}
+
+// RestoreToExistingInstanceInvoker 恢复到已有实例
+func (c *RdsClient) RestoreToExistingInstanceInvoker(request *model.RestoreToExistingInstanceRequest) *RestoreToExistingInstanceInvoker {
+ requestDef := GenReqDefForRestoreToExistingInstance()
+ return &RestoreToExistingInstanceInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// SetAuditlogPolicy 设置审计日志策略
+//
+// 设置审计日志策略。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) SetAuditlogPolicy(request *model.SetAuditlogPolicyRequest) (*model.SetAuditlogPolicyResponse, error) {
+ requestDef := GenReqDefForSetAuditlogPolicy()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.SetAuditlogPolicyResponse), nil
+ }
+}
+
+// SetAuditlogPolicyInvoker 设置审计日志策略
+func (c *RdsClient) SetAuditlogPolicyInvoker(request *model.SetAuditlogPolicyRequest) *SetAuditlogPolicyInvoker {
+ requestDef := GenReqDefForSetAuditlogPolicy()
+ return &SetAuditlogPolicyInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// SetAutoEnlargePolicy 设置自动扩容策略
+//
+// 设置实例存储空间自动扩容策略,按扩容量扣除存储费用。
+// 可用存储空间小于设置值或者10GB时,自动扩容当前存储空间的15%(非10倍数向上取整,账户余额不足,会导致自动扩容失败)。
+// 设置只读实例自动扩容与主实例自动扩容互不影响,对只读实例设置自动扩容时,可选择大于或等于主实例的存储空间。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) SetAutoEnlargePolicy(request *model.SetAutoEnlargePolicyRequest) (*model.SetAutoEnlargePolicyResponse, error) {
+ requestDef := GenReqDefForSetAutoEnlargePolicy()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.SetAutoEnlargePolicyResponse), nil
+ }
+}
+
+// SetAutoEnlargePolicyInvoker 设置自动扩容策略
+func (c *RdsClient) SetAutoEnlargePolicyInvoker(request *model.SetAutoEnlargePolicyRequest) *SetAutoEnlargePolicyInvoker {
+ requestDef := GenReqDefForSetAutoEnlargePolicy()
+ return &SetAutoEnlargePolicyInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// SetBackupPolicy 设置自动备份策略
+//
+// 设置自动备份策略。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) SetBackupPolicy(request *model.SetBackupPolicyRequest) (*model.SetBackupPolicyResponse, error) {
+ requestDef := GenReqDefForSetBackupPolicy()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.SetBackupPolicyResponse), nil
+ }
+}
+
+// SetBackupPolicyInvoker 设置自动备份策略
+func (c *RdsClient) SetBackupPolicyInvoker(request *model.SetBackupPolicyRequest) *SetBackupPolicyInvoker {
+ requestDef := GenReqDefForSetBackupPolicy()
+ return &SetBackupPolicyInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// SetBinlogClearPolicy 设置binlog本地保留时长
+//
+// 修改指定实例的binlog本地保留时长。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) SetBinlogClearPolicy(request *model.SetBinlogClearPolicyRequest) (*model.SetBinlogClearPolicyResponse, error) {
+ requestDef := GenReqDefForSetBinlogClearPolicy()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.SetBinlogClearPolicyResponse), nil
+ }
+}
+
+// SetBinlogClearPolicyInvoker 设置binlog本地保留时长
+func (c *RdsClient) SetBinlogClearPolicyInvoker(request *model.SetBinlogClearPolicyRequest) *SetBinlogClearPolicyInvoker {
+ requestDef := GenReqDefForSetBinlogClearPolicy()
+ return &SetBinlogClearPolicyInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// SetOffSiteBackupPolicy 设置跨区域备份策略
+//
+// 设置跨区域备份策略。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) SetOffSiteBackupPolicy(request *model.SetOffSiteBackupPolicyRequest) (*model.SetOffSiteBackupPolicyResponse, error) {
+ requestDef := GenReqDefForSetOffSiteBackupPolicy()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.SetOffSiteBackupPolicyResponse), nil
+ }
+}
+
+// SetOffSiteBackupPolicyInvoker 设置跨区域备份策略
+func (c *RdsClient) SetOffSiteBackupPolicyInvoker(request *model.SetOffSiteBackupPolicyRequest) *SetOffSiteBackupPolicyInvoker {
+ requestDef := GenReqDefForSetOffSiteBackupPolicy()
+ return &SetOffSiteBackupPolicyInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// SetSecondLevelMonitor 设置秒级监控策略
+//
+// 设置实例秒级监控策略,约五分钟后生效,对于1秒监控和5秒监控,计费方式为按需付费(每小时扣费一次)。
+// 设置只读实例秒级监控与主实例互不影响。
+// 规格变更到4U以下的实例,秒级监控功能会自动关闭。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) SetSecondLevelMonitor(request *model.SetSecondLevelMonitorRequest) (*model.SetSecondLevelMonitorResponse, error) {
+ requestDef := GenReqDefForSetSecondLevelMonitor()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.SetSecondLevelMonitorResponse), nil
+ }
+}
+
+// SetSecondLevelMonitorInvoker 设置秒级监控策略
+func (c *RdsClient) SetSecondLevelMonitorInvoker(request *model.SetSecondLevelMonitorRequest) *SetSecondLevelMonitorInvoker {
+ requestDef := GenReqDefForSetSecondLevelMonitor()
+ return &SetSecondLevelMonitorInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// SetSecurityGroup 修改安全组
+//
+// 修改安全组
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) SetSecurityGroup(request *model.SetSecurityGroupRequest) (*model.SetSecurityGroupResponse, error) {
+ requestDef := GenReqDefForSetSecurityGroup()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.SetSecurityGroupResponse), nil
+ }
+}
+
+// SetSecurityGroupInvoker 修改安全组
+func (c *RdsClient) SetSecurityGroupInvoker(request *model.SetSecurityGroupRequest) *SetSecurityGroupInvoker {
+ requestDef := GenReqDefForSetSecurityGroup()
+ return &SetSecurityGroupInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// SetSensitiveSlowLog 慢日志敏感信息的开关
+//
+// # V3慢日志敏感信息的开关
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) SetSensitiveSlowLog(request *model.SetSensitiveSlowLogRequest) (*model.SetSensitiveSlowLogResponse, error) {
+ requestDef := GenReqDefForSetSensitiveSlowLog()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.SetSensitiveSlowLogResponse), nil
+ }
+}
+
+// SetSensitiveSlowLogInvoker 慢日志敏感信息的开关
+func (c *RdsClient) SetSensitiveSlowLogInvoker(request *model.SetSensitiveSlowLogRequest) *SetSensitiveSlowLogInvoker {
+ requestDef := GenReqDefForSetSensitiveSlowLog()
+ return &SetSensitiveSlowLogInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowAuditlogDownloadLink 生成审计日志下载链接
+//
+// 生成审计日志下载链接。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowAuditlogDownloadLink(request *model.ShowAuditlogDownloadLinkRequest) (*model.ShowAuditlogDownloadLinkResponse, error) {
+ requestDef := GenReqDefForShowAuditlogDownloadLink()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowAuditlogDownloadLinkResponse), nil
+ }
+}
+
+// ShowAuditlogDownloadLinkInvoker 生成审计日志下载链接
+func (c *RdsClient) ShowAuditlogDownloadLinkInvoker(request *model.ShowAuditlogDownloadLinkRequest) *ShowAuditlogDownloadLinkInvoker {
+ requestDef := GenReqDefForShowAuditlogDownloadLink()
+ return &ShowAuditlogDownloadLinkInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowAuditlogPolicy 查询审计日志策略
+//
+// 查询审计日志策略。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowAuditlogPolicy(request *model.ShowAuditlogPolicyRequest) (*model.ShowAuditlogPolicyResponse, error) {
+ requestDef := GenReqDefForShowAuditlogPolicy()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowAuditlogPolicyResponse), nil
+ }
+}
+
+// ShowAuditlogPolicyInvoker 查询审计日志策略
+func (c *RdsClient) ShowAuditlogPolicyInvoker(request *model.ShowAuditlogPolicyRequest) *ShowAuditlogPolicyInvoker {
+ requestDef := GenReqDefForShowAuditlogPolicy()
+ return &ShowAuditlogPolicyInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowAutoEnlargePolicy 查询自动扩容策略
+//
+// 查询实例存储空间自动扩容策略
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowAutoEnlargePolicy(request *model.ShowAutoEnlargePolicyRequest) (*model.ShowAutoEnlargePolicyResponse, error) {
+ requestDef := GenReqDefForShowAutoEnlargePolicy()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowAutoEnlargePolicyResponse), nil
+ }
+}
+
+// ShowAutoEnlargePolicyInvoker 查询自动扩容策略
+func (c *RdsClient) ShowAutoEnlargePolicyInvoker(request *model.ShowAutoEnlargePolicyRequest) *ShowAutoEnlargePolicyInvoker {
+ requestDef := GenReqDefForShowAutoEnlargePolicy()
+ return &ShowAutoEnlargePolicyInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowAvailableVersion
+//
+// 查询实例可升级的目标版本
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowAvailableVersion(request *model.ShowAvailableVersionRequest) (*model.ShowAvailableVersionResponse, error) {
+ requestDef := GenReqDefForShowAvailableVersion()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowAvailableVersionResponse), nil
+ }
+}
+
+// ShowAvailableVersionInvoker
+func (c *RdsClient) ShowAvailableVersionInvoker(request *model.ShowAvailableVersionRequest) *ShowAvailableVersionInvoker {
+ requestDef := GenReqDefForShowAvailableVersion()
+ return &ShowAvailableVersionInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowBackupDownloadLink 获取备份下载链接
+//
+// 获取备份下载链接。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowBackupDownloadLink(request *model.ShowBackupDownloadLinkRequest) (*model.ShowBackupDownloadLinkResponse, error) {
+ requestDef := GenReqDefForShowBackupDownloadLink()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowBackupDownloadLinkResponse), nil
+ }
+}
+
+// ShowBackupDownloadLinkInvoker 获取备份下载链接
+func (c *RdsClient) ShowBackupDownloadLinkInvoker(request *model.ShowBackupDownloadLinkRequest) *ShowBackupDownloadLinkInvoker {
+ requestDef := GenReqDefForShowBackupDownloadLink()
+ return &ShowBackupDownloadLinkInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowBackupPolicy 查询自动备份策略
+//
+// 查询自动备份策略。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowBackupPolicy(request *model.ShowBackupPolicyRequest) (*model.ShowBackupPolicyResponse, error) {
+ requestDef := GenReqDefForShowBackupPolicy()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowBackupPolicyResponse), nil
+ }
+}
+
+// ShowBackupPolicyInvoker 查询自动备份策略
+func (c *RdsClient) ShowBackupPolicyInvoker(request *model.ShowBackupPolicyRequest) *ShowBackupPolicyInvoker {
+ requestDef := GenReqDefForShowBackupPolicy()
+ return &ShowBackupPolicyInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowBinlogClearPolicy 获取binlog本地保留时长
+//
+// 查寻指定实例的binlog本地保留时长。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowBinlogClearPolicy(request *model.ShowBinlogClearPolicyRequest) (*model.ShowBinlogClearPolicyResponse, error) {
+ requestDef := GenReqDefForShowBinlogClearPolicy()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowBinlogClearPolicyResponse), nil
+ }
+}
+
+// ShowBinlogClearPolicyInvoker 获取binlog本地保留时长
+func (c *RdsClient) ShowBinlogClearPolicyInvoker(request *model.ShowBinlogClearPolicyRequest) *ShowBinlogClearPolicyInvoker {
+ requestDef := GenReqDefForShowBinlogClearPolicy()
+ return &ShowBinlogClearPolicyInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowConfiguration 获取指定参数模板的参数
+//
+// 获取指定参数模板的参数。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowConfiguration(request *model.ShowConfigurationRequest) (*model.ShowConfigurationResponse, error) {
+ requestDef := GenReqDefForShowConfiguration()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowConfigurationResponse), nil
+ }
+}
+
+// ShowConfigurationInvoker 获取指定参数模板的参数
+func (c *RdsClient) ShowConfigurationInvoker(request *model.ShowConfigurationRequest) *ShowConfigurationInvoker {
+ requestDef := GenReqDefForShowConfiguration()
+ return &ShowConfigurationInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowDnsName 查询实例ipv6域名。
+//
+// 查询实例ipv6域名。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowDnsName(request *model.ShowDnsNameRequest) (*model.ShowDnsNameResponse, error) {
+ requestDef := GenReqDefForShowDnsName()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowDnsNameResponse), nil
+ }
+}
+
+// ShowDnsNameInvoker 查询实例ipv6域名。
+func (c *RdsClient) ShowDnsNameInvoker(request *model.ShowDnsNameRequest) *ShowDnsNameInvoker {
+ requestDef := GenReqDefForShowDnsName()
+ return &ShowDnsNameInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowDomainName
+//
+// 查询实例ipv4域名
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowDomainName(request *model.ShowDomainNameRequest) (*model.ShowDomainNameResponse, error) {
+ requestDef := GenReqDefForShowDomainName()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowDomainNameResponse), nil
+ }
+}
+
+// ShowDomainNameInvoker
+func (c *RdsClient) ShowDomainNameInvoker(request *model.ShowDomainNameRequest) *ShowDomainNameInvoker {
+ requestDef := GenReqDefForShowDomainName()
+ return &ShowDomainNameInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowDrReplicaStatus 查询跨云容灾复制状态
+//
+// 建立跨云容灾关系后,查询主实例和灾备实例间的复制状态及延迟。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowDrReplicaStatus(request *model.ShowDrReplicaStatusRequest) (*model.ShowDrReplicaStatusResponse, error) {
+ requestDef := GenReqDefForShowDrReplicaStatus()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowDrReplicaStatusResponse), nil
+ }
+}
+
+// ShowDrReplicaStatusInvoker 查询跨云容灾复制状态
+func (c *RdsClient) ShowDrReplicaStatusInvoker(request *model.ShowDrReplicaStatusRequest) *ShowDrReplicaStatusInvoker {
+ requestDef := GenReqDefForShowDrReplicaStatus()
+ return &ShowDrReplicaStatusInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowInstanceConfiguration 获取指定实例的参数模板
+//
+// 获取指定实例的参数模板。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowInstanceConfiguration(request *model.ShowInstanceConfigurationRequest) (*model.ShowInstanceConfigurationResponse, error) {
+ requestDef := GenReqDefForShowInstanceConfiguration()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowInstanceConfigurationResponse), nil
+ }
+}
+
+// ShowInstanceConfigurationInvoker 获取指定实例的参数模板
+func (c *RdsClient) ShowInstanceConfigurationInvoker(request *model.ShowInstanceConfigurationRequest) *ShowInstanceConfigurationInvoker {
+ requestDef := GenReqDefForShowInstanceConfiguration()
+ return &ShowInstanceConfigurationInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowOffSiteBackupPolicy 查询跨区域备份策略
+//
+// 查询跨区域备份策略。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowOffSiteBackupPolicy(request *model.ShowOffSiteBackupPolicyRequest) (*model.ShowOffSiteBackupPolicyResponse, error) {
+ requestDef := GenReqDefForShowOffSiteBackupPolicy()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowOffSiteBackupPolicyResponse), nil
+ }
+}
+
+// ShowOffSiteBackupPolicyInvoker 查询跨区域备份策略
+func (c *RdsClient) ShowOffSiteBackupPolicyInvoker(request *model.ShowOffSiteBackupPolicyRequest) *ShowOffSiteBackupPolicyInvoker {
+ requestDef := GenReqDefForShowOffSiteBackupPolicy()
+ return &ShowOffSiteBackupPolicyInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowQuotas 查询配额
+//
+// 查询当前项目下资源配额情况。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowQuotas(request *model.ShowQuotasRequest) (*model.ShowQuotasResponse, error) {
+ requestDef := GenReqDefForShowQuotas()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowQuotasResponse), nil
+ }
+}
+
+// ShowQuotasInvoker 查询配额
+func (c *RdsClient) ShowQuotasInvoker(request *model.ShowQuotasRequest) *ShowQuotasInvoker {
+ requestDef := GenReqDefForShowQuotas()
+ return &ShowQuotasInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowRecyclePolicy 查询回收站的回收策略。
+//
+// 查询回收站的回收策略。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowRecyclePolicy(request *model.ShowRecyclePolicyRequest) (*model.ShowRecyclePolicyResponse, error) {
+ requestDef := GenReqDefForShowRecyclePolicy()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowRecyclePolicyResponse), nil
+ }
+}
+
+// ShowRecyclePolicyInvoker 查询回收站的回收策略。
+func (c *RdsClient) ShowRecyclePolicyInvoker(request *model.ShowRecyclePolicyRequest) *ShowRecyclePolicyInvoker {
+ requestDef := GenReqDefForShowRecyclePolicy()
+ return &ShowRecyclePolicyInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowReplicationStatus 获取实例的复制状态。
+//
+// 获取实例的复制状态。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowReplicationStatus(request *model.ShowReplicationStatusRequest) (*model.ShowReplicationStatusResponse, error) {
+ requestDef := GenReqDefForShowReplicationStatus()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowReplicationStatusResponse), nil
+ }
+}
+
+// ShowReplicationStatusInvoker 获取实例的复制状态。
+func (c *RdsClient) ShowReplicationStatusInvoker(request *model.ShowReplicationStatusRequest) *ShowReplicationStatusInvoker {
+ requestDef := GenReqDefForShowReplicationStatus()
+ return &ShowReplicationStatusInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowSecondLevelMonitoring 查询秒级监控策略
+//
+// 查询实例秒级监控策略
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowSecondLevelMonitoring(request *model.ShowSecondLevelMonitoringRequest) (*model.ShowSecondLevelMonitoringResponse, error) {
+ requestDef := GenReqDefForShowSecondLevelMonitoring()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowSecondLevelMonitoringResponse), nil
+ }
+}
+
+// ShowSecondLevelMonitoringInvoker 查询秒级监控策略
+func (c *RdsClient) ShowSecondLevelMonitoringInvoker(request *model.ShowSecondLevelMonitoringRequest) *ShowSecondLevelMonitoringInvoker {
+ requestDef := GenReqDefForShowSecondLevelMonitoring()
+ return &ShowSecondLevelMonitoringInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowTdeStatus 根据实例id查询sqlserver TDE状态
+//
+// 根据实例id查询sqlserver TDE状态
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowTdeStatus(request *model.ShowTdeStatusRequest) (*model.ShowTdeStatusResponse, error) {
+ requestDef := GenReqDefForShowTdeStatus()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowTdeStatusResponse), nil
+ }
+}
+
+// ShowTdeStatusInvoker 根据实例id查询sqlserver TDE状态
+func (c *RdsClient) ShowTdeStatusInvoker(request *model.ShowTdeStatusRequest) *ShowTdeStatusInvoker {
+ requestDef := GenReqDefForShowTdeStatus()
+ return &ShowTdeStatusInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowUpgradeDbMajorVersionStatus
+//
+// 查询大版本检查状态或升级状态。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowUpgradeDbMajorVersionStatus(request *model.ShowUpgradeDbMajorVersionStatusRequest) (*model.ShowUpgradeDbMajorVersionStatusResponse, error) {
+ requestDef := GenReqDefForShowUpgradeDbMajorVersionStatus()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowUpgradeDbMajorVersionStatusResponse), nil
+ }
+}
+
+// ShowUpgradeDbMajorVersionStatusInvoker
+func (c *RdsClient) ShowUpgradeDbMajorVersionStatusInvoker(request *model.ShowUpgradeDbMajorVersionStatusRequest) *ShowUpgradeDbMajorVersionStatusInvoker {
+ requestDef := GenReqDefForShowUpgradeDbMajorVersionStatus()
+ return &ShowUpgradeDbMajorVersionStatusInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// StartFailover 手动倒换主备
+//
+// 手动倒换主备.
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) StartFailover(request *model.StartFailoverRequest) (*model.StartFailoverResponse, error) {
+ requestDef := GenReqDefForStartFailover()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.StartFailoverResponse), nil
+ }
+}
+
+// StartFailoverInvoker 手动倒换主备
+func (c *RdsClient) StartFailoverInvoker(request *model.StartFailoverRequest) *StartFailoverInvoker {
+ requestDef := GenReqDefForStartFailover()
+ return &StartFailoverInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// StartInstanceEnlargeVolumeAction 扩容数据库实例的磁盘空间
+//
+// 扩容数据库实例的磁盘空间。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) StartInstanceEnlargeVolumeAction(request *model.StartInstanceEnlargeVolumeActionRequest) (*model.StartInstanceEnlargeVolumeActionResponse, error) {
+ requestDef := GenReqDefForStartInstanceEnlargeVolumeAction()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.StartInstanceEnlargeVolumeActionResponse), nil
+ }
+}
+
+// StartInstanceEnlargeVolumeActionInvoker 扩容数据库实例的磁盘空间
+func (c *RdsClient) StartInstanceEnlargeVolumeActionInvoker(request *model.StartInstanceEnlargeVolumeActionRequest) *StartInstanceEnlargeVolumeActionInvoker {
+ requestDef := GenReqDefForStartInstanceEnlargeVolumeAction()
+ return &StartInstanceEnlargeVolumeActionInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// StartInstanceRestartAction 重启数据库实例
+//
+// 重启数据库实例。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) StartInstanceRestartAction(request *model.StartInstanceRestartActionRequest) (*model.StartInstanceRestartActionResponse, error) {
+ requestDef := GenReqDefForStartInstanceRestartAction()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.StartInstanceRestartActionResponse), nil
+ }
+}
+
+// StartInstanceRestartActionInvoker 重启数据库实例
+func (c *RdsClient) StartInstanceRestartActionInvoker(request *model.StartInstanceRestartActionRequest) *StartInstanceRestartActionInvoker {
+ requestDef := GenReqDefForStartInstanceRestartAction()
+ return &StartInstanceRestartActionInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// StartInstanceSingleToHaAction 单机转主备实例
+//
+// 单机转主备实例。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) StartInstanceSingleToHaAction(request *model.StartInstanceSingleToHaActionRequest) (*model.StartInstanceSingleToHaActionResponse, error) {
+ requestDef := GenReqDefForStartInstanceSingleToHaAction()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.StartInstanceSingleToHaActionResponse), nil
+ }
+}
+
+// StartInstanceSingleToHaActionInvoker 单机转主备实例
+func (c *RdsClient) StartInstanceSingleToHaActionInvoker(request *model.StartInstanceSingleToHaActionRequest) *StartInstanceSingleToHaActionInvoker {
+ requestDef := GenReqDefForStartInstanceSingleToHaAction()
+ return &StartInstanceSingleToHaActionInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// StartRecyclePolicy 设置回收站策略
+//
+// 设置回收站策略。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) StartRecyclePolicy(request *model.StartRecyclePolicyRequest) (*model.StartRecyclePolicyResponse, error) {
+ requestDef := GenReqDefForStartRecyclePolicy()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.StartRecyclePolicyResponse), nil
+ }
+}
+
+// StartRecyclePolicyInvoker 设置回收站策略
+func (c *RdsClient) StartRecyclePolicyInvoker(request *model.StartRecyclePolicyRequest) *StartRecyclePolicyInvoker {
+ requestDef := GenReqDefForStartRecyclePolicy()
+ return &StartRecyclePolicyInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// StartResizeFlavorAction 变更数据库实例的规格
+//
+// 变更数据库实例的规格。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) StartResizeFlavorAction(request *model.StartResizeFlavorActionRequest) (*model.StartResizeFlavorActionResponse, error) {
+ requestDef := GenReqDefForStartResizeFlavorAction()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.StartResizeFlavorActionResponse), nil
+ }
+}
+
+// StartResizeFlavorActionInvoker 变更数据库实例的规格
+func (c *RdsClient) StartResizeFlavorActionInvoker(request *model.StartResizeFlavorActionRequest) *StartResizeFlavorActionInvoker {
+ requestDef := GenReqDefForStartResizeFlavorAction()
+ return &StartResizeFlavorActionInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// StartupInstance 开启实例
+//
+// 停止实例以节省费用,在停止数据库实例后,支持手动重新开启实例。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) StartupInstance(request *model.StartupInstanceRequest) (*model.StartupInstanceResponse, error) {
+ requestDef := GenReqDefForStartupInstance()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.StartupInstanceResponse), nil
+ }
+}
+
+// StartupInstanceInvoker 开启实例
+func (c *RdsClient) StartupInstanceInvoker(request *model.StartupInstanceRequest) *StartupInstanceInvoker {
+ requestDef := GenReqDefForStartupInstance()
+ return &StartupInstanceInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// StopInstance 停止实例
+//
+// 实例进行关机,通过暂时停止按需实例以节省费用,实例默认停止七天。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) StopInstance(request *model.StopInstanceRequest) (*model.StopInstanceResponse, error) {
+ requestDef := GenReqDefForStopInstance()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.StopInstanceResponse), nil
+ }
+}
+
+// StopInstanceInvoker 停止实例
+func (c *RdsClient) StopInstanceInvoker(request *model.StopInstanceRequest) *StopInstanceInvoker {
+ requestDef := GenReqDefForStopInstance()
+ return &StopInstanceInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// SwitchSsl 设置SSL数据加密
+//
+// 设置SSL数据加密。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) SwitchSsl(request *model.SwitchSslRequest) (*model.SwitchSslResponse, error) {
+ requestDef := GenReqDefForSwitchSsl()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.SwitchSslResponse), nil
+ }
+}
+
+// SwitchSslInvoker 设置SSL数据加密
+func (c *RdsClient) SwitchSslInvoker(request *model.SwitchSslRequest) *SwitchSslInvoker {
+ requestDef := GenReqDefForSwitchSsl()
+ return &SwitchSslInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// UpdateConfiguration 修改参数模板参数
+//
+// 修改参数模板参数。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) UpdateConfiguration(request *model.UpdateConfigurationRequest) (*model.UpdateConfigurationResponse, error) {
+ requestDef := GenReqDefForUpdateConfiguration()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.UpdateConfigurationResponse), nil
+ }
+}
+
+// UpdateConfigurationInvoker 修改参数模板参数
+func (c *RdsClient) UpdateConfigurationInvoker(request *model.UpdateConfigurationRequest) *UpdateConfigurationInvoker {
+ requestDef := GenReqDefForUpdateConfiguration()
+ return &UpdateConfigurationInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// UpdateDataIp 修改内网地址
+//
+// 修改内网地址
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) UpdateDataIp(request *model.UpdateDataIpRequest) (*model.UpdateDataIpResponse, error) {
+ requestDef := GenReqDefForUpdateDataIp()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.UpdateDataIpResponse), nil
+ }
+}
+
+// UpdateDataIpInvoker 修改内网地址
+func (c *RdsClient) UpdateDataIpInvoker(request *model.UpdateDataIpRequest) *UpdateDataIpInvoker {
+ requestDef := GenReqDefForUpdateDataIp()
+ return &UpdateDataIpInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// UpdateDnsName 修改域名
+//
+// 修改域名
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) UpdateDnsName(request *model.UpdateDnsNameRequest) (*model.UpdateDnsNameResponse, error) {
+ requestDef := GenReqDefForUpdateDnsName()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.UpdateDnsNameResponse), nil
+ }
+}
+
+// UpdateDnsNameInvoker 修改域名
+func (c *RdsClient) UpdateDnsNameInvoker(request *model.UpdateDnsNameRequest) *UpdateDnsNameInvoker {
+ requestDef := GenReqDefForUpdateDnsName()
+ return &UpdateDnsNameInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// UpdateInstanceConfiguration 修改指定实例的参数
+//
+// 修改指定实例的参数。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) UpdateInstanceConfiguration(request *model.UpdateInstanceConfigurationRequest) (*model.UpdateInstanceConfigurationResponse, error) {
+ requestDef := GenReqDefForUpdateInstanceConfiguration()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.UpdateInstanceConfigurationResponse), nil
+ }
+}
+
+// UpdateInstanceConfigurationInvoker 修改指定实例的参数
+func (c *RdsClient) UpdateInstanceConfigurationInvoker(request *model.UpdateInstanceConfigurationRequest) *UpdateInstanceConfigurationInvoker {
+ requestDef := GenReqDefForUpdateInstanceConfiguration()
+ return &UpdateInstanceConfigurationInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// UpdateInstanceConfigurationAsync 修改指定实例的参数
+//
+// 修改指定实例的参数。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) UpdateInstanceConfigurationAsync(request *model.UpdateInstanceConfigurationAsyncRequest) (*model.UpdateInstanceConfigurationAsyncResponse, error) {
+ requestDef := GenReqDefForUpdateInstanceConfigurationAsync()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.UpdateInstanceConfigurationAsyncResponse), nil
+ }
+}
+
+// UpdateInstanceConfigurationAsyncInvoker 修改指定实例的参数
+func (c *RdsClient) UpdateInstanceConfigurationAsyncInvoker(request *model.UpdateInstanceConfigurationAsyncRequest) *UpdateInstanceConfigurationAsyncInvoker {
+ requestDef := GenReqDefForUpdateInstanceConfigurationAsync()
+ return &UpdateInstanceConfigurationAsyncInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// UpdateInstanceName 修改实例名称
+//
+// 修改实例名称。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) UpdateInstanceName(request *model.UpdateInstanceNameRequest) (*model.UpdateInstanceNameResponse, error) {
+ requestDef := GenReqDefForUpdateInstanceName()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.UpdateInstanceNameResponse), nil
+ }
+}
+
+// UpdateInstanceNameInvoker 修改实例名称
+func (c *RdsClient) UpdateInstanceNameInvoker(request *model.UpdateInstanceNameRequest) *UpdateInstanceNameInvoker {
+ requestDef := GenReqDefForUpdateInstanceName()
+ return &UpdateInstanceNameInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// UpdatePort 修改数据库端口
+//
+// 修改数据库端口
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) UpdatePort(request *model.UpdatePortRequest) (*model.UpdatePortResponse, error) {
+ requestDef := GenReqDefForUpdatePort()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.UpdatePortResponse), nil
+ }
+}
+
+// UpdatePortInvoker 修改数据库端口
+func (c *RdsClient) UpdatePortInvoker(request *model.UpdatePortRequest) *UpdatePortInvoker {
+ requestDef := GenReqDefForUpdatePort()
+ return &UpdatePortInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// UpdatePostgresqlInstanceAlias 修改实例备注信息
+//
+// 修改指定数据库实例的备注信息。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) UpdatePostgresqlInstanceAlias(request *model.UpdatePostgresqlInstanceAliasRequest) (*model.UpdatePostgresqlInstanceAliasResponse, error) {
+ requestDef := GenReqDefForUpdatePostgresqlInstanceAlias()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.UpdatePostgresqlInstanceAliasResponse), nil
+ }
+}
+
+// UpdatePostgresqlInstanceAliasInvoker 修改实例备注信息
+func (c *RdsClient) UpdatePostgresqlInstanceAliasInvoker(request *model.UpdatePostgresqlInstanceAliasRequest) *UpdatePostgresqlInstanceAliasInvoker {
+ requestDef := GenReqDefForUpdatePostgresqlInstanceAlias()
+ return &UpdatePostgresqlInstanceAliasInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// UpdateTdeStatus sqlserverTDE开关
+//
+// sqlserverTDE开关。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) UpdateTdeStatus(request *model.UpdateTdeStatusRequest) (*model.UpdateTdeStatusResponse, error) {
+ requestDef := GenReqDefForUpdateTdeStatus()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.UpdateTdeStatusResponse), nil
+ }
+}
+
+// UpdateTdeStatusInvoker sqlserverTDE开关
+func (c *RdsClient) UpdateTdeStatusInvoker(request *model.UpdateTdeStatusRequest) *UpdateTdeStatusInvoker {
+ requestDef := GenReqDefForUpdateTdeStatus()
+ return &UpdateTdeStatusInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// UpgradeDbMajorVersion
+//
+// PostgreSQL数据库升级大版本。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) UpgradeDbMajorVersion(request *model.UpgradeDbMajorVersionRequest) (*model.UpgradeDbMajorVersionResponse, error) {
+ requestDef := GenReqDefForUpgradeDbMajorVersion()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.UpgradeDbMajorVersionResponse), nil
+ }
+}
+
+// UpgradeDbMajorVersionInvoker
+func (c *RdsClient) UpgradeDbMajorVersionInvoker(request *model.UpgradeDbMajorVersionRequest) *UpgradeDbMajorVersionInvoker {
+ requestDef := GenReqDefForUpgradeDbMajorVersion()
+ return &UpgradeDbMajorVersionInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// UpgradeDbMajorVersionPreCheck
+//
+// 大版本升级前进行升级检查。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) UpgradeDbMajorVersionPreCheck(request *model.UpgradeDbMajorVersionPreCheckRequest) (*model.UpgradeDbMajorVersionPreCheckResponse, error) {
+ requestDef := GenReqDefForUpgradeDbMajorVersionPreCheck()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.UpgradeDbMajorVersionPreCheckResponse), nil
+ }
+}
+
+// UpgradeDbMajorVersionPreCheckInvoker
+func (c *RdsClient) UpgradeDbMajorVersionPreCheckInvoker(request *model.UpgradeDbMajorVersionPreCheckRequest) *UpgradeDbMajorVersionPreCheckInvoker {
+ requestDef := GenReqDefForUpgradeDbMajorVersionPreCheck()
+ return &UpgradeDbMajorVersionPreCheckInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// UpgradeDbVersion 升级内核小版本
+//
+// 对实例进行小版本升级。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) UpgradeDbVersion(request *model.UpgradeDbVersionRequest) (*model.UpgradeDbVersionResponse, error) {
+ requestDef := GenReqDefForUpgradeDbVersion()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.UpgradeDbVersionResponse), nil
+ }
+}
+
+// UpgradeDbVersionInvoker 升级内核小版本
+func (c *RdsClient) UpgradeDbVersionInvoker(request *model.UpgradeDbVersionRequest) *UpgradeDbVersionInvoker {
+ requestDef := GenReqDefForUpgradeDbVersion()
+ return &UpgradeDbVersionInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// UpgradeDbVersionNew 升级内核小版本
+//
+// 对实例进行小版本升级。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) UpgradeDbVersionNew(request *model.UpgradeDbVersionNewRequest) (*model.UpgradeDbVersionNewResponse, error) {
+ requestDef := GenReqDefForUpgradeDbVersionNew()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.UpgradeDbVersionNewResponse), nil
+ }
+}
+
+// UpgradeDbVersionNewInvoker 升级内核小版本
+func (c *RdsClient) UpgradeDbVersionNewInvoker(request *model.UpgradeDbVersionNewRequest) *UpgradeDbVersionNewInvoker {
+ requestDef := GenReqDefForUpgradeDbVersionNew()
+ return &UpgradeDbVersionNewInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListApiVersion 查询API版本列表
+//
+// 查询API版本列表。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListApiVersion(request *model.ListApiVersionRequest) (*model.ListApiVersionResponse, error) {
+ requestDef := GenReqDefForListApiVersion()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListApiVersionResponse), nil
+ }
+}
+
+// ListApiVersionInvoker 查询API版本列表
+func (c *RdsClient) ListApiVersionInvoker(request *model.ListApiVersionRequest) *ListApiVersionInvoker {
+ requestDef := GenReqDefForListApiVersion()
+ return &ListApiVersionInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListApiVersionNew 查询API版本列表
+//
+// 查询API版本列表。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListApiVersionNew(request *model.ListApiVersionNewRequest) (*model.ListApiVersionNewResponse, error) {
+ requestDef := GenReqDefForListApiVersionNew()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListApiVersionNewResponse), nil
+ }
+}
+
+// ListApiVersionNewInvoker 查询API版本列表
+func (c *RdsClient) ListApiVersionNewInvoker(request *model.ListApiVersionNewRequest) *ListApiVersionNewInvoker {
+ requestDef := GenReqDefForListApiVersionNew()
+ return &ListApiVersionNewInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowApiVersion 查询指定的API版本信息
+//
+// 查询指定的API版本信息。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowApiVersion(request *model.ShowApiVersionRequest) (*model.ShowApiVersionResponse, error) {
+ requestDef := GenReqDefForShowApiVersion()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowApiVersionResponse), nil
+ }
+}
+
+// ShowApiVersionInvoker 查询指定的API版本信息
+func (c *RdsClient) ShowApiVersionInvoker(request *model.ShowApiVersionRequest) *ShowApiVersionInvoker {
+ requestDef := GenReqDefForShowApiVersion()
+ return &ShowApiVersionInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// AllowDbUserPrivilege 授权数据库帐号
+//
+// 授权数据库帐号。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) AllowDbUserPrivilege(request *model.AllowDbUserPrivilegeRequest) (*model.AllowDbUserPrivilegeResponse, error) {
+ requestDef := GenReqDefForAllowDbUserPrivilege()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.AllowDbUserPrivilegeResponse), nil
+ }
+}
+
+// AllowDbUserPrivilegeInvoker 授权数据库帐号
+func (c *RdsClient) AllowDbUserPrivilegeInvoker(request *model.AllowDbUserPrivilegeRequest) *AllowDbUserPrivilegeInvoker {
+ requestDef := GenReqDefForAllowDbUserPrivilege()
+ return &AllowDbUserPrivilegeInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// CreateDatabase 创建数据库
+//
+// 创建数据库。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) CreateDatabase(request *model.CreateDatabaseRequest) (*model.CreateDatabaseResponse, error) {
+ requestDef := GenReqDefForCreateDatabase()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.CreateDatabaseResponse), nil
+ }
+}
+
+// CreateDatabaseInvoker 创建数据库
+func (c *RdsClient) CreateDatabaseInvoker(request *model.CreateDatabaseRequest) *CreateDatabaseInvoker {
+ requestDef := GenReqDefForCreateDatabase()
+ return &CreateDatabaseInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// CreateDbUser 创建数据库用户
+//
+// 在指定实例中创建数据库帐号。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) CreateDbUser(request *model.CreateDbUserRequest) (*model.CreateDbUserResponse, error) {
+ requestDef := GenReqDefForCreateDbUser()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.CreateDbUserResponse), nil
+ }
+}
+
+// CreateDbUserInvoker 创建数据库用户
+func (c *RdsClient) CreateDbUserInvoker(request *model.CreateDbUserRequest) *CreateDbUserInvoker {
+ requestDef := GenReqDefForCreateDbUser()
+ return &CreateDbUserInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// DeleteDatabase 删除数据库
+//
+// 删除数据库。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) DeleteDatabase(request *model.DeleteDatabaseRequest) (*model.DeleteDatabaseResponse, error) {
+ requestDef := GenReqDefForDeleteDatabase()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.DeleteDatabaseResponse), nil
+ }
+}
+
+// DeleteDatabaseInvoker 删除数据库
+func (c *RdsClient) DeleteDatabaseInvoker(request *model.DeleteDatabaseRequest) *DeleteDatabaseInvoker {
+ requestDef := GenReqDefForDeleteDatabase()
+ return &DeleteDatabaseInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// DeleteDbUser 删除数据库用户
+//
+// 删除数据库用户。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) DeleteDbUser(request *model.DeleteDbUserRequest) (*model.DeleteDbUserResponse, error) {
+ requestDef := GenReqDefForDeleteDbUser()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.DeleteDbUserResponse), nil
+ }
+}
+
+// DeleteDbUserInvoker 删除数据库用户
+func (c *RdsClient) DeleteDbUserInvoker(request *model.DeleteDbUserRequest) *DeleteDbUserInvoker {
+ requestDef := GenReqDefForDeleteDbUser()
+ return &DeleteDbUserInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListAuthorizedDatabases 查询指定用户的已授权数据库
+//
+// 查询指定用户的已授权数据库。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListAuthorizedDatabases(request *model.ListAuthorizedDatabasesRequest) (*model.ListAuthorizedDatabasesResponse, error) {
+ requestDef := GenReqDefForListAuthorizedDatabases()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListAuthorizedDatabasesResponse), nil
+ }
+}
+
+// ListAuthorizedDatabasesInvoker 查询指定用户的已授权数据库
+func (c *RdsClient) ListAuthorizedDatabasesInvoker(request *model.ListAuthorizedDatabasesRequest) *ListAuthorizedDatabasesInvoker {
+ requestDef := GenReqDefForListAuthorizedDatabases()
+ return &ListAuthorizedDatabasesInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListAuthorizedDbUsers 查询指定数据库的已授权用户
+//
+// 查询指定数据库的已授权用户。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListAuthorizedDbUsers(request *model.ListAuthorizedDbUsersRequest) (*model.ListAuthorizedDbUsersResponse, error) {
+ requestDef := GenReqDefForListAuthorizedDbUsers()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListAuthorizedDbUsersResponse), nil
+ }
+}
+
+// ListAuthorizedDbUsersInvoker 查询指定数据库的已授权用户
+func (c *RdsClient) ListAuthorizedDbUsersInvoker(request *model.ListAuthorizedDbUsersRequest) *ListAuthorizedDbUsersInvoker {
+ requestDef := GenReqDefForListAuthorizedDbUsers()
+ return &ListAuthorizedDbUsersInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListDatabases 查询数据库列表
+//
+// 查询数据库列表。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListDatabases(request *model.ListDatabasesRequest) (*model.ListDatabasesResponse, error) {
+ requestDef := GenReqDefForListDatabases()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListDatabasesResponse), nil
+ }
+}
+
+// ListDatabasesInvoker 查询数据库列表
+func (c *RdsClient) ListDatabasesInvoker(request *model.ListDatabasesRequest) *ListDatabasesInvoker {
+ requestDef := GenReqDefForListDatabases()
+ return &ListDatabasesInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListDbUsers 查询数据库用户列表
+//
+// 查询数据库用户列表。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListDbUsers(request *model.ListDbUsersRequest) (*model.ListDbUsersResponse, error) {
+ requestDef := GenReqDefForListDbUsers()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListDbUsersResponse), nil
+ }
+}
+
+// ListDbUsersInvoker 查询数据库用户列表
+func (c *RdsClient) ListDbUsersInvoker(request *model.ListDbUsersRequest) *ListDbUsersInvoker {
+ requestDef := GenReqDefForListDbUsers()
+ return &ListDbUsersInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ResetPwd 重置数据库密码
+//
+// 重置数据库密码.
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ResetPwd(request *model.ResetPwdRequest) (*model.ResetPwdResponse, error) {
+ requestDef := GenReqDefForResetPwd()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ResetPwdResponse), nil
+ }
+}
+
+// ResetPwdInvoker 重置数据库密码
+func (c *RdsClient) ResetPwdInvoker(request *model.ResetPwdRequest) *ResetPwdInvoker {
+ requestDef := GenReqDefForResetPwd()
+ return &ResetPwdInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// Revoke 解除数据库帐号权限
+//
+// 解除数据库帐号权限。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) Revoke(request *model.RevokeRequest) (*model.RevokeResponse, error) {
+ requestDef := GenReqDefForRevoke()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.RevokeResponse), nil
+ }
+}
+
+// RevokeInvoker 解除数据库帐号权限
+func (c *RdsClient) RevokeInvoker(request *model.RevokeRequest) *RevokeInvoker {
+ requestDef := GenReqDefForRevoke()
+ return &RevokeInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// SetDbUserPwd 设置数据库账号密码
+//
+// 设置数据库账号密码
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) SetDbUserPwd(request *model.SetDbUserPwdRequest) (*model.SetDbUserPwdResponse, error) {
+ requestDef := GenReqDefForSetDbUserPwd()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.SetDbUserPwdResponse), nil
+ }
+}
+
+// SetDbUserPwdInvoker 设置数据库账号密码
+func (c *RdsClient) SetDbUserPwdInvoker(request *model.SetDbUserPwdRequest) *SetDbUserPwdInvoker {
+ requestDef := GenReqDefForSetDbUserPwd()
+ return &SetDbUserPwdInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// SetReadOnlySwitch 设置数据库用户只读参数
+//
+// 根据业务需求,设置数据库用户只读
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) SetReadOnlySwitch(request *model.SetReadOnlySwitchRequest) (*model.SetReadOnlySwitchResponse, error) {
+ requestDef := GenReqDefForSetReadOnlySwitch()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.SetReadOnlySwitchResponse), nil
+ }
+}
+
+// SetReadOnlySwitchInvoker 设置数据库用户只读参数
+func (c *RdsClient) SetReadOnlySwitchInvoker(request *model.SetReadOnlySwitchRequest) *SetReadOnlySwitchInvoker {
+ requestDef := GenReqDefForSetReadOnlySwitch()
+ return &SetReadOnlySwitchInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// UpdateDatabase 修改指定实例的数据库备注
+//
+// 修改指定实例中的数据库备注。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) UpdateDatabase(request *model.UpdateDatabaseRequest) (*model.UpdateDatabaseResponse, error) {
+ requestDef := GenReqDefForUpdateDatabase()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.UpdateDatabaseResponse), nil
+ }
+}
+
+// UpdateDatabaseInvoker 修改指定实例的数据库备注
+func (c *RdsClient) UpdateDatabaseInvoker(request *model.UpdateDatabaseRequest) *UpdateDatabaseInvoker {
+ requestDef := GenReqDefForUpdateDatabase()
+ return &UpdateDatabaseInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// UpdateDbUserComment 修改数据库用户名备注
+//
+// 修改数据库用户名备注
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) UpdateDbUserComment(request *model.UpdateDbUserCommentRequest) (*model.UpdateDbUserCommentResponse, error) {
+ requestDef := GenReqDefForUpdateDbUserComment()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.UpdateDbUserCommentResponse), nil
+ }
+}
+
+// UpdateDbUserCommentInvoker 修改数据库用户名备注
+func (c *RdsClient) UpdateDbUserCommentInvoker(request *model.UpdateDbUserCommentRequest) *UpdateDbUserCommentInvoker {
+ requestDef := GenReqDefForUpdateDbUserComment()
+ return &UpdateDbUserCommentInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// AllowDbPrivilege 授权数据库帐号
+//
+// 在指定实例的数据库中, 设置帐号的权限。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) AllowDbPrivilege(request *model.AllowDbPrivilegeRequest) (*model.AllowDbPrivilegeResponse, error) {
+ requestDef := GenReqDefForAllowDbPrivilege()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.AllowDbPrivilegeResponse), nil
+ }
+}
+
+// AllowDbPrivilegeInvoker 授权数据库帐号
+func (c *RdsClient) AllowDbPrivilegeInvoker(request *model.AllowDbPrivilegeRequest) *AllowDbPrivilegeInvoker {
+ requestDef := GenReqDefForAllowDbPrivilege()
+ return &AllowDbPrivilegeInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ChangeProxyScale 数据库代理规格变更
+//
+// 数据库代理实例进行规格变更。
+//
+// - 调用接口前,您需要了解API 认证鉴权。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ChangeProxyScale(request *model.ChangeProxyScaleRequest) (*model.ChangeProxyScaleResponse, error) {
+ requestDef := GenReqDefForChangeProxyScale()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ChangeProxyScaleResponse), nil
+ }
+}
+
+// ChangeProxyScaleInvoker 数据库代理规格变更
+func (c *RdsClient) ChangeProxyScaleInvoker(request *model.ChangeProxyScaleRequest) *ChangeProxyScaleInvoker {
+ requestDef := GenReqDefForChangeProxyScale()
+ return &ChangeProxyScaleInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ChangeTheDelayThreshold 修改读写分离阈值
+//
+// 修改指定实例的读写分离延时阈值。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ChangeTheDelayThreshold(request *model.ChangeTheDelayThresholdRequest) (*model.ChangeTheDelayThresholdResponse, error) {
+ requestDef := GenReqDefForChangeTheDelayThreshold()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ChangeTheDelayThresholdResponse), nil
+ }
+}
+
+// ChangeTheDelayThresholdInvoker 修改读写分离阈值
+func (c *RdsClient) ChangeTheDelayThresholdInvoker(request *model.ChangeTheDelayThresholdRequest) *ChangeTheDelayThresholdInvoker {
+ requestDef := GenReqDefForChangeTheDelayThreshold()
+ return &ChangeTheDelayThresholdInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// CreatePostgresqlDatabase 创建数据库
+//
+// 在指定实例中创建数据库。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) CreatePostgresqlDatabase(request *model.CreatePostgresqlDatabaseRequest) (*model.CreatePostgresqlDatabaseResponse, error) {
+ requestDef := GenReqDefForCreatePostgresqlDatabase()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.CreatePostgresqlDatabaseResponse), nil
+ }
+}
+
+// CreatePostgresqlDatabaseInvoker 创建数据库
+func (c *RdsClient) CreatePostgresqlDatabaseInvoker(request *model.CreatePostgresqlDatabaseRequest) *CreatePostgresqlDatabaseInvoker {
+ requestDef := GenReqDefForCreatePostgresqlDatabase()
+ return &CreatePostgresqlDatabaseInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// CreatePostgresqlDatabaseSchema 创建数据库SCHEMA
+//
+// 在指定实例的数据库中, 创建数据库schema。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) CreatePostgresqlDatabaseSchema(request *model.CreatePostgresqlDatabaseSchemaRequest) (*model.CreatePostgresqlDatabaseSchemaResponse, error) {
+ requestDef := GenReqDefForCreatePostgresqlDatabaseSchema()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.CreatePostgresqlDatabaseSchemaResponse), nil
+ }
+}
+
+// CreatePostgresqlDatabaseSchemaInvoker 创建数据库SCHEMA
+func (c *RdsClient) CreatePostgresqlDatabaseSchemaInvoker(request *model.CreatePostgresqlDatabaseSchemaRequest) *CreatePostgresqlDatabaseSchemaInvoker {
+ requestDef := GenReqDefForCreatePostgresqlDatabaseSchema()
+ return &CreatePostgresqlDatabaseSchemaInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// CreatePostgresqlDbUser 创建数据库用户
+//
+// 在指定实例中创建数据库用户。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) CreatePostgresqlDbUser(request *model.CreatePostgresqlDbUserRequest) (*model.CreatePostgresqlDbUserResponse, error) {
+ requestDef := GenReqDefForCreatePostgresqlDbUser()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.CreatePostgresqlDbUserResponse), nil
+ }
+}
+
+// CreatePostgresqlDbUserInvoker 创建数据库用户
+func (c *RdsClient) CreatePostgresqlDbUserInvoker(request *model.CreatePostgresqlDbUserRequest) *CreatePostgresqlDbUserInvoker {
+ requestDef := GenReqDefForCreatePostgresqlDbUser()
+ return &CreatePostgresqlDbUserInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// CreatePostgresqlExtension 创建插件
+//
+// 在指定数据库上创建插件。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) CreatePostgresqlExtension(request *model.CreatePostgresqlExtensionRequest) (*model.CreatePostgresqlExtensionResponse, error) {
+ requestDef := GenReqDefForCreatePostgresqlExtension()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.CreatePostgresqlExtensionResponse), nil
+ }
+}
+
+// CreatePostgresqlExtensionInvoker 创建插件
+func (c *RdsClient) CreatePostgresqlExtensionInvoker(request *model.CreatePostgresqlExtensionRequest) *CreatePostgresqlExtensionInvoker {
+ requestDef := GenReqDefForCreatePostgresqlExtension()
+ return &CreatePostgresqlExtensionInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// DeletePostgresqlDatabase 删除数据库
+//
+// 删除数据库。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) DeletePostgresqlDatabase(request *model.DeletePostgresqlDatabaseRequest) (*model.DeletePostgresqlDatabaseResponse, error) {
+ requestDef := GenReqDefForDeletePostgresqlDatabase()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.DeletePostgresqlDatabaseResponse), nil
+ }
+}
+
+// DeletePostgresqlDatabaseInvoker 删除数据库
+func (c *RdsClient) DeletePostgresqlDatabaseInvoker(request *model.DeletePostgresqlDatabaseRequest) *DeletePostgresqlDatabaseInvoker {
+ requestDef := GenReqDefForDeletePostgresqlDatabase()
+ return &DeletePostgresqlDatabaseInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// DeletePostgresqlDbUser 删除数据库用户
+//
+// 删除数据库用户。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) DeletePostgresqlDbUser(request *model.DeletePostgresqlDbUserRequest) (*model.DeletePostgresqlDbUserResponse, error) {
+ requestDef := GenReqDefForDeletePostgresqlDbUser()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.DeletePostgresqlDbUserResponse), nil
+ }
+}
+
+// DeletePostgresqlDbUserInvoker 删除数据库用户
+func (c *RdsClient) DeletePostgresqlDbUserInvoker(request *model.DeletePostgresqlDbUserRequest) *DeletePostgresqlDbUserInvoker {
+ requestDef := GenReqDefForDeletePostgresqlDbUser()
+ return &DeletePostgresqlDbUserInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// DeletePostgresqlExtension 删除插件
+//
+// 在指定数据库上删除插件。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) DeletePostgresqlExtension(request *model.DeletePostgresqlExtensionRequest) (*model.DeletePostgresqlExtensionResponse, error) {
+ requestDef := GenReqDefForDeletePostgresqlExtension()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.DeletePostgresqlExtensionResponse), nil
+ }
+}
+
+// DeletePostgresqlExtensionInvoker 删除插件
+func (c *RdsClient) DeletePostgresqlExtensionInvoker(request *model.DeletePostgresqlExtensionRequest) *DeletePostgresqlExtensionInvoker {
+ requestDef := GenReqDefForDeletePostgresqlExtension()
+ return &DeletePostgresqlExtensionInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListPostgresqlDatabaseSchemas 查询数据库SCHEMA列表
+//
+// 查询指定实例的数据库SCHEMA列表。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListPostgresqlDatabaseSchemas(request *model.ListPostgresqlDatabaseSchemasRequest) (*model.ListPostgresqlDatabaseSchemasResponse, error) {
+ requestDef := GenReqDefForListPostgresqlDatabaseSchemas()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListPostgresqlDatabaseSchemasResponse), nil
+ }
+}
+
+// ListPostgresqlDatabaseSchemasInvoker 查询数据库SCHEMA列表
+func (c *RdsClient) ListPostgresqlDatabaseSchemasInvoker(request *model.ListPostgresqlDatabaseSchemasRequest) *ListPostgresqlDatabaseSchemasInvoker {
+ requestDef := GenReqDefForListPostgresqlDatabaseSchemas()
+ return &ListPostgresqlDatabaseSchemasInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListPostgresqlDatabases 查询数据库列表
+//
+// 查询指定实例中的数据库列表。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListPostgresqlDatabases(request *model.ListPostgresqlDatabasesRequest) (*model.ListPostgresqlDatabasesResponse, error) {
+ requestDef := GenReqDefForListPostgresqlDatabases()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListPostgresqlDatabasesResponse), nil
+ }
+}
+
+// ListPostgresqlDatabasesInvoker 查询数据库列表
+func (c *RdsClient) ListPostgresqlDatabasesInvoker(request *model.ListPostgresqlDatabasesRequest) *ListPostgresqlDatabasesInvoker {
+ requestDef := GenReqDefForListPostgresqlDatabases()
+ return &ListPostgresqlDatabasesInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListPostgresqlDbUserPaginated 查询数据库用户列表
+//
+// 在指定实例中查询数据库用户列表。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListPostgresqlDbUserPaginated(request *model.ListPostgresqlDbUserPaginatedRequest) (*model.ListPostgresqlDbUserPaginatedResponse, error) {
+ requestDef := GenReqDefForListPostgresqlDbUserPaginated()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListPostgresqlDbUserPaginatedResponse), nil
+ }
+}
+
+// ListPostgresqlDbUserPaginatedInvoker 查询数据库用户列表
+func (c *RdsClient) ListPostgresqlDbUserPaginatedInvoker(request *model.ListPostgresqlDbUserPaginatedRequest) *ListPostgresqlDbUserPaginatedInvoker {
+ requestDef := GenReqDefForListPostgresqlDbUserPaginated()
+ return &ListPostgresqlDbUserPaginatedInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListPostgresqlExtension 查询插件
+//
+// 获取指定数据库的插件信息。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListPostgresqlExtension(request *model.ListPostgresqlExtensionRequest) (*model.ListPostgresqlExtensionResponse, error) {
+ requestDef := GenReqDefForListPostgresqlExtension()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListPostgresqlExtensionResponse), nil
+ }
+}
+
+// ListPostgresqlExtensionInvoker 查询插件
+func (c *RdsClient) ListPostgresqlExtensionInvoker(request *model.ListPostgresqlExtensionRequest) *ListPostgresqlExtensionInvoker {
+ requestDef := GenReqDefForListPostgresqlExtension()
+ return &ListPostgresqlExtensionInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// RevokePostgresqlDbPrivilege 解除数据库帐号权限
+//
+// 解除数据库帐号权限
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) RevokePostgresqlDbPrivilege(request *model.RevokePostgresqlDbPrivilegeRequest) (*model.RevokePostgresqlDbPrivilegeResponse, error) {
+ requestDef := GenReqDefForRevokePostgresqlDbPrivilege()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.RevokePostgresqlDbPrivilegeResponse), nil
+ }
+}
+
+// RevokePostgresqlDbPrivilegeInvoker 解除数据库帐号权限
+func (c *RdsClient) RevokePostgresqlDbPrivilegeInvoker(request *model.RevokePostgresqlDbPrivilegeRequest) *RevokePostgresqlDbPrivilegeInvoker {
+ requestDef := GenReqDefForRevokePostgresqlDbPrivilege()
+ return &RevokePostgresqlDbPrivilegeInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// SearchQueryScaleComputeFlavors 查询数据库代理可变更的规格
+//
+// 查询数据库代理可变更的规格信息。
+//
+// - 调用接口前,您需要了解API 认证鉴权。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) SearchQueryScaleComputeFlavors(request *model.SearchQueryScaleComputeFlavorsRequest) (*model.SearchQueryScaleComputeFlavorsResponse, error) {
+ requestDef := GenReqDefForSearchQueryScaleComputeFlavors()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.SearchQueryScaleComputeFlavorsResponse), nil
+ }
+}
+
+// SearchQueryScaleComputeFlavorsInvoker 查询数据库代理可变更的规格
+func (c *RdsClient) SearchQueryScaleComputeFlavorsInvoker(request *model.SearchQueryScaleComputeFlavorsRequest) *SearchQueryScaleComputeFlavorsInvoker {
+ requestDef := GenReqDefForSearchQueryScaleComputeFlavors()
+ return &SearchQueryScaleComputeFlavorsInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// SearchQueryScaleFlavors 查询数据库代理可变更的规格
+//
+// 查询数据库代理可变更的规格信息。
+//
+// - 调用接口前,您需要了解API 认证鉴权。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) SearchQueryScaleFlavors(request *model.SearchQueryScaleFlavorsRequest) (*model.SearchQueryScaleFlavorsResponse, error) {
+ requestDef := GenReqDefForSearchQueryScaleFlavors()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.SearchQueryScaleFlavorsResponse), nil
+ }
+}
+
+// SearchQueryScaleFlavorsInvoker 查询数据库代理可变更的规格
+func (c *RdsClient) SearchQueryScaleFlavorsInvoker(request *model.SearchQueryScaleFlavorsRequest) *SearchQueryScaleFlavorsInvoker {
+ requestDef := GenReqDefForSearchQueryScaleFlavors()
+ return &SearchQueryScaleFlavorsInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// SetDatabaseUserPrivilege 设置数据库用户权限
+//
+// 设置数据库用户权限:只读或可读写。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) SetDatabaseUserPrivilege(request *model.SetDatabaseUserPrivilegeRequest) (*model.SetDatabaseUserPrivilegeResponse, error) {
+ requestDef := GenReqDefForSetDatabaseUserPrivilege()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.SetDatabaseUserPrivilegeResponse), nil
+ }
+}
+
+// SetDatabaseUserPrivilegeInvoker 设置数据库用户权限
+func (c *RdsClient) SetDatabaseUserPrivilegeInvoker(request *model.SetDatabaseUserPrivilegeRequest) *SetDatabaseUserPrivilegeInvoker {
+ requestDef := GenReqDefForSetDatabaseUserPrivilege()
+ return &SetDatabaseUserPrivilegeInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// SetPostgresqlDbUserPwd 重置数据库帐号密码
+//
+// 重置指定数据库帐号的密码。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) SetPostgresqlDbUserPwd(request *model.SetPostgresqlDbUserPwdRequest) (*model.SetPostgresqlDbUserPwdResponse, error) {
+ requestDef := GenReqDefForSetPostgresqlDbUserPwd()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.SetPostgresqlDbUserPwdResponse), nil
+ }
+}
+
+// SetPostgresqlDbUserPwdInvoker 重置数据库帐号密码
+func (c *RdsClient) SetPostgresqlDbUserPwdInvoker(request *model.SetPostgresqlDbUserPwdRequest) *SetPostgresqlDbUserPwdInvoker {
+ requestDef := GenReqDefForSetPostgresqlDbUserPwd()
+ return &SetPostgresqlDbUserPwdInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowInformationAboutDatabaseProxy 查询数据库代理信息
+//
+// 查询指定实例的数据库代理详细信息。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowInformationAboutDatabaseProxy(request *model.ShowInformationAboutDatabaseProxyRequest) (*model.ShowInformationAboutDatabaseProxyResponse, error) {
+ requestDef := GenReqDefForShowInformationAboutDatabaseProxy()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowInformationAboutDatabaseProxyResponse), nil
+ }
+}
+
+// ShowInformationAboutDatabaseProxyInvoker 查询数据库代理信息
+func (c *RdsClient) ShowInformationAboutDatabaseProxyInvoker(request *model.ShowInformationAboutDatabaseProxyRequest) *ShowInformationAboutDatabaseProxyInvoker {
+ requestDef := GenReqDefForShowInformationAboutDatabaseProxy()
+ return &ShowInformationAboutDatabaseProxyInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ShowPostgresqlParamValue 获取实例指定参数的值
+//
+// 获取实例指定参数的值。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ShowPostgresqlParamValue(request *model.ShowPostgresqlParamValueRequest) (*model.ShowPostgresqlParamValueResponse, error) {
+ requestDef := GenReqDefForShowPostgresqlParamValue()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ShowPostgresqlParamValueResponse), nil
+ }
+}
+
+// ShowPostgresqlParamValueInvoker 获取实例指定参数的值
+func (c *RdsClient) ShowPostgresqlParamValueInvoker(request *model.ShowPostgresqlParamValueRequest) *ShowPostgresqlParamValueInvoker {
+ requestDef := GenReqDefForShowPostgresqlParamValue()
+ return &ShowPostgresqlParamValueInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// StartDatabaseProxy 开启数据库代理
+//
+// 为指定实例开启数据库代理。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) StartDatabaseProxy(request *model.StartDatabaseProxyRequest) (*model.StartDatabaseProxyResponse, error) {
+ requestDef := GenReqDefForStartDatabaseProxy()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.StartDatabaseProxyResponse), nil
+ }
+}
+
+// StartDatabaseProxyInvoker 开启数据库代理
+func (c *RdsClient) StartDatabaseProxyInvoker(request *model.StartDatabaseProxyRequest) *StartDatabaseProxyInvoker {
+ requestDef := GenReqDefForStartDatabaseProxy()
+ return &StartDatabaseProxyInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// StopDatabaseProxy 关闭数据库代理
+//
+// 为指定实例关闭数据库代理。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) StopDatabaseProxy(request *model.StopDatabaseProxyRequest) (*model.StopDatabaseProxyResponse, error) {
+ requestDef := GenReqDefForStopDatabaseProxy()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.StopDatabaseProxyResponse), nil
+ }
+}
+
+// StopDatabaseProxyInvoker 关闭数据库代理
+func (c *RdsClient) StopDatabaseProxyInvoker(request *model.StopDatabaseProxyRequest) *StopDatabaseProxyInvoker {
+ requestDef := GenReqDefForStopDatabaseProxy()
+ return &StopDatabaseProxyInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// UpdateDbUserPrivilege
+//
+// 数据库帐号授权。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) UpdateDbUserPrivilege(request *model.UpdateDbUserPrivilegeRequest) (*model.UpdateDbUserPrivilegeResponse, error) {
+ requestDef := GenReqDefForUpdateDbUserPrivilege()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.UpdateDbUserPrivilegeResponse), nil
+ }
+}
+
+// UpdateDbUserPrivilegeInvoker
+func (c *RdsClient) UpdateDbUserPrivilegeInvoker(request *model.UpdateDbUserPrivilegeRequest) *UpdateDbUserPrivilegeInvoker {
+ requestDef := GenReqDefForUpdateDbUserPrivilege()
+ return &UpdateDbUserPrivilegeInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// UpdatePostgresqlDatabase 修改指定实例的数据库备注
+//
+// 修改指定实例中的数据库备注。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) UpdatePostgresqlDatabase(request *model.UpdatePostgresqlDatabaseRequest) (*model.UpdatePostgresqlDatabaseResponse, error) {
+ requestDef := GenReqDefForUpdatePostgresqlDatabase()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.UpdatePostgresqlDatabaseResponse), nil
+ }
+}
+
+// UpdatePostgresqlDatabaseInvoker 修改指定实例的数据库备注
+func (c *RdsClient) UpdatePostgresqlDatabaseInvoker(request *model.UpdatePostgresqlDatabaseRequest) *UpdatePostgresqlDatabaseInvoker {
+ requestDef := GenReqDefForUpdatePostgresqlDatabase()
+ return &UpdatePostgresqlDatabaseInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// UpdatePostgresqlDbUserComment 修改数据库用户名备注
+//
+// 修改数据库用户名备注
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) UpdatePostgresqlDbUserComment(request *model.UpdatePostgresqlDbUserCommentRequest) (*model.UpdatePostgresqlDbUserCommentResponse, error) {
+ requestDef := GenReqDefForUpdatePostgresqlDbUserComment()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.UpdatePostgresqlDbUserCommentResponse), nil
+ }
+}
+
+// UpdatePostgresqlDbUserCommentInvoker 修改数据库用户名备注
+func (c *RdsClient) UpdatePostgresqlDbUserCommentInvoker(request *model.UpdatePostgresqlDbUserCommentRequest) *UpdatePostgresqlDbUserCommentInvoker {
+ requestDef := GenReqDefForUpdatePostgresqlDbUserComment()
+ return &UpdatePostgresqlDbUserCommentInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// UpdatePostgresqlParameterValue 修改实例指定参数的值
+//
+// 修改实例指定参数的值。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) UpdatePostgresqlParameterValue(request *model.UpdatePostgresqlParameterValueRequest) (*model.UpdatePostgresqlParameterValueResponse, error) {
+ requestDef := GenReqDefForUpdatePostgresqlParameterValue()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.UpdatePostgresqlParameterValueResponse), nil
+ }
+}
+
+// UpdatePostgresqlParameterValueInvoker 修改实例指定参数的值
+func (c *RdsClient) UpdatePostgresqlParameterValueInvoker(request *model.UpdatePostgresqlParameterValueRequest) *UpdatePostgresqlParameterValueInvoker {
+ requestDef := GenReqDefForUpdatePostgresqlParameterValue()
+ return &UpdatePostgresqlParameterValueInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// UpdateReadWeight 修改读写分离权重
+//
+// 修改指定实例的读写分离权重。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) UpdateReadWeight(request *model.UpdateReadWeightRequest) (*model.UpdateReadWeightResponse, error) {
+ requestDef := GenReqDefForUpdateReadWeight()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.UpdateReadWeightResponse), nil
+ }
+}
+
+// UpdateReadWeightInvoker 修改读写分离权重
+func (c *RdsClient) UpdateReadWeightInvoker(request *model.UpdateReadWeightRequest) *UpdateReadWeightInvoker {
+ requestDef := GenReqDefForUpdateReadWeight()
+ return &UpdateReadWeightInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// AllowSqlserverDbUserPrivilege 授权数据库帐号
+//
+// 授权数据库帐号。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) AllowSqlserverDbUserPrivilege(request *model.AllowSqlserverDbUserPrivilegeRequest) (*model.AllowSqlserverDbUserPrivilegeResponse, error) {
+ requestDef := GenReqDefForAllowSqlserverDbUserPrivilege()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.AllowSqlserverDbUserPrivilegeResponse), nil
+ }
+}
+
+// AllowSqlserverDbUserPrivilegeInvoker 授权数据库帐号
+func (c *RdsClient) AllowSqlserverDbUserPrivilegeInvoker(request *model.AllowSqlserverDbUserPrivilegeRequest) *AllowSqlserverDbUserPrivilegeInvoker {
+ requestDef := GenReqDefForAllowSqlserverDbUserPrivilege()
+ return &AllowSqlserverDbUserPrivilegeInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// BatchAddMsdtcs 添加MSDTC
+//
+// 添加MSDTC相关主机host地址
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) BatchAddMsdtcs(request *model.BatchAddMsdtcsRequest) (*model.BatchAddMsdtcsResponse, error) {
+ requestDef := GenReqDefForBatchAddMsdtcs()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.BatchAddMsdtcsResponse), nil
+ }
+}
+
+// BatchAddMsdtcsInvoker 添加MSDTC
+func (c *RdsClient) BatchAddMsdtcsInvoker(request *model.BatchAddMsdtcsRequest) *BatchAddMsdtcsInvoker {
+ requestDef := GenReqDefForBatchAddMsdtcs()
+ return &BatchAddMsdtcsInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// CreateSqlserverDatabase 创建数据库
+//
+// 创建数据库。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) CreateSqlserverDatabase(request *model.CreateSqlserverDatabaseRequest) (*model.CreateSqlserverDatabaseResponse, error) {
+ requestDef := GenReqDefForCreateSqlserverDatabase()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.CreateSqlserverDatabaseResponse), nil
+ }
+}
+
+// CreateSqlserverDatabaseInvoker 创建数据库
+func (c *RdsClient) CreateSqlserverDatabaseInvoker(request *model.CreateSqlserverDatabaseRequest) *CreateSqlserverDatabaseInvoker {
+ requestDef := GenReqDefForCreateSqlserverDatabase()
+ return &CreateSqlserverDatabaseInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// CreateSqlserverDbUser 创建数据库用户
+//
+// 创建数据库用户。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) CreateSqlserverDbUser(request *model.CreateSqlserverDbUserRequest) (*model.CreateSqlserverDbUserResponse, error) {
+ requestDef := GenReqDefForCreateSqlserverDbUser()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.CreateSqlserverDbUserResponse), nil
+ }
+}
+
+// CreateSqlserverDbUserInvoker 创建数据库用户
+func (c *RdsClient) CreateSqlserverDbUserInvoker(request *model.CreateSqlserverDbUserRequest) *CreateSqlserverDbUserInvoker {
+ requestDef := GenReqDefForCreateSqlserverDbUser()
+ return &CreateSqlserverDbUserInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// DeleteSqlserverDatabase 删除数据库
+//
+// 删除数据库。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) DeleteSqlserverDatabase(request *model.DeleteSqlserverDatabaseRequest) (*model.DeleteSqlserverDatabaseResponse, error) {
+ requestDef := GenReqDefForDeleteSqlserverDatabase()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.DeleteSqlserverDatabaseResponse), nil
+ }
+}
+
+// DeleteSqlserverDatabaseInvoker 删除数据库
+func (c *RdsClient) DeleteSqlserverDatabaseInvoker(request *model.DeleteSqlserverDatabaseRequest) *DeleteSqlserverDatabaseInvoker {
+ requestDef := GenReqDefForDeleteSqlserverDatabase()
+ return &DeleteSqlserverDatabaseInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// DeleteSqlserverDatabaseEx 删除数据库
+//
+// 删除数据库。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) DeleteSqlserverDatabaseEx(request *model.DeleteSqlserverDatabaseExRequest) (*model.DeleteSqlserverDatabaseExResponse, error) {
+ requestDef := GenReqDefForDeleteSqlserverDatabaseEx()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.DeleteSqlserverDatabaseExResponse), nil
+ }
+}
+
+// DeleteSqlserverDatabaseExInvoker 删除数据库
+func (c *RdsClient) DeleteSqlserverDatabaseExInvoker(request *model.DeleteSqlserverDatabaseExRequest) *DeleteSqlserverDatabaseExInvoker {
+ requestDef := GenReqDefForDeleteSqlserverDatabaseEx()
+ return &DeleteSqlserverDatabaseExInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// DeleteSqlserverDbUser 删除数据库用户
+//
+// 删除数据库用户。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) DeleteSqlserverDbUser(request *model.DeleteSqlserverDbUserRequest) (*model.DeleteSqlserverDbUserResponse, error) {
+ requestDef := GenReqDefForDeleteSqlserverDbUser()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.DeleteSqlserverDbUserResponse), nil
+ }
+}
+
+// DeleteSqlserverDbUserInvoker 删除数据库用户
+func (c *RdsClient) DeleteSqlserverDbUserInvoker(request *model.DeleteSqlserverDbUserRequest) *DeleteSqlserverDbUserInvoker {
+ requestDef := GenReqDefForDeleteSqlserverDbUser()
+ return &DeleteSqlserverDbUserInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListAuthorizedSqlserverDbUsers 查询指定数据库的已授权用户
+//
+// 查询指定数据库的已授权用户。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListAuthorizedSqlserverDbUsers(request *model.ListAuthorizedSqlserverDbUsersRequest) (*model.ListAuthorizedSqlserverDbUsersResponse, error) {
+ requestDef := GenReqDefForListAuthorizedSqlserverDbUsers()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListAuthorizedSqlserverDbUsersResponse), nil
+ }
+}
+
+// ListAuthorizedSqlserverDbUsersInvoker 查询指定数据库的已授权用户
+func (c *RdsClient) ListAuthorizedSqlserverDbUsersInvoker(request *model.ListAuthorizedSqlserverDbUsersRequest) *ListAuthorizedSqlserverDbUsersInvoker {
+ requestDef := GenReqDefForListAuthorizedSqlserverDbUsers()
+ return &ListAuthorizedSqlserverDbUsersInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListMsdtcHosts 查询MSDTC的hosts信息
+//
+// 查询MSDTC的hosts信息
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListMsdtcHosts(request *model.ListMsdtcHostsRequest) (*model.ListMsdtcHostsResponse, error) {
+ requestDef := GenReqDefForListMsdtcHosts()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListMsdtcHostsResponse), nil
+ }
+}
+
+// ListMsdtcHostsInvoker 查询MSDTC的hosts信息
+func (c *RdsClient) ListMsdtcHostsInvoker(request *model.ListMsdtcHostsRequest) *ListMsdtcHostsInvoker {
+ requestDef := GenReqDefForListMsdtcHosts()
+ return &ListMsdtcHostsInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListSqlserverDatabases 查询数据库列表
+//
+// 查询数据库列表。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListSqlserverDatabases(request *model.ListSqlserverDatabasesRequest) (*model.ListSqlserverDatabasesResponse, error) {
+ requestDef := GenReqDefForListSqlserverDatabases()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListSqlserverDatabasesResponse), nil
+ }
+}
+
+// ListSqlserverDatabasesInvoker 查询数据库列表
+func (c *RdsClient) ListSqlserverDatabasesInvoker(request *model.ListSqlserverDatabasesRequest) *ListSqlserverDatabasesInvoker {
+ requestDef := GenReqDefForListSqlserverDatabases()
+ return &ListSqlserverDatabasesInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ListSqlserverDbUsers 查询数据库用户列表
+//
+// 查询数据库用户列表。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ListSqlserverDbUsers(request *model.ListSqlserverDbUsersRequest) (*model.ListSqlserverDbUsersResponse, error) {
+ requestDef := GenReqDefForListSqlserverDbUsers()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ListSqlserverDbUsersResponse), nil
+ }
+}
+
+// ListSqlserverDbUsersInvoker 查询数据库用户列表
+func (c *RdsClient) ListSqlserverDbUsersInvoker(request *model.ListSqlserverDbUsersRequest) *ListSqlserverDbUsersInvoker {
+ requestDef := GenReqDefForListSqlserverDbUsers()
+ return &ListSqlserverDbUsersInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// ModifyCollation 修改实例字符集
+//
+// 修改实例字符集。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) ModifyCollation(request *model.ModifyCollationRequest) (*model.ModifyCollationResponse, error) {
+ requestDef := GenReqDefForModifyCollation()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.ModifyCollationResponse), nil
+ }
+}
+
+// ModifyCollationInvoker 修改实例字符集
+func (c *RdsClient) ModifyCollationInvoker(request *model.ModifyCollationRequest) *ModifyCollationInvoker {
+ requestDef := GenReqDefForModifyCollation()
+ return &ModifyCollationInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
+
+// RevokeSqlserverDbUserPrivilege 解除数据库帐号权限
+//
+// 解除数据库帐号权限。
+//
+// Please refer to HUAWEI cloud API Explorer for details.
+func (c *RdsClient) RevokeSqlserverDbUserPrivilege(request *model.RevokeSqlserverDbUserPrivilegeRequest) (*model.RevokeSqlserverDbUserPrivilegeResponse, error) {
+ requestDef := GenReqDefForRevokeSqlserverDbUserPrivilege()
+
+ if resp, err := c.HcClient.Sync(request, requestDef); err != nil {
+ return nil, err
+ } else {
+ return resp.(*model.RevokeSqlserverDbUserPrivilegeResponse), nil
+ }
+}
+
+// RevokeSqlserverDbUserPrivilegeInvoker 解除数据库帐号权限
+func (c *RdsClient) RevokeSqlserverDbUserPrivilegeInvoker(request *model.RevokeSqlserverDbUserPrivilegeRequest) *RevokeSqlserverDbUserPrivilegeInvoker {
+ requestDef := GenReqDefForRevokeSqlserverDbUserPrivilege()
+ return &RevokeSqlserverDbUserPrivilegeInvoker{invoker.NewBaseInvoker(c.HcClient, request, requestDef)}
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/rds_invoker.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/rds_invoker.go
new file mode 100644
index 0000000000..86ce1cb035
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/rds_invoker.go
@@ -0,0 +1,2178 @@
+package v3
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model"
+)
+
+type AddPostgresqlHbaConfInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *AddPostgresqlHbaConfInvoker) Invoke() (*model.AddPostgresqlHbaConfResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.AddPostgresqlHbaConfResponse), nil
+ }
+}
+
+type ApplyConfigurationAsyncInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ApplyConfigurationAsyncInvoker) Invoke() (*model.ApplyConfigurationAsyncResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ApplyConfigurationAsyncResponse), nil
+ }
+}
+
+type AttachEipInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *AttachEipInvoker) Invoke() (*model.AttachEipResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.AttachEipResponse), nil
+ }
+}
+
+type BatchDeleteManualBackupInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *BatchDeleteManualBackupInvoker) Invoke() (*model.BatchDeleteManualBackupResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.BatchDeleteManualBackupResponse), nil
+ }
+}
+
+type BatchRestoreDatabaseInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *BatchRestoreDatabaseInvoker) Invoke() (*model.BatchRestoreDatabaseResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.BatchRestoreDatabaseResponse), nil
+ }
+}
+
+type BatchRestorePostgreSqlTablesInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *BatchRestorePostgreSqlTablesInvoker) Invoke() (*model.BatchRestorePostgreSqlTablesResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.BatchRestorePostgreSqlTablesResponse), nil
+ }
+}
+
+type BatchTagAddActionInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *BatchTagAddActionInvoker) Invoke() (*model.BatchTagAddActionResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.BatchTagAddActionResponse), nil
+ }
+}
+
+type BatchTagDelActionInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *BatchTagDelActionInvoker) Invoke() (*model.BatchTagDelActionResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.BatchTagDelActionResponse), nil
+ }
+}
+
+type ChangeFailoverModeInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ChangeFailoverModeInvoker) Invoke() (*model.ChangeFailoverModeResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ChangeFailoverModeResponse), nil
+ }
+}
+
+type ChangeFailoverStrategyInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ChangeFailoverStrategyInvoker) Invoke() (*model.ChangeFailoverStrategyResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ChangeFailoverStrategyResponse), nil
+ }
+}
+
+type ChangeOpsWindowInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ChangeOpsWindowInvoker) Invoke() (*model.ChangeOpsWindowResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ChangeOpsWindowResponse), nil
+ }
+}
+
+type CopyConfigurationInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *CopyConfigurationInvoker) Invoke() (*model.CopyConfigurationResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.CopyConfigurationResponse), nil
+ }
+}
+
+type CreateConfigurationInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *CreateConfigurationInvoker) Invoke() (*model.CreateConfigurationResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.CreateConfigurationResponse), nil
+ }
+}
+
+type CreateDnsNameInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *CreateDnsNameInvoker) Invoke() (*model.CreateDnsNameResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.CreateDnsNameResponse), nil
+ }
+}
+
+type CreateInstanceInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *CreateInstanceInvoker) Invoke() (*model.CreateInstanceResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.CreateInstanceResponse), nil
+ }
+}
+
+type CreateManualBackupInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *CreateManualBackupInvoker) Invoke() (*model.CreateManualBackupResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.CreateManualBackupResponse), nil
+ }
+}
+
+type CreateRestoreInstanceInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *CreateRestoreInstanceInvoker) Invoke() (*model.CreateRestoreInstanceResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.CreateRestoreInstanceResponse), nil
+ }
+}
+
+type CreateXelLogDownloadInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *CreateXelLogDownloadInvoker) Invoke() (*model.CreateXelLogDownloadResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.CreateXelLogDownloadResponse), nil
+ }
+}
+
+type DeleteConfigurationInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *DeleteConfigurationInvoker) Invoke() (*model.DeleteConfigurationResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.DeleteConfigurationResponse), nil
+ }
+}
+
+type DeleteInstanceInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *DeleteInstanceInvoker) Invoke() (*model.DeleteInstanceResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.DeleteInstanceResponse), nil
+ }
+}
+
+type DeleteJobInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *DeleteJobInvoker) Invoke() (*model.DeleteJobResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.DeleteJobResponse), nil
+ }
+}
+
+type DeleteManualBackupInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *DeleteManualBackupInvoker) Invoke() (*model.DeleteManualBackupResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.DeleteManualBackupResponse), nil
+ }
+}
+
+type DeletePostgresqlHbaConfInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *DeletePostgresqlHbaConfInvoker) Invoke() (*model.DeletePostgresqlHbaConfResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.DeletePostgresqlHbaConfResponse), nil
+ }
+}
+
+type DownloadSlowlogInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *DownloadSlowlogInvoker) Invoke() (*model.DownloadSlowlogResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.DownloadSlowlogResponse), nil
+ }
+}
+
+type EnableConfigurationInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *EnableConfigurationInvoker) Invoke() (*model.EnableConfigurationResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.EnableConfigurationResponse), nil
+ }
+}
+
+type ListAuditlogsInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListAuditlogsInvoker) Invoke() (*model.ListAuditlogsResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListAuditlogsResponse), nil
+ }
+}
+
+type ListBackupsInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListBackupsInvoker) Invoke() (*model.ListBackupsResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListBackupsResponse), nil
+ }
+}
+
+type ListCollationsInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListCollationsInvoker) Invoke() (*model.ListCollationsResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListCollationsResponse), nil
+ }
+}
+
+type ListConfigurationsInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListConfigurationsInvoker) Invoke() (*model.ListConfigurationsResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListConfigurationsResponse), nil
+ }
+}
+
+type ListDatastoresInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListDatastoresInvoker) Invoke() (*model.ListDatastoresResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListDatastoresResponse), nil
+ }
+}
+
+type ListDrRelationsInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListDrRelationsInvoker) Invoke() (*model.ListDrRelationsResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListDrRelationsResponse), nil
+ }
+}
+
+type ListEngineFlavorsInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListEngineFlavorsInvoker) Invoke() (*model.ListEngineFlavorsResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListEngineFlavorsResponse), nil
+ }
+}
+
+type ListErrorLogsInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListErrorLogsInvoker) Invoke() (*model.ListErrorLogsResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListErrorLogsResponse), nil
+ }
+}
+
+type ListErrorLogsNewInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListErrorLogsNewInvoker) Invoke() (*model.ListErrorLogsNewResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListErrorLogsNewResponse), nil
+ }
+}
+
+type ListErrorlogForLtsInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListErrorlogForLtsInvoker) Invoke() (*model.ListErrorlogForLtsResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListErrorlogForLtsResponse), nil
+ }
+}
+
+type ListFlavorsInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListFlavorsInvoker) Invoke() (*model.ListFlavorsResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListFlavorsResponse), nil
+ }
+}
+
+type ListHistoryDatabaseInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListHistoryDatabaseInvoker) Invoke() (*model.ListHistoryDatabaseResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListHistoryDatabaseResponse), nil
+ }
+}
+
+type ListInspectionHistoriesInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListInspectionHistoriesInvoker) Invoke() (*model.ListInspectionHistoriesResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListInspectionHistoriesResponse), nil
+ }
+}
+
+type ListInstanceDiagnosisInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListInstanceDiagnosisInvoker) Invoke() (*model.ListInstanceDiagnosisResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListInstanceDiagnosisResponse), nil
+ }
+}
+
+type ListInstanceParamHistoriesInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListInstanceParamHistoriesInvoker) Invoke() (*model.ListInstanceParamHistoriesResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListInstanceParamHistoriesResponse), nil
+ }
+}
+
+type ListInstanceTagsInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListInstanceTagsInvoker) Invoke() (*model.ListInstanceTagsResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListInstanceTagsResponse), nil
+ }
+}
+
+type ListInstancesInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListInstancesInvoker) Invoke() (*model.ListInstancesResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListInstancesResponse), nil
+ }
+}
+
+type ListInstancesInfoDiagnosisInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListInstancesInfoDiagnosisInvoker) Invoke() (*model.ListInstancesInfoDiagnosisResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListInstancesInfoDiagnosisResponse), nil
+ }
+}
+
+type ListInstancesSupportFastRestoreInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListInstancesSupportFastRestoreInvoker) Invoke() (*model.ListInstancesSupportFastRestoreResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListInstancesSupportFastRestoreResponse), nil
+ }
+}
+
+type ListJobInfoInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListJobInfoInvoker) Invoke() (*model.ListJobInfoResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListJobInfoResponse), nil
+ }
+}
+
+type ListJobInfoDetailInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListJobInfoDetailInvoker) Invoke() (*model.ListJobInfoDetailResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListJobInfoDetailResponse), nil
+ }
+}
+
+type ListOffSiteBackupsInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListOffSiteBackupsInvoker) Invoke() (*model.ListOffSiteBackupsResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListOffSiteBackupsResponse), nil
+ }
+}
+
+type ListOffSiteInstancesInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListOffSiteInstancesInvoker) Invoke() (*model.ListOffSiteInstancesResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListOffSiteInstancesResponse), nil
+ }
+}
+
+type ListOffSiteRestoreTimesInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListOffSiteRestoreTimesInvoker) Invoke() (*model.ListOffSiteRestoreTimesResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListOffSiteRestoreTimesResponse), nil
+ }
+}
+
+type ListPostgresqlHbaInfoInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListPostgresqlHbaInfoInvoker) Invoke() (*model.ListPostgresqlHbaInfoResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListPostgresqlHbaInfoResponse), nil
+ }
+}
+
+type ListPostgresqlHbaInfoHistoryInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListPostgresqlHbaInfoHistoryInvoker) Invoke() (*model.ListPostgresqlHbaInfoHistoryResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListPostgresqlHbaInfoHistoryResponse), nil
+ }
+}
+
+type ListPostgresqlListHistoryTablesInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListPostgresqlListHistoryTablesInvoker) Invoke() (*model.ListPostgresqlListHistoryTablesResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListPostgresqlListHistoryTablesResponse), nil
+ }
+}
+
+type ListPredefinedTagInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListPredefinedTagInvoker) Invoke() (*model.ListPredefinedTagResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListPredefinedTagResponse), nil
+ }
+}
+
+type ListProjectTagsInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListProjectTagsInvoker) Invoke() (*model.ListProjectTagsResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListProjectTagsResponse), nil
+ }
+}
+
+type ListRecycleInstancesInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListRecycleInstancesInvoker) Invoke() (*model.ListRecycleInstancesResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListRecycleInstancesResponse), nil
+ }
+}
+
+type ListRestoreTimesInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListRestoreTimesInvoker) Invoke() (*model.ListRestoreTimesResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListRestoreTimesResponse), nil
+ }
+}
+
+type ListSimplifiedInstancesInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListSimplifiedInstancesInvoker) Invoke() (*model.ListSimplifiedInstancesResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListSimplifiedInstancesResponse), nil
+ }
+}
+
+type ListSlowLogFileInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListSlowLogFileInvoker) Invoke() (*model.ListSlowLogFileResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListSlowLogFileResponse), nil
+ }
+}
+
+type ListSlowLogStatisticsForLtsInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListSlowLogStatisticsForLtsInvoker) Invoke() (*model.ListSlowLogStatisticsForLtsResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListSlowLogStatisticsForLtsResponse), nil
+ }
+}
+
+type ListSlowLogsInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListSlowLogsInvoker) Invoke() (*model.ListSlowLogsResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListSlowLogsResponse), nil
+ }
+}
+
+type ListSlowLogsNewInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListSlowLogsNewInvoker) Invoke() (*model.ListSlowLogsNewResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListSlowLogsNewResponse), nil
+ }
+}
+
+type ListSlowlogForLtsInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListSlowlogForLtsInvoker) Invoke() (*model.ListSlowlogForLtsResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListSlowlogForLtsResponse), nil
+ }
+}
+
+type ListSlowlogStatisticsInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListSlowlogStatisticsInvoker) Invoke() (*model.ListSlowlogStatisticsResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListSlowlogStatisticsResponse), nil
+ }
+}
+
+type ListSslCertDownloadLinkInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListSslCertDownloadLinkInvoker) Invoke() (*model.ListSslCertDownloadLinkResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListSslCertDownloadLinkResponse), nil
+ }
+}
+
+type ListStorageTypesInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListStorageTypesInvoker) Invoke() (*model.ListStorageTypesResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListStorageTypesResponse), nil
+ }
+}
+
+type ListUpgradeHistoriesInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListUpgradeHistoriesInvoker) Invoke() (*model.ListUpgradeHistoriesResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListUpgradeHistoriesResponse), nil
+ }
+}
+
+type ListXellogFilesInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListXellogFilesInvoker) Invoke() (*model.ListXellogFilesResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListXellogFilesResponse), nil
+ }
+}
+
+type MigrateFollowerInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *MigrateFollowerInvoker) Invoke() (*model.MigrateFollowerResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.MigrateFollowerResponse), nil
+ }
+}
+
+type ModifyPostgresqlHbaConfInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ModifyPostgresqlHbaConfInvoker) Invoke() (*model.ModifyPostgresqlHbaConfResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ModifyPostgresqlHbaConfResponse), nil
+ }
+}
+
+type RestoreExistInstanceInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *RestoreExistInstanceInvoker) Invoke() (*model.RestoreExistInstanceResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.RestoreExistInstanceResponse), nil
+ }
+}
+
+type RestoreTablesInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *RestoreTablesInvoker) Invoke() (*model.RestoreTablesResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.RestoreTablesResponse), nil
+ }
+}
+
+type RestoreTablesNewInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *RestoreTablesNewInvoker) Invoke() (*model.RestoreTablesNewResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.RestoreTablesNewResponse), nil
+ }
+}
+
+type RestoreToExistingInstanceInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *RestoreToExistingInstanceInvoker) Invoke() (*model.RestoreToExistingInstanceResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.RestoreToExistingInstanceResponse), nil
+ }
+}
+
+type SetAuditlogPolicyInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *SetAuditlogPolicyInvoker) Invoke() (*model.SetAuditlogPolicyResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.SetAuditlogPolicyResponse), nil
+ }
+}
+
+type SetAutoEnlargePolicyInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *SetAutoEnlargePolicyInvoker) Invoke() (*model.SetAutoEnlargePolicyResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.SetAutoEnlargePolicyResponse), nil
+ }
+}
+
+type SetBackupPolicyInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *SetBackupPolicyInvoker) Invoke() (*model.SetBackupPolicyResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.SetBackupPolicyResponse), nil
+ }
+}
+
+type SetBinlogClearPolicyInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *SetBinlogClearPolicyInvoker) Invoke() (*model.SetBinlogClearPolicyResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.SetBinlogClearPolicyResponse), nil
+ }
+}
+
+type SetOffSiteBackupPolicyInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *SetOffSiteBackupPolicyInvoker) Invoke() (*model.SetOffSiteBackupPolicyResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.SetOffSiteBackupPolicyResponse), nil
+ }
+}
+
+type SetSecondLevelMonitorInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *SetSecondLevelMonitorInvoker) Invoke() (*model.SetSecondLevelMonitorResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.SetSecondLevelMonitorResponse), nil
+ }
+}
+
+type SetSecurityGroupInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *SetSecurityGroupInvoker) Invoke() (*model.SetSecurityGroupResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.SetSecurityGroupResponse), nil
+ }
+}
+
+type SetSensitiveSlowLogInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *SetSensitiveSlowLogInvoker) Invoke() (*model.SetSensitiveSlowLogResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.SetSensitiveSlowLogResponse), nil
+ }
+}
+
+type ShowAuditlogDownloadLinkInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowAuditlogDownloadLinkInvoker) Invoke() (*model.ShowAuditlogDownloadLinkResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowAuditlogDownloadLinkResponse), nil
+ }
+}
+
+type ShowAuditlogPolicyInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowAuditlogPolicyInvoker) Invoke() (*model.ShowAuditlogPolicyResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowAuditlogPolicyResponse), nil
+ }
+}
+
+type ShowAutoEnlargePolicyInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowAutoEnlargePolicyInvoker) Invoke() (*model.ShowAutoEnlargePolicyResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowAutoEnlargePolicyResponse), nil
+ }
+}
+
+type ShowAvailableVersionInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowAvailableVersionInvoker) Invoke() (*model.ShowAvailableVersionResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowAvailableVersionResponse), nil
+ }
+}
+
+type ShowBackupDownloadLinkInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowBackupDownloadLinkInvoker) Invoke() (*model.ShowBackupDownloadLinkResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowBackupDownloadLinkResponse), nil
+ }
+}
+
+type ShowBackupPolicyInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowBackupPolicyInvoker) Invoke() (*model.ShowBackupPolicyResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowBackupPolicyResponse), nil
+ }
+}
+
+type ShowBinlogClearPolicyInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowBinlogClearPolicyInvoker) Invoke() (*model.ShowBinlogClearPolicyResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowBinlogClearPolicyResponse), nil
+ }
+}
+
+type ShowConfigurationInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowConfigurationInvoker) Invoke() (*model.ShowConfigurationResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowConfigurationResponse), nil
+ }
+}
+
+type ShowDnsNameInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowDnsNameInvoker) Invoke() (*model.ShowDnsNameResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowDnsNameResponse), nil
+ }
+}
+
+type ShowDomainNameInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowDomainNameInvoker) Invoke() (*model.ShowDomainNameResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowDomainNameResponse), nil
+ }
+}
+
+type ShowDrReplicaStatusInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowDrReplicaStatusInvoker) Invoke() (*model.ShowDrReplicaStatusResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowDrReplicaStatusResponse), nil
+ }
+}
+
+type ShowInstanceConfigurationInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowInstanceConfigurationInvoker) Invoke() (*model.ShowInstanceConfigurationResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowInstanceConfigurationResponse), nil
+ }
+}
+
+type ShowOffSiteBackupPolicyInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowOffSiteBackupPolicyInvoker) Invoke() (*model.ShowOffSiteBackupPolicyResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowOffSiteBackupPolicyResponse), nil
+ }
+}
+
+type ShowQuotasInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowQuotasInvoker) Invoke() (*model.ShowQuotasResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowQuotasResponse), nil
+ }
+}
+
+type ShowRecyclePolicyInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowRecyclePolicyInvoker) Invoke() (*model.ShowRecyclePolicyResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowRecyclePolicyResponse), nil
+ }
+}
+
+type ShowReplicationStatusInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowReplicationStatusInvoker) Invoke() (*model.ShowReplicationStatusResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowReplicationStatusResponse), nil
+ }
+}
+
+type ShowSecondLevelMonitoringInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowSecondLevelMonitoringInvoker) Invoke() (*model.ShowSecondLevelMonitoringResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowSecondLevelMonitoringResponse), nil
+ }
+}
+
+type ShowTdeStatusInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowTdeStatusInvoker) Invoke() (*model.ShowTdeStatusResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowTdeStatusResponse), nil
+ }
+}
+
+type ShowUpgradeDbMajorVersionStatusInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowUpgradeDbMajorVersionStatusInvoker) Invoke() (*model.ShowUpgradeDbMajorVersionStatusResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowUpgradeDbMajorVersionStatusResponse), nil
+ }
+}
+
+type StartFailoverInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *StartFailoverInvoker) Invoke() (*model.StartFailoverResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.StartFailoverResponse), nil
+ }
+}
+
+type StartInstanceEnlargeVolumeActionInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *StartInstanceEnlargeVolumeActionInvoker) Invoke() (*model.StartInstanceEnlargeVolumeActionResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.StartInstanceEnlargeVolumeActionResponse), nil
+ }
+}
+
+type StartInstanceRestartActionInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *StartInstanceRestartActionInvoker) Invoke() (*model.StartInstanceRestartActionResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.StartInstanceRestartActionResponse), nil
+ }
+}
+
+type StartInstanceSingleToHaActionInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *StartInstanceSingleToHaActionInvoker) Invoke() (*model.StartInstanceSingleToHaActionResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.StartInstanceSingleToHaActionResponse), nil
+ }
+}
+
+type StartRecyclePolicyInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *StartRecyclePolicyInvoker) Invoke() (*model.StartRecyclePolicyResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.StartRecyclePolicyResponse), nil
+ }
+}
+
+type StartResizeFlavorActionInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *StartResizeFlavorActionInvoker) Invoke() (*model.StartResizeFlavorActionResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.StartResizeFlavorActionResponse), nil
+ }
+}
+
+type StartupInstanceInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *StartupInstanceInvoker) Invoke() (*model.StartupInstanceResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.StartupInstanceResponse), nil
+ }
+}
+
+type StopInstanceInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *StopInstanceInvoker) Invoke() (*model.StopInstanceResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.StopInstanceResponse), nil
+ }
+}
+
+type SwitchSslInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *SwitchSslInvoker) Invoke() (*model.SwitchSslResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.SwitchSslResponse), nil
+ }
+}
+
+type UpdateConfigurationInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *UpdateConfigurationInvoker) Invoke() (*model.UpdateConfigurationResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.UpdateConfigurationResponse), nil
+ }
+}
+
+type UpdateDataIpInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *UpdateDataIpInvoker) Invoke() (*model.UpdateDataIpResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.UpdateDataIpResponse), nil
+ }
+}
+
+type UpdateDnsNameInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *UpdateDnsNameInvoker) Invoke() (*model.UpdateDnsNameResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.UpdateDnsNameResponse), nil
+ }
+}
+
+type UpdateInstanceConfigurationInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *UpdateInstanceConfigurationInvoker) Invoke() (*model.UpdateInstanceConfigurationResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.UpdateInstanceConfigurationResponse), nil
+ }
+}
+
+type UpdateInstanceConfigurationAsyncInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *UpdateInstanceConfigurationAsyncInvoker) Invoke() (*model.UpdateInstanceConfigurationAsyncResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.UpdateInstanceConfigurationAsyncResponse), nil
+ }
+}
+
+type UpdateInstanceNameInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *UpdateInstanceNameInvoker) Invoke() (*model.UpdateInstanceNameResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.UpdateInstanceNameResponse), nil
+ }
+}
+
+type UpdatePortInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *UpdatePortInvoker) Invoke() (*model.UpdatePortResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.UpdatePortResponse), nil
+ }
+}
+
+type UpdatePostgresqlInstanceAliasInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *UpdatePostgresqlInstanceAliasInvoker) Invoke() (*model.UpdatePostgresqlInstanceAliasResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.UpdatePostgresqlInstanceAliasResponse), nil
+ }
+}
+
+type UpdateTdeStatusInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *UpdateTdeStatusInvoker) Invoke() (*model.UpdateTdeStatusResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.UpdateTdeStatusResponse), nil
+ }
+}
+
+type UpgradeDbMajorVersionInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *UpgradeDbMajorVersionInvoker) Invoke() (*model.UpgradeDbMajorVersionResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.UpgradeDbMajorVersionResponse), nil
+ }
+}
+
+type UpgradeDbMajorVersionPreCheckInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *UpgradeDbMajorVersionPreCheckInvoker) Invoke() (*model.UpgradeDbMajorVersionPreCheckResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.UpgradeDbMajorVersionPreCheckResponse), nil
+ }
+}
+
+type UpgradeDbVersionInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *UpgradeDbVersionInvoker) Invoke() (*model.UpgradeDbVersionResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.UpgradeDbVersionResponse), nil
+ }
+}
+
+type UpgradeDbVersionNewInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *UpgradeDbVersionNewInvoker) Invoke() (*model.UpgradeDbVersionNewResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.UpgradeDbVersionNewResponse), nil
+ }
+}
+
+type ListApiVersionInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListApiVersionInvoker) Invoke() (*model.ListApiVersionResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListApiVersionResponse), nil
+ }
+}
+
+type ListApiVersionNewInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListApiVersionNewInvoker) Invoke() (*model.ListApiVersionNewResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListApiVersionNewResponse), nil
+ }
+}
+
+type ShowApiVersionInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowApiVersionInvoker) Invoke() (*model.ShowApiVersionResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowApiVersionResponse), nil
+ }
+}
+
+type AllowDbUserPrivilegeInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *AllowDbUserPrivilegeInvoker) Invoke() (*model.AllowDbUserPrivilegeResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.AllowDbUserPrivilegeResponse), nil
+ }
+}
+
+type CreateDatabaseInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *CreateDatabaseInvoker) Invoke() (*model.CreateDatabaseResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.CreateDatabaseResponse), nil
+ }
+}
+
+type CreateDbUserInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *CreateDbUserInvoker) Invoke() (*model.CreateDbUserResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.CreateDbUserResponse), nil
+ }
+}
+
+type DeleteDatabaseInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *DeleteDatabaseInvoker) Invoke() (*model.DeleteDatabaseResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.DeleteDatabaseResponse), nil
+ }
+}
+
+type DeleteDbUserInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *DeleteDbUserInvoker) Invoke() (*model.DeleteDbUserResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.DeleteDbUserResponse), nil
+ }
+}
+
+type ListAuthorizedDatabasesInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListAuthorizedDatabasesInvoker) Invoke() (*model.ListAuthorizedDatabasesResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListAuthorizedDatabasesResponse), nil
+ }
+}
+
+type ListAuthorizedDbUsersInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListAuthorizedDbUsersInvoker) Invoke() (*model.ListAuthorizedDbUsersResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListAuthorizedDbUsersResponse), nil
+ }
+}
+
+type ListDatabasesInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListDatabasesInvoker) Invoke() (*model.ListDatabasesResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListDatabasesResponse), nil
+ }
+}
+
+type ListDbUsersInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListDbUsersInvoker) Invoke() (*model.ListDbUsersResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListDbUsersResponse), nil
+ }
+}
+
+type ResetPwdInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ResetPwdInvoker) Invoke() (*model.ResetPwdResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ResetPwdResponse), nil
+ }
+}
+
+type RevokeInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *RevokeInvoker) Invoke() (*model.RevokeResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.RevokeResponse), nil
+ }
+}
+
+type SetDbUserPwdInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *SetDbUserPwdInvoker) Invoke() (*model.SetDbUserPwdResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.SetDbUserPwdResponse), nil
+ }
+}
+
+type SetReadOnlySwitchInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *SetReadOnlySwitchInvoker) Invoke() (*model.SetReadOnlySwitchResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.SetReadOnlySwitchResponse), nil
+ }
+}
+
+type UpdateDatabaseInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *UpdateDatabaseInvoker) Invoke() (*model.UpdateDatabaseResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.UpdateDatabaseResponse), nil
+ }
+}
+
+type UpdateDbUserCommentInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *UpdateDbUserCommentInvoker) Invoke() (*model.UpdateDbUserCommentResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.UpdateDbUserCommentResponse), nil
+ }
+}
+
+type AllowDbPrivilegeInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *AllowDbPrivilegeInvoker) Invoke() (*model.AllowDbPrivilegeResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.AllowDbPrivilegeResponse), nil
+ }
+}
+
+type ChangeProxyScaleInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ChangeProxyScaleInvoker) Invoke() (*model.ChangeProxyScaleResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ChangeProxyScaleResponse), nil
+ }
+}
+
+type ChangeTheDelayThresholdInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ChangeTheDelayThresholdInvoker) Invoke() (*model.ChangeTheDelayThresholdResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ChangeTheDelayThresholdResponse), nil
+ }
+}
+
+type CreatePostgresqlDatabaseInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *CreatePostgresqlDatabaseInvoker) Invoke() (*model.CreatePostgresqlDatabaseResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.CreatePostgresqlDatabaseResponse), nil
+ }
+}
+
+type CreatePostgresqlDatabaseSchemaInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *CreatePostgresqlDatabaseSchemaInvoker) Invoke() (*model.CreatePostgresqlDatabaseSchemaResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.CreatePostgresqlDatabaseSchemaResponse), nil
+ }
+}
+
+type CreatePostgresqlDbUserInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *CreatePostgresqlDbUserInvoker) Invoke() (*model.CreatePostgresqlDbUserResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.CreatePostgresqlDbUserResponse), nil
+ }
+}
+
+type CreatePostgresqlExtensionInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *CreatePostgresqlExtensionInvoker) Invoke() (*model.CreatePostgresqlExtensionResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.CreatePostgresqlExtensionResponse), nil
+ }
+}
+
+type DeletePostgresqlDatabaseInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *DeletePostgresqlDatabaseInvoker) Invoke() (*model.DeletePostgresqlDatabaseResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.DeletePostgresqlDatabaseResponse), nil
+ }
+}
+
+type DeletePostgresqlDbUserInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *DeletePostgresqlDbUserInvoker) Invoke() (*model.DeletePostgresqlDbUserResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.DeletePostgresqlDbUserResponse), nil
+ }
+}
+
+type DeletePostgresqlExtensionInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *DeletePostgresqlExtensionInvoker) Invoke() (*model.DeletePostgresqlExtensionResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.DeletePostgresqlExtensionResponse), nil
+ }
+}
+
+type ListPostgresqlDatabaseSchemasInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListPostgresqlDatabaseSchemasInvoker) Invoke() (*model.ListPostgresqlDatabaseSchemasResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListPostgresqlDatabaseSchemasResponse), nil
+ }
+}
+
+type ListPostgresqlDatabasesInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListPostgresqlDatabasesInvoker) Invoke() (*model.ListPostgresqlDatabasesResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListPostgresqlDatabasesResponse), nil
+ }
+}
+
+type ListPostgresqlDbUserPaginatedInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListPostgresqlDbUserPaginatedInvoker) Invoke() (*model.ListPostgresqlDbUserPaginatedResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListPostgresqlDbUserPaginatedResponse), nil
+ }
+}
+
+type ListPostgresqlExtensionInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListPostgresqlExtensionInvoker) Invoke() (*model.ListPostgresqlExtensionResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListPostgresqlExtensionResponse), nil
+ }
+}
+
+type RevokePostgresqlDbPrivilegeInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *RevokePostgresqlDbPrivilegeInvoker) Invoke() (*model.RevokePostgresqlDbPrivilegeResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.RevokePostgresqlDbPrivilegeResponse), nil
+ }
+}
+
+type SearchQueryScaleComputeFlavorsInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *SearchQueryScaleComputeFlavorsInvoker) Invoke() (*model.SearchQueryScaleComputeFlavorsResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.SearchQueryScaleComputeFlavorsResponse), nil
+ }
+}
+
+type SearchQueryScaleFlavorsInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *SearchQueryScaleFlavorsInvoker) Invoke() (*model.SearchQueryScaleFlavorsResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.SearchQueryScaleFlavorsResponse), nil
+ }
+}
+
+type SetDatabaseUserPrivilegeInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *SetDatabaseUserPrivilegeInvoker) Invoke() (*model.SetDatabaseUserPrivilegeResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.SetDatabaseUserPrivilegeResponse), nil
+ }
+}
+
+type SetPostgresqlDbUserPwdInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *SetPostgresqlDbUserPwdInvoker) Invoke() (*model.SetPostgresqlDbUserPwdResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.SetPostgresqlDbUserPwdResponse), nil
+ }
+}
+
+type ShowInformationAboutDatabaseProxyInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowInformationAboutDatabaseProxyInvoker) Invoke() (*model.ShowInformationAboutDatabaseProxyResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowInformationAboutDatabaseProxyResponse), nil
+ }
+}
+
+type ShowPostgresqlParamValueInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ShowPostgresqlParamValueInvoker) Invoke() (*model.ShowPostgresqlParamValueResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ShowPostgresqlParamValueResponse), nil
+ }
+}
+
+type StartDatabaseProxyInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *StartDatabaseProxyInvoker) Invoke() (*model.StartDatabaseProxyResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.StartDatabaseProxyResponse), nil
+ }
+}
+
+type StopDatabaseProxyInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *StopDatabaseProxyInvoker) Invoke() (*model.StopDatabaseProxyResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.StopDatabaseProxyResponse), nil
+ }
+}
+
+type UpdateDbUserPrivilegeInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *UpdateDbUserPrivilegeInvoker) Invoke() (*model.UpdateDbUserPrivilegeResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.UpdateDbUserPrivilegeResponse), nil
+ }
+}
+
+type UpdatePostgresqlDatabaseInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *UpdatePostgresqlDatabaseInvoker) Invoke() (*model.UpdatePostgresqlDatabaseResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.UpdatePostgresqlDatabaseResponse), nil
+ }
+}
+
+type UpdatePostgresqlDbUserCommentInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *UpdatePostgresqlDbUserCommentInvoker) Invoke() (*model.UpdatePostgresqlDbUserCommentResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.UpdatePostgresqlDbUserCommentResponse), nil
+ }
+}
+
+type UpdatePostgresqlParameterValueInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *UpdatePostgresqlParameterValueInvoker) Invoke() (*model.UpdatePostgresqlParameterValueResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.UpdatePostgresqlParameterValueResponse), nil
+ }
+}
+
+type UpdateReadWeightInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *UpdateReadWeightInvoker) Invoke() (*model.UpdateReadWeightResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.UpdateReadWeightResponse), nil
+ }
+}
+
+type AllowSqlserverDbUserPrivilegeInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *AllowSqlserverDbUserPrivilegeInvoker) Invoke() (*model.AllowSqlserverDbUserPrivilegeResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.AllowSqlserverDbUserPrivilegeResponse), nil
+ }
+}
+
+type BatchAddMsdtcsInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *BatchAddMsdtcsInvoker) Invoke() (*model.BatchAddMsdtcsResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.BatchAddMsdtcsResponse), nil
+ }
+}
+
+type CreateSqlserverDatabaseInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *CreateSqlserverDatabaseInvoker) Invoke() (*model.CreateSqlserverDatabaseResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.CreateSqlserverDatabaseResponse), nil
+ }
+}
+
+type CreateSqlserverDbUserInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *CreateSqlserverDbUserInvoker) Invoke() (*model.CreateSqlserverDbUserResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.CreateSqlserverDbUserResponse), nil
+ }
+}
+
+type DeleteSqlserverDatabaseInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *DeleteSqlserverDatabaseInvoker) Invoke() (*model.DeleteSqlserverDatabaseResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.DeleteSqlserverDatabaseResponse), nil
+ }
+}
+
+type DeleteSqlserverDatabaseExInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *DeleteSqlserverDatabaseExInvoker) Invoke() (*model.DeleteSqlserverDatabaseExResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.DeleteSqlserverDatabaseExResponse), nil
+ }
+}
+
+type DeleteSqlserverDbUserInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *DeleteSqlserverDbUserInvoker) Invoke() (*model.DeleteSqlserverDbUserResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.DeleteSqlserverDbUserResponse), nil
+ }
+}
+
+type ListAuthorizedSqlserverDbUsersInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListAuthorizedSqlserverDbUsersInvoker) Invoke() (*model.ListAuthorizedSqlserverDbUsersResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListAuthorizedSqlserverDbUsersResponse), nil
+ }
+}
+
+type ListMsdtcHostsInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListMsdtcHostsInvoker) Invoke() (*model.ListMsdtcHostsResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListMsdtcHostsResponse), nil
+ }
+}
+
+type ListSqlserverDatabasesInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListSqlserverDatabasesInvoker) Invoke() (*model.ListSqlserverDatabasesResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListSqlserverDatabasesResponse), nil
+ }
+}
+
+type ListSqlserverDbUsersInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ListSqlserverDbUsersInvoker) Invoke() (*model.ListSqlserverDbUsersResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ListSqlserverDbUsersResponse), nil
+ }
+}
+
+type ModifyCollationInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *ModifyCollationInvoker) Invoke() (*model.ModifyCollationResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.ModifyCollationResponse), nil
+ }
+}
+
+type RevokeSqlserverDbUserPrivilegeInvoker struct {
+ *invoker.BaseInvoker
+}
+
+func (i *RevokeSqlserverDbUserPrivilegeInvoker) Invoke() (*model.RevokeSqlserverDbUserPrivilegeResponse, error) {
+ if result, err := i.BaseInvoker.Invoke(); err != nil {
+ return nil, err
+ } else {
+ return result.(*model.RevokeSqlserverDbUserPrivilegeResponse), nil
+ }
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/rds_meta.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/rds_meta.go
new file mode 100644
index 0000000000..3a67bbcc0e
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/rds_meta.go
@@ -0,0 +1,4597 @@
+package v3
+
+import (
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/def"
+
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/model"
+ "net/http"
+)
+
+func GenReqDefForAddPostgresqlHbaConf() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/hba-info").
+ WithResponse(new(model.AddPostgresqlHbaConfResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForApplyConfigurationAsync() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3.1/{project_id}/configurations/{config_id}/apply").
+ WithResponse(new(model.ApplyConfigurationAsyncResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("ConfigId").
+ WithJsonTag("config_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForAttachEip() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/public-ip").
+ WithResponse(new(model.AttachEipResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForBatchDeleteManualBackup() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/backups/batch-delete").
+ WithResponse(new(model.BatchDeleteManualBackupResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForBatchRestoreDatabase() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/batch/restore/databases").
+ WithResponse(new(model.BatchRestoreDatabaseResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForBatchRestorePostgreSqlTables() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/batch/restore/tables").
+ WithResponse(new(model.BatchRestorePostgreSqlTablesResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForBatchTagAddAction() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/tags/action").
+ WithResponse(new(model.BatchTagAddActionResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForBatchTagDelAction() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/tags/action").
+ WithResponse(new(model.BatchTagDelActionResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForChangeFailoverMode() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/failover/mode").
+ WithResponse(new(model.ChangeFailoverModeResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForChangeFailoverStrategy() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/failover/strategy").
+ WithResponse(new(model.ChangeFailoverStrategyResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForChangeOpsWindow() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/ops-window").
+ WithResponse(new(model.ChangeOpsWindowResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForCopyConfiguration() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/configurations/{config_id}/copy").
+ WithResponse(new(model.CopyConfigurationResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("ConfigId").
+ WithJsonTag("config_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForCreateConfiguration() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/configurations").
+ WithResponse(new(model.CreateConfigurationResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForCreateDnsName() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/create-dns").
+ WithResponse(new(model.CreateDnsNameResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForCreateInstance() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances").
+ WithResponse(new(model.CreateInstanceResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XClientToken").
+ WithJsonTag("X-Client-Token").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForCreateManualBackup() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/backups").
+ WithResponse(new(model.CreateManualBackupResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForCreateRestoreInstance() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances").
+ WithResponse(new(model.CreateRestoreInstanceResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForCreateXelLogDownload() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/xellog-download").
+ WithResponse(new(model.CreateXelLogDownloadResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForDeleteConfiguration() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodDelete).
+ WithPath("/v3/{project_id}/configurations/{config_id}").
+ WithResponse(new(model.DeleteConfigurationResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("ConfigId").
+ WithJsonTag("config_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForDeleteInstance() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodDelete).
+ WithPath("/v3/{project_id}/instances/{instance_id}").
+ WithResponse(new(model.DeleteInstanceResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForDeleteJob() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodDelete).
+ WithPath("/v3/{project_id}/jobs").
+ WithResponse(new(model.DeleteJobResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Id").
+ WithJsonTag("id").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithResponseField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForDeleteManualBackup() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodDelete).
+ WithPath("/v3/{project_id}/backups/{backup_id}").
+ WithResponse(new(model.DeleteManualBackupResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("BackupId").
+ WithJsonTag("backup_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForDeletePostgresqlHbaConf() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodDelete).
+ WithPath("/v3/{project_id}/instances/{instance_id}/hba-info").
+ WithResponse(new(model.DeletePostgresqlHbaConfResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForDownloadSlowlog() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/slowlog-download").
+ WithResponse(new(model.DownloadSlowlogResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForEnableConfiguration() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/configurations/{config_id}/apply").
+ WithResponse(new(model.EnableConfigurationResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("ConfigId").
+ WithJsonTag("config_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListAuditlogs() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/auditlog").
+ WithResponse(new(model.ListAuditlogsResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("StartTime").
+ WithJsonTag("start_time").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("EndTime").
+ WithJsonTag("end_time").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Offset").
+ WithJsonTag("offset").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListBackups() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/backups").
+ WithResponse(new(model.ListBackupsResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("BackupId").
+ WithJsonTag("backup_id").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("BackupType").
+ WithJsonTag("backup_type").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Offset").
+ WithJsonTag("offset").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("BeginTime").
+ WithJsonTag("begin_time").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("EndTime").
+ WithJsonTag("end_time").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListCollations() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/collations").
+ WithResponse(new(model.ListCollationsResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListConfigurations() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/configurations").
+ WithResponse(new(model.ListConfigurationsResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListDatastores() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/datastores/{database_name}").
+ WithResponse(new(model.ListDatastoresResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("DatabaseName").
+ WithJsonTag("database_name").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListDrRelations() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/disaster-recovery-relation").
+ WithResponse(new(model.ListDrRelationsResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListEngineFlavors() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/available-flavors").
+ WithResponse(new(model.ListEngineFlavorsResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("AvailabilityZoneIds").
+ WithJsonTag("availability_zone_ids").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("HaMode").
+ WithJsonTag("ha_mode").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("SpecCodeLike").
+ WithJsonTag("spec_code_like").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("FlavorCategoryType").
+ WithJsonTag("flavor_category_type").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("IsRhaFlavor").
+ WithJsonTag("is_rha_flavor").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Offset").
+ WithJsonTag("offset").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListErrorLogs() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/errorlog").
+ WithResponse(new(model.ListErrorLogsResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("StartDate").
+ WithJsonTag("start_date").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("EndDate").
+ WithJsonTag("end_date").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Offset").
+ WithJsonTag("offset").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Level").
+ WithJsonTag("level").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListErrorLogsNew() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3.1/{project_id}/instances/{instance_id}/errorlog").
+ WithResponse(new(model.ListErrorLogsNewResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("StartDate").
+ WithJsonTag("start_date").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("EndDate").
+ WithJsonTag("end_date").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Offset").
+ WithJsonTag("offset").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Level").
+ WithJsonTag("level").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListErrorlogForLts() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/error-logs").
+ WithResponse(new(model.ListErrorlogForLtsResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListFlavors() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/flavors/{database_name}").
+ WithResponse(new(model.ListFlavorsResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("DatabaseName").
+ WithJsonTag("database_name").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("VersionName").
+ WithJsonTag("version_name").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("SpecCode").
+ WithJsonTag("spec_code").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListHistoryDatabase() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/{database_name}/instances/history/databases").
+ WithResponse(new(model.ListHistoryDatabaseResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("DatabaseName").
+ WithJsonTag("database_name").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListInspectionHistories() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/major-version/inspection-histories").
+ WithResponse(new(model.ListInspectionHistoriesResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Offset").
+ WithJsonTag("offset").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Order").
+ WithJsonTag("order").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("SortField").
+ WithJsonTag("sort_field").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("TargetVersion").
+ WithJsonTag("target_version").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("IsAvailable").
+ WithJsonTag("is_available").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListInstanceDiagnosis() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/diagnosis").
+ WithResponse(new(model.ListInstanceDiagnosisResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Engine").
+ WithJsonTag("engine").
+ WithLocationType(def.Query))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListInstanceParamHistories() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/configuration-histories").
+ WithResponse(new(model.ListInstanceParamHistoriesResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Offset").
+ WithJsonTag("offset").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("StartTime").
+ WithJsonTag("start_time").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("EndTime").
+ WithJsonTag("end_time").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("ParamName").
+ WithJsonTag("param_name").
+ WithLocationType(def.Query))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListInstanceTags() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/tags").
+ WithResponse(new(model.ListInstanceTagsResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListInstances() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances").
+ WithResponse(new(model.ListInstancesResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Id").
+ WithJsonTag("id").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Name").
+ WithJsonTag("name").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Type").
+ WithJsonTag("type").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("DatastoreType").
+ WithJsonTag("datastore_type").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("VpcId").
+ WithJsonTag("vpc_id").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("SubnetId").
+ WithJsonTag("subnet_id").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Offset").
+ WithJsonTag("offset").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Tags").
+ WithJsonTag("tags").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("ContentType").
+ WithJsonTag("Content-Type").
+ WithLocationType(def.Header))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListInstancesInfoDiagnosis() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/diagnosis/info").
+ WithResponse(new(model.ListInstancesInfoDiagnosisResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Engine").
+ WithJsonTag("engine").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Diagnosis").
+ WithJsonTag("diagnosis").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Offset").
+ WithJsonTag("offset").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListInstancesSupportFastRestore() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/fast-restore").
+ WithResponse(new(model.ListInstancesSupportFastRestoreResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListJobInfo() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/jobs").
+ WithResponse(new(model.ListJobInfoResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Id").
+ WithJsonTag("id").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListJobInfoDetail() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/tasklist/detail").
+ WithResponse(new(model.ListJobInfoDetailResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("StartTime").
+ WithJsonTag("start_time").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("EndTime").
+ WithJsonTag("end_time").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListOffSiteBackups() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/offsite-backups").
+ WithResponse(new(model.ListOffSiteBackupsResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("BackupId").
+ WithJsonTag("backup_id").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("BackupType").
+ WithJsonTag("backup_type").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Offset").
+ WithJsonTag("offset").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("BeginTime").
+ WithJsonTag("begin_time").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("EndTime").
+ WithJsonTag("end_time").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListOffSiteInstances() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/backups/offsite-backup-instance").
+ WithResponse(new(model.ListOffSiteInstancesResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Offset").
+ WithJsonTag("offset").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("ContentType").
+ WithJsonTag("Content-Type").
+ WithLocationType(def.Header))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListOffSiteRestoreTimes() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/offsite-restore-time").
+ WithResponse(new(model.ListOffSiteRestoreTimesResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Date").
+ WithJsonTag("date").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListPostgresqlHbaInfo() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/hba-info").
+ WithResponse(new(model.ListPostgresqlHbaInfoResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithResponseField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListPostgresqlHbaInfoHistory() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/hba-info/history").
+ WithResponse(new(model.ListPostgresqlHbaInfoHistoryResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("StartTime").
+ WithJsonTag("start_time").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("EndTime").
+ WithJsonTag("end_time").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithResponseField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListPostgresqlListHistoryTables() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/{database_name}/instances/history/tables").
+ WithResponse(new(model.ListPostgresqlListHistoryTablesResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("DatabaseName").
+ WithJsonTag("database_name").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListPredefinedTag() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/tags/predefined-tag").
+ WithResponse(new(model.ListPredefinedTagResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListProjectTags() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/tags").
+ WithResponse(new(model.ListProjectTagsResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListRecycleInstances() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/recycle-instances").
+ WithResponse(new(model.ListRecycleInstancesResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Offset").
+ WithJsonTag("offset").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListRestoreTimes() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/restore-time").
+ WithResponse(new(model.ListRestoreTimesResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Date").
+ WithJsonTag("date").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListSimplifiedInstances() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/simplified-instances").
+ WithResponse(new(model.ListSimplifiedInstancesResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListSlowLogFile() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/slowlog-files").
+ WithResponse(new(model.ListSlowLogFileResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Offset").
+ WithJsonTag("offset").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListSlowLogStatisticsForLts() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3.1/{project_id}/instances/{instance_id}/slow-logs/statistics").
+ WithResponse(new(model.ListSlowLogStatisticsForLtsResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListSlowLogs() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/slowlog").
+ WithResponse(new(model.ListSlowLogsResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("StartDate").
+ WithJsonTag("start_date").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("EndDate").
+ WithJsonTag("end_date").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Offset").
+ WithJsonTag("offset").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Type").
+ WithJsonTag("type").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListSlowLogsNew() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3.1/{project_id}/instances/{instance_id}/slowlog").
+ WithResponse(new(model.ListSlowLogsNewResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("StartDate").
+ WithJsonTag("start_date").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("EndDate").
+ WithJsonTag("end_date").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Offset").
+ WithJsonTag("offset").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Type").
+ WithJsonTag("type").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListSlowlogForLts() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/slow-logs").
+ WithResponse(new(model.ListSlowlogForLtsResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListSlowlogStatistics() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/slowlog/statistics").
+ WithResponse(new(model.ListSlowlogStatisticsResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("CurPage").
+ WithJsonTag("cur_page").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("PerPage").
+ WithJsonTag("per_page").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("StartDate").
+ WithJsonTag("start_date").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("EndDate").
+ WithJsonTag("end_date").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Type").
+ WithJsonTag("type").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Sort").
+ WithJsonTag("sort").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListSslCertDownloadLink() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/ssl-cert/download-link").
+ WithResponse(new(model.ListSslCertDownloadLinkResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListStorageTypes() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/storage-type/{database_name}").
+ WithResponse(new(model.ListStorageTypesResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("DatabaseName").
+ WithJsonTag("database_name").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("VersionName").
+ WithJsonTag("version_name").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("HaMode").
+ WithJsonTag("ha_mode").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListUpgradeHistories() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/major-version/upgrade-histories").
+ WithResponse(new(model.ListUpgradeHistoriesResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Offset").
+ WithJsonTag("offset").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Order").
+ WithJsonTag("order").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("SortField").
+ WithJsonTag("sort_field").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListXellogFiles() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/xellog-files").
+ WithResponse(new(model.ListXellogFilesResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Offset").
+ WithJsonTag("offset").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForMigrateFollower() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/migrateslave").
+ WithResponse(new(model.MigrateFollowerResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForModifyPostgresqlHbaConf() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/hba-info").
+ WithResponse(new(model.ModifyPostgresqlHbaConfResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForRestoreExistInstance() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3.1/{project_id}/instances/recovery").
+ WithResponse(new(model.RestoreExistInstanceResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForRestoreTables() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/restore/tables").
+ WithResponse(new(model.RestoreTablesResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForRestoreTablesNew() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3.1/{project_id}/instances/{instance_id}/restore/tables").
+ WithResponse(new(model.RestoreTablesNewResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForRestoreToExistingInstance() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/recovery").
+ WithResponse(new(model.RestoreToExistingInstanceResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForSetAuditlogPolicy() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/auditlog-policy").
+ WithResponse(new(model.SetAuditlogPolicyResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForSetAutoEnlargePolicy() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/disk-auto-expansion").
+ WithResponse(new(model.SetAutoEnlargePolicyResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ reqDefBuilder.WithResponseField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForSetBackupPolicy() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/backups/policy").
+ WithResponse(new(model.SetBackupPolicyResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForSetBinlogClearPolicy() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/binlog/clear-policy").
+ WithResponse(new(model.SetBinlogClearPolicyResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForSetOffSiteBackupPolicy() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/backups/offsite-policy").
+ WithResponse(new(model.SetOffSiteBackupPolicyResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForSetSecondLevelMonitor() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/second-level-monitor").
+ WithResponse(new(model.SetSecondLevelMonitorResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ reqDefBuilder.WithResponseField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForSetSecurityGroup() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/security-group").
+ WithResponse(new(model.SetSecurityGroupResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForSetSensitiveSlowLog() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/slowlog-sensitization/{status}").
+ WithResponse(new(model.SetSensitiveSlowLogResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Status").
+ WithJsonTag("status").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowAuditlogDownloadLink() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/auditlog-links").
+ WithResponse(new(model.ShowAuditlogDownloadLinkResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowAuditlogPolicy() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/auditlog-policy").
+ WithResponse(new(model.ShowAuditlogPolicyResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowAutoEnlargePolicy() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/disk-auto-expansion").
+ WithResponse(new(model.ShowAutoEnlargePolicyResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowAvailableVersion() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/major-version/available-version").
+ WithResponse(new(model.ShowAvailableVersionResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowBackupDownloadLink() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/backup-files").
+ WithResponse(new(model.ShowBackupDownloadLinkResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("BackupId").
+ WithJsonTag("backup_id").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowBackupPolicy() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/backups/policy").
+ WithResponse(new(model.ShowBackupPolicyResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowBinlogClearPolicy() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/binlog/clear-policy").
+ WithResponse(new(model.ShowBinlogClearPolicyResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowConfiguration() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/configurations/{config_id}").
+ WithResponse(new(model.ShowConfigurationResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("ConfigId").
+ WithJsonTag("config_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowDnsName() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/dns-ipv6").
+ WithResponse(new(model.ShowDnsNameResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("DnsType").
+ WithJsonTag("dns_type").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowDomainName() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/dns").
+ WithResponse(new(model.ShowDomainNameResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("DnsType").
+ WithJsonTag("dns_type").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowDrReplicaStatus() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/disaster-recovery").
+ WithResponse(new(model.ShowDrReplicaStatusResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowInstanceConfiguration() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/configurations").
+ WithResponse(new(model.ShowInstanceConfigurationResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowOffSiteBackupPolicy() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/backups/offsite-policy").
+ WithResponse(new(model.ShowOffSiteBackupPolicyResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowQuotas() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/quotas").
+ WithResponse(new(model.ShowQuotasResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowRecyclePolicy() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/recycle-policy").
+ WithResponse(new(model.ShowRecyclePolicyResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowReplicationStatus() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/replication/status").
+ WithResponse(new(model.ShowReplicationStatusResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowSecondLevelMonitoring() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/second-level-monitor").
+ WithResponse(new(model.ShowSecondLevelMonitoringResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowTdeStatus() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/tde-status").
+ WithResponse(new(model.ShowTdeStatusResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowUpgradeDbMajorVersionStatus() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/major-version/status").
+ WithResponse(new(model.ShowUpgradeDbMajorVersionStatusResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Action").
+ WithJsonTag("action").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForStartFailover() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/failover").
+ WithResponse(new(model.StartFailoverResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForStartInstanceEnlargeVolumeAction() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/action").
+ WithResponse(new(model.StartInstanceEnlargeVolumeActionResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForStartInstanceRestartAction() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/action").
+ WithResponse(new(model.StartInstanceRestartActionResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForStartInstanceSingleToHaAction() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/action").
+ WithResponse(new(model.StartInstanceSingleToHaActionResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForStartRecyclePolicy() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/recycle-policy").
+ WithResponse(new(model.StartRecyclePolicyResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForStartResizeFlavorAction() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/action").
+ WithResponse(new(model.StartResizeFlavorActionResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForStartupInstance() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/action/startup").
+ WithResponse(new(model.StartupInstanceResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForStopInstance() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/action/shutdown").
+ WithResponse(new(model.StopInstanceResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForSwitchSsl() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/ssl").
+ WithResponse(new(model.SwitchSslResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForUpdateConfiguration() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/configurations/{config_id}").
+ WithResponse(new(model.UpdateConfigurationResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("ConfigId").
+ WithJsonTag("config_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForUpdateDataIp() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/ip").
+ WithResponse(new(model.UpdateDataIpResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForUpdateDnsName() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/modify-dns").
+ WithResponse(new(model.UpdateDnsNameResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForUpdateInstanceConfiguration() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/configurations").
+ WithResponse(new(model.UpdateInstanceConfigurationResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForUpdateInstanceConfigurationAsync() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3.1/{project_id}/instances/{instance_id}/configurations").
+ WithResponse(new(model.UpdateInstanceConfigurationAsyncResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForUpdateInstanceName() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/name").
+ WithResponse(new(model.UpdateInstanceNameResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForUpdatePort() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/port").
+ WithResponse(new(model.UpdatePortResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForUpdatePostgresqlInstanceAlias() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/alias").
+ WithResponse(new(model.UpdatePostgresqlInstanceAliasResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForUpdateTdeStatus() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/tde").
+ WithResponse(new(model.UpdateTdeStatusResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForUpgradeDbMajorVersion() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/major-version/upgrade").
+ WithResponse(new(model.UpgradeDbMajorVersionResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ reqDefBuilder.WithResponseField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForUpgradeDbMajorVersionPreCheck() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/major-version/inspection").
+ WithResponse(new(model.UpgradeDbMajorVersionPreCheckResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForUpgradeDbVersion() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/action/db-upgrade").
+ WithResponse(new(model.UpgradeDbVersionResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForUpgradeDbVersionNew() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db-upgrade").
+ WithResponse(new(model.UpgradeDbVersionNewResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListApiVersion() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/rds").
+ WithResponse(new(model.ListApiVersionResponse)).
+ WithContentType("application/json")
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListApiVersionNew() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/").
+ WithResponse(new(model.ListApiVersionNewResponse)).
+ WithContentType("application/json")
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowApiVersion() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/rds/{version}").
+ WithResponse(new(model.ShowApiVersionResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Version").
+ WithJsonTag("version").
+ WithLocationType(def.Path))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForAllowDbUserPrivilege() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db_privilege").
+ WithResponse(new(model.AllowDbUserPrivilegeResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForCreateDatabase() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/database").
+ WithResponse(new(model.CreateDatabaseResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForCreateDbUser() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db_user").
+ WithResponse(new(model.CreateDbUserResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForDeleteDatabase() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodDelete).
+ WithPath("/v3/{project_id}/instances/{instance_id}/database/{db_name}").
+ WithResponse(new(model.DeleteDatabaseResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("DbName").
+ WithJsonTag("db_name").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForDeleteDbUser() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodDelete).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db_user/{user_name}").
+ WithResponse(new(model.DeleteDbUserResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("UserName").
+ WithJsonTag("user_name").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListAuthorizedDatabases() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db_user/database").
+ WithResponse(new(model.ListAuthorizedDatabasesResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("UserName").
+ WithJsonTag("user-name").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Page").
+ WithJsonTag("page").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListAuthorizedDbUsers() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/database/db_user").
+ WithResponse(new(model.ListAuthorizedDbUsersResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("DbName").
+ WithJsonTag("db-name").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Page").
+ WithJsonTag("page").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListDatabases() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/database/detail").
+ WithResponse(new(model.ListDatabasesResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Page").
+ WithJsonTag("page").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListDbUsers() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db_user/detail").
+ WithResponse(new(model.ListDbUsersResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Page").
+ WithJsonTag("page").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForResetPwd() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/password").
+ WithResponse(new(model.ResetPwdResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForRevoke() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodDelete).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db_privilege").
+ WithResponse(new(model.RevokeResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForSetDbUserPwd() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db_user/resetpwd").
+ WithResponse(new(model.SetDbUserPwdResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForSetReadOnlySwitch() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/readonly-status").
+ WithResponse(new(model.SetReadOnlySwitchResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForUpdateDatabase() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/database/update").
+ WithResponse(new(model.UpdateDatabaseResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForUpdateDbUserComment() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db-users/{user_name}/comment").
+ WithResponse(new(model.UpdateDbUserCommentResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("UserName").
+ WithJsonTag("user_name").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForAllowDbPrivilege() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db_privilege").
+ WithResponse(new(model.AllowDbPrivilegeResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForChangeProxyScale() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/proxy/scale").
+ WithResponse(new(model.ChangeProxyScaleResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForChangeTheDelayThreshold() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/proxy/delay-threshold").
+ WithResponse(new(model.ChangeTheDelayThresholdResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForCreatePostgresqlDatabase() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/database").
+ WithResponse(new(model.CreatePostgresqlDatabaseResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForCreatePostgresqlDatabaseSchema() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/schema").
+ WithResponse(new(model.CreatePostgresqlDatabaseSchemaResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForCreatePostgresqlDbUser() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db_user").
+ WithResponse(new(model.CreatePostgresqlDbUserResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForCreatePostgresqlExtension() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/extensions").
+ WithResponse(new(model.CreatePostgresqlExtensionResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ reqDefBuilder.WithResponseField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForDeletePostgresqlDatabase() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodDelete).
+ WithPath("/v3/{project_id}/instances/{instance_id}/database/{db_name}").
+ WithResponse(new(model.DeletePostgresqlDatabaseResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("DbName").
+ WithJsonTag("db_name").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForDeletePostgresqlDbUser() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodDelete).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db_user/{user_name}").
+ WithResponse(new(model.DeletePostgresqlDbUserResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("UserName").
+ WithJsonTag("user_name").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForDeletePostgresqlExtension() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodDelete).
+ WithPath("/v3/{project_id}/instances/{instance_id}/extensions").
+ WithResponse(new(model.DeletePostgresqlExtensionResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ reqDefBuilder.WithResponseField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListPostgresqlDatabaseSchemas() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/schema/detail").
+ WithResponse(new(model.ListPostgresqlDatabaseSchemasResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("DbName").
+ WithJsonTag("db_name").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Page").
+ WithJsonTag("page").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListPostgresqlDatabases() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/database/detail").
+ WithResponse(new(model.ListPostgresqlDatabasesResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Page").
+ WithJsonTag("page").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListPostgresqlDbUserPaginated() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db_user/detail").
+ WithResponse(new(model.ListPostgresqlDbUserPaginatedResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Page").
+ WithJsonTag("page").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListPostgresqlExtension() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/extensions").
+ WithResponse(new(model.ListPostgresqlExtensionResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("DatabaseName").
+ WithJsonTag("database_name").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Offset").
+ WithJsonTag("offset").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForRevokePostgresqlDbPrivilege() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodDelete).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db_privilege").
+ WithResponse(new(model.RevokePostgresqlDbPrivilegeResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForSearchQueryScaleComputeFlavors() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3.1/{project_id}/instances/{instance_id}/proxy/scale/flavors").
+ WithResponse(new(model.SearchQueryScaleComputeFlavorsResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Offset").
+ WithJsonTag("offset").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForSearchQueryScaleFlavors() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/proxy/scale/flavors").
+ WithResponse(new(model.SearchQueryScaleFlavorsResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForSetDatabaseUserPrivilege() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/user-privilege").
+ WithResponse(new(model.SetDatabaseUserPrivilegeResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForSetPostgresqlDbUserPwd() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db_user/resetpwd").
+ WithResponse(new(model.SetPostgresqlDbUserPwdResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowInformationAboutDatabaseProxy() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/proxy").
+ WithResponse(new(model.ShowInformationAboutDatabaseProxyResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForShowPostgresqlParamValue() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/parameter/{name}").
+ WithResponse(new(model.ShowPostgresqlParamValueResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Name").
+ WithJsonTag("name").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForStartDatabaseProxy() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/proxy").
+ WithResponse(new(model.StartDatabaseProxyResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForStopDatabaseProxy() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodDelete).
+ WithPath("/v3/{project_id}/instances/{instance_id}/proxy").
+ WithResponse(new(model.StopDatabaseProxyResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForUpdateDbUserPrivilege() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db-user-privilege").
+ WithResponse(new(model.UpdateDbUserPrivilegeResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForUpdatePostgresqlDatabase() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/database/update").
+ WithResponse(new(model.UpdatePostgresqlDatabaseResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForUpdatePostgresqlDbUserComment() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db-users/{user_name}/comment").
+ WithResponse(new(model.UpdatePostgresqlDbUserCommentResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("UserName").
+ WithJsonTag("user_name").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForUpdatePostgresqlParameterValue() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/parameter/{name}").
+ WithResponse(new(model.UpdatePostgresqlParameterValueResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Name").
+ WithJsonTag("name").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForUpdateReadWeight() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/proxy/weight").
+ WithResponse(new(model.UpdateReadWeightResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForAllowSqlserverDbUserPrivilege() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db_privilege").
+ WithResponse(new(model.AllowSqlserverDbUserPrivilegeResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForBatchAddMsdtcs() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/msdtc/host").
+ WithResponse(new(model.BatchAddMsdtcsResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForCreateSqlserverDatabase() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/database").
+ WithResponse(new(model.CreateSqlserverDatabaseResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForCreateSqlserverDbUser() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPost).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db_user").
+ WithResponse(new(model.CreateSqlserverDbUserResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForDeleteSqlserverDatabase() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodDelete).
+ WithPath("/v3/{project_id}/instances/{instance_id}/database/{db_name}").
+ WithResponse(new(model.DeleteSqlserverDatabaseResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("DbName").
+ WithJsonTag("db_name").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForDeleteSqlserverDatabaseEx() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodDelete).
+ WithPath("/v3.1/{project_id}/instances/{instance_id}/database/{db_name}").
+ WithResponse(new(model.DeleteSqlserverDatabaseExResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("DbName").
+ WithJsonTag("db_name").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForDeleteSqlserverDbUser() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodDelete).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db_user/{user_name}").
+ WithResponse(new(model.DeleteSqlserverDbUserResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("UserName").
+ WithJsonTag("user_name").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListAuthorizedSqlserverDbUsers() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/database/db_user").
+ WithResponse(new(model.ListAuthorizedSqlserverDbUsersResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("DbName").
+ WithJsonTag("db-name").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Page").
+ WithJsonTag("page").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListMsdtcHosts() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/msdtc/hosts").
+ WithResponse(new(model.ListMsdtcHostsResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Offset").
+ WithJsonTag("offset").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListSqlserverDatabases() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/database/detail").
+ WithResponse(new(model.ListSqlserverDatabasesResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Page").
+ WithJsonTag("page").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("DbName").
+ WithJsonTag("db-name").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("RecoverModel").
+ WithJsonTag("recover_model").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForListSqlserverDbUsers() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodGet).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db_user/detail").
+ WithResponse(new(model.ListSqlserverDbUsersResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Page").
+ WithJsonTag("page").
+ WithLocationType(def.Query))
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Limit").
+ WithJsonTag("limit").
+ WithLocationType(def.Query))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForModifyCollation() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodPut).
+ WithPath("/v3/{project_id}/instances/{instance_id}/collations").
+ WithResponse(new(model.ModifyCollationResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
+
+func GenReqDefForRevokeSqlserverDbUserPrivilege() *def.HttpRequestDef {
+ reqDefBuilder := def.NewHttpRequestDefBuilder().
+ WithMethod(http.MethodDelete).
+ WithPath("/v3/{project_id}/instances/{instance_id}/db_privilege").
+ WithResponse(new(model.RevokeSqlserverDbUserPrivilegeResponse)).
+ WithContentType("application/json")
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("InstanceId").
+ WithJsonTag("instance_id").
+ WithLocationType(def.Path))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("XLanguage").
+ WithJsonTag("X-Language").
+ WithLocationType(def.Header))
+
+ reqDefBuilder.WithRequestField(def.NewFieldDef().
+ WithName("Body").
+ WithLocationType(def.Body))
+
+ requestDef := reqDefBuilder.Build()
+ return requestDef
+}
diff --git a/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/region/region.go b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/region/region.go
new file mode 100644
index 0000000000..7a59c31948
--- /dev/null
+++ b/vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rds/v3/region/region.go
@@ -0,0 +1,96 @@
+package region
+
+import (
+ "fmt"
+ "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/region"
+)
+
+var (
+ AF_SOUTH_1 = region.NewRegion("af-south-1",
+ "https://rds.af-south-1.myhuaweicloud.com")
+ CN_NORTH_4 = region.NewRegion("cn-north-4",
+ "https://rds.cn-north-4.myhuaweicloud.com")
+ CN_NORTH_1 = region.NewRegion("cn-north-1",
+ "https://rds.cn-north-1.myhuaweicloud.com")
+ CN_EAST_2 = region.NewRegion("cn-east-2",
+ "https://rds.cn-east-2.myhuaweicloud.com")
+ CN_EAST_3 = region.NewRegion("cn-east-3",
+ "https://rds.cn-east-3.myhuaweicloud.com")
+ CN_SOUTH_1 = region.NewRegion("cn-south-1",
+ "https://rds.cn-south-1.myhuaweicloud.com")
+ CN_SOUTHWEST_2 = region.NewRegion("cn-southwest-2",
+ "https://rds.cn-southwest-2.myhuaweicloud.com")
+ AP_SOUTHEAST_2 = region.NewRegion("ap-southeast-2",
+ "https://rds.ap-southeast-2.myhuaweicloud.com")
+ AP_SOUTHEAST_1 = region.NewRegion("ap-southeast-1",
+ "https://rds.ap-southeast-1.myhuaweicloud.com")
+ AP_SOUTHEAST_3 = region.NewRegion("ap-southeast-3",
+ "https://rds.ap-southeast-3.myhuaweicloud.com")
+ RU_NORTHWEST_2 = region.NewRegion("ru-northwest-2",
+ "https://rds.ru-northwest-2.myhuaweicloud.com")
+ SA_BRAZIL_1 = region.NewRegion("sa-brazil-1",
+ "https://rds.sa-brazil-1.myhuaweicloud.com")
+ LA_NORTH_2 = region.NewRegion("la-north-2",
+ "https://rds.la-north-2.myhuaweicloud.com")
+ CN_SOUTH_2 = region.NewRegion("cn-south-2",
+ "https://rds.cn-south-2.myhuaweicloud.com")
+ NA_MEXICO_1 = region.NewRegion("na-mexico-1",
+ "https://rds.na-mexico-1.myhuaweicloud.com")
+ LA_SOUTH_2 = region.NewRegion("la-south-2",
+ "https://rds.la-south-2.myhuaweicloud.com")
+ CN_NORTH_9 = region.NewRegion("cn-north-9",
+ "https://rds.cn-north-9.myhuaweicloud.com")
+ CN_NORTH_2 = region.NewRegion("cn-north-2",
+ "https://rds.cn-north-2.myhuaweicloud.com")
+ TR_WEST_1 = region.NewRegion("tr-west-1",
+ "https://rds.tr-west-1.myhuaweicloud.com")
+ AP_SOUTHEAST_4 = region.NewRegion("ap-southeast-4",
+ "https://rds.ap-southeast-4.myhuaweicloud.com")
+ AE_AD_1 = region.NewRegion("ae-ad-1",
+ "https://rds.ae-ad-1.myhuaweicloud.com")
+ EU_WEST_101 = region.NewRegion("eu-west-101",
+ "https://rds.eu-west-101.myhuaweicloud.eu")
+)
+
+var staticFields = map[string]*region.Region{
+ "af-south-1": AF_SOUTH_1,
+ "cn-north-4": CN_NORTH_4,
+ "cn-north-1": CN_NORTH_1,
+ "cn-east-2": CN_EAST_2,
+ "cn-east-3": CN_EAST_3,
+ "cn-south-1": CN_SOUTH_1,
+ "cn-southwest-2": CN_SOUTHWEST_2,
+ "ap-southeast-2": AP_SOUTHEAST_2,
+ "ap-southeast-1": AP_SOUTHEAST_1,
+ "ap-southeast-3": AP_SOUTHEAST_3,
+ "ru-northwest-2": RU_NORTHWEST_2,
+ "sa-brazil-1": SA_BRAZIL_1,
+ "la-north-2": LA_NORTH_2,
+ "cn-south-2": CN_SOUTH_2,
+ "na-mexico-1": NA_MEXICO_1,
+ "la-south-2": LA_SOUTH_2,
+ "cn-north-9": CN_NORTH_9,
+ "cn-north-2": CN_NORTH_2,
+ "tr-west-1": TR_WEST_1,
+ "ap-southeast-4": AP_SOUTHEAST_4,
+ "ae-ad-1": AE_AD_1,
+ "eu-west-101": EU_WEST_101,
+}
+
+var provider = region.DefaultProviderChain("RDS")
+
+func ValueOf(regionId string) *region.Region {
+ if regionId == "" {
+ panic("unexpected empty parameter: regionId")
+ }
+
+ reg := provider.GetRegion(regionId)
+ if reg != nil {
+ return reg
+ }
+
+ if _, ok := staticFields[regionId]; ok {
+ return staticFields[regionId]
+ }
+ panic(fmt.Sprintf("unexpected regionId: %s", regionId))
+}
diff --git a/vendor/github.com/iancoleman/strcase/.travis.yml b/vendor/github.com/iancoleman/strcase/.travis.yml
new file mode 100644
index 0000000000..79ebc5693b
--- /dev/null
+++ b/vendor/github.com/iancoleman/strcase/.travis.yml
@@ -0,0 +1,10 @@
+sudo: false
+language: go
+go:
+ - 1.10.x
+ - 1.11.x
+ - 1.12.x
+ - 1.13.x
+ - 1.14.x
+ - 1.15.x
+ - master
diff --git a/vendor/github.com/iancoleman/strcase/LICENSE b/vendor/github.com/iancoleman/strcase/LICENSE
new file mode 100644
index 0000000000..3e87ff70e7
--- /dev/null
+++ b/vendor/github.com/iancoleman/strcase/LICENSE
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Ian Coleman
+Copyright (c) 2018 Ma_124,
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, Subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or Substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/vendor/github.com/iancoleman/strcase/README.md b/vendor/github.com/iancoleman/strcase/README.md
new file mode 100644
index 0000000000..e72d9e97c6
--- /dev/null
+++ b/vendor/github.com/iancoleman/strcase/README.md
@@ -0,0 +1,59 @@
+# strcase
+[](http://godoc.org/github.com/iancoleman/strcase)
+[](https://travis-ci.com/iancoleman/strcase)
+[](http://gocover.io/github.com/iancoleman/strcase)
+[](https://goreportcard.com/report/github.com/iancoleman/strcase)
+
+strcase is a go package for converting string case to various cases (e.g. [snake case](https://en.wikipedia.org/wiki/Snake_case) or [camel case](https://en.wikipedia.org/wiki/CamelCase)) to see the full conversion table below.
+
+## Example
+
+```go
+s := "AnyKind of_string"
+```
+
+| Function | Result |
+|-------------------------------------------|----------------------|
+| `ToSnake(s)` | `any_kind_of_string` |
+| `ToSnakeWithIgnore(s, '.')` | `any_kind.of_string` |
+| `ToScreamingSnake(s)` | `ANY_KIND_OF_STRING` |
+| `ToKebab(s)` | `any-kind-of-string` |
+| `ToScreamingKebab(s)` | `ANY-KIND-OF-STRING` |
+| `ToDelimited(s, '.')` | `any.kind.of.string` |
+| `ToScreamingDelimited(s, '.', '', true)` | `ANY.KIND.OF.STRING` |
+| `ToScreamingDelimited(s, '.', ' ', true)` | `ANY.KIND OF.STRING` |
+| `ToCamel(s)` | `AnyKindOfString` |
+| `ToLowerCamel(s)` | `anyKindOfString` |
+
+
+## Install
+
+```bash
+go get -u github.com/iancoleman/strcase
+```
+
+## Custom Acronyms for ToCamel && ToLowerCamel
+
+Often times text can contain specific acronyms which you need to be handled a certain way.
+Out of the box `strcase` treats the string "ID" as "Id" or "id" but there is no way to cater
+for every case in the wild.
+
+To configure your custom acronym globally you can use the following before running any conversion
+
+```go
+import (
+ "github.com/iancoleman/strcase"
+)
+
+func init() {
+ // results in "Api" using ToCamel("API")
+ // results in "api" using ToLowerCamel("API")
+ strcase.ConfigureAcronym("API", "api")
+
+ // results in "PostgreSQL" using ToCamel("PostgreSQL")
+ // results in "postgreSQL" using ToLowerCamel("PostgreSQL")
+ strcase.ConfigureAcronym("PostgreSQL", "PostgreSQL")
+
+}
+
+```
diff --git a/vendor/github.com/iancoleman/strcase/acronyms.go b/vendor/github.com/iancoleman/strcase/acronyms.go
new file mode 100644
index 0000000000..7a2fb09ea7
--- /dev/null
+++ b/vendor/github.com/iancoleman/strcase/acronyms.go
@@ -0,0 +1,13 @@
+package strcase
+
+import (
+ "sync"
+)
+
+var uppercaseAcronym = sync.Map{}
+ //"ID": "id",
+
+// ConfigureAcronym allows you to add additional words which will be considered acronyms
+func ConfigureAcronym(key, val string) {
+ uppercaseAcronym.Store(key, val)
+}
diff --git a/vendor/github.com/iancoleman/strcase/camel.go b/vendor/github.com/iancoleman/strcase/camel.go
new file mode 100644
index 0000000000..6b886894ab
--- /dev/null
+++ b/vendor/github.com/iancoleman/strcase/camel.go
@@ -0,0 +1,87 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2015 Ian Coleman
+ * Copyright (c) 2018 Ma_124,
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, Subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or Substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package strcase
+
+import (
+ "strings"
+)
+
+// Converts a string to CamelCase
+func toCamelInitCase(s string, initCase bool) string {
+ s = strings.TrimSpace(s)
+ if s == "" {
+ return s
+ }
+ a, hasAcronym := uppercaseAcronym.Load(s)
+ if hasAcronym {
+ s = a.(string)
+ }
+
+ n := strings.Builder{}
+ n.Grow(len(s))
+ capNext := initCase
+ prevIsCap := false
+ for i, v := range []byte(s) {
+ vIsCap := v >= 'A' && v <= 'Z'
+ vIsLow := v >= 'a' && v <= 'z'
+ if capNext {
+ if vIsLow {
+ v += 'A'
+ v -= 'a'
+ }
+ } else if i == 0 {
+ if vIsCap {
+ v += 'a'
+ v -= 'A'
+ }
+ } else if prevIsCap && vIsCap && !hasAcronym {
+ v += 'a'
+ v -= 'A'
+ }
+ prevIsCap = vIsCap
+
+ if vIsCap || vIsLow {
+ n.WriteByte(v)
+ capNext = false
+ } else if vIsNum := v >= '0' && v <= '9'; vIsNum {
+ n.WriteByte(v)
+ capNext = true
+ } else {
+ capNext = v == '_' || v == ' ' || v == '-' || v == '.'
+ }
+ }
+ return n.String()
+}
+
+// ToCamel converts a string to CamelCase
+func ToCamel(s string) string {
+ return toCamelInitCase(s, true)
+}
+
+// ToLowerCamel converts a string to lowerCamelCase
+func ToLowerCamel(s string) string {
+ return toCamelInitCase(s, false)
+}
diff --git a/vendor/github.com/iancoleman/strcase/doc.go b/vendor/github.com/iancoleman/strcase/doc.go
new file mode 100644
index 0000000000..5e1825b9e0
--- /dev/null
+++ b/vendor/github.com/iancoleman/strcase/doc.go
@@ -0,0 +1,12 @@
+// Package strcase converts strings to various cases. See the conversion table below:
+// | Function | Result |
+// |---------------------------------|--------------------|
+// | ToSnake(s) | any_kind_of_string |
+// | ToScreamingSnake(s) | ANY_KIND_OF_STRING |
+// | ToKebab(s) | any-kind-of-string |
+// | ToScreamingKebab(s) | ANY-KIND-OF-STRING |
+// | ToDelimited(s, '.') | any.kind.of.string |
+// | ToScreamingDelimited(s, '.') | ANY.KIND.OF.STRING |
+// | ToCamel(s) | AnyKindOfString |
+// | ToLowerCamel(s) | anyKindOfString |
+package strcase
diff --git a/vendor/github.com/iancoleman/strcase/snake.go b/vendor/github.com/iancoleman/strcase/snake.go
new file mode 100644
index 0000000000..df018bc7a2
--- /dev/null
+++ b/vendor/github.com/iancoleman/strcase/snake.go
@@ -0,0 +1,115 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2015 Ian Coleman
+ * Copyright (c) 2018 Ma_124,
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, Subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or Substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package strcase
+
+import (
+ "strings"
+)
+
+// ToSnake converts a string to snake_case
+func ToSnake(s string) string {
+ return ToDelimited(s, '_')
+}
+
+func ToSnakeWithIgnore(s string, ignore string) string {
+ return ToScreamingDelimited(s, '_', ignore, false)
+}
+
+// ToScreamingSnake converts a string to SCREAMING_SNAKE_CASE
+func ToScreamingSnake(s string) string {
+ return ToScreamingDelimited(s, '_', "", true)
+}
+
+// ToKebab converts a string to kebab-case
+func ToKebab(s string) string {
+ return ToDelimited(s, '-')
+}
+
+// ToScreamingKebab converts a string to SCREAMING-KEBAB-CASE
+func ToScreamingKebab(s string) string {
+ return ToScreamingDelimited(s, '-', "", true)
+}
+
+// ToDelimited converts a string to delimited.snake.case
+// (in this case `delimiter = '.'`)
+func ToDelimited(s string, delimiter uint8) string {
+ return ToScreamingDelimited(s, delimiter, "", false)
+}
+
+// ToScreamingDelimited converts a string to SCREAMING.DELIMITED.SNAKE.CASE
+// (in this case `delimiter = '.'; screaming = true`)
+// or delimited.snake.case
+// (in this case `delimiter = '.'; screaming = false`)
+func ToScreamingDelimited(s string, delimiter uint8, ignore string, screaming bool) string {
+ s = strings.TrimSpace(s)
+ n := strings.Builder{}
+ n.Grow(len(s) + 2) // nominal 2 bytes of extra space for inserted delimiters
+ for i, v := range []byte(s) {
+ vIsCap := v >= 'A' && v <= 'Z'
+ vIsLow := v >= 'a' && v <= 'z'
+ if vIsLow && screaming {
+ v += 'A'
+ v -= 'a'
+ } else if vIsCap && !screaming {
+ v += 'a'
+ v -= 'A'
+ }
+
+ // treat acronyms as words, eg for JSONData -> JSON is a whole word
+ if i+1 < len(s) {
+ next := s[i+1]
+ vIsNum := v >= '0' && v <= '9'
+ nextIsCap := next >= 'A' && next <= 'Z'
+ nextIsLow := next >= 'a' && next <= 'z'
+ nextIsNum := next >= '0' && next <= '9'
+ // add underscore if next letter case type is changed
+ if (vIsCap && (nextIsLow || nextIsNum)) || (vIsLow && (nextIsCap || nextIsNum)) || (vIsNum && (nextIsCap || nextIsLow)) {
+ prevIgnore := ignore != "" && i > 0 && strings.ContainsAny(string(s[i-1]), ignore)
+ if !prevIgnore {
+ if vIsCap && nextIsLow {
+ if prevIsCap := i > 0 && s[i-1] >= 'A' && s[i-1] <= 'Z'; prevIsCap {
+ n.WriteByte(delimiter)
+ }
+ }
+ n.WriteByte(v)
+ if vIsLow || vIsNum || nextIsNum {
+ n.WriteByte(delimiter)
+ }
+ continue
+ }
+ }
+ }
+
+ if (v == ' ' || v == '_' || v == '-' || v == '.') && !strings.ContainsAny(string(v), ignore) {
+ // replace space/underscore/hyphen/dot with delimiter
+ n.WriteByte(delimiter)
+ } else {
+ n.WriteByte(v)
+ }
+ }
+
+ return n.String()
+}
diff --git a/vendor/github.com/json-iterator/go/README.md b/vendor/github.com/json-iterator/go/README.md
index 52b111d5f3..c589addf98 100644
--- a/vendor/github.com/json-iterator/go/README.md
+++ b/vendor/github.com/json-iterator/go/README.md
@@ -8,8 +8,6 @@
A high-performance 100% compatible drop-in replacement of "encoding/json"
-You can also use thrift like JSON using [thrift-iterator](https://github.com/thrift-iterator/go)
-
# Benchmark

diff --git a/vendor/github.com/labstack/gommon/bytes/bytes.go b/vendor/github.com/labstack/gommon/bytes/bytes.go
index 2f6bcec6e7..b07e31cdb4 100644
--- a/vendor/github.com/labstack/gommon/bytes/bytes.go
+++ b/vendor/github.com/labstack/gommon/bytes/bytes.go
@@ -12,19 +12,31 @@ type (
Bytes struct{}
)
+// binary units (IEC 60027)
const (
_ = 1.0 << (10 * iota) // ignore first value by assigning to blank identifier
- KB
- MB
- GB
- TB
- PB
- EB
+ KiB
+ MiB
+ GiB
+ TiB
+ PiB
+ EiB
+)
+
+// decimal units (SI international system of units)
+const (
+ KB = 1000
+ MB = KB * 1000
+ GB = MB * 1000
+ TB = GB * 1000
+ PB = TB * 1000
+ EB = PB * 1000
)
var (
- pattern = regexp.MustCompile(`(?i)^(-?\d+(?:\.\d+)?)\s?([KMGTPE]B?|B?)$`)
- global = New()
+ patternBinary = regexp.MustCompile(`(?i)^(-?\d+(?:\.\d+)?)\s?([KMGTPE]iB?)$`)
+ patternDecimal = regexp.MustCompile(`(?i)^(-?\d+(?:\.\d+)?)\s?([KMGTPE]B?|B?)$`)
+ global = New()
)
// New creates a Bytes instance.
@@ -32,44 +44,97 @@ func New() *Bytes {
return &Bytes{}
}
-// Format formats bytes integer to human readable string.
+// Format formats bytes integer to human readable string according to IEC 60027.
+// For example, 31323 bytes will return 30.59KB.
+func (b *Bytes) Format(value int64) string {
+ return b.FormatBinary(value)
+}
+
+// FormatBinary formats bytes integer to human readable string according to IEC 60027.
// For example, 31323 bytes will return 30.59KB.
-func (*Bytes) Format(b int64) string {
+func (*Bytes) FormatBinary(value int64) string {
+ multiple := ""
+ val := float64(value)
+
+ switch {
+ case value >= EiB:
+ val /= EiB
+ multiple = "EiB"
+ case value >= PiB:
+ val /= PiB
+ multiple = "PiB"
+ case value >= TiB:
+ val /= TiB
+ multiple = "TiB"
+ case value >= GiB:
+ val /= GiB
+ multiple = "GiB"
+ case value >= MiB:
+ val /= MiB
+ multiple = "MiB"
+ case value >= KiB:
+ val /= KiB
+ multiple = "KiB"
+ case value == 0:
+ return "0"
+ default:
+ return strconv.FormatInt(value, 10) + "B"
+ }
+
+ return fmt.Sprintf("%.2f%s", val, multiple)
+}
+
+// FormatDecimal formats bytes integer to human readable string according to SI international system of units.
+// For example, 31323 bytes will return 31.32KB.
+func (*Bytes) FormatDecimal(value int64) string {
multiple := ""
- value := float64(b)
+ val := float64(value)
switch {
- case b >= EB:
- value /= EB
+ case value >= EB:
+ val /= EB
multiple = "EB"
- case b >= PB:
- value /= PB
+ case value >= PB:
+ val /= PB
multiple = "PB"
- case b >= TB:
- value /= TB
+ case value >= TB:
+ val /= TB
multiple = "TB"
- case b >= GB:
- value /= GB
+ case value >= GB:
+ val /= GB
multiple = "GB"
- case b >= MB:
- value /= MB
+ case value >= MB:
+ val /= MB
multiple = "MB"
- case b >= KB:
- value /= KB
+ case value >= KB:
+ val /= KB
multiple = "KB"
- case b == 0:
+ case value == 0:
return "0"
default:
- return strconv.FormatInt(b, 10) + "B"
+ return strconv.FormatInt(value, 10) + "B"
}
- return fmt.Sprintf("%.2f%s", value, multiple)
+ return fmt.Sprintf("%.2f%s", val, multiple)
}
// Parse parses human readable bytes string to bytes integer.
-// For example, 6GB (6G is also valid) will return 6442450944.
-func (*Bytes) Parse(value string) (i int64, err error) {
- parts := pattern.FindStringSubmatch(value)
+// For example, 6GiB (6Gi is also valid) will return 6442450944, and
+// 6GB (6G is also valid) will return 6000000000.
+func (b *Bytes) Parse(value string) (int64, error) {
+
+ i, err := b.ParseBinary(value)
+ if err == nil {
+ return i, err
+ }
+
+ return b.ParseDecimal(value)
+}
+
+// ParseBinary parses human readable bytes string to bytes integer.
+// For example, 6GiB (6Gi is also valid) will return 6442450944.
+func (*Bytes) ParseBinary(value string) (i int64, err error) {
+ parts := patternBinary.FindStringSubmatch(value)
if len(parts) < 3 {
return 0, fmt.Errorf("error parsing value=%s", value)
}
@@ -81,8 +146,38 @@ func (*Bytes) Parse(value string) (i int64, err error) {
}
switch multiple {
+ case "KI", "KIB":
+ return int64(bytes * KiB), nil
+ case "MI", "MIB":
+ return int64(bytes * MiB), nil
+ case "GI", "GIB":
+ return int64(bytes * GiB), nil
+ case "TI", "TIB":
+ return int64(bytes * TiB), nil
+ case "PI", "PIB":
+ return int64(bytes * PiB), nil
+ case "EI", "EIB":
+ return int64(bytes * EiB), nil
default:
return int64(bytes), nil
+ }
+}
+
+// ParseDecimal parses human readable bytes string to bytes integer.
+// For example, 6GB (6G is also valid) will return 6000000000.
+func (*Bytes) ParseDecimal(value string) (i int64, err error) {
+ parts := patternDecimal.FindStringSubmatch(value)
+ if len(parts) < 3 {
+ return 0, fmt.Errorf("error parsing value=%s", value)
+ }
+ bytesString := parts[1]
+ multiple := strings.ToUpper(parts[2])
+ bytes, err := strconv.ParseFloat(bytesString, 64)
+ if err != nil {
+ return
+ }
+
+ switch multiple {
case "K", "KB":
return int64(bytes * KB), nil
case "M", "MB":
@@ -95,15 +190,27 @@ func (*Bytes) Parse(value string) (i int64, err error) {
return int64(bytes * PB), nil
case "E", "EB":
return int64(bytes * EB), nil
+ default:
+ return int64(bytes), nil
}
}
// Format wraps global Bytes's Format function.
-func Format(b int64) string {
- return global.Format(b)
+func Format(value int64) string {
+ return global.Format(value)
+}
+
+// FormatBinary wraps global Bytes's FormatBinary function.
+func FormatBinary(value int64) string {
+ return global.FormatBinary(value)
+}
+
+// FormatDecimal wraps global Bytes's FormatDecimal function.
+func FormatDecimal(value int64) string {
+ return global.FormatDecimal(value)
}
// Parse wraps global Bytes's Parse function.
-func Parse(val string) (int64, error) {
- return global.Parse(val)
+func Parse(value string) (int64, error) {
+ return global.Parse(value)
}
diff --git a/vendor/github.com/labstack/gommon/log/log.go b/vendor/github.com/labstack/gommon/log/log.go
index 06fa37e0ef..25f719aa21 100644
--- a/vendor/github.com/labstack/gommon/log/log.go
+++ b/vendor/github.com/labstack/gommon/log/log.go
@@ -391,7 +391,7 @@ func (l *Logger) log(level Lvl, format string, args ...interface{}) {
if err == nil {
s := buf.String()
i := buf.Len() - 1
- if s[i] == '}' {
+ if i >= 0 && s[i] == '}' {
// JSON header
buf.Truncate(i)
buf.WriteByte(',')
@@ -404,7 +404,9 @@ func (l *Logger) log(level Lvl, format string, args ...interface{}) {
}
} else {
// Text header
- buf.WriteByte(' ')
+ if len(s) > 0 {
+ buf.WriteByte(' ')
+ }
buf.WriteString(message)
}
buf.WriteByte('\n')
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/README.md b/vendor/github.com/larksuite/oapi-sdk-go/v3/README.md
index bd59e84f9b..2ca931a850 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/README.md
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/README.md
@@ -42,7 +42,7 @@
## 安装
```go
-go get -u github.com/larksuite/oapi-sdk-go/v3@v3.0.18
+go get -u github.com/larksuite/oapi-sdk-go/v3@v3.0.23
```
## API Client
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/client.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/client.go
index 594f07370f..fb641f6c74 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/client.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/client.go
@@ -27,6 +27,7 @@ import (
"github.com/larksuite/oapi-sdk-go/v3/service/application/v6"
"github.com/larksuite/oapi-sdk-go/v3/service/approval/v4"
"github.com/larksuite/oapi-sdk-go/v3/service/attendance/v1"
+ "github.com/larksuite/oapi-sdk-go/v3/service/auth/v3"
"github.com/larksuite/oapi-sdk-go/v3/service/authen/v1"
"github.com/larksuite/oapi-sdk-go/v3/service/baike/v1"
"github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1"
@@ -48,6 +49,7 @@ import (
"github.com/larksuite/oapi-sdk-go/v3/service/okr/v1"
"github.com/larksuite/oapi-sdk-go/v3/service/optical_char_recognition/v1"
"github.com/larksuite/oapi-sdk-go/v3/service/passport/v1"
+ "github.com/larksuite/oapi-sdk-go/v3/service/personal_settings/v1"
"github.com/larksuite/oapi-sdk-go/v3/service/search/v2"
"github.com/larksuite/oapi-sdk-go/v3/service/sheets/v3"
"github.com/larksuite/oapi-sdk-go/v3/service/speech_to_text/v1"
@@ -65,6 +67,7 @@ type Client struct {
Application *larkapplication.ApplicationService // 应用信息
Approval *larkapproval.ApprovalService // 审批
Attendance *larkattendance.AttendanceService // 打卡
+ Auth *larkauth.AuthService //
Authen *larkauthen.AuthenService //
Baike *larkbaike.BaikeService // 企业百科
Bitable *larkbitable.BitableService // 云文档-多维表格
@@ -85,6 +88,7 @@ type Client struct {
Okr *larkokr.OkrService // OKR
OpticalCharRecognition *larkoptical_char_recognition.OpticalCharRecognitionService // AI能力
Passport *larkpassport.PassportService // 帐号
+ PersonalSettings *larkpersonal_settings.PersonalSettingsService // 个人设置
Search *larksearch.SearchService // 搜索
Sheets *larksheets.SheetsService // 云文档-电子表格
SpeechToText *larkspeech_to_text.SpeechToTextService // AI能力
@@ -221,6 +225,7 @@ func initService(client *Client, config *larkcore.Config) {
client.Application = larkapplication.NewService(config)
client.Approval = larkapproval.NewService(config)
client.Attendance = larkattendance.NewService(config)
+ client.Auth = larkauth.NewService(config)
client.Authen = larkauthen.NewService(config)
client.Baike = larkbaike.NewService(config)
client.Bitable = larkbitable.NewService(config)
@@ -241,6 +246,7 @@ func initService(client *Client, config *larkcore.Config) {
client.Okr = larkokr.NewService(config)
client.OpticalCharRecognition = larkoptical_char_recognition.NewService(config)
client.Passport = larkpassport.NewService(config)
+ client.PersonalSettings = larkpersonal_settings.NewService(config)
client.Search = larksearch.NewService(config)
client.Sheets = larksheets.NewService(config)
client.SpeechToText = larkspeech_to_text.NewService(config)
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/core/httptransport.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/core/httptransport.go
index b2e258af1d..ee3458d3fe 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/core/httptransport.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/core/httptransport.go
@@ -41,7 +41,7 @@ func NewSerialization(config *Config) {
}
func validateTokenType(accessTokenTypes []AccessTokenType, option *RequestOption) error {
- if option == nil || len(accessTokenTypes) == 0 || len(accessTokenTypes) > 1 {
+ if option == nil || len(accessTokenTypes) > 1 {
return nil
}
@@ -177,6 +177,11 @@ func Request(ctx context.Context, req *ApiReq, config *Config, options ...Reques
optionFunc(option)
}
+ // 兼容 auth_v3
+ if len(req.SupportedAccessTokenTypes) == 0 {
+ req.SupportedAccessTokenTypes = append(req.SupportedAccessTokenTypes, AccessTokenTypeNone)
+ }
+
err := validateTokenType(req.SupportedAccessTokenTypes, option)
if err != nil {
return nil, err
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/application/v6/api.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/application/v6/api.go
index 83ceb12596..a204b1b6d6 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/application/v6/api.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/application/v6/api.go
@@ -28,6 +28,7 @@ func NewService(config *larkcore.Config) *ApplicationService {
a.ApplicationAppVersion = &applicationAppVersion{service: a}
a.ApplicationFeedback = &applicationFeedback{service: a}
a.ApplicationVisibility = &applicationVisibility{service: a}
+ a.Bot = &bot{service: a}
return a
}
@@ -39,6 +40,7 @@ type ApplicationService struct {
ApplicationAppVersion *applicationAppVersion // 事件
ApplicationFeedback *applicationFeedback // 应用反馈
ApplicationVisibility *applicationVisibility // 事件
+ Bot *bot // 事件
}
type appRecommendRule struct {
@@ -59,6 +61,9 @@ type applicationFeedback struct {
type applicationVisibility struct {
service *ApplicationService
}
+type bot struct {
+ service *ApplicationService
+}
// 获取当前设置的推荐规则列表
//
@@ -94,6 +99,32 @@ func (a *appRecommendRule) ListByIterator(ctx context.Context, req *ListAppRecom
limit: req.Limit}, nil
}
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=contacts_range_configuration&project=application&resource=application&version=v6
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/applicationv6/contactsRangeConfiguration_application.go
+func (a *application) ContactsRangeConfiguration(ctx context.Context, req *ContactsRangeConfigurationApplicationReq, options ...larkcore.RequestOptionFunc) (*ContactsRangeConfigurationApplicationResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/application/v6/applications/:app_id/contacts_range_configuration"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, a.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ContactsRangeConfigurationApplicationResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, a.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
// 获取应用信息
//
// - 根据app_id获取应用的基础信息
@@ -208,6 +239,32 @@ func (a *applicationAppUsage) Overview(ctx context.Context, req *OverviewApplica
return resp, err
}
+//
+//
+// - 获取应用版本通讯录权限范围建议
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=contacts_range_suggest&project=application&resource=application.app_version&version=v6
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/applicationv6/contactsRangeSuggest_applicationAppVersion.go
+func (a *applicationAppVersion) ContactsRangeSuggest(ctx context.Context, req *ContactsRangeSuggestApplicationAppVersionReq, options ...larkcore.RequestOptionFunc) (*ContactsRangeSuggestApplicationAppVersionResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/application/v6/applications/:app_id/app_versions/:version_id/contacts_range_suggest"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, a.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ContactsRangeSuggestApplicationAppVersionResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, a.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
// 获取应用版本信息
//
// - 根据应用 ID 和应用版本 ID 来获取同租户下的应用版本的信息
@@ -345,3 +402,29 @@ func (a *applicationFeedback) Patch(ctx context.Context, req *PatchApplicationFe
}
return resp, err
}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=check_white_black_list&project=application&resource=application.visibility&version=v6
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/applicationv6/checkWhiteBlackList_applicationVisibility.go
+func (a *applicationVisibility) CheckWhiteBlackList(ctx context.Context, req *CheckWhiteBlackListApplicationVisibilityReq, options ...larkcore.RequestOptionFunc) (*CheckWhiteBlackListApplicationVisibilityResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/application/v6/applications/:app_id/visibility/check_white_black_list"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, a.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CheckWhiteBlackListApplicationVisibilityResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, a.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/application/v6/event.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/application/v6/event.go
index 354d0e0158..52f277699e 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/application/v6/event.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/application/v6/event.go
@@ -156,3 +156,23 @@ func (h *P2ApplicationVisibilityAddedV6Handler) Event() interface{} {
func (h *P2ApplicationVisibilityAddedV6Handler) Handle(ctx context.Context, event interface{}) error {
return h.handler(ctx, event.(*P2ApplicationVisibilityAddedV6))
}
+
+// 消息处理器定义
+type P2BotMenuV6Handler struct {
+ handler func(context.Context, *P2BotMenuV6) error
+}
+
+func NewP2BotMenuV6Handler(handler func(context.Context, *P2BotMenuV6) error) *P2BotMenuV6Handler {
+ h := &P2BotMenuV6Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2BotMenuV6Handler) Event() interface{} {
+ return &P2BotMenuV6{}
+}
+
+// 回调开发者注册的handle
+func (h *P2BotMenuV6Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2BotMenuV6))
+}
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/application/v6/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/application/v6/model.go
index cc14a75a94..c9d42e6833 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/application/v6/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/application/v6/model.go
@@ -30,6 +30,17 @@ const (
UserIdTypeOpenId = "open_id" // 以open_id来识别用户
)
+const (
+ DepartmentIdTypeDepartmentId = "department_id" // 以自定义department_id来标识部门
+ DepartmentIdTypeOpenDepartmentId = "open_department_id" // 以open_department_id来标识部门
+)
+
+const (
+ UserIdTypeContactsRangeConfigurationApplicationUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeContactsRangeConfigurationApplicationUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeContactsRangeConfigurationApplicationOpenId = "open_id" // 以open_id来识别用户
+)
+
const (
I18nKeyZhCn = "zh_cn" // 中文
I18nKeyEnUs = "en_us" // 英文
@@ -75,8 +86,19 @@ const (
)
const (
- DepartmentIdTypeDepartmentId = "department_id" // 以自定义department_id来标识部门
- DepartmentIdTypeOpenDepartmentId = "open_department_id" // 以open_department_id来标识部门
+ DepartmentIdTypeOverviewApplicationAppUsageDepartmentId = "department_id" // 以自定义department_id来标识部门
+ DepartmentIdTypeOverviewApplicationAppUsageOpenDepartmentId = "open_department_id" // 以open_department_id来标识部门
+)
+
+const (
+ DepartmentIdTypeContactsRangeSuggestApplicationAppVersionDepartmentId = "department_id" // 以自定义department_id来标识部门
+ DepartmentIdTypeContactsRangeSuggestApplicationAppVersionOpenDepartmentId = "open_department_id" // 以open_department_id来标识部门
+)
+
+const (
+ UserIdTypeContactsRangeSuggestApplicationAppVersionUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeContactsRangeSuggestApplicationAppVersionUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeContactsRangeSuggestApplicationAppVersionOpenId = "open_id" // 以open_id来识别用户
)
const (
@@ -152,6 +174,17 @@ const (
)
+const (
+ UserIdTypeCheckWhiteBlackListApplicationVisibilityUserId = "user_id" // 以user_id来标识用户
+ UserIdTypeCheckWhiteBlackListApplicationVisibilityUnionId = "union_id" // 以union_id来标识用户
+ UserIdTypeCheckWhiteBlackListApplicationVisibilityOpenId = "open_id" // 以open_id来标识用户
+)
+
+const (
+ DepartmentIdTypeCheckWhiteBlackListApplicationVisibilityDepartmentId = "department_id" // 以department_id来标识部门
+ DepartmentIdTypeCheckWhiteBlackListApplicationVisibilityOpenDepartmentId = "open_department_id" // 以open_department_id来标识部门
+)
+
type AppAbility struct {
Gadget *Gadget `json:"gadget,omitempty"` // 小程序能力
WebApp *WebApp `json:"web_app,omitempty"` // 网页能力
@@ -1773,6 +1806,7 @@ func (builder *AppVisibilityItemBuilder) Build() *AppVisibilityItem {
type AppVisibleList struct {
OpenIds []string `json:"open_ids,omitempty"` // 可见性成员 open_id 列表
DepartmentIds []string `json:"department_ids,omitempty"` // 可见性部门的 id 列表
+ GroupIds []string `json:"group_ids,omitempty"` // 可见性成员 group_id 列表
}
type AppVisibleListBuilder struct {
@@ -1780,6 +1814,8 @@ type AppVisibleListBuilder struct {
openIdsFlag bool
departmentIds []string // 可见性部门的 id 列表
departmentIdsFlag bool
+ groupIds []string // 可见性成员 group_id 列表
+ groupIdsFlag bool
}
func NewAppVisibleListBuilder() *AppVisibleListBuilder {
@@ -1805,6 +1841,15 @@ func (builder *AppVisibleListBuilder) DepartmentIds(departmentIds []string) *App
return builder
}
+// 可见性成员 group_id 列表
+//
+// 示例值:
+func (builder *AppVisibleListBuilder) GroupIds(groupIds []string) *AppVisibleListBuilder {
+ builder.groupIds = groupIds
+ builder.groupIdsFlag = true
+ return builder
+}
+
func (builder *AppVisibleListBuilder) Build() *AppVisibleList {
req := &AppVisibleList{}
if builder.openIdsFlag {
@@ -1813,6 +1858,9 @@ func (builder *AppVisibleListBuilder) Build() *AppVisibleList {
if builder.departmentIdsFlag {
req.DepartmentIds = builder.departmentIds
}
+ if builder.groupIdsFlag {
+ req.GroupIds = builder.groupIds
+ }
return req
}
@@ -2145,6 +2193,53 @@ func (builder *ApplicationBuilder) Build() *Application {
return req
}
+type ApplicationAppContactsRange struct {
+ ContactsScopeType *string `json:"contacts_scope_type,omitempty"` // 通讯录可见性类型
+ VisibleList *AppVisibleList `json:"visible_list,omitempty"` // 可用名单
+}
+
+type ApplicationAppContactsRangeBuilder struct {
+ contactsScopeType string // 通讯录可见性类型
+ contactsScopeTypeFlag bool
+ visibleList *AppVisibleList // 可用名单
+ visibleListFlag bool
+}
+
+func NewApplicationAppContactsRangeBuilder() *ApplicationAppContactsRangeBuilder {
+ builder := &ApplicationAppContactsRangeBuilder{}
+ return builder
+}
+
+// 通讯录可见性类型
+//
+// 示例值:some
+func (builder *ApplicationAppContactsRangeBuilder) ContactsScopeType(contactsScopeType string) *ApplicationAppContactsRangeBuilder {
+ builder.contactsScopeType = contactsScopeType
+ builder.contactsScopeTypeFlag = true
+ return builder
+}
+
+// 可用名单
+//
+// 示例值:
+func (builder *ApplicationAppContactsRangeBuilder) VisibleList(visibleList *AppVisibleList) *ApplicationAppContactsRangeBuilder {
+ builder.visibleList = visibleList
+ builder.visibleListFlag = true
+ return builder
+}
+
+func (builder *ApplicationAppContactsRangeBuilder) Build() *ApplicationAppContactsRange {
+ req := &ApplicationAppContactsRange{}
+ if builder.contactsScopeTypeFlag {
+ req.ContactsScopeType = &builder.contactsScopeType
+
+ }
+ if builder.visibleListFlag {
+ req.VisibleList = builder.visibleList
+ }
+ return req
+}
+
type ApplicationAppUsage struct {
MetricName *string `json:"metric_name,omitempty"` // 指标名称
MetricValue *int `json:"metric_value,omitempty"` // 指标值
@@ -3357,6 +3452,214 @@ func (builder *ApplicationVisibilityBuilder) Build() *ApplicationVisibility {
return req
}
+type ApplicationVisibilityDepartmentWhiteBlackInfo struct {
+ DepartmentId *string `json:"department_id,omitempty"` // 部门ID
+ InWhiteList *bool `json:"in_white_list,omitempty"` // 是否在白名单中
+ InBlackList *bool `json:"in_black_list,omitempty"` // 是否在黑名单中
+}
+
+type ApplicationVisibilityDepartmentWhiteBlackInfoBuilder struct {
+ departmentId string // 部门ID
+ departmentIdFlag bool
+ inWhiteList bool // 是否在白名单中
+ inWhiteListFlag bool
+ inBlackList bool // 是否在黑名单中
+ inBlackListFlag bool
+}
+
+func NewApplicationVisibilityDepartmentWhiteBlackInfoBuilder() *ApplicationVisibilityDepartmentWhiteBlackInfoBuilder {
+ builder := &ApplicationVisibilityDepartmentWhiteBlackInfoBuilder{}
+ return builder
+}
+
+// 部门ID
+//
+// 示例值:od-aa2c50a04769feefededb7a05b7525a8
+func (builder *ApplicationVisibilityDepartmentWhiteBlackInfoBuilder) DepartmentId(departmentId string) *ApplicationVisibilityDepartmentWhiteBlackInfoBuilder {
+ builder.departmentId = departmentId
+ builder.departmentIdFlag = true
+ return builder
+}
+
+// 是否在白名单中
+//
+// 示例值:false
+func (builder *ApplicationVisibilityDepartmentWhiteBlackInfoBuilder) InWhiteList(inWhiteList bool) *ApplicationVisibilityDepartmentWhiteBlackInfoBuilder {
+ builder.inWhiteList = inWhiteList
+ builder.inWhiteListFlag = true
+ return builder
+}
+
+// 是否在黑名单中
+//
+// 示例值:false
+func (builder *ApplicationVisibilityDepartmentWhiteBlackInfoBuilder) InBlackList(inBlackList bool) *ApplicationVisibilityDepartmentWhiteBlackInfoBuilder {
+ builder.inBlackList = inBlackList
+ builder.inBlackListFlag = true
+ return builder
+}
+
+func (builder *ApplicationVisibilityDepartmentWhiteBlackInfoBuilder) Build() *ApplicationVisibilityDepartmentWhiteBlackInfo {
+ req := &ApplicationVisibilityDepartmentWhiteBlackInfo{}
+ if builder.departmentIdFlag {
+ req.DepartmentId = &builder.departmentId
+
+ }
+ if builder.inWhiteListFlag {
+ req.InWhiteList = &builder.inWhiteList
+
+ }
+ if builder.inBlackListFlag {
+ req.InBlackList = &builder.inBlackList
+
+ }
+ return req
+}
+
+type ApplicationVisibilityGroupWhiteBlackInfo struct {
+ GroupId *string `json:"group_id,omitempty"` // 用户组ID
+ InWhiteList *bool `json:"in_white_list,omitempty"` // 是否在白名单中
+ InBlackList *bool `json:"in_black_list,omitempty"` // 是否在黑名单中
+}
+
+type ApplicationVisibilityGroupWhiteBlackInfoBuilder struct {
+ groupId string // 用户组ID
+ groupIdFlag bool
+ inWhiteList bool // 是否在白名单中
+ inWhiteListFlag bool
+ inBlackList bool // 是否在黑名单中
+ inBlackListFlag bool
+}
+
+func NewApplicationVisibilityGroupWhiteBlackInfoBuilder() *ApplicationVisibilityGroupWhiteBlackInfoBuilder {
+ builder := &ApplicationVisibilityGroupWhiteBlackInfoBuilder{}
+ return builder
+}
+
+// 用户组ID
+//
+// 示例值:96815a9cd9beg8g4
+func (builder *ApplicationVisibilityGroupWhiteBlackInfoBuilder) GroupId(groupId string) *ApplicationVisibilityGroupWhiteBlackInfoBuilder {
+ builder.groupId = groupId
+ builder.groupIdFlag = true
+ return builder
+}
+
+// 是否在白名单中
+//
+// 示例值:false
+func (builder *ApplicationVisibilityGroupWhiteBlackInfoBuilder) InWhiteList(inWhiteList bool) *ApplicationVisibilityGroupWhiteBlackInfoBuilder {
+ builder.inWhiteList = inWhiteList
+ builder.inWhiteListFlag = true
+ return builder
+}
+
+// 是否在黑名单中
+//
+// 示例值:false
+func (builder *ApplicationVisibilityGroupWhiteBlackInfoBuilder) InBlackList(inBlackList bool) *ApplicationVisibilityGroupWhiteBlackInfoBuilder {
+ builder.inBlackList = inBlackList
+ builder.inBlackListFlag = true
+ return builder
+}
+
+func (builder *ApplicationVisibilityGroupWhiteBlackInfoBuilder) Build() *ApplicationVisibilityGroupWhiteBlackInfo {
+ req := &ApplicationVisibilityGroupWhiteBlackInfo{}
+ if builder.groupIdFlag {
+ req.GroupId = &builder.groupId
+
+ }
+ if builder.inWhiteListFlag {
+ req.InWhiteList = &builder.inWhiteList
+
+ }
+ if builder.inBlackListFlag {
+ req.InBlackList = &builder.inBlackList
+
+ }
+ return req
+}
+
+type ApplicationVisibilityUserWhiteBlackInfo struct {
+ UserId *string `json:"user_id,omitempty"` // 用户ID
+ InWhiteList *bool `json:"in_white_list,omitempty"` // 是否在白名单中
+ InBlackList *bool `json:"in_black_list,omitempty"` // 是否在黑名单中
+ InPaidList *bool `json:"in_paid_list,omitempty"` // 是否在付费名单中
+}
+
+type ApplicationVisibilityUserWhiteBlackInfoBuilder struct {
+ userId string // 用户ID
+ userIdFlag bool
+ inWhiteList bool // 是否在白名单中
+ inWhiteListFlag bool
+ inBlackList bool // 是否在黑名单中
+ inBlackListFlag bool
+ inPaidList bool // 是否在付费名单中
+ inPaidListFlag bool
+}
+
+func NewApplicationVisibilityUserWhiteBlackInfoBuilder() *ApplicationVisibilityUserWhiteBlackInfoBuilder {
+ builder := &ApplicationVisibilityUserWhiteBlackInfoBuilder{}
+ return builder
+}
+
+// 用户ID
+//
+// 示例值:ou_d317f090b7258ad0372aa53963cda70d
+func (builder *ApplicationVisibilityUserWhiteBlackInfoBuilder) UserId(userId string) *ApplicationVisibilityUserWhiteBlackInfoBuilder {
+ builder.userId = userId
+ builder.userIdFlag = true
+ return builder
+}
+
+// 是否在白名单中
+//
+// 示例值:false
+func (builder *ApplicationVisibilityUserWhiteBlackInfoBuilder) InWhiteList(inWhiteList bool) *ApplicationVisibilityUserWhiteBlackInfoBuilder {
+ builder.inWhiteList = inWhiteList
+ builder.inWhiteListFlag = true
+ return builder
+}
+
+// 是否在黑名单中
+//
+// 示例值:false
+func (builder *ApplicationVisibilityUserWhiteBlackInfoBuilder) InBlackList(inBlackList bool) *ApplicationVisibilityUserWhiteBlackInfoBuilder {
+ builder.inBlackList = inBlackList
+ builder.inBlackListFlag = true
+ return builder
+}
+
+// 是否在付费名单中
+//
+// 示例值:false
+func (builder *ApplicationVisibilityUserWhiteBlackInfoBuilder) InPaidList(inPaidList bool) *ApplicationVisibilityUserWhiteBlackInfoBuilder {
+ builder.inPaidList = inPaidList
+ builder.inPaidListFlag = true
+ return builder
+}
+
+func (builder *ApplicationVisibilityUserWhiteBlackInfoBuilder) Build() *ApplicationVisibilityUserWhiteBlackInfo {
+ req := &ApplicationVisibilityUserWhiteBlackInfo{}
+ if builder.userIdFlag {
+ req.UserId = &builder.userId
+
+ }
+ if builder.inWhiteListFlag {
+ req.InWhiteList = &builder.inWhiteList
+
+ }
+ if builder.inBlackListFlag {
+ req.InBlackList = &builder.inBlackList
+
+ }
+ if builder.inPaidListFlag {
+ req.InPaidList = &builder.inPaidList
+
+ }
+ return req
+}
+
type Block struct {
BlockTypeId *string `json:"block_type_id,omitempty"` // BlockTypeID
VersionId *string `json:"version_id,omitempty"` // 上传 block 小程序的 version id
@@ -5055,6 +5358,87 @@ func (resp *ListAppRecommendRuleResp) Success() bool {
return resp.Code == 0
}
+type ContactsRangeConfigurationApplicationReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewContactsRangeConfigurationApplicationReqBuilder() *ContactsRangeConfigurationApplicationReqBuilder {
+ builder := &ContactsRangeConfigurationApplicationReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 应用的 id
+//
+// 示例值:cli_9b445f5258795107
+func (builder *ContactsRangeConfigurationApplicationReqBuilder) AppId(appId string) *ContactsRangeConfigurationApplicationReqBuilder {
+ builder.apiReq.PathParams.Set("app_id", fmt.Sprint(appId))
+ return builder
+}
+
+// 分页大小
+//
+// 示例值:20
+func (builder *ContactsRangeConfigurationApplicationReqBuilder) PageSize(pageSize int) *ContactsRangeConfigurationApplicationReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果
+//
+// 示例值:new-e3c5a0627cdf0c2e057da7257b90376a
+func (builder *ContactsRangeConfigurationApplicationReqBuilder) PageToken(pageToken string) *ContactsRangeConfigurationApplicationReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 返回值的部门ID的类型
+//
+// 示例值:department_id
+func (builder *ContactsRangeConfigurationApplicationReqBuilder) DepartmentIdType(departmentIdType string) *ContactsRangeConfigurationApplicationReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:
+func (builder *ContactsRangeConfigurationApplicationReqBuilder) UserIdType(userIdType string) *ContactsRangeConfigurationApplicationReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+func (builder *ContactsRangeConfigurationApplicationReqBuilder) Build() *ContactsRangeConfigurationApplicationReq {
+ req := &ContactsRangeConfigurationApplicationReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ContactsRangeConfigurationApplicationReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ContactsRangeConfigurationApplicationRespData struct {
+ ContactsRange *ApplicationAppContactsRange `json:"contacts_range,omitempty"` //
+ HasMore *bool `json:"has_more,omitempty"` // 是否还有更多项
+ PageToken *string `json:"page_token,omitempty"` // 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 page_token
+}
+
+type ContactsRangeConfigurationApplicationResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ContactsRangeConfigurationApplicationRespData `json:"data"` // 业务数据
+}
+
+func (resp *ContactsRangeConfigurationApplicationResp) Success() bool {
+ return resp.Code == 0
+}
+
type GetApplicationReqBuilder struct {
apiReq *larkcore.ApiReq
}
@@ -5205,7 +5589,7 @@ func (builder *UnderauditlistApplicationReqBuilder) Lang(lang string) *Underaudi
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:new-e3c5a0627cdf0c2e057da7257b90376a
func (builder *UnderauditlistApplicationReqBuilder) PageToken(pageToken string) *UnderauditlistApplicationReqBuilder {
@@ -5213,7 +5597,7 @@ func (builder *UnderauditlistApplicationReqBuilder) PageToken(pageToken string)
return builder
}
-//
+// 分页大小
//
// 示例值:10
func (builder *UnderauditlistApplicationReqBuilder) PageSize(pageSize int) *UnderauditlistApplicationReqBuilder {
@@ -5468,6 +5852,77 @@ func (resp *OverviewApplicationAppUsageResp) Success() bool {
return resp.Code == 0
}
+type ContactsRangeSuggestApplicationAppVersionReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewContactsRangeSuggestApplicationAppVersionReqBuilder() *ContactsRangeSuggestApplicationAppVersionReqBuilder {
+ builder := &ContactsRangeSuggestApplicationAppVersionReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 应用 id
+//
+// 示例值:cli_9f3ca975326b501b
+func (builder *ContactsRangeSuggestApplicationAppVersionReqBuilder) AppId(appId string) *ContactsRangeSuggestApplicationAppVersionReqBuilder {
+ builder.apiReq.PathParams.Set("app_id", fmt.Sprint(appId))
+ return builder
+}
+
+// 唯一标识应用版本的 ID
+//
+// 示例值:oav_d317f090b7258ad0372aa53963cda70d
+func (builder *ContactsRangeSuggestApplicationAppVersionReqBuilder) VersionId(versionId string) *ContactsRangeSuggestApplicationAppVersionReqBuilder {
+ builder.apiReq.PathParams.Set("version_id", fmt.Sprint(versionId))
+ return builder
+}
+
+// 返回值的部门ID的类型
+//
+// 示例值:department_id
+func (builder *ContactsRangeSuggestApplicationAppVersionReqBuilder) DepartmentIdType(departmentIdType string) *ContactsRangeSuggestApplicationAppVersionReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:
+func (builder *ContactsRangeSuggestApplicationAppVersionReqBuilder) UserIdType(userIdType string) *ContactsRangeSuggestApplicationAppVersionReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+func (builder *ContactsRangeSuggestApplicationAppVersionReqBuilder) Build() *ContactsRangeSuggestApplicationAppVersionReq {
+ req := &ContactsRangeSuggestApplicationAppVersionReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ContactsRangeSuggestApplicationAppVersionReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ContactsRangeSuggestApplicationAppVersionRespData struct {
+ ContactsRange *ApplicationAppContactsRange `json:"contacts_range,omitempty"` //
+}
+
+type ContactsRangeSuggestApplicationAppVersionResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ContactsRangeSuggestApplicationAppVersionRespData `json:"data"` // 业务数据
+}
+
+func (resp *ContactsRangeSuggestApplicationAppVersionResp) Success() bool {
+ return resp.Code == 0
+}
+
type GetApplicationAppVersionReqBuilder struct {
apiReq *larkcore.ApiReq
}
@@ -5900,6 +6355,196 @@ func (resp *PatchApplicationFeedbackResp) Success() bool {
return resp.Code == 0
}
+type CheckWhiteBlackListApplicationVisibilityReqBodyBuilder struct {
+ userIds []string // 用户ID列表
+ userIdsFlag bool
+ departmentIds []string // 部门ID列表
+ departmentIdsFlag bool
+ groupIds []string // 用户组ID列表
+ groupIdsFlag bool
+}
+
+func NewCheckWhiteBlackListApplicationVisibilityReqBodyBuilder() *CheckWhiteBlackListApplicationVisibilityReqBodyBuilder {
+ builder := &CheckWhiteBlackListApplicationVisibilityReqBodyBuilder{}
+ return builder
+}
+
+// 用户ID列表
+//
+//示例值:
+func (builder *CheckWhiteBlackListApplicationVisibilityReqBodyBuilder) UserIds(userIds []string) *CheckWhiteBlackListApplicationVisibilityReqBodyBuilder {
+ builder.userIds = userIds
+ builder.userIdsFlag = true
+ return builder
+}
+
+// 部门ID列表
+//
+//示例值:
+func (builder *CheckWhiteBlackListApplicationVisibilityReqBodyBuilder) DepartmentIds(departmentIds []string) *CheckWhiteBlackListApplicationVisibilityReqBodyBuilder {
+ builder.departmentIds = departmentIds
+ builder.departmentIdsFlag = true
+ return builder
+}
+
+// 用户组ID列表
+//
+//示例值:
+func (builder *CheckWhiteBlackListApplicationVisibilityReqBodyBuilder) GroupIds(groupIds []string) *CheckWhiteBlackListApplicationVisibilityReqBodyBuilder {
+ builder.groupIds = groupIds
+ builder.groupIdsFlag = true
+ return builder
+}
+
+func (builder *CheckWhiteBlackListApplicationVisibilityReqBodyBuilder) Build() *CheckWhiteBlackListApplicationVisibilityReqBody {
+ req := &CheckWhiteBlackListApplicationVisibilityReqBody{}
+ if builder.userIdsFlag {
+ req.UserIds = builder.userIds
+ }
+ if builder.departmentIdsFlag {
+ req.DepartmentIds = builder.departmentIds
+ }
+ if builder.groupIdsFlag {
+ req.GroupIds = builder.groupIds
+ }
+ return req
+}
+
+type CheckWhiteBlackListApplicationVisibilityPathReqBodyBuilder struct {
+ userIds []string // 用户ID列表
+ userIdsFlag bool
+ departmentIds []string // 部门ID列表
+ departmentIdsFlag bool
+ groupIds []string // 用户组ID列表
+ groupIdsFlag bool
+}
+
+func NewCheckWhiteBlackListApplicationVisibilityPathReqBodyBuilder() *CheckWhiteBlackListApplicationVisibilityPathReqBodyBuilder {
+ builder := &CheckWhiteBlackListApplicationVisibilityPathReqBodyBuilder{}
+ return builder
+}
+
+// 用户ID列表
+//
+// 示例值:
+func (builder *CheckWhiteBlackListApplicationVisibilityPathReqBodyBuilder) UserIds(userIds []string) *CheckWhiteBlackListApplicationVisibilityPathReqBodyBuilder {
+ builder.userIds = userIds
+ builder.userIdsFlag = true
+ return builder
+}
+
+// 部门ID列表
+//
+// 示例值:
+func (builder *CheckWhiteBlackListApplicationVisibilityPathReqBodyBuilder) DepartmentIds(departmentIds []string) *CheckWhiteBlackListApplicationVisibilityPathReqBodyBuilder {
+ builder.departmentIds = departmentIds
+ builder.departmentIdsFlag = true
+ return builder
+}
+
+// 用户组ID列表
+//
+// 示例值:
+func (builder *CheckWhiteBlackListApplicationVisibilityPathReqBodyBuilder) GroupIds(groupIds []string) *CheckWhiteBlackListApplicationVisibilityPathReqBodyBuilder {
+ builder.groupIds = groupIds
+ builder.groupIdsFlag = true
+ return builder
+}
+
+func (builder *CheckWhiteBlackListApplicationVisibilityPathReqBodyBuilder) Build() (*CheckWhiteBlackListApplicationVisibilityReqBody, error) {
+ req := &CheckWhiteBlackListApplicationVisibilityReqBody{}
+ if builder.userIdsFlag {
+ req.UserIds = builder.userIds
+ }
+ if builder.departmentIdsFlag {
+ req.DepartmentIds = builder.departmentIds
+ }
+ if builder.groupIdsFlag {
+ req.GroupIds = builder.groupIds
+ }
+ return req, nil
+}
+
+type CheckWhiteBlackListApplicationVisibilityReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *CheckWhiteBlackListApplicationVisibilityReqBody
+}
+
+func NewCheckWhiteBlackListApplicationVisibilityReqBuilder() *CheckWhiteBlackListApplicationVisibilityReqBuilder {
+ builder := &CheckWhiteBlackListApplicationVisibilityReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 目标应用ID
+//
+// 示例值:cli_a3a3d00b40b8d01b
+func (builder *CheckWhiteBlackListApplicationVisibilityReqBuilder) AppId(appId string) *CheckWhiteBlackListApplicationVisibilityReqBuilder {
+ builder.apiReq.PathParams.Set("app_id", fmt.Sprint(appId))
+ return builder
+}
+
+// 此次请求传参中的user_id的类型
+//
+// 示例值:user_id
+func (builder *CheckWhiteBlackListApplicationVisibilityReqBuilder) UserIdType(userIdType string) *CheckWhiteBlackListApplicationVisibilityReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 此次请求传参中的department_id的类型
+//
+// 示例值:department_id
+func (builder *CheckWhiteBlackListApplicationVisibilityReqBuilder) DepartmentIdType(departmentIdType string) *CheckWhiteBlackListApplicationVisibilityReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+//
+func (builder *CheckWhiteBlackListApplicationVisibilityReqBuilder) Body(body *CheckWhiteBlackListApplicationVisibilityReqBody) *CheckWhiteBlackListApplicationVisibilityReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *CheckWhiteBlackListApplicationVisibilityReqBuilder) Build() *CheckWhiteBlackListApplicationVisibilityReq {
+ req := &CheckWhiteBlackListApplicationVisibilityReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type CheckWhiteBlackListApplicationVisibilityReqBody struct {
+ UserIds []string `json:"user_ids,omitempty"` // 用户ID列表
+ DepartmentIds []string `json:"department_ids,omitempty"` // 部门ID列表
+ GroupIds []string `json:"group_ids,omitempty"` // 用户组ID列表
+}
+
+type CheckWhiteBlackListApplicationVisibilityReq struct {
+ apiReq *larkcore.ApiReq
+ Body *CheckWhiteBlackListApplicationVisibilityReqBody `body:""`
+}
+
+type CheckWhiteBlackListApplicationVisibilityRespData struct {
+ UserVisibilityList []*ApplicationVisibilityUserWhiteBlackInfo `json:"user_visibility_list,omitempty"` // 用户可见性信息列表
+ DepartmentVisibilityList []*ApplicationVisibilityDepartmentWhiteBlackInfo `json:"department_visibility_list,omitempty"` // 部门可见性信息列表
+ GroupVisibilityList []*ApplicationVisibilityGroupWhiteBlackInfo `json:"group_visibility_list,omitempty"` // 用户组可见性信息列表
+}
+
+type CheckWhiteBlackListApplicationVisibilityResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CheckWhiteBlackListApplicationVisibilityRespData `json:"data"` // 业务数据
+}
+
+func (resp *CheckWhiteBlackListApplicationVisibilityResp) Success() bool {
+ return resp.Code == 0
+}
+
type P2ApplicationCreatedV6Data struct {
OperatorId *UserId `json:"operator_id,omitempty"` // 用户 ID
AppId *string `json:"app_id,omitempty"` // 应用 ID
@@ -6033,6 +6678,22 @@ func (m *P2ApplicationVisibilityAddedV6) RawReq(req *larkevent.EventReq) {
m.EventReq = req
}
+type P2BotMenuV6Data struct {
+ Operator *Operator `json:"operator,omitempty"` // 用户信息
+ EventKey *string `json:"event_key,omitempty"` // 菜单事件的唯一标识
+ Timestamp *string `json:"timestamp,omitempty"` // 用户点击菜单时间
+}
+
+type P2BotMenuV6 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2BotMenuV6Data `json:"event"` // 事件内容
+}
+
+func (m *P2BotMenuV6) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
type ListAppRecommendRuleIterator struct {
nextPageToken *string
items []*AppRecommendRule
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/approval/v4/api.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/approval/v4/api.go
index 71d82398da..99060f8859 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/approval/v4/api.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/approval/v4/api.go
@@ -34,13 +34,13 @@ func NewService(config *larkcore.Config) *ApprovalService {
type ApprovalService struct {
config *larkcore.Config
- Approval *approval // 事件
+ Approval *approval // 原生审批定义
ExternalApproval *externalApproval // 三方审批定义
ExternalInstance *externalInstance // 三方审批实例
ExternalTask *externalTask // 三方审批任务
- Instance *instance // 审批查询
+ Instance *instance // 原生审批实例
InstanceComment *instanceComment // 原生审批评论
- Task *task // 审批查询
+ Task *task // 原生审批任务
}
type approval struct {
@@ -119,40 +119,6 @@ func (a *approval) Get(ctx context.Context, req *GetApprovalReq, options ...lark
return resp, err
}
-// 查询审批定义列表
-//
-// - 查询当前用户可发起的审批定义列表。
-//
-// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/approval-v4/approval/list
-//
-// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/approvalv4/list_approval.go
-func (a *approval) List(ctx context.Context, req *ListApprovalReq, options ...larkcore.RequestOptionFunc) (*ListApprovalResp, error) {
- // 发起请求
- apiReq := req.apiReq
- apiReq.ApiPath = "/open-apis/approval/v4/approvals"
- apiReq.HttpMethod = http.MethodGet
- apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}
- apiResp, err := larkcore.Request(ctx, apiReq, a.service.config, options...)
- if err != nil {
- return nil, err
- }
- // 反序列响应结果
- resp := &ListApprovalResp{ApiResp: apiResp}
- err = apiResp.JSONUnmarshalBody(resp, a.service.config)
- if err != nil {
- return nil, err
- }
- return resp, err
-}
-func (a *approval) ListByIterator(ctx context.Context, req *ListApprovalReq, options ...larkcore.RequestOptionFunc) (*ListApprovalIterator, error) {
- return &ListApprovalIterator{
- ctx: ctx,
- req: req,
- listFunc: a.List,
- options: options,
- limit: req.Limit}, nil
-}
-
// 订阅审批事件
//
// - 应用订阅 approval_code 后,该应用就可以收到该审批定义对应实例的事件通知。同一应用只需要订阅一次,无需重复订阅。;;当应用不希望再收到审批事件时,可以使用取消订阅接口进行取消,取消后将不再给应用推送消息。;;订阅和取消订阅都是应用维度的,多个应用可以同时订阅同一个 approval_code,每个应用都能收到审批事件。
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/approval/v4/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/approval/v4/model.go
index 862431b9f8..a28e14f4c3 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/approval/v4/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/approval/v4/model.go
@@ -113,6 +113,12 @@ const (
UserIdTypeCcInstanceOpenId = "open_id" // 以open_id来识别用户
)
+const (
+ TitleDisplayMethodDisplayAll = 0 // 如果都有title,展示approval 和instance的title,竖线分割。
+ TitleDisplayMethodDisplayInstanceTitle = 1 // 如果都有title,只展示instance的title
+
+)
+
const (
LocaleGetInstanceZhcn = "zh-CN" // 中文
LocaleGetInstanceEnus = "en-US" // 英文
@@ -1554,18 +1560,21 @@ func (builder *ApprovalNodeInfoBuilder) Build() *ApprovalNodeInfo {
}
type ApprovalSetting struct {
- RevertInterval *int `json:"revert_interval,omitempty"` // 审批实例通过后允许撤回的时间,以秒为单位,默认 31 天,0 为不可撤回
- RevertOption *int `json:"revert_option,omitempty"` // 是否支持审批通过第一个节点后撤回,默认为1,0为不支持
- RejectOption *int `json:"reject_option,omitempty"` // 拒绝设置
+ RevertInterval *int `json:"revert_interval,omitempty"` // 审批实例通过后允许撤回的时间,以秒为单位,默认 31 天,0 为不可撤回
+ RevertOption *int `json:"revert_option,omitempty"` // 是否支持审批通过第一个节点后撤回,默认为1,0为不支持
+ RejectOption *int `json:"reject_option,omitempty"` // 拒绝设置
+ QuickApprovalOption *int `json:"quick_approval_option,omitempty"` // 快捷审批配置项,开启后可在卡片上直接审批。默认值1为启用, 0为禁用
}
type ApprovalSettingBuilder struct {
- revertInterval int // 审批实例通过后允许撤回的时间,以秒为单位,默认 31 天,0 为不可撤回
- revertIntervalFlag bool
- revertOption int // 是否支持审批通过第一个节点后撤回,默认为1,0为不支持
- revertOptionFlag bool
- rejectOption int // 拒绝设置
- rejectOptionFlag bool
+ revertInterval int // 审批实例通过后允许撤回的时间,以秒为单位,默认 31 天,0 为不可撤回
+ revertIntervalFlag bool
+ revertOption int // 是否支持审批通过第一个节点后撤回,默认为1,0为不支持
+ revertOptionFlag bool
+ rejectOption int // 拒绝设置
+ rejectOptionFlag bool
+ quickApprovalOption int // 快捷审批配置项,开启后可在卡片上直接审批。默认值1为启用, 0为禁用
+ quickApprovalOptionFlag bool
}
func NewApprovalSettingBuilder() *ApprovalSettingBuilder {
@@ -1600,6 +1609,15 @@ func (builder *ApprovalSettingBuilder) RejectOption(rejectOption int) *ApprovalS
return builder
}
+// 快捷审批配置项,开启后可在卡片上直接审批。默认值1为启用, 0为禁用
+//
+// 示例值:1
+func (builder *ApprovalSettingBuilder) QuickApprovalOption(quickApprovalOption int) *ApprovalSettingBuilder {
+ builder.quickApprovalOption = quickApprovalOption
+ builder.quickApprovalOptionFlag = true
+ return builder
+}
+
func (builder *ApprovalSettingBuilder) Build() *ApprovalSetting {
req := &ApprovalSetting{}
if builder.revertIntervalFlag {
@@ -1613,6 +1631,10 @@ func (builder *ApprovalSettingBuilder) Build() *ApprovalSetting {
if builder.rejectOptionFlag {
req.RejectOption = &builder.rejectOption
+ }
+ if builder.quickApprovalOptionFlag {
+ req.QuickApprovalOption = &builder.quickApprovalOption
+
}
return req
}
@@ -2869,6 +2891,165 @@ func (builder *CommentRequestBuilder) Build() *CommentRequest {
return req
}
+type ConnectorLog struct {
+ LogData []*ConnectorLogData `json:"log_data,omitempty"` // 日志数据
+}
+
+type ConnectorLogBuilder struct {
+ logData []*ConnectorLogData // 日志数据
+ logDataFlag bool
+}
+
+func NewConnectorLogBuilder() *ConnectorLogBuilder {
+ builder := &ConnectorLogBuilder{}
+ return builder
+}
+
+// 日志数据
+//
+// 示例值:
+func (builder *ConnectorLogBuilder) LogData(logData []*ConnectorLogData) *ConnectorLogBuilder {
+ builder.logData = logData
+ builder.logDataFlag = true
+ return builder
+}
+
+func (builder *ConnectorLogBuilder) Build() *ConnectorLog {
+ req := &ConnectorLog{}
+ if builder.logDataFlag {
+ req.LogData = builder.logData
+ }
+ return req
+}
+
+type ConnectorLogData struct {
+ DateTime *string `json:"date_time,omitempty"` // 时间
+ Data *string `json:"data,omitempty"` // 数据(脱敏)
+ Level *string `json:"level,omitempty"` // 数据等级
+ Pod *string `json:"pod,omitempty"` // 机器名称
+ Location *string `json:"location,omitempty"` // 打印位置(脱敏)
+ Type *string `json:"type,omitempty"` // 数据类型
+ Version *string `json:"version,omitempty"` // 版本号
+}
+
+type ConnectorLogDataBuilder struct {
+ dateTime string // 时间
+ dateTimeFlag bool
+ data string // 数据(脱敏)
+ dataFlag bool
+ level string // 数据等级
+ levelFlag bool
+ pod string // 机器名称
+ podFlag bool
+ location string // 打印位置(脱敏)
+ locationFlag bool
+ type_ string // 数据类型
+ typeFlag bool
+ version string // 版本号
+ versionFlag bool
+}
+
+func NewConnectorLogDataBuilder() *ConnectorLogDataBuilder {
+ builder := &ConnectorLogDataBuilder{}
+ return builder
+}
+
+// 时间
+//
+// 示例值:2023-03-23 10:05:11
+func (builder *ConnectorLogDataBuilder) DateTime(dateTime string) *ConnectorLogDataBuilder {
+ builder.dateTime = dateTime
+ builder.dateTimeFlag = true
+ return builder
+}
+
+// 数据(脱敏)
+//
+// 示例值:cwyFtNZSO7wKZ2Bi+WHJVbb6uZ3G2hlsje
+func (builder *ConnectorLogDataBuilder) Data(data string) *ConnectorLogDataBuilder {
+ builder.data = data
+ builder.dataFlag = true
+ return builder
+}
+
+// 数据等级
+//
+// 示例值:INFO
+func (builder *ConnectorLogDataBuilder) Level(level string) *ConnectorLogDataBuilder {
+ builder.level = level
+ builder.levelFlag = true
+ return builder
+}
+
+// 机器名称
+//
+// 示例值:C02GD65CMD6R
+func (builder *ConnectorLogDataBuilder) Pod(pod string) *ConnectorLogDataBuilder {
+ builder.pod = pod
+ builder.podFlag = true
+ return builder
+}
+
+// 打印位置(脱敏)
+//
+// 示例值:K+GFMIO+2aTIX8yXkPLK2hoEPof4
+func (builder *ConnectorLogDataBuilder) Location(location string) *ConnectorLogDataBuilder {
+ builder.location = location
+ builder.locationFlag = true
+ return builder
+}
+
+// 数据类型
+//
+// 示例值:MONITOR
+func (builder *ConnectorLogDataBuilder) Type(type_ string) *ConnectorLogDataBuilder {
+ builder.type_ = type_
+ builder.typeFlag = true
+ return builder
+}
+
+// 版本号
+//
+// 示例值:2.0.1
+func (builder *ConnectorLogDataBuilder) Version(version string) *ConnectorLogDataBuilder {
+ builder.version = version
+ builder.versionFlag = true
+ return builder
+}
+
+func (builder *ConnectorLogDataBuilder) Build() *ConnectorLogData {
+ req := &ConnectorLogData{}
+ if builder.dateTimeFlag {
+ req.DateTime = &builder.dateTime
+
+ }
+ if builder.dataFlag {
+ req.Data = &builder.data
+
+ }
+ if builder.levelFlag {
+ req.Level = &builder.level
+
+ }
+ if builder.podFlag {
+ req.Pod = &builder.pod
+
+ }
+ if builder.locationFlag {
+ req.Location = &builder.location
+
+ }
+ if builder.typeFlag {
+ req.Type = &builder.type_
+
+ }
+ if builder.versionFlag {
+ req.Version = &builder.version
+
+ }
+ return req
+}
+
type Count struct {
Total *int `json:"total,omitempty"` // 总数,大于等于 1000 个项目时将返回 999
HasMore *bool `json:"has_more,omitempty"` // 还有更多,当大于等于 1000 时将返回 true
@@ -2918,15 +3099,36 @@ func (builder *CountBuilder) Build() *Count {
}
type Definition struct {
- ApprovalCode *string `json:"approval_code,omitempty"` // 审批定义 code 示例值:"7C468A54-8745-2245-9675-08B7C63E7A85"
- ApprovalName *string `json:"approval_name,omitempty"` // 审批名称,根据传入的local字段返回对应的国际化文案,未设置该国际化文案时返回默认语言对应文案
+ ApprovalCode *string `json:"approval_code,omitempty"` // 审批定义 code 示例值:"7C468A54-8745-2245-9675-08B7C63E7A85"
+ ApprovalName *string `json:"approval_name,omitempty"` // 审批名称,根据传入的local字段返回对应的国际化文案,未设置该国际化文案时返回默认语言对应文案
+ GroupName *string `json:"group_name,omitempty"` // 分组名称,值的格式是 i18n key,文案放在 i18n_resource
+ Description *string `json:"description,omitempty"` // 审批定义的说明,值的格式是 i18n key,文案放在 i18n_resource; 审批发起页 审批定义的说明内容来自该字段
+ IconUrl *string `json:"icon_url,omitempty"` // 审批图标链接
+ GroupCode *string `json:"group_code,omitempty"` // 审批定义所属审批分组
+ IsExternal *bool `json:"is_external,omitempty"` // 是否为第三方审批
+ CreateLinkPc *string `json:"create_link_pc,omitempty"` // PC端发起页链接
+ CreateLinkMobile *string `json:"create_link_mobile,omitempty"` // 移动端发起页链接
}
type DefinitionBuilder struct {
- approvalCode string // 审批定义 code 示例值:"7C468A54-8745-2245-9675-08B7C63E7A85"
- approvalCodeFlag bool
- approvalName string // 审批名称,根据传入的local字段返回对应的国际化文案,未设置该国际化文案时返回默认语言对应文案
- approvalNameFlag bool
+ approvalCode string // 审批定义 code 示例值:"7C468A54-8745-2245-9675-08B7C63E7A85"
+ approvalCodeFlag bool
+ approvalName string // 审批名称,根据传入的local字段返回对应的国际化文案,未设置该国际化文案时返回默认语言对应文案
+ approvalNameFlag bool
+ groupName string // 分组名称,值的格式是 i18n key,文案放在 i18n_resource
+ groupNameFlag bool
+ description string // 审批定义的说明,值的格式是 i18n key,文案放在 i18n_resource; 审批发起页 审批定义的说明内容来自该字段
+ descriptionFlag bool
+ iconUrl string // 审批图标链接
+ iconUrlFlag bool
+ groupCode string // 审批定义所属审批分组
+ groupCodeFlag bool
+ isExternal bool // 是否为第三方审批
+ isExternalFlag bool
+ createLinkPc string // PC端发起页链接
+ createLinkPcFlag bool
+ createLinkMobile string // 移动端发起页链接
+ createLinkMobileFlag bool
}
func NewDefinitionBuilder() *DefinitionBuilder {
@@ -2952,6 +3154,69 @@ func (builder *DefinitionBuilder) ApprovalName(approvalName string) *DefinitionB
return builder
}
+// 分组名称,值的格式是 i18n key,文案放在 i18n_resource
+//
+// 示例值:分组名称
+func (builder *DefinitionBuilder) GroupName(groupName string) *DefinitionBuilder {
+ builder.groupName = groupName
+ builder.groupNameFlag = true
+ return builder
+}
+
+// 审批定义的说明,值的格式是 i18n key,文案放在 i18n_resource; 审批发起页 审批定义的说明内容来自该字段
+//
+// 示例值:审批定义说明
+func (builder *DefinitionBuilder) Description(description string) *DefinitionBuilder {
+ builder.description = description
+ builder.descriptionFlag = true
+ return builder
+}
+
+// 审批图标链接
+//
+// 示例值:https://lf3-ea.bytetos.com/obj/goofy/ee/approval/approval-admin/image/iconLib/v3/person.png
+func (builder *DefinitionBuilder) IconUrl(iconUrl string) *DefinitionBuilder {
+ builder.iconUrl = iconUrl
+ builder.iconUrlFlag = true
+ return builder
+}
+
+// 审批定义所属审批分组
+//
+// 示例值:work_group
+func (builder *DefinitionBuilder) GroupCode(groupCode string) *DefinitionBuilder {
+ builder.groupCode = groupCode
+ builder.groupCodeFlag = true
+ return builder
+}
+
+// 是否为第三方审批
+//
+// 示例值:false
+func (builder *DefinitionBuilder) IsExternal(isExternal bool) *DefinitionBuilder {
+ builder.isExternal = isExternal
+ builder.isExternalFlag = true
+ return builder
+}
+
+// PC端发起页链接
+//
+// 示例值:https://applink.feishu.cn/client/mini_program/open?mode=appCenter&appId=cli_9c90fc38e07a9101&path=pc/pages/create-form/index?id=9999
+func (builder *DefinitionBuilder) CreateLinkPc(createLinkPc string) *DefinitionBuilder {
+ builder.createLinkPc = createLinkPc
+ builder.createLinkPcFlag = true
+ return builder
+}
+
+// 移动端发起页链接
+//
+// 示例值:https://applink.feishu.cn/client/mini_program/open?appId=cli_9c90fc38e07a9101&path=pages/approval-form/index?id=9999
+func (builder *DefinitionBuilder) CreateLinkMobile(createLinkMobile string) *DefinitionBuilder {
+ builder.createLinkMobile = createLinkMobile
+ builder.createLinkMobileFlag = true
+ return builder
+}
+
func (builder *DefinitionBuilder) Build() *Definition {
req := &Definition{}
if builder.approvalCodeFlag {
@@ -2961,6 +3226,34 @@ func (builder *DefinitionBuilder) Build() *Definition {
if builder.approvalNameFlag {
req.ApprovalName = &builder.approvalName
+ }
+ if builder.groupNameFlag {
+ req.GroupName = &builder.groupName
+
+ }
+ if builder.descriptionFlag {
+ req.Description = &builder.description
+
+ }
+ if builder.iconUrlFlag {
+ req.IconUrl = &builder.iconUrl
+
+ }
+ if builder.groupCodeFlag {
+ req.GroupCode = &builder.groupCode
+
+ }
+ if builder.isExternalFlag {
+ req.IsExternal = &builder.isExternal
+
+ }
+ if builder.createLinkPcFlag {
+ req.CreateLinkPc = &builder.createLinkPc
+
+ }
+ if builder.createLinkMobileFlag {
+ req.CreateLinkMobile = &builder.createLinkMobile
+
}
return req
}
@@ -3248,78 +3541,81 @@ func (builder *ExternalApprovalBuilder) Build() *ExternalApproval {
}
type ExternalInstance struct {
- ApprovalCode *string `json:"approval_code,omitempty"` // 审批定义 code, 创建审批定义返回的值,表示该实例属于哪个流程;该字段会影响到列表中该实例的标题,标题取自对应定义的 name 字段
- Status *string `json:"status,omitempty"` // 审批实例状态
- Extra *string `json:"extra,omitempty"` // 审批实例扩展 JSON
- InstanceId *string `json:"instance_id,omitempty"` // 审批实例唯一标识,用户自定义,需确保证租户下唯一
- Links *ExternalInstanceLink `json:"links,omitempty"` // 审批实例链接集合 ,用于【已发起】列表的跳转,跳转回三方系统; pc_link 和 mobile_link 必须填一个,填写的是哪一端的链接,即会跳转到该链接,不受平台影响
- Title *string `json:"title,omitempty"` // 审批展示名称,如果填写了该字段,则审批列表中的审批名称使用该字段,如果不填该字段,则审批名称使用审批定义的名称
- Form []*ExternalInstanceForm `json:"form,omitempty"` // 用户提交审批时填写的表单数据,用于所有审批列表中展示。可传多个值,但审批中心pc展示前2个,移动端展示前3个,长度不超过2048字符
- UserId *string `json:"user_id,omitempty"` // 审批发起人 user_id,发起人可在【已发起】列表中看到所有已发起的审批; 在【待审批】,【已审批】【抄送我】列表中,该字段展示审批是谁发起的。审批发起人 open id,和 user id 二者至少填一个。
- UserName *string `json:"user_name,omitempty"` // 审批发起人 用户名,如果发起人不是真实的用户(例如是某个部门),没有 user_id,则可以使用该字段传名称
- OpenId *string `json:"open_id,omitempty"` // 审批发起人 open id,和 user id 二者至少填一个
- DepartmentId *string `json:"department_id,omitempty"` // 发起人部门,用于列表中展示发起人所属部门。不传则不展示。如果用户没加入任何部门,传 "",将展示租户名称传 department_name 展示部门名称
- DepartmentName *string `json:"department_name,omitempty"` // 审批发起人 部门,如果发起人不是真实的用户(例如是某个部门),没有 department_id,则可以使用该字段传名称
- StartTime *string `json:"start_time,omitempty"` // 审批发起时间,Unix毫秒时间戳
- EndTime *string `json:"end_time,omitempty"` // 审批实例结束时间:未结束的审批为 0,Unix毫秒时间戳
- UpdateTime *string `json:"update_time,omitempty"` // 审批实例最近更新时间;用于推送数据版本控制如果 update_mode 值为 UPDATE,则只有传过来的 update_time 有变化时(变大),才会更新审批中心中的审批实例信息。使用该字段主要用来避免并发时老的数据更新了新的数据
- DisplayMethod *string `json:"display_method,omitempty"` // 列表页打开审批实例的方式
- UpdateMode *string `json:"update_mode,omitempty"` // 更新方式, 当 update_mode=REPLACE时,每次都以当前推送的数据为最终数据,会删掉审批中心中多余的任务、抄送数据(不在这次推送的数据中); 当 update_mode=UPDATE时,则不会删除审批中心的数据,而只是进行新增和更新实例、任务数据
- TaskList []*ExternalInstanceTaskNode `json:"task_list,omitempty"` // 任务列表
- CcList []*CcNode `json:"cc_list,omitempty"` // 抄送列表
- I18nResources []*I18nResource `json:"i18n_resources,omitempty"` // 国际化文案
- TrusteeshipUrlToken *string `json:"trusteeship_url_token,omitempty"` // 单据托管认证token,托管回调会附带此token,帮助业务方认证
- TrusteeshipUserIdType *string `json:"trusteeship_user_id_type,omitempty"` // 用户的类型,会影响请求参数用户标识域的选择,包括加签操作回传的目标用户, 目前仅支持 "user_id"
- TrusteeshipUrls *TrusteeshipUrls `json:"trusteeship_urls,omitempty"` // 单据托管回调接入方的接口的URL地址
+ ApprovalCode *string `json:"approval_code,omitempty"` // 审批定义 code, 创建审批定义返回的值,表示该实例属于哪个流程;该字段会影响到列表中该实例的标题,标题取自对应定义的 name 字段
+ Status *string `json:"status,omitempty"` // 审批实例状态
+ Extra *string `json:"extra,omitempty"` // 审批实例扩展 JSON
+ InstanceId *string `json:"instance_id,omitempty"` // 审批实例唯一标识,用户自定义,需确保证租户下唯一
+ Links *ExternalInstanceLink `json:"links,omitempty"` // 审批实例链接集合 ,用于【已发起】列表的跳转,跳转回三方系统; pc_link 和 mobile_link 必须填一个,填写的是哪一端的链接,即会跳转到该链接,不受平台影响
+ Title *string `json:"title,omitempty"` // 审批展示名称,如果填写了该字段,则审批列表中的审批名称使用该字段,如果不填该字段,则审批名称使用审批定义的名称
+ Form []*ExternalInstanceForm `json:"form,omitempty"` // 用户提交审批时填写的表单数据,用于所有审批列表中展示。可传多个值,但审批中心pc展示前2个,移动端展示前3个,长度不超过2048字符
+ UserId *string `json:"user_id,omitempty"` // 审批发起人 user_id,发起人可在【已发起】列表中看到所有已发起的审批; 在【待审批】,【已审批】【抄送我】列表中,该字段展示审批是谁发起的。审批发起人 open id,和 user id 二者至少填一个。
+ UserName *string `json:"user_name,omitempty"` // 审批发起人 用户名,如果发起人不是真实的用户(例如是某个部门),没有 user_id,则可以使用该字段传名称
+ OpenId *string `json:"open_id,omitempty"` // 审批发起人 open id,和 user id 二者至少填一个
+ DepartmentId *string `json:"department_id,omitempty"` // 发起人部门,用于列表中展示发起人所属部门。不传则不展示。如果用户没加入任何部门,传 "",将展示租户名称传 department_name 展示部门名称
+ DepartmentName *string `json:"department_name,omitempty"` // 审批发起人 部门,如果发起人不是真实的用户(例如是某个部门),没有 department_id,则可以使用该字段传名称
+ StartTime *string `json:"start_time,omitempty"` // 审批发起时间,Unix毫秒时间戳
+ EndTime *string `json:"end_time,omitempty"` // 审批实例结束时间:未结束的审批为 0,Unix毫秒时间戳
+ UpdateTime *string `json:"update_time,omitempty"` // 审批实例最近更新时间;用于推送数据版本控制如果 update_mode 值为 UPDATE,则只有传过来的 update_time 有变化时(变大),才会更新审批中心中的审批实例信息。使用该字段主要用来避免并发时老的数据更新了新的数据
+ DisplayMethod *string `json:"display_method,omitempty"` // 列表页打开审批实例的方式
+ UpdateMode *string `json:"update_mode,omitempty"` // 更新方式, 当 update_mode=REPLACE时,每次都以当前推送的数据为最终数据,会删掉审批中心中多余的任务、抄送数据(不在这次推送的数据中); 当 update_mode=UPDATE时,则不会删除审批中心的数据,而只是进行新增和更新实例、任务数据
+ TaskList []*ExternalInstanceTaskNode `json:"task_list,omitempty"` // 任务列表
+ CcList []*CcNode `json:"cc_list,omitempty"` // 抄送列表
+ I18nResources []*I18nResource `json:"i18n_resources,omitempty"` // 国际化文案
+ TrusteeshipUrlToken *string `json:"trusteeship_url_token,omitempty"` // 单据托管认证token,托管回调会附带此token,帮助业务方认证
+ TrusteeshipUserIdType *string `json:"trusteeship_user_id_type,omitempty"` // 用户的类型,会影响请求参数用户标识域的选择,包括加签操作回传的目标用户, 目前仅支持 "user_id"
+ TrusteeshipUrls *TrusteeshipUrls `json:"trusteeship_urls,omitempty"` // 单据托管回调接入方的接口的URL地址
+ TrusteeshipCacheConfig *TrusteeshipInstanceCacheConfig `json:"trusteeship_cache_config,omitempty"` // 托管预缓存策略
}
type ExternalInstanceBuilder struct {
- approvalCode string // 审批定义 code, 创建审批定义返回的值,表示该实例属于哪个流程;该字段会影响到列表中该实例的标题,标题取自对应定义的 name 字段
- approvalCodeFlag bool
- status string // 审批实例状态
- statusFlag bool
- extra string // 审批实例扩展 JSON
- extraFlag bool
- instanceId string // 审批实例唯一标识,用户自定义,需确保证租户下唯一
- instanceIdFlag bool
- links *ExternalInstanceLink // 审批实例链接集合 ,用于【已发起】列表的跳转,跳转回三方系统; pc_link 和 mobile_link 必须填一个,填写的是哪一端的链接,即会跳转到该链接,不受平台影响
- linksFlag bool
- title string // 审批展示名称,如果填写了该字段,则审批列表中的审批名称使用该字段,如果不填该字段,则审批名称使用审批定义的名称
- titleFlag bool
- form []*ExternalInstanceForm // 用户提交审批时填写的表单数据,用于所有审批列表中展示。可传多个值,但审批中心pc展示前2个,移动端展示前3个,长度不超过2048字符
- formFlag bool
- userId string // 审批发起人 user_id,发起人可在【已发起】列表中看到所有已发起的审批; 在【待审批】,【已审批】【抄送我】列表中,该字段展示审批是谁发起的。审批发起人 open id,和 user id 二者至少填一个。
- userIdFlag bool
- userName string // 审批发起人 用户名,如果发起人不是真实的用户(例如是某个部门),没有 user_id,则可以使用该字段传名称
- userNameFlag bool
- openId string // 审批发起人 open id,和 user id 二者至少填一个
- openIdFlag bool
- departmentId string // 发起人部门,用于列表中展示发起人所属部门。不传则不展示。如果用户没加入任何部门,传 "",将展示租户名称传 department_name 展示部门名称
- departmentIdFlag bool
- departmentName string // 审批发起人 部门,如果发起人不是真实的用户(例如是某个部门),没有 department_id,则可以使用该字段传名称
- departmentNameFlag bool
- startTime string // 审批发起时间,Unix毫秒时间戳
- startTimeFlag bool
- endTime string // 审批实例结束时间:未结束的审批为 0,Unix毫秒时间戳
- endTimeFlag bool
- updateTime string // 审批实例最近更新时间;用于推送数据版本控制如果 update_mode 值为 UPDATE,则只有传过来的 update_time 有变化时(变大),才会更新审批中心中的审批实例信息。使用该字段主要用来避免并发时老的数据更新了新的数据
- updateTimeFlag bool
- displayMethod string // 列表页打开审批实例的方式
- displayMethodFlag bool
- updateMode string // 更新方式, 当 update_mode=REPLACE时,每次都以当前推送的数据为最终数据,会删掉审批中心中多余的任务、抄送数据(不在这次推送的数据中); 当 update_mode=UPDATE时,则不会删除审批中心的数据,而只是进行新增和更新实例、任务数据
- updateModeFlag bool
- taskList []*ExternalInstanceTaskNode // 任务列表
- taskListFlag bool
- ccList []*CcNode // 抄送列表
- ccListFlag bool
- i18nResources []*I18nResource // 国际化文案
- i18nResourcesFlag bool
- trusteeshipUrlToken string // 单据托管认证token,托管回调会附带此token,帮助业务方认证
- trusteeshipUrlTokenFlag bool
- trusteeshipUserIdType string // 用户的类型,会影响请求参数用户标识域的选择,包括加签操作回传的目标用户, 目前仅支持 "user_id"
- trusteeshipUserIdTypeFlag bool
- trusteeshipUrls *TrusteeshipUrls // 单据托管回调接入方的接口的URL地址
- trusteeshipUrlsFlag bool
+ approvalCode string // 审批定义 code, 创建审批定义返回的值,表示该实例属于哪个流程;该字段会影响到列表中该实例的标题,标题取自对应定义的 name 字段
+ approvalCodeFlag bool
+ status string // 审批实例状态
+ statusFlag bool
+ extra string // 审批实例扩展 JSON
+ extraFlag bool
+ instanceId string // 审批实例唯一标识,用户自定义,需确保证租户下唯一
+ instanceIdFlag bool
+ links *ExternalInstanceLink // 审批实例链接集合 ,用于【已发起】列表的跳转,跳转回三方系统; pc_link 和 mobile_link 必须填一个,填写的是哪一端的链接,即会跳转到该链接,不受平台影响
+ linksFlag bool
+ title string // 审批展示名称,如果填写了该字段,则审批列表中的审批名称使用该字段,如果不填该字段,则审批名称使用审批定义的名称
+ titleFlag bool
+ form []*ExternalInstanceForm // 用户提交审批时填写的表单数据,用于所有审批列表中展示。可传多个值,但审批中心pc展示前2个,移动端展示前3个,长度不超过2048字符
+ formFlag bool
+ userId string // 审批发起人 user_id,发起人可在【已发起】列表中看到所有已发起的审批; 在【待审批】,【已审批】【抄送我】列表中,该字段展示审批是谁发起的。审批发起人 open id,和 user id 二者至少填一个。
+ userIdFlag bool
+ userName string // 审批发起人 用户名,如果发起人不是真实的用户(例如是某个部门),没有 user_id,则可以使用该字段传名称
+ userNameFlag bool
+ openId string // 审批发起人 open id,和 user id 二者至少填一个
+ openIdFlag bool
+ departmentId string // 发起人部门,用于列表中展示发起人所属部门。不传则不展示。如果用户没加入任何部门,传 "",将展示租户名称传 department_name 展示部门名称
+ departmentIdFlag bool
+ departmentName string // 审批发起人 部门,如果发起人不是真实的用户(例如是某个部门),没有 department_id,则可以使用该字段传名称
+ departmentNameFlag bool
+ startTime string // 审批发起时间,Unix毫秒时间戳
+ startTimeFlag bool
+ endTime string // 审批实例结束时间:未结束的审批为 0,Unix毫秒时间戳
+ endTimeFlag bool
+ updateTime string // 审批实例最近更新时间;用于推送数据版本控制如果 update_mode 值为 UPDATE,则只有传过来的 update_time 有变化时(变大),才会更新审批中心中的审批实例信息。使用该字段主要用来避免并发时老的数据更新了新的数据
+ updateTimeFlag bool
+ displayMethod string // 列表页打开审批实例的方式
+ displayMethodFlag bool
+ updateMode string // 更新方式, 当 update_mode=REPLACE时,每次都以当前推送的数据为最终数据,会删掉审批中心中多余的任务、抄送数据(不在这次推送的数据中); 当 update_mode=UPDATE时,则不会删除审批中心的数据,而只是进行新增和更新实例、任务数据
+ updateModeFlag bool
+ taskList []*ExternalInstanceTaskNode // 任务列表
+ taskListFlag bool
+ ccList []*CcNode // 抄送列表
+ ccListFlag bool
+ i18nResources []*I18nResource // 国际化文案
+ i18nResourcesFlag bool
+ trusteeshipUrlToken string // 单据托管认证token,托管回调会附带此token,帮助业务方认证
+ trusteeshipUrlTokenFlag bool
+ trusteeshipUserIdType string // 用户的类型,会影响请求参数用户标识域的选择,包括加签操作回传的目标用户, 目前仅支持 "user_id"
+ trusteeshipUserIdTypeFlag bool
+ trusteeshipUrls *TrusteeshipUrls // 单据托管回调接入方的接口的URL地址
+ trusteeshipUrlsFlag bool
+ trusteeshipCacheConfig *TrusteeshipInstanceCacheConfig // 托管预缓存策略
+ trusteeshipCacheConfigFlag bool
}
func NewExternalInstanceBuilder() *ExternalInstanceBuilder {
@@ -3534,6 +3830,15 @@ func (builder *ExternalInstanceBuilder) TrusteeshipUrls(trusteeshipUrls *Trustee
return builder
}
+// 托管预缓存策略
+//
+// 示例值:
+func (builder *ExternalInstanceBuilder) TrusteeshipCacheConfig(trusteeshipCacheConfig *TrusteeshipInstanceCacheConfig) *ExternalInstanceBuilder {
+ builder.trusteeshipCacheConfig = trusteeshipCacheConfig
+ builder.trusteeshipCacheConfigFlag = true
+ return builder
+}
+
func (builder *ExternalInstanceBuilder) Build() *ExternalInstance {
req := &ExternalInstance{}
if builder.approvalCodeFlag {
@@ -3622,6 +3927,9 @@ func (builder *ExternalInstanceBuilder) Build() *ExternalInstance {
if builder.trusteeshipUrlsFlag {
req.TrusteeshipUrls = builder.trusteeshipUrls
}
+ if builder.trusteeshipCacheConfigFlag {
+ req.TrusteeshipCacheConfig = builder.trusteeshipCacheConfig
+ }
return req
}
@@ -4961,6 +5269,8 @@ type InstanceCreate struct {
CancelBotNotification *string `json:"cancel_bot_notification,omitempty"` // 配置bot是否取消通知结果
ForbidRevoke *bool `json:"forbid_revoke,omitempty"` // 配置是否可以禁止撤销
I18nResources []*I18nResource `json:"i18n_resources,omitempty"` // 国际化文案
+ Title *string `json:"title,omitempty"` // 审批展示名称,如果填写了该字段,则审批列表中的审批名称使用该字段,如果不填该字段,则审批名称使用审批定义的名称
+ TitleDisplayMethod *int `json:"title_display_method,omitempty"` // 详情页title展示模式
}
type InstanceCreateBuilder struct {
@@ -4994,6 +5304,10 @@ type InstanceCreateBuilder struct {
forbidRevokeFlag bool
i18nResources []*I18nResource // 国际化文案
i18nResourcesFlag bool
+ title string // 审批展示名称,如果填写了该字段,则审批列表中的审批名称使用该字段,如果不填该字段,则审批名称使用审批定义的名称
+ titleFlag bool
+ titleDisplayMethod int // 详情页title展示模式
+ titleDisplayMethodFlag bool
}
func NewInstanceCreateBuilder() *InstanceCreateBuilder {
@@ -5136,6 +5450,24 @@ func (builder *InstanceCreateBuilder) I18nResources(i18nResources []*I18nResourc
return builder
}
+// 审批展示名称,如果填写了该字段,则审批列表中的审批名称使用该字段,如果不填该字段,则审批名称使用审批定义的名称
+//
+// 示例值:@i18n@1
+func (builder *InstanceCreateBuilder) Title(title string) *InstanceCreateBuilder {
+ builder.title = title
+ builder.titleFlag = true
+ return builder
+}
+
+// 详情页title展示模式
+//
+// 示例值:0
+func (builder *InstanceCreateBuilder) TitleDisplayMethod(titleDisplayMethod int) *InstanceCreateBuilder {
+ builder.titleDisplayMethod = titleDisplayMethod
+ builder.titleDisplayMethodFlag = true
+ return builder
+}
+
func (builder *InstanceCreateBuilder) Build() *InstanceCreate {
req := &InstanceCreate{}
if builder.approvalCodeFlag {
@@ -5193,6 +5525,14 @@ func (builder *InstanceCreateBuilder) Build() *InstanceCreate {
if builder.i18nResourcesFlag {
req.I18nResources = builder.i18nResources
}
+ if builder.titleFlag {
+ req.Title = &builder.title
+
+ }
+ if builder.titleDisplayMethodFlag {
+ req.TitleDisplayMethod = &builder.titleDisplayMethod
+
+ }
return req
}
@@ -9099,6 +9439,70 @@ func (builder *TripGroupScheduleBuilder) Build() *TripGroupSchedule {
return req
}
+type TrusteeshipInstanceCacheConfig struct {
+ FormPolicy *string `json:"form_policy,omitempty"` // 托管预缓存策略
+ FormVaryWithLocale *bool `json:"form_vary_with_locale,omitempty"` // 表单是否随国际化改变
+ FormVersion *string `json:"form_version,omitempty"` // 当前使用的表单版本号,保证表单改变后,版本号增加,实际值为int64整数
+}
+
+type TrusteeshipInstanceCacheConfigBuilder struct {
+ formPolicy string // 托管预缓存策略
+ formPolicyFlag bool
+ formVaryWithLocale bool // 表单是否随国际化改变
+ formVaryWithLocaleFlag bool
+ formVersion string // 当前使用的表单版本号,保证表单改变后,版本号增加,实际值为int64整数
+ formVersionFlag bool
+}
+
+func NewTrusteeshipInstanceCacheConfigBuilder() *TrusteeshipInstanceCacheConfigBuilder {
+ builder := &TrusteeshipInstanceCacheConfigBuilder{}
+ return builder
+}
+
+// 托管预缓存策略
+//
+// 示例值:DISABLE
+func (builder *TrusteeshipInstanceCacheConfigBuilder) FormPolicy(formPolicy string) *TrusteeshipInstanceCacheConfigBuilder {
+ builder.formPolicy = formPolicy
+ builder.formPolicyFlag = true
+ return builder
+}
+
+// 表单是否随国际化改变
+//
+// 示例值:false
+func (builder *TrusteeshipInstanceCacheConfigBuilder) FormVaryWithLocale(formVaryWithLocale bool) *TrusteeshipInstanceCacheConfigBuilder {
+ builder.formVaryWithLocale = formVaryWithLocale
+ builder.formVaryWithLocaleFlag = true
+ return builder
+}
+
+// 当前使用的表单版本号,保证表单改变后,版本号增加,实际值为int64整数
+//
+// 示例值:"1"
+func (builder *TrusteeshipInstanceCacheConfigBuilder) FormVersion(formVersion string) *TrusteeshipInstanceCacheConfigBuilder {
+ builder.formVersion = formVersion
+ builder.formVersionFlag = true
+ return builder
+}
+
+func (builder *TrusteeshipInstanceCacheConfigBuilder) Build() *TrusteeshipInstanceCacheConfig {
+ req := &TrusteeshipInstanceCacheConfig{}
+ if builder.formPolicyFlag {
+ req.FormPolicy = &builder.formPolicy
+
+ }
+ if builder.formVaryWithLocaleFlag {
+ req.FormVaryWithLocale = &builder.formVaryWithLocale
+
+ }
+ if builder.formVersionFlag {
+ req.FormVersion = &builder.formVersion
+
+ }
+ return req
+}
+
type TrusteeshipUrls struct {
FormDetailUrl *string `json:"form_detail_url,omitempty"` // 获取表单schema相关数据的url地址
ActionDefinitionUrl *string `json:"action_definition_url,omitempty"` // 表示获取审批操作区数据的url地址
@@ -9526,80 +9930,6 @@ func (resp *GetApprovalResp) Success() bool {
return resp.Code == 0
}
-type ListApprovalReqBuilder struct {
- apiReq *larkcore.ApiReq
- limit int // 最大返回多少记录,当使用迭代器访问时才有效
-}
-
-func NewListApprovalReqBuilder() *ListApprovalReqBuilder {
- builder := &ListApprovalReqBuilder{}
- builder.apiReq = &larkcore.ApiReq{
- PathParams: larkcore.PathParams{},
- QueryParams: larkcore.QueryParams{},
- }
- return builder
-}
-
-// 最大返回多少记录,当使用迭代器访问时才有效
-func (builder *ListApprovalReqBuilder) Limit(limit int) *ListApprovalReqBuilder {
- builder.limit = limit
- return builder
-}
-
-// 分页大小
-//
-// 示例值:10
-func (builder *ListApprovalReqBuilder) PageSize(pageSize int) *ListApprovalReqBuilder {
- builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
- return builder
-}
-
-// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果
-//
-// 示例值:ASDJHA1323_sda1JSASDFD
-func (builder *ListApprovalReqBuilder) PageToken(pageToken string) *ListApprovalReqBuilder {
- builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
- return builder
-}
-
-// - zh-CN:中文 ;- en-US:英文 ;- ja-JP:日文
-//
-// 示例值:zh-CN
-func (builder *ListApprovalReqBuilder) Locale(locale string) *ListApprovalReqBuilder {
- builder.apiReq.QueryParams.Set("locale", fmt.Sprint(locale))
- return builder
-}
-
-func (builder *ListApprovalReqBuilder) Build() *ListApprovalReq {
- req := &ListApprovalReq{}
- req.apiReq = &larkcore.ApiReq{}
- req.Limit = builder.limit
- req.apiReq.QueryParams = builder.apiReq.QueryParams
- return req
-}
-
-type ListApprovalReq struct {
- apiReq *larkcore.ApiReq
- Limit int // 最多返回多少记录,只有在使用迭代器访问时,才有效
-
-}
-
-type ListApprovalRespData struct {
- Items []*Definition `json:"items,omitempty"` // 审批定义列表
- PageToken *string `json:"page_token,omitempty"` // 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 page_token
- HasMore *bool `json:"has_more,omitempty"` // 是否还有更多项
-}
-
-type ListApprovalResp struct {
- *larkcore.ApiResp `json:"-"`
- larkcore.CodeError
- Data *ListApprovalRespData `json:"data"` // 业务数据
-}
-
-func (resp *ListApprovalResp) Success() bool {
- return resp.Code == 0
-}
-
type SubscribeApprovalReqBuilder struct {
apiReq *larkcore.ApiReq
}
@@ -11888,7 +12218,7 @@ func (resp *TransferTaskResp) Success() bool {
}
type P2ApprovalUpdatedV4Data struct {
- Object *ApprovalEvent `json:"object,omitempty"` //
+ Object *ApprovalEvent `json:"object,omitempty"` // 事件详情数据
}
type P2ApprovalUpdatedV4 struct {
@@ -11901,60 +12231,6 @@ func (m *P2ApprovalUpdatedV4) RawReq(req *larkevent.EventReq) {
m.EventReq = req
}
-type ListApprovalIterator struct {
- nextPageToken *string
- items []*Definition
- index int
- limit int
- ctx context.Context
- req *ListApprovalReq
- listFunc func(ctx context.Context, req *ListApprovalReq, options ...larkcore.RequestOptionFunc) (*ListApprovalResp, error)
- options []larkcore.RequestOptionFunc
- curlNum int
-}
-
-func (iterator *ListApprovalIterator) Next() (bool, *Definition, error) {
- // 达到最大量,则返回
- if iterator.limit > 0 && iterator.curlNum >= iterator.limit {
- return false, nil, nil
- }
-
- // 为0则拉取数据
- if iterator.index == 0 || iterator.index >= len(iterator.items) {
- if iterator.index != 0 && iterator.nextPageToken == nil {
- return false, nil, nil
- }
- if iterator.nextPageToken != nil {
- iterator.req.apiReq.QueryParams.Set("page_token", *iterator.nextPageToken)
- }
- resp, err := iterator.listFunc(iterator.ctx, iterator.req, iterator.options...)
- if err != nil {
- return false, nil, err
- }
-
- if resp.Code != 0 {
- return false, nil, errors.New(fmt.Sprintf("Code:%d,Msg:%s", resp.Code, resp.Msg))
- }
-
- if len(resp.Data.Items) == 0 {
- return false, nil, nil
- }
-
- iterator.nextPageToken = resp.Data.PageToken
- iterator.items = resp.Data.Items
- iterator.index = 0
- }
-
- block := iterator.items[iterator.index]
- iterator.index++
- iterator.curlNum++
- return true, block, nil
-}
-
-func (iterator *ListApprovalIterator) NextPageToken() *string {
- return iterator.nextPageToken
-}
-
type ListExternalTaskIterator struct {
nextPageToken *string
items []*ExternalTaskList
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/attendance/v1/api.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/attendance/v1/api.go
index 40f1b26f70..736e16e6ba 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/attendance/v1/api.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/attendance/v1/api.go
@@ -26,6 +26,8 @@ func NewService(config *larkcore.Config) *AttendanceService {
a.ApprovalInfo = &approvalInfo{service: a}
a.File = &file{service: a}
a.Group = &group{service: a}
+ a.LeaveAccrualRecord = &leaveAccrualRecord{service: a}
+ a.LeaveEmployExpireRecord = &leaveEmployExpireRecord{service: a}
a.Shift = &shift{service: a}
a.UserApproval = &userApproval{service: a}
a.UserDailyShift = &userDailyShift{service: a}
@@ -40,20 +42,22 @@ func NewService(config *larkcore.Config) *AttendanceService {
}
type AttendanceService struct {
- config *larkcore.Config
- ApprovalInfo *approvalInfo // approval_info
- File *file // 文件
- Group *group // 考勤组管理
- Shift *shift // 考勤班次
- UserApproval *userApproval // 假勤审批
- UserDailyShift *userDailyShift // 考勤排班
- UserFlow *userFlow // user_flow
- UserSetting *userSetting // 用户设置
- UserStatsData *userStatsData // 考勤统计
- UserStatsField *userStatsField // user_stats_field
- UserStatsView *userStatsView // user_stats_view
- UserTask *userTask // 考勤记录
- UserTaskRemedy *userTaskRemedy // 考勤补卡
+ config *larkcore.Config
+ ApprovalInfo *approvalInfo // approval_info
+ File *file // 文件
+ Group *group // 考勤组管理
+ LeaveAccrualRecord *leaveAccrualRecord // leave_accrual_record
+ LeaveEmployExpireRecord *leaveEmployExpireRecord // leave_employ_expire_record
+ Shift *shift // 考勤班次
+ UserApproval *userApproval // 假勤审批
+ UserDailyShift *userDailyShift // 考勤排班
+ UserFlow *userFlow // user_flow
+ UserSetting *userSetting // 用户设置
+ UserStatsData *userStatsData // 考勤统计
+ UserStatsField *userStatsField // user_stats_field
+ UserStatsView *userStatsView // user_stats_view
+ UserTask *userTask // 考勤记录
+ UserTaskRemedy *userTaskRemedy // 考勤补卡
}
type approvalInfo struct {
@@ -65,6 +69,12 @@ type file struct {
type group struct {
service *AttendanceService
}
+type leaveAccrualRecord struct {
+ service *AttendanceService
+}
+type leaveEmployExpireRecord struct {
+ service *AttendanceService
+}
type shift struct {
service *AttendanceService
}
@@ -325,6 +335,58 @@ func (g *group) Search(ctx context.Context, req *SearchGroupReq, options ...lark
return resp, err
}
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=patch&project=attendance&resource=leave_accrual_record&version=v1
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/patch_leaveAccrualRecord.go
+func (l *leaveAccrualRecord) Patch(ctx context.Context, req *PatchLeaveAccrualRecordReq, options ...larkcore.RequestOptionFunc) (*PatchLeaveAccrualRecordResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/attendance/v1/leave_accrual_record/:leave_id"
+ apiReq.HttpMethod = http.MethodPatch
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, l.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &PatchLeaveAccrualRecordResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, l.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=get&project=attendance&resource=leave_employ_expire_record&version=v1
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/get_leaveEmployExpireRecord.go
+func (l *leaveEmployExpireRecord) Get(ctx context.Context, req *GetLeaveEmployExpireRecordReq, options ...larkcore.RequestOptionFunc) (*GetLeaveEmployExpireRecordResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/attendance/v1/leave_employ_expire_records/:leave_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, l.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetLeaveEmployExpireRecordResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, l.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
// 创建班次
//
// - 班次是描述一次考勤任务时间规则的统称,比如一天打多少次卡,每次卡的上下班时间,晚到多长时间算迟到,晚到多长时间算缺卡等。
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/attendance/v1/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/attendance/v1/model.go
index 6abf2eb0e5..228b311c35 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/attendance/v1/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/attendance/v1/model.go
@@ -741,6 +741,8 @@ type FreePunchCfg struct {
FreeEndTime *string `json:"free_end_time,omitempty"` // 自由班制打卡结束时间
PunchDay *int `json:"punch_day,omitempty"` // 打卡的时间,为 7 位数字,每一位依次代表周一到周日,0 为不上班,1 为上班
WorkDayNoPunchAsLack *bool `json:"work_day_no_punch_as_lack,omitempty"` // 工作日不打卡是否记为缺卡
+ WorkHoursDemand *bool `json:"work_hours_demand,omitempty"` // 工作日出勤是否需满足时长要求
+ WorkHours *int `json:"work_hours,omitempty"` // 每日工作时长(分钟),范围[0,1440]
}
type FreePunchCfgBuilder struct {
@@ -752,6 +754,10 @@ type FreePunchCfgBuilder struct {
punchDayFlag bool
workDayNoPunchAsLack bool // 工作日不打卡是否记为缺卡
workDayNoPunchAsLackFlag bool
+ workHoursDemand bool // 工作日出勤是否需满足时长要求
+ workHoursDemandFlag bool
+ workHours int // 每日工作时长(分钟),范围[0,1440]
+ workHoursFlag bool
}
func NewFreePunchCfgBuilder() *FreePunchCfgBuilder {
@@ -795,6 +801,24 @@ func (builder *FreePunchCfgBuilder) WorkDayNoPunchAsLack(workDayNoPunchAsLack bo
return builder
}
+// 工作日出勤是否需满足时长要求
+//
+// 示例值:false
+func (builder *FreePunchCfgBuilder) WorkHoursDemand(workHoursDemand bool) *FreePunchCfgBuilder {
+ builder.workHoursDemand = workHoursDemand
+ builder.workHoursDemandFlag = true
+ return builder
+}
+
+// 每日工作时长(分钟),范围[0,1440]
+//
+// 示例值:480
+func (builder *FreePunchCfgBuilder) WorkHours(workHours int) *FreePunchCfgBuilder {
+ builder.workHours = workHours
+ builder.workHoursFlag = true
+ return builder
+}
+
func (builder *FreePunchCfgBuilder) Build() *FreePunchCfg {
req := &FreePunchCfg{}
if builder.freeStartTimeFlag {
@@ -812,6 +836,14 @@ func (builder *FreePunchCfgBuilder) Build() *FreePunchCfg {
if builder.workDayNoPunchAsLackFlag {
req.WorkDayNoPunchAsLack = &builder.workDayNoPunchAsLack
+ }
+ if builder.workHoursDemandFlag {
+ req.WorkHoursDemand = &builder.workHoursDemand
+
+ }
+ if builder.workHoursFlag {
+ req.WorkHours = &builder.workHours
+
}
return req
}
@@ -846,6 +878,7 @@ type Group struct {
HideStaffPunchTime *bool `json:"hide_staff_punch_time,omitempty"` // 是否隐藏员工打卡详情
FacePunch *bool `json:"face_punch,omitempty"` // 是否开启人脸识别打卡
FacePunchCfg *int `json:"face_punch_cfg,omitempty"` // 人脸识别打卡规则,1:每次打卡均需人脸识别,2:疑似作弊打卡时需要人脸识别
+ FaceLiveNeedAction *bool `json:"face_live_need_action,omitempty"` // 人脸打卡规则, false:开启活体验证 true:0动作验证,仅在 face_punch_cfg = 1 时有效
FaceDowngrade *bool `json:"face_downgrade,omitempty"` // 人脸识别失败时是否允许普通拍照打卡
ReplaceBasicPic *bool `json:"replace_basic_pic,omitempty"` // 人脸识别失败时是否允许替换基准图片
Machines []*Machine `json:"machines,omitempty"` // 考勤机列表
@@ -867,6 +900,15 @@ type Group struct {
MemberEffectTime *string `json:"member_effect_time,omitempty"` // 参加考勤的人员、部门变动生效时间,精确到秒的时间戳
RestClockInNeedApproval *bool `json:"rest_clockIn_need_approval,omitempty"` // 休息日打卡需审批
ClockInNeedPhoto *bool `json:"clockIn_need_photo,omitempty"` // 每次打卡均需拍照
+ MemberStatusChange *MemberStatusChange `json:"member_status_change,omitempty"` // 人员异动打卡设置
+ LeaveNeedPunch *bool `json:"leave_need_punch,omitempty"` // 请假离岗或返岗是否需打卡
+ LeaveNeedPunchCfg *LeaveNeedPunchCfg `json:"leave_need_punch_cfg,omitempty"` // 请假离岗或返岗打卡规则
+ GoOutNeedPunch *int `json:"go_out_need_punch,omitempty"` // 外出期间是否需打卡
+ GoOutNeedPunchCfg *LeaveNeedPunchCfg `json:"go_out_need_punch_cfg,omitempty"` // 外出期间打卡规则
+ TravelNeedPunch *int `json:"travel_need_punch,omitempty"` // 出差期间是否需打卡
+ TravelNeedPunchCfg *LeaveNeedPunchCfg `json:"travel_need_punch_cfg,omitempty"` // 出差期间打卡规则
+ NeedPunchMembers []*PunchMember `json:"need_punch_members,omitempty"` // 需要打卡的人员配置(新)
+ NoNeedPunchMembers []*PunchMember `json:"no_need_punch_members,omitempty"` // 无需打卡的人员配置(新)
}
type GroupBuilder struct {
@@ -928,6 +970,8 @@ type GroupBuilder struct {
facePunchFlag bool
facePunchCfg int // 人脸识别打卡规则,1:每次打卡均需人脸识别,2:疑似作弊打卡时需要人脸识别
facePunchCfgFlag bool
+ faceLiveNeedAction bool // 人脸打卡规则, false:开启活体验证 true:0动作验证,仅在 face_punch_cfg = 1 时有效
+ faceLiveNeedActionFlag bool
faceDowngrade bool // 人脸识别失败时是否允许普通拍照打卡
faceDowngradeFlag bool
replaceBasicPic bool // 人脸识别失败时是否允许替换基准图片
@@ -970,6 +1014,24 @@ type GroupBuilder struct {
restClockInNeedApprovalFlag bool
clockInNeedPhoto bool // 每次打卡均需拍照
clockInNeedPhotoFlag bool
+ memberStatusChange *MemberStatusChange // 人员异动打卡设置
+ memberStatusChangeFlag bool
+ leaveNeedPunch bool // 请假离岗或返岗是否需打卡
+ leaveNeedPunchFlag bool
+ leaveNeedPunchCfg *LeaveNeedPunchCfg // 请假离岗或返岗打卡规则
+ leaveNeedPunchCfgFlag bool
+ goOutNeedPunch int // 外出期间是否需打卡
+ goOutNeedPunchFlag bool
+ goOutNeedPunchCfg *LeaveNeedPunchCfg // 外出期间打卡规则
+ goOutNeedPunchCfgFlag bool
+ travelNeedPunch int // 出差期间是否需打卡
+ travelNeedPunchFlag bool
+ travelNeedPunchCfg *LeaveNeedPunchCfg // 出差期间打卡规则
+ travelNeedPunchCfgFlag bool
+ needPunchMembers []*PunchMember // 需要打卡的人员配置(新)
+ needPunchMembersFlag bool
+ noNeedPunchMembers []*PunchMember // 无需打卡的人员配置(新)
+ noNeedPunchMembersFlag bool
}
func NewGroupBuilder() *GroupBuilder {
@@ -1238,6 +1300,15 @@ func (builder *GroupBuilder) FacePunchCfg(facePunchCfg int) *GroupBuilder {
return builder
}
+// 人脸打卡规则, false:开启活体验证 true:0动作验证,仅在 face_punch_cfg = 1 时有效
+//
+// 示例值:false
+func (builder *GroupBuilder) FaceLiveNeedAction(faceLiveNeedAction bool) *GroupBuilder {
+ builder.faceLiveNeedAction = faceLiveNeedAction
+ builder.faceLiveNeedActionFlag = true
+ return builder
+}
+
// 人脸识别失败时是否允许普通拍照打卡
//
// 示例值:true
@@ -1427,6 +1498,87 @@ func (builder *GroupBuilder) ClockInNeedPhoto(clockInNeedPhoto bool) *GroupBuild
return builder
}
+// 人员异动打卡设置
+//
+// 示例值:
+func (builder *GroupBuilder) MemberStatusChange(memberStatusChange *MemberStatusChange) *GroupBuilder {
+ builder.memberStatusChange = memberStatusChange
+ builder.memberStatusChangeFlag = true
+ return builder
+}
+
+// 请假离岗或返岗是否需打卡
+//
+// 示例值:false
+func (builder *GroupBuilder) LeaveNeedPunch(leaveNeedPunch bool) *GroupBuilder {
+ builder.leaveNeedPunch = leaveNeedPunch
+ builder.leaveNeedPunchFlag = true
+ return builder
+}
+
+// 请假离岗或返岗打卡规则
+//
+// 示例值:
+func (builder *GroupBuilder) LeaveNeedPunchCfg(leaveNeedPunchCfg *LeaveNeedPunchCfg) *GroupBuilder {
+ builder.leaveNeedPunchCfg = leaveNeedPunchCfg
+ builder.leaveNeedPunchCfgFlag = true
+ return builder
+}
+
+// 外出期间是否需打卡
+//
+// 示例值:0
+func (builder *GroupBuilder) GoOutNeedPunch(goOutNeedPunch int) *GroupBuilder {
+ builder.goOutNeedPunch = goOutNeedPunch
+ builder.goOutNeedPunchFlag = true
+ return builder
+}
+
+// 外出期间打卡规则
+//
+// 示例值:
+func (builder *GroupBuilder) GoOutNeedPunchCfg(goOutNeedPunchCfg *LeaveNeedPunchCfg) *GroupBuilder {
+ builder.goOutNeedPunchCfg = goOutNeedPunchCfg
+ builder.goOutNeedPunchCfgFlag = true
+ return builder
+}
+
+// 出差期间是否需打卡
+//
+// 示例值:0
+func (builder *GroupBuilder) TravelNeedPunch(travelNeedPunch int) *GroupBuilder {
+ builder.travelNeedPunch = travelNeedPunch
+ builder.travelNeedPunchFlag = true
+ return builder
+}
+
+// 出差期间打卡规则
+//
+// 示例值:
+func (builder *GroupBuilder) TravelNeedPunchCfg(travelNeedPunchCfg *LeaveNeedPunchCfg) *GroupBuilder {
+ builder.travelNeedPunchCfg = travelNeedPunchCfg
+ builder.travelNeedPunchCfgFlag = true
+ return builder
+}
+
+// 需要打卡的人员配置(新)
+//
+// 示例值:
+func (builder *GroupBuilder) NeedPunchMembers(needPunchMembers []*PunchMember) *GroupBuilder {
+ builder.needPunchMembers = needPunchMembers
+ builder.needPunchMembersFlag = true
+ return builder
+}
+
+// 无需打卡的人员配置(新)
+//
+// 示例值:
+func (builder *GroupBuilder) NoNeedPunchMembers(noNeedPunchMembers []*PunchMember) *GroupBuilder {
+ builder.noNeedPunchMembers = noNeedPunchMembers
+ builder.noNeedPunchMembersFlag = true
+ return builder
+}
+
func (builder *GroupBuilder) Build() *Group {
req := &Group{}
if builder.groupIdFlag {
@@ -1538,6 +1690,10 @@ func (builder *GroupBuilder) Build() *Group {
if builder.facePunchCfgFlag {
req.FacePunchCfg = &builder.facePunchCfg
+ }
+ if builder.faceLiveNeedActionFlag {
+ req.FaceLiveNeedAction = &builder.faceLiveNeedAction
+
}
if builder.faceDowngradeFlag {
req.FaceDowngrade = &builder.faceDowngrade
@@ -1617,6 +1773,36 @@ func (builder *GroupBuilder) Build() *Group {
req.ClockInNeedPhoto = &builder.clockInNeedPhoto
}
+ if builder.memberStatusChangeFlag {
+ req.MemberStatusChange = builder.memberStatusChange
+ }
+ if builder.leaveNeedPunchFlag {
+ req.LeaveNeedPunch = &builder.leaveNeedPunch
+
+ }
+ if builder.leaveNeedPunchCfgFlag {
+ req.LeaveNeedPunchCfg = builder.leaveNeedPunchCfg
+ }
+ if builder.goOutNeedPunchFlag {
+ req.GoOutNeedPunch = &builder.goOutNeedPunch
+
+ }
+ if builder.goOutNeedPunchCfgFlag {
+ req.GoOutNeedPunchCfg = builder.goOutNeedPunchCfg
+ }
+ if builder.travelNeedPunchFlag {
+ req.TravelNeedPunch = &builder.travelNeedPunch
+
+ }
+ if builder.travelNeedPunchCfgFlag {
+ req.TravelNeedPunchCfg = builder.travelNeedPunchCfg
+ }
+ if builder.needPunchMembersFlag {
+ req.NeedPunchMembers = builder.needPunchMembers
+ }
+ if builder.noNeedPunchMembersFlag {
+ req.NoNeedPunchMembers = builder.noNeedPunchMembers
+ }
return req
}
@@ -1795,6 +1981,54 @@ func (builder *ItemBuilder) Build() *Item {
return req
}
+type LangText struct {
+ Lang *string `json:"lang,omitempty"` // 语言码
+ Value *string `json:"value,omitempty"` // 语言码对应的文本
+}
+
+type LangTextBuilder struct {
+ lang string // 语言码
+ langFlag bool
+ value string // 语言码对应的文本
+ valueFlag bool
+}
+
+func NewLangTextBuilder() *LangTextBuilder {
+ builder := &LangTextBuilder{}
+ return builder
+}
+
+// 语言码
+//
+// 示例值:cn_zh
+func (builder *LangTextBuilder) Lang(lang string) *LangTextBuilder {
+ builder.lang = lang
+ builder.langFlag = true
+ return builder
+}
+
+// 语言码对应的文本
+//
+// 示例值:test
+func (builder *LangTextBuilder) Value(value string) *LangTextBuilder {
+ builder.value = value
+ builder.valueFlag = true
+ return builder
+}
+
+func (builder *LangTextBuilder) Build() *LangText {
+ req := &LangText{}
+ if builder.langFlag {
+ req.Lang = &builder.lang
+
+ }
+ if builder.valueFlag {
+ req.Value = &builder.value
+
+ }
+ return req
+}
+
type LateOffLateOnRule struct {
LateOffMinutes *int `json:"late_off_minutes,omitempty"` // 晚走多久
LateOnMinutes *int `json:"late_on_minutes,omitempty"` // 晚到多久
@@ -1843,6 +2077,516 @@ func (builder *LateOffLateOnRuleBuilder) Build() *LateOffLateOnRule {
return req
}
+type LeaveAccrualRecord struct {
+ Id *string `json:"id,omitempty"` // 授予记录唯一ID
+ EmploymentId *string `json:"employment_id,omitempty"` // 员工ID
+ LeaveTypeId *string `json:"leave_type_id,omitempty"` // 假期类型ID
+ GrantingQuantity *string `json:"granting_quantity,omitempty"` // 授予数量
+ GrantingUnit *int `json:"granting_unit,omitempty"` // 授予单位,1表示天,2表示小时
+ EffectiveDate *string `json:"effective_date,omitempty"` // 生效日期,格式"2020-01-01"
+ ExpirationDate *string `json:"expiration_date,omitempty"` // 失效日期,格式"2020-01-01"
+ GrantedBy *int `json:"granted_by,omitempty"` // 授予来源,1:系统授予;2:手动授予;3:外部系统授予
+ Reason []*LangText `json:"reason,omitempty"` // 授予原因
+ CreatedAt *string `json:"created_at,omitempty"` // 授予记录的创建时间,unix时间戳
+ CreatedBy *string `json:"created_by,omitempty"` // 授予记录的创建人的ID
+ UpdatedAt *string `json:"updated_at,omitempty"` // 授予记录的更新时间,unix时间戳
+ UpdatedBy *string `json:"updated_by,omitempty"` // 授予记录的更新人的ID
+}
+
+type LeaveAccrualRecordBuilder struct {
+ id string // 授予记录唯一ID
+ idFlag bool
+ employmentId string // 员工ID
+ employmentIdFlag bool
+ leaveTypeId string // 假期类型ID
+ leaveTypeIdFlag bool
+ grantingQuantity string // 授予数量
+ grantingQuantityFlag bool
+ grantingUnit int // 授予单位,1表示天,2表示小时
+ grantingUnitFlag bool
+ effectiveDate string // 生效日期,格式"2020-01-01"
+ effectiveDateFlag bool
+ expirationDate string // 失效日期,格式"2020-01-01"
+ expirationDateFlag bool
+ grantedBy int // 授予来源,1:系统授予;2:手动授予;3:外部系统授予
+ grantedByFlag bool
+ reason []*LangText // 授予原因
+ reasonFlag bool
+ createdAt string // 授予记录的创建时间,unix时间戳
+ createdAtFlag bool
+ createdBy string // 授予记录的创建人的ID
+ createdByFlag bool
+ updatedAt string // 授予记录的更新时间,unix时间戳
+ updatedAtFlag bool
+ updatedBy string // 授予记录的更新人的ID
+ updatedByFlag bool
+}
+
+func NewLeaveAccrualRecordBuilder() *LeaveAccrualRecordBuilder {
+ builder := &LeaveAccrualRecordBuilder{}
+ return builder
+}
+
+// 授予记录唯一ID
+//
+// 示例值:1
+func (builder *LeaveAccrualRecordBuilder) Id(id string) *LeaveAccrualRecordBuilder {
+ builder.id = id
+ builder.idFlag = true
+ return builder
+}
+
+// 员工ID
+//
+// 示例值:1
+func (builder *LeaveAccrualRecordBuilder) EmploymentId(employmentId string) *LeaveAccrualRecordBuilder {
+ builder.employmentId = employmentId
+ builder.employmentIdFlag = true
+ return builder
+}
+
+// 假期类型ID
+//
+// 示例值:1
+func (builder *LeaveAccrualRecordBuilder) LeaveTypeId(leaveTypeId string) *LeaveAccrualRecordBuilder {
+ builder.leaveTypeId = leaveTypeId
+ builder.leaveTypeIdFlag = true
+ return builder
+}
+
+// 授予数量
+//
+// 示例值:1
+func (builder *LeaveAccrualRecordBuilder) GrantingQuantity(grantingQuantity string) *LeaveAccrualRecordBuilder {
+ builder.grantingQuantity = grantingQuantity
+ builder.grantingQuantityFlag = true
+ return builder
+}
+
+// 授予单位,1表示天,2表示小时
+//
+// 示例值:1表示天,2表示小时
+func (builder *LeaveAccrualRecordBuilder) GrantingUnit(grantingUnit int) *LeaveAccrualRecordBuilder {
+ builder.grantingUnit = grantingUnit
+ builder.grantingUnitFlag = true
+ return builder
+}
+
+// 生效日期,格式"2020-01-01"
+//
+// 示例值:2020-01-01
+func (builder *LeaveAccrualRecordBuilder) EffectiveDate(effectiveDate string) *LeaveAccrualRecordBuilder {
+ builder.effectiveDate = effectiveDate
+ builder.effectiveDateFlag = true
+ return builder
+}
+
+// 失效日期,格式"2020-01-01"
+//
+// 示例值:2020-01-01
+func (builder *LeaveAccrualRecordBuilder) ExpirationDate(expirationDate string) *LeaveAccrualRecordBuilder {
+ builder.expirationDate = expirationDate
+ builder.expirationDateFlag = true
+ return builder
+}
+
+// 授予来源,1:系统授予;2:手动授予;3:外部系统授予
+//
+// 示例值:1
+func (builder *LeaveAccrualRecordBuilder) GrantedBy(grantedBy int) *LeaveAccrualRecordBuilder {
+ builder.grantedBy = grantedBy
+ builder.grantedByFlag = true
+ return builder
+}
+
+// 授予原因
+//
+// 示例值:
+func (builder *LeaveAccrualRecordBuilder) Reason(reason []*LangText) *LeaveAccrualRecordBuilder {
+ builder.reason = reason
+ builder.reasonFlag = true
+ return builder
+}
+
+// 授予记录的创建时间,unix时间戳
+//
+// 示例值:1
+func (builder *LeaveAccrualRecordBuilder) CreatedAt(createdAt string) *LeaveAccrualRecordBuilder {
+ builder.createdAt = createdAt
+ builder.createdAtFlag = true
+ return builder
+}
+
+// 授予记录的创建人的ID
+//
+// 示例值:1
+func (builder *LeaveAccrualRecordBuilder) CreatedBy(createdBy string) *LeaveAccrualRecordBuilder {
+ builder.createdBy = createdBy
+ builder.createdByFlag = true
+ return builder
+}
+
+// 授予记录的更新时间,unix时间戳
+//
+// 示例值:1
+func (builder *LeaveAccrualRecordBuilder) UpdatedAt(updatedAt string) *LeaveAccrualRecordBuilder {
+ builder.updatedAt = updatedAt
+ builder.updatedAtFlag = true
+ return builder
+}
+
+// 授予记录的更新人的ID
+//
+// 示例值:1
+func (builder *LeaveAccrualRecordBuilder) UpdatedBy(updatedBy string) *LeaveAccrualRecordBuilder {
+ builder.updatedBy = updatedBy
+ builder.updatedByFlag = true
+ return builder
+}
+
+func (builder *LeaveAccrualRecordBuilder) Build() *LeaveAccrualRecord {
+ req := &LeaveAccrualRecord{}
+ if builder.idFlag {
+ req.Id = &builder.id
+
+ }
+ if builder.employmentIdFlag {
+ req.EmploymentId = &builder.employmentId
+
+ }
+ if builder.leaveTypeIdFlag {
+ req.LeaveTypeId = &builder.leaveTypeId
+
+ }
+ if builder.grantingQuantityFlag {
+ req.GrantingQuantity = &builder.grantingQuantity
+
+ }
+ if builder.grantingUnitFlag {
+ req.GrantingUnit = &builder.grantingUnit
+
+ }
+ if builder.effectiveDateFlag {
+ req.EffectiveDate = &builder.effectiveDate
+
+ }
+ if builder.expirationDateFlag {
+ req.ExpirationDate = &builder.expirationDate
+
+ }
+ if builder.grantedByFlag {
+ req.GrantedBy = &builder.grantedBy
+
+ }
+ if builder.reasonFlag {
+ req.Reason = builder.reason
+ }
+ if builder.createdAtFlag {
+ req.CreatedAt = &builder.createdAt
+
+ }
+ if builder.createdByFlag {
+ req.CreatedBy = &builder.createdBy
+
+ }
+ if builder.updatedAtFlag {
+ req.UpdatedAt = &builder.updatedAt
+
+ }
+ if builder.updatedByFlag {
+ req.UpdatedBy = &builder.updatedBy
+
+ }
+ return req
+}
+
+type LeaveEmployExpireRecord struct {
+ Id *string `json:"id,omitempty"` // record id
+ EmploymentId *string `json:"employment_id,omitempty"` // 员工ID
+ LeaveTypeId *string `json:"leave_type_id,omitempty"` // 假期类型ID
+ GrantingQuantity *string `json:"granting_quantity,omitempty"` // 授予余额数量
+ LeftGrantingQuantity *string `json:"left_granting_quantity,omitempty"` // 授予数量 扣减完后的授予数量
+ GrantingUnit *int `json:"granting_unit,omitempty"` // 授予单位,1表示天,2表示小时
+ EffectiveDate *string `json:"effective_date,omitempty"` // 生效日期,格式"2020-01-01"
+ ExpirationDate *string `json:"expiration_date,omitempty"` // 失效日期,格式"2020-01-01"
+ Reason []*LangText `json:"reason,omitempty"` // 授予原因
+ IsUpdateByExternal *bool `json:"is_update_by_external,omitempty"` // 是否已经被外部系统更改过
+ AccrualSource *int `json:"accrual_source,omitempty"` // 授予来源
+ LeaveSubTypeId *string `json:"leave_sub_type_id,omitempty"` // 假期子类型id
+}
+
+type LeaveEmployExpireRecordBuilder struct {
+ id string // record id
+ idFlag bool
+ employmentId string // 员工ID
+ employmentIdFlag bool
+ leaveTypeId string // 假期类型ID
+ leaveTypeIdFlag bool
+ grantingQuantity string // 授予余额数量
+ grantingQuantityFlag bool
+ leftGrantingQuantity string // 授予数量 扣减完后的授予数量
+ leftGrantingQuantityFlag bool
+ grantingUnit int // 授予单位,1表示天,2表示小时
+ grantingUnitFlag bool
+ effectiveDate string // 生效日期,格式"2020-01-01"
+ effectiveDateFlag bool
+ expirationDate string // 失效日期,格式"2020-01-01"
+ expirationDateFlag bool
+ reason []*LangText // 授予原因
+ reasonFlag bool
+ isUpdateByExternal bool // 是否已经被外部系统更改过
+ isUpdateByExternalFlag bool
+ accrualSource int // 授予来源
+ accrualSourceFlag bool
+ leaveSubTypeId string // 假期子类型id
+ leaveSubTypeIdFlag bool
+}
+
+func NewLeaveEmployExpireRecordBuilder() *LeaveEmployExpireRecordBuilder {
+ builder := &LeaveEmployExpireRecordBuilder{}
+ return builder
+}
+
+// record id
+//
+// 示例值:1
+func (builder *LeaveEmployExpireRecordBuilder) Id(id string) *LeaveEmployExpireRecordBuilder {
+ builder.id = id
+ builder.idFlag = true
+ return builder
+}
+
+// 员工ID
+//
+// 示例值:1
+func (builder *LeaveEmployExpireRecordBuilder) EmploymentId(employmentId string) *LeaveEmployExpireRecordBuilder {
+ builder.employmentId = employmentId
+ builder.employmentIdFlag = true
+ return builder
+}
+
+// 假期类型ID
+//
+// 示例值:1
+func (builder *LeaveEmployExpireRecordBuilder) LeaveTypeId(leaveTypeId string) *LeaveEmployExpireRecordBuilder {
+ builder.leaveTypeId = leaveTypeId
+ builder.leaveTypeIdFlag = true
+ return builder
+}
+
+// 授予余额数量
+//
+// 示例值:1
+func (builder *LeaveEmployExpireRecordBuilder) GrantingQuantity(grantingQuantity string) *LeaveEmployExpireRecordBuilder {
+ builder.grantingQuantity = grantingQuantity
+ builder.grantingQuantityFlag = true
+ return builder
+}
+
+// 授予数量 扣减完后的授予数量
+//
+// 示例值:1
+func (builder *LeaveEmployExpireRecordBuilder) LeftGrantingQuantity(leftGrantingQuantity string) *LeaveEmployExpireRecordBuilder {
+ builder.leftGrantingQuantity = leftGrantingQuantity
+ builder.leftGrantingQuantityFlag = true
+ return builder
+}
+
+// 授予单位,1表示天,2表示小时
+//
+// 示例值:1表示天,2表示小时
+func (builder *LeaveEmployExpireRecordBuilder) GrantingUnit(grantingUnit int) *LeaveEmployExpireRecordBuilder {
+ builder.grantingUnit = grantingUnit
+ builder.grantingUnitFlag = true
+ return builder
+}
+
+// 生效日期,格式"2020-01-01"
+//
+// 示例值:2020-01-01
+func (builder *LeaveEmployExpireRecordBuilder) EffectiveDate(effectiveDate string) *LeaveEmployExpireRecordBuilder {
+ builder.effectiveDate = effectiveDate
+ builder.effectiveDateFlag = true
+ return builder
+}
+
+// 失效日期,格式"2020-01-01"
+//
+// 示例值:2020-01-01
+func (builder *LeaveEmployExpireRecordBuilder) ExpirationDate(expirationDate string) *LeaveEmployExpireRecordBuilder {
+ builder.expirationDate = expirationDate
+ builder.expirationDateFlag = true
+ return builder
+}
+
+// 授予原因
+//
+// 示例值:
+func (builder *LeaveEmployExpireRecordBuilder) Reason(reason []*LangText) *LeaveEmployExpireRecordBuilder {
+ builder.reason = reason
+ builder.reasonFlag = true
+ return builder
+}
+
+// 是否已经被外部系统更改过
+//
+// 示例值:true
+func (builder *LeaveEmployExpireRecordBuilder) IsUpdateByExternal(isUpdateByExternal bool) *LeaveEmployExpireRecordBuilder {
+ builder.isUpdateByExternal = isUpdateByExternal
+ builder.isUpdateByExternalFlag = true
+ return builder
+}
+
+// 授予来源
+//
+// 示例值:1
+func (builder *LeaveEmployExpireRecordBuilder) AccrualSource(accrualSource int) *LeaveEmployExpireRecordBuilder {
+ builder.accrualSource = accrualSource
+ builder.accrualSourceFlag = true
+ return builder
+}
+
+// 假期子类型id
+//
+// 示例值:1
+func (builder *LeaveEmployExpireRecordBuilder) LeaveSubTypeId(leaveSubTypeId string) *LeaveEmployExpireRecordBuilder {
+ builder.leaveSubTypeId = leaveSubTypeId
+ builder.leaveSubTypeIdFlag = true
+ return builder
+}
+
+func (builder *LeaveEmployExpireRecordBuilder) Build() *LeaveEmployExpireRecord {
+ req := &LeaveEmployExpireRecord{}
+ if builder.idFlag {
+ req.Id = &builder.id
+
+ }
+ if builder.employmentIdFlag {
+ req.EmploymentId = &builder.employmentId
+
+ }
+ if builder.leaveTypeIdFlag {
+ req.LeaveTypeId = &builder.leaveTypeId
+
+ }
+ if builder.grantingQuantityFlag {
+ req.GrantingQuantity = &builder.grantingQuantity
+
+ }
+ if builder.leftGrantingQuantityFlag {
+ req.LeftGrantingQuantity = &builder.leftGrantingQuantity
+
+ }
+ if builder.grantingUnitFlag {
+ req.GrantingUnit = &builder.grantingUnit
+
+ }
+ if builder.effectiveDateFlag {
+ req.EffectiveDate = &builder.effectiveDate
+
+ }
+ if builder.expirationDateFlag {
+ req.ExpirationDate = &builder.expirationDate
+
+ }
+ if builder.reasonFlag {
+ req.Reason = builder.reason
+ }
+ if builder.isUpdateByExternalFlag {
+ req.IsUpdateByExternal = &builder.isUpdateByExternal
+
+ }
+ if builder.accrualSourceFlag {
+ req.AccrualSource = &builder.accrualSource
+
+ }
+ if builder.leaveSubTypeIdFlag {
+ req.LeaveSubTypeId = &builder.leaveSubTypeId
+
+ }
+ return req
+}
+
+type LeaveNeedPunchCfg struct {
+ LateMinutesAsLate *int `json:"late_minutes_as_late,omitempty"` // 晚到超过多久记为迟到
+ LateMinutesAsLack *int `json:"late_minutes_as_lack,omitempty"` // 晚到超过多久记为缺卡
+ EarlyMinutesAsEarly *int `json:"early_minutes_as_early,omitempty"` // 早走超过多久记为早退
+ EarlyMinutesAsLack *int `json:"early_minutes_as_lack,omitempty"` // 早走超过多久记为缺卡
+}
+
+type LeaveNeedPunchCfgBuilder struct {
+ lateMinutesAsLate int // 晚到超过多久记为迟到
+ lateMinutesAsLateFlag bool
+ lateMinutesAsLack int // 晚到超过多久记为缺卡
+ lateMinutesAsLackFlag bool
+ earlyMinutesAsEarly int // 早走超过多久记为早退
+ earlyMinutesAsEarlyFlag bool
+ earlyMinutesAsLack int // 早走超过多久记为缺卡
+ earlyMinutesAsLackFlag bool
+}
+
+func NewLeaveNeedPunchCfgBuilder() *LeaveNeedPunchCfgBuilder {
+ builder := &LeaveNeedPunchCfgBuilder{}
+ return builder
+}
+
+// 晚到超过多久记为迟到
+//
+// 示例值:0
+func (builder *LeaveNeedPunchCfgBuilder) LateMinutesAsLate(lateMinutesAsLate int) *LeaveNeedPunchCfgBuilder {
+ builder.lateMinutesAsLate = lateMinutesAsLate
+ builder.lateMinutesAsLateFlag = true
+ return builder
+}
+
+// 晚到超过多久记为缺卡
+//
+// 示例值:0
+func (builder *LeaveNeedPunchCfgBuilder) LateMinutesAsLack(lateMinutesAsLack int) *LeaveNeedPunchCfgBuilder {
+ builder.lateMinutesAsLack = lateMinutesAsLack
+ builder.lateMinutesAsLackFlag = true
+ return builder
+}
+
+// 早走超过多久记为早退
+//
+// 示例值:0
+func (builder *LeaveNeedPunchCfgBuilder) EarlyMinutesAsEarly(earlyMinutesAsEarly int) *LeaveNeedPunchCfgBuilder {
+ builder.earlyMinutesAsEarly = earlyMinutesAsEarly
+ builder.earlyMinutesAsEarlyFlag = true
+ return builder
+}
+
+// 早走超过多久记为缺卡
+//
+// 示例值:0
+func (builder *LeaveNeedPunchCfgBuilder) EarlyMinutesAsLack(earlyMinutesAsLack int) *LeaveNeedPunchCfgBuilder {
+ builder.earlyMinutesAsLack = earlyMinutesAsLack
+ builder.earlyMinutesAsLackFlag = true
+ return builder
+}
+
+func (builder *LeaveNeedPunchCfgBuilder) Build() *LeaveNeedPunchCfg {
+ req := &LeaveNeedPunchCfg{}
+ if builder.lateMinutesAsLateFlag {
+ req.LateMinutesAsLate = &builder.lateMinutesAsLate
+
+ }
+ if builder.lateMinutesAsLackFlag {
+ req.LateMinutesAsLack = &builder.lateMinutesAsLack
+
+ }
+ if builder.earlyMinutesAsEarlyFlag {
+ req.EarlyMinutesAsEarly = &builder.earlyMinutesAsEarly
+
+ }
+ if builder.earlyMinutesAsLackFlag {
+ req.EarlyMinutesAsLack = &builder.earlyMinutesAsLack
+
+ }
+ return req
+}
+
type Location struct {
LocationId *string `json:"location_id,omitempty"` // 地址 ID
LocationName *string `json:"location_name,omitempty"` // 地址名称
@@ -2395,6 +3139,133 @@ func (builder *MachineBuilder) Build() *Machine {
return req
}
+type MemberStatusChange struct {
+ OnboardingOnNoNeedPunch *bool `json:"onboarding_on_no_need_punch,omitempty"` // 是否入职日上班无需打卡
+ OnboardingOffNoNeedPunch *bool `json:"onboarding_off_no_need_punch,omitempty"` // 是否入职日下班无需打卡
+ OffboardingOnNoNeedPunch *bool `json:"offboarding_on_no_need_punch,omitempty"` // 是否离职日上班无需打卡
+ OffboardingOffNoNeedPunch *bool `json:"offboarding_off_no_need_punch,omitempty"` // 是否离职日下班无需打卡
+}
+
+type MemberStatusChangeBuilder struct {
+ onboardingOnNoNeedPunch bool // 是否入职日上班无需打卡
+ onboardingOnNoNeedPunchFlag bool
+ onboardingOffNoNeedPunch bool // 是否入职日下班无需打卡
+ onboardingOffNoNeedPunchFlag bool
+ offboardingOnNoNeedPunch bool // 是否离职日上班无需打卡
+ offboardingOnNoNeedPunchFlag bool
+ offboardingOffNoNeedPunch bool // 是否离职日下班无需打卡
+ offboardingOffNoNeedPunchFlag bool
+}
+
+func NewMemberStatusChangeBuilder() *MemberStatusChangeBuilder {
+ builder := &MemberStatusChangeBuilder{}
+ return builder
+}
+
+// 是否入职日上班无需打卡
+//
+// 示例值:false
+func (builder *MemberStatusChangeBuilder) OnboardingOnNoNeedPunch(onboardingOnNoNeedPunch bool) *MemberStatusChangeBuilder {
+ builder.onboardingOnNoNeedPunch = onboardingOnNoNeedPunch
+ builder.onboardingOnNoNeedPunchFlag = true
+ return builder
+}
+
+// 是否入职日下班无需打卡
+//
+// 示例值:false
+func (builder *MemberStatusChangeBuilder) OnboardingOffNoNeedPunch(onboardingOffNoNeedPunch bool) *MemberStatusChangeBuilder {
+ builder.onboardingOffNoNeedPunch = onboardingOffNoNeedPunch
+ builder.onboardingOffNoNeedPunchFlag = true
+ return builder
+}
+
+// 是否离职日上班无需打卡
+//
+// 示例值:false
+func (builder *MemberStatusChangeBuilder) OffboardingOnNoNeedPunch(offboardingOnNoNeedPunch bool) *MemberStatusChangeBuilder {
+ builder.offboardingOnNoNeedPunch = offboardingOnNoNeedPunch
+ builder.offboardingOnNoNeedPunchFlag = true
+ return builder
+}
+
+// 是否离职日下班无需打卡
+//
+// 示例值:false
+func (builder *MemberStatusChangeBuilder) OffboardingOffNoNeedPunch(offboardingOffNoNeedPunch bool) *MemberStatusChangeBuilder {
+ builder.offboardingOffNoNeedPunch = offboardingOffNoNeedPunch
+ builder.offboardingOffNoNeedPunchFlag = true
+ return builder
+}
+
+func (builder *MemberStatusChangeBuilder) Build() *MemberStatusChange {
+ req := &MemberStatusChange{}
+ if builder.onboardingOnNoNeedPunchFlag {
+ req.OnboardingOnNoNeedPunch = &builder.onboardingOnNoNeedPunch
+
+ }
+ if builder.onboardingOffNoNeedPunchFlag {
+ req.OnboardingOffNoNeedPunch = &builder.onboardingOffNoNeedPunch
+
+ }
+ if builder.offboardingOnNoNeedPunchFlag {
+ req.OffboardingOnNoNeedPunch = &builder.offboardingOnNoNeedPunch
+
+ }
+ if builder.offboardingOffNoNeedPunchFlag {
+ req.OffboardingOffNoNeedPunch = &builder.offboardingOffNoNeedPunch
+
+ }
+ return req
+}
+
+type PunchMember struct {
+ RuleScopeType *int `json:"rule_scope_type,omitempty"` // 圈人方式:0 无 1全部 2自定义
+ ScopeGroupList *ScopeGroup `json:"scope_group_list,omitempty"` // 圈人规则列表
+}
+
+type PunchMemberBuilder struct {
+ ruleScopeType int // 圈人方式:0 无 1全部 2自定义
+ ruleScopeTypeFlag bool
+ scopeGroupList *ScopeGroup // 圈人规则列表
+ scopeGroupListFlag bool
+}
+
+func NewPunchMemberBuilder() *PunchMemberBuilder {
+ builder := &PunchMemberBuilder{}
+ return builder
+}
+
+// 圈人方式:0 无 1全部 2自定义
+//
+// 示例值:0
+func (builder *PunchMemberBuilder) RuleScopeType(ruleScopeType int) *PunchMemberBuilder {
+ builder.ruleScopeType = ruleScopeType
+ builder.ruleScopeTypeFlag = true
+ return builder
+}
+
+// 圈人规则列表
+//
+// 示例值:
+func (builder *PunchMemberBuilder) ScopeGroupList(scopeGroupList *ScopeGroup) *PunchMemberBuilder {
+ builder.scopeGroupList = scopeGroupList
+ builder.scopeGroupListFlag = true
+ return builder
+}
+
+func (builder *PunchMemberBuilder) Build() *PunchMember {
+ req := &PunchMember{}
+ if builder.ruleScopeTypeFlag {
+ req.RuleScopeType = &builder.ruleScopeType
+
+ }
+ if builder.scopeGroupListFlag {
+ req.ScopeGroupList = builder.scopeGroupList
+ }
+ return req
+}
+
type PunchSpecialDateShift struct {
PunchDay *int `json:"punch_day,omitempty"` // 打卡日期
ShiftId *string `json:"shift_id,omitempty"` // 班次 ID
@@ -2740,8 +3611,134 @@ func (builder *ScheduleBuilder) Build() *Schedule {
req.GroupId = &builder.groupId
}
- if builder.shiftsFlag {
- req.Shifts = builder.shifts
+ if builder.shiftsFlag {
+ req.Shifts = builder.shifts
+ }
+ return req
+}
+
+type ScopeGroup struct {
+ ScopeValueType *int `json:"scope_value_type,omitempty"` // 类型: 1: 部门 2:人员 3:国家地区 4:员工类型 5:性别 6:工作城市
+ OperationType *int `json:"operation_type,omitempty"` // 范围类型(是否包含)
+ Right []*ScopeValue `json:"right,omitempty"` // 如果是人员/部门类型 不需要使用该字段
+ MemberIds []string `json:"member_ids,omitempty"` // 部门/人员id列表
+}
+
+type ScopeGroupBuilder struct {
+ scopeValueType int // 类型: 1: 部门 2:人员 3:国家地区 4:员工类型 5:性别 6:工作城市
+ scopeValueTypeFlag bool
+ operationType int // 范围类型(是否包含)
+ operationTypeFlag bool
+ right []*ScopeValue // 如果是人员/部门类型 不需要使用该字段
+ rightFlag bool
+ memberIds []string // 部门/人员id列表
+ memberIdsFlag bool
+}
+
+func NewScopeGroupBuilder() *ScopeGroupBuilder {
+ builder := &ScopeGroupBuilder{}
+ return builder
+}
+
+// 类型: 1: 部门 2:人员 3:国家地区 4:员工类型 5:性别 6:工作城市
+//
+// 示例值:1
+func (builder *ScopeGroupBuilder) ScopeValueType(scopeValueType int) *ScopeGroupBuilder {
+ builder.scopeValueType = scopeValueType
+ builder.scopeValueTypeFlag = true
+ return builder
+}
+
+// 范围类型(是否包含)
+//
+// 示例值:1
+func (builder *ScopeGroupBuilder) OperationType(operationType int) *ScopeGroupBuilder {
+ builder.operationType = operationType
+ builder.operationTypeFlag = true
+ return builder
+}
+
+// 如果是人员/部门类型 不需要使用该字段
+//
+// 示例值:
+func (builder *ScopeGroupBuilder) Right(right []*ScopeValue) *ScopeGroupBuilder {
+ builder.right = right
+ builder.rightFlag = true
+ return builder
+}
+
+// 部门/人员id列表
+//
+// 示例值:
+func (builder *ScopeGroupBuilder) MemberIds(memberIds []string) *ScopeGroupBuilder {
+ builder.memberIds = memberIds
+ builder.memberIdsFlag = true
+ return builder
+}
+
+func (builder *ScopeGroupBuilder) Build() *ScopeGroup {
+ req := &ScopeGroup{}
+ if builder.scopeValueTypeFlag {
+ req.ScopeValueType = &builder.scopeValueType
+
+ }
+ if builder.operationTypeFlag {
+ req.OperationType = &builder.operationType
+
+ }
+ if builder.rightFlag {
+ req.Right = builder.right
+ }
+ if builder.memberIdsFlag {
+ req.MemberIds = builder.memberIds
+ }
+ return req
+}
+
+type ScopeValue struct {
+ Key *string `json:"key,omitempty"` // 标识Key
+ Name *string `json:"name,omitempty"` // 名称
+}
+
+type ScopeValueBuilder struct {
+ key string // 标识Key
+ keyFlag bool
+ name string // 名称
+ nameFlag bool
+}
+
+func NewScopeValueBuilder() *ScopeValueBuilder {
+ builder := &ScopeValueBuilder{}
+ return builder
+}
+
+// 标识Key
+//
+// 示例值:CH
+func (builder *ScopeValueBuilder) Key(key string) *ScopeValueBuilder {
+ builder.key = key
+ builder.keyFlag = true
+ return builder
+}
+
+// 名称
+//
+// 示例值:中国大陆
+func (builder *ScopeValueBuilder) Name(name string) *ScopeValueBuilder {
+ builder.name = name
+ builder.nameFlag = true
+ return builder
+}
+
+func (builder *ScopeValueBuilder) Build() *ScopeValue {
+ req := &ScopeValue{}
+ if builder.keyFlag {
+ req.Key = &builder.key
+
+ }
+ if builder.nameFlag {
+ req.Name = &builder.name
+
}
return req
}
@@ -5921,12 +6918,12 @@ type GetGroupRespData struct {
GroupId *string `json:"group_id,omitempty"` // 考勤组的Id, 需要从获取用户打卡结果信息的接口中获取groupId,修改考勤组时必填
GroupName *string `json:"group_name,omitempty"` // 考勤组名称
TimeZone *string `json:"time_zone,omitempty"` // 考勤组时区
- BindDeptIds []string `json:"bind_dept_ids,omitempty"` //
- ExceptDeptIds []string `json:"except_dept_ids,omitempty"` //
- BindUserIds []string `json:"bind_user_ids,omitempty"` //
- ExceptUserIds []string `json:"except_user_ids,omitempty"` //
- GroupLeaderIds []string `json:"group_leader_ids,omitempty"` //
- SubGroupLeaderIds []string `json:"sub_group_leader_ids,omitempty"` //
+ BindDeptIds []string `json:"bind_dept_ids,omitempty"` // 参加考勤的部门id列表
+ ExceptDeptIds []string `json:"except_dept_ids,omitempty"` // 无需考勤的部门id列表
+ BindUserIds []string `json:"bind_user_ids,omitempty"` // 参加考勤的人员id列表
+ ExceptUserIds []string `json:"except_user_ids,omitempty"` // 参加考勤的人员id列表
+ GroupLeaderIds []string `json:"group_leader_ids,omitempty"` // 考勤组主负责人id列表
+ SubGroupLeaderIds []string `json:"sub_group_leader_ids,omitempty"` // 考勤组子负责人id列表
AllowOutPunch *bool `json:"allow_out_punch,omitempty"` // 是否允许外勤打卡
OutPunchNeedApproval *bool `json:"out_punch_need_approval,omitempty"` // 外勤打卡需审批(需要允许外勤打卡才能设置生效)
OutPunchNeedRemark *bool `json:"out_punch_need_remark,omitempty"` // 外勤打卡需填写备注(需要允许外勤打卡才能设置生效)
@@ -5947,11 +6944,12 @@ type GetGroupRespData struct {
HideStaffPunchTime *bool `json:"hide_staff_punch_time,omitempty"` // 是否隐藏员工打卡详情
FacePunch *bool `json:"face_punch,omitempty"` // 是否开启人脸打卡
FacePunchCfg *int `json:"face_punch_cfg,omitempty"` // 人脸打卡规则, 1:每次打卡均需人脸识别 2:疑似需要
+ FaceLiveNeedAction *bool `json:"face_live_need_action,omitempty"` // 人脸打卡规则, false:开启活体验证 true:0动作验证,仅在 face_punch_cfg = 1 时有效
FaceDowngrade *bool `json:"face_downgrade,omitempty"` // 脸识别失败时允许普通拍照打卡
ReplaceBasicPic *bool `json:"replace_basic_pic,omitempty"` // 是否允许替换基准图片
- Machines []*Machine `json:"machines,omitempty"` //
+ Machines []*Machine `json:"machines,omitempty"` // 考勤机信息
GpsRange *int `json:"gps_range,omitempty"` // GPS打卡的地址范围
- Locations []*Location `json:"locations,omitempty"` //
+ Locations []*Location `json:"locations,omitempty"` // GPS打卡的地址信息
GroupType *int `json:"group_type,omitempty"` // 考勤类型 0:固定考勤 2:排班考勤, 3:自由班次
PunchDayShiftIds []string `json:"punch_day_shift_ids,omitempty"` // 固定班次必需填
FreePunchCfg *FreePunchCfg `json:"free_punch_cfg,omitempty"` //
@@ -5967,6 +6965,15 @@ type GetGroupRespData struct {
MemberEffectTime *string `json:"member_effect_time,omitempty"` // 参加考勤的人员、部门变动生效时间,精确到秒的时间戳
RestClockInNeedApproval *bool `json:"rest_clockIn_need_approval,omitempty"` // 休息日打卡需审批
ClockInNeedPhoto *bool `json:"clockIn_need_photo,omitempty"` // 每次打卡均需拍照
+ MemberStatusChange *MemberStatusChange `json:"member_status_change,omitempty"` // 人员异动打卡设置
+ LeaveNeedPunch *bool `json:"leave_need_punch,omitempty"` // 请假离岗或返岗是否需打卡
+ LeaveNeedPunchCfg *LeaveNeedPunchCfg `json:"leave_need_punch_cfg,omitempty"` // 请假离岗或返岗打卡规则
+ GoOutNeedPunch *int `json:"go_out_need_punch,omitempty"` // 外出期间是否需打卡
+ GoOutNeedPunchCfg *LeaveNeedPunchCfg `json:"go_out_need_punch_cfg,omitempty"` // 外出期间打卡规则
+ TravelNeedPunch *int `json:"travel_need_punch,omitempty"` // 出差期间是否需打卡
+ TravelNeedPunchCfg *LeaveNeedPunchCfg `json:"travel_need_punch_cfg,omitempty"` // 出差期间打卡规则
+ NeedPunchMembers []*PunchMember `json:"need_punch_members,omitempty"` // 需要打卡的人员配置(新)
+ NoNeedPunchMembers []*PunchMember `json:"no_need_punch_members,omitempty"` // 无需打卡的人员配置(新)
}
type GetGroupResp struct {
@@ -6031,8 +7038,8 @@ type ListGroupReq struct {
type ListGroupRespData struct {
GroupList []*GroupMeta `json:"group_list,omitempty"` // 考勤组列表
- PageToken *string `json:"page_token,omitempty"` //
- HasMore *bool `json:"has_more,omitempty"` //
+ PageToken *string `json:"page_token,omitempty"` // 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 page_token
+ HasMore *bool `json:"has_more,omitempty"` // 是否还有更多项
}
type ListGroupResp struct {
@@ -6152,6 +7159,522 @@ func (resp *SearchGroupResp) Success() bool {
return resp.Code == 0
}
+type PatchLeaveAccrualRecordReqBodyBuilder struct {
+ leaveGrantingRecordId string // 授予记录的唯一ID
+ leaveGrantingRecordIdFlag bool
+ employmentId string // 员工ID
+ employmentIdFlag bool
+ leaveTypeId string // 假期类型ID
+ leaveTypeIdFlag bool
+ reason []*LangText // 修改授予记录原因
+ reasonFlag bool
+ timeOffset int // 时间偏移,东八区:480 8*60
+ timeOffsetFlag bool
+ expirationDate string // 失效日期,格式"2020-01-01"
+ expirationDateFlag bool
+ quantity string // 修改source 余额
+ quantityFlag bool
+}
+
+func NewPatchLeaveAccrualRecordReqBodyBuilder() *PatchLeaveAccrualRecordReqBodyBuilder {
+ builder := &PatchLeaveAccrualRecordReqBodyBuilder{}
+ return builder
+}
+
+// 授予记录的唯一ID
+//
+//示例值:1
+func (builder *PatchLeaveAccrualRecordReqBodyBuilder) LeaveGrantingRecordId(leaveGrantingRecordId string) *PatchLeaveAccrualRecordReqBodyBuilder {
+ builder.leaveGrantingRecordId = leaveGrantingRecordId
+ builder.leaveGrantingRecordIdFlag = true
+ return builder
+}
+
+// 员工ID
+//
+//示例值:1
+func (builder *PatchLeaveAccrualRecordReqBodyBuilder) EmploymentId(employmentId string) *PatchLeaveAccrualRecordReqBodyBuilder {
+ builder.employmentId = employmentId
+ builder.employmentIdFlag = true
+ return builder
+}
+
+// 假期类型ID
+//
+//示例值:1
+func (builder *PatchLeaveAccrualRecordReqBodyBuilder) LeaveTypeId(leaveTypeId string) *PatchLeaveAccrualRecordReqBodyBuilder {
+ builder.leaveTypeId = leaveTypeId
+ builder.leaveTypeIdFlag = true
+ return builder
+}
+
+// 修改授予记录原因
+//
+//示例值:
+func (builder *PatchLeaveAccrualRecordReqBodyBuilder) Reason(reason []*LangText) *PatchLeaveAccrualRecordReqBodyBuilder {
+ builder.reason = reason
+ builder.reasonFlag = true
+ return builder
+}
+
+// 时间偏移,东八区:480 8*60
+//
+//示例值:480
+func (builder *PatchLeaveAccrualRecordReqBodyBuilder) TimeOffset(timeOffset int) *PatchLeaveAccrualRecordReqBodyBuilder {
+ builder.timeOffset = timeOffset
+ builder.timeOffsetFlag = true
+ return builder
+}
+
+// 失效日期,格式"2020-01-01"
+//
+//示例值:2020-01-01
+func (builder *PatchLeaveAccrualRecordReqBodyBuilder) ExpirationDate(expirationDate string) *PatchLeaveAccrualRecordReqBodyBuilder {
+ builder.expirationDate = expirationDate
+ builder.expirationDateFlag = true
+ return builder
+}
+
+// 修改source 余额
+//
+//示例值:1
+func (builder *PatchLeaveAccrualRecordReqBodyBuilder) Quantity(quantity string) *PatchLeaveAccrualRecordReqBodyBuilder {
+ builder.quantity = quantity
+ builder.quantityFlag = true
+ return builder
+}
+
+func (builder *PatchLeaveAccrualRecordReqBodyBuilder) Build() *PatchLeaveAccrualRecordReqBody {
+ req := &PatchLeaveAccrualRecordReqBody{}
+ if builder.leaveGrantingRecordIdFlag {
+ req.LeaveGrantingRecordId = &builder.leaveGrantingRecordId
+ }
+ if builder.employmentIdFlag {
+ req.EmploymentId = &builder.employmentId
+ }
+ if builder.leaveTypeIdFlag {
+ req.LeaveTypeId = &builder.leaveTypeId
+ }
+ if builder.reasonFlag {
+ req.Reason = builder.reason
+ }
+ if builder.timeOffsetFlag {
+ req.TimeOffset = &builder.timeOffset
+ }
+ if builder.expirationDateFlag {
+ req.ExpirationDate = &builder.expirationDate
+ }
+ if builder.quantityFlag {
+ req.Quantity = &builder.quantity
+ }
+ return req
+}
+
+type PatchLeaveAccrualRecordPathReqBodyBuilder struct {
+ leaveGrantingRecordId string // 授予记录的唯一ID
+ leaveGrantingRecordIdFlag bool
+ employmentId string // 员工ID
+ employmentIdFlag bool
+ leaveTypeId string // 假期类型ID
+ leaveTypeIdFlag bool
+ reason []*LangText // 修改授予记录原因
+ reasonFlag bool
+ timeOffset int // 时间偏移,东八区:480 8*60
+ timeOffsetFlag bool
+ expirationDate string // 失效日期,格式"2020-01-01"
+ expirationDateFlag bool
+ quantity string // 修改source 余额
+ quantityFlag bool
+}
+
+func NewPatchLeaveAccrualRecordPathReqBodyBuilder() *PatchLeaveAccrualRecordPathReqBodyBuilder {
+ builder := &PatchLeaveAccrualRecordPathReqBodyBuilder{}
+ return builder
+}
+
+// 授予记录的唯一ID
+//
+// 示例值:1
+func (builder *PatchLeaveAccrualRecordPathReqBodyBuilder) LeaveGrantingRecordId(leaveGrantingRecordId string) *PatchLeaveAccrualRecordPathReqBodyBuilder {
+ builder.leaveGrantingRecordId = leaveGrantingRecordId
+ builder.leaveGrantingRecordIdFlag = true
+ return builder
+}
+
+// 员工ID
+//
+// 示例值:1
+func (builder *PatchLeaveAccrualRecordPathReqBodyBuilder) EmploymentId(employmentId string) *PatchLeaveAccrualRecordPathReqBodyBuilder {
+ builder.employmentId = employmentId
+ builder.employmentIdFlag = true
+ return builder
+}
+
+// 假期类型ID
+//
+// 示例值:1
+func (builder *PatchLeaveAccrualRecordPathReqBodyBuilder) LeaveTypeId(leaveTypeId string) *PatchLeaveAccrualRecordPathReqBodyBuilder {
+ builder.leaveTypeId = leaveTypeId
+ builder.leaveTypeIdFlag = true
+ return builder
+}
+
+// 修改授予记录原因
+//
+// 示例值:
+func (builder *PatchLeaveAccrualRecordPathReqBodyBuilder) Reason(reason []*LangText) *PatchLeaveAccrualRecordPathReqBodyBuilder {
+ builder.reason = reason
+ builder.reasonFlag = true
+ return builder
+}
+
+// 时间偏移,东八区:480 8*60
+//
+// 示例值:480
+func (builder *PatchLeaveAccrualRecordPathReqBodyBuilder) TimeOffset(timeOffset int) *PatchLeaveAccrualRecordPathReqBodyBuilder {
+ builder.timeOffset = timeOffset
+ builder.timeOffsetFlag = true
+ return builder
+}
+
+// 失效日期,格式"2020-01-01"
+//
+// 示例值:2020-01-01
+func (builder *PatchLeaveAccrualRecordPathReqBodyBuilder) ExpirationDate(expirationDate string) *PatchLeaveAccrualRecordPathReqBodyBuilder {
+ builder.expirationDate = expirationDate
+ builder.expirationDateFlag = true
+ return builder
+}
+
+// 修改source 余额
+//
+// 示例值:1
+func (builder *PatchLeaveAccrualRecordPathReqBodyBuilder) Quantity(quantity string) *PatchLeaveAccrualRecordPathReqBodyBuilder {
+ builder.quantity = quantity
+ builder.quantityFlag = true
+ return builder
+}
+
+func (builder *PatchLeaveAccrualRecordPathReqBodyBuilder) Build() (*PatchLeaveAccrualRecordReqBody, error) {
+ req := &PatchLeaveAccrualRecordReqBody{}
+ if builder.leaveGrantingRecordIdFlag {
+ req.LeaveGrantingRecordId = &builder.leaveGrantingRecordId
+ }
+ if builder.employmentIdFlag {
+ req.EmploymentId = &builder.employmentId
+ }
+ if builder.leaveTypeIdFlag {
+ req.LeaveTypeId = &builder.leaveTypeId
+ }
+ if builder.reasonFlag {
+ req.Reason = builder.reason
+ }
+ if builder.timeOffsetFlag {
+ req.TimeOffset = &builder.timeOffset
+ }
+ if builder.expirationDateFlag {
+ req.ExpirationDate = &builder.expirationDate
+ }
+ if builder.quantityFlag {
+ req.Quantity = &builder.quantity
+ }
+ return req, nil
+}
+
+type PatchLeaveAccrualRecordReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *PatchLeaveAccrualRecordReqBody
+}
+
+func NewPatchLeaveAccrualRecordReqBuilder() *PatchLeaveAccrualRecordReqBuilder {
+ builder := &PatchLeaveAccrualRecordReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 假期类型ID
+//
+// 示例值:1
+func (builder *PatchLeaveAccrualRecordReqBuilder) LeaveId(leaveId string) *PatchLeaveAccrualRecordReqBuilder {
+ builder.apiReq.PathParams.Set("leave_id", fmt.Sprint(leaveId))
+ return builder
+}
+
+//
+func (builder *PatchLeaveAccrualRecordReqBuilder) Body(body *PatchLeaveAccrualRecordReqBody) *PatchLeaveAccrualRecordReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *PatchLeaveAccrualRecordReqBuilder) Build() *PatchLeaveAccrualRecordReq {
+ req := &PatchLeaveAccrualRecordReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type PatchLeaveAccrualRecordReqBody struct {
+ LeaveGrantingRecordId *string `json:"leave_granting_record_id,omitempty"` // 授予记录的唯一ID
+ EmploymentId *string `json:"employment_id,omitempty"` // 员工ID
+ LeaveTypeId *string `json:"leave_type_id,omitempty"` // 假期类型ID
+ Reason []*LangText `json:"reason,omitempty"` // 修改授予记录原因
+ TimeOffset *int `json:"time_offset,omitempty"` // 时间偏移,东八区:480 8*60
+ ExpirationDate *string `json:"expiration_date,omitempty"` // 失效日期,格式"2020-01-01"
+ Quantity *string `json:"quantity,omitempty"` // 修改source 余额
+}
+
+type PatchLeaveAccrualRecordReq struct {
+ apiReq *larkcore.ApiReq
+ Body *PatchLeaveAccrualRecordReqBody `body:""`
+}
+
+type PatchLeaveAccrualRecordRespData struct {
+ Record *LeaveAccrualRecord `json:"record,omitempty"` // 员工过期日期的授予记录
+}
+
+type PatchLeaveAccrualRecordResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *PatchLeaveAccrualRecordRespData `json:"data"` // 业务数据
+}
+
+func (resp *PatchLeaveAccrualRecordResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetLeaveEmployExpireRecordReqBodyBuilder struct {
+ employmentId string // 员工ID
+ employmentIdFlag bool
+ leaveTypeId string // 假期类型ID
+ leaveTypeIdFlag bool
+ startExpirationDate string // 失效最早日期 2023-04-10 格式
+ startExpirationDateFlag bool
+ endExpirationDate string // 失效最晚日期 2023-05-10 格式
+ endExpirationDateFlag bool
+ timeOffset int // 时间偏移,东八区:480 8*60, 如果没有这个参数,默认东八区
+ timeOffsetFlag bool
+}
+
+func NewGetLeaveEmployExpireRecordReqBodyBuilder() *GetLeaveEmployExpireRecordReqBodyBuilder {
+ builder := &GetLeaveEmployExpireRecordReqBodyBuilder{}
+ return builder
+}
+
+// 员工ID
+//
+//示例值:1
+func (builder *GetLeaveEmployExpireRecordReqBodyBuilder) EmploymentId(employmentId string) *GetLeaveEmployExpireRecordReqBodyBuilder {
+ builder.employmentId = employmentId
+ builder.employmentIdFlag = true
+ return builder
+}
+
+// 假期类型ID
+//
+//示例值:1
+func (builder *GetLeaveEmployExpireRecordReqBodyBuilder) LeaveTypeId(leaveTypeId string) *GetLeaveEmployExpireRecordReqBodyBuilder {
+ builder.leaveTypeId = leaveTypeId
+ builder.leaveTypeIdFlag = true
+ return builder
+}
+
+// 失效最早日期 2023-04-10 格式
+//
+//示例值:2023-04-10
+func (builder *GetLeaveEmployExpireRecordReqBodyBuilder) StartExpirationDate(startExpirationDate string) *GetLeaveEmployExpireRecordReqBodyBuilder {
+ builder.startExpirationDate = startExpirationDate
+ builder.startExpirationDateFlag = true
+ return builder
+}
+
+// 失效最晚日期 2023-05-10 格式
+//
+//示例值:2023-05-10
+func (builder *GetLeaveEmployExpireRecordReqBodyBuilder) EndExpirationDate(endExpirationDate string) *GetLeaveEmployExpireRecordReqBodyBuilder {
+ builder.endExpirationDate = endExpirationDate
+ builder.endExpirationDateFlag = true
+ return builder
+}
+
+// 时间偏移,东八区:480 8*60, 如果没有这个参数,默认东八区
+//
+//示例值:480
+func (builder *GetLeaveEmployExpireRecordReqBodyBuilder) TimeOffset(timeOffset int) *GetLeaveEmployExpireRecordReqBodyBuilder {
+ builder.timeOffset = timeOffset
+ builder.timeOffsetFlag = true
+ return builder
+}
+
+func (builder *GetLeaveEmployExpireRecordReqBodyBuilder) Build() *GetLeaveEmployExpireRecordReqBody {
+ req := &GetLeaveEmployExpireRecordReqBody{}
+ if builder.employmentIdFlag {
+ req.EmploymentId = &builder.employmentId
+ }
+ if builder.leaveTypeIdFlag {
+ req.LeaveTypeId = &builder.leaveTypeId
+ }
+ if builder.startExpirationDateFlag {
+ req.StartExpirationDate = &builder.startExpirationDate
+ }
+ if builder.endExpirationDateFlag {
+ req.EndExpirationDate = &builder.endExpirationDate
+ }
+ if builder.timeOffsetFlag {
+ req.TimeOffset = &builder.timeOffset
+ }
+ return req
+}
+
+type GetLeaveEmployExpireRecordPathReqBodyBuilder struct {
+ employmentId string // 员工ID
+ employmentIdFlag bool
+ leaveTypeId string // 假期类型ID
+ leaveTypeIdFlag bool
+ startExpirationDate string // 失效最早日期 2023-04-10 格式
+ startExpirationDateFlag bool
+ endExpirationDate string // 失效最晚日期 2023-05-10 格式
+ endExpirationDateFlag bool
+ timeOffset int // 时间偏移,东八区:480 8*60, 如果没有这个参数,默认东八区
+ timeOffsetFlag bool
+}
+
+func NewGetLeaveEmployExpireRecordPathReqBodyBuilder() *GetLeaveEmployExpireRecordPathReqBodyBuilder {
+ builder := &GetLeaveEmployExpireRecordPathReqBodyBuilder{}
+ return builder
+}
+
+// 员工ID
+//
+// 示例值:1
+func (builder *GetLeaveEmployExpireRecordPathReqBodyBuilder) EmploymentId(employmentId string) *GetLeaveEmployExpireRecordPathReqBodyBuilder {
+ builder.employmentId = employmentId
+ builder.employmentIdFlag = true
+ return builder
+}
+
+// 假期类型ID
+//
+// 示例值:1
+func (builder *GetLeaveEmployExpireRecordPathReqBodyBuilder) LeaveTypeId(leaveTypeId string) *GetLeaveEmployExpireRecordPathReqBodyBuilder {
+ builder.leaveTypeId = leaveTypeId
+ builder.leaveTypeIdFlag = true
+ return builder
+}
+
+// 失效最早日期 2023-04-10 格式
+//
+// 示例值:2023-04-10
+func (builder *GetLeaveEmployExpireRecordPathReqBodyBuilder) StartExpirationDate(startExpirationDate string) *GetLeaveEmployExpireRecordPathReqBodyBuilder {
+ builder.startExpirationDate = startExpirationDate
+ builder.startExpirationDateFlag = true
+ return builder
+}
+
+// 失效最晚日期 2023-05-10 格式
+//
+// 示例值:2023-05-10
+func (builder *GetLeaveEmployExpireRecordPathReqBodyBuilder) EndExpirationDate(endExpirationDate string) *GetLeaveEmployExpireRecordPathReqBodyBuilder {
+ builder.endExpirationDate = endExpirationDate
+ builder.endExpirationDateFlag = true
+ return builder
+}
+
+// 时间偏移,东八区:480 8*60, 如果没有这个参数,默认东八区
+//
+// 示例值:480
+func (builder *GetLeaveEmployExpireRecordPathReqBodyBuilder) TimeOffset(timeOffset int) *GetLeaveEmployExpireRecordPathReqBodyBuilder {
+ builder.timeOffset = timeOffset
+ builder.timeOffsetFlag = true
+ return builder
+}
+
+func (builder *GetLeaveEmployExpireRecordPathReqBodyBuilder) Build() (*GetLeaveEmployExpireRecordReqBody, error) {
+ req := &GetLeaveEmployExpireRecordReqBody{}
+ if builder.employmentIdFlag {
+ req.EmploymentId = &builder.employmentId
+ }
+ if builder.leaveTypeIdFlag {
+ req.LeaveTypeId = &builder.leaveTypeId
+ }
+ if builder.startExpirationDateFlag {
+ req.StartExpirationDate = &builder.startExpirationDate
+ }
+ if builder.endExpirationDateFlag {
+ req.EndExpirationDate = &builder.endExpirationDate
+ }
+ if builder.timeOffsetFlag {
+ req.TimeOffset = &builder.timeOffset
+ }
+ return req, nil
+}
+
+type GetLeaveEmployExpireRecordReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *GetLeaveEmployExpireRecordReqBody
+}
+
+func NewGetLeaveEmployExpireRecordReqBuilder() *GetLeaveEmployExpireRecordReqBuilder {
+ builder := &GetLeaveEmployExpireRecordReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 假期类型ID
+//
+// 示例值:1
+func (builder *GetLeaveEmployExpireRecordReqBuilder) LeaveId(leaveId string) *GetLeaveEmployExpireRecordReqBuilder {
+ builder.apiReq.PathParams.Set("leave_id", fmt.Sprint(leaveId))
+ return builder
+}
+
+//
+func (builder *GetLeaveEmployExpireRecordReqBuilder) Body(body *GetLeaveEmployExpireRecordReqBody) *GetLeaveEmployExpireRecordReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *GetLeaveEmployExpireRecordReqBuilder) Build() *GetLeaveEmployExpireRecordReq {
+ req := &GetLeaveEmployExpireRecordReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type GetLeaveEmployExpireRecordReqBody struct {
+ EmploymentId *string `json:"employment_id,omitempty"` // 员工ID
+ LeaveTypeId *string `json:"leave_type_id,omitempty"` // 假期类型ID
+ StartExpirationDate *string `json:"start_expiration_date,omitempty"` // 失效最早日期 2023-04-10 格式
+ EndExpirationDate *string `json:"end_expiration_date,omitempty"` // 失效最晚日期 2023-05-10 格式
+ TimeOffset *int `json:"time_offset,omitempty"` // 时间偏移,东八区:480 8*60, 如果没有这个参数,默认东八区
+}
+
+type GetLeaveEmployExpireRecordReq struct {
+ apiReq *larkcore.ApiReq
+ Body *GetLeaveEmployExpireRecordReqBody `body:""`
+}
+
+type GetLeaveEmployExpireRecordRespData struct {
+ Records []*LeaveEmployExpireRecord `json:"records,omitempty"` // 员工过期日期的授予记录
+}
+
+type GetLeaveEmployExpireRecordResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetLeaveEmployExpireRecordRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetLeaveEmployExpireRecordResp) Success() bool {
+ return resp.Code == 0
+}
+
type CreateShiftReqBuilder struct {
apiReq *larkcore.ApiReq
shift *Shift
@@ -8018,7 +9541,8 @@ type QueryUserStatsDataReq struct {
}
type QueryUserStatsDataRespData struct {
- UserDatas []*UserStatsData `json:"user_datas,omitempty"` // 用户统计数据(限制1000条,超过1000条会截断)
+ UserDatas []*UserStatsData `json:"user_datas,omitempty"` // 用户统计数据(限制1000条,超过1000条会截断)
+ InvalidUserList []string `json:"invalid_user_list,omitempty"` // 无权限获取的用户列表
}
type QueryUserStatsDataResp struct {
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/auth/v3/api.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/auth/v3/api.go
new file mode 100644
index 0000000000..12a8ea5ef9
--- /dev/null
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/auth/v3/api.go
@@ -0,0 +1,176 @@
+// Package auth code generated by oapi sdk gen
+/*
+ * MIT License
+ *
+ * Copyright (c) 2022 Lark Technologies Pte. Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package larkauth
+
+import (
+ "context"
+ "net/http"
+
+ "github.com/larksuite/oapi-sdk-go/v3/core"
+)
+
+func NewService(config *larkcore.Config) *AuthService {
+ a := &AuthService{config: config}
+ a.AppAccessToken = &appAccessToken{service: a}
+ a.AppTicket = &appTicket{service: a}
+ a.TenantAccessToken = &tenantAccessToken{service: a}
+ return a
+}
+
+type AuthService struct {
+ config *larkcore.Config
+ AppAccessToken *appAccessToken // app_access_token
+ AppTicket *appTicket // app_ticket
+ TenantAccessToken *tenantAccessToken // tenant_access_token
+}
+
+type appAccessToken struct {
+ service *AuthService
+}
+type appTicket struct {
+ service *AuthService
+}
+type tenantAccessToken struct {
+ service *AuthService
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=auth&resource=app_access_token&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/authv3/create_appAccessToken.go
+func (a *appAccessToken) Create(ctx context.Context, req *CreateAppAccessTokenReq, options ...larkcore.RequestOptionFunc) (*CreateAppAccessTokenResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/auth/v3/app_access_token"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{}
+ apiResp, err := larkcore.Request(ctx, apiReq, a.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateAppAccessTokenResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, a.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=internal&project=auth&resource=app_access_token&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/authv3/internal_appAccessToken.go
+func (a *appAccessToken) Internal(ctx context.Context, req *InternalAppAccessTokenReq, options ...larkcore.RequestOptionFunc) (*InternalAppAccessTokenResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/auth/v3/app_access_token/internal"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{}
+ apiResp, err := larkcore.Request(ctx, apiReq, a.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &InternalAppAccessTokenResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, a.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=resend&project=auth&resource=app_ticket&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/authv3/resend_appTicket.go
+func (a *appTicket) Resend(ctx context.Context, req *ResendAppTicketReq, options ...larkcore.RequestOptionFunc) (*ResendAppTicketResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/auth/v3/app_ticket/resend"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{}
+ apiResp, err := larkcore.Request(ctx, apiReq, a.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ResendAppTicketResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, a.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=auth&resource=tenant_access_token&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/authv3/create_tenantAccessToken.go
+func (t *tenantAccessToken) Create(ctx context.Context, req *CreateTenantAccessTokenReq, options ...larkcore.RequestOptionFunc) (*CreateTenantAccessTokenResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/auth/v3/tenant_access_token"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{}
+ apiResp, err := larkcore.Request(ctx, apiReq, t.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateTenantAccessTokenResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, t.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=internal&project=auth&resource=tenant_access_token&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/authv3/internal_tenantAccessToken.go
+func (t *tenantAccessToken) Internal(ctx context.Context, req *InternalTenantAccessTokenReq, options ...larkcore.RequestOptionFunc) (*InternalTenantAccessTokenResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/auth/v3/tenant_access_token/internal"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{}
+ apiResp, err := larkcore.Request(ctx, apiReq, t.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &InternalTenantAccessTokenResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, t.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/auth/v3/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/auth/v3/model.go
new file mode 100644
index 0000000000..8691fb05e7
--- /dev/null
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/auth/v3/model.go
@@ -0,0 +1,696 @@
+// Package auth code generated by oapi sdk gen
+/*
+ * MIT License
+ *
+ * Copyright (c) 2022 Lark Technologies Pte. Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package larkauth
+
+import (
+ "github.com/larksuite/oapi-sdk-go/v3/core"
+)
+
+type AppAccessToken struct {
+}
+
+type AppTicket struct {
+}
+
+type TenantAccessToken struct {
+}
+
+type CreateAppAccessTokenReqBodyBuilder struct {
+ appId string // 应用唯一标识,创建应用后获得。有关app_id 的详细介绍。
+ appIdFlag bool
+ appSecret string // 应用秘钥,创建应用后获得。
+ appSecretFlag bool
+ appTicket string // 平台定时推送给应用的临时凭证,通过事件监听机制获得。
+ appTicketFlag bool
+}
+
+func NewCreateAppAccessTokenReqBodyBuilder() *CreateAppAccessTokenReqBodyBuilder {
+ builder := &CreateAppAccessTokenReqBodyBuilder{}
+ return builder
+}
+
+// 应用唯一标识,创建应用后获得。有关app_id 的详细介绍。
+//
+//示例值:cli_ddfgkk38emd38
+func (builder *CreateAppAccessTokenReqBodyBuilder) AppId(appId string) *CreateAppAccessTokenReqBodyBuilder {
+ builder.appId = appId
+ builder.appIdFlag = true
+ return builder
+}
+
+// 应用秘钥,创建应用后获得。
+//
+//示例值:clkfgkfdjes384kjdf9830d3k
+func (builder *CreateAppAccessTokenReqBodyBuilder) AppSecret(appSecret string) *CreateAppAccessTokenReqBodyBuilder {
+ builder.appSecret = appSecret
+ builder.appSecretFlag = true
+ return builder
+}
+
+// 平台定时推送给应用的临时凭证,通过事件监听机制获得。
+//
+//示例值:jdjlsd03jk34hj3kldjflcmkel
+func (builder *CreateAppAccessTokenReqBodyBuilder) AppTicket(appTicket string) *CreateAppAccessTokenReqBodyBuilder {
+ builder.appTicket = appTicket
+ builder.appTicketFlag = true
+ return builder
+}
+
+func (builder *CreateAppAccessTokenReqBodyBuilder) Build() *CreateAppAccessTokenReqBody {
+ req := &CreateAppAccessTokenReqBody{}
+ if builder.appIdFlag {
+ req.AppId = &builder.appId
+ }
+ if builder.appSecretFlag {
+ req.AppSecret = &builder.appSecret
+ }
+ if builder.appTicketFlag {
+ req.AppTicket = &builder.appTicket
+ }
+ return req
+}
+
+type CreateAppAccessTokenPathReqBodyBuilder struct {
+ appId string // 应用唯一标识,创建应用后获得。有关app_id 的详细介绍。
+ appIdFlag bool
+ appSecret string // 应用秘钥,创建应用后获得。
+ appSecretFlag bool
+ appTicket string // 平台定时推送给应用的临时凭证,通过事件监听机制获得。
+ appTicketFlag bool
+}
+
+func NewCreateAppAccessTokenPathReqBodyBuilder() *CreateAppAccessTokenPathReqBodyBuilder {
+ builder := &CreateAppAccessTokenPathReqBodyBuilder{}
+ return builder
+}
+
+// 应用唯一标识,创建应用后获得。有关app_id 的详细介绍。
+//
+// 示例值:cli_ddfgkk38emd38
+func (builder *CreateAppAccessTokenPathReqBodyBuilder) AppId(appId string) *CreateAppAccessTokenPathReqBodyBuilder {
+ builder.appId = appId
+ builder.appIdFlag = true
+ return builder
+}
+
+// 应用秘钥,创建应用后获得。
+//
+// 示例值:clkfgkfdjes384kjdf9830d3k
+func (builder *CreateAppAccessTokenPathReqBodyBuilder) AppSecret(appSecret string) *CreateAppAccessTokenPathReqBodyBuilder {
+ builder.appSecret = appSecret
+ builder.appSecretFlag = true
+ return builder
+}
+
+// 平台定时推送给应用的临时凭证,通过事件监听机制获得。
+//
+// 示例值:jdjlsd03jk34hj3kldjflcmkel
+func (builder *CreateAppAccessTokenPathReqBodyBuilder) AppTicket(appTicket string) *CreateAppAccessTokenPathReqBodyBuilder {
+ builder.appTicket = appTicket
+ builder.appTicketFlag = true
+ return builder
+}
+
+func (builder *CreateAppAccessTokenPathReqBodyBuilder) Build() (*CreateAppAccessTokenReqBody, error) {
+ req := &CreateAppAccessTokenReqBody{}
+ if builder.appIdFlag {
+ req.AppId = &builder.appId
+ }
+ if builder.appSecretFlag {
+ req.AppSecret = &builder.appSecret
+ }
+ if builder.appTicketFlag {
+ req.AppTicket = &builder.appTicket
+ }
+ return req, nil
+}
+
+type CreateAppAccessTokenReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *CreateAppAccessTokenReqBody
+}
+
+func NewCreateAppAccessTokenReqBuilder() *CreateAppAccessTokenReqBuilder {
+ builder := &CreateAppAccessTokenReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+//
+func (builder *CreateAppAccessTokenReqBuilder) Body(body *CreateAppAccessTokenReqBody) *CreateAppAccessTokenReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *CreateAppAccessTokenReqBuilder) Build() *CreateAppAccessTokenReq {
+ req := &CreateAppAccessTokenReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type CreateAppAccessTokenReqBody struct {
+ AppId *string `json:"app_id,omitempty"` // 应用唯一标识,创建应用后获得。有关app_id 的详细介绍。
+ AppSecret *string `json:"app_secret,omitempty"` // 应用秘钥,创建应用后获得。
+ AppTicket *string `json:"app_ticket,omitempty"` // 平台定时推送给应用的临时凭证,通过事件监听机制获得。
+}
+
+type CreateAppAccessTokenReq struct {
+ apiReq *larkcore.ApiReq
+ Body *CreateAppAccessTokenReqBody `body:""`
+}
+
+type CreateAppAccessTokenResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *CreateAppAccessTokenResp) Success() bool {
+ return resp.Code == 0
+}
+
+type InternalAppAccessTokenReqBodyBuilder struct {
+ appId string // 应用唯一标识,创建应用后获得。
+ appIdFlag bool
+ appSecret string // 应用秘钥,创建应用后获得。
+ appSecretFlag bool
+}
+
+func NewInternalAppAccessTokenReqBodyBuilder() *InternalAppAccessTokenReqBodyBuilder {
+ builder := &InternalAppAccessTokenReqBodyBuilder{}
+ return builder
+}
+
+// 应用唯一标识,创建应用后获得。
+//
+//示例值:cli_hsjeriogfkd93jf84
+func (builder *InternalAppAccessTokenReqBodyBuilder) AppId(appId string) *InternalAppAccessTokenReqBodyBuilder {
+ builder.appId = appId
+ builder.appIdFlag = true
+ return builder
+}
+
+// 应用秘钥,创建应用后获得。
+//
+//示例值:jdsfslkjdg8e73hdf9237enbd
+func (builder *InternalAppAccessTokenReqBodyBuilder) AppSecret(appSecret string) *InternalAppAccessTokenReqBodyBuilder {
+ builder.appSecret = appSecret
+ builder.appSecretFlag = true
+ return builder
+}
+
+func (builder *InternalAppAccessTokenReqBodyBuilder) Build() *InternalAppAccessTokenReqBody {
+ req := &InternalAppAccessTokenReqBody{}
+ if builder.appIdFlag {
+ req.AppId = &builder.appId
+ }
+ if builder.appSecretFlag {
+ req.AppSecret = &builder.appSecret
+ }
+ return req
+}
+
+type InternalAppAccessTokenPathReqBodyBuilder struct {
+ appId string // 应用唯一标识,创建应用后获得。
+ appIdFlag bool
+ appSecret string // 应用秘钥,创建应用后获得。
+ appSecretFlag bool
+}
+
+func NewInternalAppAccessTokenPathReqBodyBuilder() *InternalAppAccessTokenPathReqBodyBuilder {
+ builder := &InternalAppAccessTokenPathReqBodyBuilder{}
+ return builder
+}
+
+// 应用唯一标识,创建应用后获得。
+//
+// 示例值:cli_hsjeriogfkd93jf84
+func (builder *InternalAppAccessTokenPathReqBodyBuilder) AppId(appId string) *InternalAppAccessTokenPathReqBodyBuilder {
+ builder.appId = appId
+ builder.appIdFlag = true
+ return builder
+}
+
+// 应用秘钥,创建应用后获得。
+//
+// 示例值:jdsfslkjdg8e73hdf9237enbd
+func (builder *InternalAppAccessTokenPathReqBodyBuilder) AppSecret(appSecret string) *InternalAppAccessTokenPathReqBodyBuilder {
+ builder.appSecret = appSecret
+ builder.appSecretFlag = true
+ return builder
+}
+
+func (builder *InternalAppAccessTokenPathReqBodyBuilder) Build() (*InternalAppAccessTokenReqBody, error) {
+ req := &InternalAppAccessTokenReqBody{}
+ if builder.appIdFlag {
+ req.AppId = &builder.appId
+ }
+ if builder.appSecretFlag {
+ req.AppSecret = &builder.appSecret
+ }
+ return req, nil
+}
+
+type InternalAppAccessTokenReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *InternalAppAccessTokenReqBody
+}
+
+func NewInternalAppAccessTokenReqBuilder() *InternalAppAccessTokenReqBuilder {
+ builder := &InternalAppAccessTokenReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+//
+func (builder *InternalAppAccessTokenReqBuilder) Body(body *InternalAppAccessTokenReqBody) *InternalAppAccessTokenReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *InternalAppAccessTokenReqBuilder) Build() *InternalAppAccessTokenReq {
+ req := &InternalAppAccessTokenReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type InternalAppAccessTokenReqBody struct {
+ AppId *string `json:"app_id,omitempty"` // 应用唯一标识,创建应用后获得。
+ AppSecret *string `json:"app_secret,omitempty"` // 应用秘钥,创建应用后获得。
+}
+
+type InternalAppAccessTokenReq struct {
+ apiReq *larkcore.ApiReq
+ Body *InternalAppAccessTokenReqBody `body:""`
+}
+
+type InternalAppAccessTokenResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *InternalAppAccessTokenResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ResendAppTicketReqBodyBuilder struct {
+ appId string // 应用唯一标识,创建应用后获得
+ appIdFlag bool
+ appSecret string // 应用秘钥,创建应用后获得
+ appSecretFlag bool
+}
+
+func NewResendAppTicketReqBodyBuilder() *ResendAppTicketReqBodyBuilder {
+ builder := &ResendAppTicketReqBodyBuilder{}
+ return builder
+}
+
+// 应用唯一标识,创建应用后获得
+//
+//示例值:cli_slkdjalasdkjasd
+func (builder *ResendAppTicketReqBodyBuilder) AppId(appId string) *ResendAppTicketReqBodyBuilder {
+ builder.appId = appId
+ builder.appIdFlag = true
+ return builder
+}
+
+// 应用秘钥,创建应用后获得
+//
+//示例值:dskLLdkasdjlasdKK
+func (builder *ResendAppTicketReqBodyBuilder) AppSecret(appSecret string) *ResendAppTicketReqBodyBuilder {
+ builder.appSecret = appSecret
+ builder.appSecretFlag = true
+ return builder
+}
+
+func (builder *ResendAppTicketReqBodyBuilder) Build() *ResendAppTicketReqBody {
+ req := &ResendAppTicketReqBody{}
+ if builder.appIdFlag {
+ req.AppId = &builder.appId
+ }
+ if builder.appSecretFlag {
+ req.AppSecret = &builder.appSecret
+ }
+ return req
+}
+
+type ResendAppTicketPathReqBodyBuilder struct {
+ appId string // 应用唯一标识,创建应用后获得
+ appIdFlag bool
+ appSecret string // 应用秘钥,创建应用后获得
+ appSecretFlag bool
+}
+
+func NewResendAppTicketPathReqBodyBuilder() *ResendAppTicketPathReqBodyBuilder {
+ builder := &ResendAppTicketPathReqBodyBuilder{}
+ return builder
+}
+
+// 应用唯一标识,创建应用后获得
+//
+// 示例值:cli_slkdjalasdkjasd
+func (builder *ResendAppTicketPathReqBodyBuilder) AppId(appId string) *ResendAppTicketPathReqBodyBuilder {
+ builder.appId = appId
+ builder.appIdFlag = true
+ return builder
+}
+
+// 应用秘钥,创建应用后获得
+//
+// 示例值:dskLLdkasdjlasdKK
+func (builder *ResendAppTicketPathReqBodyBuilder) AppSecret(appSecret string) *ResendAppTicketPathReqBodyBuilder {
+ builder.appSecret = appSecret
+ builder.appSecretFlag = true
+ return builder
+}
+
+func (builder *ResendAppTicketPathReqBodyBuilder) Build() (*ResendAppTicketReqBody, error) {
+ req := &ResendAppTicketReqBody{}
+ if builder.appIdFlag {
+ req.AppId = &builder.appId
+ }
+ if builder.appSecretFlag {
+ req.AppSecret = &builder.appSecret
+ }
+ return req, nil
+}
+
+type ResendAppTicketReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *ResendAppTicketReqBody
+}
+
+func NewResendAppTicketReqBuilder() *ResendAppTicketReqBuilder {
+ builder := &ResendAppTicketReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+//
+func (builder *ResendAppTicketReqBuilder) Body(body *ResendAppTicketReqBody) *ResendAppTicketReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *ResendAppTicketReqBuilder) Build() *ResendAppTicketReq {
+ req := &ResendAppTicketReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type ResendAppTicketReqBody struct {
+ AppId *string `json:"app_id,omitempty"` // 应用唯一标识,创建应用后获得
+ AppSecret *string `json:"app_secret,omitempty"` // 应用秘钥,创建应用后获得
+}
+
+type ResendAppTicketReq struct {
+ apiReq *larkcore.ApiReq
+ Body *ResendAppTicketReqBody `body:""`
+}
+
+type ResendAppTicketResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *ResendAppTicketResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateTenantAccessTokenReqBodyBuilder struct {
+ appAccessToken string // 应用访问凭证,通过商店应用获取 app_access_token接口获取。
+ appAccessTokenFlag bool
+ tenantKey string // 租户在飞书上的唯一标识,也可以理解为企业标识可以通过如下方式获取: 业开通应用时,开放平台推送给应用,具体可参考【首次启用应用】事件; 用户登录到小程序、H5 应用或者浏览器应用时,在用户的身份信息中获取。
+ tenantKeyFlag bool
+}
+
+func NewCreateTenantAccessTokenReqBodyBuilder() *CreateTenantAccessTokenReqBodyBuilder {
+ builder := &CreateTenantAccessTokenReqBodyBuilder{}
+ return builder
+}
+
+// 应用访问凭证,通过商店应用获取 app_access_token接口获取。
+//
+//示例值:a-32bd8551db2f081cbfd26293f27516390b9feb04
+func (builder *CreateTenantAccessTokenReqBodyBuilder) AppAccessToken(appAccessToken string) *CreateTenantAccessTokenReqBodyBuilder {
+ builder.appAccessToken = appAccessToken
+ builder.appAccessTokenFlag = true
+ return builder
+}
+
+// 租户在飞书上的唯一标识,也可以理解为企业标识可以通过如下方式获取: 业开通应用时,开放平台推送给应用,具体可参考【首次启用应用】事件; 用户登录到小程序、H5 应用或者浏览器应用时,在用户的身份信息中获取。
+//
+//示例值:73658811060f175d
+func (builder *CreateTenantAccessTokenReqBodyBuilder) TenantKey(tenantKey string) *CreateTenantAccessTokenReqBodyBuilder {
+ builder.tenantKey = tenantKey
+ builder.tenantKeyFlag = true
+ return builder
+}
+
+func (builder *CreateTenantAccessTokenReqBodyBuilder) Build() *CreateTenantAccessTokenReqBody {
+ req := &CreateTenantAccessTokenReqBody{}
+ if builder.appAccessTokenFlag {
+ req.AppAccessToken = &builder.appAccessToken
+ }
+ if builder.tenantKeyFlag {
+ req.TenantKey = &builder.tenantKey
+ }
+ return req
+}
+
+type CreateTenantAccessTokenPathReqBodyBuilder struct {
+ appAccessToken string // 应用访问凭证,通过商店应用获取 app_access_token接口获取。
+ appAccessTokenFlag bool
+ tenantKey string // 租户在飞书上的唯一标识,也可以理解为企业标识可以通过如下方式获取: 业开通应用时,开放平台推送给应用,具体可参考【首次启用应用】事件; 用户登录到小程序、H5 应用或者浏览器应用时,在用户的身份信息中获取。
+ tenantKeyFlag bool
+}
+
+func NewCreateTenantAccessTokenPathReqBodyBuilder() *CreateTenantAccessTokenPathReqBodyBuilder {
+ builder := &CreateTenantAccessTokenPathReqBodyBuilder{}
+ return builder
+}
+
+// 应用访问凭证,通过商店应用获取 app_access_token接口获取。
+//
+// 示例值:a-32bd8551db2f081cbfd26293f27516390b9feb04
+func (builder *CreateTenantAccessTokenPathReqBodyBuilder) AppAccessToken(appAccessToken string) *CreateTenantAccessTokenPathReqBodyBuilder {
+ builder.appAccessToken = appAccessToken
+ builder.appAccessTokenFlag = true
+ return builder
+}
+
+// 租户在飞书上的唯一标识,也可以理解为企业标识可以通过如下方式获取: 业开通应用时,开放平台推送给应用,具体可参考【首次启用应用】事件; 用户登录到小程序、H5 应用或者浏览器应用时,在用户的身份信息中获取。
+//
+// 示例值:73658811060f175d
+func (builder *CreateTenantAccessTokenPathReqBodyBuilder) TenantKey(tenantKey string) *CreateTenantAccessTokenPathReqBodyBuilder {
+ builder.tenantKey = tenantKey
+ builder.tenantKeyFlag = true
+ return builder
+}
+
+func (builder *CreateTenantAccessTokenPathReqBodyBuilder) Build() (*CreateTenantAccessTokenReqBody, error) {
+ req := &CreateTenantAccessTokenReqBody{}
+ if builder.appAccessTokenFlag {
+ req.AppAccessToken = &builder.appAccessToken
+ }
+ if builder.tenantKeyFlag {
+ req.TenantKey = &builder.tenantKey
+ }
+ return req, nil
+}
+
+type CreateTenantAccessTokenReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *CreateTenantAccessTokenReqBody
+}
+
+func NewCreateTenantAccessTokenReqBuilder() *CreateTenantAccessTokenReqBuilder {
+ builder := &CreateTenantAccessTokenReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+//
+func (builder *CreateTenantAccessTokenReqBuilder) Body(body *CreateTenantAccessTokenReqBody) *CreateTenantAccessTokenReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *CreateTenantAccessTokenReqBuilder) Build() *CreateTenantAccessTokenReq {
+ req := &CreateTenantAccessTokenReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type CreateTenantAccessTokenReqBody struct {
+ AppAccessToken *string `json:"app_access_token,omitempty"` // 应用访问凭证,通过商店应用获取 app_access_token接口获取。
+ TenantKey *string `json:"tenant_key,omitempty"` // 租户在飞书上的唯一标识,也可以理解为企业标识可以通过如下方式获取: 业开通应用时,开放平台推送给应用,具体可参考【首次启用应用】事件; 用户登录到小程序、H5 应用或者浏览器应用时,在用户的身份信息中获取。
+}
+
+type CreateTenantAccessTokenReq struct {
+ apiReq *larkcore.ApiReq
+ Body *CreateTenantAccessTokenReqBody `body:""`
+}
+
+type CreateTenantAccessTokenResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *CreateTenantAccessTokenResp) Success() bool {
+ return resp.Code == 0
+}
+
+type InternalTenantAccessTokenReqBodyBuilder struct {
+ appId string // 应用唯一标识,创建应用后获得。
+ appIdFlag bool
+ appSecret string // 应用秘钥,创建应用后获得。
+ appSecretFlag bool
+}
+
+func NewInternalTenantAccessTokenReqBodyBuilder() *InternalTenantAccessTokenReqBodyBuilder {
+ builder := &InternalTenantAccessTokenReqBodyBuilder{}
+ return builder
+}
+
+// 应用唯一标识,创建应用后获得。
+//
+//示例值:cli_slkdjalasdkjasd
+func (builder *InternalTenantAccessTokenReqBodyBuilder) AppId(appId string) *InternalTenantAccessTokenReqBodyBuilder {
+ builder.appId = appId
+ builder.appIdFlag = true
+ return builder
+}
+
+// 应用秘钥,创建应用后获得。
+//
+//示例值:dskLLdkasdjlasdKK
+func (builder *InternalTenantAccessTokenReqBodyBuilder) AppSecret(appSecret string) *InternalTenantAccessTokenReqBodyBuilder {
+ builder.appSecret = appSecret
+ builder.appSecretFlag = true
+ return builder
+}
+
+func (builder *InternalTenantAccessTokenReqBodyBuilder) Build() *InternalTenantAccessTokenReqBody {
+ req := &InternalTenantAccessTokenReqBody{}
+ if builder.appIdFlag {
+ req.AppId = &builder.appId
+ }
+ if builder.appSecretFlag {
+ req.AppSecret = &builder.appSecret
+ }
+ return req
+}
+
+type InternalTenantAccessTokenPathReqBodyBuilder struct {
+ appId string // 应用唯一标识,创建应用后获得。
+ appIdFlag bool
+ appSecret string // 应用秘钥,创建应用后获得。
+ appSecretFlag bool
+}
+
+func NewInternalTenantAccessTokenPathReqBodyBuilder() *InternalTenantAccessTokenPathReqBodyBuilder {
+ builder := &InternalTenantAccessTokenPathReqBodyBuilder{}
+ return builder
+}
+
+// 应用唯一标识,创建应用后获得。
+//
+// 示例值:cli_slkdjalasdkjasd
+func (builder *InternalTenantAccessTokenPathReqBodyBuilder) AppId(appId string) *InternalTenantAccessTokenPathReqBodyBuilder {
+ builder.appId = appId
+ builder.appIdFlag = true
+ return builder
+}
+
+// 应用秘钥,创建应用后获得。
+//
+// 示例值:dskLLdkasdjlasdKK
+func (builder *InternalTenantAccessTokenPathReqBodyBuilder) AppSecret(appSecret string) *InternalTenantAccessTokenPathReqBodyBuilder {
+ builder.appSecret = appSecret
+ builder.appSecretFlag = true
+ return builder
+}
+
+func (builder *InternalTenantAccessTokenPathReqBodyBuilder) Build() (*InternalTenantAccessTokenReqBody, error) {
+ req := &InternalTenantAccessTokenReqBody{}
+ if builder.appIdFlag {
+ req.AppId = &builder.appId
+ }
+ if builder.appSecretFlag {
+ req.AppSecret = &builder.appSecret
+ }
+ return req, nil
+}
+
+type InternalTenantAccessTokenReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *InternalTenantAccessTokenReqBody
+}
+
+func NewInternalTenantAccessTokenReqBuilder() *InternalTenantAccessTokenReqBuilder {
+ builder := &InternalTenantAccessTokenReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+//
+func (builder *InternalTenantAccessTokenReqBuilder) Body(body *InternalTenantAccessTokenReqBody) *InternalTenantAccessTokenReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *InternalTenantAccessTokenReqBuilder) Build() *InternalTenantAccessTokenReq {
+ req := &InternalTenantAccessTokenReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type InternalTenantAccessTokenReqBody struct {
+ AppId *string `json:"app_id,omitempty"` // 应用唯一标识,创建应用后获得。
+ AppSecret *string `json:"app_secret,omitempty"` // 应用秘钥,创建应用后获得。
+}
+
+type InternalTenantAccessTokenReq struct {
+ apiReq *larkcore.ApiReq
+ Body *InternalTenantAccessTokenReqBody `body:""`
+}
+
+type InternalTenantAccessTokenResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *InternalTenantAccessTokenResp) Success() bool {
+ return resp.Code == 0
+}
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/baike/v1/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/baike/v1/model.go
index 5e9f3ea2a8..8ed8cbb1c7 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/baike/v1/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/baike/v1/model.go
@@ -196,6 +196,52 @@ func (builder *ClassificationBuilder) Build() *Classification {
return req
}
+type ClassificationFilter struct {
+ Include []string `json:"include,omitempty"` // 需要获取的分类
+ Exclude []string `json:"exclude,omitempty"` // 需要排除的分类
+}
+
+type ClassificationFilterBuilder struct {
+ include []string // 需要获取的分类
+ includeFlag bool
+ exclude []string // 需要排除的分类
+ excludeFlag bool
+}
+
+func NewClassificationFilterBuilder() *ClassificationFilterBuilder {
+ builder := &ClassificationFilterBuilder{}
+ return builder
+}
+
+// 需要获取的分类
+//
+// 示例值:
+func (builder *ClassificationFilterBuilder) Include(include []string) *ClassificationFilterBuilder {
+ builder.include = include
+ builder.includeFlag = true
+ return builder
+}
+
+// 需要排除的分类
+//
+// 示例值:
+func (builder *ClassificationFilterBuilder) Exclude(exclude []string) *ClassificationFilterBuilder {
+ builder.exclude = exclude
+ builder.excludeFlag = true
+ return builder
+}
+
+func (builder *ClassificationFilterBuilder) Build() *ClassificationFilter {
+ req := &ClassificationFilter{}
+ if builder.includeFlag {
+ req.Include = builder.include
+ }
+ if builder.excludeFlag {
+ req.Exclude = builder.exclude
+ }
+ return req
+}
+
type CorrectError struct {
Type *int `json:"type,omitempty"` //
Total *int `json:"total,omitempty"` // 该类型错误在请求时间周期内的累计数量
@@ -531,12 +577,15 @@ type Entity struct {
Aliases []*Term `json:"aliases,omitempty"` // 别名
Description *string `json:"description,omitempty"` // 词条释义(纯文本格式)
+ Creator *string `json:"creator,omitempty"` // 创建者
CreateTime *string `json:"create_time,omitempty"` // 词条创建时间
+ Updater *string `json:"updater,omitempty"` // 最近一次更新者
UpdateTime *string `json:"update_time,omitempty"` // 词条最近更新时间
RelatedMeta *RelatedMeta `json:"related_meta,omitempty"` // 更多相关信息
Statistics *Statistics `json:"statistics,omitempty"` // 当前词条收到的反馈数据
OuterInfo *OuterInfo `json:"outer_info,omitempty"` // 外部系统关联数据
RichText *string `json:"rich_text,omitempty"` // 富文本格式(当填写富文本内容时,description字段将会失效可不填写),支持的格式参考[企业百科指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/baike-v1/overview)中的释义部分
+ Source *int `json:"source,omitempty"` // 词条的创建来源,1:用户主动创建,2:批量导入,3:官方词,4:OpenAPI 创建
}
type EntityBuilder struct {
@@ -549,8 +598,12 @@ type EntityBuilder struct {
aliasesFlag bool
description string // 词条释义(纯文本格式)
descriptionFlag bool
+ creator string // 创建者
+ creatorFlag bool
createTime string // 词条创建时间
createTimeFlag bool
+ updater string // 最近一次更新者
+ updaterFlag bool
updateTime string // 词条最近更新时间
updateTimeFlag bool
relatedMeta *RelatedMeta // 更多相关信息
@@ -561,6 +614,8 @@ type EntityBuilder struct {
outerInfoFlag bool
richText string // 富文本格式(当填写富文本内容时,description字段将会失效可不填写),支持的格式参考[企业百科指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/baike-v1/overview)中的释义部分
richTextFlag bool
+ source int // 词条的创建来源,1:用户主动创建,2:批量导入,3:官方词,4:OpenAPI 创建
+ sourceFlag bool
}
func NewEntityBuilder() *EntityBuilder {
@@ -604,6 +659,15 @@ func (builder *EntityBuilder) Description(description string) *EntityBuilder {
return builder
}
+// 创建者
+//
+// 示例值:ou_30b07b63089ea46518789914dac63d36
+func (builder *EntityBuilder) Creator(creator string) *EntityBuilder {
+ builder.creator = creator
+ builder.creatorFlag = true
+ return builder
+}
+
// 词条创建时间
//
// 示例值:1649318125
@@ -613,6 +677,15 @@ func (builder *EntityBuilder) CreateTime(createTime string) *EntityBuilder {
return builder
}
+// 最近一次更新者
+//
+// 示例值:ou_30b07b63089ea46518789914dac63d36
+func (builder *EntityBuilder) Updater(updater string) *EntityBuilder {
+ builder.updater = updater
+ builder.updaterFlag = true
+ return builder
+}
+
// 词条最近更新时间
//
// 示例值:1649318125
@@ -658,6 +731,15 @@ func (builder *EntityBuilder) RichText(richText string) *EntityBuilder {
return builder
}
+// 词条的创建来源,1:用户主动创建,2:批量导入,3:官方词,4:OpenAPI 创建
+//
+// 示例值:1
+func (builder *EntityBuilder) Source(source int) *EntityBuilder {
+ builder.source = source
+ builder.sourceFlag = true
+ return builder
+}
+
func (builder *EntityBuilder) Build() *Entity {
req := &Entity{}
if builder.idFlag {
@@ -674,10 +756,18 @@ func (builder *EntityBuilder) Build() *Entity {
if builder.descriptionFlag {
req.Description = &builder.description
+ }
+ if builder.creatorFlag {
+ req.Creator = &builder.creator
+
}
if builder.createTimeFlag {
req.CreateTime = &builder.createTime
+ }
+ if builder.updaterFlag {
+ req.Updater = &builder.updater
+
}
if builder.updateTimeFlag {
req.UpdateTime = &builder.updateTime
@@ -695,6 +785,10 @@ func (builder *EntityBuilder) Build() *Entity {
if builder.richTextFlag {
req.RichText = &builder.richText
+ }
+ if builder.sourceFlag {
+ req.Source = &builder.source
+
}
return req
}
@@ -2342,8 +2436,14 @@ func (resp *MatchEntityResp) Success() bool {
}
type SearchEntityReqBodyBuilder struct {
- query string // 搜索关键词
- queryFlag bool
+ query string // 搜索关键词
+ queryFlag bool
+ classificationFilter *ClassificationFilter // 分类筛选
+ classificationFilterFlag bool
+ sources []int // 词条的创建来源,1:用户主动创建,2:批量导入,3:官方词,4:OpenAPI 创建
+ sourcesFlag bool
+ creators []string // 创建者
+ creatorsFlag bool
}
func NewSearchEntityReqBodyBuilder() *SearchEntityReqBodyBuilder {
@@ -2360,17 +2460,59 @@ func (builder *SearchEntityReqBodyBuilder) Query(query string) *SearchEntityReqB
return builder
}
+// 分类筛选
+//
+//示例值:
+func (builder *SearchEntityReqBodyBuilder) ClassificationFilter(classificationFilter *ClassificationFilter) *SearchEntityReqBodyBuilder {
+ builder.classificationFilter = classificationFilter
+ builder.classificationFilterFlag = true
+ return builder
+}
+
+// 词条的创建来源,1:用户主动创建,2:批量导入,3:官方词,4:OpenAPI 创建
+//
+//示例值:
+func (builder *SearchEntityReqBodyBuilder) Sources(sources []int) *SearchEntityReqBodyBuilder {
+ builder.sources = sources
+ builder.sourcesFlag = true
+ return builder
+}
+
+// 创建者
+//
+//示例值:ou_30b07b63089ea46518789914dac63d36
+func (builder *SearchEntityReqBodyBuilder) Creators(creators []string) *SearchEntityReqBodyBuilder {
+ builder.creators = creators
+ builder.creatorsFlag = true
+ return builder
+}
+
func (builder *SearchEntityReqBodyBuilder) Build() *SearchEntityReqBody {
req := &SearchEntityReqBody{}
if builder.queryFlag {
req.Query = &builder.query
}
+ if builder.classificationFilterFlag {
+ req.ClassificationFilter = builder.classificationFilter
+ }
+ if builder.sourcesFlag {
+ req.Sources = builder.sources
+ }
+ if builder.creatorsFlag {
+ req.Creators = builder.creators
+ }
return req
}
type SearchEntityPathReqBodyBuilder struct {
- query string // 搜索关键词
- queryFlag bool
+ query string // 搜索关键词
+ queryFlag bool
+ classificationFilter *ClassificationFilter // 分类筛选
+ classificationFilterFlag bool
+ sources []int // 词条的创建来源,1:用户主动创建,2:批量导入,3:官方词,4:OpenAPI 创建
+ sourcesFlag bool
+ creators []string // 创建者
+ creatorsFlag bool
}
func NewSearchEntityPathReqBodyBuilder() *SearchEntityPathReqBodyBuilder {
@@ -2387,11 +2529,47 @@ func (builder *SearchEntityPathReqBodyBuilder) Query(query string) *SearchEntity
return builder
}
+// 分类筛选
+//
+// 示例值:
+func (builder *SearchEntityPathReqBodyBuilder) ClassificationFilter(classificationFilter *ClassificationFilter) *SearchEntityPathReqBodyBuilder {
+ builder.classificationFilter = classificationFilter
+ builder.classificationFilterFlag = true
+ return builder
+}
+
+// 词条的创建来源,1:用户主动创建,2:批量导入,3:官方词,4:OpenAPI 创建
+//
+// 示例值:
+func (builder *SearchEntityPathReqBodyBuilder) Sources(sources []int) *SearchEntityPathReqBodyBuilder {
+ builder.sources = sources
+ builder.sourcesFlag = true
+ return builder
+}
+
+// 创建者
+//
+// 示例值:ou_30b07b63089ea46518789914dac63d36
+func (builder *SearchEntityPathReqBodyBuilder) Creators(creators []string) *SearchEntityPathReqBodyBuilder {
+ builder.creators = creators
+ builder.creatorsFlag = true
+ return builder
+}
+
func (builder *SearchEntityPathReqBodyBuilder) Build() (*SearchEntityReqBody, error) {
req := &SearchEntityReqBody{}
if builder.queryFlag {
req.Query = &builder.query
}
+ if builder.classificationFilterFlag {
+ req.ClassificationFilter = builder.classificationFilter
+ }
+ if builder.sourcesFlag {
+ req.Sources = builder.sources
+ }
+ if builder.creatorsFlag {
+ req.Creators = builder.creators
+ }
return req, nil
}
@@ -2416,19 +2594,19 @@ func (builder *SearchEntityReqBuilder) Limit(limit int) *SearchEntityReqBuilder
return builder
}
+// 每页返回的词条量
//
-//
-// 示例值:b152fa6e6f62a291019a04c3a93f365f8ac641910506ff15ff4cad6534e087cb4ed8fa2c
-func (builder *SearchEntityReqBuilder) PageToken(pageToken string) *SearchEntityReqBuilder {
- builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+// 示例值:10
+func (builder *SearchEntityReqBuilder) PageSize(pageSize int) *SearchEntityReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
return builder
}
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果
//
-//
-// 示例值:10
-func (builder *SearchEntityReqBuilder) PageSize(pageSize int) *SearchEntityReqBuilder {
- builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+// 示例值:b152fa6e6f62a291019a04c3a93f365f8ac641910506ff15ff4cad6534e087cb4ed8fa2c
+func (builder *SearchEntityReqBuilder) PageToken(pageToken string) *SearchEntityReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
return builder
}
@@ -2456,7 +2634,10 @@ func (builder *SearchEntityReqBuilder) Build() *SearchEntityReq {
}
type SearchEntityReqBody struct {
- Query *string `json:"query,omitempty"` // 搜索关键词
+ Query *string `json:"query,omitempty"` // 搜索关键词
+ ClassificationFilter *ClassificationFilter `json:"classification_filter,omitempty"` // 分类筛选
+ Sources []int `json:"sources,omitempty"` // 词条的创建来源,1:用户主动创建,2:批量导入,3:官方词,4:OpenAPI 创建
+ Creators []string `json:"creators,omitempty"` // 创建者
}
type SearchEntityReq struct {
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1/api.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1/api.go
index 585771a201..d120d0fb5b 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1/api.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1/api.go
@@ -80,6 +80,32 @@ type appTableView struct {
service *BitableService
}
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=copy&project=bitable&resource=app&version=v1
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/bitablev1/copy_app.go
+func (a *app) Copy(ctx context.Context, req *CopyAppReq, options ...larkcore.RequestOptionFunc) (*CopyAppResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/bitable/v1/apps/:app_token/copy"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, a.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CopyAppResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, a.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
//
//
// -
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1/model.go
index a2e0e1dbe0..196aa49669 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1/model.go
@@ -1220,6 +1220,9 @@ type AppTableField struct {
Type *int `json:"type,omitempty"` // 多维表格字段类型
Property *AppTableFieldProperty `json:"property,omitempty"` // 字段属性,具体参考:[字段编辑指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide)
Description *AppTableFieldDescription `json:"description,omitempty"` // 字段的描述
+ IsPrimary *bool `json:"is_primary,omitempty"` // 是否是索引列
+ UiType *string `json:"ui_type,omitempty"` // 字段在界面上的展示类型,例如进度字段是数字的一种展示形态
+ IsHidden *bool `json:"is_hidden,omitempty"` // 是否是隐藏字段
}
type AppTableFieldBuilder struct {
@@ -1233,6 +1236,12 @@ type AppTableFieldBuilder struct {
propertyFlag bool
description *AppTableFieldDescription // 字段的描述
descriptionFlag bool
+ isPrimary bool // 是否是索引列
+ isPrimaryFlag bool
+ uiType string // 字段在界面上的展示类型,例如进度字段是数字的一种展示形态
+ uiTypeFlag bool
+ isHidden bool // 是否是隐藏字段
+ isHiddenFlag bool
}
func NewAppTableFieldBuilder() *AppTableFieldBuilder {
@@ -1242,7 +1251,7 @@ func NewAppTableFieldBuilder() *AppTableFieldBuilder {
// 多维表格字段 id
//
-// 示例值:
+// 示例值:fldWJyCkFQ
func (builder *AppTableFieldBuilder) FieldId(fieldId string) *AppTableFieldBuilder {
builder.fieldId = fieldId
builder.fieldIdFlag = true
@@ -1285,6 +1294,33 @@ func (builder *AppTableFieldBuilder) Description(description *AppTableFieldDescr
return builder
}
+// 是否是索引列
+//
+// 示例值:true
+func (builder *AppTableFieldBuilder) IsPrimary(isPrimary bool) *AppTableFieldBuilder {
+ builder.isPrimary = isPrimary
+ builder.isPrimaryFlag = true
+ return builder
+}
+
+// 字段在界面上的展示类型,例如进度字段是数字的一种展示形态
+//
+// 示例值:Progress
+func (builder *AppTableFieldBuilder) UiType(uiType string) *AppTableFieldBuilder {
+ builder.uiType = uiType
+ builder.uiTypeFlag = true
+ return builder
+}
+
+// 是否是隐藏字段
+//
+// 示例值:false
+func (builder *AppTableFieldBuilder) IsHidden(isHidden bool) *AppTableFieldBuilder {
+ builder.isHidden = isHidden
+ builder.isHiddenFlag = true
+ return builder
+}
+
func (builder *AppTableFieldBuilder) Build() *AppTableField {
req := &AppTableField{}
if builder.fieldIdFlag {
@@ -1305,6 +1341,18 @@ func (builder *AppTableFieldBuilder) Build() *AppTableField {
if builder.descriptionFlag {
req.Description = builder.description
}
+ if builder.isPrimaryFlag {
+ req.IsPrimary = &builder.isPrimary
+
+ }
+ if builder.uiTypeFlag {
+ req.UiType = &builder.uiType
+
+ }
+ if builder.isHiddenFlag {
+ req.IsHidden = &builder.isHidden
+
+ }
return req
}
@@ -1916,9 +1964,9 @@ func (builder *AppTableFormPatchedFieldBuilder) Build() *AppTableFormPatchedFiel
type AppTableRecord struct {
RecordId *string `json:"record_id,omitempty"` // 一条记录的唯一标识 id [record_id 参数说明](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification#15d8db94)
CreatedBy *Person `json:"created_by,omitempty"` // 该记录的创建人
- CreatedTime *int `json:"created_time,omitempty"` // 该记录的创建时间
+ CreatedTime *int64 `json:"created_time,omitempty"` // 该记录的创建时间
LastModifiedBy *Person `json:"last_modified_by,omitempty"` // 该记录最新一次更新的修改人
- LastModifiedTime *int `json:"last_modified_time,omitempty"` // 该记录最近一次的更新时间
+ LastModifiedTime *int64 `json:"last_modified_time,omitempty"` // 该记录最近一次的更新时间
Fields map[string]interface{} `json:"fields,omitempty"` // 数据表的字段,即数据表的列;;当前接口支持的字段类型请参考[接入指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification#31f78a3c);;不同类型字段的数据结构请参考[数据结构概述](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/development-guide/bitable-structure)
}
@@ -1927,11 +1975,11 @@ type AppTableRecordBuilder struct {
recordIdFlag bool
createdBy *Person // 该记录的创建人
createdByFlag bool
- createdTime int // 该记录的创建时间
+ createdTime int64 // 该记录的创建时间
createdTimeFlag bool
lastModifiedBy *Person // 该记录最新一次更新的修改人
lastModifiedByFlag bool
- lastModifiedTime int // 该记录最近一次的更新时间
+ lastModifiedTime int64 // 该记录最近一次的更新时间
lastModifiedTimeFlag bool
fields map[string]interface{} // 数据表的字段,即数据表的列;;当前接口支持的字段类型请参考[接入指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification#31f78a3c);;不同类型字段的数据结构请参考[数据结构概述](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/development-guide/bitable-structure)
fieldsFlag bool
@@ -1962,8 +2010,8 @@ func (builder *AppTableRecordBuilder) CreatedBy(createdBy *Person) *AppTableReco
// 该记录的创建时间
//
-// 示例值:1610281603
-func (builder *AppTableRecordBuilder) CreatedTime(createdTime int) *AppTableRecordBuilder {
+// 示例值:
+func (builder *AppTableRecordBuilder) CreatedTime(createdTime int64) *AppTableRecordBuilder {
builder.createdTime = createdTime
builder.createdTimeFlag = true
return builder
@@ -1980,8 +2028,8 @@ func (builder *AppTableRecordBuilder) LastModifiedBy(lastModifiedBy *Person) *Ap
// 该记录最近一次的更新时间
//
-// 示例值:1610281603
-func (builder *AppTableRecordBuilder) LastModifiedTime(lastModifiedTime int) *AppTableRecordBuilder {
+// 示例值:
+func (builder *AppTableRecordBuilder) LastModifiedTime(lastModifiedTime int64) *AppTableRecordBuilder {
builder.lastModifiedTime = lastModifiedTime
builder.lastModifiedTimeFlag = true
return builder
@@ -3073,6 +3121,177 @@ func (builder *UrlBuilder) Build() *Url {
return req
}
+type CopyAppReqBodyBuilder struct {
+ name string // 多维表格 App 名字
+ nameFlag bool
+ folderToken string // 多维表格 App 归属文件夹
+ folderTokenFlag bool
+ withoutContent bool // 不复制文档内容,只复制文档结构
+ withoutContentFlag bool
+}
+
+func NewCopyAppReqBodyBuilder() *CopyAppReqBodyBuilder {
+ builder := &CopyAppReqBodyBuilder{}
+ return builder
+}
+
+// 多维表格 App 名字
+//
+//示例值:一篇新的多维表格
+func (builder *CopyAppReqBodyBuilder) Name(name string) *CopyAppReqBodyBuilder {
+ builder.name = name
+ builder.nameFlag = true
+ return builder
+}
+
+// 多维表格 App 归属文件夹
+//
+//示例值:fldbco*****CIMltVc
+func (builder *CopyAppReqBodyBuilder) FolderToken(folderToken string) *CopyAppReqBodyBuilder {
+ builder.folderToken = folderToken
+ builder.folderTokenFlag = true
+ return builder
+}
+
+// 不复制文档内容,只复制文档结构
+//
+//示例值:false
+func (builder *CopyAppReqBodyBuilder) WithoutContent(withoutContent bool) *CopyAppReqBodyBuilder {
+ builder.withoutContent = withoutContent
+ builder.withoutContentFlag = true
+ return builder
+}
+
+func (builder *CopyAppReqBodyBuilder) Build() *CopyAppReqBody {
+ req := &CopyAppReqBody{}
+ if builder.nameFlag {
+ req.Name = &builder.name
+ }
+ if builder.folderTokenFlag {
+ req.FolderToken = &builder.folderToken
+ }
+ if builder.withoutContentFlag {
+ req.WithoutContent = &builder.withoutContent
+ }
+ return req
+}
+
+type CopyAppPathReqBodyBuilder struct {
+ name string // 多维表格 App 名字
+ nameFlag bool
+ folderToken string // 多维表格 App 归属文件夹
+ folderTokenFlag bool
+ withoutContent bool // 不复制文档内容,只复制文档结构
+ withoutContentFlag bool
+}
+
+func NewCopyAppPathReqBodyBuilder() *CopyAppPathReqBodyBuilder {
+ builder := &CopyAppPathReqBodyBuilder{}
+ return builder
+}
+
+// 多维表格 App 名字
+//
+// 示例值:一篇新的多维表格
+func (builder *CopyAppPathReqBodyBuilder) Name(name string) *CopyAppPathReqBodyBuilder {
+ builder.name = name
+ builder.nameFlag = true
+ return builder
+}
+
+// 多维表格 App 归属文件夹
+//
+// 示例值:fldbco*****CIMltVc
+func (builder *CopyAppPathReqBodyBuilder) FolderToken(folderToken string) *CopyAppPathReqBodyBuilder {
+ builder.folderToken = folderToken
+ builder.folderTokenFlag = true
+ return builder
+}
+
+// 不复制文档内容,只复制文档结构
+//
+// 示例值:false
+func (builder *CopyAppPathReqBodyBuilder) WithoutContent(withoutContent bool) *CopyAppPathReqBodyBuilder {
+ builder.withoutContent = withoutContent
+ builder.withoutContentFlag = true
+ return builder
+}
+
+func (builder *CopyAppPathReqBodyBuilder) Build() (*CopyAppReqBody, error) {
+ req := &CopyAppReqBody{}
+ if builder.nameFlag {
+ req.Name = &builder.name
+ }
+ if builder.folderTokenFlag {
+ req.FolderToken = &builder.folderToken
+ }
+ if builder.withoutContentFlag {
+ req.WithoutContent = &builder.withoutContent
+ }
+ return req, nil
+}
+
+type CopyAppReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *CopyAppReqBody
+}
+
+func NewCopyAppReqBuilder() *CopyAppReqBuilder {
+ builder := &CopyAppReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 多维表格 App token
+//
+// 示例值:S404b*****e9PQsYDWYcNryFn0g
+func (builder *CopyAppReqBuilder) AppToken(appToken string) *CopyAppReqBuilder {
+ builder.apiReq.PathParams.Set("app_token", fmt.Sprint(appToken))
+ return builder
+}
+
+//
+func (builder *CopyAppReqBuilder) Body(body *CopyAppReqBody) *CopyAppReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *CopyAppReqBuilder) Build() *CopyAppReq {
+ req := &CopyAppReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type CopyAppReqBody struct {
+ Name *string `json:"name,omitempty"` // 多维表格 App 名字
+ FolderToken *string `json:"folder_token,omitempty"` // 多维表格 App 归属文件夹
+ WithoutContent *bool `json:"without_content,omitempty"` // 不复制文档内容,只复制文档结构
+}
+
+type CopyAppReq struct {
+ apiReq *larkcore.ApiReq
+ Body *CopyAppReqBody `body:""`
+}
+
+type CopyAppRespData struct {
+ App *App `json:"app,omitempty"` //
+}
+
+type CopyAppResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CopyAppRespData `json:"data"` // 业务数据
+}
+
+func (resp *CopyAppResp) Success() bool {
+ return resp.Code == 0
+}
+
type CreateAppReqBuilder struct {
apiReq *larkcore.ApiReq
reqApp *ReqApp
@@ -4653,7 +4872,7 @@ func (builder *ListAppTableReqBuilder) AppToken(appToken string) *ListAppTableRe
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:tblsRc9GRRXKqhvW
func (builder *ListAppTableReqBuilder) PageToken(pageToken string) *ListAppTableReqBuilder {
@@ -4661,7 +4880,7 @@ func (builder *ListAppTableReqBuilder) PageToken(pageToken string) *ListAppTable
return builder
}
-//
+// 分页大小
//
// 示例值:10
func (builder *ListAppTableReqBuilder) PageSize(pageSize int) *ListAppTableReqBuilder {
@@ -5009,7 +5228,7 @@ func (builder *ListAppTableFieldReqBuilder) TextFieldAsArray(textFieldAsArray bo
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:fldwJ4YrtB
func (builder *ListAppTableFieldReqBuilder) PageToken(pageToken string) *ListAppTableFieldReqBuilder {
@@ -5017,7 +5236,7 @@ func (builder *ListAppTableFieldReqBuilder) PageToken(pageToken string) *ListApp
return builder
}
-//
+// 分页大小
//
// 示例值:10
func (builder *ListAppTableFieldReqBuilder) PageSize(pageSize int) *ListAppTableFieldReqBuilder {
@@ -6159,7 +6378,7 @@ func (builder *ListAppTableRecordReqBuilder) AutomaticFields(automaticFields boo
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:recn0hoyXL
func (builder *ListAppTableRecordReqBuilder) PageToken(pageToken string) *ListAppTableRecordReqBuilder {
@@ -6167,7 +6386,7 @@ func (builder *ListAppTableRecordReqBuilder) PageToken(pageToken string) *ListAp
return builder
}
-//
+// 分页大小
//
// 示例值:10
func (builder *ListAppTableRecordReqBuilder) PageSize(pageSize int) *ListAppTableRecordReqBuilder {
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/calendar/v4/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/calendar/v4/model.go
index 268e57787c..0d48e52fc6 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/calendar/v4/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/calendar/v4/model.go
@@ -1832,7 +1832,7 @@ func NewCalendarEventRespBuilder() *CalendarEventRespBuilder {
// 日程ID
//
-// 示例值:
+// 示例值:75d28f9b-e35c-4230-8a83-4a661497db54_0
func (builder *CalendarEventRespBuilder) EventId(eventId string) *CalendarEventRespBuilder {
builder.eventId = eventId
builder.eventIdFlag = true
@@ -1841,7 +1841,7 @@ func (builder *CalendarEventRespBuilder) EventId(eventId string) *CalendarEventR
// 日程组织者日历ID
//
-// 示例值:
+// 示例值:feishu.cn_HF9U2MbibE8PPpjro6xjqa@group.calendar.feishu.cn
func (builder *CalendarEventRespBuilder) OrganizerCalendarId(organizerCalendarId string) *CalendarEventRespBuilder {
builder.organizerCalendarId = organizerCalendarId
builder.organizerCalendarIdFlag = true
@@ -1850,7 +1850,7 @@ func (builder *CalendarEventRespBuilder) OrganizerCalendarId(organizerCalendarId
// 日程标题
//
-// 示例值:
+// 示例值:日程主题
func (builder *CalendarEventRespBuilder) Summary(summary string) *CalendarEventRespBuilder {
builder.summary = summary
builder.summaryFlag = true
@@ -1859,7 +1859,7 @@ func (builder *CalendarEventRespBuilder) Summary(summary string) *CalendarEventR
// 日程描述
//
-// 示例值:
+// 示例值:日程描述
func (builder *CalendarEventRespBuilder) Description(description string) *CalendarEventRespBuilder {
builder.description = description
builder.descriptionFlag = true
@@ -1868,7 +1868,7 @@ func (builder *CalendarEventRespBuilder) Description(description string) *Calend
// 是否发送通知消息
//
-// 示例值:
+// 示例值:true
func (builder *CalendarEventRespBuilder) NeedNotification(needNotification bool) *CalendarEventRespBuilder {
builder.needNotification = needNotification
builder.needNotificationFlag = true
@@ -1940,7 +1940,7 @@ func (builder *CalendarEventRespBuilder) Location(location *EventLocation) *Cale
// 日程颜色,颜色RGB值的int32表示。仅对当前身份生效;客户端展示时会映射到色板上最接近的一种颜色;值为0或-1时默认跟随日历颜色。
//
-// 示例值:
+// 示例值:-1
func (builder *CalendarEventRespBuilder) Color(color int) *CalendarEventRespBuilder {
builder.color = color
builder.colorFlag = true
@@ -1958,7 +1958,7 @@ func (builder *CalendarEventRespBuilder) Reminders(reminders []*Reminder) *Calen
// 重复日程的重复性规则
//
-// 示例值:
+// 示例值:FREQ=DAILY;INTERVAL=1
func (builder *CalendarEventRespBuilder) Recurrence(recurrence string) *CalendarEventRespBuilder {
builder.recurrence = recurrence
builder.recurrenceFlag = true
@@ -1976,7 +1976,7 @@ func (builder *CalendarEventRespBuilder) Status(status string) *CalendarEventRes
// 日程是否是一个重复日程的例外日程
//
-// 示例值:
+// 示例值:true
func (builder *CalendarEventRespBuilder) IsException(isException bool) *CalendarEventRespBuilder {
builder.isException = isException
builder.isExceptionFlag = true
@@ -1985,7 +1985,7 @@ func (builder *CalendarEventRespBuilder) IsException(isException bool) *Calendar
// 例外日程的原重复日程的event_id
//
-// 示例值:
+// 示例值:75d28f9b-e35c-4230-8a83-4a661497db54_0
func (builder *CalendarEventRespBuilder) RecurringEventId(recurringEventId string) *CalendarEventRespBuilder {
builder.recurringEventId = recurringEventId
builder.recurringEventIdFlag = true
@@ -1994,7 +1994,7 @@ func (builder *CalendarEventRespBuilder) RecurringEventId(recurringEventId strin
// 日程的创建时间戳
//
-// 示例值:
+// 示例值:1682585100
func (builder *CalendarEventRespBuilder) CreateTime(createTime string) *CalendarEventRespBuilder {
builder.createTime = createTime
builder.createTimeFlag = true
@@ -2998,11 +2998,60 @@ func (builder *UserIdBuilder) Build() *UserId {
return req
}
+type VcInfo struct {
+ UniqueId *string `json:"unique_id,omitempty"` // 会议唯一ID
+ MeetingNo *string `json:"meeting_no,omitempty"` // 会议号
+}
+
+type VcInfoBuilder struct {
+ uniqueId string // 会议唯一ID
+ uniqueIdFlag bool
+ meetingNo string // 会议号
+ meetingNoFlag bool
+}
+
+func NewVcInfoBuilder() *VcInfoBuilder {
+ builder := &VcInfoBuilder{}
+ return builder
+}
+
+// 会议唯一ID
+//
+// 示例值:7226647229510582291
+func (builder *VcInfoBuilder) UniqueId(uniqueId string) *VcInfoBuilder {
+ builder.uniqueId = uniqueId
+ builder.uniqueIdFlag = true
+ return builder
+}
+
+// 会议号
+//
+// 示例值:808056935
+func (builder *VcInfoBuilder) MeetingNo(meetingNo string) *VcInfoBuilder {
+ builder.meetingNo = meetingNo
+ builder.meetingNoFlag = true
+ return builder
+}
+
+func (builder *VcInfoBuilder) Build() *VcInfo {
+ req := &VcInfo{}
+ if builder.uniqueIdFlag {
+ req.UniqueId = &builder.uniqueId
+
+ }
+ if builder.meetingNoFlag {
+ req.MeetingNo = &builder.meetingNo
+
+ }
+ return req
+}
+
type Vchat struct {
VcType *string `json:"vc_type,omitempty"` // 视频会议类型
IconType *string `json:"icon_type,omitempty"` // 第三方视频会议icon类型;可以为空,为空展示默认icon。
Description *string `json:"description,omitempty"` // 第三方视频会议文案,可以为空,为空展示默认文案
MeetingUrl *string `json:"meeting_url,omitempty"` // 视频会议URL
+
}
type VchatBuilder struct {
@@ -3075,6 +3124,7 @@ func (builder *VchatBuilder) Build() *Vchat {
req.MeetingUrl = &builder.meetingUrl
}
+
return req
}
@@ -3461,7 +3511,7 @@ func (builder *SearchCalendarReqBuilder) Limit(limit int) *SearchCalendarReqBuil
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:10
func (builder *SearchCalendarReqBuilder) PageToken(pageToken string) *SearchCalendarReqBuilder {
@@ -3469,7 +3519,7 @@ func (builder *SearchCalendarReqBuilder) PageToken(pageToken string) *SearchCale
return builder
}
-//
+// 分页大小
//
// 示例值:10
func (builder *SearchCalendarReqBuilder) PageSize(pageSize int) *SearchCalendarReqBuilder {
@@ -3774,7 +3824,7 @@ func (builder *ListCalendarAclReqBuilder) UserIdType(userIdType string) *ListCal
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:xxx
func (builder *ListCalendarAclReqBuilder) PageToken(pageToken string) *ListCalendarAclReqBuilder {
@@ -3782,7 +3832,7 @@ func (builder *ListCalendarAclReqBuilder) PageToken(pageToken string) *ListCalen
return builder
}
-//
+// 分页大小
//
// 示例值:10,小于10取10
func (builder *ListCalendarAclReqBuilder) PageSize(pageSize int) *ListCalendarAclReqBuilder {
@@ -3925,6 +3975,14 @@ func (builder *CreateCalendarEventReqBuilder) CalendarId(calendarId string) *Cre
return builder
}
+// 幂等唯一key
+//
+// 示例值:25fdf41b-8c80-2ce1-e94c-de8b5e7aa7e6
+func (builder *CreateCalendarEventReqBuilder) IdempotencyKey(idempotencyKey string) *CreateCalendarEventReqBuilder {
+ builder.apiReq.QueryParams.Set("idempotency_key", fmt.Sprint(idempotencyKey))
+ return builder
+}
+
// 该接口用于以当前身份(应用 / 用户)在日历上创建一个日程。;;身份由 Header Authorization 的 Token 类型决定。
func (builder *CreateCalendarEventReqBuilder) CalendarEvent(calendarEvent *CalendarEvent) *CreateCalendarEventReqBuilder {
builder.calendarEvent = calendarEvent
@@ -3935,6 +3993,7 @@ func (builder *CreateCalendarEventReqBuilder) Build() *CreateCalendarEventReq {
req := &CreateCalendarEventReq{}
req.apiReq = &larkcore.ApiReq{}
req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
req.apiReq.Body = builder.calendarEvent
return req
}
@@ -4350,7 +4409,7 @@ func (builder *SearchCalendarEventReqBuilder) UserIdType(userIdType string) *Sea
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:xxxxx
func (builder *SearchCalendarEventReqBuilder) PageToken(pageToken string) *SearchCalendarEventReqBuilder {
@@ -4358,7 +4417,7 @@ func (builder *SearchCalendarEventReqBuilder) PageToken(pageToken string) *Searc
return builder
}
-//
+// 分页大小
//
// 示例值:10
func (builder *SearchCalendarEventReqBuilder) PageSize(pageSize int) *SearchCalendarEventReqBuilder {
@@ -4741,6 +4800,8 @@ type CreateCalendarEventAttendeeReqBodyBuilder struct {
instanceStartTimeAdminFlag bool
isEnableAdmin bool // 是否启用管理员身份(需先在管理后台设置某人为会议室管理员)
isEnableAdminFlag bool
+ addOperatorToAttendee bool // 是否添加会议室operate_id标识的用户到参与人
+ addOperatorToAttendeeFlag bool
}
func NewCreateCalendarEventAttendeeReqBodyBuilder() *CreateCalendarEventAttendeeReqBodyBuilder {
@@ -4784,6 +4845,15 @@ func (builder *CreateCalendarEventAttendeeReqBodyBuilder) IsEnableAdmin(isEnable
return builder
}
+// 是否添加会议室operate_id标识的用户到参与人
+//
+//示例值:false
+func (builder *CreateCalendarEventAttendeeReqBodyBuilder) AddOperatorToAttendee(addOperatorToAttendee bool) *CreateCalendarEventAttendeeReqBodyBuilder {
+ builder.addOperatorToAttendee = addOperatorToAttendee
+ builder.addOperatorToAttendeeFlag = true
+ return builder
+}
+
func (builder *CreateCalendarEventAttendeeReqBodyBuilder) Build() *CreateCalendarEventAttendeeReqBody {
req := &CreateCalendarEventAttendeeReqBody{}
if builder.attendeesFlag {
@@ -4798,6 +4868,9 @@ func (builder *CreateCalendarEventAttendeeReqBodyBuilder) Build() *CreateCalenda
if builder.isEnableAdminFlag {
req.IsEnableAdmin = &builder.isEnableAdmin
}
+ if builder.addOperatorToAttendeeFlag {
+ req.AddOperatorToAttendee = &builder.addOperatorToAttendee
+ }
return req
}
@@ -4810,6 +4883,8 @@ type CreateCalendarEventAttendeePathReqBodyBuilder struct {
instanceStartTimeAdminFlag bool
isEnableAdmin bool // 是否启用管理员身份(需先在管理后台设置某人为会议室管理员)
isEnableAdminFlag bool
+ addOperatorToAttendee bool // 是否添加会议室operate_id标识的用户到参与人
+ addOperatorToAttendeeFlag bool
}
func NewCreateCalendarEventAttendeePathReqBodyBuilder() *CreateCalendarEventAttendeePathReqBodyBuilder {
@@ -4853,6 +4928,15 @@ func (builder *CreateCalendarEventAttendeePathReqBodyBuilder) IsEnableAdmin(isEn
return builder
}
+// 是否添加会议室operate_id标识的用户到参与人
+//
+// 示例值:false
+func (builder *CreateCalendarEventAttendeePathReqBodyBuilder) AddOperatorToAttendee(addOperatorToAttendee bool) *CreateCalendarEventAttendeePathReqBodyBuilder {
+ builder.addOperatorToAttendee = addOperatorToAttendee
+ builder.addOperatorToAttendeeFlag = true
+ return builder
+}
+
func (builder *CreateCalendarEventAttendeePathReqBodyBuilder) Build() (*CreateCalendarEventAttendeeReqBody, error) {
req := &CreateCalendarEventAttendeeReqBody{}
if builder.attendeesFlag {
@@ -4867,6 +4951,9 @@ func (builder *CreateCalendarEventAttendeePathReqBodyBuilder) Build() (*CreateCa
if builder.isEnableAdminFlag {
req.IsEnableAdmin = &builder.isEnableAdmin
}
+ if builder.addOperatorToAttendeeFlag {
+ req.AddOperatorToAttendee = &builder.addOperatorToAttendee
+ }
return req, nil
}
@@ -4928,6 +5015,7 @@ type CreateCalendarEventAttendeeReqBody struct {
NeedNotification *bool `json:"need_notification,omitempty"` // 是否给参与人发送bot通知 默认为true
InstanceStartTimeAdmin *string `json:"instance_start_time_admin,omitempty"` // 使用管理员身份访问时要修改的实例(仅用于重复日程修改其中的一个实例,非重复日程无需填此字段)
IsEnableAdmin *bool `json:"is_enable_admin,omitempty"` // 是否启用管理员身份(需先在管理后台设置某人为会议室管理员)
+ AddOperatorToAttendee *bool `json:"add_operator_to_attendee,omitempty"` // 是否添加会议室operate_id标识的用户到参与人
}
type CreateCalendarEventAttendeeReq struct {
@@ -4993,7 +5081,7 @@ func (builder *ListCalendarEventAttendeeReqBuilder) UserIdType(userIdType string
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:780TRhwXXXXX
func (builder *ListCalendarEventAttendeeReqBuilder) PageToken(pageToken string) *ListCalendarEventAttendeeReqBuilder {
@@ -5001,7 +5089,7 @@ func (builder *ListCalendarEventAttendeeReqBuilder) PageToken(pageToken string)
return builder
}
-//
+// 分页大小
//
// 示例值:10
func (builder *ListCalendarEventAttendeeReqBuilder) PageSize(pageSize int) *ListCalendarEventAttendeeReqBuilder {
@@ -5084,7 +5172,7 @@ func (builder *ListCalendarEventAttendeeChatMemberReqBuilder) AttendeeId(attende
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:23jhysaxxxxsysy
func (builder *ListCalendarEventAttendeeChatMemberReqBuilder) PageToken(pageToken string) *ListCalendarEventAttendeeChatMemberReqBuilder {
@@ -5092,7 +5180,7 @@ func (builder *ListCalendarEventAttendeeChatMemberReqBuilder) PageToken(pageToke
return builder
}
-//
+// 分页大小
//
// 示例值:10
func (builder *ListCalendarEventAttendeeChatMemberReqBuilder) PageSize(pageSize int) *ListCalendarEventAttendeeChatMemberReqBuilder {
@@ -5102,7 +5190,7 @@ func (builder *ListCalendarEventAttendeeChatMemberReqBuilder) PageSize(pageSize
// 此次调用中使用的用户ID的类型
//
-// 示例值:user_id
+// 示例值:
func (builder *ListCalendarEventAttendeeChatMemberReqBuilder) UserIdType(userIdType string) *ListCalendarEventAttendeeChatMemberReqBuilder {
builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
return builder
@@ -5155,7 +5243,7 @@ func NewCreateExchangeBindingReqBuilder() *CreateExchangeBindingReqBuilder {
// 此次调用中使用的用户ID的类型
//
-// 示例值:user_id
+// 示例值:
func (builder *CreateExchangeBindingReqBuilder) UserIdType(userIdType string) *CreateExchangeBindingReqBuilder {
builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
return builder
@@ -5262,7 +5350,7 @@ func (builder *GetExchangeBindingReqBuilder) ExchangeBindingId(exchangeBindingId
// 此次调用中使用的用户ID的类型
//
-// 示例值:user_id
+// 示例值:
func (builder *GetExchangeBindingReqBuilder) UserIdType(userIdType string) *GetExchangeBindingReqBuilder {
builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
return builder
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/contact/v3/api.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/contact/v3/api.go
index b3fa2faf5e..508db64815 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/contact/v3/api.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/contact/v3/api.go
@@ -26,8 +26,12 @@ func NewService(config *larkcore.Config) *ContactService {
c.CustomAttrEvent = &customAttrEvent{service: c}
c.Department = &department{service: c}
c.EmployeeTypeEnum = &employeeTypeEnum{service: c}
+ c.FunctionalRole = &functionalRole{service: c}
+ c.FunctionalRoleMember = &functionalRoleMember{service: c}
c.Group = &group{service: c}
c.GroupMember = &groupMember{service: c}
+ c.JobFamily = &jobFamily{service: c}
+ c.JobLevel = &jobLevel{service: c}
c.Scope = &scope{service: c}
c.Unit = &unit{service: c}
c.User = &user{service: c}
@@ -35,16 +39,20 @@ func NewService(config *larkcore.Config) *ContactService {
}
type ContactService struct {
- config *larkcore.Config
- CustomAttr *customAttr // 自定义用户字段
- CustomAttrEvent *customAttrEvent // 事件
- Department *department // 部门
- EmployeeTypeEnum *employeeTypeEnum // 人员类型
- Group *group // 用户组
- GroupMember *groupMember // 用户组成员
- Scope *scope // 通讯录权限范围
- Unit *unit // 单位
- User *user // 用户
+ config *larkcore.Config
+ CustomAttr *customAttr // 自定义用户字段
+ CustomAttrEvent *customAttrEvent // 事件
+ Department *department // 部门
+ EmployeeTypeEnum *employeeTypeEnum // 人员类型
+ FunctionalRole *functionalRole // functional_role
+ FunctionalRoleMember *functionalRoleMember // functional_role.member
+ Group *group // 用户组
+ GroupMember *groupMember // 用户组成员
+ JobFamily *jobFamily // job_family
+ JobLevel *jobLevel // job_level
+ Scope *scope // 通讯录权限范围
+ Unit *unit // 单位
+ User *user // 用户
}
type customAttr struct {
@@ -59,12 +67,24 @@ type department struct {
type employeeTypeEnum struct {
service *ContactService
}
+type functionalRole struct {
+ service *ContactService
+}
+type functionalRoleMember struct {
+ service *ContactService
+}
type group struct {
service *ContactService
}
type groupMember struct {
service *ContactService
}
+type jobFamily struct {
+ service *ContactService
+}
+type jobLevel struct {
+ service *ContactService
+}
type scope struct {
service *ContactService
}
@@ -531,6 +551,222 @@ func (e *employeeTypeEnum) Update(ctx context.Context, req *UpdateEmployeeTypeEn
return resp, err
}
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=contact&resource=functional_role&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/contactv3/create_functionalRole.go
+func (f *functionalRole) Create(ctx context.Context, req *CreateFunctionalRoleReq, options ...larkcore.RequestOptionFunc) (*CreateFunctionalRoleResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/contact/v3/functional_roles"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, f.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateFunctionalRoleResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, f.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=delete&project=contact&resource=functional_role&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/contactv3/delete_functionalRole.go
+func (f *functionalRole) Delete(ctx context.Context, req *DeleteFunctionalRoleReq, options ...larkcore.RequestOptionFunc) (*DeleteFunctionalRoleResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/contact/v3/functional_roles/:role_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, f.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeleteFunctionalRoleResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, f.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=update&project=contact&resource=functional_role&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/contactv3/update_functionalRole.go
+func (f *functionalRole) Update(ctx context.Context, req *UpdateFunctionalRoleReq, options ...larkcore.RequestOptionFunc) (*UpdateFunctionalRoleResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/contact/v3/functional_roles/:role_id"
+ apiReq.HttpMethod = http.MethodPut
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, f.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &UpdateFunctionalRoleResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, f.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=batch_create&project=contact&resource=functional_role.member&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/contactv3/batchCreate_functionalRoleMember.go
+func (f *functionalRoleMember) BatchCreate(ctx context.Context, req *BatchCreateFunctionalRoleMemberReq, options ...larkcore.RequestOptionFunc) (*BatchCreateFunctionalRoleMemberResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/contact/v3/functional_roles/:role_id/members/batch_create"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, f.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &BatchCreateFunctionalRoleMemberResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, f.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=batch_delete&project=contact&resource=functional_role.member&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/contactv3/batchDelete_functionalRoleMember.go
+func (f *functionalRoleMember) BatchDelete(ctx context.Context, req *BatchDeleteFunctionalRoleMemberReq, options ...larkcore.RequestOptionFunc) (*BatchDeleteFunctionalRoleMemberResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/contact/v3/functional_roles/:role_id/members/batch_delete"
+ apiReq.HttpMethod = http.MethodPatch
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, f.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &BatchDeleteFunctionalRoleMemberResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, f.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=get&project=contact&resource=functional_role.member&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/contactv3/get_functionalRoleMember.go
+func (f *functionalRoleMember) Get(ctx context.Context, req *GetFunctionalRoleMemberReq, options ...larkcore.RequestOptionFunc) (*GetFunctionalRoleMemberResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/contact/v3/functional_roles/:role_id/members/:member_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, f.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetFunctionalRoleMemberResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, f.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=contact&resource=functional_role.member&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/contactv3/list_functionalRoleMember.go
+func (f *functionalRoleMember) List(ctx context.Context, req *ListFunctionalRoleMemberReq, options ...larkcore.RequestOptionFunc) (*ListFunctionalRoleMemberResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/contact/v3/functional_roles/:role_id/members"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, f.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListFunctionalRoleMemberResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, f.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+func (f *functionalRoleMember) ListByIterator(ctx context.Context, req *ListFunctionalRoleMemberReq, options ...larkcore.RequestOptionFunc) (*ListFunctionalRoleMemberIterator, error) {
+ return &ListFunctionalRoleMemberIterator{
+ ctx: ctx,
+ req: req,
+ listFunc: f.List,
+ options: options,
+ limit: req.Limit}, nil
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=scopes&project=contact&resource=functional_role.member&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/contactv3/scopes_functionalRoleMember.go
+func (f *functionalRoleMember) Scopes(ctx context.Context, req *ScopesFunctionalRoleMemberReq, options ...larkcore.RequestOptionFunc) (*ScopesFunctionalRoleMemberResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/contact/v3/functional_roles/:role_id/members/scopes"
+ apiReq.HttpMethod = http.MethodPatch
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, f.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ScopesFunctionalRoleMemberResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, f.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
// 创建用户组
//
// - 使用该接口创建用户组,请注意创建用户组时应用的通讯录权限范围需为“全部员工”,否则会创建失败,[点击了解通讯录权限范围](https://open.feishu.cn/document/ukTMukTMukTM/uETNz4SM1MjLxUzM/v3/guides/scope_authority)。
@@ -829,6 +1065,282 @@ func (g *groupMember) Simplelist(ctx context.Context, req *SimplelistGroupMember
return resp, err
}
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=contact&resource=job_family&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/contactv3/create_jobFamily.go
+func (j *jobFamily) Create(ctx context.Context, req *CreateJobFamilyReq, options ...larkcore.RequestOptionFunc) (*CreateJobFamilyResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/contact/v3/job_families"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateJobFamilyResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=delete&project=contact&resource=job_family&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/contactv3/delete_jobFamily.go
+func (j *jobFamily) Delete(ctx context.Context, req *DeleteJobFamilyReq, options ...larkcore.RequestOptionFunc) (*DeleteJobFamilyResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/contact/v3/job_families/:job_family_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeleteJobFamilyResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=get&project=contact&resource=job_family&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/contactv3/get_jobFamily.go
+func (j *jobFamily) Get(ctx context.Context, req *GetJobFamilyReq, options ...larkcore.RequestOptionFunc) (*GetJobFamilyResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/contact/v3/job_families/:job_family_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetJobFamilyResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=contact&resource=job_family&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/contactv3/list_jobFamily.go
+func (j *jobFamily) List(ctx context.Context, req *ListJobFamilyReq, options ...larkcore.RequestOptionFunc) (*ListJobFamilyResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/contact/v3/job_families"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListJobFamilyResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+func (j *jobFamily) ListByIterator(ctx context.Context, req *ListJobFamilyReq, options ...larkcore.RequestOptionFunc) (*ListJobFamilyIterator, error) {
+ return &ListJobFamilyIterator{
+ ctx: ctx,
+ req: req,
+ listFunc: j.List,
+ options: options,
+ limit: req.Limit}, nil
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=update&project=contact&resource=job_family&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/contactv3/update_jobFamily.go
+func (j *jobFamily) Update(ctx context.Context, req *UpdateJobFamilyReq, options ...larkcore.RequestOptionFunc) (*UpdateJobFamilyResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/contact/v3/job_families/:job_family_id"
+ apiReq.HttpMethod = http.MethodPut
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &UpdateJobFamilyResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=contact&resource=job_level&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/contactv3/create_jobLevel.go
+func (j *jobLevel) Create(ctx context.Context, req *CreateJobLevelReq, options ...larkcore.RequestOptionFunc) (*CreateJobLevelResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/contact/v3/job_levels"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateJobLevelResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=delete&project=contact&resource=job_level&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/contactv3/delete_jobLevel.go
+func (j *jobLevel) Delete(ctx context.Context, req *DeleteJobLevelReq, options ...larkcore.RequestOptionFunc) (*DeleteJobLevelResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/contact/v3/job_levels/:job_level_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeleteJobLevelResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=get&project=contact&resource=job_level&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/contactv3/get_jobLevel.go
+func (j *jobLevel) Get(ctx context.Context, req *GetJobLevelReq, options ...larkcore.RequestOptionFunc) (*GetJobLevelResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/contact/v3/job_levels/:job_level_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetJobLevelResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=contact&resource=job_level&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/contactv3/list_jobLevel.go
+func (j *jobLevel) List(ctx context.Context, req *ListJobLevelReq, options ...larkcore.RequestOptionFunc) (*ListJobLevelResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/contact/v3/job_levels"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListJobLevelResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+func (j *jobLevel) ListByIterator(ctx context.Context, req *ListJobLevelReq, options ...larkcore.RequestOptionFunc) (*ListJobLevelIterator, error) {
+ return &ListJobLevelIterator{
+ ctx: ctx,
+ req: req,
+ listFunc: j.List,
+ options: options,
+ limit: req.Limit}, nil
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=update&project=contact&resource=job_level&version=v3
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/contactv3/update_jobLevel.go
+func (j *jobLevel) Update(ctx context.Context, req *UpdateJobLevelReq, options ...larkcore.RequestOptionFunc) (*UpdateJobLevelResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/contact/v3/job_levels/:job_level_id"
+ apiReq.HttpMethod = http.MethodPut
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &UpdateJobLevelResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
// 获取通讯录授权范围
//
// - 该接口用于获取应用被授权可访问的通讯录范围,包括可访问的部门列表、用户列表和用户组列表。;授权范围为全员时,返回的部门列表为该企业所有的一级部门;否则返回的部门为管理员在设置授权范围时勾选的部门(不包含勾选部门的子部门)。
@@ -1269,6 +1781,34 @@ func (u *user) Patch(ctx context.Context, req *PatchUserReq, options ...larkcore
return resp, err
}
+// 恢复已删除用户
+//
+// - 该接口用于恢复已删除用户(已离职的成员),仅自建应用可申请,应用商店应用无权调用接口。
+//
+// - - 仅支持恢复离职 30 天内的成员。恢复后,部分用户数据仍不可恢复,请谨慎调用。;- 待恢复成员的用户 ID 不能被企业内其他成员使用。如有重复,请先离职对应的成员,否则接口会报错。;- 待恢复成员的手机号和邮箱不能被企业内其他成员使用。如有重复,请先修改对应成员的信息,否则接口会报错。
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/resurrect
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/contactv3/resurrect_user.go
+func (u *user) Resurrect(ctx context.Context, req *ResurrectUserReq, options ...larkcore.RequestOptionFunc) (*ResurrectUserResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/contact/v3/users/:user_id/resurrect"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, u.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ResurrectUserResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, u.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
// 更新用户所有信息
//
// - 该接口用于更新通讯录中用户的字段。
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/contact/v3/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/contact/v3/model.go
index d316ab967a..9baee885de 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/contact/v3/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/contact/v3/model.go
@@ -147,8 +147,76 @@ const (
)
const (
- GroupTypeAssign = 1 // 普通用户组
+ RoleMemberIDTypeOpenId = "open_id" // 用户的open_id
+ RoleMemberIDTypeUnionId = "union_id" // 用户的union_id
+ RoleMemberIDTypeUserId = "user_id" // 用户的user_id
+)
+
+const (
+ RoleMemberIDTypeBatchDeleteFunctionalRoleMemberOpenId = "open_id" // 用户的open_id
+ RoleMemberIDTypeBatchDeleteFunctionalRoleMemberUnionId = "union_id" // 用户的user_id
+ RoleMemberIDTypeBatchDeleteFunctionalRoleMemberUserId = "user_id" // 用户的user_id
+)
+
+const (
+ RoleMemberIDTypeGetFunctionalRoleMemberOpenId = "open_id" // 用户的open_id
+ RoleMemberIDTypeGetFunctionalRoleMemberUnionId = "union_id" // 用户的union_id
+ RoleMemberIDTypeGetFunctionalRoleMemberUserId = "user_id" // 用户的user_id
+)
+
+const (
+ RoleMemberScopeIDTypeDepartmentId = "department_id" // 以自定义department_id来标识部门
+ RoleMemberScopeIDTypeOpenDepartmentId = "open_department_id" // 以open_department_id来标识部门
+)
+
+const (
+ RoleMemberIDTypeListFunctionalRoleMemberOpenId = "open_id" // 用户的open_id
+ RoleMemberIDTypeListFunctionalRoleMemberUnionId = "union_id" // 用户的union_id
+ RoleMemberIDTypeListFunctionalRoleMemberUserId = "user_id" // 用户的user_id
+)
+
+const (
+ RoleMemberScopeIDTypeListFunctionalRoleMemberDepartmentId = "department_id" // 以自定义department_id来标识部门
+ RoleMemberScopeIDTypeListFunctionalRoleMemberOpenDepartmentId = "open_department_id" // 以open_department_id来标识部门
+)
+
+const (
+ RoleMemberIDTypeScopesFunctionalRoleMemberOpenId = "open_id" // 用户的open_id
+ RoleMemberIDTypeScopesFunctionalRoleMemberUnionId = "union_id" // 用户的union_id
+ RoleMemberIDTypeScopesFunctionalRoleMemberUserId = "user_id" // 用户的user_id
+)
+
+const (
+ RoleMemberScopeIDTypeScopesFunctionalRoleMemberDepartmentId = "department_id" // 以自定义department_id来标识部门
+ RoleMemberScopeIDTypeScopesFunctionalRoleMemberOpenDepartmentId = "open_department_id" // 以open_department_id来标识部门
+)
+
+const (
+ GroupTypeAssign = 1 // 普通用户组
+ GroupTypeDynamic = 2 // 动态用户组
+
+)
+
+const (
+ UserIdTypeCreateGroupUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeCreateGroupUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeCreateGroupOpenId = "open_id" // 以open_id来识别用户
+)
+
+const (
+ DepartmentIdTypeCreateGroupOpenDepartmentId = "open_department_id" // 以open_department_id来标识部门
+ DepartmentIdTypeCreateGroupDepartmentId = "department_id" // 以自定义department_id来标识部门
+)
+const (
+ UserIdTypeGetGroupUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeGetGroupUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeGetGroupOpenId = "open_id" // 以open_id来识别用户
+)
+
+const (
+ DepartmentIdTypeGetGroupOpenDepartmentId = "open_department_id" // 以open_department_id来标识部门
+ DepartmentIdTypeGetGroupDepartmentId = "department_id" // 以自定义department_id来标识部门
)
const (
@@ -163,6 +231,17 @@ const (
)
+const (
+ UserIdTypePatchGroupUserId = "user_id" // 以user_id来识别用户
+ UserIdTypePatchGroupUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypePatchGroupOpenId = "open_id" // 以open_id来识别用户
+)
+
+const (
+ DepartmentIdTypePatchGroupDepartmentId = "department_id" // 以自定义department_id来标识部门
+ DepartmentIdTypePatchGroupOpenDepartmentId = "open_department_id" // 以open_department_id来标识部门
+)
+
const (
GroupTypeSimplelistGroupAssign = 1 // 普通用户组
GroupTypeSimplelistGroupDynamic = 2 // 动态用户组
@@ -308,6 +387,17 @@ const (
DepartmentIdTypePatchUserOpenDepartmentId = "open_department_id" // 以open_department_id来标识部门
)
+const (
+ UserIdTypeResurrectUserOpenId = "open_id" // 用户的 open id
+ UserIdTypeResurrectUserUnionId = "union_id" // 用户的 union id
+ UserIdTypeResurrectUserUserId = "user_id" // 用户的 user id
+)
+
+const (
+ DepartmentIdTypeResurrectUserDepartmentId = "department_id" // 以自定义department_id来标识部门
+ DepartmentIdTypeResurrectUserOpenDepartmentId = "open_department_id" // 以open_department_id来标识部门
+)
+
const (
GenderTypeUpdateUserUnkown = 0 // 未知
GenderTypeUpdateUserMale = 1 // 男
@@ -881,6 +971,7 @@ type Department struct {
Leaders []*DepartmentLeader `json:"leaders,omitempty"` // 部门负责人
GroupChatEmployeeTypes []int `json:"group_chat_employee_types,omitempty"` // 部门群雇员类型限制。[]空列表时,表示为无任何雇员类型。类型字段可包含以下值,支持多个类型值;若有多个,用英文','分隔:;1、正式员工;2、实习生;3、外包;4、劳务;5、顾问;6、其他自定义类型字段,可通过下方接口获取到该租户的自定义员工类型的名称,参见[获取人员类型](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/list)。
DepartmentHrbps []string `json:"department_hrbps,omitempty"` // 部门HRBP
+ PrimaryMemberCount *int `json:"primary_member_count,omitempty"` // 部门下主属用户的个数
}
type DepartmentBuilder struct {
@@ -914,6 +1005,8 @@ type DepartmentBuilder struct {
groupChatEmployeeTypesFlag bool
departmentHrbps []string // 部门HRBP
departmentHrbpsFlag bool
+ primaryMemberCount int // 部门下主属用户的个数
+ primaryMemberCountFlag bool
}
func NewDepartmentBuilder() *DepartmentBuilder {
@@ -1056,6 +1149,15 @@ func (builder *DepartmentBuilder) DepartmentHrbps(departmentHrbps []string) *Dep
return builder
}
+// 部门下主属用户的个数
+//
+// 示例值:100
+func (builder *DepartmentBuilder) PrimaryMemberCount(primaryMemberCount int) *DepartmentBuilder {
+ builder.primaryMemberCount = primaryMemberCount
+ builder.primaryMemberCountFlag = true
+ return builder
+}
+
func (builder *DepartmentBuilder) Build() *Department {
req := &Department{}
if builder.nameFlag {
@@ -1112,6 +1214,10 @@ func (builder *DepartmentBuilder) Build() *Department {
if builder.departmentHrbpsFlag {
req.DepartmentHrbps = builder.departmentHrbps
}
+ if builder.primaryMemberCountFlag {
+ req.PrimaryMemberCount = &builder.primaryMemberCount
+
+ }
return req
}
@@ -1259,6 +1365,68 @@ func (builder *DepartmentCountBuilder) Build() *DepartmentCount {
return req
}
+type DepartmentDetail struct {
+ DepartmentId *string `json:"department_id,omitempty"` // 部门ID
+ DepartmentName *DepartmentPathName `json:"department_name,omitempty"` // 部门名
+ DepartmentPath *DepartmentPath `json:"department_path,omitempty"` // 部门路径
+}
+
+type DepartmentDetailBuilder struct {
+ departmentId string // 部门ID
+ departmentIdFlag bool
+ departmentName *DepartmentPathName // 部门名
+ departmentNameFlag bool
+ departmentPath *DepartmentPath // 部门路径
+ departmentPathFlag bool
+}
+
+func NewDepartmentDetailBuilder() *DepartmentDetailBuilder {
+ builder := &DepartmentDetailBuilder{}
+ return builder
+}
+
+// 部门ID
+//
+// 示例值:od-4e6ac4d14bcd5071a37a39de902c7141
+func (builder *DepartmentDetailBuilder) DepartmentId(departmentId string) *DepartmentDetailBuilder {
+ builder.departmentId = departmentId
+ builder.departmentIdFlag = true
+ return builder
+}
+
+// 部门名
+//
+// 示例值:
+func (builder *DepartmentDetailBuilder) DepartmentName(departmentName *DepartmentPathName) *DepartmentDetailBuilder {
+ builder.departmentName = departmentName
+ builder.departmentNameFlag = true
+ return builder
+}
+
+// 部门路径
+//
+// 示例值:
+func (builder *DepartmentDetailBuilder) DepartmentPath(departmentPath *DepartmentPath) *DepartmentDetailBuilder {
+ builder.departmentPath = departmentPath
+ builder.departmentPathFlag = true
+ return builder
+}
+
+func (builder *DepartmentDetailBuilder) Build() *DepartmentDetail {
+ req := &DepartmentDetail{}
+ if builder.departmentIdFlag {
+ req.DepartmentId = &builder.departmentId
+
+ }
+ if builder.departmentNameFlag {
+ req.DepartmentName = builder.departmentName
+ }
+ if builder.departmentPathFlag {
+ req.DepartmentPath = builder.departmentPath
+ }
+ return req
+}
+
type DepartmentEvent struct {
Name *string `json:"name,omitempty"` // 部门名称
ParentDepartmentId *string `json:"parent_department_id,omitempty"` // 父部门的部门open_department_id [部门相关ID概念](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/field-overview#23857fe0)
@@ -1546,6 +1714,99 @@ func (builder *DepartmentParentBuilder) Build() *DepartmentParent {
return req
}
+type DepartmentPath struct {
+ DepartmentIds []string `json:"department_ids,omitempty"` // 部门路径IDs
+ DepartmentPathName *DepartmentPathName `json:"department_path_name,omitempty"` // 部门路径名字
+}
+
+type DepartmentPathBuilder struct {
+ departmentIds []string // 部门路径IDs
+ departmentIdsFlag bool
+ departmentPathName *DepartmentPathName // 部门路径名字
+ departmentPathNameFlag bool
+}
+
+func NewDepartmentPathBuilder() *DepartmentPathBuilder {
+ builder := &DepartmentPathBuilder{}
+ return builder
+}
+
+// 部门路径IDs
+//
+// 示例值:
+func (builder *DepartmentPathBuilder) DepartmentIds(departmentIds []string) *DepartmentPathBuilder {
+ builder.departmentIds = departmentIds
+ builder.departmentIdsFlag = true
+ return builder
+}
+
+// 部门路径名字
+//
+// 示例值:
+func (builder *DepartmentPathBuilder) DepartmentPathName(departmentPathName *DepartmentPathName) *DepartmentPathBuilder {
+ builder.departmentPathName = departmentPathName
+ builder.departmentPathNameFlag = true
+ return builder
+}
+
+func (builder *DepartmentPathBuilder) Build() *DepartmentPath {
+ req := &DepartmentPath{}
+ if builder.departmentIdsFlag {
+ req.DepartmentIds = builder.departmentIds
+ }
+ if builder.departmentPathNameFlag {
+ req.DepartmentPathName = builder.departmentPathName
+ }
+ return req
+}
+
+type DepartmentPathName struct {
+ Name *string `json:"name,omitempty"` // 部门名
+ I18nName *DepartmentI18nName `json:"i18n_name,omitempty"` // 部门国际化名
+}
+
+type DepartmentPathNameBuilder struct {
+ name string // 部门名
+ nameFlag bool
+ i18nName *DepartmentI18nName // 部门国际化名
+ i18nNameFlag bool
+}
+
+func NewDepartmentPathNameBuilder() *DepartmentPathNameBuilder {
+ builder := &DepartmentPathNameBuilder{}
+ return builder
+}
+
+// 部门名
+//
+// 示例值:测试部门名1
+func (builder *DepartmentPathNameBuilder) Name(name string) *DepartmentPathNameBuilder {
+ builder.name = name
+ builder.nameFlag = true
+ return builder
+}
+
+// 部门国际化名
+//
+// 示例值:
+func (builder *DepartmentPathNameBuilder) I18nName(i18nName *DepartmentI18nName) *DepartmentPathNameBuilder {
+ builder.i18nName = i18nName
+ builder.i18nNameFlag = true
+ return builder
+}
+
+func (builder *DepartmentPathNameBuilder) Build() *DepartmentPathName {
+ req := &DepartmentPathName{}
+ if builder.nameFlag {
+ req.Name = &builder.name
+
+ }
+ if builder.i18nNameFlag {
+ req.I18nName = builder.i18nName
+ }
+ return req
+}
+
type DepartmentStatus struct {
IsDeleted *bool `json:"is_deleted,omitempty"` // 是否被删除
}
@@ -1642,6 +1903,209 @@ func (builder *DepartmentUnitBuilder) Build() *DepartmentUnit {
return req
}
+type DynamicGroupExpression struct {
+ Field *string `json:"field,omitempty"` // 动态用户组表达式的左值,属性名称
+ Operator *string `json:"operator,omitempty"` // 操作符,表示左值进行什么操作
+ Value *string `json:"value,omitempty"` // 值,单个结果,用于单值运算,比如:等于操作
+ Values []string `json:"values,omitempty"` // 值,多个结果,用于多值操作,比如属于
+}
+
+type DynamicGroupExpressionBuilder struct {
+ field string // 动态用户组表达式的左值,属性名称
+ fieldFlag bool
+ operator string // 操作符,表示左值进行什么操作
+ operatorFlag bool
+ value string // 值,单个结果,用于单值运算,比如:等于操作
+ valueFlag bool
+ values []string // 值,多个结果,用于多值操作,比如属于
+ valuesFlag bool
+}
+
+func NewDynamicGroupExpressionBuilder() *DynamicGroupExpressionBuilder {
+ builder := &DynamicGroupExpressionBuilder{}
+ return builder
+}
+
+// 动态用户组表达式的左值,属性名称
+//
+// 示例值:user.name
+func (builder *DynamicGroupExpressionBuilder) Field(field string) *DynamicGroupExpressionBuilder {
+ builder.field = field
+ builder.fieldFlag = true
+ return builder
+}
+
+// 操作符,表示左值进行什么操作
+//
+// 示例值:-eq
+func (builder *DynamicGroupExpressionBuilder) Operator(operator string) *DynamicGroupExpressionBuilder {
+ builder.operator = operator
+ builder.operatorFlag = true
+ return builder
+}
+
+// 值,单个结果,用于单值运算,比如:等于操作
+//
+// 示例值:value
+func (builder *DynamicGroupExpressionBuilder) Value(value string) *DynamicGroupExpressionBuilder {
+ builder.value = value
+ builder.valueFlag = true
+ return builder
+}
+
+// 值,多个结果,用于多值操作,比如属于
+//
+// 示例值:
+func (builder *DynamicGroupExpressionBuilder) Values(values []string) *DynamicGroupExpressionBuilder {
+ builder.values = values
+ builder.valuesFlag = true
+ return builder
+}
+
+func (builder *DynamicGroupExpressionBuilder) Build() *DynamicGroupExpression {
+ req := &DynamicGroupExpression{}
+ if builder.fieldFlag {
+ req.Field = &builder.field
+
+ }
+ if builder.operatorFlag {
+ req.Operator = &builder.operator
+
+ }
+ if builder.valueFlag {
+ req.Value = &builder.value
+
+ }
+ if builder.valuesFlag {
+ req.Values = builder.values
+ }
+ return req
+}
+
+type DynamicGroupRule struct {
+ DepartmentIds []string `json:"department_ids,omitempty"` // 动态用户组匹配部门列表
+ DepartmentLevel *string `json:"department_level,omitempty"` // 动态用户组匹配部门层级
+ Expressions []*DynamicGroupExpression `json:"expressions,omitempty"` // 动态用户组规则表达式
+ JoinerRule *string `json:"joiner_rule,omitempty"` // 动态用户组表达式组合关系
+ WhiteList []string `json:"white_list,omitempty"` // 白名单用户 ID 列表,白名单用户一定会被拉入动态用户组
+ BlackList []string `json:"black_list,omitempty"` // 黑名单用户 ID 列表,黑名单用户一定会被排查在用户组外
+ GroupStatus *string `json:"group_status,omitempty"` // 动态用户组计算状态,只读,创建、更新用户组时不需要填写
+}
+
+type DynamicGroupRuleBuilder struct {
+ departmentIds []string // 动态用户组匹配部门列表
+ departmentIdsFlag bool
+ departmentLevel string // 动态用户组匹配部门层级
+ departmentLevelFlag bool
+ expressions []*DynamicGroupExpression // 动态用户组规则表达式
+ expressionsFlag bool
+ joinerRule string // 动态用户组表达式组合关系
+ joinerRuleFlag bool
+ whiteList []string // 白名单用户 ID 列表,白名单用户一定会被拉入动态用户组
+ whiteListFlag bool
+ blackList []string // 黑名单用户 ID 列表,黑名单用户一定会被排查在用户组外
+ blackListFlag bool
+ groupStatus string // 动态用户组计算状态,只读,创建、更新用户组时不需要填写
+ groupStatusFlag bool
+}
+
+func NewDynamicGroupRuleBuilder() *DynamicGroupRuleBuilder {
+ builder := &DynamicGroupRuleBuilder{}
+ return builder
+}
+
+// 动态用户组匹配部门列表
+//
+// 示例值:
+func (builder *DynamicGroupRuleBuilder) DepartmentIds(departmentIds []string) *DynamicGroupRuleBuilder {
+ builder.departmentIds = departmentIds
+ builder.departmentIdsFlag = true
+ return builder
+}
+
+// 动态用户组匹配部门层级
+//
+// 示例值:recursive
+func (builder *DynamicGroupRuleBuilder) DepartmentLevel(departmentLevel string) *DynamicGroupRuleBuilder {
+ builder.departmentLevel = departmentLevel
+ builder.departmentLevelFlag = true
+ return builder
+}
+
+// 动态用户组规则表达式
+//
+// 示例值:
+func (builder *DynamicGroupRuleBuilder) Expressions(expressions []*DynamicGroupExpression) *DynamicGroupRuleBuilder {
+ builder.expressions = expressions
+ builder.expressionsFlag = true
+ return builder
+}
+
+// 动态用户组表达式组合关系
+//
+// 示例值:1 and (2 or 3)
+func (builder *DynamicGroupRuleBuilder) JoinerRule(joinerRule string) *DynamicGroupRuleBuilder {
+ builder.joinerRule = joinerRule
+ builder.joinerRuleFlag = true
+ return builder
+}
+
+// 白名单用户 ID 列表,白名单用户一定会被拉入动态用户组
+//
+// 示例值:
+func (builder *DynamicGroupRuleBuilder) WhiteList(whiteList []string) *DynamicGroupRuleBuilder {
+ builder.whiteList = whiteList
+ builder.whiteListFlag = true
+ return builder
+}
+
+// 黑名单用户 ID 列表,黑名单用户一定会被排查在用户组外
+//
+// 示例值:
+func (builder *DynamicGroupRuleBuilder) BlackList(blackList []string) *DynamicGroupRuleBuilder {
+ builder.blackList = blackList
+ builder.blackListFlag = true
+ return builder
+}
+
+// 动态用户组计算状态,只读,创建、更新用户组时不需要填写
+//
+// 示例值:1
+func (builder *DynamicGroupRuleBuilder) GroupStatus(groupStatus string) *DynamicGroupRuleBuilder {
+ builder.groupStatus = groupStatus
+ builder.groupStatusFlag = true
+ return builder
+}
+
+func (builder *DynamicGroupRuleBuilder) Build() *DynamicGroupRule {
+ req := &DynamicGroupRule{}
+ if builder.departmentIdsFlag {
+ req.DepartmentIds = builder.departmentIds
+ }
+ if builder.departmentLevelFlag {
+ req.DepartmentLevel = &builder.departmentLevel
+
+ }
+ if builder.expressionsFlag {
+ req.Expressions = builder.expressions
+ }
+ if builder.joinerRuleFlag {
+ req.JoinerRule = &builder.joinerRule
+
+ }
+ if builder.whiteListFlag {
+ req.WhiteList = builder.whiteList
+ }
+ if builder.blackListFlag {
+ req.BlackList = builder.blackList
+ }
+ if builder.groupStatusFlag {
+ req.GroupStatus = &builder.groupStatus
+
+ }
+ return req
+}
+
type EmployeeTypeEnum struct {
EnumId *string `json:"enum_id,omitempty"` // 枚举值id
EnumValue *string `json:"enum_value,omitempty"` // 枚举的编号值,创建新的人员类型后,系统生成对应编号。对应[创建用户接口](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/create)中用户信息的employee_type字段值
@@ -1892,7 +2356,7 @@ func (builder *FunctionalRoleMemberResultBuilder) UserId(userId string) *Functio
// 成员处理结果
//
-// 示例值:0
+// 示例值:1
func (builder *FunctionalRoleMemberResultBuilder) Reason(reason int) *FunctionalRoleMemberResultBuilder {
builder.reason = reason
builder.reasonFlag = true
@@ -1913,11 +2377,16 @@ func (builder *FunctionalRoleMemberResultBuilder) Build() *FunctionalRoleMemberR
}
type Group struct {
- Id *string `json:"id,omitempty"` // 用户组ID
- Name *string `json:"name,omitempty"` // 用户组名字
- Description *string `json:"description,omitempty"` // 用户组描述
- MemberUserCount *int `json:"member_user_count,omitempty"` // 用户组成员中用户的数量
- MemberDepartmentCount *int `json:"member_department_count,omitempty"` // 普通用户组成员中部门的数量,动态用户组成员中没有部门。
+ Id *string `json:"id,omitempty"` // 用户组ID
+ Name *string `json:"name,omitempty"` // 用户组名字
+ Description *string `json:"description,omitempty"` // 用户组描述
+ MemberUserCount *int `json:"member_user_count,omitempty"` // 用户组成员中用户的数量
+ MemberDepartmentCount *int `json:"member_department_count,omitempty"` // 普通用户组成员中部门的数量,动态用户组成员中没有部门。
+ Type *int `json:"type,omitempty"` // 用户组的类型
+ DynamicGroupRule *DynamicGroupRule `json:"dynamic_group_rule,omitempty"` // 动态用户组的规则
+ VisibleScope *GroupVisibleScope `json:"visible_scope,omitempty"` // 用户组指定可见范围
+ DepartmentScopeList []string `json:"department_scope_list,omitempty"` // 部门范围
+ GroupId *string `json:"group_id,omitempty"` // 自定义用户组ID
}
type GroupBuilder struct {
@@ -1931,6 +2400,16 @@ type GroupBuilder struct {
memberUserCountFlag bool
memberDepartmentCount int // 普通用户组成员中部门的数量,动态用户组成员中没有部门。
memberDepartmentCountFlag bool
+ type_ int // 用户组的类型
+ typeFlag bool
+ dynamicGroupRule *DynamicGroupRule // 动态用户组的规则
+ dynamicGroupRuleFlag bool
+ visibleScope *GroupVisibleScope // 用户组指定可见范围
+ visibleScopeFlag bool
+ departmentScopeList []string // 部门范围
+ departmentScopeListFlag bool
+ groupId string // 自定义用户组ID
+ groupIdFlag bool
}
func NewGroupBuilder() *GroupBuilder {
@@ -1983,10 +2462,55 @@ func (builder *GroupBuilder) MemberDepartmentCount(memberDepartmentCount int) *G
return builder
}
-func (builder *GroupBuilder) Build() *Group {
- req := &Group{}
- if builder.idFlag {
- req.Id = &builder.id
+// 用户组的类型
+//
+// 示例值:1
+func (builder *GroupBuilder) Type(type_ int) *GroupBuilder {
+ builder.type_ = type_
+ builder.typeFlag = true
+ return builder
+}
+
+// 动态用户组的规则
+//
+// 示例值:
+func (builder *GroupBuilder) DynamicGroupRule(dynamicGroupRule *DynamicGroupRule) *GroupBuilder {
+ builder.dynamicGroupRule = dynamicGroupRule
+ builder.dynamicGroupRuleFlag = true
+ return builder
+}
+
+// 用户组指定可见范围
+//
+// 示例值:
+func (builder *GroupBuilder) VisibleScope(visibleScope *GroupVisibleScope) *GroupBuilder {
+ builder.visibleScope = visibleScope
+ builder.visibleScopeFlag = true
+ return builder
+}
+
+// 部门范围
+//
+// 示例值:
+func (builder *GroupBuilder) DepartmentScopeList(departmentScopeList []string) *GroupBuilder {
+ builder.departmentScopeList = departmentScopeList
+ builder.departmentScopeListFlag = true
+ return builder
+}
+
+// 自定义用户组ID
+//
+// 示例值:4ba51ab38648f9cd
+func (builder *GroupBuilder) GroupId(groupId string) *GroupBuilder {
+ builder.groupId = groupId
+ builder.groupIdFlag = true
+ return builder
+}
+
+func (builder *GroupBuilder) Build() *Group {
+ req := &Group{}
+ if builder.idFlag {
+ req.Id = &builder.id
}
if builder.nameFlag {
@@ -2004,6 +2528,23 @@ func (builder *GroupBuilder) Build() *Group {
if builder.memberDepartmentCountFlag {
req.MemberDepartmentCount = &builder.memberDepartmentCount
+ }
+ if builder.typeFlag {
+ req.Type = &builder.type_
+
+ }
+ if builder.dynamicGroupRuleFlag {
+ req.DynamicGroupRule = builder.dynamicGroupRule
+ }
+ if builder.visibleScopeFlag {
+ req.VisibleScope = builder.visibleScope
+ }
+ if builder.departmentScopeListFlag {
+ req.DepartmentScopeList = builder.departmentScopeList
+ }
+ if builder.groupIdFlag {
+ req.GroupId = &builder.groupId
+
}
return req
}
@@ -2056,6 +2597,83 @@ func (builder *GroupEventBuilder) Build() *GroupEvent {
return req
}
+type GroupVisibleScope struct {
+ VisibleScopeType *string `json:"visible_scope_type,omitempty"` // 可见范围的 id 类型,包用户、部门两类
+ VisibleUsers []string `json:"visible_users,omitempty"` // 指定可见用户组的用户 ID列表
+ VisibleDepartments []string `json:"visible_departments,omitempty"` // 指定可见用户组的部门 ID 列表
+ SceneTypes []int `json:"scene_types,omitempty"` // 用户组可用范围
+}
+
+type GroupVisibleScopeBuilder struct {
+ visibleScopeType string // 可见范围的 id 类型,包用户、部门两类
+ visibleScopeTypeFlag bool
+ visibleUsers []string // 指定可见用户组的用户 ID列表
+ visibleUsersFlag bool
+ visibleDepartments []string // 指定可见用户组的部门 ID 列表
+ visibleDepartmentsFlag bool
+ sceneTypes []int // 用户组可用范围
+ sceneTypesFlag bool
+}
+
+func NewGroupVisibleScopeBuilder() *GroupVisibleScopeBuilder {
+ builder := &GroupVisibleScopeBuilder{}
+ return builder
+}
+
+// 可见范围的 id 类型,包用户、部门两类
+//
+// 示例值:invisible
+func (builder *GroupVisibleScopeBuilder) VisibleScopeType(visibleScopeType string) *GroupVisibleScopeBuilder {
+ builder.visibleScopeType = visibleScopeType
+ builder.visibleScopeTypeFlag = true
+ return builder
+}
+
+// 指定可见用户组的用户 ID列表
+//
+// 示例值:cfe29725
+func (builder *GroupVisibleScopeBuilder) VisibleUsers(visibleUsers []string) *GroupVisibleScopeBuilder {
+ builder.visibleUsers = visibleUsers
+ builder.visibleUsersFlag = true
+ return builder
+}
+
+// 指定可见用户组的部门 ID 列表
+//
+// 示例值:
+func (builder *GroupVisibleScopeBuilder) VisibleDepartments(visibleDepartments []string) *GroupVisibleScopeBuilder {
+ builder.visibleDepartments = visibleDepartments
+ builder.visibleDepartmentsFlag = true
+ return builder
+}
+
+// 用户组可用范围
+//
+// 示例值:
+func (builder *GroupVisibleScopeBuilder) SceneTypes(sceneTypes []int) *GroupVisibleScopeBuilder {
+ builder.sceneTypes = sceneTypes
+ builder.sceneTypesFlag = true
+ return builder
+}
+
+func (builder *GroupVisibleScopeBuilder) Build() *GroupVisibleScope {
+ req := &GroupVisibleScope{}
+ if builder.visibleScopeTypeFlag {
+ req.VisibleScopeType = &builder.visibleScopeType
+
+ }
+ if builder.visibleUsersFlag {
+ req.VisibleUsers = builder.visibleUsers
+ }
+ if builder.visibleDepartmentsFlag {
+ req.VisibleDepartments = builder.visibleDepartments
+ }
+ if builder.sceneTypesFlag {
+ req.SceneTypes = builder.sceneTypes
+ }
+ return req
+}
+
type I18nContent struct {
Locale *string `json:"locale,omitempty"` // 语言版本
Value *string `json:"value,omitempty"` // 字段名
@@ -2356,6 +2974,85 @@ func (builder *JobLevelBuilder) Build() *JobLevel {
return req
}
+type JobTitle struct {
+ JobTitleId *string `json:"job_title_id,omitempty"` // 职务ID
+ Name *string `json:"name,omitempty"` // 职务名称。1-100字符,支持中、英文及符号
+ I18nName []*I18nContent `json:"i18n_name,omitempty"` // 多语言职务名称
+ Status *bool `json:"status,omitempty"` // 是否启用
+}
+
+type JobTitleBuilder struct {
+ jobTitleId string // 职务ID
+ jobTitleIdFlag bool
+ name string // 职务名称。1-100字符,支持中、英文及符号
+ nameFlag bool
+ i18nName []*I18nContent // 多语言职务名称
+ i18nNameFlag bool
+ status bool // 是否启用
+ statusFlag bool
+}
+
+func NewJobTitleBuilder() *JobTitleBuilder {
+ builder := &JobTitleBuilder{}
+ return builder
+}
+
+// 职务ID
+//
+// 示例值:b5565c46b749
+func (builder *JobTitleBuilder) JobTitleId(jobTitleId string) *JobTitleBuilder {
+ builder.jobTitleId = jobTitleId
+ builder.jobTitleIdFlag = true
+ return builder
+}
+
+// 职务名称。1-100字符,支持中、英文及符号
+//
+// 示例值:高级工程师
+func (builder *JobTitleBuilder) Name(name string) *JobTitleBuilder {
+ builder.name = name
+ builder.nameFlag = true
+ return builder
+}
+
+// 多语言职务名称
+//
+// 示例值:
+func (builder *JobTitleBuilder) I18nName(i18nName []*I18nContent) *JobTitleBuilder {
+ builder.i18nName = i18nName
+ builder.i18nNameFlag = true
+ return builder
+}
+
+// 是否启用
+//
+// 示例值:true 表示启用, false表示未启用
+func (builder *JobTitleBuilder) Status(status bool) *JobTitleBuilder {
+ builder.status = status
+ builder.statusFlag = true
+ return builder
+}
+
+func (builder *JobTitleBuilder) Build() *JobTitle {
+ req := &JobTitle{}
+ if builder.jobTitleIdFlag {
+ req.JobTitleId = &builder.jobTitleId
+
+ }
+ if builder.nameFlag {
+ req.Name = &builder.name
+
+ }
+ if builder.i18nNameFlag {
+ req.I18nName = builder.i18nName
+ }
+ if builder.statusFlag {
+ req.Status = &builder.status
+
+ }
+ return req
+}
+
type MemberResult struct {
MemberId *string `json:"member_id,omitempty"` // 成员ID
Code *int `json:"code,omitempty"` // 结果响应码,0表示成功
@@ -3082,12 +3779,13 @@ type User struct {
JobTitle *string `json:"job_title,omitempty"` // 职务
- IsFrozen *bool `json:"is_frozen,omitempty"` // 是否暂停用户
-
- JobLevelId *string `json:"job_level_id,omitempty"` // 职级ID
- JobFamilyId *string `json:"job_family_id,omitempty"` // 序列ID
- SubscriptionIds []string `json:"subscription_ids,omitempty"` // 分配给用户的席位ID列表
- AssignInfo []*UserAssignInfo `json:"assign_info,omitempty"` // 用户席位列表
+ IsFrozen *bool `json:"is_frozen,omitempty"` // 是否暂停用户
+ Geo *string `json:"geo,omitempty"` // 数据驻留地
+ JobLevelId *string `json:"job_level_id,omitempty"` // 职级ID
+ JobFamilyId *string `json:"job_family_id,omitempty"` // 序列ID
+ SubscriptionIds []string `json:"subscription_ids,omitempty"` // 分配给用户的席位ID列表
+ AssignInfo []*UserAssignInfo `json:"assign_info,omitempty"` // 用户席位列表
+ DepartmentPath []*DepartmentDetail `json:"department_path,omitempty"` // 部门路径
}
type UserBuilder struct {
@@ -3146,9 +3844,10 @@ type UserBuilder struct {
jobTitle string // 职务
jobTitleFlag bool
- isFrozen bool // 是否暂停用户
- isFrozenFlag bool
-
+ isFrozen bool // 是否暂停用户
+ isFrozenFlag bool
+ geo string // 数据驻留地
+ geoFlag bool
jobLevelId string // 职级ID
jobLevelIdFlag bool
jobFamilyId string // 序列ID
@@ -3157,6 +3856,8 @@ type UserBuilder struct {
subscriptionIdsFlag bool
assignInfo []*UserAssignInfo // 用户席位列表
assignInfoFlag bool
+ departmentPath []*DepartmentDetail // 部门路径
+ departmentPathFlag bool
}
func NewUserBuilder() *UserBuilder {
@@ -3407,6 +4108,15 @@ func (builder *UserBuilder) IsFrozen(isFrozen bool) *UserBuilder {
return builder
}
+// 数据驻留地
+//
+// 示例值:cn
+func (builder *UserBuilder) Geo(geo string) *UserBuilder {
+ builder.geo = geo
+ builder.geoFlag = true
+ return builder
+}
+
// 职级ID
//
// 示例值:mga5oa8ayjlp9rb
@@ -3443,6 +4153,15 @@ func (builder *UserBuilder) AssignInfo(assignInfo []*UserAssignInfo) *UserBuilde
return builder
}
+// 部门路径
+//
+// 示例值:
+func (builder *UserBuilder) DepartmentPath(departmentPath []*DepartmentDetail) *UserBuilder {
+ builder.departmentPath = departmentPath
+ builder.departmentPathFlag = true
+ return builder
+}
+
func (builder *UserBuilder) Build() *User {
req := &User{}
if builder.unionIdFlag {
@@ -3551,7 +4270,10 @@ func (builder *UserBuilder) Build() *User {
req.IsFrozen = &builder.isFrozen
}
+ if builder.geoFlag {
+ req.Geo = &builder.geo
+ }
if builder.jobLevelIdFlag {
req.JobLevelId = &builder.jobLevelId
@@ -3566,6 +4288,9 @@ func (builder *UserBuilder) Build() *User {
if builder.assignInfoFlag {
req.AssignInfo = builder.assignInfo
}
+ if builder.departmentPathFlag {
+ req.DepartmentPath = builder.departmentPath
+ }
return req
}
@@ -4536,6 +5261,70 @@ func (builder *UserGroupBuilder) Build() *UserGroup {
type UserGroupMember struct {
}
+type UserI18nName struct {
+ ZhCn *string `json:"zh_cn,omitempty"` // 用户的中文名
+ JaJp *string `json:"ja_jp,omitempty"` // 用户的日文名
+ EnUs *string `json:"en_us,omitempty"` // 用户的英文名
+}
+
+type UserI18nNameBuilder struct {
+ zhCn string // 用户的中文名
+ zhCnFlag bool
+ jaJp string // 用户的日文名
+ jaJpFlag bool
+ enUs string // 用户的英文名
+ enUsFlag bool
+}
+
+func NewUserI18nNameBuilder() *UserI18nNameBuilder {
+ builder := &UserI18nNameBuilder{}
+ return builder
+}
+
+// 用户的中文名
+//
+// 示例值:zh_cn_name
+func (builder *UserI18nNameBuilder) ZhCn(zhCn string) *UserI18nNameBuilder {
+ builder.zhCn = zhCn
+ builder.zhCnFlag = true
+ return builder
+}
+
+// 用户的日文名
+//
+// 示例值:ja_jp_name
+func (builder *UserI18nNameBuilder) JaJp(jaJp string) *UserI18nNameBuilder {
+ builder.jaJp = jaJp
+ builder.jaJpFlag = true
+ return builder
+}
+
+// 用户的英文名
+//
+// 示例值:en_name
+func (builder *UserI18nNameBuilder) EnUs(enUs string) *UserI18nNameBuilder {
+ builder.enUs = enUs
+ builder.enUsFlag = true
+ return builder
+}
+
+func (builder *UserI18nNameBuilder) Build() *UserI18nName {
+ req := &UserI18nName{}
+ if builder.zhCnFlag {
+ req.ZhCn = &builder.zhCn
+
+ }
+ if builder.jaJpFlag {
+ req.JaJp = &builder.jaJp
+
+ }
+ if builder.enUsFlag {
+ req.EnUs = &builder.enUs
+
+ }
+ return req
+}
+
type UserId struct {
UserId *string `json:"user_id,omitempty"` //
OpenId *string `json:"open_id,omitempty"` //
@@ -4604,6 +5393,7 @@ type UserOrder struct {
DepartmentId *string `json:"department_id,omitempty"` // 排序信息对应的部门ID, ID值与查询参数中的department_id_type 对应。;;表示用户所在的、且需要排序的部门。;;不同 ID 的说明参见及获取方式参见 [部门ID说明](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/field-overview)
UserOrder *int `json:"user_order,omitempty"` // 用户在其直属部门内的排序,数值越大,排序越靠前
DepartmentOrder *int `json:"department_order,omitempty"` // 用户所属的多个部门间的排序,数值越大,排序越靠前
+ IsPrimaryDept *bool `json:"is_primary_dept,omitempty"` // 是否为用户主部门
}
type UserOrderBuilder struct {
@@ -4613,6 +5403,8 @@ type UserOrderBuilder struct {
userOrderFlag bool
departmentOrder int // 用户所属的多个部门间的排序,数值越大,排序越靠前
departmentOrderFlag bool
+ isPrimaryDept bool // 是否为用户主部门
+ isPrimaryDeptFlag bool
}
func NewUserOrderBuilder() *UserOrderBuilder {
@@ -4647,6 +5439,15 @@ func (builder *UserOrderBuilder) DepartmentOrder(departmentOrder int) *UserOrder
return builder
}
+// 是否为用户主部门
+//
+// 示例值:true
+func (builder *UserOrderBuilder) IsPrimaryDept(isPrimaryDept bool) *UserOrderBuilder {
+ builder.isPrimaryDept = isPrimaryDept
+ builder.isPrimaryDeptFlag = true
+ return builder
+}
+
func (builder *UserOrderBuilder) Build() *UserOrder {
req := &UserOrder{}
if builder.departmentIdFlag {
@@ -4660,6 +5461,10 @@ func (builder *UserOrderBuilder) Build() *UserOrder {
if builder.departmentOrderFlag {
req.DepartmentOrder = &builder.departmentOrder
+ }
+ if builder.isPrimaryDeptFlag {
+ req.IsPrimaryDept = &builder.isPrimaryDept
+
}
return req
}
@@ -4872,6 +5677,85 @@ func (builder *UserStatusBuilder) Build() *UserStatus {
return req
}
+type WorkCity struct {
+ WorkCityId *string `json:"work_city_id,omitempty"` // 工作城市ID
+ Name *string `json:"name,omitempty"` // 工作城市名称。1-100字符,支持中、英文及符号
+ I18nName []*I18nContent `json:"i18n_name,omitempty"` // 多语言工作城市
+ Status *bool `json:"status,omitempty"` // 是否启用
+}
+
+type WorkCityBuilder struct {
+ workCityId string // 工作城市ID
+ workCityIdFlag bool
+ name string // 工作城市名称。1-100字符,支持中、英文及符号
+ nameFlag bool
+ i18nName []*I18nContent // 多语言工作城市
+ i18nNameFlag bool
+ status bool // 是否启用
+ statusFlag bool
+}
+
+func NewWorkCityBuilder() *WorkCityBuilder {
+ builder := &WorkCityBuilder{}
+ return builder
+}
+
+// 工作城市ID
+//
+// 示例值:0dd1ec95f021
+func (builder *WorkCityBuilder) WorkCityId(workCityId string) *WorkCityBuilder {
+ builder.workCityId = workCityId
+ builder.workCityIdFlag = true
+ return builder
+}
+
+// 工作城市名称。1-100字符,支持中、英文及符号
+//
+// 示例值:北京
+func (builder *WorkCityBuilder) Name(name string) *WorkCityBuilder {
+ builder.name = name
+ builder.nameFlag = true
+ return builder
+}
+
+// 多语言工作城市
+//
+// 示例值:
+func (builder *WorkCityBuilder) I18nName(i18nName []*I18nContent) *WorkCityBuilder {
+ builder.i18nName = i18nName
+ builder.i18nNameFlag = true
+ return builder
+}
+
+// 是否启用
+//
+// 示例值:true 表示启用, false表示未启用
+func (builder *WorkCityBuilder) Status(status bool) *WorkCityBuilder {
+ builder.status = status
+ builder.statusFlag = true
+ return builder
+}
+
+func (builder *WorkCityBuilder) Build() *WorkCity {
+ req := &WorkCity{}
+ if builder.workCityIdFlag {
+ req.WorkCityId = &builder.workCityId
+
+ }
+ if builder.nameFlag {
+ req.Name = &builder.name
+
+ }
+ if builder.i18nNameFlag {
+ req.I18nName = builder.i18nName
+ }
+ if builder.statusFlag {
+ req.Status = &builder.status
+
+ }
+ return req
+}
+
type ListCustomAttrReqBuilder struct {
apiReq *larkcore.ApiReq
limit int // 最大返回多少记录,当使用迭代器访问时才有效
@@ -4924,7 +5808,7 @@ type ListCustomAttrReq struct {
type ListCustomAttrRespData struct {
Items []*CustomAttr `json:"items,omitempty"` // 自定义字段定义
- PageToken *string `json:"page_token,omitempty"` //
+ PageToken *string `json:"page_token,omitempty"` // 分页标记
HasMore *bool `json:"has_more,omitempty"` // 是否还有下一页
}
@@ -5259,7 +6143,7 @@ func (builder *ListDepartmentReqBuilder) DepartmentIdType(departmentIdType strin
// 父部门的ID,填上获取部门下所有子部门
//
-// 示例值:
+// 示例值:od-80884c92e43e
func (builder *ListDepartmentReqBuilder) ParentDepartmentId(parentDepartmentId string) *ListDepartmentReqBuilder {
builder.apiReq.QueryParams.Set("parent_department_id", fmt.Sprint(parentDepartmentId))
return builder
@@ -5267,25 +6151,25 @@ func (builder *ListDepartmentReqBuilder) ParentDepartmentId(parentDepartmentId s
// 是否递归获取子部门
//
-// 示例值:
+// 示例值:false
func (builder *ListDepartmentReqBuilder) FetchChild(fetchChild bool) *ListDepartmentReqBuilder {
builder.apiReq.QueryParams.Set("fetch_child", fmt.Sprint(fetchChild))
return builder
}
+// 分页大小
//
-//
-// 示例值:
-func (builder *ListDepartmentReqBuilder) PageToken(pageToken string) *ListDepartmentReqBuilder {
- builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+// 示例值:10
+func (builder *ListDepartmentReqBuilder) PageSize(pageSize int) *ListDepartmentReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
return builder
}
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
-//
-// 示例值:
-func (builder *ListDepartmentReqBuilder) PageSize(pageSize int) *ListDepartmentReqBuilder {
- builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+// 示例值:5bc498db4617
+func (builder *ListDepartmentReqBuilder) PageToken(pageToken string) *ListDepartmentReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
return builder
}
@@ -5363,7 +6247,7 @@ func (builder *ParentDepartmentReqBuilder) DepartmentId(departmentId string) *Pa
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:AQD9/Rn9eij9Pm39ED40/RD/cIFmu77WxpxPB/2oHfQLZ%2BG8JG6tK7%2BZnHiT7COhD2hMSICh/eBl7cpzU6JEC3J7COKNe4jrQ8ExwBCR
func (builder *ParentDepartmentReqBuilder) PageToken(pageToken string) *ParentDepartmentReqBuilder {
@@ -5371,7 +6255,7 @@ func (builder *ParentDepartmentReqBuilder) PageToken(pageToken string) *ParentDe
return builder
}
-//
+// 分页大小
//
// 示例值:10
func (builder *ParentDepartmentReqBuilder) PageSize(pageSize int) *ParentDepartmentReqBuilder {
@@ -5572,7 +6456,7 @@ func (builder *SearchDepartmentReqBuilder) DepartmentIdType(departmentIdType str
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:AQD9/Rn9eij9Pm39ED40/RD/cIFmu77WxpxPB/2oHfQLZ+G8JG6tK7+ZnHiT7COhD2hMSICh/eBl7cpzU6JEC3J7COKNe4jrQ8ExwBCR
func (builder *SearchDepartmentReqBuilder) PageToken(pageToken string) *SearchDepartmentReqBuilder {
@@ -5580,7 +6464,7 @@ func (builder *SearchDepartmentReqBuilder) PageToken(pageToken string) *SearchDe
return builder
}
-//
+// 分页大小
//
// 示例值:10
func (builder *SearchDepartmentReqBuilder) PageSize(pageSize int) *SearchDepartmentReqBuilder {
@@ -5917,7 +6801,7 @@ func (builder *ListEmployeeTypeEnumReqBuilder) Limit(limit int) *ListEmployeeTyp
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:3
func (builder *ListEmployeeTypeEnumReqBuilder) PageToken(pageToken string) *ListEmployeeTypeEnumReqBuilder {
@@ -5925,7 +6809,7 @@ func (builder *ListEmployeeTypeEnumReqBuilder) PageToken(pageToken string) *List
return builder
}
-//
+// 分页大小
//
// 示例值:10
func (builder *ListEmployeeTypeEnumReqBuilder) PageSize(pageSize int) *ListEmployeeTypeEnumReqBuilder {
@@ -6018,151 +6902,67 @@ func (resp *UpdateEmployeeTypeEnumResp) Success() bool {
return resp.Code == 0
}
-type CreateGroupReqBodyBuilder struct {
- groupId string // 自定义用户组ID,可在创建时自定义,不自定义则由系统自动生成,已创建用户组不允许修改 group_id 。;;自定义group_id数据校验规则:;;最大长度:64 字符;;校验规则:数字、大小写字母的组合,不能包含空格
- groupIdFlag bool
- name string // 用户组的名字,企业内唯一,最大长度:100 字符
- nameFlag bool
- description string // 用户组描述
- descriptionFlag bool
- type_ int // 用户组的类型。默认为1表示普通用户组
- typeFlag bool
-}
-
-func NewCreateGroupReqBodyBuilder() *CreateGroupReqBodyBuilder {
- builder := &CreateGroupReqBodyBuilder{}
- return builder
-}
-
-// 自定义用户组ID,可在创建时自定义,不自定义则由系统自动生成,已创建用户组不允许修改 group_id 。;;自定义group_id数据校验规则:;;最大长度:64 字符;;校验规则:数字、大小写字母的组合,不能包含空格
-//
-//示例值:g122817
-func (builder *CreateGroupReqBodyBuilder) GroupId(groupId string) *CreateGroupReqBodyBuilder {
- builder.groupId = groupId
- builder.groupIdFlag = true
- return builder
-}
-
-// 用户组的名字,企业内唯一,最大长度:100 字符
-//
-//示例值:IT 外包组
-func (builder *CreateGroupReqBodyBuilder) Name(name string) *CreateGroupReqBodyBuilder {
- builder.name = name
- builder.nameFlag = true
- return builder
+type CreateFunctionalRoleReqBodyBuilder struct {
+ roleName string // 角色名称,在单租户下唯一
+ roleNameFlag bool
}
-// 用户组描述
-//
-//示例值:IT服务人员的集合
-func (builder *CreateGroupReqBodyBuilder) Description(description string) *CreateGroupReqBodyBuilder {
- builder.description = description
- builder.descriptionFlag = true
+func NewCreateFunctionalRoleReqBodyBuilder() *CreateFunctionalRoleReqBodyBuilder {
+ builder := &CreateFunctionalRoleReqBodyBuilder{}
return builder
}
-// 用户组的类型。默认为1表示普通用户组
+// 角色名称,在单租户下唯一
//
-//示例值:1
-func (builder *CreateGroupReqBodyBuilder) Type(type_ int) *CreateGroupReqBodyBuilder {
- builder.type_ = type_
- builder.typeFlag = true
+//示例值:考勤管理员
+func (builder *CreateFunctionalRoleReqBodyBuilder) RoleName(roleName string) *CreateFunctionalRoleReqBodyBuilder {
+ builder.roleName = roleName
+ builder.roleNameFlag = true
return builder
}
-func (builder *CreateGroupReqBodyBuilder) Build() *CreateGroupReqBody {
- req := &CreateGroupReqBody{}
- if builder.groupIdFlag {
- req.GroupId = &builder.groupId
- }
- if builder.nameFlag {
- req.Name = &builder.name
- }
- if builder.descriptionFlag {
- req.Description = &builder.description
- }
- if builder.typeFlag {
- req.Type = &builder.type_
+func (builder *CreateFunctionalRoleReqBodyBuilder) Build() *CreateFunctionalRoleReqBody {
+ req := &CreateFunctionalRoleReqBody{}
+ if builder.roleNameFlag {
+ req.RoleName = &builder.roleName
}
return req
}
-type CreateGroupPathReqBodyBuilder struct {
- groupId string // 自定义用户组ID,可在创建时自定义,不自定义则由系统自动生成,已创建用户组不允许修改 group_id 。;;自定义group_id数据校验规则:;;最大长度:64 字符;;校验规则:数字、大小写字母的组合,不能包含空格
- groupIdFlag bool
- name string // 用户组的名字,企业内唯一,最大长度:100 字符
- nameFlag bool
- description string // 用户组描述
- descriptionFlag bool
- type_ int // 用户组的类型。默认为1表示普通用户组
- typeFlag bool
-}
-
-func NewCreateGroupPathReqBodyBuilder() *CreateGroupPathReqBodyBuilder {
- builder := &CreateGroupPathReqBodyBuilder{}
- return builder
-}
-
-// 自定义用户组ID,可在创建时自定义,不自定义则由系统自动生成,已创建用户组不允许修改 group_id 。;;自定义group_id数据校验规则:;;最大长度:64 字符;;校验规则:数字、大小写字母的组合,不能包含空格
-//
-// 示例值:g122817
-func (builder *CreateGroupPathReqBodyBuilder) GroupId(groupId string) *CreateGroupPathReqBodyBuilder {
- builder.groupId = groupId
- builder.groupIdFlag = true
- return builder
-}
-
-// 用户组的名字,企业内唯一,最大长度:100 字符
-//
-// 示例值:IT 外包组
-func (builder *CreateGroupPathReqBodyBuilder) Name(name string) *CreateGroupPathReqBodyBuilder {
- builder.name = name
- builder.nameFlag = true
- return builder
+type CreateFunctionalRolePathReqBodyBuilder struct {
+ roleName string // 角色名称,在单租户下唯一
+ roleNameFlag bool
}
-// 用户组描述
-//
-// 示例值:IT服务人员的集合
-func (builder *CreateGroupPathReqBodyBuilder) Description(description string) *CreateGroupPathReqBodyBuilder {
- builder.description = description
- builder.descriptionFlag = true
+func NewCreateFunctionalRolePathReqBodyBuilder() *CreateFunctionalRolePathReqBodyBuilder {
+ builder := &CreateFunctionalRolePathReqBodyBuilder{}
return builder
}
-// 用户组的类型。默认为1表示普通用户组
+// 角色名称,在单租户下唯一
//
-// 示例值:1
-func (builder *CreateGroupPathReqBodyBuilder) Type(type_ int) *CreateGroupPathReqBodyBuilder {
- builder.type_ = type_
- builder.typeFlag = true
+// 示例值:考勤管理员
+func (builder *CreateFunctionalRolePathReqBodyBuilder) RoleName(roleName string) *CreateFunctionalRolePathReqBodyBuilder {
+ builder.roleName = roleName
+ builder.roleNameFlag = true
return builder
}
-func (builder *CreateGroupPathReqBodyBuilder) Build() (*CreateGroupReqBody, error) {
- req := &CreateGroupReqBody{}
- if builder.groupIdFlag {
- req.GroupId = &builder.groupId
- }
- if builder.nameFlag {
- req.Name = &builder.name
- }
- if builder.descriptionFlag {
- req.Description = &builder.description
- }
- if builder.typeFlag {
- req.Type = &builder.type_
+func (builder *CreateFunctionalRolePathReqBodyBuilder) Build() (*CreateFunctionalRoleReqBody, error) {
+ req := &CreateFunctionalRoleReqBody{}
+ if builder.roleNameFlag {
+ req.RoleName = &builder.roleName
}
return req, nil
}
-type CreateGroupReqBuilder struct {
+type CreateFunctionalRoleReqBuilder struct {
apiReq *larkcore.ApiReq
- body *CreateGroupReqBody
+ body *CreateFunctionalRoleReqBody
}
-func NewCreateGroupReqBuilder() *CreateGroupReqBuilder {
- builder := &CreateGroupReqBuilder{}
+func NewCreateFunctionalRoleReqBuilder() *CreateFunctionalRoleReqBuilder {
+ builder := &CreateFunctionalRoleReqBuilder{}
builder.apiReq = &larkcore.ApiReq{
PathParams: larkcore.PathParams{},
QueryParams: larkcore.QueryParams{},
@@ -6170,51 +6970,48 @@ func NewCreateGroupReqBuilder() *CreateGroupReqBuilder {
return builder
}
-// 使用该接口创建用户组,请注意创建用户组时应用的通讯录权限范围需为“全部员工”,否则会创建失败,[点击了解通讯录权限范围](https://open.feishu.cn/document/ukTMukTMukTM/uETNz4SM1MjLxUzM/v3/guides/scope_authority)。
-func (builder *CreateGroupReqBuilder) Body(body *CreateGroupReqBody) *CreateGroupReqBuilder {
+//
+func (builder *CreateFunctionalRoleReqBuilder) Body(body *CreateFunctionalRoleReqBody) *CreateFunctionalRoleReqBuilder {
builder.body = body
return builder
}
-func (builder *CreateGroupReqBuilder) Build() *CreateGroupReq {
- req := &CreateGroupReq{}
+func (builder *CreateFunctionalRoleReqBuilder) Build() *CreateFunctionalRoleReq {
+ req := &CreateFunctionalRoleReq{}
req.apiReq = &larkcore.ApiReq{}
req.apiReq.Body = builder.body
return req
}
-type CreateGroupReqBody struct {
- GroupId *string `json:"group_id,omitempty"` // 自定义用户组ID,可在创建时自定义,不自定义则由系统自动生成,已创建用户组不允许修改 group_id 。;;自定义group_id数据校验规则:;;最大长度:64 字符;;校验规则:数字、大小写字母的组合,不能包含空格
- Name *string `json:"name,omitempty"` // 用户组的名字,企业内唯一,最大长度:100 字符
- Description *string `json:"description,omitempty"` // 用户组描述
- Type *int `json:"type,omitempty"` // 用户组的类型。默认为1表示普通用户组
+type CreateFunctionalRoleReqBody struct {
+ RoleName *string `json:"role_name,omitempty"` // 角色名称,在单租户下唯一
}
-type CreateGroupReq struct {
+type CreateFunctionalRoleReq struct {
apiReq *larkcore.ApiReq
- Body *CreateGroupReqBody `body:""`
+ Body *CreateFunctionalRoleReqBody `body:""`
}
-type CreateGroupRespData struct {
- GroupId *string `json:"group_id,omitempty"` // 用户组ID
+type CreateFunctionalRoleRespData struct {
+ RoleId *string `json:"role_id,omitempty"` // 角色ID,在单租户下唯一
}
-type CreateGroupResp struct {
+type CreateFunctionalRoleResp struct {
*larkcore.ApiResp `json:"-"`
larkcore.CodeError
- Data *CreateGroupRespData `json:"data"` // 业务数据
+ Data *CreateFunctionalRoleRespData `json:"data"` // 业务数据
}
-func (resp *CreateGroupResp) Success() bool {
+func (resp *CreateFunctionalRoleResp) Success() bool {
return resp.Code == 0
}
-type DeleteGroupReqBuilder struct {
+type DeleteFunctionalRoleReqBuilder struct {
apiReq *larkcore.ApiReq
}
-func NewDeleteGroupReqBuilder() *DeleteGroupReqBuilder {
- builder := &DeleteGroupReqBuilder{}
+func NewDeleteFunctionalRoleReqBuilder() *DeleteFunctionalRoleReqBuilder {
+ builder := &DeleteFunctionalRoleReqBuilder{}
builder.apiReq = &larkcore.ApiReq{
PathParams: larkcore.PathParams{},
QueryParams: larkcore.QueryParams{},
@@ -6222,86 +7019,95 @@ func NewDeleteGroupReqBuilder() *DeleteGroupReqBuilder {
return builder
}
-// 需删除的用户组ID
+// 角色的唯一标识,单租户下唯一
//
-// 示例值:g1837191
-func (builder *DeleteGroupReqBuilder) GroupId(groupId string) *DeleteGroupReqBuilder {
- builder.apiReq.PathParams.Set("group_id", fmt.Sprint(groupId))
+// 示例值:7vrj3vk70xk7v5r
+func (builder *DeleteFunctionalRoleReqBuilder) RoleId(roleId string) *DeleteFunctionalRoleReqBuilder {
+ builder.apiReq.PathParams.Set("role_id", fmt.Sprint(roleId))
return builder
}
-func (builder *DeleteGroupReqBuilder) Build() *DeleteGroupReq {
- req := &DeleteGroupReq{}
+func (builder *DeleteFunctionalRoleReqBuilder) Build() *DeleteFunctionalRoleReq {
+ req := &DeleteFunctionalRoleReq{}
req.apiReq = &larkcore.ApiReq{}
req.apiReq.PathParams = builder.apiReq.PathParams
return req
}
-type DeleteGroupReq struct {
+type DeleteFunctionalRoleReq struct {
apiReq *larkcore.ApiReq
}
-type DeleteGroupResp struct {
+type DeleteFunctionalRoleResp struct {
*larkcore.ApiResp `json:"-"`
larkcore.CodeError
}
-func (resp *DeleteGroupResp) Success() bool {
+func (resp *DeleteFunctionalRoleResp) Success() bool {
return resp.Code == 0
}
-type GetGroupReqBuilder struct {
- apiReq *larkcore.ApiReq
+type UpdateFunctionalRoleReqBodyBuilder struct {
+ roleName string // 修改的角色名称,在单租户下唯一
+ roleNameFlag bool
}
-func NewGetGroupReqBuilder() *GetGroupReqBuilder {
- builder := &GetGroupReqBuilder{}
- builder.apiReq = &larkcore.ApiReq{
- PathParams: larkcore.PathParams{},
- QueryParams: larkcore.QueryParams{},
- }
+func NewUpdateFunctionalRoleReqBodyBuilder() *UpdateFunctionalRoleReqBodyBuilder {
+ builder := &UpdateFunctionalRoleReqBodyBuilder{}
return builder
}
-// 用户组ID
+// 修改的角色名称,在单租户下唯一
//
-// 示例值:g193821
-func (builder *GetGroupReqBuilder) GroupId(groupId string) *GetGroupReqBuilder {
- builder.apiReq.PathParams.Set("group_id", fmt.Sprint(groupId))
+//示例值:考勤管理员
+func (builder *UpdateFunctionalRoleReqBodyBuilder) RoleName(roleName string) *UpdateFunctionalRoleReqBodyBuilder {
+ builder.roleName = roleName
+ builder.roleNameFlag = true
return builder
}
-func (builder *GetGroupReqBuilder) Build() *GetGroupReq {
- req := &GetGroupReq{}
- req.apiReq = &larkcore.ApiReq{}
- req.apiReq.PathParams = builder.apiReq.PathParams
+func (builder *UpdateFunctionalRoleReqBodyBuilder) Build() *UpdateFunctionalRoleReqBody {
+ req := &UpdateFunctionalRoleReqBody{}
+ if builder.roleNameFlag {
+ req.RoleName = &builder.roleName
+ }
return req
}
-type GetGroupReq struct {
- apiReq *larkcore.ApiReq
+type UpdateFunctionalRolePathReqBodyBuilder struct {
+ roleName string // 修改的角色名称,在单租户下唯一
+ roleNameFlag bool
}
-type GetGroupRespData struct {
- Group *Group `json:"group,omitempty"` // 用户组详情
+func NewUpdateFunctionalRolePathReqBodyBuilder() *UpdateFunctionalRolePathReqBodyBuilder {
+ builder := &UpdateFunctionalRolePathReqBodyBuilder{}
+ return builder
}
-type GetGroupResp struct {
- *larkcore.ApiResp `json:"-"`
- larkcore.CodeError
- Data *GetGroupRespData `json:"data"` // 业务数据
+// 修改的角色名称,在单租户下唯一
+//
+// 示例值:考勤管理员
+func (builder *UpdateFunctionalRolePathReqBodyBuilder) RoleName(roleName string) *UpdateFunctionalRolePathReqBodyBuilder {
+ builder.roleName = roleName
+ builder.roleNameFlag = true
+ return builder
}
-func (resp *GetGroupResp) Success() bool {
- return resp.Code == 0
+func (builder *UpdateFunctionalRolePathReqBodyBuilder) Build() (*UpdateFunctionalRoleReqBody, error) {
+ req := &UpdateFunctionalRoleReqBody{}
+ if builder.roleNameFlag {
+ req.RoleName = &builder.roleName
+ }
+ return req, nil
}
-type MemberBelongGroupReqBuilder struct {
+type UpdateFunctionalRoleReqBuilder struct {
apiReq *larkcore.ApiReq
+ body *UpdateFunctionalRoleReqBody
}
-func NewMemberBelongGroupReqBuilder() *MemberBelongGroupReqBuilder {
- builder := &MemberBelongGroupReqBuilder{}
+func NewUpdateFunctionalRoleReqBuilder() *UpdateFunctionalRoleReqBuilder {
+ builder := &UpdateFunctionalRoleReqBuilder{}
builder.apiReq = &larkcore.ApiReq{
PathParams: larkcore.PathParams{},
QueryParams: larkcore.QueryParams{},
@@ -6309,162 +7115,107 @@ func NewMemberBelongGroupReqBuilder() *MemberBelongGroupReqBuilder {
return builder
}
-// 成员ID
-//
-// 示例值:u287xj12
-func (builder *MemberBelongGroupReqBuilder) MemberId(memberId string) *MemberBelongGroupReqBuilder {
- builder.apiReq.QueryParams.Set("member_id", fmt.Sprint(memberId))
- return builder
-}
-
-// 成员ID类型
-//
-// 示例值:open_id
-func (builder *MemberBelongGroupReqBuilder) MemberIdType(memberIdType string) *MemberBelongGroupReqBuilder {
- builder.apiReq.QueryParams.Set("member_id_type", fmt.Sprint(memberIdType))
- return builder
-}
-
-// 欲获取的用户组类型
-//
-// 示例值:1
-func (builder *MemberBelongGroupReqBuilder) GroupType(groupType int) *MemberBelongGroupReqBuilder {
- builder.apiReq.QueryParams.Set("group_type", fmt.Sprint(groupType))
- return builder
-}
-
-// 分页查询大小
+// 角色的唯一标识,单租户下唯一
//
-// 示例值:500
-func (builder *MemberBelongGroupReqBuilder) PageSize(pageSize int) *MemberBelongGroupReqBuilder {
- builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+// 示例值:7vrj3vk70xk7v5r
+func (builder *UpdateFunctionalRoleReqBuilder) RoleId(roleId string) *UpdateFunctionalRoleReqBuilder {
+ builder.apiReq.PathParams.Set("role_id", fmt.Sprint(roleId))
return builder
}
-// 分页查询Token
//
-// 示例值:AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=
-func (builder *MemberBelongGroupReqBuilder) PageToken(pageToken string) *MemberBelongGroupReqBuilder {
- builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+func (builder *UpdateFunctionalRoleReqBuilder) Body(body *UpdateFunctionalRoleReqBody) *UpdateFunctionalRoleReqBuilder {
+ builder.body = body
return builder
}
-func (builder *MemberBelongGroupReqBuilder) Build() *MemberBelongGroupReq {
- req := &MemberBelongGroupReq{}
+func (builder *UpdateFunctionalRoleReqBuilder) Build() *UpdateFunctionalRoleReq {
+ req := &UpdateFunctionalRoleReq{}
req.apiReq = &larkcore.ApiReq{}
- req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.Body = builder.body
return req
}
-type MemberBelongGroupReq struct {
- apiReq *larkcore.ApiReq
+type UpdateFunctionalRoleReqBody struct {
+ RoleName *string `json:"role_name,omitempty"` // 修改的角色名称,在单租户下唯一
}
-type MemberBelongGroupRespData struct {
- GroupList []string `json:"group_list,omitempty"` // 用户组ID列表
- PageToken *string `json:"page_token,omitempty"` // 分页查询Token
- HasMore *bool `json:"has_more,omitempty"` // 是否有更多结果
+type UpdateFunctionalRoleReq struct {
+ apiReq *larkcore.ApiReq
+ Body *UpdateFunctionalRoleReqBody `body:""`
}
-type MemberBelongGroupResp struct {
+type UpdateFunctionalRoleResp struct {
*larkcore.ApiResp `json:"-"`
larkcore.CodeError
- Data *MemberBelongGroupRespData `json:"data"` // 业务数据
}
-func (resp *MemberBelongGroupResp) Success() bool {
+func (resp *UpdateFunctionalRoleResp) Success() bool {
return resp.Code == 0
}
-type PatchGroupReqBodyBuilder struct {
- name string // 用户组的名字,企业内唯一,最大长度:100 字符
- nameFlag bool
- description string // 用户组描述信息;最大长度:500 字
- descriptionFlag bool
-}
-
-func NewPatchGroupReqBodyBuilder() *PatchGroupReqBodyBuilder {
- builder := &PatchGroupReqBodyBuilder{}
- return builder
+type BatchCreateFunctionalRoleMemberReqBodyBuilder struct {
+ members []string // 角色添加的角色成员列表(一批用户的UserID列表)
+ membersFlag bool
}
-// 用户组的名字,企业内唯一,最大长度:100 字符
-//
-//示例值:外包 IT 用户组
-func (builder *PatchGroupReqBodyBuilder) Name(name string) *PatchGroupReqBodyBuilder {
- builder.name = name
- builder.nameFlag = true
+func NewBatchCreateFunctionalRoleMemberReqBodyBuilder() *BatchCreateFunctionalRoleMemberReqBodyBuilder {
+ builder := &BatchCreateFunctionalRoleMemberReqBodyBuilder{}
return builder
}
-// 用户组描述信息;最大长度:500 字
+// 角色添加的角色成员列表(一批用户的UserID列表)
//
-//示例值:IT 外包用户组,需要进行细粒度权限管控
-func (builder *PatchGroupReqBodyBuilder) Description(description string) *PatchGroupReqBodyBuilder {
- builder.description = description
- builder.descriptionFlag = true
+//示例值:
+func (builder *BatchCreateFunctionalRoleMemberReqBodyBuilder) Members(members []string) *BatchCreateFunctionalRoleMemberReqBodyBuilder {
+ builder.members = members
+ builder.membersFlag = true
return builder
}
-func (builder *PatchGroupReqBodyBuilder) Build() *PatchGroupReqBody {
- req := &PatchGroupReqBody{}
- if builder.nameFlag {
- req.Name = &builder.name
- }
- if builder.descriptionFlag {
- req.Description = &builder.description
+func (builder *BatchCreateFunctionalRoleMemberReqBodyBuilder) Build() *BatchCreateFunctionalRoleMemberReqBody {
+ req := &BatchCreateFunctionalRoleMemberReqBody{}
+ if builder.membersFlag {
+ req.Members = builder.members
}
return req
}
-type PatchGroupPathReqBodyBuilder struct {
- name string // 用户组的名字,企业内唯一,最大长度:100 字符
- nameFlag bool
- description string // 用户组描述信息;最大长度:500 字
- descriptionFlag bool
-}
-
-func NewPatchGroupPathReqBodyBuilder() *PatchGroupPathReqBodyBuilder {
- builder := &PatchGroupPathReqBodyBuilder{}
- return builder
+type BatchCreateFunctionalRoleMemberPathReqBodyBuilder struct {
+ members []string // 角色添加的角色成员列表(一批用户的UserID列表)
+ membersFlag bool
}
-// 用户组的名字,企业内唯一,最大长度:100 字符
-//
-// 示例值:外包 IT 用户组
-func (builder *PatchGroupPathReqBodyBuilder) Name(name string) *PatchGroupPathReqBodyBuilder {
- builder.name = name
- builder.nameFlag = true
+func NewBatchCreateFunctionalRoleMemberPathReqBodyBuilder() *BatchCreateFunctionalRoleMemberPathReqBodyBuilder {
+ builder := &BatchCreateFunctionalRoleMemberPathReqBodyBuilder{}
return builder
}
-// 用户组描述信息;最大长度:500 字
+// 角色添加的角色成员列表(一批用户的UserID列表)
//
-// 示例值:IT 外包用户组,需要进行细粒度权限管控
-func (builder *PatchGroupPathReqBodyBuilder) Description(description string) *PatchGroupPathReqBodyBuilder {
- builder.description = description
- builder.descriptionFlag = true
+// 示例值:
+func (builder *BatchCreateFunctionalRoleMemberPathReqBodyBuilder) Members(members []string) *BatchCreateFunctionalRoleMemberPathReqBodyBuilder {
+ builder.members = members
+ builder.membersFlag = true
return builder
}
-func (builder *PatchGroupPathReqBodyBuilder) Build() (*PatchGroupReqBody, error) {
- req := &PatchGroupReqBody{}
- if builder.nameFlag {
- req.Name = &builder.name
- }
- if builder.descriptionFlag {
- req.Description = &builder.description
+func (builder *BatchCreateFunctionalRoleMemberPathReqBodyBuilder) Build() (*BatchCreateFunctionalRoleMemberReqBody, error) {
+ req := &BatchCreateFunctionalRoleMemberReqBody{}
+ if builder.membersFlag {
+ req.Members = builder.members
}
return req, nil
}
-type PatchGroupReqBuilder struct {
+type BatchCreateFunctionalRoleMemberReqBuilder struct {
apiReq *larkcore.ApiReq
- body *PatchGroupReqBody
+ body *BatchCreateFunctionalRoleMemberReqBody
}
-func NewPatchGroupReqBuilder() *PatchGroupReqBuilder {
- builder := &PatchGroupReqBuilder{}
+func NewBatchCreateFunctionalRoleMemberReqBuilder() *BatchCreateFunctionalRoleMemberReqBuilder {
+ builder := &BatchCreateFunctionalRoleMemberReqBuilder{}
builder.apiReq = &larkcore.ApiReq{
PathParams: larkcore.PathParams{},
QueryParams: larkcore.QueryParams{},
@@ -6472,238 +7223,1395 @@ func NewPatchGroupReqBuilder() *PatchGroupReqBuilder {
return builder
}
-// 用户组ID
+// 角色的唯一标识,单租户下唯一
//
-// 示例值:g187131
-func (builder *PatchGroupReqBuilder) GroupId(groupId string) *PatchGroupReqBuilder {
- builder.apiReq.PathParams.Set("group_id", fmt.Sprint(groupId))
+// 示例值:7vrj3vk70xk7v5r
+func (builder *BatchCreateFunctionalRoleMemberReqBuilder) RoleId(roleId string) *BatchCreateFunctionalRoleMemberReqBuilder {
+ builder.apiReq.PathParams.Set("role_id", fmt.Sprint(roleId))
return builder
}
-// 使用该接口更新用户组信息,请注意更新用户组时应用的通讯录权限范围需为“全部员工”,否则会更新失败。[点击了解通讯录权限范围](https://open.feishu.cn/document/ukTMukTMukTM/uETNz4SM1MjLxUzM/v3/guides/scope_authority)。
-func (builder *PatchGroupReqBuilder) Body(body *PatchGroupReqBody) *PatchGroupReqBuilder {
- builder.body = body
+// 成员ID类型
+//
+// 示例值:open_id
+func (builder *BatchCreateFunctionalRoleMemberReqBuilder) UserIdType(userIdType string) *BatchCreateFunctionalRoleMemberReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+//
+func (builder *BatchCreateFunctionalRoleMemberReqBuilder) Body(body *BatchCreateFunctionalRoleMemberReqBody) *BatchCreateFunctionalRoleMemberReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *BatchCreateFunctionalRoleMemberReqBuilder) Build() *BatchCreateFunctionalRoleMemberReq {
+ req := &BatchCreateFunctionalRoleMemberReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type BatchCreateFunctionalRoleMemberReqBody struct {
+ Members []string `json:"members,omitempty"` // 角色添加的角色成员列表(一批用户的UserID列表)
+}
+
+type BatchCreateFunctionalRoleMemberReq struct {
+ apiReq *larkcore.ApiReq
+ Body *BatchCreateFunctionalRoleMemberReqBody `body:""`
+}
+
+type BatchCreateFunctionalRoleMemberRespData struct {
+ Results []*FunctionalRoleMemberResult `json:"results,omitempty"` // 批量新增角色成员结果集
+}
+
+type BatchCreateFunctionalRoleMemberResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *BatchCreateFunctionalRoleMemberRespData `json:"data"` // 业务数据
+}
+
+func (resp *BatchCreateFunctionalRoleMemberResp) Success() bool {
+ return resp.Code == 0
+}
+
+type BatchDeleteFunctionalRoleMemberReqBodyBuilder struct {
+ members []string // 角色删除的角色成员列表(一批用户的UserID列表)
+ membersFlag bool
+}
+
+func NewBatchDeleteFunctionalRoleMemberReqBodyBuilder() *BatchDeleteFunctionalRoleMemberReqBodyBuilder {
+ builder := &BatchDeleteFunctionalRoleMemberReqBodyBuilder{}
+ return builder
+}
+
+// 角色删除的角色成员列表(一批用户的UserID列表)
+//
+//示例值:
+func (builder *BatchDeleteFunctionalRoleMemberReqBodyBuilder) Members(members []string) *BatchDeleteFunctionalRoleMemberReqBodyBuilder {
+ builder.members = members
+ builder.membersFlag = true
+ return builder
+}
+
+func (builder *BatchDeleteFunctionalRoleMemberReqBodyBuilder) Build() *BatchDeleteFunctionalRoleMemberReqBody {
+ req := &BatchDeleteFunctionalRoleMemberReqBody{}
+ if builder.membersFlag {
+ req.Members = builder.members
+ }
+ return req
+}
+
+type BatchDeleteFunctionalRoleMemberPathReqBodyBuilder struct {
+ members []string // 角色删除的角色成员列表(一批用户的UserID列表)
+ membersFlag bool
+}
+
+func NewBatchDeleteFunctionalRoleMemberPathReqBodyBuilder() *BatchDeleteFunctionalRoleMemberPathReqBodyBuilder {
+ builder := &BatchDeleteFunctionalRoleMemberPathReqBodyBuilder{}
+ return builder
+}
+
+// 角色删除的角色成员列表(一批用户的UserID列表)
+//
+// 示例值:
+func (builder *BatchDeleteFunctionalRoleMemberPathReqBodyBuilder) Members(members []string) *BatchDeleteFunctionalRoleMemberPathReqBodyBuilder {
+ builder.members = members
+ builder.membersFlag = true
+ return builder
+}
+
+func (builder *BatchDeleteFunctionalRoleMemberPathReqBodyBuilder) Build() (*BatchDeleteFunctionalRoleMemberReqBody, error) {
+ req := &BatchDeleteFunctionalRoleMemberReqBody{}
+ if builder.membersFlag {
+ req.Members = builder.members
+ }
+ return req, nil
+}
+
+type BatchDeleteFunctionalRoleMemberReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *BatchDeleteFunctionalRoleMemberReqBody
+}
+
+func NewBatchDeleteFunctionalRoleMemberReqBuilder() *BatchDeleteFunctionalRoleMemberReqBuilder {
+ builder := &BatchDeleteFunctionalRoleMemberReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 角色的唯一标识,单租户下唯一
+//
+// 示例值:7vrj3vk70xk7v5r
+func (builder *BatchDeleteFunctionalRoleMemberReqBuilder) RoleId(roleId string) *BatchDeleteFunctionalRoleMemberReqBuilder {
+ builder.apiReq.PathParams.Set("role_id", fmt.Sprint(roleId))
+ return builder
+}
+
+// 成员ID类型
+//
+// 示例值:open_id
+func (builder *BatchDeleteFunctionalRoleMemberReqBuilder) UserIdType(userIdType string) *BatchDeleteFunctionalRoleMemberReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+//
+func (builder *BatchDeleteFunctionalRoleMemberReqBuilder) Body(body *BatchDeleteFunctionalRoleMemberReqBody) *BatchDeleteFunctionalRoleMemberReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *BatchDeleteFunctionalRoleMemberReqBuilder) Build() *BatchDeleteFunctionalRoleMemberReq {
+ req := &BatchDeleteFunctionalRoleMemberReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type BatchDeleteFunctionalRoleMemberReqBody struct {
+ Members []string `json:"members,omitempty"` // 角色删除的角色成员列表(一批用户的UserID列表)
+}
+
+type BatchDeleteFunctionalRoleMemberReq struct {
+ apiReq *larkcore.ApiReq
+ Body *BatchDeleteFunctionalRoleMemberReqBody `body:""`
+}
+
+type BatchDeleteFunctionalRoleMemberRespData struct {
+ Result []*FunctionalRoleMemberResult `json:"result,omitempty"` // 批量新增角色成员结果集
+}
+
+type BatchDeleteFunctionalRoleMemberResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *BatchDeleteFunctionalRoleMemberRespData `json:"data"` // 业务数据
+}
+
+func (resp *BatchDeleteFunctionalRoleMemberResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetFunctionalRoleMemberReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetFunctionalRoleMemberReqBuilder() *GetFunctionalRoleMemberReqBuilder {
+ builder := &GetFunctionalRoleMemberReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 角色的唯一标识,单租户下唯一
+//
+// 示例值:7vrj3vk70xk7v5r
+func (builder *GetFunctionalRoleMemberReqBuilder) RoleId(roleId string) *GetFunctionalRoleMemberReqBuilder {
+ builder.apiReq.PathParams.Set("role_id", fmt.Sprint(roleId))
+ return builder
+}
+
+// 要查询的角色内成员ID
+//
+// 示例值:od-123456
+func (builder *GetFunctionalRoleMemberReqBuilder) MemberId(memberId string) *GetFunctionalRoleMemberReqBuilder {
+ builder.apiReq.PathParams.Set("member_id", fmt.Sprint(memberId))
+ return builder
+}
+
+// 用户 ID 类型
+//
+// 示例值:open_id
+func (builder *GetFunctionalRoleMemberReqBuilder) UserIdType(userIdType string) *GetFunctionalRoleMemberReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 此次调用中使用的部门ID的类型
+//
+// 示例值:open_department_id
+func (builder *GetFunctionalRoleMemberReqBuilder) DepartmentIdType(departmentIdType string) *GetFunctionalRoleMemberReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+func (builder *GetFunctionalRoleMemberReqBuilder) Build() *GetFunctionalRoleMemberReq {
+ req := &GetFunctionalRoleMemberReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type GetFunctionalRoleMemberReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetFunctionalRoleMemberRespData struct {
+ Member *FunctionalRoleMember `json:"member,omitempty"` // 成员的管理范围
+}
+
+type GetFunctionalRoleMemberResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetFunctionalRoleMemberRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetFunctionalRoleMemberResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListFunctionalRoleMemberReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ limit int // 最大返回多少记录,当使用迭代器访问时才有效
+}
+
+func NewListFunctionalRoleMemberReqBuilder() *ListFunctionalRoleMemberReqBuilder {
+ builder := &ListFunctionalRoleMemberReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 最大返回多少记录,当使用迭代器访问时才有效
+func (builder *ListFunctionalRoleMemberReqBuilder) Limit(limit int) *ListFunctionalRoleMemberReqBuilder {
+ builder.limit = limit
+ return builder
+}
+
+// 角色的唯一标识,单租户下唯一
+//
+// 示例值:7vrj3vk70xk7v5r
+func (builder *ListFunctionalRoleMemberReqBuilder) RoleId(roleId string) *ListFunctionalRoleMemberReqBuilder {
+ builder.apiReq.PathParams.Set("role_id", fmt.Sprint(roleId))
+ return builder
+}
+
+// 分页大小
+//
+// 示例值:50
+func (builder *ListFunctionalRoleMemberReqBuilder) PageSize(pageSize int) *ListFunctionalRoleMemberReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果
+//
+// 示例值:dawdewd
+func (builder *ListFunctionalRoleMemberReqBuilder) PageToken(pageToken string) *ListFunctionalRoleMemberReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 用户 ID 类型
+//
+// 示例值:open_id
+func (builder *ListFunctionalRoleMemberReqBuilder) UserIdType(userIdType string) *ListFunctionalRoleMemberReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 此次调用中使用的部门ID的类型
+//
+// 示例值:open_department_id
+func (builder *ListFunctionalRoleMemberReqBuilder) DepartmentIdType(departmentIdType string) *ListFunctionalRoleMemberReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+func (builder *ListFunctionalRoleMemberReqBuilder) Build() *ListFunctionalRoleMemberReq {
+ req := &ListFunctionalRoleMemberReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.Limit = builder.limit
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListFunctionalRoleMemberReq struct {
+ apiReq *larkcore.ApiReq
+ Limit int // 最多返回多少记录,只有在使用迭代器访问时,才有效
+
+}
+
+type ListFunctionalRoleMemberRespData struct {
+ Members []*FunctionalRoleMember `json:"members,omitempty"` // 角色成员列表
+ PageToken *string `json:"page_token,omitempty"` // 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果
+ HasMore *bool `json:"has_more,omitempty"` // 是否还有值
+}
+
+type ListFunctionalRoleMemberResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListFunctionalRoleMemberRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListFunctionalRoleMemberResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ScopesFunctionalRoleMemberReqBodyBuilder struct {
+ members []string // 角色修改的角色成员列表(一批用户的UserID列表)
+ membersFlag bool
+ departments []string // 角色内用户的管理范围
+ departmentsFlag bool
+}
+
+func NewScopesFunctionalRoleMemberReqBodyBuilder() *ScopesFunctionalRoleMemberReqBodyBuilder {
+ builder := &ScopesFunctionalRoleMemberReqBodyBuilder{}
+ return builder
+}
+
+// 角色修改的角色成员列表(一批用户的UserID列表)
+//
+//示例值:
+func (builder *ScopesFunctionalRoleMemberReqBodyBuilder) Members(members []string) *ScopesFunctionalRoleMemberReqBodyBuilder {
+ builder.members = members
+ builder.membersFlag = true
+ return builder
+}
+
+// 角色内用户的管理范围
+//
+//示例值:
+func (builder *ScopesFunctionalRoleMemberReqBodyBuilder) Departments(departments []string) *ScopesFunctionalRoleMemberReqBodyBuilder {
+ builder.departments = departments
+ builder.departmentsFlag = true
+ return builder
+}
+
+func (builder *ScopesFunctionalRoleMemberReqBodyBuilder) Build() *ScopesFunctionalRoleMemberReqBody {
+ req := &ScopesFunctionalRoleMemberReqBody{}
+ if builder.membersFlag {
+ req.Members = builder.members
+ }
+ if builder.departmentsFlag {
+ req.Departments = builder.departments
+ }
+ return req
+}
+
+type ScopesFunctionalRoleMemberPathReqBodyBuilder struct {
+ members []string // 角色修改的角色成员列表(一批用户的UserID列表)
+ membersFlag bool
+ departments []string // 角色内用户的管理范围
+ departmentsFlag bool
+}
+
+func NewScopesFunctionalRoleMemberPathReqBodyBuilder() *ScopesFunctionalRoleMemberPathReqBodyBuilder {
+ builder := &ScopesFunctionalRoleMemberPathReqBodyBuilder{}
+ return builder
+}
+
+// 角色修改的角色成员列表(一批用户的UserID列表)
+//
+// 示例值:
+func (builder *ScopesFunctionalRoleMemberPathReqBodyBuilder) Members(members []string) *ScopesFunctionalRoleMemberPathReqBodyBuilder {
+ builder.members = members
+ builder.membersFlag = true
+ return builder
+}
+
+// 角色内用户的管理范围
+//
+// 示例值:
+func (builder *ScopesFunctionalRoleMemberPathReqBodyBuilder) Departments(departments []string) *ScopesFunctionalRoleMemberPathReqBodyBuilder {
+ builder.departments = departments
+ builder.departmentsFlag = true
+ return builder
+}
+
+func (builder *ScopesFunctionalRoleMemberPathReqBodyBuilder) Build() (*ScopesFunctionalRoleMemberReqBody, error) {
+ req := &ScopesFunctionalRoleMemberReqBody{}
+ if builder.membersFlag {
+ req.Members = builder.members
+ }
+ if builder.departmentsFlag {
+ req.Departments = builder.departments
+ }
+ return req, nil
+}
+
+type ScopesFunctionalRoleMemberReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *ScopesFunctionalRoleMemberReqBody
+}
+
+func NewScopesFunctionalRoleMemberReqBuilder() *ScopesFunctionalRoleMemberReqBuilder {
+ builder := &ScopesFunctionalRoleMemberReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 角色的唯一标识,单租户下唯一
+//
+// 示例值:7vrj3vk70xk7v5r
+func (builder *ScopesFunctionalRoleMemberReqBuilder) RoleId(roleId string) *ScopesFunctionalRoleMemberReqBuilder {
+ builder.apiReq.PathParams.Set("role_id", fmt.Sprint(roleId))
+ return builder
+}
+
+// 用户 ID 类型
+//
+// 示例值:open_id
+func (builder *ScopesFunctionalRoleMemberReqBuilder) UserIdType(userIdType string) *ScopesFunctionalRoleMemberReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 此次调用中使用的部门ID的类型
+//
+// 示例值:open_department_id
+func (builder *ScopesFunctionalRoleMemberReqBuilder) DepartmentIdType(departmentIdType string) *ScopesFunctionalRoleMemberReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+//
+func (builder *ScopesFunctionalRoleMemberReqBuilder) Body(body *ScopesFunctionalRoleMemberReqBody) *ScopesFunctionalRoleMemberReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *ScopesFunctionalRoleMemberReqBuilder) Build() *ScopesFunctionalRoleMemberReq {
+ req := &ScopesFunctionalRoleMemberReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type ScopesFunctionalRoleMemberReqBody struct {
+ Members []string `json:"members,omitempty"` // 角色修改的角色成员列表(一批用户的UserID列表)
+ Departments []string `json:"departments,omitempty"` // 角色内用户的管理范围
+}
+
+type ScopesFunctionalRoleMemberReq struct {
+ apiReq *larkcore.ApiReq
+ Body *ScopesFunctionalRoleMemberReqBody `body:""`
+}
+
+type ScopesFunctionalRoleMemberRespData struct {
+ Results []*FunctionalRoleMemberResult `json:"results,omitempty"` // 批量更新角色成员管理范围结果集
+}
+
+type ScopesFunctionalRoleMemberResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ScopesFunctionalRoleMemberRespData `json:"data"` // 业务数据
+}
+
+func (resp *ScopesFunctionalRoleMemberResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateGroupReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ group *Group
+}
+
+func NewCreateGroupReqBuilder() *CreateGroupReqBuilder {
+ builder := &CreateGroupReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:open_id
+func (builder *CreateGroupReqBuilder) UserIdType(userIdType string) *CreateGroupReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 此次调用中使用的部门ID的类型
+//
+// 示例值:open_department_id
+func (builder *CreateGroupReqBuilder) DepartmentIdType(departmentIdType string) *CreateGroupReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+// 使用该接口创建用户组,请注意创建用户组时应用的通讯录权限范围需为“全部员工”,否则会创建失败,[点击了解通讯录权限范围](https://open.feishu.cn/document/ukTMukTMukTM/uETNz4SM1MjLxUzM/v3/guides/scope_authority)。
+func (builder *CreateGroupReqBuilder) Group(group *Group) *CreateGroupReqBuilder {
+ builder.group = group
+ return builder
+}
+
+func (builder *CreateGroupReqBuilder) Build() *CreateGroupReq {
+ req := &CreateGroupReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.group
+ return req
+}
+
+type CreateGroupReq struct {
+ apiReq *larkcore.ApiReq
+ Group *Group `body:""`
+}
+
+type CreateGroupRespData struct {
+ GroupId *string `json:"group_id,omitempty"` // 用户组ID
+}
+
+type CreateGroupResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateGroupRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateGroupResp) Success() bool {
+ return resp.Code == 0
+}
+
+type DeleteGroupReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewDeleteGroupReqBuilder() *DeleteGroupReqBuilder {
+ builder := &DeleteGroupReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 需删除的用户组ID
+//
+// 示例值:g1837191
+func (builder *DeleteGroupReqBuilder) GroupId(groupId string) *DeleteGroupReqBuilder {
+ builder.apiReq.PathParams.Set("group_id", fmt.Sprint(groupId))
+ return builder
+}
+
+func (builder *DeleteGroupReqBuilder) Build() *DeleteGroupReq {
+ req := &DeleteGroupReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type DeleteGroupReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type DeleteGroupResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *DeleteGroupResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetGroupReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetGroupReqBuilder() *GetGroupReqBuilder {
+ builder := &GetGroupReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 用户组ID
+//
+// 示例值:g193821
+func (builder *GetGroupReqBuilder) GroupId(groupId string) *GetGroupReqBuilder {
+ builder.apiReq.PathParams.Set("group_id", fmt.Sprint(groupId))
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:open_id
+func (builder *GetGroupReqBuilder) UserIdType(userIdType string) *GetGroupReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 此次调用中使用的部门ID的类型
+//
+// 示例值:open_department_id
+func (builder *GetGroupReqBuilder) DepartmentIdType(departmentIdType string) *GetGroupReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+func (builder *GetGroupReqBuilder) Build() *GetGroupReq {
+ req := &GetGroupReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type GetGroupReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetGroupRespData struct {
+ Group *Group `json:"group,omitempty"` // 用户组详情
+}
+
+type GetGroupResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetGroupRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetGroupResp) Success() bool {
+ return resp.Code == 0
+}
+
+type MemberBelongGroupReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewMemberBelongGroupReqBuilder() *MemberBelongGroupReqBuilder {
+ builder := &MemberBelongGroupReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 成员ID
+//
+// 示例值:u287xj12
+func (builder *MemberBelongGroupReqBuilder) MemberId(memberId string) *MemberBelongGroupReqBuilder {
+ builder.apiReq.QueryParams.Set("member_id", fmt.Sprint(memberId))
+ return builder
+}
+
+// 成员ID类型
+//
+// 示例值:open_id
+func (builder *MemberBelongGroupReqBuilder) MemberIdType(memberIdType string) *MemberBelongGroupReqBuilder {
+ builder.apiReq.QueryParams.Set("member_id_type", fmt.Sprint(memberIdType))
+ return builder
+}
+
+// 欲获取的用户组类型
+//
+// 示例值:1
+func (builder *MemberBelongGroupReqBuilder) GroupType(groupType int) *MemberBelongGroupReqBuilder {
+ builder.apiReq.QueryParams.Set("group_type", fmt.Sprint(groupType))
+ return builder
+}
+
+// 分页查询大小
+//
+// 示例值:500
+func (builder *MemberBelongGroupReqBuilder) PageSize(pageSize int) *MemberBelongGroupReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 分页查询Token
+//
+// 示例值:AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=
+func (builder *MemberBelongGroupReqBuilder) PageToken(pageToken string) *MemberBelongGroupReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+func (builder *MemberBelongGroupReqBuilder) Build() *MemberBelongGroupReq {
+ req := &MemberBelongGroupReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type MemberBelongGroupReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type MemberBelongGroupRespData struct {
+ GroupList []string `json:"group_list,omitempty"` // 用户组ID列表
+ PageToken *string `json:"page_token,omitempty"` // 分页查询Token
+ HasMore *bool `json:"has_more,omitempty"` // 是否有更多结果
+}
+
+type MemberBelongGroupResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *MemberBelongGroupRespData `json:"data"` // 业务数据
+}
+
+func (resp *MemberBelongGroupResp) Success() bool {
+ return resp.Code == 0
+}
+
+type PatchGroupReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ group *Group
+}
+
+func NewPatchGroupReqBuilder() *PatchGroupReqBuilder {
+ builder := &PatchGroupReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 用户组ID
+//
+// 示例值:g187131
+func (builder *PatchGroupReqBuilder) GroupId(groupId string) *PatchGroupReqBuilder {
+ builder.apiReq.PathParams.Set("group_id", fmt.Sprint(groupId))
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:open_id
+func (builder *PatchGroupReqBuilder) UserIdType(userIdType string) *PatchGroupReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 此次调用中使用的部门ID的类型
+//
+// 示例值:open_department_id
+func (builder *PatchGroupReqBuilder) DepartmentIdType(departmentIdType string) *PatchGroupReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+// 使用该接口更新用户组信息,请注意更新用户组时应用的通讯录权限范围需为“全部员工”,否则会更新失败。[点击了解通讯录权限范围](https://open.feishu.cn/document/ukTMukTMukTM/uETNz4SM1MjLxUzM/v3/guides/scope_authority)。
+func (builder *PatchGroupReqBuilder) Group(group *Group) *PatchGroupReqBuilder {
+ builder.group = group
+ return builder
+}
+
+func (builder *PatchGroupReqBuilder) Build() *PatchGroupReq {
+ req := &PatchGroupReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.group
+ return req
+}
+
+type PatchGroupReq struct {
+ apiReq *larkcore.ApiReq
+ Group *Group `body:""`
+}
+
+type PatchGroupResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *PatchGroupResp) Success() bool {
+ return resp.Code == 0
+}
+
+type SimplelistGroupReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ limit int // 最大返回多少记录,当使用迭代器访问时才有效
+}
+
+func NewSimplelistGroupReqBuilder() *SimplelistGroupReqBuilder {
+ builder := &SimplelistGroupReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 最大返回多少记录,当使用迭代器访问时才有效
+func (builder *SimplelistGroupReqBuilder) Limit(limit int) *SimplelistGroupReqBuilder {
+ builder.limit = limit
+ return builder
+}
+
+// 分页大小
+//
+// 示例值:50
+func (builder *SimplelistGroupReqBuilder) PageSize(pageSize int) *SimplelistGroupReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果
+//
+// 示例值:AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=
+func (builder *SimplelistGroupReqBuilder) PageToken(pageToken string) *SimplelistGroupReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 用户组类型
+//
+// 示例值:1
+func (builder *SimplelistGroupReqBuilder) Type(type_ int) *SimplelistGroupReqBuilder {
+ builder.apiReq.QueryParams.Set("type", fmt.Sprint(type_))
+ return builder
+}
+
+func (builder *SimplelistGroupReqBuilder) Build() *SimplelistGroupReq {
+ req := &SimplelistGroupReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.Limit = builder.limit
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type SimplelistGroupReq struct {
+ apiReq *larkcore.ApiReq
+ Limit int // 最多返回多少记录,只有在使用迭代器访问时,才有效
+
+}
+
+type SimplelistGroupRespData struct {
+ Grouplist []*Group `json:"grouplist,omitempty"` // 用户组列表
+ PageToken *string `json:"page_token,omitempty"` // 下次分页获取的page_token
+ HasMore *bool `json:"has_more,omitempty"` // 是否还需要分页获取
+}
+
+type SimplelistGroupResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *SimplelistGroupRespData `json:"data"` // 业务数据
+}
+
+func (resp *SimplelistGroupResp) Success() bool {
+ return resp.Code == 0
+}
+
+type AddGroupMemberReqBodyBuilder struct {
+ memberType string // 用户组成员的类型,取值为 user
+ memberTypeFlag bool
+ memberIdType string // 当member_type =user时候,member_id_type表示user_id_type,枚举值为open_id, union_id, user_id
+ memberIdTypeFlag bool
+ memberId string // 添加的成员ID
+ memberIdFlag bool
+}
+
+func NewAddGroupMemberReqBodyBuilder() *AddGroupMemberReqBodyBuilder {
+ builder := &AddGroupMemberReqBodyBuilder{}
+ return builder
+}
+
+// 用户组成员的类型,取值为 user
+//
+//示例值:user
+func (builder *AddGroupMemberReqBodyBuilder) MemberType(memberType string) *AddGroupMemberReqBodyBuilder {
+ builder.memberType = memberType
+ builder.memberTypeFlag = true
+ return builder
+}
+
+// 当member_type =user时候,member_id_type表示user_id_type,枚举值为open_id, union_id, user_id
+//
+//示例值:open_id
+func (builder *AddGroupMemberReqBodyBuilder) MemberIdType(memberIdType string) *AddGroupMemberReqBodyBuilder {
+ builder.memberIdType = memberIdType
+ builder.memberIdTypeFlag = true
+ return builder
+}
+
+// 添加的成员ID
+//
+//示例值:ou_7dab8a3d3cdcc9da365777c7ad535d62
+func (builder *AddGroupMemberReqBodyBuilder) MemberId(memberId string) *AddGroupMemberReqBodyBuilder {
+ builder.memberId = memberId
+ builder.memberIdFlag = true
+ return builder
+}
+
+func (builder *AddGroupMemberReqBodyBuilder) Build() *AddGroupMemberReqBody {
+ req := &AddGroupMemberReqBody{}
+ if builder.memberTypeFlag {
+ req.MemberType = &builder.memberType
+ }
+ if builder.memberIdTypeFlag {
+ req.MemberIdType = &builder.memberIdType
+ }
+ if builder.memberIdFlag {
+ req.MemberId = &builder.memberId
+ }
+ return req
+}
+
+type AddGroupMemberPathReqBodyBuilder struct {
+ memberType string // 用户组成员的类型,取值为 user
+ memberTypeFlag bool
+ memberIdType string // 当member_type =user时候,member_id_type表示user_id_type,枚举值为open_id, union_id, user_id
+ memberIdTypeFlag bool
+ memberId string // 添加的成员ID
+ memberIdFlag bool
+}
+
+func NewAddGroupMemberPathReqBodyBuilder() *AddGroupMemberPathReqBodyBuilder {
+ builder := &AddGroupMemberPathReqBodyBuilder{}
+ return builder
+}
+
+// 用户组成员的类型,取值为 user
+//
+// 示例值:user
+func (builder *AddGroupMemberPathReqBodyBuilder) MemberType(memberType string) *AddGroupMemberPathReqBodyBuilder {
+ builder.memberType = memberType
+ builder.memberTypeFlag = true
+ return builder
+}
+
+// 当member_type =user时候,member_id_type表示user_id_type,枚举值为open_id, union_id, user_id
+//
+// 示例值:open_id
+func (builder *AddGroupMemberPathReqBodyBuilder) MemberIdType(memberIdType string) *AddGroupMemberPathReqBodyBuilder {
+ builder.memberIdType = memberIdType
+ builder.memberIdTypeFlag = true
+ return builder
+}
+
+// 添加的成员ID
+//
+// 示例值:ou_7dab8a3d3cdcc9da365777c7ad535d62
+func (builder *AddGroupMemberPathReqBodyBuilder) MemberId(memberId string) *AddGroupMemberPathReqBodyBuilder {
+ builder.memberId = memberId
+ builder.memberIdFlag = true
+ return builder
+}
+
+func (builder *AddGroupMemberPathReqBodyBuilder) Build() (*AddGroupMemberReqBody, error) {
+ req := &AddGroupMemberReqBody{}
+ if builder.memberTypeFlag {
+ req.MemberType = &builder.memberType
+ }
+ if builder.memberIdTypeFlag {
+ req.MemberIdType = &builder.memberIdType
+ }
+ if builder.memberIdFlag {
+ req.MemberId = &builder.memberId
+ }
+ return req, nil
+}
+
+type AddGroupMemberReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *AddGroupMemberReqBody
+}
+
+func NewAddGroupMemberReqBuilder() *AddGroupMemberReqBuilder {
+ builder := &AddGroupMemberReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 用户组ID
+//
+// 示例值:g281721
+func (builder *AddGroupMemberReqBuilder) GroupId(groupId string) *AddGroupMemberReqBuilder {
+ builder.apiReq.PathParams.Set("group_id", fmt.Sprint(groupId))
+ return builder
+}
+
+// 向用户组中添加成员(目前成员仅支持用户,未来会支持部门),如果应用的通讯录权限范围是“全部员工”,则可将任何成员添加到任何用户组。如果应用的通讯录权限范围不是“全部员工”,则仅可将通讯录权限范围中的成员添加到通讯录权限范围的用户组中,[点击了解通讯录权限范围](https://open.feishu.cn/document/ukTMukTMukTM/uETNz4SM1MjLxUzM/v3/guides/scope_authority)。
+func (builder *AddGroupMemberReqBuilder) Body(body *AddGroupMemberReqBody) *AddGroupMemberReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *AddGroupMemberReqBuilder) Build() *AddGroupMemberReq {
+ req := &AddGroupMemberReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type AddGroupMemberReqBody struct {
+ MemberType *string `json:"member_type,omitempty"` // 用户组成员的类型,取值为 user
+ MemberIdType *string `json:"member_id_type,omitempty"` // 当member_type =user时候,member_id_type表示user_id_type,枚举值为open_id, union_id, user_id
+ MemberId *string `json:"member_id,omitempty"` // 添加的成员ID
+}
+
+type AddGroupMemberReq struct {
+ apiReq *larkcore.ApiReq
+ Body *AddGroupMemberReqBody `body:""`
+}
+
+type AddGroupMemberResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *AddGroupMemberResp) Success() bool {
+ return resp.Code == 0
+}
+
+type BatchAddGroupMemberReqBodyBuilder struct {
+ members []*Memberlist // 待添加成员
+ membersFlag bool
+}
+
+func NewBatchAddGroupMemberReqBodyBuilder() *BatchAddGroupMemberReqBodyBuilder {
+ builder := &BatchAddGroupMemberReqBodyBuilder{}
+ return builder
+}
+
+// 待添加成员
+//
+//示例值:
+func (builder *BatchAddGroupMemberReqBodyBuilder) Members(members []*Memberlist) *BatchAddGroupMemberReqBodyBuilder {
+ builder.members = members
+ builder.membersFlag = true
+ return builder
+}
+
+func (builder *BatchAddGroupMemberReqBodyBuilder) Build() *BatchAddGroupMemberReqBody {
+ req := &BatchAddGroupMemberReqBody{}
+ if builder.membersFlag {
+ req.Members = builder.members
+ }
+ return req
+}
+
+type BatchAddGroupMemberPathReqBodyBuilder struct {
+ members []*Memberlist // 待添加成员
+ membersFlag bool
+}
+
+func NewBatchAddGroupMemberPathReqBodyBuilder() *BatchAddGroupMemberPathReqBodyBuilder {
+ builder := &BatchAddGroupMemberPathReqBodyBuilder{}
return builder
}
-func (builder *PatchGroupReqBuilder) Build() *PatchGroupReq {
- req := &PatchGroupReq{}
+// 待添加成员
+//
+// 示例值:
+func (builder *BatchAddGroupMemberPathReqBodyBuilder) Members(members []*Memberlist) *BatchAddGroupMemberPathReqBodyBuilder {
+ builder.members = members
+ builder.membersFlag = true
+ return builder
+}
+
+func (builder *BatchAddGroupMemberPathReqBodyBuilder) Build() (*BatchAddGroupMemberReqBody, error) {
+ req := &BatchAddGroupMemberReqBody{}
+ if builder.membersFlag {
+ req.Members = builder.members
+ }
+ return req, nil
+}
+
+type BatchAddGroupMemberReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *BatchAddGroupMemberReqBody
+}
+
+func NewBatchAddGroupMemberReqBuilder() *BatchAddGroupMemberReqBuilder {
+ builder := &BatchAddGroupMemberReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 用户组ID
+//
+// 示例值:test_group
+func (builder *BatchAddGroupMemberReqBuilder) GroupId(groupId string) *BatchAddGroupMemberReqBuilder {
+ builder.apiReq.PathParams.Set("group_id", fmt.Sprint(groupId))
+ return builder
+}
+
+// 向普通用户组中批量添加成员(目前仅支持添加用户,暂不支持添加部门),如果应用的通讯录权限范围是“全部员工”,则可将任何成员添加到任何用户组。如果应用的通讯录权限范围不是“全部员工”,则仅可将通讯录权限范围中的成员添加到通讯录权限范围的用户组中,[点击了解通讯录权限范围](https://open.feishu.cn/document/ukTMukTMukTM/uETNz4SM1MjLxUzM/v3/guides/scope_authority)。
+func (builder *BatchAddGroupMemberReqBuilder) Body(body *BatchAddGroupMemberReqBody) *BatchAddGroupMemberReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *BatchAddGroupMemberReqBuilder) Build() *BatchAddGroupMemberReq {
+ req := &BatchAddGroupMemberReq{}
req.apiReq = &larkcore.ApiReq{}
req.apiReq.PathParams = builder.apiReq.PathParams
req.apiReq.Body = builder.body
return req
}
-type PatchGroupReqBody struct {
- Name *string `json:"name,omitempty"` // 用户组的名字,企业内唯一,最大长度:100 字符
- Description *string `json:"description,omitempty"` // 用户组描述信息;最大长度:500 字
+type BatchAddGroupMemberReqBody struct {
+ Members []*Memberlist `json:"members,omitempty"` // 待添加成员
}
-type PatchGroupReq struct {
+type BatchAddGroupMemberReq struct {
apiReq *larkcore.ApiReq
- Body *PatchGroupReqBody `body:""`
+ Body *BatchAddGroupMemberReqBody `body:""`
}
-type PatchGroupResp struct {
+type BatchAddGroupMemberRespData struct {
+ Results []*MemberResult `json:"results,omitempty"` // 成员添加操作结果
+}
+
+type BatchAddGroupMemberResp struct {
*larkcore.ApiResp `json:"-"`
larkcore.CodeError
+ Data *BatchAddGroupMemberRespData `json:"data"` // 业务数据
}
-func (resp *PatchGroupResp) Success() bool {
+func (resp *BatchAddGroupMemberResp) Success() bool {
return resp.Code == 0
}
-type SimplelistGroupReqBuilder struct {
- apiReq *larkcore.ApiReq
- limit int // 最大返回多少记录,当使用迭代器访问时才有效
+type BatchRemoveGroupMemberReqBodyBuilder struct {
+ members []*Memberlist // 待移除成员
+ membersFlag bool
}
-func NewSimplelistGroupReqBuilder() *SimplelistGroupReqBuilder {
- builder := &SimplelistGroupReqBuilder{}
- builder.apiReq = &larkcore.ApiReq{
- PathParams: larkcore.PathParams{},
- QueryParams: larkcore.QueryParams{},
- }
+func NewBatchRemoveGroupMemberReqBodyBuilder() *BatchRemoveGroupMemberReqBodyBuilder {
+ builder := &BatchRemoveGroupMemberReqBodyBuilder{}
return builder
}
-// 最大返回多少记录,当使用迭代器访问时才有效
-func (builder *SimplelistGroupReqBuilder) Limit(limit int) *SimplelistGroupReqBuilder {
- builder.limit = limit
+// 待移除成员
+//
+//示例值:
+func (builder *BatchRemoveGroupMemberReqBodyBuilder) Members(members []*Memberlist) *BatchRemoveGroupMemberReqBodyBuilder {
+ builder.members = members
+ builder.membersFlag = true
return builder
}
-// 分页大小
-//
-// 示例值:50
-func (builder *SimplelistGroupReqBuilder) PageSize(pageSize int) *SimplelistGroupReqBuilder {
- builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+func (builder *BatchRemoveGroupMemberReqBodyBuilder) Build() *BatchRemoveGroupMemberReqBody {
+ req := &BatchRemoveGroupMemberReqBody{}
+ if builder.membersFlag {
+ req.Members = builder.members
+ }
+ return req
+}
+
+type BatchRemoveGroupMemberPathReqBodyBuilder struct {
+ members []*Memberlist // 待移除成员
+ membersFlag bool
+}
+
+func NewBatchRemoveGroupMemberPathReqBodyBuilder() *BatchRemoveGroupMemberPathReqBodyBuilder {
+ builder := &BatchRemoveGroupMemberPathReqBodyBuilder{}
return builder
}
-// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果
+// 待移除成员
//
-// 示例值:AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=
-func (builder *SimplelistGroupReqBuilder) PageToken(pageToken string) *SimplelistGroupReqBuilder {
- builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+// 示例值:
+func (builder *BatchRemoveGroupMemberPathReqBodyBuilder) Members(members []*Memberlist) *BatchRemoveGroupMemberPathReqBodyBuilder {
+ builder.members = members
+ builder.membersFlag = true
return builder
}
-// 用户组类型
+func (builder *BatchRemoveGroupMemberPathReqBodyBuilder) Build() (*BatchRemoveGroupMemberReqBody, error) {
+ req := &BatchRemoveGroupMemberReqBody{}
+ if builder.membersFlag {
+ req.Members = builder.members
+ }
+ return req, nil
+}
+
+type BatchRemoveGroupMemberReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *BatchRemoveGroupMemberReqBody
+}
+
+func NewBatchRemoveGroupMemberReqBuilder() *BatchRemoveGroupMemberReqBuilder {
+ builder := &BatchRemoveGroupMemberReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 用户组ID
//
-// 示例值:1
-func (builder *SimplelistGroupReqBuilder) Type(type_ int) *SimplelistGroupReqBuilder {
- builder.apiReq.QueryParams.Set("type", fmt.Sprint(type_))
+// 示例值:test_group
+func (builder *BatchRemoveGroupMemberReqBuilder) GroupId(groupId string) *BatchRemoveGroupMemberReqBuilder {
+ builder.apiReq.PathParams.Set("group_id", fmt.Sprint(groupId))
return builder
}
-func (builder *SimplelistGroupReqBuilder) Build() *SimplelistGroupReq {
- req := &SimplelistGroupReq{}
+// 从普通用户组中批量移除成员 (目前仅支持移除用户,暂不支持移除部门)。如果应用的通讯录权限范围是“全部员工”,则可将任何成员移出任何用户组。如果应用的通讯录权限范围不是“全部员工”,则仅可将通讯录权限范围中的成员从通讯录权限范围的用户组中移除, [点击了解通讯录权限范围](https://open.feishu.cn/document/ukTMukTMukTM/uETNz4SM1MjLxUzM/v3/guides/scope_authority)。
+func (builder *BatchRemoveGroupMemberReqBuilder) Body(body *BatchRemoveGroupMemberReqBody) *BatchRemoveGroupMemberReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *BatchRemoveGroupMemberReqBuilder) Build() *BatchRemoveGroupMemberReq {
+ req := &BatchRemoveGroupMemberReq{}
req.apiReq = &larkcore.ApiReq{}
- req.Limit = builder.limit
- req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.Body = builder.body
return req
}
-type SimplelistGroupReq struct {
- apiReq *larkcore.ApiReq
- Limit int // 最多返回多少记录,只有在使用迭代器访问时,才有效
-
+type BatchRemoveGroupMemberReqBody struct {
+ Members []*Memberlist `json:"members,omitempty"` // 待移除成员
}
-type SimplelistGroupRespData struct {
- Grouplist []*Group `json:"grouplist,omitempty"` // 用户组列表
- PageToken *string `json:"page_token,omitempty"` // 下次分页获取的page_token
- HasMore *bool `json:"has_more,omitempty"` // 是否还需要分页获取
+type BatchRemoveGroupMemberReq struct {
+ apiReq *larkcore.ApiReq
+ Body *BatchRemoveGroupMemberReqBody `body:""`
}
-type SimplelistGroupResp struct {
+type BatchRemoveGroupMemberResp struct {
*larkcore.ApiResp `json:"-"`
larkcore.CodeError
- Data *SimplelistGroupRespData `json:"data"` // 业务数据
}
-func (resp *SimplelistGroupResp) Success() bool {
+func (resp *BatchRemoveGroupMemberResp) Success() bool {
return resp.Code == 0
}
-type AddGroupMemberReqBodyBuilder struct {
+type RemoveGroupMemberReqBodyBuilder struct {
memberType string // 用户组成员的类型,取值为 user
memberTypeFlag bool
+ memberId string // 操作移除的用户组成员ID
+ memberIdFlag bool
memberIdType string // 当member_type =user时候,member_id_type表示user_id_type,枚举值为open_id, union_id, user_id
memberIdTypeFlag bool
- memberId string // 添加的成员ID
- memberIdFlag bool
}
-func NewAddGroupMemberReqBodyBuilder() *AddGroupMemberReqBodyBuilder {
- builder := &AddGroupMemberReqBodyBuilder{}
+func NewRemoveGroupMemberReqBodyBuilder() *RemoveGroupMemberReqBodyBuilder {
+ builder := &RemoveGroupMemberReqBodyBuilder{}
return builder
}
// 用户组成员的类型,取值为 user
//
//示例值:user
-func (builder *AddGroupMemberReqBodyBuilder) MemberType(memberType string) *AddGroupMemberReqBodyBuilder {
+func (builder *RemoveGroupMemberReqBodyBuilder) MemberType(memberType string) *RemoveGroupMemberReqBodyBuilder {
builder.memberType = memberType
builder.memberTypeFlag = true
return builder
}
-// 当member_type =user时候,member_id_type表示user_id_type,枚举值为open_id, union_id, user_id
+// 操作移除的用户组成员ID
//
-//示例值:open_id
-func (builder *AddGroupMemberReqBodyBuilder) MemberIdType(memberIdType string) *AddGroupMemberReqBodyBuilder {
- builder.memberIdType = memberIdType
- builder.memberIdTypeFlag = true
+//示例值:xj82871k
+func (builder *RemoveGroupMemberReqBodyBuilder) MemberId(memberId string) *RemoveGroupMemberReqBodyBuilder {
+ builder.memberId = memberId
+ builder.memberIdFlag = true
return builder
}
-// 添加的成员ID
+// 当member_type =user时候,member_id_type表示user_id_type,枚举值为open_id, union_id, user_id
//
-//示例值:ou_7dab8a3d3cdcc9da365777c7ad535d62
-func (builder *AddGroupMemberReqBodyBuilder) MemberId(memberId string) *AddGroupMemberReqBodyBuilder {
- builder.memberId = memberId
- builder.memberIdFlag = true
+//示例值:open_id
+func (builder *RemoveGroupMemberReqBodyBuilder) MemberIdType(memberIdType string) *RemoveGroupMemberReqBodyBuilder {
+ builder.memberIdType = memberIdType
+ builder.memberIdTypeFlag = true
return builder
}
-func (builder *AddGroupMemberReqBodyBuilder) Build() *AddGroupMemberReqBody {
- req := &AddGroupMemberReqBody{}
+func (builder *RemoveGroupMemberReqBodyBuilder) Build() *RemoveGroupMemberReqBody {
+ req := &RemoveGroupMemberReqBody{}
if builder.memberTypeFlag {
req.MemberType = &builder.memberType
}
- if builder.memberIdTypeFlag {
- req.MemberIdType = &builder.memberIdType
- }
if builder.memberIdFlag {
req.MemberId = &builder.memberId
}
+ if builder.memberIdTypeFlag {
+ req.MemberIdType = &builder.memberIdType
+ }
return req
}
-type AddGroupMemberPathReqBodyBuilder struct {
+type RemoveGroupMemberPathReqBodyBuilder struct {
memberType string // 用户组成员的类型,取值为 user
memberTypeFlag bool
+ memberId string // 操作移除的用户组成员ID
+ memberIdFlag bool
memberIdType string // 当member_type =user时候,member_id_type表示user_id_type,枚举值为open_id, union_id, user_id
memberIdTypeFlag bool
- memberId string // 添加的成员ID
- memberIdFlag bool
}
-func NewAddGroupMemberPathReqBodyBuilder() *AddGroupMemberPathReqBodyBuilder {
- builder := &AddGroupMemberPathReqBodyBuilder{}
+func NewRemoveGroupMemberPathReqBodyBuilder() *RemoveGroupMemberPathReqBodyBuilder {
+ builder := &RemoveGroupMemberPathReqBodyBuilder{}
return builder
}
// 用户组成员的类型,取值为 user
//
// 示例值:user
-func (builder *AddGroupMemberPathReqBodyBuilder) MemberType(memberType string) *AddGroupMemberPathReqBodyBuilder {
+func (builder *RemoveGroupMemberPathReqBodyBuilder) MemberType(memberType string) *RemoveGroupMemberPathReqBodyBuilder {
builder.memberType = memberType
builder.memberTypeFlag = true
return builder
}
-// 当member_type =user时候,member_id_type表示user_id_type,枚举值为open_id, union_id, user_id
+// 操作移除的用户组成员ID
//
-// 示例值:open_id
-func (builder *AddGroupMemberPathReqBodyBuilder) MemberIdType(memberIdType string) *AddGroupMemberPathReqBodyBuilder {
- builder.memberIdType = memberIdType
- builder.memberIdTypeFlag = true
+// 示例值:xj82871k
+func (builder *RemoveGroupMemberPathReqBodyBuilder) MemberId(memberId string) *RemoveGroupMemberPathReqBodyBuilder {
+ builder.memberId = memberId
+ builder.memberIdFlag = true
return builder
}
-// 添加的成员ID
+// 当member_type =user时候,member_id_type表示user_id_type,枚举值为open_id, union_id, user_id
//
-// 示例值:ou_7dab8a3d3cdcc9da365777c7ad535d62
-func (builder *AddGroupMemberPathReqBodyBuilder) MemberId(memberId string) *AddGroupMemberPathReqBodyBuilder {
- builder.memberId = memberId
- builder.memberIdFlag = true
+// 示例值:open_id
+func (builder *RemoveGroupMemberPathReqBodyBuilder) MemberIdType(memberIdType string) *RemoveGroupMemberPathReqBodyBuilder {
+ builder.memberIdType = memberIdType
+ builder.memberIdTypeFlag = true
return builder
}
-
-func (builder *AddGroupMemberPathReqBodyBuilder) Build() (*AddGroupMemberReqBody, error) {
- req := &AddGroupMemberReqBody{}
+
+func (builder *RemoveGroupMemberPathReqBodyBuilder) Build() (*RemoveGroupMemberReqBody, error) {
+ req := &RemoveGroupMemberReqBody{}
if builder.memberTypeFlag {
req.MemberType = &builder.memberType
}
- if builder.memberIdTypeFlag {
- req.MemberIdType = &builder.memberIdType
- }
if builder.memberIdFlag {
req.MemberId = &builder.memberId
}
+ if builder.memberIdTypeFlag {
+ req.MemberIdType = &builder.memberIdType
+ }
return req, nil
}
-type AddGroupMemberReqBuilder struct {
+type RemoveGroupMemberReqBuilder struct {
apiReq *larkcore.ApiReq
- body *AddGroupMemberReqBody
+ body *RemoveGroupMemberReqBody
}
-func NewAddGroupMemberReqBuilder() *AddGroupMemberReqBuilder {
- builder := &AddGroupMemberReqBuilder{}
+func NewRemoveGroupMemberReqBuilder() *RemoveGroupMemberReqBuilder {
+ builder := &RemoveGroupMemberReqBuilder{}
builder.apiReq = &larkcore.ApiReq{
PathParams: larkcore.PathParams{},
QueryParams: larkcore.QueryParams{},
@@ -6713,107 +8621,134 @@ func NewAddGroupMemberReqBuilder() *AddGroupMemberReqBuilder {
// 用户组ID
//
-// 示例值:g281721
-func (builder *AddGroupMemberReqBuilder) GroupId(groupId string) *AddGroupMemberReqBuilder {
+// 示例值:g198123
+func (builder *RemoveGroupMemberReqBuilder) GroupId(groupId string) *RemoveGroupMemberReqBuilder {
builder.apiReq.PathParams.Set("group_id", fmt.Sprint(groupId))
return builder
}
-// 向用户组中添加成员(目前成员仅支持用户,未来会支持部门),如果应用的通讯录权限范围是“全部员工”,则可将任何成员添加到任何用户组。如果应用的通讯录权限范围不是“全部员工”,则仅可将通讯录权限范围中的成员添加到通讯录权限范围的用户组中,[点击了解通讯录权限范围](https://open.feishu.cn/document/ukTMukTMukTM/uETNz4SM1MjLxUzM/v3/guides/scope_authority)。
-func (builder *AddGroupMemberReqBuilder) Body(body *AddGroupMemberReqBody) *AddGroupMemberReqBuilder {
+// 从用户组中移除成员 (目前成员仅支持用户,未来会支持部门),如果应用的通讯录权限范围是“全部员工”,则可将任何成员移出任何用户组。如果应用的通讯录权限范围不是“全部员工”,则仅可将通讯录权限范围中的成员从通讯录权限范围的用户组中移除, [点击了解通讯录权限范围](https://open.feishu.cn/document/ukTMukTMukTM/uETNz4SM1MjLxUzM/v3/guides/scope_authority)。
+func (builder *RemoveGroupMemberReqBuilder) Body(body *RemoveGroupMemberReqBody) *RemoveGroupMemberReqBuilder {
builder.body = body
return builder
}
-func (builder *AddGroupMemberReqBuilder) Build() *AddGroupMemberReq {
- req := &AddGroupMemberReq{}
+func (builder *RemoveGroupMemberReqBuilder) Build() *RemoveGroupMemberReq {
+ req := &RemoveGroupMemberReq{}
req.apiReq = &larkcore.ApiReq{}
req.apiReq.PathParams = builder.apiReq.PathParams
req.apiReq.Body = builder.body
return req
}
-type AddGroupMemberReqBody struct {
+type RemoveGroupMemberReqBody struct {
MemberType *string `json:"member_type,omitempty"` // 用户组成员的类型,取值为 user
+ MemberId *string `json:"member_id,omitempty"` // 操作移除的用户组成员ID
MemberIdType *string `json:"member_id_type,omitempty"` // 当member_type =user时候,member_id_type表示user_id_type,枚举值为open_id, union_id, user_id
- MemberId *string `json:"member_id,omitempty"` // 添加的成员ID
}
-type AddGroupMemberReq struct {
+type RemoveGroupMemberReq struct {
apiReq *larkcore.ApiReq
- Body *AddGroupMemberReqBody `body:""`
+ Body *RemoveGroupMemberReqBody `body:""`
}
-type AddGroupMemberResp struct {
+type RemoveGroupMemberResp struct {
*larkcore.ApiResp `json:"-"`
larkcore.CodeError
}
-func (resp *AddGroupMemberResp) Success() bool {
+func (resp *RemoveGroupMemberResp) Success() bool {
return resp.Code == 0
}
-type BatchAddGroupMemberReqBodyBuilder struct {
- members []*Memberlist // 待添加成员
- membersFlag bool
+type SimplelistGroupMemberReqBuilder struct {
+ apiReq *larkcore.ApiReq
}
-func NewBatchAddGroupMemberReqBodyBuilder() *BatchAddGroupMemberReqBodyBuilder {
- builder := &BatchAddGroupMemberReqBodyBuilder{}
+func NewSimplelistGroupMemberReqBuilder() *SimplelistGroupMemberReqBuilder {
+ builder := &SimplelistGroupMemberReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
return builder
}
-// 待添加成员
+// 用户组ID
//
-//示例值:
-func (builder *BatchAddGroupMemberReqBodyBuilder) Members(members []*Memberlist) *BatchAddGroupMemberReqBodyBuilder {
- builder.members = members
- builder.membersFlag = true
+// 示例值:g128187
+func (builder *SimplelistGroupMemberReqBuilder) GroupId(groupId string) *SimplelistGroupMemberReqBuilder {
+ builder.apiReq.PathParams.Set("group_id", fmt.Sprint(groupId))
return builder
}
-func (builder *BatchAddGroupMemberReqBodyBuilder) Build() *BatchAddGroupMemberReqBody {
- req := &BatchAddGroupMemberReqBody{}
- if builder.membersFlag {
- req.Members = builder.members
- }
- return req
+// 分页大小
+//
+// 示例值:50
+func (builder *SimplelistGroupMemberReqBuilder) PageSize(pageSize int) *SimplelistGroupMemberReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
}
-type BatchAddGroupMemberPathReqBodyBuilder struct {
- members []*Memberlist // 待添加成员
- membersFlag bool
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果
+//
+// 示例值:AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=
+func (builder *SimplelistGroupMemberReqBuilder) PageToken(pageToken string) *SimplelistGroupMemberReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
}
-func NewBatchAddGroupMemberPathReqBodyBuilder() *BatchAddGroupMemberPathReqBodyBuilder {
- builder := &BatchAddGroupMemberPathReqBodyBuilder{}
+// 欲获取成员ID类型。;当member_type=user时候,member_id_type表示user_id_type,枚举值open_id, union_id和user_id。;当member_type=department时候,member_id_type表示department_id_type,枚举值open_id和department_id。
+//
+// 示例值:open_id
+func (builder *SimplelistGroupMemberReqBuilder) MemberIdType(memberIdType string) *SimplelistGroupMemberReqBuilder {
+ builder.apiReq.QueryParams.Set("member_id_type", fmt.Sprint(memberIdType))
return builder
}
-// 待添加成员
+// 欲获取的用户组成员类型。
//
-// 示例值:
-func (builder *BatchAddGroupMemberPathReqBodyBuilder) Members(members []*Memberlist) *BatchAddGroupMemberPathReqBodyBuilder {
- builder.members = members
- builder.membersFlag = true
+// 示例值:user
+func (builder *SimplelistGroupMemberReqBuilder) MemberType(memberType string) *SimplelistGroupMemberReqBuilder {
+ builder.apiReq.QueryParams.Set("member_type", fmt.Sprint(memberType))
return builder
}
-func (builder *BatchAddGroupMemberPathReqBodyBuilder) Build() (*BatchAddGroupMemberReqBody, error) {
- req := &BatchAddGroupMemberReqBody{}
- if builder.membersFlag {
- req.Members = builder.members
- }
- return req, nil
+func (builder *SimplelistGroupMemberReqBuilder) Build() *SimplelistGroupMemberReq {
+ req := &SimplelistGroupMemberReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
}
-type BatchAddGroupMemberReqBuilder struct {
+type SimplelistGroupMemberReq struct {
apiReq *larkcore.ApiReq
- body *BatchAddGroupMemberReqBody
}
-func NewBatchAddGroupMemberReqBuilder() *BatchAddGroupMemberReqBuilder {
- builder := &BatchAddGroupMemberReqBuilder{}
+type SimplelistGroupMemberRespData struct {
+ Memberlist []*Memberlist `json:"memberlist,omitempty"` // 成员列表
+ PageToken *string `json:"page_token,omitempty"` // 下次分页获取的page_token
+ HasMore *bool `json:"has_more,omitempty"` // 是否还需要分页获取
+}
+
+type SimplelistGroupMemberResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *SimplelistGroupMemberRespData `json:"data"` // 业务数据
+}
+
+func (resp *SimplelistGroupMemberResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateJobFamilyReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ jobFamily *JobFamily
+}
+
+func NewCreateJobFamilyReqBuilder() *CreateJobFamilyReqBuilder {
+ builder := &CreateJobFamilyReqBuilder{}
builder.apiReq = &larkcore.ApiReq{
PathParams: larkcore.PathParams{},
QueryParams: larkcore.QueryParams{},
@@ -6821,112 +8756,206 @@ func NewBatchAddGroupMemberReqBuilder() *BatchAddGroupMemberReqBuilder {
return builder
}
-// 用户组ID
//
-// 示例值:test_group
-func (builder *BatchAddGroupMemberReqBuilder) GroupId(groupId string) *BatchAddGroupMemberReqBuilder {
- builder.apiReq.PathParams.Set("group_id", fmt.Sprint(groupId))
+func (builder *CreateJobFamilyReqBuilder) JobFamily(jobFamily *JobFamily) *CreateJobFamilyReqBuilder {
+ builder.jobFamily = jobFamily
return builder
}
-// 向普通用户组中批量添加成员(目前仅支持添加用户,暂不支持添加部门),如果应用的通讯录权限范围是“全部员工”,则可将任何成员添加到任何用户组。如果应用的通讯录权限范围不是“全部员工”,则仅可将通讯录权限范围中的成员添加到通讯录权限范围的用户组中,[点击了解通讯录权限范围](https://open.feishu.cn/document/ukTMukTMukTM/uETNz4SM1MjLxUzM/v3/guides/scope_authority)。
-func (builder *BatchAddGroupMemberReqBuilder) Body(body *BatchAddGroupMemberReqBody) *BatchAddGroupMemberReqBuilder {
- builder.body = body
+func (builder *CreateJobFamilyReqBuilder) Build() *CreateJobFamilyReq {
+ req := &CreateJobFamilyReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.Body = builder.jobFamily
+ return req
+}
+
+type CreateJobFamilyReq struct {
+ apiReq *larkcore.ApiReq
+ JobFamily *JobFamily `body:""`
+}
+
+type CreateJobFamilyRespData struct {
+ JobFamily *JobFamily `json:"job_family,omitempty"` // 序列信息
+}
+
+type CreateJobFamilyResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateJobFamilyRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateJobFamilyResp) Success() bool {
+ return resp.Code == 0
+}
+
+type DeleteJobFamilyReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewDeleteJobFamilyReqBuilder() *DeleteJobFamilyReqBuilder {
+ builder := &DeleteJobFamilyReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
return builder
}
-func (builder *BatchAddGroupMemberReqBuilder) Build() *BatchAddGroupMemberReq {
- req := &BatchAddGroupMemberReq{}
+// 序列ID
+//
+// 示例值:mga5oa8ayjlp9rb
+func (builder *DeleteJobFamilyReqBuilder) JobFamilyId(jobFamilyId string) *DeleteJobFamilyReqBuilder {
+ builder.apiReq.PathParams.Set("job_family_id", fmt.Sprint(jobFamilyId))
+ return builder
+}
+
+func (builder *DeleteJobFamilyReqBuilder) Build() *DeleteJobFamilyReq {
+ req := &DeleteJobFamilyReq{}
req.apiReq = &larkcore.ApiReq{}
req.apiReq.PathParams = builder.apiReq.PathParams
- req.apiReq.Body = builder.body
return req
}
-type BatchAddGroupMemberReqBody struct {
- Members []*Memberlist `json:"members,omitempty"` // 待添加成员
+type DeleteJobFamilyReq struct {
+ apiReq *larkcore.ApiReq
}
-type BatchAddGroupMemberReq struct {
+type DeleteJobFamilyResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *DeleteJobFamilyResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetJobFamilyReqBuilder struct {
apiReq *larkcore.ApiReq
- Body *BatchAddGroupMemberReqBody `body:""`
}
-type BatchAddGroupMemberRespData struct {
- Results []*MemberResult `json:"results,omitempty"` // 成员添加操作结果
+func NewGetJobFamilyReqBuilder() *GetJobFamilyReqBuilder {
+ builder := &GetJobFamilyReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
}
-type BatchAddGroupMemberResp struct {
+// 序列ID
+//
+// 示例值:mga5oa8ayjlp9rb
+func (builder *GetJobFamilyReqBuilder) JobFamilyId(jobFamilyId string) *GetJobFamilyReqBuilder {
+ builder.apiReq.PathParams.Set("job_family_id", fmt.Sprint(jobFamilyId))
+ return builder
+}
+
+func (builder *GetJobFamilyReqBuilder) Build() *GetJobFamilyReq {
+ req := &GetJobFamilyReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type GetJobFamilyReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetJobFamilyRespData struct {
+ JobFamily *JobFamily `json:"job_family,omitempty"` // 序列信息
+}
+
+type GetJobFamilyResp struct {
*larkcore.ApiResp `json:"-"`
larkcore.CodeError
- Data *BatchAddGroupMemberRespData `json:"data"` // 业务数据
+ Data *GetJobFamilyRespData `json:"data"` // 业务数据
}
-func (resp *BatchAddGroupMemberResp) Success() bool {
+func (resp *GetJobFamilyResp) Success() bool {
return resp.Code == 0
}
-type BatchRemoveGroupMemberReqBodyBuilder struct {
- members []*Memberlist // 待移除成员
- membersFlag bool
+type ListJobFamilyReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ limit int // 最大返回多少记录,当使用迭代器访问时才有效
}
-func NewBatchRemoveGroupMemberReqBodyBuilder() *BatchRemoveGroupMemberReqBodyBuilder {
- builder := &BatchRemoveGroupMemberReqBodyBuilder{}
+func NewListJobFamilyReqBuilder() *ListJobFamilyReqBuilder {
+ builder := &ListJobFamilyReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
return builder
}
-// 待移除成员
+// 最大返回多少记录,当使用迭代器访问时才有效
+func (builder *ListJobFamilyReqBuilder) Limit(limit int) *ListJobFamilyReqBuilder {
+ builder.limit = limit
+ return builder
+}
+
+// 分页大小
//
-//示例值:
-func (builder *BatchRemoveGroupMemberReqBodyBuilder) Members(members []*Memberlist) *BatchRemoveGroupMemberReqBodyBuilder {
- builder.members = members
- builder.membersFlag = true
+// 示例值:10
+func (builder *ListJobFamilyReqBuilder) PageSize(pageSize int) *ListJobFamilyReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
return builder
}
-func (builder *BatchRemoveGroupMemberReqBodyBuilder) Build() *BatchRemoveGroupMemberReqBody {
- req := &BatchRemoveGroupMemberReqBody{}
- if builder.membersFlag {
- req.Members = builder.members
- }
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果
+//
+// 示例值:"3"
+func (builder *ListJobFamilyReqBuilder) PageToken(pageToken string) *ListJobFamilyReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 序列名称,传入该字段时,可查询指定序列名称对应的序列信息
+//
+// 示例值:2-2
+func (builder *ListJobFamilyReqBuilder) Name(name string) *ListJobFamilyReqBuilder {
+ builder.apiReq.QueryParams.Set("name", fmt.Sprint(name))
+ return builder
+}
+
+func (builder *ListJobFamilyReqBuilder) Build() *ListJobFamilyReq {
+ req := &ListJobFamilyReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.Limit = builder.limit
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
return req
}
-type BatchRemoveGroupMemberPathReqBodyBuilder struct {
- members []*Memberlist // 待移除成员
- membersFlag bool
+type ListJobFamilyReq struct {
+ apiReq *larkcore.ApiReq
+ Limit int // 最多返回多少记录,只有在使用迭代器访问时,才有效
+
}
-func NewBatchRemoveGroupMemberPathReqBodyBuilder() *BatchRemoveGroupMemberPathReqBodyBuilder {
- builder := &BatchRemoveGroupMemberPathReqBodyBuilder{}
- return builder
+type ListJobFamilyRespData struct {
+ Items []*JobFamily `json:"items,omitempty"` // 序列信息
+ PageToken *string `json:"page_token,omitempty"` // 下一页分页的token
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页数据
}
-// 待移除成员
-//
-// 示例值:
-func (builder *BatchRemoveGroupMemberPathReqBodyBuilder) Members(members []*Memberlist) *BatchRemoveGroupMemberPathReqBodyBuilder {
- builder.members = members
- builder.membersFlag = true
- return builder
+type ListJobFamilyResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListJobFamilyRespData `json:"data"` // 业务数据
}
-func (builder *BatchRemoveGroupMemberPathReqBodyBuilder) Build() (*BatchRemoveGroupMemberReqBody, error) {
- req := &BatchRemoveGroupMemberReqBody{}
- if builder.membersFlag {
- req.Members = builder.members
- }
- return req, nil
+func (resp *ListJobFamilyResp) Success() bool {
+ return resp.Code == 0
}
-type BatchRemoveGroupMemberReqBuilder struct {
- apiReq *larkcore.ApiReq
- body *BatchRemoveGroupMemberReqBody
+type UpdateJobFamilyReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ jobFamily *JobFamily
}
-func NewBatchRemoveGroupMemberReqBuilder() *BatchRemoveGroupMemberReqBuilder {
- builder := &BatchRemoveGroupMemberReqBuilder{}
+func NewUpdateJobFamilyReqBuilder() *UpdateJobFamilyReqBuilder {
+ builder := &UpdateJobFamilyReqBuilder{}
builder.apiReq = &larkcore.ApiReq{
PathParams: larkcore.PathParams{},
QueryParams: larkcore.QueryParams{},
@@ -6934,163 +8963,140 @@ func NewBatchRemoveGroupMemberReqBuilder() *BatchRemoveGroupMemberReqBuilder {
return builder
}
-// 用户组ID
+// 序列ID
//
-// 示例值:test_group
-func (builder *BatchRemoveGroupMemberReqBuilder) GroupId(groupId string) *BatchRemoveGroupMemberReqBuilder {
- builder.apiReq.PathParams.Set("group_id", fmt.Sprint(groupId))
+// 示例值:mga5oa8ayjlp9rb
+func (builder *UpdateJobFamilyReqBuilder) JobFamilyId(jobFamilyId string) *UpdateJobFamilyReqBuilder {
+ builder.apiReq.PathParams.Set("job_family_id", fmt.Sprint(jobFamilyId))
return builder
}
-// 从普通用户组中批量移除成员 (目前仅支持移除用户,暂不支持移除部门)。如果应用的通讯录权限范围是“全部员工”,则可将任何成员移出任何用户组。如果应用的通讯录权限范围不是“全部员工”,则仅可将通讯录权限范围中的成员从通讯录权限范围的用户组中移除, [点击了解通讯录权限范围](https://open.feishu.cn/document/ukTMukTMukTM/uETNz4SM1MjLxUzM/v3/guides/scope_authority)。
-func (builder *BatchRemoveGroupMemberReqBuilder) Body(body *BatchRemoveGroupMemberReqBody) *BatchRemoveGroupMemberReqBuilder {
- builder.body = body
+//
+func (builder *UpdateJobFamilyReqBuilder) JobFamily(jobFamily *JobFamily) *UpdateJobFamilyReqBuilder {
+ builder.jobFamily = jobFamily
return builder
}
-func (builder *BatchRemoveGroupMemberReqBuilder) Build() *BatchRemoveGroupMemberReq {
- req := &BatchRemoveGroupMemberReq{}
+func (builder *UpdateJobFamilyReqBuilder) Build() *UpdateJobFamilyReq {
+ req := &UpdateJobFamilyReq{}
req.apiReq = &larkcore.ApiReq{}
req.apiReq.PathParams = builder.apiReq.PathParams
- req.apiReq.Body = builder.body
+ req.apiReq.Body = builder.jobFamily
return req
}
-type BatchRemoveGroupMemberReqBody struct {
- Members []*Memberlist `json:"members,omitempty"` // 待移除成员
+type UpdateJobFamilyReq struct {
+ apiReq *larkcore.ApiReq
+ JobFamily *JobFamily `body:""`
}
-type BatchRemoveGroupMemberReq struct {
- apiReq *larkcore.ApiReq
- Body *BatchRemoveGroupMemberReqBody `body:""`
+type UpdateJobFamilyRespData struct {
+ JobFamily *JobFamily `json:"job_family,omitempty"` // 更新后的序列信息
}
-type BatchRemoveGroupMemberResp struct {
+type UpdateJobFamilyResp struct {
*larkcore.ApiResp `json:"-"`
larkcore.CodeError
+ Data *UpdateJobFamilyRespData `json:"data"` // 业务数据
}
-func (resp *BatchRemoveGroupMemberResp) Success() bool {
+func (resp *UpdateJobFamilyResp) Success() bool {
return resp.Code == 0
}
-type RemoveGroupMemberReqBodyBuilder struct {
- memberType string // 用户组成员的类型,取值为 user
- memberTypeFlag bool
- memberId string // 操作移除的用户组成员ID
- memberIdFlag bool
- memberIdType string // 当member_type =user时候,member_id_type表示user_id_type,枚举值为open_id, union_id, user_id
- memberIdTypeFlag bool
+type CreateJobLevelReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ jobLevel *JobLevel
}
-func NewRemoveGroupMemberReqBodyBuilder() *RemoveGroupMemberReqBodyBuilder {
- builder := &RemoveGroupMemberReqBodyBuilder{}
+func NewCreateJobLevelReqBuilder() *CreateJobLevelReqBuilder {
+ builder := &CreateJobLevelReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
return builder
}
-// 用户组成员的类型,取值为 user
//
-//示例值:user
-func (builder *RemoveGroupMemberReqBodyBuilder) MemberType(memberType string) *RemoveGroupMemberReqBodyBuilder {
- builder.memberType = memberType
- builder.memberTypeFlag = true
+func (builder *CreateJobLevelReqBuilder) JobLevel(jobLevel *JobLevel) *CreateJobLevelReqBuilder {
+ builder.jobLevel = jobLevel
return builder
}
-// 操作移除的用户组成员ID
-//
-//示例值:xj82871k
-func (builder *RemoveGroupMemberReqBodyBuilder) MemberId(memberId string) *RemoveGroupMemberReqBodyBuilder {
- builder.memberId = memberId
- builder.memberIdFlag = true
- return builder
+func (builder *CreateJobLevelReqBuilder) Build() *CreateJobLevelReq {
+ req := &CreateJobLevelReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.Body = builder.jobLevel
+ return req
}
-// 当member_type =user时候,member_id_type表示user_id_type,枚举值为open_id, union_id, user_id
-//
-//示例值:open_id
-func (builder *RemoveGroupMemberReqBodyBuilder) MemberIdType(memberIdType string) *RemoveGroupMemberReqBodyBuilder {
- builder.memberIdType = memberIdType
- builder.memberIdTypeFlag = true
- return builder
+type CreateJobLevelReq struct {
+ apiReq *larkcore.ApiReq
+ JobLevel *JobLevel `body:""`
}
-func (builder *RemoveGroupMemberReqBodyBuilder) Build() *RemoveGroupMemberReqBody {
- req := &RemoveGroupMemberReqBody{}
- if builder.memberTypeFlag {
- req.MemberType = &builder.memberType
- }
- if builder.memberIdFlag {
- req.MemberId = &builder.memberId
- }
- if builder.memberIdTypeFlag {
- req.MemberIdType = &builder.memberIdType
- }
- return req
+type CreateJobLevelRespData struct {
+ JobLevel *JobLevel `json:"job_level,omitempty"` // 职级信息
}
-type RemoveGroupMemberPathReqBodyBuilder struct {
- memberType string // 用户组成员的类型,取值为 user
- memberTypeFlag bool
- memberId string // 操作移除的用户组成员ID
- memberIdFlag bool
- memberIdType string // 当member_type =user时候,member_id_type表示user_id_type,枚举值为open_id, union_id, user_id
- memberIdTypeFlag bool
+type CreateJobLevelResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateJobLevelRespData `json:"data"` // 业务数据
}
-func NewRemoveGroupMemberPathReqBodyBuilder() *RemoveGroupMemberPathReqBodyBuilder {
- builder := &RemoveGroupMemberPathReqBodyBuilder{}
- return builder
+func (resp *CreateJobLevelResp) Success() bool {
+ return resp.Code == 0
}
-// 用户组成员的类型,取值为 user
-//
-// 示例值:user
-func (builder *RemoveGroupMemberPathReqBodyBuilder) MemberType(memberType string) *RemoveGroupMemberPathReqBodyBuilder {
- builder.memberType = memberType
- builder.memberTypeFlag = true
- return builder
+type DeleteJobLevelReqBuilder struct {
+ apiReq *larkcore.ApiReq
}
-// 操作移除的用户组成员ID
-//
-// 示例值:xj82871k
-func (builder *RemoveGroupMemberPathReqBodyBuilder) MemberId(memberId string) *RemoveGroupMemberPathReqBodyBuilder {
- builder.memberId = memberId
- builder.memberIdFlag = true
+func NewDeleteJobLevelReqBuilder() *DeleteJobLevelReqBuilder {
+ builder := &DeleteJobLevelReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
return builder
}
-// 当member_type =user时候,member_id_type表示user_id_type,枚举值为open_id, union_id, user_id
+// 职级ID
//
-// 示例值:open_id
-func (builder *RemoveGroupMemberPathReqBodyBuilder) MemberIdType(memberIdType string) *RemoveGroupMemberPathReqBodyBuilder {
- builder.memberIdType = memberIdType
- builder.memberIdTypeFlag = true
+// 示例值:mga5oa8ayjlp9rb
+func (builder *DeleteJobLevelReqBuilder) JobLevelId(jobLevelId string) *DeleteJobLevelReqBuilder {
+ builder.apiReq.PathParams.Set("job_level_id", fmt.Sprint(jobLevelId))
return builder
}
-func (builder *RemoveGroupMemberPathReqBodyBuilder) Build() (*RemoveGroupMemberReqBody, error) {
- req := &RemoveGroupMemberReqBody{}
- if builder.memberTypeFlag {
- req.MemberType = &builder.memberType
- }
- if builder.memberIdFlag {
- req.MemberId = &builder.memberId
- }
- if builder.memberIdTypeFlag {
- req.MemberIdType = &builder.memberIdType
- }
- return req, nil
+func (builder *DeleteJobLevelReqBuilder) Build() *DeleteJobLevelReq {
+ req := &DeleteJobLevelReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
}
-type RemoveGroupMemberReqBuilder struct {
+type DeleteJobLevelReq struct {
apiReq *larkcore.ApiReq
- body *RemoveGroupMemberReqBody
}
-func NewRemoveGroupMemberReqBuilder() *RemoveGroupMemberReqBuilder {
- builder := &RemoveGroupMemberReqBuilder{}
+type DeleteJobLevelResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *DeleteJobLevelResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetJobLevelReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetJobLevelReqBuilder() *GetJobLevelReqBuilder {
+ builder := &GetJobLevelReqBuilder{}
builder.apiReq = &larkcore.ApiReq{
PathParams: larkcore.PathParams{},
QueryParams: larkcore.QueryParams{},
@@ -7098,54 +9104,46 @@ func NewRemoveGroupMemberReqBuilder() *RemoveGroupMemberReqBuilder {
return builder
}
-// 用户组ID
+// 职级ID
//
-// 示例值:g198123
-func (builder *RemoveGroupMemberReqBuilder) GroupId(groupId string) *RemoveGroupMemberReqBuilder {
- builder.apiReq.PathParams.Set("group_id", fmt.Sprint(groupId))
- return builder
-}
-
-// 从用户组中移除成员 (目前成员仅支持用户,未来会支持部门),如果应用的通讯录权限范围是“全部员工”,则可将任何成员移出任何用户组。如果应用的通讯录权限范围不是“全部员工”,则仅可将通讯录权限范围中的成员从通讯录权限范围的用户组中移除, [点击了解通讯录权限范围](https://open.feishu.cn/document/ukTMukTMukTM/uETNz4SM1MjLxUzM/v3/guides/scope_authority)。
-func (builder *RemoveGroupMemberReqBuilder) Body(body *RemoveGroupMemberReqBody) *RemoveGroupMemberReqBuilder {
- builder.body = body
+// 示例值:mga5oa8ayjlp9rb
+func (builder *GetJobLevelReqBuilder) JobLevelId(jobLevelId string) *GetJobLevelReqBuilder {
+ builder.apiReq.PathParams.Set("job_level_id", fmt.Sprint(jobLevelId))
return builder
}
-func (builder *RemoveGroupMemberReqBuilder) Build() *RemoveGroupMemberReq {
- req := &RemoveGroupMemberReq{}
+func (builder *GetJobLevelReqBuilder) Build() *GetJobLevelReq {
+ req := &GetJobLevelReq{}
req.apiReq = &larkcore.ApiReq{}
req.apiReq.PathParams = builder.apiReq.PathParams
- req.apiReq.Body = builder.body
return req
}
-type RemoveGroupMemberReqBody struct {
- MemberType *string `json:"member_type,omitempty"` // 用户组成员的类型,取值为 user
- MemberId *string `json:"member_id,omitempty"` // 操作移除的用户组成员ID
- MemberIdType *string `json:"member_id_type,omitempty"` // 当member_type =user时候,member_id_type表示user_id_type,枚举值为open_id, union_id, user_id
+type GetJobLevelReq struct {
+ apiReq *larkcore.ApiReq
}
-type RemoveGroupMemberReq struct {
- apiReq *larkcore.ApiReq
- Body *RemoveGroupMemberReqBody `body:""`
+type GetJobLevelRespData struct {
+ JobLevel *JobLevel `json:"job_level,omitempty"` // 职级信息
}
-type RemoveGroupMemberResp struct {
+type GetJobLevelResp struct {
*larkcore.ApiResp `json:"-"`
larkcore.CodeError
+ Data *GetJobLevelRespData `json:"data"` // 业务数据
}
-func (resp *RemoveGroupMemberResp) Success() bool {
+func (resp *GetJobLevelResp) Success() bool {
return resp.Code == 0
}
-type SimplelistGroupMemberReqBuilder struct {
+type ListJobLevelReqBuilder struct {
apiReq *larkcore.ApiReq
+ limit int // 最大返回多少记录,当使用迭代器访问时才有效
}
-func NewSimplelistGroupMemberReqBuilder() *SimplelistGroupMemberReqBuilder {
- builder := &SimplelistGroupMemberReqBuilder{}
+func NewListJobLevelReqBuilder() *ListJobLevelReqBuilder {
+ builder := &ListJobLevelReqBuilder{}
builder.apiReq = &larkcore.ApiReq{
PathParams: larkcore.PathParams{},
QueryParams: larkcore.QueryParams{},
@@ -7153,71 +9151,118 @@ func NewSimplelistGroupMemberReqBuilder() *SimplelistGroupMemberReqBuilder {
return builder
}
-// 用户组ID
-//
-// 示例值:g128187
-func (builder *SimplelistGroupMemberReqBuilder) GroupId(groupId string) *SimplelistGroupMemberReqBuilder {
- builder.apiReq.PathParams.Set("group_id", fmt.Sprint(groupId))
+// 最大返回多少记录,当使用迭代器访问时才有效
+func (builder *ListJobLevelReqBuilder) Limit(limit int) *ListJobLevelReqBuilder {
+ builder.limit = limit
return builder
}
// 分页大小
//
-// 示例值:50
-func (builder *SimplelistGroupMemberReqBuilder) PageSize(pageSize int) *SimplelistGroupMemberReqBuilder {
+// 示例值:10
+func (builder *ListJobLevelReqBuilder) PageSize(pageSize int) *ListJobLevelReqBuilder {
builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
return builder
}
// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果
//
-// 示例值:AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw=
-func (builder *SimplelistGroupMemberReqBuilder) PageToken(pageToken string) *SimplelistGroupMemberReqBuilder {
+// 示例值:"3"
+func (builder *ListJobLevelReqBuilder) PageToken(pageToken string) *ListJobLevelReqBuilder {
builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
return builder
}
-// 欲获取成员ID类型。;当member_type=user时候,member_id_type表示user_id_type,枚举值open_id, union_id和user_id。;当member_type=department时候,member_id_type表示department_id_type,枚举值open_id和department_id。
+// 传入该字段时,可查询指定职级名称对应的职级信息。
//
-// 示例值:open_id
-func (builder *SimplelistGroupMemberReqBuilder) MemberIdType(memberIdType string) *SimplelistGroupMemberReqBuilder {
- builder.apiReq.QueryParams.Set("member_id_type", fmt.Sprint(memberIdType))
+// 示例值:高级
+func (builder *ListJobLevelReqBuilder) Name(name string) *ListJobLevelReqBuilder {
+ builder.apiReq.QueryParams.Set("name", fmt.Sprint(name))
return builder
}
-// 欲获取的用户组成员类型。
+func (builder *ListJobLevelReqBuilder) Build() *ListJobLevelReq {
+ req := &ListJobLevelReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.Limit = builder.limit
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListJobLevelReq struct {
+ apiReq *larkcore.ApiReq
+ Limit int // 最多返回多少记录,只有在使用迭代器访问时,才有效
+
+}
+
+type ListJobLevelRespData struct {
+ Items []*JobLevel `json:"items,omitempty"` // 职级列表
+ PageToken *string `json:"page_token,omitempty"` // 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 page_token
+ HasMore *bool `json:"has_more,omitempty"` // 是否还有更多项
+}
+
+type ListJobLevelResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListJobLevelRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListJobLevelResp) Success() bool {
+ return resp.Code == 0
+}
+
+type UpdateJobLevelReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ jobLevel *JobLevel
+}
+
+func NewUpdateJobLevelReqBuilder() *UpdateJobLevelReqBuilder {
+ builder := &UpdateJobLevelReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 职级ID
//
-// 示例值:user
-func (builder *SimplelistGroupMemberReqBuilder) MemberType(memberType string) *SimplelistGroupMemberReqBuilder {
- builder.apiReq.QueryParams.Set("member_type", fmt.Sprint(memberType))
+// 示例值:mga5oa8ayjlp9rb
+func (builder *UpdateJobLevelReqBuilder) JobLevelId(jobLevelId string) *UpdateJobLevelReqBuilder {
+ builder.apiReq.PathParams.Set("job_level_id", fmt.Sprint(jobLevelId))
return builder
}
-func (builder *SimplelistGroupMemberReqBuilder) Build() *SimplelistGroupMemberReq {
- req := &SimplelistGroupMemberReq{}
+//
+func (builder *UpdateJobLevelReqBuilder) JobLevel(jobLevel *JobLevel) *UpdateJobLevelReqBuilder {
+ builder.jobLevel = jobLevel
+ return builder
+}
+
+func (builder *UpdateJobLevelReqBuilder) Build() *UpdateJobLevelReq {
+ req := &UpdateJobLevelReq{}
req.apiReq = &larkcore.ApiReq{}
req.apiReq.PathParams = builder.apiReq.PathParams
- req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.jobLevel
return req
}
-type SimplelistGroupMemberReq struct {
- apiReq *larkcore.ApiReq
+type UpdateJobLevelReq struct {
+ apiReq *larkcore.ApiReq
+ JobLevel *JobLevel `body:""`
}
-type SimplelistGroupMemberRespData struct {
- Memberlist []*Memberlist `json:"memberlist,omitempty"` // 成员列表
- PageToken *string `json:"page_token,omitempty"` // 下次分页获取的page_token
- HasMore *bool `json:"has_more,omitempty"` // 是否还需要分页获取
+type UpdateJobLevelRespData struct {
+ JobLevel *JobLevel `json:"job_level,omitempty"` // 职级信息
}
-type SimplelistGroupMemberResp struct {
+type UpdateJobLevelResp struct {
*larkcore.ApiResp `json:"-"`
larkcore.CodeError
- Data *SimplelistGroupMemberRespData `json:"data"` // 业务数据
+ Data *UpdateJobLevelRespData `json:"data"` // 业务数据
}
-func (resp *SimplelistGroupMemberResp) Success() bool {
+func (resp *UpdateJobLevelResp) Success() bool {
return resp.Code == 0
}
@@ -7258,7 +9303,7 @@ func (builder *ListScopeReqBuilder) PageToken(pageToken string) *ListScopeReqBui
return builder
}
-// 分页大小,控制返回值所有列表长度之和
+// 分页大小,返回值所有列表长度之和不超过这个值
//
// 示例值:50
func (builder *ListScopeReqBuilder) PageSize(pageSize int) *ListScopeReqBuilder {
@@ -8824,7 +10869,7 @@ func (builder *ListUserReqBuilder) DepartmentId(departmentId string) *ListUserRe
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:
func (builder *ListUserReqBuilder) PageToken(pageToken string) *ListUserReqBuilder {
@@ -8832,7 +10877,7 @@ func (builder *ListUserReqBuilder) PageToken(pageToken string) *ListUserReqBuild
return builder
}
-//
+// 分页大小
//
// 示例值:
func (builder *ListUserReqBuilder) PageSize(pageSize int) *ListUserReqBuilder {
@@ -8942,6 +10987,160 @@ func (resp *PatchUserResp) Success() bool {
return resp.Code == 0
}
+type ResurrectUserReqBodyBuilder struct {
+ departments []*UserDepartmentInfo // 指定恢复后用户所在部门
+ departmentsFlag bool
+ subscriptionIds []string // 指定恢复后分配的席位
+ subscriptionIdsFlag bool
+}
+
+func NewResurrectUserReqBodyBuilder() *ResurrectUserReqBodyBuilder {
+ builder := &ResurrectUserReqBodyBuilder{}
+ return builder
+}
+
+// 指定恢复后用户所在部门
+//
+//示例值:
+func (builder *ResurrectUserReqBodyBuilder) Departments(departments []*UserDepartmentInfo) *ResurrectUserReqBodyBuilder {
+ builder.departments = departments
+ builder.departmentsFlag = true
+ return builder
+}
+
+// 指定恢复后分配的席位
+//
+//示例值:
+func (builder *ResurrectUserReqBodyBuilder) SubscriptionIds(subscriptionIds []string) *ResurrectUserReqBodyBuilder {
+ builder.subscriptionIds = subscriptionIds
+ builder.subscriptionIdsFlag = true
+ return builder
+}
+
+func (builder *ResurrectUserReqBodyBuilder) Build() *ResurrectUserReqBody {
+ req := &ResurrectUserReqBody{}
+ if builder.departmentsFlag {
+ req.Departments = builder.departments
+ }
+ if builder.subscriptionIdsFlag {
+ req.SubscriptionIds = builder.subscriptionIds
+ }
+ return req
+}
+
+type ResurrectUserPathReqBodyBuilder struct {
+ departments []*UserDepartmentInfo // 指定恢复后用户所在部门
+ departmentsFlag bool
+ subscriptionIds []string // 指定恢复后分配的席位
+ subscriptionIdsFlag bool
+}
+
+func NewResurrectUserPathReqBodyBuilder() *ResurrectUserPathReqBodyBuilder {
+ builder := &ResurrectUserPathReqBodyBuilder{}
+ return builder
+}
+
+// 指定恢复后用户所在部门
+//
+// 示例值:
+func (builder *ResurrectUserPathReqBodyBuilder) Departments(departments []*UserDepartmentInfo) *ResurrectUserPathReqBodyBuilder {
+ builder.departments = departments
+ builder.departmentsFlag = true
+ return builder
+}
+
+// 指定恢复后分配的席位
+//
+// 示例值:
+func (builder *ResurrectUserPathReqBodyBuilder) SubscriptionIds(subscriptionIds []string) *ResurrectUserPathReqBodyBuilder {
+ builder.subscriptionIds = subscriptionIds
+ builder.subscriptionIdsFlag = true
+ return builder
+}
+
+func (builder *ResurrectUserPathReqBodyBuilder) Build() (*ResurrectUserReqBody, error) {
+ req := &ResurrectUserReqBody{}
+ if builder.departmentsFlag {
+ req.Departments = builder.departments
+ }
+ if builder.subscriptionIdsFlag {
+ req.SubscriptionIds = builder.subscriptionIds
+ }
+ return req, nil
+}
+
+type ResurrectUserReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *ResurrectUserReqBody
+}
+
+func NewResurrectUserReqBuilder() *ResurrectUserReqBuilder {
+ builder := &ResurrectUserReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 用户ID,需要与查询参数中的user_id_type类型保持一致。
+//
+// 示例值:ou_7dab8a3d3cdcc9da365777c7ad535d62
+func (builder *ResurrectUserReqBuilder) UserId(userId string) *ResurrectUserReqBuilder {
+ builder.apiReq.PathParams.Set("user_id", fmt.Sprint(userId))
+ return builder
+}
+
+// 用户id类型
+//
+// 示例值:user_id
+func (builder *ResurrectUserReqBuilder) UserIdType(userIdType string) *ResurrectUserReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 部门id类型
+//
+// 示例值:department_id
+func (builder *ResurrectUserReqBuilder) DepartmentIdType(departmentIdType string) *ResurrectUserReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+// 该接口用于恢复已删除用户(已离职的成员),仅自建应用可申请,应用商店应用无权调用接口。
+func (builder *ResurrectUserReqBuilder) Body(body *ResurrectUserReqBody) *ResurrectUserReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *ResurrectUserReqBuilder) Build() *ResurrectUserReq {
+ req := &ResurrectUserReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type ResurrectUserReqBody struct {
+ Departments []*UserDepartmentInfo `json:"departments,omitempty"` // 指定恢复后用户所在部门
+ SubscriptionIds []string `json:"subscription_ids,omitempty"` // 指定恢复后分配的席位
+}
+
+type ResurrectUserReq struct {
+ apiReq *larkcore.ApiReq
+ Body *ResurrectUserReqBody `body:""`
+}
+
+type ResurrectUserResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *ResurrectUserResp) Success() bool {
+ return resp.Code == 0
+}
+
type UpdateUserReqBuilder struct {
apiReq *larkcore.ApiReq
user *User
@@ -9529,6 +11728,60 @@ func (iterator *ListEmployeeTypeEnumIterator) NextPageToken() *string {
return iterator.nextPageToken
}
+type ListFunctionalRoleMemberIterator struct {
+ nextPageToken *string
+ items []*FunctionalRoleMember
+ index int
+ limit int
+ ctx context.Context
+ req *ListFunctionalRoleMemberReq
+ listFunc func(ctx context.Context, req *ListFunctionalRoleMemberReq, options ...larkcore.RequestOptionFunc) (*ListFunctionalRoleMemberResp, error)
+ options []larkcore.RequestOptionFunc
+ curlNum int
+}
+
+func (iterator *ListFunctionalRoleMemberIterator) Next() (bool, *FunctionalRoleMember, error) {
+ // 达到最大量,则返回
+ if iterator.limit > 0 && iterator.curlNum >= iterator.limit {
+ return false, nil, nil
+ }
+
+ // 为0则拉取数据
+ if iterator.index == 0 || iterator.index >= len(iterator.items) {
+ if iterator.index != 0 && iterator.nextPageToken == nil {
+ return false, nil, nil
+ }
+ if iterator.nextPageToken != nil {
+ iterator.req.apiReq.QueryParams.Set("page_token", *iterator.nextPageToken)
+ }
+ resp, err := iterator.listFunc(iterator.ctx, iterator.req, iterator.options...)
+ if err != nil {
+ return false, nil, err
+ }
+
+ if resp.Code != 0 {
+ return false, nil, errors.New(fmt.Sprintf("Code:%d,Msg:%s", resp.Code, resp.Msg))
+ }
+
+ if len(resp.Data.Members) == 0 {
+ return false, nil, nil
+ }
+
+ iterator.nextPageToken = resp.Data.PageToken
+ iterator.items = resp.Data.Members
+ iterator.index = 0
+ }
+
+ block := iterator.items[iterator.index]
+ iterator.index++
+ iterator.curlNum++
+ return true, block, nil
+}
+
+func (iterator *ListFunctionalRoleMemberIterator) NextPageToken() *string {
+ return iterator.nextPageToken
+}
+
type SimplelistGroupIterator struct {
nextPageToken *string
items []*Group
@@ -9583,6 +11836,114 @@ func (iterator *SimplelistGroupIterator) NextPageToken() *string {
return iterator.nextPageToken
}
+type ListJobFamilyIterator struct {
+ nextPageToken *string
+ items []*JobFamily
+ index int
+ limit int
+ ctx context.Context
+ req *ListJobFamilyReq
+ listFunc func(ctx context.Context, req *ListJobFamilyReq, options ...larkcore.RequestOptionFunc) (*ListJobFamilyResp, error)
+ options []larkcore.RequestOptionFunc
+ curlNum int
+}
+
+func (iterator *ListJobFamilyIterator) Next() (bool, *JobFamily, error) {
+ // 达到最大量,则返回
+ if iterator.limit > 0 && iterator.curlNum >= iterator.limit {
+ return false, nil, nil
+ }
+
+ // 为0则拉取数据
+ if iterator.index == 0 || iterator.index >= len(iterator.items) {
+ if iterator.index != 0 && iterator.nextPageToken == nil {
+ return false, nil, nil
+ }
+ if iterator.nextPageToken != nil {
+ iterator.req.apiReq.QueryParams.Set("page_token", *iterator.nextPageToken)
+ }
+ resp, err := iterator.listFunc(iterator.ctx, iterator.req, iterator.options...)
+ if err != nil {
+ return false, nil, err
+ }
+
+ if resp.Code != 0 {
+ return false, nil, errors.New(fmt.Sprintf("Code:%d,Msg:%s", resp.Code, resp.Msg))
+ }
+
+ if len(resp.Data.Items) == 0 {
+ return false, nil, nil
+ }
+
+ iterator.nextPageToken = resp.Data.PageToken
+ iterator.items = resp.Data.Items
+ iterator.index = 0
+ }
+
+ block := iterator.items[iterator.index]
+ iterator.index++
+ iterator.curlNum++
+ return true, block, nil
+}
+
+func (iterator *ListJobFamilyIterator) NextPageToken() *string {
+ return iterator.nextPageToken
+}
+
+type ListJobLevelIterator struct {
+ nextPageToken *string
+ items []*JobLevel
+ index int
+ limit int
+ ctx context.Context
+ req *ListJobLevelReq
+ listFunc func(ctx context.Context, req *ListJobLevelReq, options ...larkcore.RequestOptionFunc) (*ListJobLevelResp, error)
+ options []larkcore.RequestOptionFunc
+ curlNum int
+}
+
+func (iterator *ListJobLevelIterator) Next() (bool, *JobLevel, error) {
+ // 达到最大量,则返回
+ if iterator.limit > 0 && iterator.curlNum >= iterator.limit {
+ return false, nil, nil
+ }
+
+ // 为0则拉取数据
+ if iterator.index == 0 || iterator.index >= len(iterator.items) {
+ if iterator.index != 0 && iterator.nextPageToken == nil {
+ return false, nil, nil
+ }
+ if iterator.nextPageToken != nil {
+ iterator.req.apiReq.QueryParams.Set("page_token", *iterator.nextPageToken)
+ }
+ resp, err := iterator.listFunc(iterator.ctx, iterator.req, iterator.options...)
+ if err != nil {
+ return false, nil, err
+ }
+
+ if resp.Code != 0 {
+ return false, nil, errors.New(fmt.Sprintf("Code:%d,Msg:%s", resp.Code, resp.Msg))
+ }
+
+ if len(resp.Data.Items) == 0 {
+ return false, nil, nil
+ }
+
+ iterator.nextPageToken = resp.Data.PageToken
+ iterator.items = resp.Data.Items
+ iterator.index = 0
+ }
+
+ block := iterator.items[iterator.index]
+ iterator.index++
+ iterator.curlNum++
+ return true, block, nil
+}
+
+func (iterator *ListJobLevelIterator) NextPageToken() *string {
+ return iterator.nextPageToken
+}
+
type FindByDepartmentUserIterator struct {
nextPageToken *string
items []*User
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/corehr/v1/api.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/corehr/v1/api.go
index 3df450a20f..3c5c92aaa4 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/corehr/v1/api.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/corehr/v1/api.go
@@ -14,6 +14,7 @@
package larkcorehr
import (
+ "bytes"
"context"
"net/http"
@@ -22,39 +23,2513 @@ import (
func NewService(config *larkcore.Config) *CorehrService {
c := &CorehrService{config: config}
+ c.AssignedUser = &assignedUser{service: c}
+ c.Company = &company{service: c}
+ c.Contract = &contract{service: c}
+ c.CountryRegion = &countryRegion{service: c}
+ c.Currency = ¤cy{service: c}
+ c.CustomField = &customField{service: c}
+ c.Department = &department{service: c}
+ c.EmployeeType = &employeeType{service: c}
+ c.Employment = &employment{service: c}
+ c.File = &file{service: c}
+ c.Job = &job{service: c}
+ c.JobChange = &jobChange{service: c}
+ c.JobData = &jobData{service: c}
+ c.JobFamily = &jobFamily{service: c}
+ c.JobLevel = &jobLevel{service: c}
c.Leave = &leave{service: c}
+ c.LeaveGrantingRecord = &leaveGrantingRecord{service: c}
+ c.Location = &location{service: c}
+ c.NationalIdType = &nationalIdType{service: c}
+ c.Offboarding = &offboarding{service: c}
+ c.OrgRoleAuthorization = &orgRoleAuthorization{service: c}
+ c.Person = &person{service: c}
+ c.PreHire = &preHire{service: c}
+ c.ProcessFormVariableData = &processFormVariableData{service: c}
+ c.SecurityGroup = &securityGroup{service: c}
+ c.Subdivision = &subdivision{service: c}
+ c.Subregion = &subregion{service: c}
+ c.TransferReason = &transferReason{service: c}
+ c.TransferType = &transferType{service: c}
+ c.WorkingHoursType = &workingHoursType{service: c}
return c
}
type CorehrService struct {
- config *larkcore.Config
- Leave *leave // 休假管理
+ config *larkcore.Config
+ AssignedUser *assignedUser // assigned_user
+ Company *company // 公司
+ Contract *contract // 合同
+ CountryRegion *countryRegion // 地理库信息
+ Currency *currency // 货币信息
+ CustomField *customField // 自定义字段
+ Department *department // 部门
+ EmployeeType *employeeType // 人员类型
+ Employment *employment // 雇佣信息
+ File *file // file
+ Job *job // 职务
+ JobChange *jobChange // 异动信息
+ JobData *jobData // 任职信息
+ JobFamily *jobFamily // 职务序列
+ JobLevel *jobLevel // 职务级别
+ Leave *leave // 休假管理
+ LeaveGrantingRecord *leaveGrantingRecord // leave_granting_record
+ Location *location // 地点
+ NationalIdType *nationalIdType // 国家证件类型
+ Offboarding *offboarding // 员工离职
+ OrgRoleAuthorization *orgRoleAuthorization // org_role_authorization
+ Person *person // 个人信息
+ PreHire *preHire // 待入职
+ ProcessFormVariableData *processFormVariableData // 流程管理
+ SecurityGroup *securityGroup // security_group
+ Subdivision *subdivision // 地理库信息
+ Subregion *subregion // 地理库信息
+ TransferReason *transferReason // 异动原因
+ TransferType *transferType // 异动类型
+ WorkingHoursType *workingHoursType // 工时制度
}
+type assignedUser struct {
+ service *CorehrService
+}
+type company struct {
+ service *CorehrService
+}
+type contract struct {
+ service *CorehrService
+}
+type countryRegion struct {
+ service *CorehrService
+}
+type currency struct {
+ service *CorehrService
+}
+type customField struct {
+ service *CorehrService
+}
+type department struct {
+ service *CorehrService
+}
+type employeeType struct {
+ service *CorehrService
+}
+type employment struct {
+ service *CorehrService
+}
+type file struct {
+ service *CorehrService
+}
+type job struct {
+ service *CorehrService
+}
+type jobChange struct {
+ service *CorehrService
+}
+type jobData struct {
+ service *CorehrService
+}
+type jobFamily struct {
+ service *CorehrService
+}
+type jobLevel struct {
+ service *CorehrService
+}
type leave struct {
service *CorehrService
}
+type leaveGrantingRecord struct {
+ service *CorehrService
+}
+type location struct {
+ service *CorehrService
+}
+type nationalIdType struct {
+ service *CorehrService
+}
+type offboarding struct {
+ service *CorehrService
+}
+type orgRoleAuthorization struct {
+ service *CorehrService
+}
+type person struct {
+ service *CorehrService
+}
+type preHire struct {
+ service *CorehrService
+}
+type processFormVariableData struct {
+ service *CorehrService
+}
+type securityGroup struct {
+ service *CorehrService
+}
+type subdivision struct {
+ service *CorehrService
+}
+type subregion struct {
+ service *CorehrService
+}
+type transferReason struct {
+ service *CorehrService
+}
+type transferType struct {
+ service *CorehrService
+}
+type workingHoursType struct {
+ service *CorehrService
+}
-// 批量查询员工请假记录
+// 获取组织类角色授权列表
//
-// - 批量获取员工的请假记录数据
+// - 查询组织类角色的授权信息
//
-// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/leave/leave_request_history
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/assigned_user/search
//
-// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/leaveRequestHistory_leave.go
-func (l *leave) LeaveRequestHistory(ctx context.Context, req *LeaveRequestHistoryLeaveReq, options ...larkcore.RequestOptionFunc) (*LeaveRequestHistoryLeaveResp, error) {
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/search_assignedUser.go
+func (a *assignedUser) Search(ctx context.Context, req *SearchAssignedUserReq, options ...larkcore.RequestOptionFunc) (*SearchAssignedUserResp, error) {
// 发起请求
apiReq := req.apiReq
- apiReq.ApiPath = "/open-apis/corehr/v1/leaves/leave_request_history"
+ apiReq.ApiPath = "/open-apis/corehr/v1/assigned_users/search"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, a.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &SearchAssignedUserResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, a.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 创建公司
+//
+// - 创建公司
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/company/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/create_company.go
+func (c *company) Create(ctx context.Context, req *CreateCompanyReq, options ...larkcore.RequestOptionFunc) (*CreateCompanyResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/companies"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateCompanyResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, c.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 删除公司
+//
+// - 删除公司
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/company/delete
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/delete_company.go
+func (c *company) Delete(ctx context.Context, req *DeleteCompanyReq, options ...larkcore.RequestOptionFunc) (*DeleteCompanyResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/companies/:company_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeleteCompanyResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, c.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 查询单个公司
+//
+// - 根据 ID 查询单个公司
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/company/get
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/get_company.go
+func (c *company) Get(ctx context.Context, req *GetCompanyReq, options ...larkcore.RequestOptionFunc) (*GetCompanyResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/companies/:company_id"
apiReq.HttpMethod = http.MethodGet
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
- apiResp, err := larkcore.Request(ctx, apiReq, l.service.config, options...)
+ apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
- resp := &LeaveRequestHistoryLeaveResp{ApiResp: apiResp}
- err = apiResp.JSONUnmarshalBody(resp, l.service.config)
+ resp := &GetCompanyResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, c.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 批量查询公司
+//
+// - 批量查询公司
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/company/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/list_company.go
+func (c *company) List(ctx context.Context, req *ListCompanyReq, options ...larkcore.RequestOptionFunc) (*ListCompanyResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/companies"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListCompanyResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, c.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 创建合同
+//
+// - 创建合同
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/contract/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/create_contract.go
+func (c *contract) Create(ctx context.Context, req *CreateContractReq, options ...larkcore.RequestOptionFunc) (*CreateContractResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/contracts"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateContractResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, c.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 删除合同
+//
+// - 删除合同
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/contract/delete
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/delete_contract.go
+func (c *contract) Delete(ctx context.Context, req *DeleteContractReq, options ...larkcore.RequestOptionFunc) (*DeleteContractResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/contracts/:contract_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeleteContractResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, c.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 查询单个合同
+//
+// - 根据 ID 查询单个合同
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/contract/get
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/get_contract.go
+func (c *contract) Get(ctx context.Context, req *GetContractReq, options ...larkcore.RequestOptionFunc) (*GetContractResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/contracts/:contract_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetContractResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, c.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 批量查询合同
+//
+// - 批量查询合同
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/contract/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/list_contract.go
+func (c *contract) List(ctx context.Context, req *ListContractReq, options ...larkcore.RequestOptionFunc) (*ListContractResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/contracts"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListContractResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, c.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 更新合同
+//
+// - 更新合同
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/contract/patch
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/patch_contract.go
+func (c *contract) Patch(ctx context.Context, req *PatchContractReq, options ...larkcore.RequestOptionFunc) (*PatchContractResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/contracts/:contract_id"
+ apiReq.HttpMethod = http.MethodPatch
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &PatchContractResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, c.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 查询单条国家/地区信息
+//
+// - 查询单条国家/地区信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/country_region/get
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/get_countryRegion.go
+func (c *countryRegion) Get(ctx context.Context, req *GetCountryRegionReq, options ...larkcore.RequestOptionFunc) (*GetCountryRegionResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/country_regions/:country_region_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetCountryRegionResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, c.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 批量查询国家/地区信息
+//
+// - 批量查询国家/地区信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/country_region/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/list_countryRegion.go
+func (c *countryRegion) List(ctx context.Context, req *ListCountryRegionReq, options ...larkcore.RequestOptionFunc) (*ListCountryRegionResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/country_regions"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListCountryRegionResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, c.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 查询单个货币信息
+//
+// - 查询单个货币信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/currency/get
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/get_currency.go
+func (c *currency) Get(ctx context.Context, req *GetCurrencyReq, options ...larkcore.RequestOptionFunc) (*GetCurrencyResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/currencies/:currency_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetCurrencyResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, c.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 批量查询货币信息
+//
+// - 批量查询货币信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/currency/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/list_currency.go
+func (c *currency) List(ctx context.Context, req *ListCurrencyReq, options ...larkcore.RequestOptionFunc) (*ListCurrencyResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/currencies"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListCurrencyResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, c.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 获取自定义字段详情
+//
+// - 获取「飞书人事」具体对象下某自定义字段的详细信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/custom_field/get_by_param
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/getByParam_customField.go
+func (c *customField) GetByParam(ctx context.Context, req *GetByParamCustomFieldReq, options ...larkcore.RequestOptionFunc) (*GetByParamCustomFieldResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/custom_fields/get_by_param"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetByParamCustomFieldResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, c.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 获取飞书人事对象列表
+//
+// - 获取「飞书人事」中的对象列表,含系统预置对象与自定义对象
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/custom_field/list_object_api_name
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/listObjectApiName_customField.go
+func (c *customField) ListObjectApiName(ctx context.Context, req *ListObjectApiNameCustomFieldReq, options ...larkcore.RequestOptionFunc) (*ListObjectApiNameCustomFieldResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/custom_fields/list_object_api_name"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListObjectApiNameCustomFieldResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, c.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 获取自定义字段列表
+//
+// - 获取「飞书人事」具体对象下的自定义字段列表
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/custom_field/query
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/query_customField.go
+func (c *customField) Query(ctx context.Context, req *QueryCustomFieldReq, options ...larkcore.RequestOptionFunc) (*QueryCustomFieldResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/custom_fields/query"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &QueryCustomFieldResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, c.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 创建部门
+//
+// - 创建部门
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/department/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/create_department.go
+func (d *department) Create(ctx context.Context, req *CreateDepartmentReq, options ...larkcore.RequestOptionFunc) (*CreateDepartmentResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/departments"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, d.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateDepartmentResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, d.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 删除部门
+//
+// - 删除部门
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/department/delete
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/delete_department.go
+func (d *department) Delete(ctx context.Context, req *DeleteDepartmentReq, options ...larkcore.RequestOptionFunc) (*DeleteDepartmentResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/departments/:department_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, d.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeleteDepartmentResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, d.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 查询单个部门
+//
+// - 根据 ID 查询单个部门
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/department/get
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/get_department.go
+func (d *department) Get(ctx context.Context, req *GetDepartmentReq, options ...larkcore.RequestOptionFunc) (*GetDepartmentResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/departments/:department_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, d.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetDepartmentResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, d.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 批量查询部门
+//
+// - 批量查询部门
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/department/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/list_department.go
+func (d *department) List(ctx context.Context, req *ListDepartmentReq, options ...larkcore.RequestOptionFunc) (*ListDepartmentResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/departments"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, d.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListDepartmentResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, d.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 更新部门
+//
+// - 更新部门
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/department/patch
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/patch_department.go
+func (d *department) Patch(ctx context.Context, req *PatchDepartmentReq, options ...larkcore.RequestOptionFunc) (*PatchDepartmentResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/departments/:department_id"
+ apiReq.HttpMethod = http.MethodPatch
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, d.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &PatchDepartmentResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, d.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 创建人员类型
+//
+// - 创建人员类型
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/employee_type/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/create_employeeType.go
+func (e *employeeType) Create(ctx context.Context, req *CreateEmployeeTypeReq, options ...larkcore.RequestOptionFunc) (*CreateEmployeeTypeResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/employee_types"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateEmployeeTypeResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, e.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 删除人员类型
+//
+// - 删除人员类型
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/employee_type/delete
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/delete_employeeType.go
+func (e *employeeType) Delete(ctx context.Context, req *DeleteEmployeeTypeReq, options ...larkcore.RequestOptionFunc) (*DeleteEmployeeTypeResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/employee_types/:employee_type_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeleteEmployeeTypeResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, e.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 查询单个人员类型
+//
+// - 根据 ID 查询单个人员类型
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/employee_type/get
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/get_employeeType.go
+func (e *employeeType) Get(ctx context.Context, req *GetEmployeeTypeReq, options ...larkcore.RequestOptionFunc) (*GetEmployeeTypeResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/employee_types/:employee_type_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetEmployeeTypeResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, e.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 批量查询人员类型
+//
+// - 批量查询人员类型
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/employee_type/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/list_employeeType.go
+func (e *employeeType) List(ctx context.Context, req *ListEmployeeTypeReq, options ...larkcore.RequestOptionFunc) (*ListEmployeeTypeResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/employee_types"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListEmployeeTypeResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, e.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 更新人员类型数据
+//
+// - 更新人员类型数据
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/employee_type/patch
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/patch_employeeType.go
+func (e *employeeType) Patch(ctx context.Context, req *PatchEmployeeTypeReq, options ...larkcore.RequestOptionFunc) (*PatchEmployeeTypeResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/employee_types/:employee_type_id"
+ apiReq.HttpMethod = http.MethodPatch
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &PatchEmployeeTypeResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, e.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 创建雇佣信息
+//
+// - 创建人员的雇佣信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/employment/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/create_employment.go
+func (e *employment) Create(ctx context.Context, req *CreateEmploymentReq, options ...larkcore.RequestOptionFunc) (*CreateEmploymentResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/employments"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateEmploymentResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, e.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 删除雇佣信息
+//
+// - 删除人员的雇佣信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/employment/delete
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/delete_employment.go
+func (e *employment) Delete(ctx context.Context, req *DeleteEmploymentReq, options ...larkcore.RequestOptionFunc) (*DeleteEmploymentResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/employments/:employment_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeleteEmploymentResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, e.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 更新雇佣信息
+//
+// - 更新雇佣信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/employment/patch
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/patch_employment.go
+func (e *employment) Patch(ctx context.Context, req *PatchEmploymentReq, options ...larkcore.RequestOptionFunc) (*PatchEmploymentResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/employments/:employment_id"
+ apiReq.HttpMethod = http.MethodPatch
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &PatchEmploymentResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, e.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=get&project=corehr&resource=file&version=v1
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/get_file.go
+func (f *file) Get(ctx context.Context, req *GetFileReq, options ...larkcore.RequestOptionFunc) (*GetFileResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/files/:id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, f.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetFileResp{ApiResp: apiResp}
+ // 如果是下载,则设置响应结果
+ if apiResp.StatusCode == http.StatusOK {
+ resp.File = bytes.NewBuffer(apiResp.RawBody)
+ resp.FileName = larkcore.FileNameByHeader(apiResp.Header)
+ return resp, err
+ }
+ err = apiResp.JSONUnmarshalBody(resp, f.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 创建职务
+//
+// - 创建职务
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/create_job.go
+func (j *job) Create(ctx context.Context, req *CreateJobReq, options ...larkcore.RequestOptionFunc) (*CreateJobResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/jobs"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateJobResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 删除职务
+//
+// - 删除职务
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job/delete
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/delete_job.go
+func (j *job) Delete(ctx context.Context, req *DeleteJobReq, options ...larkcore.RequestOptionFunc) (*DeleteJobResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/jobs/:job_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeleteJobResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 查询单个职务
+//
+// - 根据 ID 查询单个职务
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job/get
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/get_job.go
+func (j *job) Get(ctx context.Context, req *GetJobReq, options ...larkcore.RequestOptionFunc) (*GetJobResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/jobs/:job_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetJobResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 批量查询职务
+//
+// - 批量查询职务
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/list_job.go
+func (j *job) List(ctx context.Context, req *ListJobReq, options ...larkcore.RequestOptionFunc) (*ListJobResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/jobs"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListJobResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 更新职务
+//
+// - 更新职务
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job/patch
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/patch_job.go
+func (j *job) Patch(ctx context.Context, req *PatchJobReq, options ...larkcore.RequestOptionFunc) (*PatchJobResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/jobs/:job_id"
+ apiReq.HttpMethod = http.MethodPatch
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &PatchJobResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 发起员工异动
+//
+// - 创建员工异动信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_change/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/create_jobChange.go
+func (j *jobChange) Create(ctx context.Context, req *CreateJobChangeReq, options ...larkcore.RequestOptionFunc) (*CreateJobChangeResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/job_changes"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateJobChangeResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 创建任职信息
+//
+// - 在系统中第一次创建员工任职数据,通常在员工入职或者做数据批量导入的时候使用,【任职原因】只支持填写“入职”
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_data/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/create_jobData.go
+func (j *jobData) Create(ctx context.Context, req *CreateJobDataReq, options ...larkcore.RequestOptionFunc) (*CreateJobDataResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/job_datas"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateJobDataResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 删除任职信息
+//
+// - 删除人员的任职信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_data/delete
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/delete_jobData.go
+func (j *jobData) Delete(ctx context.Context, req *DeleteJobDataReq, options ...larkcore.RequestOptionFunc) (*DeleteJobDataResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/job_datas/:job_data_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeleteJobDataResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 查询单个任职信息
+//
+// - 根据 ID 查询单任职信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_data/get
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/get_jobData.go
+func (j *jobData) Get(ctx context.Context, req *GetJobDataReq, options ...larkcore.RequestOptionFunc) (*GetJobDataResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/job_datas/:job_data_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetJobDataResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 批量查询任职信息
+//
+// - 批量查询人员的任职信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_data/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/list_jobData.go
+func (j *jobData) List(ctx context.Context, req *ListJobDataReq, options ...larkcore.RequestOptionFunc) (*ListJobDataResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/job_datas"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListJobDataResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 更新任职信息
+//
+// - 更新任职信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_data/patch
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/patch_jobData.go
+func (j *jobData) Patch(ctx context.Context, req *PatchJobDataReq, options ...larkcore.RequestOptionFunc) (*PatchJobDataResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/job_datas/:job_data_id"
+ apiReq.HttpMethod = http.MethodPatch
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &PatchJobDataResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 创建职务序列
+//
+// - 创建职务序列
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_family/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/create_jobFamily.go
+func (j *jobFamily) Create(ctx context.Context, req *CreateJobFamilyReq, options ...larkcore.RequestOptionFunc) (*CreateJobFamilyResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/job_families"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateJobFamilyResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 删除职务序列
+//
+// - 删除职务序列
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_family/delete
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/delete_jobFamily.go
+func (j *jobFamily) Delete(ctx context.Context, req *DeleteJobFamilyReq, options ...larkcore.RequestOptionFunc) (*DeleteJobFamilyResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/job_families/:job_family_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeleteJobFamilyResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 查询单个职务序列
+//
+// - 根据 ID 查询单个职务序列
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_family/get
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/get_jobFamily.go
+func (j *jobFamily) Get(ctx context.Context, req *GetJobFamilyReq, options ...larkcore.RequestOptionFunc) (*GetJobFamilyResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/job_families/:job_family_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetJobFamilyResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 批量查询职务序列
+//
+// - 批量查询职务序列
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_family/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/list_jobFamily.go
+func (j *jobFamily) List(ctx context.Context, req *ListJobFamilyReq, options ...larkcore.RequestOptionFunc) (*ListJobFamilyResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/job_families"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListJobFamilyResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 更新职务序列
+//
+// - 更新职务序列
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_family/patch
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/patch_jobFamily.go
+func (j *jobFamily) Patch(ctx context.Context, req *PatchJobFamilyReq, options ...larkcore.RequestOptionFunc) (*PatchJobFamilyResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/job_families/:job_family_id"
+ apiReq.HttpMethod = http.MethodPatch
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &PatchJobFamilyResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 创建职务级别
+//
+// - 创建职务级别
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_level/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/create_jobLevel.go
+func (j *jobLevel) Create(ctx context.Context, req *CreateJobLevelReq, options ...larkcore.RequestOptionFunc) (*CreateJobLevelResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/job_levels"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateJobLevelResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 删除职务级别
+//
+// - 删除职务级别
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_level/delete
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/delete_jobLevel.go
+func (j *jobLevel) Delete(ctx context.Context, req *DeleteJobLevelReq, options ...larkcore.RequestOptionFunc) (*DeleteJobLevelResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/job_levels/:job_level_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeleteJobLevelResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 查询单个职务级别
+//
+// - 根据 ID 查询单个职务级别
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_level/get
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/get_jobLevel.go
+func (j *jobLevel) Get(ctx context.Context, req *GetJobLevelReq, options ...larkcore.RequestOptionFunc) (*GetJobLevelResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/job_levels/:job_level_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetJobLevelResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 批量查询职务级别
+//
+// - 批量查询职务级别
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_level/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/list_jobLevel.go
+func (j *jobLevel) List(ctx context.Context, req *ListJobLevelReq, options ...larkcore.RequestOptionFunc) (*ListJobLevelResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/job_levels"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListJobLevelResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 更新职务级别
+//
+// - 更新职务级别
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_level/patch
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/patch_jobLevel.go
+func (j *jobLevel) Patch(ctx context.Context, req *PatchJobLevelReq, options ...larkcore.RequestOptionFunc) (*PatchJobLevelResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/job_levels/:job_level_id"
+ apiReq.HttpMethod = http.MethodPatch
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &PatchJobLevelResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 批量查询员工假期余额
+//
+// - 批量获取员工各个假期的余额数据
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/leave/leave_balances
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/leaveBalances_leave.go
+func (l *leave) LeaveBalances(ctx context.Context, req *LeaveBalancesLeaveReq, options ...larkcore.RequestOptionFunc) (*LeaveBalancesLeaveResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/leaves/leave_balances"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, l.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &LeaveBalancesLeaveResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, l.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 批量查询员工请假记录
+//
+// - 批量获取员工的请假记录数据
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/leave/leave_request_history
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/leaveRequestHistory_leave.go
+func (l *leave) LeaveRequestHistory(ctx context.Context, req *LeaveRequestHistoryLeaveReq, options ...larkcore.RequestOptionFunc) (*LeaveRequestHistoryLeaveResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/leaves/leave_request_history"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, l.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &LeaveRequestHistoryLeaveResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, l.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 获取假期类型列表
+//
+// - 获取休假设置后台配置的假期类型列表(比如年假、事假、婚假等)
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/leave/leave_types
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/leaveTypes_leave.go
+func (l *leave) LeaveTypes(ctx context.Context, req *LeaveTypesLeaveReq, options ...larkcore.RequestOptionFunc) (*LeaveTypesLeaveResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/leaves/leave_types"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, l.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &LeaveTypesLeaveResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, l.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 创建假期授予记录
+//
+// - 向飞书人事休假系统写入假期授予记录
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/leave_granting_record/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/create_leaveGrantingRecord.go
+func (l *leaveGrantingRecord) Create(ctx context.Context, req *CreateLeaveGrantingRecordReq, options ...larkcore.RequestOptionFunc) (*CreateLeaveGrantingRecordResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/leave_granting_records"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, l.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateLeaveGrantingRecordResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, l.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 删除假期授予记录
+//
+// - 删除飞书人事休假系统中的假期授予记录(仅支持删除授予来源是「手动授予」或「外部系统授予」的记录)
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/leave_granting_record/delete
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/delete_leaveGrantingRecord.go
+func (l *leaveGrantingRecord) Delete(ctx context.Context, req *DeleteLeaveGrantingRecordReq, options ...larkcore.RequestOptionFunc) (*DeleteLeaveGrantingRecordResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/leave_granting_records/:leave_granting_record_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, l.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeleteLeaveGrantingRecordResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, l.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 创建地点
+//
+// - 创建地点
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/location/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/create_location.go
+func (l *location) Create(ctx context.Context, req *CreateLocationReq, options ...larkcore.RequestOptionFunc) (*CreateLocationResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/locations"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, l.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateLocationResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, l.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 删除地点
+//
+// - 删除地点
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/location/delete
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/delete_location.go
+func (l *location) Delete(ctx context.Context, req *DeleteLocationReq, options ...larkcore.RequestOptionFunc) (*DeleteLocationResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/locations/:location_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, l.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeleteLocationResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, l.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 查询单个地点
+//
+// - 根据 ID 查询单个地点
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/location/get
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/get_location.go
+func (l *location) Get(ctx context.Context, req *GetLocationReq, options ...larkcore.RequestOptionFunc) (*GetLocationResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/locations/:location_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, l.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetLocationResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, l.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 批量查询地点
+//
+// - 批量查询地点
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/location/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/list_location.go
+func (l *location) List(ctx context.Context, req *ListLocationReq, options ...larkcore.RequestOptionFunc) (*ListLocationResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/locations"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, l.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListLocationResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, l.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 创建国家证件类型
+//
+// - 创建国家证件类型
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/national_id_type/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/create_nationalIdType.go
+func (n *nationalIdType) Create(ctx context.Context, req *CreateNationalIdTypeReq, options ...larkcore.RequestOptionFunc) (*CreateNationalIdTypeResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/national_id_types"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, n.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateNationalIdTypeResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, n.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 删除国家证件类型
+//
+// - 删除国家证件类型
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/national_id_type/delete
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/delete_nationalIdType.go
+func (n *nationalIdType) Delete(ctx context.Context, req *DeleteNationalIdTypeReq, options ...larkcore.RequestOptionFunc) (*DeleteNationalIdTypeResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/national_id_types/:national_id_type_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, n.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeleteNationalIdTypeResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, n.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 查询单个国家证件类型
+//
+// - 根据 ID 查询单个国家证件类型
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/national_id_type/get
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/get_nationalIdType.go
+func (n *nationalIdType) Get(ctx context.Context, req *GetNationalIdTypeReq, options ...larkcore.RequestOptionFunc) (*GetNationalIdTypeResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/national_id_types/:national_id_type_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, n.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetNationalIdTypeResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, n.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 批量查询国家证件类型
+//
+// - 批量查询国家证件类型
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/national_id_type/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/list_nationalIdType.go
+func (n *nationalIdType) List(ctx context.Context, req *ListNationalIdTypeReq, options ...larkcore.RequestOptionFunc) (*ListNationalIdTypeResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/national_id_types"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, n.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListNationalIdTypeResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, n.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 更新国家证件类型
+//
+// - 更新国家证件类型
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/national_id_type/patch
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/patch_nationalIdType.go
+func (n *nationalIdType) Patch(ctx context.Context, req *PatchNationalIdTypeReq, options ...larkcore.RequestOptionFunc) (*PatchNationalIdTypeResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/national_id_types/:national_id_type_id"
+ apiReq.HttpMethod = http.MethodPatch
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, n.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &PatchNationalIdTypeResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, n.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 查询员工离职原因列表
+//
+// - 查询「飞书人事」-「离职设置」中的离职原因
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/offboarding/query
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/query_offboarding.go
+func (o *offboarding) Query(ctx context.Context, req *QueryOffboardingReq, options ...larkcore.RequestOptionFunc) (*QueryOffboardingResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/offboardings/query"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, o.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &QueryOffboardingResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, o.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// - 根据 雇佣 ID 查询员工离职信息
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=search&project=corehr&resource=offboarding&version=v1
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/search_offboarding.go
+func (o *offboarding) Search(ctx context.Context, req *SearchOffboardingReq, options ...larkcore.RequestOptionFunc) (*SearchOffboardingResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/offboardings/search"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, o.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &SearchOffboardingResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, o.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+func (o *offboarding) SearchByIterator(ctx context.Context, req *SearchOffboardingReq, options ...larkcore.RequestOptionFunc) (*SearchOffboardingIterator, error) {
+ return &SearchOffboardingIterator{
+ ctx: ctx,
+ req: req,
+ listFunc: o.Search,
+ options: options,
+ limit: req.Limit}, nil
+}
+
+// 操作员工离职
+//
+// - 操作员工直接离职
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/offboarding/submit
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/submit_offboarding.go
+func (o *offboarding) Submit(ctx context.Context, req *SubmitOffboardingReq, options ...larkcore.RequestOptionFunc) (*SubmitOffboardingResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/offboardings/submit"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, o.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &SubmitOffboardingResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, o.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 删除个人信息
+//
+// - 删除人员的个人信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/person/delete
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/delete_person.go
+func (p *person) Delete(ctx context.Context, req *DeletePersonReq, options ...larkcore.RequestOptionFunc) (*DeletePersonResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/persons/:person_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, p.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeletePersonResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, p.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 查询单个个人信息
+//
+// - 根据 ID 查询单个人员的个人信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/person/get
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/get_person.go
+func (p *person) Get(ctx context.Context, req *GetPersonReq, options ...larkcore.RequestOptionFunc) (*GetPersonResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/persons/:person_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, p.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetPersonResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, p.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 上传文件
+//
+// - 上传文件
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/person/upload
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/upload_person.go
+func (p *person) Upload(ctx context.Context, req *UploadPersonReq, options ...larkcore.RequestOptionFunc) (*UploadPersonResp, error) {
+ options = append(options, larkcore.WithFileUpload())
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/persons/upload"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, p.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &UploadPersonResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, p.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 删除待入职人员
+//
+// - 删除待入职人员
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/pre_hire/delete
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/delete_preHire.go
+func (p *preHire) Delete(ctx context.Context, req *DeletePreHireReq, options ...larkcore.RequestOptionFunc) (*DeletePreHireResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/pre_hires/:pre_hire_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, p.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeletePreHireResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, p.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 查询单个待入职人员
+//
+// - 根据 ID 查询单个待入职人员
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/pre_hire/get
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/get_preHire.go
+func (p *preHire) Get(ctx context.Context, req *GetPreHireReq, options ...larkcore.RequestOptionFunc) (*GetPreHireResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/pre_hires/:pre_hire_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, p.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetPreHireResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, p.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 批量查询待入职人员
+//
+// - 批量查询待入职人员
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/pre_hire/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/list_preHire.go
+func (p *preHire) List(ctx context.Context, req *ListPreHireReq, options ...larkcore.RequestOptionFunc) (*ListPreHireResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/pre_hires"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, p.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListPreHireResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, p.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 更新待入职数据
+//
+// - 更新待入职数据
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/pre_hire/patch
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/patch_preHire.go
+func (p *preHire) Patch(ctx context.Context, req *PatchPreHireReq, options ...larkcore.RequestOptionFunc) (*PatchPreHireResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/pre_hires/:pre_hire_id"
+ apiReq.HttpMethod = http.MethodPatch
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, p.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &PatchPreHireResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, p.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 获取流程表单数据
+//
+// - 获取流程表单数据
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/process-form_variable_data/get
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/get_processFormVariableData.go
+func (p *processFormVariableData) Get(ctx context.Context, req *GetProcessFormVariableDataReq, options ...larkcore.RequestOptionFunc) (*GetProcessFormVariableDataResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/processes/:process_id/form_variable_data"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, p.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetProcessFormVariableDataResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, p.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 批量获取角色列表
+//
+// - 批量查询「飞书人事」-「权限设置」-「角色设置」中的角色列表
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/security_group/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/list_securityGroup.go
+func (s *securityGroup) List(ctx context.Context, req *ListSecurityGroupReq, options ...larkcore.RequestOptionFunc) (*ListSecurityGroupResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/security_groups"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, s.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListSecurityGroupResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, s.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// HRBP/属地 BP 查询
+//
+// - 通过部门或工作地点,查询对应的 HRBP/属地 BP
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/security_group/query
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/query_securityGroup.go
+func (s *securityGroup) Query(ctx context.Context, req *QuerySecurityGroupReq, options ...larkcore.RequestOptionFunc) (*QuerySecurityGroupResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/security_groups/query"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, s.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &QuerySecurityGroupResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, s.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 查询单条省份/行政区信息
+//
+// - 查询单条省份/行政区信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/subdivision/get
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/get_subdivision.go
+func (s *subdivision) Get(ctx context.Context, req *GetSubdivisionReq, options ...larkcore.RequestOptionFunc) (*GetSubdivisionResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/subdivisions/:subdivision_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, s.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetSubdivisionResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, s.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 批量查询省份/行政区信息
+//
+// - 批量查询省份/行政区信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/subdivision/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/list_subdivision.go
+func (s *subdivision) List(ctx context.Context, req *ListSubdivisionReq, options ...larkcore.RequestOptionFunc) (*ListSubdivisionResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/subdivisions"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, s.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListSubdivisionResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, s.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 查询单条城市/区域信息
+//
+// - 查询单条城市/区域信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/subregion/get
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/get_subregion.go
+func (s *subregion) Get(ctx context.Context, req *GetSubregionReq, options ...larkcore.RequestOptionFunc) (*GetSubregionResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/subregions/:subregion_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, s.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetSubregionResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, s.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 批量查询城市/区域信息
+//
+// - 批量查询城市/区域信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/subregion/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/list_subregion.go
+func (s *subregion) List(ctx context.Context, req *ListSubregionReq, options ...larkcore.RequestOptionFunc) (*ListSubregionResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/subregions"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, s.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListSubregionResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, s.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 获取异动原因列表
+//
+// - 获取异动原因列表
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/transfer_reason/query
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/query_transferReason.go
+func (t *transferReason) Query(ctx context.Context, req *QueryTransferReasonReq, options ...larkcore.RequestOptionFunc) (*QueryTransferReasonResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/transfer_reasons/query"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, t.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &QueryTransferReasonResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, t.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 获取异动类型列表
+//
+// - 获取异动类型列表
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/transfer_type/query
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/query_transferType.go
+func (t *transferType) Query(ctx context.Context, req *QueryTransferTypeReq, options ...larkcore.RequestOptionFunc) (*QueryTransferTypeResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/transfer_types/query"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, t.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &QueryTransferTypeResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, t.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 创建工时制度
+//
+// - 创建工时制度
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/working_hours_type/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/create_workingHoursType.go
+func (w *workingHoursType) Create(ctx context.Context, req *CreateWorkingHoursTypeReq, options ...larkcore.RequestOptionFunc) (*CreateWorkingHoursTypeResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/working_hours_types"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, w.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateWorkingHoursTypeResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, w.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 删除工时制度
+//
+// - 删除工时制度
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/working_hours_type/delete
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/delete_workingHoursType.go
+func (w *workingHoursType) Delete(ctx context.Context, req *DeleteWorkingHoursTypeReq, options ...larkcore.RequestOptionFunc) (*DeleteWorkingHoursTypeResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/working_hours_types/:working_hours_type_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, w.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeleteWorkingHoursTypeResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, w.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 查询单个工时制度
+//
+// - 根据 ID 查询单个工时制度
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/working_hours_type/get
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/get_workingHoursType.go
+func (w *workingHoursType) Get(ctx context.Context, req *GetWorkingHoursTypeReq, options ...larkcore.RequestOptionFunc) (*GetWorkingHoursTypeResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/working_hours_types/:working_hours_type_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, w.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetWorkingHoursTypeResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, w.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 批量查询工时制度
+//
+// - 批量查询工时制度
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/working_hours_type/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/list_workingHoursType.go
+func (w *workingHoursType) List(ctx context.Context, req *ListWorkingHoursTypeReq, options ...larkcore.RequestOptionFunc) (*ListWorkingHoursTypeResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/working_hours_types"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, w.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListWorkingHoursTypeResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, w.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 更新工时制度
+//
+// - 更新工时制度
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/working_hours_type/patch
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/corehrv1/patch_workingHoursType.go
+func (w *workingHoursType) Patch(ctx context.Context, req *PatchWorkingHoursTypeReq, options ...larkcore.RequestOptionFunc) (*PatchWorkingHoursTypeResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/corehr/v1/working_hours_types/:working_hours_type_id"
+ apiReq.HttpMethod = http.MethodPatch
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, w.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &PatchWorkingHoursTypeResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, w.service.config)
if err != nil {
return nil, err
}
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/corehr/v1/event.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/corehr/v1/event.go
new file mode 100644
index 0000000000..e8e9708cb2
--- /dev/null
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/corehr/v1/event.go
@@ -0,0 +1,358 @@
+// Package corehr code generated by oapi sdk gen
+/*
+ * MIT License
+ *
+ * Copyright (c) 2022 Lark Technologies Pte. Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package larkcorehr
+
+import (
+ "context"
+)
+
+// 消息处理器定义
+type P2ContractCreatedV1Handler struct {
+ handler func(context.Context, *P2ContractCreatedV1) error
+}
+
+func NewP2ContractCreatedV1Handler(handler func(context.Context, *P2ContractCreatedV1) error) *P2ContractCreatedV1Handler {
+ h := &P2ContractCreatedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2ContractCreatedV1Handler) Event() interface{} {
+ return &P2ContractCreatedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2ContractCreatedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2ContractCreatedV1))
+}
+
+// 消息处理器定义
+type P2DepartmentCreatedV1Handler struct {
+ handler func(context.Context, *P2DepartmentCreatedV1) error
+}
+
+func NewP2DepartmentCreatedV1Handler(handler func(context.Context, *P2DepartmentCreatedV1) error) *P2DepartmentCreatedV1Handler {
+ h := &P2DepartmentCreatedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2DepartmentCreatedV1Handler) Event() interface{} {
+ return &P2DepartmentCreatedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2DepartmentCreatedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2DepartmentCreatedV1))
+}
+
+// 消息处理器定义
+type P2DepartmentDeletedV1Handler struct {
+ handler func(context.Context, *P2DepartmentDeletedV1) error
+}
+
+func NewP2DepartmentDeletedV1Handler(handler func(context.Context, *P2DepartmentDeletedV1) error) *P2DepartmentDeletedV1Handler {
+ h := &P2DepartmentDeletedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2DepartmentDeletedV1Handler) Event() interface{} {
+ return &P2DepartmentDeletedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2DepartmentDeletedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2DepartmentDeletedV1))
+}
+
+// 消息处理器定义
+type P2DepartmentUpdatedV1Handler struct {
+ handler func(context.Context, *P2DepartmentUpdatedV1) error
+}
+
+func NewP2DepartmentUpdatedV1Handler(handler func(context.Context, *P2DepartmentUpdatedV1) error) *P2DepartmentUpdatedV1Handler {
+ h := &P2DepartmentUpdatedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2DepartmentUpdatedV1Handler) Event() interface{} {
+ return &P2DepartmentUpdatedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2DepartmentUpdatedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2DepartmentUpdatedV1))
+}
+
+// 消息处理器定义
+type P2EmploymentConvertedV1Handler struct {
+ handler func(context.Context, *P2EmploymentConvertedV1) error
+}
+
+func NewP2EmploymentConvertedV1Handler(handler func(context.Context, *P2EmploymentConvertedV1) error) *P2EmploymentConvertedV1Handler {
+ h := &P2EmploymentConvertedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2EmploymentConvertedV1Handler) Event() interface{} {
+ return &P2EmploymentConvertedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2EmploymentConvertedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2EmploymentConvertedV1))
+}
+
+// 消息处理器定义
+type P2EmploymentCreatedV1Handler struct {
+ handler func(context.Context, *P2EmploymentCreatedV1) error
+}
+
+func NewP2EmploymentCreatedV1Handler(handler func(context.Context, *P2EmploymentCreatedV1) error) *P2EmploymentCreatedV1Handler {
+ h := &P2EmploymentCreatedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2EmploymentCreatedV1Handler) Event() interface{} {
+ return &P2EmploymentCreatedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2EmploymentCreatedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2EmploymentCreatedV1))
+}
+
+// 消息处理器定义
+type P2EmploymentDeletedV1Handler struct {
+ handler func(context.Context, *P2EmploymentDeletedV1) error
+}
+
+func NewP2EmploymentDeletedV1Handler(handler func(context.Context, *P2EmploymentDeletedV1) error) *P2EmploymentDeletedV1Handler {
+ h := &P2EmploymentDeletedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2EmploymentDeletedV1Handler) Event() interface{} {
+ return &P2EmploymentDeletedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2EmploymentDeletedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2EmploymentDeletedV1))
+}
+
+// 消息处理器定义
+type P2EmploymentResignedV1Handler struct {
+ handler func(context.Context, *P2EmploymentResignedV1) error
+}
+
+func NewP2EmploymentResignedV1Handler(handler func(context.Context, *P2EmploymentResignedV1) error) *P2EmploymentResignedV1Handler {
+ h := &P2EmploymentResignedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2EmploymentResignedV1Handler) Event() interface{} {
+ return &P2EmploymentResignedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2EmploymentResignedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2EmploymentResignedV1))
+}
+
+// 消息处理器定义
+type P2EmploymentUpdatedV1Handler struct {
+ handler func(context.Context, *P2EmploymentUpdatedV1) error
+}
+
+func NewP2EmploymentUpdatedV1Handler(handler func(context.Context, *P2EmploymentUpdatedV1) error) *P2EmploymentUpdatedV1Handler {
+ h := &P2EmploymentUpdatedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2EmploymentUpdatedV1Handler) Event() interface{} {
+ return &P2EmploymentUpdatedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2EmploymentUpdatedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2EmploymentUpdatedV1))
+}
+
+// 消息处理器定义
+type P2JobChangeUpdatedV1Handler struct {
+ handler func(context.Context, *P2JobChangeUpdatedV1) error
+}
+
+func NewP2JobChangeUpdatedV1Handler(handler func(context.Context, *P2JobChangeUpdatedV1) error) *P2JobChangeUpdatedV1Handler {
+ h := &P2JobChangeUpdatedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2JobChangeUpdatedV1Handler) Event() interface{} {
+ return &P2JobChangeUpdatedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2JobChangeUpdatedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2JobChangeUpdatedV1))
+}
+
+// 消息处理器定义
+type P2JobDataChangedV1Handler struct {
+ handler func(context.Context, *P2JobDataChangedV1) error
+}
+
+func NewP2JobDataChangedV1Handler(handler func(context.Context, *P2JobDataChangedV1) error) *P2JobDataChangedV1Handler {
+ h := &P2JobDataChangedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2JobDataChangedV1Handler) Event() interface{} {
+ return &P2JobDataChangedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2JobDataChangedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2JobDataChangedV1))
+}
+
+// 消息处理器定义
+type P2JobDataEmployedV1Handler struct {
+ handler func(context.Context, *P2JobDataEmployedV1) error
+}
+
+func NewP2JobDataEmployedV1Handler(handler func(context.Context, *P2JobDataEmployedV1) error) *P2JobDataEmployedV1Handler {
+ h := &P2JobDataEmployedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2JobDataEmployedV1Handler) Event() interface{} {
+ return &P2JobDataEmployedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2JobDataEmployedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2JobDataEmployedV1))
+}
+
+// 消息处理器定义
+type P2OffboardingUpdatedV1Handler struct {
+ handler func(context.Context, *P2OffboardingUpdatedV1) error
+}
+
+func NewP2OffboardingUpdatedV1Handler(handler func(context.Context, *P2OffboardingUpdatedV1) error) *P2OffboardingUpdatedV1Handler {
+ h := &P2OffboardingUpdatedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2OffboardingUpdatedV1Handler) Event() interface{} {
+ return &P2OffboardingUpdatedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2OffboardingUpdatedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2OffboardingUpdatedV1))
+}
+
+// 消息处理器定义
+type P2OrgRoleAuthorizationUpdatedV1Handler struct {
+ handler func(context.Context, *P2OrgRoleAuthorizationUpdatedV1) error
+}
+
+func NewP2OrgRoleAuthorizationUpdatedV1Handler(handler func(context.Context, *P2OrgRoleAuthorizationUpdatedV1) error) *P2OrgRoleAuthorizationUpdatedV1Handler {
+ h := &P2OrgRoleAuthorizationUpdatedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2OrgRoleAuthorizationUpdatedV1Handler) Event() interface{} {
+ return &P2OrgRoleAuthorizationUpdatedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2OrgRoleAuthorizationUpdatedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2OrgRoleAuthorizationUpdatedV1))
+}
+
+// 消息处理器定义
+type P2PersonCreatedV1Handler struct {
+ handler func(context.Context, *P2PersonCreatedV1) error
+}
+
+func NewP2PersonCreatedV1Handler(handler func(context.Context, *P2PersonCreatedV1) error) *P2PersonCreatedV1Handler {
+ h := &P2PersonCreatedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2PersonCreatedV1Handler) Event() interface{} {
+ return &P2PersonCreatedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2PersonCreatedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2PersonCreatedV1))
+}
+
+// 消息处理器定义
+type P2PersonDeletedV1Handler struct {
+ handler func(context.Context, *P2PersonDeletedV1) error
+}
+
+func NewP2PersonDeletedV1Handler(handler func(context.Context, *P2PersonDeletedV1) error) *P2PersonDeletedV1Handler {
+ h := &P2PersonDeletedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2PersonDeletedV1Handler) Event() interface{} {
+ return &P2PersonDeletedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2PersonDeletedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2PersonDeletedV1))
+}
+
+// 消息处理器定义
+type P2PersonUpdatedV1Handler struct {
+ handler func(context.Context, *P2PersonUpdatedV1) error
+}
+
+func NewP2PersonUpdatedV1Handler(handler func(context.Context, *P2PersonUpdatedV1) error) *P2PersonUpdatedV1Handler {
+ h := &P2PersonUpdatedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2PersonUpdatedV1Handler) Event() interface{} {
+ return &P2PersonUpdatedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2PersonUpdatedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2PersonUpdatedV1))
+}
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/corehr/v1/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/corehr/v1/model.go
index 5875b827bc..5aa49e66a0 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/corehr/v1/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/corehr/v1/model.go
@@ -14,8 +14,19 @@
package larkcorehr
import (
+ "io"
+
+ "bytes"
+
+ "io/ioutil"
+
"fmt"
+ "context"
+ "errors"
+
+ "github.com/larksuite/oapi-sdk-go/v3/event"
+
"github.com/larksuite/oapi-sdk-go/v3/core"
)
@@ -26,6 +37,207 @@ const (
UserIdTypePeopleCorehrId = "people_corehr_id" // 以飞书人事的 ID 来识别用户
)
+const (
+ UserIdTypeCreateDepartmentUserId = "user_id" // 以 user_id 来识别用户
+ UserIdTypeCreateDepartmentUnionId = "union_id" // 以 union_id 来识别用户
+ UserIdTypeCreateDepartmentOpenId = "open_id" // 以 open_id 来识别用户
+ UserIdTypeCreateDepartmentPeopleCorehrId = "people_corehr_id" // 以飞书人事的 ID 来识别用户
+)
+
+const (
+ DepartmentIdTypeOpenDepartmentId = "open_department_id" // 以 open_department_id 来标识部门
+ DepartmentIdTypeDepartmentId = "department_id" // 以 department_id 来标识部门
+ DepartmentIdTypePeopleCorehrDepartmentId = "people_corehr_department_id" // 以 people_corehr_department_id 来标识部门
+)
+
+const (
+ UserIdTypeGetDepartmentUserId = "user_id" // 以 user_id 来识别用户
+ UserIdTypeGetDepartmentUnionId = "union_id" // 以 union_id 来识别用户
+ UserIdTypeGetDepartmentOpenId = "open_id" // 以 open_id 来识别用户
+ UserIdTypeGetDepartmentPeopleCorehrId = "people_corehr_id" // 以飞书人事的 ID 来识别用户
+)
+
+const (
+ DepartmentIdTypeGetDepartmentOpenDepartmentId = "open_department_id" // 以 open_department_id 来标识部门
+ DepartmentIdTypeGetDepartmentDepartmentId = "department_id" // 以 department_id 来标识部门
+ DepartmentIdTypeGetDepartmentPeopleCorehrDepartmentId = "people_corehr_department_id" // 以 people_corehr_department_id 来标识部门
+)
+
+const (
+ UserIdTypeListDepartmentUserId = "user_id" // 以 user_id 来识别用户
+ UserIdTypeListDepartmentUnionId = "union_id" // 以 union_id 来识别用户
+ UserIdTypeListDepartmentOpenId = "open_id" // 以 open_id 来识别用户
+ UserIdTypeListDepartmentPeopleCorehrId = "people_corehr_id" // 以飞书人事的 ID 来识别用户
+)
+
+const (
+ DepartmentIdTypeListDepartmentOpenDepartmentId = "open_department_id" // 以 open_department_id 来标识部门
+ DepartmentIdTypeListDepartmentDepartmentId = "department_id" // 以 department_id 来标识部门
+ DepartmentIdTypeListDepartmentPeopleCorehrDepartmentId = "people_corehr_department_id" // 以 people_corehr_department_id 来标识部门
+)
+
+const (
+ UserIdTypePatchDepartmentUserId = "user_id" // 以 user_id 来识别用户
+ UserIdTypePatchDepartmentUnionId = "union_id" // 以 union_id 来识别用户
+ UserIdTypePatchDepartmentOpenId = "open_id" // 以 open_id 来识别用户
+ UserIdTypePatchDepartmentPeopleCorehrId = "people_corehr_id" // 以飞书人事的 ID 来识别用户
+)
+
+const (
+ DepartmentIdTypePatchDepartmentOpenDepartmentId = "open_department_id" // 以 open_department_id 来标识部门
+ DepartmentIdTypePatchDepartmentDepartmentId = "department_id" // 以 department_id 来标识部门
+ DepartmentIdTypePatchDepartmentPeopleCorehrDepartmentId = "people_corehr_department_id" // 以 people_corehr_department_id 来标识部门
+)
+
+const (
+ UserIdTypeDeleteEmploymentUserId = "user_id" // 以 user_id 来识别用户
+ UserIdTypeDeleteEmploymentUnionId = "union_id" // 以 union_id 来识别用户
+ UserIdTypeDeleteEmploymentOpenId = "open_id" // 以 open_id 来识别用户
+ UserIdTypeDeleteEmploymentPeopleCorehrId = "people_corehr_id" // 以飞书人事的 ID 来识别用户
+)
+
+const (
+ UserIdTypePatchEmploymentUserId = "user_id" // 以 user_id 来识别用户
+ UserIdTypePatchEmploymentUnionId = "union_id" // 以 union_id 来识别用户
+ UserIdTypePatchEmploymentOpenId = "open_id" // 以 open_id 来识别用户
+ UserIdTypePatchEmploymentPeopleCorehrId = "people_corehr_id" // 以飞书人事的 ID 来识别用户
+)
+
+const (
+ DepartmentIdTypePatchEmploymentOpenDepartmentId = "open_department_id" // 以 open_department_id 来标识部门
+ DepartmentIdTypePatchEmploymentDepartmentId = "department_id" // 以 department_id 来标识部门
+ DepartmentIdTypePatchEmploymentPeopleCorehrDepartmentId = "people_corehr_department_id" // 以 people_corehr_department_id 来标识部门
+)
+
+const (
+ TransferMode1 = 1 // 直接异动
+ TransferMode2 = 2 // 发起异动
+
+)
+
+const (
+ UserIdTypeCreateJobChangeUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeCreateJobChangeUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeCreateJobChangeOpenId = "open_id" // 以open_id来识别用户
+ UserIdTypeCreateJobChangePeopleAdminId = "people_admin_id" // 以people_admin_id来识别用户
+ UserIdTypeCreateJobChangePeopleCorehrId = "people_corehr_id" // 以飞书人事的ID来识别用户
+)
+
+const (
+ DepartmentIdTypeCreateJobChangeOpenDepartmentId = "open_department_id" // 以 open_department_id 来标识部门
+ DepartmentIdTypeCreateJobChangeDepartmentId = "department_id" // 以 department_id 来标识部门
+ DepartmentIdTypeCreateJobChangePeopleCorehrDepartmentId = "people_corehr_department_id" // 以 people_corehr_department_id 来标识部门
+)
+
+const (
+ UserIdTypeCreateJobDataUserId = "user_id" // 以 user_id 来识别用户
+ UserIdTypeCreateJobDataUnionId = "union_id" // 以 union_id 来识别用户
+ UserIdTypeCreateJobDataOpenId = "open_id" // 以 open_id 来识别用户
+ UserIdTypeCreateJobDataPeopleCorehrId = "people_corehr_id" // 以飞书人事的 ID 来识别用户
+)
+
+const (
+ DepartmentIdTypeCreateJobDataOpenDepartmentId = "open_department_id" // 以 open_department_id 来标识部门
+ DepartmentIdTypeCreateJobDataDepartmentId = "department_id" // 以 department_id 来标识部门
+ DepartmentIdTypeCreateJobDataPeopleCorehrDepartmentId = "people_corehr_department_id" // 以 people_corehr_department_id 来标识部门
+)
+
+const (
+ UserIdTypeGetJobDataUserId = "user_id" // 以 user_id 来识别用户
+ UserIdTypeGetJobDataUnionId = "union_id" // 以 union_id 来识别用户
+ UserIdTypeGetJobDataOpenId = "open_id" // 以 open_id 来识别用户
+ UserIdTypeGetJobDataPeopleCorehrId = "people_corehr_id" // 以飞书人事的 ID 来识别用户
+)
+
+const (
+ DepartmentIdTypeGetJobDataOpenDepartmentId = "open_department_id" // 以 open_department_id 来标识部门
+ DepartmentIdTypeGetJobDataDepartmentId = "department_id" // 以 department_id 来标识部门
+ DepartmentIdTypeGetJobDataPeopleCorehrDepartmentId = "people_corehr_department_id" // 以 people_corehr_department_id 来标识部门
+)
+
+const (
+ UserIdTypeListJobDataUserId = "user_id" // 以 user_id 来识别用户
+ UserIdTypeListJobDataUnionId = "union_id" // 以 union_id 来识别用户
+ UserIdTypeListJobDataOpenId = "open_id" // 以 open_id 来识别用户
+ UserIdTypeListJobDataPeopleCorehrId = "people_corehr_id" // 以飞书人事的 ID 来识别用户
+)
+
+const (
+ DepartmentIdTypeListJobDataOpenDepartmentId = "open_department_id" // 以 open_department_id 来标识部门
+ DepartmentIdTypeListJobDataDepartmentId = "department_id" // 以 department_id 来标识部门
+ DepartmentIdTypeListJobDataPeopleCorehrDepartmentId = "people_corehr_department_id" // 以 people_corehr_department_id 来标识部门
+)
+
+const (
+ UserIdTypePatchJobDataUserId = "user_id" // 以 user_id 来识别用户
+ UserIdTypePatchJobDataUnionId = "union_id" // 以 union_id 来识别用户
+ UserIdTypePatchJobDataOpenId = "open_id" // 以 open_id 来识别用户
+ UserIdTypePatchJobDataPeopleCorehrId = "people_corehr_id" // 以飞书人事的 ID 来识别用户
+)
+
+const (
+ DepartmentIdTypePatchJobDataOpenDepartmentId = "open_department_id" // 以 open_department_id 来标识部门
+ DepartmentIdTypePatchJobDataDepartmentId = "department_id" // 以 department_id 来标识部门
+ DepartmentIdTypePatchJobDataPeopleCorehrDepartmentId = "people_corehr_department_id" // 以 people_corehr_department_id 来标识部门
+)
+
+const (
+ UserIdTypeLeaveBalancesLeaveUserId = "user_id" // 以 user_id 来识别用户
+ UserIdTypeLeaveBalancesLeaveUnionId = "union_id" // 以 union_id 来识别用户
+ UserIdTypeLeaveBalancesLeaveOpenId = "open_id" // 以 open_id 来识别用户
+ UserIdTypeLeaveBalancesLeavePeopleCorehrId = "people_corehr_id" // 以飞书人事的 ID 来识别用户
+)
+
+const (
+ UserIdTypeLeaveRequestHistoryLeaveUserId = "user_id" // 以 user_id 来识别用户
+ UserIdTypeLeaveRequestHistoryLeaveUnionId = "union_id" // 以 union_id 来识别用户
+ UserIdTypeLeaveRequestHistoryLeaveOpenId = "open_id" // 以 open_id 来识别用户
+ UserIdTypeLeaveRequestHistoryLeavePeopleCorehrId = "people_corehr_id" // 以飞书人事的 ID 来识别用户
+)
+
+const (
+ UserIdTypeLeaveTypesLeaveUserId = "user_id" // 以 user_id 来识别用户
+ UserIdTypeLeaveTypesLeaveUnionId = "union_id" // 以 union_id 来识别用户
+ UserIdTypeLeaveTypesLeaveOpenId = "open_id" // 以 open_id 来识别用户
+ UserIdTypeLeaveTypesLeavePeopleCorehrId = "people_corehr_id" // 以飞书人事的 ID 来识别用户
+)
+
+const (
+ UserIdTypeCreateLeaveGrantingRecordUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeCreateLeaveGrantingRecordUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeCreateLeaveGrantingRecordOpenId = "open_id" // 以open_id来识别用户
+ UserIdTypeCreateLeaveGrantingRecordPeopleCorehrId = "people_corehr_id" // 以飞书人事的ID来识别用户
+)
+
+const (
+ UserIdTypeSearchOffboardingUserId = "user_id" // 以 user_id 来识别用户
+ UserIdTypeSearchOffboardingUnionId = "union_id" // 以 union_id 来识别用户
+ UserIdTypeSearchOffboardingOpenId = "open_id" // 以 open_id 来识别用户
+ UserIdTypeSearchOffboardingPeopleCorehrId = "people_corehr_id" // 以飞书人事的 ID 来识别用户
+)
+
+const (
+ OffboardingModeTerminationOfDismissal = 1 // 直接离职
+
+)
+
+const (
+ UserIdTypeSubmitOffboardingUserId = "user_id" // 以 user_id 来识别用户
+ UserIdTypeSubmitOffboardingUnionId = "union_id" // 以 union_id 来识别用户
+ UserIdTypeSubmitOffboardingOpenId = "open_id" // 以 open_id 来识别用户
+ UserIdTypeSubmitOffboardingPeopleCorehrId = "people_corehr_id" // 以飞书人事的 ID 来识别用户
+)
+
+const (
+ UserIdTypeGetPersonPeopleEmployeeId = "people_employee_id" // 以people_employee_id来识别用户
+)
+
+const (
+ DepartmentIdTypeQuerySecurityGroupOpenDepartmentId = "open_department_id" // 以 open_department_id 来标识部门
+ DepartmentIdTypeQuerySecurityGroupDepartmentId = "department_id" // 以 department_id 来标识部门
+ DepartmentIdTypeQuerySecurityGroupPeopleCorehrDepartmentId = "people_corehr_department_id" // 以 people_corehr_department_id 来标识部门
+)
+
type Address struct {
FullAddressLocalScript *string `json:"full_address_local_script,omitempty"` // 完整地址(本地文字)
FullAddressWesternScript *string `json:"full_address_western_script,omitempty"` // 完整地址(西方文字)
@@ -1012,48 +1224,43 @@ func (builder *BackgroundCheckTargetBuilder) Build() *BackgroundCheckTarget {
}
type BankAccount struct {
- BankName *string `json:"bank_name,omitempty"` // 银行名称,如果已经填入银行枚举,该字段可为空。如果要填写数据不在系统提供的枚举范围内,该字段存储自定义银行名称
- BankAccountNumber *string `json:"bank_account_number,omitempty"` // 银行账号
- AccountHolder *string `json:"account_holder,omitempty"` // 开户人姓名
- Bank *Enum `json:"bank,omitempty"` // 银行枚举,常见的银行枚举如:bank-5(交通银行)、bank-6(中国银行)、bank-7(中国建设银行)、bank-8(中国农业银行)、bank-9(中国工商银行)、bank-10(中国邮政储蓄银行)、bank-11(中国光大银行)、bank-12(中国民生银行)、bank-13(招商银行)、bank-14(中信银行)、bank-15(华夏银行)
- BankIdentificationCode *string `json:"bank_identification_code,omitempty"` // 银行识别码
- BranchName *string `json:"branch_name,omitempty"` // 支行名称
- BankId *string `json:"bank_id,omitempty"` // 银行 ID
- BranchId *string `json:"branch_id,omitempty"` // 支行 ID
- CustomFields []*ObjectFieldData `json:"custom_fields,omitempty"` // 自定义字段
- CountryRegionId *string `json:"country_region_id,omitempty"` // 国家/地区id,详细信息可通过【查询国家/地区信息】接口查询获得
- BankAccountUsage []*Enum `json:"bank_account_usage,omitempty"` // 银行卡用途,枚举值可通过文档[【飞书人事枚举常量】](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/feishu-people-enum-constant)银行卡用途(bank_account_usage)枚举定义部分获得
- BankAccountType *Enum `json:"bank_account_type,omitempty"` // 银行卡类型,枚举值可通过文档[【飞书人事枚举常量】](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/feishu-people-enum-constant)银行卡类型(bank_account_type)枚举定义部分获得
- CurrencyId *string `json:"currency_id,omitempty"` // 货币id
+ BankName *string `json:"bank_name,omitempty"` // 银行名称,如果已经填入银行枚举,该字段可为空。如果要填写数据不在系统提供的枚举范围内,该字段存储自定义银行名称
+ BankAccountNumber *string `json:"bank_account_number,omitempty"` // 银行账号
+ AccountHolder *string `json:"account_holder,omitempty"` // 开户人姓名
+ Bank *Enum `json:"bank,omitempty"` // 银行枚举,常见的银行枚举如:bank-5(交通银行)、bank-6(中国银行)、bank-7(中国建设银行)、bank-8(中国农业银行)、bank-9(中国工商银行)、bank-10(中国邮政储蓄银行)、bank-11(中国光大银行)、bank-12(中国民生银行)、bank-13(招商银行)、bank-14(中信银行)、bank-15(华夏银行)
+
+ BranchName *string `json:"branch_name,omitempty"` // 支行名称
+
+ CustomFields []*ObjectFieldData `json:"custom_fields,omitempty"` // 自定义字段
+ CountryRegionId *string `json:"country_region_id,omitempty"` // 国家/地区id,详细信息可通过【查询国家/地区信息】接口查询获得
+ BankAccountUsage []*Enum `json:"bank_account_usage,omitempty"` // 银行卡用途,枚举值可通过文档[【飞书人事枚举常量】](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/feishu-people-enum-constant)银行卡用途(bank_account_usage)枚举定义部分获得
+ BankAccountType *Enum `json:"bank_account_type,omitempty"` // 银行卡类型,枚举值可通过文档[【飞书人事枚举常量】](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/feishu-people-enum-constant)银行卡类型(bank_account_type)枚举定义部分获得
+ CurrencyId *string `json:"currency_id,omitempty"` // 货币id
}
type BankAccountBuilder struct {
- bankName string // 银行名称,如果已经填入银行枚举,该字段可为空。如果要填写数据不在系统提供的枚举范围内,该字段存储自定义银行名称
- bankNameFlag bool
- bankAccountNumber string // 银行账号
- bankAccountNumberFlag bool
- accountHolder string // 开户人姓名
- accountHolderFlag bool
- bank *Enum // 银行枚举,常见的银行枚举如:bank-5(交通银行)、bank-6(中国银行)、bank-7(中国建设银行)、bank-8(中国农业银行)、bank-9(中国工商银行)、bank-10(中国邮政储蓄银行)、bank-11(中国光大银行)、bank-12(中国民生银行)、bank-13(招商银行)、bank-14(中信银行)、bank-15(华夏银行)
- bankFlag bool
- bankIdentificationCode string // 银行识别码
- bankIdentificationCodeFlag bool
- branchName string // 支行名称
- branchNameFlag bool
- bankId string // 银行 ID
- bankIdFlag bool
- branchId string // 支行 ID
- branchIdFlag bool
- customFields []*ObjectFieldData // 自定义字段
- customFieldsFlag bool
- countryRegionId string // 国家/地区id,详细信息可通过【查询国家/地区信息】接口查询获得
- countryRegionIdFlag bool
- bankAccountUsage []*Enum // 银行卡用途,枚举值可通过文档[【飞书人事枚举常量】](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/feishu-people-enum-constant)银行卡用途(bank_account_usage)枚举定义部分获得
- bankAccountUsageFlag bool
- bankAccountType *Enum // 银行卡类型,枚举值可通过文档[【飞书人事枚举常量】](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/feishu-people-enum-constant)银行卡类型(bank_account_type)枚举定义部分获得
- bankAccountTypeFlag bool
- currencyId string // 货币id
- currencyIdFlag bool
+ bankName string // 银行名称,如果已经填入银行枚举,该字段可为空。如果要填写数据不在系统提供的枚举范围内,该字段存储自定义银行名称
+ bankNameFlag bool
+ bankAccountNumber string // 银行账号
+ bankAccountNumberFlag bool
+ accountHolder string // 开户人姓名
+ accountHolderFlag bool
+ bank *Enum // 银行枚举,常见的银行枚举如:bank-5(交通银行)、bank-6(中国银行)、bank-7(中国建设银行)、bank-8(中国农业银行)、bank-9(中国工商银行)、bank-10(中国邮政储蓄银行)、bank-11(中国光大银行)、bank-12(中国民生银行)、bank-13(招商银行)、bank-14(中信银行)、bank-15(华夏银行)
+ bankFlag bool
+
+ branchName string // 支行名称
+ branchNameFlag bool
+
+ customFields []*ObjectFieldData // 自定义字段
+ customFieldsFlag bool
+ countryRegionId string // 国家/地区id,详细信息可通过【查询国家/地区信息】接口查询获得
+ countryRegionIdFlag bool
+ bankAccountUsage []*Enum // 银行卡用途,枚举值可通过文档[【飞书人事枚举常量】](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/feishu-people-enum-constant)银行卡用途(bank_account_usage)枚举定义部分获得
+ bankAccountUsageFlag bool
+ bankAccountType *Enum // 银行卡类型,枚举值可通过文档[【飞书人事枚举常量】](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/feishu-people-enum-constant)银行卡类型(bank_account_type)枚举定义部分获得
+ bankAccountTypeFlag bool
+ currencyId string // 货币id
+ currencyIdFlag bool
}
func NewBankAccountBuilder() *BankAccountBuilder {
@@ -1097,15 +1304,6 @@ func (builder *BankAccountBuilder) Bank(bank *Enum) *BankAccountBuilder {
return builder
}
-// 银行识别码
-//
-// 示例值:1234
-func (builder *BankAccountBuilder) BankIdentificationCode(bankIdentificationCode string) *BankAccountBuilder {
- builder.bankIdentificationCode = bankIdentificationCode
- builder.bankIdentificationCodeFlag = true
- return builder
-}
-
// 支行名称
//
// 示例值:中国农业银行支行
@@ -1115,24 +1313,6 @@ func (builder *BankAccountBuilder) BranchName(branchName string) *BankAccountBui
return builder
}
-// 银行 ID
-//
-// 示例值:8
-func (builder *BankAccountBuilder) BankId(bankId string) *BankAccountBuilder {
- builder.bankId = bankId
- builder.bankIdFlag = true
- return builder
-}
-
-// 支行 ID
-//
-// 示例值:12
-func (builder *BankAccountBuilder) BranchId(branchId string) *BankAccountBuilder {
- builder.branchId = branchId
- builder.branchIdFlag = true
- return builder
-}
-
// 自定义字段
//
// 示例值:
@@ -1195,22 +1375,12 @@ func (builder *BankAccountBuilder) Build() *BankAccount {
if builder.bankFlag {
req.Bank = builder.bank
}
- if builder.bankIdentificationCodeFlag {
- req.BankIdentificationCode = &builder.bankIdentificationCode
- }
if builder.branchNameFlag {
req.BranchName = &builder.branchName
}
- if builder.bankIdFlag {
- req.BankId = &builder.bankId
-
- }
- if builder.branchIdFlag {
- req.BranchId = &builder.branchId
- }
if builder.customFieldsFlag {
req.CustomFields = builder.customFields
}
@@ -3356,6 +3526,7 @@ type Department struct {
EffectiveTime *string `json:"effective_time,omitempty"` // 生效时间
ExpirationTime *string `json:"expiration_time,omitempty"` // 失效时间
CustomFields []*ObjectFieldData `json:"custom_fields,omitempty"` // 自定义字段
+ CostCenterId *string `json:"cost_center_id,omitempty"` // 成本中心id
}
type DepartmentBuilder struct {
@@ -3375,6 +3546,8 @@ type DepartmentBuilder struct {
expirationTimeFlag bool
customFields []*ObjectFieldData // 自定义字段
customFieldsFlag bool
+ costCenterId string // 成本中心id
+ costCenterIdFlag bool
}
func NewDepartmentBuilder() *DepartmentBuilder {
@@ -3454,6 +3627,15 @@ func (builder *DepartmentBuilder) CustomFields(customFields []*ObjectFieldData)
return builder
}
+// 成本中心id
+//
+// 示例值:7142384817131652652
+func (builder *DepartmentBuilder) CostCenterId(costCenterId string) *DepartmentBuilder {
+ builder.costCenterId = costCenterId
+ builder.costCenterIdFlag = true
+ return builder
+}
+
func (builder *DepartmentBuilder) Build() *Department {
req := &Department{}
if builder.idFlag {
@@ -3485,6 +3667,10 @@ func (builder *DepartmentBuilder) Build() *Department {
if builder.customFieldsFlag {
req.CustomFields = builder.customFields
}
+ if builder.costCenterIdFlag {
+ req.CostCenterId = &builder.costCenterId
+
+ }
return req
}
@@ -3497,6 +3683,7 @@ type DepartmentCreate struct {
EffectiveTime *string `json:"effective_time,omitempty"` // 生效时间
ExpirationTime *string `json:"expiration_time,omitempty"` // 失效时间
CustomFields []*ObjectFieldData `json:"custom_fields,omitempty"` // 自定义字段
+ CostCenterId *string `json:"cost_center_id,omitempty"` // 成本中心id
}
type DepartmentCreateBuilder struct {
@@ -3516,6 +3703,8 @@ type DepartmentCreateBuilder struct {
expirationTimeFlag bool
customFields []*ObjectFieldData // 自定义字段
customFieldsFlag bool
+ costCenterId string // 成本中心id
+ costCenterIdFlag bool
}
func NewDepartmentCreateBuilder() *DepartmentCreateBuilder {
@@ -3595,6 +3784,15 @@ func (builder *DepartmentCreateBuilder) CustomFields(customFields []*ObjectField
return builder
}
+// 成本中心id
+//
+// 示例值:7142384817131652652
+func (builder *DepartmentCreateBuilder) CostCenterId(costCenterId string) *DepartmentCreateBuilder {
+ builder.costCenterId = costCenterId
+ builder.costCenterIdFlag = true
+ return builder
+}
+
func (builder *DepartmentCreateBuilder) Build() *DepartmentCreate {
req := &DepartmentCreate{}
if builder.idFlag {
@@ -3626,6 +3824,10 @@ func (builder *DepartmentCreateBuilder) Build() *DepartmentCreate {
if builder.customFieldsFlag {
req.CustomFields = builder.customFields
}
+ if builder.costCenterIdFlag {
+ req.CostCenterId = &builder.costCenterId
+
+ }
return req
}
@@ -3640,6 +3842,12 @@ type Dependent struct {
IsThisPersonCoveredByHealthInsurance *bool `json:"is_this_person_covered_by_health_insurance,omitempty"` // 包含家属医疗保险
IsThisPersonAllowedForTaxDeduction *bool `json:"is_this_person_allowed_for_tax_deduction,omitempty"` // 允许家属抵扣税款
CustomFields []*ObjectFieldData `json:"custom_fields,omitempty"` // 自定义字段
+ DependentName *string `json:"dependent_name,omitempty"` // 家庭成员姓名
+ Employer *string `json:"employer,omitempty"` // 工作单位
+ Job *string `json:"job,omitempty"` // 岗位
+ Phone *Phone `json:"phone,omitempty"` // 电话
+ Address *Address `json:"address,omitempty"` // 联系地址
+ BirthCertificateOfChild []*File `json:"birth_certificate_of_child,omitempty"` // 出生证明
}
type DependentBuilder struct {
@@ -3663,6 +3871,18 @@ type DependentBuilder struct {
isThisPersonAllowedForTaxDeductionFlag bool
customFields []*ObjectFieldData // 自定义字段
customFieldsFlag bool
+ dependentName string // 家庭成员姓名
+ dependentNameFlag bool
+ employer string // 工作单位
+ employerFlag bool
+ job string // 岗位
+ jobFlag bool
+ phone *Phone // 电话
+ phoneFlag bool
+ address *Address // 联系地址
+ addressFlag bool
+ birthCertificateOfChild []*File // 出生证明
+ birthCertificateOfChildFlag bool
}
func NewDependentBuilder() *DependentBuilder {
@@ -3760,6 +3980,60 @@ func (builder *DependentBuilder) CustomFields(customFields []*ObjectFieldData) *
return builder
}
+// 家庭成员姓名
+//
+// 示例值:张三
+func (builder *DependentBuilder) DependentName(dependentName string) *DependentBuilder {
+ builder.dependentName = dependentName
+ builder.dependentNameFlag = true
+ return builder
+}
+
+// 工作单位
+//
+// 示例值:海淀区交警大队
+func (builder *DependentBuilder) Employer(employer string) *DependentBuilder {
+ builder.employer = employer
+ builder.employerFlag = true
+ return builder
+}
+
+// 岗位
+//
+// 示例值:保安
+func (builder *DependentBuilder) Job(job string) *DependentBuilder {
+ builder.job = job
+ builder.jobFlag = true
+ return builder
+}
+
+// 电话
+//
+// 示例值:
+func (builder *DependentBuilder) Phone(phone *Phone) *DependentBuilder {
+ builder.phone = phone
+ builder.phoneFlag = true
+ return builder
+}
+
+// 联系地址
+//
+// 示例值:
+func (builder *DependentBuilder) Address(address *Address) *DependentBuilder {
+ builder.address = address
+ builder.addressFlag = true
+ return builder
+}
+
+// 出生证明
+//
+// 示例值:
+func (builder *DependentBuilder) BirthCertificateOfChild(birthCertificateOfChild []*File) *DependentBuilder {
+ builder.birthCertificateOfChild = birthCertificateOfChild
+ builder.birthCertificateOfChildFlag = true
+ return builder
+}
+
func (builder *DependentBuilder) Build() *Dependent {
req := &Dependent{}
if builder.nameFlag {
@@ -3796,6 +4070,27 @@ func (builder *DependentBuilder) Build() *Dependent {
if builder.customFieldsFlag {
req.CustomFields = builder.customFields
}
+ if builder.dependentNameFlag {
+ req.DependentName = &builder.dependentName
+
+ }
+ if builder.employerFlag {
+ req.Employer = &builder.employer
+
+ }
+ if builder.jobFlag {
+ req.Job = &builder.job
+
+ }
+ if builder.phoneFlag {
+ req.Phone = builder.phone
+ }
+ if builder.addressFlag {
+ req.Address = builder.address
+ }
+ if builder.birthCertificateOfChildFlag {
+ req.BirthCertificateOfChild = builder.birthCertificateOfChild
+ }
return req
}
@@ -6930,6 +7225,54 @@ func (builder *I18nBuilder) Build() *I18n {
return req
}
+type IdInfo struct {
+ Id *string `json:"id,omitempty"` // 传入的 ID
+ TargetId *string `json:"target_id,omitempty"` // 目标 ID 值
+}
+
+type IdInfoBuilder struct {
+ id string // 传入的 ID
+ idFlag bool
+ targetId string // 目标 ID 值
+ targetIdFlag bool
+}
+
+func NewIdInfoBuilder() *IdInfoBuilder {
+ builder := &IdInfoBuilder{}
+ return builder
+}
+
+// 传入的 ID
+//
+// 示例值:7224321696097404460
+func (builder *IdInfoBuilder) Id(id string) *IdInfoBuilder {
+ builder.id = id
+ builder.idFlag = true
+ return builder
+}
+
+// 目标 ID 值
+//
+// 示例值:7224321696097404461
+func (builder *IdInfoBuilder) TargetId(targetId string) *IdInfoBuilder {
+ builder.targetId = targetId
+ builder.targetIdFlag = true
+ return builder
+}
+
+func (builder *IdInfoBuilder) Build() *IdInfo {
+ req := &IdInfo{}
+ if builder.idFlag {
+ req.Id = &builder.id
+
+ }
+ if builder.targetIdFlag {
+ req.TargetId = &builder.targetId
+
+ }
+ return req
+}
+
type ImageFieldSetting struct {
ImageType *int `json:"image_type,omitempty"` // 图片类型枚举,具体如下:;1. Avatar 头像;2. BadgePhoto 工卡照片;3. Logo 标志
DisplayStyle *int `json:"display_style,omitempty"` // 显示样式枚举,具体如下:;1. SquareImage 方形;2. RoundImage 圆形
@@ -7388,29 +7731,30 @@ func (builder *JobChangeBuilder) Build() *JobChange {
}
type JobData struct {
- Id *string `json:"id,omitempty"` // 任职信息 ID
- VersionId *string `json:"version_id,omitempty"` // 任职记录版本 ID
- JobLevelId *string `json:"job_level_id,omitempty"` // 职务级别 ID,枚举值及详细信息可通过【批量查询职务级别】接口查询获得
- EmployeeTypeId *string `json:"employee_type_id,omitempty"` // 人员类型 ID,枚举值及详细信息可通过【批量查询人员类型】接口查询获得
- WorkingHoursTypeId *string `json:"working_hours_type_id,omitempty"` // 工时制度 ID,枚举值及详细信息可通过【批量查询工时制度】接口查询获得
- WorkLocationId *string `json:"work_location_id,omitempty"` // 工作地点 ID,枚举值及详细信息可通过【批量查询地点】接口查询获得
- DepartmentId *string `json:"department_id,omitempty"` // 部门 ID,枚举值及详细信息可通过【批量查询部门】接口查询获得
- JobId *string `json:"job_id,omitempty"` // 职务 ID,枚举值及详细信息可通过【批量查询职务】接口查询获得
- ProbationStartDate *string `json:"probation_start_date,omitempty"` // 试用期开始日期
- ProbationEndDate *string `json:"probation_end_date,omitempty"` // 试用期结束日期(实际结束日期)
- PrimaryJobData *bool `json:"primary_job_data,omitempty"` // 是否为主任职
- EmploymentId *string `json:"employment_id,omitempty"` // 雇佣 ID
- EffectiveTime *string `json:"effective_time,omitempty"` // 生效时间
- ExpirationTime *string `json:"expiration_time,omitempty"` // 失效时间
- JobFamilyId *string `json:"job_family_id,omitempty"` // 职务序列 ID,枚举值及详细信息可通过【批量查询职务序列】接口查询获得
- AssignmentStartReason *Enum `json:"assignment_start_reason,omitempty"` // 任职原因,枚举值可通过文档[【飞书人事枚举常量】](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/feishu-people-enum-constant)任职原因(assignment_start_reason)枚举定义部分获得
- ProbationExpectedEndDate *string `json:"probation_expected_end_date,omitempty"` // 预计试用期结束日期
- ProbationOutcome *Enum `json:"probation_outcome,omitempty"` // 试用期结果,枚举值可通过文档[【飞书人事枚举常量】](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/feishu-people-enum-constant)试用期结果(probation_outcome)枚举定义部分获得
- WeeklyWorkingHours *int `json:"weekly_working_hours,omitempty"` // 周工作时长
- DirectManagerId *string `json:"direct_manager_id,omitempty"` // 实线主管的任职记录ID
- DottedLineManagerIdList []string `json:"dotted_line_manager_id_list,omitempty"` // 虚线主管的任职记录ID
- SecondDirectManagerId *string `json:"second_direct_manager_id,omitempty"` // 第二实线主管的任职记录ID
- CustomFields []*ObjectFieldData `json:"custom_fields,omitempty"` // 自定义字段
+ Id *string `json:"id,omitempty"` // 任职信息 ID
+ VersionId *string `json:"version_id,omitempty"` // 任职记录版本 ID
+ JobLevelId *string `json:"job_level_id,omitempty"` // 职务级别 ID,枚举值及详细信息可通过【批量查询职务级别】接口查询获得
+ EmployeeTypeId *string `json:"employee_type_id,omitempty"` // 人员类型 ID,枚举值及详细信息可通过【批量查询人员类型】接口查询获得
+ WorkingHoursTypeId *string `json:"working_hours_type_id,omitempty"` // 工时制度 ID,枚举值及详细信息可通过【批量查询工时制度】接口查询获得
+ WorkLocationId *string `json:"work_location_id,omitempty"` // 工作地点 ID,枚举值及详细信息可通过【批量查询地点】接口查询获得
+ DepartmentId *string `json:"department_id,omitempty"` // 部门 ID,枚举值及详细信息可通过【批量查询部门】接口查询获得
+ JobId *string `json:"job_id,omitempty"` // 职务 ID,枚举值及详细信息可通过【批量查询职务】接口查询获得
+ ProbationStartDate *string `json:"probation_start_date,omitempty"` // 试用期开始日期
+ ProbationEndDate *string `json:"probation_end_date,omitempty"` // 试用期结束日期(实际结束日期)
+ PrimaryJobData *bool `json:"primary_job_data,omitempty"` // 是否为主任职
+ EmploymentId *string `json:"employment_id,omitempty"` // 雇佣 ID
+ EffectiveTime *string `json:"effective_time,omitempty"` // 生效时间
+ ExpirationTime *string `json:"expiration_time,omitempty"` // 失效时间
+ JobFamilyId *string `json:"job_family_id,omitempty"` // 职务序列 ID,枚举值及详细信息可通过【批量查询职务序列】接口查询获得
+ AssignmentStartReason *Enum `json:"assignment_start_reason,omitempty"` // 任职原因,枚举值可通过文档[【飞书人事枚举常量】](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/feishu-people-enum-constant)任职原因(assignment_start_reason)枚举定义部分获得
+ ProbationExpectedEndDate *string `json:"probation_expected_end_date,omitempty"` // 预计试用期结束日期
+ ProbationOutcome *Enum `json:"probation_outcome,omitempty"` // 试用期结果,枚举值可通过文档[【飞书人事枚举常量】](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/feishu-people-enum-constant)试用期结果(probation_outcome)枚举定义部分获得
+ WeeklyWorkingHours *int `json:"weekly_working_hours,omitempty"` // 周工作时长
+ DirectManagerId *string `json:"direct_manager_id,omitempty"` // 实线主管的任职记录ID
+ DottedLineManagerIdList []string `json:"dotted_line_manager_id_list,omitempty"` // 虚线主管的任职记录ID
+ SecondDirectManagerId *string `json:"second_direct_manager_id,omitempty"` // 第二实线主管的任职记录ID
+ CostCenterRate []*SupportCostCenterItem `json:"cost_center_rate,omitempty"` // 成本中心分摊信息
+ CustomFields []*ObjectFieldData `json:"custom_fields,omitempty"` // 自定义字段
}
type JobDataBuilder struct {
@@ -7458,6 +7802,8 @@ type JobDataBuilder struct {
dottedLineManagerIdListFlag bool
secondDirectManagerId string // 第二实线主管的任职记录ID
secondDirectManagerIdFlag bool
+ costCenterRate []*SupportCostCenterItem // 成本中心分摊信息
+ costCenterRateFlag bool
customFields []*ObjectFieldData // 自定义字段
customFieldsFlag bool
}
@@ -7665,6 +8011,15 @@ func (builder *JobDataBuilder) SecondDirectManagerId(secondDirectManagerId strin
return builder
}
+// 成本中心分摊信息
+//
+// 示例值:
+func (builder *JobDataBuilder) CostCenterRate(costCenterRate []*SupportCostCenterItem) *JobDataBuilder {
+ builder.costCenterRate = costCenterRate
+ builder.costCenterRateFlag = true
+ return builder
+}
+
// 自定义字段
//
// 示例值:
@@ -7761,6 +8116,9 @@ func (builder *JobDataBuilder) Build() *JobData {
req.SecondDirectManagerId = &builder.secondDirectManagerId
}
+ if builder.costCenterRateFlag {
+ req.CostCenterRate = builder.costCenterRate
+ }
if builder.customFieldsFlag {
req.CustomFields = builder.customFields
}
@@ -9902,7 +10260,7 @@ func (builder *ObjectFieldDataBuilder) Build() *ObjectFieldData {
type Offboarding struct {
InitiatingType *string `json:"initiating_type,omitempty"` // 离职发起类型,包括:
- Status *string `json:"status,omitempty"` // 离职状态,包括:
+ Status *string `json:"status,omitempty"` // 离职状态
ApplicationInfo *ApplicationInfo `json:"application_info,omitempty"` // 离职审批信息
OffboardingInfo *OffboardingInfo `json:"offboarding_info,omitempty"` // 员工离职信息
OffboardingChecklist *OffboardingChecklist `json:"offboarding_checklist,omitempty"` // 离职办理流程信息
@@ -9911,7 +10269,7 @@ type Offboarding struct {
type OffboardingBuilder struct {
initiatingType string // 离职发起类型,包括:
initiatingTypeFlag bool
- status string // 离职状态,包括:
+ status string // 离职状态
statusFlag bool
applicationInfo *ApplicationInfo // 离职审批信息
applicationInfoFlag bool
@@ -9935,7 +10293,7 @@ func (builder *OffboardingBuilder) InitiatingType(initiatingType string) *Offboa
return builder
}
-// 离职状态,包括:
+// 离职状态
//
// 示例值:Approving
func (builder *OffboardingBuilder) Status(status string) *OffboardingBuilder {
@@ -11637,7 +11995,7 @@ func (builder *PersonNameBuilder) Secondary(secondary string) *PersonNameBuilder
// 尊称
//
-// 示例值:王大帅
+// 示例值:刘梓新
func (builder *PersonNameBuilder) Social(social *Enum) *PersonNameBuilder {
builder.social = social
builder.socialFlag = true
@@ -12015,15 +12373,16 @@ func (builder *PhoneBuilder) Build() *Phone {
}
type PreHire struct {
- AtsApplicationId *string `json:"ats_application_id,omitempty"` // 招聘系统的候选人 ID
- Id *string `json:"id,omitempty"` // 待入职ID
- HireDate *string `json:"hire_date,omitempty"` // 入职日期
- EmployeeType *Enum `json:"employee_type,omitempty"` // 雇佣类型
- WorkerId *string `json:"worker_id,omitempty"` // 人员编号
- EmployeeTypeId *string `json:"employee_type_id,omitempty"` // 雇佣类型
- PersonId *string `json:"person_id,omitempty"` // 引用Person ID
- CustomFields []*ObjectFieldData `json:"custom_fields,omitempty"` // 自定义字段
- OnboardingStatus *Enum `json:"onboarding_status,omitempty"` // 入职状态;;- 待入职(preboarding);;- 已删除(deleted);;- 准备就绪(day_one);;- 已撤销(withdrawn);;- 已完成(completed)
+ AtsApplicationId *string `json:"ats_application_id,omitempty"` // 招聘系统的候选人 ID
+ Id *string `json:"id,omitempty"` // 待入职ID
+ HireDate *string `json:"hire_date,omitempty"` // 入职日期
+ EmployeeType *Enum `json:"employee_type,omitempty"` // 雇佣类型
+ WorkerId *string `json:"worker_id,omitempty"` // 人员编号
+ EmployeeTypeId *string `json:"employee_type_id,omitempty"` // 雇佣类型
+ PersonId *string `json:"person_id,omitempty"` // 引用Person ID
+ CustomFields []*ObjectFieldData `json:"custom_fields,omitempty"` // 自定义字段
+ CostCenterRate []*SupportCostCenterItem `json:"cost_center_rate,omitempty"` // 成本中心分摊信息
+ OnboardingStatus *Enum `json:"onboarding_status,omitempty"` // 入职状态;;- 待入职(preboarding);;- 已删除(deleted);;- 准备就绪(day_one);;- 已撤销(withdrawn);;- 已完成(completed)
}
type PreHireBuilder struct {
@@ -12043,6 +12402,8 @@ type PreHireBuilder struct {
personIdFlag bool
customFields []*ObjectFieldData // 自定义字段
customFieldsFlag bool
+ costCenterRate []*SupportCostCenterItem // 成本中心分摊信息
+ costCenterRateFlag bool
onboardingStatus *Enum // 入职状态;;- 待入职(preboarding);;- 已删除(deleted);;- 准备就绪(day_one);;- 已撤销(withdrawn);;- 已完成(completed)
onboardingStatusFlag bool
}
@@ -12124,6 +12485,15 @@ func (builder *PreHireBuilder) CustomFields(customFields []*ObjectFieldData) *Pr
return builder
}
+// 成本中心分摊信息
+//
+// 示例值:
+func (builder *PreHireBuilder) CostCenterRate(costCenterRate []*SupportCostCenterItem) *PreHireBuilder {
+ builder.costCenterRate = costCenterRate
+ builder.costCenterRateFlag = true
+ return builder
+}
+
// 入职状态;;- 待入职(preboarding);;- 已删除(deleted);;- 准备就绪(day_one);;- 已撤销(withdrawn);;- 已完成(completed)
//
// 示例值:
@@ -12165,6 +12535,9 @@ func (builder *PreHireBuilder) Build() *PreHire {
if builder.customFieldsFlag {
req.CustomFields = builder.customFields
}
+ if builder.costCenterRateFlag {
+ req.CostCenterRate = builder.costCenterRate
+ }
if builder.onboardingStatusFlag {
req.OnboardingStatus = builder.onboardingStatus
}
@@ -12172,17 +12545,18 @@ func (builder *PreHireBuilder) Build() *PreHire {
}
type PreHireQuery struct {
- AtsApplicationId *string `json:"ats_application_id,omitempty"` // 招聘系统的候选人 ID
- Id *string `json:"id,omitempty"` // 实体在CoreHR内部的唯一键
- HireDate *string `json:"hire_date,omitempty"` // 入职日期
- EmployeeType *Enum `json:"employee_type,omitempty"` // 雇佣类型
- WorkerId *string `json:"worker_id,omitempty"` // 人员编号
- EmployeeTypeId *string `json:"employee_type_id,omitempty"` // 雇佣类型
- PersonId *string `json:"person_id,omitempty"` // 引用Person ID
- CustomFields []*ObjectFieldData `json:"custom_fields,omitempty"` // 自定义字段
- OnboardingStatus *Enum `json:"onboarding_status,omitempty"` // 入职状态
- WorkEmailList []*Email `json:"work_email_list,omitempty"` // 工作邮箱
- DepartmentId *string `json:"department_id,omitempty"` // 部门ID
+ AtsApplicationId *string `json:"ats_application_id,omitempty"` // 招聘系统的候选人 ID
+ Id *string `json:"id,omitempty"` // 实体在CoreHR内部的唯一键
+ HireDate *string `json:"hire_date,omitempty"` // 入职日期
+ EmployeeType *Enum `json:"employee_type,omitempty"` // 雇佣类型
+ WorkerId *string `json:"worker_id,omitempty"` // 人员编号
+ EmployeeTypeId *string `json:"employee_type_id,omitempty"` // 雇佣类型
+ PersonId *string `json:"person_id,omitempty"` // 引用Person ID
+ CustomFields []*ObjectFieldData `json:"custom_fields,omitempty"` // 自定义字段
+ OnboardingStatus *Enum `json:"onboarding_status,omitempty"` // 入职状态
+ CostCenterRate []*SupportCostCenterItem `json:"cost_center_rate,omitempty"` // 成本中心分摊信息
+ WorkEmailList []*Email `json:"work_email_list,omitempty"` // 工作邮箱
+ DepartmentId *string `json:"department_id,omitempty"` // 部门ID
}
type PreHireQueryBuilder struct {
@@ -12204,6 +12578,8 @@ type PreHireQueryBuilder struct {
customFieldsFlag bool
onboardingStatus *Enum // 入职状态
onboardingStatusFlag bool
+ costCenterRate []*SupportCostCenterItem // 成本中心分摊信息
+ costCenterRateFlag bool
workEmailList []*Email // 工作邮箱
workEmailListFlag bool
departmentId string // 部门ID
@@ -12296,6 +12672,15 @@ func (builder *PreHireQueryBuilder) OnboardingStatus(onboardingStatus *Enum) *Pr
return builder
}
+// 成本中心分摊信息
+//
+// 示例值:
+func (builder *PreHireQueryBuilder) CostCenterRate(costCenterRate []*SupportCostCenterItem) *PreHireQueryBuilder {
+ builder.costCenterRate = costCenterRate
+ builder.costCenterRateFlag = true
+ return builder
+}
+
// 工作邮箱
//
// 示例值:
@@ -12349,6 +12734,9 @@ func (builder *PreHireQueryBuilder) Build() *PreHireQuery {
if builder.onboardingStatusFlag {
req.OnboardingStatus = builder.onboardingStatus
}
+ if builder.costCenterRateFlag {
+ req.CostCenterRate = builder.costCenterRate
+ }
if builder.workEmailListFlag {
req.WorkEmailList = builder.workEmailList
}
@@ -13196,50 +13584,52 @@ func (builder *TextFieldSettingBuilder) Build() *TextFieldSetting {
}
type TransferInfo struct {
- Remark *string `json:"remark,omitempty"` // 备注
- OfferInfo *string `json:"offer_info,omitempty"` // offer信息
- TargetDottedManagerClean *bool `json:"target_dotted_manager_clean,omitempty"` // 是否撤销虚线上级
- ProbationExist *bool `json:"probation_exist,omitempty"` // 是否有试用期
- OriginalDepartment *string `json:"original_department,omitempty"` // 原部门
- TargetDepartment *string `json:"target_department,omitempty"` // 新部门
- OriginalWorkLocation *string `json:"original_work_location,omitempty"` // 原工作地点
- TargetWorkLocation *string `json:"target_work_location,omitempty"` // 新工作地点
- OriginalDirectManager *string `json:"original_direct_manager,omitempty"` // 原直属上级
- TargetDirectManager *string `json:"target_direct_manager,omitempty"` // 新直属上级
- OriginalDottedManager *string `json:"original_dotted_manager,omitempty"` // 原虚线上级
- TargetDottedManager *string `json:"target_dotted_manager,omitempty"` // 新虚线上级
- OriginalJob *string `json:"original_job,omitempty"` // 原职务
- TargetJob *string `json:"target_job,omitempty"` // 新职务
- OriginalJobFamily *string `json:"original_job_family,omitempty"` // 原序列
- TargetJobFamily *string `json:"target_job_family,omitempty"` // 新序列
- OriginalJobLevel *string `json:"original_job_level,omitempty"` // 原级别
- TargetJobLevel *string `json:"target_job_level,omitempty"` // 新级别
- OriginalWorkforceType *string `json:"original_workforce_type,omitempty"` // 原人员类型
- TargetWorkforceType *string `json:"target_workforce_type,omitempty"` // 新人员类型
- OriginalCompany *string `json:"original_company,omitempty"` // 原公司
- TargetCompany *string `json:"target_company,omitempty"` // 新公司
- OriginalContractNumber *string `json:"original_contract_number,omitempty"` // 原合同编号
- TargetContractNumber *string `json:"target_contract_number,omitempty"` // 新合同编号
- OriginalContractType *string `json:"original_contract_type,omitempty"` // 原合同类型
- TargetContractType *string `json:"target_contract_type,omitempty"` // 新合同类型
- OriginalDurationType *string `json:"original_duration_type,omitempty"` // 原期限类型
- TargetDurationType *string `json:"target_duration_type,omitempty"` // 新期限类型
- OriginalSigningType *string `json:"original_signing_type,omitempty"` // 原签订类型
- TargetSigningType *string `json:"target_signing_type,omitempty"` // 新签订类型
- OriginalContractStartDate *string `json:"original_contract_start_date,omitempty"` // 原合同开始日期
- TargetContractStartDate *string `json:"target_contract_start_date,omitempty"` // 新合同开始日期
- OriginalContractEndDate *string `json:"original_contract_end_date,omitempty"` // 原合同结束日期
- TargetContractEndDate *string `json:"target_contract_end_date,omitempty"` // 新合同结束日期
- OriginalWorkingHoursType *string `json:"original_working_hours_type,omitempty"` // 原工时制度
- TargetWorkingHoursType *string `json:"target_working_hours_type,omitempty"` // 新工时制度
- OriginalWorkingCalendar *string `json:"original_working_calendar,omitempty"` // 原工作日历
- TargetWorkingCalendar *string `json:"target_working_calendar,omitempty"` // 新工作日历
- OriginalProbationEndDate *string `json:"original_probation_end_date,omitempty"` // 原试用期预计结束日期
- TargetProbationEndDate *string `json:"target_probation_end_date,omitempty"` // 新试用期预计结束日期
- OriginalWeeklyWorkingHours *string `json:"original_weekly_working_hours,omitempty"` // 原周工作时长
- TargetWeeklyWorkingHours *string `json:"target_weekly_working_hours,omitempty"` // 新周工作时长
- OriginalWorkShift *string `json:"original_work_shift,omitempty"` // 原排班
- TargetWorkShift *string `json:"target_work_shift,omitempty"` // 新排班
+ Remark *string `json:"remark,omitempty"` // 备注
+ OfferInfo *string `json:"offer_info,omitempty"` // offer信息
+ TargetDottedManagerClean *bool `json:"target_dotted_manager_clean,omitempty"` // 是否撤销虚线上级
+ ProbationExist *bool `json:"probation_exist,omitempty"` // 是否有试用期
+ OriginalDepartment *string `json:"original_department,omitempty"` // 原部门
+ TargetDepartment *string `json:"target_department,omitempty"` // 新部门
+ OriginalWorkLocation *string `json:"original_work_location,omitempty"` // 原工作地点
+ TargetWorkLocation *string `json:"target_work_location,omitempty"` // 新工作地点
+ OriginalDirectManager *string `json:"original_direct_manager,omitempty"` // 原直属上级
+ TargetDirectManager *string `json:"target_direct_manager,omitempty"` // 新直属上级
+ OriginalDottedManager *string `json:"original_dotted_manager,omitempty"` // 原虚线上级
+ TargetDottedManager *string `json:"target_dotted_manager,omitempty"` // 新虚线上级
+ OriginalJob *string `json:"original_job,omitempty"` // 原职务
+ TargetJob *string `json:"target_job,omitempty"` // 新职务
+ OriginalJobFamily *string `json:"original_job_family,omitempty"` // 原序列
+ TargetJobFamily *string `json:"target_job_family,omitempty"` // 新序列
+ OriginalJobLevel *string `json:"original_job_level,omitempty"` // 原级别
+ TargetJobLevel *string `json:"target_job_level,omitempty"` // 新级别
+ OriginalWorkforceType *string `json:"original_workforce_type,omitempty"` // 原人员类型
+ TargetWorkforceType *string `json:"target_workforce_type,omitempty"` // 新人员类型
+ OriginalCompany *string `json:"original_company,omitempty"` // 原公司
+ TargetCompany *string `json:"target_company,omitempty"` // 新公司
+ OriginalContractNumber *string `json:"original_contract_number,omitempty"` // 原合同编号
+ TargetContractNumber *string `json:"target_contract_number,omitempty"` // 新合同编号
+ OriginalContractType *string `json:"original_contract_type,omitempty"` // 原合同类型
+ TargetContractType *string `json:"target_contract_type,omitempty"` // 新合同类型
+ OriginalDurationType *string `json:"original_duration_type,omitempty"` // 原期限类型
+ TargetDurationType *string `json:"target_duration_type,omitempty"` // 新期限类型
+ OriginalSigningType *string `json:"original_signing_type,omitempty"` // 原签订类型
+ TargetSigningType *string `json:"target_signing_type,omitempty"` // 新签订类型
+ OriginalContractStartDate *string `json:"original_contract_start_date,omitempty"` // 原合同开始日期
+ TargetContractStartDate *string `json:"target_contract_start_date,omitempty"` // 新合同开始日期
+ OriginalContractEndDate *string `json:"original_contract_end_date,omitempty"` // 原合同结束日期
+ TargetContractEndDate *string `json:"target_contract_end_date,omitempty"` // 新合同结束日期
+ OriginalWorkingHoursType *string `json:"original_working_hours_type,omitempty"` // 原工时制度
+ TargetWorkingHoursType *string `json:"target_working_hours_type,omitempty"` // 新工时制度
+ OriginalWorkingCalendar *string `json:"original_working_calendar,omitempty"` // 原工作日历
+ TargetWorkingCalendar *string `json:"target_working_calendar,omitempty"` // 新工作日历
+ OriginalProbationEndDate *string `json:"original_probation_end_date,omitempty"` // 原试用期预计结束日期
+ TargetProbationEndDate *string `json:"target_probation_end_date,omitempty"` // 新试用期预计结束日期
+ OriginalWeeklyWorkingHours *string `json:"original_weekly_working_hours,omitempty"` // 原周工作时长
+ TargetWeeklyWorkingHours *string `json:"target_weekly_working_hours,omitempty"` // 新周工作时长
+ OriginalWorkShift *string `json:"original_work_shift,omitempty"` // 原排班
+ TargetWorkShift *string `json:"target_work_shift,omitempty"` // 新排班
+ OriginalCostCenterRate []*SupportCostCenterItem `json:"original_cost_center_rate,omitempty"` // 原成本中心分摊信息
+ TargetCostCenterRate []*SupportCostCenterItem `json:"target_cost_center_rate,omitempty"` // 新成本中心分摊信息
}
type TransferInfoBuilder struct {
@@ -13331,6 +13721,10 @@ type TransferInfoBuilder struct {
originalWorkShiftFlag bool
targetWorkShift string // 新排班
targetWorkShiftFlag bool
+ originalCostCenterRate []*SupportCostCenterItem // 原成本中心分摊信息
+ originalCostCenterRateFlag bool
+ targetCostCenterRate []*SupportCostCenterItem // 新成本中心分摊信息
+ targetCostCenterRateFlag bool
}
func NewTransferInfoBuilder() *TransferInfoBuilder {
@@ -13734,6 +14128,24 @@ func (builder *TransferInfoBuilder) TargetWorkShift(targetWorkShift string) *Tra
return builder
}
+// 原成本中心分摊信息
+//
+// 示例值:
+func (builder *TransferInfoBuilder) OriginalCostCenterRate(originalCostCenterRate []*SupportCostCenterItem) *TransferInfoBuilder {
+ builder.originalCostCenterRate = originalCostCenterRate
+ builder.originalCostCenterRateFlag = true
+ return builder
+}
+
+// 新成本中心分摊信息
+//
+// 示例值:
+func (builder *TransferInfoBuilder) TargetCostCenterRate(targetCostCenterRate []*SupportCostCenterItem) *TransferInfoBuilder {
+ builder.targetCostCenterRate = targetCostCenterRate
+ builder.targetCostCenterRateFlag = true
+ return builder
+}
+
func (builder *TransferInfoBuilder) Build() *TransferInfo {
req := &TransferInfo{}
if builder.remarkFlag {
@@ -13912,6 +14324,12 @@ func (builder *TransferInfoBuilder) Build() *TransferInfo {
req.TargetWorkShift = &builder.targetWorkShift
}
+ if builder.originalCostCenterRateFlag {
+ req.OriginalCostCenterRate = builder.originalCostCenterRate
+ }
+ if builder.targetCostCenterRateFlag {
+ req.TargetCostCenterRate = builder.targetCostCenterRate
+ }
return req
}
@@ -14152,9 +14570,73 @@ func (builder *TransferTypeBuilder) Build() *TransferType {
return req
}
-type WorkExperience struct {
- CompanyOrganization []*I18n `json:"company_organization,omitempty"` // 公司 / 组织
- Department []*I18n `json:"department,omitempty"` // 部门
+type UserId struct {
+ UserId *string `json:"user_id,omitempty"` //
+ OpenId *string `json:"open_id,omitempty"` //
+ UnionId *string `json:"union_id,omitempty"` //
+}
+
+type UserIdBuilder struct {
+ userId string //
+ userIdFlag bool
+ openId string //
+ openIdFlag bool
+ unionId string //
+ unionIdFlag bool
+}
+
+func NewUserIdBuilder() *UserIdBuilder {
+ builder := &UserIdBuilder{}
+ return builder
+}
+
+//
+//
+// 示例值:
+func (builder *UserIdBuilder) UserId(userId string) *UserIdBuilder {
+ builder.userId = userId
+ builder.userIdFlag = true
+ return builder
+}
+
+//
+//
+// 示例值:
+func (builder *UserIdBuilder) OpenId(openId string) *UserIdBuilder {
+ builder.openId = openId
+ builder.openIdFlag = true
+ return builder
+}
+
+//
+//
+// 示例值:
+func (builder *UserIdBuilder) UnionId(unionId string) *UserIdBuilder {
+ builder.unionId = unionId
+ builder.unionIdFlag = true
+ return builder
+}
+
+func (builder *UserIdBuilder) Build() *UserId {
+ req := &UserId{}
+ if builder.userIdFlag {
+ req.UserId = &builder.userId
+
+ }
+ if builder.openIdFlag {
+ req.OpenId = &builder.openId
+
+ }
+ if builder.unionIdFlag {
+ req.UnionId = &builder.unionId
+
+ }
+ return req
+}
+
+type WorkExperience struct {
+ CompanyOrganization []*I18n `json:"company_organization,omitempty"` // 公司 / 组织
+ Department []*I18n `json:"department,omitempty"` // 部门
Job []*I18n `json:"job,omitempty"` // 岗位
Description []*I18n `json:"description,omitempty"` // 工作描述
StartDate *string `json:"start_date,omitempty"` // 开始日期
@@ -14400,170 +14882,6940 @@ func (builder *WorkingHoursTypeBuilder) Build() *WorkingHoursType {
return req
}
-type LeaveRequestHistoryLeaveReqBuilder struct {
- apiReq *larkcore.ApiReq
+type SearchAssignedUserReqBodyBuilder struct {
+ roleId string // 角色 ID,仅支持组织类角色, 角色 ID 可通过【批量获取角色列表】接口获取
+ roleIdFlag bool
+ managementScopeList []*ManagementScope // 管理范围信息
+ managementScopeListFlag bool
+ searchMethod string // 查找方式;;可选值有:;- 1:只查找指定 部门/工作地点/公司/社保城市,如无授权信息则返回为空;- 2:当指定的 部门/工作地点/公司/社保城市 无授权信息,向上查找第一个授权记录并直接返回
+ searchMethodFlag bool
+ pageToken string // 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+ pageTokenFlag bool
+ pageSize string // 每页获取记录数量,最大100
+ pageSizeFlag bool
}
-func NewLeaveRequestHistoryLeaveReqBuilder() *LeaveRequestHistoryLeaveReqBuilder {
- builder := &LeaveRequestHistoryLeaveReqBuilder{}
- builder.apiReq = &larkcore.ApiReq{
- PathParams: larkcore.PathParams{},
- QueryParams: larkcore.QueryParams{},
- }
+func NewSearchAssignedUserReqBodyBuilder() *SearchAssignedUserReqBodyBuilder {
+ builder := &SearchAssignedUserReqBodyBuilder{}
return builder
}
-// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+// 角色 ID,仅支持组织类角色, 角色 ID 可通过【批量获取角色列表】接口获取
//
-// 示例值:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
-func (builder *LeaveRequestHistoryLeaveReqBuilder) PageToken(pageToken string) *LeaveRequestHistoryLeaveReqBuilder {
- builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+//示例值:100
+func (builder *SearchAssignedUserReqBodyBuilder) RoleId(roleId string) *SearchAssignedUserReqBodyBuilder {
+ builder.roleId = roleId
+ builder.roleIdFlag = true
return builder
}
-// 每页获取记录数量,最大100
+// 管理范围信息
//
-// 示例值:100
-func (builder *LeaveRequestHistoryLeaveReqBuilder) PageSize(pageSize string) *LeaveRequestHistoryLeaveReqBuilder {
- builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+//示例值:
+func (builder *SearchAssignedUserReqBodyBuilder) ManagementScopeList(managementScopeList []*ManagementScope) *SearchAssignedUserReqBodyBuilder {
+ builder.managementScopeList = managementScopeList
+ builder.managementScopeListFlag = true
return builder
}
-// 员工 ID 列表,最大 100 个(不传则默认查询全部员工)
+// 查找方式;;可选值有:;- 1:只查找指定 部门/工作地点/公司/社保城市,如无授权信息则返回为空;- 2:当指定的 部门/工作地点/公司/社保城市 无授权信息,向上查找第一个授权记录并直接返回
//
-// 示例值:["6919733291281024526"]
-func (builder *LeaveRequestHistoryLeaveReqBuilder) EmploymentIdList(employmentIdList []string) *LeaveRequestHistoryLeaveReqBuilder {
- for _, v := range employmentIdList {
- builder.apiReq.QueryParams.Add("employment_id_list", fmt.Sprint(v))
- }
+//示例值:1
+func (builder *SearchAssignedUserReqBodyBuilder) SearchMethod(searchMethod string) *SearchAssignedUserReqBodyBuilder {
+ builder.searchMethod = searchMethod
+ builder.searchMethodFlag = true
return builder
}
-// 休假发起人 ID 列表,最大 100 个
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
//
-// 示例值:["6919733291281024526"]
-func (builder *LeaveRequestHistoryLeaveReqBuilder) InitiatorIdList(initiatorIdList []string) *LeaveRequestHistoryLeaveReqBuilder {
- for _, v := range initiatorIdList {
- builder.apiReq.QueryParams.Add("initiator_id_list", fmt.Sprint(v))
- }
+//示例值:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
+func (builder *SearchAssignedUserReqBodyBuilder) PageToken(pageToken string) *SearchAssignedUserReqBodyBuilder {
+ builder.pageToken = pageToken
+ builder.pageTokenFlag = true
return builder
}
-// 请假记录的状态;;可选值有:;;- 1:已通过;;- 2:审批中;;- 3:审批中(更正);;- 4:审批中(取消休假);;- 5:审批中(返岗);;- 6:已返岗;;- 7:已拒绝;;- 8:已取消;;- 9:已撤回
+// 每页获取记录数量,最大100
//
-// 示例值:["1", "2"]
-func (builder *LeaveRequestHistoryLeaveReqBuilder) LeaveRequestStatus(leaveRequestStatus []string) *LeaveRequestHistoryLeaveReqBuilder {
- for _, v := range leaveRequestStatus {
- builder.apiReq.QueryParams.Add("leave_request_status", fmt.Sprint(v))
- }
+//示例值:100
+func (builder *SearchAssignedUserReqBodyBuilder) PageSize(pageSize string) *SearchAssignedUserReqBodyBuilder {
+ builder.pageSize = pageSize
+ builder.pageSizeFlag = true
return builder
}
-// 假期类型 ID 列表,枚举值可通过【获取假期类型列表】接口获取
-//
-// 示例值:["1"]
-func (builder *LeaveRequestHistoryLeaveReqBuilder) LeaveTypeIdList(leaveTypeIdList []string) *LeaveRequestHistoryLeaveReqBuilder {
- for _, v := range leaveTypeIdList {
- builder.apiReq.QueryParams.Add("leave_type_id_list", fmt.Sprint(v))
+func (builder *SearchAssignedUserReqBodyBuilder) Build() *SearchAssignedUserReqBody {
+ req := &SearchAssignedUserReqBody{}
+ if builder.roleIdFlag {
+ req.RoleId = &builder.roleId
+ }
+ if builder.managementScopeListFlag {
+ req.ManagementScopeList = builder.managementScopeList
}
+ if builder.searchMethodFlag {
+ req.SearchMethod = &builder.searchMethod
+ }
+ if builder.pageTokenFlag {
+ req.PageToken = &builder.pageToken
+ }
+ if builder.pageSizeFlag {
+ req.PageSize = &builder.pageSize
+ }
+ return req
+}
+
+type SearchAssignedUserPathReqBodyBuilder struct {
+ roleId string // 角色 ID,仅支持组织类角色, 角色 ID 可通过【批量获取角色列表】接口获取
+ roleIdFlag bool
+ managementScopeList []*ManagementScope // 管理范围信息
+ managementScopeListFlag bool
+ searchMethod string // 查找方式;;可选值有:;- 1:只查找指定 部门/工作地点/公司/社保城市,如无授权信息则返回为空;- 2:当指定的 部门/工作地点/公司/社保城市 无授权信息,向上查找第一个授权记录并直接返回
+ searchMethodFlag bool
+ pageToken string // 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+ pageTokenFlag bool
+ pageSize string // 每页获取记录数量,最大100
+ pageSizeFlag bool
+}
+
+func NewSearchAssignedUserPathReqBodyBuilder() *SearchAssignedUserPathReqBodyBuilder {
+ builder := &SearchAssignedUserPathReqBodyBuilder{}
return builder
}
-// 休假开始时间晚于等于的日期
+// 角色 ID,仅支持组织类角色, 角色 ID 可通过【批量获取角色列表】接口获取
//
-// 示例值:2022-07-20 morning
-func (builder *LeaveRequestHistoryLeaveReqBuilder) LeaveStartDateMin(leaveStartDateMin string) *LeaveRequestHistoryLeaveReqBuilder {
- builder.apiReq.QueryParams.Set("leave_start_date_min", fmt.Sprint(leaveStartDateMin))
+// 示例值:100
+func (builder *SearchAssignedUserPathReqBodyBuilder) RoleId(roleId string) *SearchAssignedUserPathReqBodyBuilder {
+ builder.roleId = roleId
+ builder.roleIdFlag = true
return builder
}
-// 休假开始时间早于等于的日期
+// 管理范围信息
//
-// 示例值:2022-07-20 morning
-func (builder *LeaveRequestHistoryLeaveReqBuilder) LeaveStartDateMax(leaveStartDateMax string) *LeaveRequestHistoryLeaveReqBuilder {
- builder.apiReq.QueryParams.Set("leave_start_date_max", fmt.Sprint(leaveStartDateMax))
+// 示例值:
+func (builder *SearchAssignedUserPathReqBodyBuilder) ManagementScopeList(managementScopeList []*ManagementScope) *SearchAssignedUserPathReqBodyBuilder {
+ builder.managementScopeList = managementScopeList
+ builder.managementScopeListFlag = true
return builder
}
-// 休假结束时间晚于等于的日期
+// 查找方式;;可选值有:;- 1:只查找指定 部门/工作地点/公司/社保城市,如无授权信息则返回为空;- 2:当指定的 部门/工作地点/公司/社保城市 无授权信息,向上查找第一个授权记录并直接返回
//
-// 示例值:2022-07-20 morning
-func (builder *LeaveRequestHistoryLeaveReqBuilder) LeaveEndDateMin(leaveEndDateMin string) *LeaveRequestHistoryLeaveReqBuilder {
- builder.apiReq.QueryParams.Set("leave_end_date_min", fmt.Sprint(leaveEndDateMin))
+// 示例值:1
+func (builder *SearchAssignedUserPathReqBodyBuilder) SearchMethod(searchMethod string) *SearchAssignedUserPathReqBodyBuilder {
+ builder.searchMethod = searchMethod
+ builder.searchMethodFlag = true
return builder
}
-// 休假结束时间早于等于的日期
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
//
-// 示例值:2022-07-20 morning
-func (builder *LeaveRequestHistoryLeaveReqBuilder) LeaveEndDateMax(leaveEndDateMax string) *LeaveRequestHistoryLeaveReqBuilder {
- builder.apiReq.QueryParams.Set("leave_end_date_max", fmt.Sprint(leaveEndDateMax))
+// 示例值:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
+func (builder *SearchAssignedUserPathReqBodyBuilder) PageToken(pageToken string) *SearchAssignedUserPathReqBodyBuilder {
+ builder.pageToken = pageToken
+ builder.pageTokenFlag = true
return builder
}
-// 休假发起时间晚于等于的日期
+// 每页获取记录数量,最大100
//
-// 示例值:2022-07-20 morning
-func (builder *LeaveRequestHistoryLeaveReqBuilder) LeaveSubmitDateMin(leaveSubmitDateMin string) *LeaveRequestHistoryLeaveReqBuilder {
- builder.apiReq.QueryParams.Set("leave_submit_date_min", fmt.Sprint(leaveSubmitDateMin))
+// 示例值:100
+func (builder *SearchAssignedUserPathReqBodyBuilder) PageSize(pageSize string) *SearchAssignedUserPathReqBodyBuilder {
+ builder.pageSize = pageSize
+ builder.pageSizeFlag = true
return builder
}
-// 休假发起时间早于等于的日期
-//
-// 示例值:2022-07-20 morning
-func (builder *LeaveRequestHistoryLeaveReqBuilder) LeaveSubmitDateMax(leaveSubmitDateMax string) *LeaveRequestHistoryLeaveReqBuilder {
- builder.apiReq.QueryParams.Set("leave_submit_date_max", fmt.Sprint(leaveSubmitDateMax))
+func (builder *SearchAssignedUserPathReqBodyBuilder) Build() (*SearchAssignedUserReqBody, error) {
+ req := &SearchAssignedUserReqBody{}
+ if builder.roleIdFlag {
+ req.RoleId = &builder.roleId
+ }
+ if builder.managementScopeListFlag {
+ req.ManagementScopeList = builder.managementScopeList
+ }
+ if builder.searchMethodFlag {
+ req.SearchMethod = &builder.searchMethod
+ }
+ if builder.pageTokenFlag {
+ req.PageToken = &builder.pageToken
+ }
+ if builder.pageSizeFlag {
+ req.PageSize = &builder.pageSize
+ }
+ return req, nil
+}
+
+type SearchAssignedUserReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *SearchAssignedUserReqBody
+}
+
+func NewSearchAssignedUserReqBuilder() *SearchAssignedUserReqBuilder {
+ builder := &SearchAssignedUserReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
return builder
}
// 用户 ID 类型
//
// 示例值:people_corehr_id
-func (builder *LeaveRequestHistoryLeaveReqBuilder) UserIdType(userIdType string) *LeaveRequestHistoryLeaveReqBuilder {
+func (builder *SearchAssignedUserReqBuilder) UserIdType(userIdType string) *SearchAssignedUserReqBuilder {
builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
return builder
}
-// 请假记录更新时间晚于等于的时间
-//
-// 示例值:2022-10-24 10:00:00
-func (builder *LeaveRequestHistoryLeaveReqBuilder) LeaveUpdateTimeMin(leaveUpdateTimeMin string) *LeaveRequestHistoryLeaveReqBuilder {
- builder.apiReq.QueryParams.Set("leave_update_time_min", fmt.Sprint(leaveUpdateTimeMin))
+// 查询组织类角色的授权信息
+func (builder *SearchAssignedUserReqBuilder) Body(body *SearchAssignedUserReqBody) *SearchAssignedUserReqBuilder {
+ builder.body = body
return builder
}
-// 请假记录更新时间早于等于的时间
+func (builder *SearchAssignedUserReqBuilder) Build() *SearchAssignedUserReq {
+ req := &SearchAssignedUserReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type SearchAssignedUserReqBody struct {
+ RoleId *string `json:"role_id,omitempty"` // 角色 ID,仅支持组织类角色, 角色 ID 可通过【批量获取角色列表】接口获取
+ ManagementScopeList []*ManagementScope `json:"management_scope_list,omitempty"` // 管理范围信息
+ SearchMethod *string `json:"search_method,omitempty"` // 查找方式;;可选值有:;- 1:只查找指定 部门/工作地点/公司/社保城市,如无授权信息则返回为空;- 2:当指定的 部门/工作地点/公司/社保城市 无授权信息,向上查找第一个授权记录并直接返回
+ PageToken *string `json:"page_token,omitempty"` // 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+ PageSize *string `json:"page_size,omitempty"` // 每页获取记录数量,最大100
+}
+
+type SearchAssignedUserReq struct {
+ apiReq *larkcore.ApiReq
+ Body *SearchAssignedUserReqBody `body:""`
+}
+
+type SearchAssignedUserRespData struct {
+ Items []*RoleAuthorization `json:"items,omitempty"` // 用户授权信息
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type SearchAssignedUserResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *SearchAssignedUserRespData `json:"data"` // 业务数据
+}
+
+func (resp *SearchAssignedUserResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateCompanyReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ company *Company
+}
+
+func NewCreateCompanyReqBuilder() *CreateCompanyReqBuilder {
+ builder := &CreateCompanyReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
//
-// 示例值:2022-10-24 10:00:00
-func (builder *LeaveRequestHistoryLeaveReqBuilder) LeaveUpdateTimeMax(leaveUpdateTimeMax string) *LeaveRequestHistoryLeaveReqBuilder {
- builder.apiReq.QueryParams.Set("leave_update_time_max", fmt.Sprint(leaveUpdateTimeMax))
+// 示例值:12454646
+func (builder *CreateCompanyReqBuilder) ClientToken(clientToken string) *CreateCompanyReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
return builder
}
-func (builder *LeaveRequestHistoryLeaveReqBuilder) Build() *LeaveRequestHistoryLeaveReq {
- req := &LeaveRequestHistoryLeaveReq{}
+// 创建公司
+func (builder *CreateCompanyReqBuilder) Company(company *Company) *CreateCompanyReqBuilder {
+ builder.company = company
+ return builder
+}
+
+func (builder *CreateCompanyReqBuilder) Build() *CreateCompanyReq {
+ req := &CreateCompanyReq{}
req.apiReq = &larkcore.ApiReq{}
req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.company
return req
}
-type LeaveRequestHistoryLeaveReq struct {
+type CreateCompanyReq struct {
+ apiReq *larkcore.ApiReq
+ Company *Company `body:""`
+}
+
+type CreateCompanyRespData struct {
+ Company *Company `json:"company,omitempty"` // 创建成功的公司信息
+}
+
+type CreateCompanyResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateCompanyRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateCompanyResp) Success() bool {
+ return resp.Code == 0
+}
+
+type DeleteCompanyReqBuilder struct {
apiReq *larkcore.ApiReq
}
-type LeaveRequestHistoryLeaveRespData struct {
- LeaveRequestList []*LeaveRequest `json:"leave_request_list,omitempty"` // 请假记录信息列表
- HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
- PageToken *string `json:"page_token,omitempty"` // 下一页页码
+func NewDeleteCompanyReqBuilder() *DeleteCompanyReqBuilder {
+ builder := &DeleteCompanyReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
}
-type LeaveRequestHistoryLeaveResp struct {
+// 需要删除的公司ID
+//
+// 示例值:341432424
+func (builder *DeleteCompanyReqBuilder) CompanyId(companyId string) *DeleteCompanyReqBuilder {
+ builder.apiReq.PathParams.Set("company_id", fmt.Sprint(companyId))
+ return builder
+}
+
+func (builder *DeleteCompanyReqBuilder) Build() *DeleteCompanyReq {
+ req := &DeleteCompanyReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type DeleteCompanyReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type DeleteCompanyResp struct {
*larkcore.ApiResp `json:"-"`
larkcore.CodeError
- Data *LeaveRequestHistoryLeaveRespData `json:"data"` // 业务数据
}
-func (resp *LeaveRequestHistoryLeaveResp) Success() bool {
+func (resp *DeleteCompanyResp) Success() bool {
return resp.Code == 0
}
+
+type GetCompanyReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetCompanyReqBuilder() *GetCompanyReqBuilder {
+ builder := &GetCompanyReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 公司 ID
+//
+// 示例值:151515
+func (builder *GetCompanyReqBuilder) CompanyId(companyId string) *GetCompanyReqBuilder {
+ builder.apiReq.PathParams.Set("company_id", fmt.Sprint(companyId))
+ return builder
+}
+
+func (builder *GetCompanyReqBuilder) Build() *GetCompanyReq {
+ req := &GetCompanyReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type GetCompanyReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetCompanyRespData struct {
+ Company *Company `json:"company,omitempty"` // 公司信息
+}
+
+type GetCompanyResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetCompanyRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetCompanyResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListCompanyReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListCompanyReqBuilder() *ListCompanyReqBuilder {
+ builder := &ListCompanyReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:1231231987
+func (builder *ListCompanyReqBuilder) PageToken(pageToken string) *ListCompanyReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListCompanyReqBuilder) PageSize(pageSize string) *ListCompanyReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+func (builder *ListCompanyReqBuilder) Build() *ListCompanyReq {
+ req := &ListCompanyReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListCompanyReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListCompanyRespData struct {
+ Items []*Company `json:"items,omitempty"` // 查询的公司信息
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type ListCompanyResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListCompanyRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListCompanyResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateContractReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ contract *Contract
+}
+
+func NewCreateContractReqBuilder() *CreateContractReqBuilder {
+ builder := &CreateContractReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *CreateContractReqBuilder) ClientToken(clientToken string) *CreateContractReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 创建合同
+func (builder *CreateContractReqBuilder) Contract(contract *Contract) *CreateContractReqBuilder {
+ builder.contract = contract
+ return builder
+}
+
+func (builder *CreateContractReqBuilder) Build() *CreateContractReq {
+ req := &CreateContractReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.contract
+ return req
+}
+
+type CreateContractReq struct {
+ apiReq *larkcore.ApiReq
+ Contract *Contract `body:""`
+}
+
+type CreateContractRespData struct {
+ Contract *Contract `json:"contract,omitempty"` // 创建成功的合同信息
+}
+
+type CreateContractResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateContractRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateContractResp) Success() bool {
+ return resp.Code == 0
+}
+
+type DeleteContractReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewDeleteContractReqBuilder() *DeleteContractReqBuilder {
+ builder := &DeleteContractReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 需要删除的合同 ID
+//
+// 示例值:4137834332
+func (builder *DeleteContractReqBuilder) ContractId(contractId string) *DeleteContractReqBuilder {
+ builder.apiReq.PathParams.Set("contract_id", fmt.Sprint(contractId))
+ return builder
+}
+
+func (builder *DeleteContractReqBuilder) Build() *DeleteContractReq {
+ req := &DeleteContractReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type DeleteContractReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type DeleteContractResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *DeleteContractResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetContractReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetContractReqBuilder() *GetContractReqBuilder {
+ builder := &GetContractReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 合同ID
+//
+// 示例值:151515
+func (builder *GetContractReqBuilder) ContractId(contractId string) *GetContractReqBuilder {
+ builder.apiReq.PathParams.Set("contract_id", fmt.Sprint(contractId))
+ return builder
+}
+
+func (builder *GetContractReqBuilder) Build() *GetContractReq {
+ req := &GetContractReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type GetContractReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetContractRespData struct {
+ Contract *Contract `json:"contract,omitempty"` // 合同信息
+}
+
+type GetContractResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetContractRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetContractResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListContractReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListContractReqBuilder() *ListContractReqBuilder {
+ builder := &ListContractReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:1231231987
+func (builder *ListContractReqBuilder) PageToken(pageToken string) *ListContractReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListContractReqBuilder) PageSize(pageSize string) *ListContractReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+func (builder *ListContractReqBuilder) Build() *ListContractReq {
+ req := &ListContractReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListContractReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListContractRespData struct {
+ Items []*Contract `json:"items,omitempty"` // 查询的合同信息
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type ListContractResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListContractRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListContractResp) Success() bool {
+ return resp.Code == 0
+}
+
+type PatchContractReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ contract *Contract
+}
+
+func NewPatchContractReqBuilder() *PatchContractReqBuilder {
+ builder := &PatchContractReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 合同ID
+//
+// 示例值:1616161616
+func (builder *PatchContractReqBuilder) ContractId(contractId string) *PatchContractReqBuilder {
+ builder.apiReq.PathParams.Set("contract_id", fmt.Sprint(contractId))
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *PatchContractReqBuilder) ClientToken(clientToken string) *PatchContractReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 更新合同
+func (builder *PatchContractReqBuilder) Contract(contract *Contract) *PatchContractReqBuilder {
+ builder.contract = contract
+ return builder
+}
+
+func (builder *PatchContractReqBuilder) Build() *PatchContractReq {
+ req := &PatchContractReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.contract
+ return req
+}
+
+type PatchContractReq struct {
+ apiReq *larkcore.ApiReq
+ Contract *Contract `body:""`
+}
+
+type PatchContractRespData struct {
+ Contract *Contract `json:"contract,omitempty"` // 合同
+}
+
+type PatchContractResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *PatchContractRespData `json:"data"` // 业务数据
+}
+
+func (resp *PatchContractResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetCountryRegionReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetCountryRegionReqBuilder() *GetCountryRegionReqBuilder {
+ builder := &GetCountryRegionReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 国家/地区 ID
+//
+// 示例值:67489937334909845
+func (builder *GetCountryRegionReqBuilder) CountryRegionId(countryRegionId string) *GetCountryRegionReqBuilder {
+ builder.apiReq.PathParams.Set("country_region_id", fmt.Sprint(countryRegionId))
+ return builder
+}
+
+func (builder *GetCountryRegionReqBuilder) Build() *GetCountryRegionReq {
+ req := &GetCountryRegionReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type GetCountryRegionReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetCountryRegionRespData struct {
+ CountryRegion *CountryRegion `json:"country_region,omitempty"` // 国家/地区信息
+}
+
+type GetCountryRegionResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetCountryRegionRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetCountryRegionResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListCountryRegionReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListCountryRegionReqBuilder() *ListCountryRegionReqBuilder {
+ builder := &ListCountryRegionReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:1231231987
+func (builder *ListCountryRegionReqBuilder) PageToken(pageToken string) *ListCountryRegionReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListCountryRegionReqBuilder) PageSize(pageSize string) *ListCountryRegionReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+func (builder *ListCountryRegionReqBuilder) Build() *ListCountryRegionReq {
+ req := &ListCountryRegionReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListCountryRegionReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListCountryRegionRespData struct {
+ Items []*CountryRegion `json:"items,omitempty"` // 国家/地区信息
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type ListCountryRegionResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListCountryRegionRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListCountryRegionResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetCurrencyReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetCurrencyReqBuilder() *GetCurrencyReqBuilder {
+ builder := &GetCurrencyReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 货币 ID
+//
+// 示例值:67489937334909845
+func (builder *GetCurrencyReqBuilder) CurrencyId(currencyId string) *GetCurrencyReqBuilder {
+ builder.apiReq.PathParams.Set("currency_id", fmt.Sprint(currencyId))
+ return builder
+}
+
+func (builder *GetCurrencyReqBuilder) Build() *GetCurrencyReq {
+ req := &GetCurrencyReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type GetCurrencyReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetCurrencyRespData struct {
+ Currency *Currency `json:"currency,omitempty"` // 货币信息
+}
+
+type GetCurrencyResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetCurrencyRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetCurrencyResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListCurrencyReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListCurrencyReqBuilder() *ListCurrencyReqBuilder {
+ builder := &ListCurrencyReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:1231231987
+func (builder *ListCurrencyReqBuilder) PageToken(pageToken string) *ListCurrencyReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListCurrencyReqBuilder) PageSize(pageSize string) *ListCurrencyReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+func (builder *ListCurrencyReqBuilder) Build() *ListCurrencyReq {
+ req := &ListCurrencyReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListCurrencyReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListCurrencyRespData struct {
+ Items []*Currency `json:"items,omitempty"` // 货币信息
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type ListCurrencyResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListCurrencyRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListCurrencyResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetByParamCustomFieldReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetByParamCustomFieldReqBuilder() *GetByParamCustomFieldReqBuilder {
+ builder := &GetByParamCustomFieldReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 自定义字段 apiname
+//
+// 示例值:custom_field_33
+func (builder *GetByParamCustomFieldReqBuilder) CustomApiName(customApiName string) *GetByParamCustomFieldReqBuilder {
+ builder.apiReq.QueryParams.Set("custom_api_name", fmt.Sprint(customApiName))
+ return builder
+}
+
+// 所属对象 apiname
+//
+// 示例值:offboarding_info
+func (builder *GetByParamCustomFieldReqBuilder) ObjectApiName(objectApiName string) *GetByParamCustomFieldReqBuilder {
+ builder.apiReq.QueryParams.Set("object_api_name", fmt.Sprint(objectApiName))
+ return builder
+}
+
+func (builder *GetByParamCustomFieldReqBuilder) Build() *GetByParamCustomFieldReq {
+ req := &GetByParamCustomFieldReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type GetByParamCustomFieldReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetByParamCustomFieldRespData struct {
+ Data *CustomField `json:"data,omitempty"` // 自定义字段详情
+}
+
+type GetByParamCustomFieldResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetByParamCustomFieldRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetByParamCustomFieldResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListObjectApiNameCustomFieldReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListObjectApiNameCustomFieldReqBuilder() *ListObjectApiNameCustomFieldReqBuilder {
+ builder := &ListObjectApiNameCustomFieldReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:11
+func (builder *ListObjectApiNameCustomFieldReqBuilder) PageToken(pageToken string) *ListObjectApiNameCustomFieldReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListObjectApiNameCustomFieldReqBuilder) PageSize(pageSize string) *ListObjectApiNameCustomFieldReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+func (builder *ListObjectApiNameCustomFieldReqBuilder) Build() *ListObjectApiNameCustomFieldReq {
+ req := &ListObjectApiNameCustomFieldReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListObjectApiNameCustomFieldReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListObjectApiNameCustomFieldRespData struct {
+ Items []*Object `json:"items,omitempty"` // 对象列表
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type ListObjectApiNameCustomFieldResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListObjectApiNameCustomFieldRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListObjectApiNameCustomFieldResp) Success() bool {
+ return resp.Code == 0
+}
+
+type QueryCustomFieldReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewQueryCustomFieldReqBuilder() *QueryCustomFieldReqBuilder {
+ builder := &QueryCustomFieldReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 所属对象 apiname,支持一个或多个;;当前数量限制为 20 个
+//
+// 示例值:["offboarding_info"]
+func (builder *QueryCustomFieldReqBuilder) ObjectApiNameList(objectApiNameList []string) *QueryCustomFieldReqBuilder {
+ for _, v := range objectApiNameList {
+ builder.apiReq.QueryParams.Add("object_api_name_list", fmt.Sprint(v))
+ }
+ return builder
+}
+
+func (builder *QueryCustomFieldReqBuilder) Build() *QueryCustomFieldReq {
+ req := &QueryCustomFieldReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type QueryCustomFieldReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type QueryCustomFieldRespData struct {
+ Items []*CustomField `json:"items,omitempty"` // 自定义字段列表
+}
+
+type QueryCustomFieldResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *QueryCustomFieldRespData `json:"data"` // 业务数据
+}
+
+func (resp *QueryCustomFieldResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateDepartmentReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ departmentCreate *DepartmentCreate
+}
+
+func NewCreateDepartmentReqBuilder() *CreateDepartmentReqBuilder {
+ builder := &CreateDepartmentReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *CreateDepartmentReqBuilder) ClientToken(clientToken string) *CreateDepartmentReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 用户 ID 类型
+//
+// 示例值:people_corehr_id
+func (builder *CreateDepartmentReqBuilder) UserIdType(userIdType string) *CreateDepartmentReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 此次调用中使用的部门 ID 类型
+//
+// 示例值:people_corehr_department_id
+func (builder *CreateDepartmentReqBuilder) DepartmentIdType(departmentIdType string) *CreateDepartmentReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+// 创建部门
+func (builder *CreateDepartmentReqBuilder) DepartmentCreate(departmentCreate *DepartmentCreate) *CreateDepartmentReqBuilder {
+ builder.departmentCreate = departmentCreate
+ return builder
+}
+
+func (builder *CreateDepartmentReqBuilder) Build() *CreateDepartmentReq {
+ req := &CreateDepartmentReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.departmentCreate
+ return req
+}
+
+type CreateDepartmentReq struct {
+ apiReq *larkcore.ApiReq
+ DepartmentCreate *DepartmentCreate `body:""`
+}
+
+type CreateDepartmentRespData struct {
+ Department *DepartmentCreate `json:"department,omitempty"` // 创建成功的部门信息
+}
+
+type CreateDepartmentResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateDepartmentRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateDepartmentResp) Success() bool {
+ return resp.Code == 0
+}
+
+type DeleteDepartmentReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewDeleteDepartmentReqBuilder() *DeleteDepartmentReqBuilder {
+ builder := &DeleteDepartmentReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 需要删除的部门 ID
+//
+// 示例值:341143141
+func (builder *DeleteDepartmentReqBuilder) DepartmentId(departmentId string) *DeleteDepartmentReqBuilder {
+ builder.apiReq.PathParams.Set("department_id", fmt.Sprint(departmentId))
+ return builder
+}
+
+func (builder *DeleteDepartmentReqBuilder) Build() *DeleteDepartmentReq {
+ req := &DeleteDepartmentReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type DeleteDepartmentReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type DeleteDepartmentResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *DeleteDepartmentResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetDepartmentReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetDepartmentReqBuilder() *GetDepartmentReqBuilder {
+ builder := &GetDepartmentReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 部门 ID
+//
+// 示例值:45456564
+func (builder *GetDepartmentReqBuilder) DepartmentId(departmentId string) *GetDepartmentReqBuilder {
+ builder.apiReq.PathParams.Set("department_id", fmt.Sprint(departmentId))
+ return builder
+}
+
+// 用户 ID 类型
+//
+// 示例值:people_corehr_id
+func (builder *GetDepartmentReqBuilder) UserIdType(userIdType string) *GetDepartmentReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 此次调用中使用的部门 ID 类型
+//
+// 示例值:people_corehr_department_id
+func (builder *GetDepartmentReqBuilder) DepartmentIdType(departmentIdType string) *GetDepartmentReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+func (builder *GetDepartmentReqBuilder) Build() *GetDepartmentReq {
+ req := &GetDepartmentReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type GetDepartmentReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetDepartmentRespData struct {
+ Department *Department `json:"department,omitempty"` // 部门信息
+}
+
+type GetDepartmentResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetDepartmentRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetDepartmentResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListDepartmentReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListDepartmentReqBuilder() *ListDepartmentReqBuilder {
+ builder := &ListDepartmentReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:"6966234786251671053"
+func (builder *ListDepartmentReqBuilder) PageToken(pageToken string) *ListDepartmentReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListDepartmentReqBuilder) PageSize(pageSize string) *ListDepartmentReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 部门ID列表
+//
+// 示例值:["6966234786251671053"]
+func (builder *ListDepartmentReqBuilder) DepartmentIdList(departmentIdList []string) *ListDepartmentReqBuilder {
+ for _, v := range departmentIdList {
+ builder.apiReq.QueryParams.Add("department_id_list", fmt.Sprint(v))
+ }
+ return builder
+}
+
+// 部门名称列表,需精确匹配
+//
+// 示例值:["校验部门"]
+func (builder *ListDepartmentReqBuilder) NameList(nameList []string) *ListDepartmentReqBuilder {
+ for _, v := range nameList {
+ builder.apiReq.QueryParams.Add("name_list", fmt.Sprint(v))
+ }
+ return builder
+}
+
+// 用户 ID 类型
+//
+// 示例值:people_corehr_id
+func (builder *ListDepartmentReqBuilder) UserIdType(userIdType string) *ListDepartmentReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 此次调用中使用的部门 ID 类型
+//
+// 示例值:people_corehr_department_id
+func (builder *ListDepartmentReqBuilder) DepartmentIdType(departmentIdType string) *ListDepartmentReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+func (builder *ListDepartmentReqBuilder) Build() *ListDepartmentReq {
+ req := &ListDepartmentReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListDepartmentReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListDepartmentRespData struct {
+ Items []*Department `json:"items,omitempty"` // 查询的部门信息
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type ListDepartmentResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListDepartmentRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListDepartmentResp) Success() bool {
+ return resp.Code == 0
+}
+
+type PatchDepartmentReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ department *Department
+}
+
+func NewPatchDepartmentReqBuilder() *PatchDepartmentReqBuilder {
+ builder := &PatchDepartmentReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 需要更新的部门ID,同部门实体在CoreHR内部的唯一键
+//
+// 示例值:6969828847121885087
+func (builder *PatchDepartmentReqBuilder) DepartmentId(departmentId string) *PatchDepartmentReqBuilder {
+ builder.apiReq.PathParams.Set("department_id", fmt.Sprint(departmentId))
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *PatchDepartmentReqBuilder) ClientToken(clientToken string) *PatchDepartmentReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 用户 ID 类型
+//
+// 示例值:people_corehr_id
+func (builder *PatchDepartmentReqBuilder) UserIdType(userIdType string) *PatchDepartmentReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 此次调用中使用的部门 ID 类型
+//
+// 示例值:people_corehr_department_id
+func (builder *PatchDepartmentReqBuilder) DepartmentIdType(departmentIdType string) *PatchDepartmentReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+// 更新部门
+func (builder *PatchDepartmentReqBuilder) Department(department *Department) *PatchDepartmentReqBuilder {
+ builder.department = department
+ return builder
+}
+
+func (builder *PatchDepartmentReqBuilder) Build() *PatchDepartmentReq {
+ req := &PatchDepartmentReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.department
+ return req
+}
+
+type PatchDepartmentReq struct {
+ apiReq *larkcore.ApiReq
+ Department *Department `body:""`
+}
+
+type PatchDepartmentRespData struct {
+ Department *Department `json:"department,omitempty"` // 部门
+}
+
+type PatchDepartmentResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *PatchDepartmentRespData `json:"data"` // 业务数据
+}
+
+func (resp *PatchDepartmentResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateEmployeeTypeReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ employeeType *EmployeeType
+}
+
+func NewCreateEmployeeTypeReqBuilder() *CreateEmployeeTypeReqBuilder {
+ builder := &CreateEmployeeTypeReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *CreateEmployeeTypeReqBuilder) ClientToken(clientToken string) *CreateEmployeeTypeReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 创建人员类型
+func (builder *CreateEmployeeTypeReqBuilder) EmployeeType(employeeType *EmployeeType) *CreateEmployeeTypeReqBuilder {
+ builder.employeeType = employeeType
+ return builder
+}
+
+func (builder *CreateEmployeeTypeReqBuilder) Build() *CreateEmployeeTypeReq {
+ req := &CreateEmployeeTypeReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.employeeType
+ return req
+}
+
+type CreateEmployeeTypeReq struct {
+ apiReq *larkcore.ApiReq
+ EmployeeType *EmployeeType `body:""`
+}
+
+type CreateEmployeeTypeRespData struct {
+ EmployeeType *EmployeeType `json:"employee_type,omitempty"` // 创建成功的人员类型信息
+}
+
+type CreateEmployeeTypeResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateEmployeeTypeRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateEmployeeTypeResp) Success() bool {
+ return resp.Code == 0
+}
+
+type DeleteEmployeeTypeReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewDeleteEmployeeTypeReqBuilder() *DeleteEmployeeTypeReqBuilder {
+ builder := &DeleteEmployeeTypeReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 需要删除的人员类型ID
+//
+// 示例值:434343434
+func (builder *DeleteEmployeeTypeReqBuilder) EmployeeTypeId(employeeTypeId string) *DeleteEmployeeTypeReqBuilder {
+ builder.apiReq.PathParams.Set("employee_type_id", fmt.Sprint(employeeTypeId))
+ return builder
+}
+
+func (builder *DeleteEmployeeTypeReqBuilder) Build() *DeleteEmployeeTypeReq {
+ req := &DeleteEmployeeTypeReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type DeleteEmployeeTypeReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type DeleteEmployeeTypeResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *DeleteEmployeeTypeResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetEmployeeTypeReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetEmployeeTypeReqBuilder() *GetEmployeeTypeReqBuilder {
+ builder := &GetEmployeeTypeReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 雇员类型ID
+//
+// 示例值:1
+func (builder *GetEmployeeTypeReqBuilder) EmployeeTypeId(employeeTypeId string) *GetEmployeeTypeReqBuilder {
+ builder.apiReq.PathParams.Set("employee_type_id", fmt.Sprint(employeeTypeId))
+ return builder
+}
+
+func (builder *GetEmployeeTypeReqBuilder) Build() *GetEmployeeTypeReq {
+ req := &GetEmployeeTypeReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type GetEmployeeTypeReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetEmployeeTypeRespData struct {
+ EmployeeType *EmployeeType `json:"employee_type,omitempty"` // 雇员类型
+}
+
+type GetEmployeeTypeResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetEmployeeTypeRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetEmployeeTypeResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListEmployeeTypeReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListEmployeeTypeReqBuilder() *ListEmployeeTypeReqBuilder {
+ builder := &ListEmployeeTypeReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:1231231987
+func (builder *ListEmployeeTypeReqBuilder) PageToken(pageToken string) *ListEmployeeTypeReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListEmployeeTypeReqBuilder) PageSize(pageSize string) *ListEmployeeTypeReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+func (builder *ListEmployeeTypeReqBuilder) Build() *ListEmployeeTypeReq {
+ req := &ListEmployeeTypeReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListEmployeeTypeReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListEmployeeTypeRespData struct {
+ Items []*EmployeeType `json:"items,omitempty"` // 查询的雇员类型信息
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type ListEmployeeTypeResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListEmployeeTypeRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListEmployeeTypeResp) Success() bool {
+ return resp.Code == 0
+}
+
+type PatchEmployeeTypeReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ employeeType *EmployeeType
+}
+
+func NewPatchEmployeeTypeReqBuilder() *PatchEmployeeTypeReqBuilder {
+ builder := &PatchEmployeeTypeReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 雇员类型 ID
+//
+// 示例值:6969828847931885087
+func (builder *PatchEmployeeTypeReqBuilder) EmployeeTypeId(employeeTypeId string) *PatchEmployeeTypeReqBuilder {
+ builder.apiReq.PathParams.Set("employee_type_id", fmt.Sprint(employeeTypeId))
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *PatchEmployeeTypeReqBuilder) ClientToken(clientToken string) *PatchEmployeeTypeReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 更新人员类型数据
+func (builder *PatchEmployeeTypeReqBuilder) EmployeeType(employeeType *EmployeeType) *PatchEmployeeTypeReqBuilder {
+ builder.employeeType = employeeType
+ return builder
+}
+
+func (builder *PatchEmployeeTypeReqBuilder) Build() *PatchEmployeeTypeReq {
+ req := &PatchEmployeeTypeReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.employeeType
+ return req
+}
+
+type PatchEmployeeTypeReq struct {
+ apiReq *larkcore.ApiReq
+ EmployeeType *EmployeeType `body:""`
+}
+
+type PatchEmployeeTypeRespData struct {
+ EmployeeType *EmployeeType `json:"employee_type,omitempty"` // 人员类型
+}
+
+type PatchEmployeeTypeResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *PatchEmployeeTypeRespData `json:"data"` // 业务数据
+}
+
+func (resp *PatchEmployeeTypeResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateEmploymentReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ employmentCreate *EmploymentCreate
+}
+
+func NewCreateEmploymentReqBuilder() *CreateEmploymentReqBuilder {
+ builder := &CreateEmploymentReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *CreateEmploymentReqBuilder) ClientToken(clientToken string) *CreateEmploymentReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 创建人员的雇佣信息
+func (builder *CreateEmploymentReqBuilder) EmploymentCreate(employmentCreate *EmploymentCreate) *CreateEmploymentReqBuilder {
+ builder.employmentCreate = employmentCreate
+ return builder
+}
+
+func (builder *CreateEmploymentReqBuilder) Build() *CreateEmploymentReq {
+ req := &CreateEmploymentReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.employmentCreate
+ return req
+}
+
+type CreateEmploymentReq struct {
+ apiReq *larkcore.ApiReq
+ EmploymentCreate *EmploymentCreate `body:""`
+}
+
+type CreateEmploymentRespData struct {
+ Employment *EmploymentCreate `json:"employment,omitempty"` // 创建人员的雇佣信息成功返回信息
+}
+
+type CreateEmploymentResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateEmploymentRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateEmploymentResp) Success() bool {
+ return resp.Code == 0
+}
+
+type DeleteEmploymentReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewDeleteEmploymentReqBuilder() *DeleteEmploymentReqBuilder {
+ builder := &DeleteEmploymentReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 需要删除的雇佣信息对应的ID
+//
+// 示例值:65536878783232
+func (builder *DeleteEmploymentReqBuilder) EmploymentId(employmentId string) *DeleteEmploymentReqBuilder {
+ builder.apiReq.PathParams.Set("employment_id", fmt.Sprint(employmentId))
+ return builder
+}
+
+// 用户 ID 类型
+//
+// 示例值:people_corehr_id
+func (builder *DeleteEmploymentReqBuilder) UserIdType(userIdType string) *DeleteEmploymentReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+func (builder *DeleteEmploymentReqBuilder) Build() *DeleteEmploymentReq {
+ req := &DeleteEmploymentReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type DeleteEmploymentReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type DeleteEmploymentResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *DeleteEmploymentResp) Success() bool {
+ return resp.Code == 0
+}
+
+type PatchEmploymentReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ employment *Employment
+}
+
+func NewPatchEmploymentReqBuilder() *PatchEmploymentReqBuilder {
+ builder := &PatchEmploymentReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 雇员ID
+//
+// 示例值:1616161616
+func (builder *PatchEmploymentReqBuilder) EmploymentId(employmentId string) *PatchEmploymentReqBuilder {
+ builder.apiReq.PathParams.Set("employment_id", fmt.Sprint(employmentId))
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *PatchEmploymentReqBuilder) ClientToken(clientToken string) *PatchEmploymentReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 用户 ID 类型
+//
+// 示例值:people_corehr_id
+func (builder *PatchEmploymentReqBuilder) UserIdType(userIdType string) *PatchEmploymentReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 此次调用中使用的部门 ID 类型
+//
+// 示例值:department_id
+func (builder *PatchEmploymentReqBuilder) DepartmentIdType(departmentIdType string) *PatchEmploymentReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+// 更新雇佣信息
+func (builder *PatchEmploymentReqBuilder) Employment(employment *Employment) *PatchEmploymentReqBuilder {
+ builder.employment = employment
+ return builder
+}
+
+func (builder *PatchEmploymentReqBuilder) Build() *PatchEmploymentReq {
+ req := &PatchEmploymentReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.employment
+ return req
+}
+
+type PatchEmploymentReq struct {
+ apiReq *larkcore.ApiReq
+ Employment *Employment `body:""`
+}
+
+type PatchEmploymentRespData struct {
+ Employment *Employment `json:"employment,omitempty"` // 雇佣信息
+}
+
+type PatchEmploymentResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *PatchEmploymentRespData `json:"data"` // 业务数据
+}
+
+func (resp *PatchEmploymentResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetFileReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetFileReqBuilder() *GetFileReqBuilder {
+ builder := &GetFileReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 上传文件ID
+//
+// 示例值:150018109586e8ea745e47ae8feb3722dbe1d03a181336393633393133303431393831343930373235150100
+func (builder *GetFileReqBuilder) Id(id string) *GetFileReqBuilder {
+ builder.apiReq.PathParams.Set("id", fmt.Sprint(id))
+ return builder
+}
+
+func (builder *GetFileReqBuilder) Build() *GetFileReq {
+ req := &GetFileReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type GetFileReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetFileResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ File io.Reader `json:"-"`
+ FileName string `json:"-"`
+}
+
+func (resp *GetFileResp) Success() bool {
+ return resp.Code == 0
+}
+
+func (resp *GetFileResp) WriteFile(fileName string) error {
+ bs, err := ioutil.ReadAll(resp.File)
+ if err != nil {
+ return err
+ }
+
+ err = ioutil.WriteFile(fileName, bs, 0666)
+ if err != nil {
+ return err
+ }
+ return nil
+}
+
+type CreateJobReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ job *Job
+}
+
+func NewCreateJobReqBuilder() *CreateJobReqBuilder {
+ builder := &CreateJobReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *CreateJobReqBuilder) ClientToken(clientToken string) *CreateJobReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 创建职务
+func (builder *CreateJobReqBuilder) Job(job *Job) *CreateJobReqBuilder {
+ builder.job = job
+ return builder
+}
+
+func (builder *CreateJobReqBuilder) Build() *CreateJobReq {
+ req := &CreateJobReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.job
+ return req
+}
+
+type CreateJobReq struct {
+ apiReq *larkcore.ApiReq
+ Job *Job `body:""`
+}
+
+type CreateJobRespData struct {
+ Job *Job `json:"job,omitempty"` // 创建成功的Job信息
+}
+
+type CreateJobResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateJobRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateJobResp) Success() bool {
+ return resp.Code == 0
+}
+
+type DeleteJobReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewDeleteJobReqBuilder() *DeleteJobReqBuilder {
+ builder := &DeleteJobReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 需要删除的职务 ID
+//
+// 示例值:67163716371
+func (builder *DeleteJobReqBuilder) JobId(jobId string) *DeleteJobReqBuilder {
+ builder.apiReq.PathParams.Set("job_id", fmt.Sprint(jobId))
+ return builder
+}
+
+func (builder *DeleteJobReqBuilder) Build() *DeleteJobReq {
+ req := &DeleteJobReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type DeleteJobReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type DeleteJobResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *DeleteJobResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetJobReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetJobReqBuilder() *GetJobReqBuilder {
+ builder := &GetJobReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 职务 ID
+//
+// 示例值:151515
+func (builder *GetJobReqBuilder) JobId(jobId string) *GetJobReqBuilder {
+ builder.apiReq.PathParams.Set("job_id", fmt.Sprint(jobId))
+ return builder
+}
+
+func (builder *GetJobReqBuilder) Build() *GetJobReq {
+ req := &GetJobReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type GetJobReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetJobRespData struct {
+ Job *Job `json:"job,omitempty"` // 职务信息
+}
+
+type GetJobResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetJobRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetJobResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListJobReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListJobReqBuilder() *ListJobReqBuilder {
+ builder := &ListJobReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:1231231987
+func (builder *ListJobReqBuilder) PageToken(pageToken string) *ListJobReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListJobReqBuilder) PageSize(pageSize string) *ListJobReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 名称
+//
+// 示例值:keyword
+func (builder *ListJobReqBuilder) Name(name string) *ListJobReqBuilder {
+ builder.apiReq.QueryParams.Set("name", fmt.Sprint(name))
+ return builder
+}
+
+// 语言
+//
+// 示例值:zh
+func (builder *ListJobReqBuilder) QueryLanguage(queryLanguage string) *ListJobReqBuilder {
+ builder.apiReq.QueryParams.Set("query_language", fmt.Sprint(queryLanguage))
+ return builder
+}
+
+func (builder *ListJobReqBuilder) Build() *ListJobReq {
+ req := &ListJobReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListJobReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListJobRespData struct {
+ Items []*Job `json:"items,omitempty"` // 查询的职务信息
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type ListJobResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListJobRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListJobResp) Success() bool {
+ return resp.Code == 0
+}
+
+type PatchJobReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ job *Job
+}
+
+func NewPatchJobReqBuilder() *PatchJobReqBuilder {
+ builder := &PatchJobReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 职务ID
+//
+// 示例值:1616161616
+func (builder *PatchJobReqBuilder) JobId(jobId string) *PatchJobReqBuilder {
+ builder.apiReq.PathParams.Set("job_id", fmt.Sprint(jobId))
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *PatchJobReqBuilder) ClientToken(clientToken string) *PatchJobReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 更新职务
+func (builder *PatchJobReqBuilder) Job(job *Job) *PatchJobReqBuilder {
+ builder.job = job
+ return builder
+}
+
+func (builder *PatchJobReqBuilder) Build() *PatchJobReq {
+ req := &PatchJobReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.job
+ return req
+}
+
+type PatchJobReq struct {
+ apiReq *larkcore.ApiReq
+ Job *Job `body:""`
+}
+
+type PatchJobRespData struct {
+ Job *Job `json:"job,omitempty"` // 职务
+}
+
+type PatchJobResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *PatchJobRespData `json:"data"` // 业务数据
+}
+
+func (resp *PatchJobResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateJobChangeReqBodyBuilder struct {
+ transferMode int // 异动方式
+ transferModeFlag bool
+ employmentId string // 雇员id
+ employmentIdFlag bool
+ transferTypeUniqueIdentifier string // 异动类型唯一标识
+ transferTypeUniqueIdentifierFlag bool
+ flowId string // 异动流程ID
+ flowIdFlag bool
+ effectiveDate string // 生效日期
+ effectiveDateFlag bool
+ transferInfo *TransferInfo // 异动详细信息
+ transferInfoFlag bool
+ transferKey string // 异动记录标识符
+ transferKeyFlag bool
+ initiatorId string // 异动发起人 ID
+ initiatorIdFlag bool
+}
+
+func NewCreateJobChangeReqBodyBuilder() *CreateJobChangeReqBodyBuilder {
+ builder := &CreateJobChangeReqBodyBuilder{}
+ return builder
+}
+
+// 异动方式
+//
+//示例值:2
+func (builder *CreateJobChangeReqBodyBuilder) TransferMode(transferMode int) *CreateJobChangeReqBodyBuilder {
+ builder.transferMode = transferMode
+ builder.transferModeFlag = true
+ return builder
+}
+
+// 雇员id
+//
+//示例值:ou_a294793e8fa21529f2a60e3e9de45520
+func (builder *CreateJobChangeReqBodyBuilder) EmploymentId(employmentId string) *CreateJobChangeReqBodyBuilder {
+ builder.employmentId = employmentId
+ builder.employmentIdFlag = true
+ return builder
+}
+
+// 异动类型唯一标识
+//
+//示例值:internal_transfer
+func (builder *CreateJobChangeReqBodyBuilder) TransferTypeUniqueIdentifier(transferTypeUniqueIdentifier string) *CreateJobChangeReqBodyBuilder {
+ builder.transferTypeUniqueIdentifier = transferTypeUniqueIdentifier
+ builder.transferTypeUniqueIdentifierFlag = true
+ return builder
+}
+
+// 异动流程ID
+//
+//示例值:people_6963913041981490725_6983885526583627531
+func (builder *CreateJobChangeReqBodyBuilder) FlowId(flowId string) *CreateJobChangeReqBodyBuilder {
+ builder.flowId = flowId
+ builder.flowIdFlag = true
+ return builder
+}
+
+// 生效日期
+//
+//示例值:2022-03-01
+func (builder *CreateJobChangeReqBodyBuilder) EffectiveDate(effectiveDate string) *CreateJobChangeReqBodyBuilder {
+ builder.effectiveDate = effectiveDate
+ builder.effectiveDateFlag = true
+ return builder
+}
+
+// 异动详细信息
+//
+//示例值:
+func (builder *CreateJobChangeReqBodyBuilder) TransferInfo(transferInfo *TransferInfo) *CreateJobChangeReqBodyBuilder {
+ builder.transferInfo = transferInfo
+ builder.transferInfoFlag = true
+ return builder
+}
+
+// 异动记录标识符
+//
+//示例值:transfer_3627531
+func (builder *CreateJobChangeReqBodyBuilder) TransferKey(transferKey string) *CreateJobChangeReqBodyBuilder {
+ builder.transferKey = transferKey
+ builder.transferKeyFlag = true
+ return builder
+}
+
+// 异动发起人 ID
+//
+//示例值:ou_a294793e8fa21529f2a60e3e9de45520
+func (builder *CreateJobChangeReqBodyBuilder) InitiatorId(initiatorId string) *CreateJobChangeReqBodyBuilder {
+ builder.initiatorId = initiatorId
+ builder.initiatorIdFlag = true
+ return builder
+}
+
+func (builder *CreateJobChangeReqBodyBuilder) Build() *CreateJobChangeReqBody {
+ req := &CreateJobChangeReqBody{}
+ if builder.transferModeFlag {
+ req.TransferMode = &builder.transferMode
+ }
+ if builder.employmentIdFlag {
+ req.EmploymentId = &builder.employmentId
+ }
+ if builder.transferTypeUniqueIdentifierFlag {
+ req.TransferTypeUniqueIdentifier = &builder.transferTypeUniqueIdentifier
+ }
+ if builder.flowIdFlag {
+ req.FlowId = &builder.flowId
+ }
+ if builder.effectiveDateFlag {
+ req.EffectiveDate = &builder.effectiveDate
+ }
+ if builder.transferInfoFlag {
+ req.TransferInfo = builder.transferInfo
+ }
+ if builder.transferKeyFlag {
+ req.TransferKey = &builder.transferKey
+ }
+ if builder.initiatorIdFlag {
+ req.InitiatorId = &builder.initiatorId
+ }
+ return req
+}
+
+type CreateJobChangePathReqBodyBuilder struct {
+ transferMode int // 异动方式
+ transferModeFlag bool
+ employmentId string // 雇员id
+ employmentIdFlag bool
+ transferTypeUniqueIdentifier string // 异动类型唯一标识
+ transferTypeUniqueIdentifierFlag bool
+ flowId string // 异动流程ID
+ flowIdFlag bool
+ effectiveDate string // 生效日期
+ effectiveDateFlag bool
+ transferInfo *TransferInfo // 异动详细信息
+ transferInfoFlag bool
+ transferKey string // 异动记录标识符
+ transferKeyFlag bool
+ initiatorId string // 异动发起人 ID
+ initiatorIdFlag bool
+}
+
+func NewCreateJobChangePathReqBodyBuilder() *CreateJobChangePathReqBodyBuilder {
+ builder := &CreateJobChangePathReqBodyBuilder{}
+ return builder
+}
+
+// 异动方式
+//
+// 示例值:2
+func (builder *CreateJobChangePathReqBodyBuilder) TransferMode(transferMode int) *CreateJobChangePathReqBodyBuilder {
+ builder.transferMode = transferMode
+ builder.transferModeFlag = true
+ return builder
+}
+
+// 雇员id
+//
+// 示例值:ou_a294793e8fa21529f2a60e3e9de45520
+func (builder *CreateJobChangePathReqBodyBuilder) EmploymentId(employmentId string) *CreateJobChangePathReqBodyBuilder {
+ builder.employmentId = employmentId
+ builder.employmentIdFlag = true
+ return builder
+}
+
+// 异动类型唯一标识
+//
+// 示例值:internal_transfer
+func (builder *CreateJobChangePathReqBodyBuilder) TransferTypeUniqueIdentifier(transferTypeUniqueIdentifier string) *CreateJobChangePathReqBodyBuilder {
+ builder.transferTypeUniqueIdentifier = transferTypeUniqueIdentifier
+ builder.transferTypeUniqueIdentifierFlag = true
+ return builder
+}
+
+// 异动流程ID
+//
+// 示例值:people_6963913041981490725_6983885526583627531
+func (builder *CreateJobChangePathReqBodyBuilder) FlowId(flowId string) *CreateJobChangePathReqBodyBuilder {
+ builder.flowId = flowId
+ builder.flowIdFlag = true
+ return builder
+}
+
+// 生效日期
+//
+// 示例值:2022-03-01
+func (builder *CreateJobChangePathReqBodyBuilder) EffectiveDate(effectiveDate string) *CreateJobChangePathReqBodyBuilder {
+ builder.effectiveDate = effectiveDate
+ builder.effectiveDateFlag = true
+ return builder
+}
+
+// 异动详细信息
+//
+// 示例值:
+func (builder *CreateJobChangePathReqBodyBuilder) TransferInfo(transferInfo *TransferInfo) *CreateJobChangePathReqBodyBuilder {
+ builder.transferInfo = transferInfo
+ builder.transferInfoFlag = true
+ return builder
+}
+
+// 异动记录标识符
+//
+// 示例值:transfer_3627531
+func (builder *CreateJobChangePathReqBodyBuilder) TransferKey(transferKey string) *CreateJobChangePathReqBodyBuilder {
+ builder.transferKey = transferKey
+ builder.transferKeyFlag = true
+ return builder
+}
+
+// 异动发起人 ID
+//
+// 示例值:ou_a294793e8fa21529f2a60e3e9de45520
+func (builder *CreateJobChangePathReqBodyBuilder) InitiatorId(initiatorId string) *CreateJobChangePathReqBodyBuilder {
+ builder.initiatorId = initiatorId
+ builder.initiatorIdFlag = true
+ return builder
+}
+
+func (builder *CreateJobChangePathReqBodyBuilder) Build() (*CreateJobChangeReqBody, error) {
+ req := &CreateJobChangeReqBody{}
+ if builder.transferModeFlag {
+ req.TransferMode = &builder.transferMode
+ }
+ if builder.employmentIdFlag {
+ req.EmploymentId = &builder.employmentId
+ }
+ if builder.transferTypeUniqueIdentifierFlag {
+ req.TransferTypeUniqueIdentifier = &builder.transferTypeUniqueIdentifier
+ }
+ if builder.flowIdFlag {
+ req.FlowId = &builder.flowId
+ }
+ if builder.effectiveDateFlag {
+ req.EffectiveDate = &builder.effectiveDate
+ }
+ if builder.transferInfoFlag {
+ req.TransferInfo = builder.transferInfo
+ }
+ if builder.transferKeyFlag {
+ req.TransferKey = &builder.transferKey
+ }
+ if builder.initiatorIdFlag {
+ req.InitiatorId = &builder.initiatorId
+ }
+ return req, nil
+}
+
+type CreateJobChangeReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *CreateJobChangeReqBody
+}
+
+func NewCreateJobChangeReqBuilder() *CreateJobChangeReqBuilder {
+ builder := &CreateJobChangeReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:open_id
+func (builder *CreateJobChangeReqBuilder) UserIdType(userIdType string) *CreateJobChangeReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 此次调用中使用的部门 ID 类型
+//
+// 示例值:people_corehr_department_id
+func (builder *CreateJobChangeReqBuilder) DepartmentIdType(departmentIdType string) *CreateJobChangeReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+// 创建员工异动信息
+func (builder *CreateJobChangeReqBuilder) Body(body *CreateJobChangeReqBody) *CreateJobChangeReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *CreateJobChangeReqBuilder) Build() *CreateJobChangeReq {
+ req := &CreateJobChangeReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type CreateJobChangeReqBody struct {
+ TransferMode *int `json:"transfer_mode,omitempty"` // 异动方式
+ EmploymentId *string `json:"employment_id,omitempty"` // 雇员id
+ TransferTypeUniqueIdentifier *string `json:"transfer_type_unique_identifier,omitempty"` // 异动类型唯一标识
+ FlowId *string `json:"flow_id,omitempty"` // 异动流程ID
+ EffectiveDate *string `json:"effective_date,omitempty"` // 生效日期
+ TransferInfo *TransferInfo `json:"transfer_info,omitempty"` // 异动详细信息
+ TransferKey *string `json:"transfer_key,omitempty"` // 异动记录标识符
+ InitiatorId *string `json:"initiator_id,omitempty"` // 异动发起人 ID
+}
+
+type CreateJobChangeReq struct {
+ apiReq *larkcore.ApiReq
+ Body *CreateJobChangeReqBody `body:""`
+}
+
+type CreateJobChangeRespData struct {
+ JobChangeId *string `json:"job_change_id,omitempty"` // 异动记录 id
+ EmploymentId *string `json:"employment_id,omitempty"` // 雇员 id
+ Status *string `json:"status,omitempty"` // 异动状态
+ TransferTypeUniqueIdentifier *string `json:"transfer_type_unique_identifier,omitempty"` // 异动类型
+ TransferReasonUniqueIdentifier *string `json:"transfer_reason_unique_identifier,omitempty"` // 异动原因
+ ProcessId *string `json:"process_id,omitempty"` // 异动流程 id
+ EffectiveDate *string `json:"effective_date,omitempty"` // 生效时间
+ CreatedTime *string `json:"created_time,omitempty"` // 创建时间
+ TransferInfo *TransferInfo `json:"transfer_info,omitempty"` // 异动详细信息
+}
+
+type CreateJobChangeResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateJobChangeRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateJobChangeResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateJobDataReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ jobData *JobData
+}
+
+func NewCreateJobDataReqBuilder() *CreateJobDataReqBuilder {
+ builder := &CreateJobDataReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *CreateJobDataReqBuilder) ClientToken(clientToken string) *CreateJobDataReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 用户 ID 类型
+//
+// 示例值:people_corehr_id
+func (builder *CreateJobDataReqBuilder) UserIdType(userIdType string) *CreateJobDataReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 此次调用中使用的部门 ID 类型
+//
+// 示例值:open_department_id
+func (builder *CreateJobDataReqBuilder) DepartmentIdType(departmentIdType string) *CreateJobDataReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+// 在系统中第一次创建员工任职数据,通常在员工入职或者做数据批量导入的时候使用,【任职原因】只支持填写“入职”
+func (builder *CreateJobDataReqBuilder) JobData(jobData *JobData) *CreateJobDataReqBuilder {
+ builder.jobData = jobData
+ return builder
+}
+
+func (builder *CreateJobDataReqBuilder) Build() *CreateJobDataReq {
+ req := &CreateJobDataReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.jobData
+ return req
+}
+
+type CreateJobDataReq struct {
+ apiReq *larkcore.ApiReq
+ JobData *JobData `body:""`
+}
+
+type CreateJobDataRespData struct {
+ JobData *JobData `json:"job_data,omitempty"` // 创建成功返回job data信息
+}
+
+type CreateJobDataResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateJobDataRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateJobDataResp) Success() bool {
+ return resp.Code == 0
+}
+
+type DeleteJobDataReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewDeleteJobDataReqBuilder() *DeleteJobDataReqBuilder {
+ builder := &DeleteJobDataReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 需要删除的任职信息 ID
+//
+// 示例值:467642764726472
+func (builder *DeleteJobDataReqBuilder) JobDataId(jobDataId string) *DeleteJobDataReqBuilder {
+ builder.apiReq.PathParams.Set("job_data_id", fmt.Sprint(jobDataId))
+ return builder
+}
+
+func (builder *DeleteJobDataReqBuilder) Build() *DeleteJobDataReq {
+ req := &DeleteJobDataReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type DeleteJobDataReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type DeleteJobDataResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *DeleteJobDataResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetJobDataReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetJobDataReqBuilder() *GetJobDataReqBuilder {
+ builder := &GetJobDataReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 任职信息 ID
+//
+// 示例值:151515
+func (builder *GetJobDataReqBuilder) JobDataId(jobDataId string) *GetJobDataReqBuilder {
+ builder.apiReq.PathParams.Set("job_data_id", fmt.Sprint(jobDataId))
+ return builder
+}
+
+// 用户 ID 类型
+//
+// 示例值:people_corehr_id
+func (builder *GetJobDataReqBuilder) UserIdType(userIdType string) *GetJobDataReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 此次调用中使用的部门 ID 类型
+//
+// 示例值:open_department_id
+func (builder *GetJobDataReqBuilder) DepartmentIdType(departmentIdType string) *GetJobDataReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+func (builder *GetJobDataReqBuilder) Build() *GetJobDataReq {
+ req := &GetJobDataReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type GetJobDataReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetJobDataRespData struct {
+ JobData *JobData `json:"job_data,omitempty"` // 任职信息
+}
+
+type GetJobDataResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetJobDataRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetJobDataResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListJobDataReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListJobDataReqBuilder() *ListJobDataReqBuilder {
+ builder := &ListJobDataReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:6994718879515739656
+func (builder *ListJobDataReqBuilder) PageToken(pageToken string) *ListJobDataReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListJobDataReqBuilder) PageSize(pageSize string) *ListJobDataReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 雇佣 ID
+//
+// 示例值:7072306364927985196
+func (builder *ListJobDataReqBuilder) EmploymentId(employmentId string) *ListJobDataReqBuilder {
+ builder.apiReq.QueryParams.Set("employment_id", fmt.Sprint(employmentId))
+ return builder
+}
+
+// 任职信息 ID 列表,最大 100 个(不传则默认查询全部任职信息)
+//
+// 示例值:["6919733291281024526", "6919733291281024527"]
+func (builder *ListJobDataReqBuilder) JobDataIdList(jobDataIdList []string) *ListJobDataReqBuilder {
+ for _, v := range jobDataIdList {
+ builder.apiReq.QueryParams.Add("job_data_id_list", fmt.Sprint(v))
+ }
+ return builder
+}
+
+// 部门 ID
+//
+// 示例值:6887868781834536462
+func (builder *ListJobDataReqBuilder) DepartmentId(departmentId string) *ListJobDataReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id", fmt.Sprint(departmentId))
+ return builder
+}
+
+// 职务 ID
+//
+// 示例值:6893014062142064135
+func (builder *ListJobDataReqBuilder) JobId(jobId string) *ListJobDataReqBuilder {
+ builder.apiReq.QueryParams.Set("job_id", fmt.Sprint(jobId))
+ return builder
+}
+
+// 是否获取所有任职记录,true 为获取员工所有版本的任职记录,false 为仅获取当前生效的任职记录,默认为 false
+//
+// 示例值:false
+func (builder *ListJobDataReqBuilder) GetAllVersion(getAllVersion bool) *ListJobDataReqBuilder {
+ builder.apiReq.QueryParams.Set("get_all_version", fmt.Sprint(getAllVersion))
+ return builder
+}
+
+// 用户 ID 类型
+//
+// 示例值:people_corehr_id
+func (builder *ListJobDataReqBuilder) UserIdType(userIdType string) *ListJobDataReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 此次调用中使用的部门 ID 类型
+//
+// 示例值:open_department_id
+func (builder *ListJobDataReqBuilder) DepartmentIdType(departmentIdType string) *ListJobDataReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+func (builder *ListJobDataReqBuilder) Build() *ListJobDataReq {
+ req := &ListJobDataReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListJobDataReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListJobDataRespData struct {
+ Items []*JobData `json:"items,omitempty"` // 查询的任职信息
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type ListJobDataResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListJobDataRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListJobDataResp) Success() bool {
+ return resp.Code == 0
+}
+
+type PatchJobDataReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ jobData *JobData
+}
+
+func NewPatchJobDataReqBuilder() *PatchJobDataReqBuilder {
+ builder := &PatchJobDataReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 任职信息ID
+//
+// 示例值:151515
+func (builder *PatchJobDataReqBuilder) JobDataId(jobDataId string) *PatchJobDataReqBuilder {
+ builder.apiReq.PathParams.Set("job_data_id", fmt.Sprint(jobDataId))
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *PatchJobDataReqBuilder) ClientToken(clientToken string) *PatchJobDataReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 用户 ID 类型
+//
+// 示例值:people_corehr_id
+func (builder *PatchJobDataReqBuilder) UserIdType(userIdType string) *PatchJobDataReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 此次调用中使用的部门 ID 类型
+//
+// 示例值:open_department_id
+func (builder *PatchJobDataReqBuilder) DepartmentIdType(departmentIdType string) *PatchJobDataReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+// 更新任职信息
+func (builder *PatchJobDataReqBuilder) JobData(jobData *JobData) *PatchJobDataReqBuilder {
+ builder.jobData = jobData
+ return builder
+}
+
+func (builder *PatchJobDataReqBuilder) Build() *PatchJobDataReq {
+ req := &PatchJobDataReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.jobData
+ return req
+}
+
+type PatchJobDataReq struct {
+ apiReq *larkcore.ApiReq
+ JobData *JobData `body:""`
+}
+
+type PatchJobDataRespData struct {
+ JobData *JobData `json:"job_data,omitempty"` // 任职信息
+}
+
+type PatchJobDataResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *PatchJobDataRespData `json:"data"` // 业务数据
+}
+
+func (resp *PatchJobDataResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateJobFamilyReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ jobFamily *JobFamily
+}
+
+func NewCreateJobFamilyReqBuilder() *CreateJobFamilyReqBuilder {
+ builder := &CreateJobFamilyReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *CreateJobFamilyReqBuilder) ClientToken(clientToken string) *CreateJobFamilyReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 创建职务序列
+func (builder *CreateJobFamilyReqBuilder) JobFamily(jobFamily *JobFamily) *CreateJobFamilyReqBuilder {
+ builder.jobFamily = jobFamily
+ return builder
+}
+
+func (builder *CreateJobFamilyReqBuilder) Build() *CreateJobFamilyReq {
+ req := &CreateJobFamilyReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.jobFamily
+ return req
+}
+
+type CreateJobFamilyReq struct {
+ apiReq *larkcore.ApiReq
+ JobFamily *JobFamily `body:""`
+}
+
+type CreateJobFamilyRespData struct {
+ JobFamily *JobFamily `json:"job_family,omitempty"` // 创建成功的职务序列信息
+}
+
+type CreateJobFamilyResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateJobFamilyRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateJobFamilyResp) Success() bool {
+ return resp.Code == 0
+}
+
+type DeleteJobFamilyReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewDeleteJobFamilyReqBuilder() *DeleteJobFamilyReqBuilder {
+ builder := &DeleteJobFamilyReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 需要删除的职务序列 ID
+//
+// 示例值:5425424525
+func (builder *DeleteJobFamilyReqBuilder) JobFamilyId(jobFamilyId string) *DeleteJobFamilyReqBuilder {
+ builder.apiReq.PathParams.Set("job_family_id", fmt.Sprint(jobFamilyId))
+ return builder
+}
+
+func (builder *DeleteJobFamilyReqBuilder) Build() *DeleteJobFamilyReq {
+ req := &DeleteJobFamilyReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type DeleteJobFamilyReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type DeleteJobFamilyResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *DeleteJobFamilyResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetJobFamilyReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetJobFamilyReqBuilder() *GetJobFamilyReqBuilder {
+ builder := &GetJobFamilyReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 职务序列 ID
+//
+// 示例值:1554548
+func (builder *GetJobFamilyReqBuilder) JobFamilyId(jobFamilyId string) *GetJobFamilyReqBuilder {
+ builder.apiReq.PathParams.Set("job_family_id", fmt.Sprint(jobFamilyId))
+ return builder
+}
+
+func (builder *GetJobFamilyReqBuilder) Build() *GetJobFamilyReq {
+ req := &GetJobFamilyReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type GetJobFamilyReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetJobFamilyRespData struct {
+ JobFamily *JobFamily `json:"job_family,omitempty"` // 职务序列信息
+}
+
+type GetJobFamilyResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetJobFamilyRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetJobFamilyResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListJobFamilyReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListJobFamilyReqBuilder() *ListJobFamilyReqBuilder {
+ builder := &ListJobFamilyReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:1231231987
+func (builder *ListJobFamilyReqBuilder) PageToken(pageToken string) *ListJobFamilyReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListJobFamilyReqBuilder) PageSize(pageSize string) *ListJobFamilyReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+func (builder *ListJobFamilyReqBuilder) Build() *ListJobFamilyReq {
+ req := &ListJobFamilyReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListJobFamilyReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListJobFamilyRespData struct {
+ Items []*JobFamily `json:"items,omitempty"` // 查询的职务序列信息
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type ListJobFamilyResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListJobFamilyRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListJobFamilyResp) Success() bool {
+ return resp.Code == 0
+}
+
+type PatchJobFamilyReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ jobFamily *JobFamily
+}
+
+func NewPatchJobFamilyReqBuilder() *PatchJobFamilyReqBuilder {
+ builder := &PatchJobFamilyReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 序列ID
+//
+// 示例值:1616161616
+func (builder *PatchJobFamilyReqBuilder) JobFamilyId(jobFamilyId string) *PatchJobFamilyReqBuilder {
+ builder.apiReq.PathParams.Set("job_family_id", fmt.Sprint(jobFamilyId))
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *PatchJobFamilyReqBuilder) ClientToken(clientToken string) *PatchJobFamilyReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 更新职务序列
+func (builder *PatchJobFamilyReqBuilder) JobFamily(jobFamily *JobFamily) *PatchJobFamilyReqBuilder {
+ builder.jobFamily = jobFamily
+ return builder
+}
+
+func (builder *PatchJobFamilyReqBuilder) Build() *PatchJobFamilyReq {
+ req := &PatchJobFamilyReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.jobFamily
+ return req
+}
+
+type PatchJobFamilyReq struct {
+ apiReq *larkcore.ApiReq
+ JobFamily *JobFamily `body:""`
+}
+
+type PatchJobFamilyRespData struct {
+ JobFamily *JobFamily `json:"job_family,omitempty"` // 职务序列
+}
+
+type PatchJobFamilyResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *PatchJobFamilyRespData `json:"data"` // 业务数据
+}
+
+func (resp *PatchJobFamilyResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateJobLevelReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ jobLevel *JobLevel
+}
+
+func NewCreateJobLevelReqBuilder() *CreateJobLevelReqBuilder {
+ builder := &CreateJobLevelReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *CreateJobLevelReqBuilder) ClientToken(clientToken string) *CreateJobLevelReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 创建职务级别
+func (builder *CreateJobLevelReqBuilder) JobLevel(jobLevel *JobLevel) *CreateJobLevelReqBuilder {
+ builder.jobLevel = jobLevel
+ return builder
+}
+
+func (builder *CreateJobLevelReqBuilder) Build() *CreateJobLevelReq {
+ req := &CreateJobLevelReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.jobLevel
+ return req
+}
+
+type CreateJobLevelReq struct {
+ apiReq *larkcore.ApiReq
+ JobLevel *JobLevel `body:""`
+}
+
+type CreateJobLevelRespData struct {
+ JobLevel *JobLevel `json:"job_level,omitempty"` // 创建成功的职务级别信息
+}
+
+type CreateJobLevelResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateJobLevelRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateJobLevelResp) Success() bool {
+ return resp.Code == 0
+}
+
+type DeleteJobLevelReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewDeleteJobLevelReqBuilder() *DeleteJobLevelReqBuilder {
+ builder := &DeleteJobLevelReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 需要删除的职务级别 ID
+//
+// 示例值:5423452542
+func (builder *DeleteJobLevelReqBuilder) JobLevelId(jobLevelId string) *DeleteJobLevelReqBuilder {
+ builder.apiReq.PathParams.Set("job_level_id", fmt.Sprint(jobLevelId))
+ return builder
+}
+
+func (builder *DeleteJobLevelReqBuilder) Build() *DeleteJobLevelReq {
+ req := &DeleteJobLevelReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type DeleteJobLevelReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type DeleteJobLevelResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *DeleteJobLevelResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetJobLevelReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetJobLevelReqBuilder() *GetJobLevelReqBuilder {
+ builder := &GetJobLevelReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 职务级别 ID
+//
+// 示例值:1515
+func (builder *GetJobLevelReqBuilder) JobLevelId(jobLevelId string) *GetJobLevelReqBuilder {
+ builder.apiReq.PathParams.Set("job_level_id", fmt.Sprint(jobLevelId))
+ return builder
+}
+
+func (builder *GetJobLevelReqBuilder) Build() *GetJobLevelReq {
+ req := &GetJobLevelReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type GetJobLevelReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetJobLevelRespData struct {
+ JobLevel *JobLevel `json:"job_level,omitempty"` // 职务级别信息
+}
+
+type GetJobLevelResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetJobLevelRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetJobLevelResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListJobLevelReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListJobLevelReqBuilder() *ListJobLevelReqBuilder {
+ builder := &ListJobLevelReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:1231231987
+func (builder *ListJobLevelReqBuilder) PageToken(pageToken string) *ListJobLevelReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListJobLevelReqBuilder) PageSize(pageSize string) *ListJobLevelReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+func (builder *ListJobLevelReqBuilder) Build() *ListJobLevelReq {
+ req := &ListJobLevelReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListJobLevelReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListJobLevelRespData struct {
+ Items []*JobLevel `json:"items,omitempty"` // 查询的职务级别信息
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type ListJobLevelResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListJobLevelRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListJobLevelResp) Success() bool {
+ return resp.Code == 0
+}
+
+type PatchJobLevelReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ jobLevel *JobLevel
+}
+
+func NewPatchJobLevelReqBuilder() *PatchJobLevelReqBuilder {
+ builder := &PatchJobLevelReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 级别ID
+//
+// 示例值:1616161616
+func (builder *PatchJobLevelReqBuilder) JobLevelId(jobLevelId string) *PatchJobLevelReqBuilder {
+ builder.apiReq.PathParams.Set("job_level_id", fmt.Sprint(jobLevelId))
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *PatchJobLevelReqBuilder) ClientToken(clientToken string) *PatchJobLevelReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 更新职务级别
+func (builder *PatchJobLevelReqBuilder) JobLevel(jobLevel *JobLevel) *PatchJobLevelReqBuilder {
+ builder.jobLevel = jobLevel
+ return builder
+}
+
+func (builder *PatchJobLevelReqBuilder) Build() *PatchJobLevelReq {
+ req := &PatchJobLevelReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.jobLevel
+ return req
+}
+
+type PatchJobLevelReq struct {
+ apiReq *larkcore.ApiReq
+ JobLevel *JobLevel `body:""`
+}
+
+type PatchJobLevelRespData struct {
+ JobLevel *JobLevel `json:"job_level,omitempty"` // 职务级别
+}
+
+type PatchJobLevelResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *PatchJobLevelRespData `json:"data"` // 业务数据
+}
+
+func (resp *PatchJobLevelResp) Success() bool {
+ return resp.Code == 0
+}
+
+type LeaveBalancesLeaveReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewLeaveBalancesLeaveReqBuilder() *LeaveBalancesLeaveReqBuilder {
+ builder := &LeaveBalancesLeaveReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
+func (builder *LeaveBalancesLeaveReqBuilder) PageToken(pageToken string) *LeaveBalancesLeaveReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大20
+//
+// 示例值:20
+func (builder *LeaveBalancesLeaveReqBuilder) PageSize(pageSize string) *LeaveBalancesLeaveReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 查询截止日期,即截止到某天余额数据的日期(不传则默认为当天)
+//
+// 示例值:2022-07-29
+func (builder *LeaveBalancesLeaveReqBuilder) AsOfDate(asOfDate string) *LeaveBalancesLeaveReqBuilder {
+ builder.apiReq.QueryParams.Set("as_of_date", fmt.Sprint(asOfDate))
+ return builder
+}
+
+// 员工 ID 列表,最大 100 个(不传则默认查询全部员工)
+//
+// 示例值:["6919733291281024526"]
+func (builder *LeaveBalancesLeaveReqBuilder) EmploymentIdList(employmentIdList []string) *LeaveBalancesLeaveReqBuilder {
+ for _, v := range employmentIdList {
+ builder.apiReq.QueryParams.Add("employment_id_list", fmt.Sprint(v))
+ }
+ return builder
+}
+
+// 用户 ID 类型
+//
+// 示例值:people_corehr_id
+func (builder *LeaveBalancesLeaveReqBuilder) UserIdType(userIdType string) *LeaveBalancesLeaveReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+func (builder *LeaveBalancesLeaveReqBuilder) Build() *LeaveBalancesLeaveReq {
+ req := &LeaveBalancesLeaveReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type LeaveBalancesLeaveReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type LeaveBalancesLeaveRespData struct {
+ EmploymentLeaveBalanceList []*EmploymentLeaveBalance `json:"employment_leave_balance_list,omitempty"` // 员工假期余额信息列表
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type LeaveBalancesLeaveResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *LeaveBalancesLeaveRespData `json:"data"` // 业务数据
+}
+
+func (resp *LeaveBalancesLeaveResp) Success() bool {
+ return resp.Code == 0
+}
+
+type LeaveRequestHistoryLeaveReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewLeaveRequestHistoryLeaveReqBuilder() *LeaveRequestHistoryLeaveReqBuilder {
+ builder := &LeaveRequestHistoryLeaveReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
+func (builder *LeaveRequestHistoryLeaveReqBuilder) PageToken(pageToken string) *LeaveRequestHistoryLeaveReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *LeaveRequestHistoryLeaveReqBuilder) PageSize(pageSize string) *LeaveRequestHistoryLeaveReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 员工 ID 列表,最大 100 个(不传则默认查询全部员工)
+//
+// 示例值:["6919733291281024526"]
+func (builder *LeaveRequestHistoryLeaveReqBuilder) EmploymentIdList(employmentIdList []string) *LeaveRequestHistoryLeaveReqBuilder {
+ for _, v := range employmentIdList {
+ builder.apiReq.QueryParams.Add("employment_id_list", fmt.Sprint(v))
+ }
+ return builder
+}
+
+// 休假发起人 ID 列表,最大 100 个
+//
+// 示例值:["6919733291281024526"]
+func (builder *LeaveRequestHistoryLeaveReqBuilder) InitiatorIdList(initiatorIdList []string) *LeaveRequestHistoryLeaveReqBuilder {
+ for _, v := range initiatorIdList {
+ builder.apiReq.QueryParams.Add("initiator_id_list", fmt.Sprint(v))
+ }
+ return builder
+}
+
+// 请假记录的状态;;可选值有:;;- 1:已通过;;- 2:审批中;;- 3:审批中(更正);;- 4:审批中(取消休假);;- 5:审批中(返岗);;- 6:已返岗;;- 7:已拒绝;;- 8:已取消;;- 9:已撤回
+//
+// 示例值:["1", "2"]
+func (builder *LeaveRequestHistoryLeaveReqBuilder) LeaveRequestStatus(leaveRequestStatus []string) *LeaveRequestHistoryLeaveReqBuilder {
+ for _, v := range leaveRequestStatus {
+ builder.apiReq.QueryParams.Add("leave_request_status", fmt.Sprint(v))
+ }
+ return builder
+}
+
+// 假期类型 ID 列表,枚举值可通过【获取假期类型列表】接口获取
+//
+// 示例值:["1"]
+func (builder *LeaveRequestHistoryLeaveReqBuilder) LeaveTypeIdList(leaveTypeIdList []string) *LeaveRequestHistoryLeaveReqBuilder {
+ for _, v := range leaveTypeIdList {
+ builder.apiReq.QueryParams.Add("leave_type_id_list", fmt.Sprint(v))
+ }
+ return builder
+}
+
+// 休假开始时间晚于等于的日期
+//
+// 示例值:2022-07-20 morning
+func (builder *LeaveRequestHistoryLeaveReqBuilder) LeaveStartDateMin(leaveStartDateMin string) *LeaveRequestHistoryLeaveReqBuilder {
+ builder.apiReq.QueryParams.Set("leave_start_date_min", fmt.Sprint(leaveStartDateMin))
+ return builder
+}
+
+// 休假开始时间早于等于的日期
+//
+// 示例值:2022-07-20 morning
+func (builder *LeaveRequestHistoryLeaveReqBuilder) LeaveStartDateMax(leaveStartDateMax string) *LeaveRequestHistoryLeaveReqBuilder {
+ builder.apiReq.QueryParams.Set("leave_start_date_max", fmt.Sprint(leaveStartDateMax))
+ return builder
+}
+
+// 休假结束时间晚于等于的日期
+//
+// 示例值:2022-07-20 morning
+func (builder *LeaveRequestHistoryLeaveReqBuilder) LeaveEndDateMin(leaveEndDateMin string) *LeaveRequestHistoryLeaveReqBuilder {
+ builder.apiReq.QueryParams.Set("leave_end_date_min", fmt.Sprint(leaveEndDateMin))
+ return builder
+}
+
+// 休假结束时间早于等于的日期
+//
+// 示例值:2022-07-20 morning
+func (builder *LeaveRequestHistoryLeaveReqBuilder) LeaveEndDateMax(leaveEndDateMax string) *LeaveRequestHistoryLeaveReqBuilder {
+ builder.apiReq.QueryParams.Set("leave_end_date_max", fmt.Sprint(leaveEndDateMax))
+ return builder
+}
+
+// 休假发起时间晚于等于的日期
+//
+// 示例值:2022-07-20 morning
+func (builder *LeaveRequestHistoryLeaveReqBuilder) LeaveSubmitDateMin(leaveSubmitDateMin string) *LeaveRequestHistoryLeaveReqBuilder {
+ builder.apiReq.QueryParams.Set("leave_submit_date_min", fmt.Sprint(leaveSubmitDateMin))
+ return builder
+}
+
+// 休假发起时间早于等于的日期
+//
+// 示例值:2022-07-20 morning
+func (builder *LeaveRequestHistoryLeaveReqBuilder) LeaveSubmitDateMax(leaveSubmitDateMax string) *LeaveRequestHistoryLeaveReqBuilder {
+ builder.apiReq.QueryParams.Set("leave_submit_date_max", fmt.Sprint(leaveSubmitDateMax))
+ return builder
+}
+
+// 用户 ID 类型
+//
+// 示例值:people_corehr_id
+func (builder *LeaveRequestHistoryLeaveReqBuilder) UserIdType(userIdType string) *LeaveRequestHistoryLeaveReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 请假记录更新时间晚于等于的时间
+//
+// 示例值:2022-10-24 10:00:00
+func (builder *LeaveRequestHistoryLeaveReqBuilder) LeaveUpdateTimeMin(leaveUpdateTimeMin string) *LeaveRequestHistoryLeaveReqBuilder {
+ builder.apiReq.QueryParams.Set("leave_update_time_min", fmt.Sprint(leaveUpdateTimeMin))
+ return builder
+}
+
+// 请假记录更新时间早于等于的时间
+//
+// 示例值:2022-10-24 10:00:00
+func (builder *LeaveRequestHistoryLeaveReqBuilder) LeaveUpdateTimeMax(leaveUpdateTimeMax string) *LeaveRequestHistoryLeaveReqBuilder {
+ builder.apiReq.QueryParams.Set("leave_update_time_max", fmt.Sprint(leaveUpdateTimeMax))
+ return builder
+}
+
+func (builder *LeaveRequestHistoryLeaveReqBuilder) Build() *LeaveRequestHistoryLeaveReq {
+ req := &LeaveRequestHistoryLeaveReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type LeaveRequestHistoryLeaveReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type LeaveRequestHistoryLeaveRespData struct {
+ LeaveRequestList []*LeaveRequest `json:"leave_request_list,omitempty"` // 请假记录信息列表
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type LeaveRequestHistoryLeaveResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *LeaveRequestHistoryLeaveRespData `json:"data"` // 业务数据
+}
+
+func (resp *LeaveRequestHistoryLeaveResp) Success() bool {
+ return resp.Code == 0
+}
+
+type LeaveTypesLeaveReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewLeaveTypesLeaveReqBuilder() *LeaveTypesLeaveReqBuilder {
+ builder := &LeaveTypesLeaveReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
+func (builder *LeaveTypesLeaveReqBuilder) PageToken(pageToken string) *LeaveTypesLeaveReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *LeaveTypesLeaveReqBuilder) PageSize(pageSize string) *LeaveTypesLeaveReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 假期类型状态(不传则为全部);;可选值有:;;- 1:已启用;;- 2:已停用
+//
+// 示例值:1
+func (builder *LeaveTypesLeaveReqBuilder) Status(status string) *LeaveTypesLeaveReqBuilder {
+ builder.apiReq.QueryParams.Set("status", fmt.Sprint(status))
+ return builder
+}
+
+// 用户 ID 类型
+//
+// 示例值:people_corehr_id
+func (builder *LeaveTypesLeaveReqBuilder) UserIdType(userIdType string) *LeaveTypesLeaveReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+func (builder *LeaveTypesLeaveReqBuilder) Build() *LeaveTypesLeaveReq {
+ req := &LeaveTypesLeaveReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type LeaveTypesLeaveReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type LeaveTypesLeaveRespData struct {
+ LeaveTypeList []*LeaveType `json:"leave_type_list,omitempty"` // 假期类型列表
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type LeaveTypesLeaveResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *LeaveTypesLeaveRespData `json:"data"` // 业务数据
+}
+
+func (resp *LeaveTypesLeaveResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateLeaveGrantingRecordReqBodyBuilder struct {
+ leaveTypeId string // 假期类型 ID,枚举值可通过【获取假期类型列表】接口获取(若假期类型下存在假期子类,此处仅支持传入假期子类的 ID)
+ leaveTypeIdFlag bool
+ employmentId string // 员工 ID
+ employmentIdFlag bool
+ grantingQuantity string // 授予数量
+ grantingQuantityFlag bool
+ grantingUnit int // 授予时长单位;;可选值有:;;- 1: 天;- 2: 小时
+ grantingUnitFlag bool
+ effectiveDate string // 生效时间
+ effectiveDateFlag bool
+ reason []*I18n // 授予原因
+ reasonFlag bool
+ externalId string // 自定义外部 ID,可用于避免数据重复写入(不能超过 64 字符)
+ externalIdFlag bool
+}
+
+func NewCreateLeaveGrantingRecordReqBodyBuilder() *CreateLeaveGrantingRecordReqBodyBuilder {
+ builder := &CreateLeaveGrantingRecordReqBodyBuilder{}
+ return builder
+}
+
+// 假期类型 ID,枚举值可通过【获取假期类型列表】接口获取(若假期类型下存在假期子类,此处仅支持传入假期子类的 ID)
+//
+//示例值:7111688079785723436
+func (builder *CreateLeaveGrantingRecordReqBodyBuilder) LeaveTypeId(leaveTypeId string) *CreateLeaveGrantingRecordReqBodyBuilder {
+ builder.leaveTypeId = leaveTypeId
+ builder.leaveTypeIdFlag = true
+ return builder
+}
+
+// 员工 ID
+//
+//示例值:6982509313466189342
+func (builder *CreateLeaveGrantingRecordReqBodyBuilder) EmploymentId(employmentId string) *CreateLeaveGrantingRecordReqBodyBuilder {
+ builder.employmentId = employmentId
+ builder.employmentIdFlag = true
+ return builder
+}
+
+// 授予数量
+//
+//示例值:0.5
+func (builder *CreateLeaveGrantingRecordReqBodyBuilder) GrantingQuantity(grantingQuantity string) *CreateLeaveGrantingRecordReqBodyBuilder {
+ builder.grantingQuantity = grantingQuantity
+ builder.grantingQuantityFlag = true
+ return builder
+}
+
+// 授予时长单位;;可选值有:;;- 1: 天;- 2: 小时
+//
+//示例值:1
+func (builder *CreateLeaveGrantingRecordReqBodyBuilder) GrantingUnit(grantingUnit int) *CreateLeaveGrantingRecordReqBodyBuilder {
+ builder.grantingUnit = grantingUnit
+ builder.grantingUnitFlag = true
+ return builder
+}
+
+// 生效时间
+//
+//示例值:2022-01-01
+func (builder *CreateLeaveGrantingRecordReqBodyBuilder) EffectiveDate(effectiveDate string) *CreateLeaveGrantingRecordReqBodyBuilder {
+ builder.effectiveDate = effectiveDate
+ builder.effectiveDateFlag = true
+ return builder
+}
+
+// 授予原因
+//
+//示例值:
+func (builder *CreateLeaveGrantingRecordReqBodyBuilder) Reason(reason []*I18n) *CreateLeaveGrantingRecordReqBodyBuilder {
+ builder.reason = reason
+ builder.reasonFlag = true
+ return builder
+}
+
+// 自定义外部 ID,可用于避免数据重复写入(不能超过 64 字符)
+//
+//示例值:111
+func (builder *CreateLeaveGrantingRecordReqBodyBuilder) ExternalId(externalId string) *CreateLeaveGrantingRecordReqBodyBuilder {
+ builder.externalId = externalId
+ builder.externalIdFlag = true
+ return builder
+}
+
+func (builder *CreateLeaveGrantingRecordReqBodyBuilder) Build() *CreateLeaveGrantingRecordReqBody {
+ req := &CreateLeaveGrantingRecordReqBody{}
+ if builder.leaveTypeIdFlag {
+ req.LeaveTypeId = &builder.leaveTypeId
+ }
+ if builder.employmentIdFlag {
+ req.EmploymentId = &builder.employmentId
+ }
+ if builder.grantingQuantityFlag {
+ req.GrantingQuantity = &builder.grantingQuantity
+ }
+ if builder.grantingUnitFlag {
+ req.GrantingUnit = &builder.grantingUnit
+ }
+ if builder.effectiveDateFlag {
+ req.EffectiveDate = &builder.effectiveDate
+ }
+ if builder.reasonFlag {
+ req.Reason = builder.reason
+ }
+ if builder.externalIdFlag {
+ req.ExternalId = &builder.externalId
+ }
+ return req
+}
+
+type CreateLeaveGrantingRecordPathReqBodyBuilder struct {
+ leaveTypeId string // 假期类型 ID,枚举值可通过【获取假期类型列表】接口获取(若假期类型下存在假期子类,此处仅支持传入假期子类的 ID)
+ leaveTypeIdFlag bool
+ employmentId string // 员工 ID
+ employmentIdFlag bool
+ grantingQuantity string // 授予数量
+ grantingQuantityFlag bool
+ grantingUnit int // 授予时长单位;;可选值有:;;- 1: 天;- 2: 小时
+ grantingUnitFlag bool
+ effectiveDate string // 生效时间
+ effectiveDateFlag bool
+ reason []*I18n // 授予原因
+ reasonFlag bool
+ externalId string // 自定义外部 ID,可用于避免数据重复写入(不能超过 64 字符)
+ externalIdFlag bool
+}
+
+func NewCreateLeaveGrantingRecordPathReqBodyBuilder() *CreateLeaveGrantingRecordPathReqBodyBuilder {
+ builder := &CreateLeaveGrantingRecordPathReqBodyBuilder{}
+ return builder
+}
+
+// 假期类型 ID,枚举值可通过【获取假期类型列表】接口获取(若假期类型下存在假期子类,此处仅支持传入假期子类的 ID)
+//
+// 示例值:7111688079785723436
+func (builder *CreateLeaveGrantingRecordPathReqBodyBuilder) LeaveTypeId(leaveTypeId string) *CreateLeaveGrantingRecordPathReqBodyBuilder {
+ builder.leaveTypeId = leaveTypeId
+ builder.leaveTypeIdFlag = true
+ return builder
+}
+
+// 员工 ID
+//
+// 示例值:6982509313466189342
+func (builder *CreateLeaveGrantingRecordPathReqBodyBuilder) EmploymentId(employmentId string) *CreateLeaveGrantingRecordPathReqBodyBuilder {
+ builder.employmentId = employmentId
+ builder.employmentIdFlag = true
+ return builder
+}
+
+// 授予数量
+//
+// 示例值:0.5
+func (builder *CreateLeaveGrantingRecordPathReqBodyBuilder) GrantingQuantity(grantingQuantity string) *CreateLeaveGrantingRecordPathReqBodyBuilder {
+ builder.grantingQuantity = grantingQuantity
+ builder.grantingQuantityFlag = true
+ return builder
+}
+
+// 授予时长单位;;可选值有:;;- 1: 天;- 2: 小时
+//
+// 示例值:1
+func (builder *CreateLeaveGrantingRecordPathReqBodyBuilder) GrantingUnit(grantingUnit int) *CreateLeaveGrantingRecordPathReqBodyBuilder {
+ builder.grantingUnit = grantingUnit
+ builder.grantingUnitFlag = true
+ return builder
+}
+
+// 生效时间
+//
+// 示例值:2022-01-01
+func (builder *CreateLeaveGrantingRecordPathReqBodyBuilder) EffectiveDate(effectiveDate string) *CreateLeaveGrantingRecordPathReqBodyBuilder {
+ builder.effectiveDate = effectiveDate
+ builder.effectiveDateFlag = true
+ return builder
+}
+
+// 授予原因
+//
+// 示例值:
+func (builder *CreateLeaveGrantingRecordPathReqBodyBuilder) Reason(reason []*I18n) *CreateLeaveGrantingRecordPathReqBodyBuilder {
+ builder.reason = reason
+ builder.reasonFlag = true
+ return builder
+}
+
+// 自定义外部 ID,可用于避免数据重复写入(不能超过 64 字符)
+//
+// 示例值:111
+func (builder *CreateLeaveGrantingRecordPathReqBodyBuilder) ExternalId(externalId string) *CreateLeaveGrantingRecordPathReqBodyBuilder {
+ builder.externalId = externalId
+ builder.externalIdFlag = true
+ return builder
+}
+
+func (builder *CreateLeaveGrantingRecordPathReqBodyBuilder) Build() (*CreateLeaveGrantingRecordReqBody, error) {
+ req := &CreateLeaveGrantingRecordReqBody{}
+ if builder.leaveTypeIdFlag {
+ req.LeaveTypeId = &builder.leaveTypeId
+ }
+ if builder.employmentIdFlag {
+ req.EmploymentId = &builder.employmentId
+ }
+ if builder.grantingQuantityFlag {
+ req.GrantingQuantity = &builder.grantingQuantity
+ }
+ if builder.grantingUnitFlag {
+ req.GrantingUnit = &builder.grantingUnit
+ }
+ if builder.effectiveDateFlag {
+ req.EffectiveDate = &builder.effectiveDate
+ }
+ if builder.reasonFlag {
+ req.Reason = builder.reason
+ }
+ if builder.externalIdFlag {
+ req.ExternalId = &builder.externalId
+ }
+ return req, nil
+}
+
+type CreateLeaveGrantingRecordReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *CreateLeaveGrantingRecordReqBody
+}
+
+func NewCreateLeaveGrantingRecordReqBuilder() *CreateLeaveGrantingRecordReqBuilder {
+ builder := &CreateLeaveGrantingRecordReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:open_id
+func (builder *CreateLeaveGrantingRecordReqBuilder) UserIdType(userIdType string) *CreateLeaveGrantingRecordReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 向飞书人事休假系统写入假期授予记录
+func (builder *CreateLeaveGrantingRecordReqBuilder) Body(body *CreateLeaveGrantingRecordReqBody) *CreateLeaveGrantingRecordReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *CreateLeaveGrantingRecordReqBuilder) Build() *CreateLeaveGrantingRecordReq {
+ req := &CreateLeaveGrantingRecordReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type CreateLeaveGrantingRecordReqBody struct {
+ LeaveTypeId *string `json:"leave_type_id,omitempty"` // 假期类型 ID,枚举值可通过【获取假期类型列表】接口获取(若假期类型下存在假期子类,此处仅支持传入假期子类的 ID)
+ EmploymentId *string `json:"employment_id,omitempty"` // 员工 ID
+ GrantingQuantity *string `json:"granting_quantity,omitempty"` // 授予数量
+ GrantingUnit *int `json:"granting_unit,omitempty"` // 授予时长单位;;可选值有:;;- 1: 天;- 2: 小时
+ EffectiveDate *string `json:"effective_date,omitempty"` // 生效时间
+ Reason []*I18n `json:"reason,omitempty"` // 授予原因
+ ExternalId *string `json:"external_id,omitempty"` // 自定义外部 ID,可用于避免数据重复写入(不能超过 64 字符)
+}
+
+type CreateLeaveGrantingRecordReq struct {
+ apiReq *larkcore.ApiReq
+ Body *CreateLeaveGrantingRecordReqBody `body:""`
+}
+
+type CreateLeaveGrantingRecordRespData struct {
+ LeaveGrantingRecord *LeaveGrantingRecord `json:"leave_granting_record,omitempty"` // 假期授予记录
+}
+
+type CreateLeaveGrantingRecordResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateLeaveGrantingRecordRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateLeaveGrantingRecordResp) Success() bool {
+ return resp.Code == 0
+}
+
+type DeleteLeaveGrantingRecordReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewDeleteLeaveGrantingRecordReqBuilder() *DeleteLeaveGrantingRecordReqBuilder {
+ builder := &DeleteLeaveGrantingRecordReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 假期授予记录 ID
+//
+// 示例值:6893014062142064135
+func (builder *DeleteLeaveGrantingRecordReqBuilder) LeaveGrantingRecordId(leaveGrantingRecordId string) *DeleteLeaveGrantingRecordReqBuilder {
+ builder.apiReq.PathParams.Set("leave_granting_record_id", fmt.Sprint(leaveGrantingRecordId))
+ return builder
+}
+
+func (builder *DeleteLeaveGrantingRecordReqBuilder) Build() *DeleteLeaveGrantingRecordReq {
+ req := &DeleteLeaveGrantingRecordReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type DeleteLeaveGrantingRecordReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type DeleteLeaveGrantingRecordResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *DeleteLeaveGrantingRecordResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateLocationReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ location *Location
+}
+
+func NewCreateLocationReqBuilder() *CreateLocationReqBuilder {
+ builder := &CreateLocationReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *CreateLocationReqBuilder) ClientToken(clientToken string) *CreateLocationReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 创建地点
+func (builder *CreateLocationReqBuilder) Location(location *Location) *CreateLocationReqBuilder {
+ builder.location = location
+ return builder
+}
+
+func (builder *CreateLocationReqBuilder) Build() *CreateLocationReq {
+ req := &CreateLocationReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.location
+ return req
+}
+
+type CreateLocationReq struct {
+ apiReq *larkcore.ApiReq
+ Location *Location `body:""`
+}
+
+type CreateLocationRespData struct {
+ Location *Location `json:"location,omitempty"` // 创建成功的地点信息
+}
+
+type CreateLocationResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateLocationRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateLocationResp) Success() bool {
+ return resp.Code == 0
+}
+
+type DeleteLocationReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewDeleteLocationReqBuilder() *DeleteLocationReqBuilder {
+ builder := &DeleteLocationReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 需要删除的地点 ID
+//
+// 示例值:4312443243
+func (builder *DeleteLocationReqBuilder) LocationId(locationId string) *DeleteLocationReqBuilder {
+ builder.apiReq.PathParams.Set("location_id", fmt.Sprint(locationId))
+ return builder
+}
+
+func (builder *DeleteLocationReqBuilder) Build() *DeleteLocationReq {
+ req := &DeleteLocationReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type DeleteLocationReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type DeleteLocationResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *DeleteLocationResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetLocationReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetLocationReqBuilder() *GetLocationReqBuilder {
+ builder := &GetLocationReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 地点 ID
+//
+// 示例值:1215
+func (builder *GetLocationReqBuilder) LocationId(locationId string) *GetLocationReqBuilder {
+ builder.apiReq.PathParams.Set("location_id", fmt.Sprint(locationId))
+ return builder
+}
+
+func (builder *GetLocationReqBuilder) Build() *GetLocationReq {
+ req := &GetLocationReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type GetLocationReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetLocationRespData struct {
+ Location *Location `json:"location,omitempty"` // 地点信息
+}
+
+type GetLocationResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetLocationRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetLocationResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListLocationReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListLocationReqBuilder() *ListLocationReqBuilder {
+ builder := &ListLocationReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:1231231987
+func (builder *ListLocationReqBuilder) PageToken(pageToken string) *ListLocationReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListLocationReqBuilder) PageSize(pageSize string) *ListLocationReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+func (builder *ListLocationReqBuilder) Build() *ListLocationReq {
+ req := &ListLocationReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListLocationReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListLocationRespData struct {
+ Items []*Location `json:"items,omitempty"` // 查询的地点信息
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type ListLocationResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListLocationRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListLocationResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateNationalIdTypeReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ nationalIdType *NationalIdType
+}
+
+func NewCreateNationalIdTypeReqBuilder() *CreateNationalIdTypeReqBuilder {
+ builder := &CreateNationalIdTypeReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *CreateNationalIdTypeReqBuilder) ClientToken(clientToken string) *CreateNationalIdTypeReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 创建国家证件类型
+func (builder *CreateNationalIdTypeReqBuilder) NationalIdType(nationalIdType *NationalIdType) *CreateNationalIdTypeReqBuilder {
+ builder.nationalIdType = nationalIdType
+ return builder
+}
+
+func (builder *CreateNationalIdTypeReqBuilder) Build() *CreateNationalIdTypeReq {
+ req := &CreateNationalIdTypeReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.nationalIdType
+ return req
+}
+
+type CreateNationalIdTypeReq struct {
+ apiReq *larkcore.ApiReq
+ NationalIdType *NationalIdType `body:""`
+}
+
+type CreateNationalIdTypeRespData struct {
+ NationalIdType *NationalIdType `json:"national_id_type,omitempty"` // 创建成功的国家证件类型数据
+}
+
+type CreateNationalIdTypeResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateNationalIdTypeRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateNationalIdTypeResp) Success() bool {
+ return resp.Code == 0
+}
+
+type DeleteNationalIdTypeReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewDeleteNationalIdTypeReqBuilder() *DeleteNationalIdTypeReqBuilder {
+ builder := &DeleteNationalIdTypeReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 需要删除的国家证件类型 ID
+//
+// 示例值:27837817381
+func (builder *DeleteNationalIdTypeReqBuilder) NationalIdTypeId(nationalIdTypeId string) *DeleteNationalIdTypeReqBuilder {
+ builder.apiReq.PathParams.Set("national_id_type_id", fmt.Sprint(nationalIdTypeId))
+ return builder
+}
+
+func (builder *DeleteNationalIdTypeReqBuilder) Build() *DeleteNationalIdTypeReq {
+ req := &DeleteNationalIdTypeReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type DeleteNationalIdTypeReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type DeleteNationalIdTypeResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *DeleteNationalIdTypeResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetNationalIdTypeReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetNationalIdTypeReqBuilder() *GetNationalIdTypeReqBuilder {
+ builder := &GetNationalIdTypeReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 证件类型 ID
+//
+// 示例值:121515
+func (builder *GetNationalIdTypeReqBuilder) NationalIdTypeId(nationalIdTypeId string) *GetNationalIdTypeReqBuilder {
+ builder.apiReq.PathParams.Set("national_id_type_id", fmt.Sprint(nationalIdTypeId))
+ return builder
+}
+
+func (builder *GetNationalIdTypeReqBuilder) Build() *GetNationalIdTypeReq {
+ req := &GetNationalIdTypeReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type GetNationalIdTypeReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetNationalIdTypeRespData struct {
+ NationalIdType *NationalIdType `json:"national_id_type,omitempty"` // 国家证件类型信息
+}
+
+type GetNationalIdTypeResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetNationalIdTypeRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetNationalIdTypeResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListNationalIdTypeReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListNationalIdTypeReqBuilder() *ListNationalIdTypeReqBuilder {
+ builder := &ListNationalIdTypeReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:1231231987
+func (builder *ListNationalIdTypeReqBuilder) PageToken(pageToken string) *ListNationalIdTypeReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListNationalIdTypeReqBuilder) PageSize(pageSize string) *ListNationalIdTypeReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 证件类型
+//
+// 示例值:regular_passport
+func (builder *ListNationalIdTypeReqBuilder) IdentificationType(identificationType string) *ListNationalIdTypeReqBuilder {
+ builder.apiReq.QueryParams.Set("identification_type", fmt.Sprint(identificationType))
+ return builder
+}
+
+// 证件类型编码
+//
+// 示例值:MYS-ID
+func (builder *ListNationalIdTypeReqBuilder) Code(code string) *ListNationalIdTypeReqBuilder {
+ builder.apiReq.QueryParams.Set("code", fmt.Sprint(code))
+ return builder
+}
+
+// 国家地区ID
+//
+// 示例值:6862995749043439111
+func (builder *ListNationalIdTypeReqBuilder) CountryRegionId(countryRegionId string) *ListNationalIdTypeReqBuilder {
+ builder.apiReq.QueryParams.Set("country_region_id", fmt.Sprint(countryRegionId))
+ return builder
+}
+
+func (builder *ListNationalIdTypeReqBuilder) Build() *ListNationalIdTypeReq {
+ req := &ListNationalIdTypeReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListNationalIdTypeReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListNationalIdTypeRespData struct {
+ Items []*NationalIdType `json:"items,omitempty"` // 查询的国家证件类型信息
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type ListNationalIdTypeResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListNationalIdTypeRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListNationalIdTypeResp) Success() bool {
+ return resp.Code == 0
+}
+
+type PatchNationalIdTypeReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ nationalIdType *NationalIdType
+}
+
+func NewPatchNationalIdTypeReqBuilder() *PatchNationalIdTypeReqBuilder {
+ builder := &PatchNationalIdTypeReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 证件类型ID
+//
+// 示例值:1616161616
+func (builder *PatchNationalIdTypeReqBuilder) NationalIdTypeId(nationalIdTypeId string) *PatchNationalIdTypeReqBuilder {
+ builder.apiReq.PathParams.Set("national_id_type_id", fmt.Sprint(nationalIdTypeId))
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *PatchNationalIdTypeReqBuilder) ClientToken(clientToken string) *PatchNationalIdTypeReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 更新国家证件类型
+func (builder *PatchNationalIdTypeReqBuilder) NationalIdType(nationalIdType *NationalIdType) *PatchNationalIdTypeReqBuilder {
+ builder.nationalIdType = nationalIdType
+ return builder
+}
+
+func (builder *PatchNationalIdTypeReqBuilder) Build() *PatchNationalIdTypeReq {
+ req := &PatchNationalIdTypeReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.nationalIdType
+ return req
+}
+
+type PatchNationalIdTypeReq struct {
+ apiReq *larkcore.ApiReq
+ NationalIdType *NationalIdType `body:""`
+}
+
+type PatchNationalIdTypeRespData struct {
+ NationalIdType *NationalIdType `json:"national_id_type,omitempty"` // 国家证件类型
+}
+
+type PatchNationalIdTypeResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *PatchNationalIdTypeRespData `json:"data"` // 业务数据
+}
+
+func (resp *PatchNationalIdTypeResp) Success() bool {
+ return resp.Code == 0
+}
+
+type QueryOffboardingReqBodyBuilder struct {
+ active bool // 是否启用
+ activeFlag bool
+ offboardingReasonUniqueIdentifier []string // 离职原因唯一标识列表,用于过滤,最大20个
+ offboardingReasonUniqueIdentifierFlag bool
+}
+
+func NewQueryOffboardingReqBodyBuilder() *QueryOffboardingReqBodyBuilder {
+ builder := &QueryOffboardingReqBodyBuilder{}
+ return builder
+}
+
+// 是否启用
+//
+//示例值:true
+func (builder *QueryOffboardingReqBodyBuilder) Active(active bool) *QueryOffboardingReqBodyBuilder {
+ builder.active = active
+ builder.activeFlag = true
+ return builder
+}
+
+// 离职原因唯一标识列表,用于过滤,最大20个
+//
+//示例值:["reason_for_offboarding_option"]
+func (builder *QueryOffboardingReqBodyBuilder) OffboardingReasonUniqueIdentifier(offboardingReasonUniqueIdentifier []string) *QueryOffboardingReqBodyBuilder {
+ builder.offboardingReasonUniqueIdentifier = offboardingReasonUniqueIdentifier
+ builder.offboardingReasonUniqueIdentifierFlag = true
+ return builder
+}
+
+func (builder *QueryOffboardingReqBodyBuilder) Build() *QueryOffboardingReqBody {
+ req := &QueryOffboardingReqBody{}
+ if builder.activeFlag {
+ req.Active = &builder.active
+ }
+ if builder.offboardingReasonUniqueIdentifierFlag {
+ req.OffboardingReasonUniqueIdentifier = builder.offboardingReasonUniqueIdentifier
+ }
+ return req
+}
+
+type QueryOffboardingPathReqBodyBuilder struct {
+ active bool // 是否启用
+ activeFlag bool
+ offboardingReasonUniqueIdentifier []string // 离职原因唯一标识列表,用于过滤,最大20个
+ offboardingReasonUniqueIdentifierFlag bool
+}
+
+func NewQueryOffboardingPathReqBodyBuilder() *QueryOffboardingPathReqBodyBuilder {
+ builder := &QueryOffboardingPathReqBodyBuilder{}
+ return builder
+}
+
+// 是否启用
+//
+// 示例值:true
+func (builder *QueryOffboardingPathReqBodyBuilder) Active(active bool) *QueryOffboardingPathReqBodyBuilder {
+ builder.active = active
+ builder.activeFlag = true
+ return builder
+}
+
+// 离职原因唯一标识列表,用于过滤,最大20个
+//
+// 示例值:["reason_for_offboarding_option"]
+func (builder *QueryOffboardingPathReqBodyBuilder) OffboardingReasonUniqueIdentifier(offboardingReasonUniqueIdentifier []string) *QueryOffboardingPathReqBodyBuilder {
+ builder.offboardingReasonUniqueIdentifier = offboardingReasonUniqueIdentifier
+ builder.offboardingReasonUniqueIdentifierFlag = true
+ return builder
+}
+
+func (builder *QueryOffboardingPathReqBodyBuilder) Build() (*QueryOffboardingReqBody, error) {
+ req := &QueryOffboardingReqBody{}
+ if builder.activeFlag {
+ req.Active = &builder.active
+ }
+ if builder.offboardingReasonUniqueIdentifierFlag {
+ req.OffboardingReasonUniqueIdentifier = builder.offboardingReasonUniqueIdentifier
+ }
+ return req, nil
+}
+
+type QueryOffboardingReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *QueryOffboardingReqBody
+}
+
+func NewQueryOffboardingReqBuilder() *QueryOffboardingReqBuilder {
+ builder := &QueryOffboardingReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 查询「飞书人事」-「离职设置」中的离职原因
+func (builder *QueryOffboardingReqBuilder) Body(body *QueryOffboardingReqBody) *QueryOffboardingReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *QueryOffboardingReqBuilder) Build() *QueryOffboardingReq {
+ req := &QueryOffboardingReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type QueryOffboardingReqBody struct {
+ Active *bool `json:"active,omitempty"` // 是否启用
+ OffboardingReasonUniqueIdentifier []string `json:"offboarding_reason_unique_identifier,omitempty"` // 离职原因唯一标识列表,用于过滤,最大20个
+}
+
+type QueryOffboardingReq struct {
+ apiReq *larkcore.ApiReq
+ Body *QueryOffboardingReqBody `body:""`
+}
+
+type QueryOffboardingRespData struct {
+ Items []*OffboardingReason `json:"items,omitempty"` // 离职原因列表
+}
+
+type QueryOffboardingResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *QueryOffboardingRespData `json:"data"` // 业务数据
+}
+
+func (resp *QueryOffboardingResp) Success() bool {
+ return resp.Code == 0
+}
+
+type SearchOffboardingReqBodyBuilder struct {
+ employmentIds []string // 雇佣 ID 列表,为空默认查询所有离职人员
+ employmentIdsFlag bool
+ applyInitiatingTimeStart string // 离职审批发起时间-搜索范围开始,需要与搜索范围结束一同使用
+ applyInitiatingTimeStartFlag bool
+ applyInitiatingTimeEnd string // 离职审批发起时间 - 搜索范围结束
+ applyInitiatingTimeEndFlag bool
+ expectedOffboardingDateStart string // 期望离职日期-搜索范围开始,需要与搜索范围结束一同使用
+ expectedOffboardingDateStartFlag bool
+ expectedOffboardingDateEnd string // 期望离职日期 - 搜索范围结束
+ expectedOffboardingDateEndFlag bool
+ offboardingDateStart string // 离职日期-搜索范围开始,需要与搜索范围结束一同使用
+ offboardingDateStartFlag bool
+ offboardingDateEnd string // 离职日期 - 搜索范围结束
+ offboardingDateEndFlag bool
+ statuses []string // 离职状态,多个状态之间为「或」的关系
+ statusesFlag bool
+ reasons []string // 离职原因列表 , 可以通过【查询员工离职原因列表】接口获取 ,查询时不返回下级原因相关的离职信息
+ reasonsFlag bool
+ employeeReasons []string // 离职原因(员工)列表 , 可以通过【查询员工离职原因列表】接口获取,查询时不返回下级原因相关的离职信息
+ employeeReasonsFlag bool
+}
+
+func NewSearchOffboardingReqBodyBuilder() *SearchOffboardingReqBodyBuilder {
+ builder := &SearchOffboardingReqBodyBuilder{}
+ return builder
+}
+
+// 雇佣 ID 列表,为空默认查询所有离职人员
+//
+//示例值:
+func (builder *SearchOffboardingReqBodyBuilder) EmploymentIds(employmentIds []string) *SearchOffboardingReqBodyBuilder {
+ builder.employmentIds = employmentIds
+ builder.employmentIdsFlag = true
+ return builder
+}
+
+// 离职审批发起时间-搜索范围开始,需要与搜索范围结束一同使用
+//
+//示例值:2022-01-01 11:22:33
+func (builder *SearchOffboardingReqBodyBuilder) ApplyInitiatingTimeStart(applyInitiatingTimeStart string) *SearchOffboardingReqBodyBuilder {
+ builder.applyInitiatingTimeStart = applyInitiatingTimeStart
+ builder.applyInitiatingTimeStartFlag = true
+ return builder
+}
+
+// 离职审批发起时间 - 搜索范围结束
+//
+//示例值:2022-01-01 11:22:33
+func (builder *SearchOffboardingReqBodyBuilder) ApplyInitiatingTimeEnd(applyInitiatingTimeEnd string) *SearchOffboardingReqBodyBuilder {
+ builder.applyInitiatingTimeEnd = applyInitiatingTimeEnd
+ builder.applyInitiatingTimeEndFlag = true
+ return builder
+}
+
+// 期望离职日期-搜索范围开始,需要与搜索范围结束一同使用
+//
+//示例值:2022-01-01
+func (builder *SearchOffboardingReqBodyBuilder) ExpectedOffboardingDateStart(expectedOffboardingDateStart string) *SearchOffboardingReqBodyBuilder {
+ builder.expectedOffboardingDateStart = expectedOffboardingDateStart
+ builder.expectedOffboardingDateStartFlag = true
+ return builder
+}
+
+// 期望离职日期 - 搜索范围结束
+//
+//示例值:2022-01-01
+func (builder *SearchOffboardingReqBodyBuilder) ExpectedOffboardingDateEnd(expectedOffboardingDateEnd string) *SearchOffboardingReqBodyBuilder {
+ builder.expectedOffboardingDateEnd = expectedOffboardingDateEnd
+ builder.expectedOffboardingDateEndFlag = true
+ return builder
+}
+
+// 离职日期-搜索范围开始,需要与搜索范围结束一同使用
+//
+//示例值:2022-01-01
+func (builder *SearchOffboardingReqBodyBuilder) OffboardingDateStart(offboardingDateStart string) *SearchOffboardingReqBodyBuilder {
+ builder.offboardingDateStart = offboardingDateStart
+ builder.offboardingDateStartFlag = true
+ return builder
+}
+
+// 离职日期 - 搜索范围结束
+//
+//示例值:2022-01-01
+func (builder *SearchOffboardingReqBodyBuilder) OffboardingDateEnd(offboardingDateEnd string) *SearchOffboardingReqBodyBuilder {
+ builder.offboardingDateEnd = offboardingDateEnd
+ builder.offboardingDateEndFlag = true
+ return builder
+}
+
+// 离职状态,多个状态之间为「或」的关系
+//
+//示例值:
+func (builder *SearchOffboardingReqBodyBuilder) Statuses(statuses []string) *SearchOffboardingReqBodyBuilder {
+ builder.statuses = statuses
+ builder.statusesFlag = true
+ return builder
+}
+
+// 离职原因列表 , 可以通过【查询员工离职原因列表】接口获取 ,查询时不返回下级原因相关的离职信息
+//
+//示例值:
+func (builder *SearchOffboardingReqBodyBuilder) Reasons(reasons []string) *SearchOffboardingReqBodyBuilder {
+ builder.reasons = reasons
+ builder.reasonsFlag = true
+ return builder
+}
+
+// 离职原因(员工)列表 , 可以通过【查询员工离职原因列表】接口获取,查询时不返回下级原因相关的离职信息
+//
+//示例值:
+func (builder *SearchOffboardingReqBodyBuilder) EmployeeReasons(employeeReasons []string) *SearchOffboardingReqBodyBuilder {
+ builder.employeeReasons = employeeReasons
+ builder.employeeReasonsFlag = true
+ return builder
+}
+
+func (builder *SearchOffboardingReqBodyBuilder) Build() *SearchOffboardingReqBody {
+ req := &SearchOffboardingReqBody{}
+ if builder.employmentIdsFlag {
+ req.EmploymentIds = builder.employmentIds
+ }
+ if builder.applyInitiatingTimeStartFlag {
+ req.ApplyInitiatingTimeStart = &builder.applyInitiatingTimeStart
+ }
+ if builder.applyInitiatingTimeEndFlag {
+ req.ApplyInitiatingTimeEnd = &builder.applyInitiatingTimeEnd
+ }
+ if builder.expectedOffboardingDateStartFlag {
+ req.ExpectedOffboardingDateStart = &builder.expectedOffboardingDateStart
+ }
+ if builder.expectedOffboardingDateEndFlag {
+ req.ExpectedOffboardingDateEnd = &builder.expectedOffboardingDateEnd
+ }
+ if builder.offboardingDateStartFlag {
+ req.OffboardingDateStart = &builder.offboardingDateStart
+ }
+ if builder.offboardingDateEndFlag {
+ req.OffboardingDateEnd = &builder.offboardingDateEnd
+ }
+ if builder.statusesFlag {
+ req.Statuses = builder.statuses
+ }
+ if builder.reasonsFlag {
+ req.Reasons = builder.reasons
+ }
+ if builder.employeeReasonsFlag {
+ req.EmployeeReasons = builder.employeeReasons
+ }
+ return req
+}
+
+type SearchOffboardingPathReqBodyBuilder struct {
+ employmentIds []string // 雇佣 ID 列表,为空默认查询所有离职人员
+ employmentIdsFlag bool
+ applyInitiatingTimeStart string // 离职审批发起时间-搜索范围开始,需要与搜索范围结束一同使用
+ applyInitiatingTimeStartFlag bool
+ applyInitiatingTimeEnd string // 离职审批发起时间 - 搜索范围结束
+ applyInitiatingTimeEndFlag bool
+ expectedOffboardingDateStart string // 期望离职日期-搜索范围开始,需要与搜索范围结束一同使用
+ expectedOffboardingDateStartFlag bool
+ expectedOffboardingDateEnd string // 期望离职日期 - 搜索范围结束
+ expectedOffboardingDateEndFlag bool
+ offboardingDateStart string // 离职日期-搜索范围开始,需要与搜索范围结束一同使用
+ offboardingDateStartFlag bool
+ offboardingDateEnd string // 离职日期 - 搜索范围结束
+ offboardingDateEndFlag bool
+ statuses []string // 离职状态,多个状态之间为「或」的关系
+ statusesFlag bool
+ reasons []string // 离职原因列表 , 可以通过【查询员工离职原因列表】接口获取 ,查询时不返回下级原因相关的离职信息
+ reasonsFlag bool
+ employeeReasons []string // 离职原因(员工)列表 , 可以通过【查询员工离职原因列表】接口获取,查询时不返回下级原因相关的离职信息
+ employeeReasonsFlag bool
+}
+
+func NewSearchOffboardingPathReqBodyBuilder() *SearchOffboardingPathReqBodyBuilder {
+ builder := &SearchOffboardingPathReqBodyBuilder{}
+ return builder
+}
+
+// 雇佣 ID 列表,为空默认查询所有离职人员
+//
+// 示例值:
+func (builder *SearchOffboardingPathReqBodyBuilder) EmploymentIds(employmentIds []string) *SearchOffboardingPathReqBodyBuilder {
+ builder.employmentIds = employmentIds
+ builder.employmentIdsFlag = true
+ return builder
+}
+
+// 离职审批发起时间-搜索范围开始,需要与搜索范围结束一同使用
+//
+// 示例值:2022-01-01 11:22:33
+func (builder *SearchOffboardingPathReqBodyBuilder) ApplyInitiatingTimeStart(applyInitiatingTimeStart string) *SearchOffboardingPathReqBodyBuilder {
+ builder.applyInitiatingTimeStart = applyInitiatingTimeStart
+ builder.applyInitiatingTimeStartFlag = true
+ return builder
+}
+
+// 离职审批发起时间 - 搜索范围结束
+//
+// 示例值:2022-01-01 11:22:33
+func (builder *SearchOffboardingPathReqBodyBuilder) ApplyInitiatingTimeEnd(applyInitiatingTimeEnd string) *SearchOffboardingPathReqBodyBuilder {
+ builder.applyInitiatingTimeEnd = applyInitiatingTimeEnd
+ builder.applyInitiatingTimeEndFlag = true
+ return builder
+}
+
+// 期望离职日期-搜索范围开始,需要与搜索范围结束一同使用
+//
+// 示例值:2022-01-01
+func (builder *SearchOffboardingPathReqBodyBuilder) ExpectedOffboardingDateStart(expectedOffboardingDateStart string) *SearchOffboardingPathReqBodyBuilder {
+ builder.expectedOffboardingDateStart = expectedOffboardingDateStart
+ builder.expectedOffboardingDateStartFlag = true
+ return builder
+}
+
+// 期望离职日期 - 搜索范围结束
+//
+// 示例值:2022-01-01
+func (builder *SearchOffboardingPathReqBodyBuilder) ExpectedOffboardingDateEnd(expectedOffboardingDateEnd string) *SearchOffboardingPathReqBodyBuilder {
+ builder.expectedOffboardingDateEnd = expectedOffboardingDateEnd
+ builder.expectedOffboardingDateEndFlag = true
+ return builder
+}
+
+// 离职日期-搜索范围开始,需要与搜索范围结束一同使用
+//
+// 示例值:2022-01-01
+func (builder *SearchOffboardingPathReqBodyBuilder) OffboardingDateStart(offboardingDateStart string) *SearchOffboardingPathReqBodyBuilder {
+ builder.offboardingDateStart = offboardingDateStart
+ builder.offboardingDateStartFlag = true
+ return builder
+}
+
+// 离职日期 - 搜索范围结束
+//
+// 示例值:2022-01-01
+func (builder *SearchOffboardingPathReqBodyBuilder) OffboardingDateEnd(offboardingDateEnd string) *SearchOffboardingPathReqBodyBuilder {
+ builder.offboardingDateEnd = offboardingDateEnd
+ builder.offboardingDateEndFlag = true
+ return builder
+}
+
+// 离职状态,多个状态之间为「或」的关系
+//
+// 示例值:
+func (builder *SearchOffboardingPathReqBodyBuilder) Statuses(statuses []string) *SearchOffboardingPathReqBodyBuilder {
+ builder.statuses = statuses
+ builder.statusesFlag = true
+ return builder
+}
+
+// 离职原因列表 , 可以通过【查询员工离职原因列表】接口获取 ,查询时不返回下级原因相关的离职信息
+//
+// 示例值:
+func (builder *SearchOffboardingPathReqBodyBuilder) Reasons(reasons []string) *SearchOffboardingPathReqBodyBuilder {
+ builder.reasons = reasons
+ builder.reasonsFlag = true
+ return builder
+}
+
+// 离职原因(员工)列表 , 可以通过【查询员工离职原因列表】接口获取,查询时不返回下级原因相关的离职信息
+//
+// 示例值:
+func (builder *SearchOffboardingPathReqBodyBuilder) EmployeeReasons(employeeReasons []string) *SearchOffboardingPathReqBodyBuilder {
+ builder.employeeReasons = employeeReasons
+ builder.employeeReasonsFlag = true
+ return builder
+}
+
+func (builder *SearchOffboardingPathReqBodyBuilder) Build() (*SearchOffboardingReqBody, error) {
+ req := &SearchOffboardingReqBody{}
+ if builder.employmentIdsFlag {
+ req.EmploymentIds = builder.employmentIds
+ }
+ if builder.applyInitiatingTimeStartFlag {
+ req.ApplyInitiatingTimeStart = &builder.applyInitiatingTimeStart
+ }
+ if builder.applyInitiatingTimeEndFlag {
+ req.ApplyInitiatingTimeEnd = &builder.applyInitiatingTimeEnd
+ }
+ if builder.expectedOffboardingDateStartFlag {
+ req.ExpectedOffboardingDateStart = &builder.expectedOffboardingDateStart
+ }
+ if builder.expectedOffboardingDateEndFlag {
+ req.ExpectedOffboardingDateEnd = &builder.expectedOffboardingDateEnd
+ }
+ if builder.offboardingDateStartFlag {
+ req.OffboardingDateStart = &builder.offboardingDateStart
+ }
+ if builder.offboardingDateEndFlag {
+ req.OffboardingDateEnd = &builder.offboardingDateEnd
+ }
+ if builder.statusesFlag {
+ req.Statuses = builder.statuses
+ }
+ if builder.reasonsFlag {
+ req.Reasons = builder.reasons
+ }
+ if builder.employeeReasonsFlag {
+ req.EmployeeReasons = builder.employeeReasons
+ }
+ return req, nil
+}
+
+type SearchOffboardingReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *SearchOffboardingReqBody
+ limit int // 最大返回多少记录,当使用迭代器访问时才有效
+}
+
+func NewSearchOffboardingReqBuilder() *SearchOffboardingReqBuilder {
+ builder := &SearchOffboardingReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 最大返回多少记录,当使用迭代器访问时才有效
+func (builder *SearchOffboardingReqBuilder) Limit(limit int) *SearchOffboardingReqBuilder {
+ builder.limit = limit
+ return builder
+}
+
+// 分页大小,最大 100
+//
+// 示例值:100
+func (builder *SearchOffboardingReqBuilder) PageSize(pageSize int) *SearchOffboardingReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果
+//
+// 示例值:6891251722631890445
+func (builder *SearchOffboardingReqBuilder) PageToken(pageToken string) *SearchOffboardingReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 用户 ID 类型
+//
+// 示例值:open_id
+func (builder *SearchOffboardingReqBuilder) UserIdType(userIdType string) *SearchOffboardingReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 根据 雇佣 ID 查询员工离职信息
+func (builder *SearchOffboardingReqBuilder) Body(body *SearchOffboardingReqBody) *SearchOffboardingReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *SearchOffboardingReqBuilder) Build() *SearchOffboardingReq {
+ req := &SearchOffboardingReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.Limit = builder.limit
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type SearchOffboardingReqBody struct {
+ EmploymentIds []string `json:"employment_ids,omitempty"` // 雇佣 ID 列表,为空默认查询所有离职人员
+ ApplyInitiatingTimeStart *string `json:"apply_initiating_time_start,omitempty"` // 离职审批发起时间-搜索范围开始,需要与搜索范围结束一同使用
+ ApplyInitiatingTimeEnd *string `json:"apply_initiating_time_end,omitempty"` // 离职审批发起时间 - 搜索范围结束
+ ExpectedOffboardingDateStart *string `json:"expected_offboarding_date_start,omitempty"` // 期望离职日期-搜索范围开始,需要与搜索范围结束一同使用
+ ExpectedOffboardingDateEnd *string `json:"expected_offboarding_date_end,omitempty"` // 期望离职日期 - 搜索范围结束
+ OffboardingDateStart *string `json:"offboarding_date_start,omitempty"` // 离职日期-搜索范围开始,需要与搜索范围结束一同使用
+ OffboardingDateEnd *string `json:"offboarding_date_end,omitempty"` // 离职日期 - 搜索范围结束
+ Statuses []string `json:"statuses,omitempty"` // 离职状态,多个状态之间为「或」的关系
+ Reasons []string `json:"reasons,omitempty"` // 离职原因列表 , 可以通过【查询员工离职原因列表】接口获取 ,查询时不返回下级原因相关的离职信息
+ EmployeeReasons []string `json:"employee_reasons,omitempty"` // 离职原因(员工)列表 , 可以通过【查询员工离职原因列表】接口获取,查询时不返回下级原因相关的离职信息
+}
+
+type SearchOffboardingReq struct {
+ apiReq *larkcore.ApiReq
+ Body *SearchOffboardingReqBody `body:""`
+ Limit int // 最多返回多少记录,只有在使用迭代器访问时,才有效
+
+}
+
+type SearchOffboardingRespData struct {
+ Items []*Offboarding `json:"items,omitempty"` // 查询的员工离职信息
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+}
+
+type SearchOffboardingResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *SearchOffboardingRespData `json:"data"` // 业务数据
+}
+
+func (resp *SearchOffboardingResp) Success() bool {
+ return resp.Code == 0
+}
+
+type SubmitOffboardingReqBodyBuilder struct {
+ offboardingMode int // 离职方式
+ offboardingModeFlag bool
+ employmentId string // 雇员 id
+ employmentIdFlag bool
+ offboardingDate string // 离职日期
+ offboardingDateFlag bool
+ offboardingReasonUniqueIdentifier string // 离职原因,可通过接口;[【查询员工离职原因列表】](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/offboarding/query)获取
+ offboardingReasonUniqueIdentifierFlag bool
+ offboardingReasonExplanation string // 离职原因说明,长度限制6000
+ offboardingReasonExplanationFlag bool
+ initiatorId string // 操作发起人 ID(employment_id),为空默认为系统发起。注意:只有操作发起人可以撤销流程
+ initiatorIdFlag bool
+ customFields []*ObjectFieldData // 自定义字段
+ customFieldsFlag bool
+}
+
+func NewSubmitOffboardingReqBodyBuilder() *SubmitOffboardingReqBodyBuilder {
+ builder := &SubmitOffboardingReqBodyBuilder{}
+ return builder
+}
+
+// 离职方式
+//
+//示例值:1
+func (builder *SubmitOffboardingReqBodyBuilder) OffboardingMode(offboardingMode int) *SubmitOffboardingReqBodyBuilder {
+ builder.offboardingMode = offboardingMode
+ builder.offboardingModeFlag = true
+ return builder
+}
+
+// 雇员 id
+//
+//示例值:6982509313466189342
+func (builder *SubmitOffboardingReqBodyBuilder) EmploymentId(employmentId string) *SubmitOffboardingReqBodyBuilder {
+ builder.employmentId = employmentId
+ builder.employmentIdFlag = true
+ return builder
+}
+
+// 离职日期
+//
+//示例值:2022-05-18
+func (builder *SubmitOffboardingReqBodyBuilder) OffboardingDate(offboardingDate string) *SubmitOffboardingReqBodyBuilder {
+ builder.offboardingDate = offboardingDate
+ builder.offboardingDateFlag = true
+ return builder
+}
+
+// 离职原因,可通过接口;[【查询员工离职原因列表】](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/offboarding/query)获取
+//
+//示例值:reason_for_offboarding_option8
+func (builder *SubmitOffboardingReqBodyBuilder) OffboardingReasonUniqueIdentifier(offboardingReasonUniqueIdentifier string) *SubmitOffboardingReqBodyBuilder {
+ builder.offboardingReasonUniqueIdentifier = offboardingReasonUniqueIdentifier
+ builder.offboardingReasonUniqueIdentifierFlag = true
+ return builder
+}
+
+// 离职原因说明,长度限制6000
+//
+//示例值:离职原因说明
+func (builder *SubmitOffboardingReqBodyBuilder) OffboardingReasonExplanation(offboardingReasonExplanation string) *SubmitOffboardingReqBodyBuilder {
+ builder.offboardingReasonExplanation = offboardingReasonExplanation
+ builder.offboardingReasonExplanationFlag = true
+ return builder
+}
+
+// 操作发起人 ID(employment_id),为空默认为系统发起。注意:只有操作发起人可以撤销流程
+//
+//示例值:6982509313466189341
+func (builder *SubmitOffboardingReqBodyBuilder) InitiatorId(initiatorId string) *SubmitOffboardingReqBodyBuilder {
+ builder.initiatorId = initiatorId
+ builder.initiatorIdFlag = true
+ return builder
+}
+
+// 自定义字段
+//
+//示例值:
+func (builder *SubmitOffboardingReqBodyBuilder) CustomFields(customFields []*ObjectFieldData) *SubmitOffboardingReqBodyBuilder {
+ builder.customFields = customFields
+ builder.customFieldsFlag = true
+ return builder
+}
+
+func (builder *SubmitOffboardingReqBodyBuilder) Build() *SubmitOffboardingReqBody {
+ req := &SubmitOffboardingReqBody{}
+ if builder.offboardingModeFlag {
+ req.OffboardingMode = &builder.offboardingMode
+ }
+ if builder.employmentIdFlag {
+ req.EmploymentId = &builder.employmentId
+ }
+ if builder.offboardingDateFlag {
+ req.OffboardingDate = &builder.offboardingDate
+ }
+ if builder.offboardingReasonUniqueIdentifierFlag {
+ req.OffboardingReasonUniqueIdentifier = &builder.offboardingReasonUniqueIdentifier
+ }
+ if builder.offboardingReasonExplanationFlag {
+ req.OffboardingReasonExplanation = &builder.offboardingReasonExplanation
+ }
+ if builder.initiatorIdFlag {
+ req.InitiatorId = &builder.initiatorId
+ }
+ if builder.customFieldsFlag {
+ req.CustomFields = builder.customFields
+ }
+ return req
+}
+
+type SubmitOffboardingPathReqBodyBuilder struct {
+ offboardingMode int // 离职方式
+ offboardingModeFlag bool
+ employmentId string // 雇员 id
+ employmentIdFlag bool
+ offboardingDate string // 离职日期
+ offboardingDateFlag bool
+ offboardingReasonUniqueIdentifier string // 离职原因,可通过接口;[【查询员工离职原因列表】](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/offboarding/query)获取
+ offboardingReasonUniqueIdentifierFlag bool
+ offboardingReasonExplanation string // 离职原因说明,长度限制6000
+ offboardingReasonExplanationFlag bool
+ initiatorId string // 操作发起人 ID(employment_id),为空默认为系统发起。注意:只有操作发起人可以撤销流程
+ initiatorIdFlag bool
+ customFields []*ObjectFieldData // 自定义字段
+ customFieldsFlag bool
+}
+
+func NewSubmitOffboardingPathReqBodyBuilder() *SubmitOffboardingPathReqBodyBuilder {
+ builder := &SubmitOffboardingPathReqBodyBuilder{}
+ return builder
+}
+
+// 离职方式
+//
+// 示例值:1
+func (builder *SubmitOffboardingPathReqBodyBuilder) OffboardingMode(offboardingMode int) *SubmitOffboardingPathReqBodyBuilder {
+ builder.offboardingMode = offboardingMode
+ builder.offboardingModeFlag = true
+ return builder
+}
+
+// 雇员 id
+//
+// 示例值:6982509313466189342
+func (builder *SubmitOffboardingPathReqBodyBuilder) EmploymentId(employmentId string) *SubmitOffboardingPathReqBodyBuilder {
+ builder.employmentId = employmentId
+ builder.employmentIdFlag = true
+ return builder
+}
+
+// 离职日期
+//
+// 示例值:2022-05-18
+func (builder *SubmitOffboardingPathReqBodyBuilder) OffboardingDate(offboardingDate string) *SubmitOffboardingPathReqBodyBuilder {
+ builder.offboardingDate = offboardingDate
+ builder.offboardingDateFlag = true
+ return builder
+}
+
+// 离职原因,可通过接口;[【查询员工离职原因列表】](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/offboarding/query)获取
+//
+// 示例值:reason_for_offboarding_option8
+func (builder *SubmitOffboardingPathReqBodyBuilder) OffboardingReasonUniqueIdentifier(offboardingReasonUniqueIdentifier string) *SubmitOffboardingPathReqBodyBuilder {
+ builder.offboardingReasonUniqueIdentifier = offboardingReasonUniqueIdentifier
+ builder.offboardingReasonUniqueIdentifierFlag = true
+ return builder
+}
+
+// 离职原因说明,长度限制6000
+//
+// 示例值:离职原因说明
+func (builder *SubmitOffboardingPathReqBodyBuilder) OffboardingReasonExplanation(offboardingReasonExplanation string) *SubmitOffboardingPathReqBodyBuilder {
+ builder.offboardingReasonExplanation = offboardingReasonExplanation
+ builder.offboardingReasonExplanationFlag = true
+ return builder
+}
+
+// 操作发起人 ID(employment_id),为空默认为系统发起。注意:只有操作发起人可以撤销流程
+//
+// 示例值:6982509313466189341
+func (builder *SubmitOffboardingPathReqBodyBuilder) InitiatorId(initiatorId string) *SubmitOffboardingPathReqBodyBuilder {
+ builder.initiatorId = initiatorId
+ builder.initiatorIdFlag = true
+ return builder
+}
+
+// 自定义字段
+//
+// 示例值:
+func (builder *SubmitOffboardingPathReqBodyBuilder) CustomFields(customFields []*ObjectFieldData) *SubmitOffboardingPathReqBodyBuilder {
+ builder.customFields = customFields
+ builder.customFieldsFlag = true
+ return builder
+}
+
+func (builder *SubmitOffboardingPathReqBodyBuilder) Build() (*SubmitOffboardingReqBody, error) {
+ req := &SubmitOffboardingReqBody{}
+ if builder.offboardingModeFlag {
+ req.OffboardingMode = &builder.offboardingMode
+ }
+ if builder.employmentIdFlag {
+ req.EmploymentId = &builder.employmentId
+ }
+ if builder.offboardingDateFlag {
+ req.OffboardingDate = &builder.offboardingDate
+ }
+ if builder.offboardingReasonUniqueIdentifierFlag {
+ req.OffboardingReasonUniqueIdentifier = &builder.offboardingReasonUniqueIdentifier
+ }
+ if builder.offboardingReasonExplanationFlag {
+ req.OffboardingReasonExplanation = &builder.offboardingReasonExplanation
+ }
+ if builder.initiatorIdFlag {
+ req.InitiatorId = &builder.initiatorId
+ }
+ if builder.customFieldsFlag {
+ req.CustomFields = builder.customFields
+ }
+ return req, nil
+}
+
+type SubmitOffboardingReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *SubmitOffboardingReqBody
+}
+
+func NewSubmitOffboardingReqBuilder() *SubmitOffboardingReqBuilder {
+ builder := &SubmitOffboardingReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 用户 ID 类型
+//
+// 示例值:people_corehr_id
+func (builder *SubmitOffboardingReqBuilder) UserIdType(userIdType string) *SubmitOffboardingReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 操作员工直接离职
+func (builder *SubmitOffboardingReqBuilder) Body(body *SubmitOffboardingReqBody) *SubmitOffboardingReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *SubmitOffboardingReqBuilder) Build() *SubmitOffboardingReq {
+ req := &SubmitOffboardingReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type SubmitOffboardingReqBody struct {
+ OffboardingMode *int `json:"offboarding_mode,omitempty"` // 离职方式
+ EmploymentId *string `json:"employment_id,omitempty"` // 雇员 id
+ OffboardingDate *string `json:"offboarding_date,omitempty"` // 离职日期
+ OffboardingReasonUniqueIdentifier *string `json:"offboarding_reason_unique_identifier,omitempty"` // 离职原因,可通过接口;[【查询员工离职原因列表】](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/offboarding/query)获取
+ OffboardingReasonExplanation *string `json:"offboarding_reason_explanation,omitempty"` // 离职原因说明,长度限制6000
+ InitiatorId *string `json:"initiator_id,omitempty"` // 操作发起人 ID(employment_id),为空默认为系统发起。注意:只有操作发起人可以撤销流程
+ CustomFields []*ObjectFieldData `json:"custom_fields,omitempty"` // 自定义字段
+}
+
+type SubmitOffboardingReq struct {
+ apiReq *larkcore.ApiReq
+ Body *SubmitOffboardingReqBody `body:""`
+}
+
+type SubmitOffboardingRespData struct {
+ OffboardingId *string `json:"offboarding_id,omitempty"` // 离职记录 id
+ EmploymentId *string `json:"employment_id,omitempty"` // 雇员 id
+ OffboardingReasonUniqueIdentifier *string `json:"offboarding_reason_unique_identifier,omitempty"` // 离职原因
+ OffboardingDate *string `json:"offboarding_date,omitempty"` // 离职日期
+ OffboardingReasonExplanation *string `json:"offboarding_reason_explanation,omitempty"` // 离职原因说明
+ CreatedTime *string `json:"created_time,omitempty"` // 创建时间
+}
+
+type SubmitOffboardingResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *SubmitOffboardingRespData `json:"data"` // 业务数据
+}
+
+func (resp *SubmitOffboardingResp) Success() bool {
+ return resp.Code == 0
+}
+
+type DeletePersonReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewDeletePersonReqBuilder() *DeletePersonReqBuilder {
+ builder := &DeletePersonReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 需要删除的Person ID
+//
+// 示例值:654637829201
+func (builder *DeletePersonReqBuilder) PersonId(personId string) *DeletePersonReqBuilder {
+ builder.apiReq.PathParams.Set("person_id", fmt.Sprint(personId))
+ return builder
+}
+
+func (builder *DeletePersonReqBuilder) Build() *DeletePersonReq {
+ req := &DeletePersonReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type DeletePersonReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type DeletePersonResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *DeletePersonResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetPersonReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetPersonReqBuilder() *GetPersonReqBuilder {
+ builder := &GetPersonReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// Person ID
+//
+// 示例值:1616161616
+func (builder *GetPersonReqBuilder) PersonId(personId string) *GetPersonReqBuilder {
+ builder.apiReq.PathParams.Set("person_id", fmt.Sprint(personId))
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:
+func (builder *GetPersonReqBuilder) UserIdType(userIdType string) *GetPersonReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+func (builder *GetPersonReqBuilder) Build() *GetPersonReq {
+ req := &GetPersonReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type GetPersonReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetPersonRespData struct {
+ Person *Person `json:"person,omitempty"` // 个人信息
+}
+
+type GetPersonResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetPersonRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetPersonResp) Success() bool {
+ return resp.Code == 0
+}
+
+type UploadPersonReqBodyBuilder struct {
+ fileContent io.Reader // 文件二进制内容
+ fileContentFlag bool
+ fileName string // 文件名称
+ fileNameFlag bool
+}
+
+func NewUploadPersonReqBodyBuilder() *UploadPersonReqBodyBuilder {
+ builder := &UploadPersonReqBodyBuilder{}
+ return builder
+}
+
+// 文件二进制内容
+//
+//示例值:file binary
+func (builder *UploadPersonReqBodyBuilder) FileContent(fileContent io.Reader) *UploadPersonReqBodyBuilder {
+ builder.fileContent = fileContent
+ builder.fileContentFlag = true
+ return builder
+}
+
+// 文件名称
+//
+//示例值:个人信息
+func (builder *UploadPersonReqBodyBuilder) FileName(fileName string) *UploadPersonReqBodyBuilder {
+ builder.fileName = fileName
+ builder.fileNameFlag = true
+ return builder
+}
+
+func (builder *UploadPersonReqBodyBuilder) Build() *UploadPersonReqBody {
+ req := &UploadPersonReqBody{}
+ if builder.fileContentFlag {
+ req.FileContent = builder.fileContent
+ }
+ if builder.fileNameFlag {
+ req.FileName = &builder.fileName
+ }
+ return req
+}
+
+type UploadPersonPathReqBodyBuilder struct {
+ fileContentPath string // 文件二进制内容
+ fileContentPathFlag bool
+ fileName string // 文件名称
+ fileNameFlag bool
+}
+
+func NewUploadPersonPathReqBodyBuilder() *UploadPersonPathReqBodyBuilder {
+ builder := &UploadPersonPathReqBodyBuilder{}
+ return builder
+}
+
+// 文件二进制内容
+//
+// 示例值:file binary
+func (builder *UploadPersonPathReqBodyBuilder) FileContentPath(fileContentPath string) *UploadPersonPathReqBodyBuilder {
+ builder.fileContentPath = fileContentPath
+ builder.fileContentPathFlag = true
+ return builder
+}
+
+// 文件名称
+//
+// 示例值:个人信息
+func (builder *UploadPersonPathReqBodyBuilder) FileName(fileName string) *UploadPersonPathReqBodyBuilder {
+ builder.fileName = fileName
+ builder.fileNameFlag = true
+ return builder
+}
+
+func (builder *UploadPersonPathReqBodyBuilder) Build() (*UploadPersonReqBody, error) {
+ req := &UploadPersonReqBody{}
+ if builder.fileContentPathFlag {
+ data, err := larkcore.File2Bytes(builder.fileContentPath)
+ if err != nil {
+ return nil, err
+ }
+ req.FileContent = bytes.NewBuffer(data)
+ }
+ if builder.fileNameFlag {
+ req.FileName = &builder.fileName
+ }
+ return req, nil
+}
+
+type UploadPersonReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *UploadPersonReqBody
+}
+
+func NewUploadPersonReqBuilder() *UploadPersonReqBuilder {
+ builder := &UploadPersonReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 上传文件
+func (builder *UploadPersonReqBuilder) Body(body *UploadPersonReqBody) *UploadPersonReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *UploadPersonReqBuilder) Build() *UploadPersonReq {
+ req := &UploadPersonReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type UploadPersonReqBody struct {
+ FileContent io.Reader `json:"file_content,omitempty"` // 文件二进制内容
+ FileName *string `json:"file_name,omitempty"` // 文件名称
+}
+
+type UploadPersonReq struct {
+ apiReq *larkcore.ApiReq
+ Body *UploadPersonReqBody `body:""`
+}
+
+type UploadPersonRespData struct {
+ Id *string `json:"id,omitempty"` // 上传文件ID
+}
+
+type UploadPersonResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *UploadPersonRespData `json:"data"` // 业务数据
+}
+
+func (resp *UploadPersonResp) Success() bool {
+ return resp.Code == 0
+}
+
+type DeletePreHireReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewDeletePreHireReqBuilder() *DeletePreHireReqBuilder {
+ builder := &DeletePreHireReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 需要删除的待入职人员信息ID
+//
+// 示例值:76534545454
+func (builder *DeletePreHireReqBuilder) PreHireId(preHireId string) *DeletePreHireReqBuilder {
+ builder.apiReq.PathParams.Set("pre_hire_id", fmt.Sprint(preHireId))
+ return builder
+}
+
+func (builder *DeletePreHireReqBuilder) Build() *DeletePreHireReq {
+ req := &DeletePreHireReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type DeletePreHireReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type DeletePreHireResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *DeletePreHireResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetPreHireReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetPreHireReqBuilder() *GetPreHireReqBuilder {
+ builder := &GetPreHireReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 待入职ID
+//
+// 示例值:121215
+func (builder *GetPreHireReqBuilder) PreHireId(preHireId string) *GetPreHireReqBuilder {
+ builder.apiReq.PathParams.Set("pre_hire_id", fmt.Sprint(preHireId))
+ return builder
+}
+
+func (builder *GetPreHireReqBuilder) Build() *GetPreHireReq {
+ req := &GetPreHireReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type GetPreHireReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetPreHireRespData struct {
+ PreHire *PreHire `json:"pre_hire,omitempty"` // 待入职信息
+}
+
+type GetPreHireResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetPreHireRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetPreHireResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListPreHireReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListPreHireReqBuilder() *ListPreHireReqBuilder {
+ builder := &ListPreHireReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:1231231987
+func (builder *ListPreHireReqBuilder) PageToken(pageToken string) *ListPreHireReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListPreHireReqBuilder) PageSize(pageSize string) *ListPreHireReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 待入职ID列表
+//
+// 示例值:
+func (builder *ListPreHireReqBuilder) PreHireIds(preHireIds []string) *ListPreHireReqBuilder {
+ for _, v := range preHireIds {
+ builder.apiReq.QueryParams.Add("pre_hire_ids", fmt.Sprint(v))
+ }
+ return builder
+}
+
+func (builder *ListPreHireReqBuilder) Build() *ListPreHireReq {
+ req := &ListPreHireReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListPreHireReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListPreHireRespData struct {
+ Items []*PreHireQuery `json:"items,omitempty"` // 查询的待入职信息
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type ListPreHireResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListPreHireRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListPreHireResp) Success() bool {
+ return resp.Code == 0
+}
+
+type PatchPreHireReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ preHire *PreHire
+}
+
+func NewPatchPreHireReqBuilder() *PatchPreHireReqBuilder {
+ builder := &PatchPreHireReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 待入职ID
+//
+// 示例值:1616161616
+func (builder *PatchPreHireReqBuilder) PreHireId(preHireId string) *PatchPreHireReqBuilder {
+ builder.apiReq.PathParams.Set("pre_hire_id", fmt.Sprint(preHireId))
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *PatchPreHireReqBuilder) ClientToken(clientToken string) *PatchPreHireReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 更新待入职数据
+func (builder *PatchPreHireReqBuilder) PreHire(preHire *PreHire) *PatchPreHireReqBuilder {
+ builder.preHire = preHire
+ return builder
+}
+
+func (builder *PatchPreHireReqBuilder) Build() *PatchPreHireReq {
+ req := &PatchPreHireReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.preHire
+ return req
+}
+
+type PatchPreHireReq struct {
+ apiReq *larkcore.ApiReq
+ PreHire *PreHire `body:""`
+}
+
+type PatchPreHireRespData struct {
+ PreHire *PreHire `json:"pre_hire,omitempty"` // 待入职数据
+}
+
+type PatchPreHireResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *PatchPreHireRespData `json:"data"` // 业务数据
+}
+
+func (resp *PatchPreHireResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetProcessFormVariableDataReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetProcessFormVariableDataReqBuilder() *GetProcessFormVariableDataReqBuilder {
+ builder := &GetProcessFormVariableDataReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 流程ID
+//
+// 示例值:123456987
+func (builder *GetProcessFormVariableDataReqBuilder) ProcessId(processId string) *GetProcessFormVariableDataReqBuilder {
+ builder.apiReq.PathParams.Set("process_id", fmt.Sprint(processId))
+ return builder
+}
+
+func (builder *GetProcessFormVariableDataReqBuilder) Build() *GetProcessFormVariableDataReq {
+ req := &GetProcessFormVariableDataReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type GetProcessFormVariableDataReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetProcessFormVariableDataRespData struct {
+ FieldVariableValues []*FormFieldVariable `json:"field_variable_values,omitempty"` // 流程变量
+}
+
+type GetProcessFormVariableDataResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetProcessFormVariableDataRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetProcessFormVariableDataResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListSecurityGroupReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListSecurityGroupReqBuilder() *ListSecurityGroupReqBuilder {
+ builder := &ListSecurityGroupReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:10
+func (builder *ListSecurityGroupReqBuilder) PageToken(pageToken string) *ListSecurityGroupReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListSecurityGroupReqBuilder) PageSize(pageSize string) *ListSecurityGroupReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+func (builder *ListSecurityGroupReqBuilder) Build() *ListSecurityGroupReq {
+ req := &ListSecurityGroupReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListSecurityGroupReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListSecurityGroupRespData struct {
+ Items []*SecurityGroup `json:"items,omitempty"` // 查询的用户角色信息
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type ListSecurityGroupResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListSecurityGroupRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListSecurityGroupResp) Success() bool {
+ return resp.Code == 0
+}
+
+type QuerySecurityGroupReqBodyBuilder struct {
+ itemList []*BpRoleOrganization // 角色列表,一次最多支持查询 50 个
+ itemListFlag bool
+}
+
+func NewQuerySecurityGroupReqBodyBuilder() *QuerySecurityGroupReqBodyBuilder {
+ builder := &QuerySecurityGroupReqBodyBuilder{}
+ return builder
+}
+
+// 角色列表,一次最多支持查询 50 个
+//
+//示例值:
+func (builder *QuerySecurityGroupReqBodyBuilder) ItemList(itemList []*BpRoleOrganization) *QuerySecurityGroupReqBodyBuilder {
+ builder.itemList = itemList
+ builder.itemListFlag = true
+ return builder
+}
+
+func (builder *QuerySecurityGroupReqBodyBuilder) Build() *QuerySecurityGroupReqBody {
+ req := &QuerySecurityGroupReqBody{}
+ if builder.itemListFlag {
+ req.ItemList = builder.itemList
+ }
+ return req
+}
+
+type QuerySecurityGroupPathReqBodyBuilder struct {
+ itemList []*BpRoleOrganization // 角色列表,一次最多支持查询 50 个
+ itemListFlag bool
+}
+
+func NewQuerySecurityGroupPathReqBodyBuilder() *QuerySecurityGroupPathReqBodyBuilder {
+ builder := &QuerySecurityGroupPathReqBodyBuilder{}
+ return builder
+}
+
+// 角色列表,一次最多支持查询 50 个
+//
+// 示例值:
+func (builder *QuerySecurityGroupPathReqBodyBuilder) ItemList(itemList []*BpRoleOrganization) *QuerySecurityGroupPathReqBodyBuilder {
+ builder.itemList = itemList
+ builder.itemListFlag = true
+ return builder
+}
+
+func (builder *QuerySecurityGroupPathReqBodyBuilder) Build() (*QuerySecurityGroupReqBody, error) {
+ req := &QuerySecurityGroupReqBody{}
+ if builder.itemListFlag {
+ req.ItemList = builder.itemList
+ }
+ return req, nil
+}
+
+type QuerySecurityGroupReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *QuerySecurityGroupReqBody
+}
+
+func NewQuerySecurityGroupReqBuilder() *QuerySecurityGroupReqBuilder {
+ builder := &QuerySecurityGroupReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 此次调用中使用的部门 ID 类型
+//
+// 示例值:people_corehr_department_id
+func (builder *QuerySecurityGroupReqBuilder) DepartmentIdType(departmentIdType string) *QuerySecurityGroupReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+// 通过部门或工作地点,查询对应的 HRBP/属地 BP
+func (builder *QuerySecurityGroupReqBuilder) Body(body *QuerySecurityGroupReqBody) *QuerySecurityGroupReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *QuerySecurityGroupReqBuilder) Build() *QuerySecurityGroupReq {
+ req := &QuerySecurityGroupReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type QuerySecurityGroupReqBody struct {
+ ItemList []*BpRoleOrganization `json:"item_list,omitempty"` // 角色列表,一次最多支持查询 50 个
+}
+
+type QuerySecurityGroupReq struct {
+ apiReq *larkcore.ApiReq
+ Body *QuerySecurityGroupReqBody `body:""`
+}
+
+type QuerySecurityGroupRespData struct {
+ HrbpList []*Hrbp `json:"hrbp_list,omitempty"` // HRBP/属地 BP 信息
+}
+
+type QuerySecurityGroupResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *QuerySecurityGroupRespData `json:"data"` // 业务数据
+}
+
+func (resp *QuerySecurityGroupResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetSubdivisionReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetSubdivisionReqBuilder() *GetSubdivisionReqBuilder {
+ builder := &GetSubdivisionReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 省份/行政区 ID
+//
+// 示例值:67489937334909845
+func (builder *GetSubdivisionReqBuilder) SubdivisionId(subdivisionId string) *GetSubdivisionReqBuilder {
+ builder.apiReq.PathParams.Set("subdivision_id", fmt.Sprint(subdivisionId))
+ return builder
+}
+
+func (builder *GetSubdivisionReqBuilder) Build() *GetSubdivisionReq {
+ req := &GetSubdivisionReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type GetSubdivisionReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetSubdivisionRespData struct {
+ Subdivision *Subdivision `json:"subdivision,omitempty"` // 国家/地址信息
+}
+
+type GetSubdivisionResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetSubdivisionRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetSubdivisionResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListSubdivisionReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListSubdivisionReqBuilder() *ListSubdivisionReqBuilder {
+ builder := &ListSubdivisionReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:1231231987
+func (builder *ListSubdivisionReqBuilder) PageToken(pageToken string) *ListSubdivisionReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListSubdivisionReqBuilder) PageSize(pageSize string) *ListSubdivisionReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 国家/地区id,填写后只查询该国家/地区下的省份/行政区
+//
+// 示例值:100
+func (builder *ListSubdivisionReqBuilder) CountryRegionId(countryRegionId string) *ListSubdivisionReqBuilder {
+ builder.apiReq.QueryParams.Set("country_region_id", fmt.Sprint(countryRegionId))
+ return builder
+}
+
+func (builder *ListSubdivisionReqBuilder) Build() *ListSubdivisionReq {
+ req := &ListSubdivisionReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListSubdivisionReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListSubdivisionRespData struct {
+ Items []*Subdivision `json:"items,omitempty"` // 省份/行政区信息
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type ListSubdivisionResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListSubdivisionRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListSubdivisionResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetSubregionReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetSubregionReqBuilder() *GetSubregionReqBuilder {
+ builder := &GetSubregionReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 城市/区域 ID
+//
+// 示例值:67489937334909845
+func (builder *GetSubregionReqBuilder) SubregionId(subregionId string) *GetSubregionReqBuilder {
+ builder.apiReq.PathParams.Set("subregion_id", fmt.Sprint(subregionId))
+ return builder
+}
+
+func (builder *GetSubregionReqBuilder) Build() *GetSubregionReq {
+ req := &GetSubregionReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type GetSubregionReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetSubregionRespData struct {
+ Subregion *Subregion `json:"subregion,omitempty"` // 城市/区域信息
+}
+
+type GetSubregionResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetSubregionRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetSubregionResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListSubregionReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListSubregionReqBuilder() *ListSubregionReqBuilder {
+ builder := &ListSubregionReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:1231231987
+func (builder *ListSubregionReqBuilder) PageToken(pageToken string) *ListSubregionReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListSubregionReqBuilder) PageSize(pageSize string) *ListSubregionReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 省份/行政区id,填写后只查询该省份/行政区下的城市/区域
+//
+// 示例值:100
+func (builder *ListSubregionReqBuilder) SubdivisionId(subdivisionId string) *ListSubregionReqBuilder {
+ builder.apiReq.QueryParams.Set("subdivision_id", fmt.Sprint(subdivisionId))
+ return builder
+}
+
+func (builder *ListSubregionReqBuilder) Build() *ListSubregionReq {
+ req := &ListSubregionReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListSubregionReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListSubregionRespData struct {
+ Items []*Subregion `json:"items,omitempty"` // 城市/区域信息
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type ListSubregionResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListSubregionRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListSubregionResp) Success() bool {
+ return resp.Code == 0
+}
+
+type QueryTransferReasonReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewQueryTransferReasonReqBuilder() *QueryTransferReasonReqBuilder {
+ builder := &QueryTransferReasonReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 异动原因状态
+//
+// 示例值:true
+func (builder *QueryTransferReasonReqBuilder) Active(active bool) *QueryTransferReasonReqBuilder {
+ builder.apiReq.QueryParams.Set("active", fmt.Sprint(active))
+ return builder
+}
+
+// 异动原因唯一标识,多条时最多数量为10
+//
+// 示例值:voluntary_transfer
+func (builder *QueryTransferReasonReqBuilder) TransferReasonUniqueIdentifier(transferReasonUniqueIdentifier []string) *QueryTransferReasonReqBuilder {
+ for _, v := range transferReasonUniqueIdentifier {
+ builder.apiReq.QueryParams.Add("transfer_reason_unique_identifier", fmt.Sprint(v))
+ }
+ return builder
+}
+
+func (builder *QueryTransferReasonReqBuilder) Build() *QueryTransferReasonReq {
+ req := &QueryTransferReasonReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type QueryTransferReasonReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type QueryTransferReasonRespData struct {
+ Items []*TransferReason `json:"items,omitempty"` // 异动原因列表
+}
+
+type QueryTransferReasonResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *QueryTransferReasonRespData `json:"data"` // 业务数据
+}
+
+func (resp *QueryTransferReasonResp) Success() bool {
+ return resp.Code == 0
+}
+
+type QueryTransferTypeReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewQueryTransferTypeReqBuilder() *QueryTransferTypeReqBuilder {
+ builder := &QueryTransferTypeReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 异动类型状态
+//
+// 示例值:true
+func (builder *QueryTransferTypeReqBuilder) Active(active bool) *QueryTransferTypeReqBuilder {
+ builder.apiReq.QueryParams.Set("active", fmt.Sprint(active))
+ return builder
+}
+
+// 异动类型唯一标识,多条时最多数量为10
+//
+// 示例值:job_status_change
+func (builder *QueryTransferTypeReqBuilder) TransferTypeUniqueIdentifier(transferTypeUniqueIdentifier []string) *QueryTransferTypeReqBuilder {
+ for _, v := range transferTypeUniqueIdentifier {
+ builder.apiReq.QueryParams.Add("transfer_type_unique_identifier", fmt.Sprint(v))
+ }
+ return builder
+}
+
+func (builder *QueryTransferTypeReqBuilder) Build() *QueryTransferTypeReq {
+ req := &QueryTransferTypeReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type QueryTransferTypeReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type QueryTransferTypeRespData struct {
+ Items []*TransferType `json:"items,omitempty"` // 异动类型列表
+}
+
+type QueryTransferTypeResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *QueryTransferTypeRespData `json:"data"` // 业务数据
+}
+
+func (resp *QueryTransferTypeResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateWorkingHoursTypeReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ workingHoursType *WorkingHoursType
+}
+
+func NewCreateWorkingHoursTypeReqBuilder() *CreateWorkingHoursTypeReqBuilder {
+ builder := &CreateWorkingHoursTypeReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *CreateWorkingHoursTypeReqBuilder) ClientToken(clientToken string) *CreateWorkingHoursTypeReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 创建工时制度
+func (builder *CreateWorkingHoursTypeReqBuilder) WorkingHoursType(workingHoursType *WorkingHoursType) *CreateWorkingHoursTypeReqBuilder {
+ builder.workingHoursType = workingHoursType
+ return builder
+}
+
+func (builder *CreateWorkingHoursTypeReqBuilder) Build() *CreateWorkingHoursTypeReq {
+ req := &CreateWorkingHoursTypeReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.workingHoursType
+ return req
+}
+
+type CreateWorkingHoursTypeReq struct {
+ apiReq *larkcore.ApiReq
+ WorkingHoursType *WorkingHoursType `body:""`
+}
+
+type CreateWorkingHoursTypeRespData struct {
+ WorkingHoursType *WorkingHoursType `json:"working_hours_type,omitempty"` // 工时制度
+}
+
+type CreateWorkingHoursTypeResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateWorkingHoursTypeRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateWorkingHoursTypeResp) Success() bool {
+ return resp.Code == 0
+}
+
+type DeleteWorkingHoursTypeReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewDeleteWorkingHoursTypeReqBuilder() *DeleteWorkingHoursTypeReqBuilder {
+ builder := &DeleteWorkingHoursTypeReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 需要删除的工时制度 ID
+//
+// 示例值:325325254
+func (builder *DeleteWorkingHoursTypeReqBuilder) WorkingHoursTypeId(workingHoursTypeId string) *DeleteWorkingHoursTypeReqBuilder {
+ builder.apiReq.PathParams.Set("working_hours_type_id", fmt.Sprint(workingHoursTypeId))
+ return builder
+}
+
+func (builder *DeleteWorkingHoursTypeReqBuilder) Build() *DeleteWorkingHoursTypeReq {
+ req := &DeleteWorkingHoursTypeReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type DeleteWorkingHoursTypeReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type DeleteWorkingHoursTypeResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *DeleteWorkingHoursTypeResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetWorkingHoursTypeReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetWorkingHoursTypeReqBuilder() *GetWorkingHoursTypeReqBuilder {
+ builder := &GetWorkingHoursTypeReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 工时制度 ID
+//
+// 示例值:1212
+func (builder *GetWorkingHoursTypeReqBuilder) WorkingHoursTypeId(workingHoursTypeId string) *GetWorkingHoursTypeReqBuilder {
+ builder.apiReq.PathParams.Set("working_hours_type_id", fmt.Sprint(workingHoursTypeId))
+ return builder
+}
+
+func (builder *GetWorkingHoursTypeReqBuilder) Build() *GetWorkingHoursTypeReq {
+ req := &GetWorkingHoursTypeReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type GetWorkingHoursTypeReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetWorkingHoursTypeRespData struct {
+ WorkingHoursType *WorkingHoursType `json:"working_hours_type,omitempty"` // 工时制度信息
+}
+
+type GetWorkingHoursTypeResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetWorkingHoursTypeRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetWorkingHoursTypeResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListWorkingHoursTypeReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListWorkingHoursTypeReqBuilder() *ListWorkingHoursTypeReqBuilder {
+ builder := &ListWorkingHoursTypeReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:1231231987
+func (builder *ListWorkingHoursTypeReqBuilder) PageToken(pageToken string) *ListWorkingHoursTypeReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListWorkingHoursTypeReqBuilder) PageSize(pageSize string) *ListWorkingHoursTypeReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+func (builder *ListWorkingHoursTypeReqBuilder) Build() *ListWorkingHoursTypeReq {
+ req := &ListWorkingHoursTypeReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListWorkingHoursTypeReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListWorkingHoursTypeRespData struct {
+ Items []*WorkingHoursType `json:"items,omitempty"` // 查询的工时制度信息
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type ListWorkingHoursTypeResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListWorkingHoursTypeRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListWorkingHoursTypeResp) Success() bool {
+ return resp.Code == 0
+}
+
+type PatchWorkingHoursTypeReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ workingHoursType *WorkingHoursType
+}
+
+func NewPatchWorkingHoursTypeReqBuilder() *PatchWorkingHoursTypeReqBuilder {
+ builder := &PatchWorkingHoursTypeReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 工时制度ID
+//
+// 示例值:1616161616
+func (builder *PatchWorkingHoursTypeReqBuilder) WorkingHoursTypeId(workingHoursTypeId string) *PatchWorkingHoursTypeReqBuilder {
+ builder.apiReq.PathParams.Set("working_hours_type_id", fmt.Sprint(workingHoursTypeId))
+ return builder
+}
+
+// 根据client_token是否一致来判断是否为同一请求
+//
+// 示例值:12454646
+func (builder *PatchWorkingHoursTypeReqBuilder) ClientToken(clientToken string) *PatchWorkingHoursTypeReqBuilder {
+ builder.apiReq.QueryParams.Set("client_token", fmt.Sprint(clientToken))
+ return builder
+}
+
+// 更新工时制度
+func (builder *PatchWorkingHoursTypeReqBuilder) WorkingHoursType(workingHoursType *WorkingHoursType) *PatchWorkingHoursTypeReqBuilder {
+ builder.workingHoursType = workingHoursType
+ return builder
+}
+
+func (builder *PatchWorkingHoursTypeReqBuilder) Build() *PatchWorkingHoursTypeReq {
+ req := &PatchWorkingHoursTypeReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.workingHoursType
+ return req
+}
+
+type PatchWorkingHoursTypeReq struct {
+ apiReq *larkcore.ApiReq
+ WorkingHoursType *WorkingHoursType `body:""`
+}
+
+type PatchWorkingHoursTypeRespData struct {
+ WorkingHoursType *WorkingHoursType `json:"working_hours_type,omitempty"` // 工时制度
+}
+
+type PatchWorkingHoursTypeResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *PatchWorkingHoursTypeRespData `json:"data"` // 业务数据
+}
+
+func (resp *PatchWorkingHoursTypeResp) Success() bool {
+ return resp.Code == 0
+}
+
+type P2ContractCreatedV1Data struct {
+ ContractId *string `json:"contract_id,omitempty"` // ID
+}
+
+type P2ContractCreatedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2ContractCreatedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2ContractCreatedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type P2DepartmentCreatedV1Data struct {
+ DepartmentId *string `json:"department_id,omitempty"` // 新建部门的 ID
+}
+
+type P2DepartmentCreatedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2DepartmentCreatedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2DepartmentCreatedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type P2DepartmentDeletedV1Data struct {
+ DepartmentId *string `json:"department_id,omitempty"` // 被删除部门的 ID
+}
+
+type P2DepartmentDeletedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2DepartmentDeletedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2DepartmentDeletedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type P2DepartmentUpdatedV1Data struct {
+ DepartmentId *string `json:"department_id,omitempty"` // 被更新部门的 ID
+ FieldChanges []string `json:"field_changes,omitempty"` // 发生变更的字段
+}
+
+type P2DepartmentUpdatedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2DepartmentUpdatedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2DepartmentUpdatedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type P2EmploymentConvertedV1Data struct {
+ EmploymentId *string `json:"employment_id,omitempty"` // 主对象ID
+}
+
+type P2EmploymentConvertedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2EmploymentConvertedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2EmploymentConvertedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type P2EmploymentCreatedV1Data struct {
+ EmploymentId *string `json:"employment_id,omitempty"` // 被创建的雇佣信息的 ID
+ TargetUserId *UserId `json:"target_user_id,omitempty"` // 用户 ID
+}
+
+type P2EmploymentCreatedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2EmploymentCreatedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2EmploymentCreatedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type P2EmploymentDeletedV1Data struct {
+ EmploymentId *string `json:"employment_id,omitempty"` // 被删除的雇佣信息的 ID
+ TargetUserId *UserId `json:"target_user_id,omitempty"` // 用户 ID
+}
+
+type P2EmploymentDeletedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2EmploymentDeletedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2EmploymentDeletedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type P2EmploymentResignedV1Data struct {
+ EmploymentId *string `json:"employment_id,omitempty"` // 主对象ID
+}
+
+type P2EmploymentResignedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2EmploymentResignedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2EmploymentResignedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type P2EmploymentUpdatedV1Data struct {
+ EmploymentId *string `json:"employment_id,omitempty"` // 被更新的雇佣信息 ID
+ TargetUserId *UserId `json:"target_user_id,omitempty"` // 用户 ID
+ FieldChanges []string `json:"field_changes,omitempty"` // 发生变更的字段
+}
+
+type P2EmploymentUpdatedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2EmploymentUpdatedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2EmploymentUpdatedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type P2JobChangeUpdatedV1Data struct {
+ EmploymentId *string `json:"employment_id,omitempty"` // 雇员ID
+ TargetUserId *UserId `json:"target_user_id,omitempty"` // 用户 ID
+ JobChangeId *string `json:"job_change_id,omitempty"` // 异动记录 id
+ TransferMode *int `json:"transfer_mode,omitempty"` // 异动属性/方式
+ TransferTypeUniqueIdentifier *string `json:"transfer_type_unique_identifier,omitempty"` // 异动类型唯一标识
+ ProcessId *string `json:"process_id,omitempty"` // 异动发起后的审批流程 id,如果是直接异动,则无需要审批流程id
+ EffectiveDate *string `json:"effective_date,omitempty"` // 异动生效日期
+ Status *int `json:"status,omitempty"` // 异动状态
+ TransferKey *string `json:"transfer_key,omitempty"` // 异动记录标识符
+}
+
+type P2JobChangeUpdatedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2JobChangeUpdatedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2JobChangeUpdatedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type P2JobDataChangedV1Data struct {
+ JobDataId *string `json:"job_data_id,omitempty"` // 主对象ID
+}
+
+type P2JobDataChangedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2JobDataChangedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2JobDataChangedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type P2JobDataEmployedV1Data struct {
+ JobDataId *string `json:"job_data_id,omitempty"` // 主对象ID
+}
+
+type P2JobDataEmployedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2JobDataEmployedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2JobDataEmployedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type P2OffboardingUpdatedV1Data struct {
+ EmploymentId *string `json:"employment_id,omitempty"` // 员工 ID
+ TargetUserId *UserId `json:"target_user_id,omitempty"` // 用户 ID
+ OffboardingId *string `json:"offboarding_id,omitempty"` // 离职记录 ID
+ ProcessId *string `json:"process_id,omitempty"` // 离职发起后的审批流程实例 ID
+ Status *int `json:"status,omitempty"` // 离职状态
+}
+
+type P2OffboardingUpdatedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2OffboardingUpdatedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2OffboardingUpdatedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type P2OrgRoleAuthorizationUpdatedV1Data struct {
+ RoleId *string `json:"role_id,omitempty"` // 角色id
+ ManagementScopeList []*ManagementScope `json:"management_scope_list,omitempty"` // 管理范围信息
+ EmploymentIdList []string `json:"employment_id_list,omitempty"` // 员工雇佣信息ID list
+}
+
+type P2OrgRoleAuthorizationUpdatedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2OrgRoleAuthorizationUpdatedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2OrgRoleAuthorizationUpdatedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type P2PersonCreatedV1Data struct {
+ PersonId *string `json:"person_id,omitempty"` // 人员ID
+}
+
+type P2PersonCreatedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2PersonCreatedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2PersonCreatedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type P2PersonDeletedV1Data struct {
+ PersonId *string `json:"person_id,omitempty"` // 人员ID
+}
+
+type P2PersonDeletedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2PersonDeletedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2PersonDeletedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type P2PersonUpdatedV1Data struct {
+ PersonId *string `json:"person_id,omitempty"` // 被更新个人信息的 ID
+ FieldChanges []string `json:"field_changes,omitempty"` // 发生变更的字段
+}
+
+type P2PersonUpdatedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2PersonUpdatedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2PersonUpdatedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type SearchOffboardingIterator struct {
+ nextPageToken *string
+ items []*Offboarding
+ index int
+ limit int
+ ctx context.Context
+ req *SearchOffboardingReq
+ listFunc func(ctx context.Context, req *SearchOffboardingReq, options ...larkcore.RequestOptionFunc) (*SearchOffboardingResp, error)
+ options []larkcore.RequestOptionFunc
+ curlNum int
+}
+
+func (iterator *SearchOffboardingIterator) Next() (bool, *Offboarding, error) {
+ // 达到最大量,则返回
+ if iterator.limit > 0 && iterator.curlNum >= iterator.limit {
+ return false, nil, nil
+ }
+
+ // 为0则拉取数据
+ if iterator.index == 0 || iterator.index >= len(iterator.items) {
+ if iterator.index != 0 && iterator.nextPageToken == nil {
+ return false, nil, nil
+ }
+ if iterator.nextPageToken != nil {
+ iterator.req.apiReq.QueryParams.Set("page_token", *iterator.nextPageToken)
+ }
+ resp, err := iterator.listFunc(iterator.ctx, iterator.req, iterator.options...)
+ if err != nil {
+ return false, nil, err
+ }
+
+ if resp.Code != 0 {
+ return false, nil, errors.New(fmt.Sprintf("Code:%d,Msg:%s", resp.Code, resp.Msg))
+ }
+
+ if len(resp.Data.Items) == 0 {
+ return false, nil, nil
+ }
+
+ iterator.nextPageToken = resp.Data.PageToken
+ iterator.items = resp.Data.Items
+ iterator.index = 0
+ }
+
+ block := iterator.items[iterator.index]
+ iterator.index++
+ iterator.curlNum++
+ return true, block, nil
+}
+
+func (iterator *SearchOffboardingIterator) NextPageToken() *string {
+ return iterator.nextPageToken
+}
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/docx/v1/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/docx/v1/model.go
index 1be8eba7de..884edc0554 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/docx/v1/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/docx/v1/model.go
@@ -224,6 +224,8 @@ type Block struct {
OkrKeyResult *OkrKeyResult `json:"okr_key_result,omitempty"` // OKR Key Result
OkrProgress *OkrProgress `json:"okr_progress,omitempty"` // OKR 进展信息
CommentIds []string `json:"comment_ids,omitempty"` // 评论 id 列表
+ JiraIssue *JiraIssue `json:"jira_issue,omitempty"` // Jira Issue
+ WikiCatalog *WikiCatalog `json:"wiki_catalog,omitempty"` // Wiki 子目录 Block
}
type BlockBuilder struct {
@@ -319,6 +321,10 @@ type BlockBuilder struct {
okrProgressFlag bool
commentIds []string // 评论 id 列表
commentIdsFlag bool
+ jiraIssue *JiraIssue // Jira Issue
+ jiraIssueFlag bool
+ wikiCatalog *WikiCatalog // Wiki 子目录 Block
+ wikiCatalogFlag bool
}
func NewBlockBuilder() *BlockBuilder {
@@ -740,6 +746,24 @@ func (builder *BlockBuilder) CommentIds(commentIds []string) *BlockBuilder {
return builder
}
+// Jira Issue
+//
+// 示例值:
+func (builder *BlockBuilder) JiraIssue(jiraIssue *JiraIssue) *BlockBuilder {
+ builder.jiraIssue = jiraIssue
+ builder.jiraIssueFlag = true
+ return builder
+}
+
+// Wiki 子目录 Block
+//
+// 示例值:
+func (builder *BlockBuilder) WikiCatalog(wikiCatalog *WikiCatalog) *BlockBuilder {
+ builder.wikiCatalog = wikiCatalog
+ builder.wikiCatalogFlag = true
+ return builder
+}
+
func (builder *BlockBuilder) Build() *Block {
req := &Block{}
if builder.blockIdFlag {
@@ -883,6 +907,12 @@ func (builder *BlockBuilder) Build() *Block {
if builder.commentIdsFlag {
req.CommentIds = builder.commentIds
}
+ if builder.jiraIssueFlag {
+ req.JiraIssue = builder.jiraIssue
+ }
+ if builder.wikiCatalogFlag {
+ req.WikiCatalog = builder.wikiCatalog
+ }
return req
}
@@ -1289,15 +1319,18 @@ func (builder *EquationBuilder) Build() *Equation {
}
type File struct {
- Token *string `json:"token,omitempty"` // 附件 Token
- Name *string `json:"name,omitempty"` // 文件名
+ Token *string `json:"token,omitempty"` // 附件 Token
+ Name *string `json:"name,omitempty"` // 文件名
+ ViewType *int `json:"view_type,omitempty"` // 视图类型,卡片视图(默认)或预览视图
}
type FileBuilder struct {
- token string // 附件 Token
- tokenFlag bool
- name string // 文件名
- nameFlag bool
+ token string // 附件 Token
+ tokenFlag bool
+ name string // 文件名
+ nameFlag bool
+ viewType int // 视图类型,卡片视图(默认)或预览视图
+ viewTypeFlag bool
}
func NewFileBuilder() *FileBuilder {
@@ -1323,6 +1356,15 @@ func (builder *FileBuilder) Name(name string) *FileBuilder {
return builder
}
+// 视图类型,卡片视图(默认)或预览视图
+//
+// 示例值:1
+func (builder *FileBuilder) ViewType(viewType int) *FileBuilder {
+ builder.viewType = viewType
+ builder.viewTypeFlag = true
+ return builder
+}
+
func (builder *FileBuilder) Build() *File {
req := &File{}
if builder.tokenFlag {
@@ -1332,6 +1374,10 @@ func (builder *FileBuilder) Build() *File {
if builder.nameFlag {
req.Name = &builder.name
+ }
+ if builder.viewTypeFlag {
+ req.ViewType = &builder.viewType
+
}
return req
}
@@ -1797,6 +1843,54 @@ func (builder *IsvBuilder) Build() *Isv {
return req
}
+type JiraIssue struct {
+ Id *string `json:"id,omitempty"` // Jira issue ID
+ Key *string `json:"key,omitempty"` // Jira issue key
+}
+
+type JiraIssueBuilder struct {
+ id string // Jira issue ID
+ idFlag bool
+ key string // Jira issue key
+ keyFlag bool
+}
+
+func NewJiraIssueBuilder() *JiraIssueBuilder {
+ builder := &JiraIssueBuilder{}
+ return builder
+}
+
+// Jira issue ID
+//
+// 示例值:37159
+func (builder *JiraIssueBuilder) Id(id string) *JiraIssueBuilder {
+ builder.id = id
+ builder.idFlag = true
+ return builder
+}
+
+// Jira issue key
+//
+// 示例值:Project-8317
+func (builder *JiraIssueBuilder) Key(key string) *JiraIssueBuilder {
+ builder.key = key
+ builder.keyFlag = true
+ return builder
+}
+
+func (builder *JiraIssueBuilder) Build() *JiraIssue {
+ req := &JiraIssue{}
+ if builder.idFlag {
+ req.Id = &builder.id
+
+ }
+ if builder.keyFlag {
+ req.Key = &builder.key
+
+ }
+ return req
+}
+
type Link struct {
Url *string `json:"url,omitempty"` // 超链接指向的 url (需要 url_encode)
}
@@ -4227,6 +4321,38 @@ func (builder *ViewBuilder) Build() *View {
return req
}
+type WikiCatalog struct {
+ WikiToken *string `json:"wiki_token,omitempty"` // 知识库 token
+}
+
+type WikiCatalogBuilder struct {
+ wikiToken string // 知识库 token
+ wikiTokenFlag bool
+}
+
+func NewWikiCatalogBuilder() *WikiCatalogBuilder {
+ builder := &WikiCatalogBuilder{}
+ return builder
+}
+
+// 知识库 token
+//
+// 示例值:Ub47wVl7AikG9wkgnpSbFy4EcAc
+func (builder *WikiCatalogBuilder) WikiToken(wikiToken string) *WikiCatalogBuilder {
+ builder.wikiToken = wikiToken
+ builder.wikiTokenFlag = true
+ return builder
+}
+
+func (builder *WikiCatalogBuilder) Build() *WikiCatalog {
+ req := &WikiCatalog{}
+ if builder.wikiTokenFlag {
+ req.WikiToken = &builder.wikiToken
+
+ }
+ return req
+}
+
type CreateDocumentReqBodyBuilder struct {
folderToken string // 文件夹 token,获取方式见云文档接口快速入门;空表示根目录,tenant_access_token应用权限仅允许操作应用创建的目录
folderTokenFlag bool
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/drive/v1/api.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/drive/v1/api.go
index 20c81f9f3f..4cc6ccb2de 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/drive/v1/api.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/drive/v1/api.go
@@ -30,28 +30,32 @@ func NewService(config *larkcore.Config) *DriveService {
d.FileStatistics = &fileStatistics{service: d}
d.FileSubscription = &fileSubscription{service: d}
d.FileVersion = &fileVersion{service: d}
+ d.FileViewRecord = &fileViewRecord{service: d}
d.ImportTask = &importTask{service: d}
d.Media = &media{service: d}
d.Meta = &meta{service: d}
d.PermissionMember = &permissionMember{service: d}
d.PermissionPublic = &permissionPublic{service: d}
+ d.PermissionPublicPassword = &permissionPublicPassword{service: d}
return d
}
type DriveService struct {
- config *larkcore.Config
- ExportTask *exportTask // 导出
- File *file // 文件
- FileComment *fileComment // 评论
- FileCommentReply *fileCommentReply // 评论
- FileStatistics *fileStatistics // file.statistics
- FileSubscription *fileSubscription // 订阅
- FileVersion *fileVersion // 文档版本
- ImportTask *importTask // 导入
- Media *media // 素材
- Meta *meta // meta
- PermissionMember *permissionMember // 成员
- PermissionPublic *permissionPublic // 设置
+ config *larkcore.Config
+ ExportTask *exportTask // 导出
+ File *file // 异步任务状态
+ FileComment *fileComment // 评论
+ FileCommentReply *fileCommentReply // 评论
+ FileStatistics *fileStatistics // file.statistics
+ FileSubscription *fileSubscription // 订阅
+ FileVersion *fileVersion // 文档版本
+ FileViewRecord *fileViewRecord // file.view_record
+ ImportTask *importTask // 导入
+ Media *media // 素材
+ Meta *meta // meta
+ PermissionMember *permissionMember // 成员
+ PermissionPublic *permissionPublic // 设置
+ PermissionPublicPassword *permissionPublicPassword // permission.public.password
}
type exportTask struct {
@@ -75,6 +79,9 @@ type fileSubscription struct {
type fileVersion struct {
service *DriveService
}
+type fileViewRecord struct {
+ service *DriveService
+}
type importTask struct {
service *DriveService
}
@@ -90,6 +97,9 @@ type permissionMember struct {
type permissionPublic struct {
service *DriveService
}
+type permissionPublicPassword struct {
+ service *DriveService
+}
// 创建导出任务
//
@@ -231,6 +241,32 @@ func (f *file) CreateFolder(ctx context.Context, req *CreateFolderFileReq, optio
return resp, err
}
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create_shortcut&project=drive&resource=file&version=v1
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/drivev1/createShortcut_file.go
+func (f *file) CreateShortcut(ctx context.Context, req *CreateShortcutFileReq, options ...larkcore.RequestOptionFunc) (*CreateShortcutFileResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/drive/v1/files/create_shortcut"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, f.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateShortcutFileResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, f.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
// 删除文件
//
// - 删除用户在云空间内的文件或者文件夹。文件或者文件夹被删除后,会进入用户回收站里。
@@ -517,6 +553,32 @@ func (f *file) UploadPrepare(ctx context.Context, req *UploadPrepareFileReq, opt
return resp, err
}
+// 批量获取评论
+//
+// - 该接口用于根据评论 ID 列表批量获取评论。
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/file-comment/batch_query
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/drivev1/batchQuery_fileComment.go
+func (f *fileComment) BatchQuery(ctx context.Context, req *BatchQueryFileCommentReq, options ...larkcore.RequestOptionFunc) (*BatchQueryFileCommentResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/drive/v1/files/:file_token/comments/batch_query"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
+ apiResp, err := larkcore.Request(ctx, apiReq, f.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &BatchQueryFileCommentResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, f.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
// 添加评论
//
// - 往云文档添加一条全局评论。
@@ -823,7 +885,7 @@ func (f *fileVersion) Delete(ctx context.Context, req *DeleteFileVersionReq, opt
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/drive/v1/files/:file_token/versions/:version_id"
apiReq.HttpMethod = http.MethodDelete
- apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, f.service.config, options...)
if err != nil {
return nil, err
@@ -875,7 +937,7 @@ func (f *fileVersion) List(ctx context.Context, req *ListFileVersionReq, options
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/drive/v1/files/:file_token/versions"
apiReq.HttpMethod = http.MethodGet
- apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, f.service.config, options...)
if err != nil {
return nil, err
@@ -897,6 +959,40 @@ func (f *fileVersion) ListByIterator(ctx context.Context, req *ListFileVersionRe
limit: req.Limit}, nil
}
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=drive&resource=file.view_record&version=v1
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/drivev1/list_fileViewRecord.go
+func (f *fileViewRecord) List(ctx context.Context, req *ListFileViewRecordReq, options ...larkcore.RequestOptionFunc) (*ListFileViewRecordResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/drive/v1/files/:file_token/view_records"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
+ apiResp, err := larkcore.Request(ctx, apiReq, f.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListFileViewRecordResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, f.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+func (f *fileViewRecord) ListByIterator(ctx context.Context, req *ListFileViewRecordReq, options ...larkcore.RequestOptionFunc) (*ListFileViewRecordIterator, error) {
+ return &ListFileViewRecordIterator{
+ ctx: ctx,
+ req: req,
+ listFunc: f.List,
+ options: options,
+ limit: req.Limit}, nil
+}
+
// 创建导入任务
//
// - 创建导入任务。支持导入为 doc、docx、sheet、bitable,参考[导入用户指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/import_task/import-user-guide)
@@ -1366,3 +1462,81 @@ func (p *permissionPublic) Patch(ctx context.Context, req *PatchPermissionPublic
}
return resp, err
}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=drive&resource=permission.public.password&version=v1
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/drivev1/create_permissionPublicPassword.go
+func (p *permissionPublicPassword) Create(ctx context.Context, req *CreatePermissionPublicPasswordReq, options ...larkcore.RequestOptionFunc) (*CreatePermissionPublicPasswordResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/drive/v1/permissions/:token/public/password"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
+ apiResp, err := larkcore.Request(ctx, apiReq, p.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreatePermissionPublicPasswordResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, p.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=delete&project=drive&resource=permission.public.password&version=v1
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/drivev1/delete_permissionPublicPassword.go
+func (p *permissionPublicPassword) Delete(ctx context.Context, req *DeletePermissionPublicPasswordReq, options ...larkcore.RequestOptionFunc) (*DeletePermissionPublicPasswordResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/drive/v1/permissions/:token/public/password"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
+ apiResp, err := larkcore.Request(ctx, apiReq, p.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeletePermissionPublicPasswordResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, p.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=update&project=drive&resource=permission.public.password&version=v1
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/drivev1/update_permissionPublicPassword.go
+func (p *permissionPublicPassword) Update(ctx context.Context, req *UpdatePermissionPublicPasswordReq, options ...larkcore.RequestOptionFunc) (*UpdatePermissionPublicPasswordResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/drive/v1/permissions/:token/public/password"
+ apiReq.HttpMethod = http.MethodPut
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
+ apiResp, err := larkcore.Request(ctx, apiReq, p.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &UpdatePermissionPublicPasswordResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, p.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/drive/v1/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/drive/v1/model.go
index 9e2bb0b51d..e8b65a305f 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/drive/v1/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/drive/v1/model.go
@@ -90,8 +90,10 @@ const (
)
const (
- FileTypeCreateFileCommentDoc = "doc" // 文档
- FileTypeCreateFileCommentDocx = "docx" // 新版文档
+ FileTypeBatchQueryFileCommentDoc = "doc" // 文档
+ FileTypeBatchQueryFileCommentSheet = "sheet" // 表格
+ FileTypeBatchQueryFileCommentFile = "file" // 文件
+ FileTypeBatchQueryFileCommentDocx = "docx" // 新版文档
)
const (
@@ -100,6 +102,17 @@ const (
UserIdTypeOpenId = "open_id" // 以open_id来识别用户
)
+const (
+ FileTypeCreateFileCommentDoc = "doc" // 文档
+ FileTypeCreateFileCommentDocx = "docx" // 新版文档
+)
+
+const (
+ UserIdTypeCreateFileCommentUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeCreateFileCommentUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeCreateFileCommentOpenId = "open_id" // 以open_id来识别用户
+)
+
const (
FileTypeGetFileCommentDoc = "doc" // 文档
FileTypeGetFileCommentSheet = "sheet" // 表格
@@ -254,6 +267,22 @@ const (
UserIdTypeListFileVersionUserId = "user_id" // 用户user_id
)
+const (
+ FileTypeListFileViewRecordDoc = "doc" // 旧版文档
+ FileTypeListFileViewRecordDocx = "docx" // 新版文档
+ FileTypeListFileViewRecordSheet = "sheet" // 电子表格
+ FileTypeListFileViewRecordBitable = "bitable" // 多维表格
+ FileTypeListFileViewRecordMindnote = "mindnote" // 思维笔记
+ FileTypeListFileViewRecordWiki = "wiki" // 知识库文档
+ FileTypeListFileViewRecordFile = "file" // 文件
+)
+
+const (
+ ViewerIdTypeUserId = "user_id" // 以user_id来识别用户
+ ViewerIdTypeUnionId = "union_id" // 以union_id来识别用户
+ ViewerIdTypeOpenId = "open_id" // 以open_id来识别用户
+)
+
const (
ParentTypeUploadAllMediaDocImage = "doc_image" // docs图片
ParentTypeUploadAllMediaDocxImage = "docx_image" // docx图片
@@ -455,6 +484,39 @@ const (
TokenTypePatchPermissionPublicMinutes = "minutes" // 妙记
)
+const (
+ TokenTypeCreatePermissionPublicPasswordDoc = "doc" // 文档
+ TokenTypeCreatePermissionPublicPasswordSheet = "sheet" // 电子表格
+ TokenTypeCreatePermissionPublicPasswordFile = "file" // 云空间文件
+ TokenTypeCreatePermissionPublicPasswordWiki = "wiki" // 知识库节点
+ TokenTypeCreatePermissionPublicPasswordBitable = "bitable" // 多维表格
+ TokenTypeCreatePermissionPublicPasswordDocx = "docx" // 新版文档
+ TokenTypeCreatePermissionPublicPasswordMindnote = "mindnote" // 思维笔记
+ TokenTypeCreatePermissionPublicPasswordMinutes = "minutes" // 妙计
+)
+
+const (
+ TypeDeletePermissionPublicPasswordDoc = "doc" // 文档
+ TypeDeletePermissionPublicPasswordSheet = "sheet" // 电子表格
+ TypeDeletePermissionPublicPasswordFile = "file" // 云空间文件
+ TypeDeletePermissionPublicPasswordWiki = "wiki" // 知识库节点
+ TypeDeletePermissionPublicPasswordBitable = "bitable" // 多维表格
+ TypeDeletePermissionPublicPasswordDocx = "docx" // 新版文档
+ TypeDeletePermissionPublicPasswordMindnote = "mindnote" // 思维笔记
+ TypeDeletePermissionPublicPasswordMinutes = "minutes" // 妙计
+)
+
+const (
+ TypeUpdatePermissionPublicPasswordDoc = "doc" // 文档
+ TypeUpdatePermissionPublicPasswordSheet = "sheet" // 电子表格
+ TypeUpdatePermissionPublicPasswordFile = "file" // 云空间文件
+ TypeUpdatePermissionPublicPasswordWiki = "wiki" // 知识库节点
+ TypeUpdatePermissionPublicPasswordBitable = "bitable" // 多维表格
+ TypeUpdatePermissionPublicPasswordDocx = "docx" // 新版文档
+ TypeUpdatePermissionPublicPasswordMindnote = "mindnote" // 思维笔记
+ TypeUpdatePermissionPublicPasswordMinutes = "minutes" // 妙计
+)
+
type ApplyMemberRequest struct {
Perm *string `json:"perm,omitempty"` // 需要申请的权限,权限值:"view","edit"
Remark *string `json:"remark,omitempty"` // 申请权限备注
@@ -2136,6 +2198,86 @@ func (builder *FileSubscriptionBuilder) Build() *FileSubscription {
return req
}
+type FileViewRecord struct {
+ ViewerId *string `json:"viewer_id,omitempty"` // 访问者 ID
+ Name *string `json:"name,omitempty"` // 访问者名称
+ AvatarUrl *string `json:"avatar_url,omitempty"` // 访问者头像 URL
+ LastViewTime *string `json:"last_view_time,omitempty"` // 最近访问时间,秒级时间戳
+}
+
+type FileViewRecordBuilder struct {
+ viewerId string // 访问者 ID
+ viewerIdFlag bool
+ name string // 访问者名称
+ nameFlag bool
+ avatarUrl string // 访问者头像 URL
+ avatarUrlFlag bool
+ lastViewTime string // 最近访问时间,秒级时间戳
+ lastViewTimeFlag bool
+}
+
+func NewFileViewRecordBuilder() *FileViewRecordBuilder {
+ builder := &FileViewRecordBuilder{}
+ return builder
+}
+
+// 访问者 ID
+//
+// 示例值:ou_cc19b2bfb93f8a44db4b4d6eababcef
+func (builder *FileViewRecordBuilder) ViewerId(viewerId string) *FileViewRecordBuilder {
+ builder.viewerId = viewerId
+ builder.viewerIdFlag = true
+ return builder
+}
+
+// 访问者名称
+//
+// 示例值:zhangsan
+func (builder *FileViewRecordBuilder) Name(name string) *FileViewRecordBuilder {
+ builder.name = name
+ builder.nameFlag = true
+ return builder
+}
+
+// 访问者头像 URL
+//
+// 示例值:https://foo.icon.com/xxxx
+func (builder *FileViewRecordBuilder) AvatarUrl(avatarUrl string) *FileViewRecordBuilder {
+ builder.avatarUrl = avatarUrl
+ builder.avatarUrlFlag = true
+ return builder
+}
+
+// 最近访问时间,秒级时间戳
+//
+// 示例值:1679284285
+func (builder *FileViewRecordBuilder) LastViewTime(lastViewTime string) *FileViewRecordBuilder {
+ builder.lastViewTime = lastViewTime
+ builder.lastViewTimeFlag = true
+ return builder
+}
+
+func (builder *FileViewRecordBuilder) Build() *FileViewRecord {
+ req := &FileViewRecord{}
+ if builder.viewerIdFlag {
+ req.ViewerId = &builder.viewerId
+
+ }
+ if builder.nameFlag {
+ req.Name = &builder.name
+
+ }
+ if builder.avatarUrlFlag {
+ req.AvatarUrl = &builder.avatarUrl
+
+ }
+ if builder.lastViewTimeFlag {
+ req.LastViewTime = &builder.lastViewTime
+
+ }
+ return req
+}
+
type FileSearch struct {
DocsToken *string `json:"docs_token,omitempty"` // 文档token
DocsType *string `json:"docs_type,omitempty"` // 文档类型
@@ -3221,6 +3363,9 @@ func (builder *OwnerBuilder) Build() *Owner {
return req
}
+type PermissionPublicPassword struct {
+}
+
type PermissionPublic struct {
ExternalAccess *bool `json:"external_access,omitempty"` // 允许内容被分享到组织外;;**可选值有:** ;- `true`: 允许;- `false`: 不允许
SecurityEntity *string `json:"security_entity,omitempty"` // 谁可以复制内容、创建副本、打印、下载
@@ -3541,6 +3686,54 @@ func (builder *PropertyBuilder) Build() *Property {
return req
}
+type ReferEntity struct {
+ ReferToken *string `json:"refer_token,omitempty"` // 快捷方式指向的文档token
+ ReferType *string `json:"refer_type,omitempty"` // 快捷方式指向的文档类型
+}
+
+type ReferEntityBuilder struct {
+ referToken string // 快捷方式指向的文档token
+ referTokenFlag bool
+ referType string // 快捷方式指向的文档类型
+ referTypeFlag bool
+}
+
+func NewReferEntityBuilder() *ReferEntityBuilder {
+ builder := &ReferEntityBuilder{}
+ return builder
+}
+
+// 快捷方式指向的文档token
+//
+// 示例值:doxbcGvhSVN0R6octqPwAEYNfFb
+func (builder *ReferEntityBuilder) ReferToken(referToken string) *ReferEntityBuilder {
+ builder.referToken = referToken
+ builder.referTokenFlag = true
+ return builder
+}
+
+// 快捷方式指向的文档类型
+//
+// 示例值:doc
+func (builder *ReferEntityBuilder) ReferType(referType string) *ReferEntityBuilder {
+ builder.referType = referType
+ builder.referTypeFlag = true
+ return builder
+}
+
+func (builder *ReferEntityBuilder) Build() *ReferEntity {
+ req := &ReferEntity{}
+ if builder.referTokenFlag {
+ req.ReferToken = &builder.referToken
+
+ }
+ if builder.referTypeFlag {
+ req.ReferType = &builder.referType
+
+ }
+ return req
+}
+
type ReplyContent struct {
Elements []*ReplyElement `json:"elements,omitempty"` // 回复的内容
}
@@ -4746,6 +4939,139 @@ func (resp *CreateFolderFileResp) Success() bool {
return resp.Code == 0
}
+type CreateShortcutFileReqBodyBuilder struct {
+ parentToken string // 创建快捷方式的目标父文件夹 token
+ parentTokenFlag bool
+ referEntity *ReferEntity // 快捷方式映射到的文档和文件列表信息
+ referEntityFlag bool
+}
+
+func NewCreateShortcutFileReqBodyBuilder() *CreateShortcutFileReqBodyBuilder {
+ builder := &CreateShortcutFileReqBodyBuilder{}
+ return builder
+}
+
+// 创建快捷方式的目标父文件夹 token
+//
+//示例值:fldbc5qgwyQnO0uedNllWuF3fAd
+func (builder *CreateShortcutFileReqBodyBuilder) ParentToken(parentToken string) *CreateShortcutFileReqBodyBuilder {
+ builder.parentToken = parentToken
+ builder.parentTokenFlag = true
+ return builder
+}
+
+// 快捷方式映射到的文档和文件列表信息
+//
+//示例值:
+func (builder *CreateShortcutFileReqBodyBuilder) ReferEntity(referEntity *ReferEntity) *CreateShortcutFileReqBodyBuilder {
+ builder.referEntity = referEntity
+ builder.referEntityFlag = true
+ return builder
+}
+
+func (builder *CreateShortcutFileReqBodyBuilder) Build() *CreateShortcutFileReqBody {
+ req := &CreateShortcutFileReqBody{}
+ if builder.parentTokenFlag {
+ req.ParentToken = &builder.parentToken
+ }
+ if builder.referEntityFlag {
+ req.ReferEntity = builder.referEntity
+ }
+ return req
+}
+
+type CreateShortcutFilePathReqBodyBuilder struct {
+ parentToken string // 创建快捷方式的目标父文件夹 token
+ parentTokenFlag bool
+ referEntity *ReferEntity // 快捷方式映射到的文档和文件列表信息
+ referEntityFlag bool
+}
+
+func NewCreateShortcutFilePathReqBodyBuilder() *CreateShortcutFilePathReqBodyBuilder {
+ builder := &CreateShortcutFilePathReqBodyBuilder{}
+ return builder
+}
+
+// 创建快捷方式的目标父文件夹 token
+//
+// 示例值:fldbc5qgwyQnO0uedNllWuF3fAd
+func (builder *CreateShortcutFilePathReqBodyBuilder) ParentToken(parentToken string) *CreateShortcutFilePathReqBodyBuilder {
+ builder.parentToken = parentToken
+ builder.parentTokenFlag = true
+ return builder
+}
+
+// 快捷方式映射到的文档和文件列表信息
+//
+// 示例值:
+func (builder *CreateShortcutFilePathReqBodyBuilder) ReferEntity(referEntity *ReferEntity) *CreateShortcutFilePathReqBodyBuilder {
+ builder.referEntity = referEntity
+ builder.referEntityFlag = true
+ return builder
+}
+
+func (builder *CreateShortcutFilePathReqBodyBuilder) Build() (*CreateShortcutFileReqBody, error) {
+ req := &CreateShortcutFileReqBody{}
+ if builder.parentTokenFlag {
+ req.ParentToken = &builder.parentToken
+ }
+ if builder.referEntityFlag {
+ req.ReferEntity = builder.referEntity
+ }
+ return req, nil
+}
+
+type CreateShortcutFileReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *CreateShortcutFileReqBody
+}
+
+func NewCreateShortcutFileReqBuilder() *CreateShortcutFileReqBuilder {
+ builder := &CreateShortcutFileReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+//
+func (builder *CreateShortcutFileReqBuilder) Body(body *CreateShortcutFileReqBody) *CreateShortcutFileReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *CreateShortcutFileReqBuilder) Build() *CreateShortcutFileReq {
+ req := &CreateShortcutFileReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type CreateShortcutFileReqBody struct {
+ ParentToken *string `json:"parent_token,omitempty"` // 创建快捷方式的目标父文件夹 token
+ ReferEntity *ReferEntity `json:"refer_entity,omitempty"` // 快捷方式映射到的文档和文件列表信息
+}
+
+type CreateShortcutFileReq struct {
+ apiReq *larkcore.ApiReq
+ Body *CreateShortcutFileReqBody `body:""`
+}
+
+type CreateShortcutFileRespData struct {
+ SuccShortcutNode *File `json:"succ_shortcut_node,omitempty"` // 返回创建成功的shortcut节点
+}
+
+type CreateShortcutFileResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateShortcutFileRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateShortcutFileResp) Success() bool {
+ return resp.Code == 0
+}
+
type DeleteFileReqBuilder struct {
apiReq *larkcore.ApiReq
}
@@ -5812,6 +6138,136 @@ func (resp *UploadPrepareFileResp) Success() bool {
return resp.Code == 0
}
+type BatchQueryFileCommentReqBodyBuilder struct {
+ commentIds []string // 需要获取数据的评论id
+ commentIdsFlag bool
+}
+
+func NewBatchQueryFileCommentReqBodyBuilder() *BatchQueryFileCommentReqBodyBuilder {
+ builder := &BatchQueryFileCommentReqBodyBuilder{}
+ return builder
+}
+
+// 需要获取数据的评论id
+//
+//示例值:1654857036541812356
+func (builder *BatchQueryFileCommentReqBodyBuilder) CommentIds(commentIds []string) *BatchQueryFileCommentReqBodyBuilder {
+ builder.commentIds = commentIds
+ builder.commentIdsFlag = true
+ return builder
+}
+
+func (builder *BatchQueryFileCommentReqBodyBuilder) Build() *BatchQueryFileCommentReqBody {
+ req := &BatchQueryFileCommentReqBody{}
+ if builder.commentIdsFlag {
+ req.CommentIds = builder.commentIds
+ }
+ return req
+}
+
+type BatchQueryFileCommentPathReqBodyBuilder struct {
+ commentIds []string // 需要获取数据的评论id
+ commentIdsFlag bool
+}
+
+func NewBatchQueryFileCommentPathReqBodyBuilder() *BatchQueryFileCommentPathReqBodyBuilder {
+ builder := &BatchQueryFileCommentPathReqBodyBuilder{}
+ return builder
+}
+
+// 需要获取数据的评论id
+//
+// 示例值:1654857036541812356
+func (builder *BatchQueryFileCommentPathReqBodyBuilder) CommentIds(commentIds []string) *BatchQueryFileCommentPathReqBodyBuilder {
+ builder.commentIds = commentIds
+ builder.commentIdsFlag = true
+ return builder
+}
+
+func (builder *BatchQueryFileCommentPathReqBodyBuilder) Build() (*BatchQueryFileCommentReqBody, error) {
+ req := &BatchQueryFileCommentReqBody{}
+ if builder.commentIdsFlag {
+ req.CommentIds = builder.commentIds
+ }
+ return req, nil
+}
+
+type BatchQueryFileCommentReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *BatchQueryFileCommentReqBody
+}
+
+func NewBatchQueryFileCommentReqBuilder() *BatchQueryFileCommentReqBuilder {
+ builder := &BatchQueryFileCommentReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 文档Token
+//
+// 示例值:doxbcdl03Vsxhm7Qmnj110abcef
+func (builder *BatchQueryFileCommentReqBuilder) FileToken(fileToken string) *BatchQueryFileCommentReqBuilder {
+ builder.apiReq.PathParams.Set("file_token", fmt.Sprint(fileToken))
+ return builder
+}
+
+// 文档类型
+//
+// 示例值:doc;docx;sheet;file
+func (builder *BatchQueryFileCommentReqBuilder) FileType(fileType string) *BatchQueryFileCommentReqBuilder {
+ builder.apiReq.QueryParams.Set("file_type", fmt.Sprint(fileType))
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:
+func (builder *BatchQueryFileCommentReqBuilder) UserIdType(userIdType string) *BatchQueryFileCommentReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 该接口用于根据评论 ID 列表批量获取评论。
+func (builder *BatchQueryFileCommentReqBuilder) Body(body *BatchQueryFileCommentReqBody) *BatchQueryFileCommentReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *BatchQueryFileCommentReqBuilder) Build() *BatchQueryFileCommentReq {
+ req := &BatchQueryFileCommentReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type BatchQueryFileCommentReqBody struct {
+ CommentIds []string `json:"comment_ids,omitempty"` // 需要获取数据的评论id
+}
+
+type BatchQueryFileCommentReq struct {
+ apiReq *larkcore.ApiReq
+ Body *BatchQueryFileCommentReqBody `body:""`
+}
+
+type BatchQueryFileCommentRespData struct {
+ Items []*FileComment `json:"items,omitempty"` // 评论的相关信息、回复的信息、回复分页的信息
+}
+
+type BatchQueryFileCommentResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *BatchQueryFileCommentRespData `json:"data"` // 业务数据
+}
+
+func (resp *BatchQueryFileCommentResp) Success() bool {
+ return resp.Code == 0
+}
+
type CreateFileCommentReqBuilder struct {
apiReq *larkcore.ApiReq
fileComment *FileComment
@@ -6925,22 +7381,6 @@ func (builder *GetFileVersionReqBuilder) UserIdType(userIdType string) *GetFileV
return builder
}
-//
-//
-// 示例值:1665739388
-func (builder *GetFileVersionReqBuilder) PageToken(pageToken string) *GetFileVersionReqBuilder {
- builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
- return builder
-}
-
-//
-//
-// 示例值:10
-func (builder *GetFileVersionReqBuilder) PageSize(pageSize int) *GetFileVersionReqBuilder {
- builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
- return builder
-}
-
func (builder *GetFileVersionReqBuilder) Build() *GetFileVersionReq {
req := &GetFileVersionReq{}
req.apiReq = &larkcore.ApiReq{}
@@ -7030,7 +7470,7 @@ func (builder *ListFileVersionReqBuilder) ObjType(objType string) *ListFileVersi
// 用户id类型
//
-// 示例值:
+// 示例值:open_id
func (builder *ListFileVersionReqBuilder) UserIdType(userIdType string) *ListFileVersionReqBuilder {
builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
return builder
@@ -7067,6 +7507,97 @@ func (resp *ListFileVersionResp) Success() bool {
return resp.Code == 0
}
+type ListFileViewRecordReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ limit int // 最大返回多少记录,当使用迭代器访问时才有效
+}
+
+func NewListFileViewRecordReqBuilder() *ListFileViewRecordReqBuilder {
+ builder := &ListFileViewRecordReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 最大返回多少记录,当使用迭代器访问时才有效
+func (builder *ListFileViewRecordReqBuilder) Limit(limit int) *ListFileViewRecordReqBuilder {
+ builder.limit = limit
+ return builder
+}
+
+// 文档 token
+//
+// 示例值:XIHSdYSI7oMEU1xrsnxc8fabcef
+func (builder *ListFileViewRecordReqBuilder) FileToken(fileToken string) *ListFileViewRecordReqBuilder {
+ builder.apiReq.PathParams.Set("file_token", fmt.Sprint(fileToken))
+ return builder
+}
+
+// 分页大小
+//
+// 示例值:10
+func (builder *ListFileViewRecordReqBuilder) PageSize(pageSize int) *ListFileViewRecordReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果
+//
+// 示例值:1674037112--7189934631754563585
+func (builder *ListFileViewRecordReqBuilder) PageToken(pageToken string) *ListFileViewRecordReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 文档类型
+//
+// 示例值:docx
+func (builder *ListFileViewRecordReqBuilder) FileType(fileType string) *ListFileViewRecordReqBuilder {
+ builder.apiReq.QueryParams.Set("file_type", fmt.Sprint(fileType))
+ return builder
+}
+
+// 此次调用中使用的访问者 ID 的类型
+//
+// 示例值:open_id
+func (builder *ListFileViewRecordReqBuilder) ViewerIdType(viewerIdType string) *ListFileViewRecordReqBuilder {
+ builder.apiReq.QueryParams.Set("viewer_id_type", fmt.Sprint(viewerIdType))
+ return builder
+}
+
+func (builder *ListFileViewRecordReqBuilder) Build() *ListFileViewRecordReq {
+ req := &ListFileViewRecordReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.Limit = builder.limit
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListFileViewRecordReq struct {
+ apiReq *larkcore.ApiReq
+ Limit int // 最多返回多少记录,只有在使用迭代器访问时,才有效
+
+}
+
+type ListFileViewRecordRespData struct {
+ Items []*FileViewRecord `json:"items,omitempty"` // 访问记录列表
+ PageToken *string `json:"page_token,omitempty"` // 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 page_token
+ HasMore *bool `json:"has_more,omitempty"` // 是否还有更多项
+}
+
+type ListFileViewRecordResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListFileViewRecordRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListFileViewRecordResp) Success() bool {
+ return resp.Code == 0
+}
+
type CreateImportTaskReqBuilder struct {
apiReq *larkcore.ApiReq
importTask *ImportTask
@@ -8556,6 +9087,166 @@ func (resp *PatchPermissionPublicResp) Success() bool {
return resp.Code == 0
}
+type CreatePermissionPublicPasswordReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewCreatePermissionPublicPasswordReqBuilder() *CreatePermissionPublicPasswordReqBuilder {
+ builder := &CreatePermissionPublicPasswordReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 文件的 token
+//
+// 示例值:doccnBKgoMyY5OMbUG6FioTXuBe
+func (builder *CreatePermissionPublicPasswordReqBuilder) Token(token string) *CreatePermissionPublicPasswordReqBuilder {
+ builder.apiReq.PathParams.Set("token", fmt.Sprint(token))
+ return builder
+}
+
+// 文件类型,需要与文件的 token 相匹配
+//
+// 示例值:doc
+func (builder *CreatePermissionPublicPasswordReqBuilder) Type(type_ string) *CreatePermissionPublicPasswordReqBuilder {
+ builder.apiReq.QueryParams.Set("type", fmt.Sprint(type_))
+ return builder
+}
+
+func (builder *CreatePermissionPublicPasswordReqBuilder) Build() *CreatePermissionPublicPasswordReq {
+ req := &CreatePermissionPublicPasswordReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type CreatePermissionPublicPasswordReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type CreatePermissionPublicPasswordRespData struct {
+ Password *string `json:"password,omitempty"` // 密码
+}
+
+type CreatePermissionPublicPasswordResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreatePermissionPublicPasswordRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreatePermissionPublicPasswordResp) Success() bool {
+ return resp.Code == 0
+}
+
+type DeletePermissionPublicPasswordReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewDeletePermissionPublicPasswordReqBuilder() *DeletePermissionPublicPasswordReqBuilder {
+ builder := &DeletePermissionPublicPasswordReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 文件的 token
+//
+// 示例值:doccnBKgoMyY5OMbUG6FioTXuBe
+func (builder *DeletePermissionPublicPasswordReqBuilder) Token(token string) *DeletePermissionPublicPasswordReqBuilder {
+ builder.apiReq.PathParams.Set("token", fmt.Sprint(token))
+ return builder
+}
+
+// 文件类型,需要与文件的 token 相匹配
+//
+// 示例值:doc
+func (builder *DeletePermissionPublicPasswordReqBuilder) Type(type_ string) *DeletePermissionPublicPasswordReqBuilder {
+ builder.apiReq.QueryParams.Set("type", fmt.Sprint(type_))
+ return builder
+}
+
+func (builder *DeletePermissionPublicPasswordReqBuilder) Build() *DeletePermissionPublicPasswordReq {
+ req := &DeletePermissionPublicPasswordReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type DeletePermissionPublicPasswordReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type DeletePermissionPublicPasswordResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *DeletePermissionPublicPasswordResp) Success() bool {
+ return resp.Code == 0
+}
+
+type UpdatePermissionPublicPasswordReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewUpdatePermissionPublicPasswordReqBuilder() *UpdatePermissionPublicPasswordReqBuilder {
+ builder := &UpdatePermissionPublicPasswordReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 文件的 token
+//
+// 示例值:doccnBKgoMyY5OMbUG6FioTXuBe
+func (builder *UpdatePermissionPublicPasswordReqBuilder) Token(token string) *UpdatePermissionPublicPasswordReqBuilder {
+ builder.apiReq.PathParams.Set("token", fmt.Sprint(token))
+ return builder
+}
+
+// 文件类型,需要与文件的 token 相匹配
+//
+// 示例值:doc
+func (builder *UpdatePermissionPublicPasswordReqBuilder) Type(type_ string) *UpdatePermissionPublicPasswordReqBuilder {
+ builder.apiReq.QueryParams.Set("type", fmt.Sprint(type_))
+ return builder
+}
+
+func (builder *UpdatePermissionPublicPasswordReqBuilder) Build() *UpdatePermissionPublicPasswordReq {
+ req := &UpdatePermissionPublicPasswordReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type UpdatePermissionPublicPasswordReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type UpdatePermissionPublicPasswordRespData struct {
+ Password *string `json:"password,omitempty"` // 密码
+}
+
+type UpdatePermissionPublicPasswordResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *UpdatePermissionPublicPasswordRespData `json:"data"` // 业务数据
+}
+
+func (resp *UpdatePermissionPublicPasswordResp) Success() bool {
+ return resp.Code == 0
+}
+
type P2FileBitableFieldChangedV1Data struct {
FileType *string `json:"file_type,omitempty"` // 文档类型
FileToken *string `json:"file_token,omitempty"` // 文档token
@@ -8810,3 +9501,57 @@ func (iterator *ListFileVersionIterator) Next() (bool, *Version, error) {
func (iterator *ListFileVersionIterator) NextPageToken() *string {
return iterator.nextPageToken
}
+
+type ListFileViewRecordIterator struct {
+ nextPageToken *string
+ items []*FileViewRecord
+ index int
+ limit int
+ ctx context.Context
+ req *ListFileViewRecordReq
+ listFunc func(ctx context.Context, req *ListFileViewRecordReq, options ...larkcore.RequestOptionFunc) (*ListFileViewRecordResp, error)
+ options []larkcore.RequestOptionFunc
+ curlNum int
+}
+
+func (iterator *ListFileViewRecordIterator) Next() (bool, *FileViewRecord, error) {
+ // 达到最大量,则返回
+ if iterator.limit > 0 && iterator.curlNum >= iterator.limit {
+ return false, nil, nil
+ }
+
+ // 为0则拉取数据
+ if iterator.index == 0 || iterator.index >= len(iterator.items) {
+ if iterator.index != 0 && iterator.nextPageToken == nil {
+ return false, nil, nil
+ }
+ if iterator.nextPageToken != nil {
+ iterator.req.apiReq.QueryParams.Set("page_token", *iterator.nextPageToken)
+ }
+ resp, err := iterator.listFunc(iterator.ctx, iterator.req, iterator.options...)
+ if err != nil {
+ return false, nil, err
+ }
+
+ if resp.Code != 0 {
+ return false, nil, errors.New(fmt.Sprintf("Code:%d,Msg:%s", resp.Code, resp.Msg))
+ }
+
+ if len(resp.Data.Items) == 0 {
+ return false, nil, nil
+ }
+
+ iterator.nextPageToken = resp.Data.PageToken
+ iterator.items = resp.Data.Items
+ iterator.index = 0
+ }
+
+ block := iterator.items[iterator.index]
+ iterator.index++
+ iterator.curlNum++
+ return true, block, nil
+}
+
+func (iterator *ListFileViewRecordIterator) NextPageToken() *string {
+ return iterator.nextPageToken
+}
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/ehr/v1/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/ehr/v1/model.go
index 49db7b8778..84457e48e1 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/ehr/v1/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/ehr/v1/model.go
@@ -751,8 +751,8 @@ type SystemFields struct {
CancelOnboardingReason *int `json:"cancel_onboarding_reason,omitempty"` // 取消入职原因
CancelOnboardingNotes *string `json:"cancel_onboarding_notes,omitempty"` // 取消入职备注
EmployeeFormStatus *int `json:"employee_form_status,omitempty"` // 入职登记表状态
- CreateTime *int `json:"create_time,omitempty"` // 创建时间
- UpdateTime *int `json:"update_time,omitempty"` // 更新时间
+ CreateTime *int64 `json:"create_time,omitempty"` // 创建时间
+ UpdateTime *int64 `json:"update_time,omitempty"` // 更新时间
}
type SystemFieldsBuilder struct {
@@ -874,9 +874,9 @@ type SystemFieldsBuilder struct {
cancelOnboardingNotesFlag bool
employeeFormStatus int // 入职登记表状态
employeeFormStatusFlag bool
- createTime int // 创建时间
+ createTime int64 // 创建时间
createTimeFlag bool
- updateTime int // 更新时间
+ updateTime int64 // 更新时间
updateTimeFlag bool
}
@@ -1419,7 +1419,7 @@ func (builder *SystemFieldsBuilder) EmployeeFormStatus(employeeFormStatus int) *
// 创建时间
//
// 示例值:1608690517811
-func (builder *SystemFieldsBuilder) CreateTime(createTime int) *SystemFieldsBuilder {
+func (builder *SystemFieldsBuilder) CreateTime(createTime int64) *SystemFieldsBuilder {
builder.createTime = createTime
builder.createTimeFlag = true
return builder
@@ -1428,7 +1428,7 @@ func (builder *SystemFieldsBuilder) CreateTime(createTime int) *SystemFieldsBuil
// 更新时间
//
// 示例值:1608690517811
-func (builder *SystemFieldsBuilder) UpdateTime(updateTime int) *SystemFieldsBuilder {
+func (builder *SystemFieldsBuilder) UpdateTime(updateTime int64) *SystemFieldsBuilder {
builder.updateTime = updateTime
builder.updateTimeFlag = true
return builder
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/helpdesk/v1/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/helpdesk/v1/model.go
index 999efe0c9a..477c9b4091 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/helpdesk/v1/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/helpdesk/v1/model.go
@@ -2208,9 +2208,9 @@ type Ticket struct {
TicketType *int `json:"ticket_type,omitempty"` // 工单阶段:1. 机器人 2. 人工
Status *int `json:"status,omitempty"` // 工单状态,1:已创建 2: 处理中 3: 排队中 4:待定 5:待用户响应 50: 被机器人关闭 51: 被客服关闭 52: 用户自己关闭
Score *int `json:"score,omitempty"` // 工单评分,1:不满意,2:一般,3:满意
- CreatedAt *int `json:"created_at,omitempty"` // 工单创建时间
- UpdatedAt *int `json:"updated_at,omitempty"` // 工单更新时间,没有值时为-1
- ClosedAt *int `json:"closed_at,omitempty"` // 工单结束时间
+ CreatedAt *int64 `json:"created_at,omitempty"` // 工单创建时间
+ UpdatedAt *int64 `json:"updated_at,omitempty"` // 工单更新时间,没有值时为-1
+ ClosedAt *int64 `json:"closed_at,omitempty"` // 工单结束时间
DissatisfactionReason *I18n `json:"dissatisfaction_reason,omitempty"` // 不满意原因
Agents []*TicketUser `json:"agents,omitempty"` // 工单客服
Channel *int `json:"channel,omitempty"` // 工单渠道,描述:;9:Open API 2:二维码 14:分享 13:搜索 其他数字:其他渠道
@@ -2219,13 +2219,13 @@ type Ticket struct {
Collaborators []*TicketUser `json:"collaborators,omitempty"` // 工单协作者
CustomizedFields []*CustomizedFieldDisplayItem `json:"customized_fields,omitempty"` // 自定义字段列表,没有值时不设置 ;下拉菜单的value对应工单字段里面的children.display_name;[获取全部工单自定义字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/ticket_customized_field/list-ticket-customized-fields)
AgentServiceDuration *float64 `json:"agent_service_duration,omitempty"` // 客服服务时长,客服最后一次回复时间距离客服进入时间间隔,单位分钟
- AgentFirstResponseDuration *int `json:"agent_first_response_duration,omitempty"` // 客服首次回复时间距离客服进入时间的间隔(秒)
- BotServiceDuration *int `json:"bot_service_duration,omitempty"` // 机器人服务时间:客服进入时间距离工单创建时间的间隔,单位秒
- AgentResolutionTime *int `json:"agent_resolution_time,omitempty"` // 客服解决时长,关单时间距离客服进入时间的间隔,单位秒
- ActualProcessingTime *int `json:"actual_processing_time,omitempty"` // 工单实际处理时间:从客服进入到关单,单位秒
- AgentEntryTime *int `json:"agent_entry_time,omitempty"` // 客服进入时间,单位毫秒
- AgentFirstResponseTime *int `json:"agent_first_response_time,omitempty"` // 客服首次回复时间,单位毫秒
- AgentLastResponseTime *int `json:"agent_last_response_time,omitempty"` // 客服最后回复时间,单位毫秒
+ AgentFirstResponseDuration *int64 `json:"agent_first_response_duration,omitempty"` // 客服首次回复时间距离客服进入时间的间隔(秒)
+ BotServiceDuration *int64 `json:"bot_service_duration,omitempty"` // 机器人服务时间:客服进入时间距离工单创建时间的间隔,单位秒
+ AgentResolutionTime *int64 `json:"agent_resolution_time,omitempty"` // 客服解决时长,关单时间距离客服进入时间的间隔,单位秒
+ ActualProcessingTime *int64 `json:"actual_processing_time,omitempty"` // 工单实际处理时间:从客服进入到关单,单位秒
+ AgentEntryTime *int64 `json:"agent_entry_time,omitempty"` // 客服进入时间,单位毫秒
+ AgentFirstResponseTime *int64 `json:"agent_first_response_time,omitempty"` // 客服首次回复时间,单位毫秒
+ AgentLastResponseTime *int64 `json:"agent_last_response_time,omitempty"` // 客服最后回复时间,单位毫秒
AgentOwner *TicketUser `json:"agent_owner,omitempty"` // 主责客服
}
@@ -2244,11 +2244,11 @@ type TicketBuilder struct {
statusFlag bool
score int // 工单评分,1:不满意,2:一般,3:满意
scoreFlag bool
- createdAt int // 工单创建时间
+ createdAt int64 // 工单创建时间
createdAtFlag bool
- updatedAt int // 工单更新时间,没有值时为-1
+ updatedAt int64 // 工单更新时间,没有值时为-1
updatedAtFlag bool
- closedAt int // 工单结束时间
+ closedAt int64 // 工单结束时间
closedAtFlag bool
dissatisfactionReason *I18n // 不满意原因
dissatisfactionReasonFlag bool
@@ -2266,19 +2266,19 @@ type TicketBuilder struct {
customizedFieldsFlag bool
agentServiceDuration float64 // 客服服务时长,客服最后一次回复时间距离客服进入时间间隔,单位分钟
agentServiceDurationFlag bool
- agentFirstResponseDuration int // 客服首次回复时间距离客服进入时间的间隔(秒)
+ agentFirstResponseDuration int64 // 客服首次回复时间距离客服进入时间的间隔(秒)
agentFirstResponseDurationFlag bool
- botServiceDuration int // 机器人服务时间:客服进入时间距离工单创建时间的间隔,单位秒
+ botServiceDuration int64 // 机器人服务时间:客服进入时间距离工单创建时间的间隔,单位秒
botServiceDurationFlag bool
- agentResolutionTime int // 客服解决时长,关单时间距离客服进入时间的间隔,单位秒
+ agentResolutionTime int64 // 客服解决时长,关单时间距离客服进入时间的间隔,单位秒
agentResolutionTimeFlag bool
- actualProcessingTime int // 工单实际处理时间:从客服进入到关单,单位秒
+ actualProcessingTime int64 // 工单实际处理时间:从客服进入到关单,单位秒
actualProcessingTimeFlag bool
- agentEntryTime int // 客服进入时间,单位毫秒
+ agentEntryTime int64 // 客服进入时间,单位毫秒
agentEntryTimeFlag bool
- agentFirstResponseTime int // 客服首次回复时间,单位毫秒
+ agentFirstResponseTime int64 // 客服首次回复时间,单位毫秒
agentFirstResponseTimeFlag bool
- agentLastResponseTime int // 客服最后回复时间,单位毫秒
+ agentLastResponseTime int64 // 客服最后回复时间,单位毫秒
agentLastResponseTimeFlag bool
agentOwner *TicketUser // 主责客服
agentOwnerFlag bool
@@ -2355,7 +2355,7 @@ func (builder *TicketBuilder) Score(score int) *TicketBuilder {
// 工单创建时间
//
// 示例值:1616920429000
-func (builder *TicketBuilder) CreatedAt(createdAt int) *TicketBuilder {
+func (builder *TicketBuilder) CreatedAt(createdAt int64) *TicketBuilder {
builder.createdAt = createdAt
builder.createdAtFlag = true
return builder
@@ -2364,7 +2364,7 @@ func (builder *TicketBuilder) CreatedAt(createdAt int) *TicketBuilder {
// 工单更新时间,没有值时为-1
//
// 示例值:1616920429000
-func (builder *TicketBuilder) UpdatedAt(updatedAt int) *TicketBuilder {
+func (builder *TicketBuilder) UpdatedAt(updatedAt int64) *TicketBuilder {
builder.updatedAt = updatedAt
builder.updatedAtFlag = true
return builder
@@ -2373,7 +2373,7 @@ func (builder *TicketBuilder) UpdatedAt(updatedAt int) *TicketBuilder {
// 工单结束时间
//
// 示例值:1616920429000
-func (builder *TicketBuilder) ClosedAt(closedAt int) *TicketBuilder {
+func (builder *TicketBuilder) ClosedAt(closedAt int64) *TicketBuilder {
builder.closedAt = closedAt
builder.closedAtFlag = true
return builder
@@ -2453,8 +2453,8 @@ func (builder *TicketBuilder) AgentServiceDuration(agentServiceDuration float64)
// 客服首次回复时间距离客服进入时间的间隔(秒)
//
-// 示例值:123869
-func (builder *TicketBuilder) AgentFirstResponseDuration(agentFirstResponseDuration int) *TicketBuilder {
+// 示例值:1616920429000
+func (builder *TicketBuilder) AgentFirstResponseDuration(agentFirstResponseDuration int64) *TicketBuilder {
builder.agentFirstResponseDuration = agentFirstResponseDuration
builder.agentFirstResponseDurationFlag = true
return builder
@@ -2462,8 +2462,8 @@ func (builder *TicketBuilder) AgentFirstResponseDuration(agentFirstResponseDurat
// 机器人服务时间:客服进入时间距离工单创建时间的间隔,单位秒
//
-// 示例值:1
-func (builder *TicketBuilder) BotServiceDuration(botServiceDuration int) *TicketBuilder {
+// 示例值:1616920429000
+func (builder *TicketBuilder) BotServiceDuration(botServiceDuration int64) *TicketBuilder {
builder.botServiceDuration = botServiceDuration
builder.botServiceDurationFlag = true
return builder
@@ -2471,8 +2471,8 @@ func (builder *TicketBuilder) BotServiceDuration(botServiceDuration int) *Ticket
// 客服解决时长,关单时间距离客服进入时间的间隔,单位秒
//
-// 示例值:66
-func (builder *TicketBuilder) AgentResolutionTime(agentResolutionTime int) *TicketBuilder {
+// 示例值:1616920429000
+func (builder *TicketBuilder) AgentResolutionTime(agentResolutionTime int64) *TicketBuilder {
builder.agentResolutionTime = agentResolutionTime
builder.agentResolutionTimeFlag = true
return builder
@@ -2480,8 +2480,8 @@ func (builder *TicketBuilder) AgentResolutionTime(agentResolutionTime int) *Tick
// 工单实际处理时间:从客服进入到关单,单位秒
//
-// 示例值:68
-func (builder *TicketBuilder) ActualProcessingTime(actualProcessingTime int) *TicketBuilder {
+// 示例值:1616920429000
+func (builder *TicketBuilder) ActualProcessingTime(actualProcessingTime int64) *TicketBuilder {
builder.actualProcessingTime = actualProcessingTime
builder.actualProcessingTimeFlag = true
return builder
@@ -2489,8 +2489,8 @@ func (builder *TicketBuilder) ActualProcessingTime(actualProcessingTime int) *Ti
// 客服进入时间,单位毫秒
//
-// 示例值:1636444596000
-func (builder *TicketBuilder) AgentEntryTime(agentEntryTime int) *TicketBuilder {
+// 示例值:1616920429000
+func (builder *TicketBuilder) AgentEntryTime(agentEntryTime int64) *TicketBuilder {
builder.agentEntryTime = agentEntryTime
builder.agentEntryTimeFlag = true
return builder
@@ -2498,8 +2498,8 @@ func (builder *TicketBuilder) AgentEntryTime(agentEntryTime int) *TicketBuilder
// 客服首次回复时间,单位毫秒
//
-// 示例值:1636444696000
-func (builder *TicketBuilder) AgentFirstResponseTime(agentFirstResponseTime int) *TicketBuilder {
+// 示例值:1616920429000
+func (builder *TicketBuilder) AgentFirstResponseTime(agentFirstResponseTime int64) *TicketBuilder {
builder.agentFirstResponseTime = agentFirstResponseTime
builder.agentFirstResponseTimeFlag = true
return builder
@@ -2507,8 +2507,8 @@ func (builder *TicketBuilder) AgentFirstResponseTime(agentFirstResponseTime int)
// 客服最后回复时间,单位毫秒
//
-// 示例值:1636444796000
-func (builder *TicketBuilder) AgentLastResponseTime(agentLastResponseTime int) *TicketBuilder {
+// 示例值:1616920429000
+func (builder *TicketBuilder) AgentLastResponseTime(agentLastResponseTime int64) *TicketBuilder {
builder.agentLastResponseTime = agentLastResponseTime
builder.agentLastResponseTimeFlag = true
return builder
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/hire/v1/api.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/hire/v1/api.go
index 66ffc0adc1..4545067341 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/hire/v1/api.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/hire/v1/api.go
@@ -26,33 +26,57 @@ func NewService(config *larkcore.Config) *HireService {
h.ApplicationInterview = &applicationInterview{service: h}
h.Attachment = &attachment{service: h}
h.EhrImportTask = &ehrImportTask{service: h}
+ h.EhrImportTaskForInternshipOffer = &ehrImportTaskForInternshipOffer{service: h}
h.Employee = &employee{service: h}
+ h.Evaluation = &evaluation{service: h}
+ h.ExternalApplication = &externalApplication{service: h}
+ h.ExternalBackgroundCheck = &externalBackgroundCheck{service: h}
+ h.ExternalInterview = &externalInterview{service: h}
+ h.ExternalInterviewAssessment = &externalInterviewAssessment{service: h}
+ h.Interview = &interview{service: h}
h.Job = &job{service: h}
h.JobManager = &jobManager{service: h}
h.JobProcess = &jobProcess{service: h}
+ h.JobRequirement = &jobRequirement{service: h}
+ h.JobRequirementSchema = &jobRequirementSchema{service: h}
h.Note = ¬e{service: h}
+ h.Offer = &offer{service: h}
h.OfferSchema = &offerSchema{service: h}
+ h.Questionnaire = &questionnaire{service: h}
h.Referral = &referral{service: h}
h.ResumeSource = &resumeSource{service: h}
h.Talent = &talent{service: h}
+ h.TalentFolder = &talentFolder{service: h}
return h
}
type HireService struct {
- config *larkcore.Config
- Application *application // 投递
- ApplicationInterview *applicationInterview // application.interview
- Attachment *attachment // 附件
- EhrImportTask *ehrImportTask // 导入 e-HR
- Employee *employee // 入职
- Job *job // 职位
- JobManager *jobManager // job.manager
- JobProcess *jobProcess // 流程
- Note *note // 备注
- OfferSchema *offerSchema // offer_schema
- Referral *referral // 内推
- ResumeSource *resumeSource // 简历来源
- Talent *talent // 人才
+ config *larkcore.Config
+ Application *application // 投递
+ ApplicationInterview *applicationInterview // application.interview
+ Attachment *attachment // 附件
+ EhrImportTask *ehrImportTask // 导入 e-HR
+ EhrImportTaskForInternshipOffer *ehrImportTaskForInternshipOffer // ehr_import_task_for_internship_offer
+ Employee *employee // 入职
+ Evaluation *evaluation // 评估(灰度租户可见)
+ ExternalApplication *externalApplication // 导入外部系统信息(灰度租户可见)
+ ExternalBackgroundCheck *externalBackgroundCheck // 导入外部系统信息(灰度租户可见)
+ ExternalInterview *externalInterview // 导入外部系统信息(灰度租户可见)
+ ExternalInterviewAssessment *externalInterviewAssessment // 导入外部系统信息(灰度租户可见)
+ Interview *interview // 面试
+ Job *job // 职位
+ JobManager *jobManager // job.manager
+ JobProcess *jobProcess // 流程
+ JobRequirement *jobRequirement // 招聘需求(灰度租户可见)
+ JobRequirementSchema *jobRequirementSchema // job_requirement_schema
+ Note *note // 备注
+ Offer *offer // Offer
+ OfferSchema *offerSchema // offer_schema
+ Questionnaire *questionnaire // 问卷(灰度租户可见)
+ Referral *referral // 内推
+ ResumeSource *resumeSource // 简历来源
+ Talent *talent // 人才
+ TalentFolder *talentFolder // talent_folder
}
type application struct {
@@ -67,9 +91,30 @@ type attachment struct {
type ehrImportTask struct {
service *HireService
}
+type ehrImportTaskForInternshipOffer struct {
+ service *HireService
+}
type employee struct {
service *HireService
}
+type evaluation struct {
+ service *HireService
+}
+type externalApplication struct {
+ service *HireService
+}
+type externalBackgroundCheck struct {
+ service *HireService
+}
+type externalInterview struct {
+ service *HireService
+}
+type externalInterviewAssessment struct {
+ service *HireService
+}
+type interview struct {
+ service *HireService
+}
type job struct {
service *HireService
}
@@ -79,12 +124,24 @@ type jobManager struct {
type jobProcess struct {
service *HireService
}
+type jobRequirement struct {
+ service *HireService
+}
+type jobRequirementSchema struct {
+ service *HireService
+}
type note struct {
service *HireService
}
+type offer struct {
+ service *HireService
+}
type offerSchema struct {
service *HireService
}
+type questionnaire struct {
+ service *HireService
+}
type referral struct {
service *HireService
}
@@ -94,6 +151,9 @@ type resumeSource struct {
type talent struct {
service *HireService
}
+type talentFolder struct {
+ service *HireService
+}
// 创建投递
//
@@ -433,6 +493,222 @@ func (e *employee) Patch(ctx context.Context, req *PatchEmployeeReq, options ...
return resp, err
}
+// 获取简历评估信息
+//
+// - 获取简历评估信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/evaluation/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/list_evaluation.go
+func (e *evaluation) List(ctx context.Context, req *ListEvaluationReq, options ...larkcore.RequestOptionFunc) (*ListEvaluationResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/evaluations"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListEvaluationResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, e.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+func (e *evaluation) ListByIterator(ctx context.Context, req *ListEvaluationReq, options ...larkcore.RequestOptionFunc) (*ListEvaluationIterator, error) {
+ return &ListEvaluationIterator{
+ ctx: ctx,
+ req: req,
+ listFunc: e.List,
+ options: options,
+ limit: req.Limit}, nil
+}
+
+// 创建外部投递
+//
+// - 导入来自其他系统的投递信息,创建为外部投递
+//
+// - 官网API文档链接:https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/external_application/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/create_externalApplication.go
+func (e *externalApplication) Create(ctx context.Context, req *CreateExternalApplicationReq, options ...larkcore.RequestOptionFunc) (*CreateExternalApplicationResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/external_applications"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateExternalApplicationResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, e.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// - 删除外部投递
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=delete&project=hire&resource=external_application&version=v1
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/delete_externalApplication.go
+func (e *externalApplication) Delete(ctx context.Context, req *DeleteExternalApplicationReq, options ...larkcore.RequestOptionFunc) (*DeleteExternalApplicationResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/external_applications/:external_application_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeleteExternalApplicationResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, e.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// - 更新外部投递
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=update&project=hire&resource=external_application&version=v1
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/update_externalApplication.go
+func (e *externalApplication) Update(ctx context.Context, req *UpdateExternalApplicationReq, options ...larkcore.RequestOptionFunc) (*UpdateExternalApplicationResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/external_applications/:external_application_id"
+ apiReq.HttpMethod = http.MethodPut
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &UpdateExternalApplicationResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, e.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 创建外部背调
+//
+// - 导入来自其他系统的背调信息,创建为外部背调
+//
+// - 官网API文档链接:https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/external_background_check/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/create_externalBackgroundCheck.go
+func (e *externalBackgroundCheck) Create(ctx context.Context, req *CreateExternalBackgroundCheckReq, options ...larkcore.RequestOptionFunc) (*CreateExternalBackgroundCheckResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/external_background_checks"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateExternalBackgroundCheckResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, e.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 创建外部面试
+//
+// - 导入来自其他系统的面试信息,创建为外部面试
+//
+// - 官网API文档链接:https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/external_interview/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/create_externalInterview.go
+func (e *externalInterview) Create(ctx context.Context, req *CreateExternalInterviewReq, options ...larkcore.RequestOptionFunc) (*CreateExternalInterviewResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/external_interviews"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateExternalInterviewResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, e.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 创建外部面评
+//
+// - 导入来自其他系统的面评信息,创建为外部面评
+//
+// - 官网API文档链接:https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/external_interview_assessment/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/create_externalInterviewAssessment.go
+func (e *externalInterviewAssessment) Create(ctx context.Context, req *CreateExternalInterviewAssessmentReq, options ...larkcore.RequestOptionFunc) (*CreateExternalInterviewAssessmentResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/external_interview_assessments"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateExternalInterviewAssessmentResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, e.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 获取面试信息
+//
+// - 根据投递 ID 或面试时间获取面试信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/interview/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/list_interview.go
+func (i *interview) List(ctx context.Context, req *ListInterviewReq, options ...larkcore.RequestOptionFunc) (*ListInterviewResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/interviews"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, i.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListInterviewResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, i.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
// 新建职位
//
// - 新建职位,字段的是否必填,以系统中的「职位字段管理」中的设置为准。
@@ -615,6 +891,162 @@ func (j *jobProcess) List(ctx context.Context, req *ListJobProcessReq, options .
return resp, err
}
+// 创建招聘需求
+//
+// - 创建招聘需求,除招聘需求编号为必填外,其他字段是否必填与飞书招聘「招聘需求字段管理」内设置一致
+//
+// - 官网API文档链接:https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/job_requirement/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/create_jobRequirement.go
+func (j *jobRequirement) Create(ctx context.Context, req *CreateJobRequirementReq, options ...larkcore.RequestOptionFunc) (*CreateJobRequirementResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/job_requirements"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateJobRequirementResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 删除招聘需求
+//
+// - 删除招聘需求
+//
+// - 官网API文档链接:https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/job_requirement/delete
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/delete_jobRequirement.go
+func (j *jobRequirement) Delete(ctx context.Context, req *DeleteJobRequirementReq, options ...larkcore.RequestOptionFunc) (*DeleteJobRequirementResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/job_requirements/:job_requirement_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeleteJobRequirementResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 获取招聘需求列表
+//
+// - 获取招聘需求列表
+//
+// - 官网API文档链接:https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/job_requirement/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/list_jobRequirement.go
+func (j *jobRequirement) List(ctx context.Context, req *ListJobRequirementReq, options ...larkcore.RequestOptionFunc) (*ListJobRequirementResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/job_requirements"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListJobRequirementResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// - 获取招聘需求信息
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list_by_id&project=hire&resource=job_requirement&version=v1
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/listById_jobRequirement.go
+func (j *jobRequirement) ListById(ctx context.Context, req *ListByIdJobRequirementReq, options ...larkcore.RequestOptionFunc) (*ListByIdJobRequirementResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/job_requirements/search"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListByIdJobRequirementResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 更新招聘需求
+//
+// - 更新招聘需求
+//
+// - 官网API文档链接:https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/job_requirement/update
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/update_jobRequirement.go
+func (j *jobRequirement) Update(ctx context.Context, req *UpdateJobRequirementReq, options ...larkcore.RequestOptionFunc) (*UpdateJobRequirementResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/job_requirements/:job_requirement_id"
+ apiReq.HttpMethod = http.MethodPut
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &UpdateJobRequirementResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 获取招聘需求模板
+//
+// - 获取招聘需求模板
+//
+// - 官网API文档链接:https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/job_requirement_schema/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/list_jobRequirementSchema.go
+func (j *jobRequirementSchema) List(ctx context.Context, req *ListJobRequirementSchemaReq, options ...larkcore.RequestOptionFunc) (*ListJobRequirementSchemaResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/job_requirement_schemas"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, j.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListJobRequirementSchemaResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, j.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
// 创建备注
//
// - 创建备注信息
@@ -719,6 +1151,162 @@ func (n *note) Patch(ctx context.Context, req *PatchNoteReq, options ...larkcore
return resp, err
}
+// 创建 Offer
+//
+// - 创建 Offer 时,需传入本文档中标注为必传的参数,其余参数是否必传参考「获取 Offer 申请表模板信息」的参数定义
+//
+// - 官网API文档链接:https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/offer/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/create_offer.go
+func (o *offer) Create(ctx context.Context, req *CreateOfferReq, options ...larkcore.RequestOptionFunc) (*CreateOfferResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/offers"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, o.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateOfferResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, o.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 获取 Offer 详情
+//
+// - 根据 Offer ID 获取 Offer 详细信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/offer/get
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/get_offer.go
+func (o *offer) Get(ctx context.Context, req *GetOfferReq, options ...larkcore.RequestOptionFunc) (*GetOfferResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/offers/:offer_id"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, o.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetOfferResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, o.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 更新实习 Offer 入/离职状态
+//
+// - 对「实习待入职」状态的实习 Offer 确认入职、放弃入职,或对「实习已入职」状态的实习 Offer 操作离职
+//
+// - 官网API文档链接:https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/offer/intern_offer_status
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/internOfferStatus_offer.go
+func (o *offer) InternOfferStatus(ctx context.Context, req *InternOfferStatusOfferReq, options ...larkcore.RequestOptionFunc) (*InternOfferStatusOfferResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/offers/:offer_id/intern_offer_status"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, o.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &InternOfferStatusOfferResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, o.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 获取 Offer 列表
+//
+// - 根据人才 ID 获取 Offer 列表
+//
+// - 官网API文档链接:https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/offer/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/list_offer.go
+func (o *offer) List(ctx context.Context, req *ListOfferReq, options ...larkcore.RequestOptionFunc) (*ListOfferResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/offers"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, o.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListOfferResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, o.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=offer_status&project=hire&resource=offer&version=v1
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/offerStatus_offer.go
+func (o *offer) OfferStatus(ctx context.Context, req *OfferStatusOfferReq, options ...larkcore.RequestOptionFunc) (*OfferStatusOfferResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/offers/:offer_id/offer_status"
+ apiReq.HttpMethod = http.MethodPatch
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, o.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &OfferStatusOfferResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, o.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 更新 Offer 信息
+//
+// - 1. 更新 Offer 时,需传入本文档中标注为必传的参数,其余参数是否必传参考「获取 Offer 申请表模板信息」的参数定义;;2. 对系统中已存在的 offer 进行更新的,若更新 offer 中含有「修改需审批」的字段,更新后原 Offer 的审批会自动撤回,需要重新发起审批
+//
+// - 官网API文档链接:https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/offer/update
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/update_offer.go
+func (o *offer) Update(ctx context.Context, req *UpdateOfferReq, options ...larkcore.RequestOptionFunc) (*UpdateOfferResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/offers/:offer_id"
+ apiReq.HttpMethod = http.MethodPut
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, o.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &UpdateOfferResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, o.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
//
//
// -
@@ -745,6 +1333,32 @@ func (o *offerSchema) Get(ctx context.Context, req *GetOfferSchemaReq, options .
return resp, err
}
+// 获取面试满意度问卷列表
+//
+// - 获取面试满意度问卷列表
+//
+// - 官网API文档链接:https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/questionnaire/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/list_questionnaire.go
+func (q *questionnaire) List(ctx context.Context, req *ListQuestionnaireReq, options ...larkcore.RequestOptionFunc) (*ListQuestionnaireResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/questionnaires"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, q.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListQuestionnaireResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, q.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
// 获取内推信息
//
// - 根据投递 ID 获取内推信息
@@ -805,6 +1419,32 @@ func (r *resumeSource) ListByIterator(ctx context.Context, req *ListResumeSource
limit: req.Limit}, nil
}
+// 将人才加入指定文件夹
+//
+// - 将人才加入指定文件夹
+//
+// - 官网API文档链接:https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/talent/add_to_folder
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/addToFolder_talent.go
+func (t *talent) AddToFolder(ctx context.Context, req *AddToFolderTalentReq, options ...larkcore.RequestOptionFunc) (*AddToFolderTalentResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/talents/add_to_folder"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, t.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &AddToFolderTalentResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, t.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
// 通过人才信息获取人才 ID
//
// - 通过人才信息获取人才 ID
@@ -856,3 +1496,37 @@ func (t *talent) Get(ctx context.Context, req *GetTalentReq, options ...larkcore
}
return resp, err
}
+
+// 获取人才文件夹信息
+//
+// - 用于获取招聘系统中人才文件夹信息
+//
+// - 官网API文档链接:https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/talent_folder/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/hirev1/list_talentFolder.go
+func (t *talentFolder) List(ctx context.Context, req *ListTalentFolderReq, options ...larkcore.RequestOptionFunc) (*ListTalentFolderResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/hire/v1/talent_folders"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, t.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListTalentFolderResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, t.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+func (t *talentFolder) ListByIterator(ctx context.Context, req *ListTalentFolderReq, options ...larkcore.RequestOptionFunc) (*ListTalentFolderIterator, error) {
+ return &ListTalentFolderIterator{
+ ctx: ctx,
+ req: req,
+ listFunc: t.List,
+ options: options,
+ limit: req.Limit}, nil
+}
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/hire/v1/event.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/hire/v1/event.go
new file mode 100644
index 0000000000..1ba1e46a51
--- /dev/null
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/hire/v1/event.go
@@ -0,0 +1,98 @@
+// Package hire code generated by oapi sdk gen
+/*
+ * MIT License
+ *
+ * Copyright (c) 2022 Lark Technologies Pte. Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package larkhire
+
+import (
+ "context"
+)
+
+// 消息处理器定义
+type P2ApplicationStageChangedV1Handler struct {
+ handler func(context.Context, *P2ApplicationStageChangedV1) error
+}
+
+func NewP2ApplicationStageChangedV1Handler(handler func(context.Context, *P2ApplicationStageChangedV1) error) *P2ApplicationStageChangedV1Handler {
+ h := &P2ApplicationStageChangedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2ApplicationStageChangedV1Handler) Event() interface{} {
+ return &P2ApplicationStageChangedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2ApplicationStageChangedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2ApplicationStageChangedV1))
+}
+
+// 消息处理器定义
+type P2EhrImportTaskImportedV1Handler struct {
+ handler func(context.Context, *P2EhrImportTaskImportedV1) error
+}
+
+func NewP2EhrImportTaskImportedV1Handler(handler func(context.Context, *P2EhrImportTaskImportedV1) error) *P2EhrImportTaskImportedV1Handler {
+ h := &P2EhrImportTaskImportedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2EhrImportTaskImportedV1Handler) Event() interface{} {
+ return &P2EhrImportTaskImportedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2EhrImportTaskImportedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2EhrImportTaskImportedV1))
+}
+
+// 消息处理器定义
+type P2EhrImportTaskForInternshipOfferImportedV1Handler struct {
+ handler func(context.Context, *P2EhrImportTaskForInternshipOfferImportedV1) error
+}
+
+func NewP2EhrImportTaskForInternshipOfferImportedV1Handler(handler func(context.Context, *P2EhrImportTaskForInternshipOfferImportedV1) error) *P2EhrImportTaskForInternshipOfferImportedV1Handler {
+ h := &P2EhrImportTaskForInternshipOfferImportedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2EhrImportTaskForInternshipOfferImportedV1Handler) Event() interface{} {
+ return &P2EhrImportTaskForInternshipOfferImportedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2EhrImportTaskForInternshipOfferImportedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2EhrImportTaskForInternshipOfferImportedV1))
+}
+
+// 消息处理器定义
+type P2OfferStatusChangedV1Handler struct {
+ handler func(context.Context, *P2OfferStatusChangedV1) error
+}
+
+func NewP2OfferStatusChangedV1Handler(handler func(context.Context, *P2OfferStatusChangedV1) error) *P2OfferStatusChangedV1Handler {
+ h := &P2OfferStatusChangedV1Handler{handler: handler}
+ return h
+}
+
+// 返回事件的消息体的实例,用于反序列化用
+func (h *P2OfferStatusChangedV1Handler) Event() interface{} {
+ return &P2OfferStatusChangedV1{}
+}
+
+// 回调开发者注册的handle
+func (h *P2OfferStatusChangedV1Handler) Handle(ctx context.Context, event interface{}) error {
+ return h.handler(ctx, event.(*P2OfferStatusChangedV1))
+}
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/hire/v1/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/hire/v1/model.go
index a2a2915953..06fe39072e 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/hire/v1/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/hire/v1/model.go
@@ -14,10 +14,11 @@
package larkhire
import (
- "fmt"
-
"context"
"errors"
+ "fmt"
+
+ "github.com/larksuite/oapi-sdk-go/v3/event"
"github.com/larksuite/oapi-sdk-go/v3/core"
)
@@ -114,6 +115,61 @@ const (
DepartmentIdTypePatchEmployeePeopleAdminDepartmentId = "people_admin_department_id" // 以 people_admin_department_id 来标识部门
)
+const (
+ UserIdTypeListEvaluationUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeListEvaluationUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeListEvaluationOpenId = "open_id" // 以open_id来识别用户
+ UserIdTypeListEvaluationPeopleAdminId = "people_admin_id" // 以people_admin_id来识别用户
+)
+
+const (
+ JobRecruitmentTypeSocialRecruitment = 1 // 社招
+ JobRecruitmentTypeCampusRecruitment = 2 // 校招
+
+)
+
+const (
+ DeliveryTypeHRVisit = 1 // HR 寻访
+ DeliveryTypeCandidateDelivery = 2 // 候选人主动投递
+ DeliveryTypeTalentRecommend = 3 // 人才推荐
+ DeliveryTypeOthers = 4 // 其他
+
+)
+
+const (
+ JobRecruitmentTypeUpdateExternalApplicationSocialRecruitment = 1 // 社招
+ JobRecruitmentTypeUpdateExternalApplicationCampusRecruitment = 2 // 校招
+
+)
+
+const (
+ DeliveryTypeUpdateExternalApplicationHRVisit = 1 // HR 寻访
+ DeliveryTypeUpdateExternalApplicationCandidateDelivery = 2 // 候选人主动投递
+ DeliveryTypeUpdateExternalApplicationTalentRecommend = 3 // 人才推荐
+ DeliveryTypeUpdateExternalApplicationOthers = 4 // 其他
+
+)
+
+const (
+ ParticipateStatus未参与 = 1 // 未参与
+ ParticipateStatus参与 = 2 // 参与
+ ParticipateStatus爽约 = 3 // 爽约
+
+)
+
+const (
+ Conclusion不通过 = 1 // 不通过
+ Conclusion通过 = 2 // 通过
+ Conclusion待定 = 3 // 待定
+
+)
+
+const (
+ UserIdTypeListInterviewUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeListInterviewUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeListInterviewOpenId = "open_id" // 以open_id来识别用户
+)
+
const (
ExperienceNoLimit = 1 // 不限
ExperienceGraduate = 2 // 应届毕业生
@@ -236,6 +292,122 @@ const (
UserIdTypeGetJobManagerPeopleAdminId = "people_admin_id" // 以people_admin_id来识别用户
)
+const (
+ DisplayProgressWaitingStart = 1 // 待启动
+ DisplayProgressOnGoing = 2 // 进行中
+ DisplayProgressCanceled = 3 // 已取消
+ DisplayProgressSuspended = 4 // 已暂停
+ DisplayProgressCompleted = 5 // 已完成
+ DisplayProgressExpired = 6 // 已超期
+
+)
+
+const (
+ CategoryAddition = 1 // 新增
+ CategoryReplacement = 2 // 替换
+
+)
+
+const (
+ PriorityHigh = 1 // 高
+ PriorityMedium = 2 // 中
+ PriorityLow = 3 // 低
+
+)
+
+const (
+ RequiredDegreeCreateJobRequirementPrimaryEducation = 1 // 小学及以上
+ RequiredDegreeCreateJobRequirementJuniorMiddleSchoolEducation = 2 // 初中及以上
+ RequiredDegreeCreateJobRequirementSecondary = 3 // 专职及以上
+ RequiredDegreeCreateJobRequirementSeniorSchoolGraduates = 4 // 高中及以上
+ RequiredDegreeCreateJobRequirementAssociate = 5 // 大专及以上
+ RequiredDegreeCreateJobRequirementBachelor = 6 // 本科及以上
+ RequiredDegreeCreateJobRequirementMaster = 7 // 硕士及以上
+ RequiredDegreeCreateJobRequirementPhd = 8 // 博士及以上
+ RequiredDegreeCreateJobRequirementNoLimit = 20 // 不限
+
+)
+
+const (
+ UserIdTypeCreateJobRequirementUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeCreateJobRequirementUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeCreateJobRequirementOpenId = "open_id" // 以open_id来识别用户
+)
+
+const (
+ DepartmentIdTypeCreateJobRequirementOpenDepartmentId = "open_department_id" // 以 open_department_id 来标识部门
+ DepartmentIdTypeCreateJobRequirementDepartmentId = "department_id" // 以 department_id 来标识部门
+)
+
+const (
+ UserIdTypeListJobRequirementUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeListJobRequirementUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeListJobRequirementOpenId = "open_id" // 以open_id来识别用户
+)
+
+const (
+ DepartmentIdTypeListJobRequirementOpenDepartmentId = "open_department_id" // 以 open_department_id 来标识部门
+ DepartmentIdTypeListJobRequirementDepartmentId = "department_id" // 以 department_id 来标识部门
+)
+
+const (
+ UserIdTypeListByIdJobRequirementUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeListByIdJobRequirementUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeListByIdJobRequirementOpenId = "open_id" // 以open_id来识别用户
+)
+
+const (
+ DepartmentIdTypeListByIdJobRequirementOpenDepartmentId = "open_department_id" // 以 open_department_id 来标识部门
+ DepartmentIdTypeListByIdJobRequirementDepartmentId = "department_id" // 以 department_id 来标识部门
+)
+
+const (
+ DisplayProgressUpdateJobRequirementWaitingStart = 1 // 待启动
+ DisplayProgressUpdateJobRequirementOnGoing = 2 // 进行中
+ DisplayProgressUpdateJobRequirementCanceled = 3 // 已取消
+ DisplayProgressUpdateJobRequirementSuspended = 4 // 已暂停
+ DisplayProgressUpdateJobRequirementCompleted = 5 // 已完成
+ DisplayProgressUpdateJobRequirementExpired = 6 // 已超期
+
+)
+
+const (
+ CategoryUpdateJobRequirementAddition = 1 // 新增
+ CategoryUpdateJobRequirementReplacement = 2 // 替换
+
+)
+
+const (
+ PriorityUpdateJobRequirementHigh = 1 // 高
+ PriorityUpdateJobRequirementMedium = 2 // 中
+ PriorityUpdateJobRequirementLow = 3 // 低
+
+)
+
+const (
+ RequiredDegreeUpdateJobRequirementPrimaryEducation = 1 // 小学及以上
+ RequiredDegreeUpdateJobRequirementJuniorMiddleSchoolEducation = 2 // 初中及以上
+ RequiredDegreeUpdateJobRequirementSecondary = 3 // 专职及以上
+ RequiredDegreeUpdateJobRequirementSeniorSchoolGraduates = 4 // 高中及以上
+ RequiredDegreeUpdateJobRequirementAssociate = 5 // 大专及以上
+ RequiredDegreeUpdateJobRequirementBachelor = 6 // 本科及以上
+ RequiredDegreeUpdateJobRequirementMaster = 7 // 硕士及以上
+ RequiredDegreeUpdateJobRequirementPhd = 8 // 博士及以上
+ RequiredDegreeUpdateJobRequirementNoLimit = 20 // 不限
+
+)
+
+const (
+ UserIdTypeUpdateJobRequirementUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeUpdateJobRequirementUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeUpdateJobRequirementOpenId = "open_id" // 以open_id来识别用户
+)
+
+const (
+ DepartmentIdTypeUpdateJobRequirementOpenDepartmentId = "open_department_id" // 以 open_department_id 来标识部门
+ DepartmentIdTypeUpdateJobRequirementDepartmentId = "department_id" // 以 department_id 来标识部门
+)
+
const (
PrivacyPrivate = 1 // 私密
PrivacyPublic = 2 // 公开
@@ -270,6 +442,73 @@ const (
UserIdTypePatchNotePeopleAdminId = "people_admin_id" // 以people_admin_id来识别用户
)
+const (
+ OfferType正式Offer = 1 // 正式 Offer
+ OfferType实习Offer = 2 // 实习 Offer
+
+)
+
+const (
+ UserIdTypeCreateOfferUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeCreateOfferUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeCreateOfferOpenId = "open_id" // 以open_id来识别用户
+ UserIdTypeCreateOfferPeopleAdminId = "people_admin_id" // 以people_admin_id来识别用户
+)
+
+const (
+ DepartmentIdTypeCreateOfferOpenDepartmentId = "open_department_id" // 以 open_department_id 来标识部门
+ DepartmentIdTypeCreateOfferDepartmentId = "department_id" // 以 department_id 来标识部门
+)
+
+const (
+ UserIdTypeGetOfferUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeGetOfferUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeGetOfferOpenId = "open_id" // 以open_id来识别用户
+ UserIdTypeGetOfferPeopleAdminId = "people_admin_id" // 以people_admin_id来识别用户
+)
+
+const (
+ DepartmentIdTypeGetOfferOpenDepartmentId = "open_department_id" // 以 open_department_id 来标识部门
+ DepartmentIdTypeGetOfferDepartmentId = "department_id" // 以 department_id 来标识部门
+)
+
+const (
+ OperationInternOfferStatusOfferConfirmOnboarding = "confirm_onboarding" // 确认入职
+ OperationInternOfferStatusOfferCancelOnboarding = "cancel_onboarding" // 放弃入职
+ OperationInternOfferStatusOfferOffboard = "offboard" // 操作离职
+)
+
+const (
+ UserIdTypeListOfferUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeListOfferUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeListOfferOpenId = "open_id" // 以open_id来识别用户
+ UserIdTypeListOfferPeopleAdminId = "people_admin_id" // 以people_admin_id来识别用户
+)
+
+const (
+ OfferStatusApproving = 2 // 审批中
+ OfferStatusWithdrawn = 3 // 审批已撤回
+ OfferStatusApproved = 4 // 审批通过
+ OfferStatusRejected = 5 // 审批不通过
+ OfferStatusOfferLetterSent = 6 // Offer已发出
+ OfferStatusOfferAccepted = 7 // 候选人已接收
+ OfferStatusOfferRejected = 8 // 候选人已拒绝
+ OfferStatusObsolete = 9 // Offer 已失效
+
+)
+
+const (
+ UserIdTypeUpdateOfferUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeUpdateOfferUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeUpdateOfferOpenId = "open_id" // 以open_id来识别用户
+ UserIdTypeUpdateOfferPeopleAdminId = "people_admin_id" // 以people_admin_id来识别用户
+)
+
+const (
+ DepartmentIdTypeUpdateOfferOpenDepartmentId = "open_department_id" // 以 open_department_id 来标识部门
+ DepartmentIdTypeUpdateOfferDepartmentId = "department_id" // 以 department_id 来标识部门
+)
+
const (
UserIdTypeGetByApplicationReferralUserId = "user_id" // 以user_id来识别用户
UserIdTypeGetByApplicationReferralUnionId = "union_id" // 以union_id来识别用户
@@ -284,6 +523,13 @@ const (
UserIdTypeGetTalentPeopleAdminId = "people_admin_id" // 以 people_admin_id 来识别用户
)
+const (
+ UserIdTypeListTalentFolderUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeListTalentFolderUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeListTalentFolderOpenId = "open_id" // 以open_id来识别用户
+ UserIdTypeListTalentFolderPeopleAdminId = "people_admin_id" // 以people_admin_id来识别用户
+)
+
type Agency struct {
Id *string `json:"id,omitempty"` // 猎头供应商ID
Name *string `json:"name,omitempty"` // 猎头供应商名称
@@ -6040,6 +6286,102 @@ func (builder *AttachmentBuilder) Build() *Attachment {
return req
}
+type AttachmentInfo struct {
+ Id *string `json:"id,omitempty"` // 附件id
+ Url *string `json:"url,omitempty"` // 附件的url
+ Name *string `json:"name,omitempty"` // 附件文件名
+ Mime *string `json:"mime,omitempty"` // 媒体类型/MIME
+ CreateTime *string `json:"create_time,omitempty"` // 附件创建时间(单位ms)
+}
+
+type AttachmentInfoBuilder struct {
+ id string // 附件id
+ idFlag bool
+ url string // 附件的url
+ urlFlag bool
+ name string // 附件文件名
+ nameFlag bool
+ mime string // 媒体类型/MIME
+ mimeFlag bool
+ createTime string // 附件创建时间(单位ms)
+ createTimeFlag bool
+}
+
+func NewAttachmentInfoBuilder() *AttachmentInfoBuilder {
+ builder := &AttachmentInfoBuilder{}
+ return builder
+}
+
+// 附件id
+//
+// 示例值:6949805467799537964
+func (builder *AttachmentInfoBuilder) Id(id string) *AttachmentInfoBuilder {
+ builder.id = id
+ builder.idFlag = true
+ return builder
+}
+
+// 附件的url
+//
+// 示例值:https://hire.feishu.cn/blob/xx/
+func (builder *AttachmentInfoBuilder) Url(url string) *AttachmentInfoBuilder {
+ builder.url = url
+ builder.urlFlag = true
+ return builder
+}
+
+// 附件文件名
+//
+// 示例值:xx的简历.prd
+func (builder *AttachmentInfoBuilder) Name(name string) *AttachmentInfoBuilder {
+ builder.name = name
+ builder.nameFlag = true
+ return builder
+}
+
+// 媒体类型/MIME
+//
+// 示例值:application/pdf
+func (builder *AttachmentInfoBuilder) Mime(mime string) *AttachmentInfoBuilder {
+ builder.mime = mime
+ builder.mimeFlag = true
+ return builder
+}
+
+// 附件创建时间(单位ms)
+//
+// 示例值:1618899376480
+func (builder *AttachmentInfoBuilder) CreateTime(createTime string) *AttachmentInfoBuilder {
+ builder.createTime = createTime
+ builder.createTimeFlag = true
+ return builder
+}
+
+func (builder *AttachmentInfoBuilder) Build() *AttachmentInfo {
+ req := &AttachmentInfo{}
+ if builder.idFlag {
+ req.Id = &builder.id
+
+ }
+ if builder.urlFlag {
+ req.Url = &builder.url
+
+ }
+ if builder.nameFlag {
+ req.Name = &builder.name
+
+ }
+ if builder.mimeFlag {
+ req.Mime = &builder.mime
+
+ }
+ if builder.createTimeFlag {
+ req.CreateTime = &builder.createTime
+
+ }
+ return req
+}
+
type Auth struct {
Id *string `json:"id,omitempty"` // 权限 ID
Name *I18n `json:"name,omitempty"` // 权限名称
@@ -7517,96 +7859,99 @@ func (builder *CodeNameObjectBuilder) Build() *CodeNameObject {
}
type CombinedJob struct {
- Id *string `json:"id,omitempty"` // 职位 ID
- Code *string `json:"code,omitempty"` // 职位编号,可传入职位的「职位编号」、「职位 ID」或者「职位序号」,将以传入的参数作为职位编号,以便双方系统的数据映射
- Experience *int `json:"experience,omitempty"` // 工作年限
- ExpiryTime *int `json:"expiry_time,omitempty"` // 到期日期
- CustomizedDataList []*CombinedJobObjectValueMap `json:"customized_data_list,omitempty"` // 自定义字段
- MinLevelId *string `json:"min_level_id,omitempty"` // 最低职级,枚举通过接口「获取职级列表」获取
- MinSalary *int `json:"min_salary,omitempty"` // 最低薪资,单位:k
- Title *string `json:"title,omitempty"` // 职位名称
- JobManagers *JobManager `json:"job_managers,omitempty"` // 职位的招聘团队
- JobProcessId *string `json:"job_process_id,omitempty"` // 招聘流程,枚举通过接口「获取招聘流程信息」获取
- ProcessType *int `json:"process_type,omitempty"` // 职位流程类型
- SubjectId *string `json:"subject_id,omitempty"` // 项目,枚举通过「获取项目列表」接口
- JobFunctionId *string `json:"job_function_id,omitempty"` // 职能分类,通过「获取职能分类」获取
- DepartmentId *string `json:"department_id,omitempty"` // 部门 ID,须传入open_department_id,格式为"od-xxxx"。可通过「获取部门信息列表」获取
- HeadCount *int `json:"head_count,omitempty"` // 招聘数量
- IsNeverExpired *bool `json:"is_never_expired,omitempty"` // 是否长期有效
- MaxSalary *int `json:"max_salary,omitempty"` // 最高薪资,单位:k
- Requirement *string `json:"requirement,omitempty"` // 职位要求
- AddressId *string `json:"address_id,omitempty"` // 工作地点,枚举通过接口「获取地址列表」获取,选择地点用途为「职位地址」
- Description *string `json:"description,omitempty"` // 职位描述
- HighlightList []string `json:"highlight_list,omitempty"` // 职位亮点
- JobTypeId *string `json:"job_type_id,omitempty"` // 职位类别
- MaxLevelId *string `json:"max_level_id,omitempty"` // 最高职级,枚举通过接口「获取职级列表」获取
- RecruitmentTypeId *string `json:"recruitment_type_id,omitempty"` // 雇佣类型
- RequiredDegree *int `json:"required_degree,omitempty"` // 学历要求
- JobCategoryId *string `json:"job_category_id,omitempty"` // 序列
- AddressIdList []string `json:"address_id_list,omitempty"` // 工作地点,枚举通过接口「获取地址列表」获取,选择地点用途为「职位地址」
- JobAttribute *int `json:"job_attribute,omitempty"` // 职位属性,1是实体职位,2是虚拟职位
- ExpiryTimestamp *string `json:"expiry_timestamp,omitempty"` // 到期日期的毫秒时间戳
+ Id *string `json:"id,omitempty"` // 职位 ID
+ Code *string `json:"code,omitempty"` // 职位编号,可传入职位的「职位编号」、「职位 ID」或者「职位序号」,将以传入的参数作为职位编号,以便双方系统的数据映射
+ Experience *int `json:"experience,omitempty"` // 工作年限
+ ExpiryTime *int `json:"expiry_time,omitempty"` // 到期日期
+ CustomizedDataList []*CombinedJobObjectValueMap `json:"customized_data_list,omitempty"` // 自定义字段
+ MinLevelId *string `json:"min_level_id,omitempty"` // 最低职级,枚举通过接口「获取职级列表」获取
+ MinSalary *int `json:"min_salary,omitempty"` // 最低薪资,单位:k
+ Title *string `json:"title,omitempty"` // 职位名称
+ JobManagers *JobManager `json:"job_managers,omitempty"` // 职位的招聘团队
+ JobProcessId *string `json:"job_process_id,omitempty"` // 招聘流程,枚举通过接口「获取招聘流程信息」获取
+ ProcessType *int `json:"process_type,omitempty"` // 职位流程类型
+ SubjectId *string `json:"subject_id,omitempty"` // 项目,枚举通过「获取项目列表」接口
+ JobFunctionId *string `json:"job_function_id,omitempty"` // 职能分类,通过「获取职能分类」获取
+ DepartmentId *string `json:"department_id,omitempty"` // 部门 ID,须传入open_department_id,格式为"od-xxxx"。可通过「获取部门信息列表」获取
+ HeadCount *int `json:"head_count,omitempty"` // 招聘数量
+ IsNeverExpired *bool `json:"is_never_expired,omitempty"` // 是否长期有效
+ MaxSalary *int `json:"max_salary,omitempty"` // 最高薪资,单位:k
+ Requirement *string `json:"requirement,omitempty"` // 职位要求
+ AddressId *string `json:"address_id,omitempty"` // 工作地点,枚举通过接口「获取地址列表」获取,选择地点用途为「职位地址」
+ Description *string `json:"description,omitempty"` // 职位描述
+ HighlightList []string `json:"highlight_list,omitempty"` // 职位亮点
+ JobTypeId *string `json:"job_type_id,omitempty"` // 职位类别
+ MaxLevelId *string `json:"max_level_id,omitempty"` // 最高职级,枚举通过接口「获取职级列表」获取
+ RecruitmentTypeId *string `json:"recruitment_type_id,omitempty"` // 雇佣类型
+ RequiredDegree *int `json:"required_degree,omitempty"` // 学历要求
+ JobCategoryId *string `json:"job_category_id,omitempty"` // 序列
+ AddressIdList []string `json:"address_id_list,omitempty"` // 工作地点,枚举通过接口「获取地址列表」获取,选择地点用途为「职位地址」
+ JobAttribute *int `json:"job_attribute,omitempty"` // 职位属性,1是实体职位,2是虚拟职位
+ ExpiryTimestamp *string `json:"expiry_timestamp,omitempty"` // 到期日期的毫秒时间戳
+ InterviewRegistrationSchemaId *string `json:"interview_registration_schema_id,omitempty"` // 面试登记表ID
}
type CombinedJobBuilder struct {
- id string // 职位 ID
- idFlag bool
- code string // 职位编号,可传入职位的「职位编号」、「职位 ID」或者「职位序号」,将以传入的参数作为职位编号,以便双方系统的数据映射
- codeFlag bool
- experience int // 工作年限
- experienceFlag bool
- expiryTime int // 到期日期
- expiryTimeFlag bool
- customizedDataList []*CombinedJobObjectValueMap // 自定义字段
- customizedDataListFlag bool
- minLevelId string // 最低职级,枚举通过接口「获取职级列表」获取
- minLevelIdFlag bool
- minSalary int // 最低薪资,单位:k
- minSalaryFlag bool
- title string // 职位名称
- titleFlag bool
- jobManagers *JobManager // 职位的招聘团队
- jobManagersFlag bool
- jobProcessId string // 招聘流程,枚举通过接口「获取招聘流程信息」获取
- jobProcessIdFlag bool
- processType int // 职位流程类型
- processTypeFlag bool
- subjectId string // 项目,枚举通过「获取项目列表」接口
- subjectIdFlag bool
- jobFunctionId string // 职能分类,通过「获取职能分类」获取
- jobFunctionIdFlag bool
- departmentId string // 部门 ID,须传入open_department_id,格式为"od-xxxx"。可通过「获取部门信息列表」获取
- departmentIdFlag bool
- headCount int // 招聘数量
- headCountFlag bool
- isNeverExpired bool // 是否长期有效
- isNeverExpiredFlag bool
- maxSalary int // 最高薪资,单位:k
- maxSalaryFlag bool
- requirement string // 职位要求
- requirementFlag bool
- addressId string // 工作地点,枚举通过接口「获取地址列表」获取,选择地点用途为「职位地址」
- addressIdFlag bool
- description string // 职位描述
- descriptionFlag bool
- highlightList []string // 职位亮点
- highlightListFlag bool
- jobTypeId string // 职位类别
- jobTypeIdFlag bool
- maxLevelId string // 最高职级,枚举通过接口「获取职级列表」获取
- maxLevelIdFlag bool
- recruitmentTypeId string // 雇佣类型
- recruitmentTypeIdFlag bool
- requiredDegree int // 学历要求
- requiredDegreeFlag bool
- jobCategoryId string // 序列
- jobCategoryIdFlag bool
- addressIdList []string // 工作地点,枚举通过接口「获取地址列表」获取,选择地点用途为「职位地址」
- addressIdListFlag bool
- jobAttribute int // 职位属性,1是实体职位,2是虚拟职位
- jobAttributeFlag bool
- expiryTimestamp string // 到期日期的毫秒时间戳
- expiryTimestampFlag bool
+ id string // 职位 ID
+ idFlag bool
+ code string // 职位编号,可传入职位的「职位编号」、「职位 ID」或者「职位序号」,将以传入的参数作为职位编号,以便双方系统的数据映射
+ codeFlag bool
+ experience int // 工作年限
+ experienceFlag bool
+ expiryTime int // 到期日期
+ expiryTimeFlag bool
+ customizedDataList []*CombinedJobObjectValueMap // 自定义字段
+ customizedDataListFlag bool
+ minLevelId string // 最低职级,枚举通过接口「获取职级列表」获取
+ minLevelIdFlag bool
+ minSalary int // 最低薪资,单位:k
+ minSalaryFlag bool
+ title string // 职位名称
+ titleFlag bool
+ jobManagers *JobManager // 职位的招聘团队
+ jobManagersFlag bool
+ jobProcessId string // 招聘流程,枚举通过接口「获取招聘流程信息」获取
+ jobProcessIdFlag bool
+ processType int // 职位流程类型
+ processTypeFlag bool
+ subjectId string // 项目,枚举通过「获取项目列表」接口
+ subjectIdFlag bool
+ jobFunctionId string // 职能分类,通过「获取职能分类」获取
+ jobFunctionIdFlag bool
+ departmentId string // 部门 ID,须传入open_department_id,格式为"od-xxxx"。可通过「获取部门信息列表」获取
+ departmentIdFlag bool
+ headCount int // 招聘数量
+ headCountFlag bool
+ isNeverExpired bool // 是否长期有效
+ isNeverExpiredFlag bool
+ maxSalary int // 最高薪资,单位:k
+ maxSalaryFlag bool
+ requirement string // 职位要求
+ requirementFlag bool
+ addressId string // 工作地点,枚举通过接口「获取地址列表」获取,选择地点用途为「职位地址」
+ addressIdFlag bool
+ description string // 职位描述
+ descriptionFlag bool
+ highlightList []string // 职位亮点
+ highlightListFlag bool
+ jobTypeId string // 职位类别
+ jobTypeIdFlag bool
+ maxLevelId string // 最高职级,枚举通过接口「获取职级列表」获取
+ maxLevelIdFlag bool
+ recruitmentTypeId string // 雇佣类型
+ recruitmentTypeIdFlag bool
+ requiredDegree int // 学历要求
+ requiredDegreeFlag bool
+ jobCategoryId string // 序列
+ jobCategoryIdFlag bool
+ addressIdList []string // 工作地点,枚举通过接口「获取地址列表」获取,选择地点用途为「职位地址」
+ addressIdListFlag bool
+ jobAttribute int // 职位属性,1是实体职位,2是虚拟职位
+ jobAttributeFlag bool
+ expiryTimestamp string // 到期日期的毫秒时间戳
+ expiryTimestampFlag bool
+ interviewRegistrationSchemaId string // 面试登记表ID
+ interviewRegistrationSchemaIdFlag bool
}
func NewCombinedJobBuilder() *CombinedJobBuilder {
@@ -7875,6 +8220,15 @@ func (builder *CombinedJobBuilder) ExpiryTimestamp(expiryTimestamp string) *Comb
return builder
}
+// 面试登记表ID
+//
+// 示例值:6930815272790114324
+func (builder *CombinedJobBuilder) InterviewRegistrationSchemaId(interviewRegistrationSchemaId string) *CombinedJobBuilder {
+ builder.interviewRegistrationSchemaId = interviewRegistrationSchemaId
+ builder.interviewRegistrationSchemaIdFlag = true
+ return builder
+}
+
func (builder *CombinedJobBuilder) Build() *CombinedJob {
req := &CombinedJob{}
if builder.idFlag {
@@ -7988,6 +8342,10 @@ func (builder *CombinedJobBuilder) Build() *CombinedJob {
if builder.expiryTimestampFlag {
req.ExpiryTimestamp = &builder.expiryTimestamp
+ }
+ if builder.interviewRegistrationSchemaIdFlag {
+ req.InterviewRegistrationSchemaId = &builder.interviewRegistrationSchemaId
+
}
return req
}
@@ -8041,18 +8399,21 @@ func (builder *CombinedJobObjectValueMapBuilder) Build() *CombinedJobObjectValue
}
type CombinedJobResult struct {
- DefaultJobPost *CombinedJobResultDefaultJobPost `json:"default_job_post,omitempty"` // 职位广告
- Job *Job `json:"job,omitempty"` // 职位
- JobManager *JobManager `json:"job_manager,omitempty"` // 职位负责人
+ DefaultJobPost *CombinedJobResultDefaultJobPost `json:"default_job_post,omitempty"` // 职位广告
+ Job *Job `json:"job,omitempty"` // 职位
+ JobManager *JobManager `json:"job_manager,omitempty"` // 职位负责人
+ InterviewRegistrationSchemaInfo *RegistrationInfo `json:"interview_registration_schema_info,omitempty"` // 面试登记表
}
type CombinedJobResultBuilder struct {
- defaultJobPost *CombinedJobResultDefaultJobPost // 职位广告
- defaultJobPostFlag bool
- job *Job // 职位
- jobFlag bool
- jobManager *JobManager // 职位负责人
- jobManagerFlag bool
+ defaultJobPost *CombinedJobResultDefaultJobPost // 职位广告
+ defaultJobPostFlag bool
+ job *Job // 职位
+ jobFlag bool
+ jobManager *JobManager // 职位负责人
+ jobManagerFlag bool
+ interviewRegistrationSchemaInfo *RegistrationInfo // 面试登记表
+ interviewRegistrationSchemaInfoFlag bool
}
func NewCombinedJobResultBuilder() *CombinedJobResultBuilder {
@@ -8087,6 +8448,15 @@ func (builder *CombinedJobResultBuilder) JobManager(jobManager *JobManager) *Com
return builder
}
+// 面试登记表
+//
+// 示例值:
+func (builder *CombinedJobResultBuilder) InterviewRegistrationSchemaInfo(interviewRegistrationSchemaInfo *RegistrationInfo) *CombinedJobResultBuilder {
+ builder.interviewRegistrationSchemaInfo = interviewRegistrationSchemaInfo
+ builder.interviewRegistrationSchemaInfoFlag = true
+ return builder
+}
+
func (builder *CombinedJobResultBuilder) Build() *CombinedJobResult {
req := &CombinedJobResult{}
if builder.defaultJobPostFlag {
@@ -8098,6 +8468,9 @@ func (builder *CombinedJobResultBuilder) Build() *CombinedJobResult {
if builder.jobManagerFlag {
req.JobManager = builder.jobManager
}
+ if builder.interviewRegistrationSchemaInfoFlag {
+ req.InterviewRegistrationSchemaInfo = builder.interviewRegistrationSchemaInfo
+ }
return req
}
@@ -8885,6 +9258,180 @@ func (builder *DepartmentBuilder) Build() *Department {
return req
}
+type DiData struct {
+ Value *string `json:"value,omitempty"` // 字段值 1. 单选: "1" 2. 多选:"["1", "2"]" 3. 月份选择:"{"date":"2022-01"}" 4. 年份选择:"{"date":"2022"}" 5. 数字:"123" 6. 单行文本:"xxx " 7. 多行文本:"xxx xxxx" 8. 日期范围 "[1688140800000,1688140800000]"
+ ObjectAttribute *ObjectAttribute `json:"object_attribute,omitempty"` // 字段属性
+}
+
+type DiDataBuilder struct {
+ value string // 字段值 1. 单选: "1" 2. 多选:"["1", "2"]" 3. 月份选择:"{"date":"2022-01"}" 4. 年份选择:"{"date":"2022"}" 5. 数字:"123" 6. 单行文本:"xxx " 7. 多行文本:"xxx xxxx" 8. 日期范围 "[1688140800000,1688140800000]"
+ valueFlag bool
+ objectAttribute *ObjectAttribute // 字段属性
+ objectAttributeFlag bool
+}
+
+func NewDiDataBuilder() *DiDataBuilder {
+ builder := &DiDataBuilder{}
+ return builder
+}
+
+// 字段值 1. 单选: "1" 2. 多选:"["1", "2"]" 3. 月份选择:"{"date":"2022-01"}" 4. 年份选择:"{"date":"2022"}" 5. 数字:"123" 6. 单行文本:"xxx " 7. 多行文本:"xxx xxxx" 8. 日期范围 "[1688140800000,1688140800000]"
+//
+// 示例值:"1"
+func (builder *DiDataBuilder) Value(value string) *DiDataBuilder {
+ builder.value = value
+ builder.valueFlag = true
+ return builder
+}
+
+// 字段属性
+//
+// 示例值:
+func (builder *DiDataBuilder) ObjectAttribute(objectAttribute *ObjectAttribute) *DiDataBuilder {
+ builder.objectAttribute = objectAttribute
+ builder.objectAttributeFlag = true
+ return builder
+}
+
+func (builder *DiDataBuilder) Build() *DiData {
+ req := &DiData{}
+ if builder.valueFlag {
+ req.Value = &builder.value
+
+ }
+ if builder.objectAttributeFlag {
+ req.ObjectAttribute = builder.objectAttribute
+ }
+ return req
+}
+
+type DiInfo struct {
+ Id *string `json:"id,omitempty"` // DI信息 ID
+ ApplicationId *string `json:"application_id,omitempty"` // 投递ID
+ TalentId *string `json:"talent_id,omitempty"` // 人才ID
+ SourceType *int `json:"source_type,omitempty"` // 数据来源
+ CreateTime *string `json:"create_time,omitempty"` // 创建时间毫秒时间戳
+ UpdateTime *string `json:"update_time,omitempty"` // 更新时间毫秒时间戳
+ DiData []*DiData `json:"di_data,omitempty"` // 多元信息
+}
+
+type DiInfoBuilder struct {
+ id string // DI信息 ID
+ idFlag bool
+ applicationId string // 投递ID
+ applicationIdFlag bool
+ talentId string // 人才ID
+ talentIdFlag bool
+ sourceType int // 数据来源
+ sourceTypeFlag bool
+ createTime string // 创建时间毫秒时间戳
+ createTimeFlag bool
+ updateTime string // 更新时间毫秒时间戳
+ updateTimeFlag bool
+ diData []*DiData // 多元信息
+ diDataFlag bool
+}
+
+func NewDiInfoBuilder() *DiInfoBuilder {
+ builder := &DiInfoBuilder{}
+ return builder
+}
+
+// DI信息 ID
+//
+// 示例值:"6784008015948283904"
+func (builder *DiInfoBuilder) Id(id string) *DiInfoBuilder {
+ builder.id = id
+ builder.idFlag = true
+ return builder
+}
+
+// 投递ID
+//
+// 示例值:"6784008015948283905"
+func (builder *DiInfoBuilder) ApplicationId(applicationId string) *DiInfoBuilder {
+ builder.applicationId = applicationId
+ builder.applicationIdFlag = true
+ return builder
+}
+
+// 人才ID
+//
+// 示例值:"6784008015948283906"
+func (builder *DiInfoBuilder) TalentId(talentId string) *DiInfoBuilder {
+ builder.talentId = talentId
+ builder.talentIdFlag = true
+ return builder
+}
+
+// 数据来源
+//
+// 示例值:1
+func (builder *DiInfoBuilder) SourceType(sourceType int) *DiInfoBuilder {
+ builder.sourceType = sourceType
+ builder.sourceTypeFlag = true
+ return builder
+}
+
+// 创建时间毫秒时间戳
+//
+// 示例值:"1681301987"
+func (builder *DiInfoBuilder) CreateTime(createTime string) *DiInfoBuilder {
+ builder.createTime = createTime
+ builder.createTimeFlag = true
+ return builder
+}
+
+// 更新时间毫秒时间戳
+//
+// 示例值:"1681301987"
+func (builder *DiInfoBuilder) UpdateTime(updateTime string) *DiInfoBuilder {
+ builder.updateTime = updateTime
+ builder.updateTimeFlag = true
+ return builder
+}
+
+// 多元信息
+//
+// 示例值:
+func (builder *DiInfoBuilder) DiData(diData []*DiData) *DiInfoBuilder {
+ builder.diData = diData
+ builder.diDataFlag = true
+ return builder
+}
+
+func (builder *DiInfoBuilder) Build() *DiInfo {
+ req := &DiInfo{}
+ if builder.idFlag {
+ req.Id = &builder.id
+
+ }
+ if builder.applicationIdFlag {
+ req.ApplicationId = &builder.applicationId
+
+ }
+ if builder.talentIdFlag {
+ req.TalentId = &builder.talentId
+
+ }
+ if builder.sourceTypeFlag {
+ req.SourceType = &builder.sourceType
+
+ }
+ if builder.createTimeFlag {
+ req.CreateTime = &builder.createTime
+
+ }
+ if builder.updateTimeFlag {
+ req.UpdateTime = &builder.updateTime
+
+ }
+ if builder.diDataFlag {
+ req.DiData = builder.diData
+ }
+ return req
+}
+
type Dummy struct {
Id *string `json:"id,omitempty"` // id
}
@@ -11571,6 +12118,38 @@ func (builder *ExternalBackgroundCheckAttachmentBuilder) Build() *ExternalBackgr
return req
}
+type ExternalGrantRoleInfo struct {
+ RoleId *string `json:"role_id,omitempty"` // 角色ID
+}
+
+type ExternalGrantRoleInfoBuilder struct {
+ roleId string // 角色ID
+ roleIdFlag bool
+}
+
+func NewExternalGrantRoleInfoBuilder() *ExternalGrantRoleInfoBuilder {
+ builder := &ExternalGrantRoleInfoBuilder{}
+ return builder
+}
+
+// 角色ID
+//
+// 示例值:1001
+func (builder *ExternalGrantRoleInfoBuilder) RoleId(roleId string) *ExternalGrantRoleInfoBuilder {
+ builder.roleId = roleId
+ builder.roleIdFlag = true
+ return builder
+}
+
+func (builder *ExternalGrantRoleInfoBuilder) Build() *ExternalGrantRoleInfo {
+ req := &ExternalGrantRoleInfo{}
+ if builder.roleIdFlag {
+ req.RoleId = &builder.roleId
+
+ }
+ return req
+}
+
type ExternalInterview struct {
ExternalId *string `json:"external_id,omitempty"` // 外部系统面试主键 (仅用于幂等)
ExternalApplicationId *string `json:"external_application_id,omitempty"` // 外部投递 ID
@@ -15543,39 +16122,42 @@ func (builder *JobCityBuilder) Build() *JobCity {
}
type JobConfig struct {
- OfferApplySchemaId *string `json:"offer_apply_schema_id,omitempty"` // Offer 申请表,枚举通过接口「获取 Offer 申请表列表」获取
- OfferProcessConf *string `json:"offer_process_conf,omitempty"` // Offer 审批流,枚举通过接口「获取 Offer 审批流列表」获取
- RecommendedEvaluatorIdList []string `json:"recommended_evaluator_id_list,omitempty"` // 建议评估人 ID 列表
- UpdateOptionList []int `json:"update_option_list,omitempty"` // 更新选项,传入要更新的配置项,1=更新面试评价表,2=更新 Offer 申请表,3=更新 Offer 审批流程,4=更新招聘需求,5=更新建议面试官,6=更新推荐评估人
- AssessmentTemplateBizId *string `json:"assessment_template_biz_id,omitempty"` // 面试评价表,枚举通过接口「获取面试评价表列表」获取
- InterviewRoundConfList []*JobConfigInterviewRoundConf `json:"interview_round_conf_list,omitempty"` // 建议面试官列表
- JrIdList []string `json:"jr_id_list,omitempty"` // 关联招聘需求,支持关联多个,枚举通过接口「获取招聘需求」获取
- InterviewRoundTypeConfList []*JobConfigRoundType `json:"interview_round_type_conf_list,omitempty"` // 面试轮次类型 ID 列表
- RelatedJobIdList []string `json:"related_job_id_list,omitempty"` // 关联职位列表,如职位为实体职位则关联虚拟职位id,如职位为虚拟职位则关联实体职位id
- InterviewAppointmentConfig *InterviewAppointmentConfig `json:"interview_appointment_config,omitempty"` // 自助约面配置
+ OfferApplySchemaId *string `json:"offer_apply_schema_id,omitempty"` // Offer 申请表,枚举通过接口「获取 Offer 申请表列表」获取
+ OfferProcessConf *string `json:"offer_process_conf,omitempty"` // Offer 审批流,枚举通过接口「获取 Offer 审批流列表」获取
+ RecommendedEvaluatorIdList []string `json:"recommended_evaluator_id_list,omitempty"` // 建议评估人 ID 列表
+ UpdateOptionList []int `json:"update_option_list,omitempty"` // 更新选项,传入要更新的配置项,1=更新面试评价表,2=更新 Offer 申请表,3=更新 Offer 审批流程,4=更新招聘需求,5=更新建议面试官,6=更新推荐评估人
+ AssessmentTemplateBizId *string `json:"assessment_template_biz_id,omitempty"` // 面试评价表,枚举通过接口「获取面试评价表列表」获取
+ InterviewRoundConfList []*JobConfigInterviewRoundConf `json:"interview_round_conf_list,omitempty"` // 建议面试官列表
+ JrIdList []string `json:"jr_id_list,omitempty"` // 关联招聘需求,支持关联多个,枚举通过接口「获取招聘需求」获取
+ InterviewRegistrationSchemaId *string `json:"interview_registration_schema_id,omitempty"` // 面试登记表 ID, 仅在面试登记表使用设置中开启按职位设置选项后生效
+ InterviewRoundTypeConfList []*JobConfigRoundType `json:"interview_round_type_conf_list,omitempty"` // 面试轮次类型 ID 列表
+ RelatedJobIdList []string `json:"related_job_id_list,omitempty"` // 关联职位列表,如职位为实体职位则关联虚拟职位id,如职位为虚拟职位则关联实体职位id
+ InterviewAppointmentConfig *InterviewAppointmentConfig `json:"interview_appointment_config,omitempty"` // 自助约面配置
}
type JobConfigBuilder struct {
- offerApplySchemaId string // Offer 申请表,枚举通过接口「获取 Offer 申请表列表」获取
- offerApplySchemaIdFlag bool
- offerProcessConf string // Offer 审批流,枚举通过接口「获取 Offer 审批流列表」获取
- offerProcessConfFlag bool
- recommendedEvaluatorIdList []string // 建议评估人 ID 列表
- recommendedEvaluatorIdListFlag bool
- updateOptionList []int // 更新选项,传入要更新的配置项,1=更新面试评价表,2=更新 Offer 申请表,3=更新 Offer 审批流程,4=更新招聘需求,5=更新建议面试官,6=更新推荐评估人
- updateOptionListFlag bool
- assessmentTemplateBizId string // 面试评价表,枚举通过接口「获取面试评价表列表」获取
- assessmentTemplateBizIdFlag bool
- interviewRoundConfList []*JobConfigInterviewRoundConf // 建议面试官列表
- interviewRoundConfListFlag bool
- jrIdList []string // 关联招聘需求,支持关联多个,枚举通过接口「获取招聘需求」获取
- jrIdListFlag bool
- interviewRoundTypeConfList []*JobConfigRoundType // 面试轮次类型 ID 列表
- interviewRoundTypeConfListFlag bool
- relatedJobIdList []string // 关联职位列表,如职位为实体职位则关联虚拟职位id,如职位为虚拟职位则关联实体职位id
- relatedJobIdListFlag bool
- interviewAppointmentConfig *InterviewAppointmentConfig // 自助约面配置
- interviewAppointmentConfigFlag bool
+ offerApplySchemaId string // Offer 申请表,枚举通过接口「获取 Offer 申请表列表」获取
+ offerApplySchemaIdFlag bool
+ offerProcessConf string // Offer 审批流,枚举通过接口「获取 Offer 审批流列表」获取
+ offerProcessConfFlag bool
+ recommendedEvaluatorIdList []string // 建议评估人 ID 列表
+ recommendedEvaluatorIdListFlag bool
+ updateOptionList []int // 更新选项,传入要更新的配置项,1=更新面试评价表,2=更新 Offer 申请表,3=更新 Offer 审批流程,4=更新招聘需求,5=更新建议面试官,6=更新推荐评估人
+ updateOptionListFlag bool
+ assessmentTemplateBizId string // 面试评价表,枚举通过接口「获取面试评价表列表」获取
+ assessmentTemplateBizIdFlag bool
+ interviewRoundConfList []*JobConfigInterviewRoundConf // 建议面试官列表
+ interviewRoundConfListFlag bool
+ jrIdList []string // 关联招聘需求,支持关联多个,枚举通过接口「获取招聘需求」获取
+ jrIdListFlag bool
+ interviewRegistrationSchemaId string // 面试登记表 ID, 仅在面试登记表使用设置中开启按职位设置选项后生效
+ interviewRegistrationSchemaIdFlag bool
+ interviewRoundTypeConfList []*JobConfigRoundType // 面试轮次类型 ID 列表
+ interviewRoundTypeConfListFlag bool
+ relatedJobIdList []string // 关联职位列表,如职位为实体职位则关联虚拟职位id,如职位为虚拟职位则关联实体职位id
+ relatedJobIdListFlag bool
+ interviewAppointmentConfig *InterviewAppointmentConfig // 自助约面配置
+ interviewAppointmentConfigFlag bool
}
func NewJobConfigBuilder() *JobConfigBuilder {
@@ -15646,6 +16228,15 @@ func (builder *JobConfigBuilder) JrIdList(jrIdList []string) *JobConfigBuilder {
return builder
}
+// 面试登记表 ID, 仅在面试登记表使用设置中开启按职位设置选项后生效
+//
+// 示例值:6930815272790114324
+func (builder *JobConfigBuilder) InterviewRegistrationSchemaId(interviewRegistrationSchemaId string) *JobConfigBuilder {
+ builder.interviewRegistrationSchemaId = interviewRegistrationSchemaId
+ builder.interviewRegistrationSchemaIdFlag = true
+ return builder
+}
+
// 面试轮次类型 ID 列表
//
// 示例值:
@@ -15699,6 +16290,10 @@ func (builder *JobConfigBuilder) Build() *JobConfig {
if builder.jrIdListFlag {
req.JrIdList = builder.jrIdList
}
+ if builder.interviewRegistrationSchemaIdFlag {
+ req.InterviewRegistrationSchemaId = &builder.interviewRegistrationSchemaId
+
+ }
if builder.interviewRoundTypeConfListFlag {
req.InterviewRoundTypeConfList = builder.interviewRoundTypeConfList
}
@@ -15806,39 +16401,42 @@ func (builder *JobConfigInterviewRoundConfBuilder) Build() *JobConfigInterviewRo
}
type JobConfigResult struct {
- OfferApplySchema *IdNameObject `json:"offer_apply_schema,omitempty"` // Offer 申请表
- OfferProcessConf *IdNameObject `json:"offer_process_conf,omitempty"` // Offer 审批流
- RecommendedEvaluatorList []*IdNameObject `json:"recommended_evaluator_list,omitempty"` // 建议评估人列表
- AssessmentTemplate *IdNameObject `json:"assessment_template,omitempty"` // 面试评价表
- Id *string `json:"id,omitempty"` // 职位 ID
- InterviewRoundList []*JobConfigInterviewRound `json:"interview_round_list,omitempty"` // 建议面试官列表
- JobRequirementList []*IdNameObject `json:"job_requirement_list,omitempty"` // 招聘需求
- InterviewRoundTypeList []*JobConfigRoundTypeResult `json:"interview_round_type_list,omitempty"` // 面试轮次类型列表
- RelatedJobList []*IdNameObject `json:"related_job_list,omitempty"` // 关联职位列表
- JobAttribute *int `json:"job_attribute,omitempty"` // 职位属性,1是实体职位,2是虚拟职位
+ OfferApplySchema *IdNameObject `json:"offer_apply_schema,omitempty"` // Offer 申请表
+ OfferProcessConf *IdNameObject `json:"offer_process_conf,omitempty"` // Offer 审批流
+ RecommendedEvaluatorList []*IdNameObject `json:"recommended_evaluator_list,omitempty"` // 建议评估人列表
+ AssessmentTemplate *IdNameObject `json:"assessment_template,omitempty"` // 面试评价表
+ Id *string `json:"id,omitempty"` // 职位 ID
+ InterviewRoundList []*JobConfigInterviewRound `json:"interview_round_list,omitempty"` // 建议面试官列表
+ JobRequirementList []*IdNameObject `json:"job_requirement_list,omitempty"` // 招聘需求
+ InterviewRegistrationSchema *RegistrationInfo `json:"interview_registration_schema,omitempty"` // 面试登记表
+ InterviewRoundTypeList []*JobConfigRoundTypeResult `json:"interview_round_type_list,omitempty"` // 面试轮次类型列表
+ RelatedJobList []*IdNameObject `json:"related_job_list,omitempty"` // 关联职位列表
+ JobAttribute *int `json:"job_attribute,omitempty"` // 职位属性,1是实体职位,2是虚拟职位
}
type JobConfigResultBuilder struct {
- offerApplySchema *IdNameObject // Offer 申请表
- offerApplySchemaFlag bool
- offerProcessConf *IdNameObject // Offer 审批流
- offerProcessConfFlag bool
- recommendedEvaluatorList []*IdNameObject // 建议评估人列表
- recommendedEvaluatorListFlag bool
- assessmentTemplate *IdNameObject // 面试评价表
- assessmentTemplateFlag bool
- id string // 职位 ID
- idFlag bool
- interviewRoundList []*JobConfigInterviewRound // 建议面试官列表
- interviewRoundListFlag bool
- jobRequirementList []*IdNameObject // 招聘需求
- jobRequirementListFlag bool
- interviewRoundTypeList []*JobConfigRoundTypeResult // 面试轮次类型列表
- interviewRoundTypeListFlag bool
- relatedJobList []*IdNameObject // 关联职位列表
- relatedJobListFlag bool
- jobAttribute int // 职位属性,1是实体职位,2是虚拟职位
- jobAttributeFlag bool
+ offerApplySchema *IdNameObject // Offer 申请表
+ offerApplySchemaFlag bool
+ offerProcessConf *IdNameObject // Offer 审批流
+ offerProcessConfFlag bool
+ recommendedEvaluatorList []*IdNameObject // 建议评估人列表
+ recommendedEvaluatorListFlag bool
+ assessmentTemplate *IdNameObject // 面试评价表
+ assessmentTemplateFlag bool
+ id string // 职位 ID
+ idFlag bool
+ interviewRoundList []*JobConfigInterviewRound // 建议面试官列表
+ interviewRoundListFlag bool
+ jobRequirementList []*IdNameObject // 招聘需求
+ jobRequirementListFlag bool
+ interviewRegistrationSchema *RegistrationInfo // 面试登记表
+ interviewRegistrationSchemaFlag bool
+ interviewRoundTypeList []*JobConfigRoundTypeResult // 面试轮次类型列表
+ interviewRoundTypeListFlag bool
+ relatedJobList []*IdNameObject // 关联职位列表
+ relatedJobListFlag bool
+ jobAttribute int // 职位属性,1是实体职位,2是虚拟职位
+ jobAttributeFlag bool
}
func NewJobConfigResultBuilder() *JobConfigResultBuilder {
@@ -15909,6 +16507,15 @@ func (builder *JobConfigResultBuilder) JobRequirementList(jobRequirementList []*
return builder
}
+// 面试登记表
+//
+// 示例值:
+func (builder *JobConfigResultBuilder) InterviewRegistrationSchema(interviewRegistrationSchema *RegistrationInfo) *JobConfigResultBuilder {
+ builder.interviewRegistrationSchema = interviewRegistrationSchema
+ builder.interviewRegistrationSchemaFlag = true
+ return builder
+}
+
// 面试轮次类型列表
//
// 示例值:
@@ -15960,6 +16567,9 @@ func (builder *JobConfigResultBuilder) Build() *JobConfigResult {
if builder.jobRequirementListFlag {
req.JobRequirementList = builder.jobRequirementList
}
+ if builder.interviewRegistrationSchemaFlag {
+ req.InterviewRegistrationSchema = builder.interviewRegistrationSchema
+ }
if builder.interviewRoundTypeListFlag {
req.InterviewRoundTypeList = builder.interviewRoundTypeList
}
@@ -17002,72 +17612,75 @@ func (builder *JobRecruitmentTypeBuilder) Build() *JobRecruitmentType {
}
type JobRequirement struct {
- ShortCode *string `json:"short_code,omitempty"` // 招聘需求编号
- Name *string `json:"name,omitempty"` // 需求名称
- DisplayProgress *int `json:"display_progress,omitempty"` // 需求状态
- HeadCount *int `json:"head_count,omitempty"` // 需求人数
- RecruitmentTypeId *string `json:"recruitment_type_id,omitempty"` // 职位性质 ID,可在「招聘枚举常量」文档中查看枚举值
- MaxLevelId *string `json:"max_level_id,omitempty"` // 最高职级 ID
- MinLevelId *string `json:"min_level_id,omitempty"` // 最低职级 ID
- SequenceId *string `json:"sequence_id,omitempty"` // 职位序列 ID
- Category *int `json:"category,omitempty"` // 需求类型
- DepartmentId *string `json:"department_id,omitempty"` // 需求部门的 open department id
- RecruiterIdList []string `json:"recruiter_id_list,omitempty"` // 需求负责人 ID 列表
- DirectLeaderIdList []string `json:"direct_leader_id_list,omitempty"` // 直属上级 ID
- StartTime *string `json:"start_time,omitempty"` // 开始日期,毫秒级时间戳
- Deadline *string `json:"deadline,omitempty"` // 预计完成日期,毫秒级时间戳
- Priority *int `json:"priority,omitempty"` // 招聘优先级
- RequiredDegree *int `json:"required_degree,omitempty"` // 学历要求
- MaxSalary *string `json:"max_salary,omitempty"` // 最高薪资,单位:千
- MinSalary *string `json:"min_salary,omitempty"` // 最低薪资,单位:千
- AddressId *string `json:"address_id,omitempty"` // 工作地点 ID,枚举值可通过「获取地址列表」接口查询获得
- Description *string `json:"description,omitempty"` // 需求描述
- CustomizedDataList []*JobRequirementCustomizedData `json:"customized_data_list,omitempty"` // 自定义字段
+ ShortCode *string `json:"short_code,omitempty"` // 招聘需求编号
+ Name *string `json:"name,omitempty"` // 需求名称
+ DisplayProgress *int `json:"display_progress,omitempty"` // 需求状态
+ HeadCount *int `json:"head_count,omitempty"` // 需求人数
+ RecruitmentTypeId *string `json:"recruitment_type_id,omitempty"` // 职位性质 ID,可在「招聘枚举常量」文档中查看枚举值
+ MaxLevelId *string `json:"max_level_id,omitempty"` // 最高职级 ID
+ MinLevelId *string `json:"min_level_id,omitempty"` // 最低职级 ID
+ SequenceId *string `json:"sequence_id,omitempty"` // 职位序列 ID
+ Category *int `json:"category,omitempty"` // 需求类型
+ DepartmentId *string `json:"department_id,omitempty"` // 需求部门的 open department id
+ RecruiterIdList []string `json:"recruiter_id_list,omitempty"` // 需求负责人 ID 列表
+ JrHiringManagerIdList []string `json:"jr_hiring_manager_id_list,omitempty"` // 需求用人经理 ID 列表
+ DirectLeaderIdList []string `json:"direct_leader_id_list,omitempty"` // 直属上级 ID
+ StartTime *string `json:"start_time,omitempty"` // 开始日期,毫秒级时间戳
+ Deadline *string `json:"deadline,omitempty"` // 预计完成日期,毫秒级时间戳
+ Priority *int `json:"priority,omitempty"` // 招聘优先级
+ RequiredDegree *int `json:"required_degree,omitempty"` // 学历要求
+ MaxSalary *string `json:"max_salary,omitempty"` // 最高薪资,单位:千
+ MinSalary *string `json:"min_salary,omitempty"` // 最低薪资,单位:千
+ AddressId *string `json:"address_id,omitempty"` // 工作地点 ID,枚举值可通过「获取地址列表」接口查询获得
+ Description *string `json:"description,omitempty"` // 需求描述
+ CustomizedDataList []*JobRequirementCustomizedData `json:"customized_data_list,omitempty"` // 自定义字段
}
type JobRequirementBuilder struct {
- shortCode string // 招聘需求编号
- shortCodeFlag bool
- name string // 需求名称
- nameFlag bool
- displayProgress int // 需求状态
- displayProgressFlag bool
- headCount int // 需求人数
- headCountFlag bool
- recruitmentTypeId string // 职位性质 ID,可在「招聘枚举常量」文档中查看枚举值
- recruitmentTypeIdFlag bool
- maxLevelId string // 最高职级 ID
- maxLevelIdFlag bool
- minLevelId string // 最低职级 ID
- minLevelIdFlag bool
- sequenceId string // 职位序列 ID
- sequenceIdFlag bool
- category int // 需求类型
- categoryFlag bool
- departmentId string // 需求部门的 open department id
- departmentIdFlag bool
- recruiterIdList []string // 需求负责人 ID 列表
- recruiterIdListFlag bool
- directLeaderIdList []string // 直属上级 ID
- directLeaderIdListFlag bool
- startTime string // 开始日期,毫秒级时间戳
- startTimeFlag bool
- deadline string // 预计完成日期,毫秒级时间戳
- deadlineFlag bool
- priority int // 招聘优先级
- priorityFlag bool
- requiredDegree int // 学历要求
- requiredDegreeFlag bool
- maxSalary string // 最高薪资,单位:千
- maxSalaryFlag bool
- minSalary string // 最低薪资,单位:千
- minSalaryFlag bool
- addressId string // 工作地点 ID,枚举值可通过「获取地址列表」接口查询获得
- addressIdFlag bool
- description string // 需求描述
- descriptionFlag bool
- customizedDataList []*JobRequirementCustomizedData // 自定义字段
- customizedDataListFlag bool
+ shortCode string // 招聘需求编号
+ shortCodeFlag bool
+ name string // 需求名称
+ nameFlag bool
+ displayProgress int // 需求状态
+ displayProgressFlag bool
+ headCount int // 需求人数
+ headCountFlag bool
+ recruitmentTypeId string // 职位性质 ID,可在「招聘枚举常量」文档中查看枚举值
+ recruitmentTypeIdFlag bool
+ maxLevelId string // 最高职级 ID
+ maxLevelIdFlag bool
+ minLevelId string // 最低职级 ID
+ minLevelIdFlag bool
+ sequenceId string // 职位序列 ID
+ sequenceIdFlag bool
+ category int // 需求类型
+ categoryFlag bool
+ departmentId string // 需求部门的 open department id
+ departmentIdFlag bool
+ recruiterIdList []string // 需求负责人 ID 列表
+ recruiterIdListFlag bool
+ jrHiringManagerIdList []string // 需求用人经理 ID 列表
+ jrHiringManagerIdListFlag bool
+ directLeaderIdList []string // 直属上级 ID
+ directLeaderIdListFlag bool
+ startTime string // 开始日期,毫秒级时间戳
+ startTimeFlag bool
+ deadline string // 预计完成日期,毫秒级时间戳
+ deadlineFlag bool
+ priority int // 招聘优先级
+ priorityFlag bool
+ requiredDegree int // 学历要求
+ requiredDegreeFlag bool
+ maxSalary string // 最高薪资,单位:千
+ maxSalaryFlag bool
+ minSalary string // 最低薪资,单位:千
+ minSalaryFlag bool
+ addressId string // 工作地点 ID,枚举值可通过「获取地址列表」接口查询获得
+ addressIdFlag bool
+ description string // 需求描述
+ descriptionFlag bool
+ customizedDataList []*JobRequirementCustomizedData // 自定义字段
+ customizedDataListFlag bool
}
func NewJobRequirementBuilder() *JobRequirementBuilder {
@@ -17174,6 +17787,15 @@ func (builder *JobRequirementBuilder) RecruiterIdList(recruiterIdList []string)
return builder
}
+// 需求用人经理 ID 列表
+//
+// 示例值:
+func (builder *JobRequirementBuilder) JrHiringManagerIdList(jrHiringManagerIdList []string) *JobRequirementBuilder {
+ builder.jrHiringManagerIdList = jrHiringManagerIdList
+ builder.jrHiringManagerIdListFlag = true
+ return builder
+}
+
// 直属上级 ID
//
// 示例值:ou_7dab8a3d3cdcc9da365777c7ad535d62
@@ -17309,6 +17931,9 @@ func (builder *JobRequirementBuilder) Build() *JobRequirement {
if builder.recruiterIdListFlag {
req.RecruiterIdList = builder.recruiterIdList
}
+ if builder.jrHiringManagerIdListFlag {
+ req.JrHiringManagerIdList = builder.jrHiringManagerIdList
+ }
if builder.directLeaderIdListFlag {
req.DirectLeaderIdList = builder.directLeaderIdList
}
@@ -17693,6 +18318,7 @@ type JobRequirementDto struct {
Category *int `json:"category,omitempty"` // 需求类型
Department *IdNameObject `json:"department,omitempty"` // 需求部门
RecruiterList []*IdNameObject `json:"recruiter_list,omitempty"` // 需求负责人
+ JrHiringManagers []*IdNameObject `json:"jr_hiring_managers,omitempty"` // 需求用人经理
DirectLeaderList []*IdNameObject `json:"direct_leader_list,omitempty"` // 直属上级
StartTime *string `json:"start_time,omitempty"` // 开始日期,毫秒级时间戳
Deadline *string `json:"deadline,omitempty"` // 预计完成日期,毫秒级时间戳
@@ -17731,6 +18357,8 @@ type JobRequirementDtoBuilder struct {
departmentFlag bool
recruiterList []*IdNameObject // 需求负责人
recruiterListFlag bool
+ jrHiringManagers []*IdNameObject // 需求用人经理
+ jrHiringManagersFlag bool
directLeaderList []*IdNameObject // 直属上级
directLeaderListFlag bool
startTime string // 开始日期,毫秒级时间戳
@@ -17868,6 +18496,15 @@ func (builder *JobRequirementDtoBuilder) RecruiterList(recruiterList []*IdNameOb
return builder
}
+// 需求用人经理
+//
+// 示例值:
+func (builder *JobRequirementDtoBuilder) JrHiringManagers(jrHiringManagers []*IdNameObject) *JobRequirementDtoBuilder {
+ builder.jrHiringManagers = jrHiringManagers
+ builder.jrHiringManagersFlag = true
+ return builder
+}
+
// 直属上级
//
// 示例值:
@@ -18011,6 +18648,9 @@ func (builder *JobRequirementDtoBuilder) Build() *JobRequirementDto {
if builder.recruiterListFlag {
req.RecruiterList = builder.recruiterList
}
+ if builder.jrHiringManagersFlag {
+ req.JrHiringManagers = builder.jrHiringManagers
+ }
if builder.directLeaderListFlag {
req.DirectLeaderList = builder.directLeaderList
}
@@ -18829,6 +19469,115 @@ func (builder *NoteBuilder) Build() *Note {
return req
}
+type ObjectAttribute struct {
+ Title *I18n `json:"title,omitempty"` // 字段名称
+ Description *I18n `json:"description,omitempty"` // 字段描述
+ DataType *int `json:"data_type,omitempty"` // 字段类型
+ Tags []int `json:"tags,omitempty"` // 字段标签
+ IsFcfData *bool `json:"is_fcf_data,omitempty"` // 是否为居民数据
+ IsDiData *bool `json:"is_di_data,omitempty"` // 是否为多元化数据
+}
+
+type ObjectAttributeBuilder struct {
+ title *I18n // 字段名称
+ titleFlag bool
+ description *I18n // 字段描述
+ descriptionFlag bool
+ dataType int // 字段类型
+ dataTypeFlag bool
+ tags []int // 字段标签
+ tagsFlag bool
+ isFcfData bool // 是否为居民数据
+ isFcfDataFlag bool
+ isDiData bool // 是否为多元化数据
+ isDiDataFlag bool
+}
+
+func NewObjectAttributeBuilder() *ObjectAttributeBuilder {
+ builder := &ObjectAttributeBuilder{}
+ return builder
+}
+
+// 字段名称
+//
+// 示例值:
+func (builder *ObjectAttributeBuilder) Title(title *I18n) *ObjectAttributeBuilder {
+ builder.title = title
+ builder.titleFlag = true
+ return builder
+}
+
+// 字段描述
+//
+// 示例值:
+func (builder *ObjectAttributeBuilder) Description(description *I18n) *ObjectAttributeBuilder {
+ builder.description = description
+ builder.descriptionFlag = true
+ return builder
+}
+
+// 字段类型
+//
+// 示例值:1
+func (builder *ObjectAttributeBuilder) DataType(dataType int) *ObjectAttributeBuilder {
+ builder.dataType = dataType
+ builder.dataTypeFlag = true
+ return builder
+}
+
+// 字段标签
+//
+// 示例值:1
+func (builder *ObjectAttributeBuilder) Tags(tags []int) *ObjectAttributeBuilder {
+ builder.tags = tags
+ builder.tagsFlag = true
+ return builder
+}
+
+// 是否为居民数据
+//
+// 示例值:true
+func (builder *ObjectAttributeBuilder) IsFcfData(isFcfData bool) *ObjectAttributeBuilder {
+ builder.isFcfData = isFcfData
+ builder.isFcfDataFlag = true
+ return builder
+}
+
+// 是否为多元化数据
+//
+// 示例值:true
+func (builder *ObjectAttributeBuilder) IsDiData(isDiData bool) *ObjectAttributeBuilder {
+ builder.isDiData = isDiData
+ builder.isDiDataFlag = true
+ return builder
+}
+
+func (builder *ObjectAttributeBuilder) Build() *ObjectAttribute {
+ req := &ObjectAttribute{}
+ if builder.titleFlag {
+ req.Title = builder.title
+ }
+ if builder.descriptionFlag {
+ req.Description = builder.description
+ }
+ if builder.dataTypeFlag {
+ req.DataType = &builder.dataType
+
+ }
+ if builder.tagsFlag {
+ req.Tags = builder.tags
+ }
+ if builder.isFcfDataFlag {
+ req.IsFcfData = &builder.isFcfData
+
+ }
+ if builder.isDiDataFlag {
+ req.IsDiData = &builder.isDiData
+
+ }
+ return req
+}
+
type Offer struct {
Id *string `json:"id,omitempty"` // Offer ID
ApplicationId *string `json:"application_id,omitempty"` // 投递 ID
@@ -22217,6 +22966,54 @@ func (builder *ReferralBuilder) Build() *Referral {
return req
}
+type RegistrationInfo struct {
+ Id *string `json:"id,omitempty"` // 面试登记表ID
+ Name *string `json:"name,omitempty"` // 面试登记表名称
+}
+
+type RegistrationInfoBuilder struct {
+ id string // 面试登记表ID
+ idFlag bool
+ name string // 面试登记表名称
+ nameFlag bool
+}
+
+func NewRegistrationInfoBuilder() *RegistrationInfoBuilder {
+ builder := &RegistrationInfoBuilder{}
+ return builder
+}
+
+// 面试登记表ID
+//
+// 示例值:6930815272790114324
+func (builder *RegistrationInfoBuilder) Id(id string) *RegistrationInfoBuilder {
+ builder.id = id
+ builder.idFlag = true
+ return builder
+}
+
+// 面试登记表名称
+//
+// 示例值:默认登记表
+func (builder *RegistrationInfoBuilder) Name(name string) *RegistrationInfoBuilder {
+ builder.name = name
+ builder.nameFlag = true
+ return builder
+}
+
+func (builder *RegistrationInfoBuilder) Build() *RegistrationInfo {
+ req := &RegistrationInfo{}
+ if builder.idFlag {
+ req.Id = &builder.id
+
+ }
+ if builder.nameFlag {
+ req.Name = &builder.name
+
+ }
+ return req
+}
+
type ResumeSource struct {
Id *string `json:"id,omitempty"` // 来源 ID
ZhName *string `json:"zh_name,omitempty"` // 中文名
@@ -24544,6 +25341,7 @@ type Talent struct {
ResumeAttachmentIdList []string `json:"resume_attachment_id_list,omitempty"` // 简历附件id列表(按照简历创建时间降序)
CustomizedDataList []*TalentCustomizedData `json:"customized_data_list,omitempty"` // 自定义模块
TopDegree *int `json:"top_degree,omitempty"` // 最高学历
+ FirstDegree *int `json:"first_degree,omitempty"` // 第一学历
}
type TalentBuilder struct {
@@ -24579,6 +25377,8 @@ type TalentBuilder struct {
customizedDataListFlag bool
topDegree int // 最高学历
topDegreeFlag bool
+ firstDegree int // 第一学历
+ firstDegreeFlag bool
}
func NewTalentBuilder() *TalentBuilder {
@@ -24730,6 +25530,15 @@ func (builder *TalentBuilder) TopDegree(topDegree int) *TalentBuilder {
return builder
}
+// 第一学历
+//
+// 示例值:3
+func (builder *TalentBuilder) FirstDegree(firstDegree int) *TalentBuilder {
+ builder.firstDegree = firstDegree
+ builder.firstDegreeFlag = true
+ return builder
+}
+
func (builder *TalentBuilder) Build() *Talent {
req := &Talent{}
if builder.idFlag {
@@ -24783,6 +25592,10 @@ func (builder *TalentBuilder) Build() *Talent {
if builder.topDegreeFlag {
req.TopDegree = &builder.topDegree
+ }
+ if builder.firstDegreeFlag {
+ req.FirstDegree = &builder.firstDegree
+
}
return req
}
@@ -27863,6 +28676,7 @@ func (builder *TalentInterviewBuilder) Build() *TalentInterview {
type TalentInterviewRegistrationSimple struct {
Id *string `json:"id,omitempty"` // ID
RegistrationTime *int `json:"registration_time,omitempty"` // 创建时间
+ DownloadUrl *string `json:"download_url,omitempty"` // 下载链接
}
type TalentInterviewRegistrationSimpleBuilder struct {
@@ -27870,6 +28684,8 @@ type TalentInterviewRegistrationSimpleBuilder struct {
idFlag bool
registrationTime int // 创建时间
registrationTimeFlag bool
+ downloadUrl string // 下载链接
+ downloadUrlFlag bool
}
func NewTalentInterviewRegistrationSimpleBuilder() *TalentInterviewRegistrationSimpleBuilder {
@@ -27895,6 +28711,15 @@ func (builder *TalentInterviewRegistrationSimpleBuilder) RegistrationTime(regist
return builder
}
+// 下载链接
+//
+// 示例值:https://hire.feishu.cn/hire/file/blob/...token.../
+func (builder *TalentInterviewRegistrationSimpleBuilder) DownloadUrl(downloadUrl string) *TalentInterviewRegistrationSimpleBuilder {
+ builder.downloadUrl = downloadUrl
+ builder.downloadUrlFlag = true
+ return builder
+}
+
func (builder *TalentInterviewRegistrationSimpleBuilder) Build() *TalentInterviewRegistrationSimple {
req := &TalentInterviewRegistrationSimple{}
if builder.idFlag {
@@ -27904,6 +28729,10 @@ func (builder *TalentInterviewRegistrationSimpleBuilder) Build() *TalentIntervie
if builder.registrationTimeFlag {
req.RegistrationTime = &builder.registrationTime
+ }
+ if builder.downloadUrlFlag {
+ req.DownloadUrl = &builder.downloadUrl
+
}
return req
}
@@ -28162,6 +28991,132 @@ func (builder *TalentOperationLogBuilder) Build() *TalentOperationLog {
return req
}
+type TalentPool struct {
+ Id *string `json:"id,omitempty"` // 人才库ID
+ I18nName *I18n `json:"i18n_name,omitempty"` // 人才库名称
+ I18nDescription *I18n `json:"i18n_description,omitempty"` // 人才库描述
+ ParentId *string `json:"parent_id,omitempty"` // 父级人才库ID
+ IsPrivate *int `json:"is_private,omitempty"` // 是否「仅部分用户可见」
+ CreateTime *string `json:"create_time,omitempty"` // 创建时间,毫秒时间戳
+ ModifyTime *string `json:"modify_time,omitempty"` // 修改时间,毫秒时间戳
+}
+
+type TalentPoolBuilder struct {
+ id string // 人才库ID
+ idFlag bool
+ i18nName *I18n // 人才库名称
+ i18nNameFlag bool
+ i18nDescription *I18n // 人才库描述
+ i18nDescriptionFlag bool
+ parentId string // 父级人才库ID
+ parentIdFlag bool
+ isPrivate int // 是否「仅部分用户可见」
+ isPrivateFlag bool
+ createTime string // 创建时间,毫秒时间戳
+ createTimeFlag bool
+ modifyTime string // 修改时间,毫秒时间戳
+ modifyTimeFlag bool
+}
+
+func NewTalentPoolBuilder() *TalentPoolBuilder {
+ builder := &TalentPoolBuilder{}
+ return builder
+}
+
+// 人才库ID
+//
+// 示例值:6930815272790114324
+func (builder *TalentPoolBuilder) Id(id string) *TalentPoolBuilder {
+ builder.id = id
+ builder.idFlag = true
+ return builder
+}
+
+// 人才库名称
+//
+// 示例值:
+func (builder *TalentPoolBuilder) I18nName(i18nName *I18n) *TalentPoolBuilder {
+ builder.i18nName = i18nName
+ builder.i18nNameFlag = true
+ return builder
+}
+
+// 人才库描述
+//
+// 示例值:
+func (builder *TalentPoolBuilder) I18nDescription(i18nDescription *I18n) *TalentPoolBuilder {
+ builder.i18nDescription = i18nDescription
+ builder.i18nDescriptionFlag = true
+ return builder
+}
+
+// 父级人才库ID
+//
+// 示例值:6930815272790114324
+func (builder *TalentPoolBuilder) ParentId(parentId string) *TalentPoolBuilder {
+ builder.parentId = parentId
+ builder.parentIdFlag = true
+ return builder
+}
+
+// 是否「仅部分用户可见」
+//
+// 示例值:1
+func (builder *TalentPoolBuilder) IsPrivate(isPrivate int) *TalentPoolBuilder {
+ builder.isPrivate = isPrivate
+ builder.isPrivateFlag = true
+ return builder
+}
+
+// 创建时间,毫秒时间戳
+//
+// 示例值:1679300424000
+func (builder *TalentPoolBuilder) CreateTime(createTime string) *TalentPoolBuilder {
+ builder.createTime = createTime
+ builder.createTimeFlag = true
+ return builder
+}
+
+// 修改时间,毫秒时间戳
+//
+// 示例值:1679300424000
+func (builder *TalentPoolBuilder) ModifyTime(modifyTime string) *TalentPoolBuilder {
+ builder.modifyTime = modifyTime
+ builder.modifyTimeFlag = true
+ return builder
+}
+
+func (builder *TalentPoolBuilder) Build() *TalentPool {
+ req := &TalentPool{}
+ if builder.idFlag {
+ req.Id = &builder.id
+
+ }
+ if builder.i18nNameFlag {
+ req.I18nName = builder.i18nName
+ }
+ if builder.i18nDescriptionFlag {
+ req.I18nDescription = builder.i18nDescription
+ }
+ if builder.parentIdFlag {
+ req.ParentId = &builder.parentId
+
+ }
+ if builder.isPrivateFlag {
+ req.IsPrivate = &builder.isPrivate
+
+ }
+ if builder.createTimeFlag {
+ req.CreateTime = &builder.createTime
+
+ }
+ if builder.modifyTimeFlag {
+ req.ModifyTime = &builder.modifyTime
+
+ }
+ return req
+}
+
type TalentProjectInfo struct {
Id *string `json:"id,omitempty"` // ID
Name *string `json:"name,omitempty"` // 项目名称
@@ -29521,6 +30476,70 @@ func (builder *TodoCommonBuilder) Build() *TodoCommon {
return req
}
+type UserId struct {
+ UserId *string `json:"user_id,omitempty"` //
+ OpenId *string `json:"open_id,omitempty"` //
+ UnionId *string `json:"union_id,omitempty"` //
+}
+
+type UserIdBuilder struct {
+ userId string //
+ userIdFlag bool
+ openId string //
+ openIdFlag bool
+ unionId string //
+ unionIdFlag bool
+}
+
+func NewUserIdBuilder() *UserIdBuilder {
+ builder := &UserIdBuilder{}
+ return builder
+}
+
+//
+//
+// 示例值:
+func (builder *UserIdBuilder) UserId(userId string) *UserIdBuilder {
+ builder.userId = userId
+ builder.userIdFlag = true
+ return builder
+}
+
+//
+//
+// 示例值:
+func (builder *UserIdBuilder) OpenId(openId string) *UserIdBuilder {
+ builder.openId = openId
+ builder.openIdFlag = true
+ return builder
+}
+
+//
+//
+// 示例值:
+func (builder *UserIdBuilder) UnionId(unionId string) *UserIdBuilder {
+ builder.unionId = unionId
+ builder.unionIdFlag = true
+ return builder
+}
+
+func (builder *UserIdBuilder) Build() *UserId {
+ req := &UserId{}
+ if builder.userIdFlag {
+ req.UserId = &builder.userId
+
+ }
+ if builder.openIdFlag {
+ req.OpenId = &builder.openId
+
+ }
+ if builder.unionIdFlag {
+ req.UnionId = &builder.unionId
+
+ }
+ return req
+}
+
type UserRole struct {
UserId *string `json:"user_id,omitempty"` // 用户 ID
RoleId *string `json:"role_id,omitempty"` // 角色 ID
@@ -34038,7 +35057,7 @@ func (builder *PatchEmployeeReqBuilder) UserIdType(userIdType string) *PatchEmpl
// 此次调用中使用的部门 ID 的类型
//
-// 示例值:
+// 示例值:department_id
func (builder *PatchEmployeeReqBuilder) DepartmentIdType(departmentIdType string) *PatchEmployeeReqBuilder {
builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
return builder
@@ -34078,6 +35097,494 @@ func (resp *PatchEmployeeResp) Success() bool {
return resp.Code == 0
}
+type ListEvaluationReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ limit int // 最大返回多少记录,当使用迭代器访问时才有效
+}
+
+func NewListEvaluationReqBuilder() *ListEvaluationReqBuilder {
+ builder := &ListEvaluationReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 最大返回多少记录,当使用迭代器访问时才有效
+func (builder *ListEvaluationReqBuilder) Limit(limit int) *ListEvaluationReqBuilder {
+ builder.limit = limit
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:eyJvZmZzZXQiOjEsInRpbWVzdGFtcCI6MTY0MDc2NTYzMjA4OCwiaWQiOm51bGx9
+func (builder *ListEvaluationReqBuilder) PageToken(pageToken string) *ListEvaluationReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListEvaluationReqBuilder) PageSize(pageSize int) *ListEvaluationReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 投递 ID
+//
+// 示例值:6875569957036738823
+func (builder *ListEvaluationReqBuilder) ApplicationId(applicationId string) *ListEvaluationReqBuilder {
+ builder.apiReq.QueryParams.Set("application_id", fmt.Sprint(applicationId))
+ return builder
+}
+
+// 最早更新时间,毫秒级时间戳
+//
+// 示例值:1600843767338
+func (builder *ListEvaluationReqBuilder) UpdateStartTime(updateStartTime string) *ListEvaluationReqBuilder {
+ builder.apiReq.QueryParams.Set("update_start_time", fmt.Sprint(updateStartTime))
+ return builder
+}
+
+// 最晚更新时间,毫秒级时间戳
+//
+// 示例值:1600843938726
+func (builder *ListEvaluationReqBuilder) UpdateEndTime(updateEndTime string) *ListEvaluationReqBuilder {
+ builder.apiReq.QueryParams.Set("update_end_time", fmt.Sprint(updateEndTime))
+ return builder
+}
+
+// 用户ID类型
+//
+// 示例值:open_id
+func (builder *ListEvaluationReqBuilder) UserIdType(userIdType string) *ListEvaluationReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+func (builder *ListEvaluationReqBuilder) Build() *ListEvaluationReq {
+ req := &ListEvaluationReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.Limit = builder.limit
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListEvaluationReq struct {
+ apiReq *larkcore.ApiReq
+ Limit int // 最多返回多少记录,只有在使用迭代器访问时,才有效
+
+}
+
+type ListEvaluationRespData struct {
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+ Items []*Evaluation `json:"items,omitempty"` // 简历评估信息列表
+}
+
+type ListEvaluationResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListEvaluationRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListEvaluationResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateExternalApplicationReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ externalApplication *ExternalApplication
+}
+
+func NewCreateExternalApplicationReqBuilder() *CreateExternalApplicationReqBuilder {
+ builder := &CreateExternalApplicationReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 导入来自其他系统的投递信息,创建为外部投递
+func (builder *CreateExternalApplicationReqBuilder) ExternalApplication(externalApplication *ExternalApplication) *CreateExternalApplicationReqBuilder {
+ builder.externalApplication = externalApplication
+ return builder
+}
+
+func (builder *CreateExternalApplicationReqBuilder) Build() *CreateExternalApplicationReq {
+ req := &CreateExternalApplicationReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.Body = builder.externalApplication
+ return req
+}
+
+type CreateExternalApplicationReq struct {
+ apiReq *larkcore.ApiReq
+ ExternalApplication *ExternalApplication `body:""`
+}
+
+type CreateExternalApplicationRespData struct {
+ ExternalApplication *ExternalApplication `json:"external_application,omitempty"` // 外部投递信息
+}
+
+type CreateExternalApplicationResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateExternalApplicationRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateExternalApplicationResp) Success() bool {
+ return resp.Code == 0
+}
+
+type DeleteExternalApplicationReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewDeleteExternalApplicationReqBuilder() *DeleteExternalApplicationReqBuilder {
+ builder := &DeleteExternalApplicationReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 外部投递 id
+//
+// 示例值:6960663240925956660
+func (builder *DeleteExternalApplicationReqBuilder) ExternalApplicationId(externalApplicationId string) *DeleteExternalApplicationReqBuilder {
+ builder.apiReq.PathParams.Set("external_application_id", fmt.Sprint(externalApplicationId))
+ return builder
+}
+
+// 人才ID
+//
+// 示例值:6960663240925956660
+func (builder *DeleteExternalApplicationReqBuilder) TalentId(talentId string) *DeleteExternalApplicationReqBuilder {
+ builder.apiReq.QueryParams.Set("talent_id", fmt.Sprint(talentId))
+ return builder
+}
+
+func (builder *DeleteExternalApplicationReqBuilder) Build() *DeleteExternalApplicationReq {
+ req := &DeleteExternalApplicationReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type DeleteExternalApplicationReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type DeleteExternalApplicationRespData struct {
+ ExternalApplication *ExternalApplication `json:"external_application,omitempty"` //
+}
+
+type DeleteExternalApplicationResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *DeleteExternalApplicationRespData `json:"data"` // 业务数据
+}
+
+func (resp *DeleteExternalApplicationResp) Success() bool {
+ return resp.Code == 0
+}
+
+type UpdateExternalApplicationReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ externalApplication *ExternalApplication
+}
+
+func NewUpdateExternalApplicationReqBuilder() *UpdateExternalApplicationReqBuilder {
+ builder := &UpdateExternalApplicationReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 外部投递 id
+//
+// 示例值:6960663240925956660
+func (builder *UpdateExternalApplicationReqBuilder) ExternalApplicationId(externalApplicationId string) *UpdateExternalApplicationReqBuilder {
+ builder.apiReq.PathParams.Set("external_application_id", fmt.Sprint(externalApplicationId))
+ return builder
+}
+
+// 更新外部投递
+func (builder *UpdateExternalApplicationReqBuilder) ExternalApplication(externalApplication *ExternalApplication) *UpdateExternalApplicationReqBuilder {
+ builder.externalApplication = externalApplication
+ return builder
+}
+
+func (builder *UpdateExternalApplicationReqBuilder) Build() *UpdateExternalApplicationReq {
+ req := &UpdateExternalApplicationReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.Body = builder.externalApplication
+ return req
+}
+
+type UpdateExternalApplicationReq struct {
+ apiReq *larkcore.ApiReq
+ ExternalApplication *ExternalApplication `body:""`
+}
+
+type UpdateExternalApplicationRespData struct {
+ ExternalApplication *ExternalApplication `json:"external_application,omitempty"` //
+}
+
+type UpdateExternalApplicationResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *UpdateExternalApplicationRespData `json:"data"` // 业务数据
+}
+
+func (resp *UpdateExternalApplicationResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateExternalBackgroundCheckReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ externalBackgroundCheck *ExternalBackgroundCheck
+}
+
+func NewCreateExternalBackgroundCheckReqBuilder() *CreateExternalBackgroundCheckReqBuilder {
+ builder := &CreateExternalBackgroundCheckReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 导入来自其他系统的背调信息,创建为外部背调
+func (builder *CreateExternalBackgroundCheckReqBuilder) ExternalBackgroundCheck(externalBackgroundCheck *ExternalBackgroundCheck) *CreateExternalBackgroundCheckReqBuilder {
+ builder.externalBackgroundCheck = externalBackgroundCheck
+ return builder
+}
+
+func (builder *CreateExternalBackgroundCheckReqBuilder) Build() *CreateExternalBackgroundCheckReq {
+ req := &CreateExternalBackgroundCheckReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.Body = builder.externalBackgroundCheck
+ return req
+}
+
+type CreateExternalBackgroundCheckReq struct {
+ apiReq *larkcore.ApiReq
+ ExternalBackgroundCheck *ExternalBackgroundCheck `body:""`
+}
+
+type CreateExternalBackgroundCheckRespData struct {
+ ExternalBackgroundCheck *ExternalBackgroundCheck `json:"external_background_check,omitempty"` // 外部背调信息
+}
+
+type CreateExternalBackgroundCheckResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateExternalBackgroundCheckRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateExternalBackgroundCheckResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateExternalInterviewReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ externalInterview *ExternalInterview
+}
+
+func NewCreateExternalInterviewReqBuilder() *CreateExternalInterviewReqBuilder {
+ builder := &CreateExternalInterviewReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 导入来自其他系统的面试信息,创建为外部面试
+func (builder *CreateExternalInterviewReqBuilder) ExternalInterview(externalInterview *ExternalInterview) *CreateExternalInterviewReqBuilder {
+ builder.externalInterview = externalInterview
+ return builder
+}
+
+func (builder *CreateExternalInterviewReqBuilder) Build() *CreateExternalInterviewReq {
+ req := &CreateExternalInterviewReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.Body = builder.externalInterview
+ return req
+}
+
+type CreateExternalInterviewReq struct {
+ apiReq *larkcore.ApiReq
+ ExternalInterview *ExternalInterview `body:""`
+}
+
+type CreateExternalInterviewRespData struct {
+ ExternalInterview *ExternalInterview `json:"external_interview,omitempty"` // 外部面试信息
+}
+
+type CreateExternalInterviewResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateExternalInterviewRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateExternalInterviewResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateExternalInterviewAssessmentReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ externalInterviewAssessment *ExternalInterviewAssessment
+}
+
+func NewCreateExternalInterviewAssessmentReqBuilder() *CreateExternalInterviewAssessmentReqBuilder {
+ builder := &CreateExternalInterviewAssessmentReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 导入来自其他系统的面评信息,创建为外部面评
+func (builder *CreateExternalInterviewAssessmentReqBuilder) ExternalInterviewAssessment(externalInterviewAssessment *ExternalInterviewAssessment) *CreateExternalInterviewAssessmentReqBuilder {
+ builder.externalInterviewAssessment = externalInterviewAssessment
+ return builder
+}
+
+func (builder *CreateExternalInterviewAssessmentReqBuilder) Build() *CreateExternalInterviewAssessmentReq {
+ req := &CreateExternalInterviewAssessmentReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.Body = builder.externalInterviewAssessment
+ return req
+}
+
+type CreateExternalInterviewAssessmentReq struct {
+ apiReq *larkcore.ApiReq
+ ExternalInterviewAssessment *ExternalInterviewAssessment `body:""`
+}
+
+type CreateExternalInterviewAssessmentRespData struct {
+ ExternalInterviewAssessment *ExternalInterviewAssessment `json:"external_interview_assessment,omitempty"` // 外部面评信息
+}
+
+type CreateExternalInterviewAssessmentResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateExternalInterviewAssessmentRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateExternalInterviewAssessmentResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListInterviewReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListInterviewReqBuilder() *ListInterviewReqBuilder {
+ builder := &ListInterviewReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 分页大小,不能超过 100
+//
+// 示例值:10
+func (builder *ListInterviewReqBuilder) PageSize(pageSize int) *ListInterviewReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 查询游标, 由上一页结果返回, 第一页不传
+//
+// 示例值:xx
+func (builder *ListInterviewReqBuilder) PageToken(pageToken string) *ListInterviewReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 投递 ID
+//
+// 示例值:6134134355464633
+func (builder *ListInterviewReqBuilder) ApplicationId(applicationId string) *ListInterviewReqBuilder {
+ builder.apiReq.QueryParams.Set("application_id", fmt.Sprint(applicationId))
+ return builder
+}
+
+// 面试 ID
+//
+// 示例值:6888217964693309704
+func (builder *ListInterviewReqBuilder) InterviewId(interviewId string) *ListInterviewReqBuilder {
+ builder.apiReq.QueryParams.Set("interview_id", fmt.Sprint(interviewId))
+ return builder
+}
+
+// 最早开始时间,格式为时间戳
+//
+// 示例值:1609489908000
+func (builder *ListInterviewReqBuilder) StartTime(startTime string) *ListInterviewReqBuilder {
+ builder.apiReq.QueryParams.Set("start_time", fmt.Sprint(startTime))
+ return builder
+}
+
+// 最晚开始时间,格式为时间戳
+//
+// 示例值:1610489908000
+func (builder *ListInterviewReqBuilder) EndTime(endTime string) *ListInterviewReqBuilder {
+ builder.apiReq.QueryParams.Set("end_time", fmt.Sprint(endTime))
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:
+func (builder *ListInterviewReqBuilder) UserIdType(userIdType string) *ListInterviewReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+func (builder *ListInterviewReqBuilder) Build() *ListInterviewReq {
+ req := &ListInterviewReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListInterviewReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListInterviewRespData struct {
+ Items []*InterviewExtend `json:"items,omitempty"` // 面试列表
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type ListInterviewResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListInterviewRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListInterviewResp) Success() bool {
+ return resp.Code == 0
+}
+
type CombinedCreateJobReqBuilder struct {
apiReq *larkcore.ApiReq
combinedJob *CombinedJob
@@ -34128,9 +35635,10 @@ type CombinedCreateJobReq struct {
}
type CombinedCreateJobRespData struct {
- DefaultJobPost *CombinedJobResultDefaultJobPost `json:"default_job_post,omitempty"` // 职位广告
- Job *Job `json:"job,omitempty"` // 职位
- JobManager *JobManager `json:"job_manager,omitempty"` // 职位负责人
+ DefaultJobPost *CombinedJobResultDefaultJobPost `json:"default_job_post,omitempty"` // 职位广告
+ Job *Job `json:"job,omitempty"` // 职位
+ JobManager *JobManager `json:"job_manager,omitempty"` // 职位负责人
+ InterviewRegistrationSchemaInfo *RegistrationInfo `json:"interview_registration_schema_info,omitempty"` // 面试登记表
}
type CombinedCreateJobResp struct {
@@ -34202,9 +35710,10 @@ type CombinedUpdateJobReq struct {
}
type CombinedUpdateJobRespData struct {
- DefaultJobPost *CombinedJobResultDefaultJobPost `json:"default_job_post,omitempty"` // 职位广告
- Job *Job `json:"job,omitempty"` // 职位
- JobManager *JobManager `json:"job_manager,omitempty"` // 职位负责人
+ DefaultJobPost *CombinedJobResultDefaultJobPost `json:"default_job_post,omitempty"` // 职位广告
+ Job *Job `json:"job,omitempty"` // 职位
+ JobManager *JobManager `json:"job_manager,omitempty"` // 职位负责人
+ InterviewRegistrationSchemaInfo *RegistrationInfo `json:"interview_registration_schema_info,omitempty"` // 面试登记表
}
type CombinedUpdateJobResp struct {
@@ -34518,13 +36027,13 @@ func (resp *ListJobProcessResp) Success() bool {
return resp.Code == 0
}
-type CreateNoteReqBuilder struct {
- apiReq *larkcore.ApiReq
- note *Note
+type CreateJobRequirementReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ jobRequirement *JobRequirement
}
-func NewCreateNoteReqBuilder() *CreateNoteReqBuilder {
- builder := &CreateNoteReqBuilder{}
+func NewCreateJobRequirementReqBuilder() *CreateJobRequirementReqBuilder {
+ builder := &CreateJobRequirementReqBuilder{}
builder.apiReq = &larkcore.ApiReq{
PathParams: larkcore.PathParams{},
QueryParams: larkcore.QueryParams{},
@@ -34535,50 +36044,58 @@ func NewCreateNoteReqBuilder() *CreateNoteReqBuilder {
// 此次调用中使用的用户ID的类型
//
// 示例值:
-func (builder *CreateNoteReqBuilder) UserIdType(userIdType string) *CreateNoteReqBuilder {
+func (builder *CreateJobRequirementReqBuilder) UserIdType(userIdType string) *CreateJobRequirementReqBuilder {
builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
return builder
}
-// 创建备注信息
-func (builder *CreateNoteReqBuilder) Note(note *Note) *CreateNoteReqBuilder {
- builder.note = note
+// 此次调用中使用的部门 ID 的类型
+//
+// 示例值:open_department_id
+func (builder *CreateJobRequirementReqBuilder) DepartmentIdType(departmentIdType string) *CreateJobRequirementReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
return builder
}
-func (builder *CreateNoteReqBuilder) Build() *CreateNoteReq {
- req := &CreateNoteReq{}
+// 创建招聘需求,除招聘需求编号为必填外,其他字段是否必填与飞书招聘「招聘需求字段管理」内设置一致
+func (builder *CreateJobRequirementReqBuilder) JobRequirement(jobRequirement *JobRequirement) *CreateJobRequirementReqBuilder {
+ builder.jobRequirement = jobRequirement
+ return builder
+}
+
+func (builder *CreateJobRequirementReqBuilder) Build() *CreateJobRequirementReq {
+ req := &CreateJobRequirementReq{}
req.apiReq = &larkcore.ApiReq{}
req.apiReq.QueryParams = builder.apiReq.QueryParams
- req.apiReq.Body = builder.note
+ req.apiReq.Body = builder.jobRequirement
return req
}
-type CreateNoteReq struct {
- apiReq *larkcore.ApiReq
- Note *Note `body:""`
+type CreateJobRequirementReq struct {
+ apiReq *larkcore.ApiReq
+ JobRequirement *JobRequirement `body:""`
}
-type CreateNoteRespData struct {
- Note *Note `json:"note,omitempty"` // 备注信息
+type CreateJobRequirementRespData struct {
+ JobRequirement *JobRequirementDto `json:"job_requirement,omitempty"` // 招聘需求信息
}
-type CreateNoteResp struct {
+type CreateJobRequirementResp struct {
*larkcore.ApiResp `json:"-"`
larkcore.CodeError
- Data *CreateNoteRespData `json:"data"` // 业务数据
+ Data *CreateJobRequirementRespData `json:"data"` // 业务数据
}
-func (resp *CreateNoteResp) Success() bool {
+func (resp *CreateJobRequirementResp) Success() bool {
return resp.Code == 0
}
-type GetNoteReqBuilder struct {
+type DeleteJobRequirementReqBuilder struct {
apiReq *larkcore.ApiReq
}
-func NewGetNoteReqBuilder() *GetNoteReqBuilder {
- builder := &GetNoteReqBuilder{}
+func NewDeleteJobRequirementReqBuilder() *DeleteJobRequirementReqBuilder {
+ builder := &DeleteJobRequirementReqBuilder{}
builder.apiReq = &larkcore.ApiReq{
PathParams: larkcore.PathParams{},
QueryParams: larkcore.QueryParams{},
@@ -34586,54 +36103,40 @@ func NewGetNoteReqBuilder() *GetNoteReqBuilder {
return builder
}
-// 备注ID
-//
-// 示例值:6949805467799537964
-func (builder *GetNoteReqBuilder) NoteId(noteId string) *GetNoteReqBuilder {
- builder.apiReq.PathParams.Set("note_id", fmt.Sprint(noteId))
- return builder
-}
-
-// 此次调用中使用的用户ID的类型
+// 招聘需求 ID
//
-// 示例值:
-func (builder *GetNoteReqBuilder) UserIdType(userIdType string) *GetNoteReqBuilder {
- builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+// 示例值:1616161616
+func (builder *DeleteJobRequirementReqBuilder) JobRequirementId(jobRequirementId string) *DeleteJobRequirementReqBuilder {
+ builder.apiReq.PathParams.Set("job_requirement_id", fmt.Sprint(jobRequirementId))
return builder
}
-func (builder *GetNoteReqBuilder) Build() *GetNoteReq {
- req := &GetNoteReq{}
+func (builder *DeleteJobRequirementReqBuilder) Build() *DeleteJobRequirementReq {
+ req := &DeleteJobRequirementReq{}
req.apiReq = &larkcore.ApiReq{}
req.apiReq.PathParams = builder.apiReq.PathParams
- req.apiReq.QueryParams = builder.apiReq.QueryParams
return req
}
-type GetNoteReq struct {
+type DeleteJobRequirementReq struct {
apiReq *larkcore.ApiReq
}
-type GetNoteRespData struct {
- Note *Note `json:"note,omitempty"` // 备注数据
-}
-
-type GetNoteResp struct {
+type DeleteJobRequirementResp struct {
*larkcore.ApiResp `json:"-"`
larkcore.CodeError
- Data *GetNoteRespData `json:"data"` // 业务数据
}
-func (resp *GetNoteResp) Success() bool {
+func (resp *DeleteJobRequirementResp) Success() bool {
return resp.Code == 0
}
-type ListNoteReqBuilder struct {
+type ListJobRequirementReqBuilder struct {
apiReq *larkcore.ApiReq
}
-func NewListNoteReqBuilder() *ListNoteReqBuilder {
- builder := &ListNoteReqBuilder{}
+func NewListJobRequirementReqBuilder() *ListJobRequirementReqBuilder {
+ builder := &ListJobRequirementReqBuilder{}
builder.apiReq = &larkcore.ApiReq{
PathParams: larkcore.PathParams{},
QueryParams: larkcore.QueryParams{},
@@ -34641,126 +36144,166 @@ func NewListNoteReqBuilder() *ListNoteReqBuilder {
return builder
}
-// 每页限制, 每页最大不超过100
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
//
-// 示例值:10
-func (builder *ListNoteReqBuilder) PageSize(pageSize int) *ListNoteReqBuilder {
+// 示例值:1231231987
+func (builder *ListJobRequirementReqBuilder) PageToken(pageToken string) *ListJobRequirementReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:20
+func (builder *ListJobRequirementReqBuilder) PageSize(pageSize int) *ListJobRequirementReqBuilder {
builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
return builder
}
-// 查询游标, 由上一页结果返回, 第一页不传
+// 职位ID
//
-// 示例值:1
-func (builder *ListNoteReqBuilder) PageToken(pageToken string) *ListNoteReqBuilder {
- builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+// 示例值:6001
+func (builder *ListJobRequirementReqBuilder) JobId(jobId string) *ListJobRequirementReqBuilder {
+ builder.apiReq.QueryParams.Set("job_id", fmt.Sprint(jobId))
return builder
}
-// 人才ID
+// 起始创建时间,传入毫秒级时间戳
//
-// 示例值:6916472453069883661
-func (builder *ListNoteReqBuilder) TalentId(talentId string) *ListNoteReqBuilder {
- builder.apiReq.QueryParams.Set("talent_id", fmt.Sprint(talentId))
+// 示例值:1658980233000
+func (builder *ListJobRequirementReqBuilder) CreateTimeBegin(createTimeBegin string) *ListJobRequirementReqBuilder {
+ builder.apiReq.QueryParams.Set("create_time_begin", fmt.Sprint(createTimeBegin))
+ return builder
+}
+
+// 截止创建时间,传入毫秒级时间戳
+//
+// 示例值:1658980233000
+func (builder *ListJobRequirementReqBuilder) CreateTimeEnd(createTimeEnd string) *ListJobRequirementReqBuilder {
+ builder.apiReq.QueryParams.Set("create_time_end", fmt.Sprint(createTimeEnd))
+ return builder
+}
+
+// 起始更新时间,传入毫秒级时间戳
+//
+// 示例值:1658980233000
+func (builder *ListJobRequirementReqBuilder) UpdateTimeBegin(updateTimeBegin string) *ListJobRequirementReqBuilder {
+ builder.apiReq.QueryParams.Set("update_time_begin", fmt.Sprint(updateTimeBegin))
+ return builder
+}
+
+// 截止更新时间,传入毫秒级时间戳
+//
+// 示例值:1658980233000
+func (builder *ListJobRequirementReqBuilder) UpdateTimeEnd(updateTimeEnd string) *ListJobRequirementReqBuilder {
+ builder.apiReq.QueryParams.Set("update_time_end", fmt.Sprint(updateTimeEnd))
return builder
}
// 此次调用中使用的用户ID的类型
//
// 示例值:
-func (builder *ListNoteReqBuilder) UserIdType(userIdType string) *ListNoteReqBuilder {
+func (builder *ListJobRequirementReqBuilder) UserIdType(userIdType string) *ListJobRequirementReqBuilder {
builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
return builder
}
-func (builder *ListNoteReqBuilder) Build() *ListNoteReq {
- req := &ListNoteReq{}
+// 此次调用中使用的部门 ID 的类型
+//
+// 示例值:
+func (builder *ListJobRequirementReqBuilder) DepartmentIdType(departmentIdType string) *ListJobRequirementReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+func (builder *ListJobRequirementReqBuilder) Build() *ListJobRequirementReq {
+ req := &ListJobRequirementReq{}
req.apiReq = &larkcore.ApiReq{}
req.apiReq.QueryParams = builder.apiReq.QueryParams
return req
}
-type ListNoteReq struct {
+type ListJobRequirementReq struct {
apiReq *larkcore.ApiReq
}
-type ListNoteRespData struct {
- Items []*Note `json:"items,omitempty"` // 备注数据列表
- HasMore *bool `json:"has_more,omitempty"` // 是否还有下一页数据
- PageToken *string `json:"page_token,omitempty"` // 游标, 翻下一页数据时使用
+type ListJobRequirementRespData struct {
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+ Items []*JobRequirementDto `json:"items,omitempty"` // 查询的招聘需求信息
}
-type ListNoteResp struct {
+type ListJobRequirementResp struct {
*larkcore.ApiResp `json:"-"`
larkcore.CodeError
- Data *ListNoteRespData `json:"data"` // 业务数据
+ Data *ListJobRequirementRespData `json:"data"` // 业务数据
}
-func (resp *ListNoteResp) Success() bool {
+func (resp *ListJobRequirementResp) Success() bool {
return resp.Code == 0
}
-type PatchNoteReqBodyBuilder struct {
- content string // 备注内容
- contentFlag bool
+type ListByIdJobRequirementReqBodyBuilder struct {
+ idList []string // 招聘需求ID列表
+ idListFlag bool
}
-func NewPatchNoteReqBodyBuilder() *PatchNoteReqBodyBuilder {
- builder := &PatchNoteReqBodyBuilder{}
+func NewListByIdJobRequirementReqBodyBuilder() *ListByIdJobRequirementReqBodyBuilder {
+ builder := &ListByIdJobRequirementReqBodyBuilder{}
return builder
}
-// 备注内容
+// 招聘需求ID列表
//
-//示例值:111
-func (builder *PatchNoteReqBodyBuilder) Content(content string) *PatchNoteReqBodyBuilder {
- builder.content = content
- builder.contentFlag = true
+//示例值:
+func (builder *ListByIdJobRequirementReqBodyBuilder) IdList(idList []string) *ListByIdJobRequirementReqBodyBuilder {
+ builder.idList = idList
+ builder.idListFlag = true
return builder
}
-func (builder *PatchNoteReqBodyBuilder) Build() *PatchNoteReqBody {
- req := &PatchNoteReqBody{}
- if builder.contentFlag {
- req.Content = &builder.content
+func (builder *ListByIdJobRequirementReqBodyBuilder) Build() *ListByIdJobRequirementReqBody {
+ req := &ListByIdJobRequirementReqBody{}
+ if builder.idListFlag {
+ req.IdList = builder.idList
}
return req
}
-type PatchNotePathReqBodyBuilder struct {
- content string // 备注内容
- contentFlag bool
+type ListByIdJobRequirementPathReqBodyBuilder struct {
+ idList []string // 招聘需求ID列表
+ idListFlag bool
}
-func NewPatchNotePathReqBodyBuilder() *PatchNotePathReqBodyBuilder {
- builder := &PatchNotePathReqBodyBuilder{}
+func NewListByIdJobRequirementPathReqBodyBuilder() *ListByIdJobRequirementPathReqBodyBuilder {
+ builder := &ListByIdJobRequirementPathReqBodyBuilder{}
return builder
}
-// 备注内容
+// 招聘需求ID列表
//
-// 示例值:111
-func (builder *PatchNotePathReqBodyBuilder) Content(content string) *PatchNotePathReqBodyBuilder {
- builder.content = content
- builder.contentFlag = true
+// 示例值:
+func (builder *ListByIdJobRequirementPathReqBodyBuilder) IdList(idList []string) *ListByIdJobRequirementPathReqBodyBuilder {
+ builder.idList = idList
+ builder.idListFlag = true
return builder
}
-func (builder *PatchNotePathReqBodyBuilder) Build() (*PatchNoteReqBody, error) {
- req := &PatchNoteReqBody{}
- if builder.contentFlag {
- req.Content = &builder.content
+func (builder *ListByIdJobRequirementPathReqBodyBuilder) Build() (*ListByIdJobRequirementReqBody, error) {
+ req := &ListByIdJobRequirementReqBody{}
+ if builder.idListFlag {
+ req.IdList = builder.idList
}
return req, nil
}
-type PatchNoteReqBuilder struct {
+type ListByIdJobRequirementReqBuilder struct {
apiReq *larkcore.ApiReq
- body *PatchNoteReqBody
+ body *ListByIdJobRequirementReqBody
}
-func NewPatchNoteReqBuilder() *PatchNoteReqBuilder {
- builder := &PatchNoteReqBuilder{}
+func NewListByIdJobRequirementReqBuilder() *ListByIdJobRequirementReqBuilder {
+ builder := &ListByIdJobRequirementReqBuilder{}
builder.apiReq = &larkcore.ApiReq{
PathParams: larkcore.PathParams{},
QueryParams: larkcore.QueryParams{},
@@ -34768,66 +36311,66 @@ func NewPatchNoteReqBuilder() *PatchNoteReqBuilder {
return builder
}
-// 备注 ID
+// 此次调用中使用的用户ID的类型
//
-// 示例值:6960663240925956401
-func (builder *PatchNoteReqBuilder) NoteId(noteId string) *PatchNoteReqBuilder {
- builder.apiReq.PathParams.Set("note_id", fmt.Sprint(noteId))
+// 示例值:
+func (builder *ListByIdJobRequirementReqBuilder) UserIdType(userIdType string) *ListByIdJobRequirementReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
return builder
}
-// 此次调用中使用的用户ID的类型
+// 此次调用中使用的部门 ID 的类型
//
// 示例值:
-func (builder *PatchNoteReqBuilder) UserIdType(userIdType string) *PatchNoteReqBuilder {
- builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+func (builder *ListByIdJobRequirementReqBuilder) DepartmentIdType(departmentIdType string) *ListByIdJobRequirementReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
return builder
}
-// 根据备注 ID 更新备注信息
-func (builder *PatchNoteReqBuilder) Body(body *PatchNoteReqBody) *PatchNoteReqBuilder {
+// 获取招聘需求信息
+func (builder *ListByIdJobRequirementReqBuilder) Body(body *ListByIdJobRequirementReqBody) *ListByIdJobRequirementReqBuilder {
builder.body = body
return builder
}
-func (builder *PatchNoteReqBuilder) Build() *PatchNoteReq {
- req := &PatchNoteReq{}
+func (builder *ListByIdJobRequirementReqBuilder) Build() *ListByIdJobRequirementReq {
+ req := &ListByIdJobRequirementReq{}
req.apiReq = &larkcore.ApiReq{}
- req.apiReq.PathParams = builder.apiReq.PathParams
req.apiReq.QueryParams = builder.apiReq.QueryParams
req.apiReq.Body = builder.body
return req
}
-type PatchNoteReqBody struct {
- Content *string `json:"content,omitempty"` // 备注内容
+type ListByIdJobRequirementReqBody struct {
+ IdList []string `json:"id_list,omitempty"` // 招聘需求ID列表
}
-type PatchNoteReq struct {
+type ListByIdJobRequirementReq struct {
apiReq *larkcore.ApiReq
- Body *PatchNoteReqBody `body:""`
+ Body *ListByIdJobRequirementReqBody `body:""`
}
-type PatchNoteRespData struct {
- Note *Note `json:"note,omitempty"` // 备注数据
+type ListByIdJobRequirementRespData struct {
+ Items []*JobRequirementDto `json:"items,omitempty"` // 招聘需求列表
}
-type PatchNoteResp struct {
+type ListByIdJobRequirementResp struct {
*larkcore.ApiResp `json:"-"`
larkcore.CodeError
- Data *PatchNoteRespData `json:"data"` // 业务数据
+ Data *ListByIdJobRequirementRespData `json:"data"` // 业务数据
}
-func (resp *PatchNoteResp) Success() bool {
+func (resp *ListByIdJobRequirementResp) Success() bool {
return resp.Code == 0
}
-type GetOfferSchemaReqBuilder struct {
- apiReq *larkcore.ApiReq
+type UpdateJobRequirementReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ jobRequirement *JobRequirement
}
-func NewGetOfferSchemaReqBuilder() *GetOfferSchemaReqBuilder {
- builder := &GetOfferSchemaReqBuilder{}
+func NewUpdateJobRequirementReqBuilder() *UpdateJobRequirementReqBuilder {
+ builder := &UpdateJobRequirementReqBuilder{}
builder.apiReq = &larkcore.ApiReq{
PathParams: larkcore.PathParams{},
QueryParams: larkcore.QueryParams{},
@@ -34835,22 +36378,972 @@ func NewGetOfferSchemaReqBuilder() *GetOfferSchemaReqBuilder {
return builder
}
-// offer申请表的ID *必需属性
+// 招聘需求ID
//
-// 示例值:1231231231231
-func (builder *GetOfferSchemaReqBuilder) OfferSchemaId(offerSchemaId string) *GetOfferSchemaReqBuilder {
- builder.apiReq.PathParams.Set("offer_schema_id", fmt.Sprint(offerSchemaId))
+// 示例值:623455234
+func (builder *UpdateJobRequirementReqBuilder) JobRequirementId(jobRequirementId string) *UpdateJobRequirementReqBuilder {
+ builder.apiReq.PathParams.Set("job_requirement_id", fmt.Sprint(jobRequirementId))
return builder
}
-func (builder *GetOfferSchemaReqBuilder) Build() *GetOfferSchemaReq {
- req := &GetOfferSchemaReq{}
- req.apiReq = &larkcore.ApiReq{}
- req.apiReq.PathParams = builder.apiReq.PathParams
- return req
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:
+func (builder *UpdateJobRequirementReqBuilder) UserIdType(userIdType string) *UpdateJobRequirementReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
}
-type GetOfferSchemaReq struct {
+// 此次调用中使用的部门 ID 的类型
+//
+// 示例值:
+func (builder *UpdateJobRequirementReqBuilder) DepartmentIdType(departmentIdType string) *UpdateJobRequirementReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+// 更新招聘需求
+func (builder *UpdateJobRequirementReqBuilder) JobRequirement(jobRequirement *JobRequirement) *UpdateJobRequirementReqBuilder {
+ builder.jobRequirement = jobRequirement
+ return builder
+}
+
+func (builder *UpdateJobRequirementReqBuilder) Build() *UpdateJobRequirementReq {
+ req := &UpdateJobRequirementReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.jobRequirement
+ return req
+}
+
+type UpdateJobRequirementReq struct {
+ apiReq *larkcore.ApiReq
+ JobRequirement *JobRequirement `body:""`
+}
+
+type UpdateJobRequirementResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *UpdateJobRequirementResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListJobRequirementSchemaReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListJobRequirementSchemaReqBuilder() *ListJobRequirementSchemaReqBuilder {
+ builder := &ListJobRequirementSchemaReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:1231231987
+func (builder *ListJobRequirementSchemaReqBuilder) PageToken(pageToken string) *ListJobRequirementSchemaReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListJobRequirementSchemaReqBuilder) PageSize(pageSize int) *ListJobRequirementSchemaReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+func (builder *ListJobRequirementSchemaReqBuilder) Build() *ListJobRequirementSchemaReq {
+ req := &ListJobRequirementSchemaReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListJobRequirementSchemaReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListJobRequirementSchemaRespData struct {
+ Items []*JobRequirementSchema `json:"items,omitempty"` // 列表
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+}
+
+type ListJobRequirementSchemaResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListJobRequirementSchemaRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListJobRequirementSchemaResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateNoteReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ note *Note
+}
+
+func NewCreateNoteReqBuilder() *CreateNoteReqBuilder {
+ builder := &CreateNoteReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:
+func (builder *CreateNoteReqBuilder) UserIdType(userIdType string) *CreateNoteReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 创建备注信息
+func (builder *CreateNoteReqBuilder) Note(note *Note) *CreateNoteReqBuilder {
+ builder.note = note
+ return builder
+}
+
+func (builder *CreateNoteReqBuilder) Build() *CreateNoteReq {
+ req := &CreateNoteReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.note
+ return req
+}
+
+type CreateNoteReq struct {
+ apiReq *larkcore.ApiReq
+ Note *Note `body:""`
+}
+
+type CreateNoteRespData struct {
+ Note *Note `json:"note,omitempty"` // 备注信息
+}
+
+type CreateNoteResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateNoteRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateNoteResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetNoteReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetNoteReqBuilder() *GetNoteReqBuilder {
+ builder := &GetNoteReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 备注ID
+//
+// 示例值:6949805467799537964
+func (builder *GetNoteReqBuilder) NoteId(noteId string) *GetNoteReqBuilder {
+ builder.apiReq.PathParams.Set("note_id", fmt.Sprint(noteId))
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:
+func (builder *GetNoteReqBuilder) UserIdType(userIdType string) *GetNoteReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+func (builder *GetNoteReqBuilder) Build() *GetNoteReq {
+ req := &GetNoteReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type GetNoteReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetNoteRespData struct {
+ Note *Note `json:"note,omitempty"` // 备注数据
+}
+
+type GetNoteResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetNoteRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetNoteResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListNoteReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListNoteReqBuilder() *ListNoteReqBuilder {
+ builder := &ListNoteReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 每页限制, 每页最大不超过100
+//
+// 示例值:10
+func (builder *ListNoteReqBuilder) PageSize(pageSize int) *ListNoteReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 查询游标, 由上一页结果返回, 第一页不传
+//
+// 示例值:1
+func (builder *ListNoteReqBuilder) PageToken(pageToken string) *ListNoteReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 人才ID
+//
+// 示例值:6916472453069883661
+func (builder *ListNoteReqBuilder) TalentId(talentId string) *ListNoteReqBuilder {
+ builder.apiReq.QueryParams.Set("talent_id", fmt.Sprint(talentId))
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:
+func (builder *ListNoteReqBuilder) UserIdType(userIdType string) *ListNoteReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+func (builder *ListNoteReqBuilder) Build() *ListNoteReq {
+ req := &ListNoteReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListNoteReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListNoteRespData struct {
+ Items []*Note `json:"items,omitempty"` // 备注数据列表
+ HasMore *bool `json:"has_more,omitempty"` // 是否还有下一页数据
+ PageToken *string `json:"page_token,omitempty"` // 游标, 翻下一页数据时使用
+}
+
+type ListNoteResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListNoteRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListNoteResp) Success() bool {
+ return resp.Code == 0
+}
+
+type PatchNoteReqBodyBuilder struct {
+ content string // 备注内容
+ contentFlag bool
+}
+
+func NewPatchNoteReqBodyBuilder() *PatchNoteReqBodyBuilder {
+ builder := &PatchNoteReqBodyBuilder{}
+ return builder
+}
+
+// 备注内容
+//
+//示例值:111
+func (builder *PatchNoteReqBodyBuilder) Content(content string) *PatchNoteReqBodyBuilder {
+ builder.content = content
+ builder.contentFlag = true
+ return builder
+}
+
+func (builder *PatchNoteReqBodyBuilder) Build() *PatchNoteReqBody {
+ req := &PatchNoteReqBody{}
+ if builder.contentFlag {
+ req.Content = &builder.content
+ }
+ return req
+}
+
+type PatchNotePathReqBodyBuilder struct {
+ content string // 备注内容
+ contentFlag bool
+}
+
+func NewPatchNotePathReqBodyBuilder() *PatchNotePathReqBodyBuilder {
+ builder := &PatchNotePathReqBodyBuilder{}
+ return builder
+}
+
+// 备注内容
+//
+// 示例值:111
+func (builder *PatchNotePathReqBodyBuilder) Content(content string) *PatchNotePathReqBodyBuilder {
+ builder.content = content
+ builder.contentFlag = true
+ return builder
+}
+
+func (builder *PatchNotePathReqBodyBuilder) Build() (*PatchNoteReqBody, error) {
+ req := &PatchNoteReqBody{}
+ if builder.contentFlag {
+ req.Content = &builder.content
+ }
+ return req, nil
+}
+
+type PatchNoteReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *PatchNoteReqBody
+}
+
+func NewPatchNoteReqBuilder() *PatchNoteReqBuilder {
+ builder := &PatchNoteReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 备注 ID
+//
+// 示例值:6960663240925956401
+func (builder *PatchNoteReqBuilder) NoteId(noteId string) *PatchNoteReqBuilder {
+ builder.apiReq.PathParams.Set("note_id", fmt.Sprint(noteId))
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:
+func (builder *PatchNoteReqBuilder) UserIdType(userIdType string) *PatchNoteReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 根据备注 ID 更新备注信息
+func (builder *PatchNoteReqBuilder) Body(body *PatchNoteReqBody) *PatchNoteReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *PatchNoteReqBuilder) Build() *PatchNoteReq {
+ req := &PatchNoteReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type PatchNoteReqBody struct {
+ Content *string `json:"content,omitempty"` // 备注内容
+}
+
+type PatchNoteReq struct {
+ apiReq *larkcore.ApiReq
+ Body *PatchNoteReqBody `body:""`
+}
+
+type PatchNoteRespData struct {
+ Note *Note `json:"note,omitempty"` // 备注数据
+}
+
+type PatchNoteResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *PatchNoteRespData `json:"data"` // 业务数据
+}
+
+func (resp *PatchNoteResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateOfferReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ offerInfo *OfferInfo
+}
+
+func NewCreateOfferReqBuilder() *CreateOfferReqBuilder {
+ builder := &CreateOfferReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:open_id
+func (builder *CreateOfferReqBuilder) UserIdType(userIdType string) *CreateOfferReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 此次调用中使用的部门 ID 的类型
+//
+// 示例值:
+func (builder *CreateOfferReqBuilder) DepartmentIdType(departmentIdType string) *CreateOfferReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+// 创建 Offer 时,需传入本文档中标注为必传的参数,其余参数是否必传参考「获取 Offer 申请表模板信息」的参数定义
+func (builder *CreateOfferReqBuilder) OfferInfo(offerInfo *OfferInfo) *CreateOfferReqBuilder {
+ builder.offerInfo = offerInfo
+ return builder
+}
+
+func (builder *CreateOfferReqBuilder) Build() *CreateOfferReq {
+ req := &CreateOfferReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.offerInfo
+ return req
+}
+
+type CreateOfferReq struct {
+ apiReq *larkcore.ApiReq
+ OfferInfo *OfferInfo `body:""`
+}
+
+type CreateOfferRespData struct {
+ OfferId *string `json:"offer_id,omitempty"` // Offer ID
+ ApplicationId *string `json:"application_id,omitempty"` // 投递 ID
+ SchemaId *string `json:"schema_id,omitempty"` // 模板 ID
+ OfferType *int `json:"offer_type,omitempty"` // Offer 类型
+ BasicInfo *OfferBasicInfo `json:"basic_info,omitempty"` // Offer 基本信息
+ SalaryInfo *OfferSalaryInfo `json:"salary_info,omitempty"` // Offer 薪资信息
+ CustomizedInfoList []*OfferCustomizedInfo `json:"customized_info_list,omitempty"` // 自定义信息
+}
+
+type CreateOfferResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateOfferRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateOfferResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetOfferReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetOfferReqBuilder() *GetOfferReqBuilder {
+ builder := &GetOfferReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// Offer ID
+//
+// 示例值:1111111
+func (builder *GetOfferReqBuilder) OfferId(offerId string) *GetOfferReqBuilder {
+ builder.apiReq.PathParams.Set("offer_id", fmt.Sprint(offerId))
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:
+func (builder *GetOfferReqBuilder) UserIdType(userIdType string) *GetOfferReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 此次调用中使用的部门 ID 的类型
+//
+// 示例值:
+func (builder *GetOfferReqBuilder) DepartmentIdType(departmentIdType string) *GetOfferReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+func (builder *GetOfferReqBuilder) Build() *GetOfferReq {
+ req := &GetOfferReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type GetOfferReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetOfferRespData struct {
+ Offer *Offer `json:"offer,omitempty"` // Offer 详情
+}
+
+type GetOfferResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetOfferRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetOfferResp) Success() bool {
+ return resp.Code == 0
+}
+
+type InternOfferStatusOfferReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ internOfferStatus *InternOfferStatus
+}
+
+func NewInternOfferStatusOfferReqBuilder() *InternOfferStatusOfferReqBuilder {
+ builder := &InternOfferStatusOfferReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// Offer ID
+//
+// 示例值:7016605170635213100
+func (builder *InternOfferStatusOfferReqBuilder) OfferId(offerId string) *InternOfferStatusOfferReqBuilder {
+ builder.apiReq.PathParams.Set("offer_id", fmt.Sprint(offerId))
+ return builder
+}
+
+// 对「实习待入职」状态的实习 Offer 确认入职、放弃入职,或对「实习已入职」状态的实习 Offer 操作离职
+func (builder *InternOfferStatusOfferReqBuilder) InternOfferStatus(internOfferStatus *InternOfferStatus) *InternOfferStatusOfferReqBuilder {
+ builder.internOfferStatus = internOfferStatus
+ return builder
+}
+
+func (builder *InternOfferStatusOfferReqBuilder) Build() *InternOfferStatusOfferReq {
+ req := &InternOfferStatusOfferReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.Body = builder.internOfferStatus
+ return req
+}
+
+type InternOfferStatusOfferReq struct {
+ apiReq *larkcore.ApiReq
+ InternOfferStatus *InternOfferStatus `body:""`
+}
+
+type InternOfferStatusOfferRespData struct {
+ OfferId *string `json:"offer_id,omitempty"` // Offer ID
+ Operation *string `json:"operation,omitempty"` // 更新入/离职状态的操作
+ OnboardingInfo *InternOfferOnboardingInfo `json:"onboarding_info,omitempty"` // 入职表单信息(当 operation 为 confirm_onboarding 时,该字段必填)
+ OffboardingInfo *InternOfferOffboardingInfo `json:"offboarding_info,omitempty"` // 离职表单信息(当 operation 为 offboard 时,该字段必填)
+}
+
+type InternOfferStatusOfferResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *InternOfferStatusOfferRespData `json:"data"` // 业务数据
+}
+
+func (resp *InternOfferStatusOfferResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListOfferReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListOfferReqBuilder() *ListOfferReqBuilder {
+ builder := &ListOfferReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:1231231987
+func (builder *ListOfferReqBuilder) PageToken(pageToken string) *ListOfferReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListOfferReqBuilder) PageSize(pageSize int) *ListOfferReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 人才 ID
+//
+// 示例值:7096320678581242123
+func (builder *ListOfferReqBuilder) TalentId(talentId string) *ListOfferReqBuilder {
+ builder.apiReq.QueryParams.Set("talent_id", fmt.Sprint(talentId))
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:
+func (builder *ListOfferReqBuilder) UserIdType(userIdType string) *ListOfferReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+func (builder *ListOfferReqBuilder) Build() *ListOfferReq {
+ req := &ListOfferReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListOfferReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListOfferRespData struct {
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+ Items []*OfferListInfo `json:"items,omitempty"` // Offer 列表
+}
+
+type ListOfferResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListOfferRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListOfferResp) Success() bool {
+ return resp.Code == 0
+}
+
+type OfferStatusOfferReqBodyBuilder struct {
+ offerStatus int // offer状态
+ offerStatusFlag bool
+ expirationDate string // offer 失效时间,当反馈状态是「offer已发出」时为必填项
+ expirationDateFlag bool
+ terminationReasonIdList []string // 终止原因列表,当反馈状态是「候选人已拒绝」时为必填项;最多传入50个
+ terminationReasonIdListFlag bool
+ terminationReasonNote string // 终止备注
+ terminationReasonNoteFlag bool
+}
+
+func NewOfferStatusOfferReqBodyBuilder() *OfferStatusOfferReqBodyBuilder {
+ builder := &OfferStatusOfferReqBodyBuilder{}
+ return builder
+}
+
+// offer状态
+//
+//示例值:
+func (builder *OfferStatusOfferReqBodyBuilder) OfferStatus(offerStatus int) *OfferStatusOfferReqBodyBuilder {
+ builder.offerStatus = offerStatus
+ builder.offerStatusFlag = true
+ return builder
+}
+
+// offer 失效时间,当反馈状态是「offer已发出」时为必填项
+//
+//示例值:2023-01-01
+func (builder *OfferStatusOfferReqBodyBuilder) ExpirationDate(expirationDate string) *OfferStatusOfferReqBodyBuilder {
+ builder.expirationDate = expirationDate
+ builder.expirationDateFlag = true
+ return builder
+}
+
+// 终止原因列表,当反馈状态是「候选人已拒绝」时为必填项;最多传入50个
+//
+//示例值:
+func (builder *OfferStatusOfferReqBodyBuilder) TerminationReasonIdList(terminationReasonIdList []string) *OfferStatusOfferReqBodyBuilder {
+ builder.terminationReasonIdList = terminationReasonIdList
+ builder.terminationReasonIdListFlag = true
+ return builder
+}
+
+// 终止备注
+//
+//示例值:不符合期望
+func (builder *OfferStatusOfferReqBodyBuilder) TerminationReasonNote(terminationReasonNote string) *OfferStatusOfferReqBodyBuilder {
+ builder.terminationReasonNote = terminationReasonNote
+ builder.terminationReasonNoteFlag = true
+ return builder
+}
+
+func (builder *OfferStatusOfferReqBodyBuilder) Build() *OfferStatusOfferReqBody {
+ req := &OfferStatusOfferReqBody{}
+ if builder.offerStatusFlag {
+ req.OfferStatus = &builder.offerStatus
+ }
+ if builder.expirationDateFlag {
+ req.ExpirationDate = &builder.expirationDate
+ }
+ if builder.terminationReasonIdListFlag {
+ req.TerminationReasonIdList = builder.terminationReasonIdList
+ }
+ if builder.terminationReasonNoteFlag {
+ req.TerminationReasonNote = &builder.terminationReasonNote
+ }
+ return req
+}
+
+type OfferStatusOfferPathReqBodyBuilder struct {
+ offerStatus int // offer状态
+ offerStatusFlag bool
+ expirationDate string // offer 失效时间,当反馈状态是「offer已发出」时为必填项
+ expirationDateFlag bool
+ terminationReasonIdList []string // 终止原因列表,当反馈状态是「候选人已拒绝」时为必填项;最多传入50个
+ terminationReasonIdListFlag bool
+ terminationReasonNote string // 终止备注
+ terminationReasonNoteFlag bool
+}
+
+func NewOfferStatusOfferPathReqBodyBuilder() *OfferStatusOfferPathReqBodyBuilder {
+ builder := &OfferStatusOfferPathReqBodyBuilder{}
+ return builder
+}
+
+// offer状态
+//
+// 示例值:
+func (builder *OfferStatusOfferPathReqBodyBuilder) OfferStatus(offerStatus int) *OfferStatusOfferPathReqBodyBuilder {
+ builder.offerStatus = offerStatus
+ builder.offerStatusFlag = true
+ return builder
+}
+
+// offer 失效时间,当反馈状态是「offer已发出」时为必填项
+//
+// 示例值:2023-01-01
+func (builder *OfferStatusOfferPathReqBodyBuilder) ExpirationDate(expirationDate string) *OfferStatusOfferPathReqBodyBuilder {
+ builder.expirationDate = expirationDate
+ builder.expirationDateFlag = true
+ return builder
+}
+
+// 终止原因列表,当反馈状态是「候选人已拒绝」时为必填项;最多传入50个
+//
+// 示例值:
+func (builder *OfferStatusOfferPathReqBodyBuilder) TerminationReasonIdList(terminationReasonIdList []string) *OfferStatusOfferPathReqBodyBuilder {
+ builder.terminationReasonIdList = terminationReasonIdList
+ builder.terminationReasonIdListFlag = true
+ return builder
+}
+
+// 终止备注
+//
+// 示例值:不符合期望
+func (builder *OfferStatusOfferPathReqBodyBuilder) TerminationReasonNote(terminationReasonNote string) *OfferStatusOfferPathReqBodyBuilder {
+ builder.terminationReasonNote = terminationReasonNote
+ builder.terminationReasonNoteFlag = true
+ return builder
+}
+
+func (builder *OfferStatusOfferPathReqBodyBuilder) Build() (*OfferStatusOfferReqBody, error) {
+ req := &OfferStatusOfferReqBody{}
+ if builder.offerStatusFlag {
+ req.OfferStatus = &builder.offerStatus
+ }
+ if builder.expirationDateFlag {
+ req.ExpirationDate = &builder.expirationDate
+ }
+ if builder.terminationReasonIdListFlag {
+ req.TerminationReasonIdList = builder.terminationReasonIdList
+ }
+ if builder.terminationReasonNoteFlag {
+ req.TerminationReasonNote = &builder.terminationReasonNote
+ }
+ return req, nil
+}
+
+type OfferStatusOfferReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *OfferStatusOfferReqBody
+}
+
+func NewOfferStatusOfferReqBuilder() *OfferStatusOfferReqBuilder {
+ builder := &OfferStatusOfferReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// offer ID
+//
+// 示例值:6930815272790114324
+func (builder *OfferStatusOfferReqBuilder) OfferId(offerId string) *OfferStatusOfferReqBuilder {
+ builder.apiReq.PathParams.Set("offer_id", fmt.Sprint(offerId))
+ return builder
+}
+
+//
+func (builder *OfferStatusOfferReqBuilder) Body(body *OfferStatusOfferReqBody) *OfferStatusOfferReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *OfferStatusOfferReqBuilder) Build() *OfferStatusOfferReq {
+ req := &OfferStatusOfferReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type OfferStatusOfferReqBody struct {
+ OfferStatus *int `json:"offer_status,omitempty"` // offer状态
+ ExpirationDate *string `json:"expiration_date,omitempty"` // offer 失效时间,当反馈状态是「offer已发出」时为必填项
+ TerminationReasonIdList []string `json:"termination_reason_id_list,omitempty"` // 终止原因列表,当反馈状态是「候选人已拒绝」时为必填项;最多传入50个
+ TerminationReasonNote *string `json:"termination_reason_note,omitempty"` // 终止备注
+}
+
+type OfferStatusOfferReq struct {
+ apiReq *larkcore.ApiReq
+ Body *OfferStatusOfferReqBody `body:""`
+}
+
+type OfferStatusOfferResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *OfferStatusOfferResp) Success() bool {
+ return resp.Code == 0
+}
+
+type UpdateOfferReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ offerInfo *OfferInfo
+}
+
+func NewUpdateOfferReqBuilder() *UpdateOfferReqBuilder {
+ builder := &UpdateOfferReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// Offer ID
+//
+// 示例值:7016605170635213100
+func (builder *UpdateOfferReqBuilder) OfferId(offerId string) *UpdateOfferReqBuilder {
+ builder.apiReq.PathParams.Set("offer_id", fmt.Sprint(offerId))
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:open_id
+func (builder *UpdateOfferReqBuilder) UserIdType(userIdType string) *UpdateOfferReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 此次调用中使用的部门 ID 的类型
+//
+// 示例值:
+func (builder *UpdateOfferReqBuilder) DepartmentIdType(departmentIdType string) *UpdateOfferReqBuilder {
+ builder.apiReq.QueryParams.Set("department_id_type", fmt.Sprint(departmentIdType))
+ return builder
+}
+
+// 1. 更新 Offer 时,需传入本文档中标注为必传的参数,其余参数是否必传参考「获取 Offer 申请表模板信息」的参数定义;;2. 对系统中已存在的 offer 进行更新的,若更新 offer 中含有「修改需审批」的字段,更新后原 Offer 的审批会自动撤回,需要重新发起审批
+func (builder *UpdateOfferReqBuilder) OfferInfo(offerInfo *OfferInfo) *UpdateOfferReqBuilder {
+ builder.offerInfo = offerInfo
+ return builder
+}
+
+func (builder *UpdateOfferReqBuilder) Build() *UpdateOfferReq {
+ req := &UpdateOfferReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.offerInfo
+ return req
+}
+
+type UpdateOfferReq struct {
+ apiReq *larkcore.ApiReq
+ OfferInfo *OfferInfo `body:""`
+}
+
+type UpdateOfferResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *UpdateOfferResp) Success() bool {
+ return resp.Code == 0
+}
+
+type GetOfferSchemaReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetOfferSchemaReqBuilder() *GetOfferSchemaReqBuilder {
+ builder := &GetOfferSchemaReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// offer申请表的ID *必需属性
+//
+// 示例值:1231231231231
+func (builder *GetOfferSchemaReqBuilder) OfferSchemaId(offerSchemaId string) *GetOfferSchemaReqBuilder {
+ builder.apiReq.PathParams.Set("offer_schema_id", fmt.Sprint(offerSchemaId))
+ return builder
+}
+
+func (builder *GetOfferSchemaReqBuilder) Build() *GetOfferSchemaReq {
+ req := &GetOfferSchemaReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type GetOfferSchemaReq struct {
apiReq *larkcore.ApiReq
}
@@ -34871,6 +37364,94 @@ func (resp *GetOfferSchemaResp) Success() bool {
return resp.Code == 0
}
+type ListQuestionnaireReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewListQuestionnaireReqBuilder() *ListQuestionnaireReqBuilder {
+ builder := &ListQuestionnaireReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:1231231987
+func (builder *ListQuestionnaireReqBuilder) PageToken(pageToken string) *ListQuestionnaireReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:100
+func (builder *ListQuestionnaireReqBuilder) PageSize(pageSize int) *ListQuestionnaireReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 投递 ID
+//
+// 示例值:6985833807195212076
+func (builder *ListQuestionnaireReqBuilder) ApplicationId(applicationId string) *ListQuestionnaireReqBuilder {
+ builder.apiReq.QueryParams.Set("application_id", fmt.Sprint(applicationId))
+ return builder
+}
+
+// 面试 ID
+//
+// 示例值:7038435261598763308
+func (builder *ListQuestionnaireReqBuilder) InterviewId(interviewId string) *ListQuestionnaireReqBuilder {
+ builder.apiReq.QueryParams.Set("interview_id", fmt.Sprint(interviewId))
+ return builder
+}
+
+// 最早更新时间
+//
+// 示例值:1638848468868
+func (builder *ListQuestionnaireReqBuilder) UpdateStartTime(updateStartTime string) *ListQuestionnaireReqBuilder {
+ builder.apiReq.QueryParams.Set("update_start_time", fmt.Sprint(updateStartTime))
+ return builder
+}
+
+// 最晚更新时间
+//
+// 示例值:1638848468869
+func (builder *ListQuestionnaireReqBuilder) UpdateEndTime(updateEndTime string) *ListQuestionnaireReqBuilder {
+ builder.apiReq.QueryParams.Set("update_end_time", fmt.Sprint(updateEndTime))
+ return builder
+}
+
+func (builder *ListQuestionnaireReqBuilder) Build() *ListQuestionnaireReq {
+ req := &ListQuestionnaireReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListQuestionnaireReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type ListQuestionnaireRespData struct {
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+ Items []*Questionnaire `json:"items,omitempty"` // 满意度评价列表
+}
+
+type ListQuestionnaireResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListQuestionnaireRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListQuestionnaireResp) Success() bool {
+ return resp.Code == 0
+}
+
type GetByApplicationReferralReqBuilder struct {
apiReq *larkcore.ApiReq
}
@@ -34991,6 +37572,140 @@ func (resp *ListResumeSourceResp) Success() bool {
return resp.Code == 0
}
+type AddToFolderTalentReqBodyBuilder struct {
+ talentIdList []string // 人才 ID 列表
+ talentIdListFlag bool
+ folderId string // 文件夹 ID
+ folderIdFlag bool
+}
+
+func NewAddToFolderTalentReqBodyBuilder() *AddToFolderTalentReqBodyBuilder {
+ builder := &AddToFolderTalentReqBodyBuilder{}
+ return builder
+}
+
+// 人才 ID 列表
+//
+//示例值:6039620186502138151
+func (builder *AddToFolderTalentReqBodyBuilder) TalentIdList(talentIdList []string) *AddToFolderTalentReqBodyBuilder {
+ builder.talentIdList = talentIdList
+ builder.talentIdListFlag = true
+ return builder
+}
+
+// 文件夹 ID
+//
+//示例值:7039620186502138156
+func (builder *AddToFolderTalentReqBodyBuilder) FolderId(folderId string) *AddToFolderTalentReqBodyBuilder {
+ builder.folderId = folderId
+ builder.folderIdFlag = true
+ return builder
+}
+
+func (builder *AddToFolderTalentReqBodyBuilder) Build() *AddToFolderTalentReqBody {
+ req := &AddToFolderTalentReqBody{}
+ if builder.talentIdListFlag {
+ req.TalentIdList = builder.talentIdList
+ }
+ if builder.folderIdFlag {
+ req.FolderId = &builder.folderId
+ }
+ return req
+}
+
+type AddToFolderTalentPathReqBodyBuilder struct {
+ talentIdList []string // 人才 ID 列表
+ talentIdListFlag bool
+ folderId string // 文件夹 ID
+ folderIdFlag bool
+}
+
+func NewAddToFolderTalentPathReqBodyBuilder() *AddToFolderTalentPathReqBodyBuilder {
+ builder := &AddToFolderTalentPathReqBodyBuilder{}
+ return builder
+}
+
+// 人才 ID 列表
+//
+// 示例值:6039620186502138151
+func (builder *AddToFolderTalentPathReqBodyBuilder) TalentIdList(talentIdList []string) *AddToFolderTalentPathReqBodyBuilder {
+ builder.talentIdList = talentIdList
+ builder.talentIdListFlag = true
+ return builder
+}
+
+// 文件夹 ID
+//
+// 示例值:7039620186502138156
+func (builder *AddToFolderTalentPathReqBodyBuilder) FolderId(folderId string) *AddToFolderTalentPathReqBodyBuilder {
+ builder.folderId = folderId
+ builder.folderIdFlag = true
+ return builder
+}
+
+func (builder *AddToFolderTalentPathReqBodyBuilder) Build() (*AddToFolderTalentReqBody, error) {
+ req := &AddToFolderTalentReqBody{}
+ if builder.talentIdListFlag {
+ req.TalentIdList = builder.talentIdList
+ }
+ if builder.folderIdFlag {
+ req.FolderId = &builder.folderId
+ }
+ return req, nil
+}
+
+type AddToFolderTalentReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *AddToFolderTalentReqBody
+}
+
+func NewAddToFolderTalentReqBuilder() *AddToFolderTalentReqBuilder {
+ builder := &AddToFolderTalentReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 将人才加入指定文件夹
+func (builder *AddToFolderTalentReqBuilder) Body(body *AddToFolderTalentReqBody) *AddToFolderTalentReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *AddToFolderTalentReqBuilder) Build() *AddToFolderTalentReq {
+ req := &AddToFolderTalentReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type AddToFolderTalentReqBody struct {
+ TalentIdList []string `json:"talent_id_list,omitempty"` // 人才 ID 列表
+ FolderId *string `json:"folder_id,omitempty"` // 文件夹 ID
+}
+
+type AddToFolderTalentReq struct {
+ apiReq *larkcore.ApiReq
+ Body *AddToFolderTalentReqBody `body:""`
+}
+
+type AddToFolderTalentRespData struct {
+ TalentIdList []string `json:"talent_id_list,omitempty"` // 人才 ID 列表
+ FolderId *string `json:"folder_id,omitempty"` // 文件夹 ID
+}
+
+type AddToFolderTalentResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *AddToFolderTalentRespData `json:"data"` // 业务数据
+}
+
+func (resp *AddToFolderTalentResp) Success() bool {
+ return resp.Code == 0
+}
+
type BatchGetIdTalentReqBodyBuilder struct {
mobileCode string // 手机国家区号,默认值:86,即中国大陆地区
mobileCodeFlag bool
@@ -35266,6 +37981,204 @@ func (resp *GetTalentResp) Success() bool {
return resp.Code == 0
}
+type ListTalentFolderReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ limit int // 最大返回多少记录,当使用迭代器访问时才有效
+}
+
+func NewListTalentFolderReqBuilder() *ListTalentFolderReqBuilder {
+ builder := &ListTalentFolderReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 最大返回多少记录,当使用迭代器访问时才有效
+func (builder *ListTalentFolderReqBuilder) Limit(limit int) *ListTalentFolderReqBuilder {
+ builder.limit = limit
+ return builder
+}
+
+// 页码标识,获取第一页传空,每次查询会返回下一页的page_token
+//
+// 示例值:eyJvZmZzZXQiOjEsInRpbWVzdGFtcCI6MTY0MDc2NTYzMjA4OCwiaWQiOm51bGx9
+func (builder *ListTalentFolderReqBuilder) PageToken(pageToken string) *ListTalentFolderReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+// 每页获取记录数量,最大100
+//
+// 示例值:10
+func (builder *ListTalentFolderReqBuilder) PageSize(pageSize int) *ListTalentFolderReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 用户ID类型
+//
+// 示例值:open_id
+func (builder *ListTalentFolderReqBuilder) UserIdType(userIdType string) *ListTalentFolderReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+func (builder *ListTalentFolderReqBuilder) Build() *ListTalentFolderReq {
+ req := &ListTalentFolderReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.Limit = builder.limit
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListTalentFolderReq struct {
+ apiReq *larkcore.ApiReq
+ Limit int // 最多返回多少记录,只有在使用迭代器访问时,才有效
+
+}
+
+type ListTalentFolderRespData struct {
+ HasMore *bool `json:"has_more,omitempty"` // 是否有下一页
+ PageToken *string `json:"page_token,omitempty"` // 下一页页码
+ Items []*TalentFolder `json:"items,omitempty"` // 文件夹列表
+}
+
+type ListTalentFolderResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListTalentFolderRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListTalentFolderResp) Success() bool {
+ return resp.Code == 0
+}
+
+type P2ApplicationStageChangedV1Data struct {
+ ApplicationId *string `json:"application_id,omitempty"` //
+ OriginStageId *string `json:"origin_stage_id,omitempty"` //
+ TargetStageId *string `json:"target_stage_id,omitempty"` //
+ UpdateTime *int `json:"update_time,omitempty"` //
+}
+
+type P2ApplicationStageChangedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2ApplicationStageChangedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2ApplicationStageChangedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type P2EhrImportTaskImportedV1Data struct {
+ TaskId *string `json:"task_id,omitempty"` // 导入任务 ID
+ ApplicationId *string `json:"application_id,omitempty"` // 投递 ID
+ EhrDepartmentId *string `json:"ehr_department_id,omitempty"` // 导入部门 ID
+ EhrRequirementId *string `json:"ehr_requirement_id,omitempty"` // 招聘需求 ID
+ OperatorId *string `json:"operator_id,omitempty"` // 操作人的飞书招聘 user_id
+ OperatorUserId *UserId `json:"operator_user_id,omitempty"` // 操作人的飞书 user_id
+}
+
+type P2EhrImportTaskImportedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2EhrImportTaskImportedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2EhrImportTaskImportedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type P2EhrImportTaskForInternshipOfferImportedV1Data struct {
+ TaskId *string `json:"task_id,omitempty"` // 导入任务 ID
+ ApplicationId *string `json:"application_id,omitempty"` // 投递 ID
+ OfferId *string `json:"offer_id,omitempty"` // Offer ID
+ PreOnboardId *string `json:"pre_onboard_id,omitempty"` // 实习 ID
+ EhrDepartmentId *string `json:"ehr_department_id,omitempty"` // 导入部门 ID
+ OperatorId *string `json:"operator_id,omitempty"` // 操作人的飞书招聘 user_id
+ OperatorUserId *UserId `json:"operator_user_id,omitempty"` // 操作人的飞书 user_id
+}
+
+type P2EhrImportTaskForInternshipOfferImportedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2EhrImportTaskForInternshipOfferImportedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2EhrImportTaskForInternshipOfferImportedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type P2OfferStatusChangedV1Data struct {
+ OfferId *string `json:"offer_id,omitempty"` // 发生状态变更的 OfferID
+}
+
+type P2OfferStatusChangedV1 struct {
+ *larkevent.EventV2Base // 事件基础数据
+ *larkevent.EventReq // 请求原生数据
+ Event *P2OfferStatusChangedV1Data `json:"event"` // 事件内容
+}
+
+func (m *P2OfferStatusChangedV1) RawReq(req *larkevent.EventReq) {
+ m.EventReq = req
+}
+
+type ListEvaluationIterator struct {
+ nextPageToken *string
+ items []*Evaluation
+ index int
+ limit int
+ ctx context.Context
+ req *ListEvaluationReq
+ listFunc func(ctx context.Context, req *ListEvaluationReq, options ...larkcore.RequestOptionFunc) (*ListEvaluationResp, error)
+ options []larkcore.RequestOptionFunc
+ curlNum int
+}
+
+func (iterator *ListEvaluationIterator) Next() (bool, *Evaluation, error) {
+ // 达到最大量,则返回
+ if iterator.limit > 0 && iterator.curlNum >= iterator.limit {
+ return false, nil, nil
+ }
+
+ // 为0则拉取数据
+ if iterator.index == 0 || iterator.index >= len(iterator.items) {
+ if iterator.index != 0 && iterator.nextPageToken == nil {
+ return false, nil, nil
+ }
+ if iterator.nextPageToken != nil {
+ iterator.req.apiReq.QueryParams.Set("page_token", *iterator.nextPageToken)
+ }
+ resp, err := iterator.listFunc(iterator.ctx, iterator.req, iterator.options...)
+ if err != nil {
+ return false, nil, err
+ }
+
+ if resp.Code != 0 {
+ return false, nil, errors.New(fmt.Sprintf("Code:%d,Msg:%s", resp.Code, resp.Msg))
+ }
+
+ if len(resp.Data.Items) == 0 {
+ return false, nil, nil
+ }
+
+ iterator.nextPageToken = resp.Data.PageToken
+ iterator.items = resp.Data.Items
+ iterator.index = 0
+ }
+
+ block := iterator.items[iterator.index]
+ iterator.index++
+ iterator.curlNum++
+ return true, block, nil
+}
+
+func (iterator *ListEvaluationIterator) NextPageToken() *string {
+ return iterator.nextPageToken
+}
+
type ListResumeSourceIterator struct {
nextPageToken *string
items []*ResumeSource
@@ -35319,3 +38232,57 @@ func (iterator *ListResumeSourceIterator) Next() (bool, *ResumeSource, error) {
func (iterator *ListResumeSourceIterator) NextPageToken() *string {
return iterator.nextPageToken
}
+
+type ListTalentFolderIterator struct {
+ nextPageToken *string
+ items []*TalentFolder
+ index int
+ limit int
+ ctx context.Context
+ req *ListTalentFolderReq
+ listFunc func(ctx context.Context, req *ListTalentFolderReq, options ...larkcore.RequestOptionFunc) (*ListTalentFolderResp, error)
+ options []larkcore.RequestOptionFunc
+ curlNum int
+}
+
+func (iterator *ListTalentFolderIterator) Next() (bool, *TalentFolder, error) {
+ // 达到最大量,则返回
+ if iterator.limit > 0 && iterator.curlNum >= iterator.limit {
+ return false, nil, nil
+ }
+
+ // 为0则拉取数据
+ if iterator.index == 0 || iterator.index >= len(iterator.items) {
+ if iterator.index != 0 && iterator.nextPageToken == nil {
+ return false, nil, nil
+ }
+ if iterator.nextPageToken != nil {
+ iterator.req.apiReq.QueryParams.Set("page_token", *iterator.nextPageToken)
+ }
+ resp, err := iterator.listFunc(iterator.ctx, iterator.req, iterator.options...)
+ if err != nil {
+ return false, nil, err
+ }
+
+ if resp.Code != 0 {
+ return false, nil, errors.New(fmt.Sprintf("Code:%d,Msg:%s", resp.Code, resp.Msg))
+ }
+
+ if len(resp.Data.Items) == 0 {
+ return false, nil, nil
+ }
+
+ iterator.nextPageToken = resp.Data.PageToken
+ iterator.items = resp.Data.Items
+ iterator.index = 0
+ }
+
+ block := iterator.items[iterator.index]
+ iterator.index++
+ iterator.curlNum++
+ return true, block, nil
+}
+
+func (iterator *ListTalentFolderIterator) NextPageToken() *string {
+ return iterator.nextPageToken
+}
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/im/v1/api.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/im/v1/api.go
index 47399e0e3e..5829a34c29 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/im/v1/api.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/im/v1/api.go
@@ -60,7 +60,7 @@ type ImService struct {
ChatTopNotice *chatTopNotice // chat.top_notice
File *file // 消息 - 文件信息
Image *image // 消息 - 图片信息
- Message *message // 消息加急
+ Message *message // 消息 - 消息卡片
MessageReaction *messageReaction // 消息 - 表情回复
MessageResource *messageResource // message.resource
Pin *pin // 消息 - Pin
@@ -1259,6 +1259,32 @@ func (m *message) Delete(ctx context.Context, req *DeleteMessageReq, options ...
return resp, err
}
+//
+//
+// - 转发一条消息
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=forward&project=im&resource=message&version=v1
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/imv1/forward_message.go
+func (m *message) Forward(ctx context.Context, req *ForwardMessageReq, options ...larkcore.RequestOptionFunc) (*ForwardMessageResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/im/v1/messages/:message_id/forward"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, m.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ForwardMessageResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, m.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
// 获取指定消息的内容
//
// - 通过 message_id 查询消息内容。
@@ -1325,6 +1351,32 @@ func (m *message) ListByIterator(ctx context.Context, req *ListMessageReq, optio
limit: req.Limit}, nil
}
+//
+//
+// - 合并转发多条消息
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=merge_forward&project=im&resource=message&version=v1
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/imv1/mergeForward_message.go
+func (m *message) MergeForward(ctx context.Context, req *MergeForwardMessageReq, options ...larkcore.RequestOptionFunc) (*MergeForwardMessageResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/im/v1/messages/merge_forward"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, m.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &MergeForwardMessageResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, m.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
// 更新应用发送的消息
//
// - 更新应用已发送的消息卡片内容。
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/im/v1/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/im/v1/model.go
index 86607069f8..707cdb30ef 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/im/v1/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/im/v1/model.go
@@ -54,6 +54,11 @@ const (
UserIdTypeListChatOpenId = "open_id" // 以open_id来识别用户
)
+const (
+ SortTypeByCreateTimeAsc = "ByCreateTimeAsc" // 按群组创建时间升序排列
+ SortTypeByActiveTimeDesc = "ByActiveTimeDesc" // 按群组活跃时间降序排列
+)
+
const (
UserIdTypeSearchChatUserId = "user_id" // 以user_id来识别用户
UserIdTypeSearchChatUnionId = "union_id" // 以union_id来识别用户
@@ -148,6 +153,27 @@ const (
ReceiveIdTypeChatId = "chat_id" // 以chat_id来识别群聊
)
+const (
+ ReceiveIdTypeForwardMessageOpenId = "open_id" // 标识一个用户在某个应用中的身份。同一个用户在不同应用中的 Open ID 不同。
+ ReceiveIdTypeForwardMessageUserId = "user_id" // 标识一个用户在某个租户内的身份。同一个用户在租户 A 和租户 B 内的 User ID 是不同的。在同一个租户内,一个用户的 User ID 在所有应用(包括商店应用)中都保持一致。User ID 主要用于在不同的应用间打通用户数据。
+ ReceiveIdTypeForwardMessageUnionId = "union_id" // 标识一个用户在某个应用开发商下的身份。同一用户在同一开发商下的应用中的 Union ID 是相同的,在不同开发商下的应用中的 Union ID 是不同的。通过 Union ID,应用开发商可以把同个用户在多个应用中的身份关联起来。
+ ReceiveIdTypeForwardMessageEmail = "email" // 以用户的真实邮箱来标识用户。
+ ReceiveIdTypeForwardMessageChatId = "chat_id" // 以群ID来标识群聊。
+)
+
+const (
+ SortTypeListMessageByCreateTimeAsc = "ByCreateTimeAsc" // 按消息创建时间升序排列
+ SortTypeListMessageByCreateTimeDesc = "ByCreateTimeDesc" // 按消息创建时间降序排列
+)
+
+const (
+ ReceiveIdTypeMergeForwardMessageOpenId = "open_id" // 标识一个用户在某个应用中的身份。同一个用户在不同应用中的 Open ID 不同。
+ ReceiveIdTypeMergeForwardMessageUserId = "user_id" // 标识一个用户在某个租户内的身份。同一个用户在租户 A 和租户 B 内的 User ID 是不同的。在同一个租户内,一个用户的 User ID 在所有应用(包括商店应用)中都保持一致。User ID 主要用于在不同的应用间打通用户数据。
+ ReceiveIdTypeMergeForwardMessageUnionId = "union_id" // 标识一个用户在某个应用开发商下的身份。同一用户在同一开发商下的应用中的 Union ID 是相同的,在不同开发商下的应用中的 Union ID 是不同的。通过 Union ID,应用开发商可以把同个用户在多个应用中的身份关联起来。
+ ReceiveIdTypeMergeForwardMessageEmail = "email" // 以用户的真实邮箱来标识用户。
+ ReceiveIdTypeMergeForwardMessageChatId = "chat_id" // 以群ID来标识群聊。
+)
+
const (
UserIdTypeReadUsersMessageUserId = "user_id" // 以user_id来识别用户
UserIdTypeReadUsersMessageUnionId = "union_id" // 以union_id来识别用户
@@ -1071,6 +1097,7 @@ type ChatChange struct {
ModerationPermission *string `json:"moderation_permission,omitempty"` // 发言权限(all_members/only_owner)
OwnerId *UserId `json:"owner_id,omitempty"` // 用户 ID
+ RestrictedModeSetting *RestrictedModeSetting `json:"restricted_mode_setting,omitempty"` // 防泄密模式设置
}
type ChatChangeBuilder struct {
@@ -1100,6 +1127,9 @@ type ChatChangeBuilder struct {
moderationPermissionFlag bool
ownerId *UserId // 用户 ID
ownerIdFlag bool
+
+ restrictedModeSetting *RestrictedModeSetting // 防泄密模式设置
+ restrictedModeSettingFlag bool
}
func NewChatChangeBuilder() *ChatChangeBuilder {
@@ -1224,6 +1254,15 @@ func (builder *ChatChangeBuilder) OwnerId(ownerId *UserId) *ChatChangeBuilder {
return builder
}
+// 防泄密模式设置
+//
+// 示例值:
+func (builder *ChatChangeBuilder) RestrictedModeSetting(restrictedModeSetting *RestrictedModeSetting) *ChatChangeBuilder {
+ builder.restrictedModeSetting = restrictedModeSetting
+ builder.restrictedModeSettingFlag = true
+ return builder
+}
+
func (builder *ChatChangeBuilder) Build() *ChatChange {
req := &ChatChange{}
if builder.avatarFlag {
@@ -1277,6 +1316,9 @@ func (builder *ChatChangeBuilder) Build() *ChatChange {
req.OwnerId = builder.ownerId
}
+ if builder.restrictedModeSettingFlag {
+ req.RestrictedModeSetting = builder.restrictedModeSetting
+ }
return req
}
@@ -1691,6 +1733,54 @@ func (builder *ChatTabContentBuilder) Build() *ChatTabContent {
return req
}
+type Crc32Item struct {
+ PartId *string `json:"part_id,omitempty"` // 分片编号(1开始)
+ Crc32 *string `json:"crc32,omitempty"` // crc32校验
+}
+
+type Crc32ItemBuilder struct {
+ partId string // 分片编号(1开始)
+ partIdFlag bool
+ crc32 string // crc32校验
+ crc32Flag bool
+}
+
+func NewCrc32ItemBuilder() *Crc32ItemBuilder {
+ builder := &Crc32ItemBuilder{}
+ return builder
+}
+
+// 分片编号(1开始)
+//
+// 示例值:1
+func (builder *Crc32ItemBuilder) PartId(partId string) *Crc32ItemBuilder {
+ builder.partId = partId
+ builder.partIdFlag = true
+ return builder
+}
+
+// crc32校验
+//
+// 示例值:12342388237783212356
+func (builder *Crc32ItemBuilder) Crc32(crc32 string) *Crc32ItemBuilder {
+ builder.crc32 = crc32
+ builder.crc32Flag = true
+ return builder
+}
+
+func (builder *Crc32ItemBuilder) Build() *Crc32Item {
+ req := &Crc32Item{}
+ if builder.partIdFlag {
+ req.PartId = &builder.partId
+
+ }
+ if builder.crc32Flag {
+ req.Crc32 = &builder.crc32
+
+ }
+ return req
+}
+
type Emoji struct {
EmojiType *string `json:"emoji_type,omitempty"` // emoji类型 [emoji类型列举](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message-reaction/emojis-introduce)
}
@@ -3959,6 +4049,86 @@ func (builder *ReadUserBuilder) Build() *ReadUser {
return req
}
+type RestrictedModeSetting struct {
+ Status *bool `json:"status,omitempty"` // 防泄密模式是否开启
+ ScreenshotHasPermissionSetting *string `json:"screenshot_has_permission_setting,omitempty"` // 允许截屏录屏
+ DownloadHasPermissionSetting *string `json:"download_has_permission_setting,omitempty"` // 允许下载消息中图片、视频和文件
+ MessageHasPermissionSetting *string `json:"message_has_permission_setting,omitempty"` // 允许复制和转发消息
+}
+
+type RestrictedModeSettingBuilder struct {
+ status bool // 防泄密模式是否开启
+ statusFlag bool
+ screenshotHasPermissionSetting string // 允许截屏录屏
+ screenshotHasPermissionSettingFlag bool
+ downloadHasPermissionSetting string // 允许下载消息中图片、视频和文件
+ downloadHasPermissionSettingFlag bool
+ messageHasPermissionSetting string // 允许复制和转发消息
+ messageHasPermissionSettingFlag bool
+}
+
+func NewRestrictedModeSettingBuilder() *RestrictedModeSettingBuilder {
+ builder := &RestrictedModeSettingBuilder{}
+ return builder
+}
+
+// 防泄密模式是否开启
+//
+// 示例值:true
+func (builder *RestrictedModeSettingBuilder) Status(status bool) *RestrictedModeSettingBuilder {
+ builder.status = status
+ builder.statusFlag = true
+ return builder
+}
+
+// 允许截屏录屏
+//
+// 示例值:all_members
+func (builder *RestrictedModeSettingBuilder) ScreenshotHasPermissionSetting(screenshotHasPermissionSetting string) *RestrictedModeSettingBuilder {
+ builder.screenshotHasPermissionSetting = screenshotHasPermissionSetting
+ builder.screenshotHasPermissionSettingFlag = true
+ return builder
+}
+
+// 允许下载消息中图片、视频和文件
+//
+// 示例值:all_members
+func (builder *RestrictedModeSettingBuilder) DownloadHasPermissionSetting(downloadHasPermissionSetting string) *RestrictedModeSettingBuilder {
+ builder.downloadHasPermissionSetting = downloadHasPermissionSetting
+ builder.downloadHasPermissionSettingFlag = true
+ return builder
+}
+
+// 允许复制和转发消息
+//
+// 示例值:all_members
+func (builder *RestrictedModeSettingBuilder) MessageHasPermissionSetting(messageHasPermissionSetting string) *RestrictedModeSettingBuilder {
+ builder.messageHasPermissionSetting = messageHasPermissionSetting
+ builder.messageHasPermissionSettingFlag = true
+ return builder
+}
+
+func (builder *RestrictedModeSettingBuilder) Build() *RestrictedModeSetting {
+ req := &RestrictedModeSetting{}
+ if builder.statusFlag {
+ req.Status = &builder.status
+
+ }
+ if builder.screenshotHasPermissionSettingFlag {
+ req.ScreenshotHasPermissionSetting = &builder.screenshotHasPermissionSetting
+
+ }
+ if builder.downloadHasPermissionSettingFlag {
+ req.DownloadHasPermissionSetting = &builder.downloadHasPermissionSetting
+
+ }
+ if builder.messageHasPermissionSettingFlag {
+ req.MessageHasPermissionSetting = &builder.messageHasPermissionSetting
+
+ }
+ return req
+}
+
type Sender struct {
Id *string `json:"id,omitempty"` // 该字段标识发送者的id
IdType *string `json:"id_type,omitempty"` // 该字段标识发送者的id类型;;**可选值有:**;- `open_id`;- `app_id`
@@ -4707,6 +4877,9 @@ type CreateChatReqBodyBuilder struct {
leaveMessageVisibilityFlag bool
membershipApproval string // 加群审批;;**可选值有**:;- `no_approval_required`:无需审批;- `approval_required`:需要审批
membershipApprovalFlag bool
+
+ restrictedModeSetting *RestrictedModeSetting // 防泄密模式设置
+ restrictedModeSettingFlag bool
}
func NewCreateChatReqBodyBuilder() *CreateChatReqBodyBuilder {
@@ -4831,6 +5004,15 @@ func (builder *CreateChatReqBodyBuilder) MembershipApproval(membershipApproval s
return builder
}
+// 防泄密模式设置
+//
+//示例值:
+func (builder *CreateChatReqBodyBuilder) RestrictedModeSetting(restrictedModeSetting *RestrictedModeSetting) *CreateChatReqBodyBuilder {
+ builder.restrictedModeSetting = restrictedModeSetting
+ builder.restrictedModeSettingFlag = true
+ return builder
+}
+
func (builder *CreateChatReqBodyBuilder) Build() *CreateChatReqBody {
req := &CreateChatReqBody{}
if builder.avatarFlag {
@@ -4872,6 +5054,9 @@ func (builder *CreateChatReqBodyBuilder) Build() *CreateChatReqBody {
if builder.membershipApprovalFlag {
req.MembershipApproval = &builder.membershipApproval
}
+ if builder.restrictedModeSettingFlag {
+ req.RestrictedModeSetting = builder.restrictedModeSetting
+ }
return req
}
@@ -4906,6 +5091,8 @@ type CreateChatPathReqBodyBuilder struct {
labelsFlag bool
toolkitIds []string // 群快捷组件列表
toolkitIdsFlag bool
+ restrictedModeSetting *RestrictedModeSetting // 防泄密模式设置
+ restrictedModeSettingFlag bool
}
func NewCreateChatPathReqBodyBuilder() *CreateChatPathReqBodyBuilder {
@@ -5030,6 +5217,15 @@ func (builder *CreateChatPathReqBodyBuilder) MembershipApproval(membershipApprov
return builder
}
+// 防泄密模式设置
+//
+// 示例值:
+func (builder *CreateChatPathReqBodyBuilder) RestrictedModeSetting(restrictedModeSetting *RestrictedModeSetting) *CreateChatPathReqBodyBuilder {
+ builder.restrictedModeSetting = restrictedModeSetting
+ builder.restrictedModeSettingFlag = true
+ return builder
+}
+
func (builder *CreateChatPathReqBodyBuilder) Build() (*CreateChatReqBody, error) {
req := &CreateChatReqBody{}
if builder.avatarFlag {
@@ -5071,6 +5267,9 @@ func (builder *CreateChatPathReqBodyBuilder) Build() (*CreateChatReqBody, error)
if builder.membershipApprovalFlag {
req.MembershipApproval = &builder.membershipApproval
}
+ if builder.restrictedModeSettingFlag {
+ req.RestrictedModeSetting = builder.restrictedModeSetting
+ }
return req, nil
}
@@ -5141,6 +5340,7 @@ type CreateChatReqBody struct {
LeaveMessageVisibility *string `json:"leave_message_visibility,omitempty"` // 退群消息可见性;;**可选值有**:;- `only_owner`:仅群主和管理员可见;- `all_members`:所有成员可见;- `not_anyone`:任何人均不可见
MembershipApproval *string `json:"membership_approval,omitempty"` // 加群审批;;**可选值有**:;- `no_approval_required`:无需审批;- `approval_required`:需要审批
+ RestrictedModeSetting *RestrictedModeSetting `json:"restricted_mode_setting,omitempty"` // 防泄密模式设置
}
type CreateChatReq struct {
@@ -5170,6 +5370,7 @@ type CreateChatRespData struct {
MembershipApproval *string `json:"membership_approval,omitempty"` // 加群审批;;**可选值有**:;- `no_approval_required`:无需审批;- `approval_required`:需要审批
ModerationPermission *string `json:"moderation_permission,omitempty"` // 发言权限;;**可选值有**:;- `only_owner`:仅群主和管理员;- `all_members`:所有成员;- `moderator_list`:指定群成员
+ RestrictedModeSetting *RestrictedModeSetting `json:"restricted_mode_setting,omitempty"` // 防泄密模式设置
}
type CreateChatResp struct {
@@ -5275,6 +5476,8 @@ type GetChatRespData struct {
EditPermission *string `json:"edit_permission,omitempty"` // 群编辑权限;;**可选值有**:;- `only_owner`:仅群主和管理员;- `all_members`:所有成员
OwnerIdType *string `json:"owner_id_type,omitempty"` // 群主 ID 对应的ID类型,与查询参数中的 ==user_id_type== 相同。取值为:`open_id`、`user_id`、`union_id`其中之一;;**注意**:;- 当群主是机器人时不返回该字段;- 单聊不返回该字段
OwnerId *string `json:"owner_id,omitempty"` // 群主 ID,ID值与查询参数中的 ==user_id_type== 对应;不同 ID 的说明参见 [用户相关的 ID 概念](https://open.feishu.cn/document/home/user-identity-introduction/introduction);;**注意**:;- 当群主是机器人时不返回该字段;- 单聊不返回该字段
+ UserManagerIdList []string `json:"user_manager_id_list,omitempty"` // 用户管理员列表
+ BotManagerIdList []string `json:"bot_manager_id_list,omitempty"` // 机器人管理员列表
ChatMode *string `json:"chat_mode,omitempty"` // 群模式;;**可选值有**:;- `group`:群组;- `topic`: 话题;- `p2p`: 单聊
ChatType *string `json:"chat_type,omitempty"` // 群类型;;**可选值有**:;- `private`:私有群;- `public`:公开群;;**注意**:单聊不返回该字段
ChatTag *string `json:"chat_tag,omitempty"` // 群标签,如有多个,则按照下列顺序返回第一个;;**可选值有**:;- `inner`:内部群;- `tenant`:公司群;- `department`:部门群;- `edu`:教育群;- `meeting`:会议群;- `customer_service`:客服群;;**注意**:单聊不返回该字段
@@ -5287,6 +5490,7 @@ type GetChatRespData struct {
UserCount *string `json:"user_count,omitempty"` // 群成员人数
BotCount *string `json:"bot_count,omitempty"` // 群机器人数
+ RestrictedModeSetting *RestrictedModeSetting `json:"restricted_mode_setting,omitempty"` // 防泄密模式设置
}
type GetChatResp struct {
@@ -5442,7 +5646,15 @@ func (builder *ListChatReqBuilder) UserIdType(userIdType string) *ListChatReqBui
return builder
}
+// 群组排序方式
//
+// 示例值:ByCreateTimeAsc
+func (builder *ListChatReqBuilder) SortType(sortType string) *ListChatReqBuilder {
+ builder.apiReq.QueryParams.Set("sort_type", fmt.Sprint(sortType))
+ return builder
+}
+
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==
func (builder *ListChatReqBuilder) PageToken(pageToken string) *ListChatReqBuilder {
@@ -5450,7 +5662,7 @@ func (builder *ListChatReqBuilder) PageToken(pageToken string) *ListChatReqBuild
return builder
}
-//
+// 分页大小
//
// 示例值:10
func (builder *ListChatReqBuilder) PageSize(pageSize int) *ListChatReqBuilder {
@@ -5474,8 +5686,8 @@ type ListChatReq struct {
type ListChatRespData struct {
Items []*ListChat `json:"items,omitempty"` // chat 列表
- PageToken *string `json:"page_token,omitempty"` //
- HasMore *bool `json:"has_more,omitempty"` //
+ PageToken *string `json:"page_token,omitempty"` // 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 page_token
+ HasMore *bool `json:"has_more,omitempty"` // 是否还有更多项
}
type ListChatResp struct {
@@ -5524,7 +5736,7 @@ func (builder *SearchChatReqBuilder) Query(query string) *SearchChatReqBuilder {
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==
func (builder *SearchChatReqBuilder) PageToken(pageToken string) *SearchChatReqBuilder {
@@ -5532,7 +5744,7 @@ func (builder *SearchChatReqBuilder) PageToken(pageToken string) *SearchChatReqB
return builder
}
-//
+// 分页大小
//
// 示例值:10
func (builder *SearchChatReqBuilder) PageSize(pageSize int) *SearchChatReqBuilder {
@@ -5556,7 +5768,7 @@ type SearchChatReq struct {
type SearchChatRespData struct {
Items []*ListChat `json:"items,omitempty"` // chat 列表
- PageToken *string `json:"page_token,omitempty"` //
+ PageToken *string `json:"page_token,omitempty"` // 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 page_token
HasMore *bool `json:"has_more,omitempty"` // 是否还有更多群组
}
@@ -5596,8 +5808,10 @@ type UpdateChatReqBodyBuilder struct {
membershipApproval string // 加群审批;;**可选值有**:;- `no_approval_required`:无需审批;- `approval_required`:需要审批
membershipApprovalFlag bool
- chatType string // 群类型;;**可选值有**:;- `private`:私有群;- `public`:公开群
- chatTypeFlag bool
+ restrictedModeSetting *RestrictedModeSetting // 防泄密模式设置
+ restrictedModeSettingFlag bool
+ chatType string // 群类型;;**可选值有**:;- `private`:私有群;- `public`:公开群
+ chatTypeFlag bool
}
func NewUpdateChatReqBodyBuilder() *UpdateChatReqBodyBuilder {
@@ -5713,6 +5927,15 @@ func (builder *UpdateChatReqBodyBuilder) MembershipApproval(membershipApproval s
return builder
}
+// 防泄密模式设置
+//
+//示例值:
+func (builder *UpdateChatReqBodyBuilder) RestrictedModeSetting(restrictedModeSetting *RestrictedModeSetting) *UpdateChatReqBodyBuilder {
+ builder.restrictedModeSetting = restrictedModeSetting
+ builder.restrictedModeSettingFlag = true
+ return builder
+}
+
// 群类型;;**可选值有**:;- `private`:私有群;- `public`:公开群
//
//示例值:private
@@ -5760,6 +5983,9 @@ func (builder *UpdateChatReqBodyBuilder) Build() *UpdateChatReqBody {
if builder.membershipApprovalFlag {
req.MembershipApproval = &builder.membershipApproval
}
+ if builder.restrictedModeSettingFlag {
+ req.RestrictedModeSetting = builder.restrictedModeSetting
+ }
if builder.chatTypeFlag {
req.ChatType = &builder.chatType
}
@@ -5795,6 +6021,8 @@ type UpdateChatPathReqBodyBuilder struct {
labelsFlag bool
toolkitIds []string // 群快捷组件列表
toolkitIdsFlag bool
+ restrictedModeSetting *RestrictedModeSetting // 防泄密模式设置
+ restrictedModeSettingFlag bool
chatType string // 群类型;;**可选值有**:;- `private`:私有群;- `public`:公开群
chatTypeFlag bool
}
@@ -5912,6 +6140,15 @@ func (builder *UpdateChatPathReqBodyBuilder) MembershipApproval(membershipApprov
return builder
}
+// 防泄密模式设置
+//
+// 示例值:
+func (builder *UpdateChatPathReqBodyBuilder) RestrictedModeSetting(restrictedModeSetting *RestrictedModeSetting) *UpdateChatPathReqBodyBuilder {
+ builder.restrictedModeSetting = restrictedModeSetting
+ builder.restrictedModeSettingFlag = true
+ return builder
+}
+
// 群类型;;**可选值有**:;- `private`:私有群;- `public`:公开群
//
// 示例值:private
@@ -5959,6 +6196,9 @@ func (builder *UpdateChatPathReqBodyBuilder) Build() (*UpdateChatReqBody, error)
if builder.membershipApprovalFlag {
req.MembershipApproval = &builder.membershipApproval
}
+ if builder.restrictedModeSettingFlag {
+ req.RestrictedModeSetting = builder.restrictedModeSetting
+ }
if builder.chatTypeFlag {
req.ChatType = &builder.chatType
}
@@ -6024,7 +6264,8 @@ type UpdateChatReqBody struct {
LeaveMessageVisibility *string `json:"leave_message_visibility,omitempty"` // 出群消息可见性;;**可选值有**:;- `only_owner`:仅群主和管理员可见;- `all_members`:所有成员可见;- `not_anyone`:任何人均不可见
MembershipApproval *string `json:"membership_approval,omitempty"` // 加群审批;;**可选值有**:;- `no_approval_required`:无需审批;- `approval_required`:需要审批
- ChatType *string `json:"chat_type,omitempty"` // 群类型;;**可选值有**:;- `private`:私有群;- `public`:公开群
+ RestrictedModeSetting *RestrictedModeSetting `json:"restricted_mode_setting,omitempty"` // 防泄密模式设置
+ ChatType *string `json:"chat_type,omitempty"` // 群类型;;**可选值有**:;- `private`:私有群;- `public`:公开群
}
type UpdateChatReq struct {
@@ -6603,8 +6844,9 @@ type CreateChatMembersReq struct {
}
type CreateChatMembersRespData struct {
- InvalidIdList []string `json:"invalid_id_list,omitempty"` // 无效成员列表;;**注意**:;- 当`success_type=0`时,`invalid_id_list`只包含已离职的用户ID;- 当`success_type=1`时,`invalid_id_list`中包含已离职的、不可见的、应用未激活的ID
- NotExistedIdList []string `json:"not_existed_id_list,omitempty"` // ID不存在的成员列表
+ InvalidIdList []string `json:"invalid_id_list,omitempty"` // 无效成员列表;;**注意**:;- 当`success_type=0`时,`invalid_id_list`只包含已离职的用户ID;- 当`success_type=1`时,`invalid_id_list`中包含已离职的、不可见的、应用未激活的ID
+ NotExistedIdList []string `json:"not_existed_id_list,omitempty"` // ID不存在的成员列表
+ PendingApprovalIdList []string `json:"pending_approval_id_list,omitempty"` // 等待群主或管理员审批的成员ID列表
}
type CreateChatMembersResp struct {
@@ -6775,19 +7017,19 @@ func (builder *GetChatMembersReqBuilder) MemberIdType(memberIdType string) *GetC
return builder
}
+// 分页大小
//
-//
-// 示例值:dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==
-func (builder *GetChatMembersReqBuilder) PageToken(pageToken string) *GetChatMembersReqBuilder {
- builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+// 示例值:10
+func (builder *GetChatMembersReqBuilder) PageSize(pageSize int) *GetChatMembersReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
return builder
}
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果
//
-//
-// 示例值:10
-func (builder *GetChatMembersReqBuilder) PageSize(pageSize int) *GetChatMembersReqBuilder {
- builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+// 示例值:dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==
+func (builder *GetChatMembersReqBuilder) PageToken(pageToken string) *GetChatMembersReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
return builder
}
@@ -6808,8 +7050,8 @@ type GetChatMembersReq struct {
type GetChatMembersRespData struct {
Items []*ListMember `json:"items,omitempty"` // 成员列表
- PageToken *string `json:"page_token,omitempty"` //
- HasMore *bool `json:"has_more,omitempty"` //
+ PageToken *string `json:"page_token,omitempty"` // 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 page_token
+ HasMore *bool `json:"has_more,omitempty"` // 是否还有更多项
MemberTotal *int `json:"member_total,omitempty"` // 成员总数
}
@@ -7481,19 +7723,19 @@ func (builder *GetChatModerationReqBuilder) UserIdType(userIdType string) *GetCh
return builder
}
+// 分页大小
//
-//
-// 示例值:dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==
-func (builder *GetChatModerationReqBuilder) PageToken(pageToken string) *GetChatModerationReqBuilder {
- builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+// 示例值:10
+func (builder *GetChatModerationReqBuilder) PageSize(pageSize int) *GetChatModerationReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
return builder
}
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果
//
-//
-// 示例值:10
-func (builder *GetChatModerationReqBuilder) PageSize(pageSize int) *GetChatModerationReqBuilder {
- builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+// 示例值:dmJCRHhpd3JRbGV1VEVNRFFyTitRWDY5ZFkybmYrMEUwMUFYT0VMMWdENEtuYUhsNUxGMDIwemtvdE5ORjBNQQ==
+func (builder *GetChatModerationReqBuilder) PageToken(pageToken string) *GetChatModerationReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
return builder
}
@@ -7514,8 +7756,8 @@ type GetChatModerationReq struct {
type GetChatModerationRespData struct {
ModerationSetting *string `json:"moderation_setting,omitempty"` // 群发言模式(all_members/only_owner/moderator_list,其中 moderator_list 表示部分用户可发言的模式)
- PageToken *string `json:"page_token,omitempty"` //
- HasMore *bool `json:"has_more,omitempty"` //
+ PageToken *string `json:"page_token,omitempty"` // 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 page_token
+ HasMore *bool `json:"has_more,omitempty"` // 是否还有更多项
Items []*ListModerator `json:"items,omitempty"` // 可发言用户列表
}
@@ -9048,6 +9290,148 @@ func (resp *DeleteMessageResp) Success() bool {
return resp.Code == 0
}
+type ForwardMessageReqBodyBuilder struct {
+ receiveId string // 依据receive_id_type的值,填写对应的转发目标的ID
+ receiveIdFlag bool
+}
+
+func NewForwardMessageReqBodyBuilder() *ForwardMessageReqBodyBuilder {
+ builder := &ForwardMessageReqBodyBuilder{}
+ return builder
+}
+
+// 依据receive_id_type的值,填写对应的转发目标的ID
+//
+//示例值:oc_a0553eda9014c201e6969b478895c230
+func (builder *ForwardMessageReqBodyBuilder) ReceiveId(receiveId string) *ForwardMessageReqBodyBuilder {
+ builder.receiveId = receiveId
+ builder.receiveIdFlag = true
+ return builder
+}
+
+func (builder *ForwardMessageReqBodyBuilder) Build() *ForwardMessageReqBody {
+ req := &ForwardMessageReqBody{}
+ if builder.receiveIdFlag {
+ req.ReceiveId = &builder.receiveId
+ }
+ return req
+}
+
+type ForwardMessagePathReqBodyBuilder struct {
+ receiveId string // 依据receive_id_type的值,填写对应的转发目标的ID
+ receiveIdFlag bool
+}
+
+func NewForwardMessagePathReqBodyBuilder() *ForwardMessagePathReqBodyBuilder {
+ builder := &ForwardMessagePathReqBodyBuilder{}
+ return builder
+}
+
+// 依据receive_id_type的值,填写对应的转发目标的ID
+//
+// 示例值:oc_a0553eda9014c201e6969b478895c230
+func (builder *ForwardMessagePathReqBodyBuilder) ReceiveId(receiveId string) *ForwardMessagePathReqBodyBuilder {
+ builder.receiveId = receiveId
+ builder.receiveIdFlag = true
+ return builder
+}
+
+func (builder *ForwardMessagePathReqBodyBuilder) Build() (*ForwardMessageReqBody, error) {
+ req := &ForwardMessageReqBody{}
+ if builder.receiveIdFlag {
+ req.ReceiveId = &builder.receiveId
+ }
+ return req, nil
+}
+
+type ForwardMessageReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *ForwardMessageReqBody
+}
+
+func NewForwardMessageReqBuilder() *ForwardMessageReqBuilder {
+ builder := &ForwardMessageReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 要转发的消息ID
+//
+// 示例值:om_dc13264520392913993dd051dba21dcf
+func (builder *ForwardMessageReqBuilder) MessageId(messageId string) *ForwardMessageReqBuilder {
+ builder.apiReq.PathParams.Set("message_id", fmt.Sprint(messageId))
+ return builder
+}
+
+// 消息接收者id类型 open_id/user_id/union_id/email/chat_id
+//
+// 示例值:
+func (builder *ForwardMessageReqBuilder) ReceiveIdType(receiveIdType string) *ForwardMessageReqBuilder {
+ builder.apiReq.QueryParams.Set("receive_id_type", fmt.Sprint(receiveIdType))
+ return builder
+}
+
+// 由开发者生成的唯一字符串序列,用于转发消息请求去重;持有相同uuid的请求在1小时内向同一个目标的转发只可成功一次。
+//
+// 示例值:b13g2t38-1jd2-458b-8djf-dtbca5104204
+func (builder *ForwardMessageReqBuilder) Uuid(uuid string) *ForwardMessageReqBuilder {
+ builder.apiReq.QueryParams.Set("uuid", fmt.Sprint(uuid))
+ return builder
+}
+
+// 转发一条消息
+func (builder *ForwardMessageReqBuilder) Body(body *ForwardMessageReqBody) *ForwardMessageReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *ForwardMessageReqBuilder) Build() *ForwardMessageReq {
+ req := &ForwardMessageReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type ForwardMessageReqBody struct {
+ ReceiveId *string `json:"receive_id,omitempty"` // 依据receive_id_type的值,填写对应的转发目标的ID
+}
+
+type ForwardMessageReq struct {
+ apiReq *larkcore.ApiReq
+ Body *ForwardMessageReqBody `body:""`
+}
+
+type ForwardMessageRespData struct {
+ MessageId *string `json:"message_id,omitempty"` // 消息id open_message_id
+ RootId *string `json:"root_id,omitempty"` // 根消息id open_message_id
+ ParentId *string `json:"parent_id,omitempty"` // 父消息的id open_message_id
+ MsgType *string `json:"msg_type,omitempty"` // 消息类型 text post card image等等
+ CreateTime *string `json:"create_time,omitempty"` // 消息生成的时间戳(毫秒)
+ UpdateTime *string `json:"update_time,omitempty"` // 消息更新的时间戳
+ Deleted *bool `json:"deleted,omitempty"` // 消息是否被撤回
+ Updated *bool `json:"updated,omitempty"` // 消息是否被更新
+ ChatId *string `json:"chat_id,omitempty"` // 所属的群
+ Sender *Sender `json:"sender,omitempty"` // 发送者,可以是用户或应用
+ Body *MessageBody `json:"body,omitempty"` // 消息内容,json结构
+ Mentions []*Mention `json:"mentions,omitempty"` // 被艾特的人或应用的id
+ UpperMessageId *string `json:"upper_message_id,omitempty"` // 合并消息的上一层级消息id open_message_id
+}
+
+type ForwardMessageResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ForwardMessageRespData `json:"data"` // 业务数据
+}
+
+func (resp *ForwardMessageResp) Success() bool {
+ return resp.Code == 0
+}
+
type GetMessageReqBuilder struct {
apiReq *larkcore.ApiReq
}
@@ -9146,6 +9530,14 @@ func (builder *ListMessageReqBuilder) EndTime(endTime string) *ListMessageReqBui
return builder
}
+// 消息排序方式
+//
+// 示例值:ByCreateTimeAsc
+func (builder *ListMessageReqBuilder) SortType(sortType string) *ListMessageReqBuilder {
+ builder.apiReq.QueryParams.Set("sort_type", fmt.Sprint(sortType))
+ return builder
+}
+
// 分页大小
//
// 示例值:20
@@ -9154,7 +9546,7 @@ func (builder *ListMessageReqBuilder) PageSize(pageSize int) *ListMessageReqBuil
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:GxmvlNRvP0NdQZpa7yIqf_Lv_QuBwTQ8tXkX7w-irAghVD_TvuYd1aoJ1LQph86O-XImC4X9j9FhUPhXQDvtrQ==
func (builder *ListMessageReqBuilder) PageToken(pageToken string) *ListMessageReqBuilder {
@@ -9192,6 +9584,157 @@ func (resp *ListMessageResp) Success() bool {
return resp.Code == 0
}
+type MergeForwardMessageReqBodyBuilder struct {
+ receiveId string // 依据receive_id_type的值,填写对应的转发目标的ID
+ receiveIdFlag bool
+ messageIdList []string // 要转发的消息ID列表
+ messageIdListFlag bool
+}
+
+func NewMergeForwardMessageReqBodyBuilder() *MergeForwardMessageReqBodyBuilder {
+ builder := &MergeForwardMessageReqBodyBuilder{}
+ return builder
+}
+
+// 依据receive_id_type的值,填写对应的转发目标的ID
+//
+//示例值:oc_a0553eda9014c201e6969b478895c230
+func (builder *MergeForwardMessageReqBodyBuilder) ReceiveId(receiveId string) *MergeForwardMessageReqBodyBuilder {
+ builder.receiveId = receiveId
+ builder.receiveIdFlag = true
+ return builder
+}
+
+// 要转发的消息ID列表
+//
+//示例值:
+func (builder *MergeForwardMessageReqBodyBuilder) MessageIdList(messageIdList []string) *MergeForwardMessageReqBodyBuilder {
+ builder.messageIdList = messageIdList
+ builder.messageIdListFlag = true
+ return builder
+}
+
+func (builder *MergeForwardMessageReqBodyBuilder) Build() *MergeForwardMessageReqBody {
+ req := &MergeForwardMessageReqBody{}
+ if builder.receiveIdFlag {
+ req.ReceiveId = &builder.receiveId
+ }
+ if builder.messageIdListFlag {
+ req.MessageIdList = builder.messageIdList
+ }
+ return req
+}
+
+type MergeForwardMessagePathReqBodyBuilder struct {
+ receiveId string // 依据receive_id_type的值,填写对应的转发目标的ID
+ receiveIdFlag bool
+ messageIdList []string // 要转发的消息ID列表
+ messageIdListFlag bool
+}
+
+func NewMergeForwardMessagePathReqBodyBuilder() *MergeForwardMessagePathReqBodyBuilder {
+ builder := &MergeForwardMessagePathReqBodyBuilder{}
+ return builder
+}
+
+// 依据receive_id_type的值,填写对应的转发目标的ID
+//
+// 示例值:oc_a0553eda9014c201e6969b478895c230
+func (builder *MergeForwardMessagePathReqBodyBuilder) ReceiveId(receiveId string) *MergeForwardMessagePathReqBodyBuilder {
+ builder.receiveId = receiveId
+ builder.receiveIdFlag = true
+ return builder
+}
+
+// 要转发的消息ID列表
+//
+// 示例值:
+func (builder *MergeForwardMessagePathReqBodyBuilder) MessageIdList(messageIdList []string) *MergeForwardMessagePathReqBodyBuilder {
+ builder.messageIdList = messageIdList
+ builder.messageIdListFlag = true
+ return builder
+}
+
+func (builder *MergeForwardMessagePathReqBodyBuilder) Build() (*MergeForwardMessageReqBody, error) {
+ req := &MergeForwardMessageReqBody{}
+ if builder.receiveIdFlag {
+ req.ReceiveId = &builder.receiveId
+ }
+ if builder.messageIdListFlag {
+ req.MessageIdList = builder.messageIdList
+ }
+ return req, nil
+}
+
+type MergeForwardMessageReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *MergeForwardMessageReqBody
+}
+
+func NewMergeForwardMessageReqBuilder() *MergeForwardMessageReqBuilder {
+ builder := &MergeForwardMessageReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 消息接收者id类型 open_id/user_id/union_id/email/chat_id
+//
+// 示例值:
+func (builder *MergeForwardMessageReqBuilder) ReceiveIdType(receiveIdType string) *MergeForwardMessageReqBuilder {
+ builder.apiReq.QueryParams.Set("receive_id_type", fmt.Sprint(receiveIdType))
+ return builder
+}
+
+// 由开发者生成的唯一字符串序列,用于转发消息请求去重;持有相同uuid的请求在1小时内向同一个目标的转发只可成功一次。
+//
+// 示例值:b13g2t38-1jd2-458b-8djf-dtbca5104204
+func (builder *MergeForwardMessageReqBuilder) Uuid(uuid string) *MergeForwardMessageReqBuilder {
+ builder.apiReq.QueryParams.Set("uuid", fmt.Sprint(uuid))
+ return builder
+}
+
+// 合并转发多条消息
+func (builder *MergeForwardMessageReqBuilder) Body(body *MergeForwardMessageReqBody) *MergeForwardMessageReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *MergeForwardMessageReqBuilder) Build() *MergeForwardMessageReq {
+ req := &MergeForwardMessageReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type MergeForwardMessageReqBody struct {
+ ReceiveId *string `json:"receive_id,omitempty"` // 依据receive_id_type的值,填写对应的转发目标的ID
+ MessageIdList []string `json:"message_id_list,omitempty"` // 要转发的消息ID列表
+}
+
+type MergeForwardMessageReq struct {
+ apiReq *larkcore.ApiReq
+ Body *MergeForwardMessageReqBody `body:""`
+}
+
+type MergeForwardMessageRespData struct {
+ Message *Message `json:"message,omitempty"` // 合并转发生成的新消息
+ InvalidMessageIdList []string `json:"invalid_message_id_list,omitempty"` // 无效的消息ID列表
+}
+
+type MergeForwardMessageResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *MergeForwardMessageRespData `json:"data"` // 业务数据
+}
+
+func (resp *MergeForwardMessageResp) Success() bool {
+ return resp.Code == 0
+}
+
type PatchMessageReqBodyBuilder struct {
content string // 消息内容 json 格式,[发送消息 content 说明](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/im-v1/message/create_json),参考文档中的卡片格式
contentFlag bool
@@ -9644,7 +10187,7 @@ func (builder *UrgentPhoneMessageReqBuilder) MessageId(messageId string) *Urgent
// 此次调用中使用的用户ID的类型
//
-// 示例值:
+// 示例值:open_id
func (builder *UrgentPhoneMessageReqBuilder) UserIdType(userIdType string) *UrgentPhoneMessageReqBuilder {
builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
return builder
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/mail/v1/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/mail/v1/model.go
index 5144f2af97..616fd5f1a0 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/mail/v1/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/mail/v1/model.go
@@ -230,6 +230,54 @@ func (builder *EmailAliasBuilder) Build() *EmailAlias {
return req
}
+type MailAddress struct {
+ MailAddress *string `json:"mail_address,omitempty"` // 邮件地址
+ Name *string `json:"name,omitempty"` // 名称
+}
+
+type MailAddressBuilder struct {
+ mailAddress string // 邮件地址
+ mailAddressFlag bool
+ name string // 名称
+ nameFlag bool
+}
+
+func NewMailAddressBuilder() *MailAddressBuilder {
+ builder := &MailAddressBuilder{}
+ return builder
+}
+
+// 邮件地址
+//
+// 示例值:mike@outlook.com
+func (builder *MailAddressBuilder) MailAddress(mailAddress string) *MailAddressBuilder {
+ builder.mailAddress = mailAddress
+ builder.mailAddressFlag = true
+ return builder
+}
+
+// 名称
+//
+// 示例值:Mike
+func (builder *MailAddressBuilder) Name(name string) *MailAddressBuilder {
+ builder.name = name
+ builder.nameFlag = true
+ return builder
+}
+
+func (builder *MailAddressBuilder) Build() *MailAddress {
+ req := &MailAddress{}
+ if builder.mailAddressFlag {
+ req.MailAddress = &builder.mailAddress
+
+ }
+ if builder.nameFlag {
+ req.Name = &builder.name
+
+ }
+ return req
+}
+
type Mailgroup struct {
MailgroupId *string `json:"mailgroup_id,omitempty"` // 邮件组ID
Email *string `json:"email,omitempty"` // 邮件组地址
@@ -599,12 +647,45 @@ func (builder *MailgroupPermissionMemberBuilder) Build() *MailgroupPermissionMem
}
type Message struct {
- Raw *string `json:"raw,omitempty"` // MIME邮件数据,基于base64url编码
+ Raw *string `json:"raw,omitempty"` // MIME邮件数据,基于base64url编码
+ Subject *string `json:"subject,omitempty"` // 主题
+ To []*MailAddress `json:"to,omitempty"` // 收件人
+ Cc []*MailAddress `json:"cc,omitempty"` // 抄送
+ Bcc []*MailAddress `json:"bcc,omitempty"` // 秘送
+ HeadFrom *MailAddress `json:"head_from,omitempty"` // 发件人
+ BodyHtml *string `json:"body_html,omitempty"` // 正文(base64url)
+ InternalDate *string `json:"internal_date,omitempty"` // 创建/收/发信时间(毫秒)
+ MessageState *int `json:"message_state,omitempty"` // 邮件状态
+ SmtpMessageId *string `json:"smtp_message_id,omitempty"` // RFC协议id
+ MessageId *string `json:"message_id,omitempty"` // 邮件id
+ BodyPlainText *string `json:"body_plain_text,omitempty"` // 正文纯文本(base64url)
}
type MessageBuilder struct {
- raw string // MIME邮件数据,基于base64url编码
- rawFlag bool
+ raw string // MIME邮件数据,基于base64url编码
+ rawFlag bool
+ subject string // 主题
+ subjectFlag bool
+ to []*MailAddress // 收件人
+ toFlag bool
+ cc []*MailAddress // 抄送
+ ccFlag bool
+ bcc []*MailAddress // 秘送
+ bccFlag bool
+ headFrom *MailAddress // 发件人
+ headFromFlag bool
+ bodyHtml string // 正文(base64url)
+ bodyHtmlFlag bool
+ internalDate string // 创建/收/发信时间(毫秒)
+ internalDateFlag bool
+ messageState int // 邮件状态
+ messageStateFlag bool
+ smtpMessageId string // RFC协议id
+ smtpMessageIdFlag bool
+ messageId string // 邮件id
+ messageIdFlag bool
+ bodyPlainText string // 正文纯文本(base64url)
+ bodyPlainTextFlag bool
}
func NewMessageBuilder() *MessageBuilder {
@@ -621,11 +702,150 @@ func (builder *MessageBuilder) Raw(raw string) *MessageBuilder {
return builder
}
+// 主题
+//
+// 示例值:邮件标题
+func (builder *MessageBuilder) Subject(subject string) *MessageBuilder {
+ builder.subject = subject
+ builder.subjectFlag = true
+ return builder
+}
+
+// 收件人
+//
+// 示例值:
+func (builder *MessageBuilder) To(to []*MailAddress) *MessageBuilder {
+ builder.to = to
+ builder.toFlag = true
+ return builder
+}
+
+// 抄送
+//
+// 示例值:
+func (builder *MessageBuilder) Cc(cc []*MailAddress) *MessageBuilder {
+ builder.cc = cc
+ builder.ccFlag = true
+ return builder
+}
+
+// 秘送
+//
+// 示例值:
+func (builder *MessageBuilder) Bcc(bcc []*MailAddress) *MessageBuilder {
+ builder.bcc = bcc
+ builder.bccFlag = true
+ return builder
+}
+
+// 发件人
+//
+// 示例值:
+func (builder *MessageBuilder) HeadFrom(headFrom *MailAddress) *MessageBuilder {
+ builder.headFrom = headFrom
+ builder.headFromFlag = true
+ return builder
+}
+
+// 正文(base64url)
+//
+// 示例值:xxxx
+func (builder *MessageBuilder) BodyHtml(bodyHtml string) *MessageBuilder {
+ builder.bodyHtml = bodyHtml
+ builder.bodyHtmlFlag = true
+ return builder
+}
+
+// 创建/收/发信时间(毫秒)
+//
+// 示例值:1682377086000
+func (builder *MessageBuilder) InternalDate(internalDate string) *MessageBuilder {
+ builder.internalDate = internalDate
+ builder.internalDateFlag = true
+ return builder
+}
+
+// 邮件状态
+//
+// 示例值:1(收信)2(发信)3(草稿)
+func (builder *MessageBuilder) MessageState(messageState int) *MessageBuilder {
+ builder.messageState = messageState
+ builder.messageStateFlag = true
+ return builder
+}
+
+// RFC协议id
+//
+// 示例值:ay0azrJDvbs3FJAg@outlook.com
+func (builder *MessageBuilder) SmtpMessageId(smtpMessageId string) *MessageBuilder {
+ builder.smtpMessageId = smtpMessageId
+ builder.smtpMessageIdFlag = true
+ return builder
+}
+
+// 邮件id
+//
+// 示例值:tfuh9N4WnzU6jdDw=
+func (builder *MessageBuilder) MessageId(messageId string) *MessageBuilder {
+ builder.messageId = messageId
+ builder.messageIdFlag = true
+ return builder
+}
+
+// 正文纯文本(base64url)
+//
+// 示例值:xxxxx
+func (builder *MessageBuilder) BodyPlainText(bodyPlainText string) *MessageBuilder {
+ builder.bodyPlainText = bodyPlainText
+ builder.bodyPlainTextFlag = true
+ return builder
+}
+
func (builder *MessageBuilder) Build() *Message {
req := &Message{}
if builder.rawFlag {
req.Raw = &builder.raw
+ }
+ if builder.subjectFlag {
+ req.Subject = &builder.subject
+
+ }
+ if builder.toFlag {
+ req.To = builder.to
+ }
+ if builder.ccFlag {
+ req.Cc = builder.cc
+ }
+ if builder.bccFlag {
+ req.Bcc = builder.bcc
+ }
+ if builder.headFromFlag {
+ req.HeadFrom = builder.headFrom
+ }
+ if builder.bodyHtmlFlag {
+ req.BodyHtml = &builder.bodyHtml
+
+ }
+ if builder.internalDateFlag {
+ req.InternalDate = &builder.internalDate
+
+ }
+ if builder.messageStateFlag {
+ req.MessageState = &builder.messageState
+
+ }
+ if builder.smtpMessageIdFlag {
+ req.SmtpMessageId = &builder.smtpMessageId
+
+ }
+ if builder.messageIdFlag {
+ req.MessageId = &builder.messageId
+
+ }
+ if builder.bodyPlainTextFlag {
+ req.BodyPlainText = &builder.bodyPlainText
+
}
return req
}
@@ -1005,7 +1225,7 @@ func (builder *ListMailgroupReqBuilder) UserIdType(userIdType string) *ListMailg
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:xxx
func (builder *ListMailgroupReqBuilder) PageToken(pageToken string) *ListMailgroupReqBuilder {
@@ -1013,7 +1233,7 @@ func (builder *ListMailgroupReqBuilder) PageToken(pageToken string) *ListMailgro
return builder
}
-//
+// 分页大小
//
// 示例值:10
func (builder *ListMailgroupReqBuilder) PageSize(pageSize int) *ListMailgroupReqBuilder {
@@ -1807,7 +2027,7 @@ func (builder *ListMailgroupMemberReqBuilder) DepartmentIdType(departmentIdType
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:xxx
func (builder *ListMailgroupMemberReqBuilder) PageToken(pageToken string) *ListMailgroupMemberReqBuilder {
@@ -1815,7 +2035,7 @@ func (builder *ListMailgroupMemberReqBuilder) PageToken(pageToken string) *ListM
return builder
}
-//
+// 分页大小
//
// 示例值:10
func (builder *ListMailgroupMemberReqBuilder) PageSize(pageSize int) *ListMailgroupMemberReqBuilder {
@@ -2336,7 +2556,7 @@ func (builder *ListMailgroupPermissionMemberReqBuilder) DepartmentIdType(departm
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:xxx
func (builder *ListMailgroupPermissionMemberReqBuilder) PageToken(pageToken string) *ListMailgroupPermissionMemberReqBuilder {
@@ -2344,7 +2564,7 @@ func (builder *ListMailgroupPermissionMemberReqBuilder) PageToken(pageToken stri
return builder
}
-//
+// 分页大小
//
// 示例值:10
func (builder *ListMailgroupPermissionMemberReqBuilder) PageSize(pageSize int) *ListMailgroupPermissionMemberReqBuilder {
@@ -2540,7 +2760,7 @@ func (builder *ListPublicMailboxReqBuilder) Limit(limit int) *ListPublicMailboxR
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:xxx
func (builder *ListPublicMailboxReqBuilder) PageToken(pageToken string) *ListPublicMailboxReqBuilder {
@@ -2548,7 +2768,7 @@ func (builder *ListPublicMailboxReqBuilder) PageToken(pageToken string) *ListPub
return builder
}
-//
+// 分页大小
//
// 示例值:10
func (builder *ListPublicMailboxReqBuilder) PageSize(pageSize int) *ListPublicMailboxReqBuilder {
@@ -3337,7 +3557,7 @@ func (builder *ListPublicMailboxMemberReqBuilder) UserIdType(userIdType string)
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:xxx
func (builder *ListPublicMailboxMemberReqBuilder) PageToken(pageToken string) *ListPublicMailboxMemberReqBuilder {
@@ -3345,7 +3565,7 @@ func (builder *ListPublicMailboxMemberReqBuilder) PageToken(pageToken string) *L
return builder
}
-//
+// 分页大小
//
// 示例值:10
func (builder *ListPublicMailboxMemberReqBuilder) PageSize(pageSize int) *ListPublicMailboxMemberReqBuilder {
@@ -3663,7 +3883,7 @@ func (builder *ListUserMailboxAliasReqBuilder) UserMailboxId(userMailboxId strin
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:xxx
func (builder *ListUserMailboxAliasReqBuilder) PageToken(pageToken string) *ListUserMailboxAliasReqBuilder {
@@ -3671,7 +3891,7 @@ func (builder *ListUserMailboxAliasReqBuilder) PageToken(pageToken string) *List
return builder
}
-//
+// 分页大小
//
// 示例值:10
func (builder *ListUserMailboxAliasReqBuilder) PageSize(pageSize int) *ListUserMailboxAliasReqBuilder {
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/okr/v1/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/okr/v1/model.go
index c633fc01a6..6d87b66301 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/okr/v1/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/okr/v1/model.go
@@ -6163,16 +6163,20 @@ func (resp *ListPeriodResp) Success() bool {
}
type CreateProgressRecordReqBodyBuilder struct {
- sourceTitle string // 进展来源
- sourceTitleFlag bool
- sourceUrl string // 进展来源链接
- sourceUrlFlag bool
- targetId string // 目标id,与target_type对应
- targetIdFlag bool
- targetType int // 目标类型
- targetTypeFlag bool
- content *ContentBlock // 进展详情 富文本格式
- contentFlag bool
+ sourceTitle string // 进展来源
+ sourceTitleFlag bool
+ sourceUrl string // 进展来源链接
+ sourceUrlFlag bool
+ targetId string // 目标id,与target_type对应
+ targetIdFlag bool
+ targetType int // 目标类型
+ targetTypeFlag bool
+ content *ContentBlock // 进展详情 富文本格式
+ contentFlag bool
+ sourceUrlPc string // pc进展来源链接
+ sourceUrlPcFlag bool
+ sourceUrlMobile string // mobile进展来源链接
+ sourceUrlMobileFlag bool
}
func NewCreateProgressRecordReqBodyBuilder() *CreateProgressRecordReqBodyBuilder {
@@ -6225,6 +6229,24 @@ func (builder *CreateProgressRecordReqBodyBuilder) Content(content *ContentBlock
return builder
}
+// pc进展来源链接
+//
+//示例值:open.feishu.cn
+func (builder *CreateProgressRecordReqBodyBuilder) SourceUrlPc(sourceUrlPc string) *CreateProgressRecordReqBodyBuilder {
+ builder.sourceUrlPc = sourceUrlPc
+ builder.sourceUrlPcFlag = true
+ return builder
+}
+
+// mobile进展来源链接
+//
+//示例值:open.feishu.cn
+func (builder *CreateProgressRecordReqBodyBuilder) SourceUrlMobile(sourceUrlMobile string) *CreateProgressRecordReqBodyBuilder {
+ builder.sourceUrlMobile = sourceUrlMobile
+ builder.sourceUrlMobileFlag = true
+ return builder
+}
+
func (builder *CreateProgressRecordReqBodyBuilder) Build() *CreateProgressRecordReqBody {
req := &CreateProgressRecordReqBody{}
if builder.sourceTitleFlag {
@@ -6242,20 +6264,30 @@ func (builder *CreateProgressRecordReqBodyBuilder) Build() *CreateProgressRecord
if builder.contentFlag {
req.Content = builder.content
}
+ if builder.sourceUrlPcFlag {
+ req.SourceUrlPc = &builder.sourceUrlPc
+ }
+ if builder.sourceUrlMobileFlag {
+ req.SourceUrlMobile = &builder.sourceUrlMobile
+ }
return req
}
type CreateProgressRecordPathReqBodyBuilder struct {
- sourceTitle string // 进展来源
- sourceTitleFlag bool
- sourceUrl string // 进展来源链接
- sourceUrlFlag bool
- targetId string // 目标id,与target_type对应
- targetIdFlag bool
- targetType int // 目标类型
- targetTypeFlag bool
- content *ContentBlock // 进展详情 富文本格式
- contentFlag bool
+ sourceTitle string // 进展来源
+ sourceTitleFlag bool
+ sourceUrl string // 进展来源链接
+ sourceUrlFlag bool
+ targetId string // 目标id,与target_type对应
+ targetIdFlag bool
+ targetType int // 目标类型
+ targetTypeFlag bool
+ content *ContentBlock // 进展详情 富文本格式
+ contentFlag bool
+ sourceUrlPc string // pc进展来源链接
+ sourceUrlPcFlag bool
+ sourceUrlMobile string // mobile进展来源链接
+ sourceUrlMobileFlag bool
}
func NewCreateProgressRecordPathReqBodyBuilder() *CreateProgressRecordPathReqBodyBuilder {
@@ -6308,6 +6340,24 @@ func (builder *CreateProgressRecordPathReqBodyBuilder) Content(content *ContentB
return builder
}
+// pc进展来源链接
+//
+// 示例值:open.feishu.cn
+func (builder *CreateProgressRecordPathReqBodyBuilder) SourceUrlPc(sourceUrlPc string) *CreateProgressRecordPathReqBodyBuilder {
+ builder.sourceUrlPc = sourceUrlPc
+ builder.sourceUrlPcFlag = true
+ return builder
+}
+
+// mobile进展来源链接
+//
+// 示例值:open.feishu.cn
+func (builder *CreateProgressRecordPathReqBodyBuilder) SourceUrlMobile(sourceUrlMobile string) *CreateProgressRecordPathReqBodyBuilder {
+ builder.sourceUrlMobile = sourceUrlMobile
+ builder.sourceUrlMobileFlag = true
+ return builder
+}
+
func (builder *CreateProgressRecordPathReqBodyBuilder) Build() (*CreateProgressRecordReqBody, error) {
req := &CreateProgressRecordReqBody{}
if builder.sourceTitleFlag {
@@ -6325,6 +6375,12 @@ func (builder *CreateProgressRecordPathReqBodyBuilder) Build() (*CreateProgressR
if builder.contentFlag {
req.Content = builder.content
}
+ if builder.sourceUrlPcFlag {
+ req.SourceUrlPc = &builder.sourceUrlPc
+ }
+ if builder.sourceUrlMobileFlag {
+ req.SourceUrlMobile = &builder.sourceUrlMobile
+ }
return req, nil
}
@@ -6365,11 +6421,13 @@ func (builder *CreateProgressRecordReqBuilder) Build() *CreateProgressRecordReq
}
type CreateProgressRecordReqBody struct {
- SourceTitle *string `json:"source_title,omitempty"` // 进展来源
- SourceUrl *string `json:"source_url,omitempty"` // 进展来源链接
- TargetId *string `json:"target_id,omitempty"` // 目标id,与target_type对应
- TargetType *int `json:"target_type,omitempty"` // 目标类型
- Content *ContentBlock `json:"content,omitempty"` // 进展详情 富文本格式
+ SourceTitle *string `json:"source_title,omitempty"` // 进展来源
+ SourceUrl *string `json:"source_url,omitempty"` // 进展来源链接
+ TargetId *string `json:"target_id,omitempty"` // 目标id,与target_type对应
+ TargetType *int `json:"target_type,omitempty"` // 目标类型
+ Content *ContentBlock `json:"content,omitempty"` // 进展详情 富文本格式
+ SourceUrlPc *string `json:"source_url_pc,omitempty"` // pc进展来源链接
+ SourceUrlMobile *string `json:"source_url_mobile,omitempty"` // mobile进展来源链接
}
type CreateProgressRecordReq struct {
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/personal_settings/v1/api.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/personal_settings/v1/api.go
new file mode 100644
index 0000000000..6d08515d05
--- /dev/null
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/personal_settings/v1/api.go
@@ -0,0 +1,206 @@
+// Package personal_settings code generated by oapi sdk gen
+/*
+ * MIT License
+ *
+ * Copyright (c) 2022 Lark Technologies Pte. Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package larkpersonal_settings
+
+import (
+ "context"
+ "net/http"
+
+ "github.com/larksuite/oapi-sdk-go/v3/core"
+)
+
+func NewService(config *larkcore.Config) *PersonalSettingsService {
+ p := &PersonalSettingsService{config: config}
+ p.SystemStatus = &systemStatus{service: p}
+ return p
+}
+
+type PersonalSettingsService struct {
+ config *larkcore.Config
+ SystemStatus *systemStatus // 系统状态
+}
+
+type systemStatus struct {
+ service *PersonalSettingsService
+}
+
+// 批量关闭系统状态
+//
+// - 批量关闭用户系统状态可用
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/personal_settings-v1/system_status/batch_close
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/personal_settingsv1/batchClose_systemStatus.go
+func (s *systemStatus) BatchClose(ctx context.Context, req *BatchCloseSystemStatusReq, options ...larkcore.RequestOptionFunc) (*BatchCloseSystemStatusResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/personal_settings/v1/system_statuses/:system_status_id/batch_close"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, s.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &BatchCloseSystemStatusResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, s.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 批量开启系统状态
+//
+// - 批量开启用户系统状态可用
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/personal_settings-v1/system_status/batch_open
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/personal_settingsv1/batchOpen_systemStatus.go
+func (s *systemStatus) BatchOpen(ctx context.Context, req *BatchOpenSystemStatusReq, options ...larkcore.RequestOptionFunc) (*BatchOpenSystemStatusResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/personal_settings/v1/system_statuses/:system_status_id/batch_open"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, s.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &BatchOpenSystemStatusResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, s.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 创建系统状态
+//
+// - 创建租户维度的系统状态。
+//
+// - 注意事项:;- 操作的数据为租户维度数据,请小心操作。;- 每个租户最多创建10个系统状态。
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/personal_settings-v1/system_status/create
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/personal_settingsv1/create_systemStatus.go
+func (s *systemStatus) Create(ctx context.Context, req *CreateSystemStatusReq, options ...larkcore.RequestOptionFunc) (*CreateSystemStatusResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/personal_settings/v1/system_statuses"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, s.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateSystemStatusResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, s.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 删除系统状态
+//
+// - 删除租户维度的系统状态。
+//
+// - 注意事项:;- 操作的数据为租户维度数据,请小心操作。 ;- 删除系统状态后,并不影响正在使用该状态用户下系统状态的客户端展示。
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/personal_settings-v1/system_status/delete
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/personal_settingsv1/delete_systemStatus.go
+func (s *systemStatus) Delete(ctx context.Context, req *DeleteSystemStatusReq, options ...larkcore.RequestOptionFunc) (*DeleteSystemStatusResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/personal_settings/v1/system_statuses/:system_status_id"
+ apiReq.HttpMethod = http.MethodDelete
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, s.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &DeleteSystemStatusResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, s.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+// 获取系统状态
+//
+// - 获取租户下所有系统状态
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/personal_settings-v1/system_status/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/personal_settingsv1/list_systemStatus.go
+func (s *systemStatus) List(ctx context.Context, req *ListSystemStatusReq, options ...larkcore.RequestOptionFunc) (*ListSystemStatusResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/personal_settings/v1/system_statuses"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, s.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListSystemStatusResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, s.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+func (s *systemStatus) ListByIterator(ctx context.Context, req *ListSystemStatusReq, options ...larkcore.RequestOptionFunc) (*ListSystemStatusIterator, error) {
+ return &ListSystemStatusIterator{
+ ctx: ctx,
+ req: req,
+ listFunc: s.List,
+ options: options,
+ limit: req.Limit}, nil
+}
+
+// 修改系统状态
+//
+// - 修改租户维度系统状态。
+//
+// - 注意事项:;- 操作的数据为租户维度数据,请小心操作。 ;- 修改系统状态后,并不影响正在使用的用户。该用户的系统状态可用时间到期后,再次被开启可用的时候,用户客户端才会同步到更新后的系统状态。
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/personal_settings-v1/system_status/patch
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/personal_settingsv1/patch_systemStatus.go
+func (s *systemStatus) Patch(ctx context.Context, req *PatchSystemStatusReq, options ...larkcore.RequestOptionFunc) (*PatchSystemStatusResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/personal_settings/v1/system_statuses/:system_status_id"
+ apiReq.HttpMethod = http.MethodPatch
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, s.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &PatchSystemStatusResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, s.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/personal_settings/v1/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/personal_settings/v1/model.go
new file mode 100644
index 0000000000..5c43d1c460
--- /dev/null
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/personal_settings/v1/model.go
@@ -0,0 +1,1237 @@
+// Package personal_settings code generated by oapi sdk gen
+/*
+ * MIT License
+ *
+ * Copyright (c) 2022 Lark Technologies Pte. Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package larkpersonal_settings
+
+import (
+ "fmt"
+
+ "context"
+ "errors"
+
+ "github.com/larksuite/oapi-sdk-go/v3/core"
+)
+
+const (
+ UserIdTypeUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeOpenId = "open_id" // 以open_id来识别用户
+)
+
+const (
+ UserIdTypeBatchOpenSystemStatusUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeBatchOpenSystemStatusUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeBatchOpenSystemStatusOpenId = "open_id" // 以open_id来识别用户
+)
+
+const (
+ SystemStatusIconKeyGeneralDoNotDisturb = "GeneralDoNotDisturb" // GeneralDoNotDisturb
+ SystemStatusIconKeyGeneralInMeetingBusy = "GeneralInMeetingBusy" // GeneralInMeetingBusy
+ SystemStatusIconKeyCoffee = "Coffee" // Coffee
+ SystemStatusIconKeyGeneralBusinessTrip = "GeneralBusinessTrip" // GeneralBusinessTrip
+ SystemStatusIconKeyGeneralWorkFromHome = "GeneralWorkFromHome" // GeneralWorkFromHome
+ SystemStatusIconKeyStatusEnjoyLife = "StatusEnjoyLife" // StatusEnjoyLife
+ SystemStatusIconKeyGeneralTravellingCar = "GeneralTravellingCar" // GeneralTravellingCar
+ SystemStatusIconKeyStatusBus = "StatusBus" // StatusBus
+ SystemStatusIconKeyStatusInFlight = "StatusInFlight" // StatusInFlight
+ SystemStatusIconKeyTyping = "Typing" // Typing
+ SystemStatusIconKeyEatingFood = "EatingFood" // EatingFood
+ SystemStatusIconKeySICK = "SICK" // SICK
+ SystemStatusIconKeyGeneralSun = "GeneralSun" // GeneralSun
+ SystemStatusIconKeyGeneralMoonRest = "GeneralMoonRest" // GeneralMoonRest
+ SystemStatusIconKeyStatusReading = "StatusReading" // StatusReading
+ SystemStatusIconKeyStatusPrivateMessage = "Status_PrivateMessage" // Status_PrivateMessage
+ SystemStatusIconKeyStatusFlashOfInspiration = "StatusFlashOfInspiration" // StatusFlashOfInspiration
+ SystemStatusIconKeyGeneralVacation = "GeneralVacation" // GeneralVacation
+)
+
+const (
+ SystemStatusColorBLUE = "BLUE" // 蓝色
+ SystemStatusColorGRAY = "GRAY" // 灰色
+ SystemStatusColorINDIGO = "INDIGO" // 靛青色
+ SystemStatusColorWATHET = "WATHET" // 浅蓝色
+ SystemStatusColorGREEN = "GREEN" // 绿色
+ SystemStatusColorTURQUOISE = "TURQUOISE" // 绿松石色
+ SystemStatusColorYELLOW = "YELLOW" // 黄色
+ SystemStatusColorLIME = "LIME" // 酸橙色
+ SystemStatusColorRED = "RED" // 红色
+ SystemStatusColorORANGE = "ORANGE" // 橙色
+ SystemStatusColorPURPLE = "PURPLE" // 紫色
+ SystemStatusColorVIOLET = "VIOLET" // 紫罗兰色
+ SystemStatusColorCARMINE = "CARMINE" // 胭脂红色
+)
+
+type SystemStatus struct {
+ SystemStatusId *string `json:"system_status_id,omitempty"` // 系统状态ID
+ Title *string `json:"title,omitempty"` // 系统状态名称,名称字符数要在1到20范围内。不同系统状态的title不能重复。;; **注意:** ;- 1中文=2英文=2其他语言字符=2字符
+ I18nTitle *SystemStatusI18nName `json:"i18n_title,omitempty"` // 系统状态国际化名称,名称字符数要在1到20范围内。不同系统状态之间i18n_title中任何一种title都不能重复。;; **注意:** ;- 1中文=2英文=2其他语言字符=2字符
+ IconKey *string `json:"icon_key,omitempty"` // 图标;;[**了解icon_key可选值**](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/personal_settings-v1/system_status/overview)
+ Color *string `json:"color,omitempty"` // 颜色
+ Priority *int `json:"priority,omitempty"` // 优先级,数值越小,客户端展示的优先级越高。不同系统状态的优先级不能一样。
+ SyncSetting *SystemStatusSyncSetting `json:"sync_setting,omitempty"` // 同步设置
+}
+
+type SystemStatusBuilder struct {
+ systemStatusId string // 系统状态ID
+ systemStatusIdFlag bool
+ title string // 系统状态名称,名称字符数要在1到20范围内。不同系统状态的title不能重复。;; **注意:** ;- 1中文=2英文=2其他语言字符=2字符
+ titleFlag bool
+ i18nTitle *SystemStatusI18nName // 系统状态国际化名称,名称字符数要在1到20范围内。不同系统状态之间i18n_title中任何一种title都不能重复。;; **注意:** ;- 1中文=2英文=2其他语言字符=2字符
+ i18nTitleFlag bool
+ iconKey string // 图标;;[**了解icon_key可选值**](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/personal_settings-v1/system_status/overview)
+ iconKeyFlag bool
+ color string // 颜色
+ colorFlag bool
+ priority int // 优先级,数值越小,客户端展示的优先级越高。不同系统状态的优先级不能一样。
+ priorityFlag bool
+ syncSetting *SystemStatusSyncSetting // 同步设置
+ syncSettingFlag bool
+}
+
+func NewSystemStatusBuilder() *SystemStatusBuilder {
+ builder := &SystemStatusBuilder{}
+ return builder
+}
+
+// 系统状态ID
+//
+// 示例值:7101214603622940633
+func (builder *SystemStatusBuilder) SystemStatusId(systemStatusId string) *SystemStatusBuilder {
+ builder.systemStatusId = systemStatusId
+ builder.systemStatusIdFlag = true
+ return builder
+}
+
+// 系统状态名称,名称字符数要在1到20范围内。不同系统状态的title不能重复。;; **注意:** ;- 1中文=2英文=2其他语言字符=2字符
+//
+// 示例值:出差
+func (builder *SystemStatusBuilder) Title(title string) *SystemStatusBuilder {
+ builder.title = title
+ builder.titleFlag = true
+ return builder
+}
+
+// 系统状态国际化名称,名称字符数要在1到20范围内。不同系统状态之间i18n_title中任何一种title都不能重复。;; **注意:** ;- 1中文=2英文=2其他语言字符=2字符
+//
+// 示例值:
+func (builder *SystemStatusBuilder) I18nTitle(i18nTitle *SystemStatusI18nName) *SystemStatusBuilder {
+ builder.i18nTitle = i18nTitle
+ builder.i18nTitleFlag = true
+ return builder
+}
+
+// 图标;;[**了解icon_key可选值**](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/personal_settings-v1/system_status/overview)
+//
+// 示例值:GeneralBusinessTrip
+func (builder *SystemStatusBuilder) IconKey(iconKey string) *SystemStatusBuilder {
+ builder.iconKey = iconKey
+ builder.iconKeyFlag = true
+ return builder
+}
+
+// 颜色
+//
+// 示例值:BLUE
+func (builder *SystemStatusBuilder) Color(color string) *SystemStatusBuilder {
+ builder.color = color
+ builder.colorFlag = true
+ return builder
+}
+
+// 优先级,数值越小,客户端展示的优先级越高。不同系统状态的优先级不能一样。
+//
+// 示例值:1
+func (builder *SystemStatusBuilder) Priority(priority int) *SystemStatusBuilder {
+ builder.priority = priority
+ builder.priorityFlag = true
+ return builder
+}
+
+// 同步设置
+//
+// 示例值:
+func (builder *SystemStatusBuilder) SyncSetting(syncSetting *SystemStatusSyncSetting) *SystemStatusBuilder {
+ builder.syncSetting = syncSetting
+ builder.syncSettingFlag = true
+ return builder
+}
+
+func (builder *SystemStatusBuilder) Build() *SystemStatus {
+ req := &SystemStatus{}
+ if builder.systemStatusIdFlag {
+ req.SystemStatusId = &builder.systemStatusId
+
+ }
+ if builder.titleFlag {
+ req.Title = &builder.title
+
+ }
+ if builder.i18nTitleFlag {
+ req.I18nTitle = builder.i18nTitle
+ }
+ if builder.iconKeyFlag {
+ req.IconKey = &builder.iconKey
+
+ }
+ if builder.colorFlag {
+ req.Color = &builder.color
+
+ }
+ if builder.priorityFlag {
+ req.Priority = &builder.priority
+
+ }
+ if builder.syncSettingFlag {
+ req.SyncSetting = builder.syncSetting
+ }
+ return req
+}
+
+type SystemStatusI18nName struct {
+ ZhCn *string `json:"zh_cn,omitempty"` // 中文名
+ EnUs *string `json:"en_us,omitempty"` // 英文名
+ JaJp *string `json:"ja_jp,omitempty"` // 日文名
+}
+
+type SystemStatusI18nNameBuilder struct {
+ zhCn string // 中文名
+ zhCnFlag bool
+ enUs string // 英文名
+ enUsFlag bool
+ jaJp string // 日文名
+ jaJpFlag bool
+}
+
+func NewSystemStatusI18nNameBuilder() *SystemStatusI18nNameBuilder {
+ builder := &SystemStatusI18nNameBuilder{}
+ return builder
+}
+
+// 中文名
+//
+// 示例值:出差
+func (builder *SystemStatusI18nNameBuilder) ZhCn(zhCn string) *SystemStatusI18nNameBuilder {
+ builder.zhCn = zhCn
+ builder.zhCnFlag = true
+ return builder
+}
+
+// 英文名
+//
+// 示例值:On business trip
+func (builder *SystemStatusI18nNameBuilder) EnUs(enUs string) *SystemStatusI18nNameBuilder {
+ builder.enUs = enUs
+ builder.enUsFlag = true
+ return builder
+}
+
+// 日文名
+//
+// 示例值:出張中
+func (builder *SystemStatusI18nNameBuilder) JaJp(jaJp string) *SystemStatusI18nNameBuilder {
+ builder.jaJp = jaJp
+ builder.jaJpFlag = true
+ return builder
+}
+
+func (builder *SystemStatusI18nNameBuilder) Build() *SystemStatusI18nName {
+ req := &SystemStatusI18nName{}
+ if builder.zhCnFlag {
+ req.ZhCn = &builder.zhCn
+
+ }
+ if builder.enUsFlag {
+ req.EnUs = &builder.enUs
+
+ }
+ if builder.jaJpFlag {
+ req.JaJp = &builder.jaJp
+
+ }
+ return req
+}
+
+type SystemStatusSyncI18nExplain struct {
+ ZhCn *string `json:"zh_cn,omitempty"` // 中文名
+ EnUs *string `json:"en_us,omitempty"` // 英文名
+ JaJp *string `json:"ja_jp,omitempty"` // 日文名
+}
+
+type SystemStatusSyncI18nExplainBuilder struct {
+ zhCn string // 中文名
+ zhCnFlag bool
+ enUs string // 英文名
+ enUsFlag bool
+ jaJp string // 日文名
+ jaJpFlag bool
+}
+
+func NewSystemStatusSyncI18nExplainBuilder() *SystemStatusSyncI18nExplainBuilder {
+ builder := &SystemStatusSyncI18nExplainBuilder{}
+ return builder
+}
+
+// 中文名
+//
+// 示例值:出差审批通过后,该状态将自动开启并优先展示
+func (builder *SystemStatusSyncI18nExplainBuilder) ZhCn(zhCn string) *SystemStatusSyncI18nExplainBuilder {
+ builder.zhCn = zhCn
+ builder.zhCnFlag = true
+ return builder
+}
+
+// 英文名
+//
+// 示例值:Auto-display after travel request is approved.
+func (builder *SystemStatusSyncI18nExplainBuilder) EnUs(enUs string) *SystemStatusSyncI18nExplainBuilder {
+ builder.enUs = enUs
+ builder.enUsFlag = true
+ return builder
+}
+
+// 日文名
+//
+// 示例值:申請が承認されると、このステータスが優先的に表示されます
+func (builder *SystemStatusSyncI18nExplainBuilder) JaJp(jaJp string) *SystemStatusSyncI18nExplainBuilder {
+ builder.jaJp = jaJp
+ builder.jaJpFlag = true
+ return builder
+}
+
+func (builder *SystemStatusSyncI18nExplainBuilder) Build() *SystemStatusSyncI18nExplain {
+ req := &SystemStatusSyncI18nExplain{}
+ if builder.zhCnFlag {
+ req.ZhCn = &builder.zhCn
+
+ }
+ if builder.enUsFlag {
+ req.EnUs = &builder.enUs
+
+ }
+ if builder.jaJpFlag {
+ req.JaJp = &builder.jaJp
+
+ }
+ return req
+}
+
+type SystemStatusSyncI18nName struct {
+ ZhCn *string `json:"zh_cn,omitempty"` // 中文名
+ EnUs *string `json:"en_us,omitempty"` // 英文名
+ JaJp *string `json:"ja_jp,omitempty"` // 日文名
+}
+
+type SystemStatusSyncI18nNameBuilder struct {
+ zhCn string // 中文名
+ zhCnFlag bool
+ enUs string // 英文名
+ enUsFlag bool
+ jaJp string // 日文名
+ jaJpFlag bool
+}
+
+func NewSystemStatusSyncI18nNameBuilder() *SystemStatusSyncI18nNameBuilder {
+ builder := &SystemStatusSyncI18nNameBuilder{}
+ return builder
+}
+
+// 中文名
+//
+// 示例值:出差期间自动开启
+func (builder *SystemStatusSyncI18nNameBuilder) ZhCn(zhCn string) *SystemStatusSyncI18nNameBuilder {
+ builder.zhCn = zhCn
+ builder.zhCnFlag = true
+ return builder
+}
+
+// 英文名
+//
+// 示例值:Auto display Business Trip
+func (builder *SystemStatusSyncI18nNameBuilder) EnUs(enUs string) *SystemStatusSyncI18nNameBuilder {
+ builder.enUs = enUs
+ builder.enUsFlag = true
+ return builder
+}
+
+// 日文名
+//
+// 示例值:出張中に自動的にオンにする
+func (builder *SystemStatusSyncI18nNameBuilder) JaJp(jaJp string) *SystemStatusSyncI18nNameBuilder {
+ builder.jaJp = jaJp
+ builder.jaJpFlag = true
+ return builder
+}
+
+func (builder *SystemStatusSyncI18nNameBuilder) Build() *SystemStatusSyncI18nName {
+ req := &SystemStatusSyncI18nName{}
+ if builder.zhCnFlag {
+ req.ZhCn = &builder.zhCn
+
+ }
+ if builder.enUsFlag {
+ req.EnUs = &builder.enUs
+
+ }
+ if builder.jaJpFlag {
+ req.JaJp = &builder.jaJp
+
+ }
+ return req
+}
+
+type SystemStatusSyncSetting struct {
+ IsOpenByDefault *bool `json:"is_open_by_default,omitempty"` // 是否默认开启
+ Title *string `json:"title,omitempty"` // 同步设置名称,名称字符数要在1到30范围内。;;**注意:** ;- 1中文=2英文=2其他语言字符=2字符
+ I18nTitle *SystemStatusSyncI18nName `json:"i18n_title,omitempty"` // 同步设置国际化名称,名称字符数要在1到30范围内。;;**注意:** ;- 1中文=2英文=2其他语言字符=2字符
+ Explain *string `json:"explain,omitempty"` // 同步设置解释文案,解释字符数要在1到60范围内。;;**注意:** ;- 1中文=2英文=2其他语言字符=2字符
+ I18nExplain *SystemStatusSyncI18nExplain `json:"i18n_explain,omitempty"` // 同步设置国际化解释文案,解释字符数要在1到60范围内。;;**注意:** ;- 1中文=2英文=2其他语言字符=2字符
+}
+
+type SystemStatusSyncSettingBuilder struct {
+ isOpenByDefault bool // 是否默认开启
+ isOpenByDefaultFlag bool
+ title string // 同步设置名称,名称字符数要在1到30范围内。;;**注意:** ;- 1中文=2英文=2其他语言字符=2字符
+ titleFlag bool
+ i18nTitle *SystemStatusSyncI18nName // 同步设置国际化名称,名称字符数要在1到30范围内。;;**注意:** ;- 1中文=2英文=2其他语言字符=2字符
+ i18nTitleFlag bool
+ explain string // 同步设置解释文案,解释字符数要在1到60范围内。;;**注意:** ;- 1中文=2英文=2其他语言字符=2字符
+ explainFlag bool
+ i18nExplain *SystemStatusSyncI18nExplain // 同步设置国际化解释文案,解释字符数要在1到60范围内。;;**注意:** ;- 1中文=2英文=2其他语言字符=2字符
+ i18nExplainFlag bool
+}
+
+func NewSystemStatusSyncSettingBuilder() *SystemStatusSyncSettingBuilder {
+ builder := &SystemStatusSyncSettingBuilder{}
+ return builder
+}
+
+// 是否默认开启
+//
+// 示例值:true
+func (builder *SystemStatusSyncSettingBuilder) IsOpenByDefault(isOpenByDefault bool) *SystemStatusSyncSettingBuilder {
+ builder.isOpenByDefault = isOpenByDefault
+ builder.isOpenByDefaultFlag = true
+ return builder
+}
+
+// 同步设置名称,名称字符数要在1到30范围内。;;**注意:** ;- 1中文=2英文=2其他语言字符=2字符
+//
+// 示例值:出差期间自动开启
+func (builder *SystemStatusSyncSettingBuilder) Title(title string) *SystemStatusSyncSettingBuilder {
+ builder.title = title
+ builder.titleFlag = true
+ return builder
+}
+
+// 同步设置国际化名称,名称字符数要在1到30范围内。;;**注意:** ;- 1中文=2英文=2其他语言字符=2字符
+//
+// 示例值:
+func (builder *SystemStatusSyncSettingBuilder) I18nTitle(i18nTitle *SystemStatusSyncI18nName) *SystemStatusSyncSettingBuilder {
+ builder.i18nTitle = i18nTitle
+ builder.i18nTitleFlag = true
+ return builder
+}
+
+// 同步设置解释文案,解释字符数要在1到60范围内。;;**注意:** ;- 1中文=2英文=2其他语言字符=2字符
+//
+// 示例值:出差审批通过后,将自动开启并优先展示该状态。
+func (builder *SystemStatusSyncSettingBuilder) Explain(explain string) *SystemStatusSyncSettingBuilder {
+ builder.explain = explain
+ builder.explainFlag = true
+ return builder
+}
+
+// 同步设置国际化解释文案,解释字符数要在1到60范围内。;;**注意:** ;- 1中文=2英文=2其他语言字符=2字符
+//
+// 示例值:
+func (builder *SystemStatusSyncSettingBuilder) I18nExplain(i18nExplain *SystemStatusSyncI18nExplain) *SystemStatusSyncSettingBuilder {
+ builder.i18nExplain = i18nExplain
+ builder.i18nExplainFlag = true
+ return builder
+}
+
+func (builder *SystemStatusSyncSettingBuilder) Build() *SystemStatusSyncSetting {
+ req := &SystemStatusSyncSetting{}
+ if builder.isOpenByDefaultFlag {
+ req.IsOpenByDefault = &builder.isOpenByDefault
+
+ }
+ if builder.titleFlag {
+ req.Title = &builder.title
+
+ }
+ if builder.i18nTitleFlag {
+ req.I18nTitle = builder.i18nTitle
+ }
+ if builder.explainFlag {
+ req.Explain = &builder.explain
+
+ }
+ if builder.i18nExplainFlag {
+ req.I18nExplain = builder.i18nExplain
+ }
+ return req
+}
+
+type SystemStatusUserCloseResultEntity struct {
+ UserId *string `json:"user_id,omitempty"` // 用户ID
+ Result *string `json:"result,omitempty"` // 关闭结果
+}
+
+type SystemStatusUserCloseResultEntityBuilder struct {
+ userId string // 用户ID
+ userIdFlag bool
+ result string // 关闭结果
+ resultFlag bool
+}
+
+func NewSystemStatusUserCloseResultEntityBuilder() *SystemStatusUserCloseResultEntityBuilder {
+ builder := &SystemStatusUserCloseResultEntityBuilder{}
+ return builder
+}
+
+// 用户ID
+//
+// 示例值:ou_53edd3282dbc2fdbe5c593cfa5ce82ab
+func (builder *SystemStatusUserCloseResultEntityBuilder) UserId(userId string) *SystemStatusUserCloseResultEntityBuilder {
+ builder.userId = userId
+ builder.userIdFlag = true
+ return builder
+}
+
+// 关闭结果
+//
+// 示例值:success
+func (builder *SystemStatusUserCloseResultEntityBuilder) Result(result string) *SystemStatusUserCloseResultEntityBuilder {
+ builder.result = result
+ builder.resultFlag = true
+ return builder
+}
+
+func (builder *SystemStatusUserCloseResultEntityBuilder) Build() *SystemStatusUserCloseResultEntity {
+ req := &SystemStatusUserCloseResultEntity{}
+ if builder.userIdFlag {
+ req.UserId = &builder.userId
+
+ }
+ if builder.resultFlag {
+ req.Result = &builder.result
+
+ }
+ return req
+}
+
+type SystemStatusUserOpenParam struct {
+ UserId *string `json:"user_id,omitempty"` // 用户ID
+ EndTime *string `json:"end_time,omitempty"` // 结束时间,传入的应为秒单位的时间戳,距当前的时间跨度不能超过365天。
+}
+
+type SystemStatusUserOpenParamBuilder struct {
+ userId string // 用户ID
+ userIdFlag bool
+ endTime string // 结束时间,传入的应为秒单位的时间戳,距当前的时间跨度不能超过365天。
+ endTimeFlag bool
+}
+
+func NewSystemStatusUserOpenParamBuilder() *SystemStatusUserOpenParamBuilder {
+ builder := &SystemStatusUserOpenParamBuilder{}
+ return builder
+}
+
+// 用户ID
+//
+// 示例值:ou_53edd3282dbc2fdbe5c593cfa5ce82ab
+func (builder *SystemStatusUserOpenParamBuilder) UserId(userId string) *SystemStatusUserOpenParamBuilder {
+ builder.userId = userId
+ builder.userIdFlag = true
+ return builder
+}
+
+// 结束时间,传入的应为秒单位的时间戳,距当前的时间跨度不能超过365天。
+//
+// 示例值:1665990378
+func (builder *SystemStatusUserOpenParamBuilder) EndTime(endTime string) *SystemStatusUserOpenParamBuilder {
+ builder.endTime = endTime
+ builder.endTimeFlag = true
+ return builder
+}
+
+func (builder *SystemStatusUserOpenParamBuilder) Build() *SystemStatusUserOpenParam {
+ req := &SystemStatusUserOpenParam{}
+ if builder.userIdFlag {
+ req.UserId = &builder.userId
+
+ }
+ if builder.endTimeFlag {
+ req.EndTime = &builder.endTime
+
+ }
+ return req
+}
+
+type SystemStatusUserOpenResultEntity struct {
+ UserId *string `json:"user_id,omitempty"` // 用户ID
+ EndTime *string `json:"end_time,omitempty"` // 结束时间,传入的应为秒单位的时间戳,距当前的时间跨度不能超过365天。
+ Result *string `json:"result,omitempty"` // 开启结果
+}
+
+type SystemStatusUserOpenResultEntityBuilder struct {
+ userId string // 用户ID
+ userIdFlag bool
+ endTime string // 结束时间,传入的应为秒单位的时间戳,距当前的时间跨度不能超过365天。
+ endTimeFlag bool
+ result string // 开启结果
+ resultFlag bool
+}
+
+func NewSystemStatusUserOpenResultEntityBuilder() *SystemStatusUserOpenResultEntityBuilder {
+ builder := &SystemStatusUserOpenResultEntityBuilder{}
+ return builder
+}
+
+// 用户ID
+//
+// 示例值:ou_53edd3282dbc2fdbe5c593cfa5ce82ab
+func (builder *SystemStatusUserOpenResultEntityBuilder) UserId(userId string) *SystemStatusUserOpenResultEntityBuilder {
+ builder.userId = userId
+ builder.userIdFlag = true
+ return builder
+}
+
+// 结束时间,传入的应为秒单位的时间戳,距当前的时间跨度不能超过365天。
+//
+// 示例值:1665990378
+func (builder *SystemStatusUserOpenResultEntityBuilder) EndTime(endTime string) *SystemStatusUserOpenResultEntityBuilder {
+ builder.endTime = endTime
+ builder.endTimeFlag = true
+ return builder
+}
+
+// 开启结果
+//
+// 示例值:success_show
+func (builder *SystemStatusUserOpenResultEntityBuilder) Result(result string) *SystemStatusUserOpenResultEntityBuilder {
+ builder.result = result
+ builder.resultFlag = true
+ return builder
+}
+
+func (builder *SystemStatusUserOpenResultEntityBuilder) Build() *SystemStatusUserOpenResultEntity {
+ req := &SystemStatusUserOpenResultEntity{}
+ if builder.userIdFlag {
+ req.UserId = &builder.userId
+
+ }
+ if builder.endTimeFlag {
+ req.EndTime = &builder.endTime
+
+ }
+ if builder.resultFlag {
+ req.Result = &builder.result
+
+ }
+ return req
+}
+
+type BatchCloseSystemStatusReqBodyBuilder struct {
+ userList []string // 成员列表
+ userListFlag bool
+}
+
+func NewBatchCloseSystemStatusReqBodyBuilder() *BatchCloseSystemStatusReqBodyBuilder {
+ builder := &BatchCloseSystemStatusReqBodyBuilder{}
+ return builder
+}
+
+// 成员列表
+//
+//示例值:ou_53edd3282dbc2fdbe5c593cfa5ce82ab
+func (builder *BatchCloseSystemStatusReqBodyBuilder) UserList(userList []string) *BatchCloseSystemStatusReqBodyBuilder {
+ builder.userList = userList
+ builder.userListFlag = true
+ return builder
+}
+
+func (builder *BatchCloseSystemStatusReqBodyBuilder) Build() *BatchCloseSystemStatusReqBody {
+ req := &BatchCloseSystemStatusReqBody{}
+ if builder.userListFlag {
+ req.UserList = builder.userList
+ }
+ return req
+}
+
+type BatchCloseSystemStatusPathReqBodyBuilder struct {
+ userList []string // 成员列表
+ userListFlag bool
+}
+
+func NewBatchCloseSystemStatusPathReqBodyBuilder() *BatchCloseSystemStatusPathReqBodyBuilder {
+ builder := &BatchCloseSystemStatusPathReqBodyBuilder{}
+ return builder
+}
+
+// 成员列表
+//
+// 示例值:ou_53edd3282dbc2fdbe5c593cfa5ce82ab
+func (builder *BatchCloseSystemStatusPathReqBodyBuilder) UserList(userList []string) *BatchCloseSystemStatusPathReqBodyBuilder {
+ builder.userList = userList
+ builder.userListFlag = true
+ return builder
+}
+
+func (builder *BatchCloseSystemStatusPathReqBodyBuilder) Build() (*BatchCloseSystemStatusReqBody, error) {
+ req := &BatchCloseSystemStatusReqBody{}
+ if builder.userListFlag {
+ req.UserList = builder.userList
+ }
+ return req, nil
+}
+
+type BatchCloseSystemStatusReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *BatchCloseSystemStatusReqBody
+}
+
+func NewBatchCloseSystemStatusReqBuilder() *BatchCloseSystemStatusReqBuilder {
+ builder := &BatchCloseSystemStatusReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 系统状态ID;;[获取系统状态ID](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/personal_settings-v1/system_status/list)
+//
+// 示例值:7101214603622940671
+func (builder *BatchCloseSystemStatusReqBuilder) SystemStatusId(systemStatusId string) *BatchCloseSystemStatusReqBuilder {
+ builder.apiReq.PathParams.Set("system_status_id", fmt.Sprint(systemStatusId))
+ return builder
+}
+
+// 用户id类型 open_id/user_id/union_id
+//
+// 示例值:open_id
+func (builder *BatchCloseSystemStatusReqBuilder) UserIdType(userIdType string) *BatchCloseSystemStatusReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 批量关闭用户系统状态可用
+func (builder *BatchCloseSystemStatusReqBuilder) Body(body *BatchCloseSystemStatusReqBody) *BatchCloseSystemStatusReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *BatchCloseSystemStatusReqBuilder) Build() *BatchCloseSystemStatusReq {
+ req := &BatchCloseSystemStatusReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type BatchCloseSystemStatusReqBody struct {
+ UserList []string `json:"user_list,omitempty"` // 成员列表
+}
+
+type BatchCloseSystemStatusReq struct {
+ apiReq *larkcore.ApiReq
+ Body *BatchCloseSystemStatusReqBody `body:""`
+}
+
+type BatchCloseSystemStatusRespData struct {
+ ResultList []*SystemStatusUserCloseResultEntity `json:"result_list,omitempty"` // 关闭结果
+}
+
+type BatchCloseSystemStatusResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *BatchCloseSystemStatusRespData `json:"data"` // 业务数据
+}
+
+func (resp *BatchCloseSystemStatusResp) Success() bool {
+ return resp.Code == 0
+}
+
+type BatchOpenSystemStatusReqBodyBuilder struct {
+ userList []*SystemStatusUserOpenParam // 开启列表
+ userListFlag bool
+}
+
+func NewBatchOpenSystemStatusReqBodyBuilder() *BatchOpenSystemStatusReqBodyBuilder {
+ builder := &BatchOpenSystemStatusReqBodyBuilder{}
+ return builder
+}
+
+// 开启列表
+//
+//示例值:
+func (builder *BatchOpenSystemStatusReqBodyBuilder) UserList(userList []*SystemStatusUserOpenParam) *BatchOpenSystemStatusReqBodyBuilder {
+ builder.userList = userList
+ builder.userListFlag = true
+ return builder
+}
+
+func (builder *BatchOpenSystemStatusReqBodyBuilder) Build() *BatchOpenSystemStatusReqBody {
+ req := &BatchOpenSystemStatusReqBody{}
+ if builder.userListFlag {
+ req.UserList = builder.userList
+ }
+ return req
+}
+
+type BatchOpenSystemStatusPathReqBodyBuilder struct {
+ userList []*SystemStatusUserOpenParam // 开启列表
+ userListFlag bool
+}
+
+func NewBatchOpenSystemStatusPathReqBodyBuilder() *BatchOpenSystemStatusPathReqBodyBuilder {
+ builder := &BatchOpenSystemStatusPathReqBodyBuilder{}
+ return builder
+}
+
+// 开启列表
+//
+// 示例值:
+func (builder *BatchOpenSystemStatusPathReqBodyBuilder) UserList(userList []*SystemStatusUserOpenParam) *BatchOpenSystemStatusPathReqBodyBuilder {
+ builder.userList = userList
+ builder.userListFlag = true
+ return builder
+}
+
+func (builder *BatchOpenSystemStatusPathReqBodyBuilder) Build() (*BatchOpenSystemStatusReqBody, error) {
+ req := &BatchOpenSystemStatusReqBody{}
+ if builder.userListFlag {
+ req.UserList = builder.userList
+ }
+ return req, nil
+}
+
+type BatchOpenSystemStatusReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *BatchOpenSystemStatusReqBody
+}
+
+func NewBatchOpenSystemStatusReqBuilder() *BatchOpenSystemStatusReqBuilder {
+ builder := &BatchOpenSystemStatusReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 系统状态ID;;[获取系统状态ID](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/personal_settings-v1/system_status/list)
+//
+// 示例值:7101214603622940672
+func (builder *BatchOpenSystemStatusReqBuilder) SystemStatusId(systemStatusId string) *BatchOpenSystemStatusReqBuilder {
+ builder.apiReq.PathParams.Set("system_status_id", fmt.Sprint(systemStatusId))
+ return builder
+}
+
+// 用户id类型 open_id/user_id/union_id
+//
+// 示例值:open_id
+func (builder *BatchOpenSystemStatusReqBuilder) UserIdType(userIdType string) *BatchOpenSystemStatusReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 批量开启用户系统状态可用
+func (builder *BatchOpenSystemStatusReqBuilder) Body(body *BatchOpenSystemStatusReqBody) *BatchOpenSystemStatusReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *BatchOpenSystemStatusReqBuilder) Build() *BatchOpenSystemStatusReq {
+ req := &BatchOpenSystemStatusReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type BatchOpenSystemStatusReqBody struct {
+ UserList []*SystemStatusUserOpenParam `json:"user_list,omitempty"` // 开启列表
+}
+
+type BatchOpenSystemStatusReq struct {
+ apiReq *larkcore.ApiReq
+ Body *BatchOpenSystemStatusReqBody `body:""`
+}
+
+type BatchOpenSystemStatusRespData struct {
+ ResultList []*SystemStatusUserOpenResultEntity `json:"result_list,omitempty"` // 开启结果
+}
+
+type BatchOpenSystemStatusResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *BatchOpenSystemStatusRespData `json:"data"` // 业务数据
+}
+
+func (resp *BatchOpenSystemStatusResp) Success() bool {
+ return resp.Code == 0
+}
+
+type CreateSystemStatusReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ systemStatus *SystemStatus
+}
+
+func NewCreateSystemStatusReqBuilder() *CreateSystemStatusReqBuilder {
+ builder := &CreateSystemStatusReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 创建租户维度的系统状态。
+func (builder *CreateSystemStatusReqBuilder) SystemStatus(systemStatus *SystemStatus) *CreateSystemStatusReqBuilder {
+ builder.systemStatus = systemStatus
+ return builder
+}
+
+func (builder *CreateSystemStatusReqBuilder) Build() *CreateSystemStatusReq {
+ req := &CreateSystemStatusReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.Body = builder.systemStatus
+ return req
+}
+
+type CreateSystemStatusReq struct {
+ apiReq *larkcore.ApiReq
+ SystemStatus *SystemStatus `body:""`
+}
+
+type CreateSystemStatusRespData struct {
+ SystemStatus *SystemStatus `json:"system_status,omitempty"` // 系统状态
+}
+
+type CreateSystemStatusResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateSystemStatusRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateSystemStatusResp) Success() bool {
+ return resp.Code == 0
+}
+
+type DeleteSystemStatusReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewDeleteSystemStatusReqBuilder() *DeleteSystemStatusReqBuilder {
+ builder := &DeleteSystemStatusReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 系统状态ID;;[获取系统状态ID](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/personal_settings-v1/system_status/list)
+//
+// 示例值:7101214603622940633
+func (builder *DeleteSystemStatusReqBuilder) SystemStatusId(systemStatusId string) *DeleteSystemStatusReqBuilder {
+ builder.apiReq.PathParams.Set("system_status_id", fmt.Sprint(systemStatusId))
+ return builder
+}
+
+func (builder *DeleteSystemStatusReqBuilder) Build() *DeleteSystemStatusReq {
+ req := &DeleteSystemStatusReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ return req
+}
+
+type DeleteSystemStatusReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type DeleteSystemStatusResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *DeleteSystemStatusResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListSystemStatusReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ limit int // 最大返回多少记录,当使用迭代器访问时才有效
+}
+
+func NewListSystemStatusReqBuilder() *ListSystemStatusReqBuilder {
+ builder := &ListSystemStatusReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 最大返回多少记录,当使用迭代器访问时才有效
+func (builder *ListSystemStatusReqBuilder) Limit(limit int) *ListSystemStatusReqBuilder {
+ builder.limit = limit
+ return builder
+}
+
+// 分页大小
+//
+// 示例值:50
+func (builder *ListSystemStatusReqBuilder) PageSize(pageSize int) *ListSystemStatusReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果
+//
+// 示例值:GxmvlNRvP0NdQZpa7yIqf_Lv_QuBwTQ8tXkX7w-irAghVD_TvuYd1aoJ1LQph86O-XImC4X9j9FhUPhXQDvtrQ==
+func (builder *ListSystemStatusReqBuilder) PageToken(pageToken string) *ListSystemStatusReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+func (builder *ListSystemStatusReqBuilder) Build() *ListSystemStatusReq {
+ req := &ListSystemStatusReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.Limit = builder.limit
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListSystemStatusReq struct {
+ apiReq *larkcore.ApiReq
+ Limit int // 最多返回多少记录,只有在使用迭代器访问时,才有效
+
+}
+
+type ListSystemStatusRespData struct {
+ Items []*SystemStatus `json:"items,omitempty"` // 租户系统状态
+ PageToken *string `json:"page_token,omitempty"` // 分页token
+ HasMore *bool `json:"has_more,omitempty"` // 是否存在更多
+}
+
+type ListSystemStatusResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListSystemStatusRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListSystemStatusResp) Success() bool {
+ return resp.Code == 0
+}
+
+type PatchSystemStatusReqBodyBuilder struct {
+ systemStatus *SystemStatus // 系统状态
+ systemStatusFlag bool
+ updateFields []string // 需要更新的字段
+ updateFieldsFlag bool
+}
+
+func NewPatchSystemStatusReqBodyBuilder() *PatchSystemStatusReqBodyBuilder {
+ builder := &PatchSystemStatusReqBodyBuilder{}
+ return builder
+}
+
+// 系统状态
+//
+//示例值:
+func (builder *PatchSystemStatusReqBodyBuilder) SystemStatus(systemStatus *SystemStatus) *PatchSystemStatusReqBodyBuilder {
+ builder.systemStatus = systemStatus
+ builder.systemStatusFlag = true
+ return builder
+}
+
+// 需要更新的字段
+//
+//示例值:['TITLE']
+func (builder *PatchSystemStatusReqBodyBuilder) UpdateFields(updateFields []string) *PatchSystemStatusReqBodyBuilder {
+ builder.updateFields = updateFields
+ builder.updateFieldsFlag = true
+ return builder
+}
+
+func (builder *PatchSystemStatusReqBodyBuilder) Build() *PatchSystemStatusReqBody {
+ req := &PatchSystemStatusReqBody{}
+ if builder.systemStatusFlag {
+ req.SystemStatus = builder.systemStatus
+ }
+ if builder.updateFieldsFlag {
+ req.UpdateFields = builder.updateFields
+ }
+ return req
+}
+
+type PatchSystemStatusPathReqBodyBuilder struct {
+ systemStatus *SystemStatus // 系统状态
+ systemStatusFlag bool
+ updateFields []string // 需要更新的字段
+ updateFieldsFlag bool
+}
+
+func NewPatchSystemStatusPathReqBodyBuilder() *PatchSystemStatusPathReqBodyBuilder {
+ builder := &PatchSystemStatusPathReqBodyBuilder{}
+ return builder
+}
+
+// 系统状态
+//
+// 示例值:
+func (builder *PatchSystemStatusPathReqBodyBuilder) SystemStatus(systemStatus *SystemStatus) *PatchSystemStatusPathReqBodyBuilder {
+ builder.systemStatus = systemStatus
+ builder.systemStatusFlag = true
+ return builder
+}
+
+// 需要更新的字段
+//
+// 示例值:['TITLE']
+func (builder *PatchSystemStatusPathReqBodyBuilder) UpdateFields(updateFields []string) *PatchSystemStatusPathReqBodyBuilder {
+ builder.updateFields = updateFields
+ builder.updateFieldsFlag = true
+ return builder
+}
+
+func (builder *PatchSystemStatusPathReqBodyBuilder) Build() (*PatchSystemStatusReqBody, error) {
+ req := &PatchSystemStatusReqBody{}
+ if builder.systemStatusFlag {
+ req.SystemStatus = builder.systemStatus
+ }
+ if builder.updateFieldsFlag {
+ req.UpdateFields = builder.updateFields
+ }
+ return req, nil
+}
+
+type PatchSystemStatusReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *PatchSystemStatusReqBody
+}
+
+func NewPatchSystemStatusReqBuilder() *PatchSystemStatusReqBuilder {
+ builder := &PatchSystemStatusReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 系统状态ID;;[获取系统状态ID](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/personal_settings-v1/system_status/list)
+//
+// 示例值:7101214603622940633
+func (builder *PatchSystemStatusReqBuilder) SystemStatusId(systemStatusId string) *PatchSystemStatusReqBuilder {
+ builder.apiReq.PathParams.Set("system_status_id", fmt.Sprint(systemStatusId))
+ return builder
+}
+
+// 修改租户维度系统状态。
+func (builder *PatchSystemStatusReqBuilder) Body(body *PatchSystemStatusReqBody) *PatchSystemStatusReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *PatchSystemStatusReqBuilder) Build() *PatchSystemStatusReq {
+ req := &PatchSystemStatusReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type PatchSystemStatusReqBody struct {
+ SystemStatus *SystemStatus `json:"system_status,omitempty"` // 系统状态
+ UpdateFields []string `json:"update_fields,omitempty"` // 需要更新的字段
+}
+
+type PatchSystemStatusReq struct {
+ apiReq *larkcore.ApiReq
+ Body *PatchSystemStatusReqBody `body:""`
+}
+
+type PatchSystemStatusRespData struct {
+ SystemStatus *SystemStatus `json:"system_status,omitempty"` // 系统状态
+}
+
+type PatchSystemStatusResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *PatchSystemStatusRespData `json:"data"` // 业务数据
+}
+
+func (resp *PatchSystemStatusResp) Success() bool {
+ return resp.Code == 0
+}
+
+type ListSystemStatusIterator struct {
+ nextPageToken *string
+ items []*SystemStatus
+ index int
+ limit int
+ ctx context.Context
+ req *ListSystemStatusReq
+ listFunc func(ctx context.Context, req *ListSystemStatusReq, options ...larkcore.RequestOptionFunc) (*ListSystemStatusResp, error)
+ options []larkcore.RequestOptionFunc
+ curlNum int
+}
+
+func (iterator *ListSystemStatusIterator) Next() (bool, *SystemStatus, error) {
+ // 达到最大量,则返回
+ if iterator.limit > 0 && iterator.curlNum >= iterator.limit {
+ return false, nil, nil
+ }
+
+ // 为0则拉取数据
+ if iterator.index == 0 || iterator.index >= len(iterator.items) {
+ if iterator.index != 0 && iterator.nextPageToken == nil {
+ return false, nil, nil
+ }
+ if iterator.nextPageToken != nil {
+ iterator.req.apiReq.QueryParams.Set("page_token", *iterator.nextPageToken)
+ }
+ resp, err := iterator.listFunc(iterator.ctx, iterator.req, iterator.options...)
+ if err != nil {
+ return false, nil, err
+ }
+
+ if resp.Code != 0 {
+ return false, nil, errors.New(fmt.Sprintf("Code:%d,Msg:%s", resp.Code, resp.Msg))
+ }
+
+ if len(resp.Data.Items) == 0 {
+ return false, nil, nil
+ }
+
+ iterator.nextPageToken = resp.Data.PageToken
+ iterator.items = resp.Data.Items
+ iterator.index = 0
+ }
+
+ block := iterator.items[iterator.index]
+ iterator.index++
+ iterator.curlNum++
+ return true, block, nil
+}
+
+func (iterator *ListSystemStatusIterator) NextPageToken() *string {
+ return iterator.nextPageToken
+}
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/search/v2/api.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/search/v2/api.go
index f71a8b298f..e3a934ba8c 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/search/v2/api.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/search/v2/api.go
@@ -22,29 +22,65 @@ import (
func NewService(config *larkcore.Config) *SearchService {
s := &SearchService{config: config}
+ s.App = &app{service: s}
s.DataSource = &dataSource{service: s}
s.DataSourceItem = &dataSourceItem{service: s}
+ s.Message = &message{service: s}
s.Schema = &schema{service: s}
return s
}
type SearchService struct {
config *larkcore.Config
+ App *app // app
DataSource *dataSource // 数据源
DataSourceItem *dataSourceItem // 数据项
+ Message *message // message
Schema *schema // 数据范式
}
+type app struct {
+ service *SearchService
+}
type dataSource struct {
service *SearchService
}
type dataSourceItem struct {
service *SearchService
}
+type message struct {
+ service *SearchService
+}
type schema struct {
service *SearchService
}
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=search&resource=app&version=v2
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/searchv2/create_app.go
+func (a *app) Create(ctx context.Context, req *CreateAppReq, options ...larkcore.RequestOptionFunc) (*CreateAppResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/search/v2/app"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}
+ apiResp, err := larkcore.Request(ctx, apiReq, a.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateAppResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, a.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
// 创建数据源
//
// - 创建一个数据源
@@ -261,6 +297,32 @@ func (d *dataSourceItem) Get(ctx context.Context, req *GetDataSourceItemReq, opt
return resp, err
}
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=search&resource=message&version=v2
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/searchv2/create_message.go
+func (m *message) Create(ctx context.Context, req *CreateMessageReq, options ...larkcore.RequestOptionFunc) (*CreateMessageResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/search/v2/message"
+ apiReq.HttpMethod = http.MethodPost
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}
+ apiResp, err := larkcore.Request(ctx, apiReq, m.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &CreateMessageResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, m.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
// 创建数据范式
//
// - 创建一个数据范式
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/search/v2/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/search/v2/model.go
index fc90104ff3..78f2fc7806 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/search/v2/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/search/v2/model.go
@@ -22,6 +22,12 @@ import (
"github.com/larksuite/oapi-sdk-go/v3/core"
)
+const (
+ UserIdTypeUserId = "user_id" // 以 user_id 来识别用户
+ UserIdTypeUnionId = "union_id" // 以 union_id 来识别用户
+ UserIdTypeOpenId = "open_id" // 以 open_id 来识别用户
+)
+
const (
StateOnline = 0 // 已上线
StateOffline = 1 // 未上线
@@ -40,6 +46,28 @@ const (
)
+const (
+ MessageTypeFile = "file" // 文件
+ MessageTypeImage = "image" // 图片
+ MessageTypeMedia = "media" // 视频
+)
+
+const (
+ FromTypeBot = "bot" // 机器人
+ FromTypeUser = "user" // 用户
+)
+
+const (
+ ChatTypeGroupChat = "group_chat" // 群聊
+ ChatTypeP2pChat = "p2p_chat" // 单聊
+)
+
+const (
+ UserIdTypeCreateMessageUserId = "user_id" // 以 user_id 来识别用户
+ UserIdTypeCreateMessageUnionId = "union_id" // 以 union_id 来识别用户
+ UserIdTypeCreateMessageOpenId = "open_id" // 以 open_id 来识别用户
+)
+
type Acl struct {
Access *string `json:"access,omitempty"` // 权限类型,优先级:Deny > Allow。
Value *string `json:"value,omitempty"` // 设置的权限值,例如 userID ,依赖 type 描述。;;**注**:在 type 为 user 且 access 为 allow 时,可填 "everyone" 来表示该数据项对全员可见;
@@ -1705,6 +1733,137 @@ func (builder *SchemaTypeDefinitionsBuilder) Build() *SchemaTypeDefinitions {
return req
}
+type CreateAppReqBodyBuilder struct {
+ query string // 搜索关键词
+ queryFlag bool
+}
+
+func NewCreateAppReqBodyBuilder() *CreateAppReqBodyBuilder {
+ builder := &CreateAppReqBodyBuilder{}
+ return builder
+}
+
+// 搜索关键词
+//
+//示例值:测试应用
+func (builder *CreateAppReqBodyBuilder) Query(query string) *CreateAppReqBodyBuilder {
+ builder.query = query
+ builder.queryFlag = true
+ return builder
+}
+
+func (builder *CreateAppReqBodyBuilder) Build() *CreateAppReqBody {
+ req := &CreateAppReqBody{}
+ if builder.queryFlag {
+ req.Query = &builder.query
+ }
+ return req
+}
+
+type CreateAppPathReqBodyBuilder struct {
+ query string // 搜索关键词
+ queryFlag bool
+}
+
+func NewCreateAppPathReqBodyBuilder() *CreateAppPathReqBodyBuilder {
+ builder := &CreateAppPathReqBodyBuilder{}
+ return builder
+}
+
+// 搜索关键词
+//
+// 示例值:测试应用
+func (builder *CreateAppPathReqBodyBuilder) Query(query string) *CreateAppPathReqBodyBuilder {
+ builder.query = query
+ builder.queryFlag = true
+ return builder
+}
+
+func (builder *CreateAppPathReqBodyBuilder) Build() (*CreateAppReqBody, error) {
+ req := &CreateAppReqBody{}
+ if builder.queryFlag {
+ req.Query = &builder.query
+ }
+ return req, nil
+}
+
+type CreateAppReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *CreateAppReqBody
+}
+
+func NewCreateAppReqBuilder() *CreateAppReqBuilder {
+ builder := &CreateAppReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:
+func (builder *CreateAppReqBuilder) UserIdType(userIdType string) *CreateAppReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 分页大小
+//
+// 示例值:
+func (builder *CreateAppReqBuilder) PageSize(pageSize int) *CreateAppReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 分页token
+//
+// 示例值:
+func (builder *CreateAppReqBuilder) PageToken(pageToken string) *CreateAppReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+//
+func (builder *CreateAppReqBuilder) Body(body *CreateAppReqBody) *CreateAppReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *CreateAppReqBuilder) Build() *CreateAppReq {
+ req := &CreateAppReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type CreateAppReqBody struct {
+ Query *string `json:"query,omitempty"` // 搜索关键词
+}
+
+type CreateAppReq struct {
+ apiReq *larkcore.ApiReq
+ Body *CreateAppReqBody `body:""`
+}
+
+type CreateAppRespData struct {
+ Items []string `json:"items,omitempty"` // app_id列表
+ PageToken *string `json:"page_token,omitempty"` // 翻页 token,传入返回下一页,首页不需要传入
+ HasMore *bool `json:"has_more,omitempty"` // 是否还有下一页
+}
+
+type CreateAppResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateAppRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateAppResp) Success() bool {
+ return resp.Code == 0
+}
+
type CreateDataSourceReqBuilder struct {
apiReq *larkcore.ApiReq
dataSource *DataSource
@@ -2323,6 +2482,369 @@ func (resp *GetDataSourceItemResp) Success() bool {
return resp.Code == 0
}
+type CreateMessageReqBodyBuilder struct {
+ query string // 搜索关键词
+ queryFlag bool
+ fromIds []string // 消息来自user_id列表
+ fromIdsFlag bool
+ chatIds []string // 消息所在chat_id列表
+ chatIdsFlag bool
+ messageType string // 消息类型(file/image/media)
+ messageTypeFlag bool
+ atChatterIds []string // at用户user_id列表
+ atChatterIdsFlag bool
+ fromType string // 消息来自类型(bot/user)
+ fromTypeFlag bool
+ chatType string // 会话类型(group_chat/p2p_chat)
+ chatTypeFlag bool
+ startTime string // 消息发送起始时间
+ startTimeFlag bool
+ endTime string // 消息发送结束时间
+ endTimeFlag bool
+}
+
+func NewCreateMessageReqBodyBuilder() *CreateMessageReqBodyBuilder {
+ builder := &CreateMessageReqBodyBuilder{}
+ return builder
+}
+
+// 搜索关键词
+//
+//示例值:测试消息
+func (builder *CreateMessageReqBodyBuilder) Query(query string) *CreateMessageReqBodyBuilder {
+ builder.query = query
+ builder.queryFlag = true
+ return builder
+}
+
+// 消息来自user_id列表
+//
+//示例值:
+func (builder *CreateMessageReqBodyBuilder) FromIds(fromIds []string) *CreateMessageReqBodyBuilder {
+ builder.fromIds = fromIds
+ builder.fromIdsFlag = true
+ return builder
+}
+
+// 消息所在chat_id列表
+//
+//示例值:
+func (builder *CreateMessageReqBodyBuilder) ChatIds(chatIds []string) *CreateMessageReqBodyBuilder {
+ builder.chatIds = chatIds
+ builder.chatIdsFlag = true
+ return builder
+}
+
+// 消息类型(file/image/media)
+//
+//示例值:
+func (builder *CreateMessageReqBodyBuilder) MessageType(messageType string) *CreateMessageReqBodyBuilder {
+ builder.messageType = messageType
+ builder.messageTypeFlag = true
+ return builder
+}
+
+// at用户user_id列表
+//
+//示例值:
+func (builder *CreateMessageReqBodyBuilder) AtChatterIds(atChatterIds []string) *CreateMessageReqBodyBuilder {
+ builder.atChatterIds = atChatterIds
+ builder.atChatterIdsFlag = true
+ return builder
+}
+
+// 消息来自类型(bot/user)
+//
+//示例值:
+func (builder *CreateMessageReqBodyBuilder) FromType(fromType string) *CreateMessageReqBodyBuilder {
+ builder.fromType = fromType
+ builder.fromTypeFlag = true
+ return builder
+}
+
+// 会话类型(group_chat/p2p_chat)
+//
+//示例值:
+func (builder *CreateMessageReqBodyBuilder) ChatType(chatType string) *CreateMessageReqBodyBuilder {
+ builder.chatType = chatType
+ builder.chatTypeFlag = true
+ return builder
+}
+
+// 消息发送起始时间
+//
+//示例值:1609296809
+func (builder *CreateMessageReqBodyBuilder) StartTime(startTime string) *CreateMessageReqBodyBuilder {
+ builder.startTime = startTime
+ builder.startTimeFlag = true
+ return builder
+}
+
+// 消息发送结束时间
+//
+//示例值:1609296809
+func (builder *CreateMessageReqBodyBuilder) EndTime(endTime string) *CreateMessageReqBodyBuilder {
+ builder.endTime = endTime
+ builder.endTimeFlag = true
+ return builder
+}
+
+func (builder *CreateMessageReqBodyBuilder) Build() *CreateMessageReqBody {
+ req := &CreateMessageReqBody{}
+ if builder.queryFlag {
+ req.Query = &builder.query
+ }
+ if builder.fromIdsFlag {
+ req.FromIds = builder.fromIds
+ }
+ if builder.chatIdsFlag {
+ req.ChatIds = builder.chatIds
+ }
+ if builder.messageTypeFlag {
+ req.MessageType = &builder.messageType
+ }
+ if builder.atChatterIdsFlag {
+ req.AtChatterIds = builder.atChatterIds
+ }
+ if builder.fromTypeFlag {
+ req.FromType = &builder.fromType
+ }
+ if builder.chatTypeFlag {
+ req.ChatType = &builder.chatType
+ }
+ if builder.startTimeFlag {
+ req.StartTime = &builder.startTime
+ }
+ if builder.endTimeFlag {
+ req.EndTime = &builder.endTime
+ }
+ return req
+}
+
+type CreateMessagePathReqBodyBuilder struct {
+ query string // 搜索关键词
+ queryFlag bool
+ fromIds []string // 消息来自user_id列表
+ fromIdsFlag bool
+ chatIds []string // 消息所在chat_id列表
+ chatIdsFlag bool
+ messageType string // 消息类型(file/image/media)
+ messageTypeFlag bool
+ atChatterIds []string // at用户user_id列表
+ atChatterIdsFlag bool
+ fromType string // 消息来自类型(bot/user)
+ fromTypeFlag bool
+ chatType string // 会话类型(group_chat/p2p_chat)
+ chatTypeFlag bool
+ startTime string // 消息发送起始时间
+ startTimeFlag bool
+ endTime string // 消息发送结束时间
+ endTimeFlag bool
+}
+
+func NewCreateMessagePathReqBodyBuilder() *CreateMessagePathReqBodyBuilder {
+ builder := &CreateMessagePathReqBodyBuilder{}
+ return builder
+}
+
+// 搜索关键词
+//
+// 示例值:测试消息
+func (builder *CreateMessagePathReqBodyBuilder) Query(query string) *CreateMessagePathReqBodyBuilder {
+ builder.query = query
+ builder.queryFlag = true
+ return builder
+}
+
+// 消息来自user_id列表
+//
+// 示例值:
+func (builder *CreateMessagePathReqBodyBuilder) FromIds(fromIds []string) *CreateMessagePathReqBodyBuilder {
+ builder.fromIds = fromIds
+ builder.fromIdsFlag = true
+ return builder
+}
+
+// 消息所在chat_id列表
+//
+// 示例值:
+func (builder *CreateMessagePathReqBodyBuilder) ChatIds(chatIds []string) *CreateMessagePathReqBodyBuilder {
+ builder.chatIds = chatIds
+ builder.chatIdsFlag = true
+ return builder
+}
+
+// 消息类型(file/image/media)
+//
+// 示例值:
+func (builder *CreateMessagePathReqBodyBuilder) MessageType(messageType string) *CreateMessagePathReqBodyBuilder {
+ builder.messageType = messageType
+ builder.messageTypeFlag = true
+ return builder
+}
+
+// at用户user_id列表
+//
+// 示例值:
+func (builder *CreateMessagePathReqBodyBuilder) AtChatterIds(atChatterIds []string) *CreateMessagePathReqBodyBuilder {
+ builder.atChatterIds = atChatterIds
+ builder.atChatterIdsFlag = true
+ return builder
+}
+
+// 消息来自类型(bot/user)
+//
+// 示例值:
+func (builder *CreateMessagePathReqBodyBuilder) FromType(fromType string) *CreateMessagePathReqBodyBuilder {
+ builder.fromType = fromType
+ builder.fromTypeFlag = true
+ return builder
+}
+
+// 会话类型(group_chat/p2p_chat)
+//
+// 示例值:
+func (builder *CreateMessagePathReqBodyBuilder) ChatType(chatType string) *CreateMessagePathReqBodyBuilder {
+ builder.chatType = chatType
+ builder.chatTypeFlag = true
+ return builder
+}
+
+// 消息发送起始时间
+//
+// 示例值:1609296809
+func (builder *CreateMessagePathReqBodyBuilder) StartTime(startTime string) *CreateMessagePathReqBodyBuilder {
+ builder.startTime = startTime
+ builder.startTimeFlag = true
+ return builder
+}
+
+// 消息发送结束时间
+//
+// 示例值:1609296809
+func (builder *CreateMessagePathReqBodyBuilder) EndTime(endTime string) *CreateMessagePathReqBodyBuilder {
+ builder.endTime = endTime
+ builder.endTimeFlag = true
+ return builder
+}
+
+func (builder *CreateMessagePathReqBodyBuilder) Build() (*CreateMessageReqBody, error) {
+ req := &CreateMessageReqBody{}
+ if builder.queryFlag {
+ req.Query = &builder.query
+ }
+ if builder.fromIdsFlag {
+ req.FromIds = builder.fromIds
+ }
+ if builder.chatIdsFlag {
+ req.ChatIds = builder.chatIds
+ }
+ if builder.messageTypeFlag {
+ req.MessageType = &builder.messageType
+ }
+ if builder.atChatterIdsFlag {
+ req.AtChatterIds = builder.atChatterIds
+ }
+ if builder.fromTypeFlag {
+ req.FromType = &builder.fromType
+ }
+ if builder.chatTypeFlag {
+ req.ChatType = &builder.chatType
+ }
+ if builder.startTimeFlag {
+ req.StartTime = &builder.startTime
+ }
+ if builder.endTimeFlag {
+ req.EndTime = &builder.endTime
+ }
+ return req, nil
+}
+
+type CreateMessageReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *CreateMessageReqBody
+}
+
+func NewCreateMessageReqBuilder() *CreateMessageReqBuilder {
+ builder := &CreateMessageReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:
+func (builder *CreateMessageReqBuilder) UserIdType(userIdType string) *CreateMessageReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+// 分页大小
+//
+// 示例值:
+func (builder *CreateMessageReqBuilder) PageSize(pageSize int) *CreateMessageReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 分页token
+//
+// 示例值:
+func (builder *CreateMessageReqBuilder) PageToken(pageToken string) *CreateMessageReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+//
+func (builder *CreateMessageReqBuilder) Body(body *CreateMessageReqBody) *CreateMessageReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *CreateMessageReqBuilder) Build() *CreateMessageReq {
+ req := &CreateMessageReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type CreateMessageReqBody struct {
+ Query *string `json:"query,omitempty"` // 搜索关键词
+ FromIds []string `json:"from_ids,omitempty"` // 消息来自user_id列表
+ ChatIds []string `json:"chat_ids,omitempty"` // 消息所在chat_id列表
+ MessageType *string `json:"message_type,omitempty"` // 消息类型(file/image/media)
+ AtChatterIds []string `json:"at_chatter_ids,omitempty"` // at用户user_id列表
+ FromType *string `json:"from_type,omitempty"` // 消息来自类型(bot/user)
+ ChatType *string `json:"chat_type,omitempty"` // 会话类型(group_chat/p2p_chat)
+ StartTime *string `json:"start_time,omitempty"` // 消息发送起始时间
+ EndTime *string `json:"end_time,omitempty"` // 消息发送结束时间
+}
+
+type CreateMessageReq struct {
+ apiReq *larkcore.ApiReq
+ Body *CreateMessageReqBody `body:""`
+}
+
+type CreateMessageRespData struct {
+ Items []string `json:"items,omitempty"` // 消息id列表
+ PageToken *string `json:"page_token,omitempty"` // 翻页 token,传入返回下一页,首页不需要传入
+ HasMore *bool `json:"has_more,omitempty"` // 是否还有下一页
+}
+
+type CreateMessageResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *CreateMessageRespData `json:"data"` // 业务数据
+}
+
+func (resp *CreateMessageResp) Success() bool {
+ return resp.Code == 0
+}
+
type CreateSchemaReqBuilder struct {
apiReq *larkcore.ApiReq
schema *Schema
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/sheets/v3/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/sheets/v3/model.go
index 89bb0e4de5..17819d400d 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/sheets/v3/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/sheets/v3/model.go
@@ -73,6 +73,54 @@ func (builder *AddSheetBuilder) Build() *AddSheet {
return req
}
+type AlignmentStyle struct {
+ HorizontalAlignment *string `json:"horizontal_alignment,omitempty"` // 水平对齐策略
+ VerticalAlignment *string `json:"vertical_alignment,omitempty"` // 垂直对齐策略
+}
+
+type AlignmentStyleBuilder struct {
+ horizontalAlignment string // 水平对齐策略
+ horizontalAlignmentFlag bool
+ verticalAlignment string // 垂直对齐策略
+ verticalAlignmentFlag bool
+}
+
+func NewAlignmentStyleBuilder() *AlignmentStyleBuilder {
+ builder := &AlignmentStyleBuilder{}
+ return builder
+}
+
+// 水平对齐策略
+//
+// 示例值:Left
+func (builder *AlignmentStyleBuilder) HorizontalAlignment(horizontalAlignment string) *AlignmentStyleBuilder {
+ builder.horizontalAlignment = horizontalAlignment
+ builder.horizontalAlignmentFlag = true
+ return builder
+}
+
+// 垂直对齐策略
+//
+// 示例值:Top
+func (builder *AlignmentStyleBuilder) VerticalAlignment(verticalAlignment string) *AlignmentStyleBuilder {
+ builder.verticalAlignment = verticalAlignment
+ builder.verticalAlignmentFlag = true
+ return builder
+}
+
+func (builder *AlignmentStyleBuilder) Build() *AlignmentStyle {
+ req := &AlignmentStyle{}
+ if builder.horizontalAlignmentFlag {
+ req.HorizontalAlignment = &builder.horizontalAlignment
+
+ }
+ if builder.verticalAlignmentFlag {
+ req.VerticalAlignment = &builder.verticalAlignment
+
+ }
+ return req
+}
+
type AppendDimension struct {
MajorDimension *string `json:"major_dimension,omitempty"` // 操作行还是列,取值:ROWS、COLUMNS
Length *int `json:"length,omitempty"` // 数量
@@ -185,642 +233,792 @@ func (builder *BitablePropertiesBuilder) Build() *BitableProperties {
return req
}
-type CellValue struct {
- Type *string `json:"type,omitempty"` // 元素类型
- Text *Text `json:"text,omitempty"` //
- MentionUser *MentionUser `json:"mention_user,omitempty"` //
- MentionDocument *MentionDocument `json:"mention_document,omitempty"` //
- Value *ValueElement `json:"value,omitempty"` //
- DateTime *DateTime `json:"date_time,omitempty"` //
- File *File `json:"file,omitempty"` //
- Image *Image `json:"image,omitempty"` //
- Link *Link `json:"link,omitempty"` //
- Reminder *Reminder `json:"reminder,omitempty"` //
- Formula *Formula `json:"formula,omitempty"` //
+type BoolRuleValue struct {
+ Type *string `json:"type,omitempty"` // 条件值类型
+ Number *string `json:"number,omitempty"` // 数值,当type=Number时必须有
+ Text *string `json:"text,omitempty"` // 文本,当type=Text时必须有
+ TimePeriod *string `json:"time_period,omitempty"` // 时间区间
}
-type CellValueBuilder struct {
- type_ string // 元素类型
- typeFlag bool
- text *Text //
- textFlag bool
- mentionUser *MentionUser //
- mentionUserFlag bool
- mentionDocument *MentionDocument //
- mentionDocumentFlag bool
- value *ValueElement //
- valueFlag bool
- dateTime *DateTime //
- dateTimeFlag bool
- file *File //
- fileFlag bool
- image *Image //
- imageFlag bool
- link *Link //
- linkFlag bool
- reminder *Reminder //
- reminderFlag bool
- formula *Formula //
- formulaFlag bool
+type BoolRuleValueBuilder struct {
+ type_ string // 条件值类型
+ typeFlag bool
+ number string // 数值,当type=Number时必须有
+ numberFlag bool
+ text string // 文本,当type=Text时必须有
+ textFlag bool
+ timePeriod string // 时间区间
+ timePeriodFlag bool
}
-func NewCellValueBuilder() *CellValueBuilder {
- builder := &CellValueBuilder{}
+func NewBoolRuleValueBuilder() *BoolRuleValueBuilder {
+ builder := &BoolRuleValueBuilder{}
return builder
}
-// 元素类型
+// 条件值类型
//
-// 示例值:text
-func (builder *CellValueBuilder) Type(type_ string) *CellValueBuilder {
+// 示例值:Number
+func (builder *BoolRuleValueBuilder) Type(type_ string) *BoolRuleValueBuilder {
builder.type_ = type_
builder.typeFlag = true
return builder
}
+// 数值,当type=Number时必须有
//
+// 示例值:12
+func (builder *BoolRuleValueBuilder) Number(number string) *BoolRuleValueBuilder {
+ builder.number = number
+ builder.numberFlag = true
+ return builder
+}
+
+// 文本,当type=Text时必须有
//
-// 示例值:
-func (builder *CellValueBuilder) Text(text *Text) *CellValueBuilder {
+// 示例值:abc
+func (builder *BoolRuleValueBuilder) Text(text string) *BoolRuleValueBuilder {
builder.text = text
builder.textFlag = true
return builder
}
+// 时间区间
//
-//
-// 示例值:
-func (builder *CellValueBuilder) MentionUser(mentionUser *MentionUser) *CellValueBuilder {
- builder.mentionUser = mentionUser
- builder.mentionUserFlag = true
+// 示例值:Today
+func (builder *BoolRuleValueBuilder) TimePeriod(timePeriod string) *BoolRuleValueBuilder {
+ builder.timePeriod = timePeriod
+ builder.timePeriodFlag = true
return builder
}
-//
-//
-// 示例值:
-func (builder *CellValueBuilder) MentionDocument(mentionDocument *MentionDocument) *CellValueBuilder {
- builder.mentionDocument = mentionDocument
- builder.mentionDocumentFlag = true
+func (builder *BoolRuleValueBuilder) Build() *BoolRuleValue {
+ req := &BoolRuleValue{}
+ if builder.typeFlag {
+ req.Type = &builder.type_
+
+ }
+ if builder.numberFlag {
+ req.Number = &builder.number
+
+ }
+ if builder.textFlag {
+ req.Text = &builder.text
+
+ }
+ if builder.timePeriodFlag {
+ req.TimePeriod = &builder.timePeriod
+
+ }
+ return req
+}
+
+type BooleanRuleCondition struct {
+ Type *string `json:"type,omitempty"` // 条件格式类型
+ BooleanConditionalValues []*BoolRuleValue `json:"boolean_conditional_values,omitempty"` // 条件格式值,根据条件格式类型传入相应的值
+}
+
+type BooleanRuleConditionBuilder struct {
+ type_ string // 条件格式类型
+ typeFlag bool
+ booleanConditionalValues []*BoolRuleValue // 条件格式值,根据条件格式类型传入相应的值
+ booleanConditionalValuesFlag bool
+}
+
+func NewBooleanRuleConditionBuilder() *BooleanRuleConditionBuilder {
+ builder := &BooleanRuleConditionBuilder{}
return builder
}
+// 条件格式类型
//
-//
-// 示例值:
-func (builder *CellValueBuilder) Value(value *ValueElement) *CellValueBuilder {
- builder.value = value
- builder.valueFlag = true
+// 示例值:CellEqual
+func (builder *BooleanRuleConditionBuilder) Type(type_ string) *BooleanRuleConditionBuilder {
+ builder.type_ = type_
+ builder.typeFlag = true
return builder
}
-//
+// 条件格式值,根据条件格式类型传入相应的值
//
// 示例值:
-func (builder *CellValueBuilder) DateTime(dateTime *DateTime) *CellValueBuilder {
- builder.dateTime = dateTime
- builder.dateTimeFlag = true
+func (builder *BooleanRuleConditionBuilder) BooleanConditionalValues(booleanConditionalValues []*BoolRuleValue) *BooleanRuleConditionBuilder {
+ builder.booleanConditionalValues = booleanConditionalValues
+ builder.booleanConditionalValuesFlag = true
return builder
}
-//
-//
-// 示例值:
-func (builder *CellValueBuilder) File(file *File) *CellValueBuilder {
- builder.file = file
- builder.fileFlag = true
+func (builder *BooleanRuleConditionBuilder) Build() *BooleanRuleCondition {
+ req := &BooleanRuleCondition{}
+ if builder.typeFlag {
+ req.Type = &builder.type_
+
+ }
+ if builder.booleanConditionalValuesFlag {
+ req.BooleanConditionalValues = builder.booleanConditionalValues
+ }
+ return req
+}
+
+type BorderStyle struct {
+ Top *TopBorderStyle `json:"top,omitempty"` // 上边框样式
+ Left *LeftBorderStyle `json:"left,omitempty"` // 左边框样式
+ Right *RightBorderStyle `json:"right,omitempty"` // 右边框样式
+ Bottom *BottomBorderStyle `json:"bottom,omitempty"` // 下边框样式
+}
+
+type BorderStyleBuilder struct {
+ top *TopBorderStyle // 上边框样式
+ topFlag bool
+ left *LeftBorderStyle // 左边框样式
+ leftFlag bool
+ right *RightBorderStyle // 右边框样式
+ rightFlag bool
+ bottom *BottomBorderStyle // 下边框样式
+ bottomFlag bool
+}
+
+func NewBorderStyleBuilder() *BorderStyleBuilder {
+ builder := &BorderStyleBuilder{}
return builder
}
-//
+// 上边框样式
//
// 示例值:
-func (builder *CellValueBuilder) Image(image *Image) *CellValueBuilder {
- builder.image = image
- builder.imageFlag = true
+func (builder *BorderStyleBuilder) Top(top *TopBorderStyle) *BorderStyleBuilder {
+ builder.top = top
+ builder.topFlag = true
return builder
}
-//
+// 左边框样式
//
// 示例值:
-func (builder *CellValueBuilder) Link(link *Link) *CellValueBuilder {
- builder.link = link
- builder.linkFlag = true
+func (builder *BorderStyleBuilder) Left(left *LeftBorderStyle) *BorderStyleBuilder {
+ builder.left = left
+ builder.leftFlag = true
return builder
}
-//
+// 右边框样式
//
// 示例值:
-func (builder *CellValueBuilder) Reminder(reminder *Reminder) *CellValueBuilder {
- builder.reminder = reminder
- builder.reminderFlag = true
+func (builder *BorderStyleBuilder) Right(right *RightBorderStyle) *BorderStyleBuilder {
+ builder.right = right
+ builder.rightFlag = true
return builder
}
-//
+// 下边框样式
//
// 示例值:
-func (builder *CellValueBuilder) Formula(formula *Formula) *CellValueBuilder {
- builder.formula = formula
- builder.formulaFlag = true
+func (builder *BorderStyleBuilder) Bottom(bottom *BottomBorderStyle) *BorderStyleBuilder {
+ builder.bottom = bottom
+ builder.bottomFlag = true
return builder
}
-func (builder *CellValueBuilder) Build() *CellValue {
- req := &CellValue{}
- if builder.typeFlag {
- req.Type = &builder.type_
-
- }
- if builder.textFlag {
- req.Text = builder.text
- }
- if builder.mentionUserFlag {
- req.MentionUser = builder.mentionUser
- }
- if builder.mentionDocumentFlag {
- req.MentionDocument = builder.mentionDocument
- }
- if builder.valueFlag {
- req.Value = builder.value
+func (builder *BorderStyleBuilder) Build() *BorderStyle {
+ req := &BorderStyle{}
+ if builder.topFlag {
+ req.Top = builder.top
}
- if builder.dateTimeFlag {
- req.DateTime = builder.dateTime
- }
- if builder.fileFlag {
- req.File = builder.file
- }
- if builder.imageFlag {
- req.Image = builder.image
+ if builder.leftFlag {
+ req.Left = builder.left
}
- if builder.linkFlag {
- req.Link = builder.link
- }
- if builder.reminderFlag {
- req.Reminder = builder.reminder
+ if builder.rightFlag {
+ req.Right = builder.right
}
- if builder.formulaFlag {
- req.Formula = builder.formula
+ if builder.bottomFlag {
+ req.Bottom = builder.bottom
}
return req
}
-type Condition struct {
- FilterType *string `json:"filter_type,omitempty"` // 筛选类型
- CompareType *string `json:"compare_type,omitempty"` // 比较类型
- Expected []string `json:"expected,omitempty"` // 筛选参数
-}
-
-type ConditionBuilder struct {
- filterType string // 筛选类型
- filterTypeFlag bool
- compareType string // 比较类型
- compareTypeFlag bool
- expected []string // 筛选参数
- expectedFlag bool
+type BottomBorderStyle struct {
+ Style *string `json:"style,omitempty"` // 边框样式
+ Color *string `json:"color,omitempty"` // 边框颜色
}
-func NewConditionBuilder() *ConditionBuilder {
- builder := &ConditionBuilder{}
- return builder
+type BottomBorderStyleBuilder struct {
+ style string // 边框样式
+ styleFlag bool
+ color string // 边框颜色
+ colorFlag bool
}
-// 筛选类型
-//
-// 示例值:number
-func (builder *ConditionBuilder) FilterType(filterType string) *ConditionBuilder {
- builder.filterType = filterType
- builder.filterTypeFlag = true
+func NewBottomBorderStyleBuilder() *BottomBorderStyleBuilder {
+ builder := &BottomBorderStyleBuilder{}
return builder
}
-// 比较类型
+// 边框样式
//
-// 示例值:less
-func (builder *ConditionBuilder) CompareType(compareType string) *ConditionBuilder {
- builder.compareType = compareType
- builder.compareTypeFlag = true
+// 示例值:
+func (builder *BottomBorderStyleBuilder) Style(style string) *BottomBorderStyleBuilder {
+ builder.style = style
+ builder.styleFlag = true
return builder
}
-// 筛选参数
+// 边框颜色
//
-// 示例值:6
-func (builder *ConditionBuilder) Expected(expected []string) *ConditionBuilder {
- builder.expected = expected
- builder.expectedFlag = true
+// 示例值:#ff00ff
+func (builder *BottomBorderStyleBuilder) Color(color string) *BottomBorderStyleBuilder {
+ builder.color = color
+ builder.colorFlag = true
return builder
}
-func (builder *ConditionBuilder) Build() *Condition {
- req := &Condition{}
- if builder.filterTypeFlag {
- req.FilterType = &builder.filterType
+func (builder *BottomBorderStyleBuilder) Build() *BottomBorderStyle {
+ req := &BottomBorderStyle{}
+ if builder.styleFlag {
+ req.Style = &builder.style
}
- if builder.compareTypeFlag {
- req.CompareType = &builder.compareType
+ if builder.colorFlag {
+ req.Color = &builder.color
}
- if builder.expectedFlag {
- req.Expected = builder.expected
- }
return req
}
-type CreateSheetFilter struct {
- Range *string `json:"range,omitempty"` // 筛选应用范围
- Col *string `json:"col,omitempty"` // 设置筛选条件的列
- Condition *Condition `json:"condition,omitempty"` // 筛选的条件
+type CellFontStyle struct {
+ Bold *bool `json:"bold,omitempty"` // 是否加粗
+ Italic *bool `json:"italic,omitempty"` // 是否斜体
+ Strikethrough *bool `json:"strikethrough,omitempty"` // 是否设置删除线
+ Underline *bool `json:"underline,omitempty"` // 是否展示下划线
+ ForegroundColor *string `json:"foreground_color,omitempty"` // 字体颜色
+ BackgroundColor *string `json:"background_color,omitempty"` // 背景颜色
}
-type CreateSheetFilterBuilder struct {
- range_ string // 筛选应用范围
- rangeFlag bool
- col string // 设置筛选条件的列
- colFlag bool
- condition *Condition // 筛选的条件
- conditionFlag bool
+type CellFontStyleBuilder struct {
+ bold bool // 是否加粗
+ boldFlag bool
+ italic bool // 是否斜体
+ italicFlag bool
+ strikethrough bool // 是否设置删除线
+ strikethroughFlag bool
+ underline bool // 是否展示下划线
+ underlineFlag bool
+ foregroundColor string // 字体颜色
+ foregroundColorFlag bool
+ backgroundColor string // 背景颜色
+ backgroundColorFlag bool
}
-func NewCreateSheetFilterBuilder() *CreateSheetFilterBuilder {
- builder := &CreateSheetFilterBuilder{}
+func NewCellFontStyleBuilder() *CellFontStyleBuilder {
+ builder := &CellFontStyleBuilder{}
return builder
}
-// 筛选应用范围
+// 是否加粗
//
-// 示例值:xxxxxx!C1:H14
-func (builder *CreateSheetFilterBuilder) Range(range_ string) *CreateSheetFilterBuilder {
- builder.range_ = range_
- builder.rangeFlag = true
+// 示例值:true
+func (builder *CellFontStyleBuilder) Bold(bold bool) *CellFontStyleBuilder {
+ builder.bold = bold
+ builder.boldFlag = true
return builder
}
-// 设置筛选条件的列
+// 是否斜体
//
-// 示例值:E
-func (builder *CreateSheetFilterBuilder) Col(col string) *CreateSheetFilterBuilder {
- builder.col = col
- builder.colFlag = true
+// 示例值:true
+func (builder *CellFontStyleBuilder) Italic(italic bool) *CellFontStyleBuilder {
+ builder.italic = italic
+ builder.italicFlag = true
return builder
}
-// 筛选的条件
+// 是否设置删除线
//
-// 示例值:
-func (builder *CreateSheetFilterBuilder) Condition(condition *Condition) *CreateSheetFilterBuilder {
- builder.condition = condition
- builder.conditionFlag = true
+// 示例值:true
+func (builder *CellFontStyleBuilder) Strikethrough(strikethrough bool) *CellFontStyleBuilder {
+ builder.strikethrough = strikethrough
+ builder.strikethroughFlag = true
return builder
}
-func (builder *CreateSheetFilterBuilder) Build() *CreateSheetFilter {
- req := &CreateSheetFilter{}
- if builder.rangeFlag {
- req.Range = &builder.range_
-
- }
- if builder.colFlag {
- req.Col = &builder.col
-
- }
- if builder.conditionFlag {
- req.Condition = builder.condition
- }
- return req
-}
-
-type DateTime struct {
- DateTime *string `json:"date_time,omitempty"` // 时间日期
-}
-
-type DateTimeBuilder struct {
- dateTime string // 时间日期
- dateTimeFlag bool
+// 是否展示下划线
+//
+// 示例值:true
+func (builder *CellFontStyleBuilder) Underline(underline bool) *CellFontStyleBuilder {
+ builder.underline = underline
+ builder.underlineFlag = true
+ return builder
}
-func NewDateTimeBuilder() *DateTimeBuilder {
- builder := &DateTimeBuilder{}
+// 字体颜色
+//
+// 示例值:#ff00ff
+func (builder *CellFontStyleBuilder) ForegroundColor(foregroundColor string) *CellFontStyleBuilder {
+ builder.foregroundColor = foregroundColor
+ builder.foregroundColorFlag = true
return builder
}
-// 时间日期
+// 背景颜色
//
-// 示例值:2022/02/22
-func (builder *DateTimeBuilder) DateTime(dateTime string) *DateTimeBuilder {
- builder.dateTime = dateTime
- builder.dateTimeFlag = true
+// 示例值:#ff00ff
+func (builder *CellFontStyleBuilder) BackgroundColor(backgroundColor string) *CellFontStyleBuilder {
+ builder.backgroundColor = backgroundColor
+ builder.backgroundColorFlag = true
return builder
}
-func (builder *DateTimeBuilder) Build() *DateTime {
- req := &DateTime{}
- if builder.dateTimeFlag {
- req.DateTime = &builder.dateTime
+func (builder *CellFontStyleBuilder) Build() *CellFontStyle {
+ req := &CellFontStyle{}
+ if builder.boldFlag {
+ req.Bold = &builder.bold
+
+ }
+ if builder.italicFlag {
+ req.Italic = &builder.italic
+
+ }
+ if builder.strikethroughFlag {
+ req.Strikethrough = &builder.strikethrough
+
+ }
+ if builder.underlineFlag {
+ req.Underline = &builder.underline
+
+ }
+ if builder.foregroundColorFlag {
+ req.ForegroundColor = &builder.foregroundColor
+
+ }
+ if builder.backgroundColorFlag {
+ req.BackgroundColor = &builder.backgroundColor
}
return req
}
-type Dimension struct {
- MajorDimension *string `json:"major_dimension,omitempty"` // 操作行还是列,取值:ROWS、COLUMNS
- StartIndex *int `json:"start_index,omitempty"` // 起始行或者列号
- EndIndex *int `json:"end_index,omitempty"` // 结束行或者列号
+type CellStyle struct {
+ FontStyle *CellFontStyle `json:"font_style,omitempty"` // 字体样式
+ BorderStyle *BorderStyle `json:"border_style,omitempty"` // 边框颜色
+ AlignmentStyle *AlignmentStyle `json:"alignment_style,omitempty"` // 对齐方式
+ WrapStrategy *string `json:"wrap_strategy,omitempty"` // 文本换行
+ Format *string `json:"format,omitempty"` // 数字格式
}
-type DimensionBuilder struct {
- majorDimension string // 操作行还是列,取值:ROWS、COLUMNS
- majorDimensionFlag bool
- startIndex int // 起始行或者列号
- startIndexFlag bool
- endIndex int // 结束行或者列号
- endIndexFlag bool
+type CellStyleBuilder struct {
+ fontStyle *CellFontStyle // 字体样式
+ fontStyleFlag bool
+ borderStyle *BorderStyle // 边框颜色
+ borderStyleFlag bool
+ alignmentStyle *AlignmentStyle // 对齐方式
+ alignmentStyleFlag bool
+ wrapStrategy string // 文本换行
+ wrapStrategyFlag bool
+ format string // 数字格式
+ formatFlag bool
}
-func NewDimensionBuilder() *DimensionBuilder {
- builder := &DimensionBuilder{}
+func NewCellStyleBuilder() *CellStyleBuilder {
+ builder := &CellStyleBuilder{}
return builder
}
-// 操作行还是列,取值:ROWS、COLUMNS
+// 字体样式
//
-// 示例值:ROWS
-func (builder *DimensionBuilder) MajorDimension(majorDimension string) *DimensionBuilder {
- builder.majorDimension = majorDimension
- builder.majorDimensionFlag = true
+// 示例值:
+func (builder *CellStyleBuilder) FontStyle(fontStyle *CellFontStyle) *CellStyleBuilder {
+ builder.fontStyle = fontStyle
+ builder.fontStyleFlag = true
return builder
}
-// 起始行或者列号
+// 边框颜色
//
-// 示例值:0
-func (builder *DimensionBuilder) StartIndex(startIndex int) *DimensionBuilder {
- builder.startIndex = startIndex
- builder.startIndexFlag = true
+// 示例值:
+func (builder *CellStyleBuilder) BorderStyle(borderStyle *BorderStyle) *CellStyleBuilder {
+ builder.borderStyle = borderStyle
+ builder.borderStyleFlag = true
return builder
}
-// 结束行或者列号
+// 对齐方式
//
-// 示例值:1
-func (builder *DimensionBuilder) EndIndex(endIndex int) *DimensionBuilder {
- builder.endIndex = endIndex
- builder.endIndexFlag = true
+// 示例值:
+func (builder *CellStyleBuilder) AlignmentStyle(alignmentStyle *AlignmentStyle) *CellStyleBuilder {
+ builder.alignmentStyle = alignmentStyle
+ builder.alignmentStyleFlag = true
return builder
}
-func (builder *DimensionBuilder) Build() *Dimension {
- req := &Dimension{}
- if builder.majorDimensionFlag {
- req.MajorDimension = &builder.majorDimension
+// 文本换行
+//
+// 示例值:Overflow
+func (builder *CellStyleBuilder) WrapStrategy(wrapStrategy string) *CellStyleBuilder {
+ builder.wrapStrategy = wrapStrategy
+ builder.wrapStrategyFlag = true
+ return builder
+}
+
+// 数字格式
+//
+// 示例值:yyyy/MM/dd
+func (builder *CellStyleBuilder) Format(format string) *CellStyleBuilder {
+ builder.format = format
+ builder.formatFlag = true
+ return builder
+}
+func (builder *CellStyleBuilder) Build() *CellStyle {
+ req := &CellStyle{}
+ if builder.fontStyleFlag {
+ req.FontStyle = builder.fontStyle
}
- if builder.startIndexFlag {
- req.StartIndex = &builder.startIndex
+ if builder.borderStyleFlag {
+ req.BorderStyle = builder.borderStyle
+ }
+ if builder.alignmentStyleFlag {
+ req.AlignmentStyle = builder.alignmentStyle
+ }
+ if builder.wrapStrategyFlag {
+ req.WrapStrategy = &builder.wrapStrategy
}
- if builder.endIndexFlag {
- req.EndIndex = &builder.endIndex
+ if builder.formatFlag {
+ req.Format = &builder.format
}
return req
}
-type DimensionProperties struct {
- Hidden *bool `json:"hidden,omitempty"` // 是否隐藏
- PixelSize *int `json:"pixel_size,omitempty"` // 行/列像素大小
+type CellValue struct {
+ Type *string `json:"type,omitempty"` // 元素类型
+ Text *Text `json:"text,omitempty"` //
+ MentionUser *MentionUser `json:"mention_user,omitempty"` //
+ MentionDocument *MentionDocument `json:"mention_document,omitempty"` //
+ Value *ValueElement `json:"value,omitempty"` //
+ DateTime *DateTime `json:"date_time,omitempty"` //
+ File *File `json:"file,omitempty"` //
+ Image *Image `json:"image,omitempty"` //
+ Link *Link `json:"link,omitempty"` //
+ Reminder *Reminder `json:"reminder,omitempty"` //
+ Formula *Formula `json:"formula,omitempty"` //
}
-type DimensionPropertiesBuilder struct {
- hidden bool // 是否隐藏
- hiddenFlag bool
- pixelSize int // 行/列像素大小
- pixelSizeFlag bool
+type CellValueBuilder struct {
+ type_ string // 元素类型
+ typeFlag bool
+ text *Text //
+ textFlag bool
+ mentionUser *MentionUser //
+ mentionUserFlag bool
+ mentionDocument *MentionDocument //
+ mentionDocumentFlag bool
+ value *ValueElement //
+ valueFlag bool
+ dateTime *DateTime //
+ dateTimeFlag bool
+ file *File //
+ fileFlag bool
+ image *Image //
+ imageFlag bool
+ link *Link //
+ linkFlag bool
+ reminder *Reminder //
+ reminderFlag bool
+ formula *Formula //
+ formulaFlag bool
}
-func NewDimensionPropertiesBuilder() *DimensionPropertiesBuilder {
- builder := &DimensionPropertiesBuilder{}
+func NewCellValueBuilder() *CellValueBuilder {
+ builder := &CellValueBuilder{}
return builder
}
-// 是否隐藏
+// 元素类型
//
-// 示例值:false
-func (builder *DimensionPropertiesBuilder) Hidden(hidden bool) *DimensionPropertiesBuilder {
- builder.hidden = hidden
- builder.hiddenFlag = true
+// 示例值:text
+func (builder *CellValueBuilder) Type(type_ string) *CellValueBuilder {
+ builder.type_ = type_
+ builder.typeFlag = true
return builder
}
-// 行/列像素大小
//
-// 示例值:100
-func (builder *DimensionPropertiesBuilder) PixelSize(pixelSize int) *DimensionPropertiesBuilder {
- builder.pixelSize = pixelSize
- builder.pixelSizeFlag = true
+//
+// 示例值:
+func (builder *CellValueBuilder) Text(text *Text) *CellValueBuilder {
+ builder.text = text
+ builder.textFlag = true
return builder
}
-func (builder *DimensionPropertiesBuilder) Build() *DimensionProperties {
- req := &DimensionProperties{}
- if builder.hiddenFlag {
- req.Hidden = &builder.hidden
-
- }
- if builder.pixelSizeFlag {
- req.PixelSize = &builder.pixelSize
-
- }
- return req
+//
+//
+// 示例值:
+func (builder *CellValueBuilder) MentionUser(mentionUser *MentionUser) *CellValueBuilder {
+ builder.mentionUser = mentionUser
+ builder.mentionUserFlag = true
+ return builder
}
-type File struct {
- FileToken *string `json:"file_token,omitempty"` // 附件token
- Name *string `json:"name,omitempty"` // 附件名称
- SegmentStyle *SegmentStyle `json:"segment_style,omitempty"` //
+//
+//
+// 示例值:
+func (builder *CellValueBuilder) MentionDocument(mentionDocument *MentionDocument) *CellValueBuilder {
+ builder.mentionDocument = mentionDocument
+ builder.mentionDocumentFlag = true
+ return builder
}
-type FileBuilder struct {
- fileToken string // 附件token
- fileTokenFlag bool
- name string // 附件名称
- nameFlag bool
- segmentStyle *SegmentStyle //
- segmentStyleFlag bool
+//
+//
+// 示例值:
+func (builder *CellValueBuilder) Value(value *ValueElement) *CellValueBuilder {
+ builder.value = value
+ builder.valueFlag = true
+ return builder
}
-func NewFileBuilder() *FileBuilder {
- builder := &FileBuilder{}
+//
+//
+// 示例值:
+func (builder *CellValueBuilder) DateTime(dateTime *DateTime) *CellValueBuilder {
+ builder.dateTime = dateTime
+ builder.dateTimeFlag = true
return builder
}
-// 附件token
//
-// 示例值:boxxxxxxx
-func (builder *FileBuilder) FileToken(fileToken string) *FileBuilder {
- builder.fileToken = fileToken
- builder.fileTokenFlag = true
+//
+// 示例值:
+func (builder *CellValueBuilder) File(file *File) *CellValueBuilder {
+ builder.file = file
+ builder.fileFlag = true
return builder
}
-// 附件名称
//
-// 示例值:a.png
-func (builder *FileBuilder) Name(name string) *FileBuilder {
- builder.name = name
- builder.nameFlag = true
+//
+// 示例值:
+func (builder *CellValueBuilder) Image(image *Image) *CellValueBuilder {
+ builder.image = image
+ builder.imageFlag = true
return builder
}
//
//
// 示例值:
-func (builder *FileBuilder) SegmentStyle(segmentStyle *SegmentStyle) *FileBuilder {
- builder.segmentStyle = segmentStyle
- builder.segmentStyleFlag = true
+func (builder *CellValueBuilder) Link(link *Link) *CellValueBuilder {
+ builder.link = link
+ builder.linkFlag = true
return builder
}
-func (builder *FileBuilder) Build() *File {
- req := &File{}
- if builder.fileTokenFlag {
- req.FileToken = &builder.fileToken
-
- }
- if builder.nameFlag {
- req.Name = &builder.name
+//
+//
+// 示例值:
+func (builder *CellValueBuilder) Reminder(reminder *Reminder) *CellValueBuilder {
+ builder.reminder = reminder
+ builder.reminderFlag = true
+ return builder
+}
+
+//
+//
+// 示例值:
+func (builder *CellValueBuilder) Formula(formula *Formula) *CellValueBuilder {
+ builder.formula = formula
+ builder.formulaFlag = true
+ return builder
+}
+
+func (builder *CellValueBuilder) Build() *CellValue {
+ req := &CellValue{}
+ if builder.typeFlag {
+ req.Type = &builder.type_
}
- if builder.segmentStyleFlag {
- req.SegmentStyle = builder.segmentStyle
+ if builder.textFlag {
+ req.Text = builder.text
+ }
+ if builder.mentionUserFlag {
+ req.MentionUser = builder.mentionUser
+ }
+ if builder.mentionDocumentFlag {
+ req.MentionDocument = builder.mentionDocument
+ }
+ if builder.valueFlag {
+ req.Value = builder.value
+ }
+ if builder.dateTimeFlag {
+ req.DateTime = builder.dateTime
+ }
+ if builder.fileFlag {
+ req.File = builder.file
+ }
+ if builder.imageFlag {
+ req.Image = builder.image
+ }
+ if builder.linkFlag {
+ req.Link = builder.link
+ }
+ if builder.reminderFlag {
+ req.Reminder = builder.reminder
+ }
+ if builder.formulaFlag {
+ req.Formula = builder.formula
}
return req
}
-type FilterInfo struct {
- Col *string `json:"col,omitempty"` // 设置了筛选条件的列
- Conditions []*Condition `json:"conditions,omitempty"` // 筛选条件
+type Checkbox struct {
+ DataValidationId *int `json:"data_validation_id,omitempty"` // 数据校验ID
+ DataValiditonValue *string `json:"data_validiton_value,omitempty"` // 复选框值
}
-type FilterInfoBuilder struct {
- col string // 设置了筛选条件的列
- colFlag bool
- conditions []*Condition // 筛选条件
- conditionsFlag bool
+type CheckboxBuilder struct {
+ dataValidationId int // 数据校验ID
+ dataValidationIdFlag bool
+ dataValiditonValue string // 复选框值
+ dataValiditonValueFlag bool
}
-func NewFilterInfoBuilder() *FilterInfoBuilder {
- builder := &FilterInfoBuilder{}
+func NewCheckboxBuilder() *CheckboxBuilder {
+ builder := &CheckboxBuilder{}
return builder
}
-// 设置了筛选条件的列
+// 数据校验ID
//
-// 示例值:E
-func (builder *FilterInfoBuilder) Col(col string) *FilterInfoBuilder {
- builder.col = col
- builder.colFlag = true
+// 示例值:1
+func (builder *CheckboxBuilder) DataValidationId(dataValidationId int) *CheckboxBuilder {
+ builder.dataValidationId = dataValidationId
+ builder.dataValidationIdFlag = true
return builder
}
-// 筛选条件
+// 复选框值
//
-// 示例值:
-func (builder *FilterInfoBuilder) Conditions(conditions []*Condition) *FilterInfoBuilder {
- builder.conditions = conditions
- builder.conditionsFlag = true
+// 示例值:TRUE
+func (builder *CheckboxBuilder) DataValiditonValue(dataValiditonValue string) *CheckboxBuilder {
+ builder.dataValiditonValue = dataValiditonValue
+ builder.dataValiditonValueFlag = true
return builder
}
-func (builder *FilterInfoBuilder) Build() *FilterInfo {
- req := &FilterInfo{}
- if builder.colFlag {
- req.Col = &builder.col
+func (builder *CheckboxBuilder) Build() *Checkbox {
+ req := &Checkbox{}
+ if builder.dataValidationIdFlag {
+ req.DataValidationId = &builder.dataValidationId
}
- if builder.conditionsFlag {
- req.Conditions = builder.conditions
+ if builder.dataValiditonValueFlag {
+ req.DataValiditonValue = &builder.dataValiditonValue
+
}
return req
}
-type FilterView struct {
- FilterViewId *string `json:"filter_view_id,omitempty"` // 筛选视图 id
- FilterViewName *string `json:"filter_view_name,omitempty"` // 筛选视图名字
- Range *string `json:"range,omitempty"` // 筛选视图的筛选范围
+type ClearDataValidation struct {
+ Ranges []string `json:"ranges,omitempty"` // 清除数据检验的范围
}
-type FilterViewBuilder struct {
- filterViewId string // 筛选视图 id
- filterViewIdFlag bool
- filterViewName string // 筛选视图名字
- filterViewNameFlag bool
- range_ string // 筛选视图的筛选范围
- rangeFlag bool
+type ClearDataValidationBuilder struct {
+ ranges []string // 清除数据检验的范围
+ rangesFlag bool
}
-func NewFilterViewBuilder() *FilterViewBuilder {
- builder := &FilterViewBuilder{}
+func NewClearDataValidationBuilder() *ClearDataValidationBuilder {
+ builder := &ClearDataValidationBuilder{}
return builder
}
-// 筛选视图 id
+// 清除数据检验的范围
//
-// 示例值:pH9hbVcCXA
-func (builder *FilterViewBuilder) FilterViewId(filterViewId string) *FilterViewBuilder {
- builder.filterViewId = filterViewId
- builder.filterViewIdFlag = true
+// 示例值:
+func (builder *ClearDataValidationBuilder) Ranges(ranges []string) *ClearDataValidationBuilder {
+ builder.ranges = ranges
+ builder.rangesFlag = true
return builder
}
-// 筛选视图名字
-//
-// 示例值:筛选视图 1
-func (builder *FilterViewBuilder) FilterViewName(filterViewName string) *FilterViewBuilder {
- builder.filterViewName = filterViewName
- builder.filterViewNameFlag = true
+func (builder *ClearDataValidationBuilder) Build() *ClearDataValidation {
+ req := &ClearDataValidation{}
+ if builder.rangesFlag {
+ req.Ranges = builder.ranges
+ }
+ return req
+}
+
+type ClearStyleMultiRange struct {
+ Ranges []string `json:"ranges,omitempty"` // 范围
+}
+
+type ClearStyleMultiRangeBuilder struct {
+ ranges []string // 范围
+ rangesFlag bool
+}
+
+func NewClearStyleMultiRangeBuilder() *ClearStyleMultiRangeBuilder {
+ builder := &ClearStyleMultiRangeBuilder{}
return builder
}
-// 筛选视图的筛选范围
+// 范围
//
-// 示例值:0b**12!C1:H14
-func (builder *FilterViewBuilder) Range(range_ string) *FilterViewBuilder {
- builder.range_ = range_
- builder.rangeFlag = true
+// 示例值:
+func (builder *ClearStyleMultiRangeBuilder) Ranges(ranges []string) *ClearStyleMultiRangeBuilder {
+ builder.ranges = ranges
+ builder.rangesFlag = true
return builder
}
-func (builder *FilterViewBuilder) Build() *FilterView {
- req := &FilterView{}
- if builder.filterViewIdFlag {
- req.FilterViewId = &builder.filterViewId
-
+func (builder *ClearStyleMultiRangeBuilder) Build() *ClearStyleMultiRange {
+ req := &ClearStyleMultiRange{}
+ if builder.rangesFlag {
+ req.Ranges = builder.ranges
}
- if builder.filterViewNameFlag {
- req.FilterViewName = &builder.filterViewName
+ return req
+}
- }
- if builder.rangeFlag {
- req.Range = &builder.range_
+type ClearStyleRanges struct {
+ Ranges []string `json:"ranges,omitempty"` // 范围
+}
+
+type ClearStyleRangesBuilder struct {
+ ranges []string // 范围
+ rangesFlag bool
+}
+
+func NewClearStyleRangesBuilder() *ClearStyleRangesBuilder {
+ builder := &ClearStyleRangesBuilder{}
+ return builder
+}
+
+// 范围
+//
+// 示例值:["sheet1!A1:A1"]
+func (builder *ClearStyleRangesBuilder) Ranges(ranges []string) *ClearStyleRangesBuilder {
+ builder.ranges = ranges
+ builder.rangesFlag = true
+ return builder
+}
+func (builder *ClearStyleRangesBuilder) Build() *ClearStyleRanges {
+ req := &ClearStyleRanges{}
+ if builder.rangesFlag {
+ req.Ranges = builder.ranges
}
return req
}
-type FilterViewCondition struct {
- ConditionId *string `json:"condition_id,omitempty"` // 设置筛选条件的列,使用字母号
+type Condition struct {
FilterType *string `json:"filter_type,omitempty"` // 筛选类型
CompareType *string `json:"compare_type,omitempty"` // 比较类型
Expected []string `json:"expected,omitempty"` // 筛选参数
}
-type FilterViewConditionBuilder struct {
- conditionId string // 设置筛选条件的列,使用字母号
- conditionIdFlag bool
+type ConditionBuilder struct {
filterType string // 筛选类型
filterTypeFlag bool
compareType string // 比较类型
@@ -829,24 +1027,15 @@ type FilterViewConditionBuilder struct {
expectedFlag bool
}
-func NewFilterViewConditionBuilder() *FilterViewConditionBuilder {
- builder := &FilterViewConditionBuilder{}
- return builder
-}
-
-// 设置筛选条件的列,使用字母号
-//
-// 示例值:E
-func (builder *FilterViewConditionBuilder) ConditionId(conditionId string) *FilterViewConditionBuilder {
- builder.conditionId = conditionId
- builder.conditionIdFlag = true
+func NewConditionBuilder() *ConditionBuilder {
+ builder := &ConditionBuilder{}
return builder
}
// 筛选类型
//
// 示例值:number
-func (builder *FilterViewConditionBuilder) FilterType(filterType string) *FilterViewConditionBuilder {
+func (builder *ConditionBuilder) FilterType(filterType string) *ConditionBuilder {
builder.filterType = filterType
builder.filterTypeFlag = true
return builder
@@ -855,7 +1044,7 @@ func (builder *FilterViewConditionBuilder) FilterType(filterType string) *Filter
// 比较类型
//
// 示例值:less
-func (builder *FilterViewConditionBuilder) CompareType(compareType string) *FilterViewConditionBuilder {
+func (builder *ConditionBuilder) CompareType(compareType string) *ConditionBuilder {
builder.compareType = compareType
builder.compareTypeFlag = true
return builder
@@ -864,18 +1053,14 @@ func (builder *FilterViewConditionBuilder) CompareType(compareType string) *Filt
// 筛选参数
//
// 示例值:6
-func (builder *FilterViewConditionBuilder) Expected(expected []string) *FilterViewConditionBuilder {
+func (builder *ConditionBuilder) Expected(expected []string) *ConditionBuilder {
builder.expected = expected
builder.expectedFlag = true
return builder
}
-func (builder *FilterViewConditionBuilder) Build() *FilterViewCondition {
- req := &FilterViewCondition{}
- if builder.conditionIdFlag {
- req.ConditionId = &builder.conditionId
-
- }
+func (builder *ConditionBuilder) Build() *Condition {
+ req := &Condition{}
if builder.filterTypeFlag {
req.FilterType = &builder.filterType
@@ -890,1112 +1075,2893 @@ func (builder *FilterViewConditionBuilder) Build() *FilterViewCondition {
return req
}
-type Find struct {
- FindCondition *FindCondition `json:"find_condition,omitempty"` // 查找条件
- Find *string `json:"find,omitempty"` // 查找的字符串,当`search_by_regex`字段为 true 时,该字段为正则表达式
+type ConditionalFormat struct {
+ ConditionalFormatId *string `json:"conditional_format_id,omitempty"` // 条件格式ID
+ ConditionalFormatRule *ConditionalFormatRule `json:"conditional_format_rule,omitempty"` // 条件格式
+ Index *int `json:"index,omitempty"` // 规则索引位置,默认为最后一个
+ Ranges *ConditionalFormatRange `json:"ranges,omitempty"` // 条件格式应用范围
}
-type FindBuilder struct {
- findCondition *FindCondition // 查找条件
- findConditionFlag bool
- find string // 查找的字符串,当`search_by_regex`字段为 true 时,该字段为正则表达式
- findFlag bool
+type ConditionalFormatBuilder struct {
+ conditionalFormatId string // 条件格式ID
+ conditionalFormatIdFlag bool
+ conditionalFormatRule *ConditionalFormatRule // 条件格式
+ conditionalFormatRuleFlag bool
+ index int // 规则索引位置,默认为最后一个
+ indexFlag bool
+ ranges *ConditionalFormatRange // 条件格式应用范围
+ rangesFlag bool
}
-func NewFindBuilder() *FindBuilder {
- builder := &FindBuilder{}
+func NewConditionalFormatBuilder() *ConditionalFormatBuilder {
+ builder := &ConditionalFormatBuilder{}
return builder
}
-// 查找条件
+// 条件格式ID
+//
+// 示例值:hKc9HDZhrJ
+func (builder *ConditionalFormatBuilder) ConditionalFormatId(conditionalFormatId string) *ConditionalFormatBuilder {
+ builder.conditionalFormatId = conditionalFormatId
+ builder.conditionalFormatIdFlag = true
+ return builder
+}
+
+// 条件格式
//
// 示例值:
-func (builder *FindBuilder) FindCondition(findCondition *FindCondition) *FindBuilder {
- builder.findCondition = findCondition
- builder.findConditionFlag = true
+func (builder *ConditionalFormatBuilder) ConditionalFormatRule(conditionalFormatRule *ConditionalFormatRule) *ConditionalFormatBuilder {
+ builder.conditionalFormatRule = conditionalFormatRule
+ builder.conditionalFormatRuleFlag = true
return builder
}
-// 查找的字符串,当`search_by_regex`字段为 true 时,该字段为正则表达式
+// 规则索引位置,默认为最后一个
//
-// 示例值:如下;;- 普通查找示例: "hello";- 正则查找示例: "[A-Z]\w+"
-func (builder *FindBuilder) Find(find string) *FindBuilder {
- builder.find = find
- builder.findFlag = true
+// 示例值:
+func (builder *ConditionalFormatBuilder) Index(index int) *ConditionalFormatBuilder {
+ builder.index = index
+ builder.indexFlag = true
return builder
}
-func (builder *FindBuilder) Build() *Find {
- req := &Find{}
- if builder.findConditionFlag {
- req.FindCondition = builder.findCondition
+// 条件格式应用范围
+//
+// 示例值:
+func (builder *ConditionalFormatBuilder) Ranges(ranges *ConditionalFormatRange) *ConditionalFormatBuilder {
+ builder.ranges = ranges
+ builder.rangesFlag = true
+ return builder
+}
+
+func (builder *ConditionalFormatBuilder) Build() *ConditionalFormat {
+ req := &ConditionalFormat{}
+ if builder.conditionalFormatIdFlag {
+ req.ConditionalFormatId = &builder.conditionalFormatId
+
}
- if builder.findFlag {
- req.Find = &builder.find
+ if builder.conditionalFormatRuleFlag {
+ req.ConditionalFormatRule = builder.conditionalFormatRule
+ }
+ if builder.indexFlag {
+ req.Index = &builder.index
}
+ if builder.rangesFlag {
+ req.Ranges = builder.ranges
+ }
return req
}
-type FindCondition struct {
- Range *string `json:"range,omitempty"` // 查找范围,参考 [名词解释 Range](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview)
- MatchCase *bool `json:"match_case,omitempty"` // 是否忽略大小写,默认为 false;- `true`:表示忽略字符串中字母大小写差异;- `false`:表示区分字符串中字母大小写
- MatchEntireCell *bool `json:"match_entire_cell,omitempty"` // 是否完全匹配整个单元格,默认值为 false;- `true`:表示完全匹配单元格,比如 find 取值为 "hello",则单元格中的内容必须为 "hello";- `false`:表示允许部分匹配单元格,比如 find 取值为 "hello",则单元格中的内容包含 "hello" 即可
- SearchByRegex *bool `json:"search_by_regex,omitempty"` // 是否为正则匹配,默认值为 false;- `true`:表示使用正则匹配;- `false`:表示不使用正则匹配
- IncludeFormulas *bool `json:"include_formulas,omitempty"` // 是否仅搜索单元格公式,默认值为 false;- `true`:表示仅搜索单元格公式;- `false`:表示仅搜索单元格内容
+type ConditionalFormatRange struct {
+ SheetId *string `json:"sheet_id,omitempty"` // 工作表ID
+ StartRowIndex *int `json:"start_row_index,omitempty"` // 起始行索引
+ EndRowIndex *int `json:"end_row_index,omitempty"` // 结束行索引
+ StartColumnIndex *int `json:"start_column_index,omitempty"` // 起始列索引
+ EndColumnIndex *int `json:"end_column_index,omitempty"` // 结束列索引
}
-type FindConditionBuilder struct {
- range_ string // 查找范围,参考 [名词解释 Range](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview)
- rangeFlag bool
- matchCase bool // 是否忽略大小写,默认为 false;- `true`:表示忽略字符串中字母大小写差异;- `false`:表示区分字符串中字母大小写
- matchCaseFlag bool
- matchEntireCell bool // 是否完全匹配整个单元格,默认值为 false;- `true`:表示完全匹配单元格,比如 find 取值为 "hello",则单元格中的内容必须为 "hello";- `false`:表示允许部分匹配单元格,比如 find 取值为 "hello",则单元格中的内容包含 "hello" 即可
- matchEntireCellFlag bool
- searchByRegex bool // 是否为正则匹配,默认值为 false;- `true`:表示使用正则匹配;- `false`:表示不使用正则匹配
- searchByRegexFlag bool
- includeFormulas bool // 是否仅搜索单元格公式,默认值为 false;- `true`:表示仅搜索单元格公式;- `false`:表示仅搜索单元格内容
- includeFormulasFlag bool
+type ConditionalFormatRangeBuilder struct {
+ sheetId string // 工作表ID
+ sheetIdFlag bool
+ startRowIndex int // 起始行索引
+ startRowIndexFlag bool
+ endRowIndex int // 结束行索引
+ endRowIndexFlag bool
+ startColumnIndex int // 起始列索引
+ startColumnIndexFlag bool
+ endColumnIndex int // 结束列索引
+ endColumnIndexFlag bool
}
-func NewFindConditionBuilder() *FindConditionBuilder {
- builder := &FindConditionBuilder{}
+func NewConditionalFormatRangeBuilder() *ConditionalFormatRangeBuilder {
+ builder := &ConditionalFormatRangeBuilder{}
return builder
}
-// 查找范围,参考 [名词解释 Range](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview)
+// 工作表ID
//
-// 示例值:PNIfrm!A1:C5
-func (builder *FindConditionBuilder) Range(range_ string) *FindConditionBuilder {
- builder.range_ = range_
- builder.rangeFlag = true
+// 示例值:
+func (builder *ConditionalFormatRangeBuilder) SheetId(sheetId string) *ConditionalFormatRangeBuilder {
+ builder.sheetId = sheetId
+ builder.sheetIdFlag = true
return builder
}
-// 是否忽略大小写,默认为 false;- `true`:表示忽略字符串中字母大小写差异;- `false`:表示区分字符串中字母大小写
+// 起始行索引
//
-// 示例值:true
-func (builder *FindConditionBuilder) MatchCase(matchCase bool) *FindConditionBuilder {
- builder.matchCase = matchCase
- builder.matchCaseFlag = true
+// 示例值:0
+func (builder *ConditionalFormatRangeBuilder) StartRowIndex(startRowIndex int) *ConditionalFormatRangeBuilder {
+ builder.startRowIndex = startRowIndex
+ builder.startRowIndexFlag = true
return builder
}
-// 是否完全匹配整个单元格,默认值为 false;- `true`:表示完全匹配单元格,比如 find 取值为 "hello",则单元格中的内容必须为 "hello";- `false`:表示允许部分匹配单元格,比如 find 取值为 "hello",则单元格中的内容包含 "hello" 即可
+// 结束行索引
//
-// 示例值:false
-func (builder *FindConditionBuilder) MatchEntireCell(matchEntireCell bool) *FindConditionBuilder {
- builder.matchEntireCell = matchEntireCell
- builder.matchEntireCellFlag = true
+// 示例值:0
+func (builder *ConditionalFormatRangeBuilder) EndRowIndex(endRowIndex int) *ConditionalFormatRangeBuilder {
+ builder.endRowIndex = endRowIndex
+ builder.endRowIndexFlag = true
return builder
}
-// 是否为正则匹配,默认值为 false;- `true`:表示使用正则匹配;- `false`:表示不使用正则匹配
+// 起始列索引
//
-// 示例值:false
-func (builder *FindConditionBuilder) SearchByRegex(searchByRegex bool) *FindConditionBuilder {
- builder.searchByRegex = searchByRegex
- builder.searchByRegexFlag = true
+// 示例值:0
+func (builder *ConditionalFormatRangeBuilder) StartColumnIndex(startColumnIndex int) *ConditionalFormatRangeBuilder {
+ builder.startColumnIndex = startColumnIndex
+ builder.startColumnIndexFlag = true
return builder
}
-// 是否仅搜索单元格公式,默认值为 false;- `true`:表示仅搜索单元格公式;- `false`:表示仅搜索单元格内容
+// 结束列索引
//
-// 示例值:false
-func (builder *FindConditionBuilder) IncludeFormulas(includeFormulas bool) *FindConditionBuilder {
- builder.includeFormulas = includeFormulas
- builder.includeFormulasFlag = true
+// 示例值:0
+func (builder *ConditionalFormatRangeBuilder) EndColumnIndex(endColumnIndex int) *ConditionalFormatRangeBuilder {
+ builder.endColumnIndex = endColumnIndex
+ builder.endColumnIndexFlag = true
return builder
}
-func (builder *FindConditionBuilder) Build() *FindCondition {
- req := &FindCondition{}
- if builder.rangeFlag {
- req.Range = &builder.range_
+func (builder *ConditionalFormatRangeBuilder) Build() *ConditionalFormatRange {
+ req := &ConditionalFormatRange{}
+ if builder.sheetIdFlag {
+ req.SheetId = &builder.sheetId
}
- if builder.matchCaseFlag {
- req.MatchCase = &builder.matchCase
+ if builder.startRowIndexFlag {
+ req.StartRowIndex = &builder.startRowIndex
}
- if builder.matchEntireCellFlag {
- req.MatchEntireCell = &builder.matchEntireCell
+ if builder.endRowIndexFlag {
+ req.EndRowIndex = &builder.endRowIndex
}
- if builder.searchByRegexFlag {
- req.SearchByRegex = &builder.searchByRegex
+ if builder.startColumnIndexFlag {
+ req.StartColumnIndex = &builder.startColumnIndex
}
- if builder.includeFormulasFlag {
- req.IncludeFormulas = &builder.includeFormulas
+ if builder.endColumnIndexFlag {
+ req.EndColumnIndex = &builder.endColumnIndex
}
return req
}
-type FindReplaceResult struct {
- MatchedCells []string `json:"matched_cells,omitempty"` // 符合查找条件的单元格数组,不包含公式,例如["A1", "A2"...]
- MatchedFormulaCells []string `json:"matched_formula_cells,omitempty"` // 符合查找条件的含有公式的单元格数组,例如["B3", "H7"...]
- RowsCount *int `json:"rows_count,omitempty"` // 符合查找条件的总行数
-}
-
-type FindReplaceResultBuilder struct {
- matchedCells []string // 符合查找条件的单元格数组,不包含公式,例如["A1", "A2"...]
- matchedCellsFlag bool
- matchedFormulaCells []string // 符合查找条件的含有公式的单元格数组,例如["B3", "H7"...]
- matchedFormulaCellsFlag bool
- rowsCount int // 符合查找条件的总行数
- rowsCountFlag bool
+type ConditionalFormatRule struct {
+ BooleanRule *BooleanRuleCondition `json:"boolean_rule,omitempty"` // 布尔类型条件格式
+ Type *string `json:"type,omitempty"` // 条件格式类型
}
-func NewFindReplaceResultBuilder() *FindReplaceResultBuilder {
- builder := &FindReplaceResultBuilder{}
- return builder
+type ConditionalFormatRuleBuilder struct {
+ booleanRule *BooleanRuleCondition // 布尔类型条件格式
+ booleanRuleFlag bool
+ type_ string // 条件格式类型
+ typeFlag bool
}
-// 符合查找条件的单元格数组,不包含公式,例如["A1", "A2"...]
-//
-// 示例值:
-func (builder *FindReplaceResultBuilder) MatchedCells(matchedCells []string) *FindReplaceResultBuilder {
- builder.matchedCells = matchedCells
- builder.matchedCellsFlag = true
+func NewConditionalFormatRuleBuilder() *ConditionalFormatRuleBuilder {
+ builder := &ConditionalFormatRuleBuilder{}
return builder
}
-// 符合查找条件的含有公式的单元格数组,例如["B3", "H7"...]
+// 布尔类型条件格式
//
// 示例值:
-func (builder *FindReplaceResultBuilder) MatchedFormulaCells(matchedFormulaCells []string) *FindReplaceResultBuilder {
- builder.matchedFormulaCells = matchedFormulaCells
- builder.matchedFormulaCellsFlag = true
+func (builder *ConditionalFormatRuleBuilder) BooleanRule(booleanRule *BooleanRuleCondition) *ConditionalFormatRuleBuilder {
+ builder.booleanRule = booleanRule
+ builder.booleanRuleFlag = true
return builder
}
-// 符合查找条件的总行数
+// 条件格式类型
//
-// 示例值:2
-func (builder *FindReplaceResultBuilder) RowsCount(rowsCount int) *FindReplaceResultBuilder {
- builder.rowsCount = rowsCount
- builder.rowsCountFlag = true
+// 示例值:BooleanRuleCondition
+func (builder *ConditionalFormatRuleBuilder) Type(type_ string) *ConditionalFormatRuleBuilder {
+ builder.type_ = type_
+ builder.typeFlag = true
return builder
}
-func (builder *FindReplaceResultBuilder) Build() *FindReplaceResult {
- req := &FindReplaceResult{}
- if builder.matchedCellsFlag {
- req.MatchedCells = builder.matchedCells
+func (builder *ConditionalFormatRuleBuilder) Build() *ConditionalFormatRule {
+ req := &ConditionalFormatRule{}
+ if builder.booleanRuleFlag {
+ req.BooleanRule = builder.booleanRule
}
- if builder.matchedFormulaCellsFlag {
- req.MatchedFormulaCells = builder.matchedFormulaCells
- }
- if builder.rowsCountFlag {
- req.RowsCount = &builder.rowsCount
+ if builder.typeFlag {
+ req.Type = &builder.type_
}
return req
}
-type FloatImage struct {
- FloatImageId *string `json:"float_image_id,omitempty"` // 浮动图片 id
- FloatImageToken *string `json:"float_image_token,omitempty"` // 【更新时不用传,创建需要】浮动图片 token,需要先上传图片到表格获得此 token 之后再进行浮动图片的相关操作
- Range *string `json:"range,omitempty"` // 浮动图片的左上角单元格定位,只支持一个单元格
- Width *float64 `json:"width,omitempty"` // 浮动图片的宽度,大于等于 20px
- Height *float64 `json:"height,omitempty"` // 浮动图片的高度,大于等于 20px
- OffsetX *float64 `json:"offset_x,omitempty"` // 浮动图片左上角所在位置相对于所在单元格左上角的横向偏移,大于等于0且小于所在单元格的宽度
- OffsetY *float64 `json:"offset_y,omitempty"` // 浮动图片左上角所在位置相对于所在单元格左上角的纵向偏移,大于等于0且小于所在单元格的高度
-}
-
-type FloatImageBuilder struct {
- floatImageId string // 浮动图片 id
- floatImageIdFlag bool
- floatImageToken string // 【更新时不用传,创建需要】浮动图片 token,需要先上传图片到表格获得此 token 之后再进行浮动图片的相关操作
- floatImageTokenFlag bool
- range_ string // 浮动图片的左上角单元格定位,只支持一个单元格
- rangeFlag bool
- width float64 // 浮动图片的宽度,大于等于 20px
- widthFlag bool
- height float64 // 浮动图片的高度,大于等于 20px
- heightFlag bool
- offsetX float64 // 浮动图片左上角所在位置相对于所在单元格左上角的横向偏移,大于等于0且小于所在单元格的宽度
- offsetXFlag bool
- offsetY float64 // 浮动图片左上角所在位置相对于所在单元格左上角的纵向偏移,大于等于0且小于所在单元格的高度
- offsetYFlag bool
+type ConditionalFormatStyle struct {
+ BackgroundColor *string `json:"background_color,omitempty"` // 背景颜色
+ ForegroundColor *string `json:"foreground_color,omitempty"` // 字体颜色
+ Underline *bool `json:"underline,omitempty"` // 是否设置下划线
+ Bold *bool `json:"bold,omitempty"` // 是否加粗
+ Italic *bool `json:"italic,omitempty"` // 是否设置斜体
+ Strikethrough *bool `json:"strikethrough,omitempty"` // 是否设置删除线
}
-func NewFloatImageBuilder() *FloatImageBuilder {
- builder := &FloatImageBuilder{}
- return builder
+type ConditionalFormatStyleBuilder struct {
+ backgroundColor string // 背景颜色
+ backgroundColorFlag bool
+ foregroundColor string // 字体颜色
+ foregroundColorFlag bool
+ underline bool // 是否设置下划线
+ underlineFlag bool
+ bold bool // 是否加粗
+ boldFlag bool
+ italic bool // 是否设置斜体
+ italicFlag bool
+ strikethrough bool // 是否设置删除线
+ strikethroughFlag bool
}
-// 浮动图片 id
-//
-// 示例值:ye06SS14ph
-func (builder *FloatImageBuilder) FloatImageId(floatImageId string) *FloatImageBuilder {
- builder.floatImageId = floatImageId
- builder.floatImageIdFlag = true
+func NewConditionalFormatStyleBuilder() *ConditionalFormatStyleBuilder {
+ builder := &ConditionalFormatStyleBuilder{}
return builder
}
-// 【更新时不用传,创建需要】浮动图片 token,需要先上传图片到表格获得此 token 之后再进行浮动图片的相关操作
+// 背景颜色
//
-// 示例值:boxbcbQsaSqIXsxxxxx1HCPJFbh
-func (builder *FloatImageBuilder) FloatImageToken(floatImageToken string) *FloatImageBuilder {
- builder.floatImageToken = floatImageToken
- builder.floatImageTokenFlag = true
+// 示例值:#ff00ff
+func (builder *ConditionalFormatStyleBuilder) BackgroundColor(backgroundColor string) *ConditionalFormatStyleBuilder {
+ builder.backgroundColor = backgroundColor
+ builder.backgroundColorFlag = true
return builder
}
-// 浮动图片的左上角单元格定位,只支持一个单元格
+// 字体颜色
//
-// 示例值:0b**12!A1:A1
-func (builder *FloatImageBuilder) Range(range_ string) *FloatImageBuilder {
- builder.range_ = range_
- builder.rangeFlag = true
+// 示例值:#ff00ff
+func (builder *ConditionalFormatStyleBuilder) ForegroundColor(foregroundColor string) *ConditionalFormatStyleBuilder {
+ builder.foregroundColor = foregroundColor
+ builder.foregroundColorFlag = true
return builder
}
-// 浮动图片的宽度,大于等于 20px
+// 是否设置下划线
//
-// 示例值:100
-func (builder *FloatImageBuilder) Width(width float64) *FloatImageBuilder {
- builder.width = width
- builder.widthFlag = true
+// 示例值:true
+func (builder *ConditionalFormatStyleBuilder) Underline(underline bool) *ConditionalFormatStyleBuilder {
+ builder.underline = underline
+ builder.underlineFlag = true
return builder
}
-// 浮动图片的高度,大于等于 20px
+// 是否加粗
//
-// 示例值:100
-func (builder *FloatImageBuilder) Height(height float64) *FloatImageBuilder {
- builder.height = height
- builder.heightFlag = true
+// 示例值:true
+func (builder *ConditionalFormatStyleBuilder) Bold(bold bool) *ConditionalFormatStyleBuilder {
+ builder.bold = bold
+ builder.boldFlag = true
return builder
}
-// 浮动图片左上角所在位置相对于所在单元格左上角的横向偏移,大于等于0且小于所在单元格的宽度
+// 是否设置斜体
//
-// 示例值:0
-func (builder *FloatImageBuilder) OffsetX(offsetX float64) *FloatImageBuilder {
- builder.offsetX = offsetX
- builder.offsetXFlag = true
+// 示例值:true
+func (builder *ConditionalFormatStyleBuilder) Italic(italic bool) *ConditionalFormatStyleBuilder {
+ builder.italic = italic
+ builder.italicFlag = true
return builder
}
-// 浮动图片左上角所在位置相对于所在单元格左上角的纵向偏移,大于等于0且小于所在单元格的高度
+// 是否设置删除线
//
-// 示例值:0
-func (builder *FloatImageBuilder) OffsetY(offsetY float64) *FloatImageBuilder {
- builder.offsetY = offsetY
- builder.offsetYFlag = true
+// 示例值:true
+func (builder *ConditionalFormatStyleBuilder) Strikethrough(strikethrough bool) *ConditionalFormatStyleBuilder {
+ builder.strikethrough = strikethrough
+ builder.strikethroughFlag = true
return builder
}
-func (builder *FloatImageBuilder) Build() *FloatImage {
- req := &FloatImage{}
- if builder.floatImageIdFlag {
- req.FloatImageId = &builder.floatImageId
-
- }
- if builder.floatImageTokenFlag {
- req.FloatImageToken = &builder.floatImageToken
+func (builder *ConditionalFormatStyleBuilder) Build() *ConditionalFormatStyle {
+ req := &ConditionalFormatStyle{}
+ if builder.backgroundColorFlag {
+ req.BackgroundColor = &builder.backgroundColor
}
- if builder.rangeFlag {
- req.Range = &builder.range_
+ if builder.foregroundColorFlag {
+ req.ForegroundColor = &builder.foregroundColor
}
- if builder.widthFlag {
- req.Width = &builder.width
+ if builder.underlineFlag {
+ req.Underline = &builder.underline
}
- if builder.heightFlag {
- req.Height = &builder.height
+ if builder.boldFlag {
+ req.Bold = &builder.bold
}
- if builder.offsetXFlag {
- req.OffsetX = &builder.offsetX
+ if builder.italicFlag {
+ req.Italic = &builder.italic
}
- if builder.offsetYFlag {
- req.OffsetY = &builder.offsetY
+ if builder.strikethroughFlag {
+ req.Strikethrough = &builder.strikethrough
}
return req
}
-type Formula struct {
- Formula *string `json:"formula,omitempty"` // 公式
- FormulaValue *string `json:"formula_value,omitempty"` // 公式结果
- AffectedRange *string `json:"affected_range,omitempty"` // 公式影响的范围
+type CreateDataValidation struct {
+ Range *string `json:"range,omitempty"` // 数据校验设置的范围
+ Rule *DataValidation `json:"rule,omitempty"` // 数据校验规则
}
-type FormulaBuilder struct {
- formula string // 公式
- formulaFlag bool
- formulaValue string // 公式结果
- formulaValueFlag bool
- affectedRange string // 公式影响的范围
- affectedRangeFlag bool
+type CreateDataValidationBuilder struct {
+ range_ string // 数据校验设置的范围
+ rangeFlag bool
+ rule *DataValidation // 数据校验规则
+ ruleFlag bool
}
-func NewFormulaBuilder() *FormulaBuilder {
- builder := &FormulaBuilder{}
+func NewCreateDataValidationBuilder() *CreateDataValidationBuilder {
+ builder := &CreateDataValidationBuilder{}
return builder
}
-// 公式
+// 数据校验设置的范围
//
-// 示例值:=SUM(A:A)
-func (builder *FormulaBuilder) Formula(formula string) *FormulaBuilder {
- builder.formula = formula
- builder.formulaFlag = true
+// 示例值:sjls29!A1:B2
+func (builder *CreateDataValidationBuilder) Range(range_ string) *CreateDataValidationBuilder {
+ builder.range_ = range_
+ builder.rangeFlag = true
return builder
}
-// 公式结果
+// 数据校验规则
//
-// 示例值:123
-func (builder *FormulaBuilder) FormulaValue(formulaValue string) *FormulaBuilder {
- builder.formulaValue = formulaValue
- builder.formulaValueFlag = true
+// 示例值:
+func (builder *CreateDataValidationBuilder) Rule(rule *DataValidation) *CreateDataValidationBuilder {
+ builder.rule = rule
+ builder.ruleFlag = true
return builder
}
-// 公式影响的范围
-//
-// 示例值:Xkhr2d!A1:B2
-func (builder *FormulaBuilder) AffectedRange(affectedRange string) *FormulaBuilder {
- builder.affectedRange = affectedRange
- builder.affectedRangeFlag = true
- return builder
+func (builder *CreateDataValidationBuilder) Build() *CreateDataValidation {
+ req := &CreateDataValidation{}
+ if builder.rangeFlag {
+ req.Range = &builder.range_
+
+ }
+ if builder.ruleFlag {
+ req.Rule = builder.rule
+ }
+ return req
}
-func (builder *FormulaBuilder) Build() *Formula {
+type CreateSheetFilter struct {
+ Range *string `json:"range,omitempty"` // 筛选应用范围
+ Col *string `json:"col,omitempty"` // 设置筛选条件的列
+ Condition *Condition `json:"condition,omitempty"` // 筛选的条件
+}
+
+type CreateSheetFilterBuilder struct {
+ range_ string // 筛选应用范围
+ rangeFlag bool
+ col string // 设置筛选条件的列
+ colFlag bool
+ condition *Condition // 筛选的条件
+ conditionFlag bool
+}
+
+func NewCreateSheetFilterBuilder() *CreateSheetFilterBuilder {
+ builder := &CreateSheetFilterBuilder{}
+ return builder
+}
+
+// 筛选应用范围
+//
+// 示例值:xxxxxx!C1:H14
+func (builder *CreateSheetFilterBuilder) Range(range_ string) *CreateSheetFilterBuilder {
+ builder.range_ = range_
+ builder.rangeFlag = true
+ return builder
+}
+
+// 设置筛选条件的列
+//
+// 示例值:E
+func (builder *CreateSheetFilterBuilder) Col(col string) *CreateSheetFilterBuilder {
+ builder.col = col
+ builder.colFlag = true
+ return builder
+}
+
+// 筛选的条件
+//
+// 示例值:
+func (builder *CreateSheetFilterBuilder) Condition(condition *Condition) *CreateSheetFilterBuilder {
+ builder.condition = condition
+ builder.conditionFlag = true
+ return builder
+}
+
+func (builder *CreateSheetFilterBuilder) Build() *CreateSheetFilter {
+ req := &CreateSheetFilter{}
+ if builder.rangeFlag {
+ req.Range = &builder.range_
+
+ }
+ if builder.colFlag {
+ req.Col = &builder.col
+
+ }
+ if builder.conditionFlag {
+ req.Condition = builder.condition
+ }
+ return req
+}
+
+type DataValidation struct {
+ DataValidationId *int `json:"data_validation_id,omitempty"` // 数据校验ID
+ DataValidationRule *DataValidationRule `json:"data_validation_rule,omitempty"` // 数据校验规则
+ Strict *string `json:"strict,omitempty"` // 校验模式,数据非法时是否拒绝输入
+ HelpText *string `json:"help_text,omitempty"` // 输入提示
+}
+
+type DataValidationBuilder struct {
+ dataValidationId int // 数据校验ID
+ dataValidationIdFlag bool
+ dataValidationRule *DataValidationRule // 数据校验规则
+ dataValidationRuleFlag bool
+ strict string // 校验模式,数据非法时是否拒绝输入
+ strictFlag bool
+ helpText string // 输入提示
+ helpTextFlag bool
+}
+
+func NewDataValidationBuilder() *DataValidationBuilder {
+ builder := &DataValidationBuilder{}
+ return builder
+}
+
+// 数据校验ID
+//
+// 示例值:1
+func (builder *DataValidationBuilder) DataValidationId(dataValidationId int) *DataValidationBuilder {
+ builder.dataValidationId = dataValidationId
+ builder.dataValidationIdFlag = true
+ return builder
+}
+
+// 数据校验规则
+//
+// 示例值:
+func (builder *DataValidationBuilder) DataValidationRule(dataValidationRule *DataValidationRule) *DataValidationBuilder {
+ builder.dataValidationRule = dataValidationRule
+ builder.dataValidationRuleFlag = true
+ return builder
+}
+
+// 校验模式,数据非法时是否拒绝输入
+//
+// 示例值:true
+func (builder *DataValidationBuilder) Strict(strict string) *DataValidationBuilder {
+ builder.strict = strict
+ builder.strictFlag = true
+ return builder
+}
+
+// 输入提示
+//
+// 示例值:number between 1 and 2
+func (builder *DataValidationBuilder) HelpText(helpText string) *DataValidationBuilder {
+ builder.helpText = helpText
+ builder.helpTextFlag = true
+ return builder
+}
+
+func (builder *DataValidationBuilder) Build() *DataValidation {
+ req := &DataValidation{}
+ if builder.dataValidationIdFlag {
+ req.DataValidationId = &builder.dataValidationId
+
+ }
+ if builder.dataValidationRuleFlag {
+ req.DataValidationRule = builder.dataValidationRule
+ }
+ if builder.strictFlag {
+ req.Strict = &builder.strict
+
+ }
+ if builder.helpTextFlag {
+ req.HelpText = &builder.helpText
+
+ }
+ return req
+}
+
+type DataValidationRule struct {
+ Type *string `json:"type,omitempty"` // 数据校验类型
+ SingleOption *SingleOption `json:"single_option,omitempty"` // 单选
+ MultipleOption *MultipleOption `json:"multiple_option,omitempty"` // 多选
+}
+
+type DataValidationRuleBuilder struct {
+ type_ string // 数据校验类型
+ typeFlag bool
+ singleOption *SingleOption // 单选
+ singleOptionFlag bool
+ multipleOption *MultipleOption // 多选
+ multipleOptionFlag bool
+}
+
+func NewDataValidationRuleBuilder() *DataValidationRuleBuilder {
+ builder := &DataValidationRuleBuilder{}
+ return builder
+}
+
+// 数据校验类型
+//
+// 示例值:SingleOption
+func (builder *DataValidationRuleBuilder) Type(type_ string) *DataValidationRuleBuilder {
+ builder.type_ = type_
+ builder.typeFlag = true
+ return builder
+}
+
+// 单选
+//
+// 示例值:
+func (builder *DataValidationRuleBuilder) SingleOption(singleOption *SingleOption) *DataValidationRuleBuilder {
+ builder.singleOption = singleOption
+ builder.singleOptionFlag = true
+ return builder
+}
+
+// 多选
+//
+// 示例值:
+func (builder *DataValidationRuleBuilder) MultipleOption(multipleOption *MultipleOption) *DataValidationRuleBuilder {
+ builder.multipleOption = multipleOption
+ builder.multipleOptionFlag = true
+ return builder
+}
+
+func (builder *DataValidationRuleBuilder) Build() *DataValidationRule {
+ req := &DataValidationRule{}
+ if builder.typeFlag {
+ req.Type = &builder.type_
+
+ }
+ if builder.singleOptionFlag {
+ req.SingleOption = builder.singleOption
+ }
+ if builder.multipleOptionFlag {
+ req.MultipleOption = builder.multipleOption
+ }
+ return req
+}
+
+type DataValidationValue struct {
+ OptionValue *string `json:"option_value,omitempty"` // 选项值
+ OptionColor *string `json:"option_color,omitempty"` // 选项颜色
+}
+
+type DataValidationValueBuilder struct {
+ optionValue string // 选项值
+ optionValueFlag bool
+ optionColor string // 选项颜色
+ optionColorFlag bool
+}
+
+func NewDataValidationValueBuilder() *DataValidationValueBuilder {
+ builder := &DataValidationValueBuilder{}
+ return builder
+}
+
+// 选项值
+//
+// 示例值:Option1
+func (builder *DataValidationValueBuilder) OptionValue(optionValue string) *DataValidationValueBuilder {
+ builder.optionValue = optionValue
+ builder.optionValueFlag = true
+ return builder
+}
+
+// 选项颜色
+//
+// 示例值:#ff00ff
+func (builder *DataValidationValueBuilder) OptionColor(optionColor string) *DataValidationValueBuilder {
+ builder.optionColor = optionColor
+ builder.optionColorFlag = true
+ return builder
+}
+
+func (builder *DataValidationValueBuilder) Build() *DataValidationValue {
+ req := &DataValidationValue{}
+ if builder.optionValueFlag {
+ req.OptionValue = &builder.optionValue
+
+ }
+ if builder.optionColorFlag {
+ req.OptionColor = &builder.optionColor
+
+ }
+ return req
+}
+
+type DateTime struct {
+ DateTime *string `json:"date_time,omitempty"` // 时间日期
+}
+
+type DateTimeBuilder struct {
+ dateTime string // 时间日期
+ dateTimeFlag bool
+}
+
+func NewDateTimeBuilder() *DateTimeBuilder {
+ builder := &DateTimeBuilder{}
+ return builder
+}
+
+// 时间日期
+//
+// 示例值:2022/02/22
+func (builder *DateTimeBuilder) DateTime(dateTime string) *DateTimeBuilder {
+ builder.dateTime = dateTime
+ builder.dateTimeFlag = true
+ return builder
+}
+
+func (builder *DateTimeBuilder) Build() *DateTime {
+ req := &DateTime{}
+ if builder.dateTimeFlag {
+ req.DateTime = &builder.dateTime
+
+ }
+ return req
+}
+
+type Dimension struct {
+ MajorDimension *string `json:"major_dimension,omitempty"` // 操作行还是列,取值:ROWS、COLUMNS
+ StartIndex *int `json:"start_index,omitempty"` // 起始行或者列号
+ EndIndex *int `json:"end_index,omitempty"` // 结束行或者列号
+}
+
+type DimensionBuilder struct {
+ majorDimension string // 操作行还是列,取值:ROWS、COLUMNS
+ majorDimensionFlag bool
+ startIndex int // 起始行或者列号
+ startIndexFlag bool
+ endIndex int // 结束行或者列号
+ endIndexFlag bool
+}
+
+func NewDimensionBuilder() *DimensionBuilder {
+ builder := &DimensionBuilder{}
+ return builder
+}
+
+// 操作行还是列,取值:ROWS、COLUMNS
+//
+// 示例值:ROWS
+func (builder *DimensionBuilder) MajorDimension(majorDimension string) *DimensionBuilder {
+ builder.majorDimension = majorDimension
+ builder.majorDimensionFlag = true
+ return builder
+}
+
+// 起始行或者列号
+//
+// 示例值:0
+func (builder *DimensionBuilder) StartIndex(startIndex int) *DimensionBuilder {
+ builder.startIndex = startIndex
+ builder.startIndexFlag = true
+ return builder
+}
+
+// 结束行或者列号
+//
+// 示例值:1
+func (builder *DimensionBuilder) EndIndex(endIndex int) *DimensionBuilder {
+ builder.endIndex = endIndex
+ builder.endIndexFlag = true
+ return builder
+}
+
+func (builder *DimensionBuilder) Build() *Dimension {
+ req := &Dimension{}
+ if builder.majorDimensionFlag {
+ req.MajorDimension = &builder.majorDimension
+
+ }
+ if builder.startIndexFlag {
+ req.StartIndex = &builder.startIndex
+
+ }
+ if builder.endIndexFlag {
+ req.EndIndex = &builder.endIndex
+
+ }
+ return req
+}
+
+type DimensionProperties struct {
+ Hidden *bool `json:"hidden,omitempty"` // 是否隐藏
+ PixelSize *int `json:"pixel_size,omitempty"` // 行/列像素大小
+}
+
+type DimensionPropertiesBuilder struct {
+ hidden bool // 是否隐藏
+ hiddenFlag bool
+ pixelSize int // 行/列像素大小
+ pixelSizeFlag bool
+}
+
+func NewDimensionPropertiesBuilder() *DimensionPropertiesBuilder {
+ builder := &DimensionPropertiesBuilder{}
+ return builder
+}
+
+// 是否隐藏
+//
+// 示例值:false
+func (builder *DimensionPropertiesBuilder) Hidden(hidden bool) *DimensionPropertiesBuilder {
+ builder.hidden = hidden
+ builder.hiddenFlag = true
+ return builder
+}
+
+// 行/列像素大小
+//
+// 示例值:100
+func (builder *DimensionPropertiesBuilder) PixelSize(pixelSize int) *DimensionPropertiesBuilder {
+ builder.pixelSize = pixelSize
+ builder.pixelSizeFlag = true
+ return builder
+}
+
+func (builder *DimensionPropertiesBuilder) Build() *DimensionProperties {
+ req := &DimensionProperties{}
+ if builder.hiddenFlag {
+ req.Hidden = &builder.hidden
+
+ }
+ if builder.pixelSizeFlag {
+ req.PixelSize = &builder.pixelSize
+
+ }
+ return req
+}
+
+type File struct {
+ FileToken *string `json:"file_token,omitempty"` // 附件token
+ Name *string `json:"name,omitempty"` // 附件名称
+ SegmentStyle *SegmentStyle `json:"segment_style,omitempty"` //
+}
+
+type FileBuilder struct {
+ fileToken string // 附件token
+ fileTokenFlag bool
+ name string // 附件名称
+ nameFlag bool
+ segmentStyle *SegmentStyle //
+ segmentStyleFlag bool
+}
+
+func NewFileBuilder() *FileBuilder {
+ builder := &FileBuilder{}
+ return builder
+}
+
+// 附件token
+//
+// 示例值:boxxxxxxx
+func (builder *FileBuilder) FileToken(fileToken string) *FileBuilder {
+ builder.fileToken = fileToken
+ builder.fileTokenFlag = true
+ return builder
+}
+
+// 附件名称
+//
+// 示例值:a.png
+func (builder *FileBuilder) Name(name string) *FileBuilder {
+ builder.name = name
+ builder.nameFlag = true
+ return builder
+}
+
+//
+//
+// 示例值:
+func (builder *FileBuilder) SegmentStyle(segmentStyle *SegmentStyle) *FileBuilder {
+ builder.segmentStyle = segmentStyle
+ builder.segmentStyleFlag = true
+ return builder
+}
+
+func (builder *FileBuilder) Build() *File {
+ req := &File{}
+ if builder.fileTokenFlag {
+ req.FileToken = &builder.fileToken
+
+ }
+ if builder.nameFlag {
+ req.Name = &builder.name
+
+ }
+ if builder.segmentStyleFlag {
+ req.SegmentStyle = builder.segmentStyle
+ }
+ return req
+}
+
+type FilterInfo struct {
+ Col *string `json:"col,omitempty"` // 设置了筛选条件的列
+ Conditions []*Condition `json:"conditions,omitempty"` // 筛选条件
+}
+
+type FilterInfoBuilder struct {
+ col string // 设置了筛选条件的列
+ colFlag bool
+ conditions []*Condition // 筛选条件
+ conditionsFlag bool
+}
+
+func NewFilterInfoBuilder() *FilterInfoBuilder {
+ builder := &FilterInfoBuilder{}
+ return builder
+}
+
+// 设置了筛选条件的列
+//
+// 示例值:E
+func (builder *FilterInfoBuilder) Col(col string) *FilterInfoBuilder {
+ builder.col = col
+ builder.colFlag = true
+ return builder
+}
+
+// 筛选条件
+//
+// 示例值:
+func (builder *FilterInfoBuilder) Conditions(conditions []*Condition) *FilterInfoBuilder {
+ builder.conditions = conditions
+ builder.conditionsFlag = true
+ return builder
+}
+
+func (builder *FilterInfoBuilder) Build() *FilterInfo {
+ req := &FilterInfo{}
+ if builder.colFlag {
+ req.Col = &builder.col
+
+ }
+ if builder.conditionsFlag {
+ req.Conditions = builder.conditions
+ }
+ return req
+}
+
+type FilterView struct {
+ FilterViewId *string `json:"filter_view_id,omitempty"` // 筛选视图 id
+ FilterViewName *string `json:"filter_view_name,omitempty"` // 筛选视图名字
+ Range *string `json:"range,omitempty"` // 筛选视图的筛选范围
+}
+
+type FilterViewBuilder struct {
+ filterViewId string // 筛选视图 id
+ filterViewIdFlag bool
+ filterViewName string // 筛选视图名字
+ filterViewNameFlag bool
+ range_ string // 筛选视图的筛选范围
+ rangeFlag bool
+}
+
+func NewFilterViewBuilder() *FilterViewBuilder {
+ builder := &FilterViewBuilder{}
+ return builder
+}
+
+// 筛选视图 id
+//
+// 示例值:pH9hbVcCXA
+func (builder *FilterViewBuilder) FilterViewId(filterViewId string) *FilterViewBuilder {
+ builder.filterViewId = filterViewId
+ builder.filterViewIdFlag = true
+ return builder
+}
+
+// 筛选视图名字
+//
+// 示例值:筛选视图 1
+func (builder *FilterViewBuilder) FilterViewName(filterViewName string) *FilterViewBuilder {
+ builder.filterViewName = filterViewName
+ builder.filterViewNameFlag = true
+ return builder
+}
+
+// 筛选视图的筛选范围
+//
+// 示例值:0b**12!C1:H14
+func (builder *FilterViewBuilder) Range(range_ string) *FilterViewBuilder {
+ builder.range_ = range_
+ builder.rangeFlag = true
+ return builder
+}
+
+func (builder *FilterViewBuilder) Build() *FilterView {
+ req := &FilterView{}
+ if builder.filterViewIdFlag {
+ req.FilterViewId = &builder.filterViewId
+
+ }
+ if builder.filterViewNameFlag {
+ req.FilterViewName = &builder.filterViewName
+
+ }
+ if builder.rangeFlag {
+ req.Range = &builder.range_
+
+ }
+ return req
+}
+
+type FilterViewCondition struct {
+ ConditionId *string `json:"condition_id,omitempty"` // 设置筛选条件的列,使用字母号
+ FilterType *string `json:"filter_type,omitempty"` // 筛选类型
+ CompareType *string `json:"compare_type,omitempty"` // 比较类型
+ Expected []string `json:"expected,omitempty"` // 筛选参数
+}
+
+type FilterViewConditionBuilder struct {
+ conditionId string // 设置筛选条件的列,使用字母号
+ conditionIdFlag bool
+ filterType string // 筛选类型
+ filterTypeFlag bool
+ compareType string // 比较类型
+ compareTypeFlag bool
+ expected []string // 筛选参数
+ expectedFlag bool
+}
+
+func NewFilterViewConditionBuilder() *FilterViewConditionBuilder {
+ builder := &FilterViewConditionBuilder{}
+ return builder
+}
+
+// 设置筛选条件的列,使用字母号
+//
+// 示例值:E
+func (builder *FilterViewConditionBuilder) ConditionId(conditionId string) *FilterViewConditionBuilder {
+ builder.conditionId = conditionId
+ builder.conditionIdFlag = true
+ return builder
+}
+
+// 筛选类型
+//
+// 示例值:number
+func (builder *FilterViewConditionBuilder) FilterType(filterType string) *FilterViewConditionBuilder {
+ builder.filterType = filterType
+ builder.filterTypeFlag = true
+ return builder
+}
+
+// 比较类型
+//
+// 示例值:less
+func (builder *FilterViewConditionBuilder) CompareType(compareType string) *FilterViewConditionBuilder {
+ builder.compareType = compareType
+ builder.compareTypeFlag = true
+ return builder
+}
+
+// 筛选参数
+//
+// 示例值:6
+func (builder *FilterViewConditionBuilder) Expected(expected []string) *FilterViewConditionBuilder {
+ builder.expected = expected
+ builder.expectedFlag = true
+ return builder
+}
+
+func (builder *FilterViewConditionBuilder) Build() *FilterViewCondition {
+ req := &FilterViewCondition{}
+ if builder.conditionIdFlag {
+ req.ConditionId = &builder.conditionId
+
+ }
+ if builder.filterTypeFlag {
+ req.FilterType = &builder.filterType
+
+ }
+ if builder.compareTypeFlag {
+ req.CompareType = &builder.compareType
+
+ }
+ if builder.expectedFlag {
+ req.Expected = builder.expected
+ }
+ return req
+}
+
+type Find struct {
+ FindCondition *FindCondition `json:"find_condition,omitempty"` // 查找条件
+ Find *string `json:"find,omitempty"` // 查找的字符串,当`search_by_regex`字段为 true 时,该字段为正则表达式
+}
+
+type FindBuilder struct {
+ findCondition *FindCondition // 查找条件
+ findConditionFlag bool
+ find string // 查找的字符串,当`search_by_regex`字段为 true 时,该字段为正则表达式
+ findFlag bool
+}
+
+func NewFindBuilder() *FindBuilder {
+ builder := &FindBuilder{}
+ return builder
+}
+
+// 查找条件
+//
+// 示例值:
+func (builder *FindBuilder) FindCondition(findCondition *FindCondition) *FindBuilder {
+ builder.findCondition = findCondition
+ builder.findConditionFlag = true
+ return builder
+}
+
+// 查找的字符串,当`search_by_regex`字段为 true 时,该字段为正则表达式
+//
+// 示例值:如下;;- 普通查找示例: "hello";- 正则查找示例: "[A-Z]\w+"
+func (builder *FindBuilder) Find(find string) *FindBuilder {
+ builder.find = find
+ builder.findFlag = true
+ return builder
+}
+
+func (builder *FindBuilder) Build() *Find {
+ req := &Find{}
+ if builder.findConditionFlag {
+ req.FindCondition = builder.findCondition
+ }
+ if builder.findFlag {
+ req.Find = &builder.find
+
+ }
+ return req
+}
+
+type FindCondition struct {
+ Range *string `json:"range,omitempty"` // 查找范围,参考 [名词解释 Range](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview)
+ MatchCase *bool `json:"match_case,omitempty"` // 是否忽略大小写,默认为 false;- `true`:表示忽略字符串中字母大小写差异;- `false`:表示区分字符串中字母大小写
+ MatchEntireCell *bool `json:"match_entire_cell,omitempty"` // 是否完全匹配整个单元格,默认值为 false;- `true`:表示完全匹配单元格,比如 find 取值为 "hello",则单元格中的内容必须为 "hello";- `false`:表示允许部分匹配单元格,比如 find 取值为 "hello",则单元格中的内容包含 "hello" 即可
+ SearchByRegex *bool `json:"search_by_regex,omitempty"` // 是否为正则匹配,默认值为 false;- `true`:表示使用正则匹配;- `false`:表示不使用正则匹配
+ IncludeFormulas *bool `json:"include_formulas,omitempty"` // 是否仅搜索单元格公式,默认值为 false;- `true`:表示仅搜索单元格公式;- `false`:表示仅搜索单元格内容
+}
+
+type FindConditionBuilder struct {
+ range_ string // 查找范围,参考 [名词解释 Range](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview)
+ rangeFlag bool
+ matchCase bool // 是否忽略大小写,默认为 false;- `true`:表示忽略字符串中字母大小写差异;- `false`:表示区分字符串中字母大小写
+ matchCaseFlag bool
+ matchEntireCell bool // 是否完全匹配整个单元格,默认值为 false;- `true`:表示完全匹配单元格,比如 find 取值为 "hello",则单元格中的内容必须为 "hello";- `false`:表示允许部分匹配单元格,比如 find 取值为 "hello",则单元格中的内容包含 "hello" 即可
+ matchEntireCellFlag bool
+ searchByRegex bool // 是否为正则匹配,默认值为 false;- `true`:表示使用正则匹配;- `false`:表示不使用正则匹配
+ searchByRegexFlag bool
+ includeFormulas bool // 是否仅搜索单元格公式,默认值为 false;- `true`:表示仅搜索单元格公式;- `false`:表示仅搜索单元格内容
+ includeFormulasFlag bool
+}
+
+func NewFindConditionBuilder() *FindConditionBuilder {
+ builder := &FindConditionBuilder{}
+ return builder
+}
+
+// 查找范围,参考 [名词解释 Range](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview)
+//
+// 示例值:PNIfrm!A1:C5
+func (builder *FindConditionBuilder) Range(range_ string) *FindConditionBuilder {
+ builder.range_ = range_
+ builder.rangeFlag = true
+ return builder
+}
+
+// 是否忽略大小写,默认为 false;- `true`:表示忽略字符串中字母大小写差异;- `false`:表示区分字符串中字母大小写
+//
+// 示例值:true
+func (builder *FindConditionBuilder) MatchCase(matchCase bool) *FindConditionBuilder {
+ builder.matchCase = matchCase
+ builder.matchCaseFlag = true
+ return builder
+}
+
+// 是否完全匹配整个单元格,默认值为 false;- `true`:表示完全匹配单元格,比如 find 取值为 "hello",则单元格中的内容必须为 "hello";- `false`:表示允许部分匹配单元格,比如 find 取值为 "hello",则单元格中的内容包含 "hello" 即可
+//
+// 示例值:false
+func (builder *FindConditionBuilder) MatchEntireCell(matchEntireCell bool) *FindConditionBuilder {
+ builder.matchEntireCell = matchEntireCell
+ builder.matchEntireCellFlag = true
+ return builder
+}
+
+// 是否为正则匹配,默认值为 false;- `true`:表示使用正则匹配;- `false`:表示不使用正则匹配
+//
+// 示例值:false
+func (builder *FindConditionBuilder) SearchByRegex(searchByRegex bool) *FindConditionBuilder {
+ builder.searchByRegex = searchByRegex
+ builder.searchByRegexFlag = true
+ return builder
+}
+
+// 是否仅搜索单元格公式,默认值为 false;- `true`:表示仅搜索单元格公式;- `false`:表示仅搜索单元格内容
+//
+// 示例值:false
+func (builder *FindConditionBuilder) IncludeFormulas(includeFormulas bool) *FindConditionBuilder {
+ builder.includeFormulas = includeFormulas
+ builder.includeFormulasFlag = true
+ return builder
+}
+
+func (builder *FindConditionBuilder) Build() *FindCondition {
+ req := &FindCondition{}
+ if builder.rangeFlag {
+ req.Range = &builder.range_
+
+ }
+ if builder.matchCaseFlag {
+ req.MatchCase = &builder.matchCase
+
+ }
+ if builder.matchEntireCellFlag {
+ req.MatchEntireCell = &builder.matchEntireCell
+
+ }
+ if builder.searchByRegexFlag {
+ req.SearchByRegex = &builder.searchByRegex
+
+ }
+ if builder.includeFormulasFlag {
+ req.IncludeFormulas = &builder.includeFormulas
+
+ }
+ return req
+}
+
+type FindReplaceResult struct {
+ MatchedCells []string `json:"matched_cells,omitempty"` // 符合查找条件的单元格数组,不包含公式,例如["A1", "A2"...]
+ MatchedFormulaCells []string `json:"matched_formula_cells,omitempty"` // 符合查找条件的含有公式的单元格数组,例如["B3", "H7"...]
+ RowsCount *int `json:"rows_count,omitempty"` // 符合查找条件的总行数
+}
+
+type FindReplaceResultBuilder struct {
+ matchedCells []string // 符合查找条件的单元格数组,不包含公式,例如["A1", "A2"...]
+ matchedCellsFlag bool
+ matchedFormulaCells []string // 符合查找条件的含有公式的单元格数组,例如["B3", "H7"...]
+ matchedFormulaCellsFlag bool
+ rowsCount int // 符合查找条件的总行数
+ rowsCountFlag bool
+}
+
+func NewFindReplaceResultBuilder() *FindReplaceResultBuilder {
+ builder := &FindReplaceResultBuilder{}
+ return builder
+}
+
+// 符合查找条件的单元格数组,不包含公式,例如["A1", "A2"...]
+//
+// 示例值:
+func (builder *FindReplaceResultBuilder) MatchedCells(matchedCells []string) *FindReplaceResultBuilder {
+ builder.matchedCells = matchedCells
+ builder.matchedCellsFlag = true
+ return builder
+}
+
+// 符合查找条件的含有公式的单元格数组,例如["B3", "H7"...]
+//
+// 示例值:
+func (builder *FindReplaceResultBuilder) MatchedFormulaCells(matchedFormulaCells []string) *FindReplaceResultBuilder {
+ builder.matchedFormulaCells = matchedFormulaCells
+ builder.matchedFormulaCellsFlag = true
+ return builder
+}
+
+// 符合查找条件的总行数
+//
+// 示例值:2
+func (builder *FindReplaceResultBuilder) RowsCount(rowsCount int) *FindReplaceResultBuilder {
+ builder.rowsCount = rowsCount
+ builder.rowsCountFlag = true
+ return builder
+}
+
+func (builder *FindReplaceResultBuilder) Build() *FindReplaceResult {
+ req := &FindReplaceResult{}
+ if builder.matchedCellsFlag {
+ req.MatchedCells = builder.matchedCells
+ }
+ if builder.matchedFormulaCellsFlag {
+ req.MatchedFormulaCells = builder.matchedFormulaCells
+ }
+ if builder.rowsCountFlag {
+ req.RowsCount = &builder.rowsCount
+
+ }
+ return req
+}
+
+type FloatImage struct {
+ FloatImageId *string `json:"float_image_id,omitempty"` // 浮动图片 id
+ FloatImageToken *string `json:"float_image_token,omitempty"` // 【更新时不用传,创建需要】浮动图片 token,需要先上传图片到表格获得此 token 之后再进行浮动图片的相关操作
+ Range *string `json:"range,omitempty"` // 浮动图片的左上角单元格定位,只支持一个单元格
+ Width *float64 `json:"width,omitempty"` // 浮动图片的宽度,大于等于 20px
+ Height *float64 `json:"height,omitempty"` // 浮动图片的高度,大于等于 20px
+ OffsetX *float64 `json:"offset_x,omitempty"` // 浮动图片左上角所在位置相对于所在单元格左上角的横向偏移,大于等于0且小于所在单元格的宽度
+ OffsetY *float64 `json:"offset_y,omitempty"` // 浮动图片左上角所在位置相对于所在单元格左上角的纵向偏移,大于等于0且小于所在单元格的高度
+}
+
+type FloatImageBuilder struct {
+ floatImageId string // 浮动图片 id
+ floatImageIdFlag bool
+ floatImageToken string // 【更新时不用传,创建需要】浮动图片 token,需要先上传图片到表格获得此 token 之后再进行浮动图片的相关操作
+ floatImageTokenFlag bool
+ range_ string // 浮动图片的左上角单元格定位,只支持一个单元格
+ rangeFlag bool
+ width float64 // 浮动图片的宽度,大于等于 20px
+ widthFlag bool
+ height float64 // 浮动图片的高度,大于等于 20px
+ heightFlag bool
+ offsetX float64 // 浮动图片左上角所在位置相对于所在单元格左上角的横向偏移,大于等于0且小于所在单元格的宽度
+ offsetXFlag bool
+ offsetY float64 // 浮动图片左上角所在位置相对于所在单元格左上角的纵向偏移,大于等于0且小于所在单元格的高度
+ offsetYFlag bool
+}
+
+func NewFloatImageBuilder() *FloatImageBuilder {
+ builder := &FloatImageBuilder{}
+ return builder
+}
+
+// 浮动图片 id
+//
+// 示例值:ye06SS14ph
+func (builder *FloatImageBuilder) FloatImageId(floatImageId string) *FloatImageBuilder {
+ builder.floatImageId = floatImageId
+ builder.floatImageIdFlag = true
+ return builder
+}
+
+// 【更新时不用传,创建需要】浮动图片 token,需要先上传图片到表格获得此 token 之后再进行浮动图片的相关操作
+//
+// 示例值:boxbcbQsaSqIXsxxxxx1HCPJFbh
+func (builder *FloatImageBuilder) FloatImageToken(floatImageToken string) *FloatImageBuilder {
+ builder.floatImageToken = floatImageToken
+ builder.floatImageTokenFlag = true
+ return builder
+}
+
+// 浮动图片的左上角单元格定位,只支持一个单元格
+//
+// 示例值:0b**12!A1:A1
+func (builder *FloatImageBuilder) Range(range_ string) *FloatImageBuilder {
+ builder.range_ = range_
+ builder.rangeFlag = true
+ return builder
+}
+
+// 浮动图片的宽度,大于等于 20px
+//
+// 示例值:100
+func (builder *FloatImageBuilder) Width(width float64) *FloatImageBuilder {
+ builder.width = width
+ builder.widthFlag = true
+ return builder
+}
+
+// 浮动图片的高度,大于等于 20px
+//
+// 示例值:100
+func (builder *FloatImageBuilder) Height(height float64) *FloatImageBuilder {
+ builder.height = height
+ builder.heightFlag = true
+ return builder
+}
+
+// 浮动图片左上角所在位置相对于所在单元格左上角的横向偏移,大于等于0且小于所在单元格的宽度
+//
+// 示例值:0
+func (builder *FloatImageBuilder) OffsetX(offsetX float64) *FloatImageBuilder {
+ builder.offsetX = offsetX
+ builder.offsetXFlag = true
+ return builder
+}
+
+// 浮动图片左上角所在位置相对于所在单元格左上角的纵向偏移,大于等于0且小于所在单元格的高度
+//
+// 示例值:0
+func (builder *FloatImageBuilder) OffsetY(offsetY float64) *FloatImageBuilder {
+ builder.offsetY = offsetY
+ builder.offsetYFlag = true
+ return builder
+}
+
+func (builder *FloatImageBuilder) Build() *FloatImage {
+ req := &FloatImage{}
+ if builder.floatImageIdFlag {
+ req.FloatImageId = &builder.floatImageId
+
+ }
+ if builder.floatImageTokenFlag {
+ req.FloatImageToken = &builder.floatImageToken
+
+ }
+ if builder.rangeFlag {
+ req.Range = &builder.range_
+
+ }
+ if builder.widthFlag {
+ req.Width = &builder.width
+
+ }
+ if builder.heightFlag {
+ req.Height = &builder.height
+
+ }
+ if builder.offsetXFlag {
+ req.OffsetX = &builder.offsetX
+
+ }
+ if builder.offsetYFlag {
+ req.OffsetY = &builder.offsetY
+
+ }
+ return req
+}
+
+type Formula struct {
+ Formula *string `json:"formula,omitempty"` // 公式
+ FormulaValue *string `json:"formula_value,omitempty"` // 公式结果
+ AffectedRange *string `json:"affected_range,omitempty"` // 公式影响的范围
+}
+
+type FormulaBuilder struct {
+ formula string // 公式
+ formulaFlag bool
+ formulaValue string // 公式结果
+ formulaValueFlag bool
+ affectedRange string // 公式影响的范围
+ affectedRangeFlag bool
+}
+
+func NewFormulaBuilder() *FormulaBuilder {
+ builder := &FormulaBuilder{}
+ return builder
+}
+
+// 公式
+//
+// 示例值:=SUM(A:A)
+func (builder *FormulaBuilder) Formula(formula string) *FormulaBuilder {
+ builder.formula = formula
+ builder.formulaFlag = true
+ return builder
+}
+
+// 公式结果
+//
+// 示例值:123
+func (builder *FormulaBuilder) FormulaValue(formulaValue string) *FormulaBuilder {
+ builder.formulaValue = formulaValue
+ builder.formulaValueFlag = true
+ return builder
+}
+
+// 公式影响的范围
+//
+// 示例值:Xkhr2d!A1:B2
+func (builder *FormulaBuilder) AffectedRange(affectedRange string) *FormulaBuilder {
+ builder.affectedRange = affectedRange
+ builder.affectedRangeFlag = true
+ return builder
+}
+
+func (builder *FormulaBuilder) Build() *Formula {
req := &Formula{}
if builder.formulaFlag {
req.Formula = &builder.formula
}
- if builder.formulaValueFlag {
- req.FormulaValue = &builder.formulaValue
+ if builder.formulaValueFlag {
+ req.FormulaValue = &builder.formulaValue
+
+ }
+ if builder.affectedRangeFlag {
+ req.AffectedRange = &builder.affectedRange
+
+ }
+ return req
+}
+
+type GetSpreadsheet struct {
+ Title *string `json:"title,omitempty"` // 电子表格标题
+ OwnerId *string `json:"owner_id,omitempty"` // 电子表格owner
+ Token *string `json:"token,omitempty"` // 电子表格token
+ Url *string `json:"url,omitempty"` // 电子表格url
+}
+
+type GetSpreadsheetBuilder struct {
+ title string // 电子表格标题
+ titleFlag bool
+ ownerId string // 电子表格owner
+ ownerIdFlag bool
+ token string // 电子表格token
+ tokenFlag bool
+ url string // 电子表格url
+ urlFlag bool
+}
+
+func NewGetSpreadsheetBuilder() *GetSpreadsheetBuilder {
+ builder := &GetSpreadsheetBuilder{}
+ return builder
+}
+
+// 电子表格标题
+//
+// 示例值:title
+func (builder *GetSpreadsheetBuilder) Title(title string) *GetSpreadsheetBuilder {
+ builder.title = title
+ builder.titleFlag = true
+ return builder
+}
+
+// 电子表格owner
+//
+// 示例值:ou_xxxxxxxxxxxx
+func (builder *GetSpreadsheetBuilder) OwnerId(ownerId string) *GetSpreadsheetBuilder {
+ builder.ownerId = ownerId
+ builder.ownerIdFlag = true
+ return builder
+}
+
+// 电子表格token
+//
+// 示例值:shtxxxxxxxxxxxxxx
+func (builder *GetSpreadsheetBuilder) Token(token string) *GetSpreadsheetBuilder {
+ builder.token = token
+ builder.tokenFlag = true
+ return builder
+}
+
+// 电子表格url
+//
+// 示例值:https://bytedance.feishu.cn/sheets/shtcnmBA*****yGehy8
+func (builder *GetSpreadsheetBuilder) Url(url string) *GetSpreadsheetBuilder {
+ builder.url = url
+ builder.urlFlag = true
+ return builder
+}
+
+func (builder *GetSpreadsheetBuilder) Build() *GetSpreadsheet {
+ req := &GetSpreadsheet{}
+ if builder.titleFlag {
+ req.Title = &builder.title
+
+ }
+ if builder.ownerIdFlag {
+ req.OwnerId = &builder.ownerId
+
+ }
+ if builder.tokenFlag {
+ req.Token = &builder.token
+
+ }
+ if builder.urlFlag {
+ req.Url = &builder.url
+
+ }
+ return req
+}
+
+type GridProperties struct {
+ FrozenRowCount *int `json:"frozen_row_count,omitempty"` // 冻结的行数量
+ FrozenColumnCount *int `json:"frozen_column_count,omitempty"` // 冻结的列数量
+ RowCount *int `json:"row_count,omitempty"` // 工作表的行数
+ ColumnCount *int `json:"column_count,omitempty"` // 工作表的列数量
+}
+
+type GridPropertiesBuilder struct {
+ frozenRowCount int // 冻结的行数量
+ frozenRowCountFlag bool
+ frozenColumnCount int // 冻结的列数量
+ frozenColumnCountFlag bool
+ rowCount int // 工作表的行数
+ rowCountFlag bool
+ columnCount int // 工作表的列数量
+ columnCountFlag bool
+}
+
+func NewGridPropertiesBuilder() *GridPropertiesBuilder {
+ builder := &GridPropertiesBuilder{}
+ return builder
+}
+
+// 冻结的行数量
+//
+// 示例值:0
+func (builder *GridPropertiesBuilder) FrozenRowCount(frozenRowCount int) *GridPropertiesBuilder {
+ builder.frozenRowCount = frozenRowCount
+ builder.frozenRowCountFlag = true
+ return builder
+}
+
+// 冻结的列数量
+//
+// 示例值:0
+func (builder *GridPropertiesBuilder) FrozenColumnCount(frozenColumnCount int) *GridPropertiesBuilder {
+ builder.frozenColumnCount = frozenColumnCount
+ builder.frozenColumnCountFlag = true
+ return builder
+}
+
+// 工作表的行数
+//
+// 示例值:200
+func (builder *GridPropertiesBuilder) RowCount(rowCount int) *GridPropertiesBuilder {
+ builder.rowCount = rowCount
+ builder.rowCountFlag = true
+ return builder
+}
+
+// 工作表的列数量
+//
+// 示例值:20
+func (builder *GridPropertiesBuilder) ColumnCount(columnCount int) *GridPropertiesBuilder {
+ builder.columnCount = columnCount
+ builder.columnCountFlag = true
+ return builder
+}
+
+func (builder *GridPropertiesBuilder) Build() *GridProperties {
+ req := &GridProperties{}
+ if builder.frozenRowCountFlag {
+ req.FrozenRowCount = &builder.frozenRowCount
+
+ }
+ if builder.frozenColumnCountFlag {
+ req.FrozenColumnCount = &builder.frozenColumnCount
+
+ }
+ if builder.rowCountFlag {
+ req.RowCount = &builder.rowCount
+
+ }
+ if builder.columnCountFlag {
+ req.ColumnCount = &builder.columnCount
+
+ }
+ return req
+}
+
+type Image struct {
+ ImageToken *string `json:"image_token,omitempty"` // 图片token
+}
+
+type ImageBuilder struct {
+ imageToken string // 图片token
+ imageTokenFlag bool
+}
+
+func NewImageBuilder() *ImageBuilder {
+ builder := &ImageBuilder{}
+ return builder
+}
+
+// 图片token
+//
+// 示例值:boxxxxxxxxxx
+func (builder *ImageBuilder) ImageToken(imageToken string) *ImageBuilder {
+ builder.imageToken = imageToken
+ builder.imageTokenFlag = true
+ return builder
+}
+
+func (builder *ImageBuilder) Build() *Image {
+ req := &Image{}
+ if builder.imageTokenFlag {
+ req.ImageToken = &builder.imageToken
+
+ }
+ return req
+}
+
+type InsertDimension struct {
+ DimensionRange *Dimension `json:"dimension_range,omitempty"` // 行列操作的维度
+ InheritFrom *string `json:"inherit_from,omitempty"` // 是否继承上/下一行/列样式
+}
+
+type InsertDimensionBuilder struct {
+ dimensionRange *Dimension // 行列操作的维度
+ dimensionRangeFlag bool
+ inheritFrom string // 是否继承上/下一行/列样式
+ inheritFromFlag bool
+}
+
+func NewInsertDimensionBuilder() *InsertDimensionBuilder {
+ builder := &InsertDimensionBuilder{}
+ return builder
+}
+
+// 行列操作的维度
+//
+// 示例值:
+func (builder *InsertDimensionBuilder) DimensionRange(dimensionRange *Dimension) *InsertDimensionBuilder {
+ builder.dimensionRange = dimensionRange
+ builder.dimensionRangeFlag = true
+ return builder
+}
+
+// 是否继承上/下一行/列样式
+//
+// 示例值:Before
+func (builder *InsertDimensionBuilder) InheritFrom(inheritFrom string) *InsertDimensionBuilder {
+ builder.inheritFrom = inheritFrom
+ builder.inheritFromFlag = true
+ return builder
+}
+
+func (builder *InsertDimensionBuilder) Build() *InsertDimension {
+ req := &InsertDimension{}
+ if builder.dimensionRangeFlag {
+ req.DimensionRange = builder.dimensionRange
+ }
+ if builder.inheritFromFlag {
+ req.InheritFrom = &builder.inheritFrom
+
+ }
+ return req
+}
+
+type LeftBorderStyle struct {
+ Style *string `json:"style,omitempty"` // 边框样式
+ Color *string `json:"color,omitempty"` // 边框颜色
+}
+
+type LeftBorderStyleBuilder struct {
+ style string // 边框样式
+ styleFlag bool
+ color string // 边框颜色
+ colorFlag bool
+}
+
+func NewLeftBorderStyleBuilder() *LeftBorderStyleBuilder {
+ builder := &LeftBorderStyleBuilder{}
+ return builder
+}
+
+// 边框样式
+//
+// 示例值:
+func (builder *LeftBorderStyleBuilder) Style(style string) *LeftBorderStyleBuilder {
+ builder.style = style
+ builder.styleFlag = true
+ return builder
+}
+
+// 边框颜色
+//
+// 示例值:#ff00ff
+func (builder *LeftBorderStyleBuilder) Color(color string) *LeftBorderStyleBuilder {
+ builder.color = color
+ builder.colorFlag = true
+ return builder
+}
+
+func (builder *LeftBorderStyleBuilder) Build() *LeftBorderStyle {
+ req := &LeftBorderStyle{}
+ if builder.styleFlag {
+ req.Style = &builder.style
+
+ }
+ if builder.colorFlag {
+ req.Color = &builder.color
+
+ }
+ return req
+}
+
+type Link struct {
+ Text *string `json:"text,omitempty"` // 文本
+ Link *string `json:"link,omitempty"` // 链接
+ SegmentStyles []*SegmentStyle `json:"segment_styles,omitempty"` //
+}
+
+type LinkBuilder struct {
+ text string // 文本
+ textFlag bool
+ link string // 链接
+ linkFlag bool
+ segmentStyles []*SegmentStyle //
+ segmentStylesFlag bool
+}
+
+func NewLinkBuilder() *LinkBuilder {
+ builder := &LinkBuilder{}
+ return builder
+}
+
+// 文本
+//
+// 示例值:text
+func (builder *LinkBuilder) Text(text string) *LinkBuilder {
+ builder.text = text
+ builder.textFlag = true
+ return builder
+}
+
+// 链接
+//
+// 示例值:www.xxxx.cn
+func (builder *LinkBuilder) Link(link string) *LinkBuilder {
+ builder.link = link
+ builder.linkFlag = true
+ return builder
+}
+
+//
+//
+// 示例值:
+func (builder *LinkBuilder) SegmentStyles(segmentStyles []*SegmentStyle) *LinkBuilder {
+ builder.segmentStyles = segmentStyles
+ builder.segmentStylesFlag = true
+ return builder
+}
+
+func (builder *LinkBuilder) Build() *Link {
+ req := &Link{}
+ if builder.textFlag {
+ req.Text = &builder.text
+
+ }
+ if builder.linkFlag {
+ req.Link = &builder.link
+
+ }
+ if builder.segmentStylesFlag {
+ req.SegmentStyles = builder.segmentStyles
+ }
+ return req
+}
+
+type MentionDocument struct {
+ Title *string `json:"title,omitempty"` // 文档标题
+ ObjectType *string `json:"object_type,omitempty"` // 文档类型
+ Token *string `json:"token,omitempty"` // 文档token
+ SegmentStyle *SegmentStyle `json:"segment_style,omitempty"` //
+}
+
+type MentionDocumentBuilder struct {
+ title string // 文档标题
+ titleFlag bool
+ objectType string // 文档类型
+ objectTypeFlag bool
+ token string // 文档token
+ tokenFlag bool
+ segmentStyle *SegmentStyle //
+ segmentStyleFlag bool
+}
+
+func NewMentionDocumentBuilder() *MentionDocumentBuilder {
+ builder := &MentionDocumentBuilder{}
+ return builder
+}
+
+// 文档标题
+//
+// 示例值:abc
+func (builder *MentionDocumentBuilder) Title(title string) *MentionDocumentBuilder {
+ builder.title = title
+ builder.titleFlag = true
+ return builder
+}
+
+// 文档类型
+//
+// 示例值:sheet
+func (builder *MentionDocumentBuilder) ObjectType(objectType string) *MentionDocumentBuilder {
+ builder.objectType = objectType
+ builder.objectTypeFlag = true
+ return builder
+}
+
+// 文档token
+//
+// 示例值:shtxxxxxxxxx
+func (builder *MentionDocumentBuilder) Token(token string) *MentionDocumentBuilder {
+ builder.token = token
+ builder.tokenFlag = true
+ return builder
+}
+
+//
+//
+// 示例值:
+func (builder *MentionDocumentBuilder) SegmentStyle(segmentStyle *SegmentStyle) *MentionDocumentBuilder {
+ builder.segmentStyle = segmentStyle
+ builder.segmentStyleFlag = true
+ return builder
+}
+
+func (builder *MentionDocumentBuilder) Build() *MentionDocument {
+ req := &MentionDocument{}
+ if builder.titleFlag {
+ req.Title = &builder.title
+
+ }
+ if builder.objectTypeFlag {
+ req.ObjectType = &builder.objectType
+
+ }
+ if builder.tokenFlag {
+ req.Token = &builder.token
+
+ }
+ if builder.segmentStyleFlag {
+ req.SegmentStyle = builder.segmentStyle
+ }
+ return req
+}
+
+type MentionUser struct {
+ Name *string `json:"name,omitempty"` // 用户名
+ UserId *string `json:"user_id,omitempty"` // 用户id
+ Notify *bool `json:"notify,omitempty"` // 是否通知用户
+ SegmentStyle *SegmentStyle `json:"segment_style,omitempty"` //
+}
+
+type MentionUserBuilder struct {
+ name string // 用户名
+ nameFlag bool
+ userId string // 用户id
+ userIdFlag bool
+ notify bool // 是否通知用户
+ notifyFlag bool
+ segmentStyle *SegmentStyle //
+ segmentStyleFlag bool
+}
+
+func NewMentionUserBuilder() *MentionUserBuilder {
+ builder := &MentionUserBuilder{}
+ return builder
+}
+
+// 用户名
+//
+// 示例值:李四
+func (builder *MentionUserBuilder) Name(name string) *MentionUserBuilder {
+ builder.name = name
+ builder.nameFlag = true
+ return builder
+}
+
+// 用户id
+//
+// 示例值:ou_xxxxxxx
+func (builder *MentionUserBuilder) UserId(userId string) *MentionUserBuilder {
+ builder.userId = userId
+ builder.userIdFlag = true
+ return builder
+}
+
+// 是否通知用户
+//
+// 示例值:true
+func (builder *MentionUserBuilder) Notify(notify bool) *MentionUserBuilder {
+ builder.notify = notify
+ builder.notifyFlag = true
+ return builder
+}
+
+//
+//
+// 示例值:
+func (builder *MentionUserBuilder) SegmentStyle(segmentStyle *SegmentStyle) *MentionUserBuilder {
+ builder.segmentStyle = segmentStyle
+ builder.segmentStyleFlag = true
+ return builder
+}
+
+func (builder *MentionUserBuilder) Build() *MentionUser {
+ req := &MentionUser{}
+ if builder.nameFlag {
+ req.Name = &builder.name
+
+ }
+ if builder.userIdFlag {
+ req.UserId = &builder.userId
}
- if builder.affectedRangeFlag {
- req.AffectedRange = &builder.affectedRange
+ if builder.notifyFlag {
+ req.Notify = &builder.notify
}
+ if builder.segmentStyleFlag {
+ req.SegmentStyle = builder.segmentStyle
+ }
return req
}
-type GetSpreadsheet struct {
- Title *string `json:"title,omitempty"` // 电子表格标题
- OwnerId *string `json:"owner_id,omitempty"` // 电子表格owner
- Token *string `json:"token,omitempty"` // 电子表格token
- Url *string `json:"url,omitempty"` // 电子表格url
+type MergeCell struct {
+ Range *MergeRange `json:"range,omitempty"` // 合并单元格的范围
+ MergeType *string `json:"merge_type,omitempty"` // 合并单元格类型
}
-type GetSpreadsheetBuilder struct {
- title string // 电子表格标题
- titleFlag bool
- ownerId string // 电子表格owner
- ownerIdFlag bool
- token string // 电子表格token
- tokenFlag bool
- url string // 电子表格url
- urlFlag bool
+type MergeCellBuilder struct {
+ range_ *MergeRange // 合并单元格的范围
+ rangeFlag bool
+ mergeType string // 合并单元格类型
+ mergeTypeFlag bool
}
-func NewGetSpreadsheetBuilder() *GetSpreadsheetBuilder {
- builder := &GetSpreadsheetBuilder{}
+func NewMergeCellBuilder() *MergeCellBuilder {
+ builder := &MergeCellBuilder{}
+ return builder
+}
+
+// 合并单元格的范围
+//
+// 示例值:Zj2ts!A1:B2
+func (builder *MergeCellBuilder) Range(range_ *MergeRange) *MergeCellBuilder {
+ builder.range_ = range_
+ builder.rangeFlag = true
+ return builder
+}
+
+// 合并单元格类型
+//
+// 示例值:MergeAll
+func (builder *MergeCellBuilder) MergeType(mergeType string) *MergeCellBuilder {
+ builder.mergeType = mergeType
+ builder.mergeTypeFlag = true
+ return builder
+}
+
+func (builder *MergeCellBuilder) Build() *MergeCell {
+ req := &MergeCell{}
+ if builder.rangeFlag {
+ req.Range = builder.range_
+ }
+ if builder.mergeTypeFlag {
+ req.MergeType = &builder.mergeType
+
+ }
+ return req
+}
+
+type MergeRange struct {
+ StartRowIndex *int `json:"start_row_index,omitempty"` // 起始行
+ EndRowIndex *int `json:"end_row_index,omitempty"` // 结束行
+ StartColumnIndex *int `json:"start_column_index,omitempty"` // 起始列
+ EndColumnIndex *int `json:"end_column_index,omitempty"` // 结束列
+}
+
+type MergeRangeBuilder struct {
+ startRowIndex int // 起始行
+ startRowIndexFlag bool
+ endRowIndex int // 结束行
+ endRowIndexFlag bool
+ startColumnIndex int // 起始列
+ startColumnIndexFlag bool
+ endColumnIndex int // 结束列
+ endColumnIndexFlag bool
+}
+
+func NewMergeRangeBuilder() *MergeRangeBuilder {
+ builder := &MergeRangeBuilder{}
+ return builder
+}
+
+// 起始行
+//
+// 示例值:0
+func (builder *MergeRangeBuilder) StartRowIndex(startRowIndex int) *MergeRangeBuilder {
+ builder.startRowIndex = startRowIndex
+ builder.startRowIndexFlag = true
+ return builder
+}
+
+// 结束行
+//
+// 示例值:0
+func (builder *MergeRangeBuilder) EndRowIndex(endRowIndex int) *MergeRangeBuilder {
+ builder.endRowIndex = endRowIndex
+ builder.endRowIndexFlag = true
+ return builder
+}
+
+// 起始列
+//
+// 示例值:0
+func (builder *MergeRangeBuilder) StartColumnIndex(startColumnIndex int) *MergeRangeBuilder {
+ builder.startColumnIndex = startColumnIndex
+ builder.startColumnIndexFlag = true
+ return builder
+}
+
+// 结束列
+//
+// 示例值:0
+func (builder *MergeRangeBuilder) EndColumnIndex(endColumnIndex int) *MergeRangeBuilder {
+ builder.endColumnIndex = endColumnIndex
+ builder.endColumnIndexFlag = true
+ return builder
+}
+
+func (builder *MergeRangeBuilder) Build() *MergeRange {
+ req := &MergeRange{}
+ if builder.startRowIndexFlag {
+ req.StartRowIndex = &builder.startRowIndex
+
+ }
+ if builder.endRowIndexFlag {
+ req.EndRowIndex = &builder.endRowIndex
+
+ }
+ if builder.startColumnIndexFlag {
+ req.StartColumnIndex = &builder.startColumnIndex
+
+ }
+ if builder.endColumnIndexFlag {
+ req.EndColumnIndex = &builder.endColumnIndex
+
+ }
+ return req
+}
+
+type MoveDimension struct {
+ Source *Dimension `json:"source,omitempty"` // 移动源位置参数
+ DestinationIndex *int `json:"destination_index,omitempty"` // 移动的目标位置行或者列号
+}
+
+type MoveDimensionBuilder struct {
+ source *Dimension // 移动源位置参数
+ sourceFlag bool
+ destinationIndex int // 移动的目标位置行或者列号
+ destinationIndexFlag bool
+}
+
+func NewMoveDimensionBuilder() *MoveDimensionBuilder {
+ builder := &MoveDimensionBuilder{}
+ return builder
+}
+
+// 移动源位置参数
+//
+// 示例值:
+func (builder *MoveDimensionBuilder) Source(source *Dimension) *MoveDimensionBuilder {
+ builder.source = source
+ builder.sourceFlag = true
+ return builder
+}
+
+// 移动的目标位置行或者列号
+//
+// 示例值:4
+func (builder *MoveDimensionBuilder) DestinationIndex(destinationIndex int) *MoveDimensionBuilder {
+ builder.destinationIndex = destinationIndex
+ builder.destinationIndexFlag = true
return builder
}
-// 电子表格标题
-//
-// 示例值:title
-func (builder *GetSpreadsheetBuilder) Title(title string) *GetSpreadsheetBuilder {
- builder.title = title
- builder.titleFlag = true
- return builder
+func (builder *MoveDimensionBuilder) Build() *MoveDimension {
+ req := &MoveDimension{}
+ if builder.sourceFlag {
+ req.Source = builder.source
+ }
+ if builder.destinationIndexFlag {
+ req.DestinationIndex = &builder.destinationIndex
+
+ }
+ return req
+}
+
+type MultiRange struct {
+ Ranges []string `json:"ranges,omitempty"` // 同一个工作表的多个范围
}
-// 电子表格owner
-//
-// 示例值:ou_xxxxxxxxxxxx
-func (builder *GetSpreadsheetBuilder) OwnerId(ownerId string) *GetSpreadsheetBuilder {
- builder.ownerId = ownerId
- builder.ownerIdFlag = true
- return builder
+type MultiRangeBuilder struct {
+ ranges []string // 同一个工作表的多个范围
+ rangesFlag bool
}
-// 电子表格token
-//
-// 示例值:shtxxxxxxxxxxxxxx
-func (builder *GetSpreadsheetBuilder) Token(token string) *GetSpreadsheetBuilder {
- builder.token = token
- builder.tokenFlag = true
+func NewMultiRangeBuilder() *MultiRangeBuilder {
+ builder := &MultiRangeBuilder{}
return builder
}
-// 电子表格url
+// 同一个工作表的多个范围
//
-// 示例值:https://bytedance.feishu.cn/sheets/shtcnmBA*****yGehy8
-func (builder *GetSpreadsheetBuilder) Url(url string) *GetSpreadsheetBuilder {
- builder.url = url
- builder.urlFlag = true
+// 示例值:Sheet1!A1:B2
+func (builder *MultiRangeBuilder) Ranges(ranges []string) *MultiRangeBuilder {
+ builder.ranges = ranges
+ builder.rangesFlag = true
return builder
}
-func (builder *GetSpreadsheetBuilder) Build() *GetSpreadsheet {
- req := &GetSpreadsheet{}
- if builder.titleFlag {
- req.Title = &builder.title
-
- }
- if builder.ownerIdFlag {
- req.OwnerId = &builder.ownerId
-
- }
- if builder.tokenFlag {
- req.Token = &builder.token
-
- }
- if builder.urlFlag {
- req.Url = &builder.url
-
+func (builder *MultiRangeBuilder) Build() *MultiRange {
+ req := &MultiRange{}
+ if builder.rangesFlag {
+ req.Ranges = builder.ranges
}
return req
}
-type GridProperties struct {
- FrozenRowCount *int `json:"frozen_row_count,omitempty"` // 冻结的行数量
- FrozenColumnCount *int `json:"frozen_column_count,omitempty"` // 冻结的列数量
- RowCount *int `json:"row_count,omitempty"` // 工作表的行数
- ColumnCount *int `json:"column_count,omitempty"` // 工作表的列数量
+type MultipleOption struct {
+ Type *string `json:"type,omitempty"` // 多选类型
+ Range *string `json:"range,omitempty"` // 数据引用范围,当type=MultipleOfRange时必须有
+ DataValidationValues []*DataValidationValue `json:"data_validation_values,omitempty"` // 多选列表,当type=MultipleOfList时必须有
+ Properties *OptionProperties `json:"properties,omitempty"` // 属性
}
-type GridPropertiesBuilder struct {
- frozenRowCount int // 冻结的行数量
- frozenRowCountFlag bool
- frozenColumnCount int // 冻结的列数量
- frozenColumnCountFlag bool
- rowCount int // 工作表的行数
- rowCountFlag bool
- columnCount int // 工作表的列数量
- columnCountFlag bool
+type MultipleOptionBuilder struct {
+ type_ string // 多选类型
+ typeFlag bool
+ range_ string // 数据引用范围,当type=MultipleOfRange时必须有
+ rangeFlag bool
+ dataValidationValues []*DataValidationValue // 多选列表,当type=MultipleOfList时必须有
+ dataValidationValuesFlag bool
+ properties *OptionProperties // 属性
+ propertiesFlag bool
}
-func NewGridPropertiesBuilder() *GridPropertiesBuilder {
- builder := &GridPropertiesBuilder{}
+func NewMultipleOptionBuilder() *MultipleOptionBuilder {
+ builder := &MultipleOptionBuilder{}
return builder
}
-// 冻结的行数量
+// 多选类型
//
-// 示例值:0
-func (builder *GridPropertiesBuilder) FrozenRowCount(frozenRowCount int) *GridPropertiesBuilder {
- builder.frozenRowCount = frozenRowCount
- builder.frozenRowCountFlag = true
+// 示例值:OneOfList
+func (builder *MultipleOptionBuilder) Type(type_ string) *MultipleOptionBuilder {
+ builder.type_ = type_
+ builder.typeFlag = true
return builder
}
-// 冻结的列数量
+// 数据引用范围,当type=MultipleOfRange时必须有
//
-// 示例值:0
-func (builder *GridPropertiesBuilder) FrozenColumnCount(frozenColumnCount int) *GridPropertiesBuilder {
- builder.frozenColumnCount = frozenColumnCount
- builder.frozenColumnCountFlag = true
+// 示例值:a8KL0B!A2:B3
+func (builder *MultipleOptionBuilder) Range(range_ string) *MultipleOptionBuilder {
+ builder.range_ = range_
+ builder.rangeFlag = true
return builder
}
-// 工作表的行数
+// 多选列表,当type=MultipleOfList时必须有
//
-// 示例值:200
-func (builder *GridPropertiesBuilder) RowCount(rowCount int) *GridPropertiesBuilder {
- builder.rowCount = rowCount
- builder.rowCountFlag = true
+// 示例值:
+func (builder *MultipleOptionBuilder) DataValidationValues(dataValidationValues []*DataValidationValue) *MultipleOptionBuilder {
+ builder.dataValidationValues = dataValidationValues
+ builder.dataValidationValuesFlag = true
return builder
}
-// 工作表的列数量
+// 属性
//
-// 示例值:20
-func (builder *GridPropertiesBuilder) ColumnCount(columnCount int) *GridPropertiesBuilder {
- builder.columnCount = columnCount
- builder.columnCountFlag = true
+// 示例值:
+func (builder *MultipleOptionBuilder) Properties(properties *OptionProperties) *MultipleOptionBuilder {
+ builder.properties = properties
+ builder.propertiesFlag = true
return builder
}
-func (builder *GridPropertiesBuilder) Build() *GridProperties {
- req := &GridProperties{}
- if builder.frozenRowCountFlag {
- req.FrozenRowCount = &builder.frozenRowCount
+func (builder *MultipleOptionBuilder) Build() *MultipleOption {
+ req := &MultipleOption{}
+ if builder.typeFlag {
+ req.Type = &builder.type_
}
- if builder.frozenColumnCountFlag {
- req.FrozenColumnCount = &builder.frozenColumnCount
+ if builder.rangeFlag {
+ req.Range = &builder.range_
}
- if builder.rowCountFlag {
- req.RowCount = &builder.rowCount
-
+ if builder.dataValidationValuesFlag {
+ req.DataValidationValues = builder.dataValidationValues
}
- if builder.columnCountFlag {
- req.ColumnCount = &builder.columnCount
-
+ if builder.propertiesFlag {
+ req.Properties = builder.properties
}
return req
}
-type Image struct {
- ImageToken *string `json:"image_token,omitempty"` // 图片token
+type OptionProperties struct {
+ ShowDropdownIcon *bool `json:"show_dropdown_icon,omitempty"` // 是否展示下拉按钮
}
-type ImageBuilder struct {
- imageToken string // 图片token
- imageTokenFlag bool
+type OptionPropertiesBuilder struct {
+ showDropdownIcon bool // 是否展示下拉按钮
+ showDropdownIconFlag bool
}
-func NewImageBuilder() *ImageBuilder {
- builder := &ImageBuilder{}
+func NewOptionPropertiesBuilder() *OptionPropertiesBuilder {
+ builder := &OptionPropertiesBuilder{}
return builder
}
-// 图片token
+// 是否展示下拉按钮
//
-// 示例值:boxxxxxxxxxx
-func (builder *ImageBuilder) ImageToken(imageToken string) *ImageBuilder {
- builder.imageToken = imageToken
- builder.imageTokenFlag = true
+// 示例值:true
+func (builder *OptionPropertiesBuilder) ShowDropdownIcon(showDropdownIcon bool) *OptionPropertiesBuilder {
+ builder.showDropdownIcon = showDropdownIcon
+ builder.showDropdownIconFlag = true
return builder
}
-func (builder *ImageBuilder) Build() *Image {
- req := &Image{}
- if builder.imageTokenFlag {
- req.ImageToken = &builder.imageToken
+func (builder *OptionPropertiesBuilder) Build() *OptionProperties {
+ req := &OptionProperties{}
+ if builder.showDropdownIconFlag {
+ req.ShowDropdownIcon = &builder.showDropdownIcon
}
return req
}
-type InsertDimension struct {
- DimensionRange *Dimension `json:"dimension_range,omitempty"` // 行列操作的维度
- InheritFrom *string `json:"inherit_from,omitempty"` // 是否继承上/下一行/列样式
+type PatchConditionalFormat struct {
+ Ranges []*ConditionalFormatRange `json:"ranges,omitempty"` // 条件格式应用范围
+ ConditionalFormatRule *ConditionalFormatRule `json:"conditional_format_rule,omitempty"` // 条件格式规则
+ Index *int `json:"index,omitempty"` // 条件格式索引位置
}
-type InsertDimensionBuilder struct {
- dimensionRange *Dimension // 行列操作的维度
- dimensionRangeFlag bool
- inheritFrom string // 是否继承上/下一行/列样式
- inheritFromFlag bool
+type PatchConditionalFormatBuilder struct {
+ ranges []*ConditionalFormatRange // 条件格式应用范围
+ rangesFlag bool
+ conditionalFormatRule *ConditionalFormatRule // 条件格式规则
+ conditionalFormatRuleFlag bool
+ index int // 条件格式索引位置
+ indexFlag bool
}
-func NewInsertDimensionBuilder() *InsertDimensionBuilder {
- builder := &InsertDimensionBuilder{}
+func NewPatchConditionalFormatBuilder() *PatchConditionalFormatBuilder {
+ builder := &PatchConditionalFormatBuilder{}
return builder
}
-// 行列操作的维度
+// 条件格式应用范围
//
// 示例值:
-func (builder *InsertDimensionBuilder) DimensionRange(dimensionRange *Dimension) *InsertDimensionBuilder {
- builder.dimensionRange = dimensionRange
- builder.dimensionRangeFlag = true
+func (builder *PatchConditionalFormatBuilder) Ranges(ranges []*ConditionalFormatRange) *PatchConditionalFormatBuilder {
+ builder.ranges = ranges
+ builder.rangesFlag = true
return builder
}
-// 是否继承上/下一行/列样式
+// 条件格式规则
//
-// 示例值:Before
-func (builder *InsertDimensionBuilder) InheritFrom(inheritFrom string) *InsertDimensionBuilder {
- builder.inheritFrom = inheritFrom
- builder.inheritFromFlag = true
+// 示例值:
+func (builder *PatchConditionalFormatBuilder) ConditionalFormatRule(conditionalFormatRule *ConditionalFormatRule) *PatchConditionalFormatBuilder {
+ builder.conditionalFormatRule = conditionalFormatRule
+ builder.conditionalFormatRuleFlag = true
return builder
}
-func (builder *InsertDimensionBuilder) Build() *InsertDimension {
- req := &InsertDimension{}
- if builder.dimensionRangeFlag {
- req.DimensionRange = builder.dimensionRange
+// 条件格式索引位置
+//
+// 示例值:0
+func (builder *PatchConditionalFormatBuilder) Index(index int) *PatchConditionalFormatBuilder {
+ builder.index = index
+ builder.indexFlag = true
+ return builder
+}
+
+func (builder *PatchConditionalFormatBuilder) Build() *PatchConditionalFormat {
+ req := &PatchConditionalFormat{}
+ if builder.rangesFlag {
+ req.Ranges = builder.ranges
}
- if builder.inheritFromFlag {
- req.InheritFrom = &builder.inheritFrom
+ if builder.conditionalFormatRuleFlag {
+ req.ConditionalFormatRule = builder.conditionalFormatRule
+ }
+ if builder.indexFlag {
+ req.Index = &builder.index
}
return req
}
-type Link struct {
- Text *string `json:"text,omitempty"` // 文本
- Link *string `json:"link,omitempty"` // 链接
- SegmentStyles []*SegmentStyle `json:"segment_styles,omitempty"` //
+type PatchDataValidation struct {
+ DataValidationRule *DataValidationRule `json:"data_validation_rule,omitempty"` // 数据校验规则
+ Strict *bool `json:"strict,omitempty"` // 校验模式,数据非法时是否拒绝输入
+ HelpText *string `json:"help_text,omitempty"` // 帮助文本
}
-type LinkBuilder struct {
- text string // 文本
- textFlag bool
- link string // 链接
- linkFlag bool
- segmentStyles []*SegmentStyle //
- segmentStylesFlag bool
+type PatchDataValidationBuilder struct {
+ dataValidationRule *DataValidationRule // 数据校验规则
+ dataValidationRuleFlag bool
+ strict bool // 校验模式,数据非法时是否拒绝输入
+ strictFlag bool
+ helpText string // 帮助文本
+ helpTextFlag bool
}
-func NewLinkBuilder() *LinkBuilder {
- builder := &LinkBuilder{}
+func NewPatchDataValidationBuilder() *PatchDataValidationBuilder {
+ builder := &PatchDataValidationBuilder{}
return builder
}
-// 文本
+// 数据校验规则
//
-// 示例值:text
-func (builder *LinkBuilder) Text(text string) *LinkBuilder {
- builder.text = text
- builder.textFlag = true
+// 示例值:
+func (builder *PatchDataValidationBuilder) DataValidationRule(dataValidationRule *DataValidationRule) *PatchDataValidationBuilder {
+ builder.dataValidationRule = dataValidationRule
+ builder.dataValidationRuleFlag = true
return builder
}
-// 链接
+// 校验模式,数据非法时是否拒绝输入
//
-// 示例值:www.xxxx.cn
-func (builder *LinkBuilder) Link(link string) *LinkBuilder {
- builder.link = link
- builder.linkFlag = true
+// 示例值:true
+func (builder *PatchDataValidationBuilder) Strict(strict bool) *PatchDataValidationBuilder {
+ builder.strict = strict
+ builder.strictFlag = true
return builder
}
-//
+// 帮助文本
//
// 示例值:
-func (builder *LinkBuilder) SegmentStyles(segmentStyles []*SegmentStyle) *LinkBuilder {
- builder.segmentStyles = segmentStyles
- builder.segmentStylesFlag = true
+func (builder *PatchDataValidationBuilder) HelpText(helpText string) *PatchDataValidationBuilder {
+ builder.helpText = helpText
+ builder.helpTextFlag = true
return builder
}
-func (builder *LinkBuilder) Build() *Link {
- req := &Link{}
- if builder.textFlag {
- req.Text = &builder.text
-
+func (builder *PatchDataValidationBuilder) Build() *PatchDataValidation {
+ req := &PatchDataValidation{}
+ if builder.dataValidationRuleFlag {
+ req.DataValidationRule = builder.dataValidationRule
}
- if builder.linkFlag {
- req.Link = &builder.link
+ if builder.strictFlag {
+ req.Strict = &builder.strict
}
- if builder.segmentStylesFlag {
- req.SegmentStyles = builder.segmentStyles
+ if builder.helpTextFlag {
+ req.HelpText = &builder.helpText
+
}
return req
}
-type MentionDocument struct {
- Title *string `json:"title,omitempty"` // 文档标题
- ObjectType *string `json:"object_type,omitempty"` // 文档类型
- Token *string `json:"token,omitempty"` // 文档token
- SegmentStyle *SegmentStyle `json:"segment_style,omitempty"` //
-}
-
-type MentionDocumentBuilder struct {
- title string // 文档标题
- titleFlag bool
- objectType string // 文档类型
- objectTypeFlag bool
- token string // 文档token
- tokenFlag bool
- segmentStyle *SegmentStyle //
- segmentStyleFlag bool
-}
-
-func NewMentionDocumentBuilder() *MentionDocumentBuilder {
- builder := &MentionDocumentBuilder{}
- return builder
+type PatchProtectedRange struct {
+ Description *string `json:"description,omitempty"` // 保护范围描述
+ ProtectedRows *ProtectedRows `json:"protected_rows,omitempty"` // 保护行范围
+ ProtectedColumns *ProtectedColumns `json:"protected_columns,omitempty"` // 保护列范围
}
-// 文档标题
-//
-// 示例值:abc
-func (builder *MentionDocumentBuilder) Title(title string) *MentionDocumentBuilder {
- builder.title = title
- builder.titleFlag = true
- return builder
+type PatchProtectedRangeBuilder struct {
+ description string // 保护范围描述
+ descriptionFlag bool
+ protectedRows *ProtectedRows // 保护行范围
+ protectedRowsFlag bool
+ protectedColumns *ProtectedColumns // 保护列范围
+ protectedColumnsFlag bool
}
-// 文档类型
-//
-// 示例值:sheet
-func (builder *MentionDocumentBuilder) ObjectType(objectType string) *MentionDocumentBuilder {
- builder.objectType = objectType
- builder.objectTypeFlag = true
+func NewPatchProtectedRangeBuilder() *PatchProtectedRangeBuilder {
+ builder := &PatchProtectedRangeBuilder{}
return builder
}
-// 文档token
-//
-// 示例值:shtxxxxxxxxx
-func (builder *MentionDocumentBuilder) Token(token string) *MentionDocumentBuilder {
- builder.token = token
- builder.tokenFlag = true
+// 保护范围描述
+//
+// 示例值:这是一个保护范围
+func (builder *PatchProtectedRangeBuilder) Description(description string) *PatchProtectedRangeBuilder {
+ builder.description = description
+ builder.descriptionFlag = true
return builder
}
-//
+// 保护行范围
//
// 示例值:
-func (builder *MentionDocumentBuilder) SegmentStyle(segmentStyle *SegmentStyle) *MentionDocumentBuilder {
- builder.segmentStyle = segmentStyle
- builder.segmentStyleFlag = true
+func (builder *PatchProtectedRangeBuilder) ProtectedRows(protectedRows *ProtectedRows) *PatchProtectedRangeBuilder {
+ builder.protectedRows = protectedRows
+ builder.protectedRowsFlag = true
return builder
}
-func (builder *MentionDocumentBuilder) Build() *MentionDocument {
- req := &MentionDocument{}
- if builder.titleFlag {
- req.Title = &builder.title
+// 保护列范围
+//
+// 示例值:
+func (builder *PatchProtectedRangeBuilder) ProtectedColumns(protectedColumns *ProtectedColumns) *PatchProtectedRangeBuilder {
+ builder.protectedColumns = protectedColumns
+ builder.protectedColumnsFlag = true
+ return builder
+}
- }
- if builder.objectTypeFlag {
- req.ObjectType = &builder.objectType
+func (builder *PatchProtectedRangeBuilder) Build() *PatchProtectedRange {
+ req := &PatchProtectedRange{}
+ if builder.descriptionFlag {
+ req.Description = &builder.description
}
- if builder.tokenFlag {
- req.Token = &builder.token
-
+ if builder.protectedRowsFlag {
+ req.ProtectedRows = builder.protectedRows
}
- if builder.segmentStyleFlag {
- req.SegmentStyle = builder.segmentStyle
+ if builder.protectedColumnsFlag {
+ req.ProtectedColumns = builder.protectedColumns
}
return req
}
-type MentionUser struct {
- Name *string `json:"name,omitempty"` // 用户名
- UserId *string `json:"user_id,omitempty"` // 用户id
- Notify *bool `json:"notify,omitempty"` // 是否通知用户
- SegmentStyle *SegmentStyle `json:"segment_style,omitempty"` //
+type PatchProtectedRangeEditors struct {
+ Type *string `json:"type,omitempty"` // 修改类型
+ AddEditors *ProtectedRangeEditors `json:"add_editors,omitempty"` // 增加可编辑人员
+ RemoveEditors *ProtectedRangeEditors `json:"remove_editors,omitempty"` // 删除可编辑人员
}
-type MentionUserBuilder struct {
- name string // 用户名
- nameFlag bool
- userId string // 用户id
- userIdFlag bool
- notify bool // 是否通知用户
- notifyFlag bool
- segmentStyle *SegmentStyle //
- segmentStyleFlag bool
+type PatchProtectedRangeEditorsBuilder struct {
+ type_ string // 修改类型
+ typeFlag bool
+ addEditors *ProtectedRangeEditors // 增加可编辑人员
+ addEditorsFlag bool
+ removeEditors *ProtectedRangeEditors // 删除可编辑人员
+ removeEditorsFlag bool
}
-func NewMentionUserBuilder() *MentionUserBuilder {
- builder := &MentionUserBuilder{}
+func NewPatchProtectedRangeEditorsBuilder() *PatchProtectedRangeEditorsBuilder {
+ builder := &PatchProtectedRangeEditorsBuilder{}
return builder
}
-// 用户名
+// 修改类型
//
-// 示例值:李四
-func (builder *MentionUserBuilder) Name(name string) *MentionUserBuilder {
- builder.name = name
- builder.nameFlag = true
+// 示例值:AddEditors
+func (builder *PatchProtectedRangeEditorsBuilder) Type(type_ string) *PatchProtectedRangeEditorsBuilder {
+ builder.type_ = type_
+ builder.typeFlag = true
return builder
}
-// 用户id
+// 增加可编辑人员
//
-// 示例值:ou_xxxxxxx
-func (builder *MentionUserBuilder) UserId(userId string) *MentionUserBuilder {
- builder.userId = userId
- builder.userIdFlag = true
+// 示例值:
+func (builder *PatchProtectedRangeEditorsBuilder) AddEditors(addEditors *ProtectedRangeEditors) *PatchProtectedRangeEditorsBuilder {
+ builder.addEditors = addEditors
+ builder.addEditorsFlag = true
return builder
}
-// 是否通知用户
+// 删除可编辑人员
//
-// 示例值:true
-func (builder *MentionUserBuilder) Notify(notify bool) *MentionUserBuilder {
- builder.notify = notify
- builder.notifyFlag = true
+// 示例值:
+func (builder *PatchProtectedRangeEditorsBuilder) RemoveEditors(removeEditors *ProtectedRangeEditors) *PatchProtectedRangeEditorsBuilder {
+ builder.removeEditors = removeEditors
+ builder.removeEditorsFlag = true
+ return builder
+}
+
+func (builder *PatchProtectedRangeEditorsBuilder) Build() *PatchProtectedRangeEditors {
+ req := &PatchProtectedRangeEditors{}
+ if builder.typeFlag {
+ req.Type = &builder.type_
+
+ }
+ if builder.addEditorsFlag {
+ req.AddEditors = builder.addEditors
+ }
+ if builder.removeEditorsFlag {
+ req.RemoveEditors = builder.removeEditors
+ }
+ return req
+}
+
+type PlainTextValueRange struct {
+ Range *string `json:"range,omitempty"` // 范围
+ Values [][]string `json:"values,omitempty"` // 数据
+}
+
+type PlainTextValueRangeBuilder struct {
+ range_ string // 范围
+ rangeFlag bool
+ values [][]string // 数据
+ valuesFlag bool
+}
+
+func NewPlainTextValueRangeBuilder() *PlainTextValueRangeBuilder {
+ builder := &PlainTextValueRangeBuilder{}
return builder
}
+// 范围
//
+// 示例值:Sheet1!A1:B2
+func (builder *PlainTextValueRangeBuilder) Range(range_ string) *PlainTextValueRangeBuilder {
+ builder.range_ = range_
+ builder.rangeFlag = true
+ return builder
+}
+
+// 数据
//
// 示例值:
-func (builder *MentionUserBuilder) SegmentStyle(segmentStyle *SegmentStyle) *MentionUserBuilder {
- builder.segmentStyle = segmentStyle
- builder.segmentStyleFlag = true
+func (builder *PlainTextValueRangeBuilder) Values(values [][]string) *PlainTextValueRangeBuilder {
+ builder.values = values
+ builder.valuesFlag = true
return builder
}
-func (builder *MentionUserBuilder) Build() *MentionUser {
- req := &MentionUser{}
- if builder.nameFlag {
- req.Name = &builder.name
-
- }
- if builder.userIdFlag {
- req.UserId = &builder.userId
-
- }
- if builder.notifyFlag {
- req.Notify = &builder.notify
+func (builder *PlainTextValueRangeBuilder) Build() *PlainTextValueRange {
+ req := &PlainTextValueRange{}
+ if builder.rangeFlag {
+ req.Range = &builder.range_
}
- if builder.segmentStyleFlag {
- req.SegmentStyle = builder.segmentStyle
+ if builder.valuesFlag {
+ req.Values = builder.values
}
return req
}
-type MergeCell struct {
- Range *MergeRange `json:"range,omitempty"` // 合并单元格的范围
- MergeType *string `json:"merge_type,omitempty"` // 合并单元格类型
+type ProtectedColumns struct {
+ SheetId *string `json:"sheet_id,omitempty"` // 工作表ID
+ StartIndex *int `json:"start_index,omitempty"` // 起始列
+ EndIndex *int `json:"end_index,omitempty"` // 结束列
}
-type MergeCellBuilder struct {
- range_ *MergeRange // 合并单元格的范围
- rangeFlag bool
- mergeType string // 合并单元格类型
- mergeTypeFlag bool
+type ProtectedColumnsBuilder struct {
+ sheetId string // 工作表ID
+ sheetIdFlag bool
+ startIndex int // 起始列
+ startIndexFlag bool
+ endIndex int // 结束列
+ endIndexFlag bool
}
-func NewMergeCellBuilder() *MergeCellBuilder {
- builder := &MergeCellBuilder{}
+func NewProtectedColumnsBuilder() *ProtectedColumnsBuilder {
+ builder := &ProtectedColumnsBuilder{}
return builder
}
-// 合并单元格的范围
+// 工作表ID
//
-// 示例值:Zj2ts!A1:B2
-func (builder *MergeCellBuilder) Range(range_ *MergeRange) *MergeCellBuilder {
- builder.range_ = range_
- builder.rangeFlag = true
+// 示例值:ah9IJ2
+func (builder *ProtectedColumnsBuilder) SheetId(sheetId string) *ProtectedColumnsBuilder {
+ builder.sheetId = sheetId
+ builder.sheetIdFlag = true
return builder
}
-// 合并单元格类型
+// 起始列
//
-// 示例值:MergeAll
-func (builder *MergeCellBuilder) MergeType(mergeType string) *MergeCellBuilder {
- builder.mergeType = mergeType
- builder.mergeTypeFlag = true
+// 示例值:0
+func (builder *ProtectedColumnsBuilder) StartIndex(startIndex int) *ProtectedColumnsBuilder {
+ builder.startIndex = startIndex
+ builder.startIndexFlag = true
return builder
}
-func (builder *MergeCellBuilder) Build() *MergeCell {
- req := &MergeCell{}
- if builder.rangeFlag {
- req.Range = builder.range_
+// 结束列
+//
+// 示例值:2
+func (builder *ProtectedColumnsBuilder) EndIndex(endIndex int) *ProtectedColumnsBuilder {
+ builder.endIndex = endIndex
+ builder.endIndexFlag = true
+ return builder
+}
+
+func (builder *ProtectedColumnsBuilder) Build() *ProtectedColumns {
+ req := &ProtectedColumns{}
+ if builder.sheetIdFlag {
+ req.SheetId = &builder.sheetId
+
}
- if builder.mergeTypeFlag {
- req.MergeType = &builder.mergeType
+ if builder.startIndexFlag {
+ req.StartIndex = &builder.startIndex
+
+ }
+ if builder.endIndexFlag {
+ req.EndIndex = &builder.endIndex
}
return req
}
-type MergeRange struct {
- StartRowIndex *int `json:"start_row_index,omitempty"` // 起始行
- EndRowIndex *int `json:"end_row_index,omitempty"` // 结束行
- StartColumnIndex *int `json:"start_column_index,omitempty"` // 起始列
- EndColumnIndex *int `json:"end_column_index,omitempty"` // 结束列
+type ProtectedRange struct {
+ ProtectedId *string `json:"protected_id,omitempty"` // 保护范围ID
+ Description *string `json:"description,omitempty"` // 保护范围描述
+ ProtectedDimension *string `json:"protected_dimension,omitempty"` // 保护类型
+ ProtectedRows *ProtectedRows `json:"protected_rows,omitempty"` // 保护行范围
+ ProtectedColumns *ProtectedColumns `json:"protected_columns,omitempty"` // 保护列范围
+ ProtectedSheet *ProtectedSheet `json:"protected_sheet,omitempty"` // 保护工作表范围
+ Editors *ProtectedRangeEditors `json:"editors,omitempty"` // 保护范围可编辑用户
}
-type MergeRangeBuilder struct {
- startRowIndex int // 起始行
- startRowIndexFlag bool
- endRowIndex int // 结束行
- endRowIndexFlag bool
- startColumnIndex int // 起始列
- startColumnIndexFlag bool
- endColumnIndex int // 结束列
- endColumnIndexFlag bool
+type ProtectedRangeBuilder struct {
+ protectedId string // 保护范围ID
+ protectedIdFlag bool
+ description string // 保护范围描述
+ descriptionFlag bool
+ protectedDimension string // 保护类型
+ protectedDimensionFlag bool
+ protectedRows *ProtectedRows // 保护行范围
+ protectedRowsFlag bool
+ protectedColumns *ProtectedColumns // 保护列范围
+ protectedColumnsFlag bool
+ protectedSheet *ProtectedSheet // 保护工作表范围
+ protectedSheetFlag bool
+ editors *ProtectedRangeEditors // 保护范围可编辑用户
+ editorsFlag bool
}
-func NewMergeRangeBuilder() *MergeRangeBuilder {
- builder := &MergeRangeBuilder{}
+func NewProtectedRangeBuilder() *ProtectedRangeBuilder {
+ builder := &ProtectedRangeBuilder{}
return builder
}
-// 起始行
+// 保护范围ID
//
-// 示例值:0
-func (builder *MergeRangeBuilder) StartRowIndex(startRowIndex int) *MergeRangeBuilder {
- builder.startRowIndex = startRowIndex
- builder.startRowIndexFlag = true
+// 示例值:1650435126216662
+func (builder *ProtectedRangeBuilder) ProtectedId(protectedId string) *ProtectedRangeBuilder {
+ builder.protectedId = protectedId
+ builder.protectedIdFlag = true
return builder
}
-// 结束行
+// 保护范围描述
//
-// 示例值:0
-func (builder *MergeRangeBuilder) EndRowIndex(endRowIndex int) *MergeRangeBuilder {
- builder.endRowIndex = endRowIndex
- builder.endRowIndexFlag = true
+// 示例值:这是一个保护范围
+func (builder *ProtectedRangeBuilder) Description(description string) *ProtectedRangeBuilder {
+ builder.description = description
+ builder.descriptionFlag = true
return builder
}
-// 起始列
+// 保护类型
//
-// 示例值:0
-func (builder *MergeRangeBuilder) StartColumnIndex(startColumnIndex int) *MergeRangeBuilder {
- builder.startColumnIndex = startColumnIndex
- builder.startColumnIndexFlag = true
+// 示例值:Rows
+func (builder *ProtectedRangeBuilder) ProtectedDimension(protectedDimension string) *ProtectedRangeBuilder {
+ builder.protectedDimension = protectedDimension
+ builder.protectedDimensionFlag = true
return builder
}
-// 结束列
+// 保护行范围
//
-// 示例值:0
-func (builder *MergeRangeBuilder) EndColumnIndex(endColumnIndex int) *MergeRangeBuilder {
- builder.endColumnIndex = endColumnIndex
- builder.endColumnIndexFlag = true
+// 示例值:
+func (builder *ProtectedRangeBuilder) ProtectedRows(protectedRows *ProtectedRows) *ProtectedRangeBuilder {
+ builder.protectedRows = protectedRows
+ builder.protectedRowsFlag = true
return builder
}
-func (builder *MergeRangeBuilder) Build() *MergeRange {
- req := &MergeRange{}
- if builder.startRowIndexFlag {
- req.StartRowIndex = &builder.startRowIndex
+// 保护列范围
+//
+// 示例值:
+func (builder *ProtectedRangeBuilder) ProtectedColumns(protectedColumns *ProtectedColumns) *ProtectedRangeBuilder {
+ builder.protectedColumns = protectedColumns
+ builder.protectedColumnsFlag = true
+ return builder
+}
- }
- if builder.endRowIndexFlag {
- req.EndRowIndex = &builder.endRowIndex
+// 保护工作表范围
+//
+// 示例值:
+func (builder *ProtectedRangeBuilder) ProtectedSheet(protectedSheet *ProtectedSheet) *ProtectedRangeBuilder {
+ builder.protectedSheet = protectedSheet
+ builder.protectedSheetFlag = true
+ return builder
+}
+
+// 保护范围可编辑用户
+//
+// 示例值:
+func (builder *ProtectedRangeBuilder) Editors(editors *ProtectedRangeEditors) *ProtectedRangeBuilder {
+ builder.editors = editors
+ builder.editorsFlag = true
+ return builder
+}
+
+func (builder *ProtectedRangeBuilder) Build() *ProtectedRange {
+ req := &ProtectedRange{}
+ if builder.protectedIdFlag {
+ req.ProtectedId = &builder.protectedId
}
- if builder.startColumnIndexFlag {
- req.StartColumnIndex = &builder.startColumnIndex
+ if builder.descriptionFlag {
+ req.Description = &builder.description
}
- if builder.endColumnIndexFlag {
- req.EndColumnIndex = &builder.endColumnIndex
+ if builder.protectedDimensionFlag {
+ req.ProtectedDimension = &builder.protectedDimension
}
+ if builder.protectedRowsFlag {
+ req.ProtectedRows = builder.protectedRows
+ }
+ if builder.protectedColumnsFlag {
+ req.ProtectedColumns = builder.protectedColumns
+ }
+ if builder.protectedSheetFlag {
+ req.ProtectedSheet = builder.protectedSheet
+ }
+ if builder.editorsFlag {
+ req.Editors = builder.editors
+ }
return req
}
-type MoveDimension struct {
- Source *Dimension `json:"source,omitempty"` // 移动源位置参数
- DestinationIndex *int `json:"destination_index,omitempty"` // 移动的目标位置行或者列号
+type ProtectedRangeEditors struct {
+ Users []string `json:"users,omitempty"` // 可编辑人员
+ Departments []string `json:"departments,omitempty"` // 可编辑部门
+ Chats []string `json:"chats,omitempty"` // 可编辑群
}
-type MoveDimensionBuilder struct {
- source *Dimension // 移动源位置参数
- sourceFlag bool
- destinationIndex int // 移动的目标位置行或者列号
- destinationIndexFlag bool
+type ProtectedRangeEditorsBuilder struct {
+ users []string // 可编辑人员
+ usersFlag bool
+ departments []string // 可编辑部门
+ departmentsFlag bool
+ chats []string // 可编辑群
+ chatsFlag bool
}
-func NewMoveDimensionBuilder() *MoveDimensionBuilder {
- builder := &MoveDimensionBuilder{}
+func NewProtectedRangeEditorsBuilder() *ProtectedRangeEditorsBuilder {
+ builder := &ProtectedRangeEditorsBuilder{}
return builder
}
-// 移动源位置参数
+// 可编辑人员
+//
+// 示例值:o
+func (builder *ProtectedRangeEditorsBuilder) Users(users []string) *ProtectedRangeEditorsBuilder {
+ builder.users = users
+ builder.usersFlag = true
+ return builder
+}
+
+// 可编辑部门
//
// 示例值:
-func (builder *MoveDimensionBuilder) Source(source *Dimension) *MoveDimensionBuilder {
- builder.source = source
- builder.sourceFlag = true
+func (builder *ProtectedRangeEditorsBuilder) Departments(departments []string) *ProtectedRangeEditorsBuilder {
+ builder.departments = departments
+ builder.departmentsFlag = true
return builder
}
-// 移动的目标位置行或者列号
+// 可编辑群
//
-// 示例值:4
-func (builder *MoveDimensionBuilder) DestinationIndex(destinationIndex int) *MoveDimensionBuilder {
- builder.destinationIndex = destinationIndex
- builder.destinationIndexFlag = true
+// 示例值:
+func (builder *ProtectedRangeEditorsBuilder) Chats(chats []string) *ProtectedRangeEditorsBuilder {
+ builder.chats = chats
+ builder.chatsFlag = true
return builder
}
-func (builder *MoveDimensionBuilder) Build() *MoveDimension {
- req := &MoveDimension{}
- if builder.sourceFlag {
- req.Source = builder.source
+func (builder *ProtectedRangeEditorsBuilder) Build() *ProtectedRangeEditors {
+ req := &ProtectedRangeEditors{}
+ if builder.usersFlag {
+ req.Users = builder.users
}
- if builder.destinationIndexFlag {
- req.DestinationIndex = &builder.destinationIndex
-
+ if builder.departmentsFlag {
+ req.Departments = builder.departments
+ }
+ if builder.chatsFlag {
+ req.Chats = builder.chats
}
return req
}
-type MultiRange struct {
- Ranges []string `json:"ranges,omitempty"` // 同一个工作表的多个范围
+type ProtectedRows struct {
+ SheetId *string `json:"sheet_id,omitempty"` // 工作表ID
+ StartIndex *int `json:"start_index,omitempty"` // 起始行
+ EndIndex *int `json:"end_index,omitempty"` // 结束行
}
-type MultiRangeBuilder struct {
- ranges []string // 同一个工作表的多个范围
- rangesFlag bool
+type ProtectedRowsBuilder struct {
+ sheetId string // 工作表ID
+ sheetIdFlag bool
+ startIndex int // 起始行
+ startIndexFlag bool
+ endIndex int // 结束行
+ endIndexFlag bool
}
-func NewMultiRangeBuilder() *MultiRangeBuilder {
- builder := &MultiRangeBuilder{}
+func NewProtectedRowsBuilder() *ProtectedRowsBuilder {
+ builder := &ProtectedRowsBuilder{}
return builder
}
-// 同一个工作表的多个范围
+// 工作表ID
//
-// 示例值:Sheet1!A1:B2
-func (builder *MultiRangeBuilder) Ranges(ranges []string) *MultiRangeBuilder {
- builder.ranges = ranges
- builder.rangesFlag = true
+// 示例值:s92jkL
+func (builder *ProtectedRowsBuilder) SheetId(sheetId string) *ProtectedRowsBuilder {
+ builder.sheetId = sheetId
+ builder.sheetIdFlag = true
return builder
}
-func (builder *MultiRangeBuilder) Build() *MultiRange {
- req := &MultiRange{}
- if builder.rangesFlag {
- req.Ranges = builder.ranges
- }
- return req
+// 起始行
+//
+// 示例值:0
+func (builder *ProtectedRowsBuilder) StartIndex(startIndex int) *ProtectedRowsBuilder {
+ builder.startIndex = startIndex
+ builder.startIndexFlag = true
+ return builder
}
-type PlainTextValueRange struct {
- Range *string `json:"range,omitempty"` // 范围
- Values [][]string `json:"values,omitempty"` // 数据
+// 结束行
+//
+// 示例值:0
+func (builder *ProtectedRowsBuilder) EndIndex(endIndex int) *ProtectedRowsBuilder {
+ builder.endIndex = endIndex
+ builder.endIndexFlag = true
+ return builder
}
-type PlainTextValueRangeBuilder struct {
- range_ string // 范围
- rangeFlag bool
- values [][]string // 数据
- valuesFlag bool
+func (builder *ProtectedRowsBuilder) Build() *ProtectedRows {
+ req := &ProtectedRows{}
+ if builder.sheetIdFlag {
+ req.SheetId = &builder.sheetId
+
+ }
+ if builder.startIndexFlag {
+ req.StartIndex = &builder.startIndex
+
+ }
+ if builder.endIndexFlag {
+ req.EndIndex = &builder.endIndex
+
+ }
+ return req
}
-func NewPlainTextValueRangeBuilder() *PlainTextValueRangeBuilder {
- builder := &PlainTextValueRangeBuilder{}
- return builder
+type ProtectedSheet struct {
+ SheetId *string `json:"sheet_id,omitempty"` // 工作表ID
}
-// 范围
-//
-// 示例值:Sheet1!A1:B2
-func (builder *PlainTextValueRangeBuilder) Range(range_ string) *PlainTextValueRangeBuilder {
- builder.range_ = range_
- builder.rangeFlag = true
+type ProtectedSheetBuilder struct {
+ sheetId string // 工作表ID
+ sheetIdFlag bool
+}
+
+func NewProtectedSheetBuilder() *ProtectedSheetBuilder {
+ builder := &ProtectedSheetBuilder{}
return builder
}
-// 数据
+// 工作表ID
//
-// 示例值:
-func (builder *PlainTextValueRangeBuilder) Values(values [][]string) *PlainTextValueRangeBuilder {
- builder.values = values
- builder.valuesFlag = true
+// 示例值:Kd7L09
+func (builder *ProtectedSheetBuilder) SheetId(sheetId string) *ProtectedSheetBuilder {
+ builder.sheetId = sheetId
+ builder.sheetIdFlag = true
return builder
}
-func (builder *PlainTextValueRangeBuilder) Build() *PlainTextValueRange {
- req := &PlainTextValueRange{}
- if builder.rangeFlag {
- req.Range = &builder.range_
+func (builder *ProtectedSheetBuilder) Build() *ProtectedSheet {
+ req := &ProtectedSheet{}
+ if builder.sheetIdFlag {
+ req.SheetId = &builder.sheetId
}
- if builder.valuesFlag {
- req.Values = builder.values
- }
return req
}
@@ -2219,6 +4185,54 @@ func (builder *RichValueBuilder) Build() *RichValue {
return req
}
+type RightBorderStyle struct {
+ Style *string `json:"style,omitempty"` // 边框样式
+ Color *string `json:"color,omitempty"` // 边框颜色
+}
+
+type RightBorderStyleBuilder struct {
+ style string // 边框样式
+ styleFlag bool
+ color string // 边框颜色
+ colorFlag bool
+}
+
+func NewRightBorderStyleBuilder() *RightBorderStyleBuilder {
+ builder := &RightBorderStyleBuilder{}
+ return builder
+}
+
+// 边框样式
+//
+// 示例值:
+func (builder *RightBorderStyleBuilder) Style(style string) *RightBorderStyleBuilder {
+ builder.style = style
+ builder.styleFlag = true
+ return builder
+}
+
+// 边框颜色
+//
+// 示例值:#ff00ff
+func (builder *RightBorderStyleBuilder) Color(color string) *RightBorderStyleBuilder {
+ builder.color = color
+ builder.colorFlag = true
+ return builder
+}
+
+func (builder *RightBorderStyleBuilder) Build() *RightBorderStyle {
+ req := &RightBorderStyle{}
+ if builder.styleFlag {
+ req.Style = &builder.style
+
+ }
+ if builder.colorFlag {
+ req.Color = &builder.color
+
+ }
+ return req
+}
+
type SegmentStyle struct {
AffectedText *string `json:"affected_text,omitempty"` // 影响的文本
Style *SegmentStyleStyle `json:"style,omitempty"` // 样式
@@ -2646,6 +4660,84 @@ func (builder *SheetPropertiesBuilder) Build() *SheetProperties {
return req
}
+type SingleOption struct {
+ Type *string `json:"type,omitempty"` // 单选类型
+ Range *string `json:"range,omitempty"` // 引用数据的范围,当type=OneOfRange时必须存在
+ DataValidationValues []*DataValidationValue `json:"data_validation_values,omitempty"` // 选项
+ Properties *OptionProperties `json:"properties,omitempty"` // 属性
+}
+
+type SingleOptionBuilder struct {
+ type_ string // 单选类型
+ typeFlag bool
+ range_ string // 引用数据的范围,当type=OneOfRange时必须存在
+ rangeFlag bool
+ dataValidationValues []*DataValidationValue // 选项
+ dataValidationValuesFlag bool
+ properties *OptionProperties // 属性
+ propertiesFlag bool
+}
+
+func NewSingleOptionBuilder() *SingleOptionBuilder {
+ builder := &SingleOptionBuilder{}
+ return builder
+}
+
+// 单选类型
+//
+// 示例值:OneOfList
+func (builder *SingleOptionBuilder) Type(type_ string) *SingleOptionBuilder {
+ builder.type_ = type_
+ builder.typeFlag = true
+ return builder
+}
+
+// 引用数据的范围,当type=OneOfRange时必须存在
+//
+// 示例值:as8jJ0!A1:B2
+func (builder *SingleOptionBuilder) Range(range_ string) *SingleOptionBuilder {
+ builder.range_ = range_
+ builder.rangeFlag = true
+ return builder
+}
+
+// 选项
+//
+// 示例值:
+func (builder *SingleOptionBuilder) DataValidationValues(dataValidationValues []*DataValidationValue) *SingleOptionBuilder {
+ builder.dataValidationValues = dataValidationValues
+ builder.dataValidationValuesFlag = true
+ return builder
+}
+
+// 属性
+//
+// 示例值:
+func (builder *SingleOptionBuilder) Properties(properties *OptionProperties) *SingleOptionBuilder {
+ builder.properties = properties
+ builder.propertiesFlag = true
+ return builder
+}
+
+func (builder *SingleOptionBuilder) Build() *SingleOption {
+ req := &SingleOption{}
+ if builder.typeFlag {
+ req.Type = &builder.type_
+
+ }
+ if builder.rangeFlag {
+ req.Range = &builder.range_
+
+ }
+ if builder.dataValidationValuesFlag {
+ req.DataValidationValues = builder.dataValidationValues
+ }
+ if builder.propertiesFlag {
+ req.Properties = builder.properties
+ }
+ return req
+}
+
type Spreadsheet struct {
Title *string `json:"title,omitempty"` // 表格标题
FolderToken *string `json:"folder_token,omitempty"` // 文件夹token,获取方式见[如何获取云文档资源相关 token](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN)
@@ -2726,6 +4818,84 @@ func (builder *SpreadsheetBuilder) Build() *Spreadsheet {
return req
}
+type Style struct {
+ Range *string `json:"range,omitempty"` // 范围
+ Styles [][]*CellStyle `json:"styles,omitempty"` // 单元格样式
+}
+
+type StyleBuilder struct {
+ range_ string // 范围
+ rangeFlag bool
+ styles [][]*CellStyle // 单元格样式
+ stylesFlag bool
+}
+
+func NewStyleBuilder() *StyleBuilder {
+ builder := &StyleBuilder{}
+ return builder
+}
+
+// 范围
+//
+// 示例值:aokNvv
+func (builder *StyleBuilder) Range(range_ string) *StyleBuilder {
+ builder.range_ = range_
+ builder.rangeFlag = true
+ return builder
+}
+
+// 单元格样式
+//
+// 示例值:
+func (builder *StyleBuilder) Styles(styles [][]*CellStyle) *StyleBuilder {
+ builder.styles = styles
+ builder.stylesFlag = true
+ return builder
+}
+
+func (builder *StyleBuilder) Build() *Style {
+ req := &Style{}
+ if builder.rangeFlag {
+ req.Range = &builder.range_
+
+ }
+ if builder.stylesFlag {
+ req.Styles = builder.styles
+ }
+ return req
+}
+
+type StyleRanges struct {
+ StyleRanges []*Style `json:"style_ranges,omitempty"` // 单元格样式
+}
+
+type StyleRangesBuilder struct {
+ styleRanges []*Style // 单元格样式
+ styleRangesFlag bool
+}
+
+func NewStyleRangesBuilder() *StyleRangesBuilder {
+ builder := &StyleRangesBuilder{}
+ return builder
+}
+
+// 单元格样式
+//
+// 示例值:
+func (builder *StyleRangesBuilder) StyleRanges(styleRanges []*Style) *StyleRangesBuilder {
+ builder.styleRanges = styleRanges
+ builder.styleRangesFlag = true
+ return builder
+}
+
+func (builder *StyleRangesBuilder) Build() *StyleRanges {
+ req := &StyleRanges{}
+ if builder.styleRangesFlag {
+ req.StyleRanges = builder.styleRanges
+ }
+ return req
+}
+
type Text struct {
Text *string `json:"text,omitempty"` // 文本值
SegmentStyle *SegmentStyle `json:"segment_style,omitempty"` //
@@ -2773,6 +4943,54 @@ func (builder *TextBuilder) Build() *Text {
return req
}
+type TopBorderStyle struct {
+ Style *string `json:"style,omitempty"` // 边框样式
+ Color *string `json:"color,omitempty"` // 边框颜色
+}
+
+type TopBorderStyleBuilder struct {
+ style string // 边框样式
+ styleFlag bool
+ color string // 边框颜色
+ colorFlag bool
+}
+
+func NewTopBorderStyleBuilder() *TopBorderStyleBuilder {
+ builder := &TopBorderStyleBuilder{}
+ return builder
+}
+
+// 边框样式
+//
+// 示例值:
+func (builder *TopBorderStyleBuilder) Style(style string) *TopBorderStyleBuilder {
+ builder.style = style
+ builder.styleFlag = true
+ return builder
+}
+
+// 边框颜色
+//
+// 示例值:#ff00ff
+func (builder *TopBorderStyleBuilder) Color(color string) *TopBorderStyleBuilder {
+ builder.color = color
+ builder.colorFlag = true
+ return builder
+}
+
+func (builder *TopBorderStyleBuilder) Build() *TopBorderStyle {
+ req := &TopBorderStyle{}
+ if builder.styleFlag {
+ req.Style = &builder.style
+
+ }
+ if builder.colorFlag {
+ req.Color = &builder.color
+
+ }
+ return req
+}
+
type UpdateDimensionProperties struct {
DimensionRange *Dimension `json:"dimension_range,omitempty"` // 需要更新的行列信息
Properties *DimensionProperties `json:"properties,omitempty"` // 更新的属性
@@ -3025,6 +5243,54 @@ func (builder *ValueElementBuilder) Build() *ValueElement {
return req
}
+type ValueElementSingleOption struct {
+ DataValidationId *int `json:"data_validation_id,omitempty"` // 数据校验ID
+ DataValiditonValue *string `json:"data_validiton_value,omitempty"` // 选项值
+}
+
+type ValueElementSingleOptionBuilder struct {
+ dataValidationId int // 数据校验ID
+ dataValidationIdFlag bool
+ dataValiditonValue string // 选项值
+ dataValiditonValueFlag bool
+}
+
+func NewValueElementSingleOptionBuilder() *ValueElementSingleOptionBuilder {
+ builder := &ValueElementSingleOptionBuilder{}
+ return builder
+}
+
+// 数据校验ID
+//
+// 示例值:1
+func (builder *ValueElementSingleOptionBuilder) DataValidationId(dataValidationId int) *ValueElementSingleOptionBuilder {
+ builder.dataValidationId = dataValidationId
+ builder.dataValidationIdFlag = true
+ return builder
+}
+
+// 选项值
+//
+// 示例值:option1
+func (builder *ValueElementSingleOptionBuilder) DataValiditonValue(dataValiditonValue string) *ValueElementSingleOptionBuilder {
+ builder.dataValiditonValue = dataValiditonValue
+ builder.dataValiditonValueFlag = true
+ return builder
+}
+
+func (builder *ValueElementSingleOptionBuilder) Build() *ValueElementSingleOption {
+ req := &ValueElementSingleOption{}
+ if builder.dataValidationIdFlag {
+ req.DataValidationId = &builder.dataValidationId
+
+ }
+ if builder.dataValiditonValueFlag {
+ req.DataValiditonValue = &builder.dataValiditonValue
+
+ }
+ return req
+}
+
type CreateSpreadsheetReqBuilder struct {
apiReq *larkcore.ApiReq
spreadsheet *Spreadsheet
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/task/v1/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/task/v1/model.go
index e6d2344a2e..fa5afbb11c 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/task/v1/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/task/v1/model.go
@@ -574,6 +574,9 @@ func (builder *ReminderBuilder) Build() *Reminder {
return req
}
+type Section struct {
+}
+
type Task struct {
Id *string `json:"id,omitempty"` // 任务的唯一ID,例如"83912691-2e43-47fc-94a4-d512e03984fa"
Summary *string `json:"summary,omitempty"` // 任务的标题,类型为文本字符串。;如果要在任务标题中插入 URL 或者 @某个用户,请使用rich_summary字段。;创建任务时,任务标题(summary字段)和任务富文本标题(rich_summary字段)不能同时为空,需要至少填充其中一个字段。;;任务标题和任务富文本标题同时存在时只使用富文本标题。;
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/tenant/v2/api.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/tenant/v2/api.go
index eae4db869b..104528edb4 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/tenant/v2/api.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/tenant/v2/api.go
@@ -23,17 +23,22 @@ import (
func NewService(config *larkcore.Config) *TenantService {
t := &TenantService{config: config}
t.Tenant = &tenant{service: t}
+ t.TenantProductAssignInfo = &tenantProductAssignInfo{service: t}
return t
}
type TenantService struct {
- config *larkcore.Config
- Tenant *tenant // 企业信息
+ config *larkcore.Config
+ Tenant *tenant // 企业信息
+ TenantProductAssignInfo *tenantProductAssignInfo // tenant.product_assign_info
}
type tenant struct {
service *TenantService
}
+type tenantProductAssignInfo struct {
+ service *TenantService
+}
// 获取企业信息
//
@@ -65,3 +70,32 @@ func (t *tenant) Query(ctx context.Context, options ...larkcore.RequestOptionFun
}
return resp, err
}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=query&project=tenant&resource=tenant.product_assign_info&version=v2
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/tenantv2/query_tenantProductAssignInfo.go
+func (t *tenantProductAssignInfo) Query(ctx context.Context, options ...larkcore.RequestOptionFunc) (*QueryTenantProductAssignInfoResp, error) {
+ // 发起请求
+ apiReq := &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ apiReq.ApiPath = "/open-apis/tenant/v2/tenant/assign_info_list/query"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, t.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &QueryTenantProductAssignInfoResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, t.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/tenant/v2/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/tenant/v2/model.go
index f8ed6094d2..8145a6fe15 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/tenant/v2/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/tenant/v2/model.go
@@ -97,6 +97,70 @@ func (builder *AvatarBuilder) Build() *Avatar {
return req
}
+type ProductI18nName struct {
+ ZhCn *string `json:"zh_cn,omitempty"` // 商业化产品的中文名
+ JaJp *string `json:"ja_jp,omitempty"` // 商业化产品的日文名
+ EnUs *string `json:"en_us,omitempty"` // 商业化产品的英文名
+}
+
+type ProductI18nNameBuilder struct {
+ zhCn string // 商业化产品的中文名
+ zhCnFlag bool
+ jaJp string // 商业化产品的日文名
+ jaJpFlag bool
+ enUs string // 商业化产品的英文名
+ enUsFlag bool
+}
+
+func NewProductI18nNameBuilder() *ProductI18nNameBuilder {
+ builder := &ProductI18nNameBuilder{}
+ return builder
+}
+
+// 商业化产品的中文名
+//
+// 示例值:zh_cn_name
+func (builder *ProductI18nNameBuilder) ZhCn(zhCn string) *ProductI18nNameBuilder {
+ builder.zhCn = zhCn
+ builder.zhCnFlag = true
+ return builder
+}
+
+// 商业化产品的日文名
+//
+// 示例值:ja_jp_name
+func (builder *ProductI18nNameBuilder) JaJp(jaJp string) *ProductI18nNameBuilder {
+ builder.jaJp = jaJp
+ builder.jaJpFlag = true
+ return builder
+}
+
+// 商业化产品的英文名
+//
+// 示例值:en_name
+func (builder *ProductI18nNameBuilder) EnUs(enUs string) *ProductI18nNameBuilder {
+ builder.enUs = enUs
+ builder.enUsFlag = true
+ return builder
+}
+
+func (builder *ProductI18nNameBuilder) Build() *ProductI18nName {
+ req := &ProductI18nName{}
+ if builder.zhCnFlag {
+ req.ZhCn = &builder.zhCn
+
+ }
+ if builder.jaJpFlag {
+ req.JaJp = &builder.jaJp
+
+ }
+ if builder.enUsFlag {
+ req.EnUs = &builder.enUs
+
+ }
+ return req
+}
+
type Tenant struct {
Name *string `json:"name,omitempty"` // 企业名称
DisplayId *string `json:"display_id,omitempty"` // 企业编号,平台内唯一
@@ -192,6 +256,149 @@ func (builder *TenantBuilder) Build() *Tenant {
return req
}
+type TenantAssignInfo struct {
+ SubscriptionId *string `json:"subscription_id,omitempty"` // 席位id
+ LicensePlanKey *string `json:"license_plan_key,omitempty"` // license_plan_key
+ ProductName *string `json:"product_name,omitempty"` // 商业化产品名称
+ I18nName *ProductI18nName `json:"i18n_name,omitempty"` // 国际化名称
+ TotalSeats *string `json:"total_seats,omitempty"` // 席位总数
+ AssignedSeats *string `json:"assigned_seats,omitempty"` // 已分配席位数
+ StartTime *string `json:"start_time,omitempty"` // 席位起始时间
+ EndTime *string `json:"end_time,omitempty"` // 席位结束时间
+}
+
+type TenantAssignInfoBuilder struct {
+ subscriptionId string // 席位id
+ subscriptionIdFlag bool
+ licensePlanKey string // license_plan_key
+ licensePlanKeyFlag bool
+ productName string // 商业化产品名称
+ productNameFlag bool
+ i18nName *ProductI18nName // 国际化名称
+ i18nNameFlag bool
+ totalSeats string // 席位总数
+ totalSeatsFlag bool
+ assignedSeats string // 已分配席位数
+ assignedSeatsFlag bool
+ startTime string // 席位起始时间
+ startTimeFlag bool
+ endTime string // 席位结束时间
+ endTimeFlag bool
+}
+
+func NewTenantAssignInfoBuilder() *TenantAssignInfoBuilder {
+ builder := &TenantAssignInfoBuilder{}
+ return builder
+}
+
+// 席位id
+//
+// 示例值:7079609167680782300
+func (builder *TenantAssignInfoBuilder) SubscriptionId(subscriptionId string) *TenantAssignInfoBuilder {
+ builder.subscriptionId = subscriptionId
+ builder.subscriptionIdFlag = true
+ return builder
+}
+
+// license_plan_key
+//
+// 示例值:suite_enterprise_e5
+func (builder *TenantAssignInfoBuilder) LicensePlanKey(licensePlanKey string) *TenantAssignInfoBuilder {
+ builder.licensePlanKey = licensePlanKey
+ builder.licensePlanKeyFlag = true
+ return builder
+}
+
+// 商业化产品名称
+//
+// 示例值:旗舰版 E5
+func (builder *TenantAssignInfoBuilder) ProductName(productName string) *TenantAssignInfoBuilder {
+ builder.productName = productName
+ builder.productNameFlag = true
+ return builder
+}
+
+// 国际化名称
+//
+// 示例值:
+func (builder *TenantAssignInfoBuilder) I18nName(i18nName *ProductI18nName) *TenantAssignInfoBuilder {
+ builder.i18nName = i18nName
+ builder.i18nNameFlag = true
+ return builder
+}
+
+// 席位总数
+//
+// 示例值:500
+func (builder *TenantAssignInfoBuilder) TotalSeats(totalSeats string) *TenantAssignInfoBuilder {
+ builder.totalSeats = totalSeats
+ builder.totalSeatsFlag = true
+ return builder
+}
+
+// 已分配席位数
+//
+// 示例值:20
+func (builder *TenantAssignInfoBuilder) AssignedSeats(assignedSeats string) *TenantAssignInfoBuilder {
+ builder.assignedSeats = assignedSeats
+ builder.assignedSeatsFlag = true
+ return builder
+}
+
+// 席位起始时间
+//
+// 示例值:1674981000
+func (builder *TenantAssignInfoBuilder) StartTime(startTime string) *TenantAssignInfoBuilder {
+ builder.startTime = startTime
+ builder.startTimeFlag = true
+ return builder
+}
+
+// 席位结束时间
+//
+// 示例值:1674991000
+func (builder *TenantAssignInfoBuilder) EndTime(endTime string) *TenantAssignInfoBuilder {
+ builder.endTime = endTime
+ builder.endTimeFlag = true
+ return builder
+}
+
+func (builder *TenantAssignInfoBuilder) Build() *TenantAssignInfo {
+ req := &TenantAssignInfo{}
+ if builder.subscriptionIdFlag {
+ req.SubscriptionId = &builder.subscriptionId
+
+ }
+ if builder.licensePlanKeyFlag {
+ req.LicensePlanKey = &builder.licensePlanKey
+
+ }
+ if builder.productNameFlag {
+ req.ProductName = &builder.productName
+
+ }
+ if builder.i18nNameFlag {
+ req.I18nName = builder.i18nName
+ }
+ if builder.totalSeatsFlag {
+ req.TotalSeats = &builder.totalSeats
+
+ }
+ if builder.assignedSeatsFlag {
+ req.AssignedSeats = &builder.assignedSeats
+
+ }
+ if builder.startTimeFlag {
+ req.StartTime = &builder.startTime
+
+ }
+ if builder.endTimeFlag {
+ req.EndTime = &builder.endTime
+
+ }
+ return req
+}
+
type QueryTenantRespData struct {
Tenant *Tenant `json:"tenant,omitempty"` // 企业信息
}
@@ -205,3 +412,17 @@ type QueryTenantResp struct {
func (resp *QueryTenantResp) Success() bool {
return resp.Code == 0
}
+
+type QueryTenantProductAssignInfoRespData struct {
+ AssignInfoList []*TenantAssignInfo `json:"assign_info_list,omitempty"` // 租户待分配席位列表
+}
+
+type QueryTenantProductAssignInfoResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *QueryTenantProductAssignInfoRespData `json:"data"` // 业务数据
+}
+
+func (resp *QueryTenantProductAssignInfoResp) Success() bool {
+ return resp.Code == 0
+}
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/vc/v1/api.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/vc/v1/api.go
index a610fce023..70f8d9be37 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/vc/v1/api.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/vc/v1/api.go
@@ -23,6 +23,7 @@ import (
func NewService(config *larkcore.Config) *VcService {
v := &VcService{config: config}
+ v.Alert = &alert{service: v}
v.Export = &export{service: v}
v.Meeting = &meeting{service: v}
v.MeetingRecording = &meetingRecording{service: v}
@@ -33,6 +34,7 @@ func NewService(config *larkcore.Config) *VcService {
v.Reserve = &reserve{service: v}
v.ReserveConfig = &reserveConfig{service: v}
v.ReserveConfigAdmin = &reserveConfigAdmin{service: v}
+ v.ReserveConfigForm = &reserveConfigForm{service: v}
v.ResourceReservationList = &resourceReservationList{service: v}
v.Room = &room{service: v}
v.RoomConfig = &roomConfig{service: v}
@@ -43,6 +45,7 @@ func NewService(config *larkcore.Config) *VcService {
type VcService struct {
config *larkcore.Config
+ Alert *alert // 告警中心
Export *export // 导出
Meeting *meeting // 会议
MeetingRecording *meetingRecording // 录制
@@ -53,6 +56,7 @@ type VcService struct {
Reserve *reserve // 预约
ReserveConfig *reserveConfig // reserve_config
ReserveConfigAdmin *reserveConfigAdmin // reserve_config.admin
+ ReserveConfigForm *reserveConfigForm // reserve_config.form
ResourceReservationList *resourceReservationList // resource_reservation_list
Room *room // 会议室
RoomConfig *roomConfig // room_config
@@ -60,6 +64,9 @@ type VcService struct {
ScopeConfig *scopeConfig // 会议室配置
}
+type alert struct {
+ service *VcService
+}
type export struct {
service *VcService
}
@@ -90,6 +97,9 @@ type reserveConfig struct {
type reserveConfigAdmin struct {
service *VcService
}
+type reserveConfigForm struct {
+ service *VcService
+}
type resourceReservationList struct {
service *VcService
}
@@ -106,6 +116,40 @@ type scopeConfig struct {
service *VcService
}
+// 获取告警记录
+//
+// - 获取特定条件下租户的设备告警记录
+//
+// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/vc-v1/alert/list
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/vcv1/list_alert.go
+func (a *alert) List(ctx context.Context, req *ListAlertReq, options ...larkcore.RequestOptionFunc) (*ListAlertResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/vc/v1/alerts"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
+ apiResp, err := larkcore.Request(ctx, apiReq, a.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &ListAlertResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, a.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+func (a *alert) ListByIterator(ctx context.Context, req *ListAlertReq, options ...larkcore.RequestOptionFunc) (*ListAlertIterator, error) {
+ return &ListAlertIterator{
+ ctx: ctx,
+ req: req,
+ listFunc: a.List,
+ options: options,
+ limit: req.Limit}, nil
+}
+
// 下载导出文件
//
// - 下载导出文件
@@ -454,7 +498,7 @@ func (m *meetingRecording) Get(ctx context.Context, req *GetMeetingRecordingReq,
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/vc/v1/meetings/:meeting_id/recording"
apiReq.HttpMethod = http.MethodGet
- apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
apiResp, err := larkcore.Request(ctx, apiReq, m.service.config, options...)
if err != nil {
return nil, err
@@ -752,7 +796,7 @@ func (r *reserve) Delete(ctx context.Context, req *DeleteReserveReq, options ...
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/vc/v1/reserves/:reserve_id"
apiReq.HttpMethod = http.MethodDelete
- apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
apiResp, err := larkcore.Request(ctx, apiReq, r.service.config, options...)
if err != nil {
return nil, err
@@ -780,7 +824,7 @@ func (r *reserve) Get(ctx context.Context, req *GetReserveReq, options ...larkco
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/vc/v1/reserves/:reserve_id"
apiReq.HttpMethod = http.MethodGet
- apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
apiResp, err := larkcore.Request(ctx, apiReq, r.service.config, options...)
if err != nil {
return nil, err
@@ -808,7 +852,7 @@ func (r *reserve) GetActiveMeeting(ctx context.Context, req *GetActiveMeetingRes
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/vc/v1/reserves/:reserve_id/get_active_meeting"
apiReq.HttpMethod = http.MethodGet
- apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
apiResp, err := larkcore.Request(ctx, apiReq, r.service.config, options...)
if err != nil {
return nil, err
@@ -836,7 +880,7 @@ func (r *reserve) Update(ctx context.Context, req *UpdateReserveReq, options ...
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/vc/v1/reserves/:reserve_id"
apiReq.HttpMethod = http.MethodPut
- apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
apiResp, err := larkcore.Request(ctx, apiReq, r.service.config, options...)
if err != nil {
return nil, err
@@ -954,6 +998,58 @@ func (r *reserveConfigAdmin) Patch(ctx context.Context, req *PatchReserveConfigA
return resp, err
}
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=get&project=vc&resource=reserve_config.form&version=v1
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/vcv1/get_reserveConfigForm.go
+func (r *reserveConfigForm) Get(ctx context.Context, req *GetReserveConfigFormReq, options ...larkcore.RequestOptionFunc) (*GetReserveConfigFormResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/vc/v1/reserve_configs/:reserve_config_id/form"
+ apiReq.HttpMethod = http.MethodGet
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
+ apiResp, err := larkcore.Request(ctx, apiReq, r.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &GetReserveConfigFormResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, r.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
+//
+//
+// -
+//
+// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=patch&project=vc&resource=reserve_config.form&version=v1
+//
+// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/vcv1/patch_reserveConfigForm.go
+func (r *reserveConfigForm) Patch(ctx context.Context, req *PatchReserveConfigFormReq, options ...larkcore.RequestOptionFunc) (*PatchReserveConfigFormResp, error) {
+ // 发起请求
+ apiReq := req.apiReq
+ apiReq.ApiPath = "/open-apis/vc/v1/reserve_configs/:reserve_config_id/form"
+ apiReq.HttpMethod = http.MethodPatch
+ apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
+ apiResp, err := larkcore.Request(ctx, apiReq, r.service.config, options...)
+ if err != nil {
+ return nil, err
+ }
+ // 反序列响应结果
+ resp := &PatchReserveConfigFormResp{ApiResp: apiResp}
+ err = apiResp.JSONUnmarshalBody(resp, r.service.config)
+ if err != nil {
+ return nil, err
+ }
+ return resp, err
+}
+
//
//
// -
diff --git a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/vc/v1/model.go b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/vc/v1/model.go
index 199e98ad73..e31ab35c40 100644
--- a/vendor/github.com/larksuite/oapi-sdk-go/v3/service/vc/v1/model.go
+++ b/vendor/github.com/larksuite/oapi-sdk-go/v3/service/vc/v1/model.go
@@ -28,6 +28,12 @@ import (
"github.com/larksuite/oapi-sdk-go/v3/core"
)
+const (
+ QueryTypeRoom = 1 // 会议室
+ QueryTypeErc = 2 // erc
+
+)
+
const (
UserIdTypeUserId = "user_id" // 以user_id来识别用户
UserIdTypeUnionId = "union_id" // 以union_id来识别用户
@@ -70,6 +76,12 @@ const (
UserIdTypeSetHostMeetingOpenId = "open_id" // 以open_id来识别用户(推荐)
)
+const (
+ ActionTypeAuthorize = 0 // 授权
+ ActionTypeRevoke = 1 // 取消授权
+
+)
+
const (
UserIdTypeSetPermissionMeetingRecordingUserId = "user_id" // 以user_id来识别用户
UserIdTypeSetPermissionMeetingRecordingUnionId = "union_id" // 以union_id来识别用户
@@ -154,6 +166,18 @@ const (
UserIdTypePatchReserveConfigAdminOpenId = "open_id" // 以open_id来识别用户
)
+const (
+ UserIdTypeGetReserveConfigFormUserId = "user_id" // 以user_id来识别用户
+ UserIdTypeGetReserveConfigFormUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypeGetReserveConfigFormOpenId = "open_id" // 以open_id来识别用户
+)
+
+const (
+ UserIdTypePatchReserveConfigFormUserId = "user_id" // 以user_id来识别用户
+ UserIdTypePatchReserveConfigFormUnionId = "union_id" // 以union_id来识别用户
+ UserIdTypePatchReserveConfigFormOpenId = "open_id" // 以open_id来识别用户
+)
+
const (
UserIdTypeCreateRoomUserId = "user_id" // 以user_id来识别用户
UserIdTypeCreateRoomUnionId = "union_id" // 以union_id来识别用户
@@ -256,6 +280,9 @@ type Alert struct {
Contacts []*Contact `json:"contacts,omitempty"` // 告警联系人
NotifyMethods []int `json:"notifyMethods,omitempty"` // 通知方式
AlertRule *string `json:"alertRule,omitempty"` // 规则名称
+ ProcessTime *string `json:"process_time,omitempty"` // 处理时间
+ RecoverTime *string `json:"recover_time,omitempty"` // 恢复时间
+ ProcessStatus *int `json:"process_status,omitempty"` // 处理状态:待处理/处理中/已恢复
}
type AlertBuilder struct {
@@ -277,6 +304,12 @@ type AlertBuilder struct {
notifyMethodsFlag bool
alertRule string // 规则名称
alertRuleFlag bool
+ processTime string // 处理时间
+ processTimeFlag bool
+ recoverTime string // 恢复时间
+ recoverTimeFlag bool
+ processStatus int // 处理状态:待处理/处理中/已恢复
+ processStatusFlag bool
}
func NewAlertBuilder() *AlertBuilder {
@@ -365,6 +398,33 @@ func (builder *AlertBuilder) AlertRule(alertRule string) *AlertBuilder {
return builder
}
+// 处理时间
+//
+// 示例值:1656914944
+func (builder *AlertBuilder) ProcessTime(processTime string) *AlertBuilder {
+ builder.processTime = processTime
+ builder.processTimeFlag = true
+ return builder
+}
+
+// 恢复时间
+//
+// 示例值:1656914944
+func (builder *AlertBuilder) RecoverTime(recoverTime string) *AlertBuilder {
+ builder.recoverTime = recoverTime
+ builder.recoverTimeFlag = true
+ return builder
+}
+
+// 处理状态:待处理/处理中/已恢复
+//
+// 示例值:2
+func (builder *AlertBuilder) ProcessStatus(processStatus int) *AlertBuilder {
+ builder.processStatus = processStatus
+ builder.processStatusFlag = true
+ return builder
+}
+
func (builder *AlertBuilder) Build() *Alert {
req := &Alert{}
if builder.alertIdFlag {
@@ -400,6 +460,18 @@ func (builder *AlertBuilder) Build() *Alert {
if builder.alertRuleFlag {
req.AlertRule = &builder.alertRule
+ }
+ if builder.processTimeFlag {
+ req.ProcessTime = &builder.processTime
+
+ }
+ if builder.recoverTimeFlag {
+ req.RecoverTime = &builder.recoverTime
+
+ }
+ if builder.processStatusFlag {
+ req.ProcessStatus = &builder.processStatus
+
}
return req
}
@@ -815,6 +887,68 @@ func (builder *DeviceBuilder) Build() *Device {
return req
}
+type DisableInformConfig struct {
+ IfInform *bool `json:"if_inform,omitempty"` // 禁用状态变更通知开关
+ InformedUsers []*SubscribeUser `json:"informed_users,omitempty"` // 通知成员列表
+ InformedDepts []*SubscribeDepartment `json:"informed_depts,omitempty"` // 通知部门列表
+}
+
+type DisableInformConfigBuilder struct {
+ ifInform bool // 禁用状态变更通知开关
+ ifInformFlag bool
+ informedUsers []*SubscribeUser // 通知成员列表
+ informedUsersFlag bool
+ informedDepts []*SubscribeDepartment // 通知部门列表
+ informedDeptsFlag bool
+}
+
+func NewDisableInformConfigBuilder() *DisableInformConfigBuilder {
+ builder := &DisableInformConfigBuilder{}
+ return builder
+}
+
+// 禁用状态变更通知开关
+//
+// 示例值:false
+func (builder *DisableInformConfigBuilder) IfInform(ifInform bool) *DisableInformConfigBuilder {
+ builder.ifInform = ifInform
+ builder.ifInformFlag = true
+ return builder
+}
+
+// 通知成员列表
+//
+// 示例值:
+func (builder *DisableInformConfigBuilder) InformedUsers(informedUsers []*SubscribeUser) *DisableInformConfigBuilder {
+ builder.informedUsers = informedUsers
+ builder.informedUsersFlag = true
+ return builder
+}
+
+// 通知部门列表
+//
+// 示例值:
+func (builder *DisableInformConfigBuilder) InformedDepts(informedDepts []*SubscribeDepartment) *DisableInformConfigBuilder {
+ builder.informedDepts = informedDepts
+ builder.informedDeptsFlag = true
+ return builder
+}
+
+func (builder *DisableInformConfigBuilder) Build() *DisableInformConfig {
+ req := &DisableInformConfig{}
+ if builder.ifInformFlag {
+ req.IfInform = &builder.ifInform
+
+ }
+ if builder.informedUsersFlag {
+ req.InformedUsers = builder.informedUsers
+ }
+ if builder.informedDeptsFlag {
+ req.InformedDepts = builder.informedDepts
+ }
+ return req
+}
+
type Material struct {
Name *string `json:"name,omitempty"` // 素材名称
FileToken *string `json:"file_token,omitempty"` // 文件上传drive后的token
@@ -1501,33 +1635,36 @@ func (builder *MeetingAbilityBuilder) Build() *MeetingAbility {
}
type MeetingEventMeeting struct {
- Id *string `json:"id,omitempty"` // 会议ID(视频会议的唯一标识,视频会议开始后才会产生)
- Topic *string `json:"topic,omitempty"` // 会议主题
- MeetingNo *string `json:"meeting_no,omitempty"` // 9位会议号(飞书用户可通过输入9位会议号快捷入会)
- MeetingSource *int `json:"meeting_source,omitempty"` // 会议创建源
- StartTime *string `json:"start_time,omitempty"` // 会议开始时间(unix时间,单位sec)
- EndTime *string `json:"end_time,omitempty"` // 会议结束时间(unix时间,单位sec)
- HostUser *MeetingEventUser `json:"host_user,omitempty"` // 会议主持人
- Owner *MeetingEventUser `json:"owner,omitempty"` // 会议拥有者
+ Id *string `json:"id,omitempty"` // 会议ID(视频会议的唯一标识,视频会议开始后才会产生)
+ Topic *string `json:"topic,omitempty"` // 会议主题
+ MeetingNo *string `json:"meeting_no,omitempty"` // 9位会议号(飞书用户可通过输入9位会议号快捷入会)
+ MeetingSource *int `json:"meeting_source,omitempty"` // 会议创建源
+ StartTime *string `json:"start_time,omitempty"` // 会议开始时间(unix时间,单位sec)
+ EndTime *string `json:"end_time,omitempty"` // 会议结束时间(unix时间,单位sec)
+ HostUser *MeetingEventUser `json:"host_user,omitempty"` // 会议主持人
+ Owner *MeetingEventUser `json:"owner,omitempty"` // 会议拥有者
+ CalendarEventId *string `json:"calendar_event_id,omitempty"` // 日程实体的唯一标志
}
type MeetingEventMeetingBuilder struct {
- id string // 会议ID(视频会议的唯一标识,视频会议开始后才会产生)
- idFlag bool
- topic string // 会议主题
- topicFlag bool
- meetingNo string // 9位会议号(飞书用户可通过输入9位会议号快捷入会)
- meetingNoFlag bool
- meetingSource int // 会议创建源
- meetingSourceFlag bool
- startTime string // 会议开始时间(unix时间,单位sec)
- startTimeFlag bool
- endTime string // 会议结束时间(unix时间,单位sec)
- endTimeFlag bool
- hostUser *MeetingEventUser // 会议主持人
- hostUserFlag bool
- owner *MeetingEventUser // 会议拥有者
- ownerFlag bool
+ id string // 会议ID(视频会议的唯一标识,视频会议开始后才会产生)
+ idFlag bool
+ topic string // 会议主题
+ topicFlag bool
+ meetingNo string // 9位会议号(飞书用户可通过输入9位会议号快捷入会)
+ meetingNoFlag bool
+ meetingSource int // 会议创建源
+ meetingSourceFlag bool
+ startTime string // 会议开始时间(unix时间,单位sec)
+ startTimeFlag bool
+ endTime string // 会议结束时间(unix时间,单位sec)
+ endTimeFlag bool
+ hostUser *MeetingEventUser // 会议主持人
+ hostUserFlag bool
+ owner *MeetingEventUser // 会议拥有者
+ ownerFlag bool
+ calendarEventId string // 日程实体的唯一标志
+ calendarEventIdFlag bool
}
func NewMeetingEventMeetingBuilder() *MeetingEventMeetingBuilder {
@@ -1607,6 +1744,15 @@ func (builder *MeetingEventMeetingBuilder) Owner(owner *MeetingEventUser) *Meeti
return builder
}
+// 日程实体的唯一标志
+//
+// 示例值:efa67a98-06a8-4df5-8559-746c8f4477ef_0
+func (builder *MeetingEventMeetingBuilder) CalendarEventId(calendarEventId string) *MeetingEventMeetingBuilder {
+ builder.calendarEventId = calendarEventId
+ builder.calendarEventIdFlag = true
+ return builder
+}
+
func (builder *MeetingEventMeetingBuilder) Build() *MeetingEventMeeting {
req := &MeetingEventMeeting{}
if builder.idFlag {
@@ -1639,6 +1785,10 @@ func (builder *MeetingEventMeetingBuilder) Build() *MeetingEventMeeting {
if builder.ownerFlag {
req.Owner = builder.owner
}
+ if builder.calendarEventIdFlag {
+ req.CalendarEventId = &builder.calendarEventId
+
+ }
return req
}
@@ -6374,6 +6524,104 @@ func (builder *UserIdBuilder) Build() *UserId {
return req
}
+type ListAlertReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ limit int // 最大返回多少记录,当使用迭代器访问时才有效
+}
+
+func NewListAlertReqBuilder() *ListAlertReqBuilder {
+ builder := &ListAlertReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 最大返回多少记录,当使用迭代器访问时才有效
+func (builder *ListAlertReqBuilder) Limit(limit int) *ListAlertReqBuilder {
+ builder.limit = limit
+ return builder
+}
+
+// 开始时间(unix时间,单位sec)
+//
+// 示例值:1608888867
+func (builder *ListAlertReqBuilder) StartTime(startTime string) *ListAlertReqBuilder {
+ builder.apiReq.QueryParams.Set("start_time", fmt.Sprint(startTime))
+ return builder
+}
+
+// 结束时间(unix时间,单位sec)
+//
+// 示例值:1608888867
+func (builder *ListAlertReqBuilder) EndTime(endTime string) *ListAlertReqBuilder {
+ builder.apiReq.QueryParams.Set("end_time", fmt.Sprint(endTime))
+ return builder
+}
+
+// 查询对象类型,不填返回所有
+//
+// 示例值:1
+func (builder *ListAlertReqBuilder) QueryType(queryType int) *ListAlertReqBuilder {
+ builder.apiReq.QueryParams.Set("query_type", fmt.Sprint(queryType))
+ return builder
+}
+
+// 查询对象ID
+//
+// 示例值:6911188411932033028
+func (builder *ListAlertReqBuilder) QueryValue(queryValue string) *ListAlertReqBuilder {
+ builder.apiReq.QueryParams.Set("query_value", fmt.Sprint(queryValue))
+ return builder
+}
+
+// 请求期望返回的告警记录数量,不足则返回全部,该值默认为 100,最大为 1000
+//
+// 示例值:100
+func (builder *ListAlertReqBuilder) PageSize(pageSize int) *ListAlertReqBuilder {
+ builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
+ return builder
+}
+
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果
+//
+// 示例值:100
+func (builder *ListAlertReqBuilder) PageToken(pageToken string) *ListAlertReqBuilder {
+ builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
+ return builder
+}
+
+func (builder *ListAlertReqBuilder) Build() *ListAlertReq {
+ req := &ListAlertReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.Limit = builder.limit
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type ListAlertReq struct {
+ apiReq *larkcore.ApiReq
+ Limit int // 最多返回多少记录,只有在使用迭代器访问时,才有效
+
+}
+
+type ListAlertRespData struct {
+ HasMore *bool `json:"has_more,omitempty"` // 是否还有数据
+ PageToken *string `json:"page_token,omitempty"` // 下一页分页的token,下次请求时传入
+ Items []*Alert `json:"items,omitempty"` // 告警记录
+}
+
+type ListAlertResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *ListAlertRespData `json:"data"` // 业务数据
+}
+
+func (resp *ListAlertResp) Success() bool {
+ return resp.Code == 0
+}
+
type DownloadExportReqBuilder struct {
apiReq *larkcore.ApiReq
}
@@ -7844,7 +8092,7 @@ func (builder *ListByNoMeetingReqBuilder) EndTime(endTime string) *ListByNoMeeti
return builder
}
-//
+// 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该page_token 获取查询结果
//
// 示例值:5
func (builder *ListByNoMeetingReqBuilder) PageToken(pageToken string) *ListByNoMeetingReqBuilder {
@@ -7852,7 +8100,7 @@ func (builder *ListByNoMeetingReqBuilder) PageToken(pageToken string) *ListByNoM
return builder
}
-//
+// 分页大小
//
// 示例值:10
func (builder *ListByNoMeetingReqBuilder) PageSize(pageSize int) *ListByNoMeetingReqBuilder {
@@ -8090,6 +8338,8 @@ func (resp *GetMeetingRecordingResp) Success() bool {
type SetPermissionMeetingRecordingReqBodyBuilder struct {
permissionObjects []*RecordingPermissionObject // 授权对象列表
permissionObjectsFlag bool
+ actionType int // 授权或者取消授权,默认授权
+ actionTypeFlag bool
}
func NewSetPermissionMeetingRecordingReqBodyBuilder() *SetPermissionMeetingRecordingReqBodyBuilder {
@@ -8106,17 +8356,31 @@ func (builder *SetPermissionMeetingRecordingReqBodyBuilder) PermissionObjects(pe
return builder
}
+// 授权或者取消授权,默认授权
+//
+//示例值:1
+func (builder *SetPermissionMeetingRecordingReqBodyBuilder) ActionType(actionType int) *SetPermissionMeetingRecordingReqBodyBuilder {
+ builder.actionType = actionType
+ builder.actionTypeFlag = true
+ return builder
+}
+
func (builder *SetPermissionMeetingRecordingReqBodyBuilder) Build() *SetPermissionMeetingRecordingReqBody {
req := &SetPermissionMeetingRecordingReqBody{}
if builder.permissionObjectsFlag {
req.PermissionObjects = builder.permissionObjects
}
+ if builder.actionTypeFlag {
+ req.ActionType = &builder.actionType
+ }
return req
}
type SetPermissionMeetingRecordingPathReqBodyBuilder struct {
permissionObjects []*RecordingPermissionObject // 授权对象列表
permissionObjectsFlag bool
+ actionType int // 授权或者取消授权,默认授权
+ actionTypeFlag bool
}
func NewSetPermissionMeetingRecordingPathReqBodyBuilder() *SetPermissionMeetingRecordingPathReqBodyBuilder {
@@ -8133,11 +8397,23 @@ func (builder *SetPermissionMeetingRecordingPathReqBodyBuilder) PermissionObject
return builder
}
+// 授权或者取消授权,默认授权
+//
+// 示例值:1
+func (builder *SetPermissionMeetingRecordingPathReqBodyBuilder) ActionType(actionType int) *SetPermissionMeetingRecordingPathReqBodyBuilder {
+ builder.actionType = actionType
+ builder.actionTypeFlag = true
+ return builder
+}
+
func (builder *SetPermissionMeetingRecordingPathReqBodyBuilder) Build() (*SetPermissionMeetingRecordingReqBody, error) {
req := &SetPermissionMeetingRecordingReqBody{}
if builder.permissionObjectsFlag {
req.PermissionObjects = builder.permissionObjects
}
+ if builder.actionTypeFlag {
+ req.ActionType = &builder.actionType
+ }
return req, nil
}
@@ -8188,6 +8464,7 @@ func (builder *SetPermissionMeetingRecordingReqBuilder) Build() *SetPermissionMe
type SetPermissionMeetingRecordingReqBody struct {
PermissionObjects []*RecordingPermissionObject `json:"permission_objects,omitempty"` // 授权对象列表
+ ActionType *int `json:"action_type,omitempty"` // 授权或者取消授权,默认授权
}
type SetPermissionMeetingRecordingReq struct {
@@ -9795,6 +10072,215 @@ func (resp *PatchReserveConfigAdminResp) Success() bool {
return resp.Code == 0
}
+type GetReserveConfigFormReqBuilder struct {
+ apiReq *larkcore.ApiReq
+}
+
+func NewGetReserveConfigFormReqBuilder() *GetReserveConfigFormReqBuilder {
+ builder := &GetReserveConfigFormReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 会议室或层级id
+//
+// 示例值:omm_3c5dd7e09bac0c1758fcf9511bd1a771
+func (builder *GetReserveConfigFormReqBuilder) ReserveConfigId(reserveConfigId string) *GetReserveConfigFormReqBuilder {
+ builder.apiReq.PathParams.Set("reserve_config_id", fmt.Sprint(reserveConfigId))
+ return builder
+}
+
+// 1代表层级,2代表会议室
+//
+// 示例值:2
+func (builder *GetReserveConfigFormReqBuilder) ScopeType(scopeType int) *GetReserveConfigFormReqBuilder {
+ builder.apiReq.QueryParams.Set("scope_type", fmt.Sprint(scopeType))
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:
+func (builder *GetReserveConfigFormReqBuilder) UserIdType(userIdType string) *GetReserveConfigFormReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+func (builder *GetReserveConfigFormReqBuilder) Build() *GetReserveConfigFormReq {
+ req := &GetReserveConfigFormReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ return req
+}
+
+type GetReserveConfigFormReq struct {
+ apiReq *larkcore.ApiReq
+}
+
+type GetReserveConfigFormRespData struct {
+ ReserveFormConfig *ReserveFormConfig `json:"reserve_form_config,omitempty"` // 预定表单
+}
+
+type GetReserveConfigFormResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+ Data *GetReserveConfigFormRespData `json:"data"` // 业务数据
+}
+
+func (resp *GetReserveConfigFormResp) Success() bool {
+ return resp.Code == 0
+}
+
+type PatchReserveConfigFormReqBodyBuilder struct {
+ scopeType int // 1代表层级,2代表会议室
+ scopeTypeFlag bool
+ reserveFormConfig *ReserveFormConfig // 预定表单设置
+ reserveFormConfigFlag bool
+}
+
+func NewPatchReserveConfigFormReqBodyBuilder() *PatchReserveConfigFormReqBodyBuilder {
+ builder := &PatchReserveConfigFormReqBodyBuilder{}
+ return builder
+}
+
+// 1代表层级,2代表会议室
+//
+//示例值:2
+func (builder *PatchReserveConfigFormReqBodyBuilder) ScopeType(scopeType int) *PatchReserveConfigFormReqBodyBuilder {
+ builder.scopeType = scopeType
+ builder.scopeTypeFlag = true
+ return builder
+}
+
+// 预定表单设置
+//
+//示例值:
+func (builder *PatchReserveConfigFormReqBodyBuilder) ReserveFormConfig(reserveFormConfig *ReserveFormConfig) *PatchReserveConfigFormReqBodyBuilder {
+ builder.reserveFormConfig = reserveFormConfig
+ builder.reserveFormConfigFlag = true
+ return builder
+}
+
+func (builder *PatchReserveConfigFormReqBodyBuilder) Build() *PatchReserveConfigFormReqBody {
+ req := &PatchReserveConfigFormReqBody{}
+ if builder.scopeTypeFlag {
+ req.ScopeType = &builder.scopeType
+ }
+ if builder.reserveFormConfigFlag {
+ req.ReserveFormConfig = builder.reserveFormConfig
+ }
+ return req
+}
+
+type PatchReserveConfigFormPathReqBodyBuilder struct {
+ scopeType int // 1代表层级,2代表会议室
+ scopeTypeFlag bool
+ reserveFormConfig *ReserveFormConfig // 预定表单设置
+ reserveFormConfigFlag bool
+}
+
+func NewPatchReserveConfigFormPathReqBodyBuilder() *PatchReserveConfigFormPathReqBodyBuilder {
+ builder := &PatchReserveConfigFormPathReqBodyBuilder{}
+ return builder
+}
+
+// 1代表层级,2代表会议室
+//
+// 示例值:2
+func (builder *PatchReserveConfigFormPathReqBodyBuilder) ScopeType(scopeType int) *PatchReserveConfigFormPathReqBodyBuilder {
+ builder.scopeType = scopeType
+ builder.scopeTypeFlag = true
+ return builder
+}
+
+// 预定表单设置
+//
+// 示例值:
+func (builder *PatchReserveConfigFormPathReqBodyBuilder) ReserveFormConfig(reserveFormConfig *ReserveFormConfig) *PatchReserveConfigFormPathReqBodyBuilder {
+ builder.reserveFormConfig = reserveFormConfig
+ builder.reserveFormConfigFlag = true
+ return builder
+}
+
+func (builder *PatchReserveConfigFormPathReqBodyBuilder) Build() (*PatchReserveConfigFormReqBody, error) {
+ req := &PatchReserveConfigFormReqBody{}
+ if builder.scopeTypeFlag {
+ req.ScopeType = &builder.scopeType
+ }
+ if builder.reserveFormConfigFlag {
+ req.ReserveFormConfig = builder.reserveFormConfig
+ }
+ return req, nil
+}
+
+type PatchReserveConfigFormReqBuilder struct {
+ apiReq *larkcore.ApiReq
+ body *PatchReserveConfigFormReqBody
+}
+
+func NewPatchReserveConfigFormReqBuilder() *PatchReserveConfigFormReqBuilder {
+ builder := &PatchReserveConfigFormReqBuilder{}
+ builder.apiReq = &larkcore.ApiReq{
+ PathParams: larkcore.PathParams{},
+ QueryParams: larkcore.QueryParams{},
+ }
+ return builder
+}
+
+// 会议室或层级id
+//
+// 示例值:omm_3c5dd7e09bac0c1758fcf9511bd1a771
+func (builder *PatchReserveConfigFormReqBuilder) ReserveConfigId(reserveConfigId string) *PatchReserveConfigFormReqBuilder {
+ builder.apiReq.PathParams.Set("reserve_config_id", fmt.Sprint(reserveConfigId))
+ return builder
+}
+
+// 此次调用中使用的用户ID的类型
+//
+// 示例值:
+func (builder *PatchReserveConfigFormReqBuilder) UserIdType(userIdType string) *PatchReserveConfigFormReqBuilder {
+ builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
+ return builder
+}
+
+//
+func (builder *PatchReserveConfigFormReqBuilder) Body(body *PatchReserveConfigFormReqBody) *PatchReserveConfigFormReqBuilder {
+ builder.body = body
+ return builder
+}
+
+func (builder *PatchReserveConfigFormReqBuilder) Build() *PatchReserveConfigFormReq {
+ req := &PatchReserveConfigFormReq{}
+ req.apiReq = &larkcore.ApiReq{}
+ req.apiReq.PathParams = builder.apiReq.PathParams
+ req.apiReq.QueryParams = builder.apiReq.QueryParams
+ req.apiReq.Body = builder.body
+ return req
+}
+
+type PatchReserveConfigFormReqBody struct {
+ ScopeType *int `json:"scope_type,omitempty"` // 1代表层级,2代表会议室
+ ReserveFormConfig *ReserveFormConfig `json:"reserve_form_config,omitempty"` // 预定表单设置
+}
+
+type PatchReserveConfigFormReq struct {
+ apiReq *larkcore.ApiReq
+ Body *PatchReserveConfigFormReqBody `body:""`
+}
+
+type PatchReserveConfigFormResp struct {
+ *larkcore.ApiResp `json:"-"`
+ larkcore.CodeError
+}
+
+func (resp *PatchReserveConfigFormResp) Success() bool {
+ return resp.Code == 0
+}
+
type GetResourceReservationListReqBuilder struct {
apiReq *larkcore.ApiReq
limit int // 最大返回多少记录,当使用迭代器访问时才有效
@@ -11833,6 +12319,60 @@ func (m *P2RoomLevelUpdatedV1) RawReq(req *larkevent.EventReq) {
m.EventReq = req
}
+type ListAlertIterator struct {
+ nextPageToken *string
+ items []*Alert
+ index int
+ limit int
+ ctx context.Context
+ req *ListAlertReq
+ listFunc func(ctx context.Context, req *ListAlertReq, options ...larkcore.RequestOptionFunc) (*ListAlertResp, error)
+ options []larkcore.RequestOptionFunc
+ curlNum int
+}
+
+func (iterator *ListAlertIterator) Next() (bool, *Alert, error) {
+ // 达到最大量,则返回
+ if iterator.limit > 0 && iterator.curlNum >= iterator.limit {
+ return false, nil, nil
+ }
+
+ // 为0则拉取数据
+ if iterator.index == 0 || iterator.index >= len(iterator.items) {
+ if iterator.index != 0 && iterator.nextPageToken == nil {
+ return false, nil, nil
+ }
+ if iterator.nextPageToken != nil {
+ iterator.req.apiReq.QueryParams.Set("page_token", *iterator.nextPageToken)
+ }
+ resp, err := iterator.listFunc(iterator.ctx, iterator.req, iterator.options...)
+ if err != nil {
+ return false, nil, err
+ }
+
+ if resp.Code != 0 {
+ return false, nil, errors.New(fmt.Sprintf("Code:%d,Msg:%s", resp.Code, resp.Msg))
+ }
+
+ if len(resp.Data.Items) == 0 {
+ return false, nil, nil
+ }
+
+ iterator.nextPageToken = resp.Data.PageToken
+ iterator.items = resp.Data.Items
+ iterator.index = 0
+ }
+
+ block := iterator.items[iterator.index]
+ iterator.index++
+ iterator.curlNum++
+ return true, block, nil
+}
+
+func (iterator *ListAlertIterator) NextPageToken() *string {
+ return iterator.nextPageToken
+}
+
type ListByNoMeetingIterator struct {
nextPageToken *string
items []*Meeting
diff --git a/vendor/github.com/leodido/go-urn/.gitignore b/vendor/github.com/leodido/go-urn/.gitignore
index 5bcf4bade0..89d4bc55dc 100644
--- a/vendor/github.com/leodido/go-urn/.gitignore
+++ b/vendor/github.com/leodido/go-urn/.gitignore
@@ -8,4 +8,5 @@
*.out
*.txt
-vendor/
\ No newline at end of file
+vendor/
+/removecomments
\ No newline at end of file
diff --git a/vendor/github.com/leodido/go-urn/.travis.yml b/vendor/github.com/leodido/go-urn/.travis.yml
deleted file mode 100644
index 21f348d65a..0000000000
--- a/vendor/github.com/leodido/go-urn/.travis.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-language: go
-
-go:
- - 1.13.x
- - 1.14.x
- - 1.15.x
- - tip
-
-before_install:
- - go get -t -v ./...
-
-script:
- - go test -race -coverprofile=coverage.txt -covermode=atomic
-
-after_success:
- - bash <(curl -s https://codecov.io/bash)
\ No newline at end of file
diff --git a/vendor/github.com/leodido/go-urn/README.md b/vendor/github.com/leodido/go-urn/README.md
index cc902ec0e3..731eecbb5f 100644
--- a/vendor/github.com/leodido/go-urn/README.md
+++ b/vendor/github.com/leodido/go-urn/README.md
@@ -1,4 +1,4 @@
-[](https://travis-ci.org/leodido/go-urn) [](https://codecov.io/gh/leodido/go-urn) [](https://godoc.org/github.com/leodido/go-urn)
+[](https://app.circleci.com/pipelines/github/leodido/go-urn) [](https://codecov.io/gh/leodido/go-urn) [](https://godoc.org/github.com/leodido/go-urn)
**A parser for URNs**.
@@ -52,4 +52,30 @@ no/19/urn:UrN:NSS__________________________________/-4 20000000 399 ns
---
+## Example
+```go
+package main
+
+import (
+ "fmt"
+ "github.com/leodido/go-urn"
+)
+
+func main() {
+ var uid = "URN:foo:a123,456"
+
+ u, ok := urn.Parse([]byte(uid))
+ if !ok {
+ panic("error parsing urn")
+ }
+
+ fmt.Println(u.ID)
+ fmt.Println(u.SS)
+
+ // Output:
+ // foo
+ // a123,456
+}
+```
+
[](https://github.com/igrigorik/ga-beacon)
\ No newline at end of file
diff --git a/vendor/github.com/leodido/go-urn/machine.go b/vendor/github.com/leodido/go-urn/machine.go
index fe5a0cc861..f8d57b412d 100644
--- a/vendor/github.com/leodido/go-urn/machine.go
+++ b/vendor/github.com/leodido/go-urn/machine.go
@@ -61,11 +61,9 @@ func (m *machine) Parse(input []byte) (*URN, error) {
m.err = nil
m.tolower = []int{}
output := &URN{}
-
{
m.cs = start
}
-
{
if (m.p) == (m.pe) {
goto _testEof
@@ -1674,7 +1672,6 @@ func (m *machine) Parse(input []byte) (*URN, error) {
{
goto st46
}
-
}
}
diff --git a/vendor/github.com/leodido/go-urn/makefile b/vendor/github.com/leodido/go-urn/makefile
index 47026d5099..df87cdc6d2 100644
--- a/vendor/github.com/leodido/go-urn/makefile
+++ b/vendor/github.com/leodido/go-urn/makefile
@@ -1,18 +1,37 @@
SHELL := /bin/bash
+RAGEL := ragel
+GOFMT := go fmt
+export GO_TEST=env GOTRACEBACK=all go test $(GO_ARGS)
+
+.PHONY: build
build: machine.go
+.PHONY: clean
+clean:
+ @rm -rf docs
+ @rm -f machine.go
+
+.PHONY: images
images: docs/urn.png
+.PHONY: removecomments
+removecomments:
+ @cd ./tools/removecomments; go build -o ../../removecomments .
+
machine.go: machine.go.rl
- ragel -Z -G2 -e -o $@ $<
- @sed -i '/^\/\/line/d' $@
- @$(MAKE) -s file=$@ snake2camel
- @gofmt -w -s $@
+
+machine.go: removecomments
+
+machine.go:
+ $(RAGEL) -Z -G2 -e -o $@ $<
+ @./removecomments $@
+ $(MAKE) -s file=$@ snake2camel
+ $(GOFMT) $@
docs/urn.dot: machine.go.rl
@mkdir -p docs
- ragel -Z -e -Vp $< -o $@
+ $(RAGEL) -Z -e -Vp $< -o $@
docs/urn.png: docs/urn.dot
dot $< -Tpng -o $@
@@ -22,13 +41,8 @@ bench: *_test.go machine.go
go test -bench=. -benchmem -benchtime=5s ./...
.PHONY: tests
-tests: *_test.go machine.go
- go test -race -timeout 10s -coverprofile=coverage.out -covermode=atomic -v ./...
-
-.PHONY: clean
-clean:
- @rm -rf docs
- @rm -f machine.go
+tests: *_test.go
+ $(GO_TEST) ./...
.PHONY: snake2camel
snake2camel:
@@ -36,4 +50,4 @@ snake2camel:
while ( match($$0, /(.*)([a-z]+[0-9]*)_([a-zA-Z0-9])(.*)/, cap) ) \
$$0 = cap[1] cap[2] toupper(cap[3]) cap[4]; \
print \
- }' $(file)
\ No newline at end of file
+ }' $(file)
diff --git a/vendor/github.com/mattn/go-isatty/isatty_bsd.go b/vendor/github.com/mattn/go-isatty/isatty_bsd.go
index 39bbcf00f0..d569c0c949 100644
--- a/vendor/github.com/mattn/go-isatty/isatty_bsd.go
+++ b/vendor/github.com/mattn/go-isatty/isatty_bsd.go
@@ -1,5 +1,5 @@
-//go:build (darwin || freebsd || openbsd || netbsd || dragonfly) && !appengine
-// +build darwin freebsd openbsd netbsd dragonfly
+//go:build (darwin || freebsd || openbsd || netbsd || dragonfly || hurd) && !appengine
+// +build darwin freebsd openbsd netbsd dragonfly hurd
// +build !appengine
package isatty
diff --git a/vendor/github.com/mitchellh/mapstructure/CHANGELOG.md b/vendor/github.com/mitchellh/mapstructure/CHANGELOG.md
new file mode 100644
index 0000000000..c758234904
--- /dev/null
+++ b/vendor/github.com/mitchellh/mapstructure/CHANGELOG.md
@@ -0,0 +1,96 @@
+## 1.5.0
+
+* New option `IgnoreUntaggedFields` to ignore decoding to any fields
+ without `mapstructure` (or the configured tag name) set [GH-277]
+* New option `ErrorUnset` which makes it an error if any fields
+ in a target struct are not set by the decoding process. [GH-225]
+* New function `OrComposeDecodeHookFunc` to help compose decode hooks. [GH-240]
+* Decoding to slice from array no longer crashes [GH-265]
+* Decode nested struct pointers to map [GH-271]
+* Fix issue where `,squash` was ignored if `Squash` option was set. [GH-280]
+* Fix issue where fields with `,omitempty` would sometimes decode
+ into a map with an empty string key [GH-281]
+
+## 1.4.3
+
+* Fix cases where `json.Number` didn't decode properly [GH-261]
+
+## 1.4.2
+
+* Custom name matchers to support any sort of casing, formatting, etc. for
+ field names. [GH-250]
+* Fix possible panic in ComposeDecodeHookFunc [GH-251]
+
+## 1.4.1
+
+* Fix regression where `*time.Time` value would be set to empty and not be sent
+ to decode hooks properly [GH-232]
+
+## 1.4.0
+
+* A new decode hook type `DecodeHookFuncValue` has been added that has
+ access to the full values. [GH-183]
+* Squash is now supported with embedded fields that are struct pointers [GH-205]
+* Empty strings will convert to 0 for all numeric types when weakly decoding [GH-206]
+
+## 1.3.3
+
+* Decoding maps from maps creates a settable value for decode hooks [GH-203]
+
+## 1.3.2
+
+* Decode into interface type with a struct value is supported [GH-187]
+
+## 1.3.1
+
+* Squash should only squash embedded structs. [GH-194]
+
+## 1.3.0
+
+* Added `",omitempty"` support. This will ignore zero values in the source
+ structure when encoding. [GH-145]
+
+## 1.2.3
+
+* Fix duplicate entries in Keys list with pointer values. [GH-185]
+
+## 1.2.2
+
+* Do not add unsettable (unexported) values to the unused metadata key
+ or "remain" value. [GH-150]
+
+## 1.2.1
+
+* Go modules checksum mismatch fix
+
+## 1.2.0
+
+* Added support to capture unused values in a field using the `",remain"` value
+ in the mapstructure tag. There is an example to showcase usage.
+* Added `DecoderConfig` option to always squash embedded structs
+* `json.Number` can decode into `uint` types
+* Empty slices are preserved and not replaced with nil slices
+* Fix panic that can occur in when decoding a map into a nil slice of structs
+* Improved package documentation for godoc
+
+## 1.1.2
+
+* Fix error when decode hook decodes interface implementation into interface
+ type. [GH-140]
+
+## 1.1.1
+
+* Fix panic that can happen in `decodePtr`
+
+## 1.1.0
+
+* Added `StringToIPHookFunc` to convert `string` to `net.IP` and `net.IPNet` [GH-133]
+* Support struct to struct decoding [GH-137]
+* If source map value is nil, then destination map value is nil (instead of empty)
+* If source slice value is nil, then destination slice value is nil (instead of empty)
+* If source pointer is nil, then destination pointer is set to nil (instead of
+ allocated zero value of type)
+
+## 1.0.0
+
+* Initial tagged stable release.
diff --git a/vendor/github.com/mitchellh/mapstructure/LICENSE b/vendor/github.com/mitchellh/mapstructure/LICENSE
new file mode 100644
index 0000000000..f9c841a51e
--- /dev/null
+++ b/vendor/github.com/mitchellh/mapstructure/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2013 Mitchell Hashimoto
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/vendor/github.com/mitchellh/mapstructure/README.md b/vendor/github.com/mitchellh/mapstructure/README.md
new file mode 100644
index 0000000000..0018dc7d9f
--- /dev/null
+++ b/vendor/github.com/mitchellh/mapstructure/README.md
@@ -0,0 +1,46 @@
+# mapstructure [](https://godoc.org/github.com/mitchellh/mapstructure)
+
+mapstructure is a Go library for decoding generic map values to structures
+and vice versa, while providing helpful error handling.
+
+This library is most useful when decoding values from some data stream (JSON,
+Gob, etc.) where you don't _quite_ know the structure of the underlying data
+until you read a part of it. You can therefore read a `map[string]interface{}`
+and use this library to decode it into the proper underlying native Go
+structure.
+
+## Installation
+
+Standard `go get`:
+
+```
+$ go get github.com/mitchellh/mapstructure
+```
+
+## Usage & Example
+
+For usage and examples see the [Godoc](http://godoc.org/github.com/mitchellh/mapstructure).
+
+The `Decode` function has examples associated with it there.
+
+## But Why?!
+
+Go offers fantastic standard libraries for decoding formats such as JSON.
+The standard method is to have a struct pre-created, and populate that struct
+from the bytes of the encoded format. This is great, but the problem is if
+you have configuration or an encoding that changes slightly depending on
+specific fields. For example, consider this JSON:
+
+```json
+{
+ "type": "person",
+ "name": "Mitchell"
+}
+```
+
+Perhaps we can't populate a specific structure without first reading
+the "type" field from the JSON. We could always do two passes over the
+decoding of the JSON (reading the "type" first, and the rest later).
+However, it is much simpler to just decode this into a `map[string]interface{}`
+structure, read the "type" key, then use something like this library
+to decode it into the proper structure.
diff --git a/vendor/github.com/mitchellh/mapstructure/decode_hooks.go b/vendor/github.com/mitchellh/mapstructure/decode_hooks.go
new file mode 100644
index 0000000000..3a754ca724
--- /dev/null
+++ b/vendor/github.com/mitchellh/mapstructure/decode_hooks.go
@@ -0,0 +1,279 @@
+package mapstructure
+
+import (
+ "encoding"
+ "errors"
+ "fmt"
+ "net"
+ "reflect"
+ "strconv"
+ "strings"
+ "time"
+)
+
+// typedDecodeHook takes a raw DecodeHookFunc (an interface{}) and turns
+// it into the proper DecodeHookFunc type, such as DecodeHookFuncType.
+func typedDecodeHook(h DecodeHookFunc) DecodeHookFunc {
+ // Create variables here so we can reference them with the reflect pkg
+ var f1 DecodeHookFuncType
+ var f2 DecodeHookFuncKind
+ var f3 DecodeHookFuncValue
+
+ // Fill in the variables into this interface and the rest is done
+ // automatically using the reflect package.
+ potential := []interface{}{f1, f2, f3}
+
+ v := reflect.ValueOf(h)
+ vt := v.Type()
+ for _, raw := range potential {
+ pt := reflect.ValueOf(raw).Type()
+ if vt.ConvertibleTo(pt) {
+ return v.Convert(pt).Interface()
+ }
+ }
+
+ return nil
+}
+
+// DecodeHookExec executes the given decode hook. This should be used
+// since it'll naturally degrade to the older backwards compatible DecodeHookFunc
+// that took reflect.Kind instead of reflect.Type.
+func DecodeHookExec(
+ raw DecodeHookFunc,
+ from reflect.Value, to reflect.Value) (interface{}, error) {
+
+ switch f := typedDecodeHook(raw).(type) {
+ case DecodeHookFuncType:
+ return f(from.Type(), to.Type(), from.Interface())
+ case DecodeHookFuncKind:
+ return f(from.Kind(), to.Kind(), from.Interface())
+ case DecodeHookFuncValue:
+ return f(from, to)
+ default:
+ return nil, errors.New("invalid decode hook signature")
+ }
+}
+
+// ComposeDecodeHookFunc creates a single DecodeHookFunc that
+// automatically composes multiple DecodeHookFuncs.
+//
+// The composed funcs are called in order, with the result of the
+// previous transformation.
+func ComposeDecodeHookFunc(fs ...DecodeHookFunc) DecodeHookFunc {
+ return func(f reflect.Value, t reflect.Value) (interface{}, error) {
+ var err error
+ data := f.Interface()
+
+ newFrom := f
+ for _, f1 := range fs {
+ data, err = DecodeHookExec(f1, newFrom, t)
+ if err != nil {
+ return nil, err
+ }
+ newFrom = reflect.ValueOf(data)
+ }
+
+ return data, nil
+ }
+}
+
+// OrComposeDecodeHookFunc executes all input hook functions until one of them returns no error. In that case its value is returned.
+// If all hooks return an error, OrComposeDecodeHookFunc returns an error concatenating all error messages.
+func OrComposeDecodeHookFunc(ff ...DecodeHookFunc) DecodeHookFunc {
+ return func(a, b reflect.Value) (interface{}, error) {
+ var allErrs string
+ var out interface{}
+ var err error
+
+ for _, f := range ff {
+ out, err = DecodeHookExec(f, a, b)
+ if err != nil {
+ allErrs += err.Error() + "\n"
+ continue
+ }
+
+ return out, nil
+ }
+
+ return nil, errors.New(allErrs)
+ }
+}
+
+// StringToSliceHookFunc returns a DecodeHookFunc that converts
+// string to []string by splitting on the given sep.
+func StringToSliceHookFunc(sep string) DecodeHookFunc {
+ return func(
+ f reflect.Kind,
+ t reflect.Kind,
+ data interface{}) (interface{}, error) {
+ if f != reflect.String || t != reflect.Slice {
+ return data, nil
+ }
+
+ raw := data.(string)
+ if raw == "" {
+ return []string{}, nil
+ }
+
+ return strings.Split(raw, sep), nil
+ }
+}
+
+// StringToTimeDurationHookFunc returns a DecodeHookFunc that converts
+// strings to time.Duration.
+func StringToTimeDurationHookFunc() DecodeHookFunc {
+ return func(
+ f reflect.Type,
+ t reflect.Type,
+ data interface{}) (interface{}, error) {
+ if f.Kind() != reflect.String {
+ return data, nil
+ }
+ if t != reflect.TypeOf(time.Duration(5)) {
+ return data, nil
+ }
+
+ // Convert it by parsing
+ return time.ParseDuration(data.(string))
+ }
+}
+
+// StringToIPHookFunc returns a DecodeHookFunc that converts
+// strings to net.IP
+func StringToIPHookFunc() DecodeHookFunc {
+ return func(
+ f reflect.Type,
+ t reflect.Type,
+ data interface{}) (interface{}, error) {
+ if f.Kind() != reflect.String {
+ return data, nil
+ }
+ if t != reflect.TypeOf(net.IP{}) {
+ return data, nil
+ }
+
+ // Convert it by parsing
+ ip := net.ParseIP(data.(string))
+ if ip == nil {
+ return net.IP{}, fmt.Errorf("failed parsing ip %v", data)
+ }
+
+ return ip, nil
+ }
+}
+
+// StringToIPNetHookFunc returns a DecodeHookFunc that converts
+// strings to net.IPNet
+func StringToIPNetHookFunc() DecodeHookFunc {
+ return func(
+ f reflect.Type,
+ t reflect.Type,
+ data interface{}) (interface{}, error) {
+ if f.Kind() != reflect.String {
+ return data, nil
+ }
+ if t != reflect.TypeOf(net.IPNet{}) {
+ return data, nil
+ }
+
+ // Convert it by parsing
+ _, net, err := net.ParseCIDR(data.(string))
+ return net, err
+ }
+}
+
+// StringToTimeHookFunc returns a DecodeHookFunc that converts
+// strings to time.Time.
+func StringToTimeHookFunc(layout string) DecodeHookFunc {
+ return func(
+ f reflect.Type,
+ t reflect.Type,
+ data interface{}) (interface{}, error) {
+ if f.Kind() != reflect.String {
+ return data, nil
+ }
+ if t != reflect.TypeOf(time.Time{}) {
+ return data, nil
+ }
+
+ // Convert it by parsing
+ return time.Parse(layout, data.(string))
+ }
+}
+
+// WeaklyTypedHook is a DecodeHookFunc which adds support for weak typing to
+// the decoder.
+//
+// Note that this is significantly different from the WeaklyTypedInput option
+// of the DecoderConfig.
+func WeaklyTypedHook(
+ f reflect.Kind,
+ t reflect.Kind,
+ data interface{}) (interface{}, error) {
+ dataVal := reflect.ValueOf(data)
+ switch t {
+ case reflect.String:
+ switch f {
+ case reflect.Bool:
+ if dataVal.Bool() {
+ return "1", nil
+ }
+ return "0", nil
+ case reflect.Float32:
+ return strconv.FormatFloat(dataVal.Float(), 'f', -1, 64), nil
+ case reflect.Int:
+ return strconv.FormatInt(dataVal.Int(), 10), nil
+ case reflect.Slice:
+ dataType := dataVal.Type()
+ elemKind := dataType.Elem().Kind()
+ if elemKind == reflect.Uint8 {
+ return string(dataVal.Interface().([]uint8)), nil
+ }
+ case reflect.Uint:
+ return strconv.FormatUint(dataVal.Uint(), 10), nil
+ }
+ }
+
+ return data, nil
+}
+
+func RecursiveStructToMapHookFunc() DecodeHookFunc {
+ return func(f reflect.Value, t reflect.Value) (interface{}, error) {
+ if f.Kind() != reflect.Struct {
+ return f.Interface(), nil
+ }
+
+ var i interface{} = struct{}{}
+ if t.Type() != reflect.TypeOf(&i).Elem() {
+ return f.Interface(), nil
+ }
+
+ m := make(map[string]interface{})
+ t.Set(reflect.ValueOf(m))
+
+ return f.Interface(), nil
+ }
+}
+
+// TextUnmarshallerHookFunc returns a DecodeHookFunc that applies
+// strings to the UnmarshalText function, when the target type
+// implements the encoding.TextUnmarshaler interface
+func TextUnmarshallerHookFunc() DecodeHookFuncType {
+ return func(
+ f reflect.Type,
+ t reflect.Type,
+ data interface{}) (interface{}, error) {
+ if f.Kind() != reflect.String {
+ return data, nil
+ }
+ result := reflect.New(t).Interface()
+ unmarshaller, ok := result.(encoding.TextUnmarshaler)
+ if !ok {
+ return data, nil
+ }
+ if err := unmarshaller.UnmarshalText([]byte(data.(string))); err != nil {
+ return nil, err
+ }
+ return result, nil
+ }
+}
diff --git a/vendor/github.com/mitchellh/mapstructure/error.go b/vendor/github.com/mitchellh/mapstructure/error.go
new file mode 100644
index 0000000000..47a99e5af3
--- /dev/null
+++ b/vendor/github.com/mitchellh/mapstructure/error.go
@@ -0,0 +1,50 @@
+package mapstructure
+
+import (
+ "errors"
+ "fmt"
+ "sort"
+ "strings"
+)
+
+// Error implements the error interface and can represents multiple
+// errors that occur in the course of a single decode.
+type Error struct {
+ Errors []string
+}
+
+func (e *Error) Error() string {
+ points := make([]string, len(e.Errors))
+ for i, err := range e.Errors {
+ points[i] = fmt.Sprintf("* %s", err)
+ }
+
+ sort.Strings(points)
+ return fmt.Sprintf(
+ "%d error(s) decoding:\n\n%s",
+ len(e.Errors), strings.Join(points, "\n"))
+}
+
+// WrappedErrors implements the errwrap.Wrapper interface to make this
+// return value more useful with the errwrap and go-multierror libraries.
+func (e *Error) WrappedErrors() []error {
+ if e == nil {
+ return nil
+ }
+
+ result := make([]error, len(e.Errors))
+ for i, e := range e.Errors {
+ result[i] = errors.New(e)
+ }
+
+ return result
+}
+
+func appendErrors(errors []string, err error) []string {
+ switch e := err.(type) {
+ case *Error:
+ return append(errors, e.Errors...)
+ default:
+ return append(errors, e.Error())
+ }
+}
diff --git a/vendor/github.com/mitchellh/mapstructure/mapstructure.go b/vendor/github.com/mitchellh/mapstructure/mapstructure.go
new file mode 100644
index 0000000000..1efb22ac36
--- /dev/null
+++ b/vendor/github.com/mitchellh/mapstructure/mapstructure.go
@@ -0,0 +1,1540 @@
+// Package mapstructure exposes functionality to convert one arbitrary
+// Go type into another, typically to convert a map[string]interface{}
+// into a native Go structure.
+//
+// The Go structure can be arbitrarily complex, containing slices,
+// other structs, etc. and the decoder will properly decode nested
+// maps and so on into the proper structures in the native Go struct.
+// See the examples to see what the decoder is capable of.
+//
+// The simplest function to start with is Decode.
+//
+// Field Tags
+//
+// When decoding to a struct, mapstructure will use the field name by
+// default to perform the mapping. For example, if a struct has a field
+// "Username" then mapstructure will look for a key in the source value
+// of "username" (case insensitive).
+//
+// type User struct {
+// Username string
+// }
+//
+// You can change the behavior of mapstructure by using struct tags.
+// The default struct tag that mapstructure looks for is "mapstructure"
+// but you can customize it using DecoderConfig.
+//
+// Renaming Fields
+//
+// To rename the key that mapstructure looks for, use the "mapstructure"
+// tag and set a value directly. For example, to change the "username" example
+// above to "user":
+//
+// type User struct {
+// Username string `mapstructure:"user"`
+// }
+//
+// Embedded Structs and Squashing
+//
+// Embedded structs are treated as if they're another field with that name.
+// By default, the two structs below are equivalent when decoding with
+// mapstructure:
+//
+// type Person struct {
+// Name string
+// }
+//
+// type Friend struct {
+// Person
+// }
+//
+// type Friend struct {
+// Person Person
+// }
+//
+// This would require an input that looks like below:
+//
+// map[string]interface{}{
+// "person": map[string]interface{}{"name": "alice"},
+// }
+//
+// If your "person" value is NOT nested, then you can append ",squash" to
+// your tag value and mapstructure will treat it as if the embedded struct
+// were part of the struct directly. Example:
+//
+// type Friend struct {
+// Person `mapstructure:",squash"`
+// }
+//
+// Now the following input would be accepted:
+//
+// map[string]interface{}{
+// "name": "alice",
+// }
+//
+// When decoding from a struct to a map, the squash tag squashes the struct
+// fields into a single map. Using the example structs from above:
+//
+// Friend{Person: Person{Name: "alice"}}
+//
+// Will be decoded into a map:
+//
+// map[string]interface{}{
+// "name": "alice",
+// }
+//
+// DecoderConfig has a field that changes the behavior of mapstructure
+// to always squash embedded structs.
+//
+// Remainder Values
+//
+// If there are any unmapped keys in the source value, mapstructure by
+// default will silently ignore them. You can error by setting ErrorUnused
+// in DecoderConfig. If you're using Metadata you can also maintain a slice
+// of the unused keys.
+//
+// You can also use the ",remain" suffix on your tag to collect all unused
+// values in a map. The field with this tag MUST be a map type and should
+// probably be a "map[string]interface{}" or "map[interface{}]interface{}".
+// See example below:
+//
+// type Friend struct {
+// Name string
+// Other map[string]interface{} `mapstructure:",remain"`
+// }
+//
+// Given the input below, Other would be populated with the other
+// values that weren't used (everything but "name"):
+//
+// map[string]interface{}{
+// "name": "bob",
+// "address": "123 Maple St.",
+// }
+//
+// Omit Empty Values
+//
+// When decoding from a struct to any other value, you may use the
+// ",omitempty" suffix on your tag to omit that value if it equates to
+// the zero value. The zero value of all types is specified in the Go
+// specification.
+//
+// For example, the zero type of a numeric type is zero ("0"). If the struct
+// field value is zero and a numeric type, the field is empty, and it won't
+// be encoded into the destination type.
+//
+// type Source struct {
+// Age int `mapstructure:",omitempty"`
+// }
+//
+// Unexported fields
+//
+// Since unexported (private) struct fields cannot be set outside the package
+// where they are defined, the decoder will simply skip them.
+//
+// For this output type definition:
+//
+// type Exported struct {
+// private string // this unexported field will be skipped
+// Public string
+// }
+//
+// Using this map as input:
+//
+// map[string]interface{}{
+// "private": "I will be ignored",
+// "Public": "I made it through!",
+// }
+//
+// The following struct will be decoded:
+//
+// type Exported struct {
+// private: "" // field is left with an empty string (zero value)
+// Public: "I made it through!"
+// }
+//
+// Other Configuration
+//
+// mapstructure is highly configurable. See the DecoderConfig struct
+// for other features and options that are supported.
+package mapstructure
+
+import (
+ "encoding/json"
+ "errors"
+ "fmt"
+ "reflect"
+ "sort"
+ "strconv"
+ "strings"
+)
+
+// DecodeHookFunc is the callback function that can be used for
+// data transformations. See "DecodeHook" in the DecoderConfig
+// struct.
+//
+// The type must be one of DecodeHookFuncType, DecodeHookFuncKind, or
+// DecodeHookFuncValue.
+// Values are a superset of Types (Values can return types), and Types are a
+// superset of Kinds (Types can return Kinds) and are generally a richer thing
+// to use, but Kinds are simpler if you only need those.
+//
+// The reason DecodeHookFunc is multi-typed is for backwards compatibility:
+// we started with Kinds and then realized Types were the better solution,
+// but have a promise to not break backwards compat so we now support
+// both.
+type DecodeHookFunc interface{}
+
+// DecodeHookFuncType is a DecodeHookFunc which has complete information about
+// the source and target types.
+type DecodeHookFuncType func(reflect.Type, reflect.Type, interface{}) (interface{}, error)
+
+// DecodeHookFuncKind is a DecodeHookFunc which knows only the Kinds of the
+// source and target types.
+type DecodeHookFuncKind func(reflect.Kind, reflect.Kind, interface{}) (interface{}, error)
+
+// DecodeHookFuncValue is a DecodeHookFunc which has complete access to both the source and target
+// values.
+type DecodeHookFuncValue func(from reflect.Value, to reflect.Value) (interface{}, error)
+
+// DecoderConfig is the configuration that is used to create a new decoder
+// and allows customization of various aspects of decoding.
+type DecoderConfig struct {
+ // DecodeHook, if set, will be called before any decoding and any
+ // type conversion (if WeaklyTypedInput is on). This lets you modify
+ // the values before they're set down onto the resulting struct. The
+ // DecodeHook is called for every map and value in the input. This means
+ // that if a struct has embedded fields with squash tags the decode hook
+ // is called only once with all of the input data, not once for each
+ // embedded struct.
+ //
+ // If an error is returned, the entire decode will fail with that error.
+ DecodeHook DecodeHookFunc
+
+ // If ErrorUnused is true, then it is an error for there to exist
+ // keys in the original map that were unused in the decoding process
+ // (extra keys).
+ ErrorUnused bool
+
+ // If ErrorUnset is true, then it is an error for there to exist
+ // fields in the result that were not set in the decoding process
+ // (extra fields). This only applies to decoding to a struct. This
+ // will affect all nested structs as well.
+ ErrorUnset bool
+
+ // ZeroFields, if set to true, will zero fields before writing them.
+ // For example, a map will be emptied before decoded values are put in
+ // it. If this is false, a map will be merged.
+ ZeroFields bool
+
+ // If WeaklyTypedInput is true, the decoder will make the following
+ // "weak" conversions:
+ //
+ // - bools to string (true = "1", false = "0")
+ // - numbers to string (base 10)
+ // - bools to int/uint (true = 1, false = 0)
+ // - strings to int/uint (base implied by prefix)
+ // - int to bool (true if value != 0)
+ // - string to bool (accepts: 1, t, T, TRUE, true, True, 0, f, F,
+ // FALSE, false, False. Anything else is an error)
+ // - empty array = empty map and vice versa
+ // - negative numbers to overflowed uint values (base 10)
+ // - slice of maps to a merged map
+ // - single values are converted to slices if required. Each
+ // element is weakly decoded. For example: "4" can become []int{4}
+ // if the target type is an int slice.
+ //
+ WeaklyTypedInput bool
+
+ // Squash will squash embedded structs. A squash tag may also be
+ // added to an individual struct field using a tag. For example:
+ //
+ // type Parent struct {
+ // Child `mapstructure:",squash"`
+ // }
+ Squash bool
+
+ // Metadata is the struct that will contain extra metadata about
+ // the decoding. If this is nil, then no metadata will be tracked.
+ Metadata *Metadata
+
+ // Result is a pointer to the struct that will contain the decoded
+ // value.
+ Result interface{}
+
+ // The tag name that mapstructure reads for field names. This
+ // defaults to "mapstructure"
+ TagName string
+
+ // IgnoreUntaggedFields ignores all struct fields without explicit
+ // TagName, comparable to `mapstructure:"-"` as default behaviour.
+ IgnoreUntaggedFields bool
+
+ // MatchName is the function used to match the map key to the struct
+ // field name or tag. Defaults to `strings.EqualFold`. This can be used
+ // to implement case-sensitive tag values, support snake casing, etc.
+ MatchName func(mapKey, fieldName string) bool
+}
+
+// A Decoder takes a raw interface value and turns it into structured
+// data, keeping track of rich error information along the way in case
+// anything goes wrong. Unlike the basic top-level Decode method, you can
+// more finely control how the Decoder behaves using the DecoderConfig
+// structure. The top-level Decode method is just a convenience that sets
+// up the most basic Decoder.
+type Decoder struct {
+ config *DecoderConfig
+}
+
+// Metadata contains information about decoding a structure that
+// is tedious or difficult to get otherwise.
+type Metadata struct {
+ // Keys are the keys of the structure which were successfully decoded
+ Keys []string
+
+ // Unused is a slice of keys that were found in the raw value but
+ // weren't decoded since there was no matching field in the result interface
+ Unused []string
+
+ // Unset is a slice of field names that were found in the result interface
+ // but weren't set in the decoding process since there was no matching value
+ // in the input
+ Unset []string
+}
+
+// Decode takes an input structure and uses reflection to translate it to
+// the output structure. output must be a pointer to a map or struct.
+func Decode(input interface{}, output interface{}) error {
+ config := &DecoderConfig{
+ Metadata: nil,
+ Result: output,
+ }
+
+ decoder, err := NewDecoder(config)
+ if err != nil {
+ return err
+ }
+
+ return decoder.Decode(input)
+}
+
+// WeakDecode is the same as Decode but is shorthand to enable
+// WeaklyTypedInput. See DecoderConfig for more info.
+func WeakDecode(input, output interface{}) error {
+ config := &DecoderConfig{
+ Metadata: nil,
+ Result: output,
+ WeaklyTypedInput: true,
+ }
+
+ decoder, err := NewDecoder(config)
+ if err != nil {
+ return err
+ }
+
+ return decoder.Decode(input)
+}
+
+// DecodeMetadata is the same as Decode, but is shorthand to
+// enable metadata collection. See DecoderConfig for more info.
+func DecodeMetadata(input interface{}, output interface{}, metadata *Metadata) error {
+ config := &DecoderConfig{
+ Metadata: metadata,
+ Result: output,
+ }
+
+ decoder, err := NewDecoder(config)
+ if err != nil {
+ return err
+ }
+
+ return decoder.Decode(input)
+}
+
+// WeakDecodeMetadata is the same as Decode, but is shorthand to
+// enable both WeaklyTypedInput and metadata collection. See
+// DecoderConfig for more info.
+func WeakDecodeMetadata(input interface{}, output interface{}, metadata *Metadata) error {
+ config := &DecoderConfig{
+ Metadata: metadata,
+ Result: output,
+ WeaklyTypedInput: true,
+ }
+
+ decoder, err := NewDecoder(config)
+ if err != nil {
+ return err
+ }
+
+ return decoder.Decode(input)
+}
+
+// NewDecoder returns a new decoder for the given configuration. Once
+// a decoder has been returned, the same configuration must not be used
+// again.
+func NewDecoder(config *DecoderConfig) (*Decoder, error) {
+ val := reflect.ValueOf(config.Result)
+ if val.Kind() != reflect.Ptr {
+ return nil, errors.New("result must be a pointer")
+ }
+
+ val = val.Elem()
+ if !val.CanAddr() {
+ return nil, errors.New("result must be addressable (a pointer)")
+ }
+
+ if config.Metadata != nil {
+ if config.Metadata.Keys == nil {
+ config.Metadata.Keys = make([]string, 0)
+ }
+
+ if config.Metadata.Unused == nil {
+ config.Metadata.Unused = make([]string, 0)
+ }
+
+ if config.Metadata.Unset == nil {
+ config.Metadata.Unset = make([]string, 0)
+ }
+ }
+
+ if config.TagName == "" {
+ config.TagName = "mapstructure"
+ }
+
+ if config.MatchName == nil {
+ config.MatchName = strings.EqualFold
+ }
+
+ result := &Decoder{
+ config: config,
+ }
+
+ return result, nil
+}
+
+// Decode decodes the given raw interface to the target pointer specified
+// by the configuration.
+func (d *Decoder) Decode(input interface{}) error {
+ return d.decode("", input, reflect.ValueOf(d.config.Result).Elem())
+}
+
+// Decodes an unknown data type into a specific reflection value.
+func (d *Decoder) decode(name string, input interface{}, outVal reflect.Value) error {
+ var inputVal reflect.Value
+ if input != nil {
+ inputVal = reflect.ValueOf(input)
+
+ // We need to check here if input is a typed nil. Typed nils won't
+ // match the "input == nil" below so we check that here.
+ if inputVal.Kind() == reflect.Ptr && inputVal.IsNil() {
+ input = nil
+ }
+ }
+
+ if input == nil {
+ // If the data is nil, then we don't set anything, unless ZeroFields is set
+ // to true.
+ if d.config.ZeroFields {
+ outVal.Set(reflect.Zero(outVal.Type()))
+
+ if d.config.Metadata != nil && name != "" {
+ d.config.Metadata.Keys = append(d.config.Metadata.Keys, name)
+ }
+ }
+ return nil
+ }
+
+ if !inputVal.IsValid() {
+ // If the input value is invalid, then we just set the value
+ // to be the zero value.
+ outVal.Set(reflect.Zero(outVal.Type()))
+ if d.config.Metadata != nil && name != "" {
+ d.config.Metadata.Keys = append(d.config.Metadata.Keys, name)
+ }
+ return nil
+ }
+
+ if d.config.DecodeHook != nil {
+ // We have a DecodeHook, so let's pre-process the input.
+ var err error
+ input, err = DecodeHookExec(d.config.DecodeHook, inputVal, outVal)
+ if err != nil {
+ return fmt.Errorf("error decoding '%s': %s", name, err)
+ }
+ }
+
+ var err error
+ outputKind := getKind(outVal)
+ addMetaKey := true
+ switch outputKind {
+ case reflect.Bool:
+ err = d.decodeBool(name, input, outVal)
+ case reflect.Interface:
+ err = d.decodeBasic(name, input, outVal)
+ case reflect.String:
+ err = d.decodeString(name, input, outVal)
+ case reflect.Int:
+ err = d.decodeInt(name, input, outVal)
+ case reflect.Uint:
+ err = d.decodeUint(name, input, outVal)
+ case reflect.Float32:
+ err = d.decodeFloat(name, input, outVal)
+ case reflect.Struct:
+ err = d.decodeStruct(name, input, outVal)
+ case reflect.Map:
+ err = d.decodeMap(name, input, outVal)
+ case reflect.Ptr:
+ addMetaKey, err = d.decodePtr(name, input, outVal)
+ case reflect.Slice:
+ err = d.decodeSlice(name, input, outVal)
+ case reflect.Array:
+ err = d.decodeArray(name, input, outVal)
+ case reflect.Func:
+ err = d.decodeFunc(name, input, outVal)
+ default:
+ // If we reached this point then we weren't able to decode it
+ return fmt.Errorf("%s: unsupported type: %s", name, outputKind)
+ }
+
+ // If we reached here, then we successfully decoded SOMETHING, so
+ // mark the key as used if we're tracking metainput.
+ if addMetaKey && d.config.Metadata != nil && name != "" {
+ d.config.Metadata.Keys = append(d.config.Metadata.Keys, name)
+ }
+
+ return err
+}
+
+// This decodes a basic type (bool, int, string, etc.) and sets the
+// value to "data" of that type.
+func (d *Decoder) decodeBasic(name string, data interface{}, val reflect.Value) error {
+ if val.IsValid() && val.Elem().IsValid() {
+ elem := val.Elem()
+
+ // If we can't address this element, then its not writable. Instead,
+ // we make a copy of the value (which is a pointer and therefore
+ // writable), decode into that, and replace the whole value.
+ copied := false
+ if !elem.CanAddr() {
+ copied = true
+
+ // Make *T
+ copy := reflect.New(elem.Type())
+
+ // *T = elem
+ copy.Elem().Set(elem)
+
+ // Set elem so we decode into it
+ elem = copy
+ }
+
+ // Decode. If we have an error then return. We also return right
+ // away if we're not a copy because that means we decoded directly.
+ if err := d.decode(name, data, elem); err != nil || !copied {
+ return err
+ }
+
+ // If we're a copy, we need to set te final result
+ val.Set(elem.Elem())
+ return nil
+ }
+
+ dataVal := reflect.ValueOf(data)
+
+ // If the input data is a pointer, and the assigned type is the dereference
+ // of that exact pointer, then indirect it so that we can assign it.
+ // Example: *string to string
+ if dataVal.Kind() == reflect.Ptr && dataVal.Type().Elem() == val.Type() {
+ dataVal = reflect.Indirect(dataVal)
+ }
+
+ if !dataVal.IsValid() {
+ dataVal = reflect.Zero(val.Type())
+ }
+
+ dataValType := dataVal.Type()
+ if !dataValType.AssignableTo(val.Type()) {
+ return fmt.Errorf(
+ "'%s' expected type '%s', got '%s'",
+ name, val.Type(), dataValType)
+ }
+
+ val.Set(dataVal)
+ return nil
+}
+
+func (d *Decoder) decodeString(name string, data interface{}, val reflect.Value) error {
+ dataVal := reflect.Indirect(reflect.ValueOf(data))
+ dataKind := getKind(dataVal)
+
+ converted := true
+ switch {
+ case dataKind == reflect.String:
+ val.SetString(dataVal.String())
+ case dataKind == reflect.Bool && d.config.WeaklyTypedInput:
+ if dataVal.Bool() {
+ val.SetString("1")
+ } else {
+ val.SetString("0")
+ }
+ case dataKind == reflect.Int && d.config.WeaklyTypedInput:
+ val.SetString(strconv.FormatInt(dataVal.Int(), 10))
+ case dataKind == reflect.Uint && d.config.WeaklyTypedInput:
+ val.SetString(strconv.FormatUint(dataVal.Uint(), 10))
+ case dataKind == reflect.Float32 && d.config.WeaklyTypedInput:
+ val.SetString(strconv.FormatFloat(dataVal.Float(), 'f', -1, 64))
+ case dataKind == reflect.Slice && d.config.WeaklyTypedInput,
+ dataKind == reflect.Array && d.config.WeaklyTypedInput:
+ dataType := dataVal.Type()
+ elemKind := dataType.Elem().Kind()
+ switch elemKind {
+ case reflect.Uint8:
+ var uints []uint8
+ if dataKind == reflect.Array {
+ uints = make([]uint8, dataVal.Len(), dataVal.Len())
+ for i := range uints {
+ uints[i] = dataVal.Index(i).Interface().(uint8)
+ }
+ } else {
+ uints = dataVal.Interface().([]uint8)
+ }
+ val.SetString(string(uints))
+ default:
+ converted = false
+ }
+ default:
+ converted = false
+ }
+
+ if !converted {
+ return fmt.Errorf(
+ "'%s' expected type '%s', got unconvertible type '%s', value: '%v'",
+ name, val.Type(), dataVal.Type(), data)
+ }
+
+ return nil
+}
+
+func (d *Decoder) decodeInt(name string, data interface{}, val reflect.Value) error {
+ dataVal := reflect.Indirect(reflect.ValueOf(data))
+ dataKind := getKind(dataVal)
+ dataType := dataVal.Type()
+
+ switch {
+ case dataKind == reflect.Int:
+ val.SetInt(dataVal.Int())
+ case dataKind == reflect.Uint:
+ val.SetInt(int64(dataVal.Uint()))
+ case dataKind == reflect.Float32:
+ val.SetInt(int64(dataVal.Float()))
+ case dataKind == reflect.Bool && d.config.WeaklyTypedInput:
+ if dataVal.Bool() {
+ val.SetInt(1)
+ } else {
+ val.SetInt(0)
+ }
+ case dataKind == reflect.String && d.config.WeaklyTypedInput:
+ str := dataVal.String()
+ if str == "" {
+ str = "0"
+ }
+
+ i, err := strconv.ParseInt(str, 0, val.Type().Bits())
+ if err == nil {
+ val.SetInt(i)
+ } else {
+ return fmt.Errorf("cannot parse '%s' as int: %s", name, err)
+ }
+ case dataType.PkgPath() == "encoding/json" && dataType.Name() == "Number":
+ jn := data.(json.Number)
+ i, err := jn.Int64()
+ if err != nil {
+ return fmt.Errorf(
+ "error decoding json.Number into %s: %s", name, err)
+ }
+ val.SetInt(i)
+ default:
+ return fmt.Errorf(
+ "'%s' expected type '%s', got unconvertible type '%s', value: '%v'",
+ name, val.Type(), dataVal.Type(), data)
+ }
+
+ return nil
+}
+
+func (d *Decoder) decodeUint(name string, data interface{}, val reflect.Value) error {
+ dataVal := reflect.Indirect(reflect.ValueOf(data))
+ dataKind := getKind(dataVal)
+ dataType := dataVal.Type()
+
+ switch {
+ case dataKind == reflect.Int:
+ i := dataVal.Int()
+ if i < 0 && !d.config.WeaklyTypedInput {
+ return fmt.Errorf("cannot parse '%s', %d overflows uint",
+ name, i)
+ }
+ val.SetUint(uint64(i))
+ case dataKind == reflect.Uint:
+ val.SetUint(dataVal.Uint())
+ case dataKind == reflect.Float32:
+ f := dataVal.Float()
+ if f < 0 && !d.config.WeaklyTypedInput {
+ return fmt.Errorf("cannot parse '%s', %f overflows uint",
+ name, f)
+ }
+ val.SetUint(uint64(f))
+ case dataKind == reflect.Bool && d.config.WeaklyTypedInput:
+ if dataVal.Bool() {
+ val.SetUint(1)
+ } else {
+ val.SetUint(0)
+ }
+ case dataKind == reflect.String && d.config.WeaklyTypedInput:
+ str := dataVal.String()
+ if str == "" {
+ str = "0"
+ }
+
+ i, err := strconv.ParseUint(str, 0, val.Type().Bits())
+ if err == nil {
+ val.SetUint(i)
+ } else {
+ return fmt.Errorf("cannot parse '%s' as uint: %s", name, err)
+ }
+ case dataType.PkgPath() == "encoding/json" && dataType.Name() == "Number":
+ jn := data.(json.Number)
+ i, err := strconv.ParseUint(string(jn), 0, 64)
+ if err != nil {
+ return fmt.Errorf(
+ "error decoding json.Number into %s: %s", name, err)
+ }
+ val.SetUint(i)
+ default:
+ return fmt.Errorf(
+ "'%s' expected type '%s', got unconvertible type '%s', value: '%v'",
+ name, val.Type(), dataVal.Type(), data)
+ }
+
+ return nil
+}
+
+func (d *Decoder) decodeBool(name string, data interface{}, val reflect.Value) error {
+ dataVal := reflect.Indirect(reflect.ValueOf(data))
+ dataKind := getKind(dataVal)
+
+ switch {
+ case dataKind == reflect.Bool:
+ val.SetBool(dataVal.Bool())
+ case dataKind == reflect.Int && d.config.WeaklyTypedInput:
+ val.SetBool(dataVal.Int() != 0)
+ case dataKind == reflect.Uint && d.config.WeaklyTypedInput:
+ val.SetBool(dataVal.Uint() != 0)
+ case dataKind == reflect.Float32 && d.config.WeaklyTypedInput:
+ val.SetBool(dataVal.Float() != 0)
+ case dataKind == reflect.String && d.config.WeaklyTypedInput:
+ b, err := strconv.ParseBool(dataVal.String())
+ if err == nil {
+ val.SetBool(b)
+ } else if dataVal.String() == "" {
+ val.SetBool(false)
+ } else {
+ return fmt.Errorf("cannot parse '%s' as bool: %s", name, err)
+ }
+ default:
+ return fmt.Errorf(
+ "'%s' expected type '%s', got unconvertible type '%s', value: '%v'",
+ name, val.Type(), dataVal.Type(), data)
+ }
+
+ return nil
+}
+
+func (d *Decoder) decodeFloat(name string, data interface{}, val reflect.Value) error {
+ dataVal := reflect.Indirect(reflect.ValueOf(data))
+ dataKind := getKind(dataVal)
+ dataType := dataVal.Type()
+
+ switch {
+ case dataKind == reflect.Int:
+ val.SetFloat(float64(dataVal.Int()))
+ case dataKind == reflect.Uint:
+ val.SetFloat(float64(dataVal.Uint()))
+ case dataKind == reflect.Float32:
+ val.SetFloat(dataVal.Float())
+ case dataKind == reflect.Bool && d.config.WeaklyTypedInput:
+ if dataVal.Bool() {
+ val.SetFloat(1)
+ } else {
+ val.SetFloat(0)
+ }
+ case dataKind == reflect.String && d.config.WeaklyTypedInput:
+ str := dataVal.String()
+ if str == "" {
+ str = "0"
+ }
+
+ f, err := strconv.ParseFloat(str, val.Type().Bits())
+ if err == nil {
+ val.SetFloat(f)
+ } else {
+ return fmt.Errorf("cannot parse '%s' as float: %s", name, err)
+ }
+ case dataType.PkgPath() == "encoding/json" && dataType.Name() == "Number":
+ jn := data.(json.Number)
+ i, err := jn.Float64()
+ if err != nil {
+ return fmt.Errorf(
+ "error decoding json.Number into %s: %s", name, err)
+ }
+ val.SetFloat(i)
+ default:
+ return fmt.Errorf(
+ "'%s' expected type '%s', got unconvertible type '%s', value: '%v'",
+ name, val.Type(), dataVal.Type(), data)
+ }
+
+ return nil
+}
+
+func (d *Decoder) decodeMap(name string, data interface{}, val reflect.Value) error {
+ valType := val.Type()
+ valKeyType := valType.Key()
+ valElemType := valType.Elem()
+
+ // By default we overwrite keys in the current map
+ valMap := val
+
+ // If the map is nil or we're purposely zeroing fields, make a new map
+ if valMap.IsNil() || d.config.ZeroFields {
+ // Make a new map to hold our result
+ mapType := reflect.MapOf(valKeyType, valElemType)
+ valMap = reflect.MakeMap(mapType)
+ }
+
+ // Check input type and based on the input type jump to the proper func
+ dataVal := reflect.Indirect(reflect.ValueOf(data))
+ switch dataVal.Kind() {
+ case reflect.Map:
+ return d.decodeMapFromMap(name, dataVal, val, valMap)
+
+ case reflect.Struct:
+ return d.decodeMapFromStruct(name, dataVal, val, valMap)
+
+ case reflect.Array, reflect.Slice:
+ if d.config.WeaklyTypedInput {
+ return d.decodeMapFromSlice(name, dataVal, val, valMap)
+ }
+
+ fallthrough
+
+ default:
+ return fmt.Errorf("'%s' expected a map, got '%s'", name, dataVal.Kind())
+ }
+}
+
+func (d *Decoder) decodeMapFromSlice(name string, dataVal reflect.Value, val reflect.Value, valMap reflect.Value) error {
+ // Special case for BC reasons (covered by tests)
+ if dataVal.Len() == 0 {
+ val.Set(valMap)
+ return nil
+ }
+
+ for i := 0; i < dataVal.Len(); i++ {
+ err := d.decode(
+ name+"["+strconv.Itoa(i)+"]",
+ dataVal.Index(i).Interface(), val)
+ if err != nil {
+ return err
+ }
+ }
+
+ return nil
+}
+
+func (d *Decoder) decodeMapFromMap(name string, dataVal reflect.Value, val reflect.Value, valMap reflect.Value) error {
+ valType := val.Type()
+ valKeyType := valType.Key()
+ valElemType := valType.Elem()
+
+ // Accumulate errors
+ errors := make([]string, 0)
+
+ // If the input data is empty, then we just match what the input data is.
+ if dataVal.Len() == 0 {
+ if dataVal.IsNil() {
+ if !val.IsNil() {
+ val.Set(dataVal)
+ }
+ } else {
+ // Set to empty allocated value
+ val.Set(valMap)
+ }
+
+ return nil
+ }
+
+ for _, k := range dataVal.MapKeys() {
+ fieldName := name + "[" + k.String() + "]"
+
+ // First decode the key into the proper type
+ currentKey := reflect.Indirect(reflect.New(valKeyType))
+ if err := d.decode(fieldName, k.Interface(), currentKey); err != nil {
+ errors = appendErrors(errors, err)
+ continue
+ }
+
+ // Next decode the data into the proper type
+ v := dataVal.MapIndex(k).Interface()
+ currentVal := reflect.Indirect(reflect.New(valElemType))
+ if err := d.decode(fieldName, v, currentVal); err != nil {
+ errors = appendErrors(errors, err)
+ continue
+ }
+
+ valMap.SetMapIndex(currentKey, currentVal)
+ }
+
+ // Set the built up map to the value
+ val.Set(valMap)
+
+ // If we had errors, return those
+ if len(errors) > 0 {
+ return &Error{errors}
+ }
+
+ return nil
+}
+
+func (d *Decoder) decodeMapFromStruct(name string, dataVal reflect.Value, val reflect.Value, valMap reflect.Value) error {
+ typ := dataVal.Type()
+ for i := 0; i < typ.NumField(); i++ {
+ // Get the StructField first since this is a cheap operation. If the
+ // field is unexported, then ignore it.
+ f := typ.Field(i)
+ if f.PkgPath != "" {
+ continue
+ }
+
+ // Next get the actual value of this field and verify it is assignable
+ // to the map value.
+ v := dataVal.Field(i)
+ if !v.Type().AssignableTo(valMap.Type().Elem()) {
+ return fmt.Errorf("cannot assign type '%s' to map value field of type '%s'", v.Type(), valMap.Type().Elem())
+ }
+
+ tagValue := f.Tag.Get(d.config.TagName)
+ keyName := f.Name
+
+ if tagValue == "" && d.config.IgnoreUntaggedFields {
+ continue
+ }
+
+ // If Squash is set in the config, we squash the field down.
+ squash := d.config.Squash && v.Kind() == reflect.Struct && f.Anonymous
+
+ v = dereferencePtrToStructIfNeeded(v, d.config.TagName)
+
+ // Determine the name of the key in the map
+ if index := strings.Index(tagValue, ","); index != -1 {
+ if tagValue[:index] == "-" {
+ continue
+ }
+ // If "omitempty" is specified in the tag, it ignores empty values.
+ if strings.Index(tagValue[index+1:], "omitempty") != -1 && isEmptyValue(v) {
+ continue
+ }
+
+ // If "squash" is specified in the tag, we squash the field down.
+ squash = squash || strings.Index(tagValue[index+1:], "squash") != -1
+ if squash {
+ // When squashing, the embedded type can be a pointer to a struct.
+ if v.Kind() == reflect.Ptr && v.Elem().Kind() == reflect.Struct {
+ v = v.Elem()
+ }
+
+ // The final type must be a struct
+ if v.Kind() != reflect.Struct {
+ return fmt.Errorf("cannot squash non-struct type '%s'", v.Type())
+ }
+ }
+ if keyNameTagValue := tagValue[:index]; keyNameTagValue != "" {
+ keyName = keyNameTagValue
+ }
+ } else if len(tagValue) > 0 {
+ if tagValue == "-" {
+ continue
+ }
+ keyName = tagValue
+ }
+
+ switch v.Kind() {
+ // this is an embedded struct, so handle it differently
+ case reflect.Struct:
+ x := reflect.New(v.Type())
+ x.Elem().Set(v)
+
+ vType := valMap.Type()
+ vKeyType := vType.Key()
+ vElemType := vType.Elem()
+ mType := reflect.MapOf(vKeyType, vElemType)
+ vMap := reflect.MakeMap(mType)
+
+ // Creating a pointer to a map so that other methods can completely
+ // overwrite the map if need be (looking at you decodeMapFromMap). The
+ // indirection allows the underlying map to be settable (CanSet() == true)
+ // where as reflect.MakeMap returns an unsettable map.
+ addrVal := reflect.New(vMap.Type())
+ reflect.Indirect(addrVal).Set(vMap)
+
+ err := d.decode(keyName, x.Interface(), reflect.Indirect(addrVal))
+ if err != nil {
+ return err
+ }
+
+ // the underlying map may have been completely overwritten so pull
+ // it indirectly out of the enclosing value.
+ vMap = reflect.Indirect(addrVal)
+
+ if squash {
+ for _, k := range vMap.MapKeys() {
+ valMap.SetMapIndex(k, vMap.MapIndex(k))
+ }
+ } else {
+ valMap.SetMapIndex(reflect.ValueOf(keyName), vMap)
+ }
+
+ default:
+ valMap.SetMapIndex(reflect.ValueOf(keyName), v)
+ }
+ }
+
+ if val.CanAddr() {
+ val.Set(valMap)
+ }
+
+ return nil
+}
+
+func (d *Decoder) decodePtr(name string, data interface{}, val reflect.Value) (bool, error) {
+ // If the input data is nil, then we want to just set the output
+ // pointer to be nil as well.
+ isNil := data == nil
+ if !isNil {
+ switch v := reflect.Indirect(reflect.ValueOf(data)); v.Kind() {
+ case reflect.Chan,
+ reflect.Func,
+ reflect.Interface,
+ reflect.Map,
+ reflect.Ptr,
+ reflect.Slice:
+ isNil = v.IsNil()
+ }
+ }
+ if isNil {
+ if !val.IsNil() && val.CanSet() {
+ nilValue := reflect.New(val.Type()).Elem()
+ val.Set(nilValue)
+ }
+
+ return true, nil
+ }
+
+ // Create an element of the concrete (non pointer) type and decode
+ // into that. Then set the value of the pointer to this type.
+ valType := val.Type()
+ valElemType := valType.Elem()
+ if val.CanSet() {
+ realVal := val
+ if realVal.IsNil() || d.config.ZeroFields {
+ realVal = reflect.New(valElemType)
+ }
+
+ if err := d.decode(name, data, reflect.Indirect(realVal)); err != nil {
+ return false, err
+ }
+
+ val.Set(realVal)
+ } else {
+ if err := d.decode(name, data, reflect.Indirect(val)); err != nil {
+ return false, err
+ }
+ }
+ return false, nil
+}
+
+func (d *Decoder) decodeFunc(name string, data interface{}, val reflect.Value) error {
+ // Create an element of the concrete (non pointer) type and decode
+ // into that. Then set the value of the pointer to this type.
+ dataVal := reflect.Indirect(reflect.ValueOf(data))
+ if val.Type() != dataVal.Type() {
+ return fmt.Errorf(
+ "'%s' expected type '%s', got unconvertible type '%s', value: '%v'",
+ name, val.Type(), dataVal.Type(), data)
+ }
+ val.Set(dataVal)
+ return nil
+}
+
+func (d *Decoder) decodeSlice(name string, data interface{}, val reflect.Value) error {
+ dataVal := reflect.Indirect(reflect.ValueOf(data))
+ dataValKind := dataVal.Kind()
+ valType := val.Type()
+ valElemType := valType.Elem()
+ sliceType := reflect.SliceOf(valElemType)
+
+ // If we have a non array/slice type then we first attempt to convert.
+ if dataValKind != reflect.Array && dataValKind != reflect.Slice {
+ if d.config.WeaklyTypedInput {
+ switch {
+ // Slice and array we use the normal logic
+ case dataValKind == reflect.Slice, dataValKind == reflect.Array:
+ break
+
+ // Empty maps turn into empty slices
+ case dataValKind == reflect.Map:
+ if dataVal.Len() == 0 {
+ val.Set(reflect.MakeSlice(sliceType, 0, 0))
+ return nil
+ }
+ // Create slice of maps of other sizes
+ return d.decodeSlice(name, []interface{}{data}, val)
+
+ case dataValKind == reflect.String && valElemType.Kind() == reflect.Uint8:
+ return d.decodeSlice(name, []byte(dataVal.String()), val)
+
+ // All other types we try to convert to the slice type
+ // and "lift" it into it. i.e. a string becomes a string slice.
+ default:
+ // Just re-try this function with data as a slice.
+ return d.decodeSlice(name, []interface{}{data}, val)
+ }
+ }
+
+ return fmt.Errorf(
+ "'%s': source data must be an array or slice, got %s", name, dataValKind)
+ }
+
+ // If the input value is nil, then don't allocate since empty != nil
+ if dataValKind != reflect.Array && dataVal.IsNil() {
+ return nil
+ }
+
+ valSlice := val
+ if valSlice.IsNil() || d.config.ZeroFields {
+ // Make a new slice to hold our result, same size as the original data.
+ valSlice = reflect.MakeSlice(sliceType, dataVal.Len(), dataVal.Len())
+ }
+
+ // Accumulate any errors
+ errors := make([]string, 0)
+
+ for i := 0; i < dataVal.Len(); i++ {
+ currentData := dataVal.Index(i).Interface()
+ for valSlice.Len() <= i {
+ valSlice = reflect.Append(valSlice, reflect.Zero(valElemType))
+ }
+ currentField := valSlice.Index(i)
+
+ fieldName := name + "[" + strconv.Itoa(i) + "]"
+ if err := d.decode(fieldName, currentData, currentField); err != nil {
+ errors = appendErrors(errors, err)
+ }
+ }
+
+ // Finally, set the value to the slice we built up
+ val.Set(valSlice)
+
+ // If there were errors, we return those
+ if len(errors) > 0 {
+ return &Error{errors}
+ }
+
+ return nil
+}
+
+func (d *Decoder) decodeArray(name string, data interface{}, val reflect.Value) error {
+ dataVal := reflect.Indirect(reflect.ValueOf(data))
+ dataValKind := dataVal.Kind()
+ valType := val.Type()
+ valElemType := valType.Elem()
+ arrayType := reflect.ArrayOf(valType.Len(), valElemType)
+
+ valArray := val
+
+ if valArray.Interface() == reflect.Zero(valArray.Type()).Interface() || d.config.ZeroFields {
+ // Check input type
+ if dataValKind != reflect.Array && dataValKind != reflect.Slice {
+ if d.config.WeaklyTypedInput {
+ switch {
+ // Empty maps turn into empty arrays
+ case dataValKind == reflect.Map:
+ if dataVal.Len() == 0 {
+ val.Set(reflect.Zero(arrayType))
+ return nil
+ }
+
+ // All other types we try to convert to the array type
+ // and "lift" it into it. i.e. a string becomes a string array.
+ default:
+ // Just re-try this function with data as a slice.
+ return d.decodeArray(name, []interface{}{data}, val)
+ }
+ }
+
+ return fmt.Errorf(
+ "'%s': source data must be an array or slice, got %s", name, dataValKind)
+
+ }
+ if dataVal.Len() > arrayType.Len() {
+ return fmt.Errorf(
+ "'%s': expected source data to have length less or equal to %d, got %d", name, arrayType.Len(), dataVal.Len())
+
+ }
+
+ // Make a new array to hold our result, same size as the original data.
+ valArray = reflect.New(arrayType).Elem()
+ }
+
+ // Accumulate any errors
+ errors := make([]string, 0)
+
+ for i := 0; i < dataVal.Len(); i++ {
+ currentData := dataVal.Index(i).Interface()
+ currentField := valArray.Index(i)
+
+ fieldName := name + "[" + strconv.Itoa(i) + "]"
+ if err := d.decode(fieldName, currentData, currentField); err != nil {
+ errors = appendErrors(errors, err)
+ }
+ }
+
+ // Finally, set the value to the array we built up
+ val.Set(valArray)
+
+ // If there were errors, we return those
+ if len(errors) > 0 {
+ return &Error{errors}
+ }
+
+ return nil
+}
+
+func (d *Decoder) decodeStruct(name string, data interface{}, val reflect.Value) error {
+ dataVal := reflect.Indirect(reflect.ValueOf(data))
+
+ // If the type of the value to write to and the data match directly,
+ // then we just set it directly instead of recursing into the structure.
+ if dataVal.Type() == val.Type() {
+ val.Set(dataVal)
+ return nil
+ }
+
+ dataValKind := dataVal.Kind()
+ switch dataValKind {
+ case reflect.Map:
+ return d.decodeStructFromMap(name, dataVal, val)
+
+ case reflect.Struct:
+ // Not the most efficient way to do this but we can optimize later if
+ // we want to. To convert from struct to struct we go to map first
+ // as an intermediary.
+
+ // Make a new map to hold our result
+ mapType := reflect.TypeOf((map[string]interface{})(nil))
+ mval := reflect.MakeMap(mapType)
+
+ // Creating a pointer to a map so that other methods can completely
+ // overwrite the map if need be (looking at you decodeMapFromMap). The
+ // indirection allows the underlying map to be settable (CanSet() == true)
+ // where as reflect.MakeMap returns an unsettable map.
+ addrVal := reflect.New(mval.Type())
+
+ reflect.Indirect(addrVal).Set(mval)
+ if err := d.decodeMapFromStruct(name, dataVal, reflect.Indirect(addrVal), mval); err != nil {
+ return err
+ }
+
+ result := d.decodeStructFromMap(name, reflect.Indirect(addrVal), val)
+ return result
+
+ default:
+ return fmt.Errorf("'%s' expected a map, got '%s'", name, dataVal.Kind())
+ }
+}
+
+func (d *Decoder) decodeStructFromMap(name string, dataVal, val reflect.Value) error {
+ dataValType := dataVal.Type()
+ if kind := dataValType.Key().Kind(); kind != reflect.String && kind != reflect.Interface {
+ return fmt.Errorf(
+ "'%s' needs a map with string keys, has '%s' keys",
+ name, dataValType.Key().Kind())
+ }
+
+ dataValKeys := make(map[reflect.Value]struct{})
+ dataValKeysUnused := make(map[interface{}]struct{})
+ for _, dataValKey := range dataVal.MapKeys() {
+ dataValKeys[dataValKey] = struct{}{}
+ dataValKeysUnused[dataValKey.Interface()] = struct{}{}
+ }
+
+ targetValKeysUnused := make(map[interface{}]struct{})
+ errors := make([]string, 0)
+
+ // This slice will keep track of all the structs we'll be decoding.
+ // There can be more than one struct if there are embedded structs
+ // that are squashed.
+ structs := make([]reflect.Value, 1, 5)
+ structs[0] = val
+
+ // Compile the list of all the fields that we're going to be decoding
+ // from all the structs.
+ type field struct {
+ field reflect.StructField
+ val reflect.Value
+ }
+
+ // remainField is set to a valid field set with the "remain" tag if
+ // we are keeping track of remaining values.
+ var remainField *field
+
+ fields := []field{}
+ for len(structs) > 0 {
+ structVal := structs[0]
+ structs = structs[1:]
+
+ structType := structVal.Type()
+
+ for i := 0; i < structType.NumField(); i++ {
+ fieldType := structType.Field(i)
+ fieldVal := structVal.Field(i)
+ if fieldVal.Kind() == reflect.Ptr && fieldVal.Elem().Kind() == reflect.Struct {
+ // Handle embedded struct pointers as embedded structs.
+ fieldVal = fieldVal.Elem()
+ }
+
+ // If "squash" is specified in the tag, we squash the field down.
+ squash := d.config.Squash && fieldVal.Kind() == reflect.Struct && fieldType.Anonymous
+ remain := false
+
+ // We always parse the tags cause we're looking for other tags too
+ tagParts := strings.Split(fieldType.Tag.Get(d.config.TagName), ",")
+ for _, tag := range tagParts[1:] {
+ if tag == "squash" {
+ squash = true
+ break
+ }
+
+ if tag == "remain" {
+ remain = true
+ break
+ }
+ }
+
+ if squash {
+ if fieldVal.Kind() != reflect.Struct {
+ errors = appendErrors(errors,
+ fmt.Errorf("%s: unsupported type for squash: %s", fieldType.Name, fieldVal.Kind()))
+ } else {
+ structs = append(structs, fieldVal)
+ }
+ continue
+ }
+
+ // Build our field
+ if remain {
+ remainField = &field{fieldType, fieldVal}
+ } else {
+ // Normal struct field, store it away
+ fields = append(fields, field{fieldType, fieldVal})
+ }
+ }
+ }
+
+ // for fieldType, field := range fields {
+ for _, f := range fields {
+ field, fieldValue := f.field, f.val
+ fieldName := field.Name
+
+ tagValue := field.Tag.Get(d.config.TagName)
+ tagValue = strings.SplitN(tagValue, ",", 2)[0]
+ if tagValue != "" {
+ fieldName = tagValue
+ }
+
+ rawMapKey := reflect.ValueOf(fieldName)
+ rawMapVal := dataVal.MapIndex(rawMapKey)
+ if !rawMapVal.IsValid() {
+ // Do a slower search by iterating over each key and
+ // doing case-insensitive search.
+ for dataValKey := range dataValKeys {
+ mK, ok := dataValKey.Interface().(string)
+ if !ok {
+ // Not a string key
+ continue
+ }
+
+ if d.config.MatchName(mK, fieldName) {
+ rawMapKey = dataValKey
+ rawMapVal = dataVal.MapIndex(dataValKey)
+ break
+ }
+ }
+
+ if !rawMapVal.IsValid() {
+ // There was no matching key in the map for the value in
+ // the struct. Remember it for potential errors and metadata.
+ targetValKeysUnused[fieldName] = struct{}{}
+ continue
+ }
+ }
+
+ if !fieldValue.IsValid() {
+ // This should never happen
+ panic("field is not valid")
+ }
+
+ // If we can't set the field, then it is unexported or something,
+ // and we just continue onwards.
+ if !fieldValue.CanSet() {
+ continue
+ }
+
+ // Delete the key we're using from the unused map so we stop tracking
+ delete(dataValKeysUnused, rawMapKey.Interface())
+
+ // If the name is empty string, then we're at the root, and we
+ // don't dot-join the fields.
+ if name != "" {
+ fieldName = name + "." + fieldName
+ }
+
+ if err := d.decode(fieldName, rawMapVal.Interface(), fieldValue); err != nil {
+ errors = appendErrors(errors, err)
+ }
+ }
+
+ // If we have a "remain"-tagged field and we have unused keys then
+ // we put the unused keys directly into the remain field.
+ if remainField != nil && len(dataValKeysUnused) > 0 {
+ // Build a map of only the unused values
+ remain := map[interface{}]interface{}{}
+ for key := range dataValKeysUnused {
+ remain[key] = dataVal.MapIndex(reflect.ValueOf(key)).Interface()
+ }
+
+ // Decode it as-if we were just decoding this map onto our map.
+ if err := d.decodeMap(name, remain, remainField.val); err != nil {
+ errors = appendErrors(errors, err)
+ }
+
+ // Set the map to nil so we have none so that the next check will
+ // not error (ErrorUnused)
+ dataValKeysUnused = nil
+ }
+
+ if d.config.ErrorUnused && len(dataValKeysUnused) > 0 {
+ keys := make([]string, 0, len(dataValKeysUnused))
+ for rawKey := range dataValKeysUnused {
+ keys = append(keys, rawKey.(string))
+ }
+ sort.Strings(keys)
+
+ err := fmt.Errorf("'%s' has invalid keys: %s", name, strings.Join(keys, ", "))
+ errors = appendErrors(errors, err)
+ }
+
+ if d.config.ErrorUnset && len(targetValKeysUnused) > 0 {
+ keys := make([]string, 0, len(targetValKeysUnused))
+ for rawKey := range targetValKeysUnused {
+ keys = append(keys, rawKey.(string))
+ }
+ sort.Strings(keys)
+
+ err := fmt.Errorf("'%s' has unset fields: %s", name, strings.Join(keys, ", "))
+ errors = appendErrors(errors, err)
+ }
+
+ if len(errors) > 0 {
+ return &Error{errors}
+ }
+
+ // Add the unused keys to the list of unused keys if we're tracking metadata
+ if d.config.Metadata != nil {
+ for rawKey := range dataValKeysUnused {
+ key := rawKey.(string)
+ if name != "" {
+ key = name + "." + key
+ }
+
+ d.config.Metadata.Unused = append(d.config.Metadata.Unused, key)
+ }
+ for rawKey := range targetValKeysUnused {
+ key := rawKey.(string)
+ if name != "" {
+ key = name + "." + key
+ }
+
+ d.config.Metadata.Unset = append(d.config.Metadata.Unset, key)
+ }
+ }
+
+ return nil
+}
+
+func isEmptyValue(v reflect.Value) bool {
+ switch getKind(v) {
+ case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
+ return v.Len() == 0
+ case reflect.Bool:
+ return !v.Bool()
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ return v.Int() == 0
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
+ return v.Uint() == 0
+ case reflect.Float32, reflect.Float64:
+ return v.Float() == 0
+ case reflect.Interface, reflect.Ptr:
+ return v.IsNil()
+ }
+ return false
+}
+
+func getKind(val reflect.Value) reflect.Kind {
+ kind := val.Kind()
+
+ switch {
+ case kind >= reflect.Int && kind <= reflect.Int64:
+ return reflect.Int
+ case kind >= reflect.Uint && kind <= reflect.Uint64:
+ return reflect.Uint
+ case kind >= reflect.Float32 && kind <= reflect.Float64:
+ return reflect.Float32
+ default:
+ return kind
+ }
+}
+
+func isStructTypeConvertibleToMap(typ reflect.Type, checkMapstructureTags bool, tagName string) bool {
+ for i := 0; i < typ.NumField(); i++ {
+ f := typ.Field(i)
+ if f.PkgPath == "" && !checkMapstructureTags { // check for unexported fields
+ return true
+ }
+ if checkMapstructureTags && f.Tag.Get(tagName) != "" { // check for mapstructure tags inside
+ return true
+ }
+ }
+ return false
+}
+
+func dereferencePtrToStructIfNeeded(v reflect.Value, tagName string) reflect.Value {
+ if v.Kind() != reflect.Ptr || v.Elem().Kind() != reflect.Struct {
+ return v
+ }
+ deref := v.Elem()
+ derefT := deref.Type()
+ if isStructTypeConvertibleToMap(derefT, true, tagName) {
+ return deref
+ }
+ return v
+}
diff --git a/vendor/github.com/modern-go/reflect2/.travis.yml b/vendor/github.com/modern-go/reflect2/.travis.yml
index fbb43744d9..b097728dbf 100644
--- a/vendor/github.com/modern-go/reflect2/.travis.yml
+++ b/vendor/github.com/modern-go/reflect2/.travis.yml
@@ -1,7 +1,7 @@
language: go
go:
- - 1.8.x
+ - 1.9.x
- 1.x
before_install:
diff --git a/vendor/github.com/modern-go/reflect2/Gopkg.lock b/vendor/github.com/modern-go/reflect2/Gopkg.lock
index 2a3a69893b..10ef811182 100644
--- a/vendor/github.com/modern-go/reflect2/Gopkg.lock
+++ b/vendor/github.com/modern-go/reflect2/Gopkg.lock
@@ -1,15 +1,9 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
-[[projects]]
- name = "github.com/modern-go/concurrent"
- packages = ["."]
- revision = "e0a39a4cb4216ea8db28e22a69f4ec25610d513a"
- version = "1.0.0"
-
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
- inputs-digest = "daee8a88b3498b61c5640056665b8b9eea062006f5e596bbb6a3ed9119a11ec7"
+ input-imports = []
solver-name = "gps-cdcl"
solver-version = 1
diff --git a/vendor/github.com/modern-go/reflect2/Gopkg.toml b/vendor/github.com/modern-go/reflect2/Gopkg.toml
index 2f4f4dbdcc..a9bc5061b0 100644
--- a/vendor/github.com/modern-go/reflect2/Gopkg.toml
+++ b/vendor/github.com/modern-go/reflect2/Gopkg.toml
@@ -26,10 +26,6 @@
ignored = []
-[[constraint]]
- name = "github.com/modern-go/concurrent"
- version = "1.0.0"
-
[prune]
go-tests = true
unused-packages = true
diff --git a/vendor/github.com/modern-go/reflect2/go_above_118.go b/vendor/github.com/modern-go/reflect2/go_above_118.go
new file mode 100644
index 0000000000..2b4116f6c9
--- /dev/null
+++ b/vendor/github.com/modern-go/reflect2/go_above_118.go
@@ -0,0 +1,23 @@
+//+build go1.18
+
+package reflect2
+
+import (
+ "unsafe"
+)
+
+// m escapes into the return value, but the caller of mapiterinit
+// doesn't let the return value escape.
+//go:noescape
+//go:linkname mapiterinit reflect.mapiterinit
+func mapiterinit(rtype unsafe.Pointer, m unsafe.Pointer, it *hiter)
+
+func (type2 *UnsafeMapType) UnsafeIterate(obj unsafe.Pointer) MapIterator {
+ var it hiter
+ mapiterinit(type2.rtype, *(*unsafe.Pointer)(obj), &it)
+ return &UnsafeMapIterator{
+ hiter: &it,
+ pKeyRType: type2.pKeyRType,
+ pElemRType: type2.pElemRType,
+ }
+}
\ No newline at end of file
diff --git a/vendor/github.com/modern-go/reflect2/go_above_17.go b/vendor/github.com/modern-go/reflect2/go_above_17.go
deleted file mode 100644
index 5c1cea8683..0000000000
--- a/vendor/github.com/modern-go/reflect2/go_above_17.go
+++ /dev/null
@@ -1,8 +0,0 @@
-//+build go1.7
-
-package reflect2
-
-import "unsafe"
-
-//go:linkname resolveTypeOff reflect.resolveTypeOff
-func resolveTypeOff(rtype unsafe.Pointer, off int32) unsafe.Pointer
diff --git a/vendor/github.com/modern-go/reflect2/go_above_19.go b/vendor/github.com/modern-go/reflect2/go_above_19.go
index c7e3b78011..974f7685e4 100644
--- a/vendor/github.com/modern-go/reflect2/go_above_19.go
+++ b/vendor/github.com/modern-go/reflect2/go_above_19.go
@@ -6,6 +6,9 @@ import (
"unsafe"
)
+//go:linkname resolveTypeOff reflect.resolveTypeOff
+func resolveTypeOff(rtype unsafe.Pointer, off int32) unsafe.Pointer
+
//go:linkname makemap reflect.makemap
func makemap(rtype unsafe.Pointer, cap int) (m unsafe.Pointer)
diff --git a/vendor/github.com/modern-go/reflect2/go_below_118.go b/vendor/github.com/modern-go/reflect2/go_below_118.go
new file mode 100644
index 0000000000..00003dbd7c
--- /dev/null
+++ b/vendor/github.com/modern-go/reflect2/go_below_118.go
@@ -0,0 +1,21 @@
+//+build !go1.18
+
+package reflect2
+
+import (
+ "unsafe"
+)
+
+// m escapes into the return value, but the caller of mapiterinit
+// doesn't let the return value escape.
+//go:noescape
+//go:linkname mapiterinit reflect.mapiterinit
+func mapiterinit(rtype unsafe.Pointer, m unsafe.Pointer) (val *hiter)
+
+func (type2 *UnsafeMapType) UnsafeIterate(obj unsafe.Pointer) MapIterator {
+ return &UnsafeMapIterator{
+ hiter: mapiterinit(type2.rtype, *(*unsafe.Pointer)(obj)),
+ pKeyRType: type2.pKeyRType,
+ pElemRType: type2.pElemRType,
+ }
+}
\ No newline at end of file
diff --git a/vendor/github.com/modern-go/reflect2/go_below_17.go b/vendor/github.com/modern-go/reflect2/go_below_17.go
deleted file mode 100644
index 65a93c889b..0000000000
--- a/vendor/github.com/modern-go/reflect2/go_below_17.go
+++ /dev/null
@@ -1,9 +0,0 @@
-//+build !go1.7
-
-package reflect2
-
-import "unsafe"
-
-func resolveTypeOff(rtype unsafe.Pointer, off int32) unsafe.Pointer {
- return nil
-}
diff --git a/vendor/github.com/modern-go/reflect2/go_below_19.go b/vendor/github.com/modern-go/reflect2/go_below_19.go
deleted file mode 100644
index b050ef70cd..0000000000
--- a/vendor/github.com/modern-go/reflect2/go_below_19.go
+++ /dev/null
@@ -1,14 +0,0 @@
-//+build !go1.9
-
-package reflect2
-
-import (
- "unsafe"
-)
-
-//go:linkname makemap reflect.makemap
-func makemap(rtype unsafe.Pointer) (m unsafe.Pointer)
-
-func makeMapWithSize(rtype unsafe.Pointer, cap int) unsafe.Pointer {
- return makemap(rtype)
-}
diff --git a/vendor/github.com/modern-go/reflect2/reflect2.go b/vendor/github.com/modern-go/reflect2/reflect2.go
index 63b49c7991..c43c8b9d62 100644
--- a/vendor/github.com/modern-go/reflect2/reflect2.go
+++ b/vendor/github.com/modern-go/reflect2/reflect2.go
@@ -1,8 +1,9 @@
package reflect2
import (
- "github.com/modern-go/concurrent"
"reflect"
+ "runtime"
+ "sync"
"unsafe"
)
@@ -130,13 +131,13 @@ var ConfigSafe = Config{UseSafeImplementation: true}.Froze()
type frozenConfig struct {
useSafeImplementation bool
- cache *concurrent.Map
+ cache *sync.Map
}
func (cfg Config) Froze() *frozenConfig {
return &frozenConfig{
useSafeImplementation: cfg.UseSafeImplementation,
- cache: concurrent.NewMap(),
+ cache: new(sync.Map),
}
}
@@ -288,11 +289,12 @@ func NoEscape(p unsafe.Pointer) unsafe.Pointer {
}
func UnsafeCastString(str string) []byte {
+ bytes := make([]byte, 0)
stringHeader := (*reflect.StringHeader)(unsafe.Pointer(&str))
- sliceHeader := &reflect.SliceHeader{
- Data: stringHeader.Data,
- Cap: stringHeader.Len,
- Len: stringHeader.Len,
- }
- return *(*[]byte)(unsafe.Pointer(sliceHeader))
+ sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&bytes))
+ sliceHeader.Data = stringHeader.Data
+ sliceHeader.Cap = stringHeader.Len
+ sliceHeader.Len = stringHeader.Len
+ runtime.KeepAlive(str)
+ return bytes
}
diff --git a/vendor/github.com/modern-go/reflect2/test.sh b/vendor/github.com/modern-go/reflect2/test.sh
deleted file mode 100644
index 3d2b9768ce..0000000000
--- a/vendor/github.com/modern-go/reflect2/test.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-echo "" > coverage.txt
-
-for d in $(go list github.com/modern-go/reflect2-tests/... | grep -v vendor); do
- go test -coverprofile=profile.out -coverpkg=github.com/modern-go/reflect2 $d
- if [ -f profile.out ]; then
- cat profile.out >> coverage.txt
- rm profile.out
- fi
-done
diff --git a/vendor/github.com/modern-go/reflect2/type_map.go b/vendor/github.com/modern-go/reflect2/type_map.go
index 3acfb55803..4b13c3155c 100644
--- a/vendor/github.com/modern-go/reflect2/type_map.go
+++ b/vendor/github.com/modern-go/reflect2/type_map.go
@@ -1,17 +1,13 @@
+// +build !gccgo
+
package reflect2
import (
"reflect"
- "runtime"
- "strings"
"sync"
"unsafe"
)
-// typelinks1 for 1.5 ~ 1.6
-//go:linkname typelinks1 reflect.typelinks
-func typelinks1() [][]unsafe.Pointer
-
// typelinks2 for 1.7 ~
//go:linkname typelinks2 reflect.typelinks
func typelinks2() (sections []unsafe.Pointer, offset [][]int32)
@@ -27,49 +23,10 @@ func discoverTypes() {
types = make(map[string]reflect.Type)
packages = make(map[string]map[string]reflect.Type)
- ver := runtime.Version()
- if ver == "go1.5" || strings.HasPrefix(ver, "go1.5.") {
- loadGo15Types()
- } else if ver == "go1.6" || strings.HasPrefix(ver, "go1.6.") {
- loadGo15Types()
- } else {
- loadGo17Types()
- }
-}
-
-func loadGo15Types() {
- var obj interface{} = reflect.TypeOf(0)
- typePtrss := typelinks1()
- for _, typePtrs := range typePtrss {
- for _, typePtr := range typePtrs {
- (*emptyInterface)(unsafe.Pointer(&obj)).word = typePtr
- typ := obj.(reflect.Type)
- if typ.Kind() == reflect.Ptr && typ.Elem().Kind() == reflect.Struct {
- loadedType := typ.Elem()
- pkgTypes := packages[loadedType.PkgPath()]
- if pkgTypes == nil {
- pkgTypes = map[string]reflect.Type{}
- packages[loadedType.PkgPath()] = pkgTypes
- }
- types[loadedType.String()] = loadedType
- pkgTypes[loadedType.Name()] = loadedType
- }
- if typ.Kind() == reflect.Slice && typ.Elem().Kind() == reflect.Ptr &&
- typ.Elem().Elem().Kind() == reflect.Struct {
- loadedType := typ.Elem().Elem()
- pkgTypes := packages[loadedType.PkgPath()]
- if pkgTypes == nil {
- pkgTypes = map[string]reflect.Type{}
- packages[loadedType.PkgPath()] = pkgTypes
- }
- types[loadedType.String()] = loadedType
- pkgTypes[loadedType.Name()] = loadedType
- }
- }
- }
+ loadGoTypes()
}
-func loadGo17Types() {
+func loadGoTypes() {
var obj interface{} = reflect.TypeOf(0)
sections, offset := typelinks2()
for i, offs := range offset {
diff --git a/vendor/github.com/modern-go/reflect2/unsafe_link.go b/vendor/github.com/modern-go/reflect2/unsafe_link.go
index 57229c8db4..b49f614efc 100644
--- a/vendor/github.com/modern-go/reflect2/unsafe_link.go
+++ b/vendor/github.com/modern-go/reflect2/unsafe_link.go
@@ -19,18 +19,12 @@ func typedslicecopy(elemType unsafe.Pointer, dst, src sliceHeader) int
//go:linkname mapassign reflect.mapassign
//go:noescape
-func mapassign(rtype unsafe.Pointer, m unsafe.Pointer, key, val unsafe.Pointer)
+func mapassign(rtype unsafe.Pointer, m unsafe.Pointer, key unsafe.Pointer, val unsafe.Pointer)
//go:linkname mapaccess reflect.mapaccess
//go:noescape
func mapaccess(rtype unsafe.Pointer, m unsafe.Pointer, key unsafe.Pointer) (val unsafe.Pointer)
-// m escapes into the return value, but the caller of mapiterinit
-// doesn't let the return value escape.
-//go:noescape
-//go:linkname mapiterinit reflect.mapiterinit
-func mapiterinit(rtype unsafe.Pointer, m unsafe.Pointer) *hiter
-
//go:noescape
//go:linkname mapiternext reflect.mapiternext
func mapiternext(it *hiter)
@@ -42,9 +36,21 @@ func ifaceE2I(rtype unsafe.Pointer, src interface{}, dst unsafe.Pointer)
// If you modify hiter, also change cmd/internal/gc/reflect.go to indicate
// the layout of this structure.
type hiter struct {
- key unsafe.Pointer // Must be in first position. Write nil to indicate iteration end (see cmd/internal/gc/range.go).
- value unsafe.Pointer // Must be in second position (see cmd/internal/gc/range.go).
- // rest fields are ignored
+ key unsafe.Pointer
+ value unsafe.Pointer
+ t unsafe.Pointer
+ h unsafe.Pointer
+ buckets unsafe.Pointer
+ bptr unsafe.Pointer
+ overflow *[]unsafe.Pointer
+ oldoverflow *[]unsafe.Pointer
+ startBucket uintptr
+ offset uint8
+ wrapped bool
+ B uint8
+ i uint8
+ bucket uintptr
+ checkBucket uintptr
}
// add returns p+x.
diff --git a/vendor/github.com/modern-go/reflect2/unsafe_map.go b/vendor/github.com/modern-go/reflect2/unsafe_map.go
index f2e76e6bb1..37872da819 100644
--- a/vendor/github.com/modern-go/reflect2/unsafe_map.go
+++ b/vendor/github.com/modern-go/reflect2/unsafe_map.go
@@ -107,14 +107,6 @@ func (type2 *UnsafeMapType) Iterate(obj interface{}) MapIterator {
return type2.UnsafeIterate(objEFace.data)
}
-func (type2 *UnsafeMapType) UnsafeIterate(obj unsafe.Pointer) MapIterator {
- return &UnsafeMapIterator{
- hiter: mapiterinit(type2.rtype, *(*unsafe.Pointer)(obj)),
- pKeyRType: type2.pKeyRType,
- pElemRType: type2.pElemRType,
- }
-}
-
type UnsafeMapIterator struct {
*hiter
pKeyRType unsafe.Pointer
diff --git a/vendor/github.com/oklog/ulid/.gitignore b/vendor/github.com/oklog/ulid/.gitignore
new file mode 100644
index 0000000000..c92c4d5608
--- /dev/null
+++ b/vendor/github.com/oklog/ulid/.gitignore
@@ -0,0 +1,29 @@
+#### joe made this: http://goel.io/joe
+
+#####=== Go ===#####
+
+# Compiled Object files, Static and Dynamic libs (Shared Objects)
+*.o
+*.a
+*.so
+
+# Folders
+_obj
+_test
+
+# Architecture specific extensions/prefixes
+*.[568vq]
+[568vq].out
+
+*.cgo1.go
+*.cgo2.c
+_cgo_defun.c
+_cgo_gotypes.go
+_cgo_export.*
+
+_testmain.go
+
+*.exe
+*.test
+*.prof
+
diff --git a/vendor/github.com/oklog/ulid/.travis.yml b/vendor/github.com/oklog/ulid/.travis.yml
new file mode 100644
index 0000000000..43eb762fa3
--- /dev/null
+++ b/vendor/github.com/oklog/ulid/.travis.yml
@@ -0,0 +1,16 @@
+language: go
+sudo: false
+go:
+ - 1.10.x
+install:
+ - go get -v github.com/golang/lint/golint
+ - go get golang.org/x/tools/cmd/cover
+ - go get github.com/mattn/goveralls
+ - go get -d -t -v ./...
+ - go build -v ./...
+script:
+ - go vet ./...
+ - $HOME/gopath/bin/golint .
+ - go test -v -race ./...
+ - go test -v -covermode=count -coverprofile=cov.out
+ - $HOME/gopath/bin/goveralls -coverprofile=cov.out -service=travis-ci -repotoken "$COVERALLS_TOKEN" || true
diff --git a/vendor/github.com/oklog/ulid/AUTHORS.md b/vendor/github.com/oklog/ulid/AUTHORS.md
new file mode 100644
index 0000000000..95581c78b0
--- /dev/null
+++ b/vendor/github.com/oklog/ulid/AUTHORS.md
@@ -0,0 +1,2 @@
+- Peter Bourgon (@peterbourgon)
+- Tomás Senart (@tsenart)
diff --git a/vendor/github.com/oklog/ulid/CHANGELOG.md b/vendor/github.com/oklog/ulid/CHANGELOG.md
new file mode 100644
index 0000000000..8da38c6b00
--- /dev/null
+++ b/vendor/github.com/oklog/ulid/CHANGELOG.md
@@ -0,0 +1,33 @@
+## 1.3.1 / 2018-10-02
+
+* Use underlying entropy source for random increments in Monotonic (#32)
+
+## 1.3.0 / 2018-09-29
+
+* Monotonic entropy support (#31)
+
+## 1.2.0 / 2018-09-09
+
+* Add a function to convert Unix time in milliseconds back to time.Time (#30)
+
+## 1.1.0 / 2018-08-15
+
+* Ensure random part is always read from the entropy reader in full (#28)
+
+## 1.0.0 / 2018-07-29
+
+* Add ParseStrict and MustParseStrict functions (#26)
+* Enforce overflow checking when parsing (#20)
+
+## 0.3.0 / 2017-01-03
+
+* Implement ULID.Compare method
+
+## 0.2.0 / 2016-12-13
+
+* Remove year 2262 Timestamp bug. (#1)
+* Gracefully handle invalid encodings when parsing.
+
+## 0.1.0 / 2016-12-06
+
+* First ULID release
diff --git a/vendor/github.com/oklog/ulid/CONTRIBUTING.md b/vendor/github.com/oklog/ulid/CONTRIBUTING.md
new file mode 100644
index 0000000000..68f03f26eb
--- /dev/null
+++ b/vendor/github.com/oklog/ulid/CONTRIBUTING.md
@@ -0,0 +1,17 @@
+# Contributing
+
+We use GitHub to manage reviews of pull requests.
+
+* If you have a trivial fix or improvement, go ahead and create a pull
+ request, addressing (with `@...`) one or more of the maintainers
+ (see [AUTHORS.md](AUTHORS.md)) in the description of the pull request.
+
+* If you plan to do something more involved, first propose your ideas
+ in a Github issue. This will avoid unnecessary work and surely give
+ you and us a good deal of inspiration.
+
+* Relevant coding style guidelines are the [Go Code Review
+ Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments)
+ and the _Formatting and style_ section of Peter Bourgon's [Go: Best
+ Practices for Production
+ Environments](http://peter.bourgon.org/go-in-production/#formatting-and-style).
diff --git a/vendor/github.com/oklog/ulid/Gopkg.lock b/vendor/github.com/oklog/ulid/Gopkg.lock
new file mode 100644
index 0000000000..349b449a6e
--- /dev/null
+++ b/vendor/github.com/oklog/ulid/Gopkg.lock
@@ -0,0 +1,15 @@
+# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
+
+
+[[projects]]
+ branch = "master"
+ name = "github.com/pborman/getopt"
+ packages = ["v2"]
+ revision = "7148bc3a4c3008adfcab60cbebfd0576018f330b"
+
+[solve-meta]
+ analyzer-name = "dep"
+ analyzer-version = 1
+ inputs-digest = "6779b05abd5cd429c5393641d2453005a3cb74a400d161b2b5c5d0ca2e10e116"
+ solver-name = "gps-cdcl"
+ solver-version = 1
diff --git a/vendor/github.com/oklog/ulid/Gopkg.toml b/vendor/github.com/oklog/ulid/Gopkg.toml
new file mode 100644
index 0000000000..624a7a019c
--- /dev/null
+++ b/vendor/github.com/oklog/ulid/Gopkg.toml
@@ -0,0 +1,26 @@
+
+# Gopkg.toml example
+#
+# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
+# for detailed Gopkg.toml documentation.
+#
+# required = ["github.com/user/thing/cmd/thing"]
+# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
+#
+# [[constraint]]
+# name = "github.com/user/project"
+# version = "1.0.0"
+#
+# [[constraint]]
+# name = "github.com/user/project2"
+# branch = "dev"
+# source = "github.com/myfork/project2"
+#
+# [[override]]
+# name = "github.com/x/y"
+# version = "2.4.0"
+
+
+[[constraint]]
+ branch = "master"
+ name = "github.com/pborman/getopt"
diff --git a/vendor/github.com/oklog/ulid/LICENSE b/vendor/github.com/oklog/ulid/LICENSE
new file mode 100644
index 0000000000..261eeb9e9f
--- /dev/null
+++ b/vendor/github.com/oklog/ulid/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/vendor/github.com/oklog/ulid/README.md b/vendor/github.com/oklog/ulid/README.md
new file mode 100644
index 0000000000..0a3d2f82b2
--- /dev/null
+++ b/vendor/github.com/oklog/ulid/README.md
@@ -0,0 +1,150 @@
+# Universally Unique Lexicographically Sortable Identifier
+
+
+[](http://travis-ci.org/oklog/ulid)
+[](https://goreportcard.com/report/oklog/ulid)
+[](https://coveralls.io/github/oklog/ulid?branch=master)
+[](https://godoc.org/github.com/oklog/ulid)
+[](https://raw.githubusercontent.com/oklog/ulid/master/LICENSE)
+
+A Go port of [alizain/ulid](https://github.com/alizain/ulid) with binary format implemented.
+
+## Background
+
+A GUID/UUID can be suboptimal for many use-cases because:
+
+- It isn't the most character efficient way of encoding 128 bits
+- UUID v1/v2 is impractical in many environments, as it requires access to a unique, stable MAC address
+- UUID v3/v5 requires a unique seed and produces randomly distributed IDs, which can cause fragmentation in many data structures
+- UUID v4 provides no other information than randomness which can cause fragmentation in many data structures
+
+A ULID however:
+
+- Is compatible with UUID/GUID's
+- 1.21e+24 unique ULIDs per millisecond (1,208,925,819,614,629,174,706,176 to be exact)
+- Lexicographically sortable
+- Canonically encoded as a 26 character string, as opposed to the 36 character UUID
+- Uses Crockford's base32 for better efficiency and readability (5 bits per character)
+- Case insensitive
+- No special characters (URL safe)
+- Monotonic sort order (correctly detects and handles the same millisecond)
+
+## Install
+
+```shell
+go get github.com/oklog/ulid
+```
+
+## Usage
+
+An ULID is constructed with a `time.Time` and an `io.Reader` entropy source.
+This design allows for greater flexibility in choosing your trade-offs.
+
+Please note that `rand.Rand` from the `math` package is *not* safe for concurrent use.
+Instantiate one per long living go-routine or use a `sync.Pool` if you want to avoid the potential contention of a locked `rand.Source` as its been frequently observed in the package level functions.
+
+
+```go
+func ExampleULID() {
+ t := time.Unix(1000000, 0)
+ entropy := ulid.Monotonic(rand.New(rand.NewSource(t.UnixNano())), 0)
+ fmt.Println(ulid.MustNew(ulid.Timestamp(t), entropy))
+ // Output: 0000XSNJG0MQJHBF4QX1EFD6Y3
+}
+
+```
+
+## Specification
+
+Below is the current specification of ULID as implemented in this repository.
+
+### Components
+
+**Timestamp**
+- 48 bits
+- UNIX-time in milliseconds
+- Won't run out of space till the year 10895 AD
+
+**Entropy**
+- 80 bits
+- User defined entropy source.
+- Monotonicity within the same millisecond with [`ulid.Monotonic`](https://godoc.org/github.com/oklog/ulid#Monotonic)
+
+### Encoding
+
+[Crockford's Base32](http://www.crockford.com/wrmg/base32.html) is used as shown.
+This alphabet excludes the letters I, L, O, and U to avoid confusion and abuse.
+
+```
+0123456789ABCDEFGHJKMNPQRSTVWXYZ
+```
+
+### Binary Layout and Byte Order
+
+The components are encoded as 16 octets. Each component is encoded with the Most Significant Byte first (network byte order).
+
+```
+0 1 2 3
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+| 32_bit_uint_time_high |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+| 16_bit_uint_time_low | 16_bit_uint_random |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+| 32_bit_uint_random |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+| 32_bit_uint_random |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+```
+
+### String Representation
+
+```
+ 01AN4Z07BY 79KA1307SR9X4MV3
+|----------| |----------------|
+ Timestamp Entropy
+ 10 chars 16 chars
+ 48bits 80bits
+ base32 base32
+```
+
+## Test
+
+```shell
+go test ./...
+```
+
+## Benchmarks
+
+On a Intel Core i7 Ivy Bridge 2.7 GHz, MacOS 10.12.1 and Go 1.8.0beta1
+
+```
+BenchmarkNew/WithCryptoEntropy-8 2000000 771 ns/op 20.73 MB/s 16 B/op 1 allocs/op
+BenchmarkNew/WithEntropy-8 20000000 65.8 ns/op 243.01 MB/s 16 B/op 1 allocs/op
+BenchmarkNew/WithoutEntropy-8 50000000 30.0 ns/op 534.06 MB/s 16 B/op 1 allocs/op
+BenchmarkMustNew/WithCryptoEntropy-8 2000000 781 ns/op 20.48 MB/s 16 B/op 1 allocs/op
+BenchmarkMustNew/WithEntropy-8 20000000 70.0 ns/op 228.51 MB/s 16 B/op 1 allocs/op
+BenchmarkMustNew/WithoutEntropy-8 50000000 34.6 ns/op 462.98 MB/s 16 B/op 1 allocs/op
+BenchmarkParse-8 50000000 30.0 ns/op 866.16 MB/s 0 B/op 0 allocs/op
+BenchmarkMustParse-8 50000000 35.2 ns/op 738.94 MB/s 0 B/op 0 allocs/op
+BenchmarkString-8 20000000 64.9 ns/op 246.40 MB/s 32 B/op 1 allocs/op
+BenchmarkMarshal/Text-8 20000000 55.8 ns/op 286.84 MB/s 32 B/op 1 allocs/op
+BenchmarkMarshal/TextTo-8 100000000 22.4 ns/op 714.91 MB/s 0 B/op 0 allocs/op
+BenchmarkMarshal/Binary-8 300000000 4.02 ns/op 3981.77 MB/s 0 B/op 0 allocs/op
+BenchmarkMarshal/BinaryTo-8 2000000000 1.18 ns/op 13551.75 MB/s 0 B/op 0 allocs/op
+BenchmarkUnmarshal/Text-8 100000000 20.5 ns/op 1265.27 MB/s 0 B/op 0 allocs/op
+BenchmarkUnmarshal/Binary-8 300000000 4.94 ns/op 3240.01 MB/s 0 B/op 0 allocs/op
+BenchmarkNow-8 100000000 15.1 ns/op 528.09 MB/s 0 B/op 0 allocs/op
+BenchmarkTimestamp-8 2000000000 0.29 ns/op 27271.59 MB/s 0 B/op 0 allocs/op
+BenchmarkTime-8 2000000000 0.58 ns/op 13717.80 MB/s 0 B/op 0 allocs/op
+BenchmarkSetTime-8 2000000000 0.89 ns/op 9023.95 MB/s 0 B/op 0 allocs/op
+BenchmarkEntropy-8 200000000 7.62 ns/op 1311.66 MB/s 0 B/op 0 allocs/op
+BenchmarkSetEntropy-8 2000000000 0.88 ns/op 11376.54 MB/s 0 B/op 0 allocs/op
+BenchmarkCompare-8 200000000 7.34 ns/op 4359.23 MB/s 0 B/op 0 allocs/op
+```
+
+## Prior Art
+
+- [alizain/ulid](https://github.com/alizain/ulid)
+- [RobThree/NUlid](https://github.com/RobThree/NUlid)
+- [imdario/go-ulid](https://github.com/imdario/go-ulid)
diff --git a/vendor/github.com/oklog/ulid/ulid.go b/vendor/github.com/oklog/ulid/ulid.go
new file mode 100644
index 0000000000..c5d0d66fd2
--- /dev/null
+++ b/vendor/github.com/oklog/ulid/ulid.go
@@ -0,0 +1,614 @@
+// Copyright 2016 The Oklog Authors
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package ulid
+
+import (
+ "bufio"
+ "bytes"
+ "database/sql/driver"
+ "encoding/binary"
+ "errors"
+ "io"
+ "math"
+ "math/bits"
+ "math/rand"
+ "time"
+)
+
+/*
+An ULID is a 16 byte Universally Unique Lexicographically Sortable Identifier
+
+ The components are encoded as 16 octets.
+ Each component is encoded with the MSB first (network byte order).
+
+ 0 1 2 3
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | 32_bit_uint_time_high |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | 16_bit_uint_time_low | 16_bit_uint_random |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | 32_bit_uint_random |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | 32_bit_uint_random |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+*/
+type ULID [16]byte
+
+var (
+ // ErrDataSize is returned when parsing or unmarshaling ULIDs with the wrong
+ // data size.
+ ErrDataSize = errors.New("ulid: bad data size when unmarshaling")
+
+ // ErrInvalidCharacters is returned when parsing or unmarshaling ULIDs with
+ // invalid Base32 encodings.
+ ErrInvalidCharacters = errors.New("ulid: bad data characters when unmarshaling")
+
+ // ErrBufferSize is returned when marshalling ULIDs to a buffer of insufficient
+ // size.
+ ErrBufferSize = errors.New("ulid: bad buffer size when marshaling")
+
+ // ErrBigTime is returned when constructing an ULID with a time that is larger
+ // than MaxTime.
+ ErrBigTime = errors.New("ulid: time too big")
+
+ // ErrOverflow is returned when unmarshaling a ULID whose first character is
+ // larger than 7, thereby exceeding the valid bit depth of 128.
+ ErrOverflow = errors.New("ulid: overflow when unmarshaling")
+
+ // ErrMonotonicOverflow is returned by a Monotonic entropy source when
+ // incrementing the previous ULID's entropy bytes would result in overflow.
+ ErrMonotonicOverflow = errors.New("ulid: monotonic entropy overflow")
+
+ // ErrScanValue is returned when the value passed to scan cannot be unmarshaled
+ // into the ULID.
+ ErrScanValue = errors.New("ulid: source value must be a string or byte slice")
+)
+
+// New returns an ULID with the given Unix milliseconds timestamp and an
+// optional entropy source. Use the Timestamp function to convert
+// a time.Time to Unix milliseconds.
+//
+// ErrBigTime is returned when passing a timestamp bigger than MaxTime.
+// Reading from the entropy source may also return an error.
+func New(ms uint64, entropy io.Reader) (id ULID, err error) {
+ if err = id.SetTime(ms); err != nil {
+ return id, err
+ }
+
+ switch e := entropy.(type) {
+ case nil:
+ return id, err
+ case *monotonic:
+ err = e.MonotonicRead(ms, id[6:])
+ default:
+ _, err = io.ReadFull(e, id[6:])
+ }
+
+ return id, err
+}
+
+// MustNew is a convenience function equivalent to New that panics on failure
+// instead of returning an error.
+func MustNew(ms uint64, entropy io.Reader) ULID {
+ id, err := New(ms, entropy)
+ if err != nil {
+ panic(err)
+ }
+ return id
+}
+
+// Parse parses an encoded ULID, returning an error in case of failure.
+//
+// ErrDataSize is returned if the len(ulid) is different from an encoded
+// ULID's length. Invalid encodings produce undefined ULIDs. For a version that
+// returns an error instead, see ParseStrict.
+func Parse(ulid string) (id ULID, err error) {
+ return id, parse([]byte(ulid), false, &id)
+}
+
+// ParseStrict parses an encoded ULID, returning an error in case of failure.
+//
+// It is like Parse, but additionally validates that the parsed ULID consists
+// only of valid base32 characters. It is slightly slower than Parse.
+//
+// ErrDataSize is returned if the len(ulid) is different from an encoded
+// ULID's length. Invalid encodings return ErrInvalidCharacters.
+func ParseStrict(ulid string) (id ULID, err error) {
+ return id, parse([]byte(ulid), true, &id)
+}
+
+func parse(v []byte, strict bool, id *ULID) error {
+ // Check if a base32 encoded ULID is the right length.
+ if len(v) != EncodedSize {
+ return ErrDataSize
+ }
+
+ // Check if all the characters in a base32 encoded ULID are part of the
+ // expected base32 character set.
+ if strict &&
+ (dec[v[0]] == 0xFF ||
+ dec[v[1]] == 0xFF ||
+ dec[v[2]] == 0xFF ||
+ dec[v[3]] == 0xFF ||
+ dec[v[4]] == 0xFF ||
+ dec[v[5]] == 0xFF ||
+ dec[v[6]] == 0xFF ||
+ dec[v[7]] == 0xFF ||
+ dec[v[8]] == 0xFF ||
+ dec[v[9]] == 0xFF ||
+ dec[v[10]] == 0xFF ||
+ dec[v[11]] == 0xFF ||
+ dec[v[12]] == 0xFF ||
+ dec[v[13]] == 0xFF ||
+ dec[v[14]] == 0xFF ||
+ dec[v[15]] == 0xFF ||
+ dec[v[16]] == 0xFF ||
+ dec[v[17]] == 0xFF ||
+ dec[v[18]] == 0xFF ||
+ dec[v[19]] == 0xFF ||
+ dec[v[20]] == 0xFF ||
+ dec[v[21]] == 0xFF ||
+ dec[v[22]] == 0xFF ||
+ dec[v[23]] == 0xFF ||
+ dec[v[24]] == 0xFF ||
+ dec[v[25]] == 0xFF) {
+ return ErrInvalidCharacters
+ }
+
+ // Check if the first character in a base32 encoded ULID will overflow. This
+ // happens because the base32 representation encodes 130 bits, while the
+ // ULID is only 128 bits.
+ //
+ // See https://github.com/oklog/ulid/issues/9 for details.
+ if v[0] > '7' {
+ return ErrOverflow
+ }
+
+ // Use an optimized unrolled loop (from https://github.com/RobThree/NUlid)
+ // to decode a base32 ULID.
+
+ // 6 bytes timestamp (48 bits)
+ (*id)[0] = ((dec[v[0]] << 5) | dec[v[1]])
+ (*id)[1] = ((dec[v[2]] << 3) | (dec[v[3]] >> 2))
+ (*id)[2] = ((dec[v[3]] << 6) | (dec[v[4]] << 1) | (dec[v[5]] >> 4))
+ (*id)[3] = ((dec[v[5]] << 4) | (dec[v[6]] >> 1))
+ (*id)[4] = ((dec[v[6]] << 7) | (dec[v[7]] << 2) | (dec[v[8]] >> 3))
+ (*id)[5] = ((dec[v[8]] << 5) | dec[v[9]])
+
+ // 10 bytes of entropy (80 bits)
+ (*id)[6] = ((dec[v[10]] << 3) | (dec[v[11]] >> 2))
+ (*id)[7] = ((dec[v[11]] << 6) | (dec[v[12]] << 1) | (dec[v[13]] >> 4))
+ (*id)[8] = ((dec[v[13]] << 4) | (dec[v[14]] >> 1))
+ (*id)[9] = ((dec[v[14]] << 7) | (dec[v[15]] << 2) | (dec[v[16]] >> 3))
+ (*id)[10] = ((dec[v[16]] << 5) | dec[v[17]])
+ (*id)[11] = ((dec[v[18]] << 3) | dec[v[19]]>>2)
+ (*id)[12] = ((dec[v[19]] << 6) | (dec[v[20]] << 1) | (dec[v[21]] >> 4))
+ (*id)[13] = ((dec[v[21]] << 4) | (dec[v[22]] >> 1))
+ (*id)[14] = ((dec[v[22]] << 7) | (dec[v[23]] << 2) | (dec[v[24]] >> 3))
+ (*id)[15] = ((dec[v[24]] << 5) | dec[v[25]])
+
+ return nil
+}
+
+// MustParse is a convenience function equivalent to Parse that panics on failure
+// instead of returning an error.
+func MustParse(ulid string) ULID {
+ id, err := Parse(ulid)
+ if err != nil {
+ panic(err)
+ }
+ return id
+}
+
+// MustParseStrict is a convenience function equivalent to ParseStrict that
+// panics on failure instead of returning an error.
+func MustParseStrict(ulid string) ULID {
+ id, err := ParseStrict(ulid)
+ if err != nil {
+ panic(err)
+ }
+ return id
+}
+
+// String returns a lexicographically sortable string encoded ULID
+// (26 characters, non-standard base 32) e.g. 01AN4Z07BY79KA1307SR9X4MV3
+// Format: tttttttttteeeeeeeeeeeeeeee where t is time and e is entropy
+func (id ULID) String() string {
+ ulid := make([]byte, EncodedSize)
+ _ = id.MarshalTextTo(ulid)
+ return string(ulid)
+}
+
+// MarshalBinary implements the encoding.BinaryMarshaler interface by
+// returning the ULID as a byte slice.
+func (id ULID) MarshalBinary() ([]byte, error) {
+ ulid := make([]byte, len(id))
+ return ulid, id.MarshalBinaryTo(ulid)
+}
+
+// MarshalBinaryTo writes the binary encoding of the ULID to the given buffer.
+// ErrBufferSize is returned when the len(dst) != 16.
+func (id ULID) MarshalBinaryTo(dst []byte) error {
+ if len(dst) != len(id) {
+ return ErrBufferSize
+ }
+
+ copy(dst, id[:])
+ return nil
+}
+
+// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface by
+// copying the passed data and converting it to an ULID. ErrDataSize is
+// returned if the data length is different from ULID length.
+func (id *ULID) UnmarshalBinary(data []byte) error {
+ if len(data) != len(*id) {
+ return ErrDataSize
+ }
+
+ copy((*id)[:], data)
+ return nil
+}
+
+// Encoding is the base 32 encoding alphabet used in ULID strings.
+const Encoding = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"
+
+// MarshalText implements the encoding.TextMarshaler interface by
+// returning the string encoded ULID.
+func (id ULID) MarshalText() ([]byte, error) {
+ ulid := make([]byte, EncodedSize)
+ return ulid, id.MarshalTextTo(ulid)
+}
+
+// MarshalTextTo writes the ULID as a string to the given buffer.
+// ErrBufferSize is returned when the len(dst) != 26.
+func (id ULID) MarshalTextTo(dst []byte) error {
+ // Optimized unrolled loop ahead.
+ // From https://github.com/RobThree/NUlid
+
+ if len(dst) != EncodedSize {
+ return ErrBufferSize
+ }
+
+ // 10 byte timestamp
+ dst[0] = Encoding[(id[0]&224)>>5]
+ dst[1] = Encoding[id[0]&31]
+ dst[2] = Encoding[(id[1]&248)>>3]
+ dst[3] = Encoding[((id[1]&7)<<2)|((id[2]&192)>>6)]
+ dst[4] = Encoding[(id[2]&62)>>1]
+ dst[5] = Encoding[((id[2]&1)<<4)|((id[3]&240)>>4)]
+ dst[6] = Encoding[((id[3]&15)<<1)|((id[4]&128)>>7)]
+ dst[7] = Encoding[(id[4]&124)>>2]
+ dst[8] = Encoding[((id[4]&3)<<3)|((id[5]&224)>>5)]
+ dst[9] = Encoding[id[5]&31]
+
+ // 16 bytes of entropy
+ dst[10] = Encoding[(id[6]&248)>>3]
+ dst[11] = Encoding[((id[6]&7)<<2)|((id[7]&192)>>6)]
+ dst[12] = Encoding[(id[7]&62)>>1]
+ dst[13] = Encoding[((id[7]&1)<<4)|((id[8]&240)>>4)]
+ dst[14] = Encoding[((id[8]&15)<<1)|((id[9]&128)>>7)]
+ dst[15] = Encoding[(id[9]&124)>>2]
+ dst[16] = Encoding[((id[9]&3)<<3)|((id[10]&224)>>5)]
+ dst[17] = Encoding[id[10]&31]
+ dst[18] = Encoding[(id[11]&248)>>3]
+ dst[19] = Encoding[((id[11]&7)<<2)|((id[12]&192)>>6)]
+ dst[20] = Encoding[(id[12]&62)>>1]
+ dst[21] = Encoding[((id[12]&1)<<4)|((id[13]&240)>>4)]
+ dst[22] = Encoding[((id[13]&15)<<1)|((id[14]&128)>>7)]
+ dst[23] = Encoding[(id[14]&124)>>2]
+ dst[24] = Encoding[((id[14]&3)<<3)|((id[15]&224)>>5)]
+ dst[25] = Encoding[id[15]&31]
+
+ return nil
+}
+
+// Byte to index table for O(1) lookups when unmarshaling.
+// We use 0xFF as sentinel value for invalid indexes.
+var dec = [...]byte{
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x01,
+ 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
+ 0x0F, 0x10, 0x11, 0xFF, 0x12, 0x13, 0xFF, 0x14, 0x15, 0xFF,
+ 0x16, 0x17, 0x18, 0x19, 0x1A, 0xFF, 0x1B, 0x1C, 0x1D, 0x1E,
+ 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0x0B, 0x0C,
+ 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0xFF, 0x12, 0x13, 0xFF, 0x14,
+ 0x15, 0xFF, 0x16, 0x17, 0x18, 0x19, 0x1A, 0xFF, 0x1B, 0x1C,
+ 0x1D, 0x1E, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+}
+
+// EncodedSize is the length of a text encoded ULID.
+const EncodedSize = 26
+
+// UnmarshalText implements the encoding.TextUnmarshaler interface by
+// parsing the data as string encoded ULID.
+//
+// ErrDataSize is returned if the len(v) is different from an encoded
+// ULID's length. Invalid encodings produce undefined ULIDs.
+func (id *ULID) UnmarshalText(v []byte) error {
+ return parse(v, false, id)
+}
+
+// Time returns the Unix time in milliseconds encoded in the ULID.
+// Use the top level Time function to convert the returned value to
+// a time.Time.
+func (id ULID) Time() uint64 {
+ return uint64(id[5]) | uint64(id[4])<<8 |
+ uint64(id[3])<<16 | uint64(id[2])<<24 |
+ uint64(id[1])<<32 | uint64(id[0])<<40
+}
+
+// maxTime is the maximum Unix time in milliseconds that can be
+// represented in an ULID.
+var maxTime = ULID{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}.Time()
+
+// MaxTime returns the maximum Unix time in milliseconds that
+// can be encoded in an ULID.
+func MaxTime() uint64 { return maxTime }
+
+// Now is a convenience function that returns the current
+// UTC time in Unix milliseconds. Equivalent to:
+// Timestamp(time.Now().UTC())
+func Now() uint64 { return Timestamp(time.Now().UTC()) }
+
+// Timestamp converts a time.Time to Unix milliseconds.
+//
+// Because of the way ULID stores time, times from the year
+// 10889 produces undefined results.
+func Timestamp(t time.Time) uint64 {
+ return uint64(t.Unix())*1000 +
+ uint64(t.Nanosecond()/int(time.Millisecond))
+}
+
+// Time converts Unix milliseconds in the format
+// returned by the Timestamp function to a time.Time.
+func Time(ms uint64) time.Time {
+ s := int64(ms / 1e3)
+ ns := int64((ms % 1e3) * 1e6)
+ return time.Unix(s, ns)
+}
+
+// SetTime sets the time component of the ULID to the given Unix time
+// in milliseconds.
+func (id *ULID) SetTime(ms uint64) error {
+ if ms > maxTime {
+ return ErrBigTime
+ }
+
+ (*id)[0] = byte(ms >> 40)
+ (*id)[1] = byte(ms >> 32)
+ (*id)[2] = byte(ms >> 24)
+ (*id)[3] = byte(ms >> 16)
+ (*id)[4] = byte(ms >> 8)
+ (*id)[5] = byte(ms)
+
+ return nil
+}
+
+// Entropy returns the entropy from the ULID.
+func (id ULID) Entropy() []byte {
+ e := make([]byte, 10)
+ copy(e, id[6:])
+ return e
+}
+
+// SetEntropy sets the ULID entropy to the passed byte slice.
+// ErrDataSize is returned if len(e) != 10.
+func (id *ULID) SetEntropy(e []byte) error {
+ if len(e) != 10 {
+ return ErrDataSize
+ }
+
+ copy((*id)[6:], e)
+ return nil
+}
+
+// Compare returns an integer comparing id and other lexicographically.
+// The result will be 0 if id==other, -1 if id < other, and +1 if id > other.
+func (id ULID) Compare(other ULID) int {
+ return bytes.Compare(id[:], other[:])
+}
+
+// Scan implements the sql.Scanner interface. It supports scanning
+// a string or byte slice.
+func (id *ULID) Scan(src interface{}) error {
+ switch x := src.(type) {
+ case nil:
+ return nil
+ case string:
+ return id.UnmarshalText([]byte(x))
+ case []byte:
+ return id.UnmarshalBinary(x)
+ }
+
+ return ErrScanValue
+}
+
+// Value implements the sql/driver.Valuer interface. This returns the value
+// represented as a byte slice. If instead a string is desirable, a wrapper
+// type can be created that calls String().
+//
+// // stringValuer wraps a ULID as a string-based driver.Valuer.
+// type stringValuer ULID
+//
+// func (id stringValuer) Value() (driver.Value, error) {
+// return ULID(id).String(), nil
+// }
+//
+// // Example usage.
+// db.Exec("...", stringValuer(id))
+func (id ULID) Value() (driver.Value, error) {
+ return id.MarshalBinary()
+}
+
+// Monotonic returns an entropy source that is guaranteed to yield
+// strictly increasing entropy bytes for the same ULID timestamp.
+// On conflicts, the previous ULID entropy is incremented with a
+// random number between 1 and `inc` (inclusive).
+//
+// The provided entropy source must actually yield random bytes or else
+// monotonic reads are not guaranteed to terminate, since there isn't
+// enough randomness to compute an increment number.
+//
+// When `inc == 0`, it'll be set to a secure default of `math.MaxUint32`.
+// The lower the value of `inc`, the easier the next ULID within the
+// same millisecond is to guess. If your code depends on ULIDs having
+// secure entropy bytes, then don't go under this default unless you know
+// what you're doing.
+//
+// The returned io.Reader isn't safe for concurrent use.
+func Monotonic(entropy io.Reader, inc uint64) io.Reader {
+ m := monotonic{
+ Reader: bufio.NewReader(entropy),
+ inc: inc,
+ }
+
+ if m.inc == 0 {
+ m.inc = math.MaxUint32
+ }
+
+ if rng, ok := entropy.(*rand.Rand); ok {
+ m.rng = rng
+ }
+
+ return &m
+}
+
+type monotonic struct {
+ io.Reader
+ ms uint64
+ inc uint64
+ entropy uint80
+ rand [8]byte
+ rng *rand.Rand
+}
+
+func (m *monotonic) MonotonicRead(ms uint64, entropy []byte) (err error) {
+ if !m.entropy.IsZero() && m.ms == ms {
+ err = m.increment()
+ m.entropy.AppendTo(entropy)
+ } else if _, err = io.ReadFull(m.Reader, entropy); err == nil {
+ m.ms = ms
+ m.entropy.SetBytes(entropy)
+ }
+ return err
+}
+
+// increment the previous entropy number with a random number
+// of up to m.inc (inclusive).
+func (m *monotonic) increment() error {
+ if inc, err := m.random(); err != nil {
+ return err
+ } else if m.entropy.Add(inc) {
+ return ErrMonotonicOverflow
+ }
+ return nil
+}
+
+// random returns a uniform random value in [1, m.inc), reading entropy
+// from m.Reader. When m.inc == 0 || m.inc == 1, it returns 1.
+// Adapted from: https://golang.org/pkg/crypto/rand/#Int
+func (m *monotonic) random() (inc uint64, err error) {
+ if m.inc <= 1 {
+ return 1, nil
+ }
+
+ // Fast path for using a underlying rand.Rand directly.
+ if m.rng != nil {
+ // Range: [1, m.inc)
+ return 1 + uint64(m.rng.Int63n(int64(m.inc))), nil
+ }
+
+ // bitLen is the maximum bit length needed to encode a value < m.inc.
+ bitLen := bits.Len64(m.inc)
+
+ // byteLen is the maximum byte length needed to encode a value < m.inc.
+ byteLen := uint(bitLen+7) / 8
+
+ // msbitLen is the number of bits in the most significant byte of m.inc-1.
+ msbitLen := uint(bitLen % 8)
+ if msbitLen == 0 {
+ msbitLen = 8
+ }
+
+ for inc == 0 || inc >= m.inc {
+ if _, err = io.ReadFull(m.Reader, m.rand[:byteLen]); err != nil {
+ return 0, err
+ }
+
+ // Clear bits in the first byte to increase the probability
+ // that the candidate is < m.inc.
+ m.rand[0] &= uint8(int(1< true
+// assert.EqualExportedValuesf(t, S{1, 2}, S{2, 3}, "error message %s", "formatted") => false
+func EqualExportedValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
+ if h, ok := t.(tHelper); ok {
+ h.Helper()
+ }
+ return EqualExportedValues(t, expected, actual, append([]interface{}{msg}, args...)...)
+}
+
// EqualValuesf asserts that two objects are equal or convertable to the same types
// and equal.
//
-// assert.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted")
+// assert.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted")
func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -103,10 +120,10 @@ func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg stri
// Errorf asserts that a function returned an error (i.e. not `nil`).
//
-// actualObj, err := SomeFunction()
-// if assert.Errorf(t, err, "error message %s", "formatted") {
-// assert.Equal(t, expectedErrorf, err)
-// }
+// actualObj, err := SomeFunction()
+// if assert.Errorf(t, err, "error message %s", "formatted") {
+// assert.Equal(t, expectedErrorf, err)
+// }
func Errorf(t TestingT, err error, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -126,8 +143,8 @@ func ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...int
// ErrorContainsf asserts that a function returned an error (i.e. not `nil`)
// and that the error contains the specified substring.
//
-// actualObj, err := SomeFunction()
-// assert.ErrorContainsf(t, err, expectedErrorSubString, "error message %s", "formatted")
+// actualObj, err := SomeFunction()
+// assert.ErrorContainsf(t, err, expectedErrorSubString, "error message %s", "formatted")
func ErrorContainsf(t TestingT, theError error, contains string, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -147,7 +164,7 @@ func ErrorIsf(t TestingT, err error, target error, msg string, args ...interface
// Eventuallyf asserts that given condition will be met in waitFor time,
// periodically checking target function each tick.
//
-// assert.Eventuallyf(t, func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
+// assert.Eventuallyf(t, func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -155,9 +172,34 @@ func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick
return Eventually(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...)
}
+// EventuallyWithTf asserts that given condition will be met in waitFor time,
+// periodically checking target function each tick. In contrast to Eventually,
+// it supplies a CollectT to the condition function, so that the condition
+// function can use the CollectT to call other assertions.
+// The condition is considered "met" if no errors are raised in a tick.
+// The supplied CollectT collects all errors from one tick (if there are any).
+// If the condition is not met before waitFor, the collected errors of
+// the last tick are copied to t.
+//
+// externalValue := false
+// go func() {
+// time.Sleep(8*time.Second)
+// externalValue = true
+// }()
+// assert.EventuallyWithTf(t, func(c *assert.CollectT, "error message %s", "formatted") {
+// // add assertions as needed; any assertion failure will fail the current tick
+// assert.True(c, externalValue, "expected 'externalValue' to be true")
+// }, 1*time.Second, 10*time.Second, "external state has not changed to 'true'; still false")
+func EventuallyWithTf(t TestingT, condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
+ if h, ok := t.(tHelper); ok {
+ h.Helper()
+ }
+ return EventuallyWithT(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...)
+}
+
// Exactlyf asserts that two objects are equal in value and type.
//
-// assert.Exactlyf(t, int32(123), int64(123), "error message %s", "formatted")
+// assert.Exactlyf(t, int32(123), int64(123), "error message %s", "formatted")
func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -183,7 +225,7 @@ func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}
// Falsef asserts that the specified value is false.
//
-// assert.Falsef(t, myBool, "error message %s", "formatted")
+// assert.Falsef(t, myBool, "error message %s", "formatted")
func Falsef(t TestingT, value bool, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -202,9 +244,9 @@ func FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool
// Greaterf asserts that the first element is greater than the second
//
-// assert.Greaterf(t, 2, 1, "error message %s", "formatted")
-// assert.Greaterf(t, float64(2), float64(1), "error message %s", "formatted")
-// assert.Greaterf(t, "b", "a", "error message %s", "formatted")
+// assert.Greaterf(t, 2, 1, "error message %s", "formatted")
+// assert.Greaterf(t, float64(2), float64(1), "error message %s", "formatted")
+// assert.Greaterf(t, "b", "a", "error message %s", "formatted")
func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -214,10 +256,10 @@ func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...in
// GreaterOrEqualf asserts that the first element is greater than or equal to the second
//
-// assert.GreaterOrEqualf(t, 2, 1, "error message %s", "formatted")
-// assert.GreaterOrEqualf(t, 2, 2, "error message %s", "formatted")
-// assert.GreaterOrEqualf(t, "b", "a", "error message %s", "formatted")
-// assert.GreaterOrEqualf(t, "b", "b", "error message %s", "formatted")
+// assert.GreaterOrEqualf(t, 2, 1, "error message %s", "formatted")
+// assert.GreaterOrEqualf(t, 2, 2, "error message %s", "formatted")
+// assert.GreaterOrEqualf(t, "b", "a", "error message %s", "formatted")
+// assert.GreaterOrEqualf(t, "b", "b", "error message %s", "formatted")
func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -228,7 +270,7 @@ func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, arg
// HTTPBodyContainsf asserts that a specified handler returns a
// body that contains a string.
//
-// assert.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
+// assert.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
@@ -241,7 +283,7 @@ func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url
// HTTPBodyNotContainsf asserts that a specified handler returns a
// body that does not contain a string.
//
-// assert.HTTPBodyNotContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
+// assert.HTTPBodyNotContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
@@ -253,7 +295,7 @@ func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, u
// HTTPErrorf asserts that a specified handler returns an error status code.
//
-// assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+// assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true) or not (false).
func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
@@ -265,7 +307,7 @@ func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string,
// HTTPRedirectf asserts that a specified handler returns a redirect status code.
//
-// assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+// assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true) or not (false).
func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
@@ -277,7 +319,7 @@ func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url stri
// HTTPStatusCodef asserts that a specified handler returns a specified status code.
//
-// assert.HTTPStatusCodef(t, myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted")
+// assert.HTTPStatusCodef(t, myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func HTTPStatusCodef(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) bool {
@@ -289,7 +331,7 @@ func HTTPStatusCodef(t TestingT, handler http.HandlerFunc, method string, url st
// HTTPSuccessf asserts that a specified handler returns a success status code.
//
-// assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
+// assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
@@ -301,7 +343,7 @@ func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url strin
// Implementsf asserts that an object is implemented by the specified interface.
//
-// assert.Implementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
+// assert.Implementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -311,7 +353,7 @@ func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, ms
// InDeltaf asserts that the two numerals are within delta of each other.
//
-// assert.InDeltaf(t, math.Pi, 22/7.0, 0.01, "error message %s", "formatted")
+// assert.InDeltaf(t, math.Pi, 22/7.0, 0.01, "error message %s", "formatted")
func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -353,9 +395,9 @@ func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsil
// IsDecreasingf asserts that the collection is decreasing
//
-// assert.IsDecreasingf(t, []int{2, 1, 0}, "error message %s", "formatted")
-// assert.IsDecreasingf(t, []float{2, 1}, "error message %s", "formatted")
-// assert.IsDecreasingf(t, []string{"b", "a"}, "error message %s", "formatted")
+// assert.IsDecreasingf(t, []int{2, 1, 0}, "error message %s", "formatted")
+// assert.IsDecreasingf(t, []float{2, 1}, "error message %s", "formatted")
+// assert.IsDecreasingf(t, []string{"b", "a"}, "error message %s", "formatted")
func IsDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -365,9 +407,9 @@ func IsDecreasingf(t TestingT, object interface{}, msg string, args ...interface
// IsIncreasingf asserts that the collection is increasing
//
-// assert.IsIncreasingf(t, []int{1, 2, 3}, "error message %s", "formatted")
-// assert.IsIncreasingf(t, []float{1, 2}, "error message %s", "formatted")
-// assert.IsIncreasingf(t, []string{"a", "b"}, "error message %s", "formatted")
+// assert.IsIncreasingf(t, []int{1, 2, 3}, "error message %s", "formatted")
+// assert.IsIncreasingf(t, []float{1, 2}, "error message %s", "formatted")
+// assert.IsIncreasingf(t, []string{"a", "b"}, "error message %s", "formatted")
func IsIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -377,9 +419,9 @@ func IsIncreasingf(t TestingT, object interface{}, msg string, args ...interface
// IsNonDecreasingf asserts that the collection is not decreasing
//
-// assert.IsNonDecreasingf(t, []int{1, 1, 2}, "error message %s", "formatted")
-// assert.IsNonDecreasingf(t, []float{1, 2}, "error message %s", "formatted")
-// assert.IsNonDecreasingf(t, []string{"a", "b"}, "error message %s", "formatted")
+// assert.IsNonDecreasingf(t, []int{1, 1, 2}, "error message %s", "formatted")
+// assert.IsNonDecreasingf(t, []float{1, 2}, "error message %s", "formatted")
+// assert.IsNonDecreasingf(t, []string{"a", "b"}, "error message %s", "formatted")
func IsNonDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -389,9 +431,9 @@ func IsNonDecreasingf(t TestingT, object interface{}, msg string, args ...interf
// IsNonIncreasingf asserts that the collection is not increasing
//
-// assert.IsNonIncreasingf(t, []int{2, 1, 1}, "error message %s", "formatted")
-// assert.IsNonIncreasingf(t, []float{2, 1}, "error message %s", "formatted")
-// assert.IsNonIncreasingf(t, []string{"b", "a"}, "error message %s", "formatted")
+// assert.IsNonIncreasingf(t, []int{2, 1, 1}, "error message %s", "formatted")
+// assert.IsNonIncreasingf(t, []float{2, 1}, "error message %s", "formatted")
+// assert.IsNonIncreasingf(t, []string{"b", "a"}, "error message %s", "formatted")
func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -409,7 +451,7 @@ func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg strin
// JSONEqf asserts that two JSON strings are equivalent.
//
-// assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
+// assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -420,7 +462,7 @@ func JSONEqf(t TestingT, expected string, actual string, msg string, args ...int
// Lenf asserts that the specified object has specific length.
// Lenf also fails if the object has a type that len() not accept.
//
-// assert.Lenf(t, mySlice, 3, "error message %s", "formatted")
+// assert.Lenf(t, mySlice, 3, "error message %s", "formatted")
func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -430,9 +472,9 @@ func Lenf(t TestingT, object interface{}, length int, msg string, args ...interf
// Lessf asserts that the first element is less than the second
//
-// assert.Lessf(t, 1, 2, "error message %s", "formatted")
-// assert.Lessf(t, float64(1), float64(2), "error message %s", "formatted")
-// assert.Lessf(t, "a", "b", "error message %s", "formatted")
+// assert.Lessf(t, 1, 2, "error message %s", "formatted")
+// assert.Lessf(t, float64(1), float64(2), "error message %s", "formatted")
+// assert.Lessf(t, "a", "b", "error message %s", "formatted")
func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -442,10 +484,10 @@ func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...inter
// LessOrEqualf asserts that the first element is less than or equal to the second
//
-// assert.LessOrEqualf(t, 1, 2, "error message %s", "formatted")
-// assert.LessOrEqualf(t, 2, 2, "error message %s", "formatted")
-// assert.LessOrEqualf(t, "a", "b", "error message %s", "formatted")
-// assert.LessOrEqualf(t, "b", "b", "error message %s", "formatted")
+// assert.LessOrEqualf(t, 1, 2, "error message %s", "formatted")
+// assert.LessOrEqualf(t, 2, 2, "error message %s", "formatted")
+// assert.LessOrEqualf(t, "a", "b", "error message %s", "formatted")
+// assert.LessOrEqualf(t, "b", "b", "error message %s", "formatted")
func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -455,8 +497,8 @@ func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args .
// Negativef asserts that the specified element is negative
//
-// assert.Negativef(t, -1, "error message %s", "formatted")
-// assert.Negativef(t, -1.23, "error message %s", "formatted")
+// assert.Negativef(t, -1, "error message %s", "formatted")
+// assert.Negativef(t, -1.23, "error message %s", "formatted")
func Negativef(t TestingT, e interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -467,7 +509,7 @@ func Negativef(t TestingT, e interface{}, msg string, args ...interface{}) bool
// Neverf asserts that the given condition doesn't satisfy in waitFor time,
// periodically checking the target function each tick.
//
-// assert.Neverf(t, func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
+// assert.Neverf(t, func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
func Neverf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -477,7 +519,7 @@ func Neverf(t TestingT, condition func() bool, waitFor time.Duration, tick time.
// Nilf asserts that the specified object is nil.
//
-// assert.Nilf(t, err, "error message %s", "formatted")
+// assert.Nilf(t, err, "error message %s", "formatted")
func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -496,10 +538,10 @@ func NoDirExistsf(t TestingT, path string, msg string, args ...interface{}) bool
// NoErrorf asserts that a function returned no error (i.e. `nil`).
//
-// actualObj, err := SomeFunction()
-// if assert.NoErrorf(t, err, "error message %s", "formatted") {
-// assert.Equal(t, expectedObj, actualObj)
-// }
+// actualObj, err := SomeFunction()
+// if assert.NoErrorf(t, err, "error message %s", "formatted") {
+// assert.Equal(t, expectedObj, actualObj)
+// }
func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -519,9 +561,9 @@ func NoFileExistsf(t TestingT, path string, msg string, args ...interface{}) boo
// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
// specified substring or element.
//
-// assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted")
-// assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted")
-// assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted")
+// assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted")
+// assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted")
+// assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted")
func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -532,9 +574,9 @@ func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, a
// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
// a slice or a channel with len == 0.
//
-// if assert.NotEmptyf(t, obj, "error message %s", "formatted") {
-// assert.Equal(t, "two", obj[1])
-// }
+// if assert.NotEmptyf(t, obj, "error message %s", "formatted") {
+// assert.Equal(t, "two", obj[1])
+// }
func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -544,7 +586,7 @@ func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{})
// NotEqualf asserts that the specified values are NOT equal.
//
-// assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted")
+// assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted")
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses).
@@ -557,7 +599,7 @@ func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string,
// NotEqualValuesf asserts that two objects are not equal even when converted to the same type
//
-// assert.NotEqualValuesf(t, obj1, obj2, "error message %s", "formatted")
+// assert.NotEqualValuesf(t, obj1, obj2, "error message %s", "formatted")
func NotEqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -576,7 +618,7 @@ func NotErrorIsf(t TestingT, err error, target error, msg string, args ...interf
// NotNilf asserts that the specified object is not nil.
//
-// assert.NotNilf(t, err, "error message %s", "formatted")
+// assert.NotNilf(t, err, "error message %s", "formatted")
func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -586,7 +628,7 @@ func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bo
// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
//
-// assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted")
+// assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted")
func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -596,8 +638,8 @@ func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bo
// NotRegexpf asserts that a specified regexp does not match a string.
//
-// assert.NotRegexpf(t, regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted")
-// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
+// assert.NotRegexpf(t, regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted")
+// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -607,7 +649,7 @@ func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ..
// NotSamef asserts that two pointers do not reference the same object.
//
-// assert.NotSamef(t, ptr1, ptr2, "error message %s", "formatted")
+// assert.NotSamef(t, ptr1, ptr2, "error message %s", "formatted")
//
// Both arguments must be pointer variables. Pointer variable sameness is
// determined based on the equality of both type and value.
@@ -621,7 +663,7 @@ func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string,
// NotSubsetf asserts that the specified list(array, slice...) contains not all
// elements given in the specified subset(array, slice...).
//
-// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
+// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -639,7 +681,7 @@ func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {
// Panicsf asserts that the code inside the specified PanicTestFunc panics.
//
-// assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted")
+// assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted")
func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -651,7 +693,7 @@ func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool
// panics, and that the recovered panic value is an error that satisfies the
// EqualError comparison.
//
-// assert.PanicsWithErrorf(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
+// assert.PanicsWithErrorf(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
func PanicsWithErrorf(t TestingT, errString string, f PanicTestFunc, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -662,7 +704,7 @@ func PanicsWithErrorf(t TestingT, errString string, f PanicTestFunc, msg string,
// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
// the recovered panic value equals the expected panic value.
//
-// assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
+// assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -672,8 +714,8 @@ func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg str
// Positivef asserts that the specified element is positive
//
-// assert.Positivef(t, 1, "error message %s", "formatted")
-// assert.Positivef(t, 1.23, "error message %s", "formatted")
+// assert.Positivef(t, 1, "error message %s", "formatted")
+// assert.Positivef(t, 1.23, "error message %s", "formatted")
func Positivef(t TestingT, e interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -683,8 +725,8 @@ func Positivef(t TestingT, e interface{}, msg string, args ...interface{}) bool
// Regexpf asserts that a specified regexp matches a string.
//
-// assert.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "formatted")
-// assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
+// assert.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "formatted")
+// assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -694,7 +736,7 @@ func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...in
// Samef asserts that two pointers reference the same object.
//
-// assert.Samef(t, ptr1, ptr2, "error message %s", "formatted")
+// assert.Samef(t, ptr1, ptr2, "error message %s", "formatted")
//
// Both arguments must be pointer variables. Pointer variable sameness is
// determined based on the equality of both type and value.
@@ -708,7 +750,7 @@ func Samef(t TestingT, expected interface{}, actual interface{}, msg string, arg
// Subsetf asserts that the specified list(array, slice...) contains all
// elements given in the specified subset(array, slice...).
//
-// assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
+// assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -718,7 +760,7 @@ func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args
// Truef asserts that the specified value is true.
//
-// assert.Truef(t, myBool, "error message %s", "formatted")
+// assert.Truef(t, myBool, "error message %s", "formatted")
func Truef(t TestingT, value bool, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -728,7 +770,7 @@ func Truef(t TestingT, value bool, msg string, args ...interface{}) bool {
// WithinDurationf asserts that the two times are within duration delta of each other.
//
-// assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
+// assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -736,6 +778,16 @@ func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta tim
return WithinDuration(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
}
+// WithinRangef asserts that a time is within a time range (inclusive).
+//
+// assert.WithinRangef(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted")
+func WithinRangef(t TestingT, actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) bool {
+ if h, ok := t.(tHelper); ok {
+ h.Helper()
+ }
+ return WithinRange(t, actual, start, end, append([]interface{}{msg}, args...)...)
+}
+
// YAMLEqf asserts that two YAML strings are equivalent.
func YAMLEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go b/vendor/github.com/stretchr/testify/assert/assertion_forward.go
index d9ea368d0a..b1d94aec53 100644
--- a/vendor/github.com/stretchr/testify/assert/assertion_forward.go
+++ b/vendor/github.com/stretchr/testify/assert/assertion_forward.go
@@ -30,9 +30,9 @@ func (a *Assertions) Conditionf(comp Comparison, msg string, args ...interface{}
// Contains asserts that the specified string, list(array, slice...) or map contains the
// specified substring or element.
//
-// a.Contains("Hello World", "World")
-// a.Contains(["Hello", "World"], "World")
-// a.Contains({"Hello": "World"}, "Hello")
+// a.Contains("Hello World", "World")
+// a.Contains(["Hello", "World"], "World")
+// a.Contains({"Hello": "World"}, "Hello")
func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -43,9 +43,9 @@ func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ..
// Containsf asserts that the specified string, list(array, slice...) or map contains the
// specified substring or element.
//
-// a.Containsf("Hello World", "World", "error message %s", "formatted")
-// a.Containsf(["Hello", "World"], "World", "error message %s", "formatted")
-// a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted")
+// a.Containsf("Hello World", "World", "error message %s", "formatted")
+// a.Containsf(["Hello", "World"], "World", "error message %s", "formatted")
+// a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted")
func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -98,7 +98,7 @@ func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg st
// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
// a slice or a channel with len == 0.
//
-// a.Empty(obj)
+// a.Empty(obj)
func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -109,7 +109,7 @@ func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool {
// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either
// a slice or a channel with len == 0.
//
-// a.Emptyf(obj, "error message %s", "formatted")
+// a.Emptyf(obj, "error message %s", "formatted")
func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -119,7 +119,7 @@ func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{})
// Equal asserts that two objects are equal.
//
-// a.Equal(123, 123)
+// a.Equal(123, 123)
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses). Function equality
@@ -134,8 +134,8 @@ func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs
// EqualError asserts that a function returned an error (i.e. not `nil`)
// and that it is equal to the provided error.
//
-// actualObj, err := SomeFunction()
-// a.EqualError(err, expectedErrorString)
+// actualObj, err := SomeFunction()
+// a.EqualError(err, expectedErrorString)
func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -146,8 +146,8 @@ func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...
// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
// and that it is equal to the provided error.
//
-// actualObj, err := SomeFunction()
-// a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted")
+// actualObj, err := SomeFunction()
+// a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted")
func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -155,10 +155,44 @@ func (a *Assertions) EqualErrorf(theError error, errString string, msg string, a
return EqualErrorf(a.t, theError, errString, msg, args...)
}
+// EqualExportedValues asserts that the types of two objects are equal and their public
+// fields are also equal. This is useful for comparing structs that have private fields
+// that could potentially differ.
+//
+// type S struct {
+// Exported int
+// notExported int
+// }
+// a.EqualExportedValues(S{1, 2}, S{1, 3}) => true
+// a.EqualExportedValues(S{1, 2}, S{2, 3}) => false
+func (a *Assertions) EqualExportedValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
+ if h, ok := a.t.(tHelper); ok {
+ h.Helper()
+ }
+ return EqualExportedValues(a.t, expected, actual, msgAndArgs...)
+}
+
+// EqualExportedValuesf asserts that the types of two objects are equal and their public
+// fields are also equal. This is useful for comparing structs that have private fields
+// that could potentially differ.
+//
+// type S struct {
+// Exported int
+// notExported int
+// }
+// a.EqualExportedValuesf(S{1, 2}, S{1, 3}, "error message %s", "formatted") => true
+// a.EqualExportedValuesf(S{1, 2}, S{2, 3}, "error message %s", "formatted") => false
+func (a *Assertions) EqualExportedValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
+ if h, ok := a.t.(tHelper); ok {
+ h.Helper()
+ }
+ return EqualExportedValuesf(a.t, expected, actual, msg, args...)
+}
+
// EqualValues asserts that two objects are equal or convertable to the same types
// and equal.
//
-// a.EqualValues(uint32(123), int32(123))
+// a.EqualValues(uint32(123), int32(123))
func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -169,7 +203,7 @@ func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAn
// EqualValuesf asserts that two objects are equal or convertable to the same types
// and equal.
//
-// a.EqualValuesf(uint32(123), int32(123), "error message %s", "formatted")
+// a.EqualValuesf(uint32(123), int32(123), "error message %s", "formatted")
func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -179,7 +213,7 @@ func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg
// Equalf asserts that two objects are equal.
//
-// a.Equalf(123, 123, "error message %s", "formatted")
+// a.Equalf(123, 123, "error message %s", "formatted")
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses). Function equality
@@ -193,10 +227,10 @@ func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string
// Error asserts that a function returned an error (i.e. not `nil`).
//
-// actualObj, err := SomeFunction()
-// if a.Error(err) {
-// assert.Equal(t, expectedError, err)
-// }
+// actualObj, err := SomeFunction()
+// if a.Error(err) {
+// assert.Equal(t, expectedError, err)
+// }
func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -225,8 +259,8 @@ func (a *Assertions) ErrorAsf(err error, target interface{}, msg string, args ..
// ErrorContains asserts that a function returned an error (i.e. not `nil`)
// and that the error contains the specified substring.
//
-// actualObj, err := SomeFunction()
-// a.ErrorContains(err, expectedErrorSubString)
+// actualObj, err := SomeFunction()
+// a.ErrorContains(err, expectedErrorSubString)
func (a *Assertions) ErrorContains(theError error, contains string, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -237,8 +271,8 @@ func (a *Assertions) ErrorContains(theError error, contains string, msgAndArgs .
// ErrorContainsf asserts that a function returned an error (i.e. not `nil`)
// and that the error contains the specified substring.
//
-// actualObj, err := SomeFunction()
-// a.ErrorContainsf(err, expectedErrorSubString, "error message %s", "formatted")
+// actualObj, err := SomeFunction()
+// a.ErrorContainsf(err, expectedErrorSubString, "error message %s", "formatted")
func (a *Assertions) ErrorContainsf(theError error, contains string, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -266,10 +300,10 @@ func (a *Assertions) ErrorIsf(err error, target error, msg string, args ...inter
// Errorf asserts that a function returned an error (i.e. not `nil`).
//
-// actualObj, err := SomeFunction()
-// if a.Errorf(err, "error message %s", "formatted") {
-// assert.Equal(t, expectedErrorf, err)
-// }
+// actualObj, err := SomeFunction()
+// if a.Errorf(err, "error message %s", "formatted") {
+// assert.Equal(t, expectedErrorf, err)
+// }
func (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -280,7 +314,7 @@ func (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool {
// Eventually asserts that given condition will be met in waitFor time,
// periodically checking target function each tick.
//
-// a.Eventually(func() bool { return true; }, time.Second, 10*time.Millisecond)
+// a.Eventually(func() bool { return true; }, time.Second, 10*time.Millisecond)
func (a *Assertions) Eventually(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -288,10 +322,60 @@ func (a *Assertions) Eventually(condition func() bool, waitFor time.Duration, ti
return Eventually(a.t, condition, waitFor, tick, msgAndArgs...)
}
+// EventuallyWithT asserts that given condition will be met in waitFor time,
+// periodically checking target function each tick. In contrast to Eventually,
+// it supplies a CollectT to the condition function, so that the condition
+// function can use the CollectT to call other assertions.
+// The condition is considered "met" if no errors are raised in a tick.
+// The supplied CollectT collects all errors from one tick (if there are any).
+// If the condition is not met before waitFor, the collected errors of
+// the last tick are copied to t.
+//
+// externalValue := false
+// go func() {
+// time.Sleep(8*time.Second)
+// externalValue = true
+// }()
+// a.EventuallyWithT(func(c *assert.CollectT) {
+// // add assertions as needed; any assertion failure will fail the current tick
+// assert.True(c, externalValue, "expected 'externalValue' to be true")
+// }, 1*time.Second, 10*time.Second, "external state has not changed to 'true'; still false")
+func (a *Assertions) EventuallyWithT(condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {
+ if h, ok := a.t.(tHelper); ok {
+ h.Helper()
+ }
+ return EventuallyWithT(a.t, condition, waitFor, tick, msgAndArgs...)
+}
+
+// EventuallyWithTf asserts that given condition will be met in waitFor time,
+// periodically checking target function each tick. In contrast to Eventually,
+// it supplies a CollectT to the condition function, so that the condition
+// function can use the CollectT to call other assertions.
+// The condition is considered "met" if no errors are raised in a tick.
+// The supplied CollectT collects all errors from one tick (if there are any).
+// If the condition is not met before waitFor, the collected errors of
+// the last tick are copied to t.
+//
+// externalValue := false
+// go func() {
+// time.Sleep(8*time.Second)
+// externalValue = true
+// }()
+// a.EventuallyWithTf(func(c *assert.CollectT, "error message %s", "formatted") {
+// // add assertions as needed; any assertion failure will fail the current tick
+// assert.True(c, externalValue, "expected 'externalValue' to be true")
+// }, 1*time.Second, 10*time.Second, "external state has not changed to 'true'; still false")
+func (a *Assertions) EventuallyWithTf(condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
+ if h, ok := a.t.(tHelper); ok {
+ h.Helper()
+ }
+ return EventuallyWithTf(a.t, condition, waitFor, tick, msg, args...)
+}
+
// Eventuallyf asserts that given condition will be met in waitFor time,
// periodically checking target function each tick.
//
-// a.Eventuallyf(func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
+// a.Eventuallyf(func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
func (a *Assertions) Eventuallyf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -301,7 +385,7 @@ func (a *Assertions) Eventuallyf(condition func() bool, waitFor time.Duration, t
// Exactly asserts that two objects are equal in value and type.
//
-// a.Exactly(int32(123), int64(123))
+// a.Exactly(int32(123), int64(123))
func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -311,7 +395,7 @@ func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArg
// Exactlyf asserts that two objects are equal in value and type.
//
-// a.Exactlyf(int32(123), int64(123), "error message %s", "formatted")
+// a.Exactlyf(int32(123), int64(123), "error message %s", "formatted")
func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -353,7 +437,7 @@ func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{
// False asserts that the specified value is false.
//
-// a.False(myBool)
+// a.False(myBool)
func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -363,7 +447,7 @@ func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool {
// Falsef asserts that the specified value is false.
//
-// a.Falsef(myBool, "error message %s", "formatted")
+// a.Falsef(myBool, "error message %s", "formatted")
func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -391,9 +475,9 @@ func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) b
// Greater asserts that the first element is greater than the second
//
-// a.Greater(2, 1)
-// a.Greater(float64(2), float64(1))
-// a.Greater("b", "a")
+// a.Greater(2, 1)
+// a.Greater(float64(2), float64(1))
+// a.Greater("b", "a")
func (a *Assertions) Greater(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -403,10 +487,10 @@ func (a *Assertions) Greater(e1 interface{}, e2 interface{}, msgAndArgs ...inter
// GreaterOrEqual asserts that the first element is greater than or equal to the second
//
-// a.GreaterOrEqual(2, 1)
-// a.GreaterOrEqual(2, 2)
-// a.GreaterOrEqual("b", "a")
-// a.GreaterOrEqual("b", "b")
+// a.GreaterOrEqual(2, 1)
+// a.GreaterOrEqual(2, 2)
+// a.GreaterOrEqual("b", "a")
+// a.GreaterOrEqual("b", "b")
func (a *Assertions) GreaterOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -416,10 +500,10 @@ func (a *Assertions) GreaterOrEqual(e1 interface{}, e2 interface{}, msgAndArgs .
// GreaterOrEqualf asserts that the first element is greater than or equal to the second
//
-// a.GreaterOrEqualf(2, 1, "error message %s", "formatted")
-// a.GreaterOrEqualf(2, 2, "error message %s", "formatted")
-// a.GreaterOrEqualf("b", "a", "error message %s", "formatted")
-// a.GreaterOrEqualf("b", "b", "error message %s", "formatted")
+// a.GreaterOrEqualf(2, 1, "error message %s", "formatted")
+// a.GreaterOrEqualf(2, 2, "error message %s", "formatted")
+// a.GreaterOrEqualf("b", "a", "error message %s", "formatted")
+// a.GreaterOrEqualf("b", "b", "error message %s", "formatted")
func (a *Assertions) GreaterOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -429,9 +513,9 @@ func (a *Assertions) GreaterOrEqualf(e1 interface{}, e2 interface{}, msg string,
// Greaterf asserts that the first element is greater than the second
//
-// a.Greaterf(2, 1, "error message %s", "formatted")
-// a.Greaterf(float64(2), float64(1), "error message %s", "formatted")
-// a.Greaterf("b", "a", "error message %s", "formatted")
+// a.Greaterf(2, 1, "error message %s", "formatted")
+// a.Greaterf(float64(2), float64(1), "error message %s", "formatted")
+// a.Greaterf("b", "a", "error message %s", "formatted")
func (a *Assertions) Greaterf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -442,7 +526,7 @@ func (a *Assertions) Greaterf(e1 interface{}, e2 interface{}, msg string, args .
// HTTPBodyContains asserts that a specified handler returns a
// body that contains a string.
//
-// a.HTTPBodyContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
+// a.HTTPBodyContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
//
// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {
@@ -455,7 +539,7 @@ func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, u
// HTTPBodyContainsf asserts that a specified handler returns a
// body that contains a string.
//
-// a.HTTPBodyContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
+// a.HTTPBodyContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
@@ -468,7 +552,7 @@ func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string,
// HTTPBodyNotContains asserts that a specified handler returns a
// body that does not contain a string.
//
-// a.HTTPBodyNotContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
+// a.HTTPBodyNotContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
//
// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {
@@ -481,7 +565,7 @@ func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string
// HTTPBodyNotContainsf asserts that a specified handler returns a
// body that does not contain a string.
//
-// a.HTTPBodyNotContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
+// a.HTTPBodyNotContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
@@ -493,7 +577,7 @@ func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method strin
// HTTPError asserts that a specified handler returns an error status code.
//
-// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {
@@ -505,7 +589,7 @@ func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url stri
// HTTPErrorf asserts that a specified handler returns an error status code.
//
-// a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+// a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
@@ -517,7 +601,7 @@ func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url str
// HTTPRedirect asserts that a specified handler returns a redirect status code.
//
-// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {
@@ -529,7 +613,7 @@ func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url s
// HTTPRedirectf asserts that a specified handler returns a redirect status code.
//
-// a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+// a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
@@ -541,7 +625,7 @@ func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url
// HTTPStatusCode asserts that a specified handler returns a specified status code.
//
-// a.HTTPStatusCode(myHandler, "GET", "/notImplemented", nil, 501)
+// a.HTTPStatusCode(myHandler, "GET", "/notImplemented", nil, 501)
//
// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) HTTPStatusCode(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) bool {
@@ -553,7 +637,7 @@ func (a *Assertions) HTTPStatusCode(handler http.HandlerFunc, method string, url
// HTTPStatusCodef asserts that a specified handler returns a specified status code.
//
-// a.HTTPStatusCodef(myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted")
+// a.HTTPStatusCodef(myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) HTTPStatusCodef(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) bool {
@@ -565,7 +649,7 @@ func (a *Assertions) HTTPStatusCodef(handler http.HandlerFunc, method string, ur
// HTTPSuccess asserts that a specified handler returns a success status code.
//
-// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil)
+// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil)
//
// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {
@@ -577,7 +661,7 @@ func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url st
// HTTPSuccessf asserts that a specified handler returns a success status code.
//
-// a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
+// a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
@@ -589,7 +673,7 @@ func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url s
// Implements asserts that an object is implemented by the specified interface.
//
-// a.Implements((*MyInterface)(nil), new(MyObject))
+// a.Implements((*MyInterface)(nil), new(MyObject))
func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -599,7 +683,7 @@ func (a *Assertions) Implements(interfaceObject interface{}, object interface{},
// Implementsf asserts that an object is implemented by the specified interface.
//
-// a.Implementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
+// a.Implementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -609,7 +693,7 @@ func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}
// InDelta asserts that the two numerals are within delta of each other.
//
-// a.InDelta(math.Pi, 22/7.0, 0.01)
+// a.InDelta(math.Pi, 22/7.0, 0.01)
func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -651,7 +735,7 @@ func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, del
// InDeltaf asserts that the two numerals are within delta of each other.
//
-// a.InDeltaf(math.Pi, 22/7.0, 0.01, "error message %s", "formatted")
+// a.InDeltaf(math.Pi, 22/7.0, 0.01, "error message %s", "formatted")
func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -693,9 +777,9 @@ func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilo
// IsDecreasing asserts that the collection is decreasing
//
-// a.IsDecreasing([]int{2, 1, 0})
-// a.IsDecreasing([]float{2, 1})
-// a.IsDecreasing([]string{"b", "a"})
+// a.IsDecreasing([]int{2, 1, 0})
+// a.IsDecreasing([]float{2, 1})
+// a.IsDecreasing([]string{"b", "a"})
func (a *Assertions) IsDecreasing(object interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -705,9 +789,9 @@ func (a *Assertions) IsDecreasing(object interface{}, msgAndArgs ...interface{})
// IsDecreasingf asserts that the collection is decreasing
//
-// a.IsDecreasingf([]int{2, 1, 0}, "error message %s", "formatted")
-// a.IsDecreasingf([]float{2, 1}, "error message %s", "formatted")
-// a.IsDecreasingf([]string{"b", "a"}, "error message %s", "formatted")
+// a.IsDecreasingf([]int{2, 1, 0}, "error message %s", "formatted")
+// a.IsDecreasingf([]float{2, 1}, "error message %s", "formatted")
+// a.IsDecreasingf([]string{"b", "a"}, "error message %s", "formatted")
func (a *Assertions) IsDecreasingf(object interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -717,9 +801,9 @@ func (a *Assertions) IsDecreasingf(object interface{}, msg string, args ...inter
// IsIncreasing asserts that the collection is increasing
//
-// a.IsIncreasing([]int{1, 2, 3})
-// a.IsIncreasing([]float{1, 2})
-// a.IsIncreasing([]string{"a", "b"})
+// a.IsIncreasing([]int{1, 2, 3})
+// a.IsIncreasing([]float{1, 2})
+// a.IsIncreasing([]string{"a", "b"})
func (a *Assertions) IsIncreasing(object interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -729,9 +813,9 @@ func (a *Assertions) IsIncreasing(object interface{}, msgAndArgs ...interface{})
// IsIncreasingf asserts that the collection is increasing
//
-// a.IsIncreasingf([]int{1, 2, 3}, "error message %s", "formatted")
-// a.IsIncreasingf([]float{1, 2}, "error message %s", "formatted")
-// a.IsIncreasingf([]string{"a", "b"}, "error message %s", "formatted")
+// a.IsIncreasingf([]int{1, 2, 3}, "error message %s", "formatted")
+// a.IsIncreasingf([]float{1, 2}, "error message %s", "formatted")
+// a.IsIncreasingf([]string{"a", "b"}, "error message %s", "formatted")
func (a *Assertions) IsIncreasingf(object interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -741,9 +825,9 @@ func (a *Assertions) IsIncreasingf(object interface{}, msg string, args ...inter
// IsNonDecreasing asserts that the collection is not decreasing
//
-// a.IsNonDecreasing([]int{1, 1, 2})
-// a.IsNonDecreasing([]float{1, 2})
-// a.IsNonDecreasing([]string{"a", "b"})
+// a.IsNonDecreasing([]int{1, 1, 2})
+// a.IsNonDecreasing([]float{1, 2})
+// a.IsNonDecreasing([]string{"a", "b"})
func (a *Assertions) IsNonDecreasing(object interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -753,9 +837,9 @@ func (a *Assertions) IsNonDecreasing(object interface{}, msgAndArgs ...interface
// IsNonDecreasingf asserts that the collection is not decreasing
//
-// a.IsNonDecreasingf([]int{1, 1, 2}, "error message %s", "formatted")
-// a.IsNonDecreasingf([]float{1, 2}, "error message %s", "formatted")
-// a.IsNonDecreasingf([]string{"a", "b"}, "error message %s", "formatted")
+// a.IsNonDecreasingf([]int{1, 1, 2}, "error message %s", "formatted")
+// a.IsNonDecreasingf([]float{1, 2}, "error message %s", "formatted")
+// a.IsNonDecreasingf([]string{"a", "b"}, "error message %s", "formatted")
func (a *Assertions) IsNonDecreasingf(object interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -765,9 +849,9 @@ func (a *Assertions) IsNonDecreasingf(object interface{}, msg string, args ...in
// IsNonIncreasing asserts that the collection is not increasing
//
-// a.IsNonIncreasing([]int{2, 1, 1})
-// a.IsNonIncreasing([]float{2, 1})
-// a.IsNonIncreasing([]string{"b", "a"})
+// a.IsNonIncreasing([]int{2, 1, 1})
+// a.IsNonIncreasing([]float{2, 1})
+// a.IsNonIncreasing([]string{"b", "a"})
func (a *Assertions) IsNonIncreasing(object interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -777,9 +861,9 @@ func (a *Assertions) IsNonIncreasing(object interface{}, msgAndArgs ...interface
// IsNonIncreasingf asserts that the collection is not increasing
//
-// a.IsNonIncreasingf([]int{2, 1, 1}, "error message %s", "formatted")
-// a.IsNonIncreasingf([]float{2, 1}, "error message %s", "formatted")
-// a.IsNonIncreasingf([]string{"b", "a"}, "error message %s", "formatted")
+// a.IsNonIncreasingf([]int{2, 1, 1}, "error message %s", "formatted")
+// a.IsNonIncreasingf([]float{2, 1}, "error message %s", "formatted")
+// a.IsNonIncreasingf([]string{"b", "a"}, "error message %s", "formatted")
func (a *Assertions) IsNonIncreasingf(object interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -805,7 +889,7 @@ func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg s
// JSONEq asserts that two JSON strings are equivalent.
//
-// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
+// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -815,7 +899,7 @@ func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interf
// JSONEqf asserts that two JSON strings are equivalent.
//
-// a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
+// a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -826,7 +910,7 @@ func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ..
// Len asserts that the specified object has specific length.
// Len also fails if the object has a type that len() not accept.
//
-// a.Len(mySlice, 3)
+// a.Len(mySlice, 3)
func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -837,7 +921,7 @@ func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface
// Lenf asserts that the specified object has specific length.
// Lenf also fails if the object has a type that len() not accept.
//
-// a.Lenf(mySlice, 3, "error message %s", "formatted")
+// a.Lenf(mySlice, 3, "error message %s", "formatted")
func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -847,9 +931,9 @@ func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...in
// Less asserts that the first element is less than the second
//
-// a.Less(1, 2)
-// a.Less(float64(1), float64(2))
-// a.Less("a", "b")
+// a.Less(1, 2)
+// a.Less(float64(1), float64(2))
+// a.Less("a", "b")
func (a *Assertions) Less(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -859,10 +943,10 @@ func (a *Assertions) Less(e1 interface{}, e2 interface{}, msgAndArgs ...interfac
// LessOrEqual asserts that the first element is less than or equal to the second
//
-// a.LessOrEqual(1, 2)
-// a.LessOrEqual(2, 2)
-// a.LessOrEqual("a", "b")
-// a.LessOrEqual("b", "b")
+// a.LessOrEqual(1, 2)
+// a.LessOrEqual(2, 2)
+// a.LessOrEqual("a", "b")
+// a.LessOrEqual("b", "b")
func (a *Assertions) LessOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -872,10 +956,10 @@ func (a *Assertions) LessOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...i
// LessOrEqualf asserts that the first element is less than or equal to the second
//
-// a.LessOrEqualf(1, 2, "error message %s", "formatted")
-// a.LessOrEqualf(2, 2, "error message %s", "formatted")
-// a.LessOrEqualf("a", "b", "error message %s", "formatted")
-// a.LessOrEqualf("b", "b", "error message %s", "formatted")
+// a.LessOrEqualf(1, 2, "error message %s", "formatted")
+// a.LessOrEqualf(2, 2, "error message %s", "formatted")
+// a.LessOrEqualf("a", "b", "error message %s", "formatted")
+// a.LessOrEqualf("b", "b", "error message %s", "formatted")
func (a *Assertions) LessOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -885,9 +969,9 @@ func (a *Assertions) LessOrEqualf(e1 interface{}, e2 interface{}, msg string, ar
// Lessf asserts that the first element is less than the second
//
-// a.Lessf(1, 2, "error message %s", "formatted")
-// a.Lessf(float64(1), float64(2), "error message %s", "formatted")
-// a.Lessf("a", "b", "error message %s", "formatted")
+// a.Lessf(1, 2, "error message %s", "formatted")
+// a.Lessf(float64(1), float64(2), "error message %s", "formatted")
+// a.Lessf("a", "b", "error message %s", "formatted")
func (a *Assertions) Lessf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -897,8 +981,8 @@ func (a *Assertions) Lessf(e1 interface{}, e2 interface{}, msg string, args ...i
// Negative asserts that the specified element is negative
//
-// a.Negative(-1)
-// a.Negative(-1.23)
+// a.Negative(-1)
+// a.Negative(-1.23)
func (a *Assertions) Negative(e interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -908,8 +992,8 @@ func (a *Assertions) Negative(e interface{}, msgAndArgs ...interface{}) bool {
// Negativef asserts that the specified element is negative
//
-// a.Negativef(-1, "error message %s", "formatted")
-// a.Negativef(-1.23, "error message %s", "formatted")
+// a.Negativef(-1, "error message %s", "formatted")
+// a.Negativef(-1.23, "error message %s", "formatted")
func (a *Assertions) Negativef(e interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -920,7 +1004,7 @@ func (a *Assertions) Negativef(e interface{}, msg string, args ...interface{}) b
// Never asserts that the given condition doesn't satisfy in waitFor time,
// periodically checking the target function each tick.
//
-// a.Never(func() bool { return false; }, time.Second, 10*time.Millisecond)
+// a.Never(func() bool { return false; }, time.Second, 10*time.Millisecond)
func (a *Assertions) Never(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -931,7 +1015,7 @@ func (a *Assertions) Never(condition func() bool, waitFor time.Duration, tick ti
// Neverf asserts that the given condition doesn't satisfy in waitFor time,
// periodically checking the target function each tick.
//
-// a.Neverf(func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
+// a.Neverf(func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
func (a *Assertions) Neverf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -941,7 +1025,7 @@ func (a *Assertions) Neverf(condition func() bool, waitFor time.Duration, tick t
// Nil asserts that the specified object is nil.
//
-// a.Nil(err)
+// a.Nil(err)
func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -951,7 +1035,7 @@ func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool {
// Nilf asserts that the specified object is nil.
//
-// a.Nilf(err, "error message %s", "formatted")
+// a.Nilf(err, "error message %s", "formatted")
func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -979,10 +1063,10 @@ func (a *Assertions) NoDirExistsf(path string, msg string, args ...interface{})
// NoError asserts that a function returned no error (i.e. `nil`).
//
-// actualObj, err := SomeFunction()
-// if a.NoError(err) {
-// assert.Equal(t, expectedObj, actualObj)
-// }
+// actualObj, err := SomeFunction()
+// if a.NoError(err) {
+// assert.Equal(t, expectedObj, actualObj)
+// }
func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -992,10 +1076,10 @@ func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool {
// NoErrorf asserts that a function returned no error (i.e. `nil`).
//
-// actualObj, err := SomeFunction()
-// if a.NoErrorf(err, "error message %s", "formatted") {
-// assert.Equal(t, expectedObj, actualObj)
-// }
+// actualObj, err := SomeFunction()
+// if a.NoErrorf(err, "error message %s", "formatted") {
+// assert.Equal(t, expectedObj, actualObj)
+// }
func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1024,9 +1108,9 @@ func (a *Assertions) NoFileExistsf(path string, msg string, args ...interface{})
// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
// specified substring or element.
//
-// a.NotContains("Hello World", "Earth")
-// a.NotContains(["Hello", "World"], "Earth")
-// a.NotContains({"Hello": "World"}, "Earth")
+// a.NotContains("Hello World", "Earth")
+// a.NotContains(["Hello", "World"], "Earth")
+// a.NotContains({"Hello": "World"}, "Earth")
func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1037,9 +1121,9 @@ func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs
// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
// specified substring or element.
//
-// a.NotContainsf("Hello World", "Earth", "error message %s", "formatted")
-// a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted")
-// a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted")
+// a.NotContainsf("Hello World", "Earth", "error message %s", "formatted")
+// a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted")
+// a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted")
func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1050,9 +1134,9 @@ func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg strin
// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
// a slice or a channel with len == 0.
//
-// if a.NotEmpty(obj) {
-// assert.Equal(t, "two", obj[1])
-// }
+// if a.NotEmpty(obj) {
+// assert.Equal(t, "two", obj[1])
+// }
func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1063,9 +1147,9 @@ func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) boo
// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
// a slice or a channel with len == 0.
//
-// if a.NotEmptyf(obj, "error message %s", "formatted") {
-// assert.Equal(t, "two", obj[1])
-// }
+// if a.NotEmptyf(obj, "error message %s", "formatted") {
+// assert.Equal(t, "two", obj[1])
+// }
func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1075,7 +1159,7 @@ func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface
// NotEqual asserts that the specified values are NOT equal.
//
-// a.NotEqual(obj1, obj2)
+// a.NotEqual(obj1, obj2)
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses).
@@ -1088,7 +1172,7 @@ func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndAr
// NotEqualValues asserts that two objects are not equal even when converted to the same type
//
-// a.NotEqualValues(obj1, obj2)
+// a.NotEqualValues(obj1, obj2)
func (a *Assertions) NotEqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1098,7 +1182,7 @@ func (a *Assertions) NotEqualValues(expected interface{}, actual interface{}, ms
// NotEqualValuesf asserts that two objects are not equal even when converted to the same type
//
-// a.NotEqualValuesf(obj1, obj2, "error message %s", "formatted")
+// a.NotEqualValuesf(obj1, obj2, "error message %s", "formatted")
func (a *Assertions) NotEqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1108,7 +1192,7 @@ func (a *Assertions) NotEqualValuesf(expected interface{}, actual interface{}, m
// NotEqualf asserts that the specified values are NOT equal.
//
-// a.NotEqualf(obj1, obj2, "error message %s", "formatted")
+// a.NotEqualf(obj1, obj2, "error message %s", "formatted")
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses).
@@ -1139,7 +1223,7 @@ func (a *Assertions) NotErrorIsf(err error, target error, msg string, args ...in
// NotNil asserts that the specified object is not nil.
//
-// a.NotNil(err)
+// a.NotNil(err)
func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1149,7 +1233,7 @@ func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool
// NotNilf asserts that the specified object is not nil.
//
-// a.NotNilf(err, "error message %s", "formatted")
+// a.NotNilf(err, "error message %s", "formatted")
func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1159,7 +1243,7 @@ func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}
// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
//
-// a.NotPanics(func(){ RemainCalm() })
+// a.NotPanics(func(){ RemainCalm() })
func (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1169,7 +1253,7 @@ func (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool
// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
//
-// a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted")
+// a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted")
func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1179,8 +1263,8 @@ func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}
// NotRegexp asserts that a specified regexp does not match a string.
//
-// a.NotRegexp(regexp.MustCompile("starts"), "it's starting")
-// a.NotRegexp("^start", "it's not starting")
+// a.NotRegexp(regexp.MustCompile("starts"), "it's starting")
+// a.NotRegexp("^start", "it's not starting")
func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1190,8 +1274,8 @@ func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...in
// NotRegexpf asserts that a specified regexp does not match a string.
//
-// a.NotRegexpf(regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted")
-// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted")
+// a.NotRegexpf(regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted")
+// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted")
func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1201,7 +1285,7 @@ func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, arg
// NotSame asserts that two pointers do not reference the same object.
//
-// a.NotSame(ptr1, ptr2)
+// a.NotSame(ptr1, ptr2)
//
// Both arguments must be pointer variables. Pointer variable sameness is
// determined based on the equality of both type and value.
@@ -1214,7 +1298,7 @@ func (a *Assertions) NotSame(expected interface{}, actual interface{}, msgAndArg
// NotSamef asserts that two pointers do not reference the same object.
//
-// a.NotSamef(ptr1, ptr2, "error message %s", "formatted")
+// a.NotSamef(ptr1, ptr2, "error message %s", "formatted")
//
// Both arguments must be pointer variables. Pointer variable sameness is
// determined based on the equality of both type and value.
@@ -1228,7 +1312,7 @@ func (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg stri
// NotSubset asserts that the specified list(array, slice...) contains not all
// elements given in the specified subset(array, slice...).
//
-// a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]")
+// a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]")
func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1239,7 +1323,7 @@ func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs
// NotSubsetf asserts that the specified list(array, slice...) contains not all
// elements given in the specified subset(array, slice...).
//
-// a.NotSubsetf([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
+// a.NotSubsetf([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1265,7 +1349,7 @@ func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) bo
// Panics asserts that the code inside the specified PanicTestFunc panics.
//
-// a.Panics(func(){ GoCrazy() })
+// a.Panics(func(){ GoCrazy() })
func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1277,7 +1361,7 @@ func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool {
// panics, and that the recovered panic value is an error that satisfies the
// EqualError comparison.
//
-// a.PanicsWithError("crazy error", func(){ GoCrazy() })
+// a.PanicsWithError("crazy error", func(){ GoCrazy() })
func (a *Assertions) PanicsWithError(errString string, f PanicTestFunc, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1289,7 +1373,7 @@ func (a *Assertions) PanicsWithError(errString string, f PanicTestFunc, msgAndAr
// panics, and that the recovered panic value is an error that satisfies the
// EqualError comparison.
//
-// a.PanicsWithErrorf("crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
+// a.PanicsWithErrorf("crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
func (a *Assertions) PanicsWithErrorf(errString string, f PanicTestFunc, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1300,7 +1384,7 @@ func (a *Assertions) PanicsWithErrorf(errString string, f PanicTestFunc, msg str
// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
// the recovered panic value equals the expected panic value.
//
-// a.PanicsWithValue("crazy error", func(){ GoCrazy() })
+// a.PanicsWithValue("crazy error", func(){ GoCrazy() })
func (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1311,7 +1395,7 @@ func (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFunc, msgA
// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
// the recovered panic value equals the expected panic value.
//
-// a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
+// a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
func (a *Assertions) PanicsWithValuef(expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1321,7 +1405,7 @@ func (a *Assertions) PanicsWithValuef(expected interface{}, f PanicTestFunc, msg
// Panicsf asserts that the code inside the specified PanicTestFunc panics.
//
-// a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted")
+// a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted")
func (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1331,8 +1415,8 @@ func (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) b
// Positive asserts that the specified element is positive
//
-// a.Positive(1)
-// a.Positive(1.23)
+// a.Positive(1)
+// a.Positive(1.23)
func (a *Assertions) Positive(e interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1342,8 +1426,8 @@ func (a *Assertions) Positive(e interface{}, msgAndArgs ...interface{}) bool {
// Positivef asserts that the specified element is positive
//
-// a.Positivef(1, "error message %s", "formatted")
-// a.Positivef(1.23, "error message %s", "formatted")
+// a.Positivef(1, "error message %s", "formatted")
+// a.Positivef(1.23, "error message %s", "formatted")
func (a *Assertions) Positivef(e interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1353,8 +1437,8 @@ func (a *Assertions) Positivef(e interface{}, msg string, args ...interface{}) b
// Regexp asserts that a specified regexp matches a string.
//
-// a.Regexp(regexp.MustCompile("start"), "it's starting")
-// a.Regexp("start...$", "it's not starting")
+// a.Regexp(regexp.MustCompile("start"), "it's starting")
+// a.Regexp("start...$", "it's not starting")
func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1364,8 +1448,8 @@ func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...inter
// Regexpf asserts that a specified regexp matches a string.
//
-// a.Regexpf(regexp.MustCompile("start"), "it's starting", "error message %s", "formatted")
-// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted")
+// a.Regexpf(regexp.MustCompile("start"), "it's starting", "error message %s", "formatted")
+// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted")
func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1375,7 +1459,7 @@ func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args .
// Same asserts that two pointers reference the same object.
//
-// a.Same(ptr1, ptr2)
+// a.Same(ptr1, ptr2)
//
// Both arguments must be pointer variables. Pointer variable sameness is
// determined based on the equality of both type and value.
@@ -1388,7 +1472,7 @@ func (a *Assertions) Same(expected interface{}, actual interface{}, msgAndArgs .
// Samef asserts that two pointers reference the same object.
//
-// a.Samef(ptr1, ptr2, "error message %s", "formatted")
+// a.Samef(ptr1, ptr2, "error message %s", "formatted")
//
// Both arguments must be pointer variables. Pointer variable sameness is
// determined based on the equality of both type and value.
@@ -1402,7 +1486,7 @@ func (a *Assertions) Samef(expected interface{}, actual interface{}, msg string,
// Subset asserts that the specified list(array, slice...) contains all
// elements given in the specified subset(array, slice...).
//
-// a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
+// a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1413,7 +1497,7 @@ func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...
// Subsetf asserts that the specified list(array, slice...) contains all
// elements given in the specified subset(array, slice...).
//
-// a.Subsetf([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
+// a.Subsetf([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1423,7 +1507,7 @@ func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, a
// True asserts that the specified value is true.
//
-// a.True(myBool)
+// a.True(myBool)
func (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1433,7 +1517,7 @@ func (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool {
// Truef asserts that the specified value is true.
//
-// a.Truef(myBool, "error message %s", "formatted")
+// a.Truef(myBool, "error message %s", "formatted")
func (a *Assertions) Truef(value bool, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1443,7 +1527,7 @@ func (a *Assertions) Truef(value bool, msg string, args ...interface{}) bool {
// WithinDuration asserts that the two times are within duration delta of each other.
//
-// a.WithinDuration(time.Now(), time.Now(), 10*time.Second)
+// a.WithinDuration(time.Now(), time.Now(), 10*time.Second)
func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1453,7 +1537,7 @@ func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta
// WithinDurationf asserts that the two times are within duration delta of each other.
//
-// a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
+// a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
@@ -1461,6 +1545,26 @@ func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta
return WithinDurationf(a.t, expected, actual, delta, msg, args...)
}
+// WithinRange asserts that a time is within a time range (inclusive).
+//
+// a.WithinRange(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second))
+func (a *Assertions) WithinRange(actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) bool {
+ if h, ok := a.t.(tHelper); ok {
+ h.Helper()
+ }
+ return WithinRange(a.t, actual, start, end, msgAndArgs...)
+}
+
+// WithinRangef asserts that a time is within a time range (inclusive).
+//
+// a.WithinRangef(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted")
+func (a *Assertions) WithinRangef(actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) bool {
+ if h, ok := a.t.(tHelper); ok {
+ h.Helper()
+ }
+ return WithinRangef(a.t, actual, start, end, msg, args...)
+}
+
// YAMLEq asserts that two YAML strings are equivalent.
func (a *Assertions) YAMLEq(expected string, actual string, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
diff --git a/vendor/github.com/stretchr/testify/assert/assertion_order.go b/vendor/github.com/stretchr/testify/assert/assertion_order.go
index 7594487835..00df62a059 100644
--- a/vendor/github.com/stretchr/testify/assert/assertion_order.go
+++ b/vendor/github.com/stretchr/testify/assert/assertion_order.go
@@ -46,36 +46,36 @@ func isOrdered(t TestingT, object interface{}, allowedComparesResults []CompareT
// IsIncreasing asserts that the collection is increasing
//
-// assert.IsIncreasing(t, []int{1, 2, 3})
-// assert.IsIncreasing(t, []float{1, 2})
-// assert.IsIncreasing(t, []string{"a", "b"})
+// assert.IsIncreasing(t, []int{1, 2, 3})
+// assert.IsIncreasing(t, []float{1, 2})
+// assert.IsIncreasing(t, []string{"a", "b"})
func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
return isOrdered(t, object, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...)
}
// IsNonIncreasing asserts that the collection is not increasing
//
-// assert.IsNonIncreasing(t, []int{2, 1, 1})
-// assert.IsNonIncreasing(t, []float{2, 1})
-// assert.IsNonIncreasing(t, []string{"b", "a"})
+// assert.IsNonIncreasing(t, []int{2, 1, 1})
+// assert.IsNonIncreasing(t, []float{2, 1})
+// assert.IsNonIncreasing(t, []string{"b", "a"})
func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
return isOrdered(t, object, []CompareType{compareEqual, compareGreater}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...)
}
// IsDecreasing asserts that the collection is decreasing
//
-// assert.IsDecreasing(t, []int{2, 1, 0})
-// assert.IsDecreasing(t, []float{2, 1})
-// assert.IsDecreasing(t, []string{"b", "a"})
+// assert.IsDecreasing(t, []int{2, 1, 0})
+// assert.IsDecreasing(t, []float{2, 1})
+// assert.IsDecreasing(t, []string{"b", "a"})
func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
return isOrdered(t, object, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...)
}
// IsNonDecreasing asserts that the collection is not decreasing
//
-// assert.IsNonDecreasing(t, []int{1, 1, 2})
-// assert.IsNonDecreasing(t, []float{1, 2})
-// assert.IsNonDecreasing(t, []string{"a", "b"})
+// assert.IsNonDecreasing(t, []int{1, 1, 2})
+// assert.IsNonDecreasing(t, []float{1, 2})
+// assert.IsNonDecreasing(t, []string{"a", "b"})
func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
return isOrdered(t, object, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...)
}
diff --git a/vendor/github.com/stretchr/testify/assert/assertions.go b/vendor/github.com/stretchr/testify/assert/assertions.go
index 0357b2231a..a55d1bba92 100644
--- a/vendor/github.com/stretchr/testify/assert/assertions.go
+++ b/vendor/github.com/stretchr/testify/assert/assertions.go
@@ -75,6 +75,77 @@ func ObjectsAreEqual(expected, actual interface{}) bool {
return bytes.Equal(exp, act)
}
+// copyExportedFields iterates downward through nested data structures and creates a copy
+// that only contains the exported struct fields.
+func copyExportedFields(expected interface{}) interface{} {
+ if isNil(expected) {
+ return expected
+ }
+
+ expectedType := reflect.TypeOf(expected)
+ expectedKind := expectedType.Kind()
+ expectedValue := reflect.ValueOf(expected)
+
+ switch expectedKind {
+ case reflect.Struct:
+ result := reflect.New(expectedType).Elem()
+ for i := 0; i < expectedType.NumField(); i++ {
+ field := expectedType.Field(i)
+ isExported := field.IsExported()
+ if isExported {
+ fieldValue := expectedValue.Field(i)
+ if isNil(fieldValue) || isNil(fieldValue.Interface()) {
+ continue
+ }
+ newValue := copyExportedFields(fieldValue.Interface())
+ result.Field(i).Set(reflect.ValueOf(newValue))
+ }
+ }
+ return result.Interface()
+
+ case reflect.Ptr:
+ result := reflect.New(expectedType.Elem())
+ unexportedRemoved := copyExportedFields(expectedValue.Elem().Interface())
+ result.Elem().Set(reflect.ValueOf(unexportedRemoved))
+ return result.Interface()
+
+ case reflect.Array, reflect.Slice:
+ result := reflect.MakeSlice(expectedType, expectedValue.Len(), expectedValue.Len())
+ for i := 0; i < expectedValue.Len(); i++ {
+ index := expectedValue.Index(i)
+ if isNil(index) {
+ continue
+ }
+ unexportedRemoved := copyExportedFields(index.Interface())
+ result.Index(i).Set(reflect.ValueOf(unexportedRemoved))
+ }
+ return result.Interface()
+
+ case reflect.Map:
+ result := reflect.MakeMap(expectedType)
+ for _, k := range expectedValue.MapKeys() {
+ index := expectedValue.MapIndex(k)
+ unexportedRemoved := copyExportedFields(index.Interface())
+ result.SetMapIndex(k, reflect.ValueOf(unexportedRemoved))
+ }
+ return result.Interface()
+
+ default:
+ return expected
+ }
+}
+
+// ObjectsExportedFieldsAreEqual determines if the exported (public) fields of two objects are
+// considered equal. This comparison of only exported fields is applied recursively to nested data
+// structures.
+//
+// This function does no assertion of any kind.
+func ObjectsExportedFieldsAreEqual(expected, actual interface{}) bool {
+ expectedCleaned := copyExportedFields(expected)
+ actualCleaned := copyExportedFields(actual)
+ return ObjectsAreEqualValues(expectedCleaned, actualCleaned)
+}
+
// ObjectsAreEqualValues gets whether two objects are equal, or if their
// values are equal.
func ObjectsAreEqualValues(expected, actual interface{}) bool {
@@ -140,10 +211,10 @@ func CallerInfo() []string {
}
parts := strings.Split(file, "/")
- file = parts[len(parts)-1]
if len(parts) > 1 {
+ filename := parts[len(parts)-1]
dir := parts[len(parts)-2]
- if (dir != "assert" && dir != "mock" && dir != "require") || file == "mock_test.go" {
+ if (dir != "assert" && dir != "mock" && dir != "require") || filename == "mock_test.go" {
callers = append(callers, fmt.Sprintf("%s:%d", file, line))
}
}
@@ -271,7 +342,7 @@ type labeledContent struct {
// labeledOutput returns a string consisting of the provided labeledContent. Each labeled output is appended in the following manner:
//
-// \t{{label}}:{{align_spaces}}\t{{content}}\n
+// \t{{label}}:{{align_spaces}}\t{{content}}\n
//
// The initial carriage return is required to undo/erase any padding added by testing.T.Errorf. The "\t{{label}}:" is for the label.
// If a label is shorter than the longest label provided, padding spaces are added to make all the labels match in length. Once this
@@ -294,7 +365,7 @@ func labeledOutput(content ...labeledContent) string {
// Implements asserts that an object is implemented by the specified interface.
//
-// assert.Implements(t, (*MyInterface)(nil), new(MyObject))
+// assert.Implements(t, (*MyInterface)(nil), new(MyObject))
func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -326,7 +397,7 @@ func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs
// Equal asserts that two objects are equal.
//
-// assert.Equal(t, 123, 123)
+// assert.Equal(t, 123, 123)
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses). Function equality
@@ -367,7 +438,7 @@ func validateEqualArgs(expected, actual interface{}) error {
// Same asserts that two pointers reference the same object.
//
-// assert.Same(t, ptr1, ptr2)
+// assert.Same(t, ptr1, ptr2)
//
// Both arguments must be pointer variables. Pointer variable sameness is
// determined based on the equality of both type and value.
@@ -387,7 +458,7 @@ func Same(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) b
// NotSame asserts that two pointers do not reference the same object.
//
-// assert.NotSame(t, ptr1, ptr2)
+// assert.NotSame(t, ptr1, ptr2)
//
// Both arguments must be pointer variables. Pointer variable sameness is
// determined based on the equality of both type and value.
@@ -455,7 +526,7 @@ func truncatingFormat(data interface{}) string {
// EqualValues asserts that two objects are equal or convertable to the same types
// and equal.
//
-// assert.EqualValues(t, uint32(123), int32(123))
+// assert.EqualValues(t, uint32(123), int32(123))
func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -473,9 +544,53 @@ func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interfa
}
+// EqualExportedValues asserts that the types of two objects are equal and their public
+// fields are also equal. This is useful for comparing structs that have private fields
+// that could potentially differ.
+//
+// type S struct {
+// Exported int
+// notExported int
+// }
+// assert.EqualExportedValues(t, S{1, 2}, S{1, 3}) => true
+// assert.EqualExportedValues(t, S{1, 2}, S{2, 3}) => false
+func EqualExportedValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
+ if h, ok := t.(tHelper); ok {
+ h.Helper()
+ }
+
+ aType := reflect.TypeOf(expected)
+ bType := reflect.TypeOf(actual)
+
+ if aType != bType {
+ return Fail(t, fmt.Sprintf("Types expected to match exactly\n\t%v != %v", aType, bType), msgAndArgs...)
+ }
+
+ if aType.Kind() != reflect.Struct {
+ return Fail(t, fmt.Sprintf("Types expected to both be struct \n\t%v != %v", aType.Kind(), reflect.Struct), msgAndArgs...)
+ }
+
+ if bType.Kind() != reflect.Struct {
+ return Fail(t, fmt.Sprintf("Types expected to both be struct \n\t%v != %v", bType.Kind(), reflect.Struct), msgAndArgs...)
+ }
+
+ expected = copyExportedFields(expected)
+ actual = copyExportedFields(actual)
+
+ if !ObjectsAreEqualValues(expected, actual) {
+ diff := diff(expected, actual)
+ expected, actual = formatUnequalValues(expected, actual)
+ return Fail(t, fmt.Sprintf("Not equal (comparing only exported fields): \n"+
+ "expected: %s\n"+
+ "actual : %s%s", expected, actual, diff), msgAndArgs...)
+ }
+
+ return true
+}
+
// Exactly asserts that two objects are equal in value and type.
//
-// assert.Exactly(t, int32(123), int64(123))
+// assert.Exactly(t, int32(123), int64(123))
func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -494,7 +609,7 @@ func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}
// NotNil asserts that the specified object is not nil.
//
-// assert.NotNil(t, err)
+// assert.NotNil(t, err)
func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
if !isNil(object) {
return true
@@ -528,7 +643,7 @@ func isNil(object interface{}) bool {
[]reflect.Kind{
reflect.Chan, reflect.Func,
reflect.Interface, reflect.Map,
- reflect.Ptr, reflect.Slice},
+ reflect.Ptr, reflect.Slice, reflect.UnsafePointer},
kind)
if isNilableKind && value.IsNil() {
@@ -540,7 +655,7 @@ func isNil(object interface{}) bool {
// Nil asserts that the specified object is nil.
//
-// assert.Nil(t, err)
+// assert.Nil(t, err)
func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
if isNil(object) {
return true
@@ -563,16 +678,17 @@ func isEmpty(object interface{}) bool {
switch objValue.Kind() {
// collection types are empty when they have no element
- case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:
+ case reflect.Chan, reflect.Map, reflect.Slice:
return objValue.Len() == 0
- // pointers are empty if nil or if the value they point to is empty
+ // pointers are empty if nil or if the value they point to is empty
case reflect.Ptr:
if objValue.IsNil() {
return true
}
deref := objValue.Elem().Interface()
return isEmpty(deref)
- // for all other types, compare against the zero value
+ // for all other types, compare against the zero value
+ // array types are empty when they match their zero-initialized state
default:
zero := reflect.Zero(objValue.Type())
return reflect.DeepEqual(object, zero.Interface())
@@ -582,7 +698,7 @@ func isEmpty(object interface{}) bool {
// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
// a slice or a channel with len == 0.
//
-// assert.Empty(t, obj)
+// assert.Empty(t, obj)
func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
pass := isEmpty(object)
if !pass {
@@ -599,9 +715,9 @@ func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
// a slice or a channel with len == 0.
//
-// if assert.NotEmpty(t, obj) {
-// assert.Equal(t, "two", obj[1])
-// }
+// if assert.NotEmpty(t, obj) {
+// assert.Equal(t, "two", obj[1])
+// }
func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
pass := !isEmpty(object)
if !pass {
@@ -630,7 +746,7 @@ func getLen(x interface{}) (ok bool, length int) {
// Len asserts that the specified object has specific length.
// Len also fails if the object has a type that len() not accept.
//
-// assert.Len(t, mySlice, 3)
+// assert.Len(t, mySlice, 3)
func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -648,7 +764,7 @@ func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{})
// True asserts that the specified value is true.
//
-// assert.True(t, myBool)
+// assert.True(t, myBool)
func True(t TestingT, value bool, msgAndArgs ...interface{}) bool {
if !value {
if h, ok := t.(tHelper); ok {
@@ -663,7 +779,7 @@ func True(t TestingT, value bool, msgAndArgs ...interface{}) bool {
// False asserts that the specified value is false.
//
-// assert.False(t, myBool)
+// assert.False(t, myBool)
func False(t TestingT, value bool, msgAndArgs ...interface{}) bool {
if value {
if h, ok := t.(tHelper); ok {
@@ -678,7 +794,7 @@ func False(t TestingT, value bool, msgAndArgs ...interface{}) bool {
// NotEqual asserts that the specified values are NOT equal.
//
-// assert.NotEqual(t, obj1, obj2)
+// assert.NotEqual(t, obj1, obj2)
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses).
@@ -701,7 +817,7 @@ func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{
// NotEqualValues asserts that two objects are not equal even when converted to the same type
//
-// assert.NotEqualValues(t, obj1, obj2)
+// assert.NotEqualValues(t, obj1, obj2)
func NotEqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -760,9 +876,9 @@ func containsElement(list interface{}, element interface{}) (ok, found bool) {
// Contains asserts that the specified string, list(array, slice...) or map contains the
// specified substring or element.
//
-// assert.Contains(t, "Hello World", "World")
-// assert.Contains(t, ["Hello", "World"], "World")
-// assert.Contains(t, {"Hello": "World"}, "Hello")
+// assert.Contains(t, "Hello World", "World")
+// assert.Contains(t, ["Hello", "World"], "World")
+// assert.Contains(t, {"Hello": "World"}, "Hello")
func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -783,9 +899,9 @@ func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bo
// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
// specified substring or element.
//
-// assert.NotContains(t, "Hello World", "Earth")
-// assert.NotContains(t, ["Hello", "World"], "Earth")
-// assert.NotContains(t, {"Hello": "World"}, "Earth")
+// assert.NotContains(t, "Hello World", "Earth")
+// assert.NotContains(t, ["Hello", "World"], "Earth")
+// assert.NotContains(t, {"Hello": "World"}, "Earth")
func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -793,10 +909,10 @@ func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{})
ok, found := containsElement(s, contains)
if !ok {
- return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", s), msgAndArgs...)
+ return Fail(t, fmt.Sprintf("%#v could not be applied builtin len()", s), msgAndArgs...)
}
if found {
- return Fail(t, fmt.Sprintf("\"%s\" should not contain \"%s\"", s, contains), msgAndArgs...)
+ return Fail(t, fmt.Sprintf("%#v should not contain %#v", s, contains), msgAndArgs...)
}
return true
@@ -806,7 +922,7 @@ func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{})
// Subset asserts that the specified list(array, slice...) contains all
// elements given in the specified subset(array, slice...).
//
-// assert.Subset(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
+// assert.Subset(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -815,32 +931,44 @@ func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok
return true // we consider nil to be equal to the nil set
}
- subsetValue := reflect.ValueOf(subset)
- defer func() {
- if e := recover(); e != nil {
- ok = false
- }
- }()
-
listKind := reflect.TypeOf(list).Kind()
- subsetKind := reflect.TypeOf(subset).Kind()
-
- if listKind != reflect.Array && listKind != reflect.Slice {
+ if listKind != reflect.Array && listKind != reflect.Slice && listKind != reflect.Map {
return Fail(t, fmt.Sprintf("%q has an unsupported type %s", list, listKind), msgAndArgs...)
}
- if subsetKind != reflect.Array && subsetKind != reflect.Slice {
+ subsetKind := reflect.TypeOf(subset).Kind()
+ if subsetKind != reflect.Array && subsetKind != reflect.Slice && listKind != reflect.Map {
return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...)
}
- for i := 0; i < subsetValue.Len(); i++ {
- element := subsetValue.Index(i).Interface()
+ if subsetKind == reflect.Map && listKind == reflect.Map {
+ subsetMap := reflect.ValueOf(subset)
+ actualMap := reflect.ValueOf(list)
+
+ for _, k := range subsetMap.MapKeys() {
+ ev := subsetMap.MapIndex(k)
+ av := actualMap.MapIndex(k)
+
+ if !av.IsValid() {
+ return Fail(t, fmt.Sprintf("%#v does not contain %#v", list, subset), msgAndArgs...)
+ }
+ if !ObjectsAreEqual(ev.Interface(), av.Interface()) {
+ return Fail(t, fmt.Sprintf("%#v does not contain %#v", list, subset), msgAndArgs...)
+ }
+ }
+
+ return true
+ }
+
+ subsetList := reflect.ValueOf(subset)
+ for i := 0; i < subsetList.Len(); i++ {
+ element := subsetList.Index(i).Interface()
ok, found := containsElement(list, element)
if !ok {
- return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", list), msgAndArgs...)
+ return Fail(t, fmt.Sprintf("%#v could not be applied builtin len()", list), msgAndArgs...)
}
if !found {
- return Fail(t, fmt.Sprintf("\"%s\" does not contain \"%s\"", list, element), msgAndArgs...)
+ return Fail(t, fmt.Sprintf("%#v does not contain %#v", list, element), msgAndArgs...)
}
}
@@ -850,7 +978,7 @@ func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok
// NotSubset asserts that the specified list(array, slice...) contains not all
// elements given in the specified subset(array, slice...).
//
-// assert.NotSubset(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]")
+// assert.NotSubset(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]")
func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -859,26 +987,38 @@ func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{})
return Fail(t, "nil is the empty set which is a subset of every set", msgAndArgs...)
}
- subsetValue := reflect.ValueOf(subset)
- defer func() {
- if e := recover(); e != nil {
- ok = false
- }
- }()
-
listKind := reflect.TypeOf(list).Kind()
- subsetKind := reflect.TypeOf(subset).Kind()
-
- if listKind != reflect.Array && listKind != reflect.Slice {
+ if listKind != reflect.Array && listKind != reflect.Slice && listKind != reflect.Map {
return Fail(t, fmt.Sprintf("%q has an unsupported type %s", list, listKind), msgAndArgs...)
}
- if subsetKind != reflect.Array && subsetKind != reflect.Slice {
+ subsetKind := reflect.TypeOf(subset).Kind()
+ if subsetKind != reflect.Array && subsetKind != reflect.Slice && listKind != reflect.Map {
return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...)
}
- for i := 0; i < subsetValue.Len(); i++ {
- element := subsetValue.Index(i).Interface()
+ if subsetKind == reflect.Map && listKind == reflect.Map {
+ subsetMap := reflect.ValueOf(subset)
+ actualMap := reflect.ValueOf(list)
+
+ for _, k := range subsetMap.MapKeys() {
+ ev := subsetMap.MapIndex(k)
+ av := actualMap.MapIndex(k)
+
+ if !av.IsValid() {
+ return true
+ }
+ if !ObjectsAreEqual(ev.Interface(), av.Interface()) {
+ return true
+ }
+ }
+
+ return Fail(t, fmt.Sprintf("%q is a subset of %q", subset, list), msgAndArgs...)
+ }
+
+ subsetList := reflect.ValueOf(subset)
+ for i := 0; i < subsetList.Len(); i++ {
+ element := subsetList.Index(i).Interface()
ok, found := containsElement(list, element)
if !ok {
return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", list), msgAndArgs...)
@@ -1023,7 +1163,7 @@ func didPanic(f PanicTestFunc) (didPanic bool, message interface{}, stack string
// Panics asserts that the code inside the specified PanicTestFunc panics.
//
-// assert.Panics(t, func(){ GoCrazy() })
+// assert.Panics(t, func(){ GoCrazy() })
func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -1039,7 +1179,7 @@ func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {
// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
// the recovered panic value equals the expected panic value.
//
-// assert.PanicsWithValue(t, "crazy error", func(){ GoCrazy() })
+// assert.PanicsWithValue(t, "crazy error", func(){ GoCrazy() })
func PanicsWithValue(t TestingT, expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -1060,7 +1200,7 @@ func PanicsWithValue(t TestingT, expected interface{}, f PanicTestFunc, msgAndAr
// panics, and that the recovered panic value is an error that satisfies the
// EqualError comparison.
//
-// assert.PanicsWithError(t, "crazy error", func(){ GoCrazy() })
+// assert.PanicsWithError(t, "crazy error", func(){ GoCrazy() })
func PanicsWithError(t TestingT, errString string, f PanicTestFunc, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -1080,7 +1220,7 @@ func PanicsWithError(t TestingT, errString string, f PanicTestFunc, msgAndArgs .
// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
//
-// assert.NotPanics(t, func(){ RemainCalm() })
+// assert.NotPanics(t, func(){ RemainCalm() })
func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -1095,7 +1235,7 @@ func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {
// WithinDuration asserts that the two times are within duration delta of each other.
//
-// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)
+// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)
func WithinDuration(t TestingT, expected, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -1109,6 +1249,27 @@ func WithinDuration(t TestingT, expected, actual time.Time, delta time.Duration,
return true
}
+// WithinRange asserts that a time is within a time range (inclusive).
+//
+// assert.WithinRange(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second))
+func WithinRange(t TestingT, actual, start, end time.Time, msgAndArgs ...interface{}) bool {
+ if h, ok := t.(tHelper); ok {
+ h.Helper()
+ }
+
+ if end.Before(start) {
+ return Fail(t, "Start should be before end", msgAndArgs...)
+ }
+
+ if actual.Before(start) {
+ return Fail(t, fmt.Sprintf("Time %v expected to be in time range %v to %v, but is before the range", actual, start, end), msgAndArgs...)
+ } else if actual.After(end) {
+ return Fail(t, fmt.Sprintf("Time %v expected to be in time range %v to %v, but is after the range", actual, start, end), msgAndArgs...)
+ }
+
+ return true
+}
+
func toFloat(x interface{}) (float64, bool) {
var xf float64
xok := true
@@ -1149,7 +1310,7 @@ func toFloat(x interface{}) (float64, bool) {
// InDelta asserts that the two numerals are within delta of each other.
//
-// assert.InDelta(t, math.Pi, 22/7.0, 0.01)
+// assert.InDelta(t, math.Pi, 22/7.0, 0.01)
func InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -1322,10 +1483,10 @@ func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, m
// NoError asserts that a function returned no error (i.e. `nil`).
//
-// actualObj, err := SomeFunction()
-// if assert.NoError(t, err) {
-// assert.Equal(t, expectedObj, actualObj)
-// }
+// actualObj, err := SomeFunction()
+// if assert.NoError(t, err) {
+// assert.Equal(t, expectedObj, actualObj)
+// }
func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool {
if err != nil {
if h, ok := t.(tHelper); ok {
@@ -1339,10 +1500,10 @@ func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool {
// Error asserts that a function returned an error (i.e. not `nil`).
//
-// actualObj, err := SomeFunction()
-// if assert.Error(t, err) {
-// assert.Equal(t, expectedError, err)
-// }
+// actualObj, err := SomeFunction()
+// if assert.Error(t, err) {
+// assert.Equal(t, expectedError, err)
+// }
func Error(t TestingT, err error, msgAndArgs ...interface{}) bool {
if err == nil {
if h, ok := t.(tHelper); ok {
@@ -1357,8 +1518,8 @@ func Error(t TestingT, err error, msgAndArgs ...interface{}) bool {
// EqualError asserts that a function returned an error (i.e. not `nil`)
// and that it is equal to the provided error.
//
-// actualObj, err := SomeFunction()
-// assert.EqualError(t, err, expectedErrorString)
+// actualObj, err := SomeFunction()
+// assert.EqualError(t, err, expectedErrorString)
func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -1380,8 +1541,8 @@ func EqualError(t TestingT, theError error, errString string, msgAndArgs ...inte
// ErrorContains asserts that a function returned an error (i.e. not `nil`)
// and that the error contains the specified substring.
//
-// actualObj, err := SomeFunction()
-// assert.ErrorContains(t, err, expectedErrorSubString)
+// actualObj, err := SomeFunction()
+// assert.ErrorContains(t, err, expectedErrorSubString)
func ErrorContains(t TestingT, theError error, contains string, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -1414,8 +1575,8 @@ func matchRegexp(rx interface{}, str interface{}) bool {
// Regexp asserts that a specified regexp matches a string.
//
-// assert.Regexp(t, regexp.MustCompile("start"), "it's starting")
-// assert.Regexp(t, "start...$", "it's not starting")
+// assert.Regexp(t, regexp.MustCompile("start"), "it's starting")
+// assert.Regexp(t, "start...$", "it's not starting")
func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -1432,8 +1593,8 @@ func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface
// NotRegexp asserts that a specified regexp does not match a string.
//
-// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting")
-// assert.NotRegexp(t, "^start", "it's not starting")
+// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting")
+// assert.NotRegexp(t, "^start", "it's not starting")
func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -1545,7 +1706,7 @@ func NoDirExists(t TestingT, path string, msgAndArgs ...interface{}) bool {
// JSONEq asserts that two JSON strings are equivalent.
//
-// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
+// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -1668,7 +1829,7 @@ type tHelper interface {
// Eventually asserts that given condition will be met in waitFor time,
// periodically checking target function each tick.
//
-// assert.Eventually(t, func() bool { return true; }, time.Second, 10*time.Millisecond)
+// assert.Eventually(t, func() bool { return true; }, time.Second, 10*time.Millisecond)
func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
@@ -1698,10 +1859,93 @@ func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick t
}
}
+// CollectT implements the TestingT interface and collects all errors.
+type CollectT struct {
+ errors []error
+}
+
+// Errorf collects the error.
+func (c *CollectT) Errorf(format string, args ...interface{}) {
+ c.errors = append(c.errors, fmt.Errorf(format, args...))
+}
+
+// FailNow panics.
+func (c *CollectT) FailNow() {
+ panic("Assertion failed")
+}
+
+// Reset clears the collected errors.
+func (c *CollectT) Reset() {
+ c.errors = nil
+}
+
+// Copy copies the collected errors to the supplied t.
+func (c *CollectT) Copy(t TestingT) {
+ if tt, ok := t.(tHelper); ok {
+ tt.Helper()
+ }
+ for _, err := range c.errors {
+ t.Errorf("%v", err)
+ }
+}
+
+// EventuallyWithT asserts that given condition will be met in waitFor time,
+// periodically checking target function each tick. In contrast to Eventually,
+// it supplies a CollectT to the condition function, so that the condition
+// function can use the CollectT to call other assertions.
+// The condition is considered "met" if no errors are raised in a tick.
+// The supplied CollectT collects all errors from one tick (if there are any).
+// If the condition is not met before waitFor, the collected errors of
+// the last tick are copied to t.
+//
+// externalValue := false
+// go func() {
+// time.Sleep(8*time.Second)
+// externalValue = true
+// }()
+// assert.EventuallyWithT(t, func(c *assert.CollectT) {
+// // add assertions as needed; any assertion failure will fail the current tick
+// assert.True(c, externalValue, "expected 'externalValue' to be true")
+// }, 1*time.Second, 10*time.Second, "external state has not changed to 'true'; still false")
+func EventuallyWithT(t TestingT, condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {
+ if h, ok := t.(tHelper); ok {
+ h.Helper()
+ }
+
+ collect := new(CollectT)
+ ch := make(chan bool, 1)
+
+ timer := time.NewTimer(waitFor)
+ defer timer.Stop()
+
+ ticker := time.NewTicker(tick)
+ defer ticker.Stop()
+
+ for tick := ticker.C; ; {
+ select {
+ case <-timer.C:
+ collect.Copy(t)
+ return Fail(t, "Condition never satisfied", msgAndArgs...)
+ case <-tick:
+ tick = nil
+ collect.Reset()
+ go func() {
+ condition(collect)
+ ch <- len(collect.errors) == 0
+ }()
+ case v := <-ch:
+ if v {
+ return true
+ }
+ tick = ticker.C
+ }
+ }
+}
+
// Never asserts that the given condition doesn't satisfy in waitFor time,
// periodically checking the target function each tick.
//
-// assert.Never(t, func() bool { return false; }, time.Second, 10*time.Millisecond)
+// assert.Never(t, func() bool { return false; }, time.Second, 10*time.Millisecond)
func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
diff --git a/vendor/github.com/stretchr/testify/assert/doc.go b/vendor/github.com/stretchr/testify/assert/doc.go
index c9dccc4d6c..4953981d38 100644
--- a/vendor/github.com/stretchr/testify/assert/doc.go
+++ b/vendor/github.com/stretchr/testify/assert/doc.go
@@ -1,39 +1,40 @@
// Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.
//
-// Example Usage
+// # Example Usage
//
// The following is a complete example using assert in a standard test function:
-// import (
-// "testing"
-// "github.com/stretchr/testify/assert"
-// )
//
-// func TestSomething(t *testing.T) {
+// import (
+// "testing"
+// "github.com/stretchr/testify/assert"
+// )
//
-// var a string = "Hello"
-// var b string = "Hello"
+// func TestSomething(t *testing.T) {
//
-// assert.Equal(t, a, b, "The two words should be the same.")
+// var a string = "Hello"
+// var b string = "Hello"
//
-// }
+// assert.Equal(t, a, b, "The two words should be the same.")
+//
+// }
//
// if you assert many times, use the format below:
//
-// import (
-// "testing"
-// "github.com/stretchr/testify/assert"
-// )
+// import (
+// "testing"
+// "github.com/stretchr/testify/assert"
+// )
//
-// func TestSomething(t *testing.T) {
-// assert := assert.New(t)
+// func TestSomething(t *testing.T) {
+// assert := assert.New(t)
//
-// var a string = "Hello"
-// var b string = "Hello"
+// var a string = "Hello"
+// var b string = "Hello"
//
-// assert.Equal(a, b, "The two words should be the same.")
-// }
+// assert.Equal(a, b, "The two words should be the same.")
+// }
//
-// Assertions
+// # Assertions
//
// Assertions allow you to easily write test code, and are global funcs in the `assert` package.
// All assertion functions take, as the first argument, the `*testing.T` object provided by the
diff --git a/vendor/github.com/stretchr/testify/assert/http_assertions.go b/vendor/github.com/stretchr/testify/assert/http_assertions.go
index 4ed341dd28..d8038c28a7 100644
--- a/vendor/github.com/stretchr/testify/assert/http_assertions.go
+++ b/vendor/github.com/stretchr/testify/assert/http_assertions.go
@@ -23,7 +23,7 @@ func httpCode(handler http.HandlerFunc, method, url string, values url.Values) (
// HTTPSuccess asserts that a specified handler returns a success status code.
//
-// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil)
+// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil)
//
// Returns whether the assertion was successful (true) or not (false).
func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {
@@ -45,7 +45,7 @@ func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, value
// HTTPRedirect asserts that a specified handler returns a redirect status code.
//
-// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true) or not (false).
func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {
@@ -67,7 +67,7 @@ func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, valu
// HTTPError asserts that a specified handler returns an error status code.
//
-// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true) or not (false).
func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {
@@ -89,7 +89,7 @@ func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values
// HTTPStatusCode asserts that a specified handler returns a specified status code.
//
-// assert.HTTPStatusCode(t, myHandler, "GET", "/notImplemented", nil, 501)
+// assert.HTTPStatusCode(t, myHandler, "GET", "/notImplemented", nil, 501)
//
// Returns whether the assertion was successful (true) or not (false).
func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) bool {
@@ -124,7 +124,7 @@ func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) s
// HTTPBodyContains asserts that a specified handler returns a
// body that contains a string.
//
-// assert.HTTPBodyContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
+// assert.HTTPBodyContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
//
// Returns whether the assertion was successful (true) or not (false).
func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {
@@ -144,7 +144,7 @@ func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string,
// HTTPBodyNotContains asserts that a specified handler returns a
// body that does not contain a string.
//
-// assert.HTTPBodyNotContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
+// assert.HTTPBodyNotContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
//
// Returns whether the assertion was successful (true) or not (false).
func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {
diff --git a/vendor/github.com/tjfoc/gmsm/sm2/p256.go b/vendor/github.com/tjfoc/gmsm/sm2/p256.go
new file mode 100644
index 0000000000..fd892b06da
--- /dev/null
+++ b/vendor/github.com/tjfoc/gmsm/sm2/p256.go
@@ -0,0 +1,1182 @@
+/*
+Copyright Suzhou Tongji Fintech Research Institute 2017 All Rights Reserved.
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package sm2
+
+import (
+ "crypto/elliptic"
+ "math/big"
+ "sync"
+)
+
+/** 学习标准库p256的优化方法实现sm2的快速版本
+ * 标准库的p256的代码实现有些晦涩难懂,当然sm2的同样如此,有兴趣的大家可以研究研究,最后神兽压阵。。。
+ *
+ * ━━━━━━animal━━━━━━
+ * ┏┓ ┏┓
+ * ┏┛┻━━━┛┻┓
+ * ┃ ┃
+ * ┃ ━ ┃
+ * ┃ ┳┛ ┗┳ ┃
+ * ┃ ┃
+ * ┃ ┻ ┃
+ * ┃ ┃
+ * ┗━┓ ┏━┛
+ * ┃ ┃
+ * ┃ ┃
+ * ┃ ┗━━━┓
+ * ┃ ┣┓
+ * ┃ ┏┛
+ * ┗┓┓┏━┳┓┏┛
+ * ┃┫┫ ┃┫┫
+ * ┗┻┛ ┗┻┛
+ *
+ * ━━━━━Kawaii ━━━━━━
+ */
+
+type sm2P256Curve struct {
+ RInverse *big.Int
+ *elliptic.CurveParams
+ a, b, gx, gy sm2P256FieldElement
+}
+
+var initonce sync.Once
+var sm2P256 sm2P256Curve
+
+type sm2P256FieldElement [9]uint32
+type sm2P256LargeFieldElement [17]uint64
+
+const (
+ bottom28Bits = 0xFFFFFFF
+ bottom29Bits = 0x1FFFFFFF
+)
+
+func initP256Sm2() {
+ sm2P256.CurveParams = &elliptic.CurveParams{Name: "SM2-P-256"} // sm2
+ A, _ := new(big.Int).SetString("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC", 16)
+ //SM2椭 椭 圆 曲 线 公 钥 密 码 算 法 推 荐 曲 线 参 数
+ sm2P256.P, _ = new(big.Int).SetString("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF", 16)
+ sm2P256.N, _ = new(big.Int).SetString("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123", 16)
+ sm2P256.B, _ = new(big.Int).SetString("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93", 16)
+ sm2P256.Gx, _ = new(big.Int).SetString("32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7", 16)
+ sm2P256.Gy, _ = new(big.Int).SetString("BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0", 16)
+ sm2P256.RInverse, _ = new(big.Int).SetString("7ffffffd80000002fffffffe000000017ffffffe800000037ffffffc80000002", 16)
+ sm2P256.BitSize = 256
+ sm2P256FromBig(&sm2P256.a, A)
+ sm2P256FromBig(&sm2P256.gx, sm2P256.Gx)
+ sm2P256FromBig(&sm2P256.gy, sm2P256.Gy)
+ sm2P256FromBig(&sm2P256.b, sm2P256.B)
+}
+
+func P256Sm2() elliptic.Curve {
+ initonce.Do(initP256Sm2)
+ return sm2P256
+}
+
+func (curve sm2P256Curve) Params() *elliptic.CurveParams {
+ return sm2P256.CurveParams
+}
+
+// y^2 = x^3 + ax + b
+func (curve sm2P256Curve) IsOnCurve(X, Y *big.Int) bool {
+ var a, x, y, y2, x3 sm2P256FieldElement
+
+ sm2P256FromBig(&x, X)
+ sm2P256FromBig(&y, Y)
+
+ sm2P256Square(&x3, &x) // x3 = x ^ 2
+ sm2P256Mul(&x3, &x3, &x) // x3 = x ^ 2 * x
+ sm2P256Mul(&a, &curve.a, &x) // a = a * x
+ sm2P256Add(&x3, &x3, &a)
+ sm2P256Add(&x3, &x3, &curve.b)
+
+ sm2P256Square(&y2, &y) // y2 = y ^ 2
+ return sm2P256ToBig(&x3).Cmp(sm2P256ToBig(&y2)) == 0
+}
+
+func zForAffine(x, y *big.Int) *big.Int {
+ z := new(big.Int)
+ if x.Sign() != 0 || y.Sign() != 0 {
+ z.SetInt64(1)
+ }
+ return z
+}
+
+func (curve sm2P256Curve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int) {
+ var X1, Y1, Z1, X2, Y2, Z2, X3, Y3, Z3 sm2P256FieldElement
+
+ z1 := zForAffine(x1, y1)
+ z2 := zForAffine(x2, y2)
+ sm2P256FromBig(&X1, x1)
+ sm2P256FromBig(&Y1, y1)
+ sm2P256FromBig(&Z1, z1)
+ sm2P256FromBig(&X2, x2)
+ sm2P256FromBig(&Y2, y2)
+ sm2P256FromBig(&Z2, z2)
+ sm2P256PointAdd(&X1, &Y1, &Z1, &X2, &Y2, &Z2, &X3, &Y3, &Z3)
+ return sm2P256ToAffine(&X3, &Y3, &Z3)
+}
+
+func (curve sm2P256Curve) Double(x1, y1 *big.Int) (*big.Int, *big.Int) {
+ var X1, Y1, Z1 sm2P256FieldElement
+
+ z1 := zForAffine(x1, y1)
+ sm2P256FromBig(&X1, x1)
+ sm2P256FromBig(&Y1, y1)
+ sm2P256FromBig(&Z1, z1)
+ sm2P256PointDouble(&X1, &Y1, &Z1, &X1, &Y1, &Z1)
+ return sm2P256ToAffine(&X1, &Y1, &Z1)
+}
+
+func (curve sm2P256Curve) ScalarMult(x1, y1 *big.Int, k []byte) (*big.Int, *big.Int) {
+ var X, Y, Z, X1, Y1 sm2P256FieldElement
+ sm2P256FromBig(&X1, x1)
+ sm2P256FromBig(&Y1, y1)
+ scalar := sm2GenrateWNaf(k)
+ scalarReversed := WNafReversed(scalar)
+ sm2P256ScalarMult(&X, &Y, &Z, &X1, &Y1, scalarReversed)
+ return sm2P256ToAffine(&X, &Y, &Z)
+}
+
+func (curve sm2P256Curve) ScalarBaseMult(k []byte) (*big.Int, *big.Int) {
+ var scalarReversed [32]byte
+ var X, Y, Z sm2P256FieldElement
+
+ sm2P256GetScalar(&scalarReversed, k)
+ sm2P256ScalarBaseMult(&X, &Y, &Z, &scalarReversed)
+ return sm2P256ToAffine(&X, &Y, &Z)
+}
+
+var sm2P256Precomputed = [9 * 2 * 15 * 2]uint32{
+ 0x830053d, 0x328990f, 0x6c04fe1, 0xc0f72e5, 0x1e19f3c, 0x666b093, 0x175a87b, 0xec38276, 0x222cf4b,
+ 0x185a1bba, 0x354e593, 0x1295fac1, 0xf2bc469, 0x47c60fa, 0xc19b8a9, 0xf63533e, 0x903ae6b, 0xc79acba,
+ 0x15b061a4, 0x33e020b, 0xdffb34b, 0xfcf2c8, 0x16582e08, 0x262f203, 0xfb34381, 0xa55452, 0x604f0ff,
+ 0x41f1f90, 0xd64ced2, 0xee377bf, 0x75f05f0, 0x189467ae, 0xe2244e, 0x1e7700e8, 0x3fbc464, 0x9612d2e,
+ 0x1341b3b8, 0xee84e23, 0x1edfa5b4, 0x14e6030, 0x19e87be9, 0x92f533c, 0x1665d96c, 0x226653e, 0xa238d3e,
+ 0xf5c62c, 0x95bb7a, 0x1f0e5a41, 0x28789c3, 0x1f251d23, 0x8726609, 0xe918910, 0x8096848, 0xf63d028,
+ 0x152296a1, 0x9f561a8, 0x14d376fb, 0x898788a, 0x61a95fb, 0xa59466d, 0x159a003d, 0x1ad1698, 0x93cca08,
+ 0x1b314662, 0x706e006, 0x11ce1e30, 0x97b710, 0x172fbc0d, 0x8f50158, 0x11c7ffe7, 0xd182cce, 0xc6ad9e8,
+ 0x12ea31b2, 0xc4e4f38, 0x175b0d96, 0xec06337, 0x75a9c12, 0xb001fdf, 0x93e82f5, 0x34607de, 0xb8035ed,
+ 0x17f97924, 0x75cf9e6, 0xdceaedd, 0x2529924, 0x1a10c5ff, 0xb1a54dc, 0x19464d8, 0x2d1997, 0xde6a110,
+ 0x1e276ee5, 0x95c510c, 0x1aca7c7a, 0xfe48aca, 0x121ad4d9, 0xe4132c6, 0x8239b9d, 0x40ea9cd, 0x816c7b,
+ 0x632d7a4, 0xa679813, 0x5911fcf, 0x82b0f7c, 0x57b0ad5, 0xbef65, 0xd541365, 0x7f9921f, 0xc62e7a,
+ 0x3f4b32d, 0x58e50e1, 0x6427aed, 0xdcdda67, 0xe8c2d3e, 0x6aa54a4, 0x18df4c35, 0x49a6a8e, 0x3cd3d0c,
+ 0xd7adf2, 0xcbca97, 0x1bda5f2d, 0x3258579, 0x606b1e6, 0x6fc1b5b, 0x1ac27317, 0x503ca16, 0xa677435,
+ 0x57bc73, 0x3992a42, 0xbab987b, 0xfab25eb, 0x128912a4, 0x90a1dc4, 0x1402d591, 0x9ffbcfc, 0xaa48856,
+ 0x7a7c2dc, 0xcefd08a, 0x1b29bda6, 0xa785641, 0x16462d8c, 0x76241b7, 0x79b6c3b, 0x204ae18, 0xf41212b,
+ 0x1f567a4d, 0xd6ce6db, 0xedf1784, 0x111df34, 0x85d7955, 0x55fc189, 0x1b7ae265, 0xf9281ac, 0xded7740,
+ 0xf19468b, 0x83763bb, 0x8ff7234, 0x3da7df8, 0x9590ac3, 0xdc96f2a, 0x16e44896, 0x7931009, 0x99d5acc,
+ 0x10f7b842, 0xaef5e84, 0xc0310d7, 0xdebac2c, 0x2a7b137, 0x4342344, 0x19633649, 0x3a10624, 0x4b4cb56,
+ 0x1d809c59, 0xac007f, 0x1f0f4bcd, 0xa1ab06e, 0xc5042cf, 0x82c0c77, 0x76c7563, 0x22c30f3, 0x3bf1568,
+ 0x7a895be, 0xfcca554, 0x12e90e4c, 0x7b4ab5f, 0x13aeb76b, 0x5887e2c, 0x1d7fe1e3, 0x908c8e3, 0x95800ee,
+ 0xb36bd54, 0xf08905d, 0x4e73ae8, 0xf5a7e48, 0xa67cb0, 0x50e1067, 0x1b944a0a, 0xf29c83a, 0xb23cfb9,
+ 0xbe1db1, 0x54de6e8, 0xd4707f2, 0x8ebcc2d, 0x2c77056, 0x1568ce4, 0x15fcc849, 0x4069712, 0xe2ed85f,
+ 0x2c5ff09, 0x42a6929, 0x628e7ea, 0xbd5b355, 0xaf0bd79, 0xaa03699, 0xdb99816, 0x4379cef, 0x81d57b,
+ 0x11237f01, 0xe2a820b, 0xfd53b95, 0x6beb5ee, 0x1aeb790c, 0xe470d53, 0x2c2cfee, 0x1c1d8d8, 0xa520fc4,
+ 0x1518e034, 0xa584dd4, 0x29e572b, 0xd4594fc, 0x141a8f6f, 0x8dfccf3, 0x5d20ba3, 0x2eb60c3, 0x9f16eb0,
+ 0x11cec356, 0xf039f84, 0x1b0990c1, 0xc91e526, 0x10b65bae, 0xf0616e8, 0x173fa3ff, 0xec8ccf9, 0xbe32790,
+ 0x11da3e79, 0xe2f35c7, 0x908875c, 0xdacf7bd, 0x538c165, 0x8d1487f, 0x7c31aed, 0x21af228, 0x7e1689d,
+ 0xdfc23ca, 0x24f15dc, 0x25ef3c4, 0x35248cd, 0x99a0f43, 0xa4b6ecc, 0xd066b3, 0x2481152, 0x37a7688,
+ 0x15a444b6, 0xb62300c, 0x4b841b, 0xa655e79, 0xd53226d, 0xbeb348a, 0x127f3c2, 0xb989247, 0x71a277d,
+ 0x19e9dfcb, 0xb8f92d0, 0xe2d226c, 0x390a8b0, 0x183cc462, 0x7bd8167, 0x1f32a552, 0x5e02db4, 0xa146ee9,
+ 0x1a003957, 0x1c95f61, 0x1eeec155, 0x26f811f, 0xf9596ba, 0x3082bfb, 0x96df083, 0x3e3a289, 0x7e2d8be,
+ 0x157a63e0, 0x99b8941, 0x1da7d345, 0xcc6cd0, 0x10beed9a, 0x48e83c0, 0x13aa2e25, 0x7cad710, 0x4029988,
+ 0x13dfa9dd, 0xb94f884, 0x1f4adfef, 0xb88543, 0x16f5f8dc, 0xa6a67f4, 0x14e274e2, 0x5e56cf4, 0x2f24ef,
+ 0x1e9ef967, 0xfe09bad, 0xfe079b3, 0xcc0ae9e, 0xb3edf6d, 0x3e961bc, 0x130d7831, 0x31043d6, 0xba986f9,
+ 0x1d28055, 0x65240ca, 0x4971fa3, 0x81b17f8, 0x11ec34a5, 0x8366ddc, 0x1471809, 0xfa5f1c6, 0xc911e15,
+ 0x8849491, 0xcf4c2e2, 0x14471b91, 0x39f75be, 0x445c21e, 0xf1585e9, 0x72cc11f, 0x4c79f0c, 0xe5522e1,
+ 0x1874c1ee, 0x4444211, 0x7914884, 0x3d1b133, 0x25ba3c, 0x4194f65, 0x1c0457ef, 0xac4899d, 0xe1fa66c,
+ 0x130a7918, 0x9b8d312, 0x4b1c5c8, 0x61ccac3, 0x18c8aa6f, 0xe93cb0a, 0xdccb12c, 0xde10825, 0x969737d,
+ 0xf58c0c3, 0x7cee6a9, 0xc2c329a, 0xc7f9ed9, 0x107b3981, 0x696a40e, 0x152847ff, 0x4d88754, 0xb141f47,
+ 0x5a16ffe, 0x3a7870a, 0x18667659, 0x3b72b03, 0xb1c9435, 0x9285394, 0xa00005a, 0x37506c, 0x2edc0bb,
+ 0x19afe392, 0xeb39cac, 0x177ef286, 0xdf87197, 0x19f844ed, 0x31fe8, 0x15f9bfd, 0x80dbec, 0x342e96e,
+ 0x497aced, 0xe88e909, 0x1f5fa9ba, 0x530a6ee, 0x1ef4e3f1, 0x69ffd12, 0x583006d, 0x2ecc9b1, 0x362db70,
+ 0x18c7bdc5, 0xf4bb3c5, 0x1c90b957, 0xf067c09, 0x9768f2b, 0xf73566a, 0x1939a900, 0x198c38a, 0x202a2a1,
+ 0x4bbf5a6, 0x4e265bc, 0x1f44b6e7, 0x185ca49, 0xa39e81b, 0x24aff5b, 0x4acc9c2, 0x638bdd3, 0xb65b2a8,
+ 0x6def8be, 0xb94537a, 0x10b81dee, 0xe00ec55, 0x2f2cdf7, 0xc20622d, 0x2d20f36, 0xe03c8c9, 0x898ea76,
+ 0x8e3921b, 0x8905bff, 0x1e94b6c8, 0xee7ad86, 0x154797f2, 0xa620863, 0x3fbd0d9, 0x1f3caab, 0x30c24bd,
+ 0x19d3892f, 0x59c17a2, 0x1ab4b0ae, 0xf8714ee, 0x90c4098, 0xa9c800d, 0x1910236b, 0xea808d3, 0x9ae2f31,
+ 0x1a15ad64, 0xa48c8d1, 0x184635a4, 0xb725ef1, 0x11921dcc, 0x3f866df, 0x16c27568, 0xbdf580a, 0xb08f55c,
+ 0x186ee1c, 0xb1627fa, 0x34e82f6, 0x933837e, 0xf311be5, 0xfedb03b, 0x167f72cd, 0xa5469c0, 0x9c82531,
+ 0xb92a24b, 0x14fdc8b, 0x141980d1, 0xbdc3a49, 0x7e02bb1, 0xaf4e6dd, 0x106d99e1, 0xd4616fc, 0x93c2717,
+ 0x1c0a0507, 0xc6d5fed, 0x9a03d8b, 0xa1d22b0, 0x127853e3, 0xc4ac6b8, 0x1a048cf7, 0x9afb72c, 0x65d485d,
+ 0x72d5998, 0xe9fa744, 0xe49e82c, 0x253cf80, 0x5f777ce, 0xa3799a5, 0x17270cbb, 0xc1d1ef0, 0xdf74977,
+ 0x114cb859, 0xfa8e037, 0xb8f3fe5, 0xc734cc6, 0x70d3d61, 0xeadac62, 0x12093dd0, 0x9add67d, 0x87200d6,
+ 0x175bcbb, 0xb29b49f, 0x1806b79c, 0x12fb61f, 0x170b3a10, 0x3aaf1cf, 0xa224085, 0x79d26af, 0x97759e2,
+ 0x92e19f1, 0xb32714d, 0x1f00d9f1, 0xc728619, 0x9e6f627, 0xe745e24, 0x18ea4ace, 0xfc60a41, 0x125f5b2,
+ 0xc3cf512, 0x39ed486, 0xf4d15fa, 0xf9167fd, 0x1c1f5dd5, 0xc21a53e, 0x1897930, 0x957a112, 0x21059a0,
+ 0x1f9e3ddc, 0xa4dfced, 0x8427f6f, 0x726fbe7, 0x1ea658f8, 0x2fdcd4c, 0x17e9b66f, 0xb2e7c2e, 0x39923bf,
+ 0x1bae104, 0x3973ce5, 0xc6f264c, 0x3511b84, 0x124195d7, 0x11996bd, 0x20be23d, 0xdc437c4, 0x4b4f16b,
+ 0x11902a0, 0x6c29cc9, 0x1d5ffbe6, 0xdb0b4c7, 0x10144c14, 0x2f2b719, 0x301189, 0x2343336, 0xa0bf2ac,
+}
+
+func sm2P256GetScalar(b *[32]byte, a []byte) {
+ var scalarBytes []byte
+
+ n := new(big.Int).SetBytes(a)
+ if n.Cmp(sm2P256.N) >= 0 {
+ n.Mod(n, sm2P256.N)
+ scalarBytes = n.Bytes()
+ } else {
+ scalarBytes = a
+ }
+ for i, v := range scalarBytes {
+ b[len(scalarBytes)-(1+i)] = v
+ }
+}
+
+func sm2P256PointAddMixed(xOut, yOut, zOut, x1, y1, z1, x2, y2 *sm2P256FieldElement) {
+ var z1z1, z1z1z1, s2, u2, h, i, j, r, rr, v, tmp sm2P256FieldElement
+
+ sm2P256Square(&z1z1, z1)
+ sm2P256Add(&tmp, z1, z1)
+
+ sm2P256Mul(&u2, x2, &z1z1)
+ sm2P256Mul(&z1z1z1, z1, &z1z1)
+ sm2P256Mul(&s2, y2, &z1z1z1)
+ sm2P256Sub(&h, &u2, x1)
+ sm2P256Add(&i, &h, &h)
+ sm2P256Square(&i, &i)
+ sm2P256Mul(&j, &h, &i)
+ sm2P256Sub(&r, &s2, y1)
+ sm2P256Add(&r, &r, &r)
+ sm2P256Mul(&v, x1, &i)
+
+ sm2P256Mul(zOut, &tmp, &h)
+ sm2P256Square(&rr, &r)
+ sm2P256Sub(xOut, &rr, &j)
+ sm2P256Sub(xOut, xOut, &v)
+ sm2P256Sub(xOut, xOut, &v)
+
+ sm2P256Sub(&tmp, &v, xOut)
+ sm2P256Mul(yOut, &tmp, &r)
+ sm2P256Mul(&tmp, y1, &j)
+ sm2P256Sub(yOut, yOut, &tmp)
+ sm2P256Sub(yOut, yOut, &tmp)
+}
+
+// sm2P256CopyConditional sets out=in if mask = 0xffffffff in constant time.
+//
+// On entry: mask is either 0 or 0xffffffff.
+func sm2P256CopyConditional(out, in *sm2P256FieldElement, mask uint32) {
+ for i := 0; i < 9; i++ {
+ tmp := mask & (in[i] ^ out[i])
+ out[i] ^= tmp
+ }
+}
+
+// sm2P256SelectAffinePoint sets {out_x,out_y} to the index'th entry of table.
+// On entry: index < 16, table[0] must be zero.
+func sm2P256SelectAffinePoint(xOut, yOut *sm2P256FieldElement, table []uint32, index uint32) {
+ for i := range xOut {
+ xOut[i] = 0
+ }
+ for i := range yOut {
+ yOut[i] = 0
+ }
+
+ for i := uint32(1); i < 16; i++ {
+ mask := i ^ index
+ mask |= mask >> 2
+ mask |= mask >> 1
+ mask &= 1
+ mask--
+ for j := range xOut {
+ xOut[j] |= table[0] & mask
+ table = table[1:]
+ }
+ for j := range yOut {
+ yOut[j] |= table[0] & mask
+ table = table[1:]
+ }
+ }
+}
+
+// sm2P256SelectJacobianPoint sets {out_x,out_y,out_z} to the index'th entry of
+// table.
+// On entry: index < 16, table[0] must be zero.
+func sm2P256SelectJacobianPoint(xOut, yOut, zOut *sm2P256FieldElement, table *[16][3]sm2P256FieldElement, index uint32) {
+ for i := range xOut {
+ xOut[i] = 0
+ }
+ for i := range yOut {
+ yOut[i] = 0
+ }
+ for i := range zOut {
+ zOut[i] = 0
+ }
+
+ // The implicit value at index 0 is all zero. We don't need to perform that
+ // iteration of the loop because we already set out_* to zero.
+ for i := uint32(1); i < 16; i++ {
+ mask := i ^ index
+ mask |= mask >> 2
+ mask |= mask >> 1
+ mask &= 1
+ mask--
+ for j := range xOut {
+ xOut[j] |= table[i][0][j] & mask
+ }
+ for j := range yOut {
+ yOut[j] |= table[i][1][j] & mask
+ }
+ for j := range zOut {
+ zOut[j] |= table[i][2][j] & mask
+ }
+ }
+}
+
+// sm2P256GetBit returns the bit'th bit of scalar.
+func sm2P256GetBit(scalar *[32]uint8, bit uint) uint32 {
+ return uint32(((scalar[bit>>3]) >> (bit & 7)) & 1)
+}
+
+// sm2P256ScalarBaseMult sets {xOut,yOut,zOut} = scalar*G where scalar is a
+// little-endian number. Note that the value of scalar must be less than the
+// order of the group.
+func sm2P256ScalarBaseMult(xOut, yOut, zOut *sm2P256FieldElement, scalar *[32]uint8) {
+ nIsInfinityMask := ^uint32(0)
+ var px, py, tx, ty, tz sm2P256FieldElement
+ var pIsNoninfiniteMask, mask, tableOffset uint32
+
+ for i := range xOut {
+ xOut[i] = 0
+ }
+ for i := range yOut {
+ yOut[i] = 0
+ }
+ for i := range zOut {
+ zOut[i] = 0
+ }
+
+ // The loop adds bits at positions 0, 64, 128 and 192, followed by
+ // positions 32,96,160 and 224 and does this 32 times.
+ for i := uint(0); i < 32; i++ {
+ if i != 0 {
+ sm2P256PointDouble(xOut, yOut, zOut, xOut, yOut, zOut)
+ }
+ tableOffset = 0
+ for j := uint(0); j <= 32; j += 32 {
+ bit0 := sm2P256GetBit(scalar, 31-i+j)
+ bit1 := sm2P256GetBit(scalar, 95-i+j)
+ bit2 := sm2P256GetBit(scalar, 159-i+j)
+ bit3 := sm2P256GetBit(scalar, 223-i+j)
+ index := bit0 | (bit1 << 1) | (bit2 << 2) | (bit3 << 3)
+
+ sm2P256SelectAffinePoint(&px, &py, sm2P256Precomputed[tableOffset:], index)
+ tableOffset += 30 * 9
+
+ // Since scalar is less than the order of the group, we know that
+ // {xOut,yOut,zOut} != {px,py,1}, unless both are zero, which we handle
+ // below.
+ sm2P256PointAddMixed(&tx, &ty, &tz, xOut, yOut, zOut, &px, &py)
+ // The result of pointAddMixed is incorrect if {xOut,yOut,zOut} is zero
+ // (a.k.a. the point at infinity). We handle that situation by
+ // copying the point from the table.
+ sm2P256CopyConditional(xOut, &px, nIsInfinityMask)
+ sm2P256CopyConditional(yOut, &py, nIsInfinityMask)
+ sm2P256CopyConditional(zOut, &sm2P256Factor[1], nIsInfinityMask)
+
+ // Equally, the result is also wrong if the point from the table is
+ // zero, which happens when the index is zero. We handle that by
+ // only copying from {tx,ty,tz} to {xOut,yOut,zOut} if index != 0.
+ pIsNoninfiniteMask = nonZeroToAllOnes(index)
+ mask = pIsNoninfiniteMask & ^nIsInfinityMask
+ sm2P256CopyConditional(xOut, &tx, mask)
+ sm2P256CopyConditional(yOut, &ty, mask)
+ sm2P256CopyConditional(zOut, &tz, mask)
+ // If p was not zero, then n is now non-zero.
+ nIsInfinityMask &^= pIsNoninfiniteMask
+ }
+ }
+}
+
+func sm2P256PointToAffine(xOut, yOut, x, y, z *sm2P256FieldElement) {
+ var zInv, zInvSq sm2P256FieldElement
+
+ zz := sm2P256ToBig(z)
+ zz.ModInverse(zz, sm2P256.P)
+ sm2P256FromBig(&zInv, zz)
+
+ sm2P256Square(&zInvSq, &zInv)
+ sm2P256Mul(xOut, x, &zInvSq)
+ sm2P256Mul(&zInv, &zInv, &zInvSq)
+ sm2P256Mul(yOut, y, &zInv)
+}
+
+func sm2P256ToAffine(x, y, z *sm2P256FieldElement) (xOut, yOut *big.Int) {
+ var xx, yy sm2P256FieldElement
+
+ sm2P256PointToAffine(&xx, &yy, x, y, z)
+ return sm2P256ToBig(&xx), sm2P256ToBig(&yy)
+}
+
+var sm2P256Factor = []sm2P256FieldElement{
+ sm2P256FieldElement{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
+ sm2P256FieldElement{0x2, 0x0, 0x1FFFFF00, 0x7FF, 0x0, 0x0, 0x0, 0x2000000, 0x0},
+ sm2P256FieldElement{0x4, 0x0, 0x1FFFFE00, 0xFFF, 0x0, 0x0, 0x0, 0x4000000, 0x0},
+ sm2P256FieldElement{0x6, 0x0, 0x1FFFFD00, 0x17FF, 0x0, 0x0, 0x0, 0x6000000, 0x0},
+ sm2P256FieldElement{0x8, 0x0, 0x1FFFFC00, 0x1FFF, 0x0, 0x0, 0x0, 0x8000000, 0x0},
+ sm2P256FieldElement{0xA, 0x0, 0x1FFFFB00, 0x27FF, 0x0, 0x0, 0x0, 0xA000000, 0x0},
+ sm2P256FieldElement{0xC, 0x0, 0x1FFFFA00, 0x2FFF, 0x0, 0x0, 0x0, 0xC000000, 0x0},
+ sm2P256FieldElement{0xE, 0x0, 0x1FFFF900, 0x37FF, 0x0, 0x0, 0x0, 0xE000000, 0x0},
+ sm2P256FieldElement{0x10, 0x0, 0x1FFFF800, 0x3FFF, 0x0, 0x0, 0x0, 0x0, 0x01},
+}
+
+func sm2P256Scalar(b *sm2P256FieldElement, a int) {
+ sm2P256Mul(b, b, &sm2P256Factor[a])
+}
+
+// (x3, y3, z3) = (x1, y1, z1) + (x2, y2, z2)
+func sm2P256PointAdd(x1, y1, z1, x2, y2, z2, x3, y3, z3 *sm2P256FieldElement) {
+ var u1, u2, z22, z12, z23, z13, s1, s2, h, h2, r, r2, tm sm2P256FieldElement
+
+ if sm2P256ToBig(z1).Sign() == 0 {
+ sm2P256Dup(x3, x2)
+ sm2P256Dup(y3, y2)
+ sm2P256Dup(z3, z2)
+ return
+ }
+
+ if sm2P256ToBig(z2).Sign() == 0 {
+ sm2P256Dup(x3, x1)
+ sm2P256Dup(y3, y1)
+ sm2P256Dup(z3, z1)
+ return
+ }
+
+ sm2P256Square(&z12, z1) // z12 = z1 ^ 2
+ sm2P256Square(&z22, z2) // z22 = z2 ^ 2
+
+ sm2P256Mul(&z13, &z12, z1) // z13 = z1 ^ 3
+ sm2P256Mul(&z23, &z22, z2) // z23 = z2 ^ 3
+
+ sm2P256Mul(&u1, x1, &z22) // u1 = x1 * z2 ^ 2
+ sm2P256Mul(&u2, x2, &z12) // u2 = x2 * z1 ^ 2
+
+ sm2P256Mul(&s1, y1, &z23) // s1 = y1 * z2 ^ 3
+ sm2P256Mul(&s2, y2, &z13) // s2 = y2 * z1 ^ 3
+
+ if sm2P256ToBig(&u1).Cmp(sm2P256ToBig(&u2)) == 0 &&
+ sm2P256ToBig(&s1).Cmp(sm2P256ToBig(&s2)) == 0 {
+ sm2P256PointDouble(x1, y1, z1, x1, y1, z1)
+ }
+
+ sm2P256Sub(&h, &u2, &u1) // h = u2 - u1
+ sm2P256Sub(&r, &s2, &s1) // r = s2 - s1
+
+ sm2P256Square(&r2, &r) // r2 = r ^ 2
+ sm2P256Square(&h2, &h) // h2 = h ^ 2
+
+ sm2P256Mul(&tm, &h2, &h) // tm = h ^ 3
+ sm2P256Sub(x3, &r2, &tm)
+ sm2P256Mul(&tm, &u1, &h2)
+ sm2P256Scalar(&tm, 2) // tm = 2 * (u1 * h ^ 2)
+ sm2P256Sub(x3, x3, &tm) // x3 = r ^ 2 - h ^ 3 - 2 * u1 * h ^ 2
+
+ sm2P256Mul(&tm, &u1, &h2) // tm = u1 * h ^ 2
+ sm2P256Sub(&tm, &tm, x3) // tm = u1 * h ^ 2 - x3
+ sm2P256Mul(y3, &r, &tm)
+ sm2P256Mul(&tm, &h2, &h) // tm = h ^ 3
+ sm2P256Mul(&tm, &tm, &s1) // tm = s1 * h ^ 3
+ sm2P256Sub(y3, y3, &tm) // y3 = r * (u1 * h ^ 2 - x3) - s1 * h ^ 3
+
+ sm2P256Mul(z3, z1, z2)
+ sm2P256Mul(z3, z3, &h) // z3 = z1 * z3 * h
+}
+
+// (x3, y3, z3) = (x1, y1, z1)- (x2, y2, z2)
+func sm2P256PointSub(x1, y1, z1, x2, y2, z2, x3, y3, z3 *sm2P256FieldElement) {
+ var u1, u2, z22, z12, z23, z13, s1, s2, h, h2, r, r2, tm sm2P256FieldElement
+ y:=sm2P256ToBig(y2)
+ zero:=new(big.Int).SetInt64(0)
+ y.Sub(zero,y)
+ sm2P256FromBig(y2,y)
+
+ if sm2P256ToBig(z1).Sign() == 0 {
+ sm2P256Dup(x3, x2)
+ sm2P256Dup(y3, y2)
+ sm2P256Dup(z3, z2)
+ return
+ }
+
+ if sm2P256ToBig(z2).Sign() == 0 {
+ sm2P256Dup(x3, x1)
+ sm2P256Dup(y3, y1)
+ sm2P256Dup(z3, z1)
+ return
+ }
+
+ sm2P256Square(&z12, z1) // z12 = z1 ^ 2
+ sm2P256Square(&z22, z2) // z22 = z2 ^ 2
+
+ sm2P256Mul(&z13, &z12, z1) // z13 = z1 ^ 3
+ sm2P256Mul(&z23, &z22, z2) // z23 = z2 ^ 3
+
+ sm2P256Mul(&u1, x1, &z22) // u1 = x1 * z2 ^ 2
+ sm2P256Mul(&u2, x2, &z12) // u2 = x2 * z1 ^ 2
+
+ sm2P256Mul(&s1, y1, &z23) // s1 = y1 * z2 ^ 3
+ sm2P256Mul(&s2, y2, &z13) // s2 = y2 * z1 ^ 3
+
+ if sm2P256ToBig(&u1).Cmp(sm2P256ToBig(&u2)) == 0 &&
+ sm2P256ToBig(&s1).Cmp(sm2P256ToBig(&s2)) == 0 {
+ sm2P256PointDouble(x1, y1, z1, x1, y1, z1)
+ }
+
+ sm2P256Sub(&h, &u2, &u1) // h = u2 - u1
+ sm2P256Sub(&r, &s2, &s1) // r = s2 - s1
+
+ sm2P256Square(&r2, &r) // r2 = r ^ 2
+ sm2P256Square(&h2, &h) // h2 = h ^ 2
+
+ sm2P256Mul(&tm, &h2, &h) // tm = h ^ 3
+ sm2P256Sub(x3, &r2, &tm)
+ sm2P256Mul(&tm, &u1, &h2)
+ sm2P256Scalar(&tm, 2) // tm = 2 * (u1 * h ^ 2)
+ sm2P256Sub(x3, x3, &tm) // x3 = r ^ 2 - h ^ 3 - 2 * u1 * h ^ 2
+
+ sm2P256Mul(&tm, &u1, &h2) // tm = u1 * h ^ 2
+ sm2P256Sub(&tm, &tm, x3) // tm = u1 * h ^ 2 - x3
+ sm2P256Mul(y3, &r, &tm)
+ sm2P256Mul(&tm, &h2, &h) // tm = h ^ 3
+ sm2P256Mul(&tm, &tm, &s1) // tm = s1 * h ^ 3
+ sm2P256Sub(y3, y3, &tm) // y3 = r * (u1 * h ^ 2 - x3) - s1 * h ^ 3
+
+ sm2P256Mul(z3, z1, z2)
+ sm2P256Mul(z3, z3, &h) // z3 = z1 * z3 * h
+}
+
+func sm2P256PointDouble(x3, y3, z3, x, y, z *sm2P256FieldElement) {
+ var s, m, m2, x2, y2, z2, z4, y4, az4 sm2P256FieldElement
+
+ sm2P256Square(&x2, x) // x2 = x ^ 2
+ sm2P256Square(&y2, y) // y2 = y ^ 2
+ sm2P256Square(&z2, z) // z2 = z ^ 2
+
+ sm2P256Square(&z4, z) // z4 = z ^ 2
+ sm2P256Mul(&z4, &z4, z) // z4 = z ^ 3
+ sm2P256Mul(&z4, &z4, z) // z4 = z ^ 4
+
+ sm2P256Square(&y4, y) // y4 = y ^ 2
+ sm2P256Mul(&y4, &y4, y) // y4 = y ^ 3
+ sm2P256Mul(&y4, &y4, y) // y4 = y ^ 4
+ sm2P256Scalar(&y4, 8) // y4 = 8 * y ^ 4
+
+ sm2P256Mul(&s, x, &y2)
+ sm2P256Scalar(&s, 4) // s = 4 * x * y ^ 2
+
+ sm2P256Dup(&m, &x2)
+ sm2P256Scalar(&m, 3)
+ sm2P256Mul(&az4, &sm2P256.a, &z4)
+ sm2P256Add(&m, &m, &az4) // m = 3 * x ^ 2 + a * z ^ 4
+
+ sm2P256Square(&m2, &m) // m2 = m ^ 2
+
+ sm2P256Add(z3, y, z)
+ sm2P256Square(z3, z3)
+ sm2P256Sub(z3, z3, &z2)
+ sm2P256Sub(z3, z3, &y2) // z' = (y + z) ^2 - z ^ 2 - y ^ 2
+
+ sm2P256Sub(x3, &m2, &s)
+ sm2P256Sub(x3, x3, &s) // x' = m2 - 2 * s
+
+ sm2P256Sub(y3, &s, x3)
+ sm2P256Mul(y3, y3, &m)
+ sm2P256Sub(y3, y3, &y4) // y' = m * (s - x') - 8 * y ^ 4
+}
+
+// p256Zero31 is 0 mod p.
+var sm2P256Zero31 = sm2P256FieldElement{0x7FFFFFF8, 0x3FFFFFFC, 0x800003FC, 0x3FFFDFFC, 0x7FFFFFFC, 0x3FFFFFFC, 0x7FFFFFFC, 0x37FFFFFC, 0x7FFFFFFC}
+
+// c = a + b
+func sm2P256Add(c, a, b *sm2P256FieldElement) {
+ carry := uint32(0)
+ for i := 0; ; i++ {
+ c[i] = a[i] + b[i]
+ c[i] += carry
+ carry = c[i] >> 29
+ c[i] &= bottom29Bits
+ i++
+ if i == 9 {
+ break
+ }
+ c[i] = a[i] + b[i]
+ c[i] += carry
+ carry = c[i] >> 28
+ c[i] &= bottom28Bits
+ }
+ sm2P256ReduceCarry(c, carry)
+}
+
+// c = a - b
+func sm2P256Sub(c, a, b *sm2P256FieldElement) {
+ var carry uint32
+
+ for i := 0; ; i++ {
+ c[i] = a[i] - b[i]
+ c[i] += sm2P256Zero31[i]
+ c[i] += carry
+ carry = c[i] >> 29
+ c[i] &= bottom29Bits
+ i++
+ if i == 9 {
+ break
+ }
+ c[i] = a[i] - b[i]
+ c[i] += sm2P256Zero31[i]
+ c[i] += carry
+ carry = c[i] >> 28
+ c[i] &= bottom28Bits
+ }
+ sm2P256ReduceCarry(c, carry)
+}
+
+// c = a * b
+func sm2P256Mul(c, a, b *sm2P256FieldElement) {
+ var tmp sm2P256LargeFieldElement
+
+ tmp[0] = uint64(a[0]) * uint64(b[0])
+ tmp[1] = uint64(a[0])*(uint64(b[1])<<0) +
+ uint64(a[1])*(uint64(b[0])<<0)
+ tmp[2] = uint64(a[0])*(uint64(b[2])<<0) +
+ uint64(a[1])*(uint64(b[1])<<1) +
+ uint64(a[2])*(uint64(b[0])<<0)
+ tmp[3] = uint64(a[0])*(uint64(b[3])<<0) +
+ uint64(a[1])*(uint64(b[2])<<0) +
+ uint64(a[2])*(uint64(b[1])<<0) +
+ uint64(a[3])*(uint64(b[0])<<0)
+ tmp[4] = uint64(a[0])*(uint64(b[4])<<0) +
+ uint64(a[1])*(uint64(b[3])<<1) +
+ uint64(a[2])*(uint64(b[2])<<0) +
+ uint64(a[3])*(uint64(b[1])<<1) +
+ uint64(a[4])*(uint64(b[0])<<0)
+ tmp[5] = uint64(a[0])*(uint64(b[5])<<0) +
+ uint64(a[1])*(uint64(b[4])<<0) +
+ uint64(a[2])*(uint64(b[3])<<0) +
+ uint64(a[3])*(uint64(b[2])<<0) +
+ uint64(a[4])*(uint64(b[1])<<0) +
+ uint64(a[5])*(uint64(b[0])<<0)
+ tmp[6] = uint64(a[0])*(uint64(b[6])<<0) +
+ uint64(a[1])*(uint64(b[5])<<1) +
+ uint64(a[2])*(uint64(b[4])<<0) +
+ uint64(a[3])*(uint64(b[3])<<1) +
+ uint64(a[4])*(uint64(b[2])<<0) +
+ uint64(a[5])*(uint64(b[1])<<1) +
+ uint64(a[6])*(uint64(b[0])<<0)
+ tmp[7] = uint64(a[0])*(uint64(b[7])<<0) +
+ uint64(a[1])*(uint64(b[6])<<0) +
+ uint64(a[2])*(uint64(b[5])<<0) +
+ uint64(a[3])*(uint64(b[4])<<0) +
+ uint64(a[4])*(uint64(b[3])<<0) +
+ uint64(a[5])*(uint64(b[2])<<0) +
+ uint64(a[6])*(uint64(b[1])<<0) +
+ uint64(a[7])*(uint64(b[0])<<0)
+ // tmp[8] has the greatest value but doesn't overflow. See logic in
+ // p256Square.
+ tmp[8] = uint64(a[0])*(uint64(b[8])<<0) +
+ uint64(a[1])*(uint64(b[7])<<1) +
+ uint64(a[2])*(uint64(b[6])<<0) +
+ uint64(a[3])*(uint64(b[5])<<1) +
+ uint64(a[4])*(uint64(b[4])<<0) +
+ uint64(a[5])*(uint64(b[3])<<1) +
+ uint64(a[6])*(uint64(b[2])<<0) +
+ uint64(a[7])*(uint64(b[1])<<1) +
+ uint64(a[8])*(uint64(b[0])<<0)
+ tmp[9] = uint64(a[1])*(uint64(b[8])<<0) +
+ uint64(a[2])*(uint64(b[7])<<0) +
+ uint64(a[3])*(uint64(b[6])<<0) +
+ uint64(a[4])*(uint64(b[5])<<0) +
+ uint64(a[5])*(uint64(b[4])<<0) +
+ uint64(a[6])*(uint64(b[3])<<0) +
+ uint64(a[7])*(uint64(b[2])<<0) +
+ uint64(a[8])*(uint64(b[1])<<0)
+ tmp[10] = uint64(a[2])*(uint64(b[8])<<0) +
+ uint64(a[3])*(uint64(b[7])<<1) +
+ uint64(a[4])*(uint64(b[6])<<0) +
+ uint64(a[5])*(uint64(b[5])<<1) +
+ uint64(a[6])*(uint64(b[4])<<0) +
+ uint64(a[7])*(uint64(b[3])<<1) +
+ uint64(a[8])*(uint64(b[2])<<0)
+ tmp[11] = uint64(a[3])*(uint64(b[8])<<0) +
+ uint64(a[4])*(uint64(b[7])<<0) +
+ uint64(a[5])*(uint64(b[6])<<0) +
+ uint64(a[6])*(uint64(b[5])<<0) +
+ uint64(a[7])*(uint64(b[4])<<0) +
+ uint64(a[8])*(uint64(b[3])<<0)
+ tmp[12] = uint64(a[4])*(uint64(b[8])<<0) +
+ uint64(a[5])*(uint64(b[7])<<1) +
+ uint64(a[6])*(uint64(b[6])<<0) +
+ uint64(a[7])*(uint64(b[5])<<1) +
+ uint64(a[8])*(uint64(b[4])<<0)
+ tmp[13] = uint64(a[5])*(uint64(b[8])<<0) +
+ uint64(a[6])*(uint64(b[7])<<0) +
+ uint64(a[7])*(uint64(b[6])<<0) +
+ uint64(a[8])*(uint64(b[5])<<0)
+ tmp[14] = uint64(a[6])*(uint64(b[8])<<0) +
+ uint64(a[7])*(uint64(b[7])<<1) +
+ uint64(a[8])*(uint64(b[6])<<0)
+ tmp[15] = uint64(a[7])*(uint64(b[8])<<0) +
+ uint64(a[8])*(uint64(b[7])<<0)
+ tmp[16] = uint64(a[8]) * (uint64(b[8]) << 0)
+ sm2P256ReduceDegree(c, &tmp)
+}
+
+// b = a * a
+func sm2P256Square(b, a *sm2P256FieldElement) {
+ var tmp sm2P256LargeFieldElement
+
+ tmp[0] = uint64(a[0]) * uint64(a[0])
+ tmp[1] = uint64(a[0]) * (uint64(a[1]) << 1)
+ tmp[2] = uint64(a[0])*(uint64(a[2])<<1) +
+ uint64(a[1])*(uint64(a[1])<<1)
+ tmp[3] = uint64(a[0])*(uint64(a[3])<<1) +
+ uint64(a[1])*(uint64(a[2])<<1)
+ tmp[4] = uint64(a[0])*(uint64(a[4])<<1) +
+ uint64(a[1])*(uint64(a[3])<<2) +
+ uint64(a[2])*uint64(a[2])
+ tmp[5] = uint64(a[0])*(uint64(a[5])<<1) +
+ uint64(a[1])*(uint64(a[4])<<1) +
+ uint64(a[2])*(uint64(a[3])<<1)
+ tmp[6] = uint64(a[0])*(uint64(a[6])<<1) +
+ uint64(a[1])*(uint64(a[5])<<2) +
+ uint64(a[2])*(uint64(a[4])<<1) +
+ uint64(a[3])*(uint64(a[3])<<1)
+ tmp[7] = uint64(a[0])*(uint64(a[7])<<1) +
+ uint64(a[1])*(uint64(a[6])<<1) +
+ uint64(a[2])*(uint64(a[5])<<1) +
+ uint64(a[3])*(uint64(a[4])<<1)
+ // tmp[8] has the greatest value of 2**61 + 2**60 + 2**61 + 2**60 + 2**60,
+ // which is < 2**64 as required.
+ tmp[8] = uint64(a[0])*(uint64(a[8])<<1) +
+ uint64(a[1])*(uint64(a[7])<<2) +
+ uint64(a[2])*(uint64(a[6])<<1) +
+ uint64(a[3])*(uint64(a[5])<<2) +
+ uint64(a[4])*uint64(a[4])
+ tmp[9] = uint64(a[1])*(uint64(a[8])<<1) +
+ uint64(a[2])*(uint64(a[7])<<1) +
+ uint64(a[3])*(uint64(a[6])<<1) +
+ uint64(a[4])*(uint64(a[5])<<1)
+ tmp[10] = uint64(a[2])*(uint64(a[8])<<1) +
+ uint64(a[3])*(uint64(a[7])<<2) +
+ uint64(a[4])*(uint64(a[6])<<1) +
+ uint64(a[5])*(uint64(a[5])<<1)
+ tmp[11] = uint64(a[3])*(uint64(a[8])<<1) +
+ uint64(a[4])*(uint64(a[7])<<1) +
+ uint64(a[5])*(uint64(a[6])<<1)
+ tmp[12] = uint64(a[4])*(uint64(a[8])<<1) +
+ uint64(a[5])*(uint64(a[7])<<2) +
+ uint64(a[6])*uint64(a[6])
+ tmp[13] = uint64(a[5])*(uint64(a[8])<<1) +
+ uint64(a[6])*(uint64(a[7])<<1)
+ tmp[14] = uint64(a[6])*(uint64(a[8])<<1) +
+ uint64(a[7])*(uint64(a[7])<<1)
+ tmp[15] = uint64(a[7]) * (uint64(a[8]) << 1)
+ tmp[16] = uint64(a[8]) * uint64(a[8])
+ sm2P256ReduceDegree(b, &tmp)
+}
+
+// nonZeroToAllOnes returns:
+// 0xffffffff for 0 < x <= 2**31
+// 0 for x == 0 or x > 2**31.
+func nonZeroToAllOnes(x uint32) uint32 {
+ return ((x - 1) >> 31) - 1
+}
+
+var sm2P256Carry = [8 * 9]uint32{
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x2, 0x0, 0x1FFFFF00, 0x7FF, 0x0, 0x0, 0x0, 0x2000000, 0x0,
+ 0x4, 0x0, 0x1FFFFE00, 0xFFF, 0x0, 0x0, 0x0, 0x4000000, 0x0,
+ 0x6, 0x0, 0x1FFFFD00, 0x17FF, 0x0, 0x0, 0x0, 0x6000000, 0x0,
+ 0x8, 0x0, 0x1FFFFC00, 0x1FFF, 0x0, 0x0, 0x0, 0x8000000, 0x0,
+ 0xA, 0x0, 0x1FFFFB00, 0x27FF, 0x0, 0x0, 0x0, 0xA000000, 0x0,
+ 0xC, 0x0, 0x1FFFFA00, 0x2FFF, 0x0, 0x0, 0x0, 0xC000000, 0x0,
+ 0xE, 0x0, 0x1FFFF900, 0x37FF, 0x0, 0x0, 0x0, 0xE000000, 0x0,
+}
+
+// carry < 2 ^ 3
+func sm2P256ReduceCarry(a *sm2P256FieldElement, carry uint32) {
+ a[0] += sm2P256Carry[carry*9+0]
+ a[2] += sm2P256Carry[carry*9+2]
+ a[3] += sm2P256Carry[carry*9+3]
+ a[7] += sm2P256Carry[carry*9+7]
+}
+
+
+func sm2P256ReduceDegree(a *sm2P256FieldElement, b *sm2P256LargeFieldElement) {
+ var tmp [18]uint32
+ var carry, x, xMask uint32
+
+ // tmp
+ // 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 ...
+ // 29 | 28 | 29 | 28 | 29 | 28 | 29 | 28 | 29 | 28 | 29 ...
+ tmp[0] = uint32(b[0]) & bottom29Bits
+ tmp[1] = uint32(b[0]) >> 29
+ tmp[1] |= (uint32(b[0]>>32) << 3) & bottom28Bits
+ tmp[1] += uint32(b[1]) & bottom28Bits
+ carry = tmp[1] >> 28
+ tmp[1] &= bottom28Bits
+ for i := 2; i < 17; i++ {
+ tmp[i] = (uint32(b[i-2] >> 32)) >> 25
+ tmp[i] += (uint32(b[i-1])) >> 28
+ tmp[i] += (uint32(b[i-1]>>32) << 4) & bottom29Bits
+ tmp[i] += uint32(b[i]) & bottom29Bits
+ tmp[i] += carry
+ carry = tmp[i] >> 29
+ tmp[i] &= bottom29Bits
+
+ i++
+ if i == 17 {
+ break
+ }
+ tmp[i] = uint32(b[i-2]>>32) >> 25
+ tmp[i] += uint32(b[i-1]) >> 29
+ tmp[i] += ((uint32(b[i-1] >> 32)) << 3) & bottom28Bits
+ tmp[i] += uint32(b[i]) & bottom28Bits
+ tmp[i] += carry
+ carry = tmp[i] >> 28
+ tmp[i] &= bottom28Bits
+ }
+ tmp[17] = uint32(b[15]>>32) >> 25
+ tmp[17] += uint32(b[16]) >> 29
+ tmp[17] += uint32(b[16]>>32) << 3
+ tmp[17] += carry
+
+ for i := 0; ; i += 2 {
+
+ tmp[i+1] += tmp[i] >> 29
+ x = tmp[i] & bottom29Bits
+ tmp[i] = 0
+ if x > 0 {
+ set4 := uint32(0)
+ set7 := uint32(0)
+ xMask = nonZeroToAllOnes(x)
+ tmp[i+2] += (x << 7) & bottom29Bits
+ tmp[i+3] += x >> 22
+ if tmp[i+3] < 0x10000000 {
+ set4 = 1
+ tmp[i+3] += 0x10000000 & xMask
+ tmp[i+3] -= (x << 10) & bottom28Bits
+ } else {
+ tmp[i+3] -= (x << 10) & bottom28Bits
+ }
+ if tmp[i+4] < 0x20000000 {
+ tmp[i+4] += 0x20000000 & xMask
+ tmp[i+4] -= set4 // 借位
+ tmp[i+4] -= x >> 18
+ if tmp[i+5] < 0x10000000 {
+ tmp[i+5] += 0x10000000 & xMask
+ tmp[i+5] -= 1 // 借位
+ if tmp[i+6] < 0x20000000 {
+ set7 = 1
+ tmp[i+6] += 0x20000000 & xMask
+ tmp[i+6] -= 1 // 借位
+ } else {
+ tmp[i+6] -= 1 // 借位
+ }
+ } else {
+ tmp[i+5] -= 1
+ }
+ } else {
+ tmp[i+4] -= set4 // 借位
+ tmp[i+4] -= x >> 18
+ }
+ if tmp[i+7] < 0x10000000 {
+ tmp[i+7] += 0x10000000 & xMask
+ tmp[i+7] -= set7
+ tmp[i+7] -= (x << 24) & bottom28Bits
+ tmp[i+8] += (x << 28) & bottom29Bits
+ if tmp[i+8] < 0x20000000 {
+ tmp[i+8] += 0x20000000 & xMask
+ tmp[i+8] -= 1
+ tmp[i+8] -= x >> 4
+ tmp[i+9] += ((x >> 1) - 1) & xMask
+ } else {
+ tmp[i+8] -= 1
+ tmp[i+8] -= x >> 4
+ tmp[i+9] += (x >> 1) & xMask
+ }
+ } else {
+ tmp[i+7] -= set7 // 借位
+ tmp[i+7] -= (x << 24) & bottom28Bits
+ tmp[i+8] += (x << 28) & bottom29Bits
+ if tmp[i+8] < 0x20000000 {
+ tmp[i+8] += 0x20000000 & xMask
+ tmp[i+8] -= x >> 4
+ tmp[i+9] += ((x >> 1) - 1) & xMask
+ } else {
+ tmp[i+8] -= x >> 4
+ tmp[i+9] += (x >> 1) & xMask
+ }
+ }
+
+ }
+
+ if i+1 == 9 {
+ break
+ }
+
+ tmp[i+2] += tmp[i+1] >> 28
+ x = tmp[i+1] & bottom28Bits
+ tmp[i+1] = 0
+ if x > 0 {
+ set5 := uint32(0)
+ set8 := uint32(0)
+ set9 := uint32(0)
+ xMask = nonZeroToAllOnes(x)
+ tmp[i+3] += (x << 7) & bottom28Bits
+ tmp[i+4] += x >> 21
+ if tmp[i+4] < 0x20000000 {
+ set5 = 1
+ tmp[i+4] += 0x20000000 & xMask
+ tmp[i+4] -= (x << 11) & bottom29Bits
+ } else {
+ tmp[i+4] -= (x << 11) & bottom29Bits
+ }
+ if tmp[i+5] < 0x10000000 {
+ tmp[i+5] += 0x10000000 & xMask
+ tmp[i+5] -= set5 // 借位
+ tmp[i+5] -= x >> 18
+ if tmp[i+6] < 0x20000000 {
+ tmp[i+6] += 0x20000000 & xMask
+ tmp[i+6] -= 1 // 借位
+ if tmp[i+7] < 0x10000000 {
+ set8 = 1
+ tmp[i+7] += 0x10000000 & xMask
+ tmp[i+7] -= 1 // 借位
+ } else {
+ tmp[i+7] -= 1 // 借位
+ }
+ } else {
+ tmp[i+6] -= 1 // 借位
+ }
+ } else {
+ tmp[i+5] -= set5 // 借位
+ tmp[i+5] -= x >> 18
+ }
+ if tmp[i+8] < 0x20000000 {
+ set9 = 1
+ tmp[i+8] += 0x20000000 & xMask
+ tmp[i+8] -= set8
+ tmp[i+8] -= (x << 25) & bottom29Bits
+ } else {
+ tmp[i+8] -= set8
+ tmp[i+8] -= (x << 25) & bottom29Bits
+ }
+ if tmp[i+9] < 0x10000000 {
+ tmp[i+9] += 0x10000000 & xMask
+ tmp[i+9] -= set9 // 借位
+ tmp[i+9] -= x >> 4
+ tmp[i+10] += (x - 1) & xMask
+ } else {
+ tmp[i+9] -= set9 // 借位
+ tmp[i+9] -= x >> 4
+ tmp[i+10] += x & xMask
+ }
+ }
+ }
+
+ carry = uint32(0)
+ for i := 0; i < 8; i++ {
+ a[i] = tmp[i+9]
+ a[i] += carry
+ a[i] += (tmp[i+10] << 28) & bottom29Bits
+ carry = a[i] >> 29
+ a[i] &= bottom29Bits
+
+ i++
+ a[i] = tmp[i+9] >> 1
+ a[i] += carry
+ carry = a[i] >> 28
+ a[i] &= bottom28Bits
+ }
+ a[8] = tmp[17]
+ a[8] += carry
+ carry = a[8] >> 29
+ a[8] &= bottom29Bits
+ sm2P256ReduceCarry(a, carry)
+}
+
+// b = a
+func sm2P256Dup(b, a *sm2P256FieldElement) {
+ *b = *a
+}
+
+// X = a * R mod P
+func sm2P256FromBig(X *sm2P256FieldElement, a *big.Int) {
+ x := new(big.Int).Lsh(a, 257)
+ x.Mod(x, sm2P256.P)
+ for i := 0; i < 9; i++ {
+ if bits := x.Bits(); len(bits) > 0 {
+ X[i] = uint32(bits[0]) & bottom29Bits
+ } else {
+ X[i] = 0
+ }
+ x.Rsh(x, 29)
+ i++
+ if i == 9 {
+ break
+ }
+ if bits := x.Bits(); len(bits) > 0 {
+ X[i] = uint32(bits[0]) & bottom28Bits
+ } else {
+ X[i] = 0
+ }
+ x.Rsh(x, 28)
+ }
+}
+
+// X = r * R mod P
+// r = X * R' mod P
+func sm2P256ToBig(X *sm2P256FieldElement) *big.Int {
+ r, tm := new(big.Int), new(big.Int)
+ r.SetInt64(int64(X[8]))
+ for i := 7; i >= 0; i-- {
+ if (i & 1) == 0 {
+ r.Lsh(r, 29)
+ } else {
+ r.Lsh(r, 28)
+ }
+ tm.SetInt64(int64(X[i]))
+ r.Add(r, tm)
+ }
+ r.Mul(r, sm2P256.RInverse)
+ r.Mod(r, sm2P256.P)
+ return r
+}
+func WNafReversed(wnaf []int8) []int8 {
+ wnafRev := make([]int8, len(wnaf), len(wnaf))
+ for i, v := range wnaf {
+ wnafRev[len(wnaf)-(1+i)] = v
+ }
+ return wnafRev
+}
+func sm2GenrateWNaf(b []byte) []int8 {
+ n:= new(big.Int).SetBytes(b)
+ var k *big.Int
+ if n.Cmp(sm2P256.N) >= 0 {
+ n.Mod(n, sm2P256.N)
+ k = n
+ } else {
+ k = n
+ }
+ wnaf := make([]int8, k.BitLen()+1, k.BitLen()+1)
+ if k.Sign() == 0 {
+ return wnaf
+ }
+ var width, pow2, sign int
+ width, pow2, sign = 4, 16, 8
+ var mask int64 = 15
+ var carry bool
+ var length, pos int
+ for pos <= k.BitLen() {
+ if k.Bit(pos) == boolToUint(carry) {
+ pos++
+ continue
+ }
+ k.Rsh(k, uint(pos))
+ var digit int
+ digit = int(k.Int64() & mask)
+ if carry {
+ digit++
+ }
+ carry = (digit & sign) != 0
+ if carry {
+ digit -= pow2
+ }
+ length += pos
+ wnaf[length] = int8(digit)
+ pos = int(width)
+ }
+ if len(wnaf) > length+1 {
+ t := make([]int8, length+1, length+1)
+ copy(t, wnaf[0:length+1])
+ wnaf = t
+ }
+ return wnaf
+}
+func boolToUint(b bool) uint {
+ if b {
+ return 1
+ }
+ return 0
+}
+func abs(a int8) uint32{
+ if a<0 {
+ return uint32(-a)
+ }
+ return uint32(a)
+}
+
+func sm2P256ScalarMult(xOut, yOut, zOut, x, y *sm2P256FieldElement, scalar []int8) {
+ var precomp [16][3]sm2P256FieldElement
+ var px, py, pz, tx, ty, tz sm2P256FieldElement
+ var nIsInfinityMask, index, pIsNoninfiniteMask, mask uint32
+
+ // We precompute 0,1,2,... times {x,y}.
+ precomp[1][0] = *x
+ precomp[1][1] = *y
+ precomp[1][2] = sm2P256Factor[1]
+
+ for i := 2; i < 8; i += 2 {
+ sm2P256PointDouble(&precomp[i][0], &precomp[i][1], &precomp[i][2], &precomp[i/2][0], &precomp[i/2][1], &precomp[i/2][2])
+ sm2P256PointAddMixed(&precomp[i+1][0], &precomp[i+1][1], &precomp[i+1][2], &precomp[i][0], &precomp[i][1], &precomp[i][2], x, y)
+ }
+
+ for i := range xOut {
+ xOut[i] = 0
+ }
+ for i := range yOut {
+ yOut[i] = 0
+ }
+ for i := range zOut {
+ zOut[i] = 0
+ }
+ nIsInfinityMask = ^uint32(0)
+ var zeroes int16
+ for i := 0; i0){
+ for ;zeroes>0;zeroes-- {
+ sm2P256PointDouble(xOut, yOut, zOut, xOut, yOut, zOut)
+ }
+ }
+ index = abs(scalar[i])
+ sm2P256PointDouble(xOut, yOut, zOut, xOut, yOut, zOut)
+ sm2P256SelectJacobianPoint(&px, &py, &pz, &precomp, index)
+ if scalar[i] > 0 {
+ sm2P256PointAdd(xOut, yOut, zOut, &px, &py, &pz, &tx, &ty, &tz)
+ } else {
+ sm2P256PointSub(xOut, yOut, zOut, &px, &py, &pz, &tx, &ty, &tz)
+ }
+ sm2P256CopyConditional(xOut, &px, nIsInfinityMask)
+ sm2P256CopyConditional(yOut, &py, nIsInfinityMask)
+ sm2P256CopyConditional(zOut, &pz, nIsInfinityMask)
+ pIsNoninfiniteMask = nonZeroToAllOnes(index)
+ mask = pIsNoninfiniteMask & ^nIsInfinityMask
+ sm2P256CopyConditional(xOut, &tx, mask)
+ sm2P256CopyConditional(yOut, &ty, mask)
+ sm2P256CopyConditional(zOut, &tz, mask)
+ nIsInfinityMask &^= pIsNoninfiniteMask
+ }
+ if(zeroes>0){
+ for ;zeroes>0;zeroes-- {
+ sm2P256PointDouble(xOut, yOut, zOut, xOut, yOut, zOut)
+ }
+ }
+}
diff --git a/vendor/github.com/tjfoc/gmsm/sm2/sm2.go b/vendor/github.com/tjfoc/gmsm/sm2/sm2.go
new file mode 100644
index 0000000000..20b2794a8f
--- /dev/null
+++ b/vendor/github.com/tjfoc/gmsm/sm2/sm2.go
@@ -0,0 +1,674 @@
+/*
+Copyright Suzhou Tongji Fintech Research Institute 2017 All Rights Reserved.
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package sm2
+
+// reference to ecdsa
+import (
+ "bytes"
+ "crypto"
+ "crypto/elliptic"
+ "crypto/rand"
+ "encoding/asn1"
+ "encoding/binary"
+ "errors"
+ "io"
+ "math/big"
+
+ "github.com/tjfoc/gmsm/sm3"
+)
+
+var (
+ default_uid = []byte{0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38}
+ C1C3C2=0
+ C1C2C3=1
+)
+
+type PublicKey struct {
+ elliptic.Curve
+ X, Y *big.Int
+}
+
+type PrivateKey struct {
+ PublicKey
+ D *big.Int
+}
+
+type sm2Signature struct {
+ R, S *big.Int
+}
+type sm2Cipher struct {
+ XCoordinate *big.Int
+ YCoordinate *big.Int
+ HASH []byte
+ CipherText []byte
+}
+
+// The SM2's private key contains the public key
+func (priv *PrivateKey) Public() crypto.PublicKey {
+ return &priv.PublicKey
+}
+
+var errZeroParam = errors.New("zero parameter")
+var one = new(big.Int).SetInt64(1)
+var two = new(big.Int).SetInt64(2)
+
+// sign format = 30 + len(z) + 02 + len(r) + r + 02 + len(s) + s, z being what follows its size, ie 02+len(r)+r+02+len(s)+s
+func (priv *PrivateKey) Sign(random io.Reader, msg []byte, signer crypto.SignerOpts) ([]byte, error) {
+ r, s, err := Sm2Sign(priv, msg, nil, random)
+ if err != nil {
+ return nil, err
+ }
+ return asn1.Marshal(sm2Signature{r, s})
+}
+
+func (pub *PublicKey) Verify(msg []byte, sign []byte) bool {
+ var sm2Sign sm2Signature
+ _, err := asn1.Unmarshal(sign, &sm2Sign)
+ if err != nil {
+ return false
+ }
+ return Sm2Verify(pub, msg, default_uid, sm2Sign.R, sm2Sign.S)
+}
+
+func (pub *PublicKey) Sm3Digest(msg, uid []byte) ([]byte, error) {
+ if len(uid) == 0 {
+ uid = default_uid
+ }
+
+ za, err := ZA(pub, uid)
+ if err != nil {
+ return nil, err
+ }
+
+ e, err := msgHash(za, msg)
+ if err != nil {
+ return nil, err
+ }
+
+ return e.Bytes(), nil
+}
+
+//****************************Encryption algorithm****************************//
+func (pub *PublicKey) EncryptAsn1(data []byte, random io.Reader) ([]byte, error) {
+ return EncryptAsn1(pub, data, random)
+}
+
+func (priv *PrivateKey) DecryptAsn1(data []byte) ([]byte, error) {
+ return DecryptAsn1(priv, data)
+}
+
+//**************************Key agreement algorithm**************************//
+// KeyExchangeB 协商第二部,用户B调用, 返回共享密钥k
+func KeyExchangeB(klen int, ida, idb []byte, priB *PrivateKey, pubA *PublicKey, rpri *PrivateKey, rpubA *PublicKey) (k, s1, s2 []byte, err error) {
+ return keyExchange(klen, ida, idb, priB, pubA, rpri, rpubA, false)
+}
+
+// KeyExchangeA 协商第二部,用户A调用,返回共享密钥k
+func KeyExchangeA(klen int, ida, idb []byte, priA *PrivateKey, pubB *PublicKey, rpri *PrivateKey, rpubB *PublicKey) (k, s1, s2 []byte, err error) {
+ return keyExchange(klen, ida, idb, priA, pubB, rpri, rpubB, true)
+}
+
+//****************************************************************************//
+
+func Sm2Sign(priv *PrivateKey, msg, uid []byte, random io.Reader) (r, s *big.Int, err error) {
+ digest, err := priv.PublicKey.Sm3Digest(msg, uid)
+ if err != nil {
+ return nil, nil, err
+ }
+ e := new(big.Int).SetBytes(digest)
+ c := priv.PublicKey.Curve
+ N := c.Params().N
+ if N.Sign() == 0 {
+ return nil, nil, errZeroParam
+ }
+ var k *big.Int
+ for { // 调整算法细节以实现SM2
+ for {
+ k, err = randFieldElement(c, random)
+ if err != nil {
+ r = nil
+ return
+ }
+ r, _ = priv.Curve.ScalarBaseMult(k.Bytes())
+ r.Add(r, e)
+ r.Mod(r, N)
+ if r.Sign() != 0 {
+ if t := new(big.Int).Add(r, k); t.Cmp(N) != 0 {
+ break
+ }
+ }
+
+ }
+ rD := new(big.Int).Mul(priv.D, r)
+ s = new(big.Int).Sub(k, rD)
+ d1 := new(big.Int).Add(priv.D, one)
+ d1Inv := new(big.Int).ModInverse(d1, N)
+ s.Mul(s, d1Inv)
+ s.Mod(s, N)
+ if s.Sign() != 0 {
+ break
+ }
+ }
+ return
+}
+func Sm2Verify(pub *PublicKey, msg, uid []byte, r, s *big.Int) bool {
+ c := pub.Curve
+ N := c.Params().N
+ one := new(big.Int).SetInt64(1)
+ if r.Cmp(one) < 0 || s.Cmp(one) < 0 {
+ return false
+ }
+ if r.Cmp(N) >= 0 || s.Cmp(N) >= 0 {
+ return false
+ }
+ if len(uid) == 0 {
+ uid = default_uid
+ }
+ za, err := ZA(pub, uid)
+ if err != nil {
+ return false
+ }
+ e, err := msgHash(za, msg)
+ if err != nil {
+ return false
+ }
+ t := new(big.Int).Add(r, s)
+ t.Mod(t, N)
+ if t.Sign() == 0 {
+ return false
+ }
+ var x *big.Int
+ x1, y1 := c.ScalarBaseMult(s.Bytes())
+ x2, y2 := c.ScalarMult(pub.X, pub.Y, t.Bytes())
+ x, _ = c.Add(x1, y1, x2, y2)
+
+ x.Add(x, e)
+ x.Mod(x, N)
+ return x.Cmp(r) == 0
+}
+
+/*
+ za, err := ZA(pub, uid)
+ if err != nil {
+ return
+ }
+ e, err := msgHash(za, msg)
+ hash=e.getBytes()
+*/
+func Verify(pub *PublicKey, hash []byte, r, s *big.Int) bool {
+ c := pub.Curve
+ N := c.Params().N
+
+ if r.Sign() <= 0 || s.Sign() <= 0 {
+ return false
+ }
+ if r.Cmp(N) >= 0 || s.Cmp(N) >= 0 {
+ return false
+ }
+
+ // 调整算法细节以实现SM2
+ t := new(big.Int).Add(r, s)
+ t.Mod(t, N)
+ if t.Sign() == 0 {
+ return false
+ }
+
+ var x *big.Int
+ x1, y1 := c.ScalarBaseMult(s.Bytes())
+ x2, y2 := c.ScalarMult(pub.X, pub.Y, t.Bytes())
+ x, _ = c.Add(x1, y1, x2, y2)
+
+ e := new(big.Int).SetBytes(hash)
+ x.Add(x, e)
+ x.Mod(x, N)
+ return x.Cmp(r) == 0
+}
+
+/*
+ * sm2密文结构如下:
+ * x
+ * y
+ * hash
+ * CipherText
+ */
+func Encrypt(pub *PublicKey, data []byte, random io.Reader,mode int) ([]byte, error) {
+ length := len(data)
+ for {
+ c := []byte{}
+ curve := pub.Curve
+ k, err := randFieldElement(curve, random)
+ if err != nil {
+ return nil, err
+ }
+ x1, y1 := curve.ScalarBaseMult(k.Bytes())
+ x2, y2 := curve.ScalarMult(pub.X, pub.Y, k.Bytes())
+ x1Buf := x1.Bytes()
+ y1Buf := y1.Bytes()
+ x2Buf := x2.Bytes()
+ y2Buf := y2.Bytes()
+ if n := len(x1Buf); n < 32 {
+ x1Buf = append(zeroByteSlice()[:32-n], x1Buf...)
+ }
+ if n := len(y1Buf); n < 32 {
+ y1Buf = append(zeroByteSlice()[:32-n], y1Buf...)
+ }
+ if n := len(x2Buf); n < 32 {
+ x2Buf = append(zeroByteSlice()[:32-n], x2Buf...)
+ }
+ if n := len(y2Buf); n < 32 {
+ y2Buf = append(zeroByteSlice()[:32-n], y2Buf...)
+ }
+ c = append(c, x1Buf...) // x分量
+ c = append(c, y1Buf...) // y分量
+ tm := []byte{}
+ tm = append(tm, x2Buf...)
+ tm = append(tm, data...)
+ tm = append(tm, y2Buf...)
+ h := sm3.Sm3Sum(tm)
+ c = append(c, h...)
+ ct, ok := kdf(length, x2Buf, y2Buf) // 密文
+ if !ok {
+ continue
+ }
+ c = append(c, ct...)
+ for i := 0; i < length; i++ {
+ c[96+i] ^= data[i]
+ }
+ switch mode{
+
+ case C1C3C2:
+ return append([]byte{0x04}, c...), nil
+ case C1C2C3:
+ c1 := make([]byte, 64)
+ c2 := make([]byte, len(c) - 96)
+ c3 := make([]byte, 32)
+ copy(c1, c[:64])//x1,y1
+ copy(c3, c[64:96])//hash
+ copy(c2, c[96:])//密文
+ ciphertext := []byte{}
+ ciphertext = append(ciphertext, c1...)
+ ciphertext = append(ciphertext, c2...)
+ ciphertext = append(ciphertext, c3...)
+ return append([]byte{0x04}, ciphertext...), nil
+ default:
+ return append([]byte{0x04}, c...), nil
+ }
+}
+}
+
+
+
+func Decrypt(priv *PrivateKey, data []byte,mode int) ([]byte, error) {
+ switch mode {
+ case C1C3C2:
+ data = data[1:]
+ case C1C2C3:
+ data = data[1:]
+ c1 := make([]byte, 64)
+ c2 := make([]byte, len(data) - 96)
+ c3 := make([]byte, 32)
+ copy(c1, data[:64])//x1,y1
+ copy(c2, data[64:len(data) - 32])//密文
+ copy(c3, data[len(data) - 32:])//hash
+ c := []byte{}
+ c = append(c, c1...)
+ c = append(c, c3...)
+ c = append(c, c2...)
+ data = c
+ default:
+ data = data[1:]
+ }
+ length := len(data) - 96
+ curve := priv.Curve
+ x := new(big.Int).SetBytes(data[:32])
+ y := new(big.Int).SetBytes(data[32:64])
+ x2, y2 := curve.ScalarMult(x, y, priv.D.Bytes())
+ x2Buf := x2.Bytes()
+ y2Buf := y2.Bytes()
+ if n := len(x2Buf); n < 32 {
+ x2Buf = append(zeroByteSlice()[:32-n], x2Buf...)
+ }
+ if n := len(y2Buf); n < 32 {
+ y2Buf = append(zeroByteSlice()[:32-n], y2Buf...)
+ }
+ c, ok := kdf(length, x2Buf, y2Buf)
+ if !ok {
+ return nil, errors.New("Decrypt: failed to decrypt")
+ }
+ for i := 0; i < length; i++ {
+ c[i] ^= data[i+96]
+ }
+ tm := []byte{}
+ tm = append(tm, x2Buf...)
+ tm = append(tm, c...)
+ tm = append(tm, y2Buf...)
+ h := sm3.Sm3Sum(tm)
+ if bytes.Compare(h, data[64:96]) != 0 {
+ return c, errors.New("Decrypt: failed to decrypt")
+ }
+ return c, nil
+}
+
+
+
+// keyExchange 为SM2密钥交换算法的第二部和第三步复用部分,协商的双方均调用此函数计算共同的字节串
+// klen: 密钥长度
+// ida, idb: 协商双方的标识,ida为密钥协商算法发起方标识,idb为响应方标识
+// pri: 函数调用者的密钥
+// pub: 对方的公钥
+// rpri: 函数调用者生成的临时SM2密钥
+// rpub: 对方发来的临时SM2公钥
+// thisIsA: 如果是A调用,文档中的协商第三步,设置为true,否则设置为false
+// 返回 k 为klen长度的字节串
+func keyExchange(klen int, ida, idb []byte, pri *PrivateKey, pub *PublicKey, rpri *PrivateKey, rpub *PublicKey, thisISA bool) (k, s1, s2 []byte, err error) {
+ curve := P256Sm2()
+ N := curve.Params().N
+ x2hat := keXHat(rpri.PublicKey.X)
+ x2rb := new(big.Int).Mul(x2hat, rpri.D)
+ tbt := new(big.Int).Add(pri.D, x2rb)
+ tb := new(big.Int).Mod(tbt, N)
+ if !curve.IsOnCurve(rpub.X, rpub.Y) {
+ err = errors.New("Ra not on curve")
+ return
+ }
+ x1hat := keXHat(rpub.X)
+ ramx1, ramy1 := curve.ScalarMult(rpub.X, rpub.Y, x1hat.Bytes())
+ vxt, vyt := curve.Add(pub.X, pub.Y, ramx1, ramy1)
+
+ vx, vy := curve.ScalarMult(vxt, vyt, tb.Bytes())
+ pza := pub
+ if thisISA {
+ pza = &pri.PublicKey
+ }
+ za, err := ZA(pza, ida)
+ if err != nil {
+ return
+ }
+ zero := new(big.Int)
+ if vx.Cmp(zero) == 0 || vy.Cmp(zero) == 0 {
+ err = errors.New("V is infinite")
+ }
+ pzb := pub
+ if !thisISA {
+ pzb = &pri.PublicKey
+ }
+ zb, err := ZA(pzb, idb)
+ k, ok := kdf(klen, vx.Bytes(), vy.Bytes(), za, zb)
+ if !ok {
+ err = errors.New("kdf: zero key")
+ return
+ }
+ h1 := BytesCombine(vx.Bytes(), za, zb, rpub.X.Bytes(), rpub.Y.Bytes(), rpri.X.Bytes(), rpri.Y.Bytes())
+ if !thisISA {
+ h1 = BytesCombine(vx.Bytes(), za, zb, rpri.X.Bytes(), rpri.Y.Bytes(), rpub.X.Bytes(), rpub.Y.Bytes())
+ }
+ hash := sm3.Sm3Sum(h1)
+ h2 := BytesCombine([]byte{0x02}, vy.Bytes(), hash)
+ S1 := sm3.Sm3Sum(h2)
+ h3 := BytesCombine([]byte{0x03}, vy.Bytes(), hash)
+ S2 := sm3.Sm3Sum(h3)
+ return k, S1, S2, nil
+}
+
+func msgHash(za, msg []byte) (*big.Int, error) {
+ e := sm3.New()
+ e.Write(za)
+ e.Write(msg)
+ return new(big.Int).SetBytes(e.Sum(nil)[:32]), nil
+}
+
+// ZA = H256(ENTLA || IDA || a || b || xG || yG || xA || yA)
+func ZA(pub *PublicKey, uid []byte) ([]byte, error) {
+ za := sm3.New()
+ uidLen := len(uid)
+ if uidLen >= 8192 {
+ return []byte{}, errors.New("SM2: uid too large")
+ }
+ Entla := uint16(8 * uidLen)
+ za.Write([]byte{byte((Entla >> 8) & 0xFF)})
+ za.Write([]byte{byte(Entla & 0xFF)})
+ if uidLen > 0 {
+ za.Write(uid)
+ }
+ za.Write(sm2P256ToBig(&sm2P256.a).Bytes())
+ za.Write(sm2P256.B.Bytes())
+ za.Write(sm2P256.Gx.Bytes())
+ za.Write(sm2P256.Gy.Bytes())
+
+ xBuf := pub.X.Bytes()
+ yBuf := pub.Y.Bytes()
+ if n := len(xBuf); n < 32 {
+ xBuf = append(zeroByteSlice()[:32-n], xBuf...)
+ }
+ if n := len(yBuf); n < 32 {
+ yBuf = append(zeroByteSlice()[:32-n], yBuf...)
+ }
+ za.Write(xBuf)
+ za.Write(yBuf)
+ return za.Sum(nil)[:32], nil
+}
+
+// 32byte
+func zeroByteSlice() []byte {
+ return []byte{
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ }
+}
+
+/*
+sm2加密,返回asn.1编码格式的密文内容
+*/
+func EncryptAsn1(pub *PublicKey, data []byte, rand io.Reader) ([]byte, error) {
+ cipher, err := Encrypt(pub, data, rand,C1C3C2)
+ if err != nil {
+ return nil, err
+ }
+ return CipherMarshal(cipher)
+}
+
+/*
+sm2解密,解析asn.1编码格式的密文内容
+*/
+func DecryptAsn1(pub *PrivateKey, data []byte) ([]byte, error) {
+ cipher, err := CipherUnmarshal(data)
+ if err != nil {
+ return nil, err
+ }
+ return Decrypt(pub, cipher,C1C3C2)
+}
+
+/*
+*sm2密文转asn.1编码格式
+*sm2密文结构如下:
+* x
+* y
+* hash
+* CipherText
+ */
+func CipherMarshal(data []byte) ([]byte, error) {
+ data = data[1:]
+ x := new(big.Int).SetBytes(data[:32])
+ y := new(big.Int).SetBytes(data[32:64])
+ hash := data[64:96]
+ cipherText := data[96:]
+ return asn1.Marshal(sm2Cipher{x, y, hash, cipherText})
+}
+
+/*
+sm2密文asn.1编码格式转C1|C3|C2拼接格式
+*/
+func CipherUnmarshal(data []byte) ([]byte, error) {
+ var cipher sm2Cipher
+ _, err := asn1.Unmarshal(data, &cipher)
+ if err != nil {
+ return nil, err
+ }
+ x := cipher.XCoordinate.Bytes()
+ y := cipher.YCoordinate.Bytes()
+ hash := cipher.HASH
+ if err != nil {
+ return nil, err
+ }
+ cipherText := cipher.CipherText
+ if err != nil {
+ return nil, err
+ }
+ if n := len(x); n < 32 {
+ x = append(zeroByteSlice()[:32-n], x...)
+ }
+ if n := len(y); n < 32 {
+ y = append(zeroByteSlice()[:32-n], y...)
+ }
+ c := []byte{}
+ c = append(c, x...) // x分量
+ c = append(c, y...) // y分
+ c = append(c, hash...) // x分量
+ c = append(c, cipherText...) // y分
+ return append([]byte{0x04}, c...), nil
+}
+
+// keXHat 计算 x = 2^w + (x & (2^w-1))
+// 密钥协商算法辅助函数
+func keXHat(x *big.Int) (xul *big.Int) {
+ buf := x.Bytes()
+ for i := 0; i < len(buf)-16; i++ {
+ buf[i] = 0
+ }
+ if len(buf) >= 16 {
+ c := buf[len(buf)-16]
+ buf[len(buf)-16] = c & 0x7f
+ }
+
+ r := new(big.Int).SetBytes(buf)
+ _2w := new(big.Int).SetBytes([]byte{
+ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})
+ return r.Add(r, _2w)
+}
+
+func BytesCombine(pBytes ...[]byte) []byte {
+ len := len(pBytes)
+ s := make([][]byte, len)
+ for index := 0; index < len; index++ {
+ s[index] = pBytes[index]
+ }
+ sep := []byte("")
+ return bytes.Join(s, sep)
+}
+
+func intToBytes(x int) []byte {
+ var buf = make([]byte, 4)
+
+ binary.BigEndian.PutUint32(buf, uint32(x))
+ return buf
+}
+
+func kdf(length int, x ...[]byte) ([]byte, bool) {
+ var c []byte
+
+ ct := 1
+ h := sm3.New()
+ for i, j := 0, (length+31)/32; i < j; i++ {
+ h.Reset()
+ for _, xx := range x {
+ h.Write(xx)
+ }
+ h.Write(intToBytes(ct))
+ hash := h.Sum(nil)
+ if i+1 == j && length%32 != 0 {
+ c = append(c, hash[:length%32]...)
+ } else {
+ c = append(c, hash...)
+ }
+ ct++
+ }
+ for i := 0; i < length; i++ {
+ if c[i] != 0 {
+ return c, true
+ }
+ }
+ return c, false
+}
+
+func randFieldElement(c elliptic.Curve, random io.Reader) (k *big.Int, err error) {
+ if random == nil {
+ random = rand.Reader //If there is no external trusted random source,please use rand.Reader to instead of it.
+ }
+ params := c.Params()
+ b := make([]byte, params.BitSize/8+8)
+ _, err = io.ReadFull(random, b)
+ if err != nil {
+ return
+ }
+ k = new(big.Int).SetBytes(b)
+ n := new(big.Int).Sub(params.N, one)
+ k.Mod(k, n)
+ k.Add(k, one)
+ return
+}
+
+func GenerateKey(random io.Reader) (*PrivateKey, error) {
+ c := P256Sm2()
+ if random == nil {
+ random = rand.Reader //If there is no external trusted random source,please use rand.Reader to instead of it.
+ }
+ params := c.Params()
+ b := make([]byte, params.BitSize/8+8)
+ _, err := io.ReadFull(random, b)
+ if err != nil {
+ return nil, err
+ }
+
+ k := new(big.Int).SetBytes(b)
+ n := new(big.Int).Sub(params.N, two)
+ k.Mod(k, n)
+ k.Add(k, one)
+ priv := new(PrivateKey)
+ priv.PublicKey.Curve = c
+ priv.D = k
+ priv.PublicKey.X, priv.PublicKey.Y = c.ScalarBaseMult(k.Bytes())
+
+ return priv, nil
+}
+
+type zr struct {
+ io.Reader
+}
+
+func (z *zr) Read(dst []byte) (n int, err error) {
+ for i := range dst {
+ dst[i] = 0
+ }
+ return len(dst), nil
+}
+
+var zeroReader = &zr{}
+
+func getLastBit(a *big.Int) uint {
+ return a.Bit(0)
+}
+
+// crypto.Decrypter
+func (priv *PrivateKey) Decrypt(_ io.Reader, msg []byte, _ crypto.DecrypterOpts) (plaintext []byte, err error) {
+ return Decrypt(priv, msg,C1C3C2)
+}
diff --git a/vendor/github.com/tjfoc/gmsm/sm2/utils.go b/vendor/github.com/tjfoc/gmsm/sm2/utils.go
new file mode 100644
index 0000000000..03d92270ba
--- /dev/null
+++ b/vendor/github.com/tjfoc/gmsm/sm2/utils.go
@@ -0,0 +1,59 @@
+package sm2
+
+import (
+ "encoding/asn1"
+ "math/big"
+)
+
+func Decompress(a []byte) *PublicKey {
+ var aa, xx, xx3 sm2P256FieldElement
+
+ P256Sm2()
+ x := new(big.Int).SetBytes(a[1:])
+ curve := sm2P256
+ sm2P256FromBig(&xx, x)
+ sm2P256Square(&xx3, &xx) // x3 = x ^ 2
+ sm2P256Mul(&xx3, &xx3, &xx) // x3 = x ^ 2 * x
+ sm2P256Mul(&aa, &curve.a, &xx) // a = a * x
+ sm2P256Add(&xx3, &xx3, &aa)
+ sm2P256Add(&xx3, &xx3, &curve.b)
+
+ y2 := sm2P256ToBig(&xx3)
+ y := new(big.Int).ModSqrt(y2, sm2P256.P)
+ if getLastBit(y)!= uint(a[0]) {
+ y.Sub(sm2P256.P, y)
+ }
+ return &PublicKey{
+ Curve: P256Sm2(),
+ X: x,
+ Y: y,
+ }
+}
+
+func Compress(a *PublicKey) []byte {
+ buf := []byte{}
+ yp := getLastBit(a.Y)
+ buf = append(buf, a.X.Bytes()...)
+ if n := len(a.X.Bytes()); n < 32 {
+ buf = append(zeroByteSlice()[:(32-n)], buf...)
+ }
+ buf = append([]byte{byte(yp)}, buf...)
+ return buf
+}
+
+
+
+func SignDigitToSignData(r, s *big.Int) ([]byte, error) {
+ return asn1.Marshal(sm2Signature{r, s})
+}
+
+func SignDataToSignDigit(sign []byte) (*big.Int, *big.Int, error) {
+ var sm2Sign sm2Signature
+
+ _, err := asn1.Unmarshal(sign, &sm2Sign)
+ if err != nil {
+ return nil, nil, err
+ }
+ return sm2Sign.R, sm2Sign.S, nil
+}
+
diff --git a/vendor/github.com/tjfoc/gmsm/sm3/ifile b/vendor/github.com/tjfoc/gmsm/sm3/ifile
new file mode 100644
index 0000000000..30d74d2584
--- /dev/null
+++ b/vendor/github.com/tjfoc/gmsm/sm3/ifile
@@ -0,0 +1 @@
+test
\ No newline at end of file
diff --git a/vendor/github.com/tjfoc/gmsm/sm3/sm3.go b/vendor/github.com/tjfoc/gmsm/sm3/sm3.go
index 1a610b9932..7c6094cdad 100644
--- a/vendor/github.com/tjfoc/gmsm/sm3/sm3.go
+++ b/vendor/github.com/tjfoc/gmsm/sm3/sm3.go
@@ -38,7 +38,7 @@ func (sm3 *SM3) p0(x uint32) uint32 { return x ^ sm3.leftRotate(x, 9) ^ sm3.left
func (sm3 *SM3) p1(x uint32) uint32 { return x ^ sm3.leftRotate(x, 15) ^ sm3.leftRotate(x, 23) }
-func (sm3 *SM3) leftRotate(x uint32, i uint32) uint32 { return (x<<(i%32) | x>>(32-i%32)) }
+func (sm3 *SM3) leftRotate(x uint32, i uint32) uint32 { return x<<(i%32) | x>>(32-i%32) }
func (sm3 *SM3) pad() []byte {
msg := sm3.unhandleMsg
@@ -63,7 +63,7 @@ func (sm3 *SM3) pad() []byte {
return msg
}
-func (sm3 *SM3) update(msg []byte, nblocks int) {
+func (sm3 *SM3) update(msg []byte) {
var w [68]uint32
var w1 [64]uint32
@@ -119,7 +119,7 @@ func (sm3 *SM3) update(msg []byte, nblocks int) {
}
sm3.digest[0], sm3.digest[1], sm3.digest[2], sm3.digest[3], sm3.digest[4], sm3.digest[5], sm3.digest[6], sm3.digest[7] = a, b, c, d, e, f, g, h
}
-func (sm3 *SM3) update2(msg []byte, nblocks int)([8]uint32){
+func (sm3 *SM3) update2(msg []byte,) [8]uint32 {
var w [68]uint32
var w1 [64]uint32
@@ -175,8 +175,10 @@ func (sm3 *SM3) update2(msg []byte, nblocks int)([8]uint32){
}
var digest [8]uint32
digest[0], digest[1], digest[2], digest[3], digest[4], digest[5], digest[6], digest[7] = a, b, c, d, e, f, g, h
- return digest
+ return digest
}
+
+// 创建哈希计算实例
func New() hash.Hash {
var sm3 SM3
@@ -184,14 +186,12 @@ func New() hash.Hash {
return &sm3
}
-// BlockSize, required by the hash.Hash interface.
// BlockSize returns the hash's underlying block size.
// The Write method must be able to accept any amount
// of data, but it may operate more efficiently if all writes
// are a multiple of the block size.
func (sm3 *SM3) BlockSize() int { return 64 }
-// Size, required by the hash.Hash interface.
// Size returns the number of bytes Sum will return.
func (sm3 *SM3) Size() int { return 32 }
@@ -212,7 +212,6 @@ func (sm3 *SM3) Reset() {
sm3.unhandleMsg = []byte{}
}
-// Write, required by the hash.Hash interface.
// Write (via the embedded io.Writer interface) adds more data to the running hash.
// It never returns an error.
func (sm3 *SM3) Write(p []byte) (int, error) {
@@ -220,21 +219,21 @@ func (sm3 *SM3) Write(p []byte) (int, error) {
sm3.length += uint64(len(p) * 8)
msg := append(sm3.unhandleMsg, p...)
nblocks := len(msg) / sm3.BlockSize()
- sm3.update(msg, nblocks)
+ sm3.update(msg)
// Update unhandleMsg
sm3.unhandleMsg = msg[nblocks*sm3.BlockSize():]
return toWrite, nil
}
-// Sum, required by the hash.Hash interface.
+// 返回SM3哈希算法摘要值
// Sum appends the current hash to b and returns the resulting slice.
// It does not change the underlying hash state.
func (sm3 *SM3) Sum(in []byte) []byte {
- sm3.Write(in)
+ _, _ = sm3.Write(in)
msg := sm3.pad()
- //Finialize
- digest:=sm3.update2(msg, len(msg)/sm3.BlockSize())
+ //Finalize
+ digest := sm3.update2(msg)
// save hash to in
needed := sm3.Size()
@@ -255,6 +254,6 @@ func Sm3Sum(data []byte) []byte {
var sm3 SM3
sm3.Reset()
- sm3.Write(data)
+ _, _ = sm3.Write(data)
return sm3.Sum(nil)
}
diff --git a/vendor/github.com/valyala/fasttemplate/template.go b/vendor/github.com/valyala/fasttemplate/template.go
index 186200134d..f2d3261f8b 100644
--- a/vendor/github.com/valyala/fasttemplate/template.go
+++ b/vendor/github.com/valyala/fasttemplate/template.go
@@ -112,8 +112,7 @@ func ExecuteFuncString(template, startTag, endTag string, f TagFunc) string {
// but when f returns an error, ExecuteFuncStringWithErr won't panic like ExecuteFuncString
// it just returns an empty string and the error f returned
func ExecuteFuncStringWithErr(template, startTag, endTag string, f TagFunc) (string, error) {
- tagsCount := bytes.Count(unsafeString2Bytes(template), unsafeString2Bytes(startTag))
- if tagsCount == 0 {
+ if n := bytes.Index(unsafeString2Bytes(template), unsafeString2Bytes(startTag)); n < 0 {
return template, nil
}
diff --git a/vendor/github.com/vektah/gqlparser/v2/.gitignore b/vendor/github.com/vektah/gqlparser/v2/.gitignore
deleted file mode 100644
index 877392a763..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/vendor
-/validator/imported/node_modules
-/validator/imported/graphql-js
-
-.idea/
diff --git a/vendor/github.com/vektah/gqlparser/v2/LICENSE b/vendor/github.com/vektah/gqlparser/v2/LICENSE
deleted file mode 100644
index 1221b9d389..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2018 Adam Scarr
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file
diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/argmap.go b/vendor/github.com/vektah/gqlparser/v2/ast/argmap.go
deleted file mode 100644
index 43f6a3d6fc..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/ast/argmap.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package ast
-
-func arg2map(defs ArgumentDefinitionList, args ArgumentList, vars map[string]interface{}) map[string]interface{} {
- result := map[string]interface{}{}
- var err error
-
- for _, argDef := range defs {
- var val interface{}
- var hasValue bool
-
- if argValue := args.ForName(argDef.Name); argValue != nil {
- if argValue.Value.Kind == Variable {
- val, hasValue = vars[argValue.Value.Raw]
- } else {
- val, err = argValue.Value.Value(vars)
- if err != nil {
- panic(err)
- }
- hasValue = true
- }
- }
-
- if !hasValue && argDef.DefaultValue != nil {
- val, err = argDef.DefaultValue.Value(vars)
- if err != nil {
- panic(err)
- }
- hasValue = true
- }
-
- if hasValue {
- result[argDef.Name] = val
- }
- }
-
- return result
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/collections.go b/vendor/github.com/vektah/gqlparser/v2/ast/collections.go
deleted file mode 100644
index 94b800ee26..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/ast/collections.go
+++ /dev/null
@@ -1,148 +0,0 @@
-package ast
-
-type FieldList []*FieldDefinition
-
-func (l FieldList) ForName(name string) *FieldDefinition {
- for _, it := range l {
- if it.Name == name {
- return it
- }
- }
- return nil
-}
-
-type EnumValueList []*EnumValueDefinition
-
-func (l EnumValueList) ForName(name string) *EnumValueDefinition {
- for _, it := range l {
- if it.Name == name {
- return it
- }
- }
- return nil
-}
-
-type DirectiveList []*Directive
-
-func (l DirectiveList) ForName(name string) *Directive {
- for _, it := range l {
- if it.Name == name {
- return it
- }
- }
- return nil
-}
-
-func (l DirectiveList) ForNames(name string) []*Directive {
- resp := []*Directive{}
- for _, it := range l {
- if it.Name == name {
- resp = append(resp, it)
- }
- }
- return resp
-}
-
-type OperationList []*OperationDefinition
-
-func (l OperationList) ForName(name string) *OperationDefinition {
- if name == "" && len(l) == 1 {
- return l[0]
- }
- for _, it := range l {
- if it.Name == name {
- return it
- }
- }
- return nil
-}
-
-type FragmentDefinitionList []*FragmentDefinition
-
-func (l FragmentDefinitionList) ForName(name string) *FragmentDefinition {
- for _, it := range l {
- if it.Name == name {
- return it
- }
- }
- return nil
-}
-
-type VariableDefinitionList []*VariableDefinition
-
-func (l VariableDefinitionList) ForName(name string) *VariableDefinition {
- for _, it := range l {
- if it.Variable == name {
- return it
- }
- }
- return nil
-}
-
-type ArgumentList []*Argument
-
-func (l ArgumentList) ForName(name string) *Argument {
- for _, it := range l {
- if it.Name == name {
- return it
- }
- }
- return nil
-}
-
-type ArgumentDefinitionList []*ArgumentDefinition
-
-func (l ArgumentDefinitionList) ForName(name string) *ArgumentDefinition {
- for _, it := range l {
- if it.Name == name {
- return it
- }
- }
- return nil
-}
-
-type SchemaDefinitionList []*SchemaDefinition
-
-type DirectiveDefinitionList []*DirectiveDefinition
-
-func (l DirectiveDefinitionList) ForName(name string) *DirectiveDefinition {
- for _, it := range l {
- if it.Name == name {
- return it
- }
- }
- return nil
-}
-
-type DefinitionList []*Definition
-
-func (l DefinitionList) ForName(name string) *Definition {
- for _, it := range l {
- if it.Name == name {
- return it
- }
- }
- return nil
-}
-
-type OperationTypeDefinitionList []*OperationTypeDefinition
-
-func (l OperationTypeDefinitionList) ForType(name string) *OperationTypeDefinition {
- for _, it := range l {
- if it.Type == name {
- return it
- }
- }
- return nil
-}
-
-type ChildValueList []*ChildValue
-
-func (v ChildValueList) ForName(name string) *Value {
- for _, f := range v {
- if f.Name == name {
- return f.Value
- }
- }
- return nil
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/decode.go b/vendor/github.com/vektah/gqlparser/v2/ast/decode.go
deleted file mode 100644
index d00920554c..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/ast/decode.go
+++ /dev/null
@@ -1,216 +0,0 @@
-package ast
-
-import (
- "encoding/json"
-)
-
-func UnmarshalSelectionSet(b []byte) (SelectionSet, error) {
- var tmp []json.RawMessage
-
- if err := json.Unmarshal(b, &tmp); err != nil {
- return nil, err
- }
-
- var result = make([]Selection, 0)
- for _, item := range tmp {
- var field Field
- if err := json.Unmarshal(item, &field); err == nil {
- result = append(result, &field)
- continue
- }
- var fragmentSpread FragmentSpread
- if err := json.Unmarshal(item, &fragmentSpread); err == nil {
- result = append(result, &fragmentSpread)
- continue
- }
- var inlineFragment InlineFragment
- if err := json.Unmarshal(item, &inlineFragment); err == nil {
- result = append(result, &inlineFragment)
- continue
- }
- }
-
- return result, nil
-}
-
-func (f *FragmentDefinition) UnmarshalJSON(b []byte) error {
- var tmp map[string]json.RawMessage
- if err := json.Unmarshal(b, &tmp); err != nil {
- return err
- }
- for k := range tmp {
- switch k {
- case "Name":
- err := json.Unmarshal(tmp[k], &f.Name)
- if err != nil {
- return err
- }
- case "VariableDefinition":
- err := json.Unmarshal(tmp[k], &f.VariableDefinition)
- if err != nil {
- return err
- }
- case "TypeCondition":
- err := json.Unmarshal(tmp[k], &f.TypeCondition)
- if err != nil {
- return err
- }
- case "Directives":
- err := json.Unmarshal(tmp[k], &f.Directives)
- if err != nil {
- return err
- }
- case "SelectionSet":
- ss, err := UnmarshalSelectionSet(tmp[k])
- if err != nil {
- return err
- }
- f.SelectionSet = ss
- case "Definition":
- err := json.Unmarshal(tmp[k], &f.Definition)
- if err != nil {
- return err
- }
- case "Position":
- err := json.Unmarshal(tmp[k], &f.Position)
- if err != nil {
- return err
- }
- }
- }
- return nil
-}
-
-func (f *InlineFragment) UnmarshalJSON(b []byte) error {
- var tmp map[string]json.RawMessage
- if err := json.Unmarshal(b, &tmp); err != nil {
- return err
- }
- for k := range tmp {
- switch k {
- case "TypeCondition":
- err := json.Unmarshal(tmp[k], &f.TypeCondition)
- if err != nil {
- return err
- }
- case "Directives":
- err := json.Unmarshal(tmp[k], &f.Directives)
- if err != nil {
- return err
- }
- case "SelectionSet":
- ss, err := UnmarshalSelectionSet(tmp[k])
- if err != nil {
- return err
- }
- f.SelectionSet = ss
- case "ObjectDefinition":
- err := json.Unmarshal(tmp[k], &f.ObjectDefinition)
- if err != nil {
- return err
- }
- case "Position":
- err := json.Unmarshal(tmp[k], &f.Position)
- if err != nil {
- return err
- }
- }
- }
- return nil
-}
-
-func (f *OperationDefinition) UnmarshalJSON(b []byte) error {
- var tmp map[string]json.RawMessage
- if err := json.Unmarshal(b, &tmp); err != nil {
- return err
- }
- for k := range tmp {
- switch k {
- case "Operation":
- err := json.Unmarshal(tmp[k], &f.Operation)
- if err != nil {
- return err
- }
- case "Name":
- err := json.Unmarshal(tmp[k], &f.Name)
- if err != nil {
- return err
- }
- case "VariableDefinitions":
- err := json.Unmarshal(tmp[k], &f.VariableDefinitions)
- if err != nil {
- return err
- }
- case "Directives":
- err := json.Unmarshal(tmp[k], &f.Directives)
- if err != nil {
- return err
- }
- case "SelectionSet":
- ss, err := UnmarshalSelectionSet(tmp[k])
- if err != nil {
- return err
- }
- f.SelectionSet = ss
- case "Position":
- err := json.Unmarshal(tmp[k], &f.Position)
- if err != nil {
- return err
- }
- }
- }
- return nil
-}
-
-func (f *Field) UnmarshalJSON(b []byte) error {
- var tmp map[string]json.RawMessage
- if err := json.Unmarshal(b, &tmp); err != nil {
- return err
- }
- for k := range tmp {
- switch k {
- case "Alias":
- err := json.Unmarshal(tmp[k], &f.Alias)
- if err != nil {
- return err
- }
- case "Name":
- err := json.Unmarshal(tmp[k], &f.Name)
- if err != nil {
- return err
- }
- case "Arguments":
- err := json.Unmarshal(tmp[k], &f.Arguments)
- if err != nil {
- return err
- }
- case "Directives":
- err := json.Unmarshal(tmp[k], &f.Directives)
- if err != nil {
- return err
- }
- case "SelectionSet":
- ss, err := UnmarshalSelectionSet(tmp[k])
- if err != nil {
- return err
- }
- f.SelectionSet = ss
- case "Position":
- err := json.Unmarshal(tmp[k], &f.Position)
- if err != nil {
- return err
- }
- case "Definition":
- err := json.Unmarshal(tmp[k], &f.Definition)
- if err != nil {
- return err
- }
- case "ObjectDefinition":
- err := json.Unmarshal(tmp[k], &f.ObjectDefinition)
- if err != nil {
- return err
- }
- }
- }
- return nil
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/definition.go b/vendor/github.com/vektah/gqlparser/v2/ast/definition.go
deleted file mode 100644
index d203908168..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/ast/definition.go
+++ /dev/null
@@ -1,94 +0,0 @@
-package ast
-
-type DefinitionKind string
-
-const (
- Scalar DefinitionKind = "SCALAR"
- Object DefinitionKind = "OBJECT"
- Interface DefinitionKind = "INTERFACE"
- Union DefinitionKind = "UNION"
- Enum DefinitionKind = "ENUM"
- InputObject DefinitionKind = "INPUT_OBJECT"
-)
-
-// Definition is the core type definition object, it includes all of the definable types
-// but does *not* cover schema or directives.
-//
-// @vektah: Javascript implementation has different types for all of these, but they are
-// more similar than different and don't define any behaviour. I think this style of
-// "some hot" struct works better, at least for go.
-//
-// Type extensions are also represented by this same struct.
-type Definition struct {
- Kind DefinitionKind
- Description string
- Name string
- Directives DirectiveList
- Interfaces []string // object and input object
- Fields FieldList // object and input object
- Types []string // union
- EnumValues EnumValueList // enum
-
- Position *Position `dump:"-"`
- BuiltIn bool `dump:"-"`
-}
-
-func (d *Definition) IsLeafType() bool {
- return d.Kind == Enum || d.Kind == Scalar
-}
-
-func (d *Definition) IsAbstractType() bool {
- return d.Kind == Interface || d.Kind == Union
-}
-
-func (d *Definition) IsCompositeType() bool {
- return d.Kind == Object || d.Kind == Interface || d.Kind == Union
-}
-
-func (d *Definition) IsInputType() bool {
- return d.Kind == Scalar || d.Kind == Enum || d.Kind == InputObject
-}
-
-func (d *Definition) OneOf(types ...string) bool {
- for _, t := range types {
- if d.Name == t {
- return true
- }
- }
- return false
-}
-
-type FieldDefinition struct {
- Description string
- Name string
- Arguments ArgumentDefinitionList // only for objects
- DefaultValue *Value // only for input objects
- Type *Type
- Directives DirectiveList
- Position *Position `dump:"-"`
-}
-
-type ArgumentDefinition struct {
- Description string
- Name string
- DefaultValue *Value
- Type *Type
- Directives DirectiveList
- Position *Position `dump:"-"`
-}
-
-type EnumValueDefinition struct {
- Description string
- Name string
- Directives DirectiveList
- Position *Position `dump:"-"`
-}
-
-type DirectiveDefinition struct {
- Description string
- Name string
- Arguments ArgumentDefinitionList
- Locations []DirectiveLocation
- IsRepeatable bool
- Position *Position `dump:"-"`
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/directive.go b/vendor/github.com/vektah/gqlparser/v2/ast/directive.go
deleted file mode 100644
index 5f6e8531f5..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/ast/directive.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package ast
-
-type DirectiveLocation string
-
-const (
- // Executable
- LocationQuery DirectiveLocation = `QUERY`
- LocationMutation DirectiveLocation = `MUTATION`
- LocationSubscription DirectiveLocation = `SUBSCRIPTION`
- LocationField DirectiveLocation = `FIELD`
- LocationFragmentDefinition DirectiveLocation = `FRAGMENT_DEFINITION`
- LocationFragmentSpread DirectiveLocation = `FRAGMENT_SPREAD`
- LocationInlineFragment DirectiveLocation = `INLINE_FRAGMENT`
-
- // Type System
- LocationSchema DirectiveLocation = `SCHEMA`
- LocationScalar DirectiveLocation = `SCALAR`
- LocationObject DirectiveLocation = `OBJECT`
- LocationFieldDefinition DirectiveLocation = `FIELD_DEFINITION`
- LocationArgumentDefinition DirectiveLocation = `ARGUMENT_DEFINITION`
- LocationInterface DirectiveLocation = `INTERFACE`
- LocationUnion DirectiveLocation = `UNION`
- LocationEnum DirectiveLocation = `ENUM`
- LocationEnumValue DirectiveLocation = `ENUM_VALUE`
- LocationInputObject DirectiveLocation = `INPUT_OBJECT`
- LocationInputFieldDefinition DirectiveLocation = `INPUT_FIELD_DEFINITION`
- LocationVariableDefinition DirectiveLocation = `VARIABLE_DEFINITION`
-)
-
-type Directive struct {
- Name string
- Arguments ArgumentList
- Position *Position `dump:"-"`
-
- // Requires validation
- ParentDefinition *Definition
- Definition *DirectiveDefinition
- Location DirectiveLocation
-}
-
-func (d *Directive) ArgumentMap(vars map[string]interface{}) map[string]interface{} {
- return arg2map(d.Definition.Arguments, d.Arguments, vars)
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/document.go b/vendor/github.com/vektah/gqlparser/v2/ast/document.go
deleted file mode 100644
index 43bfb54ff5..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/ast/document.go
+++ /dev/null
@@ -1,79 +0,0 @@
-package ast
-
-type QueryDocument struct {
- Operations OperationList
- Fragments FragmentDefinitionList
- Position *Position `dump:"-"`
-}
-
-type SchemaDocument struct {
- Schema SchemaDefinitionList
- SchemaExtension SchemaDefinitionList
- Directives DirectiveDefinitionList
- Definitions DefinitionList
- Extensions DefinitionList
- Position *Position `dump:"-"`
-}
-
-func (d *SchemaDocument) Merge(other *SchemaDocument) {
- d.Schema = append(d.Schema, other.Schema...)
- d.SchemaExtension = append(d.SchemaExtension, other.SchemaExtension...)
- d.Directives = append(d.Directives, other.Directives...)
- d.Definitions = append(d.Definitions, other.Definitions...)
- d.Extensions = append(d.Extensions, other.Extensions...)
-}
-
-type Schema struct {
- Query *Definition
- Mutation *Definition
- Subscription *Definition
-
- Types map[string]*Definition
- Directives map[string]*DirectiveDefinition
-
- PossibleTypes map[string][]*Definition
- Implements map[string][]*Definition
-
- Description string
-}
-
-// AddTypes is the helper to add types definition to the schema
-func (s *Schema) AddTypes(defs ...*Definition) {
- if s.Types == nil {
- s.Types = make(map[string]*Definition)
- }
- for _, def := range defs {
- s.Types[def.Name] = def
- }
-}
-
-func (s *Schema) AddPossibleType(name string, def *Definition) {
- s.PossibleTypes[name] = append(s.PossibleTypes[name], def)
-}
-
-// GetPossibleTypes will enumerate all the definitions for a given interface or union
-func (s *Schema) GetPossibleTypes(def *Definition) []*Definition {
- return s.PossibleTypes[def.Name]
-}
-
-func (s *Schema) AddImplements(name string, iface *Definition) {
- s.Implements[name] = append(s.Implements[name], iface)
-}
-
-// GetImplements returns all the interface and union definitions that the given definition satisfies
-func (s *Schema) GetImplements(def *Definition) []*Definition {
- return s.Implements[def.Name]
-}
-
-type SchemaDefinition struct {
- Description string
- Directives DirectiveList
- OperationTypes OperationTypeDefinitionList
- Position *Position `dump:"-"`
-}
-
-type OperationTypeDefinition struct {
- Operation Operation
- Type string
- Position *Position `dump:"-"`
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/dumper.go b/vendor/github.com/vektah/gqlparser/v2/ast/dumper.go
deleted file mode 100644
index dbb7a7efaf..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/ast/dumper.go
+++ /dev/null
@@ -1,159 +0,0 @@
-package ast
-
-import (
- "bytes"
- "fmt"
- "reflect"
- "strconv"
- "strings"
-)
-
-// Dump turns ast into a stable string format for assertions in tests
-func Dump(i interface{}) string {
- v := reflect.ValueOf(i)
-
- d := dumper{Buffer: &bytes.Buffer{}}
- d.dump(v)
-
- return d.String()
-}
-
-type dumper struct {
- *bytes.Buffer
- indent int
-}
-
-type Dumpable interface {
- Dump() string
-}
-
-func (d *dumper) dump(v reflect.Value) {
- if dumpable, isDumpable := v.Interface().(Dumpable); isDumpable {
- d.WriteString(dumpable.Dump())
- return
- }
- switch v.Kind() {
- case reflect.Bool:
- if v.Bool() {
- d.WriteString("true")
- } else {
- d.WriteString("false")
- }
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- d.WriteString(fmt.Sprintf("%d", v.Int()))
-
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
- d.WriteString(fmt.Sprintf("%d", v.Uint()))
-
- case reflect.Float32, reflect.Float64:
- d.WriteString(fmt.Sprintf("%.2f", v.Float()))
-
- case reflect.String:
- if v.Type().Name() != "string" {
- d.WriteString(v.Type().Name() + "(" + strconv.Quote(v.String()) + ")")
- } else {
- d.WriteString(strconv.Quote(v.String()))
- }
-
- case reflect.Array, reflect.Slice:
- d.dumpArray(v)
-
- case reflect.Interface, reflect.Ptr:
- d.dumpPtr(v)
-
- case reflect.Struct:
- d.dumpStruct(v)
-
- default:
- panic(fmt.Errorf("unsupported kind: %s\n buf: %s", v.Kind().String(), d.String()))
- }
-}
-
-func (d *dumper) writeIndent() {
- d.Buffer.WriteString(strings.Repeat(" ", d.indent))
-}
-
-func (d *dumper) nl() {
- d.Buffer.WriteByte('\n')
- d.writeIndent()
-}
-
-func typeName(t reflect.Type) string {
- if t.Kind() == reflect.Ptr {
- return typeName(t.Elem())
- }
- return t.Name()
-}
-
-func (d *dumper) dumpArray(v reflect.Value) {
- d.WriteString("[" + typeName(v.Type().Elem()) + "]")
-
- for i := 0; i < v.Len(); i++ {
- d.nl()
- d.WriteString("- ")
- d.indent++
- d.dump(v.Index(i))
- d.indent--
- }
-}
-
-func (d *dumper) dumpStruct(v reflect.Value) {
- d.WriteString("<" + v.Type().Name() + ">")
- d.indent++
-
- typ := v.Type()
- for i := 0; i < v.NumField(); i++ {
- f := v.Field(i)
- if typ.Field(i).Tag.Get("dump") == "-" {
- continue
- }
-
- if isZero(f) {
- continue
- }
- d.nl()
- d.WriteString(typ.Field(i).Name)
- d.WriteString(": ")
- d.dump(v.Field(i))
- }
-
- d.indent--
-}
-
-func isZero(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Ptr, reflect.Interface:
- return v.IsNil()
- case reflect.Func, reflect.Map:
- return v.IsNil()
-
- case reflect.Array, reflect.Slice:
- if v.IsNil() {
- return true
- }
- z := true
- for i := 0; i < v.Len(); i++ {
- z = z && isZero(v.Index(i))
- }
- return z
- case reflect.Struct:
- z := true
- for i := 0; i < v.NumField(); i++ {
- z = z && isZero(v.Field(i))
- }
- return z
- case reflect.String:
- return v.String() == ""
- }
-
- // Compare other types directly:
- return reflect.DeepEqual(v.Interface(), reflect.Zero(v.Type()))
-}
-
-func (d *dumper) dumpPtr(v reflect.Value) {
- if v.IsNil() {
- d.WriteString("nil")
- return
- }
- d.dump(v.Elem())
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/fragment.go b/vendor/github.com/vektah/gqlparser/v2/ast/fragment.go
deleted file mode 100644
index 57ab56c7c6..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/ast/fragment.go
+++ /dev/null
@@ -1,38 +0,0 @@
-package ast
-
-type FragmentSpread struct {
- Name string
- Directives DirectiveList
-
- // Require validation
- ObjectDefinition *Definition
- Definition *FragmentDefinition
-
- Position *Position `dump:"-"`
-}
-
-type InlineFragment struct {
- TypeCondition string
- Directives DirectiveList
- SelectionSet SelectionSet
-
- // Require validation
- ObjectDefinition *Definition
-
- Position *Position `dump:"-"`
-}
-
-type FragmentDefinition struct {
- Name string
- // Note: fragment variable definitions are experimental and may be changed
- // or removed in the future.
- VariableDefinition VariableDefinitionList
- TypeCondition string
- Directives DirectiveList
- SelectionSet SelectionSet
-
- // Require validation
- Definition *Definition
-
- Position *Position `dump:"-"`
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/operation.go b/vendor/github.com/vektah/gqlparser/v2/ast/operation.go
deleted file mode 100644
index 3b37f81bf3..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/ast/operation.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package ast
-
-type Operation string
-
-const (
- Query Operation = "query"
- Mutation Operation = "mutation"
- Subscription Operation = "subscription"
-)
-
-type OperationDefinition struct {
- Operation Operation
- Name string
- VariableDefinitions VariableDefinitionList
- Directives DirectiveList
- SelectionSet SelectionSet
- Position *Position `dump:"-"`
-}
-
-type VariableDefinition struct {
- Variable string
- Type *Type
- DefaultValue *Value
- Directives DirectiveList
- Position *Position `dump:"-"`
-
- // Requires validation
- Definition *Definition
- Used bool `dump:"-"`
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/path.go b/vendor/github.com/vektah/gqlparser/v2/ast/path.go
deleted file mode 100644
index 9af1684388..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/ast/path.go
+++ /dev/null
@@ -1,67 +0,0 @@
-package ast
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
-)
-
-var _ json.Unmarshaler = (*Path)(nil)
-
-type Path []PathElement
-
-type PathElement interface {
- isPathElement()
-}
-
-var _ PathElement = PathIndex(0)
-var _ PathElement = PathName("")
-
-func (path Path) String() string {
- var str bytes.Buffer
- for i, v := range path {
- switch v := v.(type) {
- case PathIndex:
- str.WriteString(fmt.Sprintf("[%d]", v))
- case PathName:
- if i != 0 {
- str.WriteByte('.')
- }
- str.WriteString(string(v))
- default:
- panic(fmt.Sprintf("unknown type: %T", v))
- }
- }
- return str.String()
-}
-
-func (path *Path) UnmarshalJSON(b []byte) error {
- var vs []interface{}
- err := json.Unmarshal(b, &vs)
- if err != nil {
- return err
- }
-
- *path = make([]PathElement, 0, len(vs))
- for _, v := range vs {
- switch v := v.(type) {
- case string:
- *path = append(*path, PathName(v))
- case int:
- *path = append(*path, PathIndex(v))
- case float64:
- *path = append(*path, PathIndex(int(v)))
- default:
- return fmt.Errorf("unknown path element type: %T", v)
- }
- }
- return nil
-}
-
-type PathIndex int
-
-func (_ PathIndex) isPathElement() {}
-
-type PathName string
-
-func (_ PathName) isPathElement() {}
diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/selection.go b/vendor/github.com/vektah/gqlparser/v2/ast/selection.go
deleted file mode 100644
index 159db84471..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/ast/selection.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package ast
-
-type SelectionSet []Selection
-
-type Selection interface {
- isSelection()
- GetPosition() *Position
-}
-
-func (*Field) isSelection() {}
-func (*FragmentSpread) isSelection() {}
-func (*InlineFragment) isSelection() {}
-
-func (s *Field) GetPosition() *Position { return s.Position }
-func (s *FragmentSpread) GetPosition() *Position { return s.Position }
-func (s *InlineFragment) GetPosition() *Position { return s.Position }
-
-type Field struct {
- Alias string
- Name string
- Arguments ArgumentList
- Directives DirectiveList
- SelectionSet SelectionSet
- Position *Position `dump:"-"`
-
- // Require validation
- Definition *FieldDefinition
- ObjectDefinition *Definition
-}
-
-type Argument struct {
- Name string
- Value *Value
- Position *Position `dump:"-"`
-}
-
-func (f *Field) ArgumentMap(vars map[string]interface{}) map[string]interface{} {
- return arg2map(f.Definition.Arguments, f.Arguments, vars)
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/source.go b/vendor/github.com/vektah/gqlparser/v2/ast/source.go
deleted file mode 100644
index 2949f83f7b..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/ast/source.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package ast
-
-// Source covers a single *.graphql file
-type Source struct {
- // Name is the filename of the source
- Name string
- // Input is the actual contents of the source file
- Input string
- // BuiltIn indicate whether the source is a part of the specification
- BuiltIn bool
-}
-
-type Position struct {
- Start int // The starting position, in runes, of this token in the input.
- End int // The end position, in runes, of this token in the input.
- Line int // The line number at the start of this item.
- Column int // The column number at the start of this item.
- Src *Source // The source document this token belongs to
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/type.go b/vendor/github.com/vektah/gqlparser/v2/ast/type.go
deleted file mode 100644
index 9577fdb48c..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/ast/type.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package ast
-
-func NonNullNamedType(named string, pos *Position) *Type {
- return &Type{NamedType: named, NonNull: true, Position: pos}
-}
-
-func NamedType(named string, pos *Position) *Type {
- return &Type{NamedType: named, NonNull: false, Position: pos}
-}
-
-func NonNullListType(elem *Type, pos *Position) *Type {
- return &Type{Elem: elem, NonNull: true, Position: pos}
-}
-
-func ListType(elem *Type, pos *Position) *Type {
- return &Type{Elem: elem, NonNull: false, Position: pos}
-}
-
-type Type struct {
- NamedType string
- Elem *Type
- NonNull bool
- Position *Position `dump:"-"`
-}
-
-func (t *Type) Name() string {
- if t.NamedType != "" {
- return t.NamedType
- }
-
- return t.Elem.Name()
-}
-
-func (t *Type) String() string {
- nn := ""
- if t.NonNull {
- nn = "!"
- }
- if t.NamedType != "" {
- return t.NamedType + nn
- }
-
- return "[" + t.Elem.String() + "]" + nn
-}
-
-func (t *Type) IsCompatible(other *Type) bool {
- if t.NamedType != other.NamedType {
- return false
- }
-
- if t.Elem != nil && other.Elem == nil {
- return false
- }
-
- if t.Elem != nil && !t.Elem.IsCompatible(other.Elem) {
- return false
- }
-
- if other.NonNull {
- return t.NonNull
- }
-
- return true
-}
-
-func (v *Type) Dump() string {
- return v.String()
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/value.go b/vendor/github.com/vektah/gqlparser/v2/ast/value.go
deleted file mode 100644
index c25ef15059..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/ast/value.go
+++ /dev/null
@@ -1,120 +0,0 @@
-package ast
-
-import (
- "fmt"
- "strconv"
- "strings"
-)
-
-type ValueKind int
-
-const (
- Variable ValueKind = iota
- IntValue
- FloatValue
- StringValue
- BlockValue
- BooleanValue
- NullValue
- EnumValue
- ListValue
- ObjectValue
-)
-
-type Value struct {
- Raw string
- Children ChildValueList
- Kind ValueKind
- Position *Position `dump:"-"`
-
- // Require validation
- Definition *Definition
- VariableDefinition *VariableDefinition
- ExpectedType *Type
-}
-
-type ChildValue struct {
- Name string
- Value *Value
- Position *Position `dump:"-"`
-}
-
-func (v *Value) Value(vars map[string]interface{}) (interface{}, error) {
- if v == nil {
- return nil, nil
- }
- switch v.Kind {
- case Variable:
- if value, ok := vars[v.Raw]; ok {
- return value, nil
- }
- if v.VariableDefinition != nil && v.VariableDefinition.DefaultValue != nil {
- return v.VariableDefinition.DefaultValue.Value(vars)
- }
- return nil, nil
- case IntValue:
- return strconv.ParseInt(v.Raw, 10, 64)
- case FloatValue:
- return strconv.ParseFloat(v.Raw, 64)
- case StringValue, BlockValue, EnumValue:
- return v.Raw, nil
- case BooleanValue:
- return strconv.ParseBool(v.Raw)
- case NullValue:
- return nil, nil
- case ListValue:
- var val []interface{}
- for _, elem := range v.Children {
- elemVal, err := elem.Value.Value(vars)
- if err != nil {
- return val, err
- }
- val = append(val, elemVal)
- }
- return val, nil
- case ObjectValue:
- val := map[string]interface{}{}
- for _, elem := range v.Children {
- elemVal, err := elem.Value.Value(vars)
- if err != nil {
- return val, err
- }
- val[elem.Name] = elemVal
- }
- return val, nil
- default:
- panic(fmt.Errorf("unknown value kind %d", v.Kind))
- }
-}
-
-func (v *Value) String() string {
- if v == nil {
- return ""
- }
- switch v.Kind {
- case Variable:
- return "$" + v.Raw
- case IntValue, FloatValue, EnumValue, BooleanValue, NullValue:
- return v.Raw
- case StringValue, BlockValue:
- return strconv.Quote(v.Raw)
- case ListValue:
- var val []string
- for _, elem := range v.Children {
- val = append(val, elem.Value.String())
- }
- return "[" + strings.Join(val, ",") + "]"
- case ObjectValue:
- var val []string
- for _, elem := range v.Children {
- val = append(val, elem.Name+":"+elem.Value.String())
- }
- return "{" + strings.Join(val, ",") + "}"
- default:
- panic(fmt.Errorf("unknown value kind %d", v.Kind))
- }
-}
-
-func (v *Value) Dump() string {
- return v.String()
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/gqlerror/error.go b/vendor/github.com/vektah/gqlparser/v2/gqlerror/error.go
deleted file mode 100644
index 8145061a22..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/gqlerror/error.go
+++ /dev/null
@@ -1,145 +0,0 @@
-package gqlerror
-
-import (
- "bytes"
- "errors"
- "fmt"
- "strconv"
-
- "github.com/vektah/gqlparser/v2/ast"
-)
-
-// Error is the standard graphql error type described in https://facebook.github.io/graphql/draft/#sec-Errors
-type Error struct {
- err error `json:"-"`
- Message string `json:"message"`
- Path ast.Path `json:"path,omitempty"`
- Locations []Location `json:"locations,omitempty"`
- Extensions map[string]interface{} `json:"extensions,omitempty"`
- Rule string `json:"-"`
-}
-
-func (err *Error) SetFile(file string) {
- if file == "" {
- return
- }
- if err.Extensions == nil {
- err.Extensions = map[string]interface{}{}
- }
-
- err.Extensions["file"] = file
-}
-
-type Location struct {
- Line int `json:"line,omitempty"`
- Column int `json:"column,omitempty"`
-}
-
-type List []*Error
-
-func (err *Error) Error() string {
- var res bytes.Buffer
- if err == nil {
- return ""
- }
- filename, _ := err.Extensions["file"].(string)
- if filename == "" {
- filename = "input"
- }
- res.WriteString(filename)
-
- if len(err.Locations) > 0 {
- res.WriteByte(':')
- res.WriteString(strconv.Itoa(err.Locations[0].Line))
- }
-
- res.WriteString(": ")
- if ps := err.pathString(); ps != "" {
- res.WriteString(ps)
- res.WriteByte(' ')
- }
-
- res.WriteString(err.Message)
-
- return res.String()
-}
-
-func (err Error) pathString() string {
- return err.Path.String()
-}
-
-func (err Error) Unwrap() error {
- return err.err
-}
-
-func (errs List) Error() string {
- var buf bytes.Buffer
- for _, err := range errs {
- buf.WriteString(err.Error())
- buf.WriteByte('\n')
- }
- return buf.String()
-}
-
-func (errs List) Is(target error) bool {
- for _, err := range errs {
- if errors.Is(err, target) {
- return true
- }
- }
- return false
-}
-
-func (errs List) As(target interface{}) bool {
- for _, err := range errs {
- if errors.As(err, target) {
- return true
- }
- }
- return false
-}
-
-func WrapPath(path ast.Path, err error) *Error {
- return &Error{
- err: err,
- Message: err.Error(),
- Path: path,
- }
-}
-
-func Errorf(message string, args ...interface{}) *Error {
- return &Error{
- Message: fmt.Sprintf(message, args...),
- }
-}
-
-func ErrorPathf(path ast.Path, message string, args ...interface{}) *Error {
- return &Error{
- Message: fmt.Sprintf(message, args...),
- Path: path,
- }
-}
-
-func ErrorPosf(pos *ast.Position, message string, args ...interface{}) *Error {
- return ErrorLocf(
- pos.Src.Name,
- pos.Line,
- pos.Column,
- message,
- args...,
- )
-}
-
-func ErrorLocf(file string, line int, col int, message string, args ...interface{}) *Error {
- var extensions map[string]interface{}
- if file != "" {
- extensions = map[string]interface{}{"file": file}
- }
- return &Error{
- Message: fmt.Sprintf(message, args...),
- Extensions: extensions,
- Locations: []Location{
- {Line: line, Column: col},
- },
- }
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/gqlparser.go b/vendor/github.com/vektah/gqlparser/v2/gqlparser.go
deleted file mode 100644
index e242a896b4..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/gqlparser.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package gqlparser
-
-import (
- "github.com/vektah/gqlparser/v2/ast"
- "github.com/vektah/gqlparser/v2/gqlerror"
- "github.com/vektah/gqlparser/v2/parser"
- "github.com/vektah/gqlparser/v2/validator"
- _ "github.com/vektah/gqlparser/v2/validator/rules"
-)
-
-func LoadSchema(str ...*ast.Source) (*ast.Schema, error) {
- return validator.LoadSchema(append([]*ast.Source{validator.Prelude}, str...)...)
-}
-
-func MustLoadSchema(str ...*ast.Source) *ast.Schema {
- s, err := validator.LoadSchema(append([]*ast.Source{validator.Prelude}, str...)...)
- if err != nil {
- panic(err)
- }
- return s
-}
-
-func LoadQuery(schema *ast.Schema, str string) (*ast.QueryDocument, gqlerror.List) {
- query, err := parser.ParseQuery(&ast.Source{Input: str})
- if err != nil {
- gqlErr := err.(*gqlerror.Error)
- return nil, gqlerror.List{gqlErr}
- }
- errs := validator.Validate(schema, query)
- if errs != nil {
- return nil, errs
- }
-
- return query, nil
-}
-
-func MustLoadQuery(schema *ast.Schema, str string) *ast.QueryDocument {
- q, err := LoadQuery(schema, str)
- if err != nil {
- panic(err)
- }
- return q
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/lexer/blockstring.go b/vendor/github.com/vektah/gqlparser/v2/lexer/blockstring.go
deleted file mode 100644
index 4065a610a8..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/lexer/blockstring.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package lexer
-
-import (
- "math"
- "strings"
-)
-
-// blockStringValue produces the value of a block string from its parsed raw value, similar to
-// Coffeescript's block string, Python's docstring trim or Ruby's strip_heredoc.
-//
-// This implements the GraphQL spec's BlockStringValue() static algorithm.
-func blockStringValue(raw string) string {
- lines := strings.Split(raw, "\n")
-
- commonIndent := math.MaxInt32
- for _, line := range lines {
- indent := leadingWhitespace(line)
- if indent < len(line) && indent < commonIndent {
- commonIndent = indent
- if commonIndent == 0 {
- break
- }
- }
- }
-
- if commonIndent != math.MaxInt32 && len(lines) > 0 {
- for i := 1; i < len(lines); i++ {
- if len(lines[i]) < commonIndent {
- lines[i] = ""
- } else {
- lines[i] = lines[i][commonIndent:]
- }
- }
- }
-
- start := 0
- end := len(lines)
-
- for start < end && leadingWhitespace(lines[start]) == math.MaxInt32 {
- start++
- }
-
- for start < end && leadingWhitespace(lines[end-1]) == math.MaxInt32 {
- end--
- }
-
- return strings.Join(lines[start:end], "\n")
-}
-
-func leadingWhitespace(str string) int {
- for i, r := range str {
- if r != ' ' && r != '\t' {
- return i
- }
- }
- // this line is made up entirely of whitespace, its leading whitespace doesnt count.
- return math.MaxInt32
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/lexer/lexer.go b/vendor/github.com/vektah/gqlparser/v2/lexer/lexer.go
deleted file mode 100644
index 25dcdcb9c4..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/lexer/lexer.go
+++ /dev/null
@@ -1,515 +0,0 @@
-package lexer
-
-import (
- "bytes"
- "unicode/utf8"
-
- "github.com/vektah/gqlparser/v2/ast"
- "github.com/vektah/gqlparser/v2/gqlerror"
-)
-
-// Lexer turns graphql request and schema strings into tokens
-type Lexer struct {
- *ast.Source
- // An offset into the string in bytes
- start int
- // An offset into the string in runes
- startRunes int
- // An offset into the string in bytes
- end int
- // An offset into the string in runes
- endRunes int
- // the current line number
- line int
- // An offset into the string in rune
- lineStartRunes int
-}
-
-func New(src *ast.Source) Lexer {
- return Lexer{
- Source: src,
- line: 1,
- }
-}
-
-// take one rune from input and advance end
-func (s *Lexer) peek() (rune, int) {
- return utf8.DecodeRuneInString(s.Input[s.end:])
-}
-
-func (s *Lexer) makeToken(kind Type) (Token, error) {
- return s.makeValueToken(kind, s.Input[s.start:s.end])
-}
-
-func (s *Lexer) makeValueToken(kind Type, value string) (Token, error) {
- return Token{
- Kind: kind,
- Value: value,
- Pos: ast.Position{
- Start: s.startRunes,
- End: s.endRunes,
- Line: s.line,
- Column: s.startRunes - s.lineStartRunes + 1,
- Src: s.Source,
- },
- }, nil
-}
-
-func (s *Lexer) makeError(format string, args ...interface{}) (Token, error) {
- column := s.endRunes - s.lineStartRunes + 1
- return Token{
- Kind: Invalid,
- Pos: ast.Position{
- Start: s.startRunes,
- End: s.endRunes,
- Line: s.line,
- Column: column,
- Src: s.Source,
- },
- }, gqlerror.ErrorLocf(s.Source.Name, s.line, column, format, args...)
-}
-
-// ReadToken gets the next token from the source starting at the given position.
-//
-// This skips over whitespace and comments until it finds the next lexable
-// token, then lexes punctuators immediately or calls the appropriate helper
-// function for more complicated tokens.
-func (s *Lexer) ReadToken() (token Token, err error) {
-
- s.ws()
- s.start = s.end
- s.startRunes = s.endRunes
-
- if s.end >= len(s.Input) {
- return s.makeToken(EOF)
- }
- r := s.Input[s.start]
- s.end++
- s.endRunes++
- switch r {
- case '!':
- return s.makeValueToken(Bang, "")
-
- case '$':
- return s.makeValueToken(Dollar, "")
- case '&':
- return s.makeValueToken(Amp, "")
- case '(':
- return s.makeValueToken(ParenL, "")
- case ')':
- return s.makeValueToken(ParenR, "")
- case '.':
- if len(s.Input) > s.start+2 && s.Input[s.start:s.start+3] == "..." {
- s.end += 2
- s.endRunes += 2
- return s.makeValueToken(Spread, "")
- }
- case ':':
- return s.makeValueToken(Colon, "")
- case '=':
- return s.makeValueToken(Equals, "")
- case '@':
- return s.makeValueToken(At, "")
- case '[':
- return s.makeValueToken(BracketL, "")
- case ']':
- return s.makeValueToken(BracketR, "")
- case '{':
- return s.makeValueToken(BraceL, "")
- case '}':
- return s.makeValueToken(BraceR, "")
- case '|':
- return s.makeValueToken(Pipe, "")
- case '#':
- s.readComment()
- return s.ReadToken()
-
- case '_', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z':
- return s.readName()
-
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- return s.readNumber()
-
- case '"':
- if len(s.Input) > s.start+2 && s.Input[s.start:s.start+3] == `"""` {
- return s.readBlockString()
- }
-
- return s.readString()
- }
-
- s.end--
- s.endRunes--
-
- if r < 0x0020 && r != 0x0009 && r != 0x000a && r != 0x000d {
- return s.makeError(`Cannot contain the invalid character "\u%04d"`, r)
- }
-
- if r == '\'' {
- return s.makeError(`Unexpected single quote character ('), did you mean to use a double quote (")?`)
- }
-
- return s.makeError(`Cannot parse the unexpected character "%s".`, string(r))
-}
-
-// ws reads from body starting at startPosition until it finds a non-whitespace
-// or commented character, and updates the token end to include all whitespace
-func (s *Lexer) ws() {
- for s.end < len(s.Input) {
- switch s.Input[s.end] {
- case '\t', ' ', ',':
- s.end++
- s.endRunes++
- case '\n':
- s.end++
- s.endRunes++
- s.line++
- s.lineStartRunes = s.endRunes
- case '\r':
- s.end++
- s.endRunes++
- s.line++
- s.lineStartRunes = s.endRunes
- // skip the following newline if its there
- if s.end < len(s.Input) && s.Input[s.end] == '\n' {
- s.end++
- s.endRunes++
- }
- // byte order mark, given ws is hot path we aren't relying on the unicode package here.
- case 0xef:
- if s.end+2 < len(s.Input) && s.Input[s.end+1] == 0xBB && s.Input[s.end+2] == 0xBF {
- s.end += 3
- s.endRunes++
- } else {
- return
- }
- default:
- return
- }
- }
-}
-
-// readComment from the input
-//
-// #[\u0009\u0020-\uFFFF]*
-func (s *Lexer) readComment() (Token, error) {
- for s.end < len(s.Input) {
- r, w := s.peek()
-
- // SourceCharacter but not LineTerminator
- if r > 0x001f || r == '\t' {
- s.end += w
- s.endRunes++
- } else {
- break
- }
- }
-
- return s.makeToken(Comment)
-}
-
-// readNumber from the input, either a float
-// or an int depending on whether a decimal point appears.
-//
-// Int: -?(0|[1-9][0-9]*)
-// Float: -?(0|[1-9][0-9]*)(\.[0-9]+)?((E|e)(+|-)?[0-9]+)?
-func (s *Lexer) readNumber() (Token, error) {
- float := false
-
- // backup to the first digit
- s.end--
- s.endRunes--
-
- s.acceptByte('-')
-
- if s.acceptByte('0') {
- if consumed := s.acceptDigits(); consumed != 0 {
- s.end -= consumed
- s.endRunes -= consumed
- return s.makeError("Invalid number, unexpected digit after 0: %s.", s.describeNext())
- }
- } else {
- if consumed := s.acceptDigits(); consumed == 0 {
- return s.makeError("Invalid number, expected digit but got: %s.", s.describeNext())
- }
- }
-
- if s.acceptByte('.') {
- float = true
-
- if consumed := s.acceptDigits(); consumed == 0 {
- return s.makeError("Invalid number, expected digit but got: %s.", s.describeNext())
- }
- }
-
- if s.acceptByte('e', 'E') {
- float = true
-
- s.acceptByte('-', '+')
-
- if consumed := s.acceptDigits(); consumed == 0 {
- return s.makeError("Invalid number, expected digit but got: %s.", s.describeNext())
- }
- }
-
- if float {
- return s.makeToken(Float)
- } else {
- return s.makeToken(Int)
- }
-}
-
-// acceptByte if it matches any of given bytes, returning true if it found anything
-func (s *Lexer) acceptByte(bytes ...uint8) bool {
- if s.end >= len(s.Input) {
- return false
- }
-
- for _, accepted := range bytes {
- if s.Input[s.end] == accepted {
- s.end++
- s.endRunes++
- return true
- }
- }
- return false
-}
-
-// acceptDigits from the input, returning the number of digits it found
-func (s *Lexer) acceptDigits() int {
- consumed := 0
- for s.end < len(s.Input) && s.Input[s.end] >= '0' && s.Input[s.end] <= '9' {
- s.end++
- s.endRunes++
- consumed++
- }
-
- return consumed
-}
-
-// describeNext peeks at the input and returns a human readable string. This should will alloc
-// and should only be used in errors
-func (s *Lexer) describeNext() string {
- if s.end < len(s.Input) {
- return `"` + string(s.Input[s.end]) + `"`
- }
- return ""
-}
-
-// readString from the input
-//
-// "([^"\\\u000A\u000D]|(\\(u[0-9a-fA-F]{4}|["\\/bfnrt])))*"
-func (s *Lexer) readString() (Token, error) {
- inputLen := len(s.Input)
-
- // this buffer is lazily created only if there are escape characters.
- var buf *bytes.Buffer
-
- // skip the opening quote
- s.start++
- s.startRunes++
-
- for s.end < inputLen {
- r := s.Input[s.end]
- if r == '\n' || r == '\r' {
- break
- }
- if r < 0x0020 && r != '\t' {
- return s.makeError(`Invalid character within String: "\u%04d".`, r)
- }
- switch r {
- default:
- var char = rune(r)
- var w = 1
-
- // skip unicode overhead if we are in the ascii range
- if r >= 127 {
- char, w = utf8.DecodeRuneInString(s.Input[s.end:])
- }
- s.end += w
- s.endRunes++
-
- if buf != nil {
- buf.WriteRune(char)
- }
-
- case '"':
- t, err := s.makeToken(String)
- // the token should not include the quotes in its value, but should cover them in its position
- t.Pos.Start--
- t.Pos.End++
-
- if buf != nil {
- t.Value = buf.String()
- }
-
- // skip the close quote
- s.end++
- s.endRunes++
-
- return t, err
-
- case '\\':
- if s.end+1 >= inputLen {
- s.end++
- s.endRunes++
- return s.makeError(`Invalid character escape sequence.`)
- }
-
- if buf == nil {
- buf = bytes.NewBufferString(s.Input[s.start:s.end])
- }
-
- escape := s.Input[s.end+1]
-
- if escape == 'u' {
- if s.end+6 >= inputLen {
- s.end++
- s.endRunes++
- return s.makeError("Invalid character escape sequence: \\%s.", s.Input[s.end:])
- }
-
- r, ok := unhex(s.Input[s.end+2 : s.end+6])
- if !ok {
- s.end++
- s.endRunes++
- return s.makeError("Invalid character escape sequence: \\%s.", s.Input[s.end:s.end+5])
- }
- buf.WriteRune(r)
- s.end += 6
- s.endRunes += 6
- } else {
- switch escape {
- case '"', '/', '\\':
- buf.WriteByte(escape)
- case 'b':
- buf.WriteByte('\b')
- case 'f':
- buf.WriteByte('\f')
- case 'n':
- buf.WriteByte('\n')
- case 'r':
- buf.WriteByte('\r')
- case 't':
- buf.WriteByte('\t')
- default:
- s.end += 1
- s.endRunes += 1
- return s.makeError("Invalid character escape sequence: \\%s.", string(escape))
- }
- s.end += 2
- s.endRunes += 2
- }
- }
- }
-
- return s.makeError("Unterminated string.")
-}
-
-// readBlockString from the input
-//
-// """("?"?(\\"""|\\(?!=""")|[^"\\]))*"""
-func (s *Lexer) readBlockString() (Token, error) {
- inputLen := len(s.Input)
-
- var buf bytes.Buffer
-
- // skip the opening quote
- s.start += 3
- s.startRunes += 3
- s.end += 2
- s.endRunes += 2
-
- for s.end < inputLen {
- r := s.Input[s.end]
-
- // Closing triple quote (""")
- if r == '"' && s.end+3 <= inputLen && s.Input[s.end:s.end+3] == `"""` {
- t, err := s.makeValueToken(BlockString, blockStringValue(buf.String()))
-
- // the token should not include the quotes in its value, but should cover them in its position
- t.Pos.Start -= 3
- t.Pos.End += 3
-
- // skip the close quote
- s.end += 3
- s.endRunes += 3
- return t, err
- }
-
- // SourceCharacter
- if r < 0x0020 && r != '\t' && r != '\n' && r != '\r' {
- return s.makeError(`Invalid character within String: "\u%04d".`, r)
- }
-
- if r == '\\' && s.end+4 <= inputLen && s.Input[s.end:s.end+4] == `\"""` {
- buf.WriteString(`"""`)
- s.end += 4
- s.endRunes += 4
- } else if r == '\r' {
- if s.end+1 < inputLen && s.Input[s.end+1] == '\n' {
- s.end++
- s.endRunes++
- }
-
- buf.WriteByte('\n')
- s.end++
- s.endRunes++
- s.line++
- s.lineStartRunes = s.endRunes
- } else {
- var char = rune(r)
- var w = 1
-
- // skip unicode overhead if we are in the ascii range
- if r >= 127 {
- char, w = utf8.DecodeRuneInString(s.Input[s.end:])
- }
- s.end += w
- s.endRunes++
- buf.WriteRune(char)
- if r == '\n' {
- s.line++
- s.lineStartRunes = s.endRunes
- }
- }
- }
-
- return s.makeError("Unterminated string.")
-}
-
-func unhex(b string) (v rune, ok bool) {
- for _, c := range b {
- v <<= 4
- switch {
- case '0' <= c && c <= '9':
- v |= c - '0'
- case 'a' <= c && c <= 'f':
- v |= c - 'a' + 10
- case 'A' <= c && c <= 'F':
- v |= c - 'A' + 10
- default:
- return 0, false
- }
- }
-
- return v, true
-}
-
-// readName from the input
-//
-// [_A-Za-z][_0-9A-Za-z]*
-func (s *Lexer) readName() (Token, error) {
- for s.end < len(s.Input) {
- r, w := s.peek()
-
- if (r >= '0' && r <= '9') || (r >= 'A' && r <= 'Z') || (r >= 'a' && r <= 'z') || r == '_' {
- s.end += w
- s.endRunes++
- } else {
- break
- }
- }
-
- return s.makeToken(Name)
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/lexer/lexer_test.yml b/vendor/github.com/vektah/gqlparser/v2/lexer/lexer_test.yml
deleted file mode 100644
index 5c4d5f0ff5..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/lexer/lexer_test.yml
+++ /dev/null
@@ -1,692 +0,0 @@
-encoding:
- - name: disallows uncommon control characters
- input: "\u0007"
- error:
- message: 'Cannot contain the invalid character "\u0007"'
- locations: [{line: 1, column: 1}]
-
- - name: accepts BOM header
- input: "\uFEFF foo"
- tokens:
- -
- kind: NAME
- start: 2
- end: 5
- value: 'foo'
-
-simple tokens:
- - name: records line and column
- input: "\n \r\n \r foo\n"
- tokens:
- -
- kind: NAME
- start: 8
- end: 11
- line: 4
- column: 3
- value: 'foo'
-
- - name: skips whitespace
- input: "\n\n foo\n\n\n"
- tokens:
- -
- kind: NAME
- start: 6
- end: 9
- value: 'foo'
-
- - name: skips comments
- input: "\n #comment\n foo#comment\n"
- tokens:
- -
- kind: NAME
- start: 18
- end: 21
- value: 'foo'
-
- - name: skips commas
- input: ",,,foo,,,"
- tokens:
- -
- kind: NAME
- start: 3
- end: 6
- value: 'foo'
-
- - name: errors respect whitespace
- input: "\n\n ?\n\n\n"
- error:
- message: 'Cannot parse the unexpected character "?".'
- locations: [{line: 3, column: 5}]
- string: |
- Syntax Error: Cannot parse the unexpected character "?".
- GraphQL request (3:5)
- 2:
- 3: ?
- ^
- 4:
-
- - name: lex reports useful information for dashes in names
- input: "a-b"
- error:
- message: 'Invalid number, expected digit but got: "b".'
- locations: [{ line: 1, column: 3 }]
- tokens:
- -
- kind: Name
- start: 0
- end: 1
- value: a
-
-lexes strings:
- - name: basic
- input: '"simple"'
- tokens:
- -
- kind: STRING
- start: 0
- end: 8
- value: 'simple'
-
- - name: whitespace
- input: '" white space "'
- tokens:
- -
- kind: STRING
- start: 0
- end: 15
- value: ' white space '
-
- - name: quote
- input: '"quote \""'
- tokens:
- -
- kind: STRING
- start: 0
- end: 10
- value: 'quote "'
-
- - name: escaped
- input: '"escaped \n\r\b\t\f"'
- tokens:
- -
- kind: STRING
- start: 0
- end: 20
- value: "escaped \n\r\b\t\f"
-
- - name: slashes
- input: '"slashes \\ \/"'
- tokens:
- -
- kind: STRING
- start: 0
- end: 15
- value: 'slashes \ /'
-
- - name: unicode
- input: '"unicode \u1234\u5678\u90AB\uCDEF"'
- tokens:
- -
- kind: STRING
- start: 0
- end: 34
- value: "unicode \u1234\u5678\u90AB\uCDEF"
-
-lex reports useful string errors:
- - name: unterminated
- input: '"'
- error:
- message: "Unterminated string."
- locations: [{ line: 1, column: 2 }]
-
- - name: no end quote
- input: '"no end quote'
- error:
- message: 'Unterminated string.'
- locations: [{ line: 1, column: 14 }]
-
- - name: single quotes
- input: "'single quotes'"
- error:
- message: "Unexpected single quote character ('), did you mean to use a double quote (\")?"
- locations: [{ line: 1, column: 1 }]
-
- - name: control characters
- input: "\"contains unescaped \u0007 control char\""
- error:
- message: 'Invalid character within String: "\u0007".'
- locations: [{ line: 1, column: 21 }]
-
- - name: null byte
- input: "\"null-byte is not \u0000 end of file\""
- error:
- message: 'Invalid character within String: "\u0000".'
- locations: [{ line: 1, column: 19 }]
-
- - name: unterminated newline
- input: "\"multi\nline\""
- error:
- message: 'Unterminated string.'
- locations: [{line: 1, column: 7 }]
-
- - name: unterminated carriage return
- input: "\"multi\rline\""
- error:
- message: 'Unterminated string.'
- locations: [{ line: 1, column: 7 }]
-
- - name: bad escape character
- input: '"bad \z esc"'
- error:
- message: 'Invalid character escape sequence: \z.'
- locations: [{ line: 1, column: 7 }]
-
- - name: hex escape sequence
- input: '"bad \x esc"'
- error:
- message: 'Invalid character escape sequence: \x.'
- locations: [{ line: 1, column: 7 }]
-
- - name: short escape sequence
- input: '"bad \u1 esc"'
- error:
- message: 'Invalid character escape sequence: \u1 es.'
- locations: [{ line: 1, column: 7 }]
-
- - name: invalid escape sequence 1
- input: '"bad \u0XX1 esc"'
- error:
- message: 'Invalid character escape sequence: \u0XX1.'
- locations: [{ line: 1, column: 7 }]
-
- - name: invalid escape sequence 2
- input: '"bad \uXXXX esc"'
- error:
- message: 'Invalid character escape sequence: \uXXXX.'
- locations: [{ line: 1, column: 7 }]
-
- - name: invalid escape sequence 3
- input: '"bad \uFXXX esc"'
- error:
- message: 'Invalid character escape sequence: \uFXXX.'
- locations: [{ line: 1, column: 7 }]
-
- - name: invalid character escape sequence
- input: '"bad \uXXXF esc"'
- error:
- message: 'Invalid character escape sequence: \uXXXF.'
- locations: [{ line: 1, column: 7 }]
-
-lexes block strings:
- - name: simple
- input: '"""simple"""'
- tokens:
- -
- kind: BLOCK_STRING
- start: 0
- end: 12
- value: 'simple'
-
- - name: white space
- input: '""" white space """'
- tokens:
- -
- kind: BLOCK_STRING
- start: 0
- end: 19
- value: ' white space '
-
- - name: contains quote
- input: '"""contains " quote"""'
- tokens:
- -
- kind: BLOCK_STRING
- start: 0
- end: 22
- value: 'contains " quote'
-
- - name: contains triplequote
- input: "\"\"\"contains \\\"\"\" triplequote\"\"\""
- tokens:
- -
- kind: BLOCK_STRING
- start: 0
- end: 31
- value: 'contains """ triplequote'
-
- - name: multi line
- input: "\"\"\"multi\nline\"\"\""
- tokens:
- -
- kind: BLOCK_STRING
- start: 0
- end: 16
- value: "multi\nline"
-
- - name: multi line normalized
- input: "\"\"\"multi\rline\r\nnormalized\"\"\""
- tokens:
- -
- kind: BLOCK_STRING
- start: 0
- end: 28
- value: "multi\nline\nnormalized"
-
- - name: unescaped
- input: '"""unescaped \n\r\b\t\f\u1234"""'
- tokens:
- -
- kind: BLOCK_STRING
- start: 0
- end: 32
- value: 'unescaped \n\r\b\t\f\u1234'
-
- - name: slashes
- input: '"""slashes \\ \/"""'
- tokens:
- -
- kind: BLOCK_STRING
- start: 0
- end: 19
- value: 'slashes \\ \/'
-
- - name: multiple lines
- input: |
- """
-
- spans
- multiple
- lines
-
- """
- tokens:
- -
- kind: BLOCK_STRING
- start: 0
- end: 36
- value: "spans\n multiple\n lines"
-
- - name: records correct line and column after block string
- input: |
- """
-
- some
- description
-
- """ foo
- tokens:
- -
- kind: BLOCK_STRING
- value: "some\ndescription"
- -
- kind: NAME
- start: 27
- end: 30
- line: 6
- column: 5
- value: 'foo'
-
-lex reports useful block string errors:
- - name: unterminated string
- input: '"""'
- error:
- message: "Unterminated string."
- locations: [{ line: 1, column: 4 }]
-
- - name: unescaped control characters
- input: "\"\"\"contains unescaped \u0007 control char\"\"\""
- error:
- message: 'Invalid character within String: "\u0007".'
- locations: [{ line: 1, column: 23 }]
-
- - name: null byte
- input: "\"\"\"null-byte is not \u0000 end of file\"\"\""
- error:
- message: 'Invalid character within String: "\u0000".'
- locations: [{ line: 1, column: 21 }]
-
-lexes numbers:
- - name: integer
- input: "4"
- tokens:
- -
- kind: INT
- start: 0
- end: 1
- value: '4'
-
- - name: float
- input: "4.123"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 5
- value: '4.123'
-
- - name: negative
- input: "-4"
- tokens:
- -
- kind: INT
- start: 0
- end: 2
- value: '-4'
-
- - name: nine
- input: "9"
- tokens:
- -
- kind: INT
- start: 0
- end: 1
- value: '9'
-
- - name: zero
- input: "0"
- tokens:
- -
- kind: INT
- start: 0
- end: 1
- value: '0'
-
- - name: negative float
- input: "-4.123"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 6
- value: '-4.123'
-
- - name: float leading zero
- input: "0.123"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 5
- value: '0.123'
-
- - name: exponent whole
- input: "123e4"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 5
- value: '123e4'
-
- - name: exponent uppercase
- input: "123E4"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 5
- value: '123E4'
-
- - name: exponent negative power
- input: "123e-4"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 6
- value: '123e-4'
-
- - name: exponent positive power
- input: "123e+4"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 6
- value: '123e+4'
-
- - name: exponent negative base
- input: "-1.123e4"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 8
- value: '-1.123e4'
-
- - name: exponent negative base upper
- input: "-1.123E4"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 8
- value: '-1.123E4'
-
- - name: exponent negative base negative power
- input: "-1.123e-4"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 9
- value: '-1.123e-4'
-
- - name: exponent negative base positive power
- input: "-1.123e+4"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 9
- value: '-1.123e+4'
-
- - name: exponent negative base large power
- input: "-1.123e4567"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 11
- value: '-1.123e4567'
-
-lex reports useful number errors:
- - name: zero
- input: "00"
- error:
- message: 'Invalid number, unexpected digit after 0: "0".'
- locations: [{ line: 1, column: 2 }]
-
- - name: positive
- input: "+1"
- error:
- message: 'Cannot parse the unexpected character "+".'
- locations: [{ line: 1, column: 1 }]
-
- - name: trailing dot
- input: "1."
- error:
- message: 'Invalid number, expected digit but got: .'
- locations: [{ line: 1, column: 3 }]
-
- - name: traililng dot exponent
- input: "1.e1"
- error:
- message: 'Invalid number, expected digit but got: "e".'
- locations: [{ line: 1, column: 3 }]
-
- - name: missing leading zero
- input: ".123"
- error:
- message: 'Cannot parse the unexpected character ".".'
- locations: [{ line: 1, column: 1 }]
-
- - name: characters
- input: "1.A"
- error:
- message: 'Invalid number, expected digit but got: "A".'
- locations: [{ line: 1, column: 3 }]
-
- - name: negative characters
- input: "-A"
- error:
- message: 'Invalid number, expected digit but got: "A".'
- locations: [{ line: 1, column: 2 }]
-
- - name: missing exponent
- input: '1.0e'
- error:
- message: 'Invalid number, expected digit but got: .'
- locations: [{ line: 1, column: 5 }]
-
- - name: character exponent
- input: "1.0eA"
- error:
- message: 'Invalid number, expected digit but got: "A".'
- locations: [{ line: 1, column: 5 }]
-
-lexes punctuation:
- - name: bang
- input: "!"
- tokens:
- -
- kind: BANG
- start: 0
- end: 1
- value: undefined
-
- - name: dollar
- input: "$"
- tokens:
- -
- kind: DOLLAR
- start: 0
- end: 1
- value: undefined
-
- - name: open paren
- input: "("
- tokens:
- -
- kind: PAREN_L
- start: 0
- end: 1
- value: undefined
-
- - name: close paren
- input: ")"
- tokens:
- -
- kind: PAREN_R
- start: 0
- end: 1
- value: undefined
-
- - name: spread
- input: "..."
- tokens:
- -
- kind: SPREAD
- start: 0
- end: 3
- value: undefined
-
- - name: colon
- input: ":"
- tokens:
- -
- kind: COLON
- start: 0
- end: 1
- value: undefined
-
- - name: equals
- input: "="
- tokens:
- -
- kind: EQUALS
- start: 0
- end: 1
- value: undefined
-
- - name: at
- input: "@"
- tokens:
- -
- kind: AT
- start: 0
- end: 1
- value: undefined
-
- - name: open bracket
- input: "["
- tokens:
- -
- kind: BRACKET_L
- start: 0
- end: 1
- value: undefined
-
- - name: close bracket
- input: "]"
- tokens:
- -
- kind: BRACKET_R
- start: 0
- end: 1
- value: undefined
-
- - name: open brace
- input: "{"
- tokens:
- -
- kind: BRACE_L
- start: 0
- end: 1
- value: undefined
-
- - name: close brace
- input: "}"
- tokens:
- -
- kind: BRACE_R
- start: 0
- end: 1
- value: undefined
-
- - name: pipe
- input: "|"
- tokens:
- -
- kind: PIPE
- start: 0
- end: 1
- value: undefined
-
-lex reports useful unknown character error:
- - name: not a spread
- input: ".."
- error:
- message: 'Cannot parse the unexpected character ".".'
- locations: [{ line: 1, column: 1 }]
-
- - name: question mark
- input: "?"
- error:
- message: 'Cannot parse the unexpected character "?".'
- message: 'Cannot parse the unexpected character "?".'
- locations: [{ line: 1, column: 1 }]
-
- - name: unicode 203
- input: "\u203B"
- error:
- message: 'Cannot parse the unexpected character "â".'
- locations: [{ line: 1, column: 1 }]
-
- - name: unicode 200
- input: "\u200b"
- error:
- message: 'Cannot parse the unexpected character "â".'
- locations: [{ line: 1, column: 1 }]
-
diff --git a/vendor/github.com/vektah/gqlparser/v2/lexer/token.go b/vendor/github.com/vektah/gqlparser/v2/lexer/token.go
deleted file mode 100644
index 8985a7efb7..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/lexer/token.go
+++ /dev/null
@@ -1,148 +0,0 @@
-package lexer
-
-import (
- "strconv"
-
- "github.com/vektah/gqlparser/v2/ast"
-)
-
-const (
- Invalid Type = iota
- EOF
- Bang
- Dollar
- Amp
- ParenL
- ParenR
- Spread
- Colon
- Equals
- At
- BracketL
- BracketR
- BraceL
- BraceR
- Pipe
- Name
- Int
- Float
- String
- BlockString
- Comment
-)
-
-func (t Type) Name() string {
- switch t {
- case Invalid:
- return "Invalid"
- case EOF:
- return "EOF"
- case Bang:
- return "Bang"
- case Dollar:
- return "Dollar"
- case Amp:
- return "Amp"
- case ParenL:
- return "ParenL"
- case ParenR:
- return "ParenR"
- case Spread:
- return "Spread"
- case Colon:
- return "Colon"
- case Equals:
- return "Equals"
- case At:
- return "At"
- case BracketL:
- return "BracketL"
- case BracketR:
- return "BracketR"
- case BraceL:
- return "BraceL"
- case BraceR:
- return "BraceR"
- case Pipe:
- return "Pipe"
- case Name:
- return "Name"
- case Int:
- return "Int"
- case Float:
- return "Float"
- case String:
- return "String"
- case BlockString:
- return "BlockString"
- case Comment:
- return "Comment"
- }
- return "Unknown " + strconv.Itoa(int(t))
-}
-
-func (t Type) String() string {
- switch t {
- case Invalid:
- return ""
- case EOF:
- return ""
- case Bang:
- return "!"
- case Dollar:
- return "$"
- case Amp:
- return "&"
- case ParenL:
- return "("
- case ParenR:
- return ")"
- case Spread:
- return "..."
- case Colon:
- return ":"
- case Equals:
- return "="
- case At:
- return "@"
- case BracketL:
- return "["
- case BracketR:
- return "]"
- case BraceL:
- return "{"
- case BraceR:
- return "}"
- case Pipe:
- return "|"
- case Name:
- return "Name"
- case Int:
- return "Int"
- case Float:
- return "Float"
- case String:
- return "String"
- case BlockString:
- return "BlockString"
- case Comment:
- return "Comment"
- }
- return "Unknown " + strconv.Itoa(int(t))
-}
-
-// Kind represents a type of token. The types are predefined as constants.
-type Type int
-
-type Token struct {
- Kind Type // The token type.
- Value string // The literal value consumed.
- Pos ast.Position // The file and line this token was read from
-}
-
-func (t Token) String() string {
- if t.Value != "" {
- return t.Kind.String() + " " + strconv.Quote(t.Value)
- }
- return t.Kind.String()
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/parser/parser.go b/vendor/github.com/vektah/gqlparser/v2/parser/parser.go
deleted file mode 100644
index 68eb51edc6..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/parser/parser.go
+++ /dev/null
@@ -1,136 +0,0 @@
-package parser
-
-import (
- "strconv"
-
- "github.com/vektah/gqlparser/v2/ast"
- "github.com/vektah/gqlparser/v2/gqlerror"
- "github.com/vektah/gqlparser/v2/lexer"
-)
-
-type parser struct {
- lexer lexer.Lexer
- err error
-
- peeked bool
- peekToken lexer.Token
- peekError error
-
- prev lexer.Token
-}
-
-func (p *parser) peekPos() *ast.Position {
- if p.err != nil {
- return nil
- }
-
- peek := p.peek()
- return &peek.Pos
-}
-
-func (p *parser) peek() lexer.Token {
- if p.err != nil {
- return p.prev
- }
-
- if !p.peeked {
- p.peekToken, p.peekError = p.lexer.ReadToken()
- p.peeked = true
- }
-
- return p.peekToken
-}
-
-func (p *parser) error(tok lexer.Token, format string, args ...interface{}) {
- if p.err != nil {
- return
- }
- p.err = gqlerror.ErrorLocf(tok.Pos.Src.Name, tok.Pos.Line, tok.Pos.Column, format, args...)
-}
-
-func (p *parser) next() lexer.Token {
- if p.err != nil {
- return p.prev
- }
- if p.peeked {
- p.peeked = false
- p.prev, p.err = p.peekToken, p.peekError
- } else {
- p.prev, p.err = p.lexer.ReadToken()
- }
- return p.prev
-}
-
-func (p *parser) expectKeyword(value string) lexer.Token {
- tok := p.peek()
- if tok.Kind == lexer.Name && tok.Value == value {
- return p.next()
- }
-
- p.error(tok, "Expected %s, found %s", strconv.Quote(value), tok.String())
- return tok
-}
-
-func (p *parser) expect(kind lexer.Type) lexer.Token {
- tok := p.peek()
- if tok.Kind == kind {
- return p.next()
- }
-
- p.error(tok, "Expected %s, found %s", kind, tok.Kind.String())
- return tok
-}
-
-func (p *parser) skip(kind lexer.Type) bool {
- if p.err != nil {
- return false
- }
-
- tok := p.peek()
-
- if tok.Kind != kind {
- return false
- }
- p.next()
- return true
-}
-
-func (p *parser) unexpectedError() {
- p.unexpectedToken(p.peek())
-}
-
-func (p *parser) unexpectedToken(tok lexer.Token) {
- p.error(tok, "Unexpected %s", tok.String())
-}
-
-func (p *parser) many(start lexer.Type, end lexer.Type, cb func()) {
- hasDef := p.skip(start)
- if !hasDef {
- return
- }
-
- for p.peek().Kind != end && p.err == nil {
- cb()
- }
- p.next()
-}
-
-func (p *parser) some(start lexer.Type, end lexer.Type, cb func()) {
- hasDef := p.skip(start)
- if !hasDef {
- return
- }
-
- called := false
- for p.peek().Kind != end && p.err == nil {
- called = true
- cb()
- }
-
- if !called {
- p.error(p.peek(), "expected at least one definition, found %s", p.peek().Kind.String())
- return
- }
-
- p.next()
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/parser/query.go b/vendor/github.com/vektah/gqlparser/v2/parser/query.go
deleted file mode 100644
index a38d982acb..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/parser/query.go
+++ /dev/null
@@ -1,348 +0,0 @@
-package parser
-
-import (
- "github.com/vektah/gqlparser/v2/lexer"
-
- . "github.com/vektah/gqlparser/v2/ast"
-)
-
-func ParseQuery(source *Source) (*QueryDocument, error) {
- p := parser{
- lexer: lexer.New(source),
- }
- return p.parseQueryDocument(), p.err
-}
-
-func (p *parser) parseQueryDocument() *QueryDocument {
- var doc QueryDocument
- for p.peek().Kind != lexer.EOF {
- if p.err != nil {
- return &doc
- }
- doc.Position = p.peekPos()
- switch p.peek().Kind {
- case lexer.Name:
- switch p.peek().Value {
- case "query", "mutation", "subscription":
- doc.Operations = append(doc.Operations, p.parseOperationDefinition())
- case "fragment":
- doc.Fragments = append(doc.Fragments, p.parseFragmentDefinition())
- default:
- p.unexpectedError()
- }
- case lexer.BraceL:
- doc.Operations = append(doc.Operations, p.parseOperationDefinition())
- default:
- p.unexpectedError()
- }
- }
-
- return &doc
-}
-
-func (p *parser) parseOperationDefinition() *OperationDefinition {
- if p.peek().Kind == lexer.BraceL {
- return &OperationDefinition{
- Position: p.peekPos(),
- Operation: Query,
- SelectionSet: p.parseRequiredSelectionSet(),
- }
- }
-
- var od OperationDefinition
- od.Position = p.peekPos()
- od.Operation = p.parseOperationType()
-
- if p.peek().Kind == lexer.Name {
- od.Name = p.next().Value
- }
-
- od.VariableDefinitions = p.parseVariableDefinitions()
- od.Directives = p.parseDirectives(false)
- od.SelectionSet = p.parseRequiredSelectionSet()
-
- return &od
-}
-
-func (p *parser) parseOperationType() Operation {
- tok := p.next()
- switch tok.Value {
- case "query":
- return Query
- case "mutation":
- return Mutation
- case "subscription":
- return Subscription
- }
- p.unexpectedToken(tok)
- return ""
-}
-
-func (p *parser) parseVariableDefinitions() VariableDefinitionList {
- var defs []*VariableDefinition
- p.many(lexer.ParenL, lexer.ParenR, func() {
- defs = append(defs, p.parseVariableDefinition())
- })
-
- return defs
-}
-
-func (p *parser) parseVariableDefinition() *VariableDefinition {
- var def VariableDefinition
- def.Position = p.peekPos()
- def.Variable = p.parseVariable()
-
- p.expect(lexer.Colon)
-
- def.Type = p.parseTypeReference()
-
- if p.skip(lexer.Equals) {
- def.DefaultValue = p.parseValueLiteral(true)
- }
-
- def.Directives = p.parseDirectives(false)
-
- return &def
-}
-
-func (p *parser) parseVariable() string {
- p.expect(lexer.Dollar)
- return p.parseName()
-}
-
-func (p *parser) parseOptionalSelectionSet() SelectionSet {
- var selections []Selection
- p.some(lexer.BraceL, lexer.BraceR, func() {
- selections = append(selections, p.parseSelection())
- })
-
- return SelectionSet(selections)
-}
-
-func (p *parser) parseRequiredSelectionSet() SelectionSet {
- if p.peek().Kind != lexer.BraceL {
- p.error(p.peek(), "Expected %s, found %s", lexer.BraceL, p.peek().Kind.String())
- return nil
- }
-
- var selections []Selection
- p.some(lexer.BraceL, lexer.BraceR, func() {
- selections = append(selections, p.parseSelection())
- })
-
- return SelectionSet(selections)
-}
-
-func (p *parser) parseSelection() Selection {
- if p.peek().Kind == lexer.Spread {
- return p.parseFragment()
- }
- return p.parseField()
-}
-
-func (p *parser) parseField() *Field {
- var field Field
- field.Position = p.peekPos()
- field.Alias = p.parseName()
-
- if p.skip(lexer.Colon) {
- field.Name = p.parseName()
- } else {
- field.Name = field.Alias
- }
-
- field.Arguments = p.parseArguments(false)
- field.Directives = p.parseDirectives(false)
- if p.peek().Kind == lexer.BraceL {
- field.SelectionSet = p.parseOptionalSelectionSet()
- }
-
- return &field
-}
-
-func (p *parser) parseArguments(isConst bool) ArgumentList {
- var arguments ArgumentList
- p.many(lexer.ParenL, lexer.ParenR, func() {
- arguments = append(arguments, p.parseArgument(isConst))
- })
-
- return arguments
-}
-
-func (p *parser) parseArgument(isConst bool) *Argument {
- arg := Argument{}
- arg.Position = p.peekPos()
- arg.Name = p.parseName()
- p.expect(lexer.Colon)
-
- arg.Value = p.parseValueLiteral(isConst)
- return &arg
-}
-
-func (p *parser) parseFragment() Selection {
- p.expect(lexer.Spread)
-
- if peek := p.peek(); peek.Kind == lexer.Name && peek.Value != "on" {
- return &FragmentSpread{
- Position: p.peekPos(),
- Name: p.parseFragmentName(),
- Directives: p.parseDirectives(false),
- }
- }
-
- var def InlineFragment
- def.Position = p.peekPos()
- if p.peek().Value == "on" {
- p.next() // "on"
-
- def.TypeCondition = p.parseName()
- }
-
- def.Directives = p.parseDirectives(false)
- def.SelectionSet = p.parseRequiredSelectionSet()
- return &def
-}
-
-func (p *parser) parseFragmentDefinition() *FragmentDefinition {
- var def FragmentDefinition
- def.Position = p.peekPos()
- p.expectKeyword("fragment")
-
- def.Name = p.parseFragmentName()
- def.VariableDefinition = p.parseVariableDefinitions()
-
- p.expectKeyword("on")
-
- def.TypeCondition = p.parseName()
- def.Directives = p.parseDirectives(false)
- def.SelectionSet = p.parseRequiredSelectionSet()
- return &def
-}
-
-func (p *parser) parseFragmentName() string {
- if p.peek().Value == "on" {
- p.unexpectedError()
- return ""
- }
-
- return p.parseName()
-}
-
-func (p *parser) parseValueLiteral(isConst bool) *Value {
- token := p.peek()
-
- var kind ValueKind
- switch token.Kind {
- case lexer.BracketL:
- return p.parseList(isConst)
- case lexer.BraceL:
- return p.parseObject(isConst)
- case lexer.Dollar:
- if isConst {
- p.unexpectedError()
- return nil
- }
- return &Value{Position: &token.Pos, Raw: p.parseVariable(), Kind: Variable}
- case lexer.Int:
- kind = IntValue
- case lexer.Float:
- kind = FloatValue
- case lexer.String:
- kind = StringValue
- case lexer.BlockString:
- kind = BlockValue
- case lexer.Name:
- switch token.Value {
- case "true", "false":
- kind = BooleanValue
- case "null":
- kind = NullValue
- default:
- kind = EnumValue
- }
- default:
- p.unexpectedError()
- return nil
- }
-
- p.next()
-
- return &Value{Position: &token.Pos, Raw: token.Value, Kind: kind}
-}
-
-func (p *parser) parseList(isConst bool) *Value {
- var values ChildValueList
- pos := p.peekPos()
- p.many(lexer.BracketL, lexer.BracketR, func() {
- values = append(values, &ChildValue{Value: p.parseValueLiteral(isConst)})
- })
-
- return &Value{Children: values, Kind: ListValue, Position: pos}
-}
-
-func (p *parser) parseObject(isConst bool) *Value {
- var fields ChildValueList
- pos := p.peekPos()
- p.many(lexer.BraceL, lexer.BraceR, func() {
- fields = append(fields, p.parseObjectField(isConst))
- })
-
- return &Value{Children: fields, Kind: ObjectValue, Position: pos}
-}
-
-func (p *parser) parseObjectField(isConst bool) *ChildValue {
- field := ChildValue{}
- field.Position = p.peekPos()
- field.Name = p.parseName()
-
- p.expect(lexer.Colon)
-
- field.Value = p.parseValueLiteral(isConst)
- return &field
-}
-
-func (p *parser) parseDirectives(isConst bool) []*Directive {
- var directives []*Directive
-
- for p.peek().Kind == lexer.At {
- if p.err != nil {
- break
- }
- directives = append(directives, p.parseDirective(isConst))
- }
- return directives
-}
-
-func (p *parser) parseDirective(isConst bool) *Directive {
- p.expect(lexer.At)
-
- return &Directive{
- Position: p.peekPos(),
- Name: p.parseName(),
- Arguments: p.parseArguments(isConst),
- }
-}
-
-func (p *parser) parseTypeReference() *Type {
- var typ Type
-
- if p.skip(lexer.BracketL) {
- typ.Position = p.peekPos()
- typ.Elem = p.parseTypeReference()
- p.expect(lexer.BracketR)
- } else {
- typ.Position = p.peekPos()
- typ.NamedType = p.parseName()
- }
-
- if p.skip(lexer.Bang) {
- typ.NonNull = true
- }
- return &typ
-}
-
-func (p *parser) parseName() string {
- token := p.expect(lexer.Name)
-
- return token.Value
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/parser/query_test.yml b/vendor/github.com/vektah/gqlparser/v2/parser/query_test.yml
deleted file mode 100644
index a46a01e718..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/parser/query_test.yml
+++ /dev/null
@@ -1,544 +0,0 @@
-parser provides useful errors:
- - name: unclosed paren
- input: '{'
- error:
- message: "Expected Name, found "
- locations: [{line: 1, column: 2}]
-
- - name: missing on in fragment
- input: |
- { ...MissingOn }
- fragment MissingOn Type
- error:
- message: 'Expected "on", found Name "Type"'
- locations: [{ line: 2, column: 20 }]
-
- - name: missing name after alias
- input: '{ field: {} }'
- error:
- message: "Expected Name, found {"
- locations: [{ line: 1, column: 10 }]
-
- - name: not an operation
- input: 'notanoperation Foo { field }'
- error:
- message: 'Unexpected Name "notanoperation"'
- locations: [{ line: 1, column: 1 }]
-
- - name: a wild splat appears
- input: '...'
- error:
- message: 'Unexpected ...'
- locations: [{ line: 1, column: 1}]
-
-variables:
- - name: are allowed in args
- input: '{ field(complex: { a: { b: [ $var ] } }) }'
-
- - name: are not allowed in default args
- input: 'query Foo($x: Complex = { a: { b: [ $var ] } }) { field }'
- error:
- message: 'Unexpected $'
- locations: [{ line: 1, column: 37 }]
-
- - name: can have directives
- input: 'query ($withDirective: String @first @second, $withoutDirective: String) { f }'
- ast: |
-
- Operations: [OperationDefinition]
- -
- Operation: Operation("query")
- VariableDefinitions: [VariableDefinition]
- -
- Variable: "withDirective"
- Type: String
- Directives: [Directive]
- -
- Name: "first"
- -
- Name: "second"
- -
- Variable: "withoutDirective"
- Type: String
- SelectionSet: [Selection]
- -
- Alias: "f"
- Name: "f"
-
-fragments:
- - name: can not be named 'on'
- input: 'fragment on on on { on }'
- error:
- message: 'Unexpected Name "on"'
- locations: [{ line: 1, column: 10 }]
-
- - name: can not spread fragments called 'on'
- input: '{ ...on }'
- error:
- message: 'Expected Name, found }'
- locations: [{ line: 1, column: 9 }]
-
-encoding:
- - name: multibyte characters are supported
- input: |
- # This comment has a ਊ multi-byte character.
- { field(arg: "Has a ਊ multi-byte character.") }
- ast: |
-
- Operations: [OperationDefinition]
- -
- Operation: Operation("query")
- SelectionSet: [Selection]
- -
- Alias: "field"
- Name: "field"
- Arguments: [Argument]
- -
- Name: "arg"
- Value: "Has a ਊ multi-byte character."
-
-keywords are allowed anywhere a name is:
- - name: on
- input: |
- query on {
- ... a
- ... on on { field }
- }
- fragment a on Type {
- on(on: $on)
- @on(on: on)
- }
-
- - name: subscription
- input: |
- query subscription {
- ... subscription
- ... on subscription { field }
- }
- fragment subscription on Type {
- subscription(subscription: $subscription)
- @subscription(subscription: subscription)
- }
-
- - name: true
- input: |
- query true {
- ... true
- ... on true { field }
- }
- fragment true on Type {
- true(true: $true)
- @true(true: true)
- }
-
-operations:
- - name: anonymous mutation
- input: 'mutation { mutationField }'
-
- - name: named mutation
- input: 'mutation Foo { mutationField }'
-
- - name: anonymous subscription
- input: 'subscription { subscriptionField }'
-
- - name: named subscription
- input: 'subscription Foo { subscriptionField }'
-
-
-ast:
- - name: simple query
- input: |
- {
- node(id: 4) {
- id,
- name
- }
- }
- ast: |
-
- Operations: [OperationDefinition]
- -
- Operation: Operation("query")
- SelectionSet: [Selection]
- -
- Alias: "node"
- Name: "node"
- Arguments: [Argument]
- -
- Name: "id"
- Value: 4
- SelectionSet: [Selection]
- -
- Alias: "id"
- Name: "id"
- -
- Alias: "name"
- Name: "name"
-
- - name: nameless query with no variables
- input: |
- query {
- node {
- id
- }
- }
- ast: |
-
- Operations: [OperationDefinition]
- -
- Operation: Operation("query")
- SelectionSet: [Selection]
- -
- Alias: "node"
- Name: "node"
- SelectionSet: [Selection]
- -
- Alias: "id"
- Name: "id"
-
- - name: fragment defined variables
- input: 'fragment a($v: Boolean = false) on t { f(v: $v) }'
- ast: |
-
- Fragments: [FragmentDefinition]
- -
- Name: "a"
- VariableDefinition: [VariableDefinition]
- -
- Variable: "v"
- Type: Boolean
- DefaultValue: false
- TypeCondition: "t"
- SelectionSet: [Selection]
- -
- Alias: "f"
- Name: "f"
- Arguments: [Argument]
- -
- Name: "v"
- Value: $v
-
-
-values:
- - name: null
- input: '{ f(id: null) }'
- ast: |
-
- Operations: [OperationDefinition]
- -
- Operation: Operation("query")
- SelectionSet: [Selection]
- -
- Alias: "f"
- Name: "f"
- Arguments: [Argument]
- -
- Name: "id"
- Value: null
-
- - name: strings
- input: '{ f(long: """long""", short: "short") } '
- ast: |
-
- Operations: [OperationDefinition]
- -
- Operation: Operation("query")
- SelectionSet: [Selection]
- -
- Alias: "f"
- Name: "f"
- Arguments: [Argument]
- -
- Name: "long"
- Value: "long"
- -
- Name: "short"
- Value: "short"
-
- - name: list
- input: '{ f(id: [1,2]) }'
- ast: |
-
- Operations: [OperationDefinition]
- -
- Operation: Operation("query")
- SelectionSet: [Selection]
- -
- Alias: "f"
- Name: "f"
- Arguments: [Argument]
- -
- Name: "id"
- Value: [1,2]
-
-types:
- - name: common types
- input: 'query ($string: String, $int: Int, $arr: [Arr], $notnull: [Arr!]!) { f }'
- ast: |
-
- Operations: [OperationDefinition]
- -
- Operation: Operation("query")
- VariableDefinitions: [VariableDefinition]
- -
- Variable: "string"
- Type: String
- -
- Variable: "int"
- Type: Int
- -
- Variable: "arr"
- Type: [Arr]
- -
- Variable: "notnull"
- Type: [Arr!]!
- SelectionSet: [Selection]
- -
- Alias: "f"
- Name: "f"
-
-large queries:
- - name: kitchen sink
- input: |
- # Copyright (c) 2015-present, Facebook, Inc.
- #
- # This source code is licensed under the MIT license found in the
- # LICENSE file in the root directory of this source tree.
-
- query queryName($foo: ComplexType, $site: Site = MOBILE) {
- whoever123is: node(id: [123, 456]) {
- id ,
- ... on User @defer {
- field2 {
- id ,
- alias: field1(first:10, after:$foo,) @include(if: $foo) {
- id,
- ...frag
- }
- }
- }
- ... @skip(unless: $foo) {
- id
- }
- ... {
- id
- }
- }
- }
-
- mutation likeStory {
- like(story: 123) @defer {
- story {
- id
- }
- }
- }
-
- subscription StoryLikeSubscription($input: StoryLikeSubscribeInput) {
- storyLikeSubscribe(input: $input) {
- story {
- likers {
- count
- }
- likeSentence {
- text
- }
- }
- }
- }
-
- fragment frag on Friend {
- foo(size: $size, bar: $b, obj: {key: "value", block: """
- block string uses \"""
- """})
- }
-
- {
- unnamed(truthy: true, falsey: false, nullish: null),
- query
- }
- ast: |
-
- Operations: [OperationDefinition]
- -
- Operation: Operation("query")
- Name: "queryName"
- VariableDefinitions: [VariableDefinition]
- -
- Variable: "foo"
- Type: ComplexType
- -
- Variable: "site"
- Type: Site
- DefaultValue: MOBILE
- SelectionSet: [Selection]
- -
- Alias: "whoever123is"
- Name: "node"
- Arguments: [Argument]
- -
- Name: "id"
- Value: [123,456]
- SelectionSet: [Selection]
- -
- Alias: "id"
- Name: "id"
- -
- TypeCondition: "User"
- Directives: [Directive]
- -
- Name: "defer"
- SelectionSet: [Selection]
- -
- Alias: "field2"
- Name: "field2"
- SelectionSet: [Selection]
- -
- Alias: "id"
- Name: "id"
- -
- Alias: "alias"
- Name: "field1"
- Arguments: [Argument]
- -
- Name: "first"
- Value: 10
- -
- Name: "after"
- Value: $foo
- Directives: [Directive]
- -
- Name: "include"
- Arguments: [Argument]
- -
- Name: "if"
- Value: $foo
- SelectionSet: [Selection]
- -
- Alias: "id"
- Name: "id"
- -
- Name: "frag"
- -
- Directives: [Directive]
- -
- Name: "skip"
- Arguments: [Argument]
- -
- Name: "unless"
- Value: $foo
- SelectionSet: [Selection]
- -
- Alias: "id"
- Name: "id"
- -
- SelectionSet: [Selection]
- -
- Alias: "id"
- Name: "id"
- -
- Operation: Operation("mutation")
- Name: "likeStory"
- SelectionSet: [Selection]
- -
- Alias: "like"
- Name: "like"
- Arguments: [Argument]
- -
- Name: "story"
- Value: 123
- Directives: [Directive]
- -
- Name: "defer"
- SelectionSet: [Selection]
- -
- Alias: "story"
- Name: "story"
- SelectionSet: [Selection]
- -
- Alias: "id"
- Name: "id"
- -
- Operation: Operation("subscription")
- Name: "StoryLikeSubscription"
- VariableDefinitions: [VariableDefinition]
- -
- Variable: "input"
- Type: StoryLikeSubscribeInput
- SelectionSet: [Selection]
- -
- Alias: "storyLikeSubscribe"
- Name: "storyLikeSubscribe"
- Arguments: [Argument]
- -
- Name: "input"
- Value: $input
- SelectionSet: [Selection]
- -
- Alias: "story"
- Name: "story"
- SelectionSet: [Selection]
- -
- Alias: "likers"
- Name: "likers"
- SelectionSet: [Selection]
- -
- Alias: "count"
- Name: "count"
- -
- Alias: "likeSentence"
- Name: "likeSentence"
- SelectionSet: [Selection]
- -
- Alias: "text"
- Name: "text"
- -
- Operation: Operation("query")
- SelectionSet: [Selection]
- -
- Alias: "unnamed"
- Name: "unnamed"
- Arguments: [Argument]
- -
- Name: "truthy"
- Value: true
- -
- Name: "falsey"
- Value: false
- -
- Name: "nullish"
- Value: null
- -
- Alias: "query"
- Name: "query"
- Fragments: [FragmentDefinition]
- -
- Name: "frag"
- TypeCondition: "Friend"
- SelectionSet: [Selection]
- -
- Alias: "foo"
- Name: "foo"
- Arguments: [Argument]
- -
- Name: "size"
- Value: $size
- -
- Name: "bar"
- Value: $b
- -
- Name: "obj"
- Value: {key:"value",block:"block string uses \"\"\""}
-
-fuzzer:
-- name: 01
- input: '{__typename{...}}'
- error:
- message: 'Expected {, found }'
- locations: [{ line: 1, column: 16 }]
-
-- name: 02
- input: '{...{__typename{...{}}}}'
- error:
- message: 'expected at least one definition, found }'
- locations: [{ line: 1, column: 21 }]
diff --git a/vendor/github.com/vektah/gqlparser/v2/parser/schema.go b/vendor/github.com/vektah/gqlparser/v2/parser/schema.go
deleted file mode 100644
index aec08a9700..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/parser/schema.go
+++ /dev/null
@@ -1,534 +0,0 @@
-package parser
-
-import (
- . "github.com/vektah/gqlparser/v2/ast"
- "github.com/vektah/gqlparser/v2/lexer"
-)
-
-func ParseSchema(source *Source) (*SchemaDocument, error) {
- p := parser{
- lexer: lexer.New(source),
- }
- ast, err := p.parseSchemaDocument(), p.err
- if err != nil {
- return nil, err
- }
-
- for _, def := range ast.Definitions {
- def.BuiltIn = source.BuiltIn
- }
- for _, def := range ast.Extensions {
- def.BuiltIn = source.BuiltIn
- }
-
- return ast, nil
-}
-
-func ParseSchemas(inputs ...*Source) (*SchemaDocument, error) {
- ast := &SchemaDocument{}
- for _, input := range inputs {
- inputAst, err := ParseSchema(input)
- if err != nil {
- return nil, err
- }
- ast.Merge(inputAst)
- }
- return ast, nil
-}
-
-func (p *parser) parseSchemaDocument() *SchemaDocument {
- var doc SchemaDocument
- doc.Position = p.peekPos()
- for p.peek().Kind != lexer.EOF {
- if p.err != nil {
- return nil
- }
-
- var description string
- if p.peek().Kind == lexer.BlockString || p.peek().Kind == lexer.String {
- description = p.parseDescription()
- }
-
- if p.peek().Kind != lexer.Name {
- p.unexpectedError()
- break
- }
-
- switch p.peek().Value {
- case "scalar", "type", "interface", "union", "enum", "input":
- doc.Definitions = append(doc.Definitions, p.parseTypeSystemDefinition(description))
- case "schema":
- doc.Schema = append(doc.Schema, p.parseSchemaDefinition(description))
- case "directive":
- doc.Directives = append(doc.Directives, p.parseDirectiveDefinition(description))
- case "extend":
- if description != "" {
- p.unexpectedToken(p.prev)
- }
- p.parseTypeSystemExtension(&doc)
- default:
- p.unexpectedError()
- return nil
- }
- }
-
- return &doc
-}
-
-func (p *parser) parseDescription() string {
- token := p.peek()
-
- if token.Kind != lexer.BlockString && token.Kind != lexer.String {
- return ""
- }
-
- return p.next().Value
-}
-
-func (p *parser) parseTypeSystemDefinition(description string) *Definition {
- tok := p.peek()
- if tok.Kind != lexer.Name {
- p.unexpectedError()
- return nil
- }
-
- switch tok.Value {
- case "scalar":
- return p.parseScalarTypeDefinition(description)
- case "type":
- return p.parseObjectTypeDefinition(description)
- case "interface":
- return p.parseInterfaceTypeDefinition(description)
- case "union":
- return p.parseUnionTypeDefinition(description)
- case "enum":
- return p.parseEnumTypeDefinition(description)
- case "input":
- return p.parseInputObjectTypeDefinition(description)
- default:
- p.unexpectedError()
- return nil
- }
-}
-
-func (p *parser) parseSchemaDefinition(description string) *SchemaDefinition {
- p.expectKeyword("schema")
-
- def := SchemaDefinition{Description: description}
- def.Position = p.peekPos()
- def.Description = description
- def.Directives = p.parseDirectives(true)
-
- p.some(lexer.BraceL, lexer.BraceR, func() {
- def.OperationTypes = append(def.OperationTypes, p.parseOperationTypeDefinition())
- })
- return &def
-}
-
-func (p *parser) parseOperationTypeDefinition() *OperationTypeDefinition {
- var op OperationTypeDefinition
- op.Position = p.peekPos()
- op.Operation = p.parseOperationType()
- p.expect(lexer.Colon)
- op.Type = p.parseName()
- return &op
-}
-
-func (p *parser) parseScalarTypeDefinition(description string) *Definition {
- p.expectKeyword("scalar")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = Scalar
- def.Description = description
- def.Name = p.parseName()
- def.Directives = p.parseDirectives(true)
- return &def
-}
-
-func (p *parser) parseObjectTypeDefinition(description string) *Definition {
- p.expectKeyword("type")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = Object
- def.Description = description
- def.Name = p.parseName()
- def.Interfaces = p.parseImplementsInterfaces()
- def.Directives = p.parseDirectives(true)
- def.Fields = p.parseFieldsDefinition()
- return &def
-}
-
-func (p *parser) parseImplementsInterfaces() []string {
- var types []string
- if p.peek().Value == "implements" {
- p.next()
- // optional leading ampersand
- p.skip(lexer.Amp)
-
- types = append(types, p.parseName())
- for p.skip(lexer.Amp) && p.err == nil {
- types = append(types, p.parseName())
- }
- }
- return types
-}
-
-func (p *parser) parseFieldsDefinition() FieldList {
- var defs FieldList
- p.some(lexer.BraceL, lexer.BraceR, func() {
- defs = append(defs, p.parseFieldDefinition())
- })
- return defs
-}
-
-func (p *parser) parseFieldDefinition() *FieldDefinition {
- var def FieldDefinition
- def.Position = p.peekPos()
- def.Description = p.parseDescription()
- def.Name = p.parseName()
- def.Arguments = p.parseArgumentDefs()
- p.expect(lexer.Colon)
- def.Type = p.parseTypeReference()
- def.Directives = p.parseDirectives(true)
-
- return &def
-}
-
-func (p *parser) parseArgumentDefs() ArgumentDefinitionList {
- var args ArgumentDefinitionList
- p.some(lexer.ParenL, lexer.ParenR, func() {
- args = append(args, p.parseArgumentDef())
- })
- return args
-}
-
-func (p *parser) parseArgumentDef() *ArgumentDefinition {
- var def ArgumentDefinition
- def.Position = p.peekPos()
- def.Description = p.parseDescription()
- def.Name = p.parseName()
- p.expect(lexer.Colon)
- def.Type = p.parseTypeReference()
- if p.skip(lexer.Equals) {
- def.DefaultValue = p.parseValueLiteral(true)
- }
- def.Directives = p.parseDirectives(true)
- return &def
-}
-
-func (p *parser) parseInputValueDef() *FieldDefinition {
- var def FieldDefinition
- def.Position = p.peekPos()
- def.Description = p.parseDescription()
- def.Name = p.parseName()
- p.expect(lexer.Colon)
- def.Type = p.parseTypeReference()
- if p.skip(lexer.Equals) {
- def.DefaultValue = p.parseValueLiteral(true)
- }
- def.Directives = p.parseDirectives(true)
- return &def
-}
-
-func (p *parser) parseInterfaceTypeDefinition(description string) *Definition {
- p.expectKeyword("interface")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = Interface
- def.Description = description
- def.Name = p.parseName()
- def.Interfaces = p.parseImplementsInterfaces()
- def.Directives = p.parseDirectives(true)
- def.Fields = p.parseFieldsDefinition()
- return &def
-}
-
-func (p *parser) parseUnionTypeDefinition(description string) *Definition {
- p.expectKeyword("union")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = Union
- def.Description = description
- def.Name = p.parseName()
- def.Directives = p.parseDirectives(true)
- def.Types = p.parseUnionMemberTypes()
- return &def
-}
-
-func (p *parser) parseUnionMemberTypes() []string {
- var types []string
- if p.skip(lexer.Equals) {
- // optional leading pipe
- p.skip(lexer.Pipe)
-
- types = append(types, p.parseName())
- for p.skip(lexer.Pipe) && p.err == nil {
- types = append(types, p.parseName())
- }
- }
- return types
-}
-
-func (p *parser) parseEnumTypeDefinition(description string) *Definition {
- p.expectKeyword("enum")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = Enum
- def.Description = description
- def.Name = p.parseName()
- def.Directives = p.parseDirectives(true)
- def.EnumValues = p.parseEnumValuesDefinition()
- return &def
-}
-
-func (p *parser) parseEnumValuesDefinition() EnumValueList {
- var values EnumValueList
- p.some(lexer.BraceL, lexer.BraceR, func() {
- values = append(values, p.parseEnumValueDefinition())
- })
- return values
-}
-
-func (p *parser) parseEnumValueDefinition() *EnumValueDefinition {
- return &EnumValueDefinition{
- Position: p.peekPos(),
- Description: p.parseDescription(),
- Name: p.parseName(),
- Directives: p.parseDirectives(true),
- }
-}
-
-func (p *parser) parseInputObjectTypeDefinition(description string) *Definition {
- p.expectKeyword("input")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = InputObject
- def.Description = description
- def.Name = p.parseName()
- def.Directives = p.parseDirectives(true)
- def.Fields = p.parseInputFieldsDefinition()
- return &def
-}
-
-func (p *parser) parseInputFieldsDefinition() FieldList {
- var values FieldList
- p.some(lexer.BraceL, lexer.BraceR, func() {
- values = append(values, p.parseInputValueDef())
- })
- return values
-}
-
-func (p *parser) parseTypeSystemExtension(doc *SchemaDocument) {
- p.expectKeyword("extend")
-
- switch p.peek().Value {
- case "schema":
- doc.SchemaExtension = append(doc.SchemaExtension, p.parseSchemaExtension())
- case "scalar":
- doc.Extensions = append(doc.Extensions, p.parseScalarTypeExtension())
- case "type":
- doc.Extensions = append(doc.Extensions, p.parseObjectTypeExtension())
- case "interface":
- doc.Extensions = append(doc.Extensions, p.parseInterfaceTypeExtension())
- case "union":
- doc.Extensions = append(doc.Extensions, p.parseUnionTypeExtension())
- case "enum":
- doc.Extensions = append(doc.Extensions, p.parseEnumTypeExtension())
- case "input":
- doc.Extensions = append(doc.Extensions, p.parseInputObjectTypeExtension())
- default:
- p.unexpectedError()
- }
-}
-
-func (p *parser) parseSchemaExtension() *SchemaDefinition {
- p.expectKeyword("schema")
-
- var def SchemaDefinition
- def.Position = p.peekPos()
- def.Directives = p.parseDirectives(true)
- p.some(lexer.BraceL, lexer.BraceR, func() {
- def.OperationTypes = append(def.OperationTypes, p.parseOperationTypeDefinition())
- })
- if len(def.Directives) == 0 && len(def.OperationTypes) == 0 {
- p.unexpectedError()
- }
- return &def
-}
-
-func (p *parser) parseScalarTypeExtension() *Definition {
- p.expectKeyword("scalar")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = Scalar
- def.Name = p.parseName()
- def.Directives = p.parseDirectives(true)
- if len(def.Directives) == 0 {
- p.unexpectedError()
- }
- return &def
-}
-
-func (p *parser) parseObjectTypeExtension() *Definition {
- p.expectKeyword("type")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = Object
- def.Name = p.parseName()
- def.Interfaces = p.parseImplementsInterfaces()
- def.Directives = p.parseDirectives(true)
- def.Fields = p.parseFieldsDefinition()
- if len(def.Interfaces) == 0 && len(def.Directives) == 0 && len(def.Fields) == 0 {
- p.unexpectedError()
- }
- return &def
-}
-
-func (p *parser) parseInterfaceTypeExtension() *Definition {
- p.expectKeyword("interface")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = Interface
- def.Name = p.parseName()
- def.Directives = p.parseDirectives(true)
- def.Fields = p.parseFieldsDefinition()
- if len(def.Directives) == 0 && len(def.Fields) == 0 {
- p.unexpectedError()
- }
- return &def
-}
-
-func (p *parser) parseUnionTypeExtension() *Definition {
- p.expectKeyword("union")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = Union
- def.Name = p.parseName()
- def.Directives = p.parseDirectives(true)
- def.Types = p.parseUnionMemberTypes()
-
- if len(def.Directives) == 0 && len(def.Types) == 0 {
- p.unexpectedError()
- }
- return &def
-}
-
-func (p *parser) parseEnumTypeExtension() *Definition {
- p.expectKeyword("enum")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = Enum
- def.Name = p.parseName()
- def.Directives = p.parseDirectives(true)
- def.EnumValues = p.parseEnumValuesDefinition()
- if len(def.Directives) == 0 && len(def.EnumValues) == 0 {
- p.unexpectedError()
- }
- return &def
-}
-
-func (p *parser) parseInputObjectTypeExtension() *Definition {
- p.expectKeyword("input")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = InputObject
- def.Name = p.parseName()
- def.Directives = p.parseDirectives(false)
- def.Fields = p.parseInputFieldsDefinition()
- if len(def.Directives) == 0 && len(def.Fields) == 0 {
- p.unexpectedError()
- }
- return &def
-}
-
-func (p *parser) parseDirectiveDefinition(description string) *DirectiveDefinition {
- p.expectKeyword("directive")
- p.expect(lexer.At)
-
- var def DirectiveDefinition
- def.Position = p.peekPos()
- def.Description = description
- def.Name = p.parseName()
- def.Arguments = p.parseArgumentDefs()
-
- if peek := p.peek(); peek.Kind == lexer.Name && peek.Value == "repeatable" {
- def.IsRepeatable = true
- p.skip(lexer.Name)
- }
-
- p.expectKeyword("on")
- def.Locations = p.parseDirectiveLocations()
- return &def
-}
-
-func (p *parser) parseDirectiveLocations() []DirectiveLocation {
- p.skip(lexer.Pipe)
-
- locations := []DirectiveLocation{p.parseDirectiveLocation()}
-
- for p.skip(lexer.Pipe) && p.err == nil {
- locations = append(locations, p.parseDirectiveLocation())
- }
-
- return locations
-}
-
-func (p *parser) parseDirectiveLocation() DirectiveLocation {
- name := p.expect(lexer.Name)
-
- switch name.Value {
- case `QUERY`:
- return LocationQuery
- case `MUTATION`:
- return LocationMutation
- case `SUBSCRIPTION`:
- return LocationSubscription
- case `FIELD`:
- return LocationField
- case `FRAGMENT_DEFINITION`:
- return LocationFragmentDefinition
- case `FRAGMENT_SPREAD`:
- return LocationFragmentSpread
- case `INLINE_FRAGMENT`:
- return LocationInlineFragment
- case `VARIABLE_DEFINITION`:
- return LocationVariableDefinition
- case `SCHEMA`:
- return LocationSchema
- case `SCALAR`:
- return LocationScalar
- case `OBJECT`:
- return LocationObject
- case `FIELD_DEFINITION`:
- return LocationFieldDefinition
- case `ARGUMENT_DEFINITION`:
- return LocationArgumentDefinition
- case `INTERFACE`:
- return LocationInterface
- case `UNION`:
- return LocationUnion
- case `ENUM`:
- return LocationEnum
- case `ENUM_VALUE`:
- return LocationEnumValue
- case `INPUT_OBJECT`:
- return LocationInputObject
- case `INPUT_FIELD_DEFINITION`:
- return LocationInputFieldDefinition
- }
-
- p.unexpectedToken(name)
- return ""
-}
diff --git a/vendor/github.com/vektah/gqlparser/v2/parser/schema_test.yml b/vendor/github.com/vektah/gqlparser/v2/parser/schema_test.yml
deleted file mode 100644
index 8b6a5d0ca3..0000000000
--- a/vendor/github.com/vektah/gqlparser/v2/parser/schema_test.yml
+++ /dev/null
@@ -1,646 +0,0 @@
-object types:
- - name: simple
- input: |
- type Hello {
- world: String
- }
- ast: |
-
- Definitions: [Definition]
- -
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Fields: [FieldDefinition]
- -
- Name: "world"
- Type: String
-
- - name: with description
- input: |
- "Description"
- type Hello {
- world: String
- }
- ast: |
-
- Definitions: [Definition]
- -
- Kind: DefinitionKind("OBJECT")
- Description: "Description"
- Name: "Hello"
- Fields: [FieldDefinition]
- -
- Name: "world"
- Type: String
-
- - name: with block description
- input: |
- """
- Description
- """
- # Even with comments between them
- type Hello {
- world: String
- }
- ast: |
-
- Definitions: [Definition]
- -
- Kind: DefinitionKind("OBJECT")
- Description: "Description"
- Name: "Hello"
- Fields: [FieldDefinition]
- -
- Name: "world"
- Type: String
- - name: with field arg
- input: |
- type Hello {
- world(flag: Boolean): String
- }
- ast: |
-
- Definitions: [Definition]
- -
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Fields: [FieldDefinition]
- -
- Name: "world"
- Arguments: [ArgumentDefinition]
- -
- Name: "flag"
- Type: Boolean
- Type: String
-
- - name: with field arg and default value
- input: |
- type Hello {
- world(flag: Boolean = true): String
- }
- ast: |
-
- Definitions: [Definition]
- -
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Fields: [FieldDefinition]
- -
- Name: "world"
- Arguments: [ArgumentDefinition]
- -
- Name: "flag"
- DefaultValue: true
- Type: Boolean
- Type: String
-
- - name: with field list arg
- input: |
- type Hello {
- world(things: [String]): String
- }
- ast: |
-
- Definitions: [Definition]
- -
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Fields: [FieldDefinition]
- -
- Name: "world"
- Arguments: [ArgumentDefinition]
- -
- Name: "things"
- Type: [String]
- Type: String
-
- - name: with two args
- input: |
- type Hello {
- world(argOne: Boolean, argTwo: Int): String
- }
- ast: |
-
- Definitions: [Definition]
- -
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Fields: [FieldDefinition]
- -
- Name: "world"
- Arguments: [ArgumentDefinition]
- -
- Name: "argOne"
- Type: Boolean
- -
- Name: "argTwo"
- Type: Int
- Type: String
- - name: must define one or more fields
- input: |
- type Hello {}
- error:
- message: "expected at least one definition, found }"
- locations: [{ line: 1, column: 13 }]
-
-type extensions:
- - name: Object extension
- input: |
- extend type Hello {
- world: String
- }
- ast: |
-
- Extensions: [Definition]
- -
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Fields: [FieldDefinition]
- -
- Name: "world"
- Type: String
-
- - name: without any fields
- input: "extend type Hello implements Greeting"
- ast: |
-
- Extensions: [Definition]
- -
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Interfaces: [string]
- - "Greeting"
-
- - name: without fields twice
- input: |
- extend type Hello implements Greeting
- extend type Hello implements SecondGreeting
- ast: |
-
- Extensions: [Definition]
- -
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Interfaces: [string]
- - "Greeting"
- -
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Interfaces: [string]
- - "SecondGreeting"
-
- - name: without anything errors
- input: "extend type Hello"
- error:
- message: "Unexpected "
- locations: [{ line: 1, column: 18 }]
-
- - name: can have descriptions # hmm, this might not be spec compliant...
- input: |
- "Description"
- extend type Hello {
- world: String
- }
- error:
- message: 'Unexpected String "Description"'
- locations: [{ line: 1, column: 2 }]
-
- - name: can not have descriptions on types
- input: |
- extend "Description" type Hello {
- world: String
- }
- error:
- message: Unexpected String "Description"
- locations: [{ line: 1, column: 9 }]
-
- - name: all can have directives
- input: |
- extend scalar Foo @deprecated
- extend type Foo @deprecated
- extend interface Foo @deprecated
- extend union Foo @deprecated
- extend enum Foo @deprecated
- extend input Foo @deprecated
- ast: |
-
- Extensions: [Definition]
- -
- Kind: DefinitionKind("SCALAR")
- Name: "Foo"
- Directives: [Directive]
- -
- Name: "deprecated"
- -
- Kind: DefinitionKind("OBJECT")
- Name: "Foo"
- Directives: [Directive]
- -
- Name: "deprecated"
- -
- Kind: DefinitionKind("INTERFACE")
- Name: "Foo"
- Directives: [Directive]
- -
- Name: "deprecated"
- -
- Kind: DefinitionKind("UNION")
- Name: "Foo"
- Directives: [Directive]
- -
- Name: "deprecated"
- -
- Kind: DefinitionKind("ENUM")
- Name: "Foo"
- Directives: [Directive]
- -
- Name: "deprecated"
- -
- Kind: DefinitionKind("INPUT_OBJECT")
- Name: "Foo"
- Directives: [Directive]
- -
- Name: "deprecated"
-
-schema definition:
- - name: simple
- input: |
- schema {
- query: Query
- }
- ast: |
-
- Schema: [SchemaDefinition]
- -
- OperationTypes: [OperationTypeDefinition]
- -
- Operation: Operation("query")
- Type: "Query"
-
-schema extensions:
- - name: simple
- input: |
- extend schema {
- mutation: Mutation
- }
- ast: |
-
- SchemaExtension: [SchemaDefinition]
- -
- OperationTypes: [OperationTypeDefinition]
- -
- Operation: Operation("mutation")
- Type: "Mutation"
-
- - name: directive only
- input: "extend schema @directive"
- ast: |
-
- SchemaExtension: [SchemaDefinition]
- -
- Directives: [Directive]
- -
- Name: "directive"
-
- - name: without anything errors
- input: "extend schema"
- error:
- message: "Unexpected "
- locations: [{ line: 1, column: 14}]
-
-inheritance:
- - name: single
- input: "type Hello implements World { field: String }"
- ast: |
-
- Definitions: [Definition]
- -
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Interfaces: [string]
- - "World"
- Fields: [FieldDefinition]
- -
- Name: "field"
- Type: String
-
- - name: multi
- input: "type Hello implements Wo & rld { field: String }"
- ast: |
-
- Definitions: [Definition]
- -
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Interfaces: [string]
- - "Wo"
- - "rld"
- Fields: [FieldDefinition]
- -
- Name: "field"
- Type: String
-
- - name: multi with leading amp
- input: "type Hello implements & Wo & rld { field: String }"
- ast: |
-